From patchwork Tue Jun 18 15:59:27 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: 805208 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:144:b0:362:4979:7f74 with SMTP id r4csp270205wrx; Tue, 18 Jun 2024 09:02:06 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWoOB4SgKb+6oZSNr2hj5pC//tE4ITSkpOfrZSGqR4kTk5Xmv3yDn+BrT1s40cYF1dI27yTduJk+pFn2z/y0hmN X-Google-Smtp-Source: AGHT+IFg72Y4pmKnLNYBHIy4q/Km7+e9YjgYuVFig7nFXoZCibly1Ya3+NhpG9YWCbFS7Krdl+5/ X-Received: by 2002:a05:6358:e4a9:b0:19f:73f3:410d with SMTP id e5c5f4694b2df-1a1fd443c66mr25273355d.16.1718726525871; Tue, 18 Jun 2024 09:02:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718726525; cv=none; d=google.com; s=arc-20160816; b=quSo+TrwTCARSZm3g1tMFySYtm23f6c4DPnbNBZYqGU1zyJA/zSkQ47YJ3pZ8elyNT OT1pmiVmSddxukWLLJIN3Q+NccR31oSPXspIRdM7tZ9tpEDYraLF1zkdp3Dgd0Yfqc5G u1B7Upyxm5wxCs6+F2u+31qjbGpm0v/BfrCYo0pwGwYjAup7NMlq1DnJER9zU51ixVnW WxJ81oXL904vuN1znv2cLi6qmH1ERCaNoAgo7vJvirPLX4i7Dz7oij5d7HivicGxqgdr bkgh0EYBQOThGbsaTxX4xXgbOzBi7AngKpY66y8Gxx4vqTcVtMebgBLt5rpvHPSddyS3 baXw== 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=92DFCEMVHNRfMYC9GC2mgRPUeb4rRwPGc14j39ovrXg=; fh=qIwwf5yzYdGUjWHfLdZ1pY/abUtmNziDEAnYJGhPICo=; b=G+zPFfM07sIEbNTKEuPsOmlaz0fIiPvM2RD3uc7Pip8ToAyzHz0zidSidpjJew8o9S U22yWMJe3xFnQkN73FYmqxJGBmOgQwvMZC8GExEnvBfvP3vTmUIlBE6F9TIiSaSJxzRR Q0a25hKVerkwyzQM0qZ9e4ZMAYTbJAFi1sucCuR5V+3FvxcgCP48MS9DoFG8WC4CzEe2 Iq/eoKHr4932gu+NAldKkZLEnrb/EdRGI1ILzda10OaPIrTnMvj0A/60dLVHQqjS76m/ puUSbDo/SzD29WafFwFT1pvOLrlkjtSXEbh18MD4p6PQgE+ObSxA5EiRuWXCSxDENlwO 0lsg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YEES+ZGE; 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 71dfb90a1353d-4ed3f1f8014si1877442e0c.58.2024.06.18.09.02.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Jun 2024 09:02:05 -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=YEES+ZGE; 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 1sJbH9-0003gW-AL; Tue, 18 Jun 2024 12:01:39 -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 1sJbGl-0003Xo-IF for qemu-devel@nongnu.org; Tue, 18 Jun 2024 12:01:16 -0400 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sJbGj-0006ky-LG for qemu-devel@nongnu.org; Tue, 18 Jun 2024 12:01:15 -0400 Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2ec17eb4493so67108991fa.2 for ; Tue, 18 Jun 2024 09:01:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718726471; x=1719331271; 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=92DFCEMVHNRfMYC9GC2mgRPUeb4rRwPGc14j39ovrXg=; b=YEES+ZGEnUhfS7r4WKly+AKEBdTU/ouHBJTPwpTcRh1KIIj9vPqUMxNd6zftkZinIY TPw7hCK0pkhARFfvh5Q6eiOjs7MDWplJxBi1FdLCFW/YlZktkNtsf806GvrbsABA0Pmj hfJidImjNnGx9URRH0x2Zn3mURMAwIdBiZjviEnICnOJngB4UUeOcLHzXav5EpnbUCz5 YPxXDbFnJPe+/fbt2R53gC+CbwaIbgvk5PVNNghqZQzuwzgcb3N8yQk091uetDnm1xmk U3pw4w3LXL4LrhHJUVCSEjv3fbMKiiqnvd9BGQXsbT86kJ8HEKR4KsBS5cFWvkBOkDjv Os8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718726471; x=1719331271; 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=92DFCEMVHNRfMYC9GC2mgRPUeb4rRwPGc14j39ovrXg=; b=OckGSfghptHzraDTu4JPeZ4FOsyKXwGeEt8cwsfwickScO8GSuHLAso3ETJwyLfAPI ryX+fPZVI2vSpsyESIWeEoNtY3bePHQE3iGSqvQ3IhUJ7NNyPcbn4yr8rjYUmf7DJ+gu UaRAsBL5hYRqKBtqa7Xz6xM8X0r/j7bOUda/6otL5ZYkbxC8KE+9bCupX5MIlwtDzjJ9 yP6GnylSOtvsNTRtcTxGgaqxBMLmYayDw08StBT7fb9kOetzr/MrAxqPi3/QwGxlqxhP 296mvETyDeQsXq05AI3MhyT+8OXw0ACBpC3+MlDo9AKequr4ZgANYjIRQj9pOu/j7OVg l/yA== X-Gm-Message-State: AOJu0YyWltwGCqkR4sU/lZe6Bt3u+VioIynfzO1lmcIMyywSETWWovdQ TWe67ValpyQLxgFphbRcudB1sE4QlUdPh6zXPQwr++Dih3pPXcy0cgsE0Os6iSxgsMtoE/wxdWZ 1 X-Received: by 2002:a05:6512:329c:b0:52c:ba7d:f032 with SMTP id 2adb3069b0e04-52ccaa32987mr43817e87.16.1718726471046; Tue, 18 Jun 2024 09:01:11 -0700 (PDT) Received: from m1x-phil.lan ([176.187.212.55]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f56db674esm626117466b.83.2024.06.18.09.01.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 18 Jun 2024 09:01:10 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Zhao Liu , Igor Mammedov Subject: [PULL 05/76] hw/i386/acpi: Remove PCMachineClass::legacy_acpi_table_size Date: Tue, 18 Jun 2024 17:59:27 +0200 Message-ID: <20240618160039.36108-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240618160039.36108-1-philmd@linaro.org> References: <20240618160039.36108-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::235; envelope-from=philmd@linaro.org; helo=mail-lj1-x235.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é Message-Id: <20240617071118.60464-6-philmd@linaro.org> --- 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);