[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/5] ppc: spapr: assert early rather late in h_enter_nested()
From: |
Harsh Prateek Bora |
Subject: |
[PATCH 3/5] ppc: spapr: assert early rather late in h_enter_nested() |
Date: |
Fri, 31 Mar 2023 12:23:42 +0530 |
Currently, it asserts very late in the code flow if lpid is already initialized.
Ideally, it should assert in the beginning if that is the case. This patch
brings assert check in the beginning alongwith the related initialization.
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
---
hw/ppc/spapr_hcall.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index a13e5256ab..a77b4c9076 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -1621,6 +1621,9 @@ static target_ulong h_enter_nested(PowerPCCPU *cpu,
struct kvmppc_pt_regs *regs;
hwaddr len;
+ assert(env->spr[SPR_LPIDR] == 0);
+ env->spr[SPR_LPIDR] = hv_state.lpid;
+
if (spapr->nested_ptcr == 0) {
return H_NOT_AVAILABLE;
}
@@ -1667,9 +1670,6 @@ static target_ulong h_enter_nested(PowerPCCPU *cpu,
address_space_unmap(CPU(cpu)->as, regs, len, len, false);
- assert(env->spr[SPR_LPIDR] == 0);
- env->spr[SPR_LPIDR] = hv_state.lpid;
-
spapr_cpu->nested_tb_offset = hv_state.tb_offset;
/*
--
2.31.1
- [PATCH 0/5] Cleanup [h_enter|spapr_exit]_nested routines, Harsh Prateek Bora, 2023/03/31
- [PATCH 1/5] ppc: spapr: cleanup cr get/store with helper routines., Harsh Prateek Bora, 2023/03/31
- [PATCH 2/5] ppc: spapr: cleanup h_enter_nested() with helper routines., Harsh Prateek Bora, 2023/03/31
- [PATCH 3/5] ppc: spapr: assert early rather late in h_enter_nested(),
Harsh Prateek Bora <=
- [PATCH 5/5] MAINTAINERS: Adding myself in the list for ppc/spapr, Harsh Prateek Bora, 2023/03/31
- [PATCH 4/5] ppc: spapr: cleanup spapr_exit_nested() with helper routines., Harsh Prateek Bora, 2023/03/31
- Re: [PATCH 0/5] Cleanup [h_enter|spapr_exit]_nested routines, Cédric Le Goater, 2023/03/31