From: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
To: Sunil V L <sunilvl@oss.qualcomm.com>,
qemu-devel@nongnu.org, qemu-riscv@nongnu.org
Cc: Palmer Dabbelt <palmer@dabbelt.com>,
Alistair Francis <alistair.francis@wdc.com>,
Weiwei Li <liwei1518@gmail.com>,
Liu Zhiwei <zhiwei_liu@linux.alibaba.com>,
Chao Liu <chao.liu@processmission.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
Ani Sinha <anisinha@redhat.com>,
Anup Patel <anup.patel@oss.qualcomm.com>,
Drew Fustini <fustini@kernel.org>,
Prajwal N <prajwal.n@oss.qualcomm.com>,
Shankar C <shankar.c@oss.qualcomm.com>,
Sia Jee Heng <jeeheng.sia@starfivetech.com>
Subject: Re: [PATCH v2 2/4] hw/riscv/virt: Add ACPI PPTT table
Date: Thu, 15 Oct 2026 13:56:23 -0300 [thread overview]
Message-ID: <ea698fba-d160-4d12-8e44-dfd41037b064@oss.qualcomm.com> (raw)
In-Reply-To: <20261015064957.4076464-3-sunilvl@oss.qualcomm.com>
On 10/15/2026 3:49 AM, Sunil V L wrote:
> Generate the Processor Properties Topology Table (PPTT) for the RISC-V
> virt machine.
>
> Describe the machine using separate L1 data and instruction caches plus
> unified L2 and L3 caches, and enable the corresponding cache and cluster
> SMP properties.
>
> Signed-off-by: Sunil V L <sunilvl@oss.qualcomm.com>
> Signed-off-by: Sia Jee Heng <jeeheng.sia@starfivetech.com>
> ---
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
> hw/riscv/virt-acpi-build.c | 7 ++++++
> hw/riscv/virt.c | 51 ++++++++++++++++++++++++++++++++++++++
> include/hw/riscv/virt.h | 4 +++
> 3 files changed, 62 insertions(+)
>
> diff --git a/hw/riscv/virt-acpi-build.c b/hw/riscv/virt-acpi-build.c
> index 0475dcb5c601..8254f1294a72 100644
> --- a/hw/riscv/virt-acpi-build.c
> +++ b/hw/riscv/virt-acpi-build.c
> @@ -882,7 +882,10 @@ static void virt_acpi_build(RISCVVirtState *s, AcpiBuildTables *tables)
> unsigned dsdt, xsdt;
> GArray *tables_blob = tables->table_data;
> MachineState *ms = MACHINE(s);
> + CPUCoreCaches caches[CPU_MAX_CACHES];
> + unsigned int num_caches;
>
> + num_caches = virt_get_caches(caches);
> table_offsets = g_array_new(false, true,
> sizeof(uint32_t));
>
> @@ -909,6 +912,10 @@ static void virt_acpi_build(RISCVVirtState *s, AcpiBuildTables *tables)
> build_rimt(tables_blob, tables->linker, s);
> }
>
> + acpi_add_table(table_offsets, tables_blob);
> + build_pptt(tables_blob, tables->linker, ms, s->oem_id,
> + s->oem_table_id, num_caches, caches);
> +
> acpi_add_table(table_offsets, tables_blob);
>
> if (ms->acpi_spcr_enabled) {
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index d4b501802f60..c84b17a40125 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -109,6 +109,45 @@ static const MemMapEntry virt_memmap[] = {
> [VIRT_DRAM] = { 0x80000000, 0x0 },
> };
>
> +static CPUCoreCaches virt_caches[] = {
> + {
> + .type = DATA_CACHE,
> + .sets = 256,
> + .size = 64 * KiB,
> + .level = 1,
> + .linesize = 64,
> + .attributes = 0x0,
> + .associativity = 4,
> + },
> + {
> + .type = INSTRUCTION_CACHE,
> + .sets = 256,
> + .size = 64 * KiB,
> + .level = 1,
> + .linesize = 64,
> + .attributes = 0x0,
> + .associativity = 4,
> + },
> + {
> + .type = UNIFIED_CACHE,
> + .sets = 4096,
> + .size = 2048 * KiB,
> + .level = 2,
> + .linesize = 64,
> + .attributes = 0x0,
> + .associativity = 8,
> + },
> + {
> + .type = UNIFIED_CACHE,
> + .sets = 8192,
> + .size = 4096 * KiB,
> + .level = 3,
> + .linesize = 64,
> + .attributes = 0x0,
> + .associativity = 8,
> + },
> +};
> +
> /* PCIe high mmio is fixed for RV32 */
> #define VIRT32_HIGH_PCIE_MMIO_BASE 0x300000000ULL
> #define VIRT32_HIGH_PCIE_MMIO_SIZE (4 * GiB)
> @@ -140,6 +179,12 @@ static void virt_flash_map(RISCVVirtState *s,
> sysmem, VIRT_FLASH_SECTOR_SIZE);
> }
>
> +unsigned int virt_get_caches(CPUCoreCaches *caches)
> +{
> + memcpy(caches, virt_caches, sizeof(virt_caches));
> + return ARRAY_SIZE(virt_caches);
> +}
> +
> static void create_fdt_socket_plic(RISCVVirtState *s,
> int socket,
> uint32_t *phandle, uint32_t *intc_phandles,
> @@ -1144,6 +1189,12 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
> mc->cpu_index_to_instance_props = riscv_numa_cpu_index_to_props;
> mc->get_default_cpu_node_id = riscv_numa_get_default_cpu_node_id;
> mc->numa_mem_supported = true;
> + mc->smp_props.clusters_supported = true;
> + mc->smp_props.cache_supported[CACHE_LEVEL_AND_TYPE_L1D] = true;
> + mc->smp_props.cache_supported[CACHE_LEVEL_AND_TYPE_L1I] = true;
> + mc->smp_props.cache_supported[CACHE_LEVEL_AND_TYPE_L2] = true;
> + mc->smp_props.cache_supported[CACHE_LEVEL_AND_TYPE_L3] = true;
> +
> /* platform instead of architectural choice */
> mc->cpu_cluster_has_numa_boundary = true;
> mc->default_ram_id = "riscv_virt_board.ram";
> diff --git a/include/hw/riscv/virt.h b/include/hw/riscv/virt.h
> index e516898f9ad9..1e498a4f5f6e 100644
> --- a/include/hw/riscv/virt.h
> +++ b/include/hw/riscv/virt.h
> @@ -121,10 +121,14 @@ enum {
> #define VIRT_PLIC_SIZE(__num_context) \
> (VIRT_PLIC_CONTEXT_BASE + (__num_context) * VIRT_PLIC_CONTEXT_STRIDE)
>
> +#define CPU_MAX_CACHES 16
> +
> bool virt_is_acpi_enabled(RISCVVirtState *s);
> bool virt_is_iommu_sys_enabled(RISCVVirtState *s);
> void virt_acpi_setup(RISCVVirtState *vms);
>
> +unsigned int virt_get_caches(CPUCoreCaches *caches);
> +
> /*
> * The virt machine physical address space used by some of the devices
> * namely ACLINT, PLIC, APLIC, and IMSIC depend on number of Sockets,
next prev parent reply other threads:[~2026-10-15 16:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 6:49 [PATCH v2 0/4] RISC-V: ACPI: Add PPTT support Sunil V L
2026-10-15 6:49 ` [PATCH v2 1/4] tests/qtest/bios-tables-test: Allow PPTT for RISC-V Sunil V L
2026-10-15 6:49 ` [PATCH v2 2/4] hw/riscv/virt: Add ACPI PPTT table Sunil V L
2026-10-15 16:56 ` Daniel Henrique Barboza [this message]
2026-10-15 6:49 ` [PATCH v2 3/4] tests/qtest/bios-tables-test: Update riscv64 virt PPTT golden reference Sunil V L
2026-10-15 6:49 ` [PATCH v2 4/4] MAINTAINERS: Update Sunil's email id Sunil V L
2026-10-20 22:29 ` [PATCH v2 0/4] RISC-V: ACPI: Add PPTT support Drew Fustini
2026-10-21 0:39 ` Daniel Henrique Barboza
2026-10-21 1:14 ` Jinjie Ruan
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=ea698fba-d160-4d12-8e44-dfd41037b064@oss.qualcomm.com \
--to=daniel.barboza@oss.qualcomm.com \
--cc=alistair.francis@wdc.com \
--cc=anisinha@redhat.com \
--cc=anup.patel@oss.qualcomm.com \
--cc=chao.liu@processmission.com \
--cc=fustini@kernel.org \
--cc=imammedo@redhat.com \
--cc=jeeheng.sia@starfivetech.com \
--cc=liwei1518@gmail.com \
--cc=mst@redhat.com \
--cc=palmer@dabbelt.com \
--cc=prajwal.n@oss.qualcomm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=shankar.c@oss.qualcomm.com \
--cc=sunilvl@oss.qualcomm.com \
--cc=zhiwei_liu@linux.alibaba.com \
/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.