From nobody Sat Dec 28 09:42:52 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.zohomail.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 1499351446922124.22200616764644; Thu, 6 Jul 2017 07:30:46 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 697632095896F; Thu, 6 Jul 2017 07:28:37 -0700 (PDT) Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0088.outbound.protection.outlook.com [104.47.32.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B2FD621CC537E for ; Thu, 6 Jul 2017 07:28:35 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0147.namprd12.prod.outlook.com (10.162.82.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1240.13; Thu, 6 Jul 2017 14:30:13 +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=hsBrpMnyvit7cTYj9vmfV4mjwaVpziApeV347ISb2ps=; b=wzzijEJFFmC0bl8QddxUean+gd+Lw/YKJxy3uq1sxhVpPIR8o58NR+h0wpLrTs7xEVkjkQPUIY0DtdAqeJ9tNtGS/coRMUaIvrlKQrzUV75LlByyFrnFNKtE2bXiZopD2sun+vd7hegsT06wJGGAMC1QM7dCFY0hkc+QDML28kc= 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: edk2-devel@lists.01.org Date: Thu, 6 Jul 2017 10:29:46 -0400 Message-Id: <1499351394-1175-9-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499351394-1175-1-git-send-email-brijesh.singh@amd.com> References: <1499351394-1175-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: DM5PR15CA0024.namprd15.prod.outlook.com (10.173.207.162) To BY2PR12MB0147.namprd12.prod.outlook.com (10.162.82.20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c860aa74-546d-4201-39da-08d4c47b83fc X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0147; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0147; 3:X7D0zdmzq+kuvJxgQ72gGpD/VlSU3cC8y9Nq9vUbu+p8RvBuyhlVdkHFKscWEQKZ3W8Z7anBiOUYqYU+KEwIYhXXntKGHZMQhzqNQX2V6NXRTXlrOieBdR+G3DbxBSZV8uFHxvF2do48/D5qRWoFwEM4s2Ucn/qEiAW2meFa9lonv4F/noGxQnv9ou8r1o6sCuqhtC3isO/ZIHTEjm4HBZ0nwL06V0vsglHyVAlJcjesu9ORTd26Doq5DgRuDik+MWon1Up2nqDxHTlkTE+Z8FEe8qe9T1TrjOoWXaSPDhTgI0VIQill9fuD4KNNFjjNdnMYhCp4NyohvHwNttfqUjNydFXM/Wysq8LKjtPiqEE1LfGw4radUqZlyZhr3hyjgl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diagnostics: 1; BY2PR12MB0147; 20:oDVmPuyeJOGynWcN2oFcgE45JiUiUjNZ0pSkKN1ecX39dCtNZhkiiGxwbPxiNApTIbfVkult3JCLfvLB+SRQVxMZfxoCowfLAxZajmlAuPRiDhjokiUq9E7q+dORkSGUolZ9LnvLgHGmEO3KZ6l2/veZ5ebkxQ5ZI97YvEy1LTcq+Kz2iCymAJYwFv5J086XIHCW0trNDxjVxyhpVdH7hGME0jUmHGBiRur6iu9QzjpcC5e3O1mJRsfCw3QUPmw7ZforkG+m4CTiULOr0PurCW3pSyKAN7MVBfNvBPGEJcIOe8e6GBNEgkAmFrQf1ZcNEubo0JVHyhlXcSXZuuavW/ySN+tUvcpqDEc1WUdfQjfOL8krpiPzAYdjG7Rrz93FuHQjozyUZfpalKnkfKGcP9zCq9cvJO5o4q0YcPjztb9U+rQ37fzug/88UvZtBQPPrCeuUsRGT34abN+5ygihEbxkWrEyqdLmkIoMXoSxgJRlqs+8T2CLbfmcLsdvAUAp X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(133145235818549)(236129657087228)(192374486261705)(767451399110)(148574349560750)(167848164394848)(228905959029699)(247924648384137)(17755550239193); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(2017060910048)(5005006)(8121501046)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123558100)(20161123555025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0147; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0147; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0147; 4:V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xEEj?= =?us-ascii?Q?LCyPPj/z4ZpJgGsA5grJg7z0u29Ml1qAblCFRLoh35zUbEKAFka4PYlRHxwx?= =?us-ascii?Q?B+oYJRgIicmcm4LNXkcXD9xiPoKb5iheMhVd3L/zqLSe2g6xvsx9PE/gIenQ?= =?us-ascii?Q?ShP/nSYjT/X8JyM4OB5qP+4OPtKf/tu20Zb1AwAxqTm7AgGAxszYXBuOsu+2?= =?us-ascii?Q?1UFtHEhda2kGTPqCpiSHnwYYZjgD1ChnByWjcE2JjHwlr881s/oaKro7oViN?= =?us-ascii?Q?byLjbtcfzzO9QOnqifje9tdWu7iOzHqCb+jlUwqyy2HY7AbLbww8bJH4ZgCn?= =?us-ascii?Q?CGH954XqyJvVJtlEqzqwHL8hUilf677qEY0KrvWvZsnon+wlcsTVDpw6Q6WN?= =?us-ascii?Q?964VO6K57uE7huCSepv8u5ugUD7nwBq0YDZRZICQv1BV1jwZY6GHPd3G01ru?= =?us-ascii?Q?ngWYy6Yy5sPD9yOjdk1arJz/lHieQAgvK/5Q3M5a7m5Q8pN2LVf2uiMaCdET?= =?us-ascii?Q?DykOIQxhwDrgMk+SG8KFieL6BBiReKn7H/qat/ZuQm0vXg1waenmgEYiMTmW?= =?us-ascii?Q?gAnshEFJ2vF6sf7umfrZ+ZddxX+pPCzqoufpy4l6c0x272FG4IaaLv5zdlCT?= =?us-ascii?Q?+VJBdLGRyvaghkNyqP0Hx6psJcP+yBjTI=3D?= X-Forefront-PRVS: 03607C04F0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6029001)(39450400003)(39850400002)(39840400002)(39860400002)(39410400002)(39400400002)(53936002)(48376002)(305945005)(2351001)(5003940100001)(2361001)(7736002)(50986999)(76176999)(5660300001)(4326008)(42186005)(16799955002)(2906002)(66066001)(6116002)(3846002)(15188155005)(47776003)(53416004)(6486002)(38730400002)(33646002)(81166006)(36756003)(189998001)(53376002)(110136004)(25786009)(50226002)(8676002)(6306002)(50466002)(575784001)(86362001)(6666003)(966005)(54906002)(2950100002)(478600001)(6916009)(44824005)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0147; H:brijesh-build-machine.amd.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0147; 23:jM00FZpaPaFUSkrG9P2AHjcp6lBhJVzmtyhIdqyir?= =?us-ascii?Q?+3SILeSUw83wWnml3zoiaDJNnP764PqGPSphUkxbU9ugL6okG1OGJB52kFUJ?= =?us-ascii?Q?WuyrZTD5Ghw1nVs4+ujrpjbGct8HLrFBpK0KfpxJZ8lQWY9GQO+Z/l9aoftC?= =?us-ascii?Q?AWbHNbl0JnkWe83s04QYIenxGqg1qYyRpeJXmpo4DFQwwW4ycwZOibQjWxZq?= =?us-ascii?Q?rb9cne/UP/MWKH1+rkfGpBvrQ9RAS2kzXumxILhHhzmDSv6XoykqWevllPHs?= =?us-ascii?Q?Z2nlkLbglJWVuTIG3TQkQ0Nr8LmdepN3hlQeEg4LRlF+m4bX3eWbyHh99npN?= =?us-ascii?Q?47ZjV+vtFYisNHHUN2dVbjhc+TSmkLbBQ3KBUTYvcMeGiLeGW+rk0toiVCSb?= =?us-ascii?Q?FS4cKWzAs3gX0iK0JqEmgvUWFaVMEv3yjjp4rwhPd5ZsCEG/4j1vuYLPlMev?= =?us-ascii?Q?yeAn+tv9WilC+xzAH6K5hv4zEcbsXjBvK3Jl+unfGJhscQmFFbfi76faPry+?= =?us-ascii?Q?iSyzPGXmN/YhAGXUmtHgjk3fCaa6mrkaFsynzGKFtGmVKMh3yUJC739hO+SE?= =?us-ascii?Q?5S5TnnjzN4q6MYJFa4HqUslh+Eeu2rrdNiKqz/AOPq+bYb40tuA2xZWBRmtE?= =?us-ascii?Q?5HElowgN4v7tocSI1521lLhrEoWymU/4pnLKCAU9AFW5U/412N3jf1gJpiSF?= =?us-ascii?Q?XC8pRbNHcIIsxCsiKDai8LNQHG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1UjUDcQV7ry/0CbqfTGAMJadEAbzN/m?= =?us-ascii?Q?OV3NVgNxzBNlg1UzAO8PuM7ssWBR+qpBm6MuAloTLNMsEt99MaL3eeORfd+7?= =?us-ascii?Q?fT6SbWVO/UNb0mwJ4scIbZhYreQ+74uQpbZYDp3yZNbB2C44Hj/PMgZaOq5A?= =?us-ascii?Q?rOpYDymk/5QYKV3QBkAgnr+cwf3bKncb6M5CPF0N5Fj0Amv3lme1KczQzQ2c?= =?us-ascii?Q?9s79h6TgQWE+5GdARN4MT0B9ZYz/dO3hTqcUd0ZQdgpemYOOdfWu9EfjmFZN?= =?us-ascii?Q?7gwBPcxmY33gXcrcDDfw4RTlQ3dgS+KydqesTyt3YGC1LJD9okSezYw/28dF?= =?us-ascii?Q?+Rt7aOSotTTiB3RfXUYYdVYEAdpPWc1iQQyhu9+KnHdNa07NqIgqdg2j8L7n?= =?us-ascii?Q?pXEga4qQKrLJxbzE/loiASSGVyuOSjzPkApAHKxn7romT6pwcugQcmYhUln5?= =?us-ascii?Q?iPp3o58cjWpFq41UZFDRIenKKunNY+1TUL3TRCfw4Nzny6wDaPTLmYLXzO4K?= =?us-ascii?Q?+g0ZAFkAqlJ+GxdZxeBmEM8AbtNCFmcKVIYzacxOamytp8h8oRZdwmgvzv5L?= =?us-ascii?Q?vyYTOFIqllXoDpBP/+obybKUwqSmKwwgPk9CzYVn6RtJlOOcmH91T7v8padb?= =?us-ascii?Q?ByHZaw5LmIjh2bQauJT0uSUlsmW3kauyedvzUyAMfx2S8terBQc6EAMlPr0v?= =?us-ascii?Q?KCzeWQx9KOvSF/7toWTrEg9OtM8CrJDIaYcWkro3f23iQd/qUw7KN2eOMp9H?= =?us-ascii?Q?r2LbDmKrldoF6ngbhwlQdY?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0147; 5:oxmTcqnLsjT39x/F5DEOp3h1p3hplgBNo9z+jNc2OAfSil79qxL5mK9JStyldTIGEPj+TDQYn8erJc0uzWmgoaf1B5Z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C954WlIVdIGS0wCaxfc6Sa55CbZ1UgsjvopYr8HFrDl0EZy7nZGfskumbF4ZB56TQ2DsYHFXjQNUQSfsaKuLwGXFA3W6aG4Y06D2hN1CHetmjTu2FhyzmYuQrfX4MIfB2Kovebk3ok0jkmx2JBv0QagJHcn+Tj6BcC5EyIwIAOkY0H4o19b46E1YeoiryPLdWngTwtv2Y8AIe1sc4+rNkEOJB7Kx6KN0/dxZLP6Z95F5tkx0b7SV/Fg2K7p2v7xIOFYCrvfq2WJIxvmoJhSBqlWx9FTCPru/G2d9Ngz8VifYuJOVyj3vHJTbcOxkFdBB36xfo6q3WNxEZd/pf7cnuw/bsf+vk= X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0147; 20:pDmZNi+IZeOmjUgi5YL9HCOdb8HQjZyU/OB+zqyqY3W1yJCM7r3rCxu+bV6c4ASw2upQ+D5jJSe7K5DlOPDnbnynB4n2JAq3O9BtFsEsVm5BhNBdK1tj3ZNRJJSPJnO4UwUl4enJSTuv/Gv4FqMlsfw33Mh9BeeHugJRGq9YtKt/4fs3cDG9Ovikx3U+AB8cfXPjUYQLPeOTt0xHkacSxrZYHrb/VEckX3+wwdxMrjDKiO94MnoUTh44Je9GJo3u X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2017 14:30:13.4354 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0147 Subject: [edk2] [PATCH v8 08/16] OvmfPkg: Add IoMmuDxe driver 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, jordan.l.justen@intel.com, leo.duran@amd.com, Jiewen Yao , lersek@redhat.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" The IOMMU protocol driver provides capabilities to set a DMA access attribute and methods to allocate, free, map and unmap the DMA memory for the PCI Bus devices. Due to security reasons all DMA operations inside the SEV guest must be performed on shared (i.e unencrypted) pages. The IOMMU protocol driver for the SEV guest uses a bounce buffer to map guest DMA buffer to shared pages inorder to provide the support for DMA operations inside SEV guest. IoMmuDxe driver looks for SEV capabilities, if present then it installs the real IOMMU protocol otherwise it installs placeholder protocol. Currently, PciHostBridgeDxe and QemuFWCfgLib need to know the existance of IOMMU protocol. The modules needing to know the existance of IOMMU support should add gEdkiiIoMmuProtocolGuid OR gIoMmuAbsentProtocolGuid in their depex to ensure that platform IOMMU detection has been performed. Cc: Jordan Justen Cc: Laszlo Ersek Cc: Leo Duran Cc: Jiewen Yao Contributed-under: TianoCore Contribution Agreement 1.0 Suggested-by: Jiewen Yao Signed-off-by: Brijesh Singh Reviewed-by: Jiewen Yao Acked-by: Laszlo Ersek --- OvmfPkg/OvmfPkgIa32.dsc | 1 + OvmfPkg/OvmfPkgIa32X64.dsc | 1 + OvmfPkg/OvmfPkgX64.dsc | 1 + OvmfPkg/OvmfPkgIa32.fdf | 1 + OvmfPkg/OvmfPkgIa32X64.fdf | 1 + OvmfPkg/OvmfPkgX64.fdf | 1 + OvmfPkg/IoMmuDxe/IoMmuDxe.inf | 49 +++ OvmfPkg/IoMmuDxe/AmdSevIoMmu.h | 43 ++ OvmfPkg/IoMmuDxe/AmdSevIoMmu.c | 459 ++++++++++++++++++++ OvmfPkg/IoMmuDxe/IoMmuDxe.c | 53 +++ 10 files changed, 610 insertions(+) diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index 9355a37ae95a..6a3e400cab6a 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -816,6 +816,7 @@ [Components] !endif =20 OvmfPkg/PlatformDxe/Platform.inf + OvmfPkg/IoMmuDxe/IoMmuDxe.inf =20 !if $(SMM_REQUIRE) =3D=3D TRUE OvmfPkg/SmmAccess/SmmAccess2Dxe.inf diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index b3a22c726b92..d6d5d7db522e 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -826,6 +826,7 @@ [Components.X64] =20 OvmfPkg/PlatformDxe/Platform.inf OvmfPkg/AmdSevDxe/AmdSevDxe.inf + OvmfPkg/IoMmuDxe/IoMmuDxe.inf =20 !if $(SMM_REQUIRE) =3D=3D TRUE OvmfPkg/SmmAccess/SmmAccess2Dxe.inf diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index aba4d907b567..2acf8f436222 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -824,6 +824,7 @@ [Components] =20 OvmfPkg/PlatformDxe/Platform.inf OvmfPkg/AmdSevDxe/AmdSevDxe.inf + OvmfPkg/IoMmuDxe/IoMmuDxe.inf =20 !if $(SMM_REQUIRE) =3D=3D TRUE OvmfPkg/SmmAccess/SmmAccess2Dxe.inf diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf index cd91bc03a683..5e5ade2a1fcb 100644 --- a/OvmfPkg/OvmfPkgIa32.fdf +++ b/OvmfPkg/OvmfPkgIa32.fdf @@ -347,6 +347,7 @@ [FV.DXEFV] INF OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf INF OvmfPkg/VirtioGpuDxe/VirtioGpu.inf INF OvmfPkg/PlatformDxe/Platform.inf +INF OvmfPkg/IoMmuDxe/IoMmuDxe.inf =20 !if $(SMM_REQUIRE) =3D=3D TRUE INF OvmfPkg/SmmAccess/SmmAccess2Dxe.inf diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf index 5cec9982dbe1..aa0d8c69f3f8 100644 --- a/OvmfPkg/OvmfPkgIa32X64.fdf +++ b/OvmfPkg/OvmfPkgIa32X64.fdf @@ -354,6 +354,7 @@ [FV.DXEFV] INF OvmfPkg/VirtioGpuDxe/VirtioGpu.inf INF OvmfPkg/PlatformDxe/Platform.inf INF OvmfPkg/AmdSevDxe/AmdSevDxe.inf +INF OvmfPkg/IoMmuDxe/IoMmuDxe.inf =20 !if $(SMM_REQUIRE) =3D=3D TRUE INF OvmfPkg/SmmAccess/SmmAccess2Dxe.inf diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf index 213db6bedbe2..98a0cf17da90 100644 --- a/OvmfPkg/OvmfPkgX64.fdf +++ b/OvmfPkg/OvmfPkgX64.fdf @@ -354,6 +354,7 @@ [FV.DXEFV] INF OvmfPkg/VirtioGpuDxe/VirtioGpu.inf INF OvmfPkg/PlatformDxe/Platform.inf INF OvmfPkg/AmdSevDxe/AmdSevDxe.inf +INF OvmfPkg/IoMmuDxe/IoMmuDxe.inf =20 !if $(SMM_REQUIRE) =3D=3D TRUE INF OvmfPkg/SmmAccess/SmmAccess2Dxe.inf diff --git a/OvmfPkg/IoMmuDxe/IoMmuDxe.inf b/OvmfPkg/IoMmuDxe/IoMmuDxe.inf new file mode 100644 index 000000000000..b90dc80dfd37 --- /dev/null +++ b/OvmfPkg/IoMmuDxe/IoMmuDxe.inf @@ -0,0 +1,49 @@ +#/** @file +# +# Driver provides the IOMMU protcol support for PciHostBridgeIo and others +# drivers. +# +# Copyright (c) 2017, AMD Inc. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the B= SD +# License which accompanies this distribution. The full text of the lice= nse may +# be found at http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED. +# +#**/ + +[Defines] + INF_VERSION =3D 1.25 + BASE_NAME =3D IoMmuDxe + FILE_GUID =3D 8657015b-ea43-440d-949a-af3be365c0fc + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D IoMmuDxeEntryPoint + +[Sources] + AmdSevIoMmu.c + IoMmuDxe.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + OvmfPkg/OvmfPkg.dec + +[LibraryClasses] + BaseLib + UefiLib + UefiDriverEntryPoint + UefiBootServicesTableLib + DxeServicesTableLib + DebugLib + MemEncryptSevLib + +[Protocols] + gEdkiiIoMmuProtocolGuid ## SOMETIME_PRODUCES + gIoMmuAbsentProtocolGuid ## SOMETIME_PRODUCES + +[Depex] + TRUE diff --git a/OvmfPkg/IoMmuDxe/AmdSevIoMmu.h b/OvmfPkg/IoMmuDxe/AmdSevIoMmu.h new file mode 100644 index 000000000000..8b3962a8c395 --- /dev/null +++ b/OvmfPkg/IoMmuDxe/AmdSevIoMmu.h @@ -0,0 +1,43 @@ +/** @file + + The protocol provides support to allocate, free, map and umap a DMA buff= er for + bus master (e.g PciHostBridge). When SEV is enabled, the DMA operations = must + be performed on unencrypted buffer hence protocol clear the encryption b= it + from the DMA buffer. + + Copyright (c) 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2017, AMD Inc. All rights reserved.
+ This program and the accompanying materials are licensed and made availa= ble + under the terms and conditions of the BSD License which accompanies this + distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. + +**/ + +#ifndef __AMD_SEV_IOMMU_H_ +#define __AMD_SEV_IOMMU_H + +#include + +#include +#include +#include +#include +#include +#include + +/** + Install IOMMU protocol to provide the DMA support for PciHostBridge and + MemEncryptSevLib. + +**/ +VOID +EFIAPI +AmdSevInstallIoMmuProtocol ( + VOID + ); + +#endif diff --git a/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c b/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c new file mode 100644 index 000000000000..9e78058b7242 --- /dev/null +++ b/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c @@ -0,0 +1,459 @@ +/** @file + + The protocol provides support to allocate, free, map and umap a DMA buff= er for + bus master (e.g PciHostBridge). When SEV is enabled, the DMA operations = must + be performed on unencrypted buffer hence we use a bounce buffer to map t= he guest + buffer into an unencrypted DMA buffer. + + Copyright (c) 2017, AMD Inc. All rights reserved.
+ Copyright (c) 2017, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made availa= ble + under the terms and conditions of the BSD License which accompanies this + distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. + +**/ + +#include "AmdSevIoMmu.h" + +typedef struct { + EDKII_IOMMU_OPERATION Operation; + UINTN NumberOfBytes; + UINTN NumberOfPages; + EFI_PHYSICAL_ADDRESS HostAddress; + EFI_PHYSICAL_ADDRESS DeviceAddress; +} MAP_INFO; + +#define NO_MAPPING (VOID *) (UINTN) -1 + +/** + Provides the controller-specific addresses required to access system mem= ory from a + DMA bus master. On SEV guest, the DMA operations must be performed on sh= ared + buffer hence we allocate a bounce buffer to map the HostAddress to a Dev= iceAddress. + The Encryption attribute is removed from the DeviceAddress buffer. + + @param This The protocol instance pointer. + @param Operation Indicates if the bus master is going to re= ad or + write to system memory. + @param HostAddress The system memory address to map to the PC= I controller. + @param NumberOfBytes On input the number of bytes to map. On ou= tput + the number of bytes + that were mapped. + @param DeviceAddress The resulting map address for the bus mast= er PCI + controller to use to + access the hosts HostAddress. + @param Mapping A resulting value to pass to Unmap(). + + @retval EFI_SUCCESS The range was mapped for the returned Numb= erOfBytes. + @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a comm= on buffer. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due to = a lack + of resources. + @retval EFI_DEVICE_ERROR The system hardware could not map the requ= ested address. + +**/ +EFI_STATUS +EFIAPI +IoMmuMap ( + IN EDKII_IOMMU_PROTOCOL *This, + IN EDKII_IOMMU_OPERATION Operation, + IN VOID *HostAddress, + IN OUT UINTN *NumberOfBytes, + OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, + OUT VOID **Mapping + ) +{ + EFI_STATUS Status; + EFI_PHYSICAL_ADDRESS PhysicalAddress; + MAP_INFO *MapInfo; + EFI_PHYSICAL_ADDRESS DmaMemoryTop; + EFI_ALLOCATE_TYPE AllocateType; + + if (HostAddress =3D=3D NULL || NumberOfBytes =3D=3D NULL || DeviceAddres= s =3D=3D NULL || + Mapping =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + // + // Make sure that Operation is valid + // + if ((UINT32) Operation >=3D EdkiiIoMmuOperationMaximum) { + return EFI_INVALID_PARAMETER; + } + PhysicalAddress =3D (EFI_PHYSICAL_ADDRESS) (UINTN) HostAddress; + + DmaMemoryTop =3D (UINTN)-1; + AllocateType =3D AllocateAnyPages; + + if (((Operation !=3D EdkiiIoMmuOperationBusMasterRead64 && + Operation !=3D EdkiiIoMmuOperationBusMasterWrite64 && + Operation !=3D EdkiiIoMmuOperationBusMasterCommonBuffer64)) && + ((PhysicalAddress + *NumberOfBytes) > SIZE_4GB)) { + // + // If the root bridge or the device cannot handle performing DMA above + // 4GB but any part of the DMA transfer being mapped is above 4GB, then + // map the DMA transfer to a buffer below 4GB. + // + DmaMemoryTop =3D SIZE_4GB - 1; + AllocateType =3D AllocateMaxAddress; + + if (Operation =3D=3D EdkiiIoMmuOperationBusMasterCommonBuffer || + Operation =3D=3D EdkiiIoMmuOperationBusMasterCommonBuffer64) { + // + // Common Buffer operations can not be remapped. If the common bu= ffer + // if above 4GB, then it is not possible to generate a mapping, so= return + // an error. + // + return EFI_UNSUPPORTED; + } + } + + // + // CommandBuffer was allocated by us (AllocateBuffer) and is already in + // unencryted buffer so no need to create bounce buffer + // + if (Operation =3D=3D EdkiiIoMmuOperationBusMasterCommonBuffer || + Operation =3D=3D EdkiiIoMmuOperationBusMasterCommonBuffer64) { + *Mapping =3D NO_MAPPING; + *DeviceAddress =3D PhysicalAddress; + + return EFI_SUCCESS; + } + + // + // Allocate a MAP_INFO structure to remember the mapping when Unmap() is + // called later. + // + MapInfo =3D AllocatePool (sizeof (MAP_INFO)); + if (MapInfo =3D=3D NULL) { + *NumberOfBytes =3D 0; + return EFI_OUT_OF_RESOURCES; + } + + // + // Initialize the MAP_INFO structure + // + MapInfo->Operation =3D Operation; + MapInfo->NumberOfBytes =3D *NumberOfBytes; + MapInfo->NumberOfPages =3D EFI_SIZE_TO_PAGES (MapInfo->NumberOfBytes= ); + MapInfo->HostAddress =3D PhysicalAddress; + MapInfo->DeviceAddress =3D DmaMemoryTop; + + // + // Allocate a buffer to map the transfer to. + // + Status =3D gBS->AllocatePages ( + AllocateType, + EfiBootServicesData, + MapInfo->NumberOfPages, + &MapInfo->DeviceAddress + ); + if (EFI_ERROR (Status)) { + FreePool (MapInfo); + *NumberOfBytes =3D 0; + return Status; + } + + // + // Clear the memory encryption mask from the device buffer + // + Status =3D MemEncryptSevClearPageEncMask (0, MapInfo->DeviceAddress, Map= Info->NumberOfPages, TRUE); + ASSERT_EFI_ERROR(Status); + + // + // If this is a read operation from the Bus Master's point of view, + // then copy the contents of the real buffer into the mapped buffer + // so the Bus Master can read the contents of the real buffer. + // + if (Operation =3D=3D EdkiiIoMmuOperationBusMasterRead || + Operation =3D=3D EdkiiIoMmuOperationBusMasterRead64) { + CopyMem ( + (VOID *) (UINTN) MapInfo->DeviceAddress, + (VOID *) (UINTN) MapInfo->HostAddress, + MapInfo->NumberOfBytes + ); + } + + // + // The DeviceAddress is the address of the maped buffer below 4GB + // + *DeviceAddress =3D MapInfo->DeviceAddress; + + // + // Return a pointer to the MAP_INFO structure in Mapping + // + *Mapping =3D MapInfo; + + DEBUG ((DEBUG_VERBOSE, "%a Device 0x%Lx Host 0x%Lx Pages 0x%Lx Bytes 0x%= Lx\n", + __FUNCTION__, MapInfo->DeviceAddress, MapInfo->HostAddress, + MapInfo->NumberOfPages, MapInfo->NumberOfBytes)); + + return EFI_SUCCESS; +} + +/** + Completes the Map() operation and releases any corresponding resources. + + @param This The protocol instance pointer. + @param Mapping The mapping value returned from Map(). + + @retval EFI_SUCCESS The range was unmapped. + @retval EFI_INVALID_PARAMETER Mapping is not a value that was returned b= y Map(). + @retval EFI_DEVICE_ERROR The data was not committed to the target s= ystem memory. +**/ +EFI_STATUS +EFIAPI +IoMmuUnmap ( + IN EDKII_IOMMU_PROTOCOL *This, + IN VOID *Mapping + ) +{ + MAP_INFO *MapInfo; + EFI_STATUS Status; + + if (Mapping =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + // + // See if the Map() operation associated with this Unmap() required a ma= pping + // buffer. If a mapping buffer was not required, then this function simp= ly + // buffer. If a mapping buffer was not required, then this function simp= ly + // + if (Mapping =3D=3D NO_MAPPING) { + return EFI_SUCCESS; + } + + MapInfo =3D (MAP_INFO *)Mapping; + + // + // If this is a write operation from the Bus Master's point of view, + // then copy the contents of the mapped buffer into the real buffer + // so the processor can read the contents of the real buffer. + // + if (MapInfo->Operation =3D=3D EdkiiIoMmuOperationBusMasterWrite || + MapInfo->Operation =3D=3D EdkiiIoMmuOperationBusMasterWrite64) { + CopyMem ( + (VOID *) (UINTN) MapInfo->HostAddress, + (VOID *) (UINTN) MapInfo->DeviceAddress, + MapInfo->NumberOfBytes + ); + } + + DEBUG ((DEBUG_VERBOSE, "%a Device 0x%Lx Host 0x%Lx Pages 0x%Lx Bytes 0x%= Lx\n", + __FUNCTION__, MapInfo->DeviceAddress, MapInfo->HostAddress, + MapInfo->NumberOfPages, MapInfo->NumberOfBytes)); + // + // Restore the memory encryption mask + // + Status =3D MemEncryptSevSetPageEncMask (0, MapInfo->DeviceAddress, MapIn= fo->NumberOfPages, TRUE); + ASSERT_EFI_ERROR(Status); + + // + // Free the mapped buffer and the MAP_INFO structure. + // + gBS->FreePages (MapInfo->DeviceAddress, MapInfo->NumberOfPages); + FreePool (Mapping); + return EFI_SUCCESS; +} + +/** + Allocates pages that are suitable for an OperationBusMasterCommonBuffer = or + OperationBusMasterCommonBuffer64 mapping. + + @param This The protocol instance pointer. + @param Type This parameter is not used and must be ign= ored. + @param MemoryType The type of memory to allocate, EfiBootSer= vicesData + or EfiRuntimeServicesData. + @param Pages The number of pages to allocate. + @param HostAddress A pointer to store the base system memory = address + of the allocated range. + @param Attributes The requested bit mask of attributes for t= he allocated range. + + @retval EFI_SUCCESS The requested memory pages were allocated. + @retval EFI_UNSUPPORTED Attributes is unsupported. The only legal = attribute + bits are MEMORY_WRITE_COMBINE and MEMORY_C= ACHED. + @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated. + +**/ +EFI_STATUS +EFIAPI +IoMmuAllocateBuffer ( + IN EDKII_IOMMU_PROTOCOL *This, + IN EFI_ALLOCATE_TYPE Type, + IN EFI_MEMORY_TYPE MemoryType, + IN UINTN Pages, + IN OUT VOID **HostAddress, + IN UINT64 Attributes + ) +{ + EFI_STATUS Status; + EFI_PHYSICAL_ADDRESS PhysicalAddress; + + // + // Validate Attributes + // + if ((Attributes & EDKII_IOMMU_ATTRIBUTE_INVALID_FOR_ALLOCATE_BUFFER) != =3D 0) { + return EFI_UNSUPPORTED; + } + + // + // Check for invalid inputs + // + if (HostAddress =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + // + // The only valid memory types are EfiBootServicesData and + // EfiRuntimeServicesData + // + if (MemoryType !=3D EfiBootServicesData && + MemoryType !=3D EfiRuntimeServicesData) { + return EFI_INVALID_PARAMETER; + } + + PhysicalAddress =3D (UINTN)-1; + if ((Attributes & EDKII_IOMMU_ATTRIBUTE_DUAL_ADDRESS_CYCLE) =3D=3D 0) { + // + // Limit allocations to memory below 4GB + // + PhysicalAddress =3D SIZE_4GB - 1; + } + Status =3D gBS->AllocatePages ( + AllocateMaxAddress, + MemoryType, + Pages, + &PhysicalAddress + ); + if (!EFI_ERROR (Status)) { + *HostAddress =3D (VOID *) (UINTN) PhysicalAddress; + + // + // Clear memory encryption mask + // + Status =3D MemEncryptSevClearPageEncMask (0, PhysicalAddress, Pages, T= RUE); + ASSERT_EFI_ERROR(Status); + } + + DEBUG ((DEBUG_VERBOSE, "%a Address 0x%Lx Pages 0x%Lx\n", __FUNCTION__, P= hysicalAddress, Pages)); + return Status; +} + +/** + Frees memory that was allocated with AllocateBuffer(). + + @param This The protocol instance pointer. + @param Pages The number of pages to free. + @param HostAddress The base system memory address of the allo= cated range. + + @retval EFI_SUCCESS The requested memory pages were freed. + @retval EFI_INVALID_PARAMETER The memory range specified by HostAddress = and Pages + was not allocated with AllocateBuffer(). + +**/ +EFI_STATUS +EFIAPI +IoMmuFreeBuffer ( + IN EDKII_IOMMU_PROTOCOL *This, + IN UINTN Pages, + IN VOID *HostAddress + ) +{ + EFI_STATUS Status; + + // + // Set memory encryption mask + // + Status =3D MemEncryptSevSetPageEncMask (0, (EFI_PHYSICAL_ADDRESS)(UINTN)= HostAddress, Pages, TRUE); + ASSERT_EFI_ERROR(Status); + + DEBUG ((DEBUG_VERBOSE, "%a Address 0x%Lx Pages 0x%Lx\n", __FUNCTION__, (= UINTN)HostAddress, Pages)); + return gBS->FreePages ((EFI_PHYSICAL_ADDRESS) (UINTN) HostAddress, Pages= ); +} + + +/** + Set IOMMU attribute for a system memory. + + If the IOMMU protocol exists, the system memory cannot be used + for DMA by default. + + When a device requests a DMA access for a system memory, + the device driver need use SetAttribute() to update the IOMMU + attribute to request DMA access (read and/or write). + + The DeviceHandle is used to identify which device submits the request. + The IOMMU implementation need translate the device path to an IOMMU devi= ce ID, + and set IOMMU hardware register accordingly. + 1) DeviceHandle can be a standard PCI device. + The memory for BusMasterRead need set EDKII_IOMMU_ACCESS_READ. + The memory for BusMasterWrite need set EDKII_IOMMU_ACCESS_WRITE. + The memory for BusMasterCommonBuffer need set EDKII_IOMMU_ACCESS_READ= |EDKII_IOMMU_ACCESS_WRITE. + After the memory is used, the memory need set 0 to keep it being prot= ected. + 2) DeviceHandle can be an ACPI device (ISA, I2C, SPI, etc). + The memory for DMA access need set EDKII_IOMMU_ACCESS_READ and/or EDK= II_IOMMU_ACCESS_WRITE. + + @param[in] This The protocol instance pointer. + @param[in] DeviceHandle The device who initiates the DMA access re= quest. + @param[in] Mapping The mapping value returned from Map(). + @param[in] IoMmuAccess The IOMMU access. + + @retval EFI_SUCCESS The IoMmuAccess is set for the memory ran= ge specified by DeviceAddress and Length. + @retval EFI_INVALID_PARAMETER DeviceHandle is an invalid handle. + @retval EFI_INVALID_PARAMETER Mapping is not a value that was returned = by Map(). + @retval EFI_INVALID_PARAMETER IoMmuAccess specified an illegal combinat= ion of access. + @retval EFI_UNSUPPORTED DeviceHandle is unknown by the IOMMU. + @retval EFI_UNSUPPORTED The bit mask of IoMmuAccess is not suppor= ted by the IOMMU. + @retval EFI_UNSUPPORTED The IOMMU does not support the memory ran= ge specified by Mapping. + @retval EFI_OUT_OF_RESOURCES There are not enough resources available = to modify the IOMMU access. + @retval EFI_DEVICE_ERROR The IOMMU device reported an error while = attempting the operation. + +**/ +EFI_STATUS +EFIAPI +IoMmuSetAttribute ( + IN EDKII_IOMMU_PROTOCOL *This, + IN EFI_HANDLE DeviceHandle, + IN VOID *Mapping, + IN UINT64 IoMmuAccess + ) +{ + return EFI_UNSUPPORTED; +} + +EDKII_IOMMU_PROTOCOL mAmdSev =3D { + EDKII_IOMMU_PROTOCOL_REVISION, + IoMmuSetAttribute, + IoMmuMap, + IoMmuUnmap, + IoMmuAllocateBuffer, + IoMmuFreeBuffer, +}; + +/** + Initialize Iommu Protocol. + +**/ +VOID +EFIAPI +AmdSevInstallIoMmuProtocol ( + VOID + ) +{ + EFI_STATUS Status; + EFI_HANDLE Handle; + + Handle =3D NULL; + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &Handle, + &gEdkiiIoMmuProtocolGuid, &mAmdSev, + NULL + ); + ASSERT_EFI_ERROR (Status); +} diff --git a/OvmfPkg/IoMmuDxe/IoMmuDxe.c b/OvmfPkg/IoMmuDxe/IoMmuDxe.c new file mode 100644 index 000000000000..101157e228b3 --- /dev/null +++ b/OvmfPkg/IoMmuDxe/IoMmuDxe.c @@ -0,0 +1,53 @@ +/** @file + + IoMmuDxe driver installs EDKII_IOMMU_PROTOCOL to provide the support for= DMA + operations when SEV is enabled. + + Copyright (c) 2017, AMD Inc. All rights reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD + License which accompanies this distribution. The full text of the licen= se may + be found at http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. + +**/ + +#include + +#include +#include +#include +#include +#include +#include + +#include "AmdSevIoMmu.h" + +EFI_STATUS +EFIAPI +IoMmuDxeEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status =3D EFI_SUCCESS; + EFI_HANDLE Handle =3D NULL; + + // + // When SEV is enabled, install IoMmu protocol otherwise install the + // placeholder protocol so that other dependent module can run. + // + if (MemEncryptSevIsEnabled ()) { + AmdSevInstallIoMmuProtocol (); + } else { + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &Handle, + &gIoMmuAbsentProtocolGuid, + NULL, NULL); + } + + return Status; +} --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel