diff mbox

[v3] xen-hvm: ignore background I/O sections

Message ID 1462811480-16295-1-git-send-email-paul.durrant@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paul Durrant May 9, 2016, 4:31 p.m. UTC
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.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
---

v3:
 - Really add missing braces.

v2:
 - Add missing braces
---
 xen-hvm.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

Comments

Anthony PERARD May 25, 2016, 3:52 p.m. UTC | #1
On Mon, May 09, 2016 at 05:31:20PM +0100, Paul Durrant wrote:
> 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.
> 
> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>

Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Paolo Bonzini May 25, 2016, 6:04 p.m. UTC | #2
----- Original Message -----
> From: "Anthony PERARD" <anthony.perard@citrix.com>
> To: "Paul Durrant" <paul.durrant@citrix.com>
> Cc: qemu-devel@nongnu.org, xen-devel@lists.xenproject.org, "Stefano Stabellini" <sstabellini@kernel.org>, "Paolo
> Bonzini" <pbonzini@redhat.com>
> Sent: Wednesday, May 25, 2016 5:52:32 PM
> Subject: Re: [PATCH v3] xen-hvm: ignore background I/O sections
> 
> On Mon, May 09, 2016 at 05:31:20PM +0100, Paul Durrant wrote:
> > 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.
> > 
> > Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> > Cc: Stefano Stabellini <sstabellini@kernel.org>
> > Cc: Anthony Perard <anthony.perard@citrix.com>
> > Cc: Paolo Bonzini <pbonzini@redhat.com>
> 
> Acked-by: Anthony PERARD <anthony.perard@citrix.com>

Do you have a signed GPG key or do I need to apply this for you?

Thanks,

Paolo
Stefano Stabellini May 26, 2016, 9:09 a.m. UTC | #3
On Wed, 25 May 2016, Paolo Bonzini wrote:
> > From: "Anthony PERARD" <anthony.perard@citrix.com>
> > To: "Paul Durrant" <paul.durrant@citrix.com>
> > Cc: qemu-devel@nongnu.org, xen-devel@lists.xenproject.org, "Stefano Stabellini" <sstabellini@kernel.org>, "Paolo
> > Bonzini" <pbonzini@redhat.com>
> > Sent: Wednesday, May 25, 2016 5:52:32 PM
> > Subject: Re: [PATCH v3] xen-hvm: ignore background I/O sections
> > 
> > On Mon, May 09, 2016 at 05:31:20PM +0100, Paul Durrant wrote:
> > > 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.
> > > 
> > > Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> > > Cc: Stefano Stabellini <sstabellini@kernel.org>
> > > Cc: Anthony Perard <anthony.perard@citrix.com>
> > > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > 
> > Acked-by: Anthony PERARD <anthony.perard@citrix.com>
> 
> Do you have a signed GPG key or do I need to apply this for you?

I was going to say, I'll just queue this up in my tree, but I don't have
any other commits at this time, so if you are OK with applying this, I
am fine with it too.
diff mbox

Patch

diff --git a/xen-hvm.c b/xen-hvm.c
index 039680a..e394407 100644
--- a/xen-hvm.c
+++ b/xen-hvm.c
@@ -510,8 +510,13 @@  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 +525,15 @@  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,