[v5,1/6] Revert various SLOF-to-QEMU private hypercalls

Message ID 20171016051653.31014-2-aik@ozlabs.ru
State New
Headers show
Series
  • fdt: Pass the resulting device tree to QEMU + related fixes
Related show

Commit Message

Alexey Kardashevskiy Oct. 16, 2017, 5:16 a.m.
This reverts commits:

604d28cc3 "board-qemu: add private hcall to inform host on "phandle" update"
089fc18a9 "libhvcall: drop unused KVMPPC_H_REPORT_MC_ERR and KVMPPC_H_NMI_MCE defines"
1c17c13a5 "rtas: Improve error handling in instantiate-rtas"
f9a60de30 "Add private HCALL to inform updated RTAS base and entry"

A bigger hammer is coming soon which will pass the entire device
tree to QEMU, not just some random bits.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 lib/libhvcall/libhvcall.h |  3 +--
 board-qemu/slof/fdt.fs    | 14 ++------------
 board-qemu/slof/rtas.fs   |  9 +--------
 lib/libhvcall/hvcall.code | 13 -------------
 lib/libhvcall/hvcall.in   |  2 --
 5 files changed, 4 insertions(+), 37 deletions(-)

Comments

Greg Kurz Oct. 16, 2017, 1:02 p.m. | #1
On Mon, 16 Oct 2017 16:16:48 +1100
Alexey Kardashevskiy <aik@ozlabs.ru> wrote:

> This reverts commits:
> 
> 604d28cc3 "board-qemu: add private hcall to inform host on "phandle" update"
> 089fc18a9 "libhvcall: drop unused KVMPPC_H_REPORT_MC_ERR and KVMPPC_H_NMI_MCE defines"
> 1c17c13a5 "rtas: Improve error handling in instantiate-rtas"
> f9a60de30 "Add private HCALL to inform updated RTAS base and entry"
> 
> A bigger hammer is coming soon which will pass the entire device
> tree to QEMU, not just some random bits.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---

Reviewed-by: Greg Kurz <groug@kaod.org>

