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

[PATCH 3/8] xen/mpu: enable device passthrough in MPU system



From: Penny Zheng <Penny.Zheng@xxxxxxx>

In order to enable device passthrough in MPU system, we only need to
provide p2m_mmio_direct_dev permission set up.

Signed-off-by: Penny Zheng <penny.zheng@xxxxxxx>
Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
---
 xen/arch/arm/mpu/p2m.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/mpu/p2m.c b/xen/arch/arm/mpu/p2m.c
index 681717eacf37..f2482237412b 100644
--- a/xen/arch/arm/mpu/p2m.c
+++ b/xen/arch/arm/mpu/p2m.c
@@ -13,6 +13,7 @@
 static inline unsigned int build_p2m_flags(p2m_type_t t)
 {
     unsigned int flags = 0;
+    unsigned int attr_idx = MT_NORMAL;
 
     BUILD_BUG_ON(p2m_max_real_type > (1 << 4));
 
@@ -30,11 +31,15 @@ static inline unsigned int build_p2m_flags(p2m_type_t t)
         flags |= _PAGE_XN | _PAGE_RO;
         break;
 
+    case p2m_mmio_direct_dev:
+        flags |= _PAGE_XN;
+        attr_idx = MT_DEVICE_nGnRE;
+        break;
+
     case p2m_max_real_type:
         BUG();
         break;
 
-    case p2m_mmio_direct_dev:
     case p2m_mmio_direct_nc:
     case p2m_mmio_direct_c:
     case p2m_iommu_map_ro:
@@ -47,7 +52,7 @@ static inline unsigned int build_p2m_flags(p2m_type_t t)
         break;
     }
 
-    flags |= MT_NORMAL;
+    flags |= attr_idx;
 
     return flags;
 }
-- 
2.34.1




 


Rackspace

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