From nobody Wed Nov 5 08:31:07 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504301779780106.60906107644655; Fri, 1 Sep 2017 14:36:19 -0700 (PDT) Received: from localhost ([::1]:33633 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dntbu-0001s4-8b for importer@patchew.org; Fri, 01 Sep 2017 17:36:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54505) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dno95-0008By-9q for qemu-devel@nongnu.org; Fri, 01 Sep 2017 11:46:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dno92-00052d-82 for qemu-devel@nongnu.org; Fri, 01 Sep 2017 11:46:11 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:38871) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dno92-00051G-1L for qemu-devel@nongnu.org; Fri, 01 Sep 2017 11:46:08 -0400 Received: from 1.general.cascardo.us.vpn ([10.172.70.58] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1dno8z-0004Gn-B7; Fri, 01 Sep 2017 15:46:05 +0000 From: Thadeu Lima de Souza Cascardo 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 enabled X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov , Richard Henderson , Paolo Bonzini , Eduardo Habkost , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Linux uses SRAT to determine the maximum memory in a system, which is used to determine whether to use the swiotlb for IOMMU or not for a device that supports only 32 bits of addresses. When there is no NUMA configuration, qemu will not build SRAT. And when memory hotplug is done, some Linux device drivers start failing. Tested by running with -m 512M,slots=3D8,maxmem=3D1G, adding the memory, putting that online and using the system. Without the patch, swiotlb is not used and ATA driver fails. With the patch, swiotlb is used, no driver failure is observed. Signed-off-by: Thadeu Lima de Souza Cascardo --- hw/i386/acpi-build.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 98dd424678..fb94249779 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2645,6 +2645,9 @@ void acpi_build(AcpiBuildTables *tables, MachineState= *machine) GArray *tables_blob =3D tables->table_data; AcpiSlicOem slic_oem =3D { .id =3D NULL, .table_id =3D NULL }; Object *vmgenid_dev; + ram_addr_t hotplugabble_address_space_size =3D + object_property_get_int(OBJECT(pcms), PC_MACHINE_MEMHP_REGION_SIZE, + NULL); =20 acpi_get_pm_info(&pm); acpi_get_misc_info(&misc); @@ -2708,7 +2711,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState= *machine) build_tpm2(tables_blob, tables->linker); } } - if (pcms->numa_nodes) { + if (pcms->numa_nodes || hotplugabble_address_space_size) { acpi_add_table(table_offsets, tables_blob); build_srat(tables_blob, tables->linker, machine); if (have_numa_distance) { --=20 2.11.0