[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 25/27] pc: ACPI BIOS: use enum for defining memo
From: |
Igor Mammedov |
Subject: |
Re: [Qemu-devel] [PATCH 25/27] pc: ACPI BIOS: use enum for defining memory affinity flags |
Date: |
Mon, 25 Nov 2013 11:11:54 +0100 |
On Thu, 21 Nov 2013 09:20:18 +0200
"Michael S. Tsirkin" <address@hidden> wrote:
> On Thu, Nov 21, 2013 at 03:38:46AM +0100, Igor Mammedov wrote:
> > replace magic numbers with enum describing Flags field of
> > memory affinity in SRAT table.
> >
> > MemoryAffinityFlags enum will define flags decribed by:
> > ACPI spec 5.0, "5.2.16.2 Memory Affinity Structure",
> > "Table 5-69 Flags - Memory Affinity Structure"
> >
> > Signed-off-by: Igor Mammedov <address@hidden>
> > ---
> > hw/i386/acpi-build.c | 22 +++++++++++++++-------
> > 1 files changed, 15 insertions(+), 7 deletions(-)
> >
> > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > index d41fd81..86c1372 100644
> > --- a/hw/i386/acpi-build.c
> > +++ b/hw/i386/acpi-build.c
> > @@ -1038,15 +1038,22 @@ build_hpet(GArray *table_data, GArray *linker)
> > (void *)hpet, ACPI_HPET_SIGNATURE, sizeof(*hpet), 1);
> > }
> >
> > +typedef enum {
> > + NOFLAGS_MEM = 0,
> > + ENABLED_MEM = (1 << 0),
> > + HOT_PLUGGABLE_MEM = (1 << 1),
> > + NON_VOLATILE_MEM = (1 << 2),
> > +} MemoryAffinityFlags;
>
> Absolutely but please use prefixes not suffixes, and make them
> a bit more specific.
> E.g. MEM_AFFINITY_NOFLAGS
I'll do it, thanks!
>
> > +
> > static void
> > -acpi_build_srat_memory(AcpiSratMemoryAffinity *numamem,
> > - uint64_t base, uint64_t len, int node, int enabled)
> > +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);
> > memset(numamem->proximity, 0, 4);
> > numamem->proximity[0] = node;
> > - numamem->flags = cpu_to_le32(!!enabled);
> > + numamem->flags = cpu_to_le32(flags);
> > numamem->base_addr = cpu_to_le64(base);
> > numamem->range_length = cpu_to_le64(len);
> > }
> > @@ -1094,7 +1101,7 @@ build_srat(GArray *table_data, GArray *linker,
> > numa_start = table_data->len;
> >
> > numamem = acpi_data_push(table_data, sizeof *numamem);
> > - acpi_build_srat_memory(numamem, 0, 640*1024, 0, 1);
> > + acpi_build_srat_memory(numamem, 0, 640*1024, 0, ENABLED_MEM);
> > next_base = 1024 * 1024;
> > for (i = 1; i < guest_info->numa_nodes + 1; ++i) {
> > mem_base = next_base;
> > @@ -1110,19 +1117,20 @@ build_srat(GArray *table_data, GArray *linker,
> > mem_len -= next_base - guest_info->ram_size;
> > if (mem_len > 0) {
> > numamem = acpi_data_push(table_data, sizeof *numamem);
> > - acpi_build_srat_memory(numamem, mem_base, mem_len, i-1, 1);
> > + acpi_build_srat_memory(numamem, mem_base, mem_len, i-1,
> > + ENABLED_MEM);
> > }
> > mem_base = 1ULL << 32;
> > mem_len = next_base - guest_info->ram_size;
> > next_base += (1ULL << 32) - guest_info->ram_size;
> > }
> > numamem = acpi_data_push(table_data, sizeof *numamem);
> > - acpi_build_srat_memory(numamem, mem_base, mem_len, i - 1, 1);
> > + acpi_build_srat_memory(numamem, mem_base, mem_len, i - 1,
> > ENABLED_MEM);
> > }
> > slots = (table_data->len - numa_start) / sizeof *numamem;
> > for (; slots < guest_info->numa_nodes + 2; slots++) {
> > numamem = acpi_data_push(table_data, sizeof *numamem);
> > - acpi_build_srat_memory(numamem, 0, 0, 0, 0);
> > + acpi_build_srat_memory(numamem, 0, 0, 0, NOFLAGS_MEM);
> > }
> >
> > build_header(linker, table_data,
> > --
> > 1.7.1
- Re: [Qemu-devel] [PATCH 21/27] pc: add memory hotplug 440fx machine, (continued)
Re: [Qemu-devel] [PATCH 21/27] pc: add memory hotplug 440fx machine, Gerd Hoffmann, 2013/11/22
[Qemu-devel] [PATCH 22/27] pc: add memory hotplug Q35 machine, Igor Mammedov, 2013/11/20
[Qemu-devel] [PATCH 23/27] pc: ACPI BIOS: implement memory hotplug interface, Igor Mammedov, 2013/11/20
[Qemu-devel] [PATCH 24/27] pc: ACPI BIOS: add ssdt-mem.hex.generated and update ssdt-misc.hex.generated, Igor Mammedov, 2013/11/20
[Qemu-devel] [PATCH 25/27] pc: ACPI BIOS: use enum for defining memory affinity flags, Igor Mammedov, 2013/11/20
[Qemu-devel] [PATCH 26/27] pc: ACPI BIOS: reserve SRAT entry for hotplug mem hole, Igor Mammedov, 2013/11/20
[Qemu-devel] [PATCH 27/27] pc: ACPI BIOS: make GPE.3 handle memory hotplug event on PIIX and Q35 machines, Igor Mammedov, 2013/11/20
Re: [Qemu-devel] [PATCH 00/27 RFC v7] ACPI memory hotplug, Michael S. Tsirkin, 2013/11/21