diff mbox series

[v2,2/2] arm/hvf: Stop setting current_cpu

Message ID d91deec6e2c68a9cf0e911251992b4d845be14ab.1606856104.git.pcc@google.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/2] arm/hvf: Optimize and simplify WFI handling | expand

Commit Message

Peter Collingbourne Dec. 1, 2020, 9 p.m. UTC
This variable is already being set by the generic HVF code and it's a
thread-local variable so I don't see how it can be overwritten.

Signed-off-by: Peter Collingbourne <pcc@google.com>
---
 target/arm/hvf/hvf.c | 8 --------
 1 file changed, 8 deletions(-)

Comments

Alexander Graf Dec. 1, 2020, 10:11 p.m. UTC | #1
On 01.12.20 22:00, Peter Collingbourne wrote:
> This variable is already being set by the generic HVF code and it's a
> thread-local variable so I don't see how it can be overwritten.
>
> Signed-off-by: Peter Collingbourne <pcc@google.com>


Yikes :). Yes, absolutely!

Would you mind if I squash this straight into my patch?


Thanks,

Alex


> ---
>   target/arm/hvf/hvf.c | 8 --------
>   1 file changed, 8 deletions(-)
>
> diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
> index 3321d48aa2..40984fcf4d 100644
> --- a/target/arm/hvf/hvf.c
> +++ b/target/arm/hvf/hvf.c
> @@ -364,7 +364,6 @@ int hvf_vcpu_exec(CPUState *cpu)
>       do {
>           bool advance_pc = false;
>   
> -        current_cpu = cpu;
>           qemu_wait_io_event_common(cpu);
>   
>           flush_cpu_state(cpu);
> @@ -391,7 +390,6 @@ int hvf_vcpu_exec(CPUState *cpu)
>               /* This is the main one, handle below. */
>               break;
>           case HV_EXIT_REASON_VTIMER_ACTIVATED:
> -            current_cpu = cpu;
>               qemu_set_irq(arm_cpu->gt_timer_outputs[GTIMER_VIRT], 1);
>               continue;
>           case HV_EXIT_REASON_CANCELED:
> @@ -412,8 +410,6 @@ int hvf_vcpu_exec(CPUState *cpu)
>               uint32_t srt = (syndrome >> 16) & 0x1f;
>               uint64_t val = 0;
>   
> -            current_cpu = cpu;
> -
>               DPRINTF("data abort: [pc=0x%llx va=0x%016llx pa=0x%016llx isv=%x "
>                       "iswrite=%x s1ptw=%x len=%d srt=%d]\n",
>                       env->pc, hvf_exit->exception.virtual_address,
> @@ -523,7 +519,6 @@ int hvf_vcpu_exec(CPUState *cpu)
>               break;
>           case EC_AA64_HVC:
>               cpu_synchronize_state(cpu);
> -            current_cpu = cpu;
>               if (arm_is_psci_call(arm_cpu, EXCP_HVC)) {
>                   arm_handle_psci_call(arm_cpu);
>               } else {
> @@ -533,7 +528,6 @@ int hvf_vcpu_exec(CPUState *cpu)
>               break;
>           case EC_AA64_SMC:
>               cpu_synchronize_state(cpu);
> -            current_cpu = cpu;
>               if (arm_is_psci_call(arm_cpu, EXCP_SMC)) {
>                   arm_handle_psci_call(arm_cpu);
>               } else {
> @@ -561,7 +555,5 @@ int hvf_vcpu_exec(CPUState *cpu)
>           }
>       } while (ret == 0);
>   
> -    current_cpu = cpu;
> -
>       return ret;
>   }
Peter Collingbourne Dec. 2, 2020, 12:13 a.m. UTC | #2
On Tue, Dec 1, 2020 at 2:11 PM Alexander Graf <agraf@csgraf.de> wrote:
>
>
> On 01.12.20 22:00, Peter Collingbourne wrote:
> > This variable is already being set by the generic HVF code and it's a
> > thread-local variable so I don't see how it can be overwritten.
> >
> > Signed-off-by: Peter Collingbourne <pcc@google.com>
>
>
> Yikes :). Yes, absolutely!
>
> Would you mind if I squash this straight into my patch?

Sure, please go ahead.

Peter

