From nobody Tue Feb 10 03:37:24 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=1769508251; cv=none; d=zohomail.com; s=zohoarc; b=S0trvSRQG2VbEfemGLRpi7EDC5WCbXk+GPeC7njpSgjIRlgRrpBMIROHqo2ewJkjdgeucRFkzmr4NPOcG+QQyoyhRFL2eOWQDRgPXdM0UPlLG3dEOjmkV+jAqmnT4cjCZNp1QNHrLAeVI+QfyUolyHUz/UJnxM3W8DHQCFA9UGQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769508251; 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=78qEYGxPGWEZJXeutuZiOnK8kpP41OBXgXR3DQZ5n0c=; b=AWatZs0zT1UQyozujESTe/ntff3Wjcc7LZitQ8VrAfxGheT2rEQZk3P9d5z0nx38Myr5vNVMckcg+FFCbeY10n4USoMaDFCAA4+9i8iRU/oPj0UaTneOHiVTjkwxza3tRSGrdNkRIsBZdnKd6uh0dYB0IuQW1Zzoe876Di2LZSM= 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 1769508251639261.4406617435253; Tue, 27 Jan 2026 02:04:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vkfvW-0005za-DF; Tue, 27 Jan 2026 05:04: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 1vkfvS-0005mY-1x for qemu-devel@nongnu.org; Tue, 27 Jan 2026 05:03:58 -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 1vkfvQ-0005EF-Ei for qemu-devel@nongnu.org; Tue, 27 Jan 2026 05:03:57 -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-29-iPqbXcF-PBmbKc4lB7fTYg-1; Tue, 27 Jan 2026 05:03: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 14D521800365; Tue, 27 Jan 2026 10:03:41 +0000 (UTC) Received: from osteffen-thinkpadx1carbongen12.rmtde.csb (unknown [10.44.34.174]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2BB4A180049F; Tue, 27 Jan 2026 10:03:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769508235; 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=78qEYGxPGWEZJXeutuZiOnK8kpP41OBXgXR3DQZ5n0c=; b=QzoxMRkoQvzxy1zBJFWIJ44v1NGDzr11AuGK2iAu8hwXSQkaN3LF3bLKoGHUElbIUUFreA 7A9JkhbOMNc9P7iA+aI4DM6fRNR7Yp0OnCKDz1c0jYooSFQYHrWtif17RcxsC64hG2du54 SGILGauZfA5QIkUE5tYLPp+v5MrIeMk= X-MC-Unique: iPqbXcF-PBmbKc4lB7fTYg-1 X-Mimecast-MFC-AGG-ID: iPqbXcF-PBmbKc4lB7fTYg_1769508221 From: Oliver Steffen To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , Gerd Hoffmann , Stefano Garzarella , Zhao Liu , Marcel Apfelbaum , Igor Mammedov , Marcelo Tosatti , Richard Henderson , Ani Sinha , kvm@vger.kernel.org, "Michael S. Tsirkin" , Luigi Leonardi , Joerg Roedel , Oliver Steffen Subject: [PATCH v5 6/6] igvm: Fill MADT IGVM parameter field Date: Tue, 27 Jan 2026 11:02:57 +0100 Message-ID: <20260127100257.1074104-7-osteffen@redhat.com> In-Reply-To: <20260127100257.1074104-1-osteffen@redhat.com> References: <20260127100257.1074104-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 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: 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: 1769508253114158500 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 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. [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 --- backends/igvm.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/backends/igvm.c b/backends/igvm.c index f26eb633f8..1d8f807cf6 100644 --- a/backends/igvm.c +++ b/backends/igvm.c @@ -21,6 +21,7 @@ #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 @@ -138,6 +139,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 **errp); =20 struct QIGVMHandler { uint32_t type; @@ -166,6 +169,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) @@ -779,6 +784,34 @@ 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 **errp) +{ + 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; +} + static int qigvm_supported_platform_compat_mask(QIgvm *ctx, Error **errp) { int32_t header_count; --=20 2.52.0