qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v3 15/16] hw/riscv: clint: Avoid using hard-coded timebase fr


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v3 15/16] hw/riscv: clint: Avoid using hard-coded timebase frequency
Date: Tue, 1 Sep 2020 11:49:20 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

On 9/1/20 3:39 AM, Bin Meng wrote:
> From: Bin Meng <bin.meng@windriver.com>
> 
> At present the CLINT timestamp is using a hard-coded timebase
> frequency value SIFIVE_CLINT_TIMEBASE_FREQ. This might not be
> true for all boards.
> 
> Add a new 'timebase-freq' property to the CLINT device, and
> update various functions to accept this as a parameter.
> 
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
> 
> ---
> 
> (no changes since v1)
> 
>  include/hw/riscv/sifive_clint.h |  4 +++-
>  target/riscv/cpu.h              |  6 ++++--
>  hw/riscv/microchip_pfsoc.c      |  6 +++++-
>  hw/riscv/sifive_clint.c         | 26 +++++++++++++++-----------
>  hw/riscv/sifive_e.c             |  3 ++-
>  hw/riscv/sifive_u.c             |  3 ++-
>  hw/riscv/spike.c                |  3 ++-
>  hw/riscv/virt.c                 |  3 ++-
>  target/riscv/cpu_helper.c       |  4 +++-
>  target/riscv/csr.c              |  4 ++--
>  10 files changed, 40 insertions(+), 22 deletions(-)
> 
> diff --git a/include/hw/riscv/sifive_clint.h b/include/hw/riscv/sifive_clint.h
> index 9f5fb3d..a30be0f 100644
> --- a/include/hw/riscv/sifive_clint.h
> +++ b/include/hw/riscv/sifive_clint.h
> @@ -39,11 +39,13 @@ typedef struct SiFiveCLINTState {
>      uint32_t timecmp_base;
>      uint32_t time_base;
>      uint32_t aperture_size;
> +    uint32_t timebase_freq;
>  } SiFiveCLINTState;
>  
>  DeviceState *sifive_clint_create(hwaddr addr, hwaddr size,
>      uint32_t hartid_base, uint32_t num_harts, uint32_t sip_base,
> -    uint32_t timecmp_base, uint32_t time_base, bool provide_rdtime);
> +    uint32_t timecmp_base, uint32_t time_base, uint32_t timebase_freq,
> +    bool provide_rdtime);

As an future improvement, consider using the recently introduced Clock API.

Regards,

Phil.



reply via email to

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