>
>
> Thanks,
>
> Alex
>
>
> > ---
> >   target/arm/hvf/hvf.c | 8 --------
> >   1 file changed, 8 deletions(-)
> >
> > diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
> > index 3321d48aa2..40984fcf4d 100644
> > --- a/target/arm/hvf/hvf.c
> > +++ b/target/arm/hvf/hvf.c
> > @@ -364,7 +364,6 @@ int hvf_vcpu_exec(CPUState *cpu)
> >       do {
> >           bool advance_pc = false;
> >
> > -        current_cpu = cpu;
> >           qemu_wait_io_event_common(cpu);
> >
> >           flush_cpu_state(cpu);
> > @@ -391,7 +390,6 @@ int hvf_vcpu_exec(CPUState *cpu)
> >               /* This is the main one, handle below. */
> >               break;
> >           case HV_EXIT_REASON_VTIMER_ACTIVATED:
> > -            current_cpu = cpu;
> >               qemu_set_irq(arm_cpu->gt_timer_outputs[GTIMER_VIRT], 1);
> >               continue;
> >           case HV_EXIT_REASON_CANCELED:
> > @@ -412,8 +410,6 @@ int hvf_vcpu_exec(CPUState *cpu)
> >               uint32_t srt = (syndrome >> 16) & 0x1f;
> >               uint64_t val = 0;
> >
> > -            current_cpu = cpu;
> > -
> >               DPRINTF("data abort: [pc=0x%llx va=0x%016llx pa=0x%016llx isv=%x "
> >                       "iswrite=%x s1ptw=%x len=%d srt=%d]\n",
> >                       env->pc, hvf_exit->exception.virtual_address,
> > @@ -523,7 +519,6 @@ int hvf_vcpu_exec(CPUState *cpu)
> >               break;
> >           case EC_AA64_HVC:
> >               cpu_synchronize_state(cpu);
> > -            current_cpu = cpu;
> >               if (arm_is_psci_call(arm_cpu, EXCP_HVC)) {
> >                   arm_handle_psci_call(arm_cpu);
> >               } else {
> > @@ -533,7 +528,6 @@ int hvf_vcpu_exec(CPUState *cpu)
> >               break;
> >           case EC_AA64_SMC:
> >               cpu_synchronize_state(cpu);
> > -            current_cpu = cpu;
> >               if (arm_is_psci_call(arm_cpu, EXCP_SMC)) {
> >                   arm_handle_psci_call(arm_cpu);
> >               } else {
> > @@ -561,7 +555,5 @@ int hvf_vcpu_exec(CPUState *cpu)
> >           }
> >       } while (ret == 0);
> >
> > -    current_cpu = cpu;
> > -
> >       return ret;
> >   }
diff mbox series

Patch

diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index 3321d48aa2..40984fcf4d 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -364,7 +364,6 @@  int hvf_vcpu_exec(CPUState *cpu)
     do {
         bool advance_pc = false;
 
-        current_cpu = cpu;
         qemu_wait_io_event_common(cpu);
 
         flush_cpu_state(cpu);
@@ -391,7 +390,6 @@  int hvf_vcpu_exec(CPUState *cpu)
             /* This is the main one, handle below. */
             break;
         case HV_EXIT_REASON_VTIMER_ACTIVATED:
-            current_cpu = cpu;
             qemu_set_irq(arm_cpu->gt_timer_outputs[GTIMER_VIRT], 1);
             continue;
         case HV_EXIT_REASON_CANCELED:
@@ -412,8 +410,6 @@  int hvf_vcpu_exec(CPUState *cpu)
             uint32_t srt = (syndrome >> 16) & 0x1f;
             uint64_t val = 0;
 
-            current_cpu = cpu;
-
             DPRINTF("data abort: [pc=0x%llx va=0x%016llx pa=0x%016llx isv=%x "
                     "iswrite=%x s1ptw=%x len=%d srt=%d]\n",
                     env->pc, hvf_exit->exception.virtual_address,
@@ -523,7 +519,6 @@  int hvf_vcpu_exec(CPUState *cpu)
             break;
         case EC_AA64_HVC:
             cpu_synchronize_state(cpu);
-            current_cpu = cpu;
             if (arm_is_psci_call(arm_cpu, EXCP_HVC)) {
                 arm_handle_psci_call(arm_cpu);
             } else {
@@ -533,7 +528,6 @@  int hvf_vcpu_exec(CPUState *cpu)
             break;
         case EC_AA64_SMC:
             cpu_synchronize_state(cpu);
-            current_cpu = cpu;
             if (arm_is_psci_call(arm_cpu, EXCP_SMC)) {
                 arm_handle_psci_call(arm_cpu);
             } else {
@@ -561,7 +555,5 @@  int hvf_vcpu_exec(CPUState *cpu)
         }
     } while (ret == 0);
 
-    current_cpu = cpu;
-
     return ret;
 }