Re: [kvm-unit-tests v2 09/10] powerpc: Support powernv machine with QEMU TCG

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20/03/2023 08.03, Nicholas Piggin wrote:
This is a basic first pass at powernv support using OPAL (skiboot)
firmware.

The ACCEL is a bit clunky, now defaulting to tcg for powernv machine.
It also does not yet run in the run_tests.sh batch process, more work
is needed to exclude certain tests (e.g., rtas) and adjust parameters
(e.g., increase memory size) to allow powernv to work. For now it
can run single test cases.

Signed-off-by: Nicholas Piggin <npiggin@xxxxxxxxx>
---
  lib/powerpc/asm/ppc_asm.h   |  5 +++
  lib/powerpc/asm/processor.h | 14 ++++++++
  lib/powerpc/hcall.c         |  4 +--
  lib/powerpc/io.c            | 33 ++++++++++++++++--
  lib/powerpc/io.h            |  6 ++++
  lib/powerpc/processor.c     | 10 ++++++
  lib/powerpc/setup.c         | 10 ++++--
  lib/ppc64/asm/opal.h        | 11 ++++++
  lib/ppc64/opal-calls.S      | 46 +++++++++++++++++++++++++
  lib/ppc64/opal.c            | 67 +++++++++++++++++++++++++++++++++++++
  powerpc/Makefile.ppc64      |  2 ++
  powerpc/cstart64.S          |  7 ++++
  powerpc/run                 | 30 ++++++++++++++---
  13 files changed, 234 insertions(+), 11 deletions(-)
  create mode 100644 lib/ppc64/asm/opal.h
  create mode 100644 lib/ppc64/opal-calls.S
  create mode 100644 lib/ppc64/opal.c

diff --git a/lib/powerpc/asm/ppc_asm.h b/lib/powerpc/asm/ppc_asm.h
index 6299ff5..5eec9d3 100644
--- a/lib/powerpc/asm/ppc_asm.h
+++ b/lib/powerpc/asm/ppc_asm.h
@@ -36,7 +36,12 @@
  #endif /* __BYTE_ORDER__ */
/* Machine State Register definitions: */
+#define MSR_LE_BIT	0
  #define MSR_EE_BIT	15			/* External Interrupts Enable */
+#define MSR_HV_BIT	60			/* Hypervisor mode */
  #define MSR_SF_BIT	63			/* 64-bit mode */
+#define SPR_HSRR0 0x13A
+#define SPR_HSRR1	0x13B
+
  #endif /* _ASMPOWERPC_PPC_ASM_H */
diff --git a/lib/powerpc/asm/processor.h b/lib/powerpc/asm/processor.h
index ebfeff2..8084787 100644
--- a/lib/powerpc/asm/processor.h
+++ b/lib/powerpc/asm/processor.h
@@ -3,12 +3,26 @@
#include <libcflat.h>
  #include <asm/ptrace.h>
+#include <asm/ppc_asm.h>
#ifndef __ASSEMBLY__
  void handle_exception(int trap, void (*func)(struct pt_regs *, void *), void *);
  void do_handle_exception(struct pt_regs *regs);
  #endif /* __ASSEMBLY__ */
+/*
+ * If this returns true on PowerNV / OPAL machines which run in hypervisor
+ * mode. False on pseries / PAPR machines that run in guest mode.

s/If this/This/

 Thomas




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux