From patchwork Tue Apr 16 18:59:21 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: 13632370 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 06F8B13473F for ; Tue, 16 Apr 2024 19:00:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713294019; cv=none; b=SbCHncx0H6jkgasxqBLz8sS5ghnlemYV1xAehanPsLfXbFbXk91HKsUZR8rG2e+RT3cToHq0jwfn2U9lWc/2nrFaso0sofUoWpcLRXJjn4oQnPreUHsd0eK/u1tXjwtftf7za0hcrwwwxi5iLri+HX8VK0EA78jecwY0njrFh3o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713294019; c=relaxed/simple; bh=EBx/P3JVoglQ3Uk9mirZIfrMknyIRlcgkIJTc/dY+uo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IgVZ5nfjYMrTBUfBFwKarsvyP7HmiX4i0ca/TzvR+dbxS6ERpi3DOduLLAj/+iH3OVEO6XUWhKK54Z8OpHRqZGRrCBIAiIGfRlhJlF1DtRaSs/CK9qYVj3cd33jJ6PudNM6LSDRxpGNuYcJMHcFBrzqcSjxtKbORA5pHodwiQ7Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=F3VI5jLE; arc=none smtp.client-ip=209.85.167.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="F3VI5jLE" Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-518a3e0d2ecso5863742e87.3 for ; Tue, 16 Apr 2024 12:00:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713294016; x=1713898816; darn=vger.kernel.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=F3VI5jLENCII8dU8bJthMz15r8lMdNAdlaZV3obk1ni7ifUmw2pR+rRgdsxxqlyDUw tssI5t5vqmthFLcBmzeqUJqNK9pcsoKVxt72+aoxgKKYQ2pujGMKuiEFKJxYsuUqtLOn t2Zw3NPMLC4Ot1H0ToFNKPKdKfhByjuFE9uQUbDvBlndw0mvfpGzDJg+EaOvVFugRuQ5 xMHQh8GzrEMBpUpqcfWRidDU5F5UrRiMLNh6RTkQUPkb9NDc67htrZadVIzxmOgJXF/e oqR1rgB6RyYovcR4ehWgV+0htPixEg4rKPopOSDEgEB03AwRguZmdZ1KSbnE28zC6mZX fO9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713294016; x=1713898816; 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=V2JLT+kcSvhlj3jjPaw4kJChGBcFnvO0dahORhUpZzwsD6b/Ha3Vrh/8ztttUepvAy ObT3rh8y1KQmwoYQZ5YYdr1BY+JLIn6unevhBafkyjU6acjRp1HqyFOxSZSeYz4D+oRy FlHKmXcWi++toRUmH/Jls/bAylZy9I1NMnbzO1wVP54zDf7PTofy4p+GBfmu2OiFJAVH Bzb23S69peIdoRfYrox0Jsdc+++fXtRq9EojFnu6O6ss9fvyEUx2zzvixTCdwKGWy6YX t6V+hc2Jwu8C4XP4cZh6B9M9KBz/+nk5oMxRw33nOQ6QOtNwKWYYzP3ZiQiRmoL4CFR2 H1qQ== X-Forwarded-Encrypted: i=1; AJvYcCXVUTapPisy2wNtHEEXNOAhoAYl15Epy3/JP+m59tSv5+MK/SKaSAoDGcG3AHO+rmD09tCiuEFYAtdMT/Ss8pO3s1HU X-Gm-Message-State: AOJu0Yzv3HHpJo6d3A94rdZiocjenwxEV29pqZyfey4OSoaRuLhRkKZn 7I5C4oRVlKKhajk+J9yvIxW40yUNPy7i9bTrWkcAmsHe85C3Y9VRuLVCOjFiwfg= X-Google-Smtp-Source: AGHT+IFpaDhkZVGyt9FRjFRkLSliGlw/RoGYCriKsFs1NmzG+pAK4BYMQ7AP4uxiUsP1tLZDU2rQAQ== X-Received: by 2002:a05:651c:1255:b0:2d4:5c03:5ccb with SMTP id h21-20020a05651c125500b002d45c035ccbmr11347972ljh.10.1713294016250; Tue, 16 Apr 2024 12:00:16 -0700 (PDT) Received: from m1x-phil.lan ([176.176.155.61]) by smtp.gmail.com with ESMTPSA id v13-20020a17090606cd00b00a526562de1fsm3470219ejb.73.2024.04.16.12.00.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Apr 2024 12:00:15 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Thomas Huth Cc: "Michael S. Tsirkin" , qemu-riscv@nongnu.org, David Hildenbrand , Igor Mammedov , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Zhao Liu , Ani Sinha , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PATCH v4 05/22] hw/i386/acpi: Remove PCMachineClass::legacy_acpi_table_size Date: Tue, 16 Apr 2024 20:59:21 +0200 Message-ID: <20240416185939.37984-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240416185939.37984-1-philmd@linaro.org> References: <20240416185939.37984-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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);