From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web11.9380.1635236596556722351 for ; Tue, 26 Oct 2021 01:23:17 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=QRJJ2gE2; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: min.m.xu@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10148"; a="227306315" X-IronPort-AV: E=Sophos;i="5.87,182,1631602800"; d="scan'208";a="227306315" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2021 01:23:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,182,1631602800"; d="scan'208";a="446630893" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga006.jf.intel.com with ESMTP; 26 Oct 2021 01:23:15 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 26 Oct 2021 01:23:14 -0700 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) 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.2242.12; Tue, 26 Oct 2021 01:23:14 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Tue, 26 Oct 2021 01:23:14 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.101) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Tue, 26 Oct 2021 01:23:14 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hVm39rJtDilUCmzUyfVAdxamHyeSOpf72CZHvsRczVjvCay1mcLTSQV9eHTLmi7qlErA0Lx3Y4bYFdHol2gASOiBzajozXpz6yg89szDdI3SmMP2to4SbuBtqiUKtW/wNMsY7jVx5MG/415PYzzVWCKXkIBDc42AmjpdYpNx7utufZsJbhsLIiIcDkGpdEl6FjQPohxpopQuIXYea6Gas5NJqj1ywqTU8G+vUjqFEH6dUSOswMvygTYjkIrT2dzFIlvPkShF/xtEA0AZlorSQSvB5tJ51sdHbGuIOG1VK0/hW0ImAtTaqT8D9ZhJ8npoVyUpukuykM0aLF4Xd5AQtA== 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=7tCcXakV+lJVLmXIIM0A4aPXU7QHE4TXeqxxlSZuot8=; b=mdxhZpBHSfBlQASt1EcEyFW/4hJ9eDah9qLUzaVADkb0QnfWyFslbwZzKggbbWlmkmaClgGpwQ2p5V5XneI7tVAobCC/fk6iOvdXmNb8VYA4UrGeeeJbWiSfh8ZzdilKEg22oUK4VyONMGAtPHj2sYCePGLABIPBRMKs583bcVI2IPzyPwCUHJvNeiy9Rd1oVKM2/+Wf7grkt60LhFTN1DWpn2G9uGXegsJbnkW/GXbD0suZt2lb0kNefyBH5aiBKj12jivJH3MGEbzKFLOmbYQ/eaH7+QLoloZyQqI7oVvMlBOOnTHFBVA8q4Qcj/O+OeU1oYn+4KTh67bUNTXbpw== 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=7tCcXakV+lJVLmXIIM0A4aPXU7QHE4TXeqxxlSZuot8=; b=QRJJ2gE20/6IBjJDHbCasaS1biQ6jCqW6fsHqNw8zoKLPzt6HHkJpLK8aG2mK6p04Gl7//Tk5TEPNKSv4Sq87Wpf9d+LJjbY+e+uK3ynTNTWHEYVdsck4ZQZcwfaBeHzqcpvhgSdJ09FkMZ2/giCuG5jEx83eu7c8PLOLZ1LZE0= Received: from PH0PR11MB5064.namprd11.prod.outlook.com (2603:10b6:510:3b::15) by PH0PR11MB5192.namprd11.prod.outlook.com (2603:10b6:510:3b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.13; Tue, 26 Oct 2021 08:23:13 +0000 Received: from PH0PR11MB5064.namprd11.prod.outlook.com ([fe80::7deb:6c36:73c2:f0d4]) by PH0PR11MB5064.namprd11.prod.outlook.com ([fe80::7deb:6c36:73c2:f0d4%4]) with mapi id 15.20.4649.014; Tue, 26 Oct 2021 08:23:13 +0000 From: "Min Xu" To: "kraxel@redhat.com" CC: "devel@edk2.groups.io" , Brijesh Singh , Erdem Aktas , James Bottomley , "Yao, Jiewen" , Tom Lendacky , "Dong, Eric" , "Ni, Ray" , "Kumar, Rahul1" , "Xu, Min M" Subject: Re: [edk2-devel] [PATCH V2 12/28] UefiCpuPkg/CpuExceptionHandler: Add base support for the #VE exception Thread-Topic: [edk2-devel] [PATCH V2 12/28] UefiCpuPkg/CpuExceptionHandler: Add base support for the #VE exception Thread-Index: AQHXuZrEZaTymLGmdUC5iTq/+VuJ36vPND8AgBWluZCAABOKAIAAAekg Date: Tue, 26 Oct 2021 08:23:12 +0000 Message-ID: References: <24d3a351f21bff1a4b20490313d039e403b1453c.1633401643.git.min.m.xu@intel.com> <20211012102716.wr6bao42f5hviz5z@sirius.home.kraxel.org> <20211026061148.omqerrswnpgs3jin@sirius.home.kraxel.org> In-Reply-To: <20211026061148.omqerrswnpgs3jin@sirius.home.kraxel.org> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.200.16 authentication-results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c3ecb2e0-a76c-496c-e87a-08d99859da48 x-ms-traffictypediagnostic: PH0PR11MB5192: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: EVf7M9fvP6MUh7t6QuoExq2ywKpzUPoM0Wl9NdkrQxMVXutMsaAMb0bw+9Z+2ZaX8NpvYzTZ+WKRJ0gVrJS1lHvPBnZWtdx1gC5pgGa9RZmQXlvgT5ANtODvuYjp2YkP16qN+31QJPhHuG7MkB7PlsUNaooCcdsTKELfKT9iEYWnxZ/a1j6yLqE1Jk0jmUEcl3RW/MAfChnPmlRWfqnrDs10sW8nv7ABqCweMaIlPxQn1JDh8qwSN2bEtZ3oL3+iDPyqtOXa40Zgqg+k/TtMkQSELUlg8fsATRWA3ntBmWkPT6ZFRdZ6RgIbI/ibtf4Jop+5k3hGhq1YnXeVt0aJNncfwJnVy7TkPLWZa34rXVfuKKwhuP+Gyjtkdsk+yX7xG4TSy6ueTYZOFrmcxEOneWTI8nyCDQfB7CMlMAfJMm3uNSuWsnYY+vYauDCvLrxC3MVVUCseMF92XrHa2NRHw8Nnd1eh7q+SYH1FJLIX/rljY4oyw9/LDplVS5ayyKuws4voCN7Mn5pTOjH0xj73aX5EWghAFrxEBCOFe2rGD2THVesF0EXGTrSIql5+45gHZ5uPBTkMWspS0K9YMi9Y2ja9llhSKDamgbdrhTQcKcZe63PX6XA3ENVbgEYihrrVYuw2hv6QYDgUxJt1OXWAQw2GdlfmoYKgqO6H+jtOcrV+6F9BLzG7Mc0mh8J+e7ir1XmpudJG4vH6DTLNMw27k1SZ3XNvOwSZqkq6F7ZjaKYryb8/0aK9pM35hg+/eYhnA0ZBQt79CZC0QJTVE7cYMOBvmt2Wa61SBA8dPAYNESo= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5064.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(86362001)(186003)(55016002)(508600001)(82960400001)(2906002)(52536014)(966005)(38070700005)(26005)(4326008)(6506007)(5660300002)(71200400001)(7696005)(8676002)(33656002)(9686003)(76116006)(66946007)(107886003)(66556008)(64756008)(66476007)(66446008)(6916009)(316002)(83380400001)(8936002)(38100700002)(54906003)(122000001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Udc2oT/FT11FxMJD8X+wZ8jYYQSGphz64UP2xVetS1VLc9c5LnY0HFqd8YhU?= =?us-ascii?Q?HXvoj7e8BSVEuAe/AYl3odFMeAcdfqUV40UX2s7srxinEzvUFnNTmXeF/Bm+?= =?us-ascii?Q?nPHgWkwpfM/wCI09OhmRbNe5XUN9PPpvfoKaeHHwaq04iQVHhdDD/TVqfv7f?= =?us-ascii?Q?SByqFoj7U+JAm+K0maXRKWCfUb7LEtRkN94Qv/dAWBCrL/0tNzKa7kcjUwrc?= =?us-ascii?Q?LhUQZqe+s9CVYtzkWbHOBKF0v4wi/2e9pWWaOYQ3VAlHNOPQbXKrp+YV+bL1?= =?us-ascii?Q?+Re/rQ2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rZbFO32Fovlh4Y+LJx?= =?us-ascii?Q?brE4WOeF5Kc2/TBCJQ4hvSIdPSQRJfT1cmf1rYuybGQgCEutpONyCI4I+X+5?= =?us-ascii?Q?N87a29TUvJn7pPu3JdkEngtcmwRDyRGLAsitwY256vgtZr2dKpOaBxFjANFV?= =?us-ascii?Q?/VIuKB8x/ZD8fe/oigy0KYNLNlGgxtsQ77her3OPWn3cfQD6FTzBk+KVB838?= =?us-ascii?Q?eLj9Xadi25y06AhQxbPJMkGAos2nrwBQlA76ivsFZBKbzxwFpnk/dxYBvhxg?= =?us-ascii?Q?oQPYiefxjN6f+qrF2Fabz7BwQ6a43IaD3dkd5oOcBf4pMus1gMbmaD0s8mfE?= =?us-ascii?Q?JRoZ+0QxNUXRCSgTpyOBvBFAa+6d9W0/E7x0MUoRb7dORtOyFGFBnVT5K0kE?= =?us-ascii?Q?uogRGNzVZyY0BflN/Oo/HbmJMqRkMEBo7cCdKvzajTFPn5xn14wova4w1uR6?= =?us-ascii?Q?Og=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5064.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3ecb2e0-a76c-496c-e87a-08d99859da48 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Oct 2021 08:23:12.9954 (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: stj6NioPiaUoTQZvdKzKjAH7xjxH6PTbeR6W5p67zolx2l30s7Tt/v7s8l9wZA7F4N6rIZ5kqJuKqIPVhBo0NA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5192 Return-Path: min.m.xu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable On October 26, 2021 2:12 PM, Gerd Hoffmann wrote: > On Tue, Oct 26, 2021 at 05:06:21AM +0000, Xu, Min M wrote: > > On October 12, 2021 6:27 PM, Gerd Hoffmann wrote: > > > > + if (ExceptionType =3D=3D VE_EXCEPTION) { > > > > + EFI_STATUS Status; > > > > + // > > > > + // #VE needs to be handled immediately upon enabling exception > handling > > > > + // and therefore can't use the RegisterCpuInterruptHandler() > interface. > > > > > > Can please you explain in more detail why this is the case? > > > > > VE Exception may happen before a component registers exception. > > > > So it has to be implemented inside the exception lib. >=20 > Well, no, you can also change the code to avoid triggering an exception. >=20 > Adding a new lib for the exception means the lib must be added into each > and every *.dsc file (either the tdx impl or the null variant), not only = in the > tianocore core itself but also all projects depending on tianocore. >=20 > So IMHO it is worth checking out how much effort it would be to avoid ear= ly > (before component registration) exceptions. >=20 > Which early exception do actually happen? >=20 RegisterCpuInterfaceHandler() is not supported in SEC/PEI phase. But there = are still some scenarios in SEC/PEI which will trigger #VE. CPUID is the sample. See below call chain in CpuMpPei. InitializeCpuMpWorker --> CollectBitsDataFromPpi --> MpInitLibGetProcessorI= nfo --> GetProcessorLocationByApicId() Actually #VE handler follows the same way as #VC handler (by SEV). See disc= ussions in below link. https://edk2.groups.io/g/devel/topic/73201885 Thanks Min