From: Jonathan Cameron via <qemu-devel@nongnu.org>
To: Alireza Sanaee <alireza.sanaee@huawei.com>
Cc: <qemu-devel@nongnu.org>, <qemu-arm@nongnu.org>, <mst@redhat.com>,
<zhao1.liu@intel.com>, <dapeng1.mi@linux.intel.com>,
<armbru@redhat.com>, <farman@linux.ibm.com>,
<peter.maydell@linaro.org>, <anisinha@redhat.com>,
<shannon.zhaosl@gmail.com>, <imammedo@redhat.com>,
<mtosatti@redhat.com>, <berrange@redhat.com>,
<richard.henderson@linaro.org>,
<shameerali.kolothum.thodi@huawei.com>, <jiangkunkun@huawei.com>,
<yangyicong@hisilicon.com>, <linuxarm@huawei.com>
Subject: Re: [PATCH v8 4/6] hw/acpi/aml-build.c: add cache hierarchy to pptt table
Date: Thu, 13 Mar 2025 09:24:56 +0000 [thread overview]
Message-ID: <20250313092456.000024f1@huawei.com> (raw)
In-Reply-To: <20250310162337.844-5-alireza.sanaee@huawei.com>
On Mon, 10 Mar 2025 16:23:35 +0000
Alireza Sanaee <alireza.sanaee@huawei.com> wrote:
> Add cache topology to PPTT table. With this patch, both ACPI PPTT table
> and device tree will represent the same cache topology given users
> input.
>
> Signed-off-by: Alireza Sanaee <alireza.sanaee@huawei.com>
> Co-developed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
> Signed-off-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Hi Ali,
A few trivial style things. You'll need to rebase after 10.0 is out
anyway, so just tidy these up when you do that.
Jonathan
> ---
> hw/acpi/aml-build.c | 205 ++++++++++++++++++++++++++++++++-
> hw/arm/virt-acpi-build.c | 8 +-
> hw/loongarch/virt-acpi-build.c | 2 +-
> include/hw/acpi/aml-build.h | 4 +-
> include/hw/cpu/core.h | 1 +
> 5 files changed, 212 insertions(+), 8 deletions(-)
>
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index e5401dfdb1a8..e2568522660d 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
...
> /*
> * ACPI spec, Revision 6.3
> * 5.2.29.1 Processor hierarchy node structure (Type 0)
> @@ -2146,15 +2247,24 @@ void build_spcr(GArray *table_data, BIOSLinker *linker,
> * 5.2.29 Processor Properties Topology Table (PPTT)
> */
> void build_pptt(GArray *table_data, BIOSLinker *linker, MachineState *ms,
> - const char *oem_id, const char *oem_table_id)
> + const char *oem_id, const char *oem_table_id,
...
> @@ -2184,11 +2294,35 @@ void build_pptt(GArray *table_data, BIOSLinker *linker, MachineState *ms,
> socket_id = cpus->cpus[n].props.socket_id;
> cluster_id = -1;
> core_id = -1;
> + bottom_node = top_node;
> + num_priv = 0;
> + if (cache_described_at(ms, CPU_TOPOLOGY_LEVEL_SOCKET) &&
> + find_the_lowest_level_cache_defined_at_level(
> + ms,
> + &bottom_node,
> + CPU_TOPOLOGY_LEVEL_SOCKET))
> + {
As below.
> + build_caches(table_data, pptt_start,
> + num_caches, caches,
> + n, top_node, bottom_node,
> + &node_data_offset, &node_instr_offset);
> +
> + priv_rsrc[0] = node_instr_offset;
> + priv_rsrc[1] = node_data_offset;
> +
> + if (node_instr_offset || node_data_offset) {
> + num_priv = node_instr_offset == node_data_offset ? 1 : 2;
> + }
> +
> + top_cluster = bottom_node - 1;
> + }
> +
> socket_offset = table_data->len - pptt_start;
> build_processor_hierarchy_node(table_data,
> (1 << 0) | /* Physical package */
> (1 << 4), /* Identical Implementation */
> - root_offset, socket_id, NULL, 0);
> + root_offset, socket_id,
> + priv_rsrc, num_priv);
> }
>
> if (mc->smp_props.clusters_supported && mc->smp_props.has_clusters) {
> @@ -2196,21 +2330,81 @@ void build_pptt(GArray *table_data, BIOSLinker *linker, MachineState *ms,
> assert(cpus->cpus[n].props.cluster_id > cluster_id);
> cluster_id = cpus->cpus[n].props.cluster_id;
> core_id = -1;
> + bottom_cluster = top_cluster;
> + num_priv = 0;
> +
> + if (cache_described_at(ms, CPU_TOPOLOGY_LEVEL_CLUSTER) &&
> + find_the_lowest_level_cache_defined_at_level(
> + ms,
> + &bottom_cluster,
> + CPU_TOPOLOGY_LEVEL_CLUSTER))
> + {
As below, style not correct. Please check for other cases.
> +
> + build_caches(table_data, pptt_start,
> + num_caches, caches, n, top_cluster,
> + bottom_cluster, &cluster_data_offset,
> + &cluster_instr_offset);
> +
> + priv_rsrc[0] = cluster_instr_offset;
> + priv_rsrc[1] = cluster_data_offset;
> +
> + if (cluster_instr_offset || cluster_data_offset) {
> + num_priv =
> + cluster_instr_offset == cluster_data_offset ? 1 : 2;
> + }
> +
> + top_core = bottom_cluster - 1;
> + } else if (top_cluster == bottom_node - 1) {
> + /* socket cache but no cluster cache */
> + top_core = bottom_node - 1;
> + }
...
> + if (cpus->cpus[n].props.core_id != core_id) {
> + bottom_core = top_core;
> + num_priv = 0;
> +
> + if (cache_described_at(ms, CPU_TOPOLOGY_LEVEL_CORE) &&
> + find_the_lowest_level_cache_defined_at_level(
> + ms,
> + &bottom_core,
> + CPU_TOPOLOGY_LEVEL_CORE))
> + {
Trivial but that's not qemu coding style. Bracket needs to go on end of
line above.
> + build_caches(table_data, pptt_start,
> + num_caches, caches,
> + n, top_core, bottom_core,
> + &core_data_offset, &core_instr_offset);
> +
> + priv_rsrc[0] = core_instr_offset;
> + priv_rsrc[1] = core_data_offset;
> +
> + num_priv = core_instr_offset == core_data_offset ? 1 : 2;
> + }
> + }
> +
> +
One blank line enough.
> if (ms->smp.threads == 1) {
> build_processor_hierarchy_node(table_data,
> (1 << 1) | /* ACPI Processor ID valid */
> (1 << 3), /* Node is a Leaf */
> - cluster_offset, n, NULL, 0);
> + cluster_offset, n,
> + priv_rsrc, num_priv);
next prev parent reply other threads:[~2025-03-13 9:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-10 16:23 [PATCH v8 0/6] Specifying cache topology on ARM Alireza Sanaee via
2025-03-10 16:23 ` [PATCH v8 1/6] target/arm/tcg: increase cache level for cpu=max Alireza Sanaee via
2025-04-07 17:07 ` Eric Auger
2025-04-08 8:26 ` Alireza Sanaee via
2025-03-10 16:23 ` [PATCH v8 2/6] arm/virt.c: add cache hierarchy to device tree Alireza Sanaee via
2025-03-10 16:23 ` [PATCH v8 3/6] bios-tables-test: prepare to change ARM ACPI virt PPTT Alireza Sanaee via
2025-03-13 9:18 ` Jonathan Cameron via
2025-03-10 16:23 ` [PATCH v8 4/6] hw/acpi/aml-build.c: add cache hierarchy to pptt table Alireza Sanaee via
2025-03-13 9:24 ` Jonathan Cameron via [this message]
2025-03-13 9:38 ` Alireza Sanaee via
2025-03-10 16:23 ` [PATCH v8 5/6] tests/qtest/bios-table-test: testing new ARM ACPI PPTT topology Alireza Sanaee via
2025-04-07 17:30 ` Eric Auger
2025-04-08 8:59 ` Alireza Sanaee via
2025-03-10 16:23 ` [PATCH v8 6/6] Update the ACPI tables according to the acpi aml_build change, also empty bios-tables-test-allowed-diff.h Alireza Sanaee via
2025-04-07 17:24 ` [PATCH v8 0/6] Specifying cache topology on ARM Eric Auger
2025-04-08 8:48 ` Alireza Sanaee via
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=20250313092456.000024f1@huawei.com \
--to=qemu-devel@nongnu.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=alireza.sanaee@huawei.com \
--cc=anisinha@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=dapeng1.mi@linux.intel.com \
--cc=farman@linux.ibm.com \
--cc=imammedo@redhat.com \
--cc=jiangkunkun@huawei.com \
--cc=linuxarm@huawei.com \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=shannon.zhaosl@gmail.com \
--cc=yangyicong@hisilicon.com \
--cc=zhao1.liu@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).