From nobody Tue Feb 10 06:07:14 2026 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1586257123; cv=none; d=zohomail.com; s=zohoarc; b=L8HQNBc02DFUFowHtQ4zUE4jTKglODea3VXOkFnPdcCx7Y7ukBRLOPU337w1g0QoqRkobeYGSv/zGOdfJKeP0X9XnIMpjMs74wmoessQRT+dm8n7UQCWR+IxhMp1ma5i3Jo0E6eilTYqvHVKSl9wpWfO29UWdQrIeTEvH+wNA6Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586257123; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AjAdemLOCuVwvALpsJgkwZ+ghc/9C3y7w9H7Ihw+3vY=; b=Fn36Y1ZESfdzix7sqr2Chg37iLEiQmxC9/orwQHAY3oozN6Pt8xD/k9paaGzQw8uDXrWwE0Vl9Vd1e1qUXoMo5mTEGhtjzDhfsu7nEPhE/8aTD/n8VQyClyNOikY/mxUGSvSnnx5Uk9soedu6OFKNubRHKZjTE0fwTLq7ATbzAg= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1586257123610329.32283343690995; Tue, 7 Apr 2020 03:58:43 -0700 (PDT) Received: from localhost ([::1]:45082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLlwI-0001HN-BN for importer@patchew.org; Tue, 07 Apr 2020 06:58:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47284) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLlvG-00080E-4N for qemu-devel@nongnu.org; Tue, 07 Apr 2020 06:57:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLlvF-0007SH-3n for qemu-devel@nongnu.org; Tue, 07 Apr 2020 06:57:38 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:3660 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jLlvE-0007P3-Dq for qemu-devel@nongnu.org; Tue, 07 Apr 2020 06:57:36 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id E717FF93C05087F294D7; Tue, 7 Apr 2020 18:57:27 +0800 (CST) Received: from DESKTOP-D7EVK5B.china.huawei.com (10.173.221.29) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.487.0; Tue, 7 Apr 2020 18:57:20 +0800 From: Yubo Miao To: , , Subject: [PATCH v5 5/8] acpi: align the size to 128k Date: Tue, 7 Apr 2020 18:57:03 +0800 Message-ID: <20200407105706.1920-6-miaoyubo@huawei.com> X-Mailer: git-send-email 2.24.1.windows.2 In-Reply-To: <20200407105706.1920-1-miaoyubo@huawei.com> References: <20200407105706.1920-1-miaoyubo@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.173.221.29] X-CFilter-Loop: Reflected Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 45.249.212.190 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: berrange@redhat.com, mst@redhat.com, qemu-devel@nongnu.org, xiexiangyou@huawei.com, miaoyubo@huawei.com, imammedo@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: miaoyubo If table size is changed between virt_acpi_build and virt_acpi_build_update, the table size would not be updated to UEFI, therefore, just align the size to 128kb, which is enough and same with x86. It would warn if 64k is not enough and the align size should be updated. Signed-off-by: miaoyubo --- hw/arm/virt-acpi-build.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 7bcd04dfb7..89bb768b0c 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -54,6 +54,8 @@ #include "hw/pci/pci_bridge.h" #define ARM_SPI_BASE 32 =20 +#define ACPI_BUILD_TABLE_SIZE 0x20000 + static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus) { uint16_t i; @@ -883,6 +885,15 @@ struct AcpiBuildState { bool patched; } AcpiBuildState; =20 +static void acpi_align_size(GArray *blob, unsigned align) +{ + /* + * Align size to multiple of given size. This reduces the chance + * we need to change size in the future (breaking cross version migrat= ion). + */ + g_array_set_size(blob, ROUND_UP(acpi_data_len(blob), align)); +} + static void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables) { @@ -953,6 +964,20 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildT= ables *tables) build_rsdp(tables->rsdp, tables->linker, &rsdp_data); } =20 + /* + * The align size is 128, warn if 64k is not enough therefore + * the align size could be resized. + */ + if (tables_blob->len > ACPI_BUILD_TABLE_SIZE / 2) { + 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."); + } + acpi_align_size(tables_blob, ACPI_BUILD_TABLE_SIZE); + + /* Cleanup memory that's no longer used. */ g_array_free(table_offsets, true); } --=20 2.19.1