From nobody Fri Nov 14 18:19:01 2025 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=1760527476; cv=none; d=zohomail.com; s=zohoarc; b=ZQQGsye/pvrPQUxvh2mZRU+XXs0v4CvZbG24Uq3osziy9+W748FUITrIxclXOAtJ5fxXc9XXa5bQQuA6Zd8boid+Ltz0A6FicuxRb2GVbxbws9cA6CtCJ6sSoQsC7DIhxyj2ecd/xvagSAVor5hvNEtXc/5EEXEwpMx1EjHXOws= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1760527476; 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=HoLLtDqNGVTdiRisEdK/jURVkbxy+tmYmSz13Vku/6Y=; b=DcBk/zQxDcs139cPjVtbYMEEiahbZrpu0CbyW35oS7ZAklxOrPOmu5PWOC8IBz0upNYk9hZ72K18jWGt+0nQSoAVA+mGEUEL5rytKzLcACK2/ClHM6SPz8fKUUTliSpMSe+HqcFXm+kHvBRkS2Bc2EsqspfmUBZkGmF6r706/J4= 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 1760527476911485.7923972009803; Wed, 15 Oct 2025 04:24:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v8zbq-0008U7-31; Wed, 15 Oct 2025 07:23:58 -0400 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 1v8zbp-0008Ts-4n for qemu-devel@nongnu.org; Wed, 15 Oct 2025 07:23:57 -0400 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 1v8zbj-0003DW-Vd for qemu-devel@nongnu.org; Wed, 15 Oct 2025 07:23:56 -0400 Received: from mx-prod-mc-01.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-75-tt9tt-KrOjKoL65woo537g-1; Wed, 15 Oct 2025 07:23:46 -0400 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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 83100195608F; Wed, 15 Oct 2025 11:23:45 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.44.32.27]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C06AC30001A5; Wed, 15 Oct 2025 11:23:44 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B390A1800998; Wed, 15 Oct 2025 13:23:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1760527429; 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=HoLLtDqNGVTdiRisEdK/jURVkbxy+tmYmSz13Vku/6Y=; b=iH5rIDjA9JjBa0hZVBUHlyJguqwnN60HBlEyMwEIhwSqwGv1qI28gBWg6M6NB45BQdv4zY DldjnOOinaBu4PMI4xj4omsreb81SA2wtKopUVKfs24Bor4AuNRTUP5L4e0bpvTlkG8+JZ sWntkJRImhHsVllnnvWf+bjxuy04Whg= X-MC-Unique: tt9tt-KrOjKoL65woo537g-1 X-Mimecast-MFC-AGG-ID: tt9tt-KrOjKoL65woo537g_1760527425 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Gerd Hoffmann , Roy Hopkins , Stefano Garzarella , Ani Sinha , Zhao Liu Subject: [PATCH v3 1/5] igvm: move igvm.h file to include/system Date: Wed, 15 Oct 2025 13:23:38 +0200 Message-ID: <20251015112342.1672955-2-kraxel@redhat.com> In-Reply-To: <20251015112342.1672955-1-kraxel@redhat.com> References: <20251015112342.1672955-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.129.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: 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: 1760527479996154100 Content-Type: text/plain; charset="utf-8" Prepare for arch-specific igvm code being added to the code base. Signed-off-by: Gerd Hoffmann Reviewed-by: Ani Sinha Reviewed-by: Stefano Garzarella --- {backends =3D> include/system}/igvm.h | 0 backends/igvm-cfg.c | 2 +- backends/igvm.c | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename {backends =3D> include/system}/igvm.h (100%) diff --git a/backends/igvm.h b/include/system/igvm.h similarity index 100% rename from backends/igvm.h rename to include/system/igvm.h diff --git a/backends/igvm-cfg.c b/backends/igvm-cfg.c index 45df63e06c1a..d00acf351249 100644 --- a/backends/igvm-cfg.c +++ b/backends/igvm-cfg.c @@ -12,7 +12,7 @@ #include "qemu/osdep.h" =20 #include "system/igvm-cfg.h" -#include "igvm.h" +#include "system/igvm.h" #include "qom/object_interfaces.h" =20 static char *get_igvm(Object *obj, Error **errp) diff --git a/backends/igvm.c b/backends/igvm.c index 9ad41582ee5e..723d45b755a0 100644 --- a/backends/igvm.c +++ b/backends/igvm.c @@ -11,8 +11,8 @@ =20 #include "qemu/osdep.h" =20 -#include "igvm.h" #include "qapi/error.h" +#include "system/igvm.h" #include "system/memory.h" #include "system/address-spaces.h" #include "hw/core/cpu.h" --=20 2.51.0 From nobody Fri Nov 14 18:19:01 2025 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=1760527512; cv=none; d=zohomail.com; s=zohoarc; b=hvCZrsPeMh9Yopw52u37DsRsBVd6EfU+mgukH85jK412L96ZHUKVzFK/JkKTMV7Q/Z7ZNuvG0ypXDNdMmwMdkf8r+WZROQib/zKV5XsEukpdLF08hB5orzJBN9KCcGoFPwvB6TmU4zWAMJHRPbYscEaF9hgcZ4C9QX0IP6my3vI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1760527512; 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=caWGUGGM/k4ZIcTosCRU7rf8W+938SnhmMAenF+SXSI=; b=hBLHJ90M4Nxj34xXGjcV9Y88CZlPAWMtV+RBr3YIdMBs8kCq0WEdMNxs/1OIDOe4elZcKnRtrW4na65nc8SyBLsuxyyRlN/oEfJgDi2yaY34Zt1UazAikmNf0BRQKAv7xkm9xv0Xwn9xl/5FzoC9O/BjcERDq2YYkVgHcECKPwA= 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 1760527512901215.3618457383575; Wed, 15 Oct 2025 04:25:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v8zby-00005O-KQ; Wed, 15 Oct 2025 07:24:06 -0400 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 1v8zbw-0008VF-VW for qemu-devel@nongnu.org; Wed, 15 Oct 2025 07:24:04 -0400 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 1v8zbm-0003Dl-Mw for qemu-devel@nongnu.org; Wed, 15 Oct 2025 07:24:04 -0400 Received: from mx-prod-mc-05.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-184-FeA9kQQEPwCstWkvEK23dw-1; Wed, 15 Oct 2025 07:23:49 -0400 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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AD60119560A2; Wed, 15 Oct 2025 11:23:48 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.44.32.27]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 91FD41800446; Wed, 15 Oct 2025 11:23:47 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id CF041180099A; Wed, 15 Oct 2025 13:23:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1760527431; 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=caWGUGGM/k4ZIcTosCRU7rf8W+938SnhmMAenF+SXSI=; b=B2PYUozcfixyk6/nxq/8zf4MHPMSi2lldYFoUV9NpitsIZQWq5sORLJEpJVDN/0Z2CT2Ml Tn4nV/d3NI5wllmm+FeTBlnzjN6RSc6pr6gmOh5VWkyvRLBTyAey3aCTFqv0khFibVs2Vo hAR2b1z464t+8UK9dCVv+GVbCDD0fK0= X-MC-Unique: FeA9kQQEPwCstWkvEK23dw-1 X-Mimecast-MFC-AGG-ID: FeA9kQQEPwCstWkvEK23dw_1760527428 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Gerd Hoffmann , Roy Hopkins , Stefano Garzarella , Ani Sinha , Zhao Liu Subject: [PATCH v3 2/5] igvm: add support for igvm memory map parameter in native mode Date: Wed, 15 Oct 2025 13:23:39 +0200 Message-ID: <20251015112342.1672955-3-kraxel@redhat.com> In-Reply-To: <20251015112342.1672955-1-kraxel@redhat.com> References: <20251015112342.1672955-1-kraxel@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 client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=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, T_SPF_TEMPERROR=0.01 autolearn=no 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: 1760527520758158500 Content-Type: text/plain; charset="utf-8" Add and wire up qigvm_x86_get_mem_map_entry function which converts the e820 table into an igvm memory map parameter. This makes igvm files for the native (non-confidential) platform with memory map parameter work. Signed-off-by: Gerd Hoffmann Reviewed-by: Stefano Garzarella --- include/system/igvm.h | 5 +++++ backends/igvm.c | 18 ++++++++++++---- stubs/igvm.c | 21 +++++++++++++++++++ target/i386/igvm.c | 46 +++++++++++++++++++++++++++++++++++++++++ stubs/meson.build | 1 + target/i386/meson.build | 3 +++ 6 files changed, 90 insertions(+), 4 deletions(-) create mode 100644 stubs/igvm.c create mode 100644 target/i386/igvm.c diff --git a/include/system/igvm.h b/include/system/igvm.h index a4abab043a1f..3f72a40b8897 100644 --- a/include/system/igvm.h +++ b/include/system/igvm.h @@ -19,4 +19,9 @@ int qigvm_process_file(IgvmCfg *igvm, ConfidentialGuestSupport *cgs, bool onlyVpContext, Error **errp); =20 +/* x86 native */ +int qigvm_x86_get_mem_map_entry(int index, + ConfidentialGuestMemoryMapEntry *entry, + Error **errp); + #endif diff --git a/backends/igvm.c b/backends/igvm.c index 723d45b755a0..e949c81abb9a 100644 --- a/backends/igvm.c +++ b/backends/igvm.c @@ -12,6 +12,7 @@ #include "qemu/osdep.h" =20 #include "qapi/error.h" +#include "qemu/target-info-qapi.h" #include "system/igvm.h" #include "system/memory.h" #include "system/address-spaces.h" @@ -543,6 +544,8 @@ static int qigvm_directive_memory_map(QIgvm *ctx, const= uint8_t *header_data, Error **errp) { const IGVM_VHS_PARAMETER *param =3D (const IGVM_VHS_PARAMETER *)header= _data; + int (*get_mem_map_entry)(int index, ConfidentialGuestMemoryMapEntry *e= ntry, + Error **errp) =3D NULL; QIgvmParameterData *param_entry; int max_entry_count; int entry =3D 0; @@ -550,7 +553,15 @@ static int qigvm_directive_memory_map(QIgvm *ctx, cons= t uint8_t *header_data, ConfidentialGuestMemoryMapEntry cgmm_entry; int retval =3D 0; =20 - if (!ctx->cgs) { + if (ctx->cgs && ctx->cgsc->get_mem_map_entry) { + get_mem_map_entry =3D ctx->cgsc->get_mem_map_entry; + } + + if (!get_mem_map_entry && target_arch() =3D=3D SYS_EMU_TARGET_X86_64) { + get_mem_map_entry =3D qigvm_x86_get_mem_map_entry; + } + + if (!get_mem_map_entry) { error_setg(errp, "IGVM file contains a memory map but this is not suppor= ted " "by the current system."); @@ -565,7 +576,7 @@ static int qigvm_directive_memory_map(QIgvm *ctx, const= uint8_t *header_data, param_entry->size / sizeof(IGVM_VHS_MEMORY_MAP_ENTRY); mm_entry =3D (IGVM_VHS_MEMORY_MAP_ENTRY *)param_entry->data; =20 - retval =3D ctx->cgsc->get_mem_map_entry(entry, &cgmm_entry, er= rp); + retval =3D get_mem_map_entry(entry, &cgmm_entry, errp); while (retval =3D=3D 0) { if (entry > max_entry_count) { error_setg( @@ -598,8 +609,7 @@ static int qigvm_directive_memory_map(QIgvm *ctx, const= uint8_t *header_data, IGVM_MEMORY_MAP_ENTRY_TYPE_PLATFORM_RESERVED; break; } - retval =3D - ctx->cgsc->get_mem_map_entry(++entry, &cgmm_entry, err= p); + retval =3D get_mem_map_entry(++entry, &cgmm_entry, errp); } if (retval < 0) { return retval; diff --git a/stubs/igvm.c b/stubs/igvm.c new file mode 100644 index 000000000000..c32058eb2a6e --- /dev/null +++ b/stubs/igvm.c @@ -0,0 +1,21 @@ +/* + * QEMU IGVM, stubs + * + * Copyright (C) 2026 Red Hat + * + * Authors: + * Gerd Hoffmann + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" + +#include "system/igvm.h" + +int qigvm_x86_get_mem_map_entry(int index, + ConfidentialGuestMemoryMapEntry *entry, + Error **errp) +{ + return -1; +} diff --git a/target/i386/igvm.c b/target/i386/igvm.c new file mode 100644 index 000000000000..2ed6cd052c79 --- /dev/null +++ b/target/i386/igvm.c @@ -0,0 +1,46 @@ +/* + * QEMU IGVM, support for native x86 guests + * + * Copyright (C) 2026 Red Hat + * + * Authors: + * Gerd Hoffmann + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" + +#include "hw/i386/e820_memory_layout.h" +#include "system/igvm.h" + +/* + * convert e820 table into igvm memory map + */ +int qigvm_x86_get_mem_map_entry(int index, + ConfidentialGuestMemoryMapEntry *entry, + Error **errp) +{ + struct e820_entry *table; + int num_entries; + + num_entries =3D e820_get_table(&table); + if ((index < 0) || (index >=3D num_entries)) { + return 1; + } + entry->gpa =3D table[index].address; + entry->size =3D table[index].length; + switch (table[index].type) { + case E820_RAM: + entry->type =3D CGS_MEM_RAM; + break; + case E820_RESERVED: + entry->type =3D CGS_MEM_RESERVED; + break; + default: + /* should not happen */ + error_setg(errp, "unknown e820 type"); + return -1; + } + return 0; +} diff --git a/stubs/meson.build b/stubs/meson.build index 5d577467bfdd..27be2dec9f9e 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -74,6 +74,7 @@ if have_system stub_ss.add(files('dump.c')) stub_ss.add(files('cmos.c')) stub_ss.add(files('fw_cfg.c')) + stub_ss.add(files('igvm.c')) stub_ss.add(files('target-get-monitor-def.c')) stub_ss.add(files('target-monitor-defs.c')) stub_ss.add(files('win32-kbd-hook.c')) diff --git a/target/i386/meson.build b/target/i386/meson.build index 89ba4912aaeb..d385eafdf7e1 100644 --- a/target/i386/meson.build +++ b/target/i386/meson.build @@ -26,6 +26,9 @@ i386_system_ss.add(files( )) i386_system_ss.add(when: 'CONFIG_SEV', if_true: files('sev.c'), if_false: files('sev-system-stub.c'= )) +if igvm.found() + i386_system_ss.add(files('igvm.c')) +endif =20 i386_user_ss =3D ss.source_set() =20 --=20 2.51.0 From nobody Fri Nov 14 18:19:01 2025 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=1760527506; cv=none; d=zohomail.com; s=zohoarc; b=SQHx7jMUIfTODbsgClfSzq29AJxvHqKnAjIZHTH1Ot8SpGcXITAve5NJizpP0HKAnX1D8M5kd4AFyiJx/lHpV93GngqQBYe5bXr2PzNdLrrWO65Gk8Ava2FxvwuQX10IX6yhizjwWjVWYp3IBLqu+V0hqVeSeVveSYj19fsbdhY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1760527506; 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=bss9VrrkZjAvO7SOaj3Ahs7ZGtj6irMV84p1n8Tp6NE=; b=kv/T1KCBqWPa0zZEtS7VeaKW9Yg8F1jZtkyq/LNF96vFXOviHtV8Akbz4rFHROotMaFhSUgNsSi5GhutkIZaGx3MHc6w9sefOv3EW3jd3FQSDh7aZqp0FBV0IrGF3c4bBky3Hh94+iVFojgFhSRSqPe5mCTPII+fXgckxxtW//k= 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 1760527506443338.8865473666352; Wed, 15 Oct 2025 04:25:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v8zbv-0008Uz-2A; Wed, 15 Oct 2025 07:24:03 -0400 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 1v8zbt-0008Um-KA for qemu-devel@nongnu.org; Wed, 15 Oct 2025 07:24:01 -0400 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 1v8zbl-0003Dn-Sq for qemu-devel@nongnu.org; Wed, 15 Oct 2025 07:24:00 -0400 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-172-nUsEMVVrN9mg0ZSq2Czw4g-1; Wed, 15 Oct 2025 07:23:49 -0400 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 1409D1800D89; Wed, 15 Oct 2025 11:23:48 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.44.32.27]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8FF9330001A1; Wed, 15 Oct 2025 11:23:47 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id EDAC0180099B; Wed, 15 Oct 2025 13:23:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1760527431; 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=bss9VrrkZjAvO7SOaj3Ahs7ZGtj6irMV84p1n8Tp6NE=; b=dAeaUwChB7ZCQFzYtpXjdsKsYK5XTKgR7Oo2WsB3CkazmE1Ci8hyR9FCArgO79eQ/Lfi/p +jxZqscOLEJ2Mz9F5kyWB5F5iU+BH0RaM6sPpOi1Nkrstu9PNc3wn2L6cWIvmBxfSaV4DR D42Y4V2iaUzQRN76qgLtXMDbZm5BAoc= X-MC-Unique: nUsEMVVrN9mg0ZSq2Czw4g-1 X-Mimecast-MFC-AGG-ID: nUsEMVVrN9mg0ZSq2Czw4g_1760527428 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Gerd Hoffmann , Roy Hopkins , Stefano Garzarella , Ani Sinha , Zhao Liu Subject: [PATCH v3 3/5] igvm: add support for initial register state load in native mode Date: Wed, 15 Oct 2025 13:23:40 +0200 Message-ID: <20251015112342.1672955-4-kraxel@redhat.com> In-Reply-To: <20251015112342.1672955-1-kraxel@redhat.com> References: <20251015112342.1672955-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: 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: 1760527516712158500 Content-Type: text/plain; charset="utf-8" Add IgvmNativeVpContextX64 struct holding the register state (see igvm spec), and the qigvm_x86_load_context() function to load the register state. Wire up using two new functions: qigvm_x86_set_vp_context() is called from igvm file handling code and stores the boot processor context. qigvm_x86_bsp_reset() is called from i386 target cpu reset code and loads the context into the cpu registers. Signed-off-by: Gerd Hoffmann Reviewed-by: Stefano Garzarella --- include/system/igvm.h | 2 + target/i386/cpu.h | 3 + backends/igvm.c | 30 +++++----- stubs/igvm.c | 5 ++ target/i386/cpu.c | 4 ++ target/i386/igvm.c | 133 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 162 insertions(+), 15 deletions(-) diff --git a/include/system/igvm.h b/include/system/igvm.h index 3f72a40b8897..48ce20604259 100644 --- a/include/system/igvm.h +++ b/include/system/igvm.h @@ -23,5 +23,7 @@ int qigvm_process_file(IgvmCfg *igvm, ConfidentialGuestSu= pport *cgs, int qigvm_x86_get_mem_map_entry(int index, ConfidentialGuestMemoryMapEntry *entry, Error **errp); +int qigvm_x86_set_vp_context(void *data, int index, + Error **errp); =20 #endif diff --git a/target/i386/cpu.h b/target/i386/cpu.h index ce948861a765..78d4b427c67a 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -2867,6 +2867,9 @@ void x86_cpu_dump_local_apic_state(CPUState *cs, int = flags); =20 #endif =20 +/* igvm.c */ +void qigvm_x86_bsp_reset(CPUX86State *env); + /* cpu.c */ bool cpu_is_bsp(X86CPU *cpu); =20 diff --git a/backends/igvm.c b/backends/igvm.c index e949c81abb9a..ee5ee74c7a66 100644 --- a/backends/igvm.c +++ b/backends/igvm.c @@ -432,18 +432,6 @@ static int qigvm_directive_vp_context(QIgvm *ctx, cons= t uint8_t *header_data, return 0; } =20 - /* - * A confidential guest support object must be provided for setting - * a VP context. - */ - if (!ctx->cgs) { - error_setg( - errp, - "A VP context is present in the IGVM file but is not supported= " - "by the current system."); - return -1; - } - data_handle =3D igvm_get_header_data(ctx->file, IGVM_HEADER_SECTION_DI= RECTIVE, ctx->current_header_index); if (data_handle < 0) { @@ -453,9 +441,21 @@ static int qigvm_directive_vp_context(QIgvm *ctx, cons= t uint8_t *header_data, } =20 data =3D (uint8_t *)igvm_get_buffer(ctx->file, data_handle); - result =3D ctx->cgsc->set_guest_state( - vp_context->gpa, data, igvm_get_buffer_size(ctx->file, data_handle= ), - CGS_PAGE_TYPE_VMSA, vp_context->vp_index, errp); + + if (ctx->cgs) { + result =3D ctx->cgsc->set_guest_state( + vp_context->gpa, data, igvm_get_buffer_size(ctx->file, data_ha= ndle), + CGS_PAGE_TYPE_VMSA, vp_context->vp_index, errp); + } else if (target_arch() =3D=3D SYS_EMU_TARGET_X86_64) { + result =3D qigvm_x86_set_vp_context(data, vp_context->vp_index, er= rp); + } else { + error_setg( + errp, + "A VP context is present in the IGVM file but is not supported= " + "by the current system."); + result =3D -1; + } + igvm_free_buffer(ctx->file, data_handle); if (result < 0) { return result; diff --git a/stubs/igvm.c b/stubs/igvm.c index c32058eb2a6e..17cd1e903e35 100644 --- a/stubs/igvm.c +++ b/stubs/igvm.c @@ -19,3 +19,8 @@ int qigvm_x86_get_mem_map_entry(int index, { return -1; } + +int qigvm_x86_set_vp_context(void *data, int index, Error **errp) +{ + return -1; +} diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 455caff6b230..8dd5ac8020c2 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -8770,6 +8770,10 @@ static void x86_cpu_reset_hold(Object *obj, ResetTyp= e type) =20 cs->halted =3D !cpu_is_bsp(cpu); =20 + if (cpu_is_bsp(cpu)) { + qigvm_x86_bsp_reset(env); + } + if (kvm_enabled()) { kvm_arch_reset_vcpu(cpu); } diff --git a/target/i386/igvm.c b/target/i386/igvm.c index 2ed6cd052c79..0921ec830508 100644 --- a/target/i386/igvm.c +++ b/target/i386/igvm.c @@ -11,9 +11,114 @@ =20 #include "qemu/osdep.h" =20 +#include "cpu.h" #include "hw/i386/e820_memory_layout.h" #include "system/igvm.h" =20 +struct IgvmNativeVpContextX64 { + uint64_t rax; + uint64_t rcx; + uint64_t rdx; + uint64_t rbx; + uint64_t rsp; + uint64_t rbp; + uint64_t rsi; + uint64_t rdi; + uint64_t r8; + uint64_t r9; + uint64_t r10; + uint64_t r11; + uint64_t r12; + uint64_t r13; + uint64_t r14; + uint64_t r15; + uint64_t rip; + uint64_t rflags; + uint64_t idtr_base; + uint16_t idtr_limit; + uint16_t reserved[2]; + uint16_t gdtr_limit; + uint64_t gdtr_base; + + uint16_t code_selector; + uint16_t code_attributes; + uint32_t code_base; + uint32_t code_limit; + + uint16_t data_selector; + uint16_t data_attributes; + uint32_t data_base; + uint32_t data_limit; + + uint64_t gs_base; + uint64_t cr0; + uint64_t cr3; + uint64_t cr4; + uint64_t efer; +}; + +#define FLAGS_TO_SEGCACHE(flags) \ + (((unsigned int)flags) << 8) + +static void qigvm_x86_load_context(struct IgvmNativeVpContextX64 *context,= CPUX86State *env) +{ + cpu_load_efer(env, context->efer); + cpu_x86_update_cr4(env, context->cr4); + cpu_x86_update_cr0(env, context->cr0); + cpu_x86_update_cr3(env, context->cr3); + + cpu_x86_load_seg_cache( + env, R_CS, context->code_selector, + context->code_base, context->code_limit, + FLAGS_TO_SEGCACHE(context->code_attributes)); + cpu_x86_load_seg_cache( + env, R_DS, context->data_selector, + context->data_base, context->data_limit, + FLAGS_TO_SEGCACHE(context->data_attributes)); + cpu_x86_load_seg_cache( + env, R_ES, context->data_selector, + context->data_base, context->data_limit, + FLAGS_TO_SEGCACHE(context->data_attributes)); + cpu_x86_load_seg_cache( + env, R_FS, context->data_selector, + context->data_base, context->data_limit, + FLAGS_TO_SEGCACHE(context->data_attributes)); + cpu_x86_load_seg_cache( + env, R_GS, context->data_selector, + context->data_base, context->data_limit, + FLAGS_TO_SEGCACHE(context->data_attributes)); + cpu_x86_load_seg_cache( + env, R_SS, context->data_selector, + context->data_base, context->data_limit, + FLAGS_TO_SEGCACHE(context->data_attributes)); + + env->gdt.base =3D context->gdtr_base; + env->gdt.limit =3D context->gdtr_limit; + env->idt.base =3D context->idtr_base; + env->idt.limit =3D context->idtr_limit; + + env->regs[R_EAX] =3D context->rax; + env->regs[R_ECX] =3D context->rcx; + env->regs[R_EDX] =3D context->rdx; + env->regs[R_EBX] =3D context->rbx; + env->regs[R_ESP] =3D context->rsp; + env->regs[R_EBP] =3D context->rbp; + env->regs[R_ESI] =3D context->rsi; + env->regs[R_EDI] =3D context->rdi; +#ifdef TARGET_X86_64 + env->regs[R_R8] =3D context->r8; + env->regs[R_R9] =3D context->r9; + env->regs[R_R10] =3D context->r10; + env->regs[R_R11] =3D context->r11; + env->regs[R_R12] =3D context->r12; + env->regs[R_R13] =3D context->r13; + env->regs[R_R14] =3D context->r14; + env->regs[R_R15] =3D context->r15; +#endif + env->eip =3D context->rip; + env->eflags =3D context->rflags; +} + /* * convert e820 table into igvm memory map */ @@ -44,3 +149,31 @@ int qigvm_x86_get_mem_map_entry(int index, } return 0; } + +/* + * set initial cpu context + */ +static struct IgvmNativeVpContextX64 *bsp_context; + +int qigvm_x86_set_vp_context(void *data, int index, Error **errp) +{ + if (index !=3D 0) { + error_setg(errp, "context can be set for BSP only"); + return -1; + } + + if (bsp_context =3D=3D NULL) { + bsp_context =3D g_new0(struct IgvmNativeVpContextX64, 1); + } + memcpy(bsp_context, data, sizeof(struct IgvmNativeVpContextX64)); + return 0; +} + +void qigvm_x86_bsp_reset(CPUX86State *env) +{ + if (bsp_context =3D=3D NULL) { + return; + } + + qigvm_x86_load_context(bsp_context, env); +} --=20 2.51.0 From nobody Fri Nov 14 18:19:01 2025 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=1760527518; cv=none; d=zohomail.com; s=zohoarc; b=EFz+zhtB5orrmeuvWFY+rqV1Fvd5Q9tBsAqajw0Ll78O0Svk10P+kd50li1hs5f38wq6I5EsOgMqlClx1lfFVIpKagXZt69iaZqVUg/WIwVVIdt1DSQe2MiPqNGwHxU/5DMicoU1eWH5uiIJt6Vd5thZ42nJyg+stbGham4OOx8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1760527518; 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=WOTVJE4znw/zNoERVFcl7Z/SeuXdNa7jD4n1nPt3Z/g=; b=XNGdPhXUYAa8+BDtEXJJSCLgpGtNk5c2wP7i+cyjbG9EeozuvW1cRIrid8UfWbpgzmt0SMHRstxd4THJnK3rqFYfUJwKViikkZ0cGm6cAZ5KMaIxzcDDd0zWv2aSzycc7hZ592AHrMDjkjfVlEa59dAnC1PvEIxOYj1HVBtjgrg= 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 1760527518384848.4555058560961; Wed, 15 Oct 2025 04:25:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v8zcI-0000Bn-4i; Wed, 15 Oct 2025 07:24:28 -0400 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 1v8zc4-00009Q-81 for qemu-devel@nongnu.org; Wed, 15 Oct 2025 07:24:12 -0400 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 1v8zbs-0003El-6Y for qemu-devel@nongnu.org; Wed, 15 Oct 2025 07:24:10 -0400 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-342-EJ2oRJ7XNsSqXWV21KNLtg-1; Wed, 15 Oct 2025 07:23:51 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 B32371800BC0; Wed, 15 Oct 2025 11:23:50 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.44.32.27]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 50D9F1955BE3; Wed, 15 Oct 2025 11:23:50 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 08ABB180099C; Wed, 15 Oct 2025 13:23:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1760527436; 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=WOTVJE4znw/zNoERVFcl7Z/SeuXdNa7jD4n1nPt3Z/g=; b=Bx9Dx6OExwDuA93JjoaEwT0Fzq4KN88WuHZvT1cWZYMBkCi9hidwKpcHNbhHCdf8gEaQte ZNp7idyjFcC+v0im2S2uU4CClQCW7zE5KcG8nQulml0qO9pODV/7C5OqC98vETobSpYXYi JRkvEH7Yrc7O77TQ8l2XZUc9Bke6zTc= X-MC-Unique: EJ2oRJ7XNsSqXWV21KNLtg-1 X-Mimecast-MFC-AGG-ID: EJ2oRJ7XNsSqXWV21KNLtg_1760527430 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Gerd Hoffmann , Roy Hopkins , Stefano Garzarella , Ani Sinha , Zhao Liu Subject: [PATCH v3 4/5] igvm: track memory regions created Date: Wed, 15 Oct 2025 13:23:41 +0200 Message-ID: <20251015112342.1672955-5-kraxel@redhat.com> In-Reply-To: <20251015112342.1672955-1-kraxel@redhat.com> References: <20251015112342.1672955-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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: 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: 1760527520696154100 Content-Type: text/plain; charset="utf-8" Keep a linked list of the memory regions created by igvm. Signed-off-by: Gerd Hoffmann Reviewed-by: Ani Sinha --- backends/igvm.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/backends/igvm.c b/backends/igvm.c index ee5ee74c7a66..1690fb334bf5 100644 --- a/backends/igvm.c +++ b/backends/igvm.c @@ -28,6 +28,11 @@ typedef struct QIgvmParameterData { uint32_t index; } QIgvmParameterData; =20 +typedef struct QIgvmMemoryRegion { + QTAILQ_ENTRY(QIgvmMemoryRegion) next; + MemoryRegion mr; +} QIgvmMemoryRegion; + /* * Some directives are specific to particular confidential computing platf= orms. * Define required types for each of those platforms here. @@ -73,6 +78,7 @@ typedef struct QIgvm { uint32_t compatibility_mask; unsigned current_header_index; QTAILQ_HEAD(, QIgvmParameterData) parameter_data; + QTAILQ_HEAD(, QIgvmMemoryRegion) memory_regions; IgvmPlatformType platform_type; =20 /* @@ -185,7 +191,7 @@ static void *qigvm_prepare_memory(QIgvm *ctx, uint64_t = addr, uint64_t size, int region_identifier, Error **errp) { ERRP_GUARD(); - MemoryRegion *igvm_pages =3D NULL; + QIgvmMemoryRegion *pages =3D NULL; Int128 gpa_region_size; MemoryRegionSection mrs =3D memory_region_find(get_system_memory(), addr, size); @@ -219,20 +225,21 @@ static void *qigvm_prepare_memory(QIgvm *ctx, uint64_= t addr, uint64_t size, */ g_autofree char *region_name =3D g_strdup_printf("igvm.%X", region_identifier); - igvm_pages =3D g_new0(MemoryRegion, 1); + pages =3D g_new0(QIgvmMemoryRegion, 1); if (ctx->cgs && ctx->cgs->require_guest_memfd) { - if (!memory_region_init_ram_guest_memfd(igvm_pages, NULL, + if (!memory_region_init_ram_guest_memfd(&pages->mr, NULL, region_name, size, err= p)) { return NULL; } } else { - if (!memory_region_init_ram(igvm_pages, NULL, region_name, siz= e, + if (!memory_region_init_ram(&pages->mr, NULL, region_name, siz= e, errp)) { return NULL; } } - memory_region_add_subregion(get_system_memory(), addr, igvm_pages); - return memory_region_get_ram_ptr(igvm_pages); + memory_region_add_subregion(get_system_memory(), addr, &pages->mr); + QTAILQ_INSERT_TAIL(&ctx->memory_regions, pages, next); + return memory_region_get_ram_ptr(&pages->mr); } } =20 @@ -928,6 +935,7 @@ int qigvm_process_file(IgvmCfg *cfg, ConfidentialGuestS= upport *cgs, } =20 QTAILQ_INIT(&ctx.parameter_data); + QTAILQ_INIT(&ctx.memory_regions); =20 for (ctx.current_header_index =3D 0; ctx.current_header_index < (unsigned)header_count; --=20 2.51.0 From nobody Fri Nov 14 18:19:01 2025 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=1760527515; cv=none; d=zohomail.com; s=zohoarc; b=QSDcPZ92t00AVt77aXxvOJKQVnu01PrOh1xGqVoFhHCTgUp3zokh9Kwz71CROusZ5X01ZaRgBn7G9aIyaUeAqDiTE4saUYbdA4LrMdJ3RgdU1DlCE6Btsc9d4T2tRuugRwquDDiTAq0xf+uNr0W4183G4pR3SK+pisMj3L94/Sw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1760527515; 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=WHuyFH0qz8zatLiaBKM8zR/Didj7BSq8AfNawrUP1nE=; b=LqBBipZZr4npwEoWNFLL9bt+4XeJhJMXoAAny3ny2HJmEOS015IgODmww8gPgMKO/I8AO00BYacYRyIKG77eem54drR0qIwL1QULcps6xKfv4fPMjzDH5c+3d8DCECWcrQsQg5tu7XOlzEM/lcAotFOuEGuTCLQ1foddLSnlSCY= 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 17605275156430.49094492679773793; Wed, 15 Oct 2025 04:25:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v8zc0-000088-S3; Wed, 15 Oct 2025 07:24:08 -0400 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 1v8zby-0008VJ-K3 for qemu-devel@nongnu.org; Wed, 15 Oct 2025 07:24:06 -0400 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 1v8zbr-0003EV-Bh for qemu-devel@nongnu.org; Wed, 15 Oct 2025 07:24:04 -0400 Received: from mx-prod-mc-05.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-122-fJO_jkaANH2VcNRd9K-xCw-1; Wed, 15 Oct 2025 07:23:52 -0400 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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1A14C19560A7; Wed, 15 Oct 2025 11:23:51 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.44.32.27]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CE97518003FC; Wed, 15 Oct 2025 11:23:50 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 172A418009A0; Wed, 15 Oct 2025 13:23:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1760527435; 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=WHuyFH0qz8zatLiaBKM8zR/Didj7BSq8AfNawrUP1nE=; b=Cfb7VygcMr/cUJokNh2S7OGGWB4qtT1w66WfbrLt/oC/UwXgY+U9TcwbisrRZf2yTIPYc4 pFlBpu95/Pej0vlAlsypE7Z21ZcSt5WB4cgxK/y1RvoJkALaQ1QFMStpDk+jbIFsNo1qp/ nHtvVfLwdW8xxJTfhcops5rbpBB4iUU= X-MC-Unique: fJO_jkaANH2VcNRd9K-xCw-1 X-Mimecast-MFC-AGG-ID: fJO_jkaANH2VcNRd9K-xCw_1760527431 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Gerd Hoffmann , Roy Hopkins , Stefano Garzarella , Ani Sinha , Zhao Liu Subject: [PATCH v3 5/5] igvm: add MAINTAINERS entry Date: Wed, 15 Oct 2025 13:23:42 +0200 Message-ID: <20251015112342.1672955-6-kraxel@redhat.com> In-Reply-To: <20251015112342.1672955-1-kraxel@redhat.com> References: <20251015112342.1672955-1-kraxel@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 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: 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: 1760527528742158500 Content-Type: text/plain; charset="utf-8" Add Roy (being the original author) as maintainer. Add myself as reviewer. Status to be decided. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 84cfd85e1fa1..3ebcbcdfdb04 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3893,6 +3893,15 @@ F: roms/edk2-* F: tests/data/uefi-boot-images/ F: tests/uefi-test-tools/ =20 +IGVM Firmware +M: Roy Hopkins +R: Gerd Hoffmann +S: TBD +F: backends/igvm*.c +F: include/system/igvm*.h +F: stubs/igvm.c +F: target/i386/igvm.c + VT-d Emulation M: Michael S. Tsirkin R: Jason Wang --=20 2.51.0