mbox series

[v5,00/27] little endian skiboot

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

Message

Nicholas Piggin Oct. 15, 2019, 3:06 a.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.

Notably missing from conversion:
- PHB3
- NPU and CAPI code
- Debug descriptor

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. For the
most part, big endian builds should be minimally impacted.

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.

Since v4:
- Converted several more pieces, ELF kernel loading (so LE skiboot can
  load BE kernel), HMI, IPMI, SBE, MPIPL, FSP, ECC, PRD, etc.
- Paid more attention to sparse warnings, folded in some fixes found
  by sparse, added some larger sparse cleanup patches.
- Sparse warnings have gone from 406 to 126 after this series, incorrect
  type warnings from 296 to 66, and those all come from PHB3 and one HB
  source file.

Thanks,
Nick

Nicholas Piggin (27):
  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
  elf: endian conversions
  spira: fix endian conversions in spira data structures
  hdata: endian conversions
  naca: move naca definition from asm to C
  io: endian conversions for io accessors
  hmi: endian conversions
  cvc: allow BE cvc code to be called from LE context
  xive: make endian-clean
  phb4: make endian-clean
  occ sensors: make endian-clean
  memconsole: make endian-clean
  ipmi: endian conversion
  sbe-p9: endian conversion
  fsp: endian conversions
  libflash: ecc endian conversions
  prd: endian conversions
  opal-dump: MPIPL endan conversions
  sfc-ctrl: endian conversions
  add little endian support
  dt: assorted cleanups
  Add more sparse endian annotations
  Fix simple sparse warnings

 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                            |  25 +-
 core/fdt.c                               |   6 +-
 core/flash.c                             |  36 ++-
 core/hmi.c                               |  20 +-
 core/init.c                              |  97 +++---
 core/interrupts.c                        |  15 +-
 core/ipmi-opal.c                         |   6 +-
 core/mem_region.c                        |   2 +-
 core/opal-dump.c                         |  80 ++---
 core/pci-opal.c                          |  98 ++++--
 core/pci.c                               |  40 +--
 core/platform.c                          |   2 +-
 core/powercap.c                          |  14 +-
 core/psr.c                               |  14 +-
 core/sensor.c                            |  60 ++--
 core/trace.c                             |   3 +-
 doc/stb.rst                              |   2 +-
 hdata/Makefile.inc                       |   2 +-
 hdata/fsp.c                              |   9 +-
 hdata/hdata.h                            |   2 +
 hdata/iohub.c                            |  21 +-
 hdata/memory.c                           |  18 +-
 hdata/naca.c                             |  26 ++
 hdata/naca.h                             |  54 ++++
 hdata/paca.c                             |  82 +----
 hdata/spira.c                            |  74 +++--
 hdata/spira.h                            |   2 +
 hdata/tpmrel.c                           |   2 +-
 hw/ast-bmc/ast-sf-ctrl.c                 |   5 +-
 hw/capp.c                                |   2 +-
 hw/fake-rtc.c                            |  11 +-
 hw/fsp/fsp-codeupdate.c                  |   4 +-
 hw/fsp/fsp-codeupdate.h                  |  86 ++---
 hw/fsp/fsp-console.c                     |  26 +-
 hw/fsp/fsp-dpo.c                         |   2 +-
 hw/fsp/fsp-rtc.c                         |  25 +-
 hw/fsp/fsp-sysdump.c                     |   2 +-
 hw/fsp/fsp-sysparam.c                    |   6 +-
 hw/fsp/fsp.c                             |  18 +-
 hw/imc.c                                 |  12 +-
 hw/ipmi/ipmi-rtc.c                       |  11 +-
 hw/ipmi/ipmi-sel.c                       |   2 +-
 hw/lpc-rtc.c                             |  11 +-
 hw/lpc-uart.c                            |  16 +-
 hw/lpc.c                                 |   6 +-
 hw/npu2-opencapi.c                       |  12 +-
 hw/occ-sensor.c                          | 100 +++---
 hw/occ.c                                 |  46 +--
 hw/phb4.c                                | 344 ++++++++++----------
 hw/prd.c                                 |  74 ++---
 hw/psi.c                                 |  10 +-
 hw/sbe-p9.c                              |   2 +-
 hw/sfc-ctrl.c                            |  19 +-
 hw/slw.c                                 |  10 +-
 hw/vas.c                                 |   8 +-
 hw/xive.c                                | 392 ++++++++++++-----------
 hw/xscom.c                               |  19 +-
 include/asm-utils.h                      |  22 +-
 include/console.h                        |  22 +-
 include/cpu.h                            |   3 +
 include/device.h                         |   4 +-
 include/elf.h                            | 235 ++++++++++----
 include/io.h                             |  79 ++++-
 include/ipmi.h                           |   2 +-
 include/mem-map.h                        |   2 +
 include/occ.h                            |  50 +--
 include/opal-api.h                       |  14 +-
 include/opal-internal.h                  |   4 +-
 include/phb4.h                           |   2 +-
 include/skiboot.h                        |   2 +-
 include/stack.h                          |   6 +
 include/types.h                          |   4 +
 include/xive.h                           |  52 +--
 libc/stdlib/labs.c                       |   2 +-
 libflash/ecc.c                           |  36 ++-
 libflash/ecc.h                           |   8 +-
 libflash/ipmi-hiomap.c                   |  20 +-
 libflash/mbox-flash.c                    |  28 +-
 libpore/p9_cpu_reg_restore_instruction.H |  23 +-
 libstb/cvc.c                             |  16 +-
 libstb/cvc.h                             |   2 +-
 libstb/secureboot.c                      |   2 +-
 platforms/astbmc/common.c                |   4 +-
 platforms/astbmc/p8dtu.c                 |   2 +-
 platforms/astbmc/p9dsu.c                 |   2 +-
 platforms/astbmc/vesnin.c                |   8 +-
 platforms/astbmc/witherspoon.c           |   6 +-
 platforms/ibm-fsp/common.c               |   4 +-
 platforms/ibm-fsp/hostservices.c         |  12 +-
 platforms/mambo/mambo.c                  |   9 +-
 skiboot.lds.S                            |   5 +
 97 files changed, 1753 insertions(+), 1316 deletions(-)
 create mode 100644 hdata/naca.c
 create mode 100644 hdata/naca.h