[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 13/14] spapr: nested: keep nested-hv exit code restricted to i
From: |
Harsh Prateek Bora |
Subject: |
[PATCH v2 13/14] spapr: nested: keep nested-hv exit code restricted to its API. |
Date: |
Thu, 12 Oct 2023 16:19:50 +0530 |
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.
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)
{
--
2.39.3
- [PATCH v2 00/14] Nested PAPR API (KVM on PowerVM), Harsh Prateek Bora, 2023/10/12
- [PATCH v2 01/14] spapr: nested: move nested part of spapr_get_pate into spapr_nested.c, Harsh Prateek Bora, 2023/10/12
- [PATCH v2 04/14] spapr: nested: Introduce cap-nested-papr for Nested PAPR API, Harsh Prateek Bora, 2023/10/12
- [PATCH v2 03/14] spapr: nested: Document Nested PAPR API, Harsh Prateek Bora, 2023/10/12
- [PATCH v2 06/14] spapr: nested: Introduce H_GUEST_[GET|SET]_CAPABILITIES hcalls., Harsh Prateek Bora, 2023/10/12
- [PATCH v2 02/14] spapr: nested: Introduce SpaprMachineStateNested to store related info., Harsh Prateek Bora, 2023/10/12
- [PATCH v2 08/14] spapr: nested: Introduce H_GUEST_CREATE_VPCU hcall., Harsh Prateek Bora, 2023/10/12
- [PATCH v2 09/14] spapr: nested: Initialize the GSB elements lookup table., Harsh Prateek Bora, 2023/10/12
- [PATCH v2 05/14] spapr: nested: register nested-hv api hcalls only for cap-nested-hv, Harsh Prateek Bora, 2023/10/12
- [PATCH v2 11/14] spapr: nested: Use correct source for parttbl info for nested PAPR API., Harsh Prateek Bora, 2023/10/12
- [PATCH v2 13/14] spapr: nested: keep nested-hv exit code restricted to its API.,
Harsh Prateek Bora <=
- [PATCH v2 10/14] spapr: nested: Introduce H_GUEST_[GET|SET]_STATE hcalls., Harsh Prateek Bora, 2023/10/12
- [PATCH v2 07/14] spapr: nested: Introduce H_GUEST_[CREATE|DELETE] hcalls., Harsh Prateek Bora, 2023/10/12
- [PATCH v2 12/14] spapr: nested: rename nested_host_state to nested_hv_host, Harsh Prateek Bora, 2023/10/12
- [PATCH v2 14/14] spapr: nested: Introduce H_GUEST_RUN_VCPU hcall., Harsh Prateek Bora, 2023/10/12