Skip to content

Commit

Permalink
xen-hvm: ignore background I/O sections
Browse files Browse the repository at this point in the history
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>
Message-Id: <1462811480-16295-1-git-send-email-paul.durrant@citrix.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Paul Durrant authored and bonzini committed May 29, 2016
1 parent a4a0e4b commit a8ff431
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions xen-hvm.c
Expand Up @@ -511,8 +511,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);
}
Expand All @@ -521,10 +526,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,
Expand Down

0 comments on commit a8ff431

Please sign in to comment.