From 052e87b073cb70afcd767d32f45af2794a5a65de Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 27 May 2013 10:08:27 +0200 Subject: memory: make section size a 128-bit integer So far, the size of all regions passed to listeners could fit in 64 bits, because artificial regions (containers and aliases) are eliminated by the memory core, leaving only device regions which have reasonable sizes An IOMMU however cannot be eliminated by the memory core, and may have an artificial size, hence we may need 65 bits to represent its size. Signed-off-by: Paolo Bonzini --- hw/misc/vfio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'hw/misc/vfio.c') diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c index 693a9ffdda..c89676b3ff 100644 --- a/hw/misc/vfio.c +++ b/hw/misc/vfio.c @@ -1953,7 +1953,7 @@ static void vfio_listener_region_add(MemoryListener *listener, } iova = TARGET_PAGE_ALIGN(section->offset_within_address_space); - end = (section->offset_within_address_space + section->size) & + end = (section->offset_within_address_space + int128_get64(section->size)) & TARGET_PAGE_MASK; if (iova >= end) { @@ -1997,7 +1997,7 @@ static void vfio_listener_region_del(MemoryListener *listener, } iova = TARGET_PAGE_ALIGN(section->offset_within_address_space); - end = (section->offset_within_address_space + section->size) & + end = (section->offset_within_address_space + int128_get64(section->size)) & TARGET_PAGE_MASK; if (iova >= end) { -- cgit 1.4.1 From 06d985f5d844d07d31b4dada20f4ff6cf0d6ff4a Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Tue, 30 Oct 2012 13:47:49 +0200 Subject: vfio: abort if an emulated iommu is used vfio doesn't support guest iommus yet, indicate it to the user by gently depositing a core on their disk. Reviewed-by: Peter Maydell Signed-off-by: Avi Kivity Signed-off-by: Paolo Bonzini --- hw/misc/vfio.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'hw/misc/vfio.c') diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c index c89676b3ff..52fb03601d 100644 --- a/hw/misc/vfio.c +++ b/hw/misc/vfio.c @@ -1939,6 +1939,8 @@ static void vfio_listener_region_add(MemoryListener *listener, void *vaddr; int ret; + assert(!memory_region_is_iommu(section->mr)); + if (vfio_listener_skipped_section(section)) { DPRINTF("SKIPPING region_add %"HWADDR_PRIx" - %"PRIx64"\n", section->offset_within_address_space, -- cgit 1.4.1