From: Harsh Prateek Bora <harshpb@linux.ibm.com>
To: qemu-ppc@nongnu.org
Cc: qemu-devel@nongnu.org, danielhb413@gmail.com
Subject: [PATCH 3/5] ppc: spapr: assert early rather late in h_enter_nested()
Date: Fri, 31 Mar 2023 12:23:42 +0530 [thread overview]
Message-ID: <20230331065344.112341-4-harshpb@linux.ibm.com> (raw)
In-Reply-To: <20230331065344.112341-1-harshpb@linux.ibm.com>
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
next prev parent reply other threads:[~2023-03-31 6:54 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-31 6:53 [PATCH 0/5] Cleanup [h_enter|spapr_exit]_nested routines Harsh Prateek Bora
2023-03-31 6:53 ` [PATCH 1/5] ppc: spapr: cleanup cr get/store with helper routines Harsh Prateek Bora
2023-04-14 11:40 ` Fabiano Rosas
2023-04-17 6:54 ` Harsh Prateek Bora
2023-03-31 6:53 ` [PATCH 2/5] ppc: spapr: cleanup h_enter_nested() " Harsh Prateek Bora
2023-04-14 11:53 ` Fabiano Rosas
2023-04-17 7:02 ` Harsh Prateek Bora
2023-03-31 6:53 ` Harsh Prateek Bora [this message]
2023-04-14 11:55 ` [PATCH 3/5] ppc: spapr: assert early rather late in h_enter_nested() Fabiano Rosas
2023-04-17 7:15 ` Harsh Prateek Bora
2023-03-31 6:53 ` [PATCH 4/5] ppc: spapr: cleanup spapr_exit_nested() with helper routines Harsh Prateek Bora
2023-04-14 11:58 ` Fabiano Rosas
2023-04-17 7:17 ` Harsh Prateek Bora
2023-03-31 6:53 ` [PATCH 5/5] MAINTAINERS: Adding myself in the list for ppc/spapr Harsh Prateek Bora
2023-04-14 11:57 ` Daniel Henrique Barboza
2023-04-17 7:21 ` Harsh Prateek Bora
2023-03-31 10:39 ` [PATCH 0/5] Cleanup [h_enter|spapr_exit]_nested routines Cédric Le Goater
2023-03-31 11:06 ` Daniel Henrique Barboza
2023-04-11 4:15 ` Harsh Prateek Bora
2023-04-14 12:04 ` Fabiano Rosas
2023-04-17 7:21 ` Harsh Prateek Bora
2023-04-17 10:10 ` Cédric Le Goater
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230331065344.112341-4-harshpb@linux.ibm.com \
--to=harshpb@linux.ibm.com \
--cc=danielhb413@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).