>  lib/libhvcall/libhvcall.h |  3 +--
>  board-qemu/slof/fdt.fs    | 14 ++------------
>  board-qemu/slof/rtas.fs   |  9 +--------
>  lib/libhvcall/hvcall.code | 13 -------------
>  lib/libhvcall/hvcall.in   |  2 --
>  5 files changed, 4 insertions(+), 37 deletions(-)
> 
> diff --git a/lib/libhvcall/libhvcall.h b/lib/libhvcall/libhvcall.h
> index 5776a2b..6356a62 100644
> --- a/lib/libhvcall/libhvcall.h
> +++ b/lib/libhvcall/libhvcall.h
> @@ -24,8 +24,7 @@
>  #define KVMPPC_H_LOGICAL_MEMOP  (KVMPPC_HCALL_BASE + 0x1)
>  /* Client Architecture support */
>  #define KVMPPC_H_CAS            (KVMPPC_HCALL_BASE + 0x2)
> -#define KVMPPC_H_RTAS_UPDATE    (KVMPPC_HCALL_BASE + 0x3)
> -#define KVMPPC_H_UPDATE_PHANDLE (KVMPPC_HCALL_BASE + 0x4)
> +#define KVMPPC_HCALL_MAX        KVMPPC_H_CAS
>  
>  #ifndef __ASSEMBLY__
>  
> diff --git a/board-qemu/slof/fdt.fs b/board-qemu/slof/fdt.fs
> index a24e344..851645e 100644
> --- a/board-qemu/slof/fdt.fs
> +++ b/board-qemu/slof/fdt.fs
> @@ -308,28 +308,18 @@ fdt-claim-reserve
>     3drop
>  ;
>  
> -\ Tell QEMU about the updated phandle:
> -: fdt-hv-update-phandle ( old new -- )
> -   hv-update-phandle ?dup IF
> -      \ Ignore hcall not implemented error, print error otherwise
> -      dup -2 <> IF ." HV-UPDATE-PHANDLE error: " . cr ELSE drop THEN
> -   THEN
> -;
> -
>  \ Replace one FDT phandle "val" with a OF1275 phandle "node" in the
>  \ whole tree:
>  : fdt-update-phandle ( val node -- )
>     >r  
>     FALSE TO (fdt-phandle-replaced)
> -   r@ 2dup s" /" find-node          ( val node val node root )
> -   fdt-replace-all-phandles         ( val node )
> +   r@ s" /" find-node               ( val node root )
> +   fdt-replace-all-phandles
>     (fdt-phandle-replaced) IF
> -      fdt-hv-update-phandle
>        r@ set-node
>        s" phandle" delete-property
>        s" linux,phandle" delete-property
>     ELSE
> -      2drop
>        diagnostic-mode? IF
>           cr ." Warning: Did not replace phandle in " r@ node>path type cr
>        THEN
> diff --git a/board-qemu/slof/rtas.fs b/board-qemu/slof/rtas.fs
> index 54d3929..b17157e 100644
> --- a/board-qemu/slof/rtas.fs
> +++ b/board-qemu/slof/rtas.fs
> @@ -172,14 +172,7 @@ rtas-node set-node
>  
>  : instantiate-rtas ( adr -- entry )
>      dup rtas-base swap rtas-size move
> -    dup rtas-entry rtas-base - +
> -    2dup hv-rtas-update dup 0 <> IF
> -	\ Ignore hcall not implemented error, print error otherwise
> -	dup -2 <> IF ." HV-RTAS-UPDATE error: " . cr ELSE drop THEN
> -    ELSE
> -	drop
> -    THEN
> -    nip
> +    rtas-entry rtas-base - +
>  ;
>  
>  device-end
> diff --git a/lib/libhvcall/hvcall.code b/lib/libhvcall/hvcall.code
> index 8349748..744469f 100644
> --- a/lib/libhvcall/hvcall.code
> +++ b/lib/libhvcall/hvcall.code
> @@ -111,12 +111,6 @@ 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);
> @@ -129,10 +123,3 @@ PRIM(check_X2d_and_X2d_patch_X2d_sc1)
>  
>  	patch_broken_sc1((void*)start, (void*)end, (void*)patch_ins);
>  MIRP
> -
> -// : hv-update-phandle ( old_phandle new_phandle -- res )
> -PRIM(hv_X2d_update_X2d_phandle)
> -	uint32_t new_phandle = TOS.u; POP;
> -	uint32_t old_phandle = TOS.u;
> -	TOS.u = hv_generic(KVMPPC_H_UPDATE_PHANDLE, old_phandle, new_phandle);
> -MIRP
> diff --git a/lib/libhvcall/hvcall.in b/lib/libhvcall/hvcall.in
> index ab7513a..e99d6d1 100644
> --- a/lib/libhvcall/hvcall.in
> +++ b/lib/libhvcall/hvcall.in
> @@ -30,6 +30,4 @@ cod(RX!)
>  
>  cod(hv-logical-memop)
>  cod(hv-cas)
> -cod(hv-rtas-update)
> -cod(hv-update-phandle)
>  cod(get-print-version)

Patch

diff --git a/lib/libhvcall/libhvcall.h b/lib/libhvcall/libhvcall.h
index 5776a2b..6356a62 100644
--- a/lib/libhvcall/libhvcall.h
+++ b/lib/libhvcall/libhvcall.h
@@ -24,8 +24,7 @@ 
 #define KVMPPC_H_LOGICAL_MEMOP  (KVMPPC_HCALL_BASE + 0x1)
 /* Client Architecture support */
 #define KVMPPC_H_CAS            (KVMPPC_HCALL_BASE + 0x2)
