Skip to contentSkip to conversation

hw/pt-graphics.c: Gave guest iomem permission for host opregion in qemu-xen-traditional

PATCH In review Xiong Zhang 2 participants 3 messages Jun 27, 2017 – Jul 11, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 hw/pt-graphics.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
hw/pt-graphics.c +11 -1
index 7302b25..893bf12 100644
@@ -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 )
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw

Hi,

Perhaps Anthony can review this patch (noticing you reviewed other igd related patches recently..) ?

Thanks,

-- Pasi

Quoted 46 lines · Xiong Zhang

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.

---
 hw/pt-graphics.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
hw/pt-graphics.c +11 -1
index 7302b25..893bf12 100644
@@ -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 )
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw

Actually, qemu-xen has done this in igd_write_opregion() of hw/xen/xen_pt_graphics.c, while qemu-xen-traditional lack of this, so I send this patch to fix it.

thanks

Quoted 40 lines

-----Original Message-----
From: Pasi Kärkkäinen [mailto:[email protected]]
Sent: Monday, July 10, 2017 11:00 PM
To: Anthony PERARD <[email protected]>
Cc: [email protected]; [email protected]; Zhang, Xiong Y <[email protected]>
Subject: Re: [Xen-devel] [PATCH] hw/pt-graphics.c: Gave guest iomem permission for host opregion in qemu-xen-traditional

Hi,

Perhaps Anthony can review this patch (noticing you reviewed other igd related patches recently..) ?

Thanks,

-- Pasi

hw/pt-graphics.c void igd_write_opregion(struct pt_dev *real_dev,

Quoted 17 lines · Xiong Zhang

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.

---
 hw/pt-graphics.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
hw/pt-graphics.c +0 -0
index 7302b25..893bf12 100644
@@ -78,10 +78,20 @@ void igd_write_opregion(struct pt_dev *real_dev,

uint32_t val)

hw/pt-graphics.c void igd_write_opregion(struct pt_dev *real_dev, · line 79

Quoted 2 lines
hw/pt-graphics.c +0 -0
     igd_guest_opregion = (val & ~0xfff) | (host_opregion & 0xfff);
     PT_LOG("Map OpRegion: %x -> %x\n", host_opregion,
Quoted 29 lines

igd_guest_opregion);

hw/pt-graphics.c void igd_write_opregion(struct pt_dev *real_dev, uint32_t val)

Quoted 6 lines
hw/pt-graphics.c +5 -0
+    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",

Quoted 21 lines
hw/pt-graphics.c +6 -2
+                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
[email protected]
https://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel