[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/5] target/riscv: No need to re-start QEMU timer when timecm
From: |
Alistair Francis |
Subject: |
Re: [PATCH 4/5] target/riscv: No need to re-start QEMU timer when timecmp == UINT64_MAX |
Date: |
Mon, 31 Oct 2022 10:55:14 +1000 |
On Fri, Oct 28, 2022 at 2:53 AM Anup Patel <apatel@ventanamicro.com> wrote:
>
> The time CSR will wrap-around immediately after reaching UINT64_MAX
> so we don't need to re-start QEMU timer when timecmp == UINT64_MAX
> in riscv_timer_write_timecmp().
I'm not clear what this is fixing?
If the guest sets a timer for UINT64_MAX shouldn't that still trigger
an event at some point?
Alistair
>
> Signed-off-by: Anup Patel <apatel@ventanamicro.com>
> ---
> target/riscv/time_helper.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/target/riscv/time_helper.c b/target/riscv/time_helper.c
> index 4fb2a471a9..1ee9f94813 100644
> --- a/target/riscv/time_helper.c
> +++ b/target/riscv/time_helper.c
> @@ -72,6 +72,14 @@ void riscv_timer_write_timecmp(RISCVCPU *cpu, QEMUTimer
> *timer,
> riscv_cpu_update_mip(cpu, timer_irq, BOOL_TO_MASK(0));
> }
>
> + /*
> + * Don't re-start the QEMU timer when timecmp == UINT64_MAX because
> + * time CSR will wrap-around immediately after reaching UINT64_MAX.
> + */
> + if (timecmp == UINT64_MAX) {
> + return;
> + }
> +
> /* otherwise, set up the future timer interrupt */
> diff = timecmp - rtc_r;
> /* back to ns (note args switched in muldiv64) */
> --
> 2.34.1
>
>
- [PATCH 0/5] Nested virtualization fixes for QEMU, Anup Patel, 2022/10/27
- [PATCH 2/5] target/riscv: Update VS timer whenever htimedelta changes, Anup Patel, 2022/10/27
- [PATCH 3/5] target/riscv: Don't clear mask in riscv_cpu_update_mip() for VSTIP, Anup Patel, 2022/10/27
- [PATCH 4/5] target/riscv: No need to re-start QEMU timer when timecmp == UINT64_MAX, Anup Patel, 2022/10/27
- Re: [PATCH 4/5] target/riscv: No need to re-start QEMU timer when timecmp == UINT64_MAX,
Alistair Francis <=
- [PATCH 5/5] target/riscv: Ensure opcode is saved for all relevant instructions, Anup Patel, 2022/10/27
- [PATCH 1/5] target/riscv: Typo fix in sstc() predicate, Anup Patel, 2022/10/27