From nobody Mon Feb 9 17:25:12 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=1768413095; cv=none; d=zohomail.com; s=zohoarc; b=HIA0KCq6pWhu6O5X3aa0s00lHodZCopUrNYMNf0uuYdnua673f1VooGm5/B8BaGOyo1VNuJCCbrZc+yP8A3s6UIA3bFJGFnxFNdftBnI1XnB904WDcoq8ZslRplMT8cEWX6voQTQn6GY7qrw5m5PEKH6Ys3Bzcd51bywT4Q281E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768413095; 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=Z97WeNJlMmycR+z4WcgaMcn3WWTu94HVQEJdZml9px0=; b=Ey09YXIdwGCBGYFELWKE4kxVsp7XMeP6yE+AVVosKKJ2eiRVuNzsROYTo9iOEoz6evoGPHKhwuEV7PcutpK8aItgU4cvpqRjedVcGAXvDCJU9jicEvfCCIqJkyeo69vvZwFQe9UOXBzN95CXrt7WDxNqfD0Z4GDG9V22qJAHMDc= 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 1768413095328244.5073523177058; Wed, 14 Jan 2026 09:51:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vg51I-0001ry-Bp; Wed, 14 Jan 2026 12:51:00 -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 1vg51E-0001r8-Br for qemu-devel@nongnu.org; Wed, 14 Jan 2026 12:50:56 -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 1vg51C-000057-1N for qemu-devel@nongnu.org; Wed, 14 Jan 2026 12:50:55 -0500 Received: from mx-prod-mc-03.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-613-8Z-IX3osPFKhDOfCdHM3tQ-1; Wed, 14 Jan 2026 12:50:48 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0FDE41955DC7; Wed, 14 Jan 2026 17:50:47 +0000 (UTC) Received: from osteffen-laptop.redhat.com (unknown [10.45.224.90]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D30B11800665; Wed, 14 Jan 2026 17:50:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1768413052; 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=Z97WeNJlMmycR+z4WcgaMcn3WWTu94HVQEJdZml9px0=; b=eOmxNGnu3D7Ve773XV+rV4NDG65F7KSfHY0O2cDtwWHJzyw3nnLXYSeJ2F/YpS88a/Irx6 sRjRCoyIuEo6K428q2aTKWrcIYo8G0UWXTnDTto4zyHrDwGyBkzfjyuivp4hc4L5Fg/Tz0 /dhlZMv26pMj4k0llDDhX+1xzj3AUKQ= X-MC-Unique: 8Z-IX3osPFKhDOfCdHM3tQ-1 X-Mimecast-MFC-AGG-ID: 8Z-IX3osPFKhDOfCdHM3tQ_1768413047 From: Oliver Steffen To: qemu-devel@nongnu.org Cc: Marcelo Tosatti , Ani Sinha , Zhao Liu , Joerg Roedel , Richard Henderson , kvm@vger.kernel.org, Paolo Bonzini , Eduardo Habkost , Gerd Hoffmann , "Michael S. Tsirkin" , Igor Mammedov , Stefano Garzarella , Marcel Apfelbaum , Luigi Leonardi , Oliver Steffen Subject: [PATCH v4 5/5] igvm: Fill MADT IGVM parameter field Date: Wed, 14 Jan 2026 18:50:07 +0100 Message-ID: <20260114175007.90845-6-osteffen@redhat.com> In-Reply-To: <20260114175007.90845-1-osteffen@redhat.com> References: <20260114175007.90845-1-osteffen@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass (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: 1768413096811158500 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 | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/backends/igvm.c b/backends/igvm.c index cb2f997c87..980068fb58 100644 --- a/backends/igvm.c +++ b/backends/igvm.c @@ -18,6 +18,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 @@ -134,6 +135,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; @@ -162,6 +165,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) @@ -771,6 +776,33 @@ 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); + if (param_entry !=3D NULL) { + + 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 fi= le"); + 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