From nobody Sun Dec 29 01:55:38 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; dkim=fail spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1495466668107144.65186265307307; Mon, 22 May 2017 08:24:28 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 0D1D121969FB6; Mon, 22 May 2017 08:23:50 -0700 (PDT) Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0627.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe40::627]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 17D2921969FA6 for ; Mon, 22 May 2017 08:23:47 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by DM2PR12MB0155.namprd12.prod.outlook.com (2a01:111:e400:50ce::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.14; Mon, 22 May 2017 15:23:45 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=cBas6R1tt3/sSqIT3C72M3UrO6pEZocOlfDpdgr0AyY=; b=1wQWivTQdV8kAm32G39orYV6l0RjRJdj99yyBKTemYFTMwBqT0oqG7av1qvDThGzvjLREvjhrFpYlQIeHwoeB8WVl+zS0l+DtT0PYVnPHNjvI7bDIJl/EZfXvBwHbzKZxD7DpP/xQ/IZOI/rgMDWERzr74Xcfbd/PDUfDHAdtps= Authentication-Results: lists.01.org; dkim=none (message not signed) header.d=none;lists.01.org; dmarc=none action=none header.from=amd.com; From: Brijesh Singh To: , , Date: Mon, 22 May 2017 11:23:10 -0400 Message-ID: <1495466592-21641-13-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1495466592-21641-1-git-send-email-brijesh.singh@amd.com> References: <1495466592-21641-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BN6PR17CA0030.namprd17.prod.outlook.com (2603:10b6:404:123::16) To DM2PR12MB0155.namprd12.prod.outlook.com (2a01:111:e400:50ce::18) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM2PR12MB0155: X-MS-Office365-Filtering-Correlation-Id: 11fd566a-e1d5-43cd-5f51-08d4a12689a9 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081)(201703131423075)(201703031133081); SRVR:DM2PR12MB0155; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 3:Ai3LYhrks0qpyBFmFisCDTG4tp9m7a08fGqPAomZj+IZOzooAQKqIvagHQ019gmFRNC5bI/bx1f2MywDU6XjHhDb0eMMhynqyNoX14SnFyyqxuO9vO3uJMN+kf/KI3DyPvTvrS7ljnu/pTBi4Ikp32GCYXrIbnIkBam8TgI61P0ykSsc6u/ZW9CGvQiW4GmmGbwdJqu19qvJAoI7xtUFMhN3TWDkIdYNQdJZs3gYfnGUDaQv3pDlvUEAFEvH1ddKhoJMzCt5w6ia3vBc96bYexWmbDa48mBrT1v6Uillv0tjsSwOIzUweajysM1Op/DL4IRnPgloi2J1MlsNfZz+69XpEPAWUTJts1CTpsnCCEw=; 25:vqmcgqV6OAGjYG0DixiMI8NbJ1PQ88Ajd7znUM0OP0KhLNRZoJjY1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fiKciYa+Sk0l42mPM8ZOqXgH6/r6RXN2HwdxRM/1NfvKAMs9V7ZKz1XOT7KEj1JC6hwrtn3var2UA81/R6Gusi1F6oK6ooNVRbVtE1/2eti2YMZCsSJ1kr76wKPCulKUeCSShinldvUuf+8ZQ79Bcmz X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123555025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(6072148); SRVR:DM2PR12MB0155; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0155; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 4:QGKVaGKPwpJ/2+ub2m+CgokkMt50yizl02q5GCt3tXT3pr1iY9mF7JV588oaAaCI6g1RRV869w9s3MtfrB+b+btEbSxy/O+2HI1xGDfhcAOKC8ZIXBb3tSS0S9IXpvfRPu7oSYV1NG2OluW8R+ZYQbr81YEc/rvrYR3jMdhV/nXrqeYoQodf1ufOAxaePXSfpRARI0KDb/bLeaE13Kq+DtCJhq5wKsLHZAsPuq8IN932Jw1cGbUz0nk0u/kqyksgxp4btqSSCcUiG7Nr60+DGYl/To27fK7ICuBglg9U3KGaIW34CiJcwhNitRCAHHIRnS3/F9/eVURpohVqKltzmTj9W2/t5J1f0DpI3Y1yxY6Z2w9cq56lr3YlmJr/0dgLP4kUX86yIXFjS8guWh5bTpwUy3mmY0CnpX/v/yAx7D1iVxgrXbm1giWcd2z2468SOurGS3l47VL/R2EoOJ1qShebo07cKX5j+8GtN3LjY92FbYFm4rt2FrdqsS+x4rLpInastmQJxzPFHGJvUjHhjWL4aHqKaE9WWjT1GOxpoAXPzyW6pq0ultqc3LC4KV4d7urMFvUHzkn0e7IrkGLsGiVrA3w+F2rziX+tVfCuSvpFDBVtR2b6TpRmByANY46hrzMWJ6f9WPhKZHeUemEVd+gUfBC+zouMh0EuOT3HR4Xah8sDZf3F6H6nT9jAiJ3hOpsJVouzsTRSKlv2gFss/oxmuFGae3Bs2SpnF/Po3q4LpYkfTphQzK2Wrb62xJs85Mw+ODwDnnDTUmKNM8aXEqZc6joo983KwNq4NW+Wne1is9NlIlYc4gOGJGvEkRWvw69z4J8ryLEZXp5V+5mQ8fl5HnlCMxGkNP1Ci+qcKqSVYFQp87hx/DuwwSSl375z X-Forefront-PRVS: 03152A99FF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39840400002)(39860400002)(39850400002)(39450400003)(39410400002)(39400400002)(6486002)(5003940100001)(54906002)(6666003)(2950100002)(36756003)(53416004)(42186005)(86362001)(47776003)(2201001)(66066001)(2906002)(5660300001)(305945005)(7736002)(50226002)(38730400002)(3846002)(6116002)(189998001)(8676002)(76176999)(81166006)(53936002)(50986999)(33646002)(4326008)(478600001)(48376002)(50466002)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0155; H:brijesh-build-machine.amd.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR12MB0155; 23:61ByLpHg+MWL5UUkhUY1abeGkKNhnSwKmws/SpCtA?= =?us-ascii?Q?ivu8Cq+O6ylpr1JDCTYuD6W8kNDVjxJKOVK/JzgiRgFDiqM610xrcrXFFRfj?= =?us-ascii?Q?ANZ7N3LEAaH0a7r9v7ywjwTRGzcEtMxvJ/L7TbMbt/15pnjX05eqS8sKTg2U?= =?us-ascii?Q?Ps2wZaksJaC9teFrO04WZ9E/WrlKM7DFRDQ/vo/oezSEBgi+UwPTKWXbA7yr?= =?us-ascii?Q?1vhtEXglRHmMNs1SIy6CeweXpewKs7T3pEDgwTt0pbUk9+RXcdQUlBCYRUae?= =?us-ascii?Q?prXkpihx+v98YxWzpAgL65F6uh8g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Tt/YN5UIKU48gxz36ZWtj+HD0dVZQ0LWc/QfBH6bog4eZlfJZnlpqdCCug==; 20:qF2Rm7jjKxZoWbXr5l9qJRyd54kx82B7gzaMM3hjCcwFcLb3d9i23CsydNYbJV90IAtvZDuVi+owYy3xftvgrX7DVwaRdmzMbtdK7JTsUcH1391rEyqHr2cdOuvRhV+GQwwV62fUw/AR5wrE58Xx7NtDWKaNbq1SzQKnHnFuNHgR1Juu+9inxFPkl7YDEprkMoeScMZkycGivU0U/U4c+ZRQZtgZp3C362xE4FGE6fQghUfNaBQ49iTsWF1UukEv X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2017 15:23:45.0240 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0155 Subject: [edk2] [PATCH v5 12/14] OvmfPkg/QemuFwCfgLib: Implement SEV internal function for Dxe phase X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas.Lendacky@amd.com, leo.duran@amd.com Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When SEV is enabled, the DMA must be performed on unencrypted pages. So when get asked to perfom FWCFG DMA read or write, we allocate a intermediate (bounce buffer) unencrypted buffer and use this buffer for DMA read or write. Cc: Jordan Justen Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Brijesh Singh --- OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf | 7 ++ OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c | 108 ++++++++++++++++++++ 2 files changed, 115 insertions(+) diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf b/OvmfPkg/Lib= rary/QemuFwCfgLib/QemuFwCfgDxeLib.inf index d7e368e5435d..ec128f82c702 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf @@ -39,6 +39,7 @@ [Sources] =20 [Packages] MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec OvmfPkg/OvmfPkg.dec =20 [LibraryClasses] @@ -47,4 +48,10 @@ [LibraryClasses] DebugLib IoLib MemoryAllocationLib + MemEncryptSevLib =20 +[Protocols] + gEdkiiIoMmuProtocolGuid ## SOMETIMES_CONSUMES + +[Depex] + gEdkiiIoMmuProtocolGuid OR gIoMmuDetectedProtocolGuid diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c b/OvmfPkg/Library/= QemuFwCfgLib/QemuFwCfgDxe.c index ac05f4c347f3..bda1a80b5eb9 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxe.c @@ -4,6 +4,7 @@ =20 Copyright (C) 2013, Red Hat, Inc. Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.
+ Copyright (c) 2017, Advanced Micro Devices. All rights reserved.
=20 This program and the accompanying materials are licensed and made availa= ble under the terms and conditions of the BSD License which accompanies this @@ -14,14 +15,36 @@ WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ =20 +#include + +#include + +#include #include #include +#include +#include =20 #include "QemuFwCfgLibInternal.h" =20 STATIC BOOLEAN mQemuFwCfgSupported =3D FALSE; STATIC BOOLEAN mQemuFwCfgDmaSupported; =20 +STATIC EDKII_IOMMU_PROTOCOL *mIoMmuProtocol; +/** + + Returns a boolean indicating whether SEV is enabled + + @retval TRUE SEV is enabled + @retval FALSE SEV is disabled +**/ +BOOLEAN +InternalQemuFwCfgSevIsEnabled ( + VOID + ) +{ + return MemEncryptSevIsEnabled (); +} =20 /** Returns a boolean indicating if the firmware configuration interface @@ -79,6 +102,22 @@ QemuFwCfgInitialize ( mQemuFwCfgDmaSupported =3D TRUE; DEBUG ((DEBUG_INFO, "QemuFwCfg interface (DMA) is supported.\n")); } + + if (mQemuFwCfgDmaSupported && MemEncryptSevIsEnabled ()) { + EFI_STATUS Status; + + // + // IoMmuDxe driver must have installed the IOMMU protocol. If we are n= ot + // able to locate the protocol then something must have gone wrong. + // + Status =3D gBS->LocateProtocol (&gEdkiiIoMmuProtocolGuid, NULL, (VOID = **)&mIoMmuProtocol); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "QemuwCfgSevDma: failed to locate IOMMU protoco= l\n")); + ASSERT (FALSE); + CpuDeadLoop (); + } + } + return RETURN_SUCCESS; } =20 @@ -114,3 +153,72 @@ InternalQemuFwCfgDmaIsAvailable ( { return mQemuFwCfgDmaSupported; } + +/** + Allocate a bounce buffer for SEV DMA. + + @param[in] NumPage Number of pages. + @param[out] Buffer Allocated DMA Buffer pointer + +**/ +VOID +InternalQemuFwCfgSevDmaAllocateBuffer ( + OUT VOID **Buffer, + IN UINT32 NumPages + ) +{ + EFI_STATUS Status; + + ASSERT (mIoMmuProtocol !=3D NULL); + + Status =3D mIoMmuProtocol->AllocateBuffer ( + mIoMmuProtocol, + 0, + EfiBootServicesData, + NumPages, + Buffer, + EDKII_IOMMU_ATTRIBUTE_MEMORY_CACHED + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a:%a failed to allocate %u pages\n", gEfiCaller= BaseName, + __FUNCTION__, NumPages)); + ASSERT (FALSE); + CpuDeadLoop (); + } + + DEBUG ((DEBUG_VERBOSE, "%a:%a buffer 0x%Lx Pages %u\n", gEfiCallerBaseNa= me, + __FUNCTION__, (UINT64)(UINTN)Buffer, NumPages)); +} + +/** + Free the DMA buffer allocated using InternalQemuFwCfgSevDmaAllocateBuffer + + @param[in] NumPage Number of pages. + @param[in] Buffer DMA Buffer pointer + +**/ +VOID +InternalQemuFwCfgSevDmaFreeBuffer ( + IN VOID *Buffer, + IN UINT32 NumPages + ) +{ + EFI_STATUS Status; + + ASSERT (mIoMmuProtocol !=3D NULL); + + Status =3D mIoMmuProtocol->FreeBuffer ( + mIoMmuProtocol, + NumPages, + Buffer + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a:%a failed to free buffer 0x%Lx pages %u\n", + gEfiCallerBaseName, __FUNCTION__, (UINT64)(UINTN)Buffer, NumPage= s)); + ASSERT (FALSE); + CpuDeadLoop (); + } + + DEBUG ((DEBUG_VERBOSE, "%a:%a buffer 0x%Lx Pages %u\n", gEfiCallerBaseNa= me, + __FUNCTION__, (UINT64)(UINTN)Buffer, NumPages)); +} --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel