Skip to contentSkip to conversation

Add private HCALL to inform updated RTAS base and entry

PATCH Applied Aravinda Prasad 2 participants 2 messages Aug 25, 2014 – Aug 27, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add private HCALL to inform updated RTAS base and entry

This patch adds a private HCALL to inform qemu the updated rtas-base and rtas-entry address when OS invokes the call "instantiate-rtas". This is required as qemu allocates the error reporting structure in RTAS space upon a machine check exception and hence needs to know the updated RTAS.

Enhancements to qemu to handle the private HCALL, prepare error log and invoke machine check notification routine are in a separate patch.

---
 board-qemu/slof/rtas.fs   |    6 +++++-
 lib/libhvcall/hvcall.code |    6 ++++++
 lib/libhvcall/hvcall.in   |    1 +
 lib/libhvcall/libhvcall.h |    4 +++-
 4 files changed, 15 insertions(+), 2 deletions(-)
board-qemu/slof/rtas.fs +5 -1
index 41e30c2..c081b57 100644
@@ -174,7 +174,11 @@ rtas-node set-node
 
 : instantiate-rtas ( adr -- entry )
     dup rtas-base swap rtas-size move
-    rtas-entry rtas-base - +
+    dup rtas-entry rtas-base - +
+    2dup hv-rtas-update 0 <> IF
+    ." Failed to update RTAS " cr
+    THEN
+    nip   
 ;
 
 device-end
lib/libhvcall/hvcall.code +6 -0
index 744469f..0ff50f2 100644
@@ -111,6 +111,12 @@ PRIM(hv_X2d_cas)
 	TOS.u = hv_cas(vec, buf, size);
 MIRP
 
+PRIM(hv_X2d_rtas_X2d_update)
+	unsigned long rtas_entry   = TOS.u; POP;
+	unsigned long rtas_base    = TOS.u;
+	TOS.u = hv_generic(KVMPPC_H_RTAS_UPDATE, rtas_base, rtas_entry);
+MIRP
+
 PRIM(get_X2d_print_X2d_version)
 	unsigned long addr = TOS.u; POP;
 	get_print_banner(addr);
lib/libhvcall/hvcall.in +1 -0
index e99d6d1..4437b77 100644
@@ -30,4 +30,5 @@ cod(RX!)
 
 cod(hv-logical-memop)
 cod(hv-cas)
+cod(hv-rtas-update)
 cod(get-print-version)
lib/libhvcall/libhvcall.h +3 -1
index 6356a62..193b738 100644
@@ -24,7 +24,9 @@
 #define KVMPPC_H_LOGICAL_MEMOP  (KVMPPC_HCALL_BASE + 0x1)
 /* Client Architecture support */
 #define KVMPPC_H_CAS            (KVMPPC_HCALL_BASE + 0x2)
-#define KVMPPC_HCALL_MAX        KVMPPC_H_CAS
+#define KVMPPC_H_RTAS_UPDATE    (KVMPPC_HCALL_BASE + 0x3)
+#define KVMPPC_H_REPORT_MC_ERR  (KVMPPC_HCALL_BASE + 0x4)
+#define KVMPPC_HCALL_MAX        KVMPPC_H_NMI_MCE
 
 #ifndef __ASSEMBLY__
 
#1 lore raw
Quoted 6 lines · Aravinda Prasad

This patch adds a private HCALL to inform qemu the updated rtas-base and rtas-entry address when OS invokes the call "instantiate-rtas". This is required as qemu allocates the error reporting structure in RTAS space upon a machine check exception and hence needs to know the updated RTAS.

Quoted 6 lines

Enhancements to qemu to handle the private HCALL, prepare error log and invoke machine check notification routine are in a separate patch.

Thanks, applied.

Quoted 65 lines
---
 board-qemu/slof/rtas.fs   |    6 +++++-
 lib/libhvcall/hvcall.code |    6 ++++++
 lib/libhvcall/hvcall.in   |    1 +
 lib/libhvcall/libhvcall.h |    4 +++-
 4 files changed, 15 insertions(+), 2 deletions(-)
board-qemu/slof/rtas.fs +5 -1
index 41e30c2..c081b57 100644
@@ -174,7 +174,11 @@ rtas-node set-node
 
 : instantiate-rtas ( adr -- entry )
     dup rtas-base swap rtas-size move
-    rtas-entry rtas-base - +
+    dup rtas-entry rtas-base - +
+    2dup hv-rtas-update 0 <> IF
+    ." Failed to update RTAS " cr
+    THEN
+    nip   
 ;
 
 device-end
lib/libhvcall/hvcall.code +6 -0
index 744469f..0ff50f2 100644
@@ -111,6 +111,12 @@ PRIM(hv_X2d_cas)
 	TOS.u = hv_cas(vec, buf, size);
 MIRP
 
+PRIM(hv_X2d_rtas_X2d_update)
+	unsigned long rtas_entry   = TOS.u; POP;
+	unsigned long rtas_base    = TOS.u;
+	TOS.u = hv_generic(KVMPPC_H_RTAS_UPDATE, rtas_base, rtas_entry);
+MIRP
+
 PRIM(get_X2d_print_X2d_version)
 	unsigned long addr = TOS.u; POP;
 	get_print_banner(addr);
lib/libhvcall/hvcall.in +1 -0
index e99d6d1..4437b77 100644
@@ -30,4 +30,5 @@ cod(RX!)
 
 cod(hv-logical-memop)
 cod(hv-cas)
+cod(hv-rtas-update)
 cod(get-print-version)
lib/libhvcall/libhvcall.h +3 -1
index 6356a62..193b738 100644
@@ -24,7 +24,9 @@
 #define KVMPPC_H_LOGICAL_MEMOP  (KVMPPC_HCALL_BASE + 0x1)
 /* Client Architecture support */
 #define KVMPPC_H_CAS            (KVMPPC_HCALL_BASE + 0x2)
-#define KVMPPC_HCALL_MAX        KVMPPC_H_CAS
+#define KVMPPC_H_RTAS_UPDATE    (KVMPPC_HCALL_BASE + 0x3)
+#define KVMPPC_H_REPORT_MC_ERR  (KVMPPC_HCALL_BASE + 0x4)
+#define KVMPPC_HCALL_MAX        KVMPPC_H_NMI_MCE
 
 #ifndef __ASSEMBLY__