mbox series

[0/2] target/arm: armv7m_load_kernel() improvements

Message ID 20220823160417.3858216-1-peter.maydell@linaro.org
Headers show
Series target/arm: armv7m_load_kernel() improvements | expand

Message

Peter Maydell Aug. 23, 2022, 4:04 p.m. UTC
Two small patches to armv7m_load_kernel().  The first is just getting
rid of some dead code, that I noticed while working on the function. 
The second is to make boards pass armv7m_load_kernel() the base
address for loading guest (non-ELF) binaries.  At the moment we
assume all M-profile boards start at address 0; this happens to be
true for all the ones we implement right now, but it's not true in
general.  In particular the Teeny board has its ROM at 0x0020_0000.

I thought about having armv7m_load_kernel() be "clever" and ask the
CPU what init-svtor/init-nsvtor were set to, but that seems like it
might have unanticipated consequences[*].  "Just pass the base address"
is simpler and is how A-profile does it (though for A-profile it's
the loader_start field in struct arm_boot_info rather than an extra
argument).

[*] eg where the board has the rom/flash aliased at both address
0 and some other address, and init-svtor points at an alias;
also Secure vs NonSecure address spaces and loading...

thanks
-- PMM

Peter Maydell (2):
  target/arm: Remove useless TARGET_BIG_ENDIAN check in
    armv7m_load_kernel()
  target/arm: Make boards pass base address to armv7m_load_kernel()

 include/hw/arm/boot.h     |  5 ++++-
 hw/arm/armv7m.c           | 14 ++++----------
 hw/arm/aspeed.c           |  1 +
 hw/arm/microbit.c         |  2 +-
 hw/arm/mps2-tz.c          |  2 +-
 hw/arm/mps2.c             |  2 +-
 hw/arm/msf2-som.c         |  2 +-
 hw/arm/musca.c            |  3 ++-
 hw/arm/netduino2.c        |  2 +-
 hw/arm/netduinoplus2.c    |  2 +-
 hw/arm/stellaris.c        |  2 +-
 hw/arm/stm32vldiscovery.c |  2 +-
 12 files changed, 19 insertions(+), 20 deletions(-)

Comments

Richard Henderson Aug. 23, 2022, 9:56 p.m. UTC | #1
On 8/23/22 09:04, Peter Maydell wrote:
> Two small patches to armv7m_load_kernel().  The first is just getting
> rid of some dead code, that I noticed while working on the function.
> The second is to make boards pass armv7m_load_kernel() the base
> address for loading guest (non-ELF) binaries.  At the moment we
> assume all M-profile boards start at address 0; this happens to be
> true for all the ones we implement right now, but it's not true in
> general.  In particular the Teeny board has its ROM at 0x0020_0000.
> 
> I thought about having armv7m_load_kernel() be "clever" and ask the
> CPU what init-svtor/init-nsvtor were set to, but that seems like it
> might have unanticipated consequences[*].  "Just pass the base address"
> is simpler and is how A-profile does it (though for A-profile it's
> the loader_start field in struct arm_boot_info rather than an extra
> argument).
> 
> [*] eg where the board has the rom/flash aliased at both address
> 0 and some other address, and init-svtor points at an alias;
> also Secure vs NonSecure address spaces and loading...

Thanks, queued to target-arm.next.


r~