All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] xen-hvm: ignore background I/O sections
@ 2016-05-09 16:18 ` Paul Durrant
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Durrant @ 2016-05-09 16:18 UTC (permalink / raw)
  To: qemu-devel, xen-devel
  Cc: Paul Durrant, Stefano Stabellini, Anthony Perard, Paolo Bonzini

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

diff --git a/xen-hvm.c b/xen-hvm.c
index 039680a..8ab44f0 100644
--- a/xen-hvm.c
+++ b/xen-hvm.c
@@ -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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] xen-hvm: ignore background I/O sections
@ 2016-05-09 16:18 ` Paul Durrant
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Durrant @ 2016-05-09 16:18 UTC (permalink / raw)
  To: qemu-devel, xen-devel
  Cc: Anthony Perard, Paolo Bonzini, Paul Durrant, Stefano Stabellini

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

diff --git a/xen-hvm.c b/xen-hvm.c
index 039680a..8ab44f0 100644
--- a/xen-hvm.c
+++ b/xen-hvm.c
@@ -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


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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] xen-hvm: ignore background I/O sections
  2016-05-09 16:18 ` Paul Durrant
  (?)
  (?)
@ 2016-05-09 16:39 ` Paolo Bonzini
  2016-05-09 16:40     ` Paul Durrant
  -1 siblings, 1 reply; 6+ messages in thread
From: Paolo Bonzini @ 2016-05-09 16:39 UTC (permalink / raw)
  To: Paul Durrant, qemu-devel, xen-devel; +Cc: Stefano Stabellini, Anthony Perard



On 09/05/2016 18:18, 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>
> ---
>  xen-hvm.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/xen-hvm.c b/xen-hvm.c
> index 039680a..8ab44f0 100644
> --- a/xen-hvm.c
> +++ b/xen-hvm.c
> @@ -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

> +    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,
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen-hvm: ignore background I/O sections
  2016-05-09 16:18 ` Paul Durrant
  (?)
@ 2016-05-09 16:39 ` Paolo Bonzini
  -1 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2016-05-09 16:39 UTC (permalink / raw)
  To: Paul Durrant, qemu-devel, xen-devel; +Cc: Anthony Perard, Stefano Stabellini



On 09/05/2016 18:18, 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>
> ---
>  xen-hvm.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/xen-hvm.c b/xen-hvm.c
> index 039680a..8ab44f0 100644
> --- a/xen-hvm.c
> +++ b/xen-hvm.c
> @@ -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

> +    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,
> 

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] xen-hvm: ignore background I/O sections
  2016-05-09 16:39 ` [Qemu-devel] " Paolo Bonzini
@ 2016-05-09 16:40     ` Paul Durrant
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Durrant @ 2016-05-09 16:40 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel, xen-devel; +Cc: Stefano Stabellini, Anthony Perard

> -----Original Message-----
> From: Paolo Bonzini [mailto:pbonzini@redhat.com]
> Sent: 09 May 2016 17:39
> To: Paul Durrant; qemu-devel@nongnu.org; xen-devel@lists.xenproject.org
> Cc: Stefano Stabellini; Anthony Perard
> Subject: Re: [PATCH] xen-hvm: ignore background I/O sections
> 
> 
> 
> On 09/05/2016 18:18, 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>
> > ---
> >  xen-hvm.c | 12 ++++++++++--
> >  1 file changed, 10 insertions(+), 2 deletions(-)
> >
> > diff --git a/xen-hvm.c b/xen-hvm.c
> > index 039680a..8ab44f0 100644
> > --- a/xen-hvm.c
> > +++ b/xen-hvm.c
> > @@ -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.
> 

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

> Paolo
> 
> > +    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,
> >

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen-hvm: ignore background I/O sections
@ 2016-05-09 16:40     ` Paul Durrant
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Durrant @ 2016-05-09 16:40 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel, xen-devel; +Cc: Anthony Perard, Stefano Stabellini

> -----Original Message-----
> From: Paolo Bonzini [mailto:pbonzini@redhat.com]
> Sent: 09 May 2016 17:39
> To: Paul Durrant; qemu-devel@nongnu.org; xen-devel@lists.xenproject.org
> Cc: Stefano Stabellini; Anthony Perard
> Subject: Re: [PATCH] xen-hvm: ignore background I/O sections
> 
> 
> 
> On 09/05/2016 18:18, 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>
> > ---
> >  xen-hvm.c | 12 ++++++++++--
> >  1 file changed, 10 insertions(+), 2 deletions(-)
> >
> > diff --git a/xen-hvm.c b/xen-hvm.c
> > index 039680a..8ab44f0 100644
> > --- a/xen-hvm.c
> > +++ b/xen-hvm.c
> > @@ -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.
> 

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

> Paolo
> 
> > +    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,
> >
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-05-09 17:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-09 16:18 [Qemu-devel] [PATCH] xen-hvm: ignore background I/O sections Paul Durrant
2016-05-09 16:18 ` Paul Durrant
2016-05-09 16:39 ` Paolo Bonzini
2016-05-09 16:39 ` [Qemu-devel] " Paolo Bonzini
2016-05-09 16:40   ` Paul Durrant
2016-05-09 16:40     ` Paul Durrant

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.