Skip to contentSkip to conversation

sysbus: Remove sysbus_mmio_unmap

PATCH Peter Maydell 3 participants 6 messages Jun 23, 2022 4 messages not in the archive KVM

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

Peter Maydell

author Reviewed-by
#2 lore raw
Quoted 5 lines · Peter Delevoryas

Cedric removed usage of this function in a previous commit.

Fixes 981b1c6266c6 ("spapr/xive: rework the mapping the KVM memory regions")

We only added this function for the XIVE in the first place so I guess it makes sense to remove it now it's unused. (People doing complicated stuff that needs to unmap MRs should probably not be using sysbus_mmio_map()/unmap() anyway...)

-- PMM

Reviewed-by
#3 lore raw
In reply to a message not in the archive
Quoted 4 lines · Peter Delevoryas

Cedric removed usage of this function in a previous commit.

Fixes 981b1c6266c6 ("spapr/xive: rework the mapping the KVM memory regions")

Thanks,

C.

Quoted 38 lines
---
  hw/core/sysbus.c    | 10 ----------
  include/hw/sysbus.h |  1 -
  2 files changed, 11 deletions(-)
hw/core/sysbus.c +0 -10
index 05c1da3d31..637e18f247 100644
@@ -154,16 +154,6 @@ 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);
include/hw/sysbus.h +0 -1
index 3564b7b6a2..153ef20695 100644
@@ -82,7 +82,6 @@ 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);

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

Re: [PATCH 06/14] aspeed: Add system-memory QOM link to SoC

Review

Quoted 11 lines · Peter Delevoryas

Right now it's just defined as the regular global system memory. If we migrate all the SoC code to use this property instead of directly calling get_system_memory(), then we can restrict the memory container for the SoC, which will be useful for multi-SoC machines.

static Property aspeed_soc_properties[] = {

(quoted diff) +2 -0
+    DEFINE_PROP_LINK("system-memory", AspeedSoCState, system_memory,
+                     TYPE_MEMORY_REGION, MemoryRegion *),

To the extent that we have a convention, we tend to call this property on an SoC or CPU "memory", I think. (Better suggestions welcome...)

-- PMM

#6 lore raw

Re: [PATCH 06/14] aspeed: Add system-memory QOM link to SoC

Quoted 13 lines · Peter Maydell
Quoted 7 lines · Peter Delevoryas

Right now it's just defined as the regular global system memory. If we migrate all the SoC code to use this property instead of directly calling get_system_memory(), then we can restrict the memory container for the SoC, which will be useful for multi-SoC machines.

Quoted 7 lines

Review

Quoted 3 lines

static Property aspeed_soc_properties[] = {

(quoted diff) +2 -0
+    DEFINE_PROP_LINK("system-memory", AspeedSoCState, system_memory,
+                     TYPE_MEMORY_REGION, MemoryRegion *),

To the extent that we have a convention, we tend to call this property on an SoC or CPU "memory", I think. (Better suggestions welcome...)

Oh oops, yes, in hindsight that is very obvious. I’ll change this from “system-memory” to “memory”.

Quoted 2 lines

-- PMM

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw

Re: [PATCH 11/14] aspeed: Switch to create_unimplemented_device_in

Quoted 16 lines · Peter Delevoryas
---
 hw/arm/aspeed_ast10x0.c | 10 ++++------
 hw/arm/aspeed_ast2600.c | 19 ++++++++++---------
 hw/arm/aspeed_soc.c     |  9 +++++----
 3 files changed, 19 insertions(+), 19 deletions(-)
hw/arm/aspeed_ast10x0.c +0 -0
index d259d30fc0..4e6688cc68 100644
@@ -158,12 +158,10 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
     }
 
     /* General I/O memory space to catch all unimplemented device */

hw/arm/aspeed_ast10x0.c static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp) · line 164

Quoted 10 lines
hw/arm/aspeed_ast10x0.c +4 -6
-    create_unimplemented_device("aspeed.sbc",
-                                sc->memmap[ASPEED_DEV_SBC],
-                                0x40000);
-    create_unimplemented_device("aspeed.io",
-                                sc->memmap[ASPEED_DEV_IOMEM],
-                                ASPEED_SOC_IOMEM_SIZE);
+    create_unimplemented_device_in("aspeed.sbc", sc->memmap[ASPEED_DEV_SBC],
+                                   0x40000, s->system_memory);
+    create_unimplemented_device_in("aspeed.io", sc->memmap[ASPEED_DEV_IOMEM],
+                                   ASPEED_SOC_IOMEM_SIZE, s->system_memory);

This is SoC code, so it should probably be handling its unimplemented devices by creating and mapping TYPE_UNIMPLEMENTED_DEVICE child objects directly, the same way it handles all its other child devices.

thanks
-- PMM

#9 lore raw

Re: [PATCH 11/14] aspeed: Switch to create_unimplemented_device_in

Quoted 20 lines · Peter Maydell
Quoted 15 lines · Peter Delevoryas

---

hw/arm/aspeed_ast10x0.c | 10 ++++------
hw/arm/aspeed_ast2600.c | 19 ++++++++++---------
hw/arm/aspeed_soc.c     |  9 +++++----
3 files changed, 19 insertions(+), 19 deletions(-)
hw/arm/aspeed_ast10x0.c +0 -0
index d259d30fc0..4e6688cc68 100644
@@ -158,12 +158,10 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
    }
 
Quoted 15 lines

hw/arm/aspeed_ast10x0.c static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp) · line 164

Quoted 11 lines
hw/arm/aspeed_ast10x0.c +4 -6
    /* General I/O memory space to catch all unimplemented device */
-    create_unimplemented_device("aspeed.sbc",
-                                sc->memmap[ASPEED_DEV_SBC],
-                                0x40000);
-    create_unimplemented_device("aspeed.io",
-                                sc->memmap[ASPEED_DEV_IOMEM],
-                                ASPEED_SOC_IOMEM_SIZE);
+    create_unimplemented_device_in("aspeed.sbc", sc->memmap[ASPEED_DEV_SBC],
+                                   0x40000, s->system_memory);
+    create_unimplemented_device_in("aspeed.io", sc->memmap[ASPEED_DEV_IOMEM],
+                                   ASPEED_SOC_IOMEM_SIZE, s->system_memory);

This is SoC code, so it should probably be handling its unimplemented devices by creating and mapping TYPE_UNIMPLEMENTED_DEVICE child objects directly, the same way it handles all its other child devices.

Ah, right. I’ll include a patch to create the device as a regular child object, and after that it will probably make more sense to remove “create_unimplemented_device_in” too and just do that memory mapping directly. Especially since I’m going to remove the “sysbus_mmio_map_overlap_in” function too.

Quoted 3 lines

thanks
-- PMM