mbox series

[v3,0/9] ppc/e500: Add support for two types of flash, cleanup

Message ID 20221016122737.93755-1-shentey@gmail.com (mailing list archive)
Headers show
Series ppc/e500: Add support for two types of flash, cleanup | expand

Message

Bernhard Beschow Oct. 16, 2022, 12:27 p.m. UTC
Cover letter:
~~~~~~~~~~~~~

This series adds support for -pflash and direct SD card access to the
PPC e500 boards. The idea is to increase compatibility with "real" firmware
images where only the bare minimum of drivers is compiled in.

The series is structured as follows:

Patches 1-6 perform some general cleanup which paves the way for the rest of
the series.

Patch 7 adds -pflash handling where memory-mapped flash can be added on
user's behalf. That is, the flash memory region in the eLBC is only added if
the -pflash argument is supplied. Note that the cfi01 device model becomes
stricter in checking the size of the emulated flash space.

Patches 8 and 9 add a new device model - the Freescale eSDHC - to the e500
boards which was missing so far.

User documentation is also added as the new features become available.

Tesing done:
* `qemu-system-ppc -M ppce500 -cpu e500mc -m 256 -kernel uImage -append
"console=ttyS0 rootwait root=/dev/mtdblock0 nokaslr" -drive
if=pflash,file=rootfs.ext2,format=raw`
* `qemu-system-ppc -M ppce500 -cpu e500mc -m 256 -kernel uImage -append
"console=ttyS0 rootwait root=/dev/mmcblk0" -device sd-card,drive=mydrive -drive
id=mydrive,if=none,file=rootfs.ext2,format=raw`

The load was created using latest Buildroot with `make
qemu_ppc_e500mc_defconfig` where the rootfs was configured to be of ext2 type.
In both cases it was possible to log in and explore the root file system.

v3:
~~~
Phil:
- Also add power-of-2 fix to pflash_cfi02
- Resolve cfi01-specific assertion in e500 code
- Resolve unused define in eSDHC device model
- Resolve redundant alignment checks in eSDHC device model

Bin:
- Add dedicated flash chapter to documentation

Bernhard:
- Use is_power_of_2() instead of ctpop64() for better readability
- Only instantiate eSDHC device model in ppce500 (not used in MPC8544DS)
- Rebase onto gitlab.com/danielhb/qemu/tree/ppc-next

v2:
~~~
Bin:
- Add source for MPC8544DS platform bus' memory map in commit message.
- Keep "ESDHC" in comment referring to Linux driver.
- Use "qemu-system-ppc{64|32} in documentation.
- Use g_autofree in device tree code.
- Remove unneeded device tree properties.
- Error out if pflash size doesn't fit into eLBC memory window.
- Remove unused ESDHC defines.
- Define macro ESDHC_WML for register offset with magic constant.
- Fix some whitespace issues when adding eSDHC device to e500.

Phil:
- Fix tense in commit message.

Bernhard Beschow (9):
  hw/block/pflash_cfi0{1,2}: Error out if device length isn't a power of
    two
  hw/{arm,ppc}: Resolve unreachable code
  hw/block/pflash_cfi01: Attach memory region in boards
  hw/block/pflash_cfi02: Attach memory region in boards
  hw/sd/sdhci-internal: Unexport ESDHC defines
  hw/sd/sdhci: Rename ESDHC_* defines to USDHC_*
  hw/ppc/e500: Implement pflash handling
  hw/sd/sdhci: Implement Freescale eSDHC device model
  hw/ppc/e500: Add Freescale eSDHC to e500plat

 docs/system/ppc/ppce500.rst              |  28 ++++
 hw/arm/collie.c                          |  20 ++-
 hw/arm/digic_boards.c                    |  16 +-
 hw/arm/gumstix.c                         |  24 +--
 hw/arm/mainstone.c                       |  15 +-
 hw/arm/musicpal.c                        |  15 +-
 hw/arm/omap_sx1.c                        |  25 ++--
 hw/arm/versatilepb.c                     |  14 +-
 hw/arm/xilinx_zynq.c                     |  12 +-
 hw/arm/z2.c                              |  12 +-
 hw/block/pflash_cfi01.c                  |  12 +-
 hw/block/pflash_cfi02.c                  |  14 +-
 hw/microblaze/petalogix_ml605_mmu.c      |  16 +-
 hw/microblaze/petalogix_s3adsp1800_mmu.c |  10 +-
 hw/mips/malta.c                          |   4 +-
 hw/ppc/Kconfig                           |   2 +
 hw/ppc/e500.c                            |  97 +++++++++++-
 hw/ppc/e500.h                            |   1 +
 hw/ppc/e500plat.c                        |   1 +
 hw/ppc/sam460ex.c                        |  19 ++-
 hw/ppc/virtex_ml507.c                    |   5 +-
 hw/sd/sdhci-internal.h                   |  20 ---
 hw/sd/sdhci.c                            | 183 ++++++++++++++++++++---
 hw/sh4/r2d.c                             |  11 +-
 include/hw/block/flash.h                 |   7 +-
 include/hw/sd/sdhci.h                    |   3 +
 26 files changed, 433 insertions(+), 153 deletions(-)

Comments

