All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: Ying Fang <fangying1@huawei.com>
Cc: peter.maydell@linaro.org, zhang.zhanghailiang@huawei.com,
	qemu-devel@nongnu.org, alex.chen@huawei.com,
	shannon.zhaosl@gmail.com, qemu-arm@nongnu.org,
	alistair.francis@wdc.com, imammedo@redhat.com
Subject: Re: [RFC PATCH v2 09/13] hw/arm/virt-acpi-build: add PPTT table
Date: Thu, 29 Oct 2020 17:56:14 +0100	[thread overview]
Message-ID: <20201029165614.mbwv26bnx6ntughx@kamzik.brq.redhat.com> (raw)
In-Reply-To: <20201020131440.1090-10-fangying1@huawei.com>

On Tue, Oct 20, 2020 at 09:14:36PM +0800, Ying Fang wrote:
> Add the Processor Properties Topology Table (PPTT) to present CPU topology
> information to the guest.
> 
> Signed-off-by: Andrew Jones <drjones@redhat.com>

I don't know why I have an s-o-b here. I guess it's because this code
looks nearly identical to what I wrote, except for using the new and,
IMO, unnecessary build_socket_hierarchy and build_smt_hierarchy functions.

IMHO, you should drop the last patch and just take 

https://github.com/rhdrjones/qemu/commit/439b38d67ca1f2cbfa5b9892a822b651ebd05c11

as it is, unless it needs to be fixed somehow.

Thanks,
drew

> Signed-off-by: Ying Fang <fangying1@huawei.com>
> ---
>  hw/arm/virt-acpi-build.c | 42 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 42 insertions(+)
> 
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index fae5a26741..e1f3ea50ad 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -429,6 +429,42 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
>                   "SRAT", table_data->len - srat_start, 3, NULL, NULL);
>  }
>  
> +static void build_pptt(GArray *table_data, BIOSLinker *linker, MachineState *ms)
> +{
> +    int pptt_start = table_data->len;
> +    int uid = 0, cpus = 0, socket;
> +    unsigned int smp_cores = ms->smp.cores;
> +    unsigned int smp_threads = ms->smp.threads;
> +
> +    acpi_data_push(table_data, sizeof(AcpiTableHeader));
> +
> +    for (socket = 0; cpus < ms->possible_cpus->len; socket++) {
> +        uint32_t socket_offset = table_data->len - pptt_start;
> +        int core;
> +
> +        build_socket_hierarchy(table_data, 0, socket);
> +
> +        for (core = 0; core < smp_cores; core++) {
> +            uint32_t core_offset = table_data->len - pptt_start;
> +            int thread;
> +
> +            if (smp_threads <= 1) {
> +                build_processor_hierarchy(table_data, 2, socket_offset, uid++);
> +             } else {
> +                build_processor_hierarchy(table_data, 0, socket_offset, core);
> +                for (thread = 0; thread < smp_threads; thread++) {
> +                    build_smt_hierarchy(table_data, core_offset, uid++);
> +                }
> +             }
> +        }
> +        cpus += smp_cores * smp_threads;
> +    }
> +
> +    build_header(linker, table_data,
> +                 (void *)(table_data->data + pptt_start), "PPTT",
> +                 table_data->len - pptt_start, 2, NULL, NULL);
> +}
> +
>  /* GTDT */
>  static void
>  build_gtdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
> @@ -669,6 +705,7 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
>      unsigned dsdt, xsdt;
>      GArray *tables_blob = tables->table_data;
>      MachineState *ms = MACHINE(vms);
> +    bool cpu_topology_enabled = !vmc->ignore_cpu_topology;
>  
>      table_offsets = g_array_new(false, true /* clear */,
>                                          sizeof(uint32_t));
> @@ -688,6 +725,11 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
>      acpi_add_table(table_offsets, tables_blob);
>      build_madt(tables_blob, tables->linker, vms);
>  
> +    if (cpu_topology_enabled) {
> +        acpi_add_table(table_offsets, tables_blob);
> +        build_pptt(tables_blob, tables->linker, ms);
> +    }
> +
>      acpi_add_table(table_offsets, tables_blob);
>      build_gtdt(tables_blob, tables->linker, vms);
>  
> -- 
> 2.23.0
> 
> 



  reply	other threads:[~2020-10-29 16:57 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-20 13:14 [RFC PATCH v2 00/13] hw/arm/virt: Introduce cpu and cache topology support Ying Fang
2020-10-20 13:14 ` [RFC PATCH v2 01/13] hw/arm/virt: Spell out smp.cpus and smp.max_cpus Ying Fang
2020-10-20 13:14 ` [RFC PATCH v2 02/13] hw/arm/virt: Remove unused variable Ying Fang
2020-10-20 13:14 ` [RFC PATCH v2 03/13] hw/arm/virt: Replace smp_parse with one that prefers cores Ying Fang
2020-10-20 13:14 ` [RFC PATCH v2 04/13] device_tree: Add qemu_fdt_add_path Ying Fang
2020-10-20 13:14 ` [RFC PATCH v2 05/13] hw: add compat machines for 5.3 Ying Fang
2020-10-29 17:08   ` Andrew Jones
2020-11-03  1:47     ` Ying Fang
2020-10-20 13:14 ` [RFC PATCH v2 06/13] hw/arm/virt: DT: add cpu-map Ying Fang
2020-10-20 13:14 ` [RFC PATCH v2 07/13] hw/arm/virt-acpi-build: distinguish possible and present cpus Message Ying Fang
2020-10-29 17:20   ` Andrew Jones
2020-11-02  3:13     ` Ying Fang
2020-11-03  2:46     ` Ying Fang
2020-10-20 13:14 ` [RFC PATCH v2 08/13] hw/acpi/aml-build: add processor hierarchy node structure Ying Fang
2020-10-29 16:52   ` Andrew Jones
2020-10-29 17:24   ` Andrew Jones
2020-11-03  2:16     ` Ying Fang
2020-10-20 13:14 ` [RFC PATCH v2 09/13] hw/arm/virt-acpi-build: add PPTT table Ying Fang
2020-10-29 16:56   ` Andrew Jones [this message]
2020-11-03  2:34     ` Ying Fang
2020-10-20 13:14 ` [RFC PATCH v2 10/13] target/arm/cpu: Add CPU cache description for arm Ying Fang
2020-10-20 13:14 ` [RFC PATCH v2 11/13] hw/arm/virt: add fdt cache information Ying Fang
2020-10-20 13:14 ` [RFC PATCH v2 12/13] hw/acpi/aml-build: build ACPI CPU cache hierarchy information Ying Fang
2020-10-20 13:14 ` [RFC PATCH v2 13/13] hw/arm/virt-acpi-build: Enable CPU cache topology Ying Fang

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=20201029165614.mbwv26bnx6ntughx@kamzik.brq.redhat.com \
    --to=drjones@redhat.com \
    --cc=alex.chen@huawei.com \
    --cc=alistair.francis@wdc.com \
    --cc=fangying1@huawei.com \
    --cc=imammedo@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shannon.zhaosl@gmail.com \
    --cc=zhang.zhanghailiang@huawei.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.