From nobody Wed Dec 17 03:33:59 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1765449166; cv=none; d=zohomail.com; s=zohoarc; b=fJVd3JgBvvcP2d+R4zKTHcrZu1svZz7tTtVObnvjxdp+5XnDogADa/9tw5x88YTcPZZGHVP2JtKZm7JeEA94RveTOZw32TXGMrFRrOVU532v3E8QF+35HvRjZjG02N8GmxQ3OhT78aPBrcA7Ndqs9ZcRnFK+7EjoL7oqHlHDAZo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765449166; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=iaPmqw/Ehr8W6RQwc5yl82CYunPOYiPN0xNLMshtHSc=; b=fA8logaEAu8SqaA8zDnS347M0T33II2FUi14eqd86NIRCBoF9oHY+gnhCbg6xhF6Qxc5d/EDP5yJ40taNrYfAbRavESqFM12ccGCN9TC2miWaoi2dX/hyxjHR68q+vauDMXLgMIo/PFBE2PkF2J1t9YGe+4lNLNyLwDKK1wX2mQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765449166427401.30335552008364; Thu, 11 Dec 2025 02:32:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vTdxq-0001s7-Li; Thu, 11 Dec 2025 05:32:02 -0500 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 1vTdxl-0001qD-BZ for qemu-devel@nongnu.org; Thu, 11 Dec 2025 05:31:57 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vTdxi-0008M3-9x for qemu-devel@nongnu.org; Thu, 11 Dec 2025 05:31:56 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-561-sU6khzAZNxO8q3_tvqFg3w-1; Thu, 11 Dec 2025 05:31:50 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 37B931956088; Thu, 11 Dec 2025 10:31:49 +0000 (UTC) Received: from osteffen-laptop.redhat.com (unknown [10.45.225.89]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BD83A1800451; Thu, 11 Dec 2025 10:31:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1765449113; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iaPmqw/Ehr8W6RQwc5yl82CYunPOYiPN0xNLMshtHSc=; b=UEQYd9Ky8BKHFawSkmyDe9Tmb7DOzVHDDevYgLnYJRyE8STYExiwiqwKSaZHaUkcZd0lxS tq5sWYfdQEYTxu6PMtxFWG3KfsfEE2aYTK/bf3k1VickNtDU2Am5rU4+Lw4jX2x9sbG3Ie Krv1YBD0ZK7qMTlscPdUbEtoRKwva2w= X-MC-Unique: sU6khzAZNxO8q3_tvqFg3w-1 X-Mimecast-MFC-AGG-ID: sU6khzAZNxO8q3_tvqFg3w_1765449109 From: Oliver Steffen To: qemu-devel@nongnu.org Cc: Richard Henderson , Paolo Bonzini , Igor Mammedov , "Michael S. Tsirkin" , Joerg Roedel , Gerd Hoffmann , kvm@vger.kernel.org, Zhao Liu , Eduardo Habkost , Marcelo Tosatti , Luigi Leonardi , Stefano Garzarella , Ani Sinha , Marcel Apfelbaum , Oliver Steffen Subject: [PATCH v2 1/3] hw/acpi: Make BIOS linker optional Date: Thu, 11 Dec 2025 11:31:34 +0100 Message-ID: <20251211103136.1578463-2-osteffen@redhat.com> In-Reply-To: <20251211103136.1578463-1-osteffen@redhat.com> References: <20251211103136.1578463-1-osteffen@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.129.124; envelope-from=osteffen@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H2=0.001, RCVD_IN_SBL_CSS=3.335, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1765449169098158500 Content-Type: text/plain; charset="utf-8" Make the BIOS linker optional in acpi_table_end(). This makes it possible to call for example acpi_build_madt() from outside the ACPI table builder context. Signed-off-by: Oliver Steffen Based-On: <20251118122133.1695767-1-kraxel@redhat.com> --- hw/acpi/aml-build.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 2d5826a8f1..ed86867ae3 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1748,8 +1748,11 @@ void acpi_table_end(BIOSLinker *linker, AcpiTable *d= esc) */ memcpy(len_ptr, &table_len_le, sizeof table_len_le); =20 - bios_linker_loader_add_checksum(linker, ACPI_BUILD_TABLE_FILE, - desc->table_offset, table_len, desc->table_offset + checksum_offse= t); + if (linker !=3D NULL) { + bios_linker_loader_add_checksum(linker, ACPI_BUILD_TABLE_FILE, + desc->table_offset, table_len, + desc->table_offset + checksum_offs= et); + } } =20 void *acpi_data_push(GArray *table_data, unsigned size) --=20 2.52.0 From nobody Wed Dec 17 03:33:59 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1765449159; cv=none; d=zohomail.com; s=zohoarc; b=npjubQSxdPOFHJpz9b87jHrnyuEVu57xnrsbdmO7q0A6dLBoPdwd0wY46AS6P+sQysi2n8ykhdKE54V0IaItV+Edqs77fGzH5SsF5f1LsVZUZBrXV30MrQ3rG5o8ii1WkFYL7dwK08lhaXxH1LokHoE3EzXebO9hPkxjfhACu1E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765449159; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=RbvZl+vxzfLE3Kc7Wvw7PIUMKqNVOyqJtrnlb2bMgEM=; b=aKYRJPzL5bPG4JfVD3/7pxaEuirubeHHJTlZsz/F9A1veEyrSsl2dpKSiiLFEd4tGXxWrTK3hGrtwrmTEWdVl0xBUacCrGqAlRBcpFKnQi9Mh8LAT3cg49SUx7NISixtw06LH+uKhgWd5A0UtPYaxDhv6Brk+kWk3ARxYhPFetg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765449159182975.7840082134771; Thu, 11 Dec 2025 02:32:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vTdxr-0001tY-KC; Thu, 11 Dec 2025 05:32:03 -0500 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 1vTdxp-0001sH-Db for qemu-devel@nongnu.org; Thu, 11 Dec 2025 05:32:02 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vTdxo-0008Um-3Z for qemu-devel@nongnu.org; Thu, 11 Dec 2025 05:32:01 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-651-B-BrPfBkNr2nhG_Wj9i9dw-1; Thu, 11 Dec 2025 05:31:56 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A036118002EC; Thu, 11 Dec 2025 10:31:54 +0000 (UTC) Received: from osteffen-laptop.redhat.com (unknown [10.45.225.89]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C19AB1800451; Thu, 11 Dec 2025 10:31:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1765449119; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RbvZl+vxzfLE3Kc7Wvw7PIUMKqNVOyqJtrnlb2bMgEM=; b=g9VI6452nM2ShQrhyaJj/rAsDktsb/MINIDLFhOMJqnFBbXhuPFshYBMSSXS/kDe7BGxmI un3DBco4qKS5l1OY+A2RyYgeDdDKL2hKNfnfwbgiLKvJ4yaKEppWF4d+in1x3hn+PlnpUg jb1WCGWdCrsTTeAm4jlAEjAiM4MEQds= X-MC-Unique: B-BrPfBkNr2nhG_Wj9i9dw-1 X-Mimecast-MFC-AGG-ID: B-BrPfBkNr2nhG_Wj9i9dw_1765449114 From: Oliver Steffen To: qemu-devel@nongnu.org Cc: Richard Henderson , Paolo Bonzini , Igor Mammedov , "Michael S. Tsirkin" , Joerg Roedel , Gerd Hoffmann , kvm@vger.kernel.org, Zhao Liu , Eduardo Habkost , Marcelo Tosatti , Luigi Leonardi , Stefano Garzarella , Ani Sinha , Marcel Apfelbaum , Oliver Steffen Subject: [PATCH v2 2/3] hw/acpi: Add standalone function to build MADT Date: Thu, 11 Dec 2025 11:31:35 +0100 Message-ID: <20251211103136.1578463-3-osteffen@redhat.com> In-Reply-To: <20251211103136.1578463-1-osteffen@redhat.com> References: <20251211103136.1578463-1-osteffen@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.129.124; envelope-from=osteffen@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_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1765449161198158500 Content-Type: text/plain; charset="utf-8" Add a fuction called `acpi_build_madt_standalone()` that builds a MADT without the rest of the ACPI table structure. Signed-off-by: Oliver Steffen Based-On: <20251118122133.1695767-1-kraxel@redhat.com> --- hw/i386/acpi-build.c | 8 ++++++++ hw/i386/acpi-build.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 9446a9f862..e472876567 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2249,3 +2249,11 @@ void acpi_setup(void) */ acpi_build_tables_cleanup(&tables, false); } + +GArray *acpi_build_madt_standalone(MachineState *machine) { + X86MachineState *x86ms =3D X86_MACHINE(machine); + GArray *table =3D g_array_new(false, true, 1); + acpi_build_madt(table, NULL, x86ms, x86ms->oem_id, + x86ms->oem_table_id); + return table; +} diff --git a/hw/i386/acpi-build.h b/hw/i386/acpi-build.h index 8ba3c33e48..00e19bbe5e 100644 --- a/hw/i386/acpi-build.h +++ b/hw/i386/acpi-build.h @@ -8,4 +8,6 @@ extern const struct AcpiGenericAddress x86_nvdimm_acpi_dsmi= o; void acpi_setup(void); Object *acpi_get_i386_pci_host(void); =20 +GArray *acpi_build_madt_standalone(MachineState *machine); + #endif --=20 2.52.0 From nobody Wed Dec 17 03:33:59 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1765449178; cv=none; d=zohomail.com; s=zohoarc; b=cfuEOkBpn/+q87sT7GRHbGg4+5cj3FuDvKcw7ebDXFxQIM6rmf3cVvBzsgYiDtjWwmEiab6J0U7W7asB0oMIUWspy3IvxXNOv/pXCpvCjPN2SPYMpgeFxuDz3ob+3x2aL11SIsHeJm6V3rTrAPx0MtUnZY1P73lP4Ege8Y6VCvw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765449178; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HiqwH+EbrOicd1rdvR0ZlaJPF+L0oee3OxmFWoyqXNY=; b=Rlqp3Ld8IX4RG9eRLuP4rPRAfIY2TCtYGFmgBKL+imWWoOoz3C/2WaYGTZDVZb9Av18Uj1CJHf0vDLz+Fuox2KWQ8/NL9iOQ/XNCzsXIBMznoCWKyWy+lNcHsn120xxK8X1+8QG4dsZGZJAzYOJBWE3ALHYX3p1cZIau+N7A3WI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1765449178647809.6976668544114; Thu, 11 Dec 2025 02:32:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vTdxz-0001wB-Io; Thu, 11 Dec 2025 05:32:11 -0500 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 1vTdxw-0001vD-EA for qemu-devel@nongnu.org; Thu, 11 Dec 2025 05:32:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vTdxu-00007g-Jt for qemu-devel@nongnu.org; Thu, 11 Dec 2025 05:32:08 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-203-F9NmniNwPsarQBtvqBKzvQ-1; Thu, 11 Dec 2025 05:32:02 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5EE0319560B2; Thu, 11 Dec 2025 10:32:00 +0000 (UTC) Received: from osteffen-laptop.redhat.com (unknown [10.45.225.89]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 532051800451; Thu, 11 Dec 2025 10:31:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1765449125; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HiqwH+EbrOicd1rdvR0ZlaJPF+L0oee3OxmFWoyqXNY=; b=dBiNUFP2EkaO6bL0qqL5kpydYbONGIY6RAQ5HubbSKCLPAPRhBO/yE7CumBsli4+WuRk0R IDx7L5OwfZ16A90n7NjiXDGz3iw1t+nqc1GLNt8uFb55/i0JmvdiimD10T5Ql8iMy3zBV8 3H4xrG0hcHb14s4Ci2eq4qfy+acbrS8= X-MC-Unique: F9NmniNwPsarQBtvqBKzvQ-1 X-Mimecast-MFC-AGG-ID: F9NmniNwPsarQBtvqBKzvQ_1765449120 From: Oliver Steffen To: qemu-devel@nongnu.org Cc: Richard Henderson , Paolo Bonzini , Igor Mammedov , "Michael S. Tsirkin" , Joerg Roedel , Gerd Hoffmann , kvm@vger.kernel.org, Zhao Liu , Eduardo Habkost , Marcelo Tosatti , Luigi Leonardi , Stefano Garzarella , Ani Sinha , Marcel Apfelbaum , Oliver Steffen Subject: [PATCH v2 3/3] igvm: Fill MADT IGVM parameter field Date: Thu, 11 Dec 2025 11:31:36 +0100 Message-ID: <20251211103136.1578463-4-osteffen@redhat.com> In-Reply-To: <20251211103136.1578463-1-osteffen@redhat.com> References: <20251211103136.1578463-1-osteffen@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=170.10.129.124; envelope-from=osteffen@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H2=0.001, RCVD_IN_SBL_CSS=3.335, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1765449179346158500 Content-Type: text/plain; charset="utf-8" Use the new acpi_build_madt_standalone() function to fill the MADT parameter field. The IGVM parameter can be consumed by Coconut SVSM [1], instead of relying on the fw_cfg interface, which has caused problems before due to unexpected access [2,3]. Using IGVM parameters is the default way for Coconut SVSM; switching over would allow removing specialized code paths for QEMU in Coconut. In any case OVMF, which runs after SVSM has already been initialized, will continue reading all ACPI tables via fw_cfg and provide fixed up ACPI data to the OS as before. Generating the MADT twice (here and during ACPI table building) seems acceptable, since there is no infrastructure to obtain the MADT out of the ACPI table memory area. [1] https://github.com/coconut-svsm/svsm/pull/858 [2] https://gitlab.com/qemu-project/qemu/-/issues/2882 [3] https://github.com/coconut-svsm/svsm/issues/646 Signed-off-by: Oliver Steffen Based-On: <20251118122133.1695767-1-kraxel@redhat.com> --- backends/igvm-cfg.c | 8 +++++++- backends/igvm.c | 37 ++++++++++++++++++++++++++++++++++++- include/system/igvm-cfg.h | 5 ++++- include/system/igvm.h | 2 +- target/i386/sev.c | 5 +++-- 5 files changed, 51 insertions(+), 6 deletions(-) diff --git a/backends/igvm-cfg.c b/backends/igvm-cfg.c index c1b45401f4..0a77f7b7a1 100644 --- a/backends/igvm-cfg.c +++ b/backends/igvm-cfg.c @@ -17,6 +17,7 @@ #include "qom/object_interfaces.h" #include "hw/qdev-core.h" #include "hw/boards.h" +#include "hw/i386/acpi-build.h" =20 #include "trace.h" =20 @@ -48,10 +49,15 @@ static void igvm_reset_hold(Object *obj, ResetType type) { MachineState *ms =3D MACHINE(qdev_get_machine()); IgvmCfg *igvm =3D IGVM_CFG(obj); + GArray *madt =3D NULL; =20 trace_igvm_reset_hold(type); =20 - qigvm_process_file(igvm, ms->cgs, false, &error_fatal); + madt =3D acpi_build_madt_standalone(ms); + + qigvm_process_file(igvm, ms->cgs, false, madt, &error_fatal); + + g_array_free(madt, true); } =20 static void igvm_reset_exit(Object *obj, ResetType type) diff --git a/backends/igvm.c b/backends/igvm.c index a350c890cc..7e56b19b0a 100644 --- a/backends/igvm.c +++ b/backends/igvm.c @@ -93,6 +93,7 @@ typedef struct QIgvm { unsigned region_start_index; unsigned region_last_index; unsigned region_page_count; + GArray *madt; } QIgvm; =20 static int qigvm_directive_page_data(QIgvm *ctx, const uint8_t *header_dat= a, @@ -120,6 +121,8 @@ static int qigvm_directive_snp_id_block(QIgvm *ctx, con= st uint8_t *header_data, static int qigvm_initialization_guest_policy(QIgvm *ctx, const uint8_t *header_data, Error **errp); +static int qigvm_initialization_madt(QIgvm *ctx, + const uint8_t *header_data, Error **e= rrp); =20 struct QIGVMHandler { uint32_t type; @@ -148,6 +151,8 @@ static struct QIGVMHandler handlers[] =3D { qigvm_directive_snp_id_block }, { IGVM_VHT_GUEST_POLICY, IGVM_HEADER_SECTION_INITIALIZATION, qigvm_initialization_guest_policy }, + { IGVM_VHT_MADT, IGVM_HEADER_SECTION_DIRECTIVE, + qigvm_initialization_madt }, }; =20 static int qigvm_handler(QIgvm *ctx, uint32_t type, Error **errp) @@ -764,6 +769,34 @@ static int qigvm_initialization_guest_policy(QIgvm *ct= x, return 0; } =20 +static int qigvm_initialization_madt(QIgvm *ctx, + const uint8_t *header_data, Error **e= rrp) +{ + const IGVM_VHS_PARAMETER *param =3D (const IGVM_VHS_PARAMETER *)header= _data; + QIgvmParameterData *param_entry; + + if (ctx->madt =3D=3D NULL) { + return 0; + } + + /* Find the parameter area that should hold the device tree */ + QTAILQ_FOREACH(param_entry, &ctx->parameter_data, next) + { + if (param_entry->index =3D=3D param->parameter_area_index) { + + if (ctx->madt->len > param_entry->size) { + error_setg( + errp, + "IGVM: MADT size exceeds parameter area defined in IGV= M file"); + return -1; + } + memcpy(param_entry->data, ctx->madt->data, ctx->madt->len); + break; + } + } + return 0; +} + static int qigvm_supported_platform_compat_mask(QIgvm *ctx, Error **errp) { int32_t header_count; @@ -892,7 +925,7 @@ IgvmHandle qigvm_file_init(char *filename, Error **errp) } =20 int qigvm_process_file(IgvmCfg *cfg, ConfidentialGuestSupport *cgs, - bool onlyVpContext, Error **errp) + bool onlyVpContext, GArray *madt, Error **errp) { int32_t header_count; QIgvmParameterData *parameter; @@ -915,6 +948,8 @@ int qigvm_process_file(IgvmCfg *cfg, ConfidentialGuestS= upport *cgs, ctx.cgs =3D cgs; ctx.cgsc =3D cgs ? CONFIDENTIAL_GUEST_SUPPORT_GET_CLASS(cgs) : NULL; =20 + ctx.madt =3D madt; + /* * Check that the IGVM file provides configuration for the current * platform diff --git a/include/system/igvm-cfg.h b/include/system/igvm-cfg.h index 7dc48677fd..d5138f745c 100644 --- a/include/system/igvm-cfg.h +++ b/include/system/igvm-cfg.h @@ -40,10 +40,13 @@ typedef struct IgvmCfgClass { * in the IGVM file will be processed, allowing information about the * CPU state to be determined before processing the entire file. * + * @madt: Optional ACPI MADT data to pass to the guest via the IGVM_VH= T_MADT + * parameter. Only relevant if onlyVpContext is false. + * * Returns 0 for ok and -1 on error. */ int (*process)(IgvmCfg *cfg, ConfidentialGuestSupport *cgs, - bool onlyVpContext, Error **errp); + bool onlyVpContext, GArray *madt, Error **errp); =20 } IgvmCfgClass; =20 diff --git a/include/system/igvm.h b/include/system/igvm.h index ec2538daa0..f2e580e4ee 100644 --- a/include/system/igvm.h +++ b/include/system/igvm.h @@ -18,7 +18,7 @@ =20 IgvmHandle qigvm_file_init(char *filename, Error **errp); int qigvm_process_file(IgvmCfg *igvm, ConfidentialGuestSupport *cgs, - bool onlyVpContext, Error **errp); + bool onlyVpContext, GArray *madt, Error **errp); =20 /* x86 native */ int qigvm_x86_get_mem_map_entry(int index, diff --git a/target/i386/sev.c b/target/i386/sev.c index fd2dada013..55fd20510a 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -1888,11 +1888,12 @@ static int sev_common_kvm_init(ConfidentialGuestSup= port *cgs, Error **errp) * we need to pre-process it here to extract sev_features in order= to * provide it to KVM_SEV_INIT2. Each cgs_* function that is called= by * the IGVM processor detects this pre-process by observing the st= ate - * as SEV_STATE_UNINIT. + * as SEV_STATE_UNINIT. The IGVM file is only read here, no MADT d= ata + * needs to be supplied. */ if (x86machine->igvm) { if (IGVM_CFG_GET_CLASS(x86machine->igvm) - ->process(x86machine->igvm, machine->cgs, true, errp) = =3D=3D + ->process(x86machine->igvm, machine->cgs, true, NULL, = errp) =3D=3D -1) { return -1; } --=20 2.52.0