From patchwork Mon Jun 17 07:11:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 804844 Delivered-To: patch@linaro.org Received: by 2002:adf:fb90:0:b0:360:93e7:1765 with SMTP id a16csp434193wrr; Mon, 17 Jun 2024 00:12:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVFzjiVrb6BGhwWg3hbCWjx9ajeXBKiEWhWJHNAjb0qPf3AVLHtJDUqUMTTYWArY8/8FsD0zbm1vcL7hp+DoDFG X-Google-Smtp-Source: AGHT+IHkDaLt0cx+YPyf6WEj+sl482GAo44MQ2s+ZnxllYSuzNVkPZmOQmLo1lznArVAk3RPJiPV X-Received: by 2002:ac8:59c6:0:b0:440:ccce:2fe9 with SMTP id d75a77b69052e-442168bf221mr109749001cf.33.1718608368689; Mon, 17 Jun 2024 00:12:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718608368; cv=none; d=google.com; s=arc-20160816; b=YBWfNyALGihaAItoATlWZhvfFkScf99/MuCO408lYiFpXa9K2q9pxP4bvrwoc7L1sp TDvIdMaxZWNzTJfK9AmPgf61MWPRnwcsugHVjgeeJ86gNL+uOzHsOp/T/dSzuGxeiz6r WLnbaE66/y8g7bgkEFacXIBpeqDRrWD8FAYWZkS34K51l9R+rQOuOIe6YZVfaKisajA/ LjjwQjgXuKZdaevWDpAst79rd5E/XXpuYVZmanTpHmzAFc0hFSc6jDgOFZ+7cnTcRJGW KUNoNduU8QvrQJuMmXSp5MNdDegj4N2bq4fuKXkPS/We32g9RGURYkSzr1sSFdVzk221 GEvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3V8dcRgEahFB3NY5bnQD9C47ReYjbE4TI9uiATbzbyw=; fh=l8/n/W5i7z81h5FD9Kj1U/CuCFTc2BinYUZq3V7aXdQ=; b=AKlGXyUM8EgX7pqyWaZUJ575rhFUTtXHGiraIZz4j3jz3L8yfrpvYLQqT+n1uGspV3 pdHGxVECVIvr41e19iwZhQ9RIX8pdYeZhP5+CyJ3xYCYdOKqKBcoMcxukFBguXAM2CgO 0KYxQT7PcMIa1y4CkrvE6J25XMU5XWRhsQS069XpjvDVB+c9pkEmhvsVEk1KO8Sz7vgP kw5Qe2JAksgkvT46Vzs0RO6LUaTKwHXtWy5d6o4EYJkZHemknyDp4l1vgCLRnnr9GIOu P9ZCmaPhdUm31ppu6hmM45LgbylpVjeq1ufT9M6QOTKqUHmoIRk666vhiWX+kHtkw+bv kTWQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eyo5aA79; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-441f2ea8a2bsi89439431cf.364.2024.06.17.00.12.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 Jun 2024 00:12:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eyo5aA79; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sJ6Ww-0003tl-LT; Mon, 17 Jun 2024 03:11:54 -0400 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 1sJ6Wu-0003t2-To for qemu-devel@nongnu.org; Mon, 17 Jun 2024 03:11:52 -0400 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 1sJ6Wt-00029K-0k for qemu-devel@nongnu.org; Mon, 17 Jun 2024 03:11:52 -0400 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-57c714a1e24so4449850a12.2 for ; Mon, 17 Jun 2024 00:11:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718608309; x=1719213109; 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=3V8dcRgEahFB3NY5bnQD9C47ReYjbE4TI9uiATbzbyw=; b=eyo5aA79Qzsh6urgQTqslLQaONRXXRMakM+crcjM/cnGeQ3SNTnBAbzR+ibRALHe1Q 9jWizNjPXmDx/uOawRaVUBElQUAxAwcD5ZGuFoPC53XOZsyjmkSqYLVX5ztQ0TJSppsh rgXttmnUaXZFGDrRQPYLzQ5y/bI4CniIcfRjbT6+QbpIIs9+5Z0Ow5fXptInote46J8f IeTcBZlEOTaWyis1GTCEgkmarXn4wV33CSwzSIGEC5pGUDe4cGPkhCzEWcOBUmr1Gx13 6i08Xzuke16cA7zGunRWbjQBscOlOFYhtP0qnAVVbb9qjmRItgGEIuAX+yxOBY7Vgiyg kLFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718608309; x=1719213109; 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=3V8dcRgEahFB3NY5bnQD9C47ReYjbE4TI9uiATbzbyw=; b=q1s3toHt8a1gHPMtC0L1iGuGvweqx8ey7mcL1lulsrxL9gcN4KED0p3g0r5vtCYCbI kQ1a7BnDCE+zib+8mt2SU4SJAWjCAjEP9MrSCIKRHpvyOAlPglligHtNlIWyU7tz8nl1 R49b9qsJlxVUkxQJ4A8bH4ZiXduaFtZIhMNY5GeUqX6OqDoRaoKTziMUbXKQiLYNSsas Ezh2bn7PxNZ8jn3kgjvyNZ6rmPffWlm2bNVPs+8kyz4lxD4ei8FBRWZHXdc1ilsVINml P/+jH6O2I1C9o1LWJIrAgq0+uUlaOMX0ytL7alYFVzFXQxHF3VPcl2iAWuCSmgYUwya5 9Qjw== X-Gm-Message-State: AOJu0YxQPZSJwLOXbBrgwo3LRQIC0GfTAW5J/HbxpTS1lIqROZyk7eDY ijBv0q4IkbUTo4Z1sJQWA9bGSxnZY7uLb4AUgtEEURKsghoGBuKa2rBlMI4g0I0k3MMG5iN269A f0Vs= X-Received: by 2002:a50:9f64:0:b0:57c:6f67:b17c with SMTP id 4fb4d7f45d1cf-57cbd6742bfmr5148671a12.7.1718608309067; Mon, 17 Jun 2024 00:11:49 -0700 (PDT) Received: from m1x-phil.lan ([176.176.169.90]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57cb7439646sm6014070a12.88.2024.06.17.00.11.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 17 Jun 2024 00:11:48 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Igor Mammedov , "Michael S. Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Zhao Liu Subject: [PATCH v6 05/23] hw/i386/acpi: Remove PCMachineClass::legacy_acpi_table_size Date: Mon, 17 Jun 2024 09:11:00 +0200 Message-ID: <20240617071118.60464-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240617071118.60464-1-philmd@linaro.org> References: <20240617071118.60464-1-philmd@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org PCMachineClass::legacy_acpi_table_size was only used by the pc-i440fx-2.0 machine, which got removed. Remove it and simplify acpi_build(). Reviewed-by: Zhao Liu Reviewed-by: Igor Mammedov Signed-off-by: Philippe Mathieu-Daudé --- include/hw/i386/pc.h | 1 - hw/i386/acpi-build.c | 63 +++++++++----------------------------------- 2 files changed, 12 insertions(+), 52 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 3e606949fb..434e531160 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; diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 53f804ac16..f5d74e2b4b 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -85,7 +85,6 @@ * a little bit, there should be plenty of free space since the DSDT * shrunk by ~1.5k between QEMU 2.0 and QEMU 2.1. */ -#define ACPI_BUILD_LEGACY_CPU_AML_SIZE 97 #define ACPI_BUILD_ALIGN_SIZE 0x1000 #define ACPI_BUILD_TABLE_SIZE 0x20000 @@ -2499,13 +2498,12 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine) X86MachineState *x86ms = X86_MACHINE(machine); DeviceState *iommu = pcms->iommu; GArray *table_offsets; - unsigned facs, dsdt, rsdt, fadt; + unsigned facs, dsdt, rsdt; AcpiPmInfo pm; AcpiMiscInfo misc; AcpiMcfgInfo mcfg; Range pci_hole = {}, pci_hole64 = {}; uint8_t *u; - size_t aml_len = 0; GArray *tables_blob = tables->table_data; AcpiSlicOem slic_oem = { .id = NULL, .table_id = NULL }; Object *vmgenid_dev; @@ -2551,19 +2549,12 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine) build_dsdt(tables_blob, tables->linker, &pm, &misc, &pci_hole, &pci_hole64, machine); - /* Count the size of the DSDT and SSDT, we will need it for legacy - * sizing of ACPI tables. - */ - aml_len += tables_blob->len - dsdt; - /* ACPI tables pointed to by RSDT */ - fadt = tables_blob->len; acpi_add_table(table_offsets, tables_blob); pm.fadt.facs_tbl_offset = &facs; pm.fadt.dsdt_tbl_offset = &dsdt; pm.fadt.xdsdt_tbl_offset = &dsdt; build_fadt(tables_blob, tables->linker, &pm.fadt, oem_id, oem_table_id); - aml_len += tables_blob->len - fadt; acpi_add_table(table_offsets, tables_blob); acpi_build_madt(tables_blob, tables->linker, x86ms, @@ -2694,49 +2685,19 @@ void acpi_build(AcpiBuildTables *tables, MachineState *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 can - * then use the exact size of the 2.0 tables. - * - * All this is for PIIX4, since QEMU 2.0 didn't support Q35 migration. + * combinations. */ - if (pcmc->legacy_acpi_table_size) { - /* Subtracting aml_len gives the size of fixed tables. Then add the - * size of the PIIX4 DSDT/SSDT in QEMU 2.0. - */ - int legacy_aml_len = - pcmc->legacy_acpi_table_size + - ACPI_BUILD_LEGACY_CPU_AML_SIZE * x86ms->apic_id_limit; - int legacy_table_size = - 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 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); + /* 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); acpi_align_size(tables->linker->cmd_blob, ACPI_BUILD_ALIGN_SIZE);