* [PATCH 0/9] Replace remaining target_ulong in system-mode accel
@ 2023-07-21 20:58 Anton Johansson via
2023-07-21 20:58 ` [PATCH 1/9] accel/kvm: Widen pc/saved_insn for kvm_sw_breakpoint Anton Johansson via
` (8 more replies)
0 siblings, 9 replies; 19+ messages in thread
From: Anton Johansson via @ 2023-07-21 20:58 UTC (permalink / raw)
To: qemu-devel
Cc: ale, richard.henderson, pbonzini, philmd, agraf, dirty,
rbolshakov, anielhb413, pasic, borntraeger, palmer,
alistair.francis, bin.meng, ysato, peter.maydell
This patchset replaces the remaining uses of target_ulong in the accel/
directory. Specifically, the address type of a few kvm/hvf functions
is widened to vaddr, and the address type of the cpu_[st|ld]*()
functions is changed to abi_ptr (which is re-typedef'd to vaddr in
system mode).
As a starting point, my goal is to be able to build cputlb.c once for
system mode, and this is a step in that direction by reducing the
target-dependence of accel/.
Anton Johansson (9):
accel/kvm: Widen pc/saved_insn for kvm_sw_breakpoint
accel/hvf: Widen pc/saved_insn for hvf_sw_breakpoint
target: Use vaddr for kvm_arch_[insert|remove]_hw_breakpoint
target: Use vaddr for hvf_arch_[insert|remove]_hw_breakpoint
Replace target_ulong with abi_ptr in cpu_[st|ld]*()
include/exec: typedef abi_ptr to vaddr in softmmu
include/exec: Widen tlb_hit/tlb_hit_page()
accel/tcg: Widen address arg. in tlb_compare_set()
accel/tcg: Update run_on_cpu_data static assert
accel/tcg/atomic_template.h | 16 ++++++++--------
include/exec/cpu-all.h | 4 ++--
include/exec/cpu_ldst.h | 28 ++++++++++++++--------------
include/sysemu/hvf.h | 12 +++++-------
include/sysemu/kvm.h | 12 +++++-------
accel/hvf/hvf-accel-ops.c | 4 ++--
accel/hvf/hvf-all.c | 2 +-
accel/kvm/kvm-all.c | 3 +--
accel/tcg/cputlb.c | 17 +++++++++--------
target/arm/hvf/hvf.c | 14 ++++++++------
target/arm/kvm64.c | 16 ++++++++--------
target/i386/hvf/hvf.c | 4 ++--
target/i386/kvm/kvm.c | 15 +++++++--------
target/ppc/kvm.c | 15 +++++++--------
target/riscv/vector_helper.c | 2 +-
target/rx/op_helper.c | 6 +++---
target/s390x/kvm/kvm.c | 11 +++++------
17 files changed, 88 insertions(+), 93 deletions(-)
--
2.41.0
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 1/9] accel/kvm: Widen pc/saved_insn for kvm_sw_breakpoint
2023-07-21 20:58 [PATCH 0/9] Replace remaining target_ulong in system-mode accel Anton Johansson via
@ 2023-07-21 20:58 ` Anton Johansson via
2023-07-27 19:21 ` Richard Henderson
2023-07-21 20:58 ` [PATCH 2/9] accel/hvf: Widen pc/saved_insn for hvf_sw_breakpoint Anton Johansson via
` (7 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Anton Johansson via @ 2023-07-21 20:58 UTC (permalink / raw)
To: qemu-devel
Cc: ale, richard.henderson, pbonzini, philmd, agraf, dirty,
rbolshakov, anielhb413, pasic, borntraeger, palmer,
alistair.francis, bin.meng, ysato, peter.maydell
Widens the pc and saved_insn fields of kvm_sw_breakpoint from
target_ulong to vaddr. The pc argument of kvm_find_sw_breakpoint is also
widened to match.
Signed-off-by: Anton Johansson <anjo@rev.ng>
---
include/sysemu/kvm.h | 6 +++---
accel/kvm/kvm-all.c | 3 +--
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 115f0cca79..5670306dbf 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -411,14 +411,14 @@ struct kvm_guest_debug;
struct kvm_debug_exit_arch;
struct kvm_sw_breakpoint {
- target_ulong pc;
- target_ulong saved_insn;
+ vaddr pc;
+ vaddr saved_insn;
int use_count;
QTAILQ_ENTRY(kvm_sw_breakpoint) entry;
};
struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUState *cpu,
- target_ulong pc);
+ vaddr pc);
int kvm_sw_breakpoints_active(CPUState *cpu);
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 373d876c05..3a5f71b48a 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -3306,8 +3306,7 @@ bool kvm_arm_supports_user_irq(void)
}
#ifdef KVM_CAP_SET_GUEST_DEBUG
-struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUState *cpu,
- target_ulong pc)
+struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUState *cpu, vaddr pc)
{
struct kvm_sw_breakpoint *bp;
--
2.41.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 2/9] accel/hvf: Widen pc/saved_insn for hvf_sw_breakpoint
2023-07-21 20:58 [PATCH 0/9] Replace remaining target_ulong in system-mode accel Anton Johansson via
2023-07-21 20:58 ` [PATCH 1/9] accel/kvm: Widen pc/saved_insn for kvm_sw_breakpoint Anton Johansson via
@ 2023-07-21 20:58 ` Anton Johansson via
2023-07-27 19:25 ` Richard Henderson
2023-07-21 20:58 ` [PATCH 3/9] target: Use vaddr for kvm_arch_[insert|remove]_hw_breakpoint Anton Johansson via
` (6 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Anton Johansson via @ 2023-07-21 20:58 UTC (permalink / raw)
To: qemu-devel
Cc: ale, richard.henderson, pbonzini, philmd, agraf, dirty,
rbolshakov, anielhb413, pasic, borntraeger, palmer,
alistair.francis, bin.meng, ysato, peter.maydell
Widens the pc and saved_insn fields of hvf_sw_breakpoint from
target_ulong to vaddr. Other hvf_* functions accessing hvf_sw_breakpoint
are also widened to match.
Signed-off-by: Anton Johansson <anjo@rev.ng>
---
include/sysemu/hvf.h | 6 +++---
accel/hvf/hvf-accel-ops.c | 4 ++--
accel/hvf/hvf-all.c | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/sysemu/hvf.h b/include/sysemu/hvf.h
index 70549b9158..4cbae87ced 100644
--- a/include/sysemu/hvf.h
+++ b/include/sysemu/hvf.h
@@ -39,14 +39,14 @@ DECLARE_INSTANCE_CHECKER(HVFState, HVF_STATE,
#ifdef NEED_CPU_H
struct hvf_sw_breakpoint {
- target_ulong pc;
- target_ulong saved_insn;
+ vaddr pc;
+ vaddr saved_insn;
int use_count;
QTAILQ_ENTRY(hvf_sw_breakpoint) entry;
};
struct hvf_sw_breakpoint *hvf_find_sw_breakpoint(CPUState *cpu,
- target_ulong pc);
+ vaddr pc);
int hvf_sw_breakpoints_active(CPUState *cpu);
int hvf_arch_insert_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp);
diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c
index a44cf1c144..3c94c79747 100644
--- a/accel/hvf/hvf-accel-ops.c
+++ b/accel/hvf/hvf-accel-ops.c
@@ -474,7 +474,7 @@ static void hvf_start_vcpu_thread(CPUState *cpu)
cpu, QEMU_THREAD_JOINABLE);
}
-static int hvf_insert_breakpoint(CPUState *cpu, int type, hwaddr addr, hwaddr len)
+static int hvf_insert_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
{
struct hvf_sw_breakpoint *bp;
int err;
@@ -512,7 +512,7 @@ static int hvf_insert_breakpoint(CPUState *cpu, int type, hwaddr addr, hwaddr le
return 0;
}
-static int hvf_remove_breakpoint(CPUState *cpu, int type, hwaddr addr, hwaddr len)
+static int hvf_remove_breakpoint(CPUState *cpu, int type, vaddr addr, vaddr len)
{
struct hvf_sw_breakpoint *bp;
int err;
diff --git a/accel/hvf/hvf-all.c b/accel/hvf/hvf-all.c
index 4920787af6..db05b81be5 100644
--- a/accel/hvf/hvf-all.c
+++ b/accel/hvf/hvf-all.c
@@ -51,7 +51,7 @@ void assert_hvf_ok(hv_return_t ret)
abort();
}
-struct hvf_sw_breakpoint *hvf_find_sw_breakpoint(CPUState *cpu, target_ulong pc)
+struct hvf_sw_breakpoint *hvf_find_sw_breakpoint(CPUState *cpu, vaddr pc)
{
struct hvf_sw_breakpoint *bp;
--
2.41.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 3/9] target: Use vaddr for kvm_arch_[insert|remove]_hw_breakpoint
2023-07-21 20:58 [PATCH 0/9] Replace remaining target_ulong in system-mode accel Anton Johansson via
2023-07-21 20:58 ` [PATCH 1/9] accel/kvm: Widen pc/saved_insn for kvm_sw_breakpoint Anton Johansson via
2023-07-21 20:58 ` [PATCH 2/9] accel/hvf: Widen pc/saved_insn for hvf_sw_breakpoint Anton Johansson via
@ 2023-07-21 20:58 ` Anton Johansson via
2023-07-27 19:27 ` Richard Henderson
2023-07-21 20:58 ` [PATCH 4/9] target: Use vaddr for hvf_arch_[insert|remove]_hw_breakpoint Anton Johansson via
` (5 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Anton Johansson via @ 2023-07-21 20:58 UTC (permalink / raw)
To: qemu-devel
Cc: ale, richard.henderson, pbonzini, philmd, agraf, dirty,
rbolshakov, anielhb413, pasic, borntraeger, palmer,
alistair.francis, bin.meng, ysato, peter.maydell
Changes the signature of the target-defined functions for
inserting/removing kvm hw breakpoints. The address and length arguments
are now of vaddr type, which both matches the type used internally in
accel/kvm/kvm-all.c and makes the api target-agnostic.
Signed-off-by: Anton Johansson <anjo@rev.ng>
---
include/sysemu/kvm.h | 6 ++----
target/arm/kvm64.c | 16 ++++++++--------
target/i386/kvm/kvm.c | 15 +++++++--------
target/ppc/kvm.c | 15 +++++++--------
target/s390x/kvm/kvm.c | 11 +++++------
5 files changed, 29 insertions(+), 34 deletions(-)
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 5670306dbf..19d87b20e8 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -426,10 +426,8 @@ int kvm_arch_insert_sw_breakpoint(CPUState *cpu,
struct kvm_sw_breakpoint *bp);
int kvm_arch_remove_sw_breakpoint(CPUState *cpu,
struct kvm_sw_breakpoint *bp);
-int kvm_arch_insert_hw_breakpoint(target_ulong addr,
- target_ulong len, int type);
-int kvm_arch_remove_hw_breakpoint(target_ulong addr,
- target_ulong len, int type);
+int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type);
+int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type);
void kvm_arch_remove_all_hw_breakpoints(void);
void kvm_arch_update_guest_debug(CPUState *cpu, struct kvm_guest_debug *dbg);
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
index 94bbd9661f..c0750792cb 100644
--- a/target/arm/kvm64.c
+++ b/target/arm/kvm64.c
@@ -49,32 +49,32 @@ void kvm_arm_init_debug(KVMState *s)
return;
}
-int kvm_arch_insert_hw_breakpoint(target_ulong addr,
- target_ulong len, int type)
+int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
{
switch (type) {
case GDB_BREAKPOINT_HW:
- return insert_hw_breakpoint(addr);
+ return insert_hw_breakpoint((target_ulong) addr);
break;
case GDB_WATCHPOINT_READ:
case GDB_WATCHPOINT_WRITE:
case GDB_WATCHPOINT_ACCESS:
- return insert_hw_watchpoint(addr, len, type);
+ return insert_hw_watchpoint((target_ulong) addr,
+ (target_ulong) len, type);
default:
return -ENOSYS;
}
}
-int kvm_arch_remove_hw_breakpoint(target_ulong addr,
- target_ulong len, int type)
+int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
{
switch (type) {
case GDB_BREAKPOINT_HW:
- return delete_hw_breakpoint(addr);
+ return delete_hw_breakpoint((target_ulong) addr);
case GDB_WATCHPOINT_READ:
case GDB_WATCHPOINT_WRITE:
case GDB_WATCHPOINT_ACCESS:
- return delete_hw_watchpoint(addr, len, type);
+ return delete_hw_watchpoint((target_ulong) addr,
+ (target_ulong) len, type);
default:
return -ENOSYS;
}
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index ebfaf3d24c..4c237083e5 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -4995,7 +4995,7 @@ MemTxAttrs kvm_arch_post_run(CPUState *cpu, struct kvm_run *run)
kvm_rate_limit_on_bus_lock();
}
-#ifdef CONFIG_XEN_EMU
+#ifdef CONFIG_XEN_EMU
/*
* If the callback is asserted as a GSI (or PCI INTx) then check if
* vcpu_info->evtchn_upcall_pending has been cleared, and deassert
@@ -5156,8 +5156,7 @@ static int find_hw_breakpoint(target_ulong addr, int len, int type)
return -1;
}
-int kvm_arch_insert_hw_breakpoint(target_ulong addr,
- target_ulong len, int type)
+int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
{
switch (type) {
case GDB_BREAKPOINT_HW:
@@ -5189,20 +5188,20 @@ int kvm_arch_insert_hw_breakpoint(target_ulong addr,
if (find_hw_breakpoint(addr, len, type) >= 0) {
return -EEXIST;
}
- hw_breakpoint[nb_hw_breakpoint].addr = addr;
- hw_breakpoint[nb_hw_breakpoint].len = len;
+ hw_breakpoint[nb_hw_breakpoint].addr = (target_ulong) addr;
+ hw_breakpoint[nb_hw_breakpoint].len = (int) len;
hw_breakpoint[nb_hw_breakpoint].type = type;
nb_hw_breakpoint++;
return 0;
}
-int kvm_arch_remove_hw_breakpoint(target_ulong addr,
- target_ulong len, int type)
+int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
{
int n;
- n = find_hw_breakpoint(addr, (type == GDB_BREAKPOINT_HW) ? 1 : len, type);
+ n = find_hw_breakpoint((target_ulong) addr,
+ (type == GDB_BREAKPOINT_HW) ? 1 : len, type);
if (n < 0) {
return -ENOENT;
}
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index a8a935e267..7ff88d341a 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -1444,15 +1444,15 @@ static int find_hw_watchpoint(target_ulong addr, int *flag)
return -1;
}
-int kvm_arch_insert_hw_breakpoint(target_ulong addr,
- target_ulong len, int type)
+int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
{
- if ((nb_hw_breakpoint + nb_hw_watchpoint) >= ARRAY_SIZE(hw_debug_points)) {
+ const unsigned breakpoint_index = nb_hw_breakpoint + nb_hw_watchpoint;
+ if (breakpoint_index >= ARRAY_SIZE(hw_debug_points)) {
return -ENOBUFS;
}
- hw_debug_points[nb_hw_breakpoint + nb_hw_watchpoint].addr = addr;
- hw_debug_points[nb_hw_breakpoint + nb_hw_watchpoint].type = type;
+ hw_debug_points[breakpoint_index].addr = (target_ulong) addr;
+ hw_debug_points[breakpoint_index].type = type;
switch (type) {
case GDB_BREAKPOINT_HW:
@@ -1488,12 +1488,11 @@ int kvm_arch_insert_hw_breakpoint(target_ulong addr,
return 0;
}
-int kvm_arch_remove_hw_breakpoint(target_ulong addr,
- target_ulong len, int type)
+int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
{
int n;
- n = find_hw_breakpoint(addr, type);
+ n = find_hw_breakpoint((target_ulong) addr, type);
if (n < 0) {
return -ENOENT;
}
diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
index a9e5880349..c7c96b4198 100644
--- a/target/s390x/kvm/kvm.c
+++ b/target/s390x/kvm/kvm.c
@@ -995,8 +995,7 @@ static int insert_hw_breakpoint(target_ulong addr, int len, int type)
return 0;
}
-int kvm_arch_insert_hw_breakpoint(target_ulong addr,
- target_ulong len, int type)
+int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
{
switch (type) {
case GDB_BREAKPOINT_HW:
@@ -1011,14 +1010,14 @@ int kvm_arch_insert_hw_breakpoint(target_ulong addr,
default:
return -ENOSYS;
}
- return insert_hw_breakpoint(addr, len, type);
+ return insert_hw_breakpoint((target_ulong) addr, (target_ulong) len, type);
}
-int kvm_arch_remove_hw_breakpoint(target_ulong addr,
- target_ulong len, int type)
+int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
{
int size;
- struct kvm_hw_breakpoint *bp = find_hw_breakpoint(addr, len, type);
+ struct kvm_hw_breakpoint *bp = find_hw_breakpoint((target_ulong) addr,
+ (target_ulong) len, type);
if (bp == NULL) {
return -ENOENT;
--
2.41.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 4/9] target: Use vaddr for hvf_arch_[insert|remove]_hw_breakpoint
2023-07-21 20:58 [PATCH 0/9] Replace remaining target_ulong in system-mode accel Anton Johansson via
` (2 preceding siblings ...)
2023-07-21 20:58 ` [PATCH 3/9] target: Use vaddr for kvm_arch_[insert|remove]_hw_breakpoint Anton Johansson via
@ 2023-07-21 20:58 ` Anton Johansson via
2023-07-27 19:29 ` Richard Henderson
2023-07-21 20:58 ` [PATCH 5/9] Replace target_ulong with abi_ptr in cpu_[st|ld]*() Anton Johansson via
` (4 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Anton Johansson via @ 2023-07-21 20:58 UTC (permalink / raw)
To: qemu-devel
Cc: ale, richard.henderson, pbonzini, philmd, agraf, dirty,
rbolshakov, anielhb413, pasic, borntraeger, palmer,
alistair.francis, bin.meng, ysato, peter.maydell
Changes the signature of the target-defined functions for
inserting/removing hvf hw breakpoints. The address and length arguments
are now of vaddr type, which both matches the type used internally in
accel/hvf/hvf-all.c and makes the api target-agnostic.
Signed-off-by: Anton Johansson <anjo@rev.ng>
---
include/sysemu/hvf.h | 6 ++----
target/arm/hvf/hvf.c | 14 ++++++++------
target/i386/hvf/hvf.c | 4 ++--
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/include/sysemu/hvf.h b/include/sysemu/hvf.h
index 4cbae87ced..4037cd6a73 100644
--- a/include/sysemu/hvf.h
+++ b/include/sysemu/hvf.h
@@ -51,10 +51,8 @@ int hvf_sw_breakpoints_active(CPUState *cpu);
int hvf_arch_insert_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp);
int hvf_arch_remove_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp);
-int hvf_arch_insert_hw_breakpoint(target_ulong addr, target_ulong len,
- int type);
-int hvf_arch_remove_hw_breakpoint(target_ulong addr, target_ulong len,
- int type);
+int hvf_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type);
+int hvf_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type);
void hvf_arch_remove_all_hw_breakpoints(void);
/*
diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index 8fce64bbf6..f8649bdb1b 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -2063,29 +2063,31 @@ int hvf_arch_remove_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp)
return 0;
}
-int hvf_arch_insert_hw_breakpoint(target_ulong addr, target_ulong len, int type)
+int hvf_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
{
switch (type) {
case GDB_BREAKPOINT_HW:
- return insert_hw_breakpoint(addr);
+ return insert_hw_breakpoint((target_ulong) addr);
case GDB_WATCHPOINT_READ:
case GDB_WATCHPOINT_WRITE:
case GDB_WATCHPOINT_ACCESS:
- return insert_hw_watchpoint(addr, len, type);
+ return insert_hw_watchpoint((target_ulong) addr,
+ (target_ulong) len, type);
default:
return -ENOSYS;
}
}
-int hvf_arch_remove_hw_breakpoint(target_ulong addr, target_ulong len, int type)
+int hvf_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
{
switch (type) {
case GDB_BREAKPOINT_HW:
- return delete_hw_breakpoint(addr);
+ return delete_hw_breakpoint((target_ulong) addr);
case GDB_WATCHPOINT_READ:
case GDB_WATCHPOINT_WRITE:
case GDB_WATCHPOINT_ACCESS:
- return delete_hw_watchpoint(addr, len, type);
+ return delete_hw_watchpoint((target_ulong) addr,
+ (target_ulong) len, type);
default:
return -ENOSYS;
}
diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c
index b9cbcc02a8..cb2cd0b02f 100644
--- a/target/i386/hvf/hvf.c
+++ b/target/i386/hvf/hvf.c
@@ -690,12 +690,12 @@ int hvf_arch_remove_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp)
return -ENOSYS;
}
-int hvf_arch_insert_hw_breakpoint(target_ulong addr, target_ulong len, int type)
+int hvf_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
{
return -ENOSYS;
}
-int hvf_arch_remove_hw_breakpoint(target_ulong addr, target_ulong len, int type)
+int hvf_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type)
{
return -ENOSYS;
}
--
2.41.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 5/9] Replace target_ulong with abi_ptr in cpu_[st|ld]*()
2023-07-21 20:58 [PATCH 0/9] Replace remaining target_ulong in system-mode accel Anton Johansson via
` (3 preceding siblings ...)
2023-07-21 20:58 ` [PATCH 4/9] target: Use vaddr for hvf_arch_[insert|remove]_hw_breakpoint Anton Johansson via
@ 2023-07-21 20:58 ` Anton Johansson via
2023-07-27 23:48 ` Richard Henderson
2023-07-21 20:58 ` [PATCH 6/9] include/exec: typedef abi_ptr to vaddr in softmmu Anton Johansson via
` (3 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Anton Johansson via @ 2023-07-21 20:58 UTC (permalink / raw)
To: qemu-devel
Cc: ale, richard.henderson, pbonzini, philmd, agraf, dirty,
rbolshakov, anielhb413, pasic, borntraeger, palmer,
alistair.francis, bin.meng, ysato, peter.maydell
Changes the address type of the guest memory read/write functions from
target_ulong to abi_ptr. (abi_ptr is currently typedef'd to target_ulong
but that will change in a following commit.) This will reduce the
coupling between accel/ and target/.
Note: Function pointers that point to cpu_[st|ld]*() in target/riscv and
target/rx are also updated in this commit.
Signed-off-by: Anton Johansson <anjo@rev.ng>
---
accel/tcg/atomic_template.h | 16 ++++++++--------
include/exec/cpu_ldst.h | 24 ++++++++++++------------
accel/tcg/cputlb.c | 10 +++++-----
target/riscv/vector_helper.c | 2 +-
target/rx/op_helper.c | 6 +++---
5 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/accel/tcg/atomic_template.h b/accel/tcg/atomic_template.h
index e312acd16d..84c08b1425 100644
--- a/accel/tcg/atomic_template.h
+++ b/accel/tcg/atomic_template.h
@@ -69,7 +69,7 @@
# define END _le
#endif
-ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, target_ulong addr,
+ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, abi_ptr addr,
ABI_TYPE cmpv, ABI_TYPE newv,
MemOpIdx oi, uintptr_t retaddr)
{
@@ -87,7 +87,7 @@ ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, target_ulong addr,
}
#if DATA_SIZE < 16
-ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, target_ulong addr, ABI_TYPE val,
+ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, abi_ptr addr, ABI_TYPE val,
MemOpIdx oi, uintptr_t retaddr)
{
DATA_TYPE *haddr = atomic_mmu_lookup(env, addr, oi, DATA_SIZE, retaddr);
@@ -100,7 +100,7 @@ ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, target_ulong addr, ABI_TYPE val,
}
#define GEN_ATOMIC_HELPER(X) \
-ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr, \
+ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, abi_ptr addr, \
ABI_TYPE val, MemOpIdx oi, uintptr_t retaddr) \
{ \
DATA_TYPE *haddr, ret; \
@@ -131,7 +131,7 @@ GEN_ATOMIC_HELPER(xor_fetch)
* of CF_PARALLEL's value, we'll trace just a read and a write.
*/
#define GEN_ATOMIC_HELPER_FN(X, FN, XDATA_TYPE, RET) \
-ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr, \
+ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, abi_ptr addr, \
ABI_TYPE xval, MemOpIdx oi, uintptr_t retaddr) \
{ \
XDATA_TYPE *haddr, cmp, old, new, val = xval; \
@@ -172,7 +172,7 @@ GEN_ATOMIC_HELPER_FN(umax_fetch, MAX, DATA_TYPE, new)
# define END _be
#endif
-ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, target_ulong addr,
+ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, abi_ptr addr,
ABI_TYPE cmpv, ABI_TYPE newv,
MemOpIdx oi, uintptr_t retaddr)
{
@@ -190,7 +190,7 @@ ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, target_ulong addr,
}
#if DATA_SIZE < 16
-ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, target_ulong addr, ABI_TYPE val,
+ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, abi_ptr addr, ABI_TYPE val,
MemOpIdx oi, uintptr_t retaddr)
{
DATA_TYPE *haddr = atomic_mmu_lookup(env, addr, oi, DATA_SIZE, retaddr);
@@ -203,7 +203,7 @@ ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, target_ulong addr, ABI_TYPE val,
}
#define GEN_ATOMIC_HELPER(X) \
-ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr, \
+ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, abi_ptr addr, \
ABI_TYPE val, MemOpIdx oi, uintptr_t retaddr) \
{ \
DATA_TYPE *haddr, ret; \
@@ -231,7 +231,7 @@ GEN_ATOMIC_HELPER(xor_fetch)
* of CF_PARALLEL's value, we'll trace just a read and a write.
*/
#define GEN_ATOMIC_HELPER_FN(X, FN, XDATA_TYPE, RET) \
-ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, target_ulong addr, \
+ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, abi_ptr addr, \
ABI_TYPE xval, MemOpIdx oi, uintptr_t retaddr) \
{ \
XDATA_TYPE *haddr, ldo, ldn, old, new, val = xval; \
diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h
index 645476f0e5..da10ba1433 100644
--- a/include/exec/cpu_ldst.h
+++ b/include/exec/cpu_ldst.h
@@ -223,31 +223,31 @@ void cpu_stq_mmu(CPUArchState *env, abi_ptr ptr, uint64_t val,
void cpu_st16_mmu(CPUArchState *env, abi_ptr addr, Int128 val,
MemOpIdx oi, uintptr_t ra);
-uint32_t cpu_atomic_cmpxchgb_mmu(CPUArchState *env, target_ulong addr,
+uint32_t cpu_atomic_cmpxchgb_mmu(CPUArchState *env, abi_ptr addr,
uint32_t cmpv, uint32_t newv,
MemOpIdx oi, uintptr_t retaddr);
-uint32_t cpu_atomic_cmpxchgw_le_mmu(CPUArchState *env, target_ulong addr,
+uint32_t cpu_atomic_cmpxchgw_le_mmu(CPUArchState *env, abi_ptr addr,
uint32_t cmpv, uint32_t newv,
MemOpIdx oi, uintptr_t retaddr);
-uint32_t cpu_atomic_cmpxchgl_le_mmu(CPUArchState *env, target_ulong addr,
+uint32_t cpu_atomic_cmpxchgl_le_mmu(CPUArchState *env, abi_ptr addr,
uint32_t cmpv, uint32_t newv,
MemOpIdx oi, uintptr_t retaddr);
-uint64_t cpu_atomic_cmpxchgq_le_mmu(CPUArchState *env, target_ulong addr,
+uint64_t cpu_atomic_cmpxchgq_le_mmu(CPUArchState *env, abi_ptr addr,
uint64_t cmpv, uint64_t newv,
MemOpIdx oi, uintptr_t retaddr);
-uint32_t cpu_atomic_cmpxchgw_be_mmu(CPUArchState *env, target_ulong addr,
+uint32_t cpu_atomic_cmpxchgw_be_mmu(CPUArchState *env, abi_ptr addr,
uint32_t cmpv, uint32_t newv,
MemOpIdx oi, uintptr_t retaddr);
-uint32_t cpu_atomic_cmpxchgl_be_mmu(CPUArchState *env, target_ulong addr,
+uint32_t cpu_atomic_cmpxchgl_be_mmu(CPUArchState *env, abi_ptr addr,
uint32_t cmpv, uint32_t newv,
MemOpIdx oi, uintptr_t retaddr);
-uint64_t cpu_atomic_cmpxchgq_be_mmu(CPUArchState *env, target_ulong addr,
+uint64_t cpu_atomic_cmpxchgq_be_mmu(CPUArchState *env, abi_ptr addr,
uint64_t cmpv, uint64_t newv,
MemOpIdx oi, uintptr_t retaddr);
-#define GEN_ATOMIC_HELPER(NAME, TYPE, SUFFIX) \
-TYPE cpu_atomic_ ## NAME ## SUFFIX ## _mmu \
- (CPUArchState *env, target_ulong addr, TYPE val, \
+#define GEN_ATOMIC_HELPER(NAME, TYPE, SUFFIX) \
+TYPE cpu_atomic_ ## NAME ## SUFFIX ## _mmu \
+ (CPUArchState *env, abi_ptr addr, TYPE val, \
MemOpIdx oi, uintptr_t retaddr);
#ifdef CONFIG_ATOMIC64
@@ -293,10 +293,10 @@ GEN_ATOMIC_HELPER_ALL(xchg)
#undef GEN_ATOMIC_HELPER_ALL
#undef GEN_ATOMIC_HELPER
-Int128 cpu_atomic_cmpxchgo_le_mmu(CPUArchState *env, target_ulong addr,
+Int128 cpu_atomic_cmpxchgo_le_mmu(CPUArchState *env, abi_ptr addr,
Int128 cmpv, Int128 newv,
MemOpIdx oi, uintptr_t retaddr);
-Int128 cpu_atomic_cmpxchgo_be_mmu(CPUArchState *env, target_ulong addr,
+Int128 cpu_atomic_cmpxchgo_be_mmu(CPUArchState *env, abi_ptr addr,
Int128 cmpv, Int128 newv,
MemOpIdx oi, uintptr_t retaddr);
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index e0079c9a9d..8e9dc51cd1 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -3038,14 +3038,14 @@ static void plugin_store_cb(CPUArchState *env, abi_ptr addr, MemOpIdx oi)
qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, oi, QEMU_PLUGIN_MEM_W);
}
-void cpu_stb_mmu(CPUArchState *env, target_ulong addr, uint8_t val,
+void cpu_stb_mmu(CPUArchState *env, abi_ptr addr, uint8_t val,
MemOpIdx oi, uintptr_t retaddr)
{
helper_stb_mmu(env, addr, val, oi, retaddr);
plugin_store_cb(env, addr, oi);
}
-void cpu_stw_mmu(CPUArchState *env, target_ulong addr, uint16_t val,
+void cpu_stw_mmu(CPUArchState *env, abi_ptr addr, uint16_t val,
MemOpIdx oi, uintptr_t retaddr)
{
tcg_debug_assert((get_memop(oi) & MO_SIZE) == MO_16);
@@ -3053,7 +3053,7 @@ void cpu_stw_mmu(CPUArchState *env, target_ulong addr, uint16_t val,
plugin_store_cb(env, addr, oi);
}
-void cpu_stl_mmu(CPUArchState *env, target_ulong addr, uint32_t val,
+void cpu_stl_mmu(CPUArchState *env, abi_ptr addr, uint32_t val,
MemOpIdx oi, uintptr_t retaddr)
{
tcg_debug_assert((get_memop(oi) & MO_SIZE) == MO_32);
@@ -3061,7 +3061,7 @@ void cpu_stl_mmu(CPUArchState *env, target_ulong addr, uint32_t val,
plugin_store_cb(env, addr, oi);
}
-void cpu_stq_mmu(CPUArchState *env, target_ulong addr, uint64_t val,
+void cpu_stq_mmu(CPUArchState *env, abi_ptr addr, uint64_t val,
MemOpIdx oi, uintptr_t retaddr)
{
tcg_debug_assert((get_memop(oi) & MO_SIZE) == MO_64);
@@ -3069,7 +3069,7 @@ void cpu_stq_mmu(CPUArchState *env, target_ulong addr, uint64_t val,
plugin_store_cb(env, addr, oi);
}
-void cpu_st16_mmu(CPUArchState *env, target_ulong addr, Int128 val,
+void cpu_st16_mmu(CPUArchState *env, abi_ptr addr, Int128 val,
MemOpIdx oi, uintptr_t retaddr)
{
tcg_debug_assert((get_memop(oi) & MO_SIZE) == MO_128);
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
index 4d06754826..bf7e0029a1 100644
--- a/target/riscv/vector_helper.c
+++ b/target/riscv/vector_helper.c
@@ -235,7 +235,7 @@ static inline int vext_elem_mask(void *v0, int index)
}
/* elements operations for load and store */
-typedef void vext_ldst_elem_fn(CPURISCVState *env, target_ulong addr,
+typedef void vext_ldst_elem_fn(CPURISCVState *env, abi_ptr addr,
uint32_t idx, void *vd, uintptr_t retaddr);
#define GEN_VEXT_LD_ELEM(NAME, ETYPE, H, LDSUF) \
diff --git a/target/rx/op_helper.c b/target/rx/op_helper.c
index dc0092ca99..691a12b2be 100644
--- a/target/rx/op_helper.c
+++ b/target/rx/op_helper.c
@@ -216,19 +216,19 @@ void helper_scmpu(CPURXState *env)
}
static uint32_t (* const cpu_ldufn[])(CPUArchState *env,
- target_ulong ptr,
+ abi_ptr ptr,
uintptr_t retaddr) = {
cpu_ldub_data_ra, cpu_lduw_data_ra, cpu_ldl_data_ra,
};
static uint32_t (* const cpu_ldfn[])(CPUArchState *env,
- target_ulong ptr,
+ abi_ptr ptr,
uintptr_t retaddr) = {
cpu_ldub_data_ra, cpu_lduw_data_ra, cpu_ldl_data_ra,
};
static void (* const cpu_stfn[])(CPUArchState *env,
- target_ulong ptr,
+ abi_ptr ptr,
uint32_t val,
uintptr_t retaddr) = {
cpu_stb_data_ra, cpu_stw_data_ra, cpu_stl_data_ra,
--
2.41.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 6/9] include/exec: typedef abi_ptr to vaddr in softmmu
2023-07-21 20:58 [PATCH 0/9] Replace remaining target_ulong in system-mode accel Anton Johansson via
` (4 preceding siblings ...)
2023-07-21 20:58 ` [PATCH 5/9] Replace target_ulong with abi_ptr in cpu_[st|ld]*() Anton Johansson via
@ 2023-07-21 20:58 ` Anton Johansson via
2023-07-27 23:51 ` Richard Henderson
2023-07-21 20:58 ` [PATCH 7/9] include/exec: Widen tlb_hit/tlb_hit_page() Anton Johansson via
` (2 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Anton Johansson via @ 2023-07-21 20:58 UTC (permalink / raw)
To: qemu-devel
Cc: ale, richard.henderson, pbonzini, philmd, agraf, dirty,
rbolshakov, anielhb413, pasic, borntraeger, palmer,
alistair.francis, bin.meng, ysato, peter.maydell
In system mode, abi_ptr is primarily used for representing addresses
when accessing guest memory with cpu_[st|ld]*(). Widening it from
target_ulong to vaddr reduces the target dependence of these functions
and is step towards building accel/ once for system mode.
Signed-off-by: Anton Johansson <anjo@rev.ng>
---
include/exec/cpu_ldst.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h
index da10ba1433..f3ce4eb1d0 100644
--- a/include/exec/cpu_ldst.h
+++ b/include/exec/cpu_ldst.h
@@ -121,8 +121,8 @@ static inline bool guest_range_valid_untagged(abi_ulong start, abi_ulong len)
h2g_nocheck(x); \
})
#else
-typedef target_ulong abi_ptr;
-#define TARGET_ABI_FMT_ptr TARGET_FMT_lx
+typedef vaddr abi_ptr;
+#define TARGET_ABI_FMT_ptr "%016" VADDR_PRIx
#endif
uint32_t cpu_ldub_data(CPUArchState *env, abi_ptr ptr);
--
2.41.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 7/9] include/exec: Widen tlb_hit/tlb_hit_page()
2023-07-21 20:58 [PATCH 0/9] Replace remaining target_ulong in system-mode accel Anton Johansson via
` (5 preceding siblings ...)
2023-07-21 20:58 ` [PATCH 6/9] include/exec: typedef abi_ptr to vaddr in softmmu Anton Johansson via
@ 2023-07-21 20:58 ` Anton Johansson via
2023-07-27 23:52 ` Richard Henderson
2023-07-21 20:58 ` [PATCH 8/9] accel/tcg: Widen address arg. in tlb_compare_set() Anton Johansson via
2023-07-21 20:58 ` [PATCH 9/9] accel/tcg: Update run_on_cpu_data static assert Anton Johansson via
8 siblings, 1 reply; 19+ messages in thread
From: Anton Johansson via @ 2023-07-21 20:58 UTC (permalink / raw)
To: qemu-devel
Cc: ale, richard.henderson, pbonzini, philmd, agraf, dirty,
rbolshakov, anielhb413, pasic, borntraeger, palmer,
alistair.francis, bin.meng, ysato, peter.maydell
tlb_addr is changed from target_ulong to uint64_t to match the type of
a CPUTLBEntry value, and the addressed is changed to vaddr.
Signed-off-by: Anton Johansson <anjo@rev.ng>
---
include/exec/cpu-all.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index 94f44f1f59..c2c62160c6 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -397,7 +397,7 @@ QEMU_BUILD_BUG_ON(TLB_FLAGS_MASK & TLB_SLOW_FLAGS_MASK);
* @addr: virtual address to test (must be page aligned)
* @tlb_addr: TLB entry address (a CPUTLBEntry addr_read/write/code value)
*/
-static inline bool tlb_hit_page(target_ulong tlb_addr, target_ulong addr)
+static inline bool tlb_hit_page(uint64_t tlb_addr, vaddr addr)
{
return addr == (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK));
}
@@ -408,7 +408,7 @@ static inline bool tlb_hit_page(target_ulong tlb_addr, target_ulong addr)
* @addr: virtual address to test (need not be page aligned)
* @tlb_addr: TLB entry address (a CPUTLBEntry addr_read/write/code value)
*/
-static inline bool tlb_hit(target_ulong tlb_addr, target_ulong addr)
+static inline bool tlb_hit(uint64_t tlb_addr, vaddr addr)
{
return tlb_hit_page(tlb_addr, addr & TARGET_PAGE_MASK);
}
--
2.41.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 8/9] accel/tcg: Widen address arg. in tlb_compare_set()
2023-07-21 20:58 [PATCH 0/9] Replace remaining target_ulong in system-mode accel Anton Johansson via
` (6 preceding siblings ...)
2023-07-21 20:58 ` [PATCH 7/9] include/exec: Widen tlb_hit/tlb_hit_page() Anton Johansson via
@ 2023-07-21 20:58 ` Anton Johansson via
2023-07-27 23:53 ` Richard Henderson
2023-07-21 20:58 ` [PATCH 9/9] accel/tcg: Update run_on_cpu_data static assert Anton Johansson via
8 siblings, 1 reply; 19+ messages in thread
From: Anton Johansson via @ 2023-07-21 20:58 UTC (permalink / raw)
To: qemu-devel
Cc: ale, richard.henderson, pbonzini, philmd, agraf, dirty,
rbolshakov, anielhb413, pasic, borntraeger, palmer,
alistair.francis, bin.meng, ysato, peter.maydell
Signed-off-by: Anton Johansson <anjo@rev.ng>
---
accel/tcg/cputlb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index 8e9dc51cd1..2f97ae2fda 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -1108,7 +1108,7 @@ static void tlb_add_large_page(CPUArchState *env, int mmu_idx,
}
static inline void tlb_set_compare(CPUTLBEntryFull *full, CPUTLBEntry *ent,
- target_ulong address, int flags,
+ vaddr address, int flags,
MMUAccessType access_type, bool enable)
{
if (enable) {
--
2.41.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 9/9] accel/tcg: Update run_on_cpu_data static assert
2023-07-21 20:58 [PATCH 0/9] Replace remaining target_ulong in system-mode accel Anton Johansson via
` (7 preceding siblings ...)
2023-07-21 20:58 ` [PATCH 8/9] accel/tcg: Widen address arg. in tlb_compare_set() Anton Johansson via
@ 2023-07-21 20:58 ` Anton Johansson via
2023-07-27 23:53 ` Richard Henderson
8 siblings, 1 reply; 19+ messages in thread
From: Anton Johansson via @ 2023-07-21 20:58 UTC (permalink / raw)
To: qemu-devel
Cc: ale, richard.henderson, pbonzini, philmd, agraf, dirty,
rbolshakov, anielhb413, pasic, borntraeger, palmer,
alistair.francis, bin.meng, ysato, peter.maydell
As we are now using vaddr for representing guest addresses, update the
static assert to check that vaddr fits in the run_on_cpu_data union.
Signed-off-by: Anton Johansson <anjo@rev.ng>
---
accel/tcg/cputlb.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index 2f97ae2fda..b558da04af 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -74,8 +74,9 @@
} while (0)
/* run_on_cpu_data.target_ptr should always be big enough for a
- * target_ulong even on 32 bit builds */
-QEMU_BUILD_BUG_ON(sizeof(target_ulong) > sizeof(run_on_cpu_data));
+ * vaddr even on 32 bit builds
+ */
+QEMU_BUILD_BUG_ON(sizeof(vaddr) > sizeof(run_on_cpu_data));
/* We currently can't handle more than 16 bits in the MMUIDX bitmask.
*/
--
2.41.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 1/9] accel/kvm: Widen pc/saved_insn for kvm_sw_breakpoint
2023-07-21 20:58 ` [PATCH 1/9] accel/kvm: Widen pc/saved_insn for kvm_sw_breakpoint Anton Johansson via
@ 2023-07-27 19:21 ` Richard Henderson
0 siblings, 0 replies; 19+ messages in thread
From: Richard Henderson @ 2023-07-27 19:21 UTC (permalink / raw)
To: Anton Johansson, qemu-devel
Cc: ale, pbonzini, philmd, agraf, dirty, rbolshakov, anielhb413,
pasic, borntraeger, palmer, alistair.francis, bin.meng, ysato,
peter.maydell
On 7/21/23 13:58, Anton Johansson wrote:
> Widens the pc and saved_insn fields of kvm_sw_breakpoint from
> target_ulong to vaddr. The pc argument of kvm_find_sw_breakpoint is also
> widened to match.
>
> Signed-off-by: Anton Johansson<anjo@rev.ng>
> ---
> include/sysemu/kvm.h | 6 +++---
> accel/kvm/kvm-all.c | 3 +--
> 2 files changed, 4 insertions(+), 5 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/9] accel/hvf: Widen pc/saved_insn for hvf_sw_breakpoint
2023-07-21 20:58 ` [PATCH 2/9] accel/hvf: Widen pc/saved_insn for hvf_sw_breakpoint Anton Johansson via
@ 2023-07-27 19:25 ` Richard Henderson
0 siblings, 0 replies; 19+ messages in thread
From: Richard Henderson @ 2023-07-27 19:25 UTC (permalink / raw)
To: Anton Johansson, qemu-devel
Cc: ale, pbonzini, philmd, agraf, dirty, rbolshakov, anielhb413,
pasic, borntraeger, palmer, alistair.francis, bin.meng, ysato,
peter.maydell
On 7/21/23 13:58, Anton Johansson wrote:
> Widens the pc and saved_insn fields of hvf_sw_breakpoint from
> target_ulong to vaddr. Other hvf_* functions accessing hvf_sw_breakpoint
> are also widened to match.
>
> Signed-off-by: Anton Johansson<anjo@rev.ng>
> ---
> include/sysemu/hvf.h | 6 +++---
> accel/hvf/hvf-accel-ops.c | 4 ++--
> accel/hvf/hvf-all.c | 2 +-
> 3 files changed, 6 insertions(+), 6 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/9] target: Use vaddr for kvm_arch_[insert|remove]_hw_breakpoint
2023-07-21 20:58 ` [PATCH 3/9] target: Use vaddr for kvm_arch_[insert|remove]_hw_breakpoint Anton Johansson via
@ 2023-07-27 19:27 ` Richard Henderson
0 siblings, 0 replies; 19+ messages in thread
From: Richard Henderson @ 2023-07-27 19:27 UTC (permalink / raw)
To: Anton Johansson, qemu-devel
Cc: ale, pbonzini, philmd, agraf, dirty, rbolshakov, anielhb413,
pasic, borntraeger, palmer, alistair.francis, bin.meng, ysato,
peter.maydell
On 7/21/23 13:58, Anton Johansson wrote:
> Changes the signature of the target-defined functions for
> inserting/removing kvm hw breakpoints. The address and length arguments
> are now of vaddr type, which both matches the type used internally in
> accel/kvm/kvm-all.c and makes the api target-agnostic.
>
> Signed-off-by: Anton Johansson <anjo@rev.ng>
> ---
> include/sysemu/kvm.h | 6 ++----
> target/arm/kvm64.c | 16 ++++++++--------
> target/i386/kvm/kvm.c | 15 +++++++--------
> target/ppc/kvm.c | 15 +++++++--------
> target/s390x/kvm/kvm.c | 11 +++++------
> 5 files changed, 29 insertions(+), 34 deletions(-)
>
> diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
> index 5670306dbf..19d87b20e8 100644
> --- a/include/sysemu/kvm.h
> +++ b/include/sysemu/kvm.h
> @@ -426,10 +426,8 @@ int kvm_arch_insert_sw_breakpoint(CPUState *cpu,
> struct kvm_sw_breakpoint *bp);
> int kvm_arch_remove_sw_breakpoint(CPUState *cpu,
> struct kvm_sw_breakpoint *bp);
> -int kvm_arch_insert_hw_breakpoint(target_ulong addr,
> - target_ulong len, int type);
> -int kvm_arch_remove_hw_breakpoint(target_ulong addr,
> - target_ulong len, int type);
> +int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type);
> +int kvm_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type);
> void kvm_arch_remove_all_hw_breakpoints(void);
>
> void kvm_arch_update_guest_debug(CPUState *cpu, struct kvm_guest_debug *dbg);
> diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
> index 94bbd9661f..c0750792cb 100644
> --- a/target/arm/kvm64.c
> +++ b/target/arm/kvm64.c
> @@ -49,32 +49,32 @@ void kvm_arm_init_debug(KVMState *s)
> return;
> }
>
> -int kvm_arch_insert_hw_breakpoint(target_ulong addr,
> - target_ulong len, int type)
> +int kvm_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
> {
> switch (type) {
> case GDB_BREAKPOINT_HW:
> - return insert_hw_breakpoint(addr);
> + return insert_hw_breakpoint((target_ulong) addr);
No need for the casts.
r~
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 4/9] target: Use vaddr for hvf_arch_[insert|remove]_hw_breakpoint
2023-07-21 20:58 ` [PATCH 4/9] target: Use vaddr for hvf_arch_[insert|remove]_hw_breakpoint Anton Johansson via
@ 2023-07-27 19:29 ` Richard Henderson
0 siblings, 0 replies; 19+ messages in thread
From: Richard Henderson @ 2023-07-27 19:29 UTC (permalink / raw)
To: Anton Johansson, qemu-devel
Cc: ale, pbonzini, philmd, agraf, dirty, rbolshakov, anielhb413,
pasic, borntraeger, palmer, alistair.francis, bin.meng, ysato,
peter.maydell
On 7/21/23 13:58, Anton Johansson wrote:
> -int hvf_arch_insert_hw_breakpoint(target_ulong addr, target_ulong len, int type)
> +int hvf_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type)
> {
> switch (type) {
> case GDB_BREAKPOINT_HW:
> - return insert_hw_breakpoint(addr);
> + return insert_hw_breakpoint((target_ulong) addr);
No need for the casts.
r~
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 5/9] Replace target_ulong with abi_ptr in cpu_[st|ld]*()
2023-07-21 20:58 ` [PATCH 5/9] Replace target_ulong with abi_ptr in cpu_[st|ld]*() Anton Johansson via
@ 2023-07-27 23:48 ` Richard Henderson
0 siblings, 0 replies; 19+ messages in thread
From: Richard Henderson @ 2023-07-27 23:48 UTC (permalink / raw)
To: Anton Johansson, qemu-devel
Cc: ale, pbonzini, philmd, agraf, dirty, rbolshakov, anielhb413,
pasic, borntraeger, palmer, alistair.francis, bin.meng, ysato,
peter.maydell
On 7/21/23 13:58, Anton Johansson wrote:
> Changes the address type of the guest memory read/write functions from
> target_ulong to abi_ptr. (abi_ptr is currently typedef'd to target_ulong
> but that will change in a following commit.) This will reduce the
> coupling between accel/ and target/.
>
> Note: Function pointers that point to cpu_[st|ld]*() in target/riscv and
> target/rx are also updated in this commit.
>
> Signed-off-by: Anton Johansson<anjo@rev.ng>
> ---
> accel/tcg/atomic_template.h | 16 ++++++++--------
> include/exec/cpu_ldst.h | 24 ++++++++++++------------
> accel/tcg/cputlb.c | 10 +++++-----
> target/riscv/vector_helper.c | 2 +-
> target/rx/op_helper.c | 6 +++---
> 5 files changed, 29 insertions(+), 29 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 6/9] include/exec: typedef abi_ptr to vaddr in softmmu
2023-07-21 20:58 ` [PATCH 6/9] include/exec: typedef abi_ptr to vaddr in softmmu Anton Johansson via
@ 2023-07-27 23:51 ` Richard Henderson
0 siblings, 0 replies; 19+ messages in thread
From: Richard Henderson @ 2023-07-27 23:51 UTC (permalink / raw)
To: Anton Johansson, qemu-devel
Cc: ale, pbonzini, philmd, agraf, dirty, rbolshakov, anielhb413,
pasic, borntraeger, palmer, alistair.francis, bin.meng, ysato,
peter.maydell
On 7/21/23 13:58, Anton Johansson wrote:
> In system mode, abi_ptr is primarily used for representing addresses
> when accessing guest memory with cpu_[st|ld]*(). Widening it from
> target_ulong to vaddr reduces the target dependence of these functions
> and is step towards building accel/ once for system mode.
>
> Signed-off-by: Anton Johansson<anjo@rev.ng>
> ---
> include/exec/cpu_ldst.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 7/9] include/exec: Widen tlb_hit/tlb_hit_page()
2023-07-21 20:58 ` [PATCH 7/9] include/exec: Widen tlb_hit/tlb_hit_page() Anton Johansson via
@ 2023-07-27 23:52 ` Richard Henderson
0 siblings, 0 replies; 19+ messages in thread
From: Richard Henderson @ 2023-07-27 23:52 UTC (permalink / raw)
To: Anton Johansson, qemu-devel
Cc: ale, pbonzini, philmd, agraf, dirty, rbolshakov, anielhb413,
pasic, borntraeger, palmer, alistair.francis, bin.meng, ysato,
peter.maydell
On 7/21/23 13:58, Anton Johansson wrote:
> tlb_addr is changed from target_ulong to uint64_t to match the type of
> a CPUTLBEntry value, and the addressed is changed to vaddr.
>
> Signed-off-by: Anton Johansson<anjo@rev.ng>
> ---
> include/exec/cpu-all.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 8/9] accel/tcg: Widen address arg. in tlb_compare_set()
2023-07-21 20:58 ` [PATCH 8/9] accel/tcg: Widen address arg. in tlb_compare_set() Anton Johansson via
@ 2023-07-27 23:53 ` Richard Henderson
0 siblings, 0 replies; 19+ messages in thread
From: Richard Henderson @ 2023-07-27 23:53 UTC (permalink / raw)
To: Anton Johansson, qemu-devel
Cc: ale, pbonzini, philmd, agraf, dirty, rbolshakov, anielhb413,
pasic, borntraeger, palmer, alistair.francis, bin.meng, ysato,
peter.maydell
On 7/21/23 13:58, Anton Johansson wrote:
> Signed-off-by: Anton Johansson<anjo@rev.ng>
> ---
> accel/tcg/cputlb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 9/9] accel/tcg: Update run_on_cpu_data static assert
2023-07-21 20:58 ` [PATCH 9/9] accel/tcg: Update run_on_cpu_data static assert Anton Johansson via
@ 2023-07-27 23:53 ` Richard Henderson
0 siblings, 0 replies; 19+ messages in thread
From: Richard Henderson @ 2023-07-27 23:53 UTC (permalink / raw)
To: Anton Johansson, qemu-devel
Cc: ale, pbonzini, philmd, agraf, dirty, rbolshakov, anielhb413,
pasic, borntraeger, palmer, alistair.francis, bin.meng, ysato,
peter.maydell
On 7/21/23 13:58, Anton Johansson wrote:
> As we are now using vaddr for representing guest addresses, update the
> static assert to check that vaddr fits in the run_on_cpu_data union.
>
> Signed-off-by: Anton Johansson<anjo@rev.ng>
> ---
> accel/tcg/cputlb.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2023-07-28 0:50 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-21 20:58 [PATCH 0/9] Replace remaining target_ulong in system-mode accel Anton Johansson via
2023-07-21 20:58 ` [PATCH 1/9] accel/kvm: Widen pc/saved_insn for kvm_sw_breakpoint Anton Johansson via
2023-07-27 19:21 ` Richard Henderson
2023-07-21 20:58 ` [PATCH 2/9] accel/hvf: Widen pc/saved_insn for hvf_sw_breakpoint Anton Johansson via
2023-07-27 19:25 ` Richard Henderson
2023-07-21 20:58 ` [PATCH 3/9] target: Use vaddr for kvm_arch_[insert|remove]_hw_breakpoint Anton Johansson via
2023-07-27 19:27 ` Richard Henderson
2023-07-21 20:58 ` [PATCH 4/9] target: Use vaddr for hvf_arch_[insert|remove]_hw_breakpoint Anton Johansson via
2023-07-27 19:29 ` Richard Henderson
2023-07-21 20:58 ` [PATCH 5/9] Replace target_ulong with abi_ptr in cpu_[st|ld]*() Anton Johansson via
2023-07-27 23:48 ` Richard Henderson
2023-07-21 20:58 ` [PATCH 6/9] include/exec: typedef abi_ptr to vaddr in softmmu Anton Johansson via
2023-07-27 23:51 ` Richard Henderson
2023-07-21 20:58 ` [PATCH 7/9] include/exec: Widen tlb_hit/tlb_hit_page() Anton Johansson via
2023-07-27 23:52 ` Richard Henderson
2023-07-21 20:58 ` [PATCH 8/9] accel/tcg: Widen address arg. in tlb_compare_set() Anton Johansson via
2023-07-27 23:53 ` Richard Henderson
2023-07-21 20:58 ` [PATCH 9/9] accel/tcg: Update run_on_cpu_data static assert Anton Johansson via
2023-07-27 23:53 ` Richard Henderson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.