Skip to contentSkip to conversation

xen-hvm: ignore background I/O sections

PATCH Superseded Paul Durrant 1 participant 3 messages May 9, 2016

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 xen-hvm: ignore background I/O sections

Since Xen will correctly handle accesses to unimplemented I/O ports (by returning all 1's for reads and ignoring writes) there is no need for QEMU to register backgroud I/O sections.

This patch therefore adds checks to xen_io_add/del so that sections with memory-region ops pointing at 'unassigned_io_ops' are ignored.

Cc Stefano Stabellini <[email protected]>
Cc Anthony Perard <[email protected]>
Cc Paolo Bonzini <[email protected]>

---

v2:
- Add missing braces

---
 xen-hvm.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
xen-hvm.c +10 -2
index 039680a..8ab44f0 100644
@@ -510,8 +510,12 @@ static void xen_io_add(MemoryListener *listener,
                        MemoryRegionSection *section)
 {
     XenIOState *state = container_of(listener, XenIOState, io_listener);
+    MemoryRegion *mr = section->mr;
 
-    memory_region_ref(section->mr);
+    if (mr->ops == &unassigned_io_ops)
+        return;
+
+    memory_region_ref(mr);
 
     xen_map_io_section(xen_xc, xen_domid, state->ioservid, section);
 }
@@ -520,10 +524,14 @@ static void xen_io_del(MemoryListener *listener,
                        MemoryRegionSection *section)
 {
     XenIOState *state = container_of(listener, XenIOState, io_listener);
+    MemoryRegion *mr = section->mr;
+
+    if (mr->ops == &unassigned_io_ops)
+        return;
 
     xen_unmap_io_section(xen_xc, xen_domid, state->ioservid, section);
 
-    memory_region_unref(section->mr);
+    memory_region_unref(mr);
 }
 
 static void xen_device_realize(DeviceListener *listener,
Signature · 7 lines
2.1.4


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

-----Original Message-----
From: Paul Durrant [mailto:[email protected]]
Sent: 09 May 2016 17:29
To: [email protected]; [email protected]
Cc: Paul Durrant; Stefano Stabellini; Anthony Perard; Paolo Bonzini
Subject: [PATCH v2] xen-hvm: ignore background I/O sections

Since Xen will correctly handle accesses to unimplemented I/O ports (by returning all 1's for reads and ignoring writes) there is no need for QEMU to register backgroud I/O sections.

This patch therefore adds checks to xen_io_add/del so that sections with memory-region ops pointing at 'unassigned_io_ops' are ignored.

Quoted 8 lines
Cc Stefano Stabellini <[email protected]>
Cc Anthony Perard <[email protected]>
Cc Paolo Bonzini <[email protected]>

---

v2:
- Add missing braces

Aargh. Forgot to git add. Please ignore.

Paul

Quoted 39 lines
---
 xen-hvm.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
xen-hvm.c +10 -3
index 039680a..8ab44f0 100644
@@ -510,8 +510,12 @@ static void xen_io_add(MemoryListener *listener,
                        MemoryRegionSection *section)
 {
     XenIOState *state = container_of(listener, XenIOState, io_listener);
+    MemoryRegion *mr = section->mr;
 
-    memory_region_ref(section->mr);
+    if (mr->ops == &unassigned_io_ops)
+        return;
+
+    memory_region_ref(mr);
 
     xen_map_io_section(xen_xc, xen_domid, state->ioservid, section);
 }
@@ -520,10 +524,14 @@ static void xen_io_del(MemoryListener *listener,
                        MemoryRegionSection *section)
 {
     XenIOState *state = container_of(listener, XenIOState, io_listener);
+    MemoryRegion *mr = section->mr;
+
+    if (mr->ops == &unassigned_io_ops)
+        return;
 
     xen_unmap_io_section(xen_xc, xen_domid, state->ioservid, section);
 
-    memory_region_unref(section->mr);
+    memory_region_unref(mr);
 }
 
 static void xen_device_realize(DeviceListener *listener,
--
Quoted 1 line

2.1.4

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

#2 lore raw
In reply to Paul Durrant
Quoted 14 lines

-----Original Message-----
From: Paul Durrant [mailto:[email protected]]
Sent: 09 May 2016 17:29
To: [email protected]; [email protected]
Cc: Paul Durrant; Stefano Stabellini; Anthony Perard; Paolo Bonzini
Subject: [PATCH v2] xen-hvm: ignore background I/O sections

Since Xen will correctly handle accesses to unimplemented I/O ports (by returning all 1's for reads and ignoring writes) there is no need for QEMU to register backgroud I/O sections.

This patch therefore adds checks to xen_io_add/del so that sections with memory-region ops pointing at 'unassigned_io_ops' are ignored.

Quoted 8 lines
Cc Stefano Stabellini <[email protected]>
Cc Anthony Perard <[email protected]>
Cc Paolo Bonzini <[email protected]>

---

v2:
- Add missing braces

Aargh. Forgot to git add. Please ignore.

Paul

Quoted 40 lines
---
 xen-hvm.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
xen-hvm.c +10 -3
index 039680a..8ab44f0 100644
@@ -510,8 +510,12 @@ static void xen_io_add(MemoryListener *listener,
                        MemoryRegionSection *section)
 {
     XenIOState *state = container_of(listener, XenIOState, io_listener);
+    MemoryRegion *mr = section->mr;
 
-    memory_region_ref(section->mr);
+    if (mr->ops == &unassigned_io_ops)
+        return;
+
+    memory_region_ref(mr);
 
     xen_map_io_section(xen_xc, xen_domid, state->ioservid, section);
 }
@@ -520,10 +524,14 @@ static void xen_io_del(MemoryListener *listener,
                        MemoryRegionSection *section)
 {
     XenIOState *state = container_of(listener, XenIOState, io_listener);
+    MemoryRegion *mr = section->mr;
+
+    if (mr->ops == &unassigned_io_ops)
+        return;
 
     xen_unmap_io_section(xen_xc, xen_domid, state->ioservid, section);
 
-    memory_region_unref(section->mr);
+    memory_region_unref(mr);
 }
 
 static void xen_device_realize(DeviceListener *listener,
--

2.1.4