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=vSnrTGU+; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.80.87, mailfrom: thomas.lendacky@amd.com) Received: from NAM03-DM3-obe.outbound.protection.outlook.com (NAM03-DM3-obe.outbound.protection.outlook.com [40.107.80.87]) by groups.io with SMTP; Thu, 19 Sep 2019 12:52:37 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UtaVDjyn/Sc3Tf5ou3L+KfHm8Fo2rjxUArWHE1H5fDWeDRrgEUEzT6Vt0gdt14AsketJqjQfPxpXLe2JUZWncZwnLeSYdOZ/GKeJXceUA9vEOEpBV7i3igZBio/XdiEQchlSmWqbQBTWzk+6L+m1erzmK7njH+YeTTA+Ay9g01B57bZz98cafi6pp22jtm7XR0HVUikGu6fhoQ6CFxfqW3iWCZfNjSpn85uLlaIvy0b8W4w7asNIXW9d5AAZL2SlSp2qRnNvG6X+mrfIExCngDIP+usEXfkPv/VW7TgGluGDm6jdXzQQUown1wWMveFz95OYaL53caLvfvdv0myPKA== 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=Y0b/c6QVQIYB2LE2zIb2FaWHiNt/1Zg50uw/1QYpqUw=; b=Pc6H7HH9VSrzxph7UQ1bFwu3LCXbJ/mko0r5KQBTKMopeYfq5xPZYKdPu49RmIo3HNHWl5ODru9iH0cUYiiAw64zno1I898Bt2IL6eKFh/sZEZTfPe/skVFXKvt49sZdq1svGxpyGlM3NqE2fZ9nYTWKHudbyhv/NMse9fPZ8HdXXWcXKvp3wcA7ZGtR3HrNhlHzAOaU7H8rWoyHyx4DnRCfBl7qDxfeMn8tLWjZ5LxDsedOuStHwPVDrFE36zXocuFq4u4ovtLu3AMkoSHan/074/i6GX6gLohmQOIKu6mGXfLImQIq2KjROm6YnxL1nmmjqYRGVXRl3l/sPvmZRQ== 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=Y0b/c6QVQIYB2LE2zIb2FaWHiNt/1Zg50uw/1QYpqUw=; b=vSnrTGU+3kOVQv/lzD5kRAVJXYRkndl6n6FCO1IRMg1TzA1ng3SHYMEZlZN7B6D8gTTM68u2oXA7JDFSuJrtEGXzqk9Zy2Foz38DLsdRU8qZZMKci/jBWZzH+e8otJKd2jErxx1o2TCjUFRAfN6GbQsFg1YC4Zo5LY5hMd/Oq34= Received: from DM6PR12MB3163.namprd12.prod.outlook.com (20.179.104.150) by DM6PR12MB2890.namprd12.prod.outlook.com (20.179.71.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.23; Thu, 19 Sep 2019 19:52:35 +0000 Received: from DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::400e:f0c3:7ca:2fcc]) by DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::400e:f0c3:7ca:2fcc%6]) with mapi id 15.20.2284.009; Thu, 19 Sep 2019 19:52:35 +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 v2 10/44] OvmfPkg: A per-CPU variable area for #VC usage Thread-Topic: [RFC PATCH v2 10/44] OvmfPkg: A per-CPU variable area for #VC usage Thread-Index: AQHVbyPIi0t/93BoCUigK+eNYlDx0A== Date: Thu, 19 Sep 2019 19:52:35 +0000 Message-ID: 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: SN4PR0501CA0146.namprd05.prod.outlook.com (2603:10b6:803:2c::24) To DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:182::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [165.204.78.1] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7a2e5bdd-2215-40f7-0f64-08d73d3aeaf4 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600167)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:DM6PR12MB2890; x-ms-traffictypediagnostic: DM6PR12MB2890: x-ms-exchange-purlcount: 1 x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 016572D96D x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(346002)(376002)(366004)(396003)(136003)(39860400002)(189003)(199004)(2501003)(99286004)(6486002)(86362001)(476003)(52116002)(11346002)(446003)(54906003)(2616005)(8936002)(19627235002)(3846002)(6436002)(64756008)(5660300002)(66556008)(66476007)(8676002)(66446008)(76176011)(66946007)(256004)(2351001)(486006)(6512007)(5640700003)(6116002)(50226002)(6916009)(6306002)(118296001)(71200400001)(71190400001)(2906002)(386003)(6506007)(966005)(14454004)(478600001)(4326008)(305945005)(66066001)(36756003)(26005)(102836004)(316002)(7736002)(81166006)(186003)(1730700003)(25786009)(81156014);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB2890;H:DM6PR12MB3163.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: WIjLkThCdDz5uI98x2OUeIFMHstw/qDcQgC38RuErK23hA5Dkd/ryTShHOTY7nUnjPbP2LhNsmrnGVRyVREMfnqErF2bLG47IlFg4cHwsryBZHOKlhxM7UdoxPY5fuT18Fq9yWe2kkmIG4NxAPe2X4F+BJyoccPMCtj+cN1UUj0zFQsJHNDQovg/mzJlBN4z+28ffUWTgi77Pu6Qm9KsDLNWdvhryJqlKl/NjODfIuk/eYBYV6j7QQnFOoWC7NVvzMDOlMTrVNYIfDe6CgRgkmuL/bx9f/POb2ZLz4G7hFNUZr1kbAkrLiKoaIGVrAre5VpnmzebsTAe5GEDthDhMGW9O4EqoVr5wbKU9jdXJu0CbRd5KilJVgSPiybtnDJRNY+CGcBsmFKpZSKVZHus2aDJ4hYllbR3fRAgnb2L1Wg= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7a2e5bdd-2215-40f7-0f64-08d73d3aeaf4 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Sep 2019 19:52:35.7724 (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: lJlEBNhGxEPSkU207L68uTP/FQ9BEWieyz1PRzvjM9nDeTHEuy9c5B5qJ85/ETp66QGSra+AFDfM4olQnwGSAA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2890 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-ID: <42B337017DC31E479C7CFF4F1C75C79B@namprd12.prod.outlook.com> Content-Transfer-Encoding: quoted-printable From: Tom Lendacky BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2198 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 (and that is done), 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. Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Signed-off-by: Tom Lendacky --- OvmfPkg/OvmfPkgX64.fdf | 2 +- OvmfPkg/PlatformPei/AmdSev.c | 2 +- OvmfPkg/ResetVector/ResetVector.nasmb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf index a567131a0591..84716952052d 100644 --- a/OvmfPkg/OvmfPkgX64.fdf +++ b/OvmfPkg/OvmfPkgX64.fdf @@ -79,7 +79,7 @@ [FD.MEMFD] 0x008000|0x001000 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecGhcbPageTableBase|gUefiOvmfPkgTokenSp= aceGuid.PcdOvmfSecGhcbPageTableSize =20 -0x009000|0x001000 +0x009000|0x002000 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecGhcbBase|gUefiOvmfPkgTokenSpaceGuid.P= cdOvmfSecGhcbSize =20 0x010000|0x010000 diff --git a/OvmfPkg/PlatformPei/AmdSev.c b/OvmfPkg/PlatformPei/AmdSev.c index 30c0e4af7252..699bb8b11557 100644 --- a/OvmfPkg/PlatformPei/AmdSev.c +++ b/OvmfPkg/PlatformPei/AmdSev.c @@ -48,7 +48,7 @@ AmdSevEsInitialize ( // // Allocate GHCB pages. // - GhcbPageCount =3D mMaxCpuCount; + GhcbPageCount =3D mMaxCpuCount * 2; GhcbBase =3D AllocatePages (GhcbPageCount); ASSERT (GhcbBase); =20 diff --git a/OvmfPkg/ResetVector/ResetVector.nasmb b/OvmfPkg/ResetVector/Re= setVector.nasmb index 8909fc9313f4..d7c0ab3ada00 100644 --- a/OvmfPkg/ResetVector/ResetVector.nasmb +++ b/OvmfPkg/ResetVector/ResetVector.nasmb @@ -57,7 +57,7 @@ %error "This implementation inherently depends on PcdOvmfSecGhcbPageTa= bleSize" %endif =20 - %if (FixedPcdGet32 (PcdOvmfSecGhcbSize) !=3D 0x1000) + %if (FixedPcdGet32 (PcdOvmfSecGhcbSize) !=3D 0x2000) %error "This implementation inherently depends on PcdOvmfSecGhcbSize" %endif =20 --=20 2.17.1