mbox series

[v2,00/21] hw: Remove implicit sysbus_mmio_map() from pflash APIs

Message ID 20230109120833.3330-1-philmd@linaro.org
Headers show
Series hw: Remove implicit sysbus_mmio_map() from pflash APIs | expand

Message

Philippe Mathieu-Daudé Jan. 9, 2023, 12:08 p.m. UTC
Since v1:
- Do not introduce pflash_cfi_create(), directly
  open-code pflash_cfi_register() before removing it (Peter)
- Added R-b tags

Paving the road toward heterogeneous QEMU, the limitations of
having a single machine sysbus become more apparent.

The sysbus_mmio_map() API forces the caller to map a sysbus
device to an address on the system bus (system bus here is
the root MemoryRegion returned by get_system_memory() ).

This is not practical when each core has its own address
space and group of cores have access to a part of the
peripherals.

Experimenting with the PFLASH devices. Here the fix is
quite easy: open-code the pflash_cfi_register() functions.

Since we were touching the PFLASH API, we restricted the
PFlashCFI0X structures to their models. The API now deals
with a generic qdev pointer (DeviceState*).

Please review,

Phil.

Based-on: <20230109115316.2235-1-philmd@linaro.org>
          "hw/arm: Cleanups before pflash refactor"
Based-on: <20230109120154.2868-1-philmd@linaro.org>
          "hw/misc: Cleanups around PFLASH use"

Philippe Mathieu-Daudé (21):
  hw/block: Rename TYPE_PFLASH_CFI02 'width' property as 'device-width'
  hw/block: Pass DeviceState to pflash_cfi01_get_blk()
  hw/block: Use pflash_cfi01_get_blk() in pflash_cfi01_legacy_drive()
  hw/block: Pass DeviceState to pflash_cfi01_get_memory()
  hw/arm: Use generic DeviceState instead of PFlashCFI01
  hw/loongarch: Use generic DeviceState instead of PFlashCFI01
  hw/riscv: Use generic DeviceState instead of PFlashCFI01
  hw/i386: Use generic DeviceState instead of PFlashCFI01
  hw/xtensa: Use generic DeviceState instead of PFlashCFI01
  hw/sh4: Open-code pflash_cfi02_register()
  hw/arm/digic: Open-code pflash_cfi02_register()
  hw/arm/musicpal: Open-code pflash_cfi02_register()
  hw/arm/xilinx_zynq: Open-code pflash_cfi02_register()
  hw/block: Remove unused pflash_cfi02_register()
  hw/block: Make PFlashCFI02 QOM declaration internal
  hw/arm: Open-code pflash_cfi01_register()
  hw/microblaze: Open-code pflash_cfi01_register()
  hw/mips: Open-code pflash_cfi01_register()
  hw/ppc: Open-code pflash_cfi01_register()
  hw/block: Remove unused pflash_cfi01_register()
  hw/block: Make PFlashCFI01 QOM declaration internal

 hw/arm/collie.c                          | 16 ++++++---
 hw/arm/digic_boards.c                    | 26 ++++++++++----
 hw/arm/gumstix.c                         | 32 +++++++++++++----
 hw/arm/mainstone.c                       | 19 +++++++---
 hw/arm/musicpal.c                        | 21 +++++++----
 hw/arm/omap_sx1.c                        | 31 +++++++++++-----
 hw/arm/sbsa-ref.c                        |  8 ++---
 hw/arm/versatilepb.c                     | 18 +++++++---
 hw/arm/vexpress.c                        | 10 +++---
 hw/arm/virt.c                            |  6 ++--
 hw/arm/xilinx_zynq.c                     | 20 ++++++++---
 hw/arm/z2.c                              | 17 +++++++--
 hw/block/pflash_cfi01.c                  | 45 ++++++------------------
 hw/block/pflash_cfi02.c                  | 40 ++-------------------
 hw/i386/pc_sysfw.c                       |  6 ++--
 hw/loongarch/virt.c                      |  9 +++--
 hw/microblaze/petalogix_ml605_mmu.c      | 18 ++++++----
 hw/microblaze/petalogix_s3adsp1800_mmu.c | 16 ++++++---
 hw/mips/malta.c                          | 18 ++++++----
 hw/ppc/e500.c                            |  2 +-
 hw/ppc/sam460ex.c                        | 19 +++++++---
 hw/ppc/virtex_ml507.c                    | 15 ++++++--
 hw/riscv/virt.c                          |  7 ++--
 hw/sh4/r2d.c                             | 21 ++++++++---
 hw/xtensa/xtfpga.c                       |  6 ++--
 include/hw/arm/virt.h                    |  3 +-
 include/hw/block/flash.h                 | 37 ++-----------------
 include/hw/i386/pc.h                     |  3 +-
 include/hw/loongarch/virt.h              |  3 +-
 include/hw/riscv/virt.h                  |  3 +-
 30 files changed, 276 insertions(+), 219 deletions(-)

