From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0068.outbound.protection.outlook.com [104.47.40.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3066821D0A27A for ; Mon, 14 Aug 2017 04:35:07 -0700 (PDT) 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=O/aLbizKpfD7uKPXxGM+Zm7DcNoyNcpe8K+dPfslmew=; b=W5V4A6PfrHpaN9UAZ8db+kH2q8iZ8KxIMGXmwuyyQnKNTIMmx5y5PIouD1Z2sSt1hRnMYwoXSKj4uQPce78NBqrW3L+iQYXjMn9y0lDsRMBjLjNk+eMvSnReADYGkAWU3lbkfHgsKZuPQCSqRNK0KVRk6qwSvmaq+99SpyYbvTU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from brijesh-build-machine.amd.com (165.204.77.1) by BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21; Mon, 14 Aug 2017 11:37:28 +0000 From: Brijesh Singh To: edk2-devel@lists.01.org Cc: Brijesh Singh , Ard Biesheuvel , Jordan Justen , Tom Lendacky , Laszlo Ersek Date: Mon, 14 Aug 2017 07:36:45 -0400 Message-Id: <1502710605-8058-24-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (10.173.226.157) To BY2PR12MB0145.namprd12.prod.outlook.com (10.162.82.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7c47f10f-d9c5-4198-f589-08d4e308d85f X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR12MB0145; X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 3:7g4x1TundQYeCPFme05kiqwa8eyPjbef14FXi5QfOargaT75XTlLz3dzsVsorey4nPhOuPDvWaZfDFHxI8he8eYPKbH9vJUbOfj0Uzs+K6507/XIIqB+gB+V6wMDP47/CNjKN46CA58H7xJzGt8kwWQxSYe3z3bi/Jrii8kPBjuBY9q0sZ5qSPKfZdmbTtQ/iFobNJmXNp/JDg+LoqvFnk1FZDFCusMPo6FXtIl+VDBKvmATEgPb3o9p4wKga4Bh; 25:PnHCb0CLUGP/iG1xbtTzlosJUCtE3RqwC42Rq+vXXcgK1akACIGSqAMqPLgJRbFDbC7+gC77y7i+skuz/LAD3BEVq3e/s8G9lCKhi7mwEBbEUa8y2onCgmxgyLA4gj/0GzXbTpyXqjk+0k30sUbVTRBrGcySwgVIWDWmGGSsPRWPGduKrc7QOoD4HH8GKKiizboJiYfsT/KmWQ2QXAUZP18x1gXJ3XjsnP9CqCHZ4/5GHYQbJNv+Uh1nukI1kpharjnINtV+Pf77dXpvcqAKm4o4izgkNpbo7NCerTe72uVKb8o6FNiALjfgnhSzh8tSAJeEqp/H7f9CnIHz0vfLmA==; 31:jviPw9mzWXnh+x0sN3F0A9to+f9zCNQ4pmJLt0UMuthTY+PCpfQzVDt6JXIp92OQJunhkCWutJLxnqbFwT2ZXLtFCXGNxOxXtMyJmSseUwnrkb0aHdKIS2XL4FK7dfV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)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0145; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0145; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(199003)(189002)(54906002)(5003940100001)(6116002)(3846002)(53936002)(97736004)(575784001)(86362001)(36756003)(81156014)(81166006)(110136004)(8676002)(6306002)(189998001)(50986999)(966005)(76176999)(5660300001)(2361001)(25786009)(2351001)(50226002)(4326008)(7350300001)(33646002)(478600001)(53416004)(42186005)(2906002)(105586002)(7736002)(305945005)(106356001)(48376002)(50466002)(47776003)(66066001)(6486002)(6916009)(2950100002)(6666003)(68736007)(101416001)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0145; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0145; 23:B2aI0xR76bCRmYrR8k2xA/+TAtjD91NWBQXyPZUI5?= =?us-ascii?Q?n3DPCmorXnA8cwFUJ3MeEDupI/aA29icbpXD1cWCsEP1uhgooZtwAo8dHfsL?= =?us-ascii?Q?QJQ9K6T3dgrISLWfur3SmI3J+b/3o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7QccdkP2+UdR8zEVv4jhOoPBKlwhXEvVD886zl4mKqAvaexgmbPXaZOSQEXCWoIOdmrlNvzbmP+Ev8TKqHnW1Srv/TMRjCofvKuJG/VKoKI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0145; 20:Rz9j0RDkahIzOKHyDalL3IzuYRJKsIdopSViZkaJuDyyXUWmzQbAC6EmPqKGIqfVsMro+nDFOVPlJGqC9CwFWAGZUWc0512a8b03OdpRHJXek8OS6M+7QLzGU040z7fEUaSvK3lAn8TSBguDUSnBAUYI4b90UDJJKcX2Ftj9L3fe2rIP+/5ILYdcqITQEG1L/0PZB6HNTJST/V5O0cYFQKpeyNldEj3pe+fcQivhI8+oqqKsSVWLb1S1d8c8hlpq X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 11:37:28.9555 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0145 Subject: [PATCH v2 23/23] OvmfPkg/Virtio: define VIRITO_F_IOMMU_PLATFORM feature bit 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: , X-List-Received-Date: Mon, 14 Aug 2017 11:35:07 -0000 Content-Type: text/plain This feature indicates that the device is behind an IOMMU that translates bus addresses from the device into physical addresses in memory. If this feature bit is set to 0, then the device emits physical addresses which are not translated further, even though an IOMMU may be present. see [1] for more infromation [1] https://lists.oasis-open.org/archives/virtio-dev/201610/msg00121.html In previous patches, we have implemented IOMMU-like member functions in VIRTIO_DEVICE_PROTOCOL to translate the physical address to bus address and virtio drivers are updated to use those member functions. We do not need to do anything special when VIRTIO_F_IOMMU_PLATFORM bit is present hence treat it in parallel with VIRTIO_F_VERSION_1. Suggested-by: Laszlo Ersek Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh --- OvmfPkg/Include/IndustryStandard/Virtio10.h | 5 +++++ OvmfPkg/VirtioBlkDxe/VirtioBlk.c | 3 ++- OvmfPkg/VirtioNetDxe/SnpInitialize.c | 3 ++- OvmfPkg/VirtioRngDxe/VirtioRng.c | 2 +- OvmfPkg/VirtioScsiDxe/VirtioScsi.c | 3 ++- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/OvmfPkg/Include/IndustryStandard/Virtio10.h b/OvmfPkg/Include/IndustryStandard/Virtio10.h index 4c9b62a3cf59..c62429d94432 100644 --- a/OvmfPkg/Include/IndustryStandard/Virtio10.h +++ b/OvmfPkg/Include/IndustryStandard/Virtio10.h @@ -83,4 +83,9 @@ typedef struct { // #define VIRTIO_F_VERSION_1 BIT32 +// +// VirtIo 1.0 reserved iommu platform feature bits +// +#define VIRTIO_F_IOMMU_PLATFORM BIT33 + #endif // _VIRTIO_1_0_H_ diff --git a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c index 57baceb20a19..a78ec0df9c7b 100644 --- a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c +++ b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c @@ -773,7 +773,8 @@ VirtioBlkInit ( } Features &= VIRTIO_BLK_F_BLK_SIZE | VIRTIO_BLK_F_TOPOLOGY | VIRTIO_BLK_F_RO | - VIRTIO_BLK_F_FLUSH | VIRTIO_F_VERSION_1; + VIRTIO_BLK_F_FLUSH | VIRTIO_F_VERSION_1 | + VIRTIO_F_IOMMU_PLATFORM; // // In virtio-1.0, feature negotiation is expected to complete before queue diff --git a/OvmfPkg/VirtioNetDxe/SnpInitialize.c b/OvmfPkg/VirtioNetDxe/SnpInitialize.c index 9bac19f8e3d1..b389f6243661 100644 --- a/OvmfPkg/VirtioNetDxe/SnpInitialize.c +++ b/OvmfPkg/VirtioNetDxe/SnpInitialize.c @@ -536,7 +536,8 @@ VirtioNetInitialize ( ASSERT (Dev->Snm.MediaPresentSupported == !!(Features & VIRTIO_NET_F_STATUS)); - Features &= VIRTIO_NET_F_MAC | VIRTIO_NET_F_STATUS | VIRTIO_F_VERSION_1; + Features &= VIRTIO_NET_F_MAC | VIRTIO_NET_F_STATUS | VIRTIO_F_VERSION_1 | + VIRTIO_F_IOMMU_PLATFORM; // // In virtio-1.0, feature negotiation is expected to complete before queue diff --git a/OvmfPkg/VirtioRngDxe/VirtioRng.c b/OvmfPkg/VirtioRngDxe/VirtioRng.c index b19d90901430..81d8c7facc10 100644 --- a/OvmfPkg/VirtioRngDxe/VirtioRng.c +++ b/OvmfPkg/VirtioRngDxe/VirtioRng.c @@ -273,7 +273,7 @@ VirtioRngInit ( goto Failed; } - Features &= VIRTIO_F_VERSION_1; + Features &= VIRTIO_F_VERSION_1 | VIRTIO_F_IOMMU_PLATFORM; // // In virtio-1.0, feature negotiation is expected to complete before queue diff --git a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c index 65e9bda0827a..286b005c994c 100644 --- a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c +++ b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c @@ -903,7 +903,8 @@ VirtioScsiInit ( goto Failed; } - Features &= VIRTIO_SCSI_F_INOUT | VIRTIO_F_VERSION_1; + Features &= VIRTIO_SCSI_F_INOUT | VIRTIO_F_VERSION_1 | + VIRTIO_F_IOMMU_PLATFORM; // // In virtio-1.0, feature negotiation is expected to complete before queue -- 2.7.4