From nobody Mon Feb 9 00:45:33 2026 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=1765441043; cv=none; d=zohomail.com; s=zohoarc; b=l8/h4+xOnd689AKSjtx1xHPnZo3ldMR7zaJWzoOL12X7ix2h2DnszhAkX7VczLXeNzI7PuJdsH+OvZjS77D1y0AKHpUcbWQoei2YVnLrsiLSyuwYNb2rArMPwBF7KL3454HhzjU6Ou8cJkoFxpSTV63ZfhSy/iTwJvkrXvkHnrY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765441043; 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=Qh3ZnKdbbXmwW5iE0N29O/4G1KGa1g81iRRHKch44ciZX0kRC/HPI4k9yUTerPgc8KsrcuX32q4PunDoTdcxh/53ZQkAMdb33mwz4GB5r2goDNrsXHwOBCX62MYtuDjTvugasT4G9dqcBM5TY/qBAdVfLgJtgmHiP9378pKpXmk= 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 1765441043942386.8846727513867; Thu, 11 Dec 2025 00:17:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vTbqw-0001lh-QE; Thu, 11 Dec 2025 03:16:46 -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 1vTbqv-0001lS-1X for qemu-devel@nongnu.org; Thu, 11 Dec 2025 03:16:45 -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 1vTbqt-0000mi-LN for qemu-devel@nongnu.org; Thu, 11 Dec 2025 03:16:44 -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-659-PKaoQOUINLmg6Dngg2gFOA-1; Thu, 11 Dec 2025 03:15:32 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 909A1195DE61; Thu, 11 Dec 2025 08:15:30 +0000 (UTC) Received: from osteffen-laptop.redhat.com (unknown [10.45.225.89]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 90E6930001A2; Thu, 11 Dec 2025 08:15:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1765441003; 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=hbbQaZ3UL4oqV4Dz4+bWhxaii/OaK9/VKu5sC13QM+3b8GpGvWZ2J5qkAKjuFyTRYVpOOU epmCb4yTPk3mj47EJwJ4KMoQBge/Eg4PAxyKxkHW3Cz4YmlsfRh5mR4doKle0fYMC0gVjm y5js9axnNP2zbCPd0tF0DJRJkIm+BIU= X-MC-Unique: PKaoQOUINLmg6Dngg2gFOA-1 X-Mimecast-MFC-AGG-ID: PKaoQOUINLmg6Dngg2gFOA_1765440931 From: Oliver Steffen To: qemu-devel@nongnu.org Cc: Joerg Roedel , Marcel Apfelbaum , Gerd Hoffmann , Paolo Bonzini , Stefano Garzarella , Marcelo Tosatti , kvm@vger.kernel.org, Richard Henderson , Zhao Liu , Eduardo Habkost , Ani Sinha , "Michael S. Tsirkin" , Luigi Leonardi , Igor Mammedov , Oliver Steffen Subject: [PATCH 1/3] hw/acpi: Make BIOS linker optional Date: Thu, 11 Dec 2025 09:15:15 +0100 Message-ID: <20251211081517.1546957-2-osteffen@redhat.com> In-Reply-To: <20251211081517.1546957-1-osteffen@redhat.com> References: <20251211081517.1546957-1-osteffen@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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: 1765441044998158501 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 Mon Feb 9 00:45:33 2026 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=1765441088; cv=none; d=zohomail.com; s=zohoarc; b=N2hnzhvdroVIqTuIenIq/RmsbQ5VTrJ3XYnpjFyK4DLyRtEnLeW9JaqA2wJBwzb5k0/QxyY6HOxqwoza0qMD1r4WdbMTaJq15t0wcKEr3mwwDxxLtc/lNf0dL18xO7M+DsCcZklPHS8Y/fW3rI5wP5meDHvLszkGiTaPJo763Hk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765441088; 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=n45+oZsxAB/m0rBy0oY0j5zTc6VvDW07J3KavGhQBJqudb0L78i+NJzc1NC64WsrMnevCAa6zTd+/IZ7URyZzbGyQ+i9zapOVUruf47oUhCuVsRi/6jOd5FZysArIRXpYX2dp4BncY3QYYS6kJsCc36xFdoC3yxVTZ1xEbW9VM8= 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 1765441088908271.5623207528927; Thu, 11 Dec 2025 00:18:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vTbr0-0001mL-21; Thu, 11 Dec 2025 03:16:50 -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 1vTbqy-0001m3-Ag for qemu-devel@nongnu.org; Thu, 11 Dec 2025 03:16:48 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vTbqw-0000n3-Su for qemu-devel@nongnu.org; Thu, 11 Dec 2025 03:16:48 -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-295-HSliwGdDPdKxVCZPPH6PeQ-1; Thu, 11 Dec 2025 03:15:37 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 04FD9195F156; Thu, 11 Dec 2025 08:15:36 +0000 (UTC) Received: from osteffen-laptop.redhat.com (unknown [10.45.225.89]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0663C30001A2; Thu, 11 Dec 2025 08:15:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1765441005; 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=h9f/tmQmbPJETkpHbMmPlLnx5ytJpbZbkfPZ00iNY8A7kma3CGn+1T5yKQbQyNA5c2ILRl PcIE/UvctnjM6tF2wZhvLkF2Qo5GivHC5/1OSjIgF86aKiN8vsmDr3fGqgEEwZtI2U5AJP qgdtcufWS31PsmjVUrd9STg9a5dkw+E= X-MC-Unique: HSliwGdDPdKxVCZPPH6PeQ-1 X-Mimecast-MFC-AGG-ID: HSliwGdDPdKxVCZPPH6PeQ_1765440936 From: Oliver Steffen To: qemu-devel@nongnu.org Cc: Joerg Roedel , Marcel Apfelbaum , Gerd Hoffmann , Paolo Bonzini , Stefano Garzarella , Marcelo Tosatti , kvm@vger.kernel.org, Richard Henderson , Zhao Liu , Eduardo Habkost , Ani Sinha , "Michael S. Tsirkin" , Luigi Leonardi , Igor Mammedov , Oliver Steffen Subject: [PATCH 2/3] hw/acpi: Add standalone function to build MADT Date: Thu, 11 Dec 2025 09:15:16 +0100 Message-ID: <20251211081517.1546957-3-osteffen@redhat.com> In-Reply-To: <20251211081517.1546957-1-osteffen@redhat.com> References: <20251211081517.1546957-1-osteffen@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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.133.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_H3=0.001, RCVD_IN_MSPIKE_WL=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: 1765441089117158500 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 Mon Feb 9 00:45:33 2026 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=1765441059; cv=none; d=zohomail.com; s=zohoarc; b=TGhhEpoXEwMx/CbzvFAMVMkzBEZeOtWWQxXa4+O/QF7Io9SYc7qhphiPJWhXuOklq8E8lqzGVAGSwRfSFQvx1hWjRaBQF4bCgA+UDz3vjefTiPUeToAcQC3WzTkthAVtJ+Sv1815tph9w4DzNoMH0CQIJymPytPcQo0YHfjMejM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765441059; 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=VUw6KhdDlkAILHY2E/DfsZms1XeBroforyfbqStERgI=; b=n2myqjLUl2cyOPNFEEWCFTpaZHdTTWtbbPohcs3E9C9ekPPymQNOi5fJlDb1GwUiSUDrfzQ4tMrrqnhdxSqWe4tG68BnYUt4G+pJASzPL4MEBPbfnOZqraR6upxBTrF+GJYjy8jl6cwgDK2Ys1hlbM0stSL0GIIBXjJjK0f8U2Y= 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 1765441059049922.4350412541406; Thu, 11 Dec 2025 00:17:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vTbrG-0001nc-80; Thu, 11 Dec 2025 03:17:06 -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 1vTbrE-0001nK-5G for qemu-devel@nongnu.org; Thu, 11 Dec 2025 03:17:04 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vTbrC-0000nt-IT for qemu-devel@nongnu.org; Thu, 11 Dec 2025 03:17:03 -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-652-HB2UMXwlPLeRFmHgfOYjcA-1; Thu, 11 Dec 2025 03:15:43 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 3F8B31956054; Thu, 11 Dec 2025 08:15:42 +0000 (UTC) Received: from osteffen-laptop.redhat.com (unknown [10.45.225.89]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9310930001A2; Thu, 11 Dec 2025 08:15:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1765441022; 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=VUw6KhdDlkAILHY2E/DfsZms1XeBroforyfbqStERgI=; b=eHVyqMxQMwI2RDBY4NuuBaQ/eDjHxC0vqN06jvrRewGIHubd+Iels9+xA/IkFZ+neQW8DD ktbOz+ZPkXbX7eSOBnDWsPQDhijUgxFxcq1LuDWSCZe7h8fT/XqMN7hSk1Iyhhjs7yAR67 bPFzDJFSMt3I+l3EZy3xLk5lroXwegA= X-MC-Unique: HB2UMXwlPLeRFmHgfOYjcA-1 X-Mimecast-MFC-AGG-ID: HB2UMXwlPLeRFmHgfOYjcA_1765440942 From: Oliver Steffen To: qemu-devel@nongnu.org Cc: Joerg Roedel , Marcel Apfelbaum , Gerd Hoffmann , Paolo Bonzini , Stefano Garzarella , Marcelo Tosatti , kvm@vger.kernel.org, Richard Henderson , Zhao Liu , Eduardo Habkost , Ani Sinha , "Michael S. Tsirkin" , Luigi Leonardi , Igor Mammedov , Oliver Steffen Subject: [PATCH 3/3] igvm: Fill MADT IGVM parameter field Date: Thu, 11 Dec 2025 09:15:17 +0100 Message-ID: <20251211081517.1546957-4-osteffen@redhat.com> In-Reply-To: <20251211081517.1546957-1-osteffen@redhat.com> References: <20251211081517.1546957-1-osteffen@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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.133.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_H3=0.001, RCVD_IN_MSPIKE_WL=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: 1765441061001158500 Content-Type: text/plain; charset="utf-8" Use the new acpi_build_madt_standalone() function to fill the MADT parameter field. 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 | 4 ++-- include/system/igvm.h | 2 +- target/i386/sev.c | 2 +- 5 files changed, 47 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..1a04302beb 100644 --- a/include/system/igvm-cfg.h +++ b/include/system/igvm-cfg.h @@ -42,8 +42,8 @@ typedef struct IgvmCfgClass { * * Returns 0 for ok and -1 on error. */ - int (*process)(IgvmCfg *cfg, ConfidentialGuestSupport *cgs, - bool onlyVpContext, Error **errp); + int (*process)(IgvmCfg *cfg, ConfidentialGuestSupport *cgs,=20 + 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..ffeb9f52a2 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -1892,7 +1892,7 @@ static int sev_common_kvm_init(ConfidentialGuestSuppo= rt *cgs, Error **errp) */ 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