From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.88]) by mx.groups.io with SMTP id smtpd.web11.181.1620328860160505522 for ; Thu, 06 May 2021 12:21:00 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=FYzSklSN; 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.236.88, mailfrom: brijesh.singh@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NVMmKfR3L6nizgCjo2NB0KLE3VKzLDMErOw72doZFsU4hwHBQr3DxJml5cq8EnN5GOtIhMiGIgjfAffTOoGaijDcbZfff/P0TTkSR7vFjky98+AtkjIg1r3ltPLIntMCbqt0OnOhKC3skuV3ejk4Qk5zDA39Bv/EDnIzN+EomJprpUtozMfNqzfYKRReaLzuNe5RYeGa0Ol8rvkCXv7Ijsdr6Bk85/jfnBZfa2yXug6ORjavV2fZB7IP1Cl6AThoZH/U+ka28GOinLottKaRpW4aWdZqQD1JxTxBA9AVSj7URw1727kHDxjZMdkswELhpwaTL7Q4nG7nfTyVhm3AKQ== 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=aO9vFIXV1Ow0XqK4lA0HzZdisQ9DpIpO3gP3n+/gSpk=; b=kuVfL+L7Suo/3nRhqBtarbzYp5CzJLkTK7b0oZZCpK30AuT6OpA05Z+yTQsGhG4XyigT1urJ9r+y4Fr8L2cXMobO3BJImW8+T4TRoZS1yqObDAYV91gQCRynU6SKPk/fo7VAfk431Ny7D0fyNxYK4xJCqJVrMafpan3JbCmB9zacRgzmBO2OlHRtxiTDoeM7xwYyT/Th2NMSwiWv6SJWiUkOCzWl1EYKp3czUfZAMTMT2j6Ew04AaGZRYBRxu8amFVUkUZgaQx7CHmdSbi1toMD7tXh9ltjVQd72OSP6Tn2zwB0BXuo4IsprcGpMeEZEF/xINhg0g6npIq0wl19a9A== 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=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aO9vFIXV1Ow0XqK4lA0HzZdisQ9DpIpO3gP3n+/gSpk=; b=FYzSklSNDOzQrr0t4Q5nAxAMvfwTqYE6NagLx5zmu7K8pcmtIhctPicuTI7Ncb5KZCxb/g1DwnGq3VLX61gCDYKhvco9B7+BmDfEPZKX6cKuvYxKU97x8oXmsNJ5HC7Mdz0aSNlA7U5GQ/sZr8uOu/SAPlk1i3gJHL2auU44ogQ= Authentication-Results: google.com; dkim=none (message not signed) header.d=none;google.com; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) by SA0PR12MB4511.namprd12.prod.outlook.com (2603:10b6:806:95::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.26; Thu, 6 May 2021 19:20:58 +0000 Received: from SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::9898:5b48:a062:db94]) by SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::9898:5b48:a062:db94%6]) with mapi id 15.20.4108.026; Thu, 6 May 2021 19:20:58 +0000 Cc: brijesh.singh@amd.com, James Bottomley , Min Xu , Jiewen Yao , Tom Lendacky , Jordan Justen , Ard Biesheuvel , Erdem Aktas Subject: Re: [edk2-devel] [PATCH RFC v2 07/28] OvmfPkg: Use MemEncryptSevClearMmioPageEncMask() to clear EncMask from Mmio To: Laszlo Ersek , devel@edk2.groups.io References: <20210430115148.22267-1-brijesh.singh@amd.com> <20210430115148.22267-8-brijesh.singh@amd.com> <73fccea5-c198-0931-acb8-40a957fb895d@redhat.com> From: "Brijesh Singh" Message-ID: Date: Thu, 6 May 2021 14:20:56 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 In-Reply-To: <73fccea5-c198-0931-acb8-40a957fb895d@redhat.com> X-Originating-IP: [70.112.153.56] X-ClientProxiedBy: SN1PR12CA0057.namprd12.prod.outlook.com (2603:10b6:802:20::28) To SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) Return-Path: brijesh.singh@amd.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from Brijeshs-MacBook-Pro.local (70.112.153.56) by SN1PR12CA0057.namprd12.prod.outlook.com (2603:10b6:802:20::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Thu, 6 May 2021 19:20:57 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eb2e4935-9b59-432e-c6a2-08d910c413c2 X-MS-TrafficTypeDiagnostic: SA0PR12MB4511: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v31Sl5liqz+qt0zsKeka902TAt322b/L73ECEVegF831ry1dVYS9pRD0uddcUBDPtsHAmr6iP0J6RFLKwW59QQVRTpztcwfh6NeJiV+A1GHviv5FH6iki22z2p8JKaCzCCke0yjkTBjOChEjUJtCjxPyN2YYLeM9+3JPcNJd2Pgi8yZdsSVdSQ6OF7TdfEpahB+4OsH6d8DiyipreOpfX5BNG8NOojzoLCTFsfItgwSde07lpUqLEBavU5To5MXUVc99jOHFUWfhBbB41BV9Zyj1kW1tDIO7tqu7A+YGNWdfBDxVAJQslTepRxxb6CP/chXjD0asOcMeG9B4UbnpWHUnOix7kXOduBLd+SEwtfSFP42Jsgbb02DXlbhyIfY+Hn+CUq9CH/6hlOkD2pxGqAUdmyuklapeu9yqHHe0o9c46NuYYVuYJXTdifbTnhcR1DEyqt8XbnXWMsdL1KEXckuOLuC4WInR+fr1IJNAqKbwDd3P168y32vEkvB4jBazNiTwq3v6P1/Tl94KwzCrLcGKs5yZ8qEb+s+QcKfLv5zOWCQ/1FQlJk4ndMK3epDi3xzeC/v6NGt1QeHIC34JVR/BB+upICVXvL0RYKHVqeP76ztdxaSzPDTF2fjINC3J87oEcDz2ROJSjcnpZvAEhypkP2tnU2CdOvB8mwrxFdbgXsONyBkC0w7lzKQUWA/xLpADt5RS9FjRSvzjL5UXS6B9oUsN4HGx1/nfA+DG9VHihgCypUJjH0bwgB3TdLoto8L1Enq5j3N1NB3qvjGSBl7psAzZWNFRELQUNFK0YaJ/YGBIf31apBAii3q+9wYBLtzboWmXmYxrEqPjDypiEw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2718.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(376002)(366004)(136003)(39860400002)(346002)(2906002)(5660300002)(4326008)(26005)(478600001)(6486002)(16526019)(316002)(44832011)(38100700002)(6506007)(2616005)(31686004)(186003)(8676002)(54906003)(66556008)(53546011)(66946007)(966005)(45080400002)(83380400001)(956004)(31696002)(8936002)(38350700002)(66476007)(36756003)(6512007)(86362001)(52116002)(213903007)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?Q2JDVmdnNXJBekRoY1pRcitnZHRablJxZTkvYUIwaDM3YWZnRExka09USTAr?= =?utf-8?B?cFdsVG93eTBWZ1IxbUwzVkI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ource: SN6PR12MB2718.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2021 19:20:58.2141 (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: lMV0MJwRkuqYYKLrcHBTDX1oa/NY4brjJMQT8gC+MnM42yAYlXenr9wg7etGrPyeaXFNpPIkALth439+uZu9sg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4511 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US On 5/6/21 5:50 AM, Laszlo Ersek wrote: > On 04/30/21 13:51, Brijesh Singh wrote: >> BZ: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D3275&data=04%7C01%7Cbrijesh.singh%40amd.com%7Cce4b852d83a14265d48f08d9107cd16f%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637558950553380286%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=CgY57XQGI9QBvj7vipJoJLVZLiEvpfySW17TLLx%2BZm8%3D&reserved=0 >> >> Use the MemEncryptSevClearMmioPageEncMask() to clear memory encryption mask >> for the Mmio address range from the current page table context. >> >> Cc: James Bottomley >> Cc: Min Xu >> Cc: Jiewen Yao >> Cc: Tom Lendacky >> Cc: Jordan Justen >> Cc: Ard Biesheuvel >> Cc: Laszlo Ersek >> Cc: Erdem Aktas >> Signed-off-by: Brijesh Singh >> --- >> OvmfPkg/AmdSevDxe/AmdSevDxe.c | 10 ++++------ >> OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c | 5 ++--- >> OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashSmm.c | 5 ++--- >> 3 files changed, 8 insertions(+), 12 deletions(-) >> >> diff --git a/OvmfPkg/AmdSevDxe/AmdSevDxe.c b/OvmfPkg/AmdSevDxe/AmdSevDxe.c >> index 689bfb376d..80831b81fa 100644 >> --- a/OvmfPkg/AmdSevDxe/AmdSevDxe.c >> +++ b/OvmfPkg/AmdSevDxe/AmdSevDxe.c >> @@ -53,11 +53,10 @@ AmdSevDxeEntryPoint ( >> Desc = &AllDescMap[Index]; >> if (Desc->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo || >> Desc->GcdMemoryType == EfiGcdMemoryTypeNonExistent) { >> - Status = MemEncryptSevClearPageEncMask ( >> + Status = MemEncryptSevClearMmioPageEncMask ( >> 0, >> Desc->BaseAddress, >> - EFI_SIZE_TO_PAGES (Desc->Length), >> - FALSE >> + EFI_SIZE_TO_PAGES (Desc->Length) >> ); >> ASSERT_EFI_ERROR (Status); >> } >> @@ -73,11 +72,10 @@ AmdSevDxeEntryPoint ( >> // the range. >> // >> if (PcdGet16 (PcdOvmfHostBridgePciDevId) == INTEL_Q35_MCH_DEVICE_ID) { >> - Status = MemEncryptSevClearPageEncMask ( >> + Status = MemEncryptSevClearMmioPageEncMask ( >> 0, >> FixedPcdGet64 (PcdPciExpressBaseAddress), >> - EFI_SIZE_TO_PAGES (SIZE_256MB), >> - FALSE >> + EFI_SIZE_TO_PAGES (SIZE_256MB) >> ); >> >> ASSERT_EFI_ERROR (Status); >> diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c >> index 1f285e0083..ab40087a84 100644 >> --- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c >> +++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c >> @@ -205,11 +205,10 @@ MarkIoMemoryRangeForRuntimeAccess ( >> // memory range. >> // >> if (MemEncryptSevIsEnabled ()) { >> - Status = MemEncryptSevClearPageEncMask ( >> + Status = MemEncryptSevClearMmioPageEncMask ( >> 0, >> BaseAddress, >> - EFI_SIZE_TO_PAGES (Length), >> - FALSE >> + EFI_SIZE_TO_PAGES (Length) >> ); >> ASSERT_EFI_ERROR (Status); >> } >> diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashSmm.c b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashSmm.c >> index 7eb80bfeff..ea75b489c7 100644 >> --- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashSmm.c >> +++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashSmm.c >> @@ -38,11 +38,10 @@ QemuFlashBeforeProbe ( >> // C-bit on flash ranges from SMM page table. >> // >> >> - Status = MemEncryptSevClearPageEncMask ( >> + Status = MemEncryptSevClearMmioPageEncMask ( >> 0, >> BaseAddress, >> - EFI_SIZE_TO_PAGES (FdBlockSize * FdBlockCount), >> - FALSE >> + EFI_SIZE_TO_PAGES (FdBlockSize * FdBlockCount) >> ); >> ASSERT_EFI_ERROR (Status); >> } >> > The contents of this patch are sound, but they are incomplete, and > incorrectly structured too. > > (1) Please provide a separate patch for each modified module. Noted. > (2) You missed the MemEncryptSevClearPageEncMask() call in > TpmMmioSevDecryptPeimEntryPoint() > [OvmfPkg/Tcg/TpmMmioSevDecryptPei/TpmMmioSevDecryptPeim.c] -- probably > because you worked on this series in parallel with Tom working on the > SEV-ES TPM fixes. I guess Tom's patches were not accepted when I rebased the the SNP patches. Will pick those changes in next rev. > > In the end, this patch should be split into three patches (because the > change is needed for three modules). > > Thanks > Laszlo >