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.84]) by mx.groups.io with SMTP id smtpd.web08.15798.1621448415664855986 for ; Wed, 19 May 2021 11:20:15 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=dciJFXEQ; 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.84, mailfrom: brijesh.singh@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KCN6thQL6GMs+ippn+3HjX3pqIqE2AYbWJd6ECyXtSrDZTTNrvFIPQoWAANlHCDaZpg4G3yfY+ItsHzDeltoLNAYeNfMPm+znTveha+8FuuYuM4aZF2mEzYVR2pz9jBMGtTPptGCDUYROyF+QA/P6JTaBjQOaKA0SoaWcdKDy6Sfdty88f0HxF/bywmMD4YiTYQBawrJok5AKDMzP1QpHlapdCqnINEOujoyHAqOuO3ukYw5UhzDNZzHD9m+O3jE0h4TanhTbYuTjsaujxLsRI9SkE5H75Z+aevpvqhF5UKfM7AYeJL04YGZUMX+kb4me2SZLa/Wqsxuqu/GGWM58A== 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=fzufsZrWgS+UNzs4KbfjAj1i6bjJ2PYGsIILu54EiEI=; b=IfJbwqPd6uCAZYbBN4A4JA0PANT6D2X6TjmDdP29Nwl4Ac8o3zr3s0cSBNDr6KPU+BLih/EyAItH1TziXYM0rD45wCZxLgJczTb08JFyQwMYvdBSNJmQ6+qRGZb/lFvczEJmp4dtVBobqwN9gyYJRmZoJx71LWZS2yVkH/3AFu3Gjnjtyy2eYkSpfUp/c4ZK3CeqsSmO3YSd9SFCtT3dpCv1+uvse2dlXMIgQ6no/5qc9UiqcrHM8gplCwGKfgIfQVtSu/x/JUjgqnokpzSbV2VvP8TGWWw2/bHlCsvgM+4kb6Q3C2WMWZkHVM6cUdJNFVgSgHJkVXOxdtGPHbZrWA== 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=fzufsZrWgS+UNzs4KbfjAj1i6bjJ2PYGsIILu54EiEI=; b=dciJFXEQJAUDCffg2BLvunMiTPJfElYtVSQkUYhNh+Wz+NM+xFiRStR4D/TYQps0kGXSYDf8kZf6gnOoYuV8qABXIzY1D9coIxTVd5HupUhSeDO7XuK27JXdPrD7lZMgys+q6JMsTDTeU+RIV5s0NWt6w8bUA+gbRiyRkgaFGHM= Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) by SN1PR12MB2365.namprd12.prod.outlook.com (2603:10b6:802:2e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25; Wed, 19 May 2021 18:20:13 +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.4129.032; Wed, 19 May 2021 18:20:13 +0000 From: "Brijesh Singh" To: devel@edk2.groups.io CC: Brijesh Singh , James Bottomley , Min Xu , Jiewen Yao , Tom Lendacky , Jordan Justen , Ard Biesheuvel , Laszlo Ersek , Erdem Aktas Subject: [PATCH v3 11/13] OvmfPkg/QemuFlashFvbServicesRuntimeDxe: use Mmio helper to clear enc mask Date: Wed, 19 May 2021 13:19:47 -0500 Message-ID: <20210519181949.6574-12-brijesh.singh@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210519181949.6574-1-brijesh.singh@amd.com> References: <20210519181949.6574-1-brijesh.singh@amd.com> X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN7PR04CA0212.namprd04.prod.outlook.com (2603:10b6:806:127::7) 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 sbrijesh-desktop.amd.com (165.204.77.1) by SN7PR04CA0212.namprd04.prod.outlook.com (2603:10b6:806:127::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25 via Frontend Transport; Wed, 19 May 2021 18:20:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 89145bbd-0417-4326-292c-08d91af2beba X-MS-TrafficTypeDiagnostic: SN1PR12MB2365: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3ovcvVYZ31WiAdnMvW2eIoltfRakym7ayU4PRx1yNwCWjlOVx8omVKNyEA4yYAbWwMtlXWqtXLCEtVFkkPlISMV6atrRUilPhpVGPwr/FCoAaqjy68EiXkSMFe9efMri6GmIM6hIiduRzklprazhBZ3lXy041e2ko1O2MltHJ/wJjYiYIAhkVJO41H4W1eBTfE5R51TDWQS89ADE7BKsVvks6aeVCVMFYNKLMTyWcNxLX3zTECgifev7sG64r4nPl5oC3rx2hCAy9PkkSoY+87dNG357eORUoP0zEyNoDkoW5+/HwnDXPDNNyC2hjruP9j6Q+6q4hEcvmmx60FSwxjg5SNVGaREYP7vlZ9/DpHpXr8BZ4MtLuwAsgnuAwqOSL/6byZh4WSvzga/+rXbEZuKCdZo5u2a7ypt/LhrBLlgLH6KmK6Fhfvx23pVi2sIwNQ2xKSnrTPtK5B7dvpst4ixvtDNNFBgrpqrrHnlbcCbO2r6gAO+RTqjrh4tmTyrmUphg224szNuqSmcXox8WHKY1RlOk7FJAK/JMS50fs32cKQ8AfarfpujI91oawCnbkTVophPsY83lTWsYNUTmh6aVGaIw26sKe3QZJONaULJZXQiSteL8gldQWjYcVhrjPknhDfRKinoLZPe7XpdXJ0m0xPaPA+kAaY2HRIm1n7xIDRXqOhb5jH4978nVNw85uDd9GCWrL2hGnLWvSCQGBkjd4IMMZqf0Xqbl9xSyZmbvmVSSOAcl0786KmzKd+VkjrYcVbtuckLTEHkyUsUH/g== 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)(136003)(346002)(396003)(366004)(376002)(39840400004)(16526019)(4326008)(6916009)(956004)(2616005)(478600001)(1076003)(2906002)(5660300002)(6486002)(966005)(54906003)(66946007)(66476007)(316002)(8676002)(66556008)(8936002)(83380400001)(36756003)(38100700002)(38350700002)(86362001)(26005)(7696005)(52116002)(186003)(44832011)(6666004)(213903007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?7QV2HjFbvOCCoaaETIw/9herUB4f6EUKZi592n4QSPbNi4McJ8+3oxTrC1km?= =?us-ascii?Q?wqK7YCKn2kNHM9qP6KHP+4GjS+DMQ4kmCBCEb44CoPa1k2422WgPrGZ81oPO?= =?us-ascii?Q?qlqr87D1SIGo3OT6wNPjSvjkt4E3HsfdewmWIAgMZ7daR59tBIKGAMtGvtQN?= =?us-ascii?Q?Sa1mlIA3p2tQub98FNoI6j1NrV9IzeZCPnuPX6TNL6Qk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oZa+6Hz5hPv7CJHgKcCzZHm2Zpx3zFckdAhfAc5hC8fw627P0pn?= =?us-ascii?Q?4SCOaQP/KcGueBf7NhSl5E+x0wjJlrpGITS/rWqvw3NpGlTfGgANAK7RZlSO?= =?us-ascii?Q?qot2KaK/pGDgf+oaEOxU/P5h91M2SV21Nh64NuR359FI8cihJVhG/WN623iE?= =?us-ascii?Q?T6J1F9ad/JtNhFna4Cg5+VCqaqi0F0kFITCdBnvQyxlNiO+09mne1J8VgXD+?= =?us-ascii?Q?aQsdWWJEe7HnI6W6bukaHdIS?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 89145bbd-0417-4326-292c-08d91af2beba X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2718.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2021 18:20:13.5593 (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: lyhrwU16jxaJPEr2f6q+m9gkOSx1dk8IWKJ5krGsrNUmY2xXg9BSUu1bAhfCAjdH6N3L8vwdesBDwKzN0c71JA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2365 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3275 Use the MemEncryptSevClearMmioPageEncMask() to clear memory encryption mask for the Mmio address range. Cc: James Bottomley Cc: Min Xu Cc: Jiewen Yao Cc: Tom Lendacky Cc: Jordan Justen Cc: Ard Biesheuvel Cc: Laszlo Ersek Cc: Erdem Aktas Reviewed-by: Laszlo Ersek Signed-off-by: Brijesh Singh --- OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c | 5 ++--- OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashSmm.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c b/O= vmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c index 1f285e008372..ab40087a8408 100644 --- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c +++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceDxe.c @@ -205,11 +205,10 @@ MarkIoMemoryRangeForRuntimeAccess ( // memory range. // if (MemEncryptSevIsEnabled ()) { - Status =3D MemEncryptSevClearPageEncMask ( + Status =3D 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/OvmfPk= g/QemuFlashFvbServicesRuntimeDxe/QemuFlashSmm.c index 7eb80bfeffae..ea75b489c7fd 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. // =20 - Status =3D MemEncryptSevClearPageEncMask ( + Status =3D MemEncryptSevClearMmioPageEncMask ( 0, BaseAddress, - EFI_SIZE_TO_PAGES (FdBlockSize * FdBlockCount), - FALSE + EFI_SIZE_TO_PAGES (FdBlockSize * FdBlockCount) ); ASSERT_EFI_ERROR (Status); } --=20 2.17.1