{"id":809022,"url":"http://patchwork.ozlabs.org/api/patches/809022/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170901154542.5687-1-cascardo@canonical.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170901154542.5687-1-cascardo@canonical.com>","list_archive_url":null,"date":"2017-09-01T15:45:42","name":"x86/acpi: build SRAT when memory hotplug is enabled","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"6970615949ff0fe3894cbde547e84866313f85e7","submitter":{"id":70574,"url":"http://patchwork.ozlabs.org/api/people/70574/?format=json","name":"Thadeu Lima de Souza Cascardo","email":"cascardo@canonical.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170901154542.5687-1-cascardo@canonical.com/mbox/","series":[{"id":1123,"url":"http://patchwork.ozlabs.org/api/series/1123/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=1123","date":"2017-09-01T15:45:42","name":"x86/acpi: build SRAT when memory hotplug is enabled","version":1,"mbox":"http://patchwork.ozlabs.org/series/1123/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/809022/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/809022/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xkXb84DZSz9sQl\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  2 Sep 2017 07:35:13 +1000 (AEST)","from localhost ([::1]:33619 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dntap-0000T5-Ls\n\tfor incoming@patchwork.ozlabs.org; Fri, 01 Sep 2017 17:35:11 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:54505)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <cascardo@canonical.com>) id 1dno95-0008By-9q\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 11:46:15 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <cascardo@canonical.com>) id 1dno92-00052d-82\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 11:46:11 -0400","from youngberry.canonical.com ([91.189.89.112]:38871)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <cascardo@canonical.com>)\n\tid 1dno92-00051G-1L\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 11:46:08 -0400","from 1.general.cascardo.us.vpn ([10.172.70.58]\n\thelo=localhost.localdomain) by youngberry.canonical.com with esmtpsa\n\t(TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76)\n\t(envelope-from <cascardo@canonical.com>)\n\tid 1dno8z-0004Gn-B7; Fri, 01 Sep 2017 15:46:05 +0000"],"From":"Thadeu Lima de Souza Cascardo <cascardo@canonical.com>","To":"qemu-devel@nongnu.org","Date":"Fri,  1 Sep 2017 12:45:42 -0300","Message-Id":"<20170901154542.5687-1-cascardo@canonical.com>","X-Mailer":"git-send-email 2.11.0","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 3.x [fuzzy]","X-Received-From":"91.189.89.112","X-Mailman-Approved-At":"Fri, 01 Sep 2017 17:34:26 -0400","Subject":"[Qemu-devel] [PATCH] x86/acpi: build SRAT when memory hotplug is\n\tenabled","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Igor Mammedov <imammedo@redhat.com>, Richard Henderson <rth@twiddle.net>,\n\tPaolo Bonzini <pbonzini@redhat.com>,\n\tEduardo Habkost <ehabkost@redhat.com>, \n\t\"Michael S. Tsirkin\" <mst@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"Linux uses SRAT to determine the maximum memory in a system, which is\nused to determine whether to use the swiotlb for IOMMU or not for a\ndevice that supports only 32 bits of addresses.\n\nWhen there is no NUMA configuration, qemu will not build SRAT. And when\nmemory hotplug is done, some Linux device drivers start failing.\n\nTested by running with -m 512M,slots=8,maxmem=1G, adding the memory,\nputting that online and using the system. Without the patch, swiotlb is\nnot used and ATA driver fails. With the patch, swiotlb is used, no\ndriver failure is observed.\n\nSigned-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>\n---\n hw/i386/acpi-build.c | 5 ++++-\n 1 file changed, 4 insertions(+), 1 deletion(-)","diff":"diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c\nindex 98dd424678..fb94249779 100644\n--- a/hw/i386/acpi-build.c\n+++ b/hw/i386/acpi-build.c\n@@ -2645,6 +2645,9 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)\n     GArray *tables_blob = tables->table_data;\n     AcpiSlicOem slic_oem = { .id = NULL, .table_id = NULL };\n     Object *vmgenid_dev;\n+    ram_addr_t hotplugabble_address_space_size =\n+        object_property_get_int(OBJECT(pcms), PC_MACHINE_MEMHP_REGION_SIZE,\n+                                NULL);\n \n     acpi_get_pm_info(&pm);\n     acpi_get_misc_info(&misc);\n@@ -2708,7 +2711,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)\n             build_tpm2(tables_blob, tables->linker);\n         }\n     }\n-    if (pcms->numa_nodes) {\n+    if (pcms->numa_nodes || hotplugabble_address_space_size) {\n         acpi_add_table(table_offsets, tables_blob);\n         build_srat(tables_blob, tables->linker, machine);\n         if (have_numa_distance) {\n","prefixes":[]}