Comments

Philippe Mathieu-Daudé Jan. 9, 2023, 12:13 p.m. UTC | #1
On 9/1/23 13:08, Philippe Mathieu-Daudé wrote:
> Since v1:
> - Do not introduce pflash_cfi_create(), directly
>    open-code pflash_cfi_register() before removing it (Peter)
> - Added R-b tags

Sigh, my sendemail.cccmd command didn't work, so Cc'ing manually the cover.

> Paving the road toward heterogeneous QEMU, the limitations of
> having a single machine sysbus become more apparent.
> 
> The sysbus_mmio_map() API forces the caller to map a sysbus
> device to an address on the system bus (system bus here is
> the root MemoryRegion returned by get_system_memory() ).
> 
> This is not practical when each core has its own address
> space and group of cores have access to a part of the
> peripherals.
> 
> Experimenting with the PFLASH devices. Here the fix is
> quite easy: open-code the pflash_cfi_register() functions.
> 
> Since we were touching the PFLASH API, we restricted the
> PFlashCFI0X structures to their models. The API now deals
> with a generic qdev pointer (DeviceState*).
> 
> Please review,
> 
> Phil.
> 
> Based-on: <20230109115316.2235-1-philmd@linaro.org>
>            "hw/arm: Cleanups before pflash refactor"
> Based-on: <20230109120154.2868-1-philmd@linaro.org>
>            "hw/misc: Cleanups around PFLASH use"
> 
> Philippe Mathieu-Daudé (21):
>    hw/block: Rename TYPE_PFLASH_CFI02 'width' property as 'device-width'
>    hw/block: Pass DeviceState to pflash_cfi01_get_blk()
>    hw/block: Use pflash_cfi01_get_blk() in pflash_cfi01_legacy_drive()
>    hw/block: Pass DeviceState to pflash_cfi01_get_memory()
>    hw/arm: Use generic DeviceState instead of PFlashCFI01
>    hw/loongarch: Use generic DeviceState instead of PFlashCFI01
>    hw/riscv: Use generic DeviceState instead of PFlashCFI01
>    hw/i386: Use generic DeviceState instead of PFlashCFI01
>    hw/xtensa: Use generic DeviceState instead of PFlashCFI01
>    hw/sh4: Open-code pflash_cfi02_register()
>    hw/arm/digic: Open-code pflash_cfi02_register()
>    hw/arm/musicpal: Open-code pflash_cfi02_register()
>    hw/arm/xilinx_zynq: Open-code pflash_cfi02_register()
>    hw/block: Remove unused pflash_cfi02_register()
>    hw/block: Make PFlashCFI02 QOM declaration internal
>    hw/arm: Open-code pflash_cfi01_register()
>    hw/microblaze: Open-code pflash_cfi01_register()
>    hw/mips: Open-code pflash_cfi01_register()
>    hw/ppc: Open-code pflash_cfi01_register()
>    hw/block: Remove unused pflash_cfi01_register()
>    hw/block: Make PFlashCFI01 QOM declaration internal