From nobody Sun Feb 8 23:26:44 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=1767969302; cv=none; d=zohomail.com; s=zohoarc; b=Eq9m1dQd4RLoYgULAjUkI6T+dTja7kqnY4WubhPqXfKtAscPo2dGE/Fyab30GOsxk0SYxN1I3VhUjIgrUNJUopU8ufx/TtEdQK354NkkpVLAVwNts5LpS//u9riszePSqBKjBUBxIiqp0tuUGjMO8p+jPsmTzz6czkG1Xmcnm7Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767969302; 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=aLqvoSAaOfxAza5JNQnP8qFvCHzK415FNygsWJU1yee8GeGvetH7x5nRns1zCt4zi7kKRazk41K++TBW+xpUzlMGN4D+tiLSsBk15wiv4QU07fag3yiB1EWuxGdM5XerVSaZI1WIuPxCBZVUG49FgYsxuBq1UG9aVDX/jCzjJ30= 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 1767969302868267.28112642440044; Fri, 9 Jan 2026 06:35:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veDZU-0004rL-JW; Fri, 09 Jan 2026 09:34:36 -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 1veDZS-0004r3-HL for qemu-devel@nongnu.org; Fri, 09 Jan 2026 09:34:34 -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 1veDZQ-0005Po-Iw for qemu-devel@nongnu.org; Fri, 09 Jan 2026 09:34:34 -0500 Received: from mx-prod-mc-06.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-442-4i_4hS42MCOsmAjYEx9_fQ-1; Fri, 09 Jan 2026 09:34:29 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DAED918005B7; Fri, 9 Jan 2026 14:34:27 +0000 (UTC) Received: from osteffen-laptop.redhat.com (unknown [10.45.225.84]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8D4FE18001D5; Fri, 9 Jan 2026 14:34:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1767969271; 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=ihqgLq8smpJVYP6H0u1S38uuQnjF+xnGtX4nlZUJdooF/mpzAUNhVnRZAFQq7VIBy++TQO OAfxpJXbZjnClcIgTlh6sP9u1nS21COTfkM8RiYS+YsyuuGsPlqSC4RgfGzAWXLgXmst9K IJvVI7q4qfdtRJ125In451m5Kl79Cdc= X-MC-Unique: 4i_4hS42MCOsmAjYEx9_fQ-1 X-Mimecast-MFC-AGG-ID: 4i_4hS42MCOsmAjYEx9_fQ_1767969268 From: Oliver Steffen To: qemu-devel@nongnu.org Cc: Richard Henderson , Igor Mammedov , Paolo Bonzini , Marcelo Tosatti , Ani Sinha , Stefano Garzarella , Luigi Leonardi , Zhao Liu , Joerg Roedel , Gerd Hoffmann , kvm@vger.kernel.org, Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Oliver Steffen Subject: [PATCH v3 1/6] hw/acpi: Make BIOS linker optional Date: Fri, 9 Jan 2026 15:34:08 +0100 Message-ID: <20260109143413.293593-2-osteffen@redhat.com> In-Reply-To: <20260109143413.293593-1-osteffen@redhat.com> References: <20260109143413.293593-1-osteffen@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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 (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: -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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1767969305631158500 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 --- 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 Sun Feb 8 23:26:44 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=1767969303; cv=none; d=zohomail.com; s=zohoarc; b=No9ACLNz33j/oGZQD/ao2WfNCoMA1REM6IxJ+FMm2+2EB+MXtEd6nd9R/qICoCjw2LW9UoWMOkCctNhAIFtSK8fdDjTeKaGbTCeBDzZojEyrxbv5iXMLcBQZpCeYlI0oaKBqbQ8GUDrfOR3POhi/ZCtiYytqJG8Dx+r3wK2ccrs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767969303; 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=DxxCK/S3638LKTnUXgee7ZD3VWrEUKlqLqdZCXxg1Ad9U+PiP77kHEVy+3++vVpqTsMVpX/UfSNpnRrHASo5hhNzeauJfey9wnwfI6GP8nNts5IhOgDjQWjMmji9P2fqoRsMDu/LQy8ORX76OkJH5g78BZfitj1ONlKCY5NwblU= 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 1767969303331499.72799420193326; Fri, 9 Jan 2026 06:35:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veDZd-0004tP-2h; Fri, 09 Jan 2026 09:34:45 -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 1veDZa-0004sp-DV for qemu-devel@nongnu.org; Fri, 09 Jan 2026 09:34:42 -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 1veDZZ-0005Qb-2r for qemu-devel@nongnu.org; Fri, 09 Jan 2026 09:34:42 -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-562-5OsW6jX8Nzi4s9LpspY1GQ-1; Fri, 09 Jan 2026 09:34:36 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 E8E8E19560A5; Fri, 9 Jan 2026 14:34:34 +0000 (UTC) Received: from osteffen-laptop.redhat.com (unknown [10.45.225.84]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 77B7F1801A46; Fri, 9 Jan 2026 14:34:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1767969280; 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=fdwT1W3QNUoeLUi6mR6De6e8ELHqR6OYaoisJsaEp1usoCsMlWDiSStftipnblpO2ILyCS fMek7f7PngHJj1WFZIyXHC3+dfQxSjTo8i4vqDrps5Ugxu55HD9YLghNT2IGyzDQZZttg3 v4fwdS/HUpjyw/i44hTi9NiH6EW4RAs= X-MC-Unique: 5OsW6jX8Nzi4s9LpspY1GQ-1 X-Mimecast-MFC-AGG-ID: 5OsW6jX8Nzi4s9LpspY1GQ_1767969275 From: Oliver Steffen To: qemu-devel@nongnu.org Cc: Richard Henderson , Igor Mammedov , Paolo Bonzini , Marcelo Tosatti , Ani Sinha , Stefano Garzarella , Luigi Leonardi , Zhao Liu , Joerg Roedel , Gerd Hoffmann , kvm@vger.kernel.org, Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Oliver Steffen Subject: [PATCH v3 2/6] hw/acpi: Add standalone function to build MADT Date: Fri, 9 Jan 2026 15:34:09 +0100 Message-ID: <20260109143413.293593-3-osteffen@redhat.com> In-Reply-To: <20260109143413.293593-1-osteffen@redhat.com> References: <20260109143413.293593-1-osteffen@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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 (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: -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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1767969305326158500 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 --- 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 Sun Feb 8 23:26:44 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=1767969318; cv=none; d=zohomail.com; s=zohoarc; b=YVYAVuG1v3+yzhhQaIimbhVWxoRiTKQ+JdS4GvZJPJ/uF5Pd+6xpB1e0mrwiRec4lzBpbwb6N7HixI4WvYjGNezyh+7IepLt4ITtnhbyC4oRpP4oAT79RPE+1GeQZIB38ORrC58P5xeF0avUwJkf0jBEjqXY09UZz3vbCbsm9Zk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767969318; 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=NRabUwKCcnSa4tcxD8eunuOpk4bc+IJarAuAxh7ITUE=; b=iuJRhnyyN0MDN+l8Okim/GQL6fTmXTn7NQY0f8sjPL+OtsTMbopasi9xY0SYjpPdU04G2r3TVv7Oa6DlV6C08rWpATww0i4evprCAVoX18mkW0SLY8hg5vM+WDxiWCVGMgklVe0jBMcBn4L9ueEbDU+Zj+5bSjazxYzRLOffq00= 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 1767969318083224.1790230724108; Fri, 9 Jan 2026 06:35:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veDZh-0004uH-BT; Fri, 09 Jan 2026 09:34:49 -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 1veDZf-0004tv-M2 for qemu-devel@nongnu.org; Fri, 09 Jan 2026 09:34:47 -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 1veDZe-0005Qq-9D for qemu-devel@nongnu.org; Fri, 09 Jan 2026 09:34:47 -0500 Received: from mx-prod-mc-06.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-654-6G9LkJXhOVGlCvQ16DNN4g-1; Fri, 09 Jan 2026 09:34:42 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9171B18005AE; Fri, 9 Jan 2026 14:34:40 +0000 (UTC) Received: from osteffen-laptop.redhat.com (unknown [10.45.225.84]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 69C0318001D5; Fri, 9 Jan 2026 14:34:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1767969285; 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=NRabUwKCcnSa4tcxD8eunuOpk4bc+IJarAuAxh7ITUE=; b=DmZEcLfRIMJ6B3dX/+2HReYueAx3YYL0e7jcyti4fJSNlHRtxxhF2xy6vRl8+moNICjZdb PRTMwrzvQyqV9d3kbRcvGjHiKueHSc5sMsO6X+HSDYu+miBPamLpFkEbKQ/9ooZp1FeNfY jA5Lw4Bai6Ui8jY4i2BXNhrzQpsanb4= X-MC-Unique: 6G9LkJXhOVGlCvQ16DNN4g-1 X-Mimecast-MFC-AGG-ID: 6G9LkJXhOVGlCvQ16DNN4g_1767969280 From: Oliver Steffen To: qemu-devel@nongnu.org Cc: Richard Henderson , Igor Mammedov , Paolo Bonzini , Marcelo Tosatti , Ani Sinha , Stefano Garzarella , Luigi Leonardi , Zhao Liu , Joerg Roedel , Gerd Hoffmann , kvm@vger.kernel.org, Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Oliver Steffen Subject: [PATCH v3 3/6] igvm: Add missing NULL check Date: Fri, 9 Jan 2026 15:34:10 +0100 Message-ID: <20260109143413.293593-4-osteffen@redhat.com> In-Reply-To: <20260109143413.293593-1-osteffen@redhat.com> References: <20260109143413.293593-1-osteffen@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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 (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: -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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1767969319134158500 Content-Type: text/plain; charset="utf-8" Check for NULL pointer returned from igvm_get_buffer(). Documentation for that function calls for that unconditionally. Signed-off-by: Oliver Steffen --- backends/igvm.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/backends/igvm.c b/backends/igvm.c index a350c890cc..dc1fd026cb 100644 --- a/backends/igvm.c +++ b/backends/igvm.c @@ -170,9 +170,16 @@ static int qigvm_handler(QIgvm *ctx, uint32_t type, Er= ror **errp) (int)header_handle); return -1; } - header_data =3D igvm_get_buffer(ctx->file, header_handle) + - sizeof(IGVM_VHS_VARIABLE_HEADER); - result =3D handlers[handler].handler(ctx, header_data, errp); + header_data =3D igvm_get_buffer(ctx->file, header_handle); + if (header_data =3D=3D NULL) { + error_setg( + errp, + "IGVM: Failed to get directive header data (code: %d)", + (int)header_handle); + result =3D -1; + } else { + result =3D handlers[handler].handler(ctx, header_data + sizeof= (IGVM_VHS_VARIABLE_HEADER), errp); + } igvm_free_buffer(ctx->file, header_handle); return result; } --=20 2.52.0 From nobody Sun Feb 8 23:26:44 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=1767969330; cv=none; d=zohomail.com; s=zohoarc; b=gBNWmfLEOvA6sBSAuXw0S9Zsf+v8cADWkmOjAGvh1Lx3BvpWXi7Z228/49l0WmSFSwliIoMEdhhgJJa+TJcIDhU3nakPDZpCvCbq2MXSnb/lpouZBpP9f2flngHPLVx5rOBLp/t8D2GB6Q0WwaSXUIhp4/kZiJz4bXad6f2Njlk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767969330; 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=kh5b5sfCH40GicWYc2tsY/crNp+W5lW6bAFRhHZ+qr0=; b=PGc/ALyBU2uPve7Png2Z8BrLGfjJwGpRdsbc7kfl5fzEtOTeG2d1eFWRfWtD2L9Ccu1OJ/2u4zm4/L/+A5nItmHeL71lWvGwGU/Jd4p1ATly0Qu1Q64AYe8OWcvAlUQY26UG82VpjW0f9IOGlVpHel7CNg8Bf8lZlKjQuhXS3fA= 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 1767969330092316.3304278081604; Fri, 9 Jan 2026 06:35:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veDZu-0004wF-I8; Fri, 09 Jan 2026 09:35: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 1veDZl-0004vB-Qf for qemu-devel@nongnu.org; Fri, 09 Jan 2026 09:34:54 -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 1veDZk-0005R4-8s for qemu-devel@nongnu.org; Fri, 09 Jan 2026 09:34:53 -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-7-Pjbg_medOXeK_QnUXxk9kg-1; Fri, 09 Jan 2026 09:34:48 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 847721956054; Fri, 9 Jan 2026 14:34:46 +0000 (UTC) Received: from osteffen-laptop.redhat.com (unknown [10.45.225.84]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4D145180066A; Fri, 9 Jan 2026 14:34:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1767969291; 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=kh5b5sfCH40GicWYc2tsY/crNp+W5lW6bAFRhHZ+qr0=; b=XhQEYmdV36AlGpvzsQLCqWkvtmbLQp6Gj8fByDwhsIo5OKU30rI4PbI2E1+X5EC/z2vgNv 3Xo0RD3HWmzsxaRwzuSzqTkRi6ptrpcXJV/W1HWnFZPIpJW+hy0OLklHTvUONd575Fmgk3 IYvgj610ijJyIN3VOx0Bfx+Iz3324kE= X-MC-Unique: Pjbg_medOXeK_QnUXxk9kg-1 X-Mimecast-MFC-AGG-ID: Pjbg_medOXeK_QnUXxk9kg_1767969286 From: Oliver Steffen To: qemu-devel@nongnu.org Cc: Richard Henderson , Igor Mammedov , Paolo Bonzini , Marcelo Tosatti , Ani Sinha , Stefano Garzarella , Luigi Leonardi , Zhao Liu , Joerg Roedel , Gerd Hoffmann , kvm@vger.kernel.org, Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Oliver Steffen Subject: [PATCH v3 4/6] igvm: Add common function for finding parameter entries Date: Fri, 9 Jan 2026 15:34:11 +0100 Message-ID: <20260109143413.293593-5-osteffen@redhat.com> In-Reply-To: <20260109143413.293593-1-osteffen@redhat.com> References: <20260109143413.293593-1-osteffen@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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 (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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1767969333371158500 Content-Type: text/plain; charset="utf-8" Move repeating code for finding the parameter entries in the IGVM backend out of the parameter handlers into a common function. --- backends/igvm.c | 115 +++++++++++++++++++++++++----------------------- 1 file changed, 61 insertions(+), 54 deletions(-) diff --git a/backends/igvm.c b/backends/igvm.c index dc1fd026cb..a797bd741c 100644 --- a/backends/igvm.c +++ b/backends/igvm.c @@ -95,6 +95,18 @@ typedef struct QIgvm { unsigned region_page_count; } QIgvm; =20 +static QIgvmParameterData *qigvm_find_param_entry(QIgvm *igvm, const IGVM_= VHS_PARAMETER *param) { + + QIgvmParameterData *param_entry; + QTAILQ_FOREACH(param_entry, &igvm->parameter_data, next) + { + if (param_entry->index =3D=3D param->parameter_area_index) { + return param_entry; + } + } + return NULL; +} + static int qigvm_directive_page_data(QIgvm *ctx, const uint8_t *header_dat= a, Error **errp); static int qigvm_directive_vp_context(QIgvm *ctx, const uint8_t *header_da= ta, @@ -576,57 +588,54 @@ static int qigvm_directive_memory_map(QIgvm *ctx, con= st uint8_t *header_data, } =20 /* Find the parameter area that should hold the memory map */ - QTAILQ_FOREACH(param_entry, &ctx->parameter_data, next) + param_entry =3D qigvm_find_param_entry(ctx, param); + if (param_entry !=3D NULL) { - if (param_entry->index =3D=3D param->parameter_area_index) { - max_entry_count =3D - param_entry->size / sizeof(IGVM_VHS_MEMORY_MAP_ENTRY); - mm_entry =3D (IGVM_VHS_MEMORY_MAP_ENTRY *)param_entry->data; - - retval =3D get_mem_map_entry(entry, &cgmm_entry, errp); - while (retval =3D=3D 0) { - if (entry >=3D max_entry_count) { - error_setg( - errp, - "IGVM: guest memory map size exceeds parameter are= a defined in IGVM file"); - return -1; - } - mm_entry[entry].starting_gpa_page_number =3D cgmm_entry.gp= a >> 12; - mm_entry[entry].number_of_pages =3D cgmm_entry.size >> 12; - - switch (cgmm_entry.type) { - case CGS_MEM_RAM: - mm_entry[entry].entry_type =3D - IGVM_MEMORY_MAP_ENTRY_TYPE_MEMORY; - break; - case CGS_MEM_RESERVED: - mm_entry[entry].entry_type =3D - IGVM_MEMORY_MAP_ENTRY_TYPE_PLATFORM_RESERVED; - break; - case CGS_MEM_ACPI: - mm_entry[entry].entry_type =3D - IGVM_MEMORY_MAP_ENTRY_TYPE_PLATFORM_RESERVED; - break; - case CGS_MEM_NVS: - mm_entry[entry].entry_type =3D - IGVM_MEMORY_MAP_ENTRY_TYPE_PERSISTENT; - break; - case CGS_MEM_UNUSABLE: - mm_entry[entry].entry_type =3D - IGVM_MEMORY_MAP_ENTRY_TYPE_PLATFORM_RESERVED; - break; - } - retval =3D get_mem_map_entry(++entry, &cgmm_entry, errp); + max_entry_count =3D + param_entry->size / sizeof(IGVM_VHS_MEMORY_MAP_ENTRY); + mm_entry =3D (IGVM_VHS_MEMORY_MAP_ENTRY *)param_entry->data; + + retval =3D get_mem_map_entry(entry, &cgmm_entry, errp); + while (retval =3D=3D 0) { + if (entry >=3D max_entry_count) { + error_setg( + errp, + "IGVM: guest memory map size exceeds parameter area de= fined in IGVM file"); + return -1; } - if (retval < 0) { - return retval; + mm_entry[entry].starting_gpa_page_number =3D cgmm_entry.gpa >>= 12; + mm_entry[entry].number_of_pages =3D cgmm_entry.size >> 12; + + switch (cgmm_entry.type) { + case CGS_MEM_RAM: + mm_entry[entry].entry_type =3D + IGVM_MEMORY_MAP_ENTRY_TYPE_MEMORY; + break; + case CGS_MEM_RESERVED: + mm_entry[entry].entry_type =3D + IGVM_MEMORY_MAP_ENTRY_TYPE_PLATFORM_RESERVED; + break; + case CGS_MEM_ACPI: + mm_entry[entry].entry_type =3D + IGVM_MEMORY_MAP_ENTRY_TYPE_PLATFORM_RESERVED; + break; + case CGS_MEM_NVS: + mm_entry[entry].entry_type =3D + IGVM_MEMORY_MAP_ENTRY_TYPE_PERSISTENT; + break; + case CGS_MEM_UNUSABLE: + mm_entry[entry].entry_type =3D + IGVM_MEMORY_MAP_ENTRY_TYPE_PLATFORM_RESERVED; + break; } - /* The entries need to be sorted */ - qsort(mm_entry, entry, sizeof(IGVM_VHS_MEMORY_MAP_ENTRY), - qigvm_cmp_mm_entry); - - break; + retval =3D get_mem_map_entry(++entry, &cgmm_entry, errp); } + if (retval < 0) { + return retval; + } + /* The entries need to be sorted */ + qsort(mm_entry, entry, sizeof(IGVM_VHS_MEMORY_MAP_ENTRY), + qigvm_cmp_mm_entry); } return 0; } @@ -662,14 +671,12 @@ static int qigvm_directive_environment_info(QIgvm *ct= x, QIgvmParameterData *param_entry; IgvmEnvironmentInfo *environmental_state; =20 - QTAILQ_FOREACH(param_entry, &ctx->parameter_data, next) + param_entry =3D qigvm_find_param_entry(ctx, param); + if (param_entry !=3D NULL) { - if (param_entry->index =3D=3D param->parameter_area_index) { - environmental_state =3D - (IgvmEnvironmentInfo *)(param_entry->data + param->byte_of= fset); - environmental_state->memory_is_shared =3D 1; - break; - } + environmental_state =3D + (IgvmEnvironmentInfo *)(param_entry->data + param->byte_offset= ); + environmental_state->memory_is_shared =3D 1; } return 0; } --=20 2.52.0 From nobody Sun Feb 8 23:26:44 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=1767969337; cv=none; d=zohomail.com; s=zohoarc; b=fCJn4VGd2uZHmQNDbgBF/2m1WkbvTeEdRs0QKol83APj70lsUMJLTKbf3ytFzcXPVcUz0lo5ulvoQRkYBLL48ElBN+UCidnwLZRPmdxlnIvUu8jf3slFNK5RFAHEJ46SF1L/l62HWqgI2P9FyB+pH1SHHiT0IcCXV3niMYIxCHI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767969337; 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=StFbEp2ry1WOmdUB9ftIGUAuXNqoomLenoPBUoiEMBQ=; b=O+gXetAQKGedJp0DZrtK5AvEzQ9cVhHRzUpuAwpRsWiwQqQF9uutol1rIf+1vD+gl+hvoZ2cBP35jap9qlFuiLVM7J3ed1puh/9qmgEk7IyqhloEm1WXLMyqaRShwKExcuEnm407TqJPfu6p9AaxUq848ZU8IkEXo7DfV5Nbb2w= 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 1767969337491811.6952604378286; Fri, 9 Jan 2026 06:35:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veDZy-00059x-Sk; Fri, 09 Jan 2026 09:35: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 1veDZw-00052X-07 for qemu-devel@nongnu.org; Fri, 09 Jan 2026 09:35: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 1veDZs-0005U1-BB for qemu-devel@nongnu.org; Fri, 09 Jan 2026 09:35:02 -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-616-XjbkymKgPxO-HutGHKDT4w-1; Fri, 09 Jan 2026 09:34:54 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 745A41956088; Fri, 9 Jan 2026 14:34:52 +0000 (UTC) Received: from osteffen-laptop.redhat.com (unknown [10.45.225.84]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1ECAD18001D5; Fri, 9 Jan 2026 14:34:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1767969298; 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=StFbEp2ry1WOmdUB9ftIGUAuXNqoomLenoPBUoiEMBQ=; b=NvCR3dopTsQuX8hEiHiJUntv/+lLJSvgAiEeyTZKV/UNCYm5kSaYv/URfKM0XvR9nS9Tlu Tf6+xbLGlmsRINh5XitX3hoc/6ArjSY3Y65EKFtmm+du9J06Kjd2Zd9cwm3pbmGKG7wSBd /roqZcBobs3qvkkmfcrsSk4/8YPkwkc= X-MC-Unique: XjbkymKgPxO-HutGHKDT4w-1 X-Mimecast-MFC-AGG-ID: XjbkymKgPxO-HutGHKDT4w_1767969292 From: Oliver Steffen To: qemu-devel@nongnu.org Cc: Richard Henderson , Igor Mammedov , Paolo Bonzini , Marcelo Tosatti , Ani Sinha , Stefano Garzarella , Luigi Leonardi , Zhao Liu , Joerg Roedel , Gerd Hoffmann , kvm@vger.kernel.org, Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Oliver Steffen Subject: [PATCH v3 5/6] igvm: Pass machine state to IGVM file processing Date: Fri, 9 Jan 2026 15:34:12 +0100 Message-ID: <20260109143413.293593-6-osteffen@redhat.com> In-Reply-To: <20260109143413.293593-1-osteffen@redhat.com> References: <20260109143413.293593-1-osteffen@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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 (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: -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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1767969339295158500 Content-Type: text/plain; charset="utf-8" Add a new MachineState* parameter to qigvm_process_file() to make the machine state available in the IGVM processing context. We will use it later to generate MADT data there to pass to the guest as IGVM parameter. Signed-off-by: Oliver Steffen --- backends/igvm-cfg.c | 2 +- backends/igvm.c | 6 +++++- include/system/igvm-cfg.h | 3 ++- include/system/igvm.h | 3 ++- target/i386/sev.c | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/backends/igvm-cfg.c b/backends/igvm-cfg.c index c1b45401f4..d79bdecab1 100644 --- a/backends/igvm-cfg.c +++ b/backends/igvm-cfg.c @@ -51,7 +51,7 @@ static void igvm_reset_hold(Object *obj, ResetType type) =20 trace_igvm_reset_hold(type); =20 - qigvm_process_file(igvm, ms->cgs, false, &error_fatal); + qigvm_process_file(igvm, ms->cgs, false, ms, &error_fatal); } =20 static void igvm_reset_exit(Object *obj, ResetType type) diff --git a/backends/igvm.c b/backends/igvm.c index a797bd741c..7390dee734 100644 --- a/backends/igvm.c +++ b/backends/igvm.c @@ -11,6 +11,7 @@ =20 #include "qemu/osdep.h" =20 +#include "hw/boards.h" #include "qapi/error.h" #include "qemu/target-info-qapi.h" #include "system/igvm.h" @@ -93,6 +94,7 @@ typedef struct QIgvm { unsigned region_start_index; unsigned region_last_index; unsigned region_page_count; + MachineState *machine_state; } QIgvm; =20 static QIgvmParameterData *qigvm_find_param_entry(QIgvm *igvm, const IGVM_= VHS_PARAMETER *param) { @@ -906,7 +908,7 @@ IgvmHandle qigvm_file_init(char *filename, Error **errp) } =20 int qigvm_process_file(IgvmCfg *cfg, ConfidentialGuestSupport *cgs, - bool onlyVpContext, Error **errp) + bool onlyVpContext, MachineState *machine_state, Er= ror **errp) { int32_t header_count; QIgvmParameterData *parameter; @@ -929,6 +931,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.machine_state =3D machine_state; + /* * 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..2783fc542e 100644 --- a/include/system/igvm-cfg.h +++ b/include/system/igvm-cfg.h @@ -12,6 +12,7 @@ #ifndef QEMU_IGVM_CFG_H #define QEMU_IGVM_CFG_H =20 +#include "hw/boards.h" #include "qom/object.h" #include "hw/resettable.h" =20 @@ -43,7 +44,7 @@ typedef struct IgvmCfgClass { * Returns 0 for ok and -1 on error. */ int (*process)(IgvmCfg *cfg, ConfidentialGuestSupport *cgs, - bool onlyVpContext, Error **errp); + bool onlyVpContext, MachineState *machine_state, Error = **errp); =20 } IgvmCfgClass; =20 diff --git a/include/system/igvm.h b/include/system/igvm.h index ec2538daa0..0afe784a17 100644 --- a/include/system/igvm.h +++ b/include/system/igvm.h @@ -14,11 +14,12 @@ =20 #include "system/confidential-guest-support.h" #include "system/igvm-cfg.h" +#include "hw/boards.h" #include "qapi/error.h" =20 IgvmHandle qigvm_file_init(char *filename, Error **errp); int qigvm_process_file(IgvmCfg *igvm, ConfidentialGuestSupport *cgs, - bool onlyVpContext, Error **errp); + bool onlyVpContext, MachineState *machine_state, Err= or **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..a733868043 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, machin= e, errp) =3D=3D -1) { return -1; } --=20 2.52.0 From nobody Sun Feb 8 23:26:44 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=1767969332; cv=none; d=zohomail.com; s=zohoarc; b=oGLs243gFCzI2Ho8H+dRe2ntmcN25Rt6XwfxbeYeTTJr/Cu0XZIutZRaDgLhCm9OoOXGJ/rnUxLd640Le0aokci0wC7H0HcI1iprUC16HukzW1kGgYSFq/Zj/y5hv9NWs33NQsp/F9tYoidZXPkH0+oqqK+WRpF13AsCyvWmKEY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767969332; 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=kk/8eotG0F0P+tesvNKVdbvvCdd2DwmMuhkjQ8i8LyE=; b=gmEdEqkSNH36lb+EWGvK6WAZR9q+Zg9PN7LoLbVrNK8HnXGHENJK1nYhlMBgidL2cgA/+93X3TCCH94w0xl+CzUF+pyUB06r+K0ewWCkb5rro64v/fZKsSJAd8dlIuPfAuJry43DYFQjhZ9WdLX9NE/1KgbHSruB0VtXEYeMrAU= 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 17679693329591004.2745198751413; Fri, 9 Jan 2026 06:35:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1veDaD-0005IQ-06; Fri, 09 Jan 2026 09:35:21 -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 1veDa6-0005E2-Tu for qemu-devel@nongnu.org; Fri, 09 Jan 2026 09:35:16 -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 1veDa3-0005hb-SU for qemu-devel@nongnu.org; Fri, 09 Jan 2026 09:35:13 -0500 Received: from mx-prod-mc-06.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-104-qH2LqthvP6G-KazQNLRC2g-1; Fri, 09 Jan 2026 09:34:59 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 39A7718005B7; Fri, 9 Jan 2026 14:34:58 +0000 (UTC) Received: from osteffen-laptop.redhat.com (unknown [10.45.225.84]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E1C4E180066A; Fri, 9 Jan 2026 14:34:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1767969311; 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=kk/8eotG0F0P+tesvNKVdbvvCdd2DwmMuhkjQ8i8LyE=; b=YjkG6js8Su2rlM+AD7fpfOqUu2pLs2DFYH6IpOaXJRjB0mWthku6upjPdaQ3WKHRq7MM6I RKrZuoJkjYUIv7+sgwyNHdhlMM3n1uwLHfyUxwJCuh53RlxvysVae3fh9i25nRoMSNxYVP C3yxT84B6jX6NtGPRdwB4atZU+Pk5Ck= X-MC-Unique: qH2LqthvP6G-KazQNLRC2g-1 X-Mimecast-MFC-AGG-ID: qH2LqthvP6G-KazQNLRC2g_1767969298 From: Oliver Steffen To: qemu-devel@nongnu.org Cc: Richard Henderson , Igor Mammedov , Paolo Bonzini , Marcelo Tosatti , Ani Sinha , Stefano Garzarella , Luigi Leonardi , Zhao Liu , Joerg Roedel , Gerd Hoffmann , kvm@vger.kernel.org, Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Oliver Steffen Subject: [PATCH v3 6/6] igvm: Fill MADT IGVM parameter field Date: Fri, 9 Jan 2026 15:34:13 +0100 Message-ID: <20260109143413.293593-7-osteffen@redhat.com> In-Reply-To: <20260109143413.293593-1-osteffen@redhat.com> References: <20260109143413.293593-1-osteffen@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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 (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: -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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1767969335435158500 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 (during ACPI table building and IGVM processing) 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 SQUASH: Rename madt parameter handler --- backends/igvm.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/backends/igvm.c b/backends/igvm.c index 7390dee734..90ea2c22fd 100644 --- a/backends/igvm.c +++ b/backends/igvm.c @@ -15,9 +15,11 @@ #include "qapi/error.h" #include "qemu/target-info-qapi.h" #include "system/igvm.h" +#include "glib.h" #include "system/memory.h" #include "system/address-spaces.h" #include "hw/core/cpu.h" +#include "hw/i386/acpi-build.h" =20 #include "trace.h" =20 @@ -134,6 +136,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_directive_madt(QIgvm *ctx, + const uint8_t *header_data, Error **e= rrp); =20 struct QIGVMHandler { uint32_t type; @@ -162,6 +166,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_directive_madt }, }; =20 static int qigvm_handler(QIgvm *ctx, uint32_t type, Error **errp) @@ -780,6 +786,35 @@ static int qigvm_initialization_guest_policy(QIgvm *ct= x, return 0; } =20 +static int qigvm_directive_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->machine_state =3D=3D NULL) { + return 0; + } + + /* Find the parameter area that should hold the MADT data */ + param_entry =3D qigvm_find_param_entry(ctx, param); + if (param_entry !=3D NULL) { + + GArray *madt =3D acpi_build_madt_standalone(ctx->machine_state); + + if (madt->len > param_entry->size) { + error_setg( + errp, + "IGVM: MADT size exceeds parameter area defined in IGVM fi= le"); + return -1; + } + memcpy(param_entry->data, madt->data, madt->len); + + g_array_free(madt, true); + } + return 0; +} + static int qigvm_supported_platform_compat_mask(QIgvm *ctx, Error **errp) { int32_t header_count; --=20 2.52.0