Subject: [RFC PATCH 0/6] VMAP_STACK support for book3s64

From: Andrew Donnellan <[email-masked]>
Date: Sat, 5 Nov 2022 04:27:31 +1100

This series begins implementing VMAP_STACK support for book3s64 platforms,
building on the existing 32-bit work that Christophe Leroy has done.

Right now, it doesn't boot on my POWER9 machine - I'm sending this as is because
I'm about to go on holidays for a couple of weeks, and I'll pick it up once I'm
back.

The primary issue is the amount of arch code that has to run in real mode for
some reason or another - this includes OPAL, the cpu idle driver, KVM, and a
few other bits and pieces.

Right now, VMAP_STACK is only enabled if KVM_BOOK3S_64_HV=n - I'm working on
patches for KVM support but they're not quite ready yet.

If anyone has better suggestions for the extremely ugly approach to fixing
OPAL calls, suggest away!

Andrew Donnellan (6):
  powerpc/64s: Fix assembly to support larger values of THREAD_SIZE
  powerpc/64s: Helpers to switch between linear and vmapped stack
    pointers
  powerpc/powernv: Keep MSR in register across OPAL entry/return path
  powerpc/powernv: Convert pointers to physical addresses in OPAL call
    args
  powerpc/powernv/idle: Convert stack pointer to physical address
  powerpc/64s: Enable CONFIG_VMAP_STACK

 arch/powerpc/include/asm/asm-compat.h         |  2 +
 arch/powerpc/include/asm/book3s/64/stack.h    | 71 +++++++++++++++++++
 arch/powerpc/include/asm/opal.h               |  1 +
 arch/powerpc/include/asm/paca.h               |  4 ++
 arch/powerpc/include/asm/processor.h          |  6 ++
 arch/powerpc/kernel/asm-offsets.c             |  8 +++
 arch/powerpc/kernel/entry_64.S                | 11 ++-
 arch/powerpc/kernel/irq.c                     |  8 ++-
 arch/powerpc/kernel/misc_64.S                 |  4 +-
 arch/powerpc/kernel/process.c                 |  8 +++
 arch/powerpc/kernel/smp.c                     |  7 ++
 arch/powerpc/kvm/book3s_hv_builtin.c          |  2 +-
 arch/powerpc/kvm/book3s_hv_rmhandlers.S       |  3 +-
 arch/powerpc/mm/book3s64/slb.c                | 11 ++-
 arch/powerpc/platforms/Kconfig.cputype        |  1 +
 arch/powerpc/platforms/powernv/eeh-powernv.c  | 20 +++---
 arch/powerpc/platforms/powernv/idle.c         | 47 +++++++++++-
 arch/powerpc/platforms/powernv/ocxl.c         |  3 +-
 arch/powerpc/platforms/powernv/opal-core.c    |  4 +-
 arch/powerpc/platforms/powernv/opal-dump.c    |  6 +-
 arch/powerpc/platforms/powernv/opal-elog.c    | 10 +--
 arch/powerpc/platforms/powernv/opal-fadump.c  | 12 ++--
 arch/powerpc/platforms/powernv/opal-flash.c   |  5 +-
 arch/powerpc/platforms/powernv/opal-hmi.c     |  3 +-
 arch/powerpc/platforms/powernv/opal-irqchip.c |  4 +-
 arch/powerpc/platforms/powernv/opal-lpc.c     |  8 +--
 arch/powerpc/platforms/powernv/opal-nvram.c   |  4 +-
 arch/powerpc/platforms/powernv/opal-power.c   |  4 +-
 .../powerpc/platforms/powernv/opal-powercap.c |  2 +-
 arch/powerpc/platforms/powernv/opal-prd.c     |  6 +-
 arch/powerpc/platforms/powernv/opal-psr.c     |  2 +-
 arch/powerpc/platforms/powernv/opal-rtc.c     |  2 +-
 arch/powerpc/platforms/powernv/opal-secvar.c  |  9 ++-
 arch/powerpc/platforms/powernv/opal-sensor.c  |  4 +-
 .../powerpc/platforms/powernv/opal-sysparam.c |  4 +-
 .../powerpc/platforms/powernv/opal-wrappers.S | 43 ++++++-----
 arch/powerpc/platforms/powernv/opal-xscom.c   |  2 +-
 arch/powerpc/platforms/powernv/opal.c         | 16 ++---
 arch/powerpc/platforms/powernv/pci-ioda.c     | 14 ++--
 arch/powerpc/platforms/powernv/pci.c          | 25 ++++---
 arch/powerpc/platforms/powernv/setup.c        |  2 +-
 arch/powerpc/platforms/powernv/smp.c          |  2 +-
 arch/powerpc/sysdev/xics/icp-opal.c           |  2 +-
 arch/powerpc/sysdev/xics/ics-opal.c           |  8 +--
 arch/powerpc/sysdev/xive/native.c             | 33 +++++----
 arch/powerpc/xmon/xmon.c                      |  4 ++
 drivers/char/ipmi/ipmi_powernv.c              |  6 +-
 drivers/char/powernv-op-panel.c               |  2 +-
 drivers/i2c/busses/i2c-opal.c                 |  2 +-
 drivers/leds/leds-powernv.c                   |  6 +-
 drivers/mtd/devices/powernv_flash.c           |  4 +-
 drivers/rtc/rtc-opal.c                        |  4 +-
 52 files changed, 347 insertions(+), 134 deletions(-)
 create mode 100644 arch/powerpc/include/asm/book3s/64/stack.h

-- 
2.38.1