Skip to contentSkip to conversation

xen-hvm: ignore background I/O sections

PATCH Superseded Paul Durrant 2 participants 4 messages May 9, 2016

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 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]>
---
 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 20 lines · Paul Durrant

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]>
---
 xen-hvm.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
xen-hvm.c +0 -0
index 039680a..8ab44f0 100644

xen-hvm.c static void xen_io_add(MemoryListener *listener, · line 516

Quoted 8 lines
xen-hvm.c +3 -1
@@ -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;

Missing braces, same in xen_io_del. Otherwise looks ok.

Paolo

Quoted 11 lines
xen-hvm.c +3 -0
+    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;
+

xen-hvm.c static void xen_io_del(MemoryListener *listener, · line 537

Quoted 10 lines
xen-hvm.c +3 -1
+    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,

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

#2 lore raw
In reply to Paul Durrant
Quoted 20 lines · Paul Durrant

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]>
---
 xen-hvm.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
xen-hvm.c +0 -0
index 039680a..8ab44f0 100644

xen-hvm.c static void xen_io_add(MemoryListener *listener, · line 516

Quoted 8 lines
xen-hvm.c +3 -1
@@ -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;

Missing braces, same in xen_io_del. Otherwise looks ok.

Paolo

Quoted 21 lines
xen-hvm.c +6 -1
+    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,
#3 lore raw
Quoted 35 lines

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

Quoted 25 lines · Paul Durrant

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]>
---
 xen-hvm.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
xen-hvm.c +1 -0
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;
 
Quoted 6 lines

xen-hvm.c static void xen_io_add(MemoryListener *listener, · line 516

Quoted 3 lines
xen-hvm.c +2 -1
-    memory_region_ref(section->mr);
+    if (mr->ops == &unassigned_io_ops)
+        return;

Missing braces, same in xen_io_del. Otherwise looks ok.

Ah, sorry. Forgot to style-switch. Will post v2.

Quoted 15 lines

Paolo

Quoted 13 lines
xen-hvm.c +5 -0
+    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;
 
Quoted 8 lines

xen-hvm.c static void xen_io_del(MemoryListener *listener, · line 537

Quoted 8 lines
xen-hvm.c +1 -1
     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,

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