From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=eNrPZpgM; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.77.57, mailfrom: thomas.lendacky@amd.com) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (NAM02-SN1-obe.outbound.protection.outlook.com [40.107.77.57]) by groups.io with SMTP; Mon, 19 Aug 2019 14:35:56 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hQhEMCjqeh3KQnzhwOlVAIkNLA1Owdb0f4d4XxzbGcw+sIX0M38Wq3cc3IaZ4cu1fgr13zCbPfHDGGLA+rq4IdptMp38l+Vn4K10+R48HjYhqzkZNRyiemY/G32+E5P+KmZOMo9UyaRDwdwUx/dGQ3LYiPEjgIUXXErVJgIPcz/TmEkzl8b/WzJ/zx1pqTmwNO59s4IyvavRCSsmcAJh5p164g4H7uf2s3zlGKZwFf7hcDqRp/CdNnYP9dn6tMbAls9bd/bA0F2wiks7lDtlI3xiEXlkWEDbxViYxgB0UDEmxicVmTag65iTrE2z0qxlIa6SNTDGiyeWEI801+mPmQ== 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=MyRetcf+yn/3HCLYTXVf4pHQiKU4YRETo3ZN5m9cPxg=; b=JBXwIlJngVpdR6LeKUz/nQh8TU8yjlKWhCRC7WkFeq+mEMla1J5icgcn4MFwncuQoboqaN4THHxTIem9Ekg2xYMlKhqQzfiZHForAc5BQiBPkkc3jk20++Bk7OfYAVUaR3nIunGyCxWOHjZqFoYr0wSLjTEdKmu2HYUcHmErk/LfBuJcI0Q1GX7cgjkSKBJP/tHIZl7cwe8/hVh9ivYCnXXklUnldr6HyHo+86l7u9T0rXd1cQTL4TYJBcutaZ5vpX/BNRNftKUwSQuolQwnBHry9p05dZFxFXSTlfMR9i4jRH+kIevmSE/XnIugB/nUXPAl9daDidpjK9ZikUgaMw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MyRetcf+yn/3HCLYTXVf4pHQiKU4YRETo3ZN5m9cPxg=; b=eNrPZpgMEMD3f+GBdQVU285g+4vULodN1xiGOt9x18N7OskZWLk2uIGBIRfSDEeiNhab3sJOlKp+FpUUket1RNEV8hg5EW/YaHcL5FyST0KT2E69XeYcfW1kQQ0353NdIvW26ASfEjVCIIJY9XQbBxGGknvkOKdY2aGpOBGcSkY= Received: from BYAPR12MB3158.namprd12.prod.outlook.com (20.179.92.19) by BYAPR12MB2965.namprd12.prod.outlook.com (20.178.52.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.18; Mon, 19 Aug 2019 21:35:54 +0000 Received: from BYAPR12MB3158.namprd12.prod.outlook.com ([fe80::39b9:76bd:a491:1f27]) by BYAPR12MB3158.namprd12.prod.outlook.com ([fe80::39b9:76bd:a491:1f27%6]) with mapi id 15.20.2157.022; Mon, 19 Aug 2019 21:35:54 +0000 From: "Lendacky, Thomas" To: "devel@edk2.groups.io" CC: Jordan Justen , Laszlo Ersek , Ard Biesheuvel , Michael D Kinney , Liming Gao , Eric Dong , Ray Ni , "Singh, Brijesh" Subject: [RFC PATCH 06/28] OvmfPkg: A per-CPU variable area for #VC usage Thread-Topic: [RFC PATCH 06/28] OvmfPkg: A per-CPU variable area for #VC usage Thread-Index: AQHVVtYUanvxBD+q6E2MuwUQV/mnvg== Date: Mon, 19 Aug 2019 21:35:54 +0000 Message-ID: <1f3b874316842a078338be79d246e5fcafc40bd4.1566250534.git.thomas.lendacky@amd.com> References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.17.1 x-clientproxiedby: SN2PR01CA0031.prod.exchangelabs.com (2603:10b6:804:2::41) To BYAPR12MB3158.namprd12.prod.outlook.com (2603:10b6:a03:132::19) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [165.204.77.1] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 85d61f24-4b98-4dc6-9b58-08d724ed36c1 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:BYAPR12MB2965; x-ms-traffictypediagnostic: BYAPR12MB2965: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-forefront-prvs: 0134AD334F x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(346002)(366004)(376002)(396003)(136003)(39860400002)(189003)(199004)(50226002)(53936002)(316002)(5660300002)(2351001)(52116002)(76176011)(36756003)(6436002)(71200400001)(19627235002)(6512007)(7736002)(256004)(86362001)(14454004)(478600001)(305945005)(2906002)(71190400001)(2501003)(64756008)(186003)(118296001)(4326008)(26005)(6486002)(99286004)(1730700003)(386003)(6506007)(66066001)(66476007)(66556008)(8676002)(102836004)(81166006)(25786009)(66446008)(6916009)(54906003)(3846002)(6116002)(486006)(5640700003)(476003)(2616005)(11346002)(446003)(81156014)(66946007)(8936002);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR12MB2965;H:BYAPR12MB3158.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: E40UVJraVvi+E1SZrDHUHPfv7ZN9mOxwillcN7KShSVVCOOG9BGXT8TqEvAIcdVM3Cv37ZRI8cuRDGirHSWsiNxGcSQVMWDSj0GRP2bNyO0tbe3/zwRWbnhw8K4w+1HZs/gc0wYTdeUT4Ndkgc+6398EjJuqSKxsoMQosB6WiG8dZuFxuIy760ZOHqq419Aaaw8OdNjdp5fzf0gJjonCpvNSxnOypgEFVZChErBg6Cg6G0+Z3qIbgKRwHZIuMcY/HA56OQ3uMDR7cL//CM7rOazLnjX13R30t+LVDQdV94jrIVaxkszxdsUPYUPnwGdFOQG83i7x65yUJKU9GO69c89Rt5dMaMDy9LcAzUr2Q8/YqPWU+Qk3mVEOoqVbELkRX3mGC0aZnW532gbFCfb9BWBH00jZfhNjOQjnk8WUnPg= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 85d61f24-4b98-4dc6-9b58-08d724ed36c1 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Aug 2019 21:35:54.3959 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: nHFJQYlVD9Zu8Xk05m3L7nke5Zl8OBGJtnepBCDHHNdeW0b0yTwoG8XzK1iOSnxWrUV4KLpGWz5KlCyfaZPBGw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2965 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable From: Tom Lendacky A per-CPU implementation for holding values specific to a CPU when running as an SEV-ES guest, specifically to hold the Debug Register value. Allocate an extra page immediately after the GHCB page for each AP. Using the page after the GHCB ensures that it is unique per AP. But, it also ends up being marked shared/unencrypted when it doesn't need to be. It is possible, during PEI, to mark only the GHCB pages as shared, but DXE is not as easy. There needs to be a way to change the pagetables created for DXE using CreateIdentityMappingPageTables() before switching to them. Signed-off-by: Tom Lendacky --- OvmfPkg/OvmfPkgX64.fdf | 8 ++++---- OvmfPkg/PlatformPei/AmdSev.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf index 2a2427092382..3ba3d7384745 100644 --- a/OvmfPkg/OvmfPkgX64.fdf +++ b/OvmfPkg/OvmfPkgX64.fdf @@ -70,13 +70,13 @@ [FD.MEMFD] 0x000000|0x007000 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase|gUefiOvmfPkgTokenSpace= Guid.PcdOvmfSecPageTablesSize =20 -0x007000|0x001000 +0x007000|0x002000 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecGhcbBase|gUefiOvmfPkgTokenSpaceGuid.P= cdOvmfSecGhcbSize =20 -0x008000|0x001000 -gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageBase|gUefiOvmfPkgTokenSpac= eGuid.PcdOvmfLockBoxStorageSize - 0x009000|0x001000 +gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageBase|gUefiOvmfPkgTokenSpac= eGuid.PcdOvmfLockBoxStorageSize + +0x00A000|0x001000 gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|gUefiOvmfPkgT= okenSpaceGuid.PcdGuidedExtractHandlerTableSize =20 0x010000|0x010000 diff --git a/OvmfPkg/PlatformPei/AmdSev.c b/OvmfPkg/PlatformPei/AmdSev.c index 84896d4681f9..87ac842a1590 100644 --- a/OvmfPkg/PlatformPei/AmdSev.c +++ b/OvmfPkg/PlatformPei/AmdSev.c @@ -42,7 +42,7 @@ AmdSevEsInitialize ( return; } =20 - GhcbPageCount =3D mMaxCpuCount; + GhcbPageCount =3D mMaxCpuCount * 2; =20 // // Allocate GHCB pages. --=20 2.17.1