From: Andrew Jones <andrew.jones@linux.dev>
To: Xiang W <wangxiang@iscas.ac.cn>
Cc: kvm@vger.kernel.org, kvm-riscv@lists.infradead.org,
pbonzini@redhat.com, thuth@redhat.com
Subject: Re: [kvm-unit-tests PATCH v2 3/8] riscv: Add ACPI support for timer frequency discovery
Date: Fri, 20 Nov 2026 14:51:00 +0100 [thread overview]
Message-ID: <awBQL-e_PtSmrfm-@orel> (raw)
In-Reply-To: <20261105082035.133680-4-wangxiang@iscas.ac.cn>
On Thu, Nov 05, 2026 at 04:20:30PM +0800, Xiang W wrote:
> When a DT is not provided, read the system time base frequency from
> the RHCT instead of aborting in timer_get_frequency().
>
> RHCT Time Base Frequency is the ACPI equivalent of the DT
> /cpus timebase-frequency property and is the same for all harts.
> Keep DT as the preferred path when one is available.
>
> Signed-off-by: Xiang W <wangxiang@iscas.ac.cn>
> ---
> lib/acpi.h | 9 +++++++++
> lib/riscv/timer.c | 38 ++++++++++++++++++++++++++------------
> 2 files changed, 35 insertions(+), 12 deletions(-)
>
> diff --git a/lib/acpi.h b/lib/acpi.h
> index f6c92d28..0589669b 100644
> --- a/lib/acpi.h
> +++ b/lib/acpi.h
> @@ -20,6 +20,7 @@
> #define MADT_SIGNATURE ACPI_SIGNATURE('A','P','I','C')
> #define SPCR_SIGNATURE ACPI_SIGNATURE('S','P','C','R')
> #define GTDT_SIGNATURE ACPI_SIGNATURE('G','T','D','T')
> +#define RHCT_SIGNATURE ACPI_SIGNATURE('R','H','C','T')
>
> #define ACPI_SIGNATURE_8BYTE(c1, c2, c3, c4, c5, c6, c7, c8) \
> (((uint64_t)(ACPI_SIGNATURE(c1, c2, c3, c4))) | \
> @@ -325,6 +326,14 @@ struct acpi_table_gtdt {
> u32 virtual_el2_timer_flags;
> };
>
> +struct acpi_table_rhct {
> + ACPI_TABLE_HEADER_DEF
> + u32 flags;
> + u64 time_base_freq;
> + u32 node_count;
> + u32 node_offset;
> +};
> +
> /* Reset to default packing */
> #pragma pack()
>
> diff --git a/lib/riscv/timer.c b/lib/riscv/timer.c
> index 18063b7e..a3af7e2b 100644
> --- a/lib/riscv/timer.c
> +++ b/lib/riscv/timer.c
> @@ -13,24 +13,38 @@
> #include <asm/smp.h>
> #include <asm/timer.h>
>
> +#ifdef CONFIG_EFI
> +#include <acpi.h>
> +#endif
No need for this EFI guard.
Thanks,
drew
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Jones <andrew.jones@linux.dev>
To: Xiang W <wangxiang@iscas.ac.cn>
Cc: kvm@vger.kernel.org, kvm-riscv@lists.infradead.org,
pbonzini@redhat.com, thuth@redhat.com
Subject: Re: [kvm-unit-tests PATCH v2 3/8] riscv: Add ACPI support for timer frequency discovery
Date: Fri, 20 Nov 2026 14:51:00 +0100 [thread overview]
Message-ID: <awBQL-e_PtSmrfm-@orel> (raw)
In-Reply-To: <20261105082035.133680-4-wangxiang@iscas.ac.cn>
On Thu, Nov 05, 2026 at 04:20:30PM +0800, Xiang W wrote:
> When a DT is not provided, read the system time base frequency from
> the RHCT instead of aborting in timer_get_frequency().
>
> RHCT Time Base Frequency is the ACPI equivalent of the DT
> /cpus timebase-frequency property and is the same for all harts.
> Keep DT as the preferred path when one is available.
>
> Signed-off-by: Xiang W <wangxiang@iscas.ac.cn>
> ---
> lib/acpi.h | 9 +++++++++
> lib/riscv/timer.c | 38 ++++++++++++++++++++++++++------------
> 2 files changed, 35 insertions(+), 12 deletions(-)
>
> diff --git a/lib/acpi.h b/lib/acpi.h
> index f6c92d28..0589669b 100644
> --- a/lib/acpi.h
> +++ b/lib/acpi.h
> @@ -20,6 +20,7 @@
> #define MADT_SIGNATURE ACPI_SIGNATURE('A','P','I','C')
> #define SPCR_SIGNATURE ACPI_SIGNATURE('S','P','C','R')
> #define GTDT_SIGNATURE ACPI_SIGNATURE('G','T','D','T')
> +#define RHCT_SIGNATURE ACPI_SIGNATURE('R','H','C','T')
>
> #define ACPI_SIGNATURE_8BYTE(c1, c2, c3, c4, c5, c6, c7, c8) \
> (((uint64_t)(ACPI_SIGNATURE(c1, c2, c3, c4))) | \
> @@ -325,6 +326,14 @@ struct acpi_table_gtdt {
> u32 virtual_el2_timer_flags;
> };
>
> +struct acpi_table_rhct {
> + ACPI_TABLE_HEADER_DEF
> + u32 flags;
> + u64 time_base_freq;
> + u32 node_count;
> + u32 node_offset;
> +};
> +
> /* Reset to default packing */
> #pragma pack()
>
> diff --git a/lib/riscv/timer.c b/lib/riscv/timer.c
> index 18063b7e..a3af7e2b 100644
> --- a/lib/riscv/timer.c
> +++ b/lib/riscv/timer.c
> @@ -13,24 +13,38 @@
> #include <asm/smp.h>
> #include <asm/timer.h>
>
> +#ifdef CONFIG_EFI
> +#include <acpi.h>
> +#endif
No need for this EFI guard.
Thanks,
drew
--
kvm-riscv mailing list
kvm-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kvm-riscv
next prev parent reply other threads:[~2026-11-20 13:51 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 8:20 [kvm-unit-tests PATCH v2 0/8] riscv: ACPI boot and BRS-I SBI tests Xiang W
2026-11-05 8:20 ` Xiang W
2026-11-05 8:20 ` [kvm-unit-tests PATCH v2 1/8] riscv: Initialize the ACPI RSDP from the EFI system table Xiang W
2026-11-05 8:20 ` Xiang W
2026-11-05 8:20 ` [kvm-unit-tests PATCH v2 2/8] riscv: Add ACPI support for CPU initialization Xiang W
2026-11-05 8:20 ` Xiang W
2026-11-05 8:20 ` [kvm-unit-tests PATCH v2 3/8] riscv: Add ACPI support for timer frequency discovery Xiang W
2026-11-05 8:20 ` Xiang W
2026-11-20 13:51 ` Andrew Jones [this message]
2026-11-20 13:51 ` Andrew Jones
2026-11-05 8:20 ` [kvm-unit-tests PATCH v2 4/8] riscv: Add ACPI support for ISA string discovery Xiang W
2026-11-05 8:20 ` Xiang W
2026-11-20 8:54 ` Andrew Jones
2026-11-20 8:54 ` Andrew Jones
2026-11-20 9:14 ` Andrew Jones
2026-11-20 9:14 ` Andrew Jones
2026-11-20 11:20 ` Andrew Jones
2026-11-20 11:20 ` Andrew Jones
2026-11-05 8:20 ` [kvm-unit-tests PATCH v2 5/8] riscv: Prefer SBI DBCN console with UART fallback Xiang W
2026-11-05 8:20 ` Xiang W
2026-11-20 10:08 ` Andrew Jones
2026-11-20 10:08 ` Andrew Jones
2026-11-05 8:20 ` [kvm-unit-tests PATCH v2 6/8] riscv: efi: Allow ACPI boots Xiang W
2026-11-05 8:20 ` Xiang W
2026-11-20 10:12 ` Andrew Jones
2026-11-20 10:12 ` Andrew Jones
2026-11-05 8:20 ` [kvm-unit-tests PATCH v2 7/8] riscv: initialize ISA extensions for all harts in cpu_init Xiang W
2026-11-05 8:20 ` Xiang W
2026-11-20 11:37 ` Andrew Jones
2026-11-20 11:37 ` Andrew Jones
2026-11-20 13:49 ` Andrew Jones
2026-11-20 13:49 ` Andrew Jones
2026-11-05 8:20 ` [kvm-unit-tests PATCH v2 8/8] riscv: Add BRS SBI requirement tests Xiang W
2026-11-05 8:20 ` Xiang W
2026-11-20 14:09 ` Andrew Jones
2026-11-20 14:09 ` Andrew Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=awBQL-e_PtSmrfm-@orel \
--to=andrew.jones@linux.dev \
--cc=kvm-riscv@lists.infradead.org \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=thuth@redhat.com \
--cc=wangxiang@iscas.ac.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.