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.85]) by mx.groups.io with SMTP id smtpd.web12.16149.1620419956704136651 for ; Fri, 07 May 2021 13:39:16 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=fcAZ9hT8; 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.85, mailfrom: brijesh.singh@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z5LQWO/ez0ji05dtRVKTOxWzUwFrwVBUo8WraLyUHwy4e4Gl/eQdluFjEojibxo3kBlDduM/D7LF4iQJcuGUZffGLaXOsbCjwK1mEhaa4gIJhLxWMaJR/7kaAptcTcl7eOArJfBtlo+rrsAB/45p3XqgJwvyt219bGw1e6CUXlfTBF3Hs/unvQV1HWtXaeDQX69x8tnNH6l4FJyOOtNs8U2KrwSzA1lh0DdLcL8cjHy9LIFIw3tju4u2638EKVtzayvFYY5IDa2jN00sdSDAOkfAXK1gDJusZ2wb96+nuigMBhrtYkrd26XN1wXD8djiTNr8O/wE/E1qsdItqZk6FQ== 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=ZNBSNu801ETdcnbLldO/TL7s9c82ULUThKZlujLAFNs=; b=UGMknZn2vFNRzjylPEzCHBzmbjNUbKkxZp2yaOf8mbsPHV1mvX53DSCCFPD3tZdz9FpPjkHprit1QJOy507+OLWGREmIFE7JdfeZ//K9x6Rhz/00mv1TesndVRzWZQlGSGhi0/ROH0JWuCMRY4E/cgtsgJRa4J+FlzIvnY8Sqe0sS/K43rFJSxD6eM1sEdLilSF21gBp+r3WGeIy+LE9bxYmxpzVq4Cb3djZOGYaC73qzKYNzusnW9pPimlpWgazSthgV8cFluIwZh9EHnOTwaJhNpKLCHaCIrU/nRsX3oueVSI5rtdeZFsFYFrELTtIv8t5BGoObzCISEe0vJjEhw== 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=ZNBSNu801ETdcnbLldO/TL7s9c82ULUThKZlujLAFNs=; b=fcAZ9hT8u7zigHiSW+7PBHTE9AjzCtzIYXvOqZ+SSt3XHONxaeRo+Dv/uq3o7ZZ1gT9rAJokQJRmfdu+raGWFpVb4eApcVpMLML+rN3GW5TVFTAaWvr0hpSEg1YspprSk44OcvbCa9h9+OUAWbGColwwKsckqCWyGK6XXuTUJzU= 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 10/13] OvmfPkg/AmdSevDxe: use MemEncryptSevClearMmioPageEncMask() to clear EncMask Date: Fri, 7 May 2021 15:38:35 -0500 Message-ID: <20210507203838.23706-11-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:14 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9ed78b68-6739-4e1b-a1cb-08d911982d96 X-MS-TrafficTypeDiagnostic: SN1PR12MB2367: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: h6rs9i8+45NTEmGbdCKu5xBS0PaDa/VjSe1GPtMefWZ/45DwYIoZUVpEwHVwlMVwVcWiRUYpH1J+lXeBOurIkORIuo5+Tr0MxesfS0bxlQojfqke/ZIZCwK04WYK2C3YGWcqn5tlKFrpa8rd0pDqPGMhLRTpEEX+Q3VXCuDGS39SZh3TiIcq00JO9UsR1zVlm6u1y1E/rkeG4dMs97Ge58kjm7OhS7faP+5nJwaKgSr6kptvDKdOyNaOnNL77sHjfy8/cjYy60u2ICochSFxuQOdHhqElKikmjh7AzAUlRtnHf0ccWNenwoT/+8Ydgt3wveZ3bfEu0eIKaQt+YtF0lMP2tK5jG3u7I+CLTHu7wIxNnD7G9BVVK/Dq4APpmanKKGawffVXoIQvo+tQW8bVM7sIGgcDXvtaoxdz4UpIIIK0bV9VnxAUjSoCs55OkC5/kcSsrWgBSEM3p/LifT2M7kF8iXiGj13a5DLS281S80CikZqisB3XhusUdvc1mKkQ2BJOc5KIhH2U2zmdOb4rDa+b8bxgIQ9LjhUn7X1Thoa/Ra/wo1xswdOSbppgeWqsXHE3aRs9tlg4XTxCzX3SXnzj095r9YOs4p+gV4bX1gsFQg1D0ZM4Gjg6rbdqR23IB8CGHqdPqngYYMpWlTZ0YAGGeKZdn+ZqfDdunOo61MbqhWGr11fpYKkCZJDJ9CzdkR2Pf1ynSkl4T7oOizcF5hO/n18Kzp21toAZYWzI1MDvK7GUXDfEvp9ioOCDayE 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?G3ybYt8Ur9I6NrcwNDo1q/xVZjCxN/SWf8rwiuMyOc/ihWgeKd/8ghabjXKl?= =?us-ascii?Q?zP1QPUKo+bZ3Gvb2uuchwmt8wQgL8ItP+owUipQbRuh206UyDRkQXecw05vk?= =?us-ascii?Q?Q2n7GH68uOs67y3yf++cBfoAPVPdg1sKBEuV/N4MVb44s4g756VaJeGoDha8?= =?us-ascii?Q?wenDChYjdWIWzJSuHVrsmrhfOUC5AOz+8Ggly6AkafyJnu9lLD5FztMeNdb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mMG2ZRcYjBiHF7wttt1Hbt06XyFJU7tvcU+ORGLFrCTfCpLMd3U8?= =?us-ascii?Q?Ue4Bt7RTbhb89pY22IKoh4l40pbNknTwhZQSfUCHIvpFPglZdyen3qQrqxUr?= =?us-ascii?Q?O4HMDtuoLpTsveFUaFhRgW6DQdfJgitbz4BgRSZCkOSgXu6wwTvcccgfaigZ?= =?us-ascii?Q?5Pp/XS+DuUQuxRwWfCoVkGoY4/6uPogy5aoihbPYtXwVV4xfoipmDMlmGSQQ?= =?us-ascii?Q?JJ4yAbIJKS76oJSzP8Aco7gp?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ed78b68-6739-4e1b-a1cb-08d911982d96 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:14.8942 (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: +rl4ni74W6sgOSJkdwg/rpL1IsgWXTrpw+kgHqXq5pcySZ0dOklspSE/zLwdGdJTVXdpaX8vjainYsmU1bHTbg== 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 and NonExistent 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/AmdSevDxe/AmdSevDxe.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/OvmfPkg/AmdSevDxe/AmdSevDxe.c b/OvmfPkg/AmdSevDxe/AmdSevDxe.c index 689bfb376d03..80831b81facf 100644 --- a/OvmfPkg/AmdSevDxe/AmdSevDxe.c +++ b/OvmfPkg/AmdSevDxe/AmdSevDxe.c @@ -53,11 +53,10 @@ AmdSevDxeEntryPoint ( Desc =3D &AllDescMap[Index]; if (Desc->GcdMemoryType =3D=3D EfiGcdMemoryTypeMemoryMappedIo || Desc->GcdMemoryType =3D=3D EfiGcdMemoryTypeNonExistent) { - Status =3D MemEncryptSevClearPageEncMask ( + Status =3D 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) =3D=3D INTEL_Q35_MCH_DEVICE_ID)= { - Status =3D MemEncryptSevClearPageEncMask ( + Status =3D MemEncryptSevClearMmioPageEncMask ( 0, FixedPcdGet64 (PcdPciExpressBaseAddress), - EFI_SIZE_TO_PAGES (SIZE_256MB), - FALSE + EFI_SIZE_TO_PAGES (SIZE_256MB) ); =20 ASSERT_EFI_ERROR (Status); --=20 2.17.1