Bernhard Beschow Oct. 16, 2022, 12:41 p.m. UTC | #1
Am 16. Oktober 2022 12:27:28 UTC schrieb Bernhard Beschow <shentey@gmail.com>:
>Cover letter:
>
>~~~~~~~~~~~~~
>
>
>
>This series adds support for -pflash and direct SD card access to the
>
>PPC e500 boards. The idea is to increase compatibility with "real" firmware
>
>images where only the bare minimum of drivers is compiled in.
>
>
>
>The series is structured as follows:
>
>
>
>Patches 1-6 perform some general cleanup which paves the way for the rest of
>
>the series.
>
>
>
>Patch 7 adds -pflash handling where memory-mapped flash can be added on
>
>user's behalf. That is, the flash memory region in the eLBC is only added if
>
>the -pflash argument is supplied. Note that the cfi01 device model becomes
>
>stricter in checking the size of the emulated flash space.
>
>
>
>Patches 8 and 9 add a new device model - the Freescale eSDHC - to the e500
>
>boards which was missing so far.
>
>
>
>User documentation is also added as the new features become available.
>
>
>
>Tesing done:
>
>* `qemu-system-ppc -M ppce500 -cpu e500mc -m 256 -kernel uImage -append
>
>"console=ttyS0 rootwait root=/dev/mtdblock0 nokaslr" -drive
>
>if=pflash,file=rootfs.ext2,format=raw`
>
>* `qemu-system-ppc -M ppce500 -cpu e500mc -m 256 -kernel uImage -append
>
>"console=ttyS0 rootwait root=/dev/mmcblk0" -device sd-card,drive=mydrive -drive
>
>id=mydrive,if=none,file=rootfs.ext2,format=raw`
>
>
>
>The load was created using latest Buildroot with `make
>
>qemu_ppc_e500mc_defconfig` where the rootfs was configured to be of ext2 type.
>
>In both cases it was possible to log in and explore the root file system.
>
>
>
>v3:
>
>~~~
>
>Phil:
>
>- Also add power-of-2 fix to pflash_cfi02
>
>- Resolve cfi01-specific assertion in e500 code
>
>- Resolve unused define in eSDHC device model
>
>- Resolve redundant alignment checks in eSDHC device model
>
>
>
>Bin:
>
>- Add dedicated flash chapter to documentation
>
>
>
>Bernhard:
>
>- Use is_power_of_2() instead of ctpop64() for better readability
>
>- Only instantiate eSDHC device model in ppce500 (not used in MPC8544DS)
>
>- Rebase onto gitlab.com/danielhb/qemu/tree/ppc-next
- Move cfi0x memory region setup into board code to avoid cfi01-specific assertion there
- While at it, resolve unreachable code related to cfi01 device creation
- Reorder patches such that trivial patches come first

Best regards,
Bernhard

>
>
>
>v2:
>
>~~~
>
>Bin:
>
>- Add source for MPC8544DS platform bus' memory map in commit message.
>
>- Keep "ESDHC" in comment referring to Linux driver.
>
>- Use "qemu-system-ppc{64|32} in documentation.
>
>- Use g_autofree in device tree code.
>
>- Remove unneeded device tree properties.
>
>- Error out if pflash size doesn't fit into eLBC memory window.
>
>- Remove unused ESDHC defines.
>
>- Define macro ESDHC_WML for register offset with magic constant.
>
>- Fix some whitespace issues when adding eSDHC device to e500.
>
>
>
>Phil:
>
>- Fix tense in commit message.
>
>
>
>Bernhard Beschow (9):
>
>  hw/block/pflash_cfi0{1,2}: Error out if device length isn't a power of
>
>    two
>
>  hw/{arm,ppc}: Resolve unreachable code
>
>  hw/block/pflash_cfi01: Attach memory region in boards
>
>  hw/block/pflash_cfi02: Attach memory region in boards
>
>  hw/sd/sdhci-internal: Unexport ESDHC defines
>
>  hw/sd/sdhci: Rename ESDHC_* defines to USDHC_*
>
>  hw/ppc/e500: Implement pflash handling
>
>  hw/sd/sdhci: Implement Freescale eSDHC device model
>
>  hw/ppc/e500: Add Freescale eSDHC to e500plat
>
>
>
> docs/system/ppc/ppce500.rst              |  28 ++++
>
> hw/arm/collie.c                          |  20 ++-
>
> hw/arm/digic_boards.c                    |  16 +-
>
> hw/arm/gumstix.c                         |  24 +--
>
> hw/arm/mainstone.c                       |  15 +-
>
> hw/arm/musicpal.c                        |  15 +-
>
> hw/arm/omap_sx1.c                        |  25 ++--
>
> hw/arm/versatilepb.c                     |  14 +-
>
> hw/arm/xilinx_zynq.c                     |  12 +-
>
> hw/arm/z2.c                              |  12 +-
>
> hw/block/pflash_cfi01.c                  |  12 +-
>
> hw/block/pflash_cfi02.c                  |  14 +-
>
> hw/microblaze/petalogix_ml605_mmu.c      |  16 +-
>
> hw/microblaze/petalogix_s3adsp1800_mmu.c |  10 +-
>
> hw/mips/malta.c                          |   4 +-
>
> hw/ppc/Kconfig                           |   2 +
>
> hw/ppc/e500.c                            |  97 +++++++++++-
>
> hw/ppc/e500.h                            |   1 +
>
> hw/ppc/e500plat.c                        |   1 +
>
> hw/ppc/sam460ex.c                        |  19 ++-
>
> hw/ppc/virtex_ml507.c                    |   5 +-
>
> hw/sd/sdhci-internal.h                   |  20 ---
>
> hw/sd/sdhci.c                            | 183 ++++++++++++++++++++---
>
> hw/sh4/r2d.c                             |  11 +-
>
> include/hw/block/flash.h                 |   7 +-
>
> include/hw/sd/sdhci.h                    |   3 +
>
> 26 files changed, 433 insertions(+), 153 deletions(-)
>
>
>
>-- >
>2.38.0
>
>
>