Skip to contentSkip to conversation

target/arm: Use vaddr type in handle_psci_call()

PATCH In review Philippe Mathieu-Daudé 2 participants 3 messages Apr 10

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 target/arm: Use vaddr type in handle_psci_call()

Use 'vaddr' type for @entry, which is the start %pc for the on-lining vCPU. This allows to remove an unnecessary target_ulong in hvf_handle_psci_call().

---
 target/arm/hvf/hvf.c  | 2 +-
 target/arm/tcg/psci.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
target/arm/hvf/hvf.c +1 -1
index 5fc8f6bbbd9..124644918ef 100644
@@ -1418,7 +1418,7 @@ static bool hvf_handle_psci_call(CPUState *cpu, int *excp_ret)
     bool target_aarch64 = true;
     CPUState *target_cpu_state;
     ARMCPU *target_cpu;
-    target_ulong entry;
+    vaddr entry;
     int target_el = 1;
     int32_t ret = 0;
 
target/arm/tcg/psci.c +1 -1
index 56754bde951..5df17bd059d 100644
@@ -68,7 +68,7 @@ void arm_handle_psci_call(ARMCPU *cpu)
     CPUARMState *env = &cpu->env;
     uint64_t param[4];
     uint64_t context_id, mpidr;
-    uint64_t entry;
+    vaddr entry;
     int32_t ret = 0;
     int i;
 
Signature · 1 line
2.53.0
#1 lore raw
Quoted 32 lines · Philippe Mathieu-Daudé

Use 'vaddr' type for @entry, which is the start %pc for the on-lining vCPU. This allows to remove an unnecessary target_ulong in hvf_handle_psci_call().

---
 target/arm/hvf/hvf.c  | 2 +-
 target/arm/tcg/psci.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
target/arm/hvf/hvf.c +1 -1
index 5fc8f6bbbd9..124644918ef 100644
@@ -1418,7 +1418,7 @@ static bool hvf_handle_psci_call(CPUState *cpu, int *excp_ret)
     bool target_aarch64 = true;
     CPUState *target_cpu_state;
     ARMCPU *target_cpu;
-    target_ulong entry;
+    vaddr entry;
     int target_el = 1;
     int32_t ret = 0;
 
target/arm/tcg/psci.c +0 -0
index 56754bde951..5df17bd059d 100644

target/arm/tcg/psci.c void arm_handle_psci_call(ARMCPU *cpu) · line 73

Quoted 7 lines
target/arm/tcg/psci.c +1 -1
@@ -68,7 +68,7 @@ void arm_handle_psci_call(ARMCPU *cpu)
     CPUARMState *env = &cpu->env;
     uint64_t param[4];
     uint64_t context_id, mpidr;
-    uint64_t entry;
+    vaddr entry;
     int32_t ret = 0;
     int i;

So we take our argument which is a uint64_t in param[], and we put it into a vaddr entry, and then the only thing we do with that is pass it to arm_set_cpu_on() which takes a uint64_t... I'm not sure what the vaddr type is getting us here.

Should we just do in hvf.c the same thing we did already for tcg/psci.c in 3580aa03547f92, and make 'entry' a uint64_t ?

-- PMM

#2 lore raw
Quoted 46 lines · Peter Maydell
Quoted 32 lines · Philippe Mathieu-Daudé

Use 'vaddr' type for @entry, which is the start %pc for the on-lining vCPU. This allows to remove an unnecessary target_ulong in hvf_handle_psci_call().

---
  target/arm/hvf/hvf.c  | 2 +-
  target/arm/tcg/psci.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
target/arm/hvf/hvf.c +1 -1
index 5fc8f6bbbd9..124644918ef 100644
@@ -1418,7 +1418,7 @@ static bool hvf_handle_psci_call(CPUState *cpu, int *excp_ret)
      bool target_aarch64 = true;
      CPUState *target_cpu_state;
      ARMCPU *target_cpu;
-    target_ulong entry;
+    vaddr entry;
      int target_el = 1;
      int32_t ret = 0;
 
target/arm/tcg/psci.c +0 -0
index 56754bde951..5df17bd059d 100644

target/arm/tcg/psci.c void arm_handle_psci_call(ARMCPU *cpu) · line 73

Quoted 7 lines
target/arm/tcg/psci.c +1 -1
@@ -68,7 +68,7 @@ void arm_handle_psci_call(ARMCPU *cpu)
      CPUARMState *env = &cpu->env;
      uint64_t param[4];
      uint64_t context_id, mpidr;
-    uint64_t entry;
+    vaddr entry;
      int32_t ret = 0;
      int i;

So we take our argument which is a uint64_t in param[], and we put it into a vaddr entry, and then the only thing we do with that is pass it to arm_set_cpu_on() which takes a uint64_t... I'm not sure what the vaddr type is getting us here.

Quoted 2 lines

Should we just do in hvf.c the same thing we did already for tcg/psci.c in 3580aa03547f92, and make 'entry' a uint64_t ?

Well this was v3, I just wanted to address Richard comment:
https://lore.kernel.org/qemu-devel/[email protected]/

I'll repost v3 as v5 so we can choose :)