diff options
author | Cédric Le Goater <clg@kaod.org> | 2019-05-13 10:42:39 +0200 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2019-05-29 11:39:46 +1000 |
commit | 90c20e1e2ce0fb52975ff4d6590620ef0129790e (patch) | |
tree | bd7fb156517aa76a8542d0f17082e97870266cb2 | |
parent | 0dc9f5f8496a23da375a3b19556e265ba22478e0 (diff) | |
download | qemu-90c20e1e2ce0fb52975ff4d6590620ef0129790e.zip qemu-90c20e1e2ce0fb52975ff4d6590620ef0129790e.tar.gz qemu-90c20e1e2ce0fb52975ff4d6590620ef0129790e.tar.bz2 |
sysbus: add a sysbus_mmio_unmap() helper
This will be used to remove the MMIO regions of the POWER9 XIVE
interrupt controller when the sPAPR machine is reseted.
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20190513084245.25755-9-clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r-- | hw/core/sysbus.c | 10 | ||||
-rw-r--r-- | include/hw/sysbus.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 307cf90..689a867 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -153,6 +153,16 @@ static void sysbus_mmio_map_common(SysBusDevice *dev, int n, hwaddr addr, } } +void sysbus_mmio_unmap(SysBusDevice *dev, int n) +{ + assert(n >= 0 && n < dev->num_mmio); + + if (dev->mmio[n].addr != (hwaddr)-1) { + memory_region_del_subregion(get_system_memory(), dev->mmio[n].memory); + dev->mmio[n].addr = (hwaddr)-1; + } +} + void sysbus_mmio_map(SysBusDevice *dev, int n, hwaddr addr) { sysbus_mmio_map_common(dev, n, addr, false, 0); diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index 1aedcf0..4c668fb 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -89,6 +89,7 @@ qemu_irq sysbus_get_connected_irq(SysBusDevice *dev, int n); void sysbus_mmio_map(SysBusDevice *dev, int n, hwaddr addr); void sysbus_mmio_map_overlap(SysBusDevice *dev, int n, hwaddr addr, int priority); +void sysbus_mmio_unmap(SysBusDevice *dev, int n); void sysbus_add_io(SysBusDevice *dev, hwaddr addr, MemoryRegion *mem); MemoryRegion *sysbus_address_space(SysBusDevice *dev); |