mbox series

[v4,00/15] little endian skiboot

Message ID 20191009234951.2850-1-npiggin@gmail.com
Headers show
Series little endian skiboot | expand

Message

Nicholas Piggin Oct. 9, 2019, 11:49 p.m. UTC
A few reasons for this:
- The rest of the software is moving (moved) to LE. BE is still
  supported, but the fact is LE will be better tested from now on in
  terms of toolchain.
- ELFv2 ABI is a smaller image, nicer asm code. We can use ELFv2 with BE
  but toolchain won't officially support or test it.
- Some levels of OpenPOWER ISA allow a conforming implementation to
  implement LE only.
- Less stack usage of ELFv2 facilitates OPAL call convention that uses
  the host kernel stack (which is a whole different story but has
  benefits).
- Common endian with the host kernel can help with debugging skiboot
  with host kernel facilities (like BUG, xmon). We could achieve the
  same by teaching kernel about different endianness, but it's more work.

Mostly missing from conversion:
- PHB3
- NPU and CAPI code

XICS, XICS-on-XIVE, KVM, VAS, and niche features have not been tested
yet, but at this point it's complete enough that it's easy to work on
and improve so I think it is ready for proper submission now.

Since v1:
- Addressed review comments
- Added a missed endian conversion in hw/fsp/fsp.c
- Added a patch on the end to tidy up dt access
- xive patch is not for merge, (pending Cedric's stuff) but included
  so the series can boot on real hardware.

Since v2:
- Remove a few bits of dead POWER7 code

Since v3:
- Several fixes to cvc code, including a stack trashing bug that would
  sometimes result in skiboots that failed container verification,
  depending on where the compiler put things.

Nicholas Piggin (15):
  asm/cvc_entry.S: r2 save fix
  Remove dead POWER7 code
  capp: fix endian conversion
  cpu: use dt accessor device tree access
  opal-api: add endian conversions to most opal calls
  spira: fix endian conversions in spira data structures
  fixup_spira remove incorrect endian conversion
  naca: move naca definition from asm to C
  io: endian conversions for io accessors
  xive: make endian-clean
  phb4: make endian-clean
  occ sensors: make endian-clean
  memconsole: make endian-clean
  add little endian support
  dt: assorted cleanups

 Makefile.main                            |  38 ++-
 asm/asm-offsets.c                        |   2 -
 asm/cvc_entry.S                          |  51 ++-
 asm/head.S                               | 126 +++-----
 core/console.c                           |  41 ++-
 core/cpu.c                               |  26 +-
 core/device.c                            |   8 +
 core/fdt.c                               |   4 +-
 core/init.c                              |   1 +
 core/interrupts.c                        |  12 +-
 core/ipmi-opal.c                         |   6 +-
 core/pci-opal.c                          |  98 ++++--
 core/pci.c                               |  36 +--
 core/powercap.c                          |  14 +-
 core/psr.c                               |  14 +-
 core/sensor.c                            |  36 ++-
 doc/stb.rst                              |   2 +-
 hdata/Makefile.inc                       |   2 +-
 hdata/fsp.c                              |   7 +-
 hdata/hdata.h                            |   2 +
 hdata/iohub.c                            |  21 +-
 hdata/memory.c                           |  10 +-
 hdata/naca.c                             |  26 ++
 hdata/naca.h                             |  54 ++++
 hdata/paca.c                             |  82 +----
 hdata/spira.c                            |  68 ++--
 hdata/spira.h                            |   2 +
 hw/capp.c                                |   2 +-
 hw/fake-rtc.c                            |  11 +-
 hw/fsp/fsp-console.c                     |  26 +-
 hw/fsp/fsp-rtc.c                         |  26 +-
 hw/fsp/fsp-sysparam.c                    |   4 +-
 hw/fsp/fsp.c                             |   2 +-
 hw/imc.c                                 |   4 +-
 hw/ipmi/ipmi-rtc.c                       |  12 +-
 hw/lpc-rtc.c                             |  12 +-
 hw/lpc-uart.c                            |  16 +-
 hw/lpc.c                                 |   6 +-
 hw/npu2-opencapi.c                       |  12 +-
 hw/occ-sensor.c                          | 100 +++---
 hw/occ.c                                 |  24 +-
 hw/phb4.c                                | 323 +++++++++----------
 hw/psi.c                                 |   8 +-
 hw/vas.c                                 |   9 +-
 hw/xive.c                                | 386 ++++++++++++-----------
 hw/xscom.c                               |  19 +-
 include/asm-utils.h                      |  22 +-
 include/console.h                        |  22 +-
 include/cpu.h                            |   3 +
 include/device.h                         |   1 +
 include/elf.h                            |   4 +
 include/io.h                             |  72 ++++-
 include/mem-map.h                        |   2 +
 include/occ.h                            |  50 +--
 include/phb4.h                           |   2 +-
 include/stack.h                          |   6 +
 include/xive.h                           |  50 +--
 libflash/ipmi-hiomap.c                   |  18 +-
 libflash/mbox-flash.c                    |  18 +-
 libpore/p9_cpu_reg_restore_instruction.H |  23 +-
 libstb/cvc.c                             |  16 +-
 libstb/cvc.h                             |   2 +-
 platforms/ibm-fsp/common.c               |   4 +-
 platforms/ibm-fsp/hostservices.c         |  12 +-
 platforms/mambo/mambo.c                  |   7 +-
 skiboot.lds.S                            |   5 +
 66 files changed, 1217 insertions(+), 913 deletions(-)
 create mode 100644 hdata/naca.c
 create mode 100644 hdata/naca.h

Comments

Stewart Smith Oct. 10, 2019, 3:19 p.m. UTC | #1
On Wed, Oct 9, 2019, at 4:49 PM, Nicholas Piggin wrote:
> A few reasons for this:
> - The rest of the software is moving (moved) to LE. BE is still
>   supported, but the fact is LE will be better tested from now on in
>   terms of toolchain.

That alone is a pretty solid reason. I wonder how on top of this other firmware components are? Hostboot could probably save a *lot* of boot time and thrashing if it switched.
 
> XICS, XICS-on-XIVE, KVM, VAS, and niche features have not been tested
> yet, but at this point it's complete enough that it's easy to work on
> and improve so I think it is ready for proper submission now.

i.e. all the things there's no op-test test for? :)

> Since v3:
> - Several fixes to cvc code, including a stack trashing bug that would
>   sometimes result in skiboots that failed container verification,
>   depending on where the compiler put things.

that looks like it would have been a fun one to find
Nicholas Piggin Oct. 12, 2019, 10:22 p.m. UTC | #2
Stewart Smith's on October 11, 2019 1:19 am:
> On Wed, Oct 9, 2019, at 4:49 PM, Nicholas Piggin wrote:
>> A few reasons for this:
>> - The rest of the software is moving (moved) to LE. BE is still
>>   supported, but the fact is LE will be better tested from now on in
>>   terms of toolchain.
> 
> That alone is a pretty solid reason. I wonder how on top of this other firmware components are? Hostboot could probably save a *lot* of boot time and thrashing if it switched.

Good question, I don't know I'm still pretty hostbootphobic.

The image size shrinks pretty significantly too. Less problem for
skiboot because compressed doesn't change much, but if HB is memory
constrained early on this might help.

   text	   data	    bss	    dec	    hex	filename
1471553	 273880	  48424	1793857	 1b5f41	skiboot.elf
1283853	 199328	  48424	1531605	 175ed5	skiboot.elf.le

>  
>> XICS, XICS-on-XIVE, KVM, VAS, and niche features have not been tested
>> yet, but at this point it's complete enough that it's easy to work on
>> and improve so I think it is ready for proper submission now.
> 
> i.e. all the things there's no op-test test for? :)

Yeah, well it was more just get just one real system to boot, then
hope other people can pick up the rest of the pieces :)

> 
>> Since v3:
>> - Several fixes to cvc code, including a stack trashing bug that would
>>   sometimes result in skiboots that failed container verification,
>>   depending on where the compiler put things.
> 
> that looks like it would have been a fun one to find

Well at least it wasn't checkstopping, so not _quite_ so fun as the
r13 clobber in this code you found with the virtual memory patches!

Thanks,
Nick