From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web08.2407.1620180646991531664 for ; Tue, 04 May 2021 19:10:47 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=Z87n2upD; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: jiewen.yao@intel.com) IronPort-SDR: /8yNbGcyRShsyUlQqCT2qc+enBKcTGrnOpSwLn8gHmvyCUh3egm9iT6lDYZiccbwGpcxI9G7AX iyc05xkc1F2w== X-IronPort-AV: E=McAfee;i="6200,9189,9974"; a="185248673" X-IronPort-AV: E=Sophos;i="5.82,273,1613462400"; d="scan'208";a="185248673" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 May 2021 19:10:45 -0700 IronPort-SDR: JEGUesnZloK99SVTX4UxRegu39ZPw3whWUQiLHqS268pTotm1mpo5Z/zYy11kggLDFH6wS7hD7 44SzI48AYocw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,273,1613462400"; d="scan'208";a="406366247" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by orsmga002.jf.intel.com with ESMTP; 04 May 2021 19:10:44 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 4 May 2021 19:10:44 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 4 May 2021 19:10:43 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Tue, 4 May 2021 19:10:43 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.104) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Tue, 4 May 2021 19:10:42 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y2mM5H/TKxRk9yMabl70lga3HKvxP4WYzFfkvdtFkKJmorCuUUMDkYDZSUdH0sUZ9oMiEIy0axow87kbYpRsx9mMmD/iRhGyNfVbvFO0w+3VGqwSX0GSYPSJDbyGX+Lw2D5JxXl3tFMuGHwJOToYyXd3XLMNhcjsQO/RZkbxY7mfhYpNngKk3RtE3iJxCFPzEYvGi7hKAHbXLmEJuQd1/7r6Jg5JdU8x7/4l0eubohQ/gEoUGmvn6UlcV31HcIA/sKr6sj1KO8xf7a3Pi/Rv+wGXbmXPMC7LhCGy16bn/45kUiD5+CXuQvEsrOXMYSA8u1c7JDf9TnCcPIzhh9LM/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BZE9C6x9dNzy5wp8oTscayquOxdY1jf+wkbaOtgMbpM=; b=EZX+FGJgUYvpQV/e6HsqVMKGuE9G4fcM08ZP6xKT9PvD1lPHmN45MuZ+oloHVfa3me8CWSsJxfhRcN/vGaNlXA9kDuWbUTCofSL++A22kq7d/udzv9LcQ2YfoNgTLC3aj47Oh2YDizjeDJky6hjX//hxJq4b+JYY1SIJ7iCgcByCAwi9NTBCSlqrCjxM5v1J8iatnI8wVZOBpOq09ApmmDvJcZQ3HR7od4KnvDkupi4+W5oabpzsMyYYpd0wvNJhkQJL6gE2USadn3wD6/aMki9HtCHE96LnA3Nf5NFHHW3klGzwoW2UH0ltY8Ukx3IShNNFPz9pXVXbVN882CHzdg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BZE9C6x9dNzy5wp8oTscayquOxdY1jf+wkbaOtgMbpM=; b=Z87n2upD2RllrNj8ULPc4xsMz2BopCkCnqyGfWFSVk4Na7sY/ubNn5n/FY76VHmdaIqONkWo8iiGekCS+cjyecQoHnXeVFTfkhlZykjF0YwL8V0DZ8zYQqBDaSdXlYEKr3Etewjr1IUyzNZAzz34h3SaJzJRDS+I0ndNJSrGIr8= Received: from PH0PR11MB4885.namprd11.prod.outlook.com (2603:10b6:510:35::14) by PH0PR11MB4933.namprd11.prod.outlook.com (2603:10b6:510:33::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.42; Wed, 5 May 2021 02:10:41 +0000 Received: from PH0PR11MB4885.namprd11.prod.outlook.com ([fe80::4cf8:ac8:a6fd:d386]) by PH0PR11MB4885.namprd11.prod.outlook.com ([fe80::4cf8:ac8:a6fd:d386%7]) with mapi id 15.20.4087.044; Wed, 5 May 2021 02:10:41 +0000 From: "Yao, Jiewen" To: "devel@edk2.groups.io" , "etienne.carriere@linaro.org" CC: Achin Gupta , Ard Biesheuvel , Leif Lindholm , Sami Mujawar , Sughosh Ganu Subject: Re: [edk2-devel] [PATCH 4/5] StandaloneMmPkg: fix pointer/int casts against 32bit architectures Thread-Topic: [edk2-devel] [PATCH 4/5] StandaloneMmPkg: fix pointer/int casts against 32bit architectures Thread-Index: AQHXQPkfScSMkKrDJkOaUBSuKuFjTqrUJYBg Date: Wed, 5 May 2021 02:10:41 +0000 Message-ID: References: <20210504152048.8739-1-etienne.carriere@linaro.org> <20210504152048.8739-5-etienne.carriere@linaro.org> In-Reply-To: <20210504152048.8739-5-etienne.carriere@linaro.org> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.210] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 3fc43e89-d35e-4d8f-034d-08d90f6afbd1 x-ms-traffictypediagnostic: PH0PR11MB4933: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: uj/QtrvnE7G4WxXJDCmrc+2Bm06Rgk7cEz2rBuWtOuB0W397o+ZvrzWxBWjmZ6LxU/A2cE4QrJOXLBgWI3upMW6rW5H2ZGYCG24K9RebVB1rm7sZ4Wrr7Lm8sDL6c9rw0HPVtcbm1gHp9lc1M5yJmq16GngB0Ytodc/eev3jFzoa9JPOmKI7y7Pj8KsG6bzjfKhH+6qU4Hc46rZQp8jXBg5S3j8yWaenOHtDSikV8PO3m4P/P/+3LlF+AFq965u0RlYqkhB2UJLT3qGBARczXv07GtJvFDxI7F/MSFMPcr+w29LImZEdnhvGU9QjwC1nijureAjx1zUD5mo+PWNtHFcaFtjGbWvYviRQwKkJMlNC5mctSNnOs+Q+S1t1eEt8KPmwXnE7hABgHaLwiFyh2s+T4EqXkLu8tOho4yJYy2/STLOXjVDYFpX8CrgbRXh/KLThdWbbYhMFziVl3JTRzE2tMihw9Uysou0WVe3YqvIWP9ozKmZ90pnisPklE1YBtZdh99RzIXjBt/f0x35yKcqJIlFF87XFFNSDzd4/hYdCHxLOEl6Let+twBCI6TpE1M/sabB8R7hBZeaHxst5VAp0B2hF3NO6UlH01FrYvcEO/C/jnfWcfvIlObaU6to2YxrZhQFFK9X1AyedWmh5a/tWKg7WJ3j4vo2WTtkN5U3BGAXoPc2DXyuEazxvtuiC x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB4885.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(6029001)(346002)(366004)(376002)(136003)(39860400002)(396003)(26005)(6506007)(66946007)(66556008)(316002)(966005)(52536014)(53546011)(86362001)(4326008)(33656002)(7696005)(71200400001)(5660300002)(110136005)(2906002)(76116006)(66476007)(478600001)(8676002)(83380400001)(54906003)(186003)(38100700002)(8936002)(122000001)(64756008)(66446008)(55016002)(9686003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?wpJsEiB8NFDgXPLNBGyJJMCxziErpvil5Z+MpzG9Ugmo2NItivvIjQYlYSqQ?= =?us-ascii?Q?Qpdz1BzZvt7WGYlvXcO5jjU+uwIJKh3tvCTpuPqt0QsVfnZLPnSvrxbRBovQ?= =?us-ascii?Q?SXKxOvTgvCeGLYWFq0OGShWl2QHx9gHdKi4CN/SRJAS90vpnKAiNPq1luUOx?= =?us-ascii?Q?MWSsKkW8v8eszHyyfbn4ciG4HwyqT+Vhy8HRW8c/FsHFrBUPCMrRRf94FTig?= =?us-ascii?Q?ugMc28zY00q2ODUBONr1KYVyNG1tsfWItaGSImTnd8WYKw6iCtcVbRIcJTuC?= =?us-ascii?Q?Q6aYCf4GCvcL5BUyMZBmW419elXLlEnzo3mXmz6CrWWF0pSh6W6yv+KYkfN7?= =?us-ascii?Q?gzJ4tQnTLTt6VfCm0pPpr5KMILMSXsKMLrvN2nKm6/r5qEPZZFqE+xg7q2mH?= =?us-ascii?Q?B9IhYNxSOjfQGnTWE6+2+OsSD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JvDwWQi8d+wMS/RK0CfK86Tq?= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB4885.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3fc43e89-d35e-4d8f-034d-08d90f6afbd1 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 May 2021 02:10:41.3990 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0SzbACj7hfXVZDiOdANDMW4/88WeDQ7ZyHKItHhMz6NVCuy1HfeLSafF3K32Mr/beh7rEAcg7N058dyGWcE0xw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4933 Return-Path: jiewen.yao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Acked-by: Jiewen Yao Need ARM expert to comment if it is OK to refer AArch64 for ARM? Thank you Yao Jiewen > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Etienne > Carriere > Sent: Tuesday, May 4, 2021 11:21 PM > To: devel@edk2.groups.io > Cc: Achin Gupta ; Ard Biesheuvel > ; Yao, Jiewen ; Leif > Lindholm ; Sami Mujawar ; > Sughosh Ganu ; Etienne Carriere > > Subject: [edk2-devel] [PATCH 4/5] StandaloneMmPkg: fix pointer/int casts > against 32bit architectures >=20 > Use intermediate (UINTN) cast when casting int from/to pointer. This > is needed as UINT64 values cast from/to 32bit pointer for 32bit > architectures. >=20 > Cc: Achin Gupta > Cc: Ard Biesheuvel > Cc: Jiewen Yao > Cc: Leif Lindholm > Cc: Sami Mujawar > Cc: Sughosh Ganu > Signed-off-by: Etienne Carriere > --- > StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.c > | 8 ++++---- >=20 > StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/CreateHobL > ist.c | 14 +++++++------- >=20 > StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalone > MmCoreEntryPoint.c | 2 +- > 3 files changed, 12 insertions(+), 12 deletions(-) >=20 > diff --git > a/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.c > b/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.c > index 6884095c49..d4590bcd19 100644 > --- > a/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.c > +++ > b/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.c > @@ -164,8 +164,8 @@ StandaloneMmCpuInitialize ( >=20 > // Share the entry point of the CPU driver > DEBUG ((DEBUG_INFO, "Sharing Cpu Driver EP *0x%lx =3D 0x%lx\n", > - (UINT64) CpuDriverEntryPointDesc->ArmTfCpuDriverEpPtr, > - (UINT64) PiMmStandaloneArmTfCpuDriverEntry)); > + (UINTN) CpuDriverEntryPointDesc->ArmTfCpuDriverEpPtr, > + (UINTN) PiMmStandaloneArmTfCpuDriverEntry)); > *(CpuDriverEntryPointDesc->ArmTfCpuDriverEpPtr) =3D > PiMmStandaloneArmTfCpuDriverEntry; >=20 > // Find the descriptor that contains the whereabouts of the buffer fo= r > @@ -180,8 +180,8 @@ StandaloneMmCpuInitialize ( > return Status; > } >=20 > - DEBUG ((DEBUG_INFO, "mNsCommBuffer.PhysicalStart - 0x%lx\n", (UINT64) > NsCommBufMmramRange->PhysicalStart)); > - DEBUG ((DEBUG_INFO, "mNsCommBuffer.PhysicalSize - 0x%lx\n", (UINT64) > NsCommBufMmramRange->PhysicalSize)); > + DEBUG ((DEBUG_INFO, "mNsCommBuffer.PhysicalStart - 0x%lx\n", (UINTN) > NsCommBufMmramRange->PhysicalStart)); > + DEBUG ((DEBUG_INFO, "mNsCommBuffer.PhysicalSize - 0x%lx\n", (UINTN) > NsCommBufMmramRange->PhysicalSize)); >=20 > CopyMem (&mNsCommBuffer, NsCommBufMmramRange, > sizeof(EFI_MMRAM_DESCRIPTOR)); > DEBUG ((DEBUG_INFO, "mNsCommBuffer: 0x%016lx - 0x%lx\n", > mNsCommBuffer.CpuStart, mNsCommBuffer.PhysicalSize)); > diff --git > a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/CreateHo > bList.c > b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/CreateHo > bList.c > index e8fb96bd6e..4d4cf3d5ff 100644 > --- > a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/CreateHo > bList.c > +++ > b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/CreateHo > bList.c > @@ -72,14 +72,14 @@ CreateHobListFromBootInfo ( >=20 > // Create a hoblist with a PHIT and EOH > HobStart =3D HobConstructor ( > - (VOID *) PayloadBootInfo->SpMemBase, > + (VOID *) (UINTN) PayloadBootInfo->SpMemBase, > (UINTN) PayloadBootInfo->SpMemLimit - PayloadBootInfo- > >SpMemBase, > - (VOID *) PayloadBootInfo->SpHeapBase, > - (VOID *) (PayloadBootInfo->SpHeapBase + PayloadBootInfo- > >SpHeapSize) > + (VOID *) (UINTN) PayloadBootInfo->SpHeapBase, > + (VOID *) (UINTN) (PayloadBootInfo->SpHeapBase + PayloadB= ootInfo- > >SpHeapSize) > ); >=20 > // Check that the Hoblist starts at the bottom of the Heap > - ASSERT (HobStart =3D=3D (VOID *) PayloadBootInfo->SpHeapBase); > + ASSERT (HobStart =3D=3D (VOID *) (UINTN) PayloadBootInfo->SpHeapBase)= ; >=20 > // Build a Boot Firmware Volume HOB > BuildFvHob (PayloadBootInfo->SpImageBase, PayloadBootInfo->SpImageSiz= e); > @@ -190,9 +190,9 @@ CreateHobListFromBootInfo ( > MmramRanges[3].RegionState =3D EFI_CACHEABLE | EFI_ALLOCATED; >=20 > // Base and size of heap memory shared by all cpus > - MmramRanges[4].PhysicalStart =3D (EFI_PHYSICAL_ADDRESS) HobStart; > - MmramRanges[4].CpuStart =3D (EFI_PHYSICAL_ADDRESS) HobStart; > - MmramRanges[4].PhysicalSize =3D HobStart->EfiFreeMemoryBottom - > (EFI_PHYSICAL_ADDRESS) HobStart; > + MmramRanges[4].PhysicalStart =3D (EFI_PHYSICAL_ADDRESS) (UINTN) HobSt= art; > + MmramRanges[4].CpuStart =3D (EFI_PHYSICAL_ADDRESS) (UINTN) HobSt= art; > + MmramRanges[4].PhysicalSize =3D HobStart->EfiFreeMemoryBottom - > (EFI_PHYSICAL_ADDRESS) (UINTN) HobStart; > MmramRanges[4].RegionState =3D EFI_CACHEABLE | EFI_ALLOCATED; >=20 > // Base and size of heap memory shared by all cpus > diff --git > a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalon > eMmCoreEntryPoint.c > b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalon > eMmCoreEntryPoint.c > index 6c50f470aa..b445d6942e 100644 > --- > a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalon > eMmCoreEntryPoint.c > +++ > b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/AArch64/Standalon > eMmCoreEntryPoint.c > @@ -328,7 +328,7 @@ _ModuleEntryPoint ( >=20 > // Locate PE/COFF File information for the Standalone MM core module > Status =3D LocateStandaloneMmCorePeCoffData ( > - (EFI_FIRMWARE_VOLUME_HEADER *) PayloadBootInfo->SpImageBas= e, > + (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PayloadBootInfo- > >SpImageBase, > &TeData, > &TeDataSize > ); > -- > 2.17.1 >=20 >=20 >=20 >=20 >=20