[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 13/14] spapr: nested: keep nested-hv exit code restricted
From: |
Nicholas Piggin |
Subject: |
Re: [PATCH v2 13/14] spapr: nested: keep nested-hv exit code restricted to its API. |
Date: |
Wed, 29 Nov 2023 14:16:55 +1000 |
On Thu Oct 12, 2023 at 8:49 PM AEST, Harsh Prateek Bora wrote:
> spapr_exit_nested gets triggered on a nested guest exit and currently
> being used only for nested-hv API. Isolating code flows based on API
> helps extending it to be used with nested PAPR API as well.
>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
> Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
> ---
> hw/ppc/spapr_nested.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/hw/ppc/spapr_nested.c b/hw/ppc/spapr_nested.c
> index 607fb7ead2..e2d0cb5559 100644
> --- a/hw/ppc/spapr_nested.c
> +++ b/hw/ppc/spapr_nested.c
> @@ -325,7 +325,7 @@ static target_ulong h_enter_nested(PowerPCCPU *cpu,
> return env->gpr[3];
> }
>
> -void spapr_exit_nested(PowerPCCPU *cpu, int excp)
> +static void spapr_exit_nested_hv(PowerPCCPU *cpu, int excp)
> {
> CPUPPCState *env = &cpu->env;
> SpaprCpuState *spapr_cpu = spapr_cpu_state(cpu);
> @@ -337,8 +337,6 @@ void spapr_exit_nested(PowerPCCPU *cpu, int excp)
> struct kvmppc_pt_regs *regs;
> hwaddr len;
>
> - assert(spapr_cpu->in_nested);
> -
> nested_save_state(&l2_state, cpu);
> hsrr0 = env->spr[SPR_HSRR0];
> hsrr1 = env->spr[SPR_HSRR1];
> @@ -428,6 +426,17 @@ void spapr_exit_nested(PowerPCCPU *cpu, int excp)
> address_space_unmap(CPU(cpu)->as, regs, len, len, true);
> }
>
> +void spapr_exit_nested(PowerPCCPU *cpu, int excp)
> +{
> + SpaprMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
> + SpaprCpuState *spapr_cpu = spapr_cpu_state(cpu);
> +
> + assert(spapr_cpu->in_nested);
> + if (spapr->nested.api == NESTED_API_KVM_HV) {
> + spapr_exit_nested_hv(cpu, excp);
> + }
> +}
> +
> SpaprMachineStateNestedGuest *spapr_get_nested_guest(SpaprMachineState
> *spapr,
> target_ulong guestid)
> {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH v2 13/14] spapr: nested: keep nested-hv exit code restricted to its API.,
Nicholas Piggin <=