Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D1C26CC6B39 for ; Thu, 15 Oct 2026 16:56:47 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xHOkz-0006FI-RD; Thu, 15 Oct 2026 12:56:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHOkv-0006En-LJ for qemu-riscv@nongnu.org; Thu, 15 Oct 2026 12:56:37 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xHOkr-0003Pm-Ek for qemu-riscv@nongnu.org; Thu, 15 Oct 2026 12:56:37 -0400 Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 69FGitDU1596905 for ; Thu, 15 Oct 2026 16:56:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= gG7ACg1z6L1SEO51yYG9+sA6LIAZRJwe+ytR6c12GDI=; b=mktC8Sv8zSSnGrAw pMkdy/Lc2wsUrGV5d1H8NBq26WzfEsWszqXl6lgExdfVkNeGaNELH5Z7nGYHfgv+ jJNfMDTvIrFjhDpUXIY67bDn/nSW7qQImvr+1HO33ekbMZBJSLTM2QWxNhAnTJer MPZ9bySC3LTfljUt3tD9hvP9vSRtIOQAdmbGT+MrQhjNNsTpllQiipqZh6HB9rG7 960WEhmWHIU4XkJED+qmCbRPsaUSElxO0XdTfQd7ot2dgnJeK81Se22Dt189SuRK yjV10O+qBZDw8bgFcy6bE1zF7eN02fdjrly8YMh6dtn5qRHzg+5xAli7/0T45/n3 NmCPTw== Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4haw2v9j4r-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 15 Oct 2026 16:56:30 +0000 (GMT) Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-934956beec8so339325085a.0 for ; Thu, 15 Oct 2026 09:56:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1792083389; x=1792688189; darn=nongnu.org; h=content-transfer-encoding:content-type:in-reply-to:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to:content-type; bh=gG7ACg1z6L1SEO51yYG9+sA6LIAZRJwe+ytR6c12GDI=; b=TLrLvcC6ORQONaPMdKfwzMNMT6j+KSa2KgkMeVbpNhMYJl0P6jWZxXAwBIzGfwaIFy JiPZwMs7tZA5KU5/PFOIo/a3uL9sVxNwZ+4fPG1LiyVToIR2barQ/kXqC16A1NCigFLP I+4AmUdVJaY44+FSM7TPgAvyK9uzrY5lXmCZzanJE/JrKvfJOBMtUAkj9kaDFDI0Zy2e MqaZGF7iIt+Qx/vRDoXsZ5cJbvjXPbGb0tYM8CwQatBnXHnGP6I1iv38l+xz7N4fm/Rf B5j5r8cpfQYCK9Arfy7gCvr4xYWoSJzKAHbpBlebmrKEMhPOWlA2xXSZ/D0wErWssqaY yO/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792083389; x=1792688189; h=content-transfer-encoding:content-type:in-reply-to:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=gG7ACg1z6L1SEO51yYG9+sA6LIAZRJwe+ytR6c12GDI=; b=XKBCNOAm+C9rZ+NRFEXfpdwFnbXTllb/osIXB6ZD/6ZndJDh5ZxUMAMAIEVN6MYeFq 4VqRerCdu07sLjTt4hTHOcumYqZPMgIfCWRcTZ4gye7J0f0+60CPYkCIFmw423ea5q3S CLGIe+EjJ+4qt84HgxjMRrDhrVGTviQvbwkoLYA4+3bYFQl+4W+OvEdcLdK9o4S9AWFF ed8j1BzUY3gacn/Wg6XHYtV1/shrot070dxEfXcFUqeoVn2Y6s2TelccSI1uu8ATyBHl OZqPnI38A8YbCvGIK1ok5R/qAnkihytd+Gr02RehiFwIUZSiJpNGQrDzIXCkG706pl73 M2qg== X-Forwarded-Encrypted: i=1; AKwUvBzLb8pHIjN11dtvt/8wgFMyWCkvjl10qcGVTEA/7RaAz7tg8C81AciJIr1VDMINYbfTr3xT/uGbG8ju@nongnu.org X-Gm-Message-State: AFq9FYI7aDdGoqCW4tBwUItUMyJfSB5uRYI+czy1hjv8enXOa7n8uVpL EM8u8OqbOGLg8803N7KAhbkXezOLdIjVv6fyBxdoYdw8ll2gD8UuWi3rqQBqbqfCYVcHR3XD3aM sbpt09euYuYGRJMysM3jpdeavPHmxiwAC9L1Zu+on8QNzRX+YcfKfEQi2Bg== X-Gm-Gg: AYBFou1wf3Mt5ADc+Q4RJGjXcWGNVxa8dNqY87XBrmNmgi18PiN58x7pYsHOXJ//xBj d905BhAyMMH/WsW9UtSKQdtOCk/AlufoGwuR64DWF8SFL81RpAcHb8mSpG/6MeT6NQGWvO90cvM JvXLvFSb+fx9q9pgSBIhKE96jx1ChhKQ9gEb6cvXtJZaUCgwdzkEeW92gNOgy0utL7+ZOL2Bowb ztfvyJ/jQLe/LvOo9c+8Nf5kP4+3OIK/TTz2b0wHi2iyAvcmoXM5HGusLNzsbLgI/S+X/iyuRNJ PCP5ordPPxlXJbgXyJrDJgwuuG4Gx4/u+OVNh1aGkZsZF7JpTMhTM8XcyUKwqv4fBmHf94njd68 KdgcYRWehVGtVKDBQvJWl/CHNoFGEr3j9N6Q= X-Received: by 2002:a05:620a:2949:b0:93e:c12c:4409 with SMTP id af79cd13be357-93ec12c4a64mr3026962385a.69.1792083388973; Thu, 15 Oct 2026 09:56:28 -0700 (PDT) X-Received: by 2002:a05:620a:2949:b0:93e:c12c:4409 with SMTP id af79cd13be357-93ec12c4a64mr3026955285a.69.1792083388274; Thu, 15 Oct 2026 09:56:28 -0700 (PDT) Received: from [192.168.68.103] ([152.234.126.58]) by smtp.gmail.com with ESMTPSA id af79cd13be357-93ef50947e6sm811063485a.42.2026.10.15.09.56.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 15 Oct 2026 09:56:27 -0700 (PDT) Message-ID: Date: Thu, 15 Oct 2026 13:56:23 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/4] hw/riscv/virt: Add ACPI PPTT table To: Sunil V L , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: Palmer Dabbelt , Alistair Francis , Weiwei Li , Liu Zhiwei , Chao Liu , "Michael S . Tsirkin" , Igor Mammedov , Ani Sinha , Anup Patel , Drew Fustini , Prajwal N , Shankar C , Sia Jee Heng References: <20261015064957.4076464-1-sunilvl@oss.qualcomm.com> <20261015064957.4076464-3-sunilvl@oss.qualcomm.com> From: Daniel Henrique Barboza Content-Language: en-US In-Reply-To: <20261015064957.4076464-3-sunilvl@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDE1MDA2NyBTYWx0ZWRfX42yRPAhgj9C2 PymNKYkhO+JAaNelbj7CMVsO6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0Fv TrWMnYDB+ilwVt1CaBhh9aqyfYCnmZw= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-10-14_01,2026-10-14_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 lowpriorityscore=0 spamscore=0 clxscore=1015 bulkscore=0 impostorscore=0 suspectscore=0 adultscore=0 phishscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610080000 definitions=main-2610150067 Received-SPF: pass client-ip=205.220.168.131; envelope-from=daniel.barboza@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-riscv@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-riscv-bounces+qemu-riscv=archiver.kernel.org@nongnu.org Sender: qemu-riscv-bounces+qemu-riscv=archiver.kernel.org@nongnu.org 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 > Signed-off-by: Sia Jee Heng > --- Reviewed-by: Daniel Henrique Barboza > 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,