From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (NAM02-DM3-obe.outbound.protection.outlook.com [40.107.95.79]) by mx.groups.io with SMTP id smtpd.web09.2438.1636582521102679805 for ; Wed, 10 Nov 2021 14:15:21 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=CV62sUmh; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.95.79, mailfrom: brijesh.singh@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kpur7yOn1nDXHVV104/z9kZX4H/EZ4SLDsuJcl6Bte3bBLLBQVeSWCaQWcO+ved0yb1m48l1AyCfw/knvd/Qxh4VFFBQ2r33R/fAuswGUCBVoBeyW+daFCT6aodpdxHnhy7TKdGj6770Pimd9G61mMxgmoU7mosMYLOfiuxr6XD8bolaZdCSmEVaOxvz+mGXVR+G9KnPTHV3hiVEzKudghCDHLzj51a7qLEt34daXAB1D2/WBVsj71vx7L9dseWaDDrKiln8r6hqVnQ2DrB6WlGROcivEuGYh/xN7vQDkXnkdTP1vR3HpiyRTT6Uy7707+6aQe1g6px6TCD/FO4WEw== 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=uZfAVbIA9EkCcp2VP3oV/UoxB+1F6Mw8Kfvwp/RP3ZI=; b=GLkLbfsbEiUjo2qB6aGNgYVwmDLpdnZ0KD1oFqc1+hTA/D0+7SEwBI8WhB0r570s1U6AmnWcBsfnAhoy8Or/HW1RrsITFTjSX3R4L4otlHFLtiAnmD36YctIrPzKhD6BrSZfwVjOD5B7qAuJvgyYfXv9lPVk/LaQOpG5eptSGqulDzk02lrwnCgqK891LBBsCDc71dR2hF2xjA6vTCgaYe0nsNjHs0EYFJ8m/dV0oGgLUTks36aIocD/WKtdxJdirGzWkGmB5jI0xkoAgw5rkQyqfSdR1HFKQEQacOXGd2cmVMJt5J9oG2WyxDgKdap4RebIIDuoEE58xA1PbrfFkg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uZfAVbIA9EkCcp2VP3oV/UoxB+1F6Mw8Kfvwp/RP3ZI=; b=CV62sUmhkcfOVtLyUdMEz6b11b7zhuDrzAteikqZOQVZZ8LoEKdB4HOYVnw3pg5GHGSHzyg5NeivlwAVjhWyOpGsYCO/kFWMd5C1yFVWky/FrJsQU7cW3QZFy8EWIakGPnm0MHE2nWan3ThlkyNUYnNatS95TI6MBsXkZEiumuU= Received: from BN6PR2001CA0010.namprd20.prod.outlook.com (2603:10b6:404:b4::20) by BN6PR12MB1698.namprd12.prod.outlook.com (2603:10b6:404:106::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11; Wed, 10 Nov 2021 22:15:15 +0000 Received: from BN8NAM11FT066.eop-nam11.prod.protection.outlook.com (2603:10b6:404:b4:cafe::7a) by BN6PR2001CA0010.outlook.office365.com (2603:10b6:404:b4::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.13 via Frontend Transport; Wed, 10 Nov 2021 22:15:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT066.mail.protection.outlook.com (10.13.177.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4690.15 via Frontend Transport; Wed, 10 Nov 2021 22:15:15 +0000 Received: from sbrijesh-desktop.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Wed, 10 Nov 2021 16:15:12 -0600 From: "Brijesh Singh" To: CC: James Bottomley , Min Xu , "Jiewen Yao" , Tom Lendacky , "Jordan Justen" , Ard Biesheuvel , Erdem Aktas , "Michael Roth" , Gerd Hoffmann , "Michael D Kinney" , Liming Gao , Zhiguang Liu , Ray Ni , Rahul Kumar , Eric Dong , Brijesh Singh , Michael Roth Subject: [PATCH v12 03/32] OvmfPkg/ResetVector: move clearing GHCB in SecMain Date: Wed, 10 Nov 2021 16:14:28 -0600 Message-ID: <20211110221457.2397234-4-brijesh.singh@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211110221457.2397234-1-brijesh.singh@amd.com> References: <20211110221457.2397234-1-brijesh.singh@amd.com> MIME-Version: 1.0 Return-Path: brijesh.singh@amd.com X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d09ad210-604b-4c86-efeb-08d9a4979282 X-MS-TrafficTypeDiagnostic: BN6PR12MB1698: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T8WTLy0jhV/k7d7DvY/RLnFTL/6kmFTIDWGlwTesd+x6vipB+ux33QhJ4tKJ4gy4Z20/HhuGmLEpfeOQHqmVOtR4hpEAph9931I7p6B9/SHmsz3Y1I5RFIl1T+E1p2RnLBa/nqZxKi63n5gQfosQWJLK4r0M3zpxnhHHLHEoNv5O0T8r4GJYGUfWlgRYOzb03nTqvJW7vA6b2jWIkU44IWfca989Qg0NWrfs/ToBIawZRKwVHWK5YposAcH68lGgiDVAp//D3IYqMj6OlOBYjqX4r3TObOVQimaogiZV1tjQlFeLDRycVW/w5l4oA6HmqH6WwsoiCNEpyjoMidVklqr3X+13WnC0gQJUUNKGoHK6wrzrhQY5CKYSliVMo4IEPSNpNybFS2wkBVwSeTk0QKEYx9xmK5YBara1wiLNGSDJk6YowkYkiH5B/m/JBX2q+oRkhVBBbmMZUfoVle/qweFM/YgJXuCP+ra3bIPChhmgfeEQuld9mv6bz2gw+4eIjxJ6appAV5bF0mAlpqFVEi8z+1BiS00X0r9LJHFJ9a99zjxM3jA9TGg7SxO3dJWoDM8hZbmlsAu+K7mRwUF0wkT18czJSusW0WnROLF45fxmmKYxN+Hku/q1zuXAYPHB38x+iE1VsVbZrSpLrB7N7pW/TPnlGq3v0NGGIdq/O4xIOYuZskGi5TPfLeiWP4+XMS5uPTV/1l6uUGIYnfGVXitB0RO2faYYCLwQ7Dakfc2cQRe6tqJfjy9cV5DIk5uZOILz9dbnx2pFmzG7iw5khe0ZlhJCjTrzTNzBVuQrttagqxuT9mjUVVjNEnkA/J2/ X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(36840700001)(46966006)(44832011)(36860700001)(426003)(1076003)(19627235002)(6666004)(8936002)(54906003)(7696005)(336012)(7416002)(966005)(316002)(2616005)(83380400001)(6916009)(47076005)(81166007)(70206006)(8676002)(2906002)(508600001)(4326008)(186003)(16526019)(86362001)(36756003)(82310400003)(26005)(5660300002)(70586007)(356005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 22:15:15.4277 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d09ad210-604b-4c86-efeb-08d9a4979282 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT066.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1698 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3275 In preparation for SEV-SNP support move clearing of the GHCB memory from the ResetVector/AmdSev.asm to SecMain/AmdSev.c. The GHCB page is not accessed until SevEsProtocolCheck() switch to full GHCB. So, the move does not make any changes in the code flow or logic. The move will simplify the SEV-SNP support. Cc: Michael Roth Cc: James Bottomley Cc: Min Xu Cc: Jiewen Yao Cc: Tom Lendacky Cc: Jordan Justen Cc: Ard Biesheuvel Cc: Erdem Aktas Cc: Gerd Hoffmann Acked-by: Gerd Hoffmann Signed-off-by: Brijesh Singh --- OvmfPkg/Sec/AmdSev.c | 2 +- OvmfPkg/ResetVector/Ia32/AmdSev.asm | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/OvmfPkg/Sec/AmdSev.c b/OvmfPkg/Sec/AmdSev.c index 3b4adaae32c7..7f74e8bfe88e 100644 --- a/OvmfPkg/Sec/AmdSev.c +++ b/OvmfPkg/Sec/AmdSev.c @@ -95,7 +95,7 @@ SevEsProtocolCheck ( AsmWriteMsr64 (MSR_SEV_ES_GHCB, Msr.GhcbPhysicalAddress); =20 Ghcb =3D Msr.Ghcb; - SetMem (Ghcb, sizeof (*Ghcb), 0); + SetMem (Ghcb, FixedPcdGet32 (PcdOvmfSecGhcbSize), 0); =20 // // Set the version to the maximum that can be supported diff --git a/OvmfPkg/ResetVector/Ia32/AmdSev.asm b/OvmfPkg/ResetVector/Ia32= /AmdSev.asm index 250ac8d8b180..48d9178168b0 100644 --- a/OvmfPkg/ResetVector/Ia32/AmdSev.asm +++ b/OvmfPkg/ResetVector/Ia32/AmdSev.asm @@ -177,12 +177,6 @@ pageTableEntries4kLoop: mov ecx, (GHCB_BASE & 0x1F_FFFF) >> 12 mov [ecx * 8 + GHCB_PT_ADDR + 4], strict dword 0 =20 - mov ecx, GHCB_SIZE / 4 - xor eax, eax -clearGhcbMemoryLoop: - mov dword[ecx * 4 + GHCB_BASE - 4], eax - loop clearGhcbMemoryLoop - SevClearPageEncMaskForGhcbPageExit: OneTimeCallRet SevClearPageEncMaskForGhcbPage =20 --=20 2.25.1