From: Zhao Liu <zhao1.liu@intel.com>
To: Alireza Sanaee <alireza.sanaee@huawei.com>
Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org,
zhenyu.z.wang@intel.com, dapeng1.mi@linux.intel.com,
yongwei.ma@intel.com, armbru@redhat.com, farman@linux.ibm.com,
peter.maydell@linaro.org, mst@redhat.com, anisinha@redhat.com,
shannon.zhaosl@gmail.com, imammedo@redhat.com,
mtosatti@redhat.com, berrange@redhat.com,
richard.henderson@linaro.org, linuxarm@huwei.com,
shameerali.kolothum.thodi@huawei.com,
Jonathan.Cameron@huawei.com, jiangkunkun@huawei.com,
zhao1.liu@intel.com
Subject: Re: [PATCH 2/2] hw/acpi: add cache hierarchy node to pptt table
Date: Sat, 31 Aug 2024 19:47:49 +0800 [thread overview]
Message-ID: <ZtMC5Y5AJW3mAmO2@intel.com> (raw)
In-Reply-To: <20240823125446.721-3-alireza.sanaee@huawei.com>
Hi Alireza,
On Fri, Aug 23, 2024 at 01:54:46PM +0100, Alireza Sanaee wrote:
[snip]
> +static int partial_cache_description(MachineState *ms, ACPIPPTTCache* caches,
> + int num_caches)
> +{
> + int level, c;
> +
> + for (level = 1; level < num_caches; level++) {
> + for (c = 0; c < num_caches; c++) {
> + if (caches[c].level != level) {
> + continue;
> + }
> +
> + switch (level) {
> + case 1:
> + /*
> + * L1 cache is assumed to have both L1I and L1D available.
> + * Technically both need to be checked.
> + */
> + if (machine_get_cache_topo_level(ms, SMP_CACHE_L1I) ==
> + CPU_TOPO_LEVEL_DEFAULT) {
This check just concerns L1i, but it looks not covering L1d, is L1d being
missed?
> + assert(machine_get_cache_topo_level(ms, SMP_CACHE_L1D) !=
> + CPU_TOPO_LEVEL_DEFAULT);
I understand you don't want user to configure other different levels for
L1d in this case...If so, it's better to return error (error_steg or
error_report or some other error print ways) to tell user his cache
configuration is invalid.
> + return level;
> + }
> + break;
> + case 2:
> + if (machine_get_cache_topo_level(ms, SMP_CACHE_L2) ==
> + CPU_TOPO_LEVEL_DEFAULT) {
> + return level;
> + }
> + break;
> + case 3:
> + if (machine_get_cache_topo_level(ms, SMP_CACHE_L3) ==
> + CPU_TOPO_LEVEL_DEFAULT) {
> + return level;
> + }
> + break;
> + }
> + }
> + }
> +
> + return 0;
> +}
> +
[snip]
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index b0c68d66a3..b723248ecf 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -3093,6 +3093,11 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
> hc->unplug = virt_machine_device_unplug_cb;
> mc->nvdimm_supported = true;
> mc->smp_props.clusters_supported = true;
> + /* Supported cached */
> + mc->smp_props.cache_supported[SMP_CACHE_L1D] = true;
> + mc->smp_props.cache_supported[SMP_CACHE_L1I] = true;
> + mc->smp_props.cache_supported[SMP_CACHE_L2] = true;
> + mc->smp_props.cache_supported[SMP_CACHE_L3] = true;
> mc->auto_enable_numa_with_memhp = true;
> mc->auto_enable_numa_with_memdev = true;
> /* platform instead of architectural choice */
> diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c
> index bf6f2f9107..de95ec9c0f 100644
> --- a/hw/core/machine-smp.c
> +++ b/hw/core/machine-smp.c
> @@ -274,7 +274,11 @@ unsigned int machine_topo_get_threads_per_socket(const MachineState *ms)
> CpuTopologyLevel machine_get_cache_topo_level(const MachineState *ms,
> SMPCacheName cache)
> {
> - return ms->smp_cache->props[cache].topo;
> + if (ms->smp_cache) {
> + return ms->smp_cache->props[cache].topo;
> + }
> +
> + return CPU_TOPO_LEVEL_DEFAULT;
> }
>
> static bool machine_check_topo_support(MachineState *ms,
Maybe it's better to split smp-cache support/check on Arm in a seperate
patch.
Regards,
Zhao
next prev parent reply other threads:[~2024-08-31 11:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-23 12:54 [RFC PATCH 0/2] Specifying cache topology on ARM Alireza Sanaee via
2024-08-23 12:54 ` [PATCH 1/2] target/arm/tcg: increase cache level for cpu=max Alireza Sanaee via
2024-08-23 12:54 ` [PATCH 2/2] hw/acpi: add cache hierarchy node to pptt table Alireza Sanaee via
2024-08-31 11:47 ` Zhao Liu [this message]
2024-08-31 11:25 ` [RFC PATCH 0/2] Specifying cache topology on ARM Zhao Liu
2024-09-02 10:25 ` Alireza Sanaee via
2024-09-02 10:25 ` Alireza Sanaee via
2024-09-02 12:23 ` Zhao Liu
2024-09-02 11:49 ` Marcin Juszkiewicz
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=ZtMC5Y5AJW3mAmO2@intel.com \
--to=zhao1.liu@intel.com \
--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@huwei.com \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=shannon.zhaosl@gmail.com \
--cc=yongwei.ma@intel.com \
--cc=zhenyu.z.wang@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 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.