From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57669) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vkt8i-00067k-Tx for qemu-devel@nongnu.org; Mon, 25 Nov 2013 05:11:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vkt8a-0003qe-Rv for qemu-devel@nongnu.org; Mon, 25 Nov 2013 05:11:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:1715) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vkt8a-0003qH-Jb for qemu-devel@nongnu.org; Mon, 25 Nov 2013 05:11:28 -0500 Date: Mon, 25 Nov 2013 11:11:14 +0100 From: Igor Mammedov Message-ID: <20131125111114.5058234d@nial.usersys.redhat.com> In-Reply-To: <20131121071840.GC19703@redhat.com> References: <1385001528-12003-1-git-send-email-imammedo@redhat.com> <1385001528-12003-27-git-send-email-imammedo@redhat.com> <20131121071840.GC19703@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 26/27] pc: ACPI BIOS: reserve SRAT entry for hotplug mem hole List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: peter.maydell@linaro.org, stefanha@redhat.com, stefanb@linux.vnet.ibm.com, qemu-devel@nongnu.org, chegu_vinod@hp.com, marcel.a@redhat.com, mjt@tls.msk.ru, mdroth@linux.vnet.ibm.com, armbru@redhat.com, vasilis.liaskovitis@profitbricks.com, quintela@redhat.com, kraxel@redhat.com, aliguori@amazon.com, hutao@cn.fujitsu.com, pbonzini@redhat.com, lcapitulino@redhat.com, afaerber@suse.de On Thu, 21 Nov 2013 09:18:40 +0200 "Michael S. Tsirkin" wrote: > On Thu, Nov 21, 2013 at 03:38:47AM +0100, Igor Mammedov wrote: > > Needed for Windows to use hotplugged memory device, otherwise > > it complains that server is not configured for memory hotplug. > > Tests shows that aftewards it uses dynamically provided > > proximity value from _PXM() method if available. > > > > Signed-off-by: Igor Mammedov > > Maybe add comment in code? > Someone reading the spec might well wonder. Ok. > > > --- > > hw/i386/acpi-build.c | 33 +++++++++++++++++++++++++++++++++ > > 1 files changed, 33 insertions(+), 0 deletions(-) > > > > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c > > index 86c1372..ab8e923 100644 > > --- a/hw/i386/acpi-build.c > > +++ b/hw/i386/acpi-build.c > > @@ -50,6 +50,7 @@ > > > > #include "qapi/qmp/qint.h" > > #include "qom/qom-qobject.h" > > +#include "hw/mem/dimm.h" > > > > typedef struct AcpiCpuInfo { > > DECLARE_BITMAP(found_cpus, MAX_CPUMASK_BITS + 1); > > @@ -1058,6 +1059,31 @@ acpi_build_srat_memory(AcpiSratMemoryAffinity *numamem, uint64_t base, > > numamem->range_length = cpu_to_le64(len); > > } > > > > +typedef struct { > > + AcpiSratMemoryAffinity **numamem; > > + GArray *table_data; > > +} AcpiSratHotplugMemoryArg; > > + > > +static int acpi_add_hotplug_memory_region_entry(Object *obj, void *opaque) > > +{ > > + AcpiSratHotplugMemoryArg *arg = opaque; > > + DimmBus *bus = (DimmBus *)object_dynamic_cast(obj, TYPE_DIMM_BUS); > > + > > + if (bus) { > > + uint64_t size = memory_region_size(&bus->as); > > + if (size) { > > + *arg->numamem = acpi_data_push(arg->table_data, > > + sizeof **arg->numamem); > > + acpi_build_srat_memory(*arg->numamem, bus->base, size, 0, > > + HOT_PLUGGABLE_MEM | ENABLED_MEM); > > + } > > + } > > + > > + object_child_foreach(obj, acpi_add_hotplug_memory_region_entry, > > + opaque); > > + return 0; > > +} > > + > > static void > > build_srat(GArray *table_data, GArray *linker, > > AcpiCpuInfo *cpu, PcGuestInfo *guest_info) > > @@ -1133,6 +1159,13 @@ build_srat(GArray *table_data, GArray *linker, > > acpi_build_srat_memory(numamem, 0, 0, 0, NOFLAGS_MEM); > > } > > > > + { > > + AcpiSratHotplugMemoryArg arg = { .numamem = &numamem, > > + .table_data = table_data }; > > + object_child_foreach(qdev_get_machine(), > > + acpi_add_hotplug_memory_region_entry, &arg); > > + } > > + > > build_header(linker, table_data, > > (void *)(table_data->data + srat_start), > > ACPI_SRAT_SIGNATURE, > > -- > > 1.7.1