From nobody Mon Feb 9 17:05:14 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