From nobody Tue Feb 10 02:43:31 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=1770120330; cv=none; d=zohomail.com; s=zohoarc; b=JcaJXzeAGF9SXgeB+QpN/RtO2b1W3tyehXmx10NsrkFvhKrWmM1p9mNLmhHxn21AzrQwK7EnVG2k+/VVuTuQaCtGYckZip4jYFi9noCMbm2p/M9CbjjWjRwhcwQ687+fDe9MLQDOMLPaFGQN0MHzP+aedxxwIvWrWhj/yfGuGdg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770120330; 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=CnOXJUc/BoLbPslPw3aPQeYYdMXvaRXwx5lRglNofE0=; b=ZRf50KBJFDbDxf2xWg1ZZzD+NXgjrG4spPRBdmnbUMBl55GtqiChSE2dWGUPMlfjONUt6DSGJm4rY5j4O+HyvLcz+jdq44Di3b2Ka5Awc8CNOmhmC3YnJ4OkeANABJqzgkL2Zh25WQFS2q1gkuXpYzcGZgIAzutjL95OnTyz660= 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 1770120330488104.91539475688978; Tue, 3 Feb 2026 04:05:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vnF98-0000g0-OM; Tue, 03 Feb 2026 07:04:42 -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 1vnF8j-0007x1-I0 for qemu-devel@nongnu.org; Tue, 03 Feb 2026 07:04:17 -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 1vnF8g-0007h3-St for qemu-devel@nongnu.org; Tue, 03 Feb 2026 07:04:17 -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-468-USztDpaWNaq_aozul2U5dQ-1; Tue, 03 Feb 2026 07:04:10 -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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EECEA180047F; Tue, 3 Feb 2026 12:04:08 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.44.34.28]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3D91030001A7; Tue, 3 Feb 2026 12:04:08 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id C324A182626E; Tue, 03 Feb 2026 13:03:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770120253; 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=CnOXJUc/BoLbPslPw3aPQeYYdMXvaRXwx5lRglNofE0=; b=hezH9QTW5un5GRf92obsnOYX0JWIVT94H1uAF56IVrdgzFOr+YQLAQQhorOvkLSXLMRD37 LbEMJ69nDMgysZpIbYp/l8lxSZ/XbwFuAdvuA32FdLrMZ3U9fcI8hWZL4oIFH1zRUMynFT hppjoWVlD6/4UIuY0+pdRzlq7zv0pUM= X-MC-Unique: USztDpaWNaq_aozul2U5dQ-1 X-Mimecast-MFC-AGG-ID: USztDpaWNaq_aozul2U5dQ_1770120249 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Igor Mammedov , Paolo Bonzini , Marcel Apfelbaum , Ani Sinha , Pierrick Bouvier , Eduardo Habkost , Zhao Liu , Stefano Garzarella , Marcelo Tosatti , "Michael S. Tsirkin" , Richard Henderson , kvm@vger.kernel.org, Gerd Hoffmann , Oliver Steffen Subject: [PULL 17/17] igvm: Fill MADT IGVM parameter field on x86_64 Date: Tue, 3 Feb 2026 13:03:42 +0100 Message-ID: <20260203120343.656961-18-kraxel@redhat.com> In-Reply-To: <20260203120343.656961-1-kraxel@redhat.com> References: <20260203120343.656961-1-kraxel@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=kraxel@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: qemu development 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: 1770120331246158500 Content-Type: text/plain; charset="utf-8" From: Oliver Steffen 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 across hypervisors; switching over would allow removing specialized code paths for QEMU in Coconut. Coconut SVSM needs to know the SMP configuration, but does not look at any other ACPI data, nor does it interact with the PCI bus settings. Since the MADT is static and not linked with other ACPI tables, it can be supplied stand-alone like this. 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. 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 without any changes. The IGVM parameter handler is implemented for the i386 machine target and stubbed for all others. [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 Message-ID: <20260130054714.715928-10-osteffen@redhat.com> Signed-off-by: Gerd Hoffmann --- include/system/igvm-internal.h | 5 +++++ backends/igvm.c | 2 ++ stubs/igvm.c | 6 ++++++ target/i386/igvm.c | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+) diff --git a/include/system/igvm-internal.h b/include/system/igvm-internal.h index 1d36519ab082..38004bd908e7 100644 --- a/include/system/igvm-internal.h +++ b/include/system/igvm-internal.h @@ -74,4 +74,9 @@ IgvmHandle qigvm_file_init(char *filename, Error **errp); QIgvmParameterData* qigvm_find_param_entry(QIgvm *igvm, uint32_t parameter_area_index); =20 +/* + * IGVM parameter handlers + */ +int qigvm_directive_madt(QIgvm *ctx, const uint8_t *header_data, Error **e= rrp); + #endif diff --git a/backends/igvm.c b/backends/igvm.c index 3e7c0ea41d14..b01a19ba46a1 100644 --- a/backends/igvm.c +++ b/backends/igvm.c @@ -128,6 +128,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) diff --git a/stubs/igvm.c b/stubs/igvm.c index 17cd1e903e35..47d5130d9d74 100644 --- a/stubs/igvm.c +++ b/stubs/igvm.c @@ -12,6 +12,7 @@ #include "qemu/osdep.h" =20 #include "system/igvm.h" +#include "system/igvm-internal.h" =20 int qigvm_x86_get_mem_map_entry(int index, ConfidentialGuestMemoryMapEntry *entry, @@ -24,3 +25,8 @@ int qigvm_x86_set_vp_context(void *data, int index, Error= **errp) { return -1; } + +int qigvm_directive_madt(QIgvm *ctx, const uint8_t *header_data, Error **e= rrp) +{ + return -1; +} diff --git a/target/i386/igvm.c b/target/i386/igvm.c index 457c253b030c..f41b498b8924 100644 --- a/target/i386/igvm.c +++ b/target/i386/igvm.c @@ -13,7 +13,9 @@ =20 #include "cpu.h" #include "hw/i386/e820_memory_layout.h" +#include "hw/i386/acpi-build.h" #include "system/igvm.h" +#include "system/igvm-internal.h" =20 struct IgvmNativeVpContextX64 { uint64_t rax; @@ -178,3 +180,33 @@ void qigvm_x86_bsp_reset(CPUX86State *env) =20 qigvm_x86_load_context(bsp_context, env); } + +/* + * Process MADT IGVM parameter + */ +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; + int result =3D 0; + + /* Find the parameter area that should hold the MADT data */ + param_entry =3D qigvm_find_param_entry(ctx, param->parameter_area_inde= x); + if (param_entry =3D=3D NULL) { + return 0; + } + + GArray *madt =3D acpi_build_madt_standalone(ctx->machine_state); + + if (madt->len <=3D param_entry->size) { + memcpy(param_entry->data, madt->data, madt->len); + } else { + error_setg( + errp, + "IGVM: MADT size exceeds parameter area defined in IGVM file"); + result =3D -1; + } + + g_array_free(madt, true); + return result; +} --=20 2.52.0