From nobody Tue Feb 10 15:29:42 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+82364+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1634672405015509.4148099202997; Tue, 19 Oct 2021 12:40:05 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 45YvYY1788612xxxISP0GeI2; Tue, 19 Oct 2021 12:40:04 -0700 X-Received: from NAM12-DM6-obe.outbound.protection.outlook.com (NAM12-DM6-obe.outbound.protection.outlook.com [40.107.243.73]) by mx.groups.io with SMTP id smtpd.web09.15157.1634672403858711784 for ; Tue, 19 Oct 2021 12:40:04 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b5RBKZaaE7Xw83t3qIyjgYfN8TZuiVxqSJwx5P3mrUy7QXKws5zNunis0hhiCAKzNIHbZFoKfGMo3VakhIIAu6/Xv/RjZtgfK6cCfF4dw9NIjLl+CmNH6N2mqCes5XrIAMuPFvK3Ndij6CKVZQI4lGKNYbkSd13RqtJOUxdxLcRUB6VZB/7DjWa/NBOZDND1L3J9NVHssGoINIBCZ0LhWJFJvMGD9fgQU7MFGuInzuS0Fh/+Mp23QHg8bk+bHH4k4xK6j9AoZZP/hbppxYVU29OE50bQc6cRqB3XQ3kzstKLERX8F8CgdHYi2s7+Mi1u0gPSDmyN2YGkYW8InuWKhA== 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=Pn3PmyEdukOhReK7eY+xTww+5rJvhITzFrZSkRQ2qgGxHDJqCTXv8qUJqYIpXjcCEsYxTwuQlg3QKFxhN3cXRij130iJZ1ciBK9ZKzKXmAZEWzl1D8ouI6hbHiVn/8kqcbMIOxfNFHdfEniFIASIvRUfMn0pf/iMlWtzKIn5+/7v/xMUSLna/KEp/unPvALt1gh5/epGmjnXPDTqA32p3FHddoM2ftWSFk2Gwr5QW8hwmvcWn+AHa5sOEfy3dG2+oe+UgPq5Lm+AVf4RzGD2QD6ixaiW8hfNkEOtqHfjR/rM+Qhq6kfZ8ydQiHyeWR7exwuqT9wh0zbBW2oV9QnSTw== 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 X-Received: from MWHPR14CA0063.namprd14.prod.outlook.com (2603:10b6:300:81::25) by SJ0PR12MB5501.namprd12.prod.outlook.com (2603:10b6:a03:304::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Tue, 19 Oct 2021 19:39:58 +0000 X-Received: from CO1NAM11FT004.eop-nam11.prod.protection.outlook.com (2603:10b6:300:81:cafe::ed) by MWHPR14CA0063.outlook.office365.com (2603:10b6:300:81::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Tue, 19 Oct 2021 19:39:58 +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 (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+82364+1787277+3901457@groups.io; helo=mail02.groups.io; 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; X-Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT004.mail.protection.outlook.com (10.13.175.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 19:39:58 +0000 X-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.2308.15; Tue, 19 Oct 2021 14:39:52 -0500 From: "Brijesh Singh via groups.io" To: CC: James Bottomley , Min Xu , "Jiewen Yao" , Tom Lendacky , "Jordan Justen" , Ard Biesheuvel , Erdem Aktas , "Michael Roth" , Gerd Hoffmann , Brijesh Singh , Michael Roth Subject: [edk2-devel] [PATCH v10 03/32] OvmfPkg/ResetVector: move clearing GHCB in SecMain Date: Tue, 19 Oct 2021 14:39:05 -0500 Message-ID: <20211019193934.1052465-4-brijesh.singh@amd.com> In-Reply-To: <20211019193934.1052465-1-brijesh.singh@amd.com> References: <20211019193934.1052465-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0e57fca1-f023-48ae-98f6-08d993383c1e X-MS-TrafficTypeDiagnostic: SJ0PR12MB5501: 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-Message-Info: t2xsPuFj54Dz8bQAk5YuSoCI6VDKOUt4WdqvNY5qHLZLPf8iihsjds6PlIF8fBjucqehpZioOSr2BsY9A7HF0LayC1ibuaOU7bzI7wnj/vgkeKX4qXD0dEOMY8TG9QBDHsNaBMTsWfVE2t+w1hEZe8YOGn0VC4OeC2Pry1QKcNIZOrdO3DVoQT8UdaqOTs7eYYt0if+DkgKntKikXRtl4j4UO4Mk0U0iBzTG41Tvi88PcafqogvrDZyeAwtA7kHl1iIADRu+f5VVrau6CVrIrxbIvFcCNtPhHa4KRPJCPIklFXvTF79eKidONIsobbmCqbPChDxhpWEhNIHus4vE2QZbnGpobI0jswednp46GfS7isjkvuqYXv9jmBTRTgPYVMKzui5+D7RqGGB+hjpOvH1ItugzZ3doUGhmEBnn1kacp3HBNcmwyTvCNse95j+bs9ClzzGOBXkTG01CaiiTxoVjiZ/cAGtF21AwYd1SutNaj3WJqjWpmBBNdSHttEs5PoNex5d16iMWghSx1Vqcr7ClINceVbEY6BDQs6ANsQMdCYYu3PBxXx2t6Rpxi0za6qxp4jP9qdDTvc/7cc6QY1ljXGyguenbyTLNQTkpTb5GCuEb4vEVrCkTE7ExsBebtdNrKAq5UXtaLgoeF2ggDTxf8CrxzEEAiF1lBo4L350Ox8rkerK4l4nUKDYfv6CIEX7E5mI35OzjW7N3jsXwRE/tio7HRDa0mJyrWqse3VYborWtQ6x2DhC3TucXyp6+akuq8+sjAHINIHjxS1ZMlrxx6CEEQhiC5FRAQczthUL5EoK1X3VUOmXSb3beXnTc X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 19:39:58.4176 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0e57fca1-f023-48ae-98f6-08d993383c1e 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: CO1NAM11FT004.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB5501 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,brijesh.singh@amd.com X-Gm-Message-State: rP2YVOQerAKye748pwZiyFOkx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634672404; bh=atxreYYX1ROJOdzRwiSTo1Dc6DXoVSRve6jHl9Y3qKU=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=n3s2nGnbG4k8oVzkjBI+0163hlBb+D4A4DxzTrdH0o0j071/FW7BStU621XM33awcnw +9x9h/oA1+fiDSpe4Xi0LnpHTXEB8jjMJ8/9C366In8fr97vqYXOMLgBgvKrTTyafwUuU Rw9mhaWsA6a5+t0ZfAd9DYpmLnY5J3W5qPU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634672406685100004 Content-Type: text/plain; charset="utf-8" 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 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#82364): https://edk2.groups.io/g/devel/message/82364 Mute This Topic: https://groups.io/mt/86448798/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-