From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web12.134.1591116107245543697 for ; Tue, 02 Jun 2020 09:41:47 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=M7B7Zc0f; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: deric.cole@intel.com) IronPort-SDR: GMIpqnIptiI8G9ICye9zyRWJm8CdMjkXXxroYMLwAjerCQIhRlVxm5W0IUaaUp/ecMU1nTWdxR 9+lAlsAXqysg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2020 09:41:46 -0700 IronPort-SDR: rtjEwC+qOxXhhlg/hGuaXUHWGwsTrHd6o8SqGsndg7gdcWL3zeZrRYOTsyuMtWZhUaG+U+s4T+ aoUXUQO5txVw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,465,1583222400"; d="scan'208";a="470730496" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga006.fm.intel.com with ESMTP; 02 Jun 2020 09:41:45 -0700 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 2 Jun 2020 09:41:44 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 2 Jun 2020 09:41:44 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.172) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 2 Jun 2020 09:41:44 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UqM/DaIJ5gx85HZR9Ba1RbAjHOVWlrvGkc7HLemoa1mHOMpw5Ch21cqviUmXj9rPZvlBI1E0KzQCYaQMLr2U70yM5ZiGvu4BDQKxDGQqLHgs7CASPLjSX4S5G3OIZG+Z3WMmZAZOQD6z/Nd9+5yLmuOvhIaEcIIQHxV/2Gz8g7D7feoRvhJiDf6HGdEP3j45Qprk4/hZt9pwYV5bdm7VPgkECHXM7VZfcq2KdXtKTSXrYtYDmxGdPy6xXHT19b7+2DmaYnvZ7ZE9bsRe31SJSlpZ0MpIk3L172/lkJW0CJ9v9iM9IrOrGLhvcjHGkgZ73bzeSzuID9WnkxY0QJ4/gA== 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=91mp+LLYu77+Lu4UeQ+EY78WGSmAJH3enY8DODNQWPo=; b=nJiGf+LC8seUoJsemE8eyk85kB1EArj5N1tVYG2+WxNl9XJlIDAHL0nRT2yp08JqSRO8dhLPe9QIZm1CF4KXZnQSV1I2p8BqWjT1zzTOLOvxglBt79GusJVHaY4wXbSUWXquTmK+PerT6x/wlvyD0JaAdyGoDByAE01wmZjfr3WwHRgWbS/lMV5Mr5izZFrbsDhPg4+NA67n2pBHuPKQUV7CTDz1BH0f/KMiQ2sFYjxh/rZp1o5XDVnaizrBtWFpblhOUn4pNXl12jBR/VPvkCfyhXGAb+9vvu8fwTqFWH5ExnkQKqgbCkTHh6bUnG6vrouTgA+H7GFBawPRGsoNsA== 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=91mp+LLYu77+Lu4UeQ+EY78WGSmAJH3enY8DODNQWPo=; b=M7B7Zc0fhBw91LSPtqBnRCx5OdGr8Ff4NNuYNU5jZIPaIMETEvW+3rrCvwvCGgUz9nyHCJKhk3Ep01kPJ3MkdT4XebR72WbfqcWVmZ7fsKVwnBfWJa7cS/BTTMFTxqkRgdJdn4T413gKl9D4JYrnKhSq0nNXxnLjUxQKi1swZKA= Received: from MW3PR11MB4618.namprd11.prod.outlook.com (2603:10b6:303:5f::9) by MW3PR11MB4747.namprd11.prod.outlook.com (2603:10b6:303:2f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.19; Tue, 2 Jun 2020 16:41:43 +0000 Received: from MW3PR11MB4618.namprd11.prod.outlook.com ([fe80::19bc:95a1:75ef:2a6e]) by MW3PR11MB4618.namprd11.prod.outlook.com ([fe80::19bc:95a1:75ef:2a6e%9]) with mapi id 15.20.3045.024; Tue, 2 Jun 2020 16:41:43 +0000 From: "Cole, Deric" To: "Ni, Ray" , "devel@edk2.groups.io" CC: "Dong, Eric" , Laszlo Ersek Subject: Re: [PATCH] UefiCpuPkg/SecCore: Add pre-memory AP vector Thread-Topic: [PATCH] UefiCpuPkg/SecCore: Add pre-memory AP vector Thread-Index: AQHWOGSbFzTuqHke20y3IG+6R1N8JajEwgQAgAC8qTA= Date: Tue, 2 Jun 2020 16:41:43 +0000 Message-ID: References: <20200601223225.1925-1-deric.cole@intel.com> <734D49CCEBEEF84792F5B80ED585239D5C596480@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5C596480@SHSMSX104.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [76.105.225.74] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: adca086e-521b-47d8-3f39-08d80713d545 x-ms-traffictypediagnostic: MW3PR11MB4747: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 0422860ED4 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ROhVOM50L4e5sHS3xT536LjVN4F/L3h7AKW7osjFVTf4/Y4fSj+hfYu5KDH9mtKfmQ9pP/3H/HjCX6UrVtooSf9Uhff7v82A3icaKjDR/Uazwlt/U8QyJBoVuOitRl91ziXcFieeZk4tLhGp8HSeQmm1kbqY9sgytFq2y7SZrbuB4ebt56Q/46vk0eCiNyrXs32RoieFRVGQQ1NJxIwyhp9JZhoxmYvPhgMjm/KPUHVMbCLf4sLElyEAeJsafG3+pEjdB8t7FZYw5U3HsAAHH95igd8sVipOtf5JIZHqcogFOefQKO+ID079teOLg34WtFOGQTT76pEI4HtExz4XhkERuaZ6BXgF7CNrqRLEjg+iU6enOa6FebQiPs2YDbvOi9p0L+HXXzHr3euNnbGeKg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW3PR11MB4618.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(136003)(366004)(39860400002)(396003)(376002)(346002)(55016002)(316002)(8936002)(7696005)(2906002)(83380400001)(110136005)(9686003)(8676002)(52536014)(478600001)(54906003)(6506007)(33656002)(66446008)(53546011)(66946007)(76116006)(4326008)(66556008)(66476007)(5660300002)(64756008)(86362001)(26005)(71200400001)(186003)(19627235002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: 5kAh4PjbaWPEudL1NPOgjk1PNsdUbebx4fW7D6YwW5wP7gv8D3GikbxVdguDXbSqLCmb4wLwMSUXTNqACe3Kcn5/GXtKb1/XZla0fF4TP7xLToqz3542JiIL8hJ5l20gf0m5/YiakoLMvK1h03QqxAoebkIfJqXYkTpcTjBEPjWn1dLZMLZRIQQxqvc3nKp91ebFKa56XUWr0BrJ0xEYTnPHkc1mOfDeevNR160gCDFb1Gxtcm1gDtIk3EjsyZlGqeAfH57oc6PVwYzKQQpmHPyofgSgXXqZoCiWPA2GyW9eLjNLrpxjZHk54UBxnIzfRXxEBK39Sa4lMIhjsnNrCvEK5n/KbhtBJSwS2q9fuMnSecrzjEdUIIjihM8Fs1wrJaWITlLDyYlio+RWzOAX0rVlN+WJBq/d0oVRXQ1aJPe7k9PS4Eo+1JEMHT/E6cPrTE82KmhsLCQwYVZFrvClILZcmxpYxEsdy+PPmkScwoM= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: adca086e-521b-47d8-3f39-08d80713d545 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Jun 2020 16:41:43.4931 (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: yUtihop4CPQESlY8Tlfs9zVVJeap4lsxUaFC/fg+B0AYgHZ+5OXPToAsXPGxV0tdK+i3/y/r8GE7P9KTfpaPtQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR11MB4747 Return-Path: deric.cole@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Ray, The NOP is not a functional change, it's just for ease of debug. Before, this file was padding with zeros in various places. When viewing th= is memory using a disassembler, two subsequent zero-bytes show up as an ADD= instruction, which I found confusing. But worse, if the number of zero-byt= es was odd, the disassembler might try to "consume" part of the next (real)= instruction as an operand to the last hypothetical ADD. Since NOP is a 1-byte instruction, I used that instead, so it is easier to = visually identify the real code versus the padding when viewing disassembly= . -Deric -----Original Message----- From: Ni, Ray =20 Sent: Monday, June 1, 2020 9:51 PM To: Cole, Deric ; devel@edk2.groups.io Cc: Dong, Eric ; Laszlo Ersek Subject: RE: [PATCH] UefiCpuPkg/SecCore: Add pre-memory AP vector Deric, Can you explain why changing all padding 0x0 to 0x90 (nop) in your patch? Is it required to enable AP start up in pre-mem? Thanks, Ray > -----Original Message----- > From: Cole, Deric > Sent: Tuesday, June 2, 2020 6:32 AM > To: devel@edk2.groups.io > Cc: Cole, Deric ; Dong, Eric=20 > ; Ni, Ray ; Laszlo Ersek=20 > > Subject: [PATCH] UefiCpuPkg/SecCore: Add pre-memory AP vector >=20 > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2776 >=20 > Add a vector at 0xFF000 (0xFFFFF000) that can be used by=20 > Init-SIPI-SIPI to start an AP before memory is initialized. This=20 > vector jumps into the same SEC entry point as the ordinary reset=20 > vector, with a special value of "AP" in the DI register. The=20 > platform-specific SEC code is expected to check for that value and=20 > take a different path for APs, if this feature is supported by the platfo= rm. >=20 > Cc: Eric Dong > Cc: Ray Ni > Cc: Laszlo Ersek > Signed-off-by: Deric Cole > --- > UefiCpuPkg/SecCore/Ia32/ResetVec.nasmb | 31 > ++++++++++++++++++++++++------- > 1 file changed, 24 insertions(+), 7 deletions(-) >=20 > diff --git a/UefiCpuPkg/SecCore/Ia32/ResetVec.nasmb > b/UefiCpuPkg/SecCore/Ia32/ResetVec.nasmb > index f41b9669d0..1dfc4efe4c 100644 > --- a/UefiCpuPkg/SecCore/Ia32/ResetVec.nasmb > +++ b/UefiCpuPkg/SecCore/Ia32/ResetVec.nasmb > @@ -10,7 +10,7 @@ > ; Abstract: >=20 > ; >=20 > ; Reset Vector Data structure >=20 > -; This structure is located at 0xFFFFFFC0 >=20 > +; This structure is located at 0xFFFFF000 >=20 > ; >=20 > =20 > ;--------------------------------------------------------------------- > --------- >=20 >=20 >=20 > @@ -23,19 +23,36 @@ USE16 > ; >=20 >=20 >=20 > ORG 0h >=20 > + >=20 > +; >=20 > +; 0xFFFFF000 >=20 > +; >=20 > +; We enter here with CS:IP =3D 0xFF00:0x0000. Do a far-jump to change=20 > +CS to > 0xF000 >=20 > +; and IP to ApStartup. >=20 > +; >=20 > +ApVector: >=20 > + mov di, "AP" >=20 > + jmp 0xF000:0xF000+ApStartup >=20 > + >=20 > + TIMES 0xFC0-($-$$) nop >=20 > + >=20 > +; >=20 > +; This should be at 0xFFFFFFC0 >=20 > +; >=20 > + >=20 > ; >=20 > ; Reserved >=20 > ; >=20 > ReservedData: DD 0eeeeeeeeh, 0eeeeeeeeh >=20 >=20 >=20 > - TIMES 0x10-($-$$) DB 0 >=20 > + TIMES 0xFD0-($-$$) nop >=20 > ; >=20 > -; This is located at 0xFFFFFFD0h >=20 > +; This is located at 0xFFFFFFD0 >=20 > ; >=20 > mov di, "PA" >=20 > jmp ApStartup >=20 >=20 >=20 > - TIMES 0x20-($-$$) DB 0 >=20 > + TIMES 0xFE0-($-$$) nop >=20 > ; >=20 > ; Pointer to the entry point of the PEI core >=20 > ; It is located at 0xFFFFFFE0, and is fixed up by some build tool >=20 > @@ -53,7 +70,7 @@ ASM_PFX(InterruptHandler): > jmp $ >=20 > iret >=20 >=20 >=20 > - TIMES 0x30-($-$$) DB 0 >=20 > + TIMES 0xFF0-($-$$) nop >=20 > ; >=20 > ; For IA32, the reset vector must be at 0xFFFFFFF0, i.e., 4G-16 byte >=20 > ; Execution starts here upon power-on/platform-reset. >=20 > @@ -74,7 +91,7 @@ ApStartup: > DW -3 >=20 >=20 >=20 >=20 >=20 > - TIMES 0x38-($-$$) DB 0 >=20 > + TIMES 0xFF8-($-$$) nop >=20 > ; >=20 > ; Ap reset vector segment address is at 0xFFFFFFF8 >=20 > ; This will be fixed up by some build tool, >=20 > @@ -83,7 +100,7 @@ ApStartup: > ; >=20 > ApSegAddress: dd 12345678h >=20 >=20 >=20 > - TIMES 0x3c-($-$$) DB 0 >=20 > + TIMES 0xFFC-($-$$) nop >=20 > ; >=20 > ; BFV Base is at 0xFFFFFFFC >=20 > ; This will be fixed up by some build tool, >=20 > -- > 2.26.2.windows.1