On 19/10/2023 09.16, Philippe Mathieu-Daudé wrote:
There is no point in exposing an internal MMIO region via
SysBus and directly mapping it in the very same device.

Just map it without using the SysBus API.

Transformation done using the following coccinelle script:

   @@
   expression sbdev;
   expression index;
   expression addr;
   expression subregion;
   @@
   -    sysbus_init_mmio(sbdev, subregion);
        ... when != sbdev
   -    sysbus_mmio_map(sbdev, index, addr);
   +    memory_region_add_subregion(get_system_memory(),
   +                                addr, subregion);

   @@
   expression priority;
   @@
   -    sysbus_init_mmio(sbdev, subregion);
        ... when != sbdev
   -    sysbus_mmio_map_overlap(sbdev, index, addr, priority);
   +    memory_region_add_subregion_overlap(get_system_memory(),
   +                                        addr,
   +                                        subregion, priority);

Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
---
  hw/misc/allwinner-r40-dramc.c | 13 ++++++-------
  1 file changed, 6 insertions(+), 7 deletions(-)

Reviewed-by: Thomas Huth <th...@redhat.com>



Reply via email to