From nobody Sun Feb 8 23:05:04 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607457256; cv=none; d=zohomail.com; s=zohoarc; b=J5w+paOBGw7AmzJ2+YS6z7OPQZhq3WF8qUozeAdZ/Ko2Skp6pQvmfESoFVaX507QNiloZa/LzlFj8+KxrUXucoAAgqUw9khC3tYezdamXgXWFr4GgYCVAcuyqLPymoAupW45zFMujlePG8gyXsfBUoXEkVkpaI3o69R0p9irlgA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607457256; h=Content-Type: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=E8KRj603PozPBooN+Hrw7u6hn2/z258ATjiH9hYG620=; b=gztTyVfvQ4ikPwI1sx+uhj7ct9i7lruFPjU6Reg/yOA9CAgLxWds6PrAgH8/mP5QkCU7Vq8rY/6mdgK1DQu2dBVZQhQfp9DuPq2Mmn7MfxXTm0BNIRktNnD2cT6P//6+cm8M+mRa2hkAG/VuxsHyx1HEMRLU34pE8A1EIKuRnKU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607457256986423.31135810485387; Tue, 8 Dec 2020 11:54:16 -0800 (PST) Received: from localhost ([::1]:43956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kmj3v-0006S0-Nm for importer@patchew.org; Tue, 08 Dec 2020 14:54:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49020) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmil2-0005Ht-ET for qemu-devel@nongnu.org; Tue, 08 Dec 2020 14:34:46 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:48229) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kmiku-0004ub-La for qemu-devel@nongnu.org; Tue, 08 Dec 2020 14:34:42 -0500 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-546-1E5trE7hMKWl939kvxdMaQ-1; Tue, 08 Dec 2020 14:34:23 -0500 Received: by mail-wr1-f72.google.com with SMTP id b8so168473wrv.14 for ; Tue, 08 Dec 2020 11:34:23 -0800 (PST) Received: from redhat.com (bzq-79-176-44-197.red.bezeqint.net. [79.176.44.197]) by smtp.gmail.com with ESMTPSA id s13sm4904715wmj.28.2020.12.08.11.34.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Dec 2020 11:34:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607456075; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=E8KRj603PozPBooN+Hrw7u6hn2/z258ATjiH9hYG620=; b=Eqa3QA8r4GUXKuxmUatwyUtVmZHSFKXCGriKDq35NS3nWYdm4tLTTW1gaO2IaElwrNknpB yqhP+zVRgA2U/VHddy8hc53RyYeMn/1+6L7q9QLP3L1Wm/cWtgMKD6I6qhzGqNPH+Q38Aw kvXu+hlXnShsRnBuXrfkp2szTbl/0yQ= X-MC-Unique: 1E5trE7hMKWl939kvxdMaQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=E8KRj603PozPBooN+Hrw7u6hn2/z258ATjiH9hYG620=; b=AjwbBe1vONKfv4mtAki9EbJfW8laRYNtdLYeuhGRLnV/P2kmWxQd64baasau1/yr5N +isrxDFCGgntMWQdL7j9enOYHmmjFI7xu16hxElxuNrogeutQ01X5k69cbNqwF6cnfCH 99UKBeKslGP1iBRT9kPJB+wdfnUhR+DGirNiLX4mRudFdeETYmxI+DF/UnirWCFRZY+m GVyB/k3puR1DC55VEQGZdwxhjRzTDDeT9cYy1XeB9NHqNgLlgsVG3i5KKiTjk3QHAv4q cCUUWtmZXUAwgWOOS/gJPM6AqQCQ0JvWpNQTapapuzf4ehfmS3xlDYzgwJzhXXu2Iy5J 6mxA== X-Gm-Message-State: AOAM531ztKZr4K2U62JMWpjp8o9OsuHeisFZyMxa+ax/DNV42x2IwoFm mFmOlzbIkvcvVzdV9lagg/BnLxaH5HU36ymgJeRbiRA26/eAWy6M2txfL2kPb+8RXPFzM6JkkDN P3P1WWYNDrh884yrIdcXZOQQtNLMhHIGVl2MUAburIi8CXwGd8txCM2aEFUCl X-Received: by 2002:adf:cd8f:: with SMTP id q15mr9245604wrj.79.1607456062021; Tue, 08 Dec 2020 11:34:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJyi21cw5Bzp2ohysEdBJU8enXbec5+uCudF8/enTUTMYaBsN6FXQByew6DZZN9TV97dFdHpsg== X-Received: by 2002:adf:cd8f:: with SMTP id q15mr9245581wrj.79.1607456061785; Tue, 08 Dec 2020 11:34:21 -0800 (PST) Date: Tue, 8 Dec 2020 14:34:19 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 13/66] acpi: Align the size to 128k Message-ID: <20201208193307.646726-14-mst@redhat.com> References: <20201208193307.646726-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201208193307.646726-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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; Received-SPF: pass client-ip=63.128.21.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jiahui Cen , Shannon Zhao , Yubo Miao , qemu-arm@nongnu.org, Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Yubo Miao 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: Yubo Miao Signed-off-by: Jiahui Cen Message-Id: <20201119014841.7298-7-cenjiahui@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- 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 e0bed9037c..711cf2069f 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -57,6 +57,8 @@ =20 #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; @@ -656,6 +658,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) { @@ -743,6 +754,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 MST