From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35623) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6Efx-0002uR-FI for qemu-devel@nongnu.org; Fri, 27 May 2016 06:07:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b6Efr-0007Rl-17 for qemu-devel@nongnu.org; Fri, 27 May 2016 06:07:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34551) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6Efq-0007RZ-RF for qemu-devel@nongnu.org; Fri, 27 May 2016 06:07:22 -0400 From: Paolo Bonzini Date: Fri, 27 May 2016 12:06:34 +0200 Message-Id: <1464343604-517-22-git-send-email-pbonzini@redhat.com> In-Reply-To: <1464343604-517-1-git-send-email-pbonzini@redhat.com> References: <1464343604-517-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 21/31] xen-hvm: ignore background I/O sections List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paul Durrant , Stefano Stabellini , Anthony Perard From: 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. Signed-off-by: Paul Durrant Cc: Stefano Stabellini Cc: Anthony Perard Cc: Paolo Bonzini Message-Id: <1462811480-16295-1-git-send-email-paul.durrant@citrix.com> Acked-by: Anthony PERARD Signed-off-by: Paolo Bonzini --- xen-hvm.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/xen-hvm.c b/xen-hvm.c index c14e778..01ee25d 100644 --- a/xen-hvm.c +++ b/xen-hvm.c @@ -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); } @@ -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, -- 2.5.5