From patchwork Tue Apr 16 13:52:34 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: 789214 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:dcf:b0:346:15ad:a2a with SMTP id dw15csp296786wrb; Tue, 16 Apr 2024 06:54:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWc3s/DaOujZWcJUQ1/svMk/LQHve1b2qK6bRvu6WI9ken4+31UHqGHuc2N3YDcZ2j3cvWX9teR6FkL7WpBeFcE X-Google-Smtp-Source: AGHT+IFWc2P/kuUhnwuijJV/7PjUoypyloD5DNpLuJRlx7vzCmf7E6bz60TUGvoCKVGpLwgb2hvS X-Received: by 2002:ac8:570a:0:b0:436:b95c:e7b4 with SMTP id 10-20020ac8570a000000b00436b95ce7b4mr10700535qtw.47.1713275696040; Tue, 16 Apr 2024 06:54:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713275696; cv=none; d=google.com; s=arc-20160816; b=pap/zc0xMB+dmlafyV11sJOHjdDow3N8JzyfBazO6dDdk7nGqbYBGj1udSmdMP54uG xHly8UQurJ00J3XjiBbNhdVs+ZJxALOaBiqFfFyM09J5/ucbKNtOK+NkzyyfM3ElUXel 5uBSJw6OUAavfkit95nuQUHiy8caf3qOrnyHt44Dp2IPoUMFcfZV4go5aQdticKXH29p e6rGbGQ1WGylz88id+un4YnWu07sAVyT4PWhuYlTtEGTJW/DVYxAv8upSar+l1CkASLz vOf/7JbkAI5BoXz+ORKaGn42s54MiJOwZkamQ7Bd3VstwBSNNNEZXqefyjSfG1hHgxJ2 mqQQ== 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=GbDbMJ6uZWpUFLveYfiSh5ZQucMurGHlFI0AhTW7f68=; fh=8a/KSKrN0m7aG1/xNcslk0oXaBVfGoSUqZaRA9zaCV4=; b=VTu6EDZNBBriY9gqQS5776uWLMFWEDhO1+MLXPPT4Hc1uLJqUKzd4KlVqkCNMj12zE CuVHrQtdSdd4/QeL0K/eIW8lWjHLBQb/mg/qp2F5+DDHtl87/lLd9+VxLrFvf2t7jlE5 kzocWSR1j7KsQzm7o8H5tZyXQSj+8XxW77DGN4ZED1aF8+EUEILWkAoAvicT5OA4p1NP hFiZy20hvFQTUPLFiLrU9fvN9yK7nxpyQOLJfgP9r1GiKatj6/5sBzOlL3r+gRQ2oVvr FmS2THEyLlFk4+QWYYtFMc/+Yg4Q/536CUe1iiAOr7q8wMpSMieZ98lzTYeCwaRRAasw mL7g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="qPxIx/zx"; 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 r17-20020a05622a035100b0043731a2f0adsi2542761qtw.627.2024.04.16.06.54.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Apr 2024 06:54:56 -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="qPxIx/zx"; 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 1rwjFx-0002B6-7r; Tue, 16 Apr 2024 09:53: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 1rwjFr-00023u-ND for qemu-devel@nongnu.org; Tue, 16 Apr 2024 09:53:47 -0400 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rwjFb-0001ku-MM for qemu-devel@nongnu.org; Tue, 16 Apr 2024 09:53:47 -0400 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-a526d0b2349so266829266b.3 for ; Tue, 16 Apr 2024 06:53:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713275609; x=1713880409; 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=GbDbMJ6uZWpUFLveYfiSh5ZQucMurGHlFI0AhTW7f68=; b=qPxIx/zxfDmPvjJafmgwuzKHfdHrwCAci20orMl5E9GRPSpdt6ldtdlTmIZcwMMQEG Wb0VhVR6QgdJwSrpZ4dbV9pACj1Te4iaYjcfATsBpSUHHynwqgU60PvU0h/NlP7iFa9X y+Y9ITf83yGC2R8Yh8ckeh7W1IzWLyZ7WEqU7+oXEgewaOnwTh9jqTCI4HqqXGJWbyv6 Tbcy8TXcAqIErBCbAQyAUbud1FH2QhZn7TAhyw2/ztO6f1ZqQksIu/UEcxYqz6GC+MrJ L4Do1PnrUMnU3hw0kR3JwFC5x5k/pkE/v6TIhAp0I8CJJ1rDflbhRIpmqN/clDheJ+gA U3pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713275609; x=1713880409; 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=GbDbMJ6uZWpUFLveYfiSh5ZQucMurGHlFI0AhTW7f68=; b=MBLFgIWO8fwvMcrWYah87BCjQbZSETrnDRnvd2X8cIFxy/0bDSGeITpMBM785NBlV6 2lq500FlkDbN6pfJY3vWeBJl1O7gEZ1FMhFe6ZtvJl8EiKDaDOdFNxSlpQyvIONopjxt 7ORIAjvvwp4rdD2vEV0j0pXeoTVu7nvGUDLInwH9oRpu1hEr3APsahQfGv8nsi9w7txw oF2mzYsMsaetoNH6loHu1BG8EEI3Yj1zFykER6II1zpO6itqp6BCK09z+oLO8UazSgMd kBo2wu1G0KS4wrAkW4O8ufqFiGQZCZsDld+NBTW0H6X1XNfYkpKLgxme+gIl3+8YdXcj eFTg== X-Gm-Message-State: AOJu0Yzdf2x3qNBjiZX++OPvpbsnYsYcJ0D9KdtWhk9DKTcL/djFa5Vi zX1HEghSKP3XnnBaRKukWvXkvN5+M6Pr4yNa83eVcgQTGNBqb0SjKK2DX2dyXLug7OUPy+pu6T6 / X-Received: by 2002:a17:906:1cd7:b0:a52:15dd:20d8 with SMTP id i23-20020a1709061cd700b00a5215dd20d8mr8989112ejh.26.1713275606318; Tue, 16 Apr 2024 06:53:26 -0700 (PDT) Received: from m1x-phil.lan ([176.176.155.61]) by smtp.gmail.com with ESMTPSA id n5-20020a170906724500b00a47423b4c33sm6892640ejk.128.2024.04.16.06.53.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Apr 2024 06:53:25 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Thomas Huth Cc: Ani Sinha , qemu-riscv@nongnu.org, qemu-ppc@nongnu.org, Zhao Liu , David Hildenbrand , Paolo Bonzini , Igor Mammedov , "Michael S. Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PATCH v3 05/22] hw/i386/acpi: Remove PCMachineClass::legacy_acpi_table_size Date: Tue, 16 Apr 2024 15:52:34 +0200 Message-ID: <20240416135252.8384-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240416135252.8384-1-philmd@linaro.org> References: <20240416135252.8384-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62a; envelope-from=philmd@linaro.org; helo=mail-ej1-x62a.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 autolearn=unavailable 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(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Zhao Liu --- include/hw/i386/pc.h | 1 - hw/i386/acpi-build.c | 62 +++++++++----------------------------------- 2 files changed, 12 insertions(+), 51 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 67856f54c3..4ad724601a 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..a6f8203460 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2499,13 +2499,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 +2550,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 +2686,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);