-#define KVMPPC_H_RTAS_UPDATE    (KVMPPC_HCALL_BASE + 0x3)
-#define KVMPPC_H_UPDATE_PHANDLE (KVMPPC_HCALL_BASE + 0x4)
+#define KVMPPC_HCALL_MAX        KVMPPC_H_CAS
 
 #ifndef __ASSEMBLY__
 
diff --git a/board-qemu/slof/fdt.fs b/board-qemu/slof/fdt.fs
index a24e344..851645e 100644
--- a/board-qemu/slof/fdt.fs
+++ b/board-qemu/slof/fdt.fs
@@ -308,28 +308,18 @@  fdt-claim-reserve
    3drop
 ;
 
-\ Tell QEMU about the updated phandle:
-: fdt-hv-update-phandle ( old new -- )
-   hv-update-phandle ?dup IF
-      \ Ignore hcall not implemented error, print error otherwise
-      dup -2 <> IF ." HV-UPDATE-PHANDLE error: " . cr ELSE drop THEN
-   THEN
-;
-
 \ Replace one FDT phandle "val" with a OF1275 phandle "node" in the
 \ whole tree:
 : fdt-update-phandle ( val node -- )
    >r
    FALSE TO (fdt-phandle-replaced)
-   r@ 2dup s" /" find-node          ( val node val node root )
-   fdt-replace-all-phandles         ( val node )
+   r@ s" /" find-node               ( val node root )
+   fdt-replace-all-phandles
    (fdt-phandle-replaced) IF
-      fdt-hv-update-phandle
       r@ set-node
       s" phandle" delete-property
       s" linux,phandle" delete-property
    ELSE
-      2drop
       diagnostic-mode? IF
          cr ." Warning: Did not replace phandle in " r@ node>path type cr
       THEN
diff --git a/board-qemu/slof/rtas.fs b/board-qemu/slof/rtas.fs
index 54d3929..b17157e 100644
--- a/board-qemu/slof/rtas.fs
+++ b/board-qemu/slof/rtas.fs
@@ -172,14 +172,7 @@  rtas-node set-node
 
 : instantiate-rtas ( adr -- entry )
     dup rtas-base swap rtas-size move
-    dup rtas-entry rtas-base - +
-    2dup hv-rtas-update dup 0 <> IF
-	\ Ignore hcall not implemented error, print error otherwise
-	dup -2 <> IF ." HV-RTAS-UPDATE error: " . cr ELSE drop THEN
-    ELSE
-	drop
-    THEN
-    nip
+    rtas-entry rtas-base - +
 ;
 
 device-end
diff --git a/lib/libhvcall/hvcall.code b/lib/libhvcall/hvcall.code
index 8349748..744469f 100644
--- a/lib/libhvcall/hvcall.code
+++ b/lib/libhvcall/hvcall.code
@@ -111,12 +111,6 @@  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);
@@ -129,10 +123,3 @@  PRIM(check_X2d_and_X2d_patch_X2d_sc1)
 
 	patch_broken_sc1((void*)start, (void*)end, (void*)patch_ins);
 MIRP
-
-// : hv-update-phandle ( old_phandle new_phandle -- res )
-PRIM(hv_X2d_update_X2d_phandle)
-	uint32_t new_phandle = TOS.u; POP;
-	uint32_t old_phandle = TOS.u;
-	TOS.u = hv_generic(KVMPPC_H_UPDATE_PHANDLE, old_phandle, new_phandle);
-MIRP
diff --git a/lib/libhvcall/hvcall.in b/lib/libhvcall/hvcall.in
index ab7513a..e99d6d1 100644
--- a/lib/libhvcall/hvcall.in
+++ b/lib/libhvcall/hvcall.in
@@ -30,6 +30,4 @@  cod(RX!)
 
 cod(hv-logical-memop)
 cod(hv-cas)
-cod(hv-rtas-update)
-cod(hv-update-phandle)
 cod(get-print-version)