From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web11.4616.1687171090365742771 for ; Mon, 19 Jun 2023 03:38:10 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=n1RNULb3; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: zhiguang.liu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687171090; x=1718707090; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=48/yuuuQbki/BSn4GPYweFXUkcuq/DXAOPiTbI/JwUE=; b=n1RNULb3VZ1UDM1wgGTP+jmbeuUcuQPmBnMRwzrH2y/0gsbax7ppKvNG KeYA9aUQqfFBY5v5XFbEbM7biw8DWKUvLklnfdX4OBVxcEjh7/Rg6JfTk qZ+iUoheS2urtfosnOe5/TLB+lDhFexTWQ5jjdflIqPI+HjfOlnsnXfcb 2yNqV5LqBLJdpVIwYwGUQxXfhfOtcLXRpq88u5wv7XiM7w12uhGiCG2Mv utdbxaYpeaaPex7TnBRCfhN0MOiIRzrwMf0g1iOLSnReDqsUb2rKHdmMm sI5zOP4m1t7drEhQIqxncdJswGep74dbqjwErIxH/huLKRoJgwDPYOP3j g==; X-IronPort-AV: E=McAfee;i="6600,9927,10745"; a="363023255" X-IronPort-AV: E=Sophos;i="6.00,254,1681196400"; d="scan'208";a="363023255" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2023 03:38:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10745"; a="858189924" X-IronPort-AV: E=Sophos;i="6.00,254,1681196400"; d="scan'208";a="858189924" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga001.fm.intel.com with ESMTP; 19 Jun 2023 03:38:09 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 19 Jun 2023 03:38:08 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Mon, 19 Jun 2023 03:38:08 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.177) 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.2507.23; Mon, 19 Jun 2023 03:38:08 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z/+zeYgGI2Sli5DMjGob0dpFZ7TyptyzxUSc/Weo3Q0EZTaE9btxvJauWUrct9XRWo0yPBTRohpV9sy5JO0YvdGKfbVGh4WvKOAZqlfmeM3QeR6ReQT9L93iEtf5tupBCC3RMw9aajnXmMGs6U48ccelx4Dco1WBHdeiOjtESYNiD0yrup6vioy8bF4r2YPcaEwNiZRXCF8n5I0AqpHCna7rwlns9O37ylVw12j1kx8xFZcMIEpWiPfJh09GVp5j9adJ9bOYpwy3hSyJmRI+DyszIUDTCEF34WTudaIZ1jxlU6qIFUgvJ7Vy8lHwFowp+U2Vx1HtnGpfvTWvfZJCxg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+uOHpJ0YY+IVij39jD9AVtv8NrjdIAVYuWd5yykryys=; b=eP37pGufHp5IPJgjPFzeeEZ0Q4q1adDd6Z3dhyGqr5PjrM6AV6Ml8mQQtwTWW2oyvcW+5eQUvhCmhpPX9lWSJJ2giSSiF2cfddFCJTTz9TzdzK+IrSJZI36dpCh4PtflTIaVj5Z43n7EQDiLXoqzQXF9PIIf7lBCc+Yl+BGJ6TlFNMj/Q3h7+FjmLzjL9eKnrXdjhND3KfWqLt44WpLLFWgKzwbQwC7foxRk+0Dr9WOSSbd54K+MWbwYZTCYJeO9GaH6Tylp+AS59ZluHv2OfzIJa2xQbDA9QnD3eXNt35guq5SLiQqxmPSj7SkWvHRhc7AJW4XN00ESHfk82i7pXw== 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 Received: from PH0PR11MB5048.namprd11.prod.outlook.com (2603:10b6:510:3d::14) by DM4PR11MB7206.namprd11.prod.outlook.com (2603:10b6:8:112::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.36; Mon, 19 Jun 2023 10:38:06 +0000 Received: from PH0PR11MB5048.namprd11.prod.outlook.com ([fe80::b0d6:8241:68f9:6092]) by PH0PR11MB5048.namprd11.prod.outlook.com ([fe80::b0d6:8241:68f9:6092%7]) with mapi id 15.20.6500.036; Mon, 19 Jun 2023 10:38:06 +0000 From: "Zhiguang Liu" To: "devel@edk2.groups.io" , "Ni, Ray" CC: "Dong, Eric" , "Kumar, Rahul R" , Gerd Hoffmann Subject: Re: [edk2-devel] [PATCH 2/3] UefiCpuPkg/ResetVector: Add guidance of how to guarantee 16B align Thread-Topic: [edk2-devel] [PATCH 2/3] UefiCpuPkg/ResetVector: Add guidance of how to guarantee 16B align Thread-Index: AQHZn3dZyGf0ZhZ5pUKXvZ9IqUV6RK+R9IVw Date: Mon, 19 Jun 2023 10:38:06 +0000 Message-ID: References: <20230615105057.297-1-ray.ni@intel.com> <20230615105057.297-3-ray.ni@intel.com> In-Reply-To: <20230615105057.297-3-ray.ni@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH0PR11MB5048:EE_|DM4PR11MB7206:EE_ x-ms-office365-filtering-correlation-id: e0b768d9-c93e-49b5-7d01-08db70b14460 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: RESUcDXxlffXn3uctFJGv7wv7aRj/890kdP/FRmOGu/z/ve2DbulkjNRzg3geajp4rCwIdLX0fXAwHgfWxJaj+4QBah1pvCn/DleGhvEZJtKeOxAW2/38WTtOePJsNKdNeTFjdXobCRcDrG3yKSBAo3pGn8fA7UJFMa5cY8oa7dTdY0EQICgUJZNnUqABpUjB1RbqSCJ1/VIQpY5Uc5lxi/B/bkxQZ9pY3x8A/usLGl8/NuXNn7xcfSQPJTLw5wcp4pay7JrgoCKnJejtbKAsnUbUUsGbcnpGr8lhAtrpICqKniz9qECQ4hKPLbAXjrzq4376EaHhww2+5H8J1huq45uORWw81MBZlFDBGoAmE4el5owNnS6wrDdAaBGq/0Nx4U6O5N+GINcwrXvx5C4NKmzP1R7X2ABRIKV42TEOtbQQ5i6IDsUtxIbVxEl0CYC2zGgrOe1kejpUwnUs+yHXinloeOW69VRUW6LqRvHQS/Bmh3iEIwAlXgyb3Zg3hihDalO/IsdAXgEMjIGtg8HwJLYSEmB9RbThstt4aOy4Xhf825/PvjImdFmWxaxYKQvm3v3dPhtiMRQHb42SCAd4sI4ztKhemRdKD68tKssA7fQq8uxLvwwn6Mlh9FTrkn4HnbM5qqCAO0sN250wg0Luw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5048.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(346002)(396003)(136003)(376002)(39860400002)(451199021)(4326008)(54906003)(71200400001)(478600001)(76116006)(6636002)(110136005)(7696005)(19627235002)(6506007)(53546011)(9686003)(26005)(186003)(966005)(55016003)(2906002)(8676002)(8936002)(38070700005)(41300700001)(66946007)(66446008)(64756008)(66556008)(66476007)(316002)(5660300002)(66899021)(52536014)(83380400001)(38100700002)(33656002)(86362001)(122000001)(82960400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?9g2fs5AY/eaHKCQdqqBrmPfC0uRp4gtD0yuIFTjb6xucX+s+dTZV60VOLFu2?= =?us-ascii?Q?mixodhq1EeBRm70Gzm3VhKnqzxhj2PBUbnJ66gCZ1FpNQicz/Od4/irbiytw?= =?us-ascii?Q?y35Nv1L0wuSSHHNcxxdr4x98NcVkCxhxrMJXx492k0vpTahqlsDprE1CRML4?= =?us-ascii?Q?qg08ba2TFsS4oYzx4jCwYbiZIkRv2TjPFPhLqh/dZHoaXGArEf6nL+S8tuHf?= =?us-ascii?Q?vI64+UjkAGny8AZKS0siwgMYh3doVGr8LaX4Wa2YnjHFM9Fj6bacT1rd7NlE?= =?us-ascii?Q?DQy3zOhF6IqImZKii3hZOL4bgQRWXrKN3w2uXcGAt/fwbnDwkEXfzveX5uDj?= =?us-ascii?Q?xs53Y4ASGE9D6OqeYbEDEwDtlqrqpsBoYqSc6ia0icit9+nVWGC4SSQH2hv7?= =?us-ascii?Q?ttBSxlw326eI+q8IEwbIjUGHHt5ejD7UreHvjzs0cPuCyux+IPlgvOqca+6Z?= =?us-ascii?Q?wnZhnrLkX+Qjkt0EKBhdurZPfxiKhmtIY84w506cVVpebdhfIqQlCs3WNDms?= =?us-ascii?Q?sVcikepF8VnbPVf3zLXGwl4CmyB6U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?Q?QAXQ1DrMa82ia88ZddFu9elK6jG1Xd/t9Ld3Mj+VKgZyy/9sO3RdLSlczAVC?= =?us-ascii?Q?Ots5ggW+0UtHj3WswXgU83GnfZ49tQdko44Os0XU7mdFvS+k69xFyg2EwdE6?= =?us-ascii?Q?nFZzHpcOIfVqOSbf4eS4RvBjneFhKbFwqCvCKLSv?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5048.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0b768d9-c93e-49b5-7d01-08db70b14460 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jun 2023 10:38:06.1404 (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: FXPotOM4/AhwJ/bRz+j8zTXs68nNLEFyT1T2+Si51MJPWHML8/btXkDnyGC//ZSmYyoehuW67mRSQ6q+8QLbCg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB7206 Return-Path: zhiguang.liu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Ray, I don't think we need the 16 bytes align for reset vector. Because the size of reset vector is 16 bytes align, and it will be put in t= he end of FD, this mean the beginning address of the reset vector is (4G - = size of reset vector), which is 16 bytes align. Thanks Zhiguang > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Ni, Ray > Sent: Thursday, June 15, 2023 6:51 PM > To: devel@edk2.groups.io > Cc: Dong, Eric ; Kumar, Rahul R > ; Gerd Hoffmann > Subject: [edk2-devel] [PATCH 2/3] UefiCpuPkg/ResetVector: Add guidance > of how to guarantee 16B align >=20 > ResetVector assembly implementation puts "ALIGN 16" in the end > to guarantee the final executable file size is multiple of 16 bytes. > Because the module uses a special GUID which guarantees it's put in > the very end of a FV, which should be also the end of the FD. > Then to make sure the reset vector "JMP" code is at FFFF_FFF0h, the > ResetVector has to be aligned at 16-byte boundary. >=20 > The patch updates INF file and ReadMe.txt to add guidance how to make > sure the module is aligned on 16-byte boundary. >=20 > Signed-off-by: Ray Ni > Cc: Eric Dong > Cc: Rahul Kumar > Cc: Gerd Hoffmann > --- > UefiCpuPkg/ResetVector/Vtf0/ReadMe.txt | 27 +++++++------------------- > UefiCpuPkg/ResetVector/Vtf0/Vtf0.inf | 19 +++++++++++++++++- > 2 files changed, 25 insertions(+), 21 deletions(-) >=20 > diff --git a/UefiCpuPkg/ResetVector/Vtf0/ReadMe.txt > b/UefiCpuPkg/ResetVector/Vtf0/ReadMe.txt > index 97f4600968..edeb2d6d3e 100644 > --- a/UefiCpuPkg/ResetVector/Vtf0/ReadMe.txt > +++ b/UefiCpuPkg/ResetVector/Vtf0/ReadMe.txt > @@ -1,15 +1,16 @@ >=20 >=20 > =3D=3D=3D HOW TO USE VTF0 =3D=3D=3D >=20 > +Add this line to your DSC [Components.IA32] or [Components.X64] section: >=20 > + UefiCpuPkg/ResetVector/Vtf0/ResetVector.inf >=20 >=20 >=20 > Add this line to your FDF FV section: >=20 > -INF RuleOverride=3DRESET_VECTOR USE =3D IA32 > UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.inf >=20 > -(For X64 SEC/PEI change IA32 to X64 =3D> 'USE =3D X64') >=20 > + INF RuleOverride=3DRESET_VECTOR > UefiCpuPkg/ResetVector/Vtf0/ResetVector.inf >=20 >=20 >=20 > In your FDF FFS file rules sections add: >=20 > -[Rule.Common.SEC.RESET_VECTOR] >=20 > - FILE RAW =3D $(NAMED_GUID) { >=20 > - RAW RAW |.raw >=20 > - } >=20 > + [Rule.Common.SEC.RESET_VECTOR] >=20 > + FILE RAW =3D $(NAMED_GUID) { >=20 > + RAW BIN Align =3D 16 |.bin >=20 > + } >=20 >=20 >=20 > =3D=3D=3D VTF0 Boot Flow =3D=3D=3D >=20 >=20 >=20 > @@ -25,17 +26,3 @@ All inputs to SEC image are register based: > EAX/RAX - Initial value of the EAX register (BIST: Built-in Self Test) >=20 > DI - 'BP': boot-strap processor, or 'AP': application processor >=20 > EBP/RBP - Pointer to the start of the Boot Firmware Volume >=20 > - >=20 > -=3D=3D=3D HOW TO BUILD VTF0 =3D=3D=3D >=20 > - >=20 > -Dependencies: >=20 > -* Python 3 or newer >=20 > -* Nasm 2.03 or newer >=20 > - >=20 > -To rebuild the VTF0 binaries: >=20 > -1. Change to VTF0 source dir: UefiCpuPkg/ResetVector/Vtf0 >=20 > -2. nasm and python should be in executable path >=20 > -3. Run this command: >=20 > - python Build.py >=20 > -4. Binaries output will be in UefiCpuPkg/ResetVector/Vtf0/Bin >=20 > - >=20 > diff --git a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.inf > b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.inf > index 9922cb2755..28185a6e60 100644 > --- a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.inf > +++ b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.inf > @@ -1,7 +1,24 @@ > ## @file >=20 > # Reset Vector >=20 > # >=20 > -# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved. >=20 > +# Note: >=20 > +# The platform FDF file MUST guarantee the ResetVector is aligned >=20 > +# on 16-byte boundary. Otherwise, the CPU reset vector will NOT be >=20 > +# at FFFF_FFF0h. >=20 > +# >=20 > +# A sample FDF build rule could be as follows: >=20 > +# >=20 > +# [Rule.Common.SEC.RESET_VECTOR] >=20 > +# FILE RAW =3D $(NAMED_GUID) { >=20 > +# RAW BIN Align =3D 16 |.bin >=20 > +# } >=20 > +# >=20 > +# Following line in FDF forces to use the above build rule for the > ResetVector: >=20 > +# >=20 > +# INF RuleOverride=3DRESET_VECTOR > UefiCpuPkg/ResetVector/Vtf0/Vtf0.inf >=20 > +# >=20 > +# >=20 > +# Copyright (c) 2006 - 2023, Intel Corporation. All rights reserved. >=20 > # >=20 > # SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > # >=20 > -- > 2.39.1.windows.1 >=20 >=20 >=20 > -=3D-=3D-=3D-=3D-=3D-=3D > Groups.io Links: You receive all messages sent to this group. > View/Reply Online (#106112): > https://edk2.groups.io/g/devel/message/106112 > Mute This Topic: https://groups.io/mt/99546049/1779286 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: > https://edk2.groups.io/g/devel/leave/3883862/1779286/1021340322/xyzzy > [zhiguang.liu@intel.com] > -=3D-=3D-=3D-=3D-=3D-=3D >=20