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

[Xen-devel] [PATCH] hw/pt-graphics.c: Gave guest iomem permission for host opregion in qemu-xen-traditional



Currently guest couldn't access host opregion when igd is passed through
to guest with qemu-xen-traditional. Because guest lack of
iomem permission to map guest allocated opregion pages to host opregion
pages.

So guest should get iomem permission for host opregion before mapping.

Signed-off-by: Xiong Zhang <xiong.y.zhang@xxxxxxxxx>
---
 hw/pt-graphics.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/hw/pt-graphics.c b/hw/pt-graphics.c
index 7302b25..893bf12 100644
--- a/hw/pt-graphics.c
+++ b/hw/pt-graphics.c
@@ -78,10 +78,20 @@ void igd_write_opregion(struct pt_dev *real_dev, uint32_t 
val)
     igd_guest_opregion = (val & ~0xfff) | (host_opregion & 0xfff);
     PT_LOG("Map OpRegion: %x -> %x\n", host_opregion, igd_guest_opregion);
 
+    ret = xc_domain_iomem_permission(xc_handle, domid,
+            host_opregion >> XC_PAGE_SHIFT, 3, 1);
+    if (ret)
+    {
+        PT_LOG("Error[%d]: Can't enable to access IGD host opregion: 0x%x\n",
+                ret, host_opregion >> XC_PAGE_SHIFT);
+        igd_guest_opregion = 0;
+        return;
+    }
+
     ret = xc_domain_memory_mapping(xc_handle, domid,
             igd_guest_opregion >> XC_PAGE_SHIFT,
             host_opregion >> XC_PAGE_SHIFT,
-            2,
+            3,
             DPCI_ADD_MAPPING);
 
     if ( ret != 0 )
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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