[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 10/11] xen/arm: device assignment on 1:1 direct-map domain


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <sstabellini@xxxxxxxxxx>, <julien@xxxxxxx>
  • From: Penny Zheng <penny.zheng@xxxxxxx>
  • Date: Thu, 23 Sep 2021 03:11:14 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none
  • 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; bh=5SA4d2GeBF/c/7lvVqfUDdcRMEVLTNcBLtAK0ks8Cfg=; b=cg0STODoC+kwN6BBhu+tY1r8ABimttGv0/VdcXdREYEbl9W3JwdBQGaacTncHMwXpE3DyncCt2vi63IAdM8hMqPcTNQaIoPLl/rrN4ryplZQr+8FzHxZGf/dv2mJqxKkEwHoGQIwWH1cKJ/e6XvB6t0fu3+WnAilIyJW0KbBoreof/JODSwhiWCE+W3nqcA24yMysssbTnQSQkQGxHD6rixBDVCXs67TgfeF6hL2ulQEnaUhAPWreNCHWJa/OysbNcCh9tDjgrHLjSDvM/SYgWoELYwBwhh2EgcCBuE2R2wwp0pjgmC2Kp4cD+R+AbaBcPBwl5YWGsRz+TOLYB9/4w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Utw3mh2tL9u54gxSJBfNFCpBgsU32aT5P4B4Jk7bJsV426RPe1lcZi6dP/BtGat2QDEczgHJNq41eBxAmJDcSEVYZ0N0uuBIC50qEcxcnZHlj76P/FDjer+Umky9nld0J9PMxWLRl/mj4uwtAD6wmkq3ntzMItbDIuPMBMNgapyIBu0Z7LIzA6jfOge87o5vp2yXuXL7lA/6HFt6vGypk8z4TIS74HZwQDds98DI9PiTctA9sWR7whoLa15jz0yhlsBX+AgdmjOG6SUvoCQ7M5k3PsNJI7DHFl3/7AP7+noPPddieH3YDw8hE008gxKdwcLfrLtlImEUL7hohWfkCA==
  • Cc: <Bertrand.Marquis@xxxxxxx>, <Penny.Zheng@xxxxxxx>, <Wei.Chen@xxxxxxx>
  • Delivery-date: Thu, 23 Sep 2021 03:17:06 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true

User could do device passthrough, with "xen,force-assign-without-iommu" in
the device tree snippet, on trusted guest through 1:1 direct-map,
if IOMMU absent or disabled on hardware.

In order to achieve that, this patch adds 1:1 direct-map check and disables
iommu-related action.

Signed-off-by: Penny Zheng <penny.zheng@xxxxxxx>
---
 xen/arch/arm/domain_build.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index c92e510ae7..9a9d2522b7 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2070,14 +2070,18 @@ static int __init handle_passthrough_prop(struct 
kernel_info *kinfo,
     if ( res < 0 )
         return res;
 
+    /*
+     * If xen_force, we allow assignment of devices without IOMMU protection.
+     * And if IOMMU is disabled or absent, 1:1 direct-map is necessary
+     */
+    if ( xen_force && is_domain_direct_mapped(kinfo->d) &&
+         !dt_device_is_protected(node) )
+        return 0;
+
     res = iommu_add_dt_device(node);
     if ( res < 0 )
         return res;
 
-    /* If xen_force, we allow assignment of devices without IOMMU protection. 
*/
-    if ( xen_force && !dt_device_is_protected(node) )
-        return 0;
-
     return iommu_assign_dt_device(kinfo->d, node);
 }
 
-- 
2.25.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.