All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luigi Leonardi <leonardi@redhat.com>
To: Oliver Steffen <osteffen@redhat.com>
Cc: qemu-devel@nongnu.org,
	 Richard Henderson <richard.henderson@linaro.org>,
	Igor Mammedov <imammedo@redhat.com>,
	 Paolo Bonzini <pbonzini@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	 Ani Sinha <anisinha@redhat.com>,
	Stefano Garzarella <sgarzare@redhat.com>,
	 Zhao Liu <zhao1.liu@intel.com>,
	Joerg Roedel <joerg.roedel@amd.com>,
	 Gerd Hoffmann <kraxel@redhat.com>,
	kvm@vger.kernel.org, Eduardo Habkost <eduardo@habkost.net>,
	 "Michael S. Tsirkin" <mst@redhat.com>,
	Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Subject: Re: [PATCH v3 6/6] igvm: Fill MADT IGVM parameter field
Date: Mon, 12 Jan 2026 10:57:08 +0100	[thread overview]
Message-ID: <aWTFR-sYjRIdDbId@leonardi-redhat> (raw)
In-Reply-To: <20260109143413.293593-7-osteffen@redhat.com>

On Fri, Jan 09, 2026 at 03:34:13PM +0100, Oliver Steffen wrote:
>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 <osteffen@redhat.com>
>
>SQUASH: Rename madt parameter handler

Development leftover?

>---
> 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"

is this needed?

> #include "system/memory.h"
> #include "system/address-spaces.h"
> #include "hw/core/cpu.h"
>+#include "hw/i386/acpi-build.h"
>
> #include "trace.h"
>
>@@ -134,6 +136,8 @@ static int qigvm_directive_snp_id_block(QIgvm *ctx, const 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);
>
> struct QIGVMHandler {
>     uint32_t type;
>@@ -162,6 +166,8 @@ static struct QIGVMHandler handlers[] = {
>       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 },
> };
>
> static int qigvm_handler(QIgvm *ctx, uint32_t type, Error **errp)
>@@ -780,6 +786,35 @@ static int qigvm_initialization_guest_policy(QIgvm *ctx,
>     return 0;
> }
>
>+static int qigvm_directive_madt(QIgvm *ctx,
>+                                     const uint8_t *header_data, Error **errp)
>+{
>+    const IGVM_VHS_PARAMETER *param = (const IGVM_VHS_PARAMETER *)header_data;
>+    QIgvmParameterData *param_entry;
>+
>+    if (ctx->machine_state == NULL) {
>+        return 0;
>+    }
>+
>+    /* Find the parameter area that should hold the MADT data */
>+    param_entry = qigvm_find_param_entry(ctx, param);
>+    if (param_entry != NULL) {
>+
>+        GArray *madt = 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 file");
>+            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;
>--
>2.52.0
>

Rest LGTM!

Luigi


  reply	other threads:[~2026-01-12  9:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-09 14:34 [PATCH v3 0/6] igvm: Supply MADT via IGVM parameter Oliver Steffen
2026-01-09 14:34 ` [PATCH v3 1/6] hw/acpi: Make BIOS linker optional Oliver Steffen
2026-01-12  9:47   ` Gerd Hoffmann
2026-01-09 14:34 ` [PATCH v3 2/6] hw/acpi: Add standalone function to build MADT Oliver Steffen
2026-01-09 14:34 ` [PATCH v3 3/6] igvm: Add missing NULL check Oliver Steffen
2026-01-09 17:37   ` Luigi Leonardi
2026-01-12  9:41     ` Gerd Hoffmann
2026-01-12  9:49       ` Luigi Leonardi
2026-01-12  9:57         ` Gerd Hoffmann
2026-01-13  9:36           ` Oliver Steffen
2026-01-13  7:21   ` Ani Sinha
2026-01-13  9:04     ` Oliver Steffen
2026-01-09 14:34 ` [PATCH v3 4/6] igvm: Add common function for finding parameter entries Oliver Steffen
2026-01-12  9:43   ` Gerd Hoffmann
2026-01-09 14:34 ` [PATCH v3 5/6] igvm: Pass machine state to IGVM file processing Oliver Steffen
2026-01-12  9:09   ` Luigi Leonardi
2026-01-09 14:34 ` [PATCH v3 6/6] igvm: Fill MADT IGVM parameter field Oliver Steffen
2026-01-12  9:57   ` Luigi Leonardi [this message]
2026-01-12 12:34 ` [PATCH v3 0/6] igvm: Supply MADT via IGVM parameter Igor Mammedov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aWTFR-sYjRIdDbId@leonardi-redhat \
    --to=leonardi@redhat.com \
    --cc=anisinha@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=imammedo@redhat.com \
    --cc=joerg.roedel@amd.com \
    --cc=kraxel@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=osteffen@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=sgarzare@redhat.com \
    --cc=zhao1.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.