qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] target/riscv: Have kvm_riscv_get_timebase_frequency() ta


From: Alistair Francis
Subject: Re: [PATCH 1/2] target/riscv: Have kvm_riscv_get_timebase_frequency() take RISCVCPU cpu
Date: Mon, 13 Jan 2025 10:14:25 +1000

On Mon, Jan 13, 2025 at 9:14 AM Philippe Mathieu-Daudé
<philmd@linaro.org> wrote:
>
> Keep kvm_riscv_get_timebase_frequency() prototype aligned with
> the other ones declared in "kvm_riscv.h", have it take a RISCVCPU
> cpu as argument. Include "target/riscv/cpu-qom.h" which declares
> the RISCVCPU typedef.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  target/riscv/kvm/kvm_riscv.h | 4 +++-
>  hw/riscv/virt.c              | 2 +-
>  target/riscv/kvm/kvm-cpu.c   | 4 ++--
>  3 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/target/riscv/kvm/kvm_riscv.h b/target/riscv/kvm/kvm_riscv.h
> index 58518988681..b2bcd1041f6 100644
> --- a/target/riscv/kvm/kvm_riscv.h
> +++ b/target/riscv/kvm/kvm_riscv.h
> @@ -19,6 +19,8 @@
>  #ifndef QEMU_KVM_RISCV_H
>  #define QEMU_KVM_RISCV_H
>
> +#include "target/riscv/cpu-qom.h"
> +
>  void kvm_riscv_reset_vcpu(RISCVCPU *cpu);
>  void kvm_riscv_set_irq(RISCVCPU *cpu, int irq, int level);
>  void kvm_riscv_aia_create(MachineState *machine, uint64_t group_shift,
> @@ -28,6 +30,6 @@ void kvm_riscv_aia_create(MachineState *machine, uint64_t 
> group_shift,
>  void riscv_kvm_aplic_request(void *opaque, int irq, int level);
>  int kvm_riscv_sync_mpstate_to_kvm(RISCVCPU *cpu, int state);
>  void riscv_kvm_cpu_finalize_features(RISCVCPU *cpu, Error **errp);
> -uint64_t kvm_riscv_get_timebase_frequency(CPUState *cs);
> +uint64_t kvm_riscv_get_timebase_frequency(RISCVCPU *cpu);
>
>  #endif
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index 2bc5a9dd981..9e8876be29b 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -750,7 +750,7 @@ static void create_fdt_sockets(RISCVVirtState *s, const 
> MemMapEntry *memmap,
>      qemu_fdt_add_subnode(ms->fdt, "/cpus");
>      qemu_fdt_setprop_cell(ms->fdt, "/cpus", "timebase-frequency",
>                            kvm_enabled() ?
> -                          kvm_riscv_get_timebase_frequency(first_cpu) :
> +                          
> kvm_riscv_get_timebase_frequency(RISCV_CPU(first_cpu)) :
>                            RISCV_ACLINT_DEFAULT_TIMEBASE_FREQ);
>      qemu_fdt_setprop_cell(ms->fdt, "/cpus", "#size-cells", 0x0);
>      qemu_fdt_setprop_cell(ms->fdt, "/cpus", "#address-cells", 0x1);
> diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c
> index 11278ea778d..23ce7793594 100644
> --- a/target/riscv/kvm/kvm-cpu.c
> +++ b/target/riscv/kvm/kvm-cpu.c
> @@ -758,11 +758,11 @@ static void kvm_riscv_put_regs_timer(CPUState *cs)
>      env->kvm_timer_dirty = false;
>  }
>
> -uint64_t kvm_riscv_get_timebase_frequency(CPUState *cs)
> +uint64_t kvm_riscv_get_timebase_frequency(RISCVCPU *cpu)
>  {
>      uint64_t reg;
>
> -    KVM_RISCV_GET_TIMER(cs, frequency, reg);
> +    KVM_RISCV_GET_TIMER(CPU(cpu), frequency, reg);
>
>      return reg;
>  }
> --
> 2.47.1
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]