From nobody Mon Feb 9 16:32:43 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1709646202; cv=none; d=zohomail.com; s=zohoarc; b=hHIX5zm8cnL4NR23haY26BafvAmmWfS69RYWOyDJR6ll2S7414H+gdSv/xv3B42OpV1kQ5jxkAIzXWOe44+QxIwfEyb6h04vnumoo/YV3et5ku245SPD+YToU2jemhQwj02Kt6sd3d2UPCRe5LKbxSfSQr2a765Q0Jr6OMjEo3I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709646202; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=P6j3vsQkgHjlqXgYSK7hYcuXtUupY0HchuWejne43RQ=; b=ZY8nbkzvLserN7LZInaC+YVZLgcv0SC3rTp/Ue7byPr+qzkTqa9d3t4b9qwDF+cN4ovJNxX3rXyv3oznerl0QnaOXUUur6modvAcc5rJ6IwI/KCEJGdas2XT7R+LwHnxSXyIrwmCxoNQnTf3IQAmDY+UIFsIm/8Wh08l3G8Bmkw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1709646202470844.097813083813; Tue, 5 Mar 2024 05:43:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhV4U-0002jr-Jj; Tue, 05 Mar 2024 08:43:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rhV4S-0002aY-B6 for qemu-devel@nongnu.org; Tue, 05 Mar 2024 08:43:04 -0500 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rhV4P-0003yW-A2 for qemu-devel@nongnu.org; Tue, 05 Mar 2024 08:43:04 -0500 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-5640fef9fa6so6950009a12.0 for ; Tue, 05 Mar 2024 05:43:00 -0800 (PST) Received: from m1x-phil.lan ([176.176.177.70]) by smtp.gmail.com with ESMTPSA id ev16-20020a056402541000b0055d333a0584sm5846620edb.72.2024.03.05.05.42.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 05 Mar 2024 05:42:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709646179; x=1710250979; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=P6j3vsQkgHjlqXgYSK7hYcuXtUupY0HchuWejne43RQ=; b=dhSqQ6LoHh4QuI+bffRHfh7C1C2+AiLKLlWfzbEhvHwMrKmyVfl00LvnHRoskau7x7 zrx8+BqoxSflO1vZrMzpzNU6ND4Q55nqkwvOrDlXuUJhL7LesO9f8rKWaBMlr0GlfptL AhtobSl056e8Cc+ILNQsV41XcbuIk0osAeRsh2WakS2LFBUywBSj6mrCjP/MdzgLo24H 51+ZhweWKM/2JFODGi+Nd7C0zM07Ufr9+Cwg0+wJ1ZfOgnd1CEO7JLaWqRb1Sqc+iIc+ kF3T4Dgbw02NugXq26vOJ+Fzp29I7WtT6fgb3AUIUxCLuFzafgXXIINGpPRxzyyCDt2U yf4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709646179; x=1710250979; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P6j3vsQkgHjlqXgYSK7hYcuXtUupY0HchuWejne43RQ=; b=ti97BeOQsAoDbcc82xxq1N15DRTWb6VLfG/o2Jw6qX6qK/T+012/xbTnHL7yKZ8pLy CPyOGHEfeKCa0Tb7nq5Rg25yZgfak+NJ4C5OQB2PORIissyjo8WLGWqbAiVHkYLjG/SI CT56w2DQt10UiuKTslKQJm4arR2ZcmTu4jpul568ABX+buYpRswRNxVAVVLb82mR1qXC d7rJZ+tom0Hi8GOZSI/C38LMsqAEZfibL9+1EFJ6CLAeNLuDxj36P6qcC7oUN/NaRNML Q70i3E0j7E51mK2q3xyP40Qt5LAK+37TdG4H13lmuIv9sbCQVg1jouVetpIDxTGLAzYW eVGA== X-Gm-Message-State: AOJu0YyBNN9Qy8uC/wdnK+EHomGRDTj336xl4BZeeDyJ7PXw1HXxyrxV yCiBCi4XTgD14NoefgF1hkjMPUmEF6VDsweE3auJpltW6KeHlNyoBXBxNGiUBOPc0a158o3e+jv y X-Google-Smtp-Source: AGHT+IFbWNyURA+FceZTD6yItwbOnb08ix3nn/dgtrYLs3f5Fy0iPr8irxrkPsFNRKIP2au/om3Y3Q== X-Received: by 2002:a05:6402:2152:b0:566:ef8:a81a with SMTP id bq18-20020a056402215200b005660ef8a81amr9346231edb.7.1709646179007; Tue, 05 Mar 2024 05:42:59 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Thomas Huth Cc: Igor Mammedov , Richard Henderson , kvm@vger.kernel.org, Marcelo Tosatti , devel@lists.libvirt.org, David Hildenbrand , Ani Sinha , Paolo Bonzini , Marcel Apfelbaum , "Michael S. Tsirkin" , Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eduardo Habkost Subject: [PATCH-for-9.1 05/18] hw/i386/acpi: Remove PCMachineClass::legacy_acpi_table_size Date: Tue, 5 Mar 2024 14:42:07 +0100 Message-ID: <20240305134221.30924-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240305134221.30924-1-philmd@linaro.org> References: <20240305134221.30924-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=philmd@linaro.org; helo=mail-ed1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1709646202748100001 PCMachineClass::legacy_acpi_table_size was only used by the pc-i440fx-2.0 machine, which got removed. Remove it and simplify acpi_build(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/i386/pc.h | 1 - hw/i386/acpi-build.c | 60 +++++++++----------------------------------- 2 files changed, 12 insertions(+), 49 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 3360ca2307..758d670a36 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -103,7 +103,6 @@ struct PCMachineClass { /* ACPI compat: */ bool has_acpi_build; bool rsdp_in_ram; - int legacy_acpi_table_size; unsigned acpi_data_size; int pci_root_uid; =20 diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 15242b9096..8c7fad92e9 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2496,13 +2496,12 @@ void acpi_build(AcpiBuildTables *tables, MachineSta= te *machine) X86MachineState *x86ms =3D X86_MACHINE(machine); DeviceState *iommu =3D pcms->iommu; GArray *table_offsets; - unsigned facs, dsdt, rsdt, fadt; + unsigned facs, dsdt, rsdt; AcpiPmInfo pm; AcpiMiscInfo misc; AcpiMcfgInfo mcfg; Range pci_hole =3D {}, pci_hole64 =3D {}; uint8_t *u; - size_t aml_len =3D 0; GArray *tables_blob =3D tables->table_data; AcpiSlicOem slic_oem =3D { .id =3D NULL, .table_id =3D NULL }; Object *vmgenid_dev; @@ -2548,19 +2547,12 @@ void acpi_build(AcpiBuildTables *tables, MachineSta= te *machine) build_dsdt(tables_blob, tables->linker, &pm, &misc, &pci_hole, &pci_hole64, machine); =20 - /* Count the size of the DSDT and SSDT, we will need it for legacy - * sizing of ACPI tables. - */ - aml_len +=3D tables_blob->len - dsdt; - /* ACPI tables pointed to by RSDT */ - fadt =3D tables_blob->len; acpi_add_table(table_offsets, tables_blob); pm.fadt.facs_tbl_offset =3D &facs; pm.fadt.dsdt_tbl_offset =3D &dsdt; pm.fadt.xdsdt_tbl_offset =3D &dsdt; build_fadt(tables_blob, tables->linker, &pm.fadt, oem_id, oem_table_id= ); - aml_len +=3D tables_blob->len - fadt; =20 acpi_add_table(table_offsets, tables_blob); acpi_build_madt(tables_blob, tables->linker, x86ms, @@ -2691,49 +2683,21 @@ void acpi_build(AcpiBuildTables *tables, MachineSta= te *machine) * too simple to be enough. 4k turned out to be too small an * alignment very soon, and in fact it is almost impossible to * keep the table size stable for all (max_cpus, max_memory_slots) - * combinations. So the table size is always 64k for pc-i440fx-2.1 - * and we give an error if the table grows beyond that limit. - * - * We still have the problem of migrating from "-M pc-i440fx-2.0". For - * that, we exploit the fact that QEMU 2.1 generates _smaller_ tables - * than 2.0 and we can always pad the smaller tables with zeros. We c= an - * then use the exact size of the 2.0 tables. + * combinations. * * All this is for PIIX4, since QEMU 2.0 didn't support Q35 migration. */ - if (pcmc->legacy_acpi_table_size) { - /* Subtracting aml_len gives the size of fixed tables. Then add t= he - * size of the PIIX4 DSDT/SSDT in QEMU 2.0. - */ - int legacy_aml_len =3D - pcmc->legacy_acpi_table_size + - ACPI_BUILD_LEGACY_CPU_AML_SIZE * x86ms->apic_id_limit; - int legacy_table_size =3D - ROUND_UP(tables_blob->len - aml_len + legacy_aml_len, - ACPI_BUILD_ALIGN_SIZE); - if ((tables_blob->len > legacy_table_size) && - !pcmc->resizable_acpi_blob) { - /* Should happen only with PCI bridges and -M pc-i440fx-2.0. = */ - warn_report("ACPI table size %u exceeds %d bytes," - " migration may not work", - tables_blob->len, legacy_table_size); - error_printf("Try removing CPUs, NUMA nodes, memory slots" - " or PCI bridges.\n"); - } - g_array_set_size(tables_blob, legacy_table_size); - } else { - /* Make sure we have a buffer in case we need to resize the tables= . */ - if ((tables_blob->len > ACPI_BUILD_TABLE_SIZE / 2) && - !pcmc->resizable_acpi_blob) { - /* As of QEMU 2.1, this fires with 160 VCPUs and 255 memory sl= ots. */ - warn_report("ACPI table size %u exceeds %d bytes," - " migration may not work", - tables_blob->len, ACPI_BUILD_TABLE_SIZE / 2); - error_printf("Try removing CPUs, NUMA nodes, memory slots" - " or PCI bridges.\n"); - } - acpi_align_size(tables_blob, ACPI_BUILD_TABLE_SIZE); + /* Make sure we have a buffer in case we need to resize the tables. */ + if ((tables_blob->len > ACPI_BUILD_TABLE_SIZE / 2) && + !pcmc->resizable_acpi_blob) { + /* As of QEMU 2.1, this fires with 160 VCPUs and 255 memory slots.= */ + warn_report("ACPI table size %u exceeds %d bytes," + " migration may not work", + tables_blob->len, ACPI_BUILD_TABLE_SIZE / 2); + error_printf("Try removing CPUs, NUMA nodes, memory slots" + " or PCI bridges.\n"); } + acpi_align_size(tables_blob, ACPI_BUILD_TABLE_SIZE); =20 acpi_align_size(tables->linker->cmd_blob, ACPI_BUILD_ALIGN_SIZE); =20 --=20 2.41.0