diff mbox series

[v2,05/14] spapr: nested: register nested-hv api hcalls only for cap-nested-hv

Message ID 20231012104951.194876-6-harshpb@linux.ibm.com
State New
Headers show
Series Nested PAPR API (KVM on PowerVM) | expand

Commit Message

Harsh Prateek Bora Oct. 12, 2023, 10:49 a.m. UTC
Since cap-nested-hv and cap-nested-papr are mutually exclusive, now it
makes sense to register api specfic hcalls only when respective
capability is enabled, hence this change.

Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
---
 hw/ppc/spapr_caps.c  | 1 +
 hw/ppc/spapr_hcall.c | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

Comments

Nicholas Piggin Nov. 29, 2023, 4:03 a.m. UTC | #1
On Thu Oct 12, 2023 at 8:49 PM AEST, Harsh Prateek Bora wrote:
> Since cap-nested-hv and cap-nested-papr are mutually exclusive, now it
> makes sense to register api specfic hcalls only when respective
> capability is enabled, hence this change.
>
> Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>

I think this basically makes sense anyway since if you don't enable
cap-nested-hv, then no need to register the hcalls. This patch could
be pulled to the front of the series.

Reviewed-by: Nicholas Piggin <npiggin@gmail.com>

> ---
>  hw/ppc/spapr_caps.c  | 1 +
>  hw/ppc/spapr_hcall.c | 2 --
>  2 files changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c
> index 9b53f19ec8..ed3e638334 100644
> --- a/hw/ppc/spapr_caps.c
> +++ b/hw/ppc/spapr_caps.c
> @@ -456,6 +456,7 @@ static void cap_nested_kvm_hv_apply(SpaprMachineState *spapr,
>  
>      if (!spapr->nested.api) {
>          spapr->nested.api = NESTED_API_KVM_HV;
> +        spapr_register_nested();
>      } else {
>          error_setg(errp, "Nested-HV APIs are mutually exclusive/incompatible");
>          error_append_hint(errp, "Please use either cap-nested-hv or "
> diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
> index 522a2396c7..8ae55087ec 100644
> --- a/hw/ppc/spapr_hcall.c
> +++ b/hw/ppc/spapr_hcall.c
> @@ -1635,8 +1635,6 @@ static void hypercall_register_types(void)
>      spapr_register_hypercall(KVMPPC_H_CAS, h_client_architecture_support);
>  
>      spapr_register_hypercall(KVMPPC_H_UPDATE_DT, h_update_dt);
> -
> -    spapr_register_nested();
>  }
>  
>  type_init(hypercall_register_types)
diff mbox series

Patch

diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c
index 9b53f19ec8..ed3e638334 100644
--- a/hw/ppc/spapr_caps.c
+++ b/hw/ppc/spapr_caps.c
@@ -456,6 +456,7 @@  static void cap_nested_kvm_hv_apply(SpaprMachineState *spapr,
 
     if (!spapr->nested.api) {
         spapr->nested.api = NESTED_API_KVM_HV;
+        spapr_register_nested();
     } else {
         error_setg(errp, "Nested-HV APIs are mutually exclusive/incompatible");
         error_append_hint(errp, "Please use either cap-nested-hv or "
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index 522a2396c7..8ae55087ec 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -1635,8 +1635,6 @@  static void hypercall_register_types(void)
     spapr_register_hypercall(KVMPPC_H_CAS, h_client_architecture_support);
 
     spapr_register_hypercall(KVMPPC_H_UPDATE_DT, h_update_dt);
-
-    spapr_register_nested();
 }
 
 type_init(hypercall_register_types)