diff mbox series

[v2,10/10] target/ppc: Get CPUState in one step

Message ID f2a22b2c5483a31fa2c6cdd84fe659bfc5d499cd.1686776990.git.balaton@eik.bme.hu
State New
Headers show
Series Misc clean ups to target/ppc exception handling | expand

Commit Message

BALATON Zoltan June 14, 2023, 9:34 p.m. UTC
We can get CPUState from env with env_cpu without going through
PowerPCCPU and casting that.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
 target/ppc/excp_helper.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

Comments

Nicholas Piggin June 15, 2023, 3:35 a.m. UTC | #1
On Thu Jun 15, 2023 at 7:34 AM AEST, BALATON Zoltan wrote:
> We can get CPUState from env with env_cpu without going through
> PowerPCCPU and casting that.
>
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>

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

> ---
>  target/ppc/excp_helper.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
> index 662457f342..5edf06210f 100644
> --- a/target/ppc/excp_helper.c
> +++ b/target/ppc/excp_helper.c
> @@ -1506,8 +1506,8 @@ static int p7_interrupt_powersave(CPUPPCState *env)
>  
>  static int p7_next_unmasked_interrupt(CPUPPCState *env)
>  {
> -    PowerPCCPU *cpu = env_archcpu(env);
> -    CPUState *cs = CPU(cpu);
> +    CPUState *cs = env_cpu(env);
> +
>      /* Ignore MSR[EE] when coming out of some power management states */
>      bool msr_ee = FIELD_EX64(env->msr, MSR, EE) || env->resume_as_sreset;
>  
> @@ -1596,8 +1596,8 @@ static int p8_interrupt_powersave(CPUPPCState *env)
>  
>  static int p8_next_unmasked_interrupt(CPUPPCState *env)
>  {
> -    PowerPCCPU *cpu = env_archcpu(env);
> -    CPUState *cs = CPU(cpu);
> +    CPUState *cs = env_cpu(env);
> +
>      /* Ignore MSR[EE] when coming out of some power management states */
>      bool msr_ee = FIELD_EX64(env->msr, MSR, EE) || env->resume_as_sreset;
>  
> @@ -1717,8 +1717,8 @@ static int p9_interrupt_powersave(CPUPPCState *env)
>  
>  static int p9_next_unmasked_interrupt(CPUPPCState *env)
>  {
> -    PowerPCCPU *cpu = env_archcpu(env);
> -    CPUState *cs = CPU(cpu);
> +    CPUState *cs = env_cpu(env);
> +
>      /* Ignore MSR[EE] when coming out of some power management states */
>      bool msr_ee = FIELD_EX64(env->msr, MSR, EE) || env->resume_as_sreset;
>  
> @@ -2412,9 +2412,8 @@ void helper_scv(CPUPPCState *env, uint32_t lev)
>  
>  void helper_pminsn(CPUPPCState *env, uint32_t insn)
>  {
> -    CPUState *cs;
> +    CPUState *cs = env_cpu(env);
>  
> -    cs = env_cpu(env);
>      cs->halted = 1;
>  
>      /* Condition for waking up at 0x100 */
> -- 
> 2.30.9
diff mbox series

Patch

diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
index 662457f342..5edf06210f 100644
--- a/target/ppc/excp_helper.c
+++ b/target/ppc/excp_helper.c
@@ -1506,8 +1506,8 @@  static int p7_interrupt_powersave(CPUPPCState *env)
 
 static int p7_next_unmasked_interrupt(CPUPPCState *env)
 {
-    PowerPCCPU *cpu = env_archcpu(env);
-    CPUState *cs = CPU(cpu);
+    CPUState *cs = env_cpu(env);
+
     /* Ignore MSR[EE] when coming out of some power management states */
     bool msr_ee = FIELD_EX64(env->msr, MSR, EE) || env->resume_as_sreset;
 
@@ -1596,8 +1596,8 @@  static int p8_interrupt_powersave(CPUPPCState *env)
 
 static int p8_next_unmasked_interrupt(CPUPPCState *env)
 {
-    PowerPCCPU *cpu = env_archcpu(env);
-    CPUState *cs = CPU(cpu);
+    CPUState *cs = env_cpu(env);
+
     /* Ignore MSR[EE] when coming out of some power management states */
     bool msr_ee = FIELD_EX64(env->msr, MSR, EE) || env->resume_as_sreset;
 
@@ -1717,8 +1717,8 @@  static int p9_interrupt_powersave(CPUPPCState *env)
 
 static int p9_next_unmasked_interrupt(CPUPPCState *env)
 {
-    PowerPCCPU *cpu = env_archcpu(env);
-    CPUState *cs = CPU(cpu);
+    CPUState *cs = env_cpu(env);
+
     /* Ignore MSR[EE] when coming out of some power management states */
     bool msr_ee = FIELD_EX64(env->msr, MSR, EE) || env->resume_as_sreset;
 
@@ -2412,9 +2412,8 @@  void helper_scv(CPUPPCState *env, uint32_t lev)
 
 void helper_pminsn(CPUPPCState *env, uint32_t insn)
 {
-    CPUState *cs;
+    CPUState *cs = env_cpu(env);
 
-    cs = env_cpu(env);
     cs->halted = 1;
 
     /* Condition for waking up at 0x100 */