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 4/8] riscv: Add ACPI support for ISA string discovery
Date: Fri, 20 Nov 2026 10:14:13 +0100 [thread overview]
Message-ID: <awAMfrnZbDemHE8o@orel> (raw)
In-Reply-To: <20261105082035.133680-5-wangxiang@iscas.ac.cn>
On Thu, Nov 05, 2026 at 04:20:31PM +0800, Xiang W wrote:
...
> +static int acpi_rhct_for_each_hart(void (*func)(struct acpi_table_rhct *,
> + struct acpi_rhct_node_hart_info *,
> + void *), void *data)
Check the alignment of these parameters. There's an extra space.
> +{
> + u32 offset;
> + struct acpi_table_rhct *rhct;
> + struct acpi_rhct_node *node;
> + struct acpi_rhct_node_hart_info *hart_info;
> +
> + rhct = find_acpi_table_addr(RHCT_SIGNATURE);
> + if (rhct == NULL)
> + return -1;
> +
> + offset = rhct->node_offset;
> + for (int i = 0; i < rhct->node_count; i++) {
> + if (offset >= rhct->length)
> + return -1;
> +
> + node = (void *)rhct + offset;
> + if (node->length < sizeof(*node))
> + return -1;
> +
> + if (node->type == ACPI_RHCT_NODE_TYPE_HART_INFO) {
> + hart_info = (void *)node;
> + func(rhct, hart_info, data);
> + }
> +
> + offset += node->length;
> + }
> +
> + return 0;
> }
> +#endif
>
> void isa_init(struct thread_info *ti)
> {
> struct isa_info info = {
> - .hartid = ti->hartid,
> .func = isa_bit,
> .data = ti,
> };
> int ret;
>
> if (dt_available()) {
> + info.id = ti->hartid;
> ret = dt_for_each_cpu_node(isa_parse_fdt, &info);
> assert(ret == 0);
> } else {
> - isa_init_acpi();
> +#ifdef CONFIG_EFI
> + info.id = ti->uid;
> + ret = acpi_rhct_for_each_hart(isa_parse_acpi, &info);
> + assert(ret == 0);
assert_msg(ret == 0, "ACPI: Failed to parse RHCT");
> +#else
> + assert_msg(false, "ACPI not available");
> +#endif
> }
> }
>
> bool cpu_has_extension_name(int cpu, const char *ext)
> {
> struct isa_info info = {
> - .hartid = cpus[cpu].hartid,
> .func = isa_name,
> .data = &(struct isa_check){ .ext = ext, },
> };
> @@ -116,10 +176,17 @@ bool cpu_has_extension_name(int cpu, const char *ext)
> int ret;
>
> if (dt_available()) {
> + info.id = cpus[cpu].hartid;
> ret = dt_for_each_cpu_node(isa_parse_fdt, &info);
> assert(ret == 0);
> } else {
> +#ifdef CONFIG_EFI
> + info.id = cpus[cpu].uid;
> + ret = acpi_rhct_for_each_hart(isa_parse_acpi, &info);
> + assert(ret == 0);
assert_msg(ret == 0, "ACPI: Failed to parse RHCT");
> +#else
> assert_msg(false, "ACPI not available");
> +#endif
> }
>
> return check->found;
> --
> 2.47.3
>
next prev parent reply other threads:[~2026-11-20 9:14 UTC|newest]
Thread overview: 13+ 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 ` [kvm-unit-tests PATCH v2 1/8] riscv: Initialize the ACPI RSDP from the EFI system table 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 ` [kvm-unit-tests PATCH v2 3/8] riscv: Add ACPI support for timer frequency discovery Xiang W
2026-11-05 8:20 ` [kvm-unit-tests PATCH v2 4/8] riscv: Add ACPI support for ISA string discovery Xiang W
2026-11-20 8:54 ` Andrew Jones
2026-11-20 9:14 ` Andrew Jones [this message]
2026-11-05 8:20 ` [kvm-unit-tests PATCH v2 5/8] riscv: Prefer SBI DBCN console with UART fallback Xiang W
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-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 ` [kvm-unit-tests PATCH v2 8/8] riscv: Add BRS SBI requirement tests Xiang W
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=awAMfrnZbDemHE8o@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox