Skip to contentSkip to conversation

target/s390x: Few target_ulong -> vaddr replacements

PATCH In review Philippe Mathieu-Daudé 2 participants 5 messages Jul 7, 2025

lore
Share & tools
lore
#0 lore raw

cover target/s390x: Few target_ulong -> vaddr replacements

Replace few 'target_ulong' by 'vaddr' in target/s390x/ (the other lefts aren't in my way, so I'm ignoring them).

Philippe Mathieu-Daudé (2):
target/s390x/kvm: Use vaddr in find/insert_hw_breakpoint() target/s390x/tcg: Use vaddr in s390_probe_access()

 target/s390x/kvm/kvm.c        |  4 ++--
 target/s390x/tcg/mem_helper.c | 10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)
Signature · 1 line
2.49.0
#1 lore raw

PATCH 1/2 target/s390x/kvm: Use vaddr in find/insert_hw_breakpoint()

Since commit b8a6eb1862a both kvm_arch_insert_hw_breakpoint() and kvm_arch_remove_hw_breakpoint() use a vaddr type. Use the same type for the callees.

Fixes b8a6eb1862a ("sysemu/kvm: Use vaddr for kvm_arch_[insert|remove]_hw_breakpoint")
---
 target/s390x/kvm/kvm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target/s390x/kvm/kvm.c +2 -2
index 67d9a1977c0..491cc5f9756 100644
@@ -889,7 +889,7 @@ int kvm_arch_remove_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *bp)
     return 0;
 }
 
-static struct kvm_hw_breakpoint *find_hw_breakpoint(target_ulong addr,
+static struct kvm_hw_breakpoint *find_hw_breakpoint(vaddr addr,
                                                     int len, int type)
 {
     int n;
@@ -904,7 +904,7 @@ static struct kvm_hw_breakpoint *find_hw_breakpoint(target_ulong addr,
     return NULL;
 }
 
-static int insert_hw_breakpoint(target_ulong addr, int len, int type)
+static int insert_hw_breakpoint(vaddr addr, int len, int type)
 {
     int size;
 
Signature · 1 line
2.49.0
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] target/s390x/kvm: Use vaddr in find/insert_hw_breakpoint()

Quoted 24 lines · Philippe Mathieu-Daudé

Since commit b8a6eb1862a both kvm_arch_insert_hw_breakpoint() and kvm_arch_remove_hw_breakpoint() use a vaddr type. Use the same type for the callees.

Fixes b8a6eb1862a ("sysemu/kvm: Use vaddr for kvm_arch_[insert|remove]_hw_breakpoint")
---
  target/s390x/kvm/kvm.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
target/s390x/kvm/kvm.c +1 -1
index 67d9a1977c0..491cc5f9756 100644
@@ -889,7 +889,7 @@ int kvm_arch_remove_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *bp)
      return 0;
  }
 
-static struct kvm_hw_breakpoint *find_hw_breakpoint(target_ulong addr,
+static struct kvm_hw_breakpoint *find_hw_breakpoint(vaddr addr,
                                                      int len, int type)
  {
      int n;

target/s390x/kvm/kvm.c static struct kvm_hw_breakpoint *find_hw_breakpoint(target_ulong addr, · line 910

Quoted 8 lines
target/s390x/kvm/kvm.c +1 -1
@@ -904,7 +904,7 @@ static struct kvm_hw_breakpoint *find_hw_breakpoint(target_ulong addr,
      return NULL;
  }
 
-static int insert_hw_breakpoint(target_ulong addr, int len, int type)
+static int insert_hw_breakpoint(vaddr addr, int len, int type)
  {
      int size;
 

r~

#3 lore raw

PATCH 2/2 target/s390x/tcg: Use vaddr in s390_probe_access()

In reply to Philippe Mathieu-Daudé

Commit 70ebd9ce1cb ("s390x/tcg: Fault-safe memset") passed vaddr type to access_prepare(), and commit b6c636f2cd6 ("s390x/tcg: Fault-safe memmove") to do_access_get_byte(), but declared S390Access::vaddr[1,2] as target_ulong. Directly declare these as vaddr type, and have s390_probe_access() use that type as argument.

---
 target/s390x/tcg/mem_helper.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
target/s390x/tcg/mem_helper.c +5 -5
index a03609a1406..f1acb1618f7 100644
@@ -126,8 +126,8 @@ static inline void cpu_stsize_data_ra(CPUS390XState *env, uint64_t addr,
 
 /* An access covers at most 4096 bytes and therefore at most two pages. */
 typedef struct S390Access {
-    target_ulong vaddr1;
-    target_ulong vaddr2;
+    vaddr vaddr1;
+    vaddr vaddr2;
     void *haddr1;
     void *haddr2;
     uint16_t size1;
@@ -148,7 +148,7 @@ typedef struct S390Access {
  * For !CONFIG_USER_ONLY, the TEC is stored stored to env->tlb_fill_tec.
  * For CONFIG_USER_ONLY, the faulting address is stored to env->__excp_addr.
  */
-static inline int s390_probe_access(CPUArchState *env, target_ulong addr,
+static inline int s390_probe_access(CPUArchState *env, vaddr addr,
                                     int size, MMUAccessType access_type,
                                     int mmu_idx, bool nonfault,
                                     void **phost, uintptr_t ra)
@@ -258,7 +258,7 @@ static void access_memset(CPUS390XState *env, S390Access *desta,
 static uint8_t access_get_byte(CPUS390XState *env, S390Access *access,
                                int offset, uintptr_t ra)
 {
-    target_ulong vaddr = access->vaddr1;
+    vaddr vaddr = access->vaddr1;
     void *haddr = access->haddr1;
 
     if (unlikely(offset >= access->size1)) {
@@ -278,7 +278,7 @@ static uint8_t access_get_byte(CPUS390XState *env, S390Access *access,
 static void access_set_byte(CPUS390XState *env, S390Access *access,
                             int offset, uint8_t byte, uintptr_t ra)
 {
-    target_ulong vaddr = access->vaddr1;
+    vaddr vaddr = access->vaddr1;
     void *haddr = access->haddr1;
 
     if (unlikely(offset >= access->size1)) {
Signature · 1 line
2.49.0
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] target/s390x/tcg: Use vaddr in s390_probe_access()

Quoted 46 lines · Philippe Mathieu-Daudé

Commit 70ebd9ce1cb ("s390x/tcg: Fault-safe memset") passed vaddr type to access_prepare(), and commit b6c636f2cd6 ("s390x/tcg: Fault-safe memmove") to do_access_get_byte(), but declared S390Access::vaddr[1,2] as target_ulong. Directly declare these as vaddr type, and have s390_probe_access() use that type as argument.

---
  target/s390x/tcg/mem_helper.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
target/s390x/tcg/mem_helper.c +4 -4
index a03609a1406..f1acb1618f7 100644
@@ -126,8 +126,8 @@ static inline void cpu_stsize_data_ra(CPUS390XState *env, uint64_t addr,
 
  /* An access covers at most 4096 bytes and therefore at most two pages. */
  typedef struct S390Access {
-    target_ulong vaddr1;
-    target_ulong vaddr2;
+    vaddr vaddr1;
+    vaddr vaddr2;
      void *haddr1;
      void *haddr2;
      uint16_t size1;
@@ -148,7 +148,7 @@ typedef struct S390Access {
   * For !CONFIG_USER_ONLY, the TEC is stored stored to env->tlb_fill_tec.
   * For CONFIG_USER_ONLY, the faulting address is stored to env->__excp_addr.
   */
-static inline int s390_probe_access(CPUArchState *env, target_ulong addr,
+static inline int s390_probe_access(CPUArchState *env, vaddr addr,
                                      int size, MMUAccessType access_type,
                                      int mmu_idx, bool nonfault,
                                      void **phost, uintptr_t ra)
@@ -258,7 +258,7 @@ static void access_memset(CPUS390XState *env, S390Access *desta,
  static uint8_t access_get_byte(CPUS390XState *env, S390Access *access,
                                 int offset, uintptr_t ra)
  {
-    target_ulong vaddr = access->vaddr1;
+    vaddr vaddr = access->vaddr1;
      void *haddr = access->haddr1;
 
      if (unlikely(offset >= access->size1)) {

target/s390x/tcg/mem_helper.c static uint8_t access_get_byte(CPUS390XState *env, S390Access *access, · line 284

Quoted 8 lines
target/s390x/tcg/mem_helper.c +1 -1
@@ -278,7 +278,7 @@ static uint8_t access_get_byte(CPUS390XState *env, S390Access *access,
  static void access_set_byte(CPUS390XState *env, S390Access *access,
                              int offset, uint8_t byte, uintptr_t ra)
  {
-    target_ulong vaddr = access->vaddr1;
+    vaddr vaddr = access->vaddr1;
      void *haddr = access->haddr1;
 
      if (unlikely(offset >= access->size1)) {

r~