From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (NAM04-MW2-obe.outbound.protection.outlook.com [40.107.101.46]) by mx.groups.io with SMTP id smtpd.web12.109.1634144263488404743 for ; Wed, 13 Oct 2021 09:57:43 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=0A9VCL4U; 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.101.46, mailfrom: brijesh.singh@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gSMMh1t7wt3TFJ8HcN+L6EUuMTz/DVyyn0ohSw7ajcetDmJPu9EqXTt76YBuo/KYIvumY4m8b5sDIePG6RTcugEBsNpupGBU00T9orDTQ8nI1bxQlT6+NBsTuvLWQQKXcjNinieo2Oeqov88Ebsoyxvc/7JlY3FUFMEWOVGrPTQcUh5DTw26zzN+PmRIgssA/0ALhJHWkoG7Y8N7ZF5bgelgi2KJ1Nh6Cy3hZn0zubTdZVEj25PeeX+2+d+9thXSV/gKVWMZSN+z9aamSEumHetLBK3Y84ykaNW8SfHY33KBwtLvxv/D7bcnqWG7Rl8J3pS9w0vUbGCnwFjFPnqAAQ== 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=AINumP86uSNPlYoT8Fq5kGXANP8TRYHU1Ca47I3OecI=; b=MX9pTgmUdOGyY7UBEAcPQ+Md3UwNsRgNmnGvPNJhC0JIpyDKBlyvAyEKTKPU5tz+KnvtRahLIoM+/pRDYlGjXzDumPq3KLaC2ve1/VITB9RXVGv9NGlynUnlGwQGUA7auUJXtoVeqm+6Vs0fOT9XulPuDAuSwDGoCEide6QVReF+F0VipMbQlU+NuVGHxWN51C7epyD5C1wvAdN15ZsSLpmIh4ylW19U6IYrmZ+mfRQ7jKDQJ/t0ldhm7ftbSz7S/0EBAmq6rQP5nxrBrhbFLOJZI8X6w/Q4cxsq2da8YzApwC/O/cq9q5GNwgNXwPYyUMDq4NdpIusTtDuQULz5hw== 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=AINumP86uSNPlYoT8Fq5kGXANP8TRYHU1Ca47I3OecI=; b=0A9VCL4UKpwDOe4yFZYHgsWbKZt1bpD6mZC7+mGzIB6g6tSfwpJLiSJHcWSXQ0RR4vcECEPcfHWFHMm6YxdCibhGQXkbW5cAW7ZnmS1HmVkN6FTCzZFCv3FQiX2IMKJ8Hf5xHiQ5GBTJhRtGDH2VqEBbbZrk8YUZ209CptSEeKY= Received: from MW4PR04CA0056.namprd04.prod.outlook.com (2603:10b6:303:6a::31) by CY4PR1201MB0119.namprd12.prod.outlook.com (2603:10b6:910:1e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.24; Wed, 13 Oct 2021 16:57:41 +0000 Received: from CO1NAM11FT039.eop-nam11.prod.protection.outlook.com (2603:10b6:303:6a:cafe::df) by MW4PR04CA0056.outlook.office365.com (2603:10b6:303:6a::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Wed, 13 Oct 2021 16:57:41 +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 CO1NAM11FT039.mail.protection.outlook.com (10.13.174.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Wed, 13 Oct 2021 16:57:40 +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.2308.8; Wed, 13 Oct 2021 11:57:38 -0500 From: "Brijesh Singh" 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: [PATCH v9 03/32] OvmfPkg/ResetVector: move clearing GHCB in SecMain Date: Wed, 13 Oct 2021 11:56:44 -0500 Message-ID: <20211013165713.727815-4-brijesh.singh@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211013165713.727815-1-brijesh.singh@amd.com> References: <20211013165713.727815-1-brijesh.singh@amd.com> MIME-Version: 1.0 Return-Path: brijesh.singh@amd.com 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: 56730f95-8d00-4cc6-e618-08d98e6a91ab X-MS-TrafficTypeDiagnostic: CY4PR1201MB0119: 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: p2zxs0Jwvin9tsIZcj/ilLjK00DwxPiGHSBypmZHv1wN5CtyhUgGKgSqucvJ5uijDhLoWNUWqBmzqf7kF0v+3B3iVCmCF8XXeryWMEeL2Ct0kab5GlcPaxjLzLQu9OpRobQwtjDQDdd4nSqdefZAj7xE9cebze7Zjr0SK0dM+2ijP89RYtUFApkHXhUxpR7Jf3CBzsK5FtwZCazVfOTwirfAyMENlJ8c8+1IrjPj2MIgsGmC75wnWRX2ACZ1rUPpb7BUgMw4Vo/a3v7MV7NAAbeOuW7GPAucju44fldZ7/LcR3703PjObZol9lhSMGCbDJ0XFUO5vlOiam0kuEKMrBMgj+ojs+dGlonZUoy6mDZoyQEAlhap4LvsvXzDLdTGEwwrC606k56giu31sZvvtC6mapZfKuWirEGV3a65CpCPI98g7scy3ZxakaF3NHLlVh7lzpuOE8V/jzePeAXZI2hw8HjMAmn9vv1UW1Xc1d5EEHz03BZQLz/zbqmftLpmlIprO3BVQSt2vqkROgxDmcfn44Kj2mGyhb2BiCFwAhDAuLqlcuYnVk1OyO54izA01hPWqrNBx/Qz2Wf3aznsfV8nXDBDcL/P9VdqjQFaiWj0IkJhlTucNP4qODK3c7OND4BIj+C0xRO2tRoi5pnPvnbs/M+6c2iJu4KmQWxhRD9bQm+3uk5+jZnsEUkZA1y1qYamPZHMgxIkLO3NvUtgLZPSHbNJUhNvKSuVvP5V6zBVFLSUAgWADpT58a9IIx4HegQWgqKreerRNiAPTzgYB4dxgQJEJXzW8C3wWsXB2EEFm2w++k7LWWeruL2K1cTb 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)(46966006)(36840700001)(6666004)(44832011)(70586007)(1076003)(5660300002)(81166007)(508600001)(70206006)(2906002)(6916009)(356005)(82310400003)(966005)(8676002)(26005)(19627235002)(83380400001)(7696005)(47076005)(316002)(4326008)(16526019)(2616005)(426003)(36860700001)(336012)(8936002)(54906003)(186003)(36756003)(86362001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2021 16:57:40.9776 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 56730f95-8d00-4cc6-e618-08d98e6a91ab 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: CO1NAM11FT039.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0119 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 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