From: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
To: Shannon Zhao <zhaoshenglong@huawei.com>,
qemu-arm@nongnu.org, peter.maydell@linaro.org
Cc: drjones@redhat.com, david.daney@cavium.com,
"Michael S. Tsirkin" <mst@redhat.com>,
qemu-devel@nongnu.org, peter.huangpeng@huawei.com,
shannon.zhao@linaro.org, Igor Mammedov <imammedo@redhat.com>
Subject: Re: [Qemu-arm] [Qemu-devel] [PATCH v7 4/5] ACPI: move acpi_build_srat_memory to common place
Date: Mon, 25 Apr 2016 15:58:54 +0300 [thread overview]
Message-ID: <571E148E.3070508@gmail.com> (raw)
In-Reply-To: <1461571547-13132-5-git-send-email-zhaoshenglong@huawei.com>
On 04/25/2016 11:05 AM, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
>
> Move acpi_build_srat_memory to common place so that it could be reused
> by ARM. Rename it to build_acpi_srat_memory.
>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Igor Mammedov <imammedo@redhat.com>
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> ---
> hw/acpi/aml-build.c | 11 +++++++++++
> hw/i386/acpi-build.c | 29 +++++------------------------
> include/hw/acpi/aml-build.h | 10 ++++++++++
> 3 files changed, 26 insertions(+), 24 deletions(-)
>
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index ab89ca6..f945524 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -1563,3 +1563,14 @@ build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets,
> build_header(linker, table_data,
> (void *)rsdt, "RSDT", rsdt_len, 1, oem_id, oem_table_id);
> }
> +
> +void build_acpi_srat_memory(AcpiSratMemoryAffinity *numamem, uint64_t base,
> + uint64_t len, int node, MemoryAffinityFlags flags)
> +{
> + numamem->type = ACPI_SRAT_MEMORY;
> + numamem->length = sizeof(*numamem);
> + numamem->proximity = cpu_to_le32(node);
> + numamem->flags = cpu_to_le32(flags);
> + numamem->base_addr = cpu_to_le64(base);
> + numamem->range_length = cpu_to_le64(len);
> +}
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 3c031aa..f939191 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -2427,25 +2427,6 @@ build_tpm2(GArray *table_data, GArray *linker)
> (void *)tpm2_ptr, "TPM2", sizeof(*tpm2_ptr), 4, NULL, NULL);
> }
>
> -typedef enum {
> - MEM_AFFINITY_NOFLAGS = 0,
> - MEM_AFFINITY_ENABLED = (1 << 0),
> - MEM_AFFINITY_HOTPLUGGABLE = (1 << 1),
> - MEM_AFFINITY_NON_VOLATILE = (1 << 2),
> -} MemoryAffinityFlags;
> -
> -static void
> -acpi_build_srat_memory(AcpiSratMemoryAffinity *numamem, uint64_t base,
> - uint64_t len, int node, MemoryAffinityFlags flags)
> -{
> - numamem->type = ACPI_SRAT_MEMORY;
> - numamem->length = sizeof(*numamem);
> - numamem->proximity = cpu_to_le32(node);
> - numamem->flags = cpu_to_le32(flags);
> - numamem->base_addr = cpu_to_le64(base);
> - numamem->range_length = cpu_to_le64(len);
> -}
> -
> static void
> build_srat(GArray *table_data, GArray *linker, MachineState *machine)
> {
> @@ -2491,7 +2472,7 @@ build_srat(GArray *table_data, GArray *linker, MachineState *machine)
> numa_start = table_data->len;
>
> numamem = acpi_data_push(table_data, sizeof *numamem);
> - acpi_build_srat_memory(numamem, 0, 640*1024, 0, MEM_AFFINITY_ENABLED);
> + build_acpi_srat_memory(numamem, 0, 640*1024, 0, MEM_AFFINITY_ENABLED);
Please run checkpatch before submitting. It will help getting it in sooner :)
In this case the ERROR was here before your code, but you have chance to fix it.
Thanks,
Marcel
> next_base = 1024 * 1024;
> for (i = 1; i < pcms->numa_nodes + 1; ++i) {
> mem_base = next_base;
> @@ -2507,7 +2488,7 @@ build_srat(GArray *table_data, GArray *linker, MachineState *machine)
> mem_len -= next_base - pcms->below_4g_mem_size;
> if (mem_len > 0) {
> numamem = acpi_data_push(table_data, sizeof *numamem);
> - acpi_build_srat_memory(numamem, mem_base, mem_len, i - 1,
> + build_acpi_srat_memory(numamem, mem_base, mem_len, i - 1,
> MEM_AFFINITY_ENABLED);
> }
> mem_base = 1ULL << 32;
> @@ -2515,13 +2496,13 @@ build_srat(GArray *table_data, GArray *linker, MachineState *machine)
> next_base += (1ULL << 32) - pcms->below_4g_mem_size;
> }
> numamem = acpi_data_push(table_data, sizeof *numamem);
> - acpi_build_srat_memory(numamem, mem_base, mem_len, i - 1,
> + build_acpi_srat_memory(numamem, mem_base, mem_len, i - 1,
> MEM_AFFINITY_ENABLED);
> }
> slots = (table_data->len - numa_start) / sizeof *numamem;
> for (; slots < pcms->numa_nodes + 2; slots++) {
> numamem = acpi_data_push(table_data, sizeof *numamem);
> - acpi_build_srat_memory(numamem, 0, 0, 0, MEM_AFFINITY_NOFLAGS);
> + build_acpi_srat_memory(numamem, 0, 0, 0, MEM_AFFINITY_NOFLAGS);
> }
>
> /*
> @@ -2531,7 +2512,7 @@ build_srat(GArray *table_data, GArray *linker, MachineState *machine)
> */
> if (hotplugabble_address_space_size) {
> numamem = acpi_data_push(table_data, sizeof *numamem);
> - acpi_build_srat_memory(numamem, pcms->hotplug_memory.base,
> + build_acpi_srat_memory(numamem, pcms->hotplug_memory.base,
> hotplugabble_address_space_size, 0,
> MEM_AFFINITY_HOTPLUGGABLE |
> MEM_AFFINITY_ENABLED);
> diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> index 2c994b3..a9e8a04 100644
> --- a/include/hw/acpi/aml-build.h
> +++ b/include/hw/acpi/aml-build.h
> @@ -198,6 +198,13 @@ typedef enum {
> AML_PULL_NONE = 3,
> } AmlPinConfig;
>
> +typedef enum {
> + MEM_AFFINITY_NOFLAGS = 0,
> + MEM_AFFINITY_ENABLED = (1 << 0),
> + MEM_AFFINITY_HOTPLUGGABLE = (1 << 1),
> + MEM_AFFINITY_NON_VOLATILE = (1 << 2),
> +} MemoryAffinityFlags;
> +
> typedef
> struct AcpiBuildTables {
> GArray *table_data;
> @@ -372,4 +379,7 @@ int
> build_append_named_dword(GArray *array, const char *name_format, ...)
> GCC_FMT_ATTR(2, 3);
>
> +void build_acpi_srat_memory(AcpiSratMemoryAffinity *numamem, uint64_t base,
> + uint64_t len, int node, MemoryAffinityFlags flags);
> +
> #endif
>
WARNING: multiple messages have this Message-ID (diff)
From: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
To: Shannon Zhao <zhaoshenglong@huawei.com>,
qemu-arm@nongnu.org, peter.maydell@linaro.org
Cc: drjones@redhat.com, "Michael S. Tsirkin" <mst@redhat.com>,
david.daney@cavium.com, peter.huangpeng@huawei.com,
qemu-devel@nongnu.org, shannon.zhao@linaro.org,
Igor Mammedov <imammedo@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v7 4/5] ACPI: move acpi_build_srat_memory to common place
Date: Mon, 25 Apr 2016 15:58:54 +0300 [thread overview]
Message-ID: <571E148E.3070508@gmail.com> (raw)
In-Reply-To: <1461571547-13132-5-git-send-email-zhaoshenglong@huawei.com>
On 04/25/2016 11:05 AM, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
>
> Move acpi_build_srat_memory to common place so that it could be reused
> by ARM. Rename it to build_acpi_srat_memory.
>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Igor Mammedov <imammedo@redhat.com>
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> ---
> hw/acpi/aml-build.c | 11 +++++++++++
> hw/i386/acpi-build.c | 29 +++++------------------------
> include/hw/acpi/aml-build.h | 10 ++++++++++
> 3 files changed, 26 insertions(+), 24 deletions(-)
>
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index ab89ca6..f945524 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -1563,3 +1563,14 @@ build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets,
> build_header(linker, table_data,
> (void *)rsdt, "RSDT", rsdt_len, 1, oem_id, oem_table_id);
> }
> +
> +void build_acpi_srat_memory(AcpiSratMemoryAffinity *numamem, uint64_t base,
> + uint64_t len, int node, MemoryAffinityFlags flags)
> +{
> + numamem->type = ACPI_SRAT_MEMORY;
> + numamem->length = sizeof(*numamem);
> + numamem->proximity = cpu_to_le32(node);
> + numamem->flags = cpu_to_le32(flags);
> + numamem->base_addr = cpu_to_le64(base);
> + numamem->range_length = cpu_to_le64(len);
> +}
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 3c031aa..f939191 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -2427,25 +2427,6 @@ build_tpm2(GArray *table_data, GArray *linker)
> (void *)tpm2_ptr, "TPM2", sizeof(*tpm2_ptr), 4, NULL, NULL);
> }
>
> -typedef enum {
> - MEM_AFFINITY_NOFLAGS = 0,
> - MEM_AFFINITY_ENABLED = (1 << 0),
> - MEM_AFFINITY_HOTPLUGGABLE = (1 << 1),
> - MEM_AFFINITY_NON_VOLATILE = (1 << 2),
> -} MemoryAffinityFlags;
> -
> -static void
> -acpi_build_srat_memory(AcpiSratMemoryAffinity *numamem, uint64_t base,
> - uint64_t len, int node, MemoryAffinityFlags flags)
> -{
> - numamem->type = ACPI_SRAT_MEMORY;
> - numamem->length = sizeof(*numamem);
> - numamem->proximity = cpu_to_le32(node);
> - numamem->flags = cpu_to_le32(flags);
> - numamem->base_addr = cpu_to_le64(base);
> - numamem->range_length = cpu_to_le64(len);
> -}
> -
> static void
> build_srat(GArray *table_data, GArray *linker, MachineState *machine)
> {
> @@ -2491,7 +2472,7 @@ build_srat(GArray *table_data, GArray *linker, MachineState *machine)
> numa_start = table_data->len;
>
> numamem = acpi_data_push(table_data, sizeof *numamem);
> - acpi_build_srat_memory(numamem, 0, 640*1024, 0, MEM_AFFINITY_ENABLED);
> + build_acpi_srat_memory(numamem, 0, 640*1024, 0, MEM_AFFINITY_ENABLED);
Please run checkpatch before submitting. It will help getting it in sooner :)
In this case the ERROR was here before your code, but you have chance to fix it.
Thanks,
Marcel
> next_base = 1024 * 1024;
> for (i = 1; i < pcms->numa_nodes + 1; ++i) {
> mem_base = next_base;
> @@ -2507,7 +2488,7 @@ build_srat(GArray *table_data, GArray *linker, MachineState *machine)
> mem_len -= next_base - pcms->below_4g_mem_size;
> if (mem_len > 0) {
> numamem = acpi_data_push(table_data, sizeof *numamem);
> - acpi_build_srat_memory(numamem, mem_base, mem_len, i - 1,
> + build_acpi_srat_memory(numamem, mem_base, mem_len, i - 1,
> MEM_AFFINITY_ENABLED);
> }
> mem_base = 1ULL << 32;
> @@ -2515,13 +2496,13 @@ build_srat(GArray *table_data, GArray *linker, MachineState *machine)
> next_base += (1ULL << 32) - pcms->below_4g_mem_size;
> }
> numamem = acpi_data_push(table_data, sizeof *numamem);
> - acpi_build_srat_memory(numamem, mem_base, mem_len, i - 1,
> + build_acpi_srat_memory(numamem, mem_base, mem_len, i - 1,
> MEM_AFFINITY_ENABLED);
> }
> slots = (table_data->len - numa_start) / sizeof *numamem;
> for (; slots < pcms->numa_nodes + 2; slots++) {
> numamem = acpi_data_push(table_data, sizeof *numamem);
> - acpi_build_srat_memory(numamem, 0, 0, 0, MEM_AFFINITY_NOFLAGS);
> + build_acpi_srat_memory(numamem, 0, 0, 0, MEM_AFFINITY_NOFLAGS);
> }
>
> /*
> @@ -2531,7 +2512,7 @@ build_srat(GArray *table_data, GArray *linker, MachineState *machine)
> */
> if (hotplugabble_address_space_size) {
> numamem = acpi_data_push(table_data, sizeof *numamem);
> - acpi_build_srat_memory(numamem, pcms->hotplug_memory.base,
> + build_acpi_srat_memory(numamem, pcms->hotplug_memory.base,
> hotplugabble_address_space_size, 0,
> MEM_AFFINITY_HOTPLUGGABLE |
> MEM_AFFINITY_ENABLED);
> diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> index 2c994b3..a9e8a04 100644
> --- a/include/hw/acpi/aml-build.h
> +++ b/include/hw/acpi/aml-build.h
> @@ -198,6 +198,13 @@ typedef enum {
> AML_PULL_NONE = 3,
> } AmlPinConfig;
>
> +typedef enum {
> + MEM_AFFINITY_NOFLAGS = 0,
> + MEM_AFFINITY_ENABLED = (1 << 0),
> + MEM_AFFINITY_HOTPLUGGABLE = (1 << 1),
> + MEM_AFFINITY_NON_VOLATILE = (1 << 2),
> +} MemoryAffinityFlags;
> +
> typedef
> struct AcpiBuildTables {
> GArray *table_data;
> @@ -372,4 +379,7 @@ int
> build_append_named_dword(GArray *array, const char *name_format, ...)
> GCC_FMT_ATTR(2, 3);
>
> +void build_acpi_srat_memory(AcpiSratMemoryAffinity *numamem, uint64_t base,
> + uint64_t len, int node, MemoryAffinityFlags flags);
> +
> #endif
>
next prev parent reply other threads:[~2016-04-25 12:59 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-25 8:05 [Qemu-devel] [PATCH v7 0/5] ARM: Add NUMA support for machine virt Shannon Zhao
2016-04-25 8:05 ` Shannon Zhao
2016-04-25 8:05 ` [Qemu-arm] [PATCH v7 1/5] ARM: Virt: Set numa-node-id for cpu and memory nodes Shannon Zhao
2016-04-25 8:05 ` [Qemu-devel] " Shannon Zhao
2016-04-25 8:05 ` [Qemu-arm] [PATCH v7 2/5] ACPI: Add GICC Affinity Structure Shannon Zhao
2016-04-25 8:05 ` [Qemu-devel] " Shannon Zhao
2016-04-25 8:05 ` [Qemu-devel] [PATCH v7 3/5] ACPI: Fix the definition of proximity in AcpiSratMemoryAffinity Shannon Zhao
2016-04-25 8:05 ` Shannon Zhao
2016-04-25 9:26 ` [Qemu-arm] " Andrew Jones
2016-04-25 9:26 ` Andrew Jones
2016-04-25 8:05 ` [Qemu-arm] [PATCH v7 4/5] ACPI: move acpi_build_srat_memory to common place Shannon Zhao
2016-04-25 8:05 ` [Qemu-devel] " Shannon Zhao
2016-04-25 9:28 ` [Qemu-arm] " Andrew Jones
2016-04-25 9:28 ` Andrew Jones
2016-04-25 12:58 ` Marcel Apfelbaum [this message]
2016-04-25 12:58 ` Marcel Apfelbaum
2016-04-25 8:05 ` [Qemu-devel] [PATCH v7 5/5] ACPI: Virt: Generate SRAT table Shannon Zhao
2016-04-25 8:05 ` Shannon Zhao
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=571E148E.3070508@gmail.com \
--to=marcel.apfelbaum@gmail.com \
--cc=david.daney@cavium.com \
--cc=drjones@redhat.com \
--cc=imammedo@redhat.com \
--cc=marcel@redhat.com \
--cc=mst@redhat.com \
--cc=peter.huangpeng@huawei.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=shannon.zhao@linaro.org \
--cc=zhaoshenglong@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.