Skip to contentSkip to conversation

powerpc/pseries: Kexec style boot

RFC PATCH New Alexey Kardashevskiy 1 participant 3 messages Jul 20, 2019 PowerPC

lore
Share & tools
lore
#0 lore raw

cover powerpc/pseries: Kexec style boot

There is a funny excercise to run a guest under QEMU without the SLOF firmware and boot into a kernel directly to use petitboot as a boot loader (a more power boot loader than grub and yum), the patchset is posted as "spapr: Kexec style boot".

Since there is no SLOF, i.e. no client interface and no RTAS blob, we need to avoid the former and call the latter directly. Also, this implements "client-architecture-support" substiitute for the new environment.

This is based on sha1
a2b6f26c264e Christophe Leroy "powerpc/module64: Use symbolic instructions names.".

Please comment. Thanks.

Alexey Kardashevskiy (2):
powerpc/pseries: Call RTAS directly
powerpc/pseries: Kexec style ibm,client-architecture-support support

 arch/powerpc/include/asm/rtas.h |  1 +
 arch/powerpc/kernel/prom_init.c | 12 ++++++---
 arch/powerpc/kernel/rtas.c      | 47 +++++++++++++++------------------
 arch/powerpc/kernel/setup_64.c  | 41 ++++++++++++++++++++++++++++
 4 files changed, 71 insertions(+), 30 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

RFC PATCH 1/2 powerpc/pseries: Call RTAS directly

The pseries guests call RTAS via a RTAS entry point which is a firmware image under powernv and simple HCALL wrapper under QEMU. For the latter, we can skip the binary image and do HCALL directly, eliminating the need in the RTAS blob entirely.

This checks the DT whether the new method is supported and use it if it is. This removes few checks as QEMU might decide not to keen RTAS around at all (might be the case for secure VMs).

Note that kexec still checks for the linux,rtas-xxx properties which has to be fixed.

---
 arch/powerpc/include/asm/rtas.h |  1 +
 arch/powerpc/kernel/rtas.c      | 47 +++++++++++++++------------------
 2 files changed, 22 insertions(+), 26 deletions(-)
arch/powerpc/include/asm/rtas.h +1 -0
index 3c1887351c71..60cd528806c1 100644
@@ -59,6 +59,7 @@ struct rtas_t {
 	arch_spinlock_t lock;
 	struct rtas_args args;
 	struct device_node *dev;	/* virtual address pointer */
+	bool hcall;
 };
 
 struct rtas_suspend_me_data {
arch/powerpc/kernel/rtas.c +21 -26

131 lines not on this page · raw message

Signature · 1 line
2.17.1
#2 lore raw

RFC PATCH 2/2 powerpc/pseries: Kexec style ibm,client-architecture-support support

In reply to Alexey Kardashevskiy

This checks the FDT for "/chosen/qemu,h_cas" and calls H_CAS when present. The H_CAS hcall is implemented in QEMU for ages and currently returns an FDT with a diff to the initial FDT which SLOF updates and returns to the OS. For this patch to work, QEMU needs to provide the full tree instead, so when QEMU is run with the "-machine pseries,bios=no", it reads the existing FDT from the OS, updats it and writes back on top.

This changes prom_check_platform_support() not to call the client interface's prom_getproplen() as the kexec-style boot does not provide the client interface services.

---
 arch/powerpc/kernel/prom_init.c | 12 ++++++----
 arch/powerpc/kernel/setup_64.c  | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 4 deletions(-)
arch/powerpc/kernel/prom_init.c +8 -4
index 514707ef6779..6d8e35cb3c57 100644
@@ -1261,7 +1261,7 @@ static void __init prom_parse_platform_support(u8 index, u8 val,
 	}
 }
 
-static void __init prom_check_platform_support(void)
+struct ibm_arch_vec __init *prom_check_platform_support(int prop_len)
 {
 	struct platform_support supported = {
 		.hash_mmu = false,
@@ -1269,8 +1269,6 @@ static void __init prom_check_platform_support(void)
 		.radix_gtse = false,
 		.xive = false
 	};
-	int prop_len = prom_getproplen(prom.chosen,
-				       "ibm,arch-vec-5-platform-support");
 
 	/*
 	 * First copy the architecture vec template
@@ -1319,7 +1317,12 @@ static void __init prom_check_platform_support(void)
 		prom_debug("Asking for XIVE\n");
 		ibm_architecture_vec.vec5.intarch = OV5_FEAT(OV5_XIVE_EXPLOIT);
 	}
+
+	ibm_architecture_vec.vec5.max_cpus = cpu_to_be32(NR_CPUS);
+
+	return &ibm_architecture_vec;
 }
+EXPORT_SYMBOL_GPL(prom_check_platform_support);
 
 static void __init prom_send_capabilities(void)
 {
@@ -1328,7 +1331,8 @@ static void __init prom_send_capabilities(void)
 	u32 cores;
 
 	/* Check ibm,arch-vec-5-platform-support and fixup vec5 if required */
-	prom_check_platform_support();
+	prom_check_platform_support(prom_getproplen(prom.chosen,
+				"ibm,arch-vec-5-platform-support"));
 
 	root = call_prom("open", 1, 1, ADDR("/"));
 	if (root != 0) {
arch/powerpc/kernel/setup_64.c +41 -0

53 lines not on this page · raw message

Signature · 1 line
2.17.1