From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (NAM02-SN1-obe.outbound.protection.outlook.com [40.107.77.41]) by mx.groups.io with SMTP id smtpd.web12.16151.1620419957740516945 for ; Fri, 07 May 2021 13:39:17 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=RyQFbIMw; 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.77.41, mailfrom: brijesh.singh@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FhpRiYfUkpc7XdLga8zSZUSqcga82yAkQqJdXCW8S2AA4G7TyEHDhwUPsGd+C8mkGjWPfsCW48TA6TEsu8xdIr31TL1kIM1dynIkmJRDy131FOzlA5aVbOrE6SeriUQoFwsfCkOn0UXjm8LcG6CYb4eSXK1JHNfsKSZQ9x5oYndmjaZYF67Cgce0gBZs06xIkdALepGobRNMMkgZigm1hQnl+YwDezo8eQfdd6hvFp0c8k/MIc1sB3HuV4tSVYP7GYzH8MV5/M9Ee7heWnHkRiEuRpgIp7udJAqSYFjBAWEX5TkVE7uhGiJhQoPVxi0yYJM+phaXRaMTNdvMBzx5fg== 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=+5IySms+wGrCGNxp2UY6bY9E4ANuSarA135eH3Hqaaw=; b=GML2OQFWUq/2wF99j9idRVeZmKJGUDbWrmnJPWlkkcAdBaIz0De+lgLnLJ8KxszQfMttKK+PcN+qsoFYa4wmARe5V/cmZK6Rn7HJDrCp8IcHvl+P9dvuiLk+XSUbb/0yVWEjUVBvS/hPLIu4OWR+sZ2OS1ElI4ZcMhmb8PJNnAdH4BYQEc+UkBL+ylCg0n5/7N9KWQWeqQKHQGE8aRDoa27IDykUZKc34ttvhtnhXQnIhk9MjwuLYCPo9XbjO4CYaYJkp3auURHVnwXRUrOtjo+k5di9qCkffGa1/z+neGLJMpogYsIxdHMPNUAyBbLNjfFai4JZltxx5xR97p6LIA== 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=+5IySms+wGrCGNxp2UY6bY9E4ANuSarA135eH3Hqaaw=; b=RyQFbIMwNLHd+JFykLDPKKiblFvuKfOF5gY1CuKoPiYmOkgbD507+B2hP/NIa0aRN5ROhhnj3cEpv+X7Du9g0Usr7YyCN9UVMepHTzGJtKeia3AXnq/dM/bwfEGBNU/EQiNRN929dY8AycKa0SHYAWDniwwrvIIQhZd3HdsztDE= 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 SN1PR12MB2367.namprd12.prod.outlook.com (2603:10b6:802:26::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.27; Fri, 7 May 2021 20:39:15 +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.029; Fri, 7 May 2021 20:39:15 +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 11/13] OvmfPkg/QemuFlashFvbServicesRuntimeDxe: use Mmio helper to clear enc mask Date: Fri, 7 May 2021 15:38:36 -0500 Message-ID: <20210507203838.23706-12-brijesh.singh@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210507203838.23706-1-brijesh.singh@amd.com> References: <20210507203838.23706-1-brijesh.singh@amd.com> X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN7PR04CA0020.namprd04.prod.outlook.com (2603:10b6:806:f2::25) 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 SN7PR04CA0020.namprd04.prod.outlook.com (2603:10b6:806:f2::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 20:39:15 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aa02b0a6-31ea-4f06-a7a1-08d911982dfc X-MS-TrafficTypeDiagnostic: SN1PR12MB2367: 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: CKZdkCy7u3muWcdJif/GruS4tJnH48DSKRlljua5ML1QwsyqPaFTMgaW2E89IWLz1tIXCBlSGiQicn9Q2W3aBjxumY/2ia5W6zzo3kEoIQgZR5p4rV1PgF7nkA0RL79gvH9nDBGI0miCrtWLjJLZk+9wINbL6+wtIQH2esyiB0ReyKgK3lMsPa12RANDgHaLZvQ9RNESgK1AutTcv62wkYzNVCVSDWmgtIX6NRqRuweZqgK8zsa5NXhXH/U6yAoEqqiX5CpDk4LP7V4JtcXkQUXrBgB1qJzkNVfoS51RuzxX5BTJH45ANYezImhPv3chxylRE3iFzy9XKMazgpDoQEvcMiVB4cLTfcvxbE0sdnghPovZPZYiKpn26zif0O8Mq4LdSsAA9TAxC8Vh6wLr/mb9jB+waHUmlVh3MrPf1VeKSXuia4qT+zxNXP+SNsh5/QHhYjFmD3xppGz0B+2k7A84vzw2PZi0UCZ/gKuT2QNuW+ukjf4OsAhVpHpVFCQMdtxL+HbP7FGJsbmeCCcd241WbxSFDSTsijSnLlInJ1ha5qZGQ/udYb1QC/By58WOZnPsiq/3ZdQ7M196F5kWdVl5vPWWo57CPVrDwkYg1cUN5YOG2pjNfdQzWDpin1tsH73+FftIKFOA/vvcdGmEkig5E/gvNZsfx4R8zGhRRdg9RccWjOazm9szJ0LDDsXteKUAjV7F+yhQ1hMNzsORtap6819NEB9b7OvomHt9m1zxn4C1DM3fbPMX/1HEa9Y4 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)(376002)(366004)(346002)(136003)(396003)(39860400002)(2906002)(316002)(1076003)(6486002)(8936002)(4326008)(54906003)(186003)(7696005)(5660300002)(83380400001)(86362001)(6666004)(966005)(6916009)(956004)(66946007)(52116002)(38350700002)(16526019)(44832011)(2616005)(478600001)(38100700002)(66476007)(8676002)(66556008)(26005)(36756003)(213903007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?aDiE5ca8X9AR+7VxVUOPbfCMP4SrvPSLbOFA5dcoKj54fkbHmu7jUPEE5k+u?= =?us-ascii?Q?/qWT5FSLtEydeGgcu+BMTVW/nPJ2EJhafx+p7WlkhD7W1KWBE7imH7OL5Ho7?= =?us-ascii?Q?zh4DhKU2aWqYMe0zM+rLq4L24cnegUrLYzZ1KsM7XiCUxtvjQ1WWwqmMB00s?= =?us-ascii?Q?3HZdJjWkRbP43W1yPrtwXouqfdaBut9rmepc/9liR11e58xcwVEXQpLAQu8s?=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+jH5zhVlM4olFD9rCccrK?= =?us-ascii?Q?FYDUwqDyloDVosE3smZ+6ljCn9FlZJiugktPyn0NurKC5r8KrhvzOs/khsqA?= =?us-ascii?Q?xfReOub0P6ITVED7PbBGEL4fO1ulKtY4zs5AUh0/eQDt0EFhVpm9NYWLZl71?= =?us-ascii?Q?pdk6wSXTsMFp30nxtaTxGUM9hpuGVDRMUfSZYsXI1VO6Bxb+7abd09XGKZhK?= =?us-ascii?Q?OC/oteYK2ZnJOIH6YqrAcNm2?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa02b0a6-31ea-4f06-a7a1-08d911982dfc X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2718.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2021 20:39:15.6268 (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: zkDz7SwCyEVdQXPvTVEC8VYOKUeCnoe6ctvw/fxKTGLNUYL5iJ8GPPGMNOpHNi8V9sr1EhKxUZq3ckpk+OJrRA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2367 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 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