On Wed, Oct 15, 2025 at 6:38 AM Anton Johansson via
<qemu-devel@nongnu.org> wrote:
>
> Widen to 64 bits, and use hwaddr as argument to get_physical_address().
>
> Signed-off-by: Anton Johansson <anjo@rev.ng>
> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> target/riscv/cpu.h | 2 +-
> target/riscv/cpu_helper.c | 3 +--
> target/riscv/machine.c | 2 +-
> 3 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
> index 8c93030b1c..bcf10a4c8b 100644
> --- a/target/riscv/cpu.h
> +++ b/target/riscv/cpu.h
> @@ -236,7 +236,7 @@ struct CPUArchState {
> uint64_t badaddr;
> uint64_t bins;
>
> - target_ulong guest_phys_fault_addr;
> + uint64_t guest_phys_fault_addr;
>
> target_ulong priv_ver;
> target_ulong vext_ver;
> diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
> index 5a20596f1f..7790244d93 100644
> --- a/target/riscv/cpu_helper.c
> +++ b/target/riscv/cpu_helper.c
> @@ -1186,7 +1186,7 @@ static bool check_svukte_addr(CPURISCVState *env, vaddr addr)
> */
> static int get_physical_address(CPURISCVState *env, hwaddr *physical,
> int *ret_prot, vaddr addr,
> - target_ulong *fault_pte_addr,
> + hwaddr *fault_pte_addr,
> int access_type, int mmu_idx,
> bool first_stage, bool two_stage,
> bool is_debug, bool is_probe)
> @@ -1787,7 +1787,6 @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
> ret = get_physical_address(env, &pa, &prot, address,
> &env->guest_phys_fault_addr, access_type,
> mmu_idx, true, true, false, probe);
> -
> /*
> * A G-stage exception may be triggered during two state lookup.
> * And the env->guest_phys_fault_addr has already been set in
> diff --git a/target/riscv/machine.c b/target/riscv/machine.c
> index b047321073..27034180c4 100644
> --- a/target/riscv/machine.c
> +++ b/target/riscv/machine.c
> @@ -438,7 +438,7 @@ const VMStateDescription vmstate_riscv_cpu = {
> VMSTATE_UINT64(env.load_val, RISCVCPU),
> VMSTATE_UINT8(env.frm, RISCVCPU),
> VMSTATE_UINT64(env.badaddr, RISCVCPU),
> - VMSTATE_UINTTL(env.guest_phys_fault_addr, RISCVCPU),
> + VMSTATE_UINT64(env.guest_phys_fault_addr, RISCVCPU),
> VMSTATE_UINTTL(env.priv_ver, RISCVCPU),
> VMSTATE_UINTTL(env.vext_ver, RISCVCPU),
> VMSTATE_UINT32(env.misa_mxl, RISCVCPU),
> --
> 2.51.0
>
>