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.web10.49122.1680247502083675034 for ; Fri, 31 Mar 2023 00:25:02 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=KmMPSs+h; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: ray.ni@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680247502; x=1711783502; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Kn2vCW+3+aURhdu3cO/OTx19TtXsWQfjuIGVPYEM2eI=; b=KmMPSs+hrhNILIFkgEnzY9Y4NtQf/wFDmKKllkD+7yRXtP6mQ7AX1gGl jsBuo75a/1Ngnt3tMDVzz7OfWnPGWAv0E4iw8smH0d9or4wuhSFNerPWW XEWM1eQeFzvetyoLEOPbJLhuI2RcXI87iqvBqU2cmxKeKBcT3qJmgQGup JwxeplqydD1fatOXONpwlisz6D/riLNr2XRCziLrB23B39A54+j/4FdSx syyKOFGymEFcP7gd5PwIM2xehBQbNo2PMmuEG1l5cqBJNZ4mLnqGFLZ5i 3sURGr5mPFSaXR4FUrrfwSE9TmdB3Gqid162qZ3QaoXjUKw9TOq96zcWw Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10665"; a="329916187" X-IronPort-AV: E=Sophos;i="5.98,307,1673942400"; d="scan'208";a="329916187" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2023 00:25:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10665"; a="859214118" X-IronPort-AV: E=Sophos;i="5.98,307,1673942400"; d="scan'208";a="859214118" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga005.jf.intel.com with ESMTP; 31 Mar 2023 00:25:01 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Fri, 31 Mar 2023 00:25:01 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Fri, 31 Mar 2023 00:25:01 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.170) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.21; Fri, 31 Mar 2023 00:25:01 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O6/YEozLgBc0h8IPI5BpnXLzGVy3/KmyZAcKUwsG0Xws9FO8M4g97Dlm0qv1qtMQeEaCwQ6/GrwX5ap6CyjhIuNTHGw2TRkJvLDAzQeiV0VG8KY/BNg4VzjN/dlr41UlEHaBc0fHjNzXIspiJBTOMN38K98Dzo6QK8KdreFPF2IM0YAFXedm3d05ftNg1D0DYPJptMRzoAmS5JLgVNxD7TanWibfkvXH5++EL5O2YsoRsj+F+49rQVuPR5T9vi6pBMbhN5GA6s4/IGhLJLokAhnLSEqh8dTDyQ9C7HzvbrDNmBmxlq6OCHebbSf5w3bXv7Vulvwza3KEbG3y48Ka1g== 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=/VgOfUpysFYRa7h3gHZJausZOq549rSprBG65DeFmzI=; b=RZIUpNPRGNwWf0+PBemqkPtoMPRX8I+lcIuwORgAzq49A6uZeCI1QLsmorkCEZJGoYiF4HWqSRVpMP9oleLx5rc+mMtow75jvEyBDszKSVXonmAT5UA7LpCP06dVi1e4yC7JEZLruSUEDbKCdSqSVFIpWkjXxPBfWc5VHPqRWeYyUYEjeh7dfXjez9UaQcE66u2irwSAedzE/G5VPdAfBoKrBNVb/+3dwylIkExGBQoZLcto/6sshpDbxjEkd3JNHhWQNLB7XVZf+MbAWqDWgBAB9rzAY5MDb3fa/l2MbAnBctxgJoBas6/iV4TrpBLFg9+G5llRa5ocS3itR/ZBhA== 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 MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by MW5PR11MB5882.namprd11.prod.outlook.com (2603:10b6:303:19e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.35; Fri, 31 Mar 2023 07:24:58 +0000 Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::ae07:e96a:4a24:8a69]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::ae07:e96a:4a24:8a69%8]) with mapi id 15.20.6222.035; Fri, 31 Mar 2023 07:24:58 +0000 From: "Ni, Ray" To: "kraxel@redhat.com" , "Xu, Min M" , "Liu, Zhiguang" CC: "devel@edk2.groups.io" , Tom Lendacky Subject: Re: [edk2-devel] [PATCH 0/6] Substract TME-MK KEY_ID_BITS from CPU max PA Thread-Topic: [edk2-devel] [PATCH 0/6] Substract TME-MK KEY_ID_BITS from CPU max PA Thread-Index: AQHZXFDgJtZZxfQaVEqr06ue07EIf68QRGOOgAJgZlCAAFQXAIAAAS6AgAAaTYCAAXQBwA== Date: Fri, 31 Mar 2023 07:24:58 +0000 Message-ID: References: <174E9488256AAAA5.22739@groups.io> <17509A92F1FF60E5.28404@groups.io> In-Reply-To: Accept-Language: en-US X-Mentions: min.m.xu@intel.com,zhiguang.liu@intel.com 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: MN6PR11MB8244:EE_|MW5PR11MB5882:EE_ x-ms-office365-filtering-correlation-id: 99b0b39c-ca5b-4594-62ee-08db31b9085d x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 17WDvXkbB8uLurnlIGrOdO2Ca4ne036ElEYwf1XVuQ73vQDKCX9/69WBNkl6qjAxknYXpFs9MqUr8PIgJKRsQdRKlsB5yvad0IRMPyMhgZvdj8USv3FnCE5SuUMSHpdWi2OpcybrZF5ZWKSYbFDAWAwu+2HnOsU/MqkcKYmRVSqp2DHYIlDcEX4oJVGPFdfsGkJmzxhT2qeZPUXkSksLaJbq27GW5rOCt79KGq0ndierXVi6MXEDyDaNxAtVD7EKPUeN0EKHSX6OaFWXLChUfl5Qf1BnPNTB51JSX/FSIs+1CqANX93XaxaP1DYyvjzuaashS/TwdDP3+si1IJgTNDXAGTg0gOhX0PfafX6XVyhjZPm347mwKGN2/IsSCoABBEykOCG4RVrK3fTw7Co4wRJERhICY8bftQ02Txk9jgTY+zMkWgyUkr3tesHP5N684yPE6HUB3BX/yqhec+tdFI3SvpmlEecXL0yD58ejJ4qJF2pqSxYWYfP8CLudI/ZQS/6uCK4Sq7yZ61fomLYJylcLEDLZm/ARqMEkB8xVOWQPG5KKC592th0HHMKNqH0dgc5CNBSoF9yDvc/3mGi5qvEGnraFm3nwPjVNMRyOA7M= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN6PR11MB8244.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(39860400002)(396003)(136003)(346002)(366004)(376002)(451199021)(66476007)(66446008)(82960400001)(186003)(122000001)(4326008)(76116006)(66556008)(64756008)(66946007)(8676002)(55016003)(2906002)(8936002)(52536014)(5660300002)(33656002)(83380400001)(41300700001)(110136005)(7696005)(26005)(54906003)(478600001)(86362001)(38070700005)(6636002)(38100700002)(71200400001)(966005)(9686003)(6506007)(316002)(53546011);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?y3urfauyXm467oB41cppFfKduuJZTBeyQKXif2TBcdCR+X3DSXSbfpkKoMMn?= =?us-ascii?Q?vPHai/P6BIIXlzFCq7u8+7JBFHXrjvt950osEV4i9Nt80ZNDwQX3J5RnyRAL?= =?us-ascii?Q?4XCkUPAA7tN88tQk7duLTaXgGK/4QIHcblef9JtRU0xZFjeXPPeCyyvXahe4?= =?us-ascii?Q?H4XUJfgM1DDp57x3vSenAwvy/jJcDKI93T1ZFaSA2Gtr+om4wGTfWyRPK2zs?= =?us-ascii?Q?9MiwKEeNJ5n7QbGbgmLlTb1x8Yjc847zQwS9M80TVVOn8tpQz+2hmSGp/aVm?= =?us-ascii?Q?IzUISGJDafd7lPethnRQff8mk8AR13YBYf5qYFH7Gr16ZVH0prTOq8EcuyuO?= =?us-ascii?Q?umK4nz+sM0OLHBoE/3HJG6QabkPFhHRCD8SHxFVohvz1ZhBnR5pXAadVkNxh?= =?us-ascii?Q?5zSpr1aT1DNOyS8J3e4pR07I5ewFsVjM3F9C4G43gVFKcepqNQpvL9R4Oik/?= =?us-ascii?Q?v9lGDCdEgOO0BaW05LMb7H2kMR0XHCQN4jOINxldf3hePz7EPWn9TAjR4qBD?= =?us-ascii?Q?CzoAqRSuATmoisHeZuFlxDD8qCw3reSXU77htSE/xOB8zEOz4AH0KIu+UClg?= =?us-ascii?Q?evitvk6xB6Mtiu0V3fqY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us-ascii?Q?a5bOdtX7DyGFtlF8RZ1PTBb33ugc0Zqzc5ZaPGqe39l9G2C0E7BxohqUN5Dg?= =?us-ascii?Q?1QTyPwdDebnhAEvkjoM=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN6PR11MB8244.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 99b0b39c-ca5b-4594-62ee-08db31b9085d X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Mar 2023 07:24:58.2082 (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: Dv6ZXOGtq84ra5sK1u9uu5v8ntvr689SaYfpKe+OZMT3cHZc7rOxqa/ej56Re8SVC9tzfaLgVGbtuocFiZFEHg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR11MB5882 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable @Xu, Min M, can you check if Gerd's comment is valid? Gerd, This Bugzilla captures the same idea: https://bugzilla.tianocore.org/show_b= ug.cgi?id=3D3394 Originally from Laszlo. +@Liu, Zhiguang who will work on patch submission l= ater. Thanks, Ray > -----Original Message----- > From: kraxel@redhat.com > Sent: Thursday, March 30, 2023 5:03 PM > To: Ni, Ray > Cc: devel@edk2.groups.io; Tom Lendacky > Subject: Re: [edk2-devel] [PATCH 0/6] Substract TME-MK KEY_ID_BITS from C= PU max PA >=20 > Hi, >=20 > > For tdx, the actual max physical address bits is decreased by the KEY_I= D_BITS bits. > > But the max physical address bits reported from CPUID instruction don't= change. >=20 > I guess the physical address bits calculation for tdx needs adjustment > then. Right now we have: >=20 > if (TdIsEnabled ()) { > if (TdSharedPageMask () =3D=3D (1ULL << 47)) { > PhysMemAddressWidth =3D 48; > } else { > PhysMemAddressWidth =3D 52; > } > } >=20 >=20 > See PlatformAddressWidthInitialization() in PlatformInitLib/MemDetect.c >=20 > Which would be the third place needing the same logic. Maybe worth > thinking about a helper function in a library somewhere, so we don't > cut&paste the same code snippet again and again ... >=20 > take care, > Gerd