From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web11.7647.1651475000266334025 for ; Mon, 02 May 2022 00:03:20 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=XIkP1Xng; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: min.m.xu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651475000; x=1683011000; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=umHzRmfT99Wb8FujS+UDkkBLodbHBzde9KFSP1gFB2U=; b=XIkP1Xng8UwhHOf6wbMlcSkjl4SPiYJqh2dOVKmBhkbdAtgkEXIFb4M2 tE2c1R6DIBiGo9aWmvd7Tei2lwqxucj/U5nP36zlHXR3rAe7ugN5kI38G m29Nhyif3aqiarvc4q+TIw5h69v8iYv+TIor71kpsoVa9DoLVXWMG9pDK nLpSc+91fnX90815MeenCwzcYCbov/CH+Hn6+h5KljI7XlgPdYXnhKXN5 DFSP8+vOxDJJwisiiTq851TX+Al/AQueM2JivGCfiSybkVSO2MvaQ4cBA MzsVzLv2bQc9UvO1vjzLsSh9tIb4xkkG3WMkyo/u72W+aYSeyKEIqlpzC w==; X-IronPort-AV: E=McAfee;i="6400,9594,10334"; a="327680415" X-IronPort-AV: E=Sophos;i="5.91,190,1647327600"; d="scan'208";a="327680415" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 May 2022 00:03:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,190,1647327600"; d="scan'208";a="733307639" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by orsmga005.jf.intel.com with ESMTP; 02 May 2022 00:03:18 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) 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.2308.27; Mon, 2 May 2022 00:03:18 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 2 May 2022 00:03:18 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Mon, 2 May 2022 00:03:18 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.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.2308.27; Mon, 2 May 2022 00:03:17 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RqbVWCAsbowwb3+JpsiqOkOUEekQQvMrKN7zsCclcm+3I/jxn89cjdVdxgztWOoydDc4AtMPt0+901afxil6s6bK2vv02Zfer5b36nQtee/G678zUomLpIy3hoDbadbtkRViUL3NZkTdC3ego6gPomcV6HmuvDObVKOlBr+sGIWrbjvhJyH5E5HwT7QO8DRt3JvjWcdidiVtQgUPkBLcpdrNwMRxa8Fp0mVAyB+9lEWI4tvsaTOhs+bkUFUzHcSvMarOAjIQG1PLHX7XTfGB16O4lFcn/qy0yPWgJcKh89XwSGXicDYVzqfBAztXRQjPicXOrg+WxX/YManwfDi1WQ== 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=umHzRmfT99Wb8FujS+UDkkBLodbHBzde9KFSP1gFB2U=; b=RWd31s3AuXL3e6DtjKB3/4YjgEq27eT2QATn3sDNO8DhzmKulMzpwIMt9T0zKDj5PIAjl9hNZOFnFLJou5u1MRCGKoe6CcunoLb78/yJaUpQT8njAe9ckoF23Ke4Sdr3pPofS9RLvEcmiBcxbXBgVJtNIq5bfTDOMaIO+etR+xOUpSXYqdjCg7Xxw4M5A4EiONf9gqYZVBmy4UVsJf2GwiMjXjptMKwocFZDIMMnCV5hLX34cSNmtzyqW1tn/LSneA8Zhybqzarn1AaVotprYMkRdojt9oO9WLkG7ZYNTWB9OEoNcexYlhKzrvzCyDuc50fMK8HV7zrRBZYHyUQbFw== 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 PH0PR11MB5064.namprd11.prod.outlook.com (2603:10b6:510:3b::15) by BN7PR11MB2803.namprd11.prod.outlook.com (2603:10b6:406:b5::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.15; Mon, 2 May 2022 07:03:15 +0000 Received: from PH0PR11MB5064.namprd11.prod.outlook.com ([fe80::1844:3fca:639e:7c56]) by PH0PR11MB5064.namprd11.prod.outlook.com ([fe80::1844:3fca:639e:7c56%8]) with mapi id 15.20.5206.013; Mon, 2 May 2022 07:03:15 +0000 From: "Min Xu" To: "Ni, Ray" , "devel@edk2.groups.io" CC: Brijesh Singh , "Aktas, Erdem" , James Bottomley , "Yao, Jiewen" , Tom Lendacky , "Dong, Eric" Subject: Re: [PATCH 1/1] UefiCpuPkg: Save PcdConfidentialComputingGuestAttr in mCcGuestAttr Thread-Topic: [PATCH 1/1] UefiCpuPkg: Save PcdConfidentialComputingGuestAttr in mCcGuestAttr Thread-Index: AQHYW3WlQ8qbASIqCka1c46L2Zs1C60GNXUAgATzd3A= Date: Mon, 2 May 2022 07:03:14 +0000 Message-ID: References: <1bef66daa55f86bba85b78aec1aaec077d97d0a8.1651201263.git.min.m.xu@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.401.20 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 27fd70a5-7793-41c7-f8eb-08da2c09d423 x-ms-traffictypediagnostic: BN7PR11MB2803:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: VkbEZZx+PbZZ19H+7usXJIikS667PO1k+9k6Kg1mjvq9KQdzqmhUHLWOIo93TZA22G9ZgBqO8FB1zg7dBnzM0It4GaWvscFU2JGImrQ5oH1vLGOa+C/Vu/7oqycZLHNuX9tIeUHR2nLyjFcYwHmcuH2t1HBw6R8eDUpr22J+/Afi7K+OnruQhr+12x2VzJMuNGLG3KLBKbaLKpfzZTikH34gZE2roSZTy4wl4htpsF2JGlKK7i2S+lvcLcwtGFg3DEPD4yqQNsj0r6g/pTg67iGPzkgub4mB9J+G6sK55W8ML1oTJ7sFNtm7eTG2q+/k2mOw9hjhtcRAxDy7xPhVuoVOgVhw2PLhBAfPlqstK/X+QxadkzrxoTwFQYM91t2WCZ2nav6l0AZBt4E7p2veXKGvJlsEzf9iK8HKFbVGB5bUzR5aLJnKKd/OLZDxHzFow10iCBE7p1/BcIZdoB1RJhszaSmAJyybiH92qizjhgMBbhyfABkjGVw10YqtnjGWzaZvO4HEe/TSN96xl51Y/kkbbshldU8BH14VK/bFpYCVE5aDU5AEM9q/xfrKz66TNt0H4f8mZ10FnEwP8ICvsiqjxzj/yz2rMQc1GAmA/vyYIBKR/sS8MUACF4VbdkUmTmU4VFdLO6widNkQSR83Nv28kQOhZ2AyVyXCPU8dvnk7He02pbDtvrGVwQITDYvIeT3+LOrbOrriuxC6rcXdzlGQqSK/4sQyCElejNF5yV1LnWq5XHpE66qWGEyNX6LPF9HELiDtAV0uNSgEkNsmbXoWrQZI8JTljDquBxb1u9g= 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:(13230001)(6029001)(366004)(508600001)(38070700005)(316002)(38100700002)(110136005)(71200400001)(54906003)(122000001)(8936002)(82960400001)(8676002)(4326008)(64756008)(76116006)(66556008)(66446008)(5660300002)(83380400001)(66946007)(55016003)(66476007)(2906002)(7696005)(9686003)(6506007)(52536014)(33656002)(26005)(186003)(86362001)(107886003)(145543001)(145603002)(213903007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?rTNkGdD0uIuu1uuYciCWFe+kXDsA775Trn4SEJvZiypPIHwZU6Q1NRiLBHoo?= =?us-ascii?Q?rCvbZwUjR1b5B6PhNYkibO+cHOq/N261LF0Zob23DP+zhY1pZeunEOzCFMme?= =?us-ascii?Q?rXSinDMsGUQrpxafty1nPAFt4rxRsvkqR/Ch/PE7v5FY7FUdoO4nUbyhAUut?= =?us-ascii?Q?X/+qLd8/Sd08eEU1DTW8aJobLp8mqzB1xxsBBscHUuUf0DiiVeuxCyYh701i?= =?us-ascii?Q?qPFWu6QwZhQnYzks361fv1Pp3Edmx3jAsCASYQnDbSPG3sPf9gOFA57BfpJZ?= =?us-ascii?Q?CvjF8YSiFF50/MibYCFsR0KIYF5xVptfEV1+ROFLKKPos8fXeJDvJ/eH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+zilEDJ/W5HT3+5YK4KRd?= =?us-ascii?Q?KxeWxT5oCm7bznN9YqsYAao2sqC0Z5o1PW669DpYp+bbD+G/YKPyk3QKeJHQ?= =?us-ascii?Q?5jUjABbH786nYLYVDghM7VT6vY65PwlJScX17H5UwwshQRRvKA0WBIYXNCB7?= =?us-ascii?Q?NQclMmBo3naMx0zYSnEpr1jpoIMICGR1j5lYZQYb/aAX991Q0SGtW9XbKHdB?= =?us-ascii?Q?Lf1BsesJMBmn33XcLnZodfeQ1GI/K8xDgrAKQ512roOcRrRz3N62bd8L2epC?= =?us-ascii?Q?Q56Drs7MhIYgiVmqJZ44cGNlec2FAgckplF7UOe2E0ysuPxSG6H4JiVM7/nZ?= =?us-ascii?Q?pwUbhctbXrLzTucc0BJoaHxPf1KGQYcMkY1Dewdrk6w5FTDgaCGZTGRROiAU?= =?us-ascii?Q?fjkFI0GU2weIlM20t6xV+CePTYFtP14eIIKY3Gvplaax+bDSIEq8sULGWxcZ?= =?us-ascii?Q?+ACQaUo4jILIF8/rj4VavFqnZRgw/EMHe8WgN7hQS/PAaMSpRFhIDrInPVOv?= =?us-ascii?Q?TnEdEAm4JA=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: 27fd70a5-7793-41c7-f8eb-08da2c09d423 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 May 2022 07:03:15.0551 (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: tyb9oD9C/SVmgvoU/ITrkLYPzUSpGD1gk79wYMDnQ4TFRUs4qMeXKVv91Y7HXMcCqZKp3PSMGBW9mjTW2iWojQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR11MB2803 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 April 29, 2022 11:07 AM, Ni Ray wrote: >=20 > Min, > You cannot use C global variable in PEIM. > Can you add a new field in _CPU_MP_DATA? >=20 The reason why C global variable cannot be used in PEIM is that in some sce= nario PEIM is executed in FLASH so that the value of C global variable cann= ot be kept in different calls. But I don't think it is a problem in this si= tuation. 1. This global variable is to keep the PcdConfidentialComputingGuestAttribu= te in mCcGuestAttr. So if this is Tdx guest, then the global variable can b= e kept (CC_GUEST_IS_TDX (mCcGuestAttr) =3D=3D TRUE).=20 2. If this is Non-Td guest, then even the global variable cannot be kept, C= C_GUEST_IS_TDX (mCcGuestAttr) is FALSE. So mCcGuestAttr can still work. There is another solution that we can use CcProbe (which is in MdePkg/CcPro= beLib). CcProbe checks the work area to fetch the guest type. It calls Fixe= dPcdGet32 (PcdOvmfWorkAreaBase) so there is no SMP safe issue in PcdLib. As to a new field in CPU_MP_DATA, Tdx guest doesn't create CPU_MP_DATA obje= ct in MpInitLibInitialize, instead it return right after it detects the wor= king guest is Tdx guest. So this fix will be more complicated than above 2 = solutions. Ray, What's your thought? Thanks Min