From nobody Fri Nov 14 19:39:56 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=1761735417; cv=none; d=zohomail.com; s=zohoarc; b=Q31o9gcPANbtxVb0eMK1Be4DWPP/7Tz3umVkA428jhW8PSQ3oaZV/44rEohayAbGhzMbj7c/W9imPeQFcnQCP5DcGbogx4gYzIYuMs7yP8LJgqLgDzY7pleB2Dmxe0CsWwVKhE2u5VJg/Ypc/yPyL2MfqE4DZoMvmgVNr1HUiV4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761735417; 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=/TxElgF6Bz+9wv3iJtL4TO5Zl1TWgjoKOS/XojBZxqQ=; b=CjBbgtSx6yWGtMFO1I7TKL9IPQzY92cDjjhIRb8TodSpJ1jAxuTeTXA13XE0HGEyTknJxVMCWToVgOPTY/FRISiMykulk8tL0PcGoCOiY788G6qhLf+Kmdbifv8tsJO/QXBNTtpMQAXfTXJJDLAjfQ/lvirqXn8JSuUK/f4+MP0= 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 1761735417822594.2304843337348; Wed, 29 Oct 2025 03:56:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vE3qo-00030k-Nm; Wed, 29 Oct 2025 06:56:22 -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 1vE3ql-0002wl-O4 for qemu-devel@nongnu.org; Wed, 29 Oct 2025 06:56:20 -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 1vE3qe-0002TY-3e for qemu-devel@nongnu.org; Wed, 29 Oct 2025 06:56:19 -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-644-qD3gO1G1O6ONdXGD2OxpjQ-1; Wed, 29 Oct 2025 06:56:00 -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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7ED52196F756; Wed, 29 Oct 2025 10:55:59 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.44.33.5]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6C6F81800353; Wed, 29 Oct 2025 10:55:58 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id EEADF1800395; Wed, 29 Oct 2025 11:55:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761735362; 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=/TxElgF6Bz+9wv3iJtL4TO5Zl1TWgjoKOS/XojBZxqQ=; b=EpLsKncbEgP5+Dv9r5/oDTG1kwpb2ddnlO32y7eSMqP3FSx9l6qtmyBD4u8+sT7JQKW/Ad 3uSaw9dC3LaXkIKZBqNsm9+VzfsyKGodHm2P+Trk6saaztV5yIrIgoaI923KagZG+grE2Y r0owgghz9s49uDsPTB94o+fF8YvXL8U= X-MC-Unique: qD3gO1G1O6ONdXGD2OxpjQ-1 X-Mimecast-MFC-AGG-ID: qD3gO1G1O6ONdXGD2OxpjQ_1761735359 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Stefano Garzarella , Paolo Bonzini , Roy Hopkins , Ani Sinha , Luigi Leonardi , Gerd Hoffmann , Zhao Liu Subject: [PATCH v5 1/5] igvm: move igvm.h file to include/system Date: Wed, 29 Oct 2025 11:55:51 +0100 Message-ID: <20251029105555.2492276-2-kraxel@redhat.com> In-Reply-To: <20251029105555.2492276-1-kraxel@redhat.com> References: <20251029105555.2492276-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1761735424574158500 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 Reviewed-by: Luigi Leonardi --- {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 19:39:56 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=1761735456; cv=none; d=zohomail.com; s=zohoarc; b=lKgfATauihhWZo9w+U7K/tF30Tb/UQRFIp2Ps0M6mnuOFP3wWajZLkNrdzueL1/obzjFdN3plu1wVrhb0PbBlaEkT3oOdn+/2adgyxE5NdoCztHcvEIsqwMtRkFrwe0TWGvmzsUxBNdiV1uxRrPD7tf10WR++uKOkcyQBk5LcSE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761735456; 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=5hFjG2lmjB3VOUfWO2ci+B2pfILkJypf8Xr0QR8dkxg=; b=EdwEstk1u9H/qJQsmmye23kiPpvMizek0/+5XUJp1LoW+JtsOr7sqjKnwEOvZwMSAe1gegS/AYXrtLCwaXE/iBlBbP/si0/ReHZPSmaJv5h3GDEr6Ni4VHpSDh9Y1PkTvU49yurZ1x5mAz60DRUCMowumVGFnjjq0qB4c3iv04Q= 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 1761735456761922.8779169525964; Wed, 29 Oct 2025 03:57:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vE3ql-0002v2-0O; Wed, 29 Oct 2025 06:56:19 -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 1vE3qj-0002td-20 for qemu-devel@nongnu.org; Wed, 29 Oct 2025 06:56:17 -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 1vE3qd-0002Ut-MH for qemu-devel@nongnu.org; Wed, 29 Oct 2025 06:56:16 -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-195-3oj2bZ8UNGijOYgR5eX4kQ-1; Wed, 29 Oct 2025 06:56:03 -0400 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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4DF4C19560B3; Wed, 29 Oct 2025 10:56:02 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.44.33.5]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CA4CD1800579; Wed, 29 Oct 2025 10:56:01 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 09B46180060A; Wed, 29 Oct 2025 11:55:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761735366; 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=5hFjG2lmjB3VOUfWO2ci+B2pfILkJypf8Xr0QR8dkxg=; b=HbaK4jiTp3lFOv8FmNjbn6/GU9N3hknlHV/UIFg0mg67FoyNRRrPNOYpTjsXDzPPDVt2lH PesVDTUHO/Byc6Aqa1f+eHS7y+3lflRAUiZnAB41UsZTq/GAGMN5qpdN7WOJpxa1qXxW4R A8tMMY2TFU6I+hTRRgMpBWegVIHnYIs= X-MC-Unique: 3oj2bZ8UNGijOYgR5eX4kQ-1 X-Mimecast-MFC-AGG-ID: 3oj2bZ8UNGijOYgR5eX4kQ_1761735362 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Stefano Garzarella , Paolo Bonzini , Roy Hopkins , Ani Sinha , Luigi Leonardi , Gerd Hoffmann , Zhao Liu Subject: [PATCH v5 2/5] igvm: fix off by one bug in memmap entry count checking Date: Wed, 29 Oct 2025 11:55:52 +0100 Message-ID: <20251029105555.2492276-3-kraxel@redhat.com> In-Reply-To: <20251029105555.2492276-1-kraxel@redhat.com> References: <20251029105555.2492276-1-kraxel@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=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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1761735458649154100 Content-Type: text/plain; charset="utf-8" Fixes: c1d466d267 ("backends/igvm: Add IGVM loader and configuration") Signed-off-by: Gerd Hoffmann Reviewed-by: Luigi Leonardi Reviewed-by: Stefano Garzarella --- backends/igvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backends/igvm.c b/backends/igvm.c index 723d45b755a0..055bbba745ad 100644 --- a/backends/igvm.c +++ b/backends/igvm.c @@ -567,7 +567,7 @@ static int qigvm_directive_memory_map(QIgvm *ctx, const= uint8_t *header_data, =20 retval =3D ctx->cgsc->get_mem_map_entry(entry, &cgmm_entry, er= rp); while (retval =3D=3D 0) { - if (entry > max_entry_count) { + if (entry >=3D max_entry_count) { error_setg( errp, "IGVM: guest memory map size exceeds parameter are= a defined in IGVM file"); --=20 2.51.0 From nobody Fri Nov 14 19:39:56 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=1761735491; cv=none; d=zohomail.com; s=zohoarc; b=V9xHIBztRdqbgyq8Ss8sbUK/zMyKI4YTFND+ie20thACMRbepXHKIIHAxfjaUhBlVeqPxkLpLiSAVgRVboKAhKeMe/6eGqWXhypqWHnOkTP8zjrJVl5WFvYnwytT5yQdGvAboeRPR6uIYS13YKwIdSWGCEgaQ/dl63ielroqZMk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761735491; 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=rd9BqaVNmaYUJB1T/ZPBr2Dd5G+ObJpGJIa0WPFeMmQ=; b=jB6S0tEFQa/52bqPrhdbsVQoCU9soPJytOOvyjcDxqS4MgGtJAfhPdkJvqN63T9K59kHml172otpQJ5H7707jRTSbaBxI6OFKHWtXed+svw2RiFocti/yfoppcLs2fUQ5ihELyDvsZXj1YcSTpNeXYpxq1oMZFrMm9jI4Xvp8SM= 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 1761735491536526.3458562001936; Wed, 29 Oct 2025 03:58:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vE3qp-000332-Qd; Wed, 29 Oct 2025 06:56:23 -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 1vE3qn-0002zi-N4 for qemu-devel@nongnu.org; Wed, 29 Oct 2025 06:56:21 -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 1vE3qe-0002Ul-Cl for qemu-devel@nongnu.org; Wed, 29 Oct 2025 06:56:21 -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-221-9Dekksy7O9eR-15wVSP8tg-1; Wed, 29 Oct 2025 06:56:04 -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 115F31800C36; Wed, 29 Oct 2025 10:56:03 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.44.33.5]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0436A1953988; Wed, 29 Oct 2025 10:56:01 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 24FA6180061C; Wed, 29 Oct 2025 11:55:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761735366; 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=rd9BqaVNmaYUJB1T/ZPBr2Dd5G+ObJpGJIa0WPFeMmQ=; b=PQV4Pth6ps+qlEZevFsYNW3yk8KZ5k8EHikkEi9wvAVNNO+lpbH92qERRFGKnpHu5Jledm bW8508VZhOSoX1bsCuWN5sGn/0fcG+WBCKuxz2dUqd+8qzAlBz5200pqpCiQgeHjOZxYiI JmhE+uUIBmjke978k8Bwz+ge9Xyr2eE= X-MC-Unique: 9Dekksy7O9eR-15wVSP8tg-1 X-Mimecast-MFC-AGG-ID: 9Dekksy7O9eR-15wVSP8tg_1761735363 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Stefano Garzarella , Paolo Bonzini , Roy Hopkins , Ani Sinha , Luigi Leonardi , Gerd Hoffmann , Zhao Liu Subject: [PATCH v5 3/5] igvm: add support for igvm memory map parameter in native mode Date: Wed, 29 Oct 2025 11:55:53 +0100 Message-ID: <20251029105555.2492276-4-kraxel@redhat.com> In-Reply-To: <20251029105555.2492276-1-kraxel@redhat.com> References: <20251029105555.2492276-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.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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1761735492999154100 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 Reviewed-by: Luigi Leonardi --- include/system/igvm.h | 5 +++++ backends/igvm.c | 16 ++++++++++---- stubs/igvm.c | 21 +++++++++++++++++++ target/i386/igvm.c | 46 +++++++++++++++++++++++++++++++++++++++++ stubs/meson.build | 1 + target/i386/meson.build | 3 +++ 6 files changed, 88 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 055bbba745ad..2ab7a9d96565 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,13 @@ 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; + + } else if (target_arch() =3D=3D SYS_EMU_TARGET_X86_64) { + get_mem_map_entry =3D qigvm_x86_get_mem_map_entry; + + } else { error_setg(errp, "IGVM file contains a memory map but this is not suppor= ted " "by the current system."); @@ -565,7 +574,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 >=3D max_entry_count) { error_setg( @@ -598,8 +607,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 19:39:56 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=1761735427; cv=none; d=zohomail.com; s=zohoarc; b=gONOPi2IFdvfKHaYqWbE/jkrLXuh2k3x8OAtNZMyOmuSla3GKGl36VVFhBBIfkvjMElyD7ixYqWcOA++e1x6aHexAt+Ik7gWfH/6aJLWLWfPILKK3I1xSrHXr8JM5qaG9mVLHJBVZLYTtRnG/lJYfyQVG7cVnH9pSO8hDExsMvU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761735427; 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=jhz0C4+KTXqWgx5lnV9YDaVPSwBsbpG92YpzQsph+XQ=; b=cpPLprhtSgGM9GGDpBRQb2SsEAI4QYeXZaPpyEy1h5tJ667XekGpOXAmk/dRIuzVzdSZ2bUbiAyzaFCTvLH3GrY6h8kSF1DhrlMwxZMoe4Y+a8D3CJen3LtcDGxF8ChA2RNoiK9T47p3ygYuzGwzptk2oJZdYfJPgO+HDtt79dI= 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 1761735427578972.5424813638333; Wed, 29 Oct 2025 03:57:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vE3qt-00036r-Cj; Wed, 29 Oct 2025 06:56:27 -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 1vE3qp-00032v-L7 for qemu-devel@nongnu.org; Wed, 29 Oct 2025 06:56:23 -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 1vE3qh-0002VK-0J for qemu-devel@nongnu.org; Wed, 29 Oct 2025 06:56:23 -0400 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-332-0ToX3glaNjmp-5axfLboKA-1; Wed, 29 Oct 2025 06:56:07 -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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D12501809A0E; Wed, 29 Oct 2025 10:56:05 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.44.33.5]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B32B530001A2; Wed, 29 Oct 2025 10:56:04 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 40E4C180061F; Wed, 29 Oct 2025 11:55:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761735369; 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=jhz0C4+KTXqWgx5lnV9YDaVPSwBsbpG92YpzQsph+XQ=; b=CQL1xNJ+zb4kHMAziXiClMMV7hC2mMsDRT2jiK0HlmSjZyAh9xVf2iGcESiA0bx3fyrxd7 dFevp7wY567DNINSzx9QnKlHTnvKmsr69FUfAWEKYv0+c3G52tYMlWIduwVROpIRl5K8MT rzk2PrlZmy4KqIDxQzasUkvDI0xtyqA= X-MC-Unique: 0ToX3glaNjmp-5axfLboKA-1 X-Mimecast-MFC-AGG-ID: 0ToX3glaNjmp-5axfLboKA_1761735366 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Stefano Garzarella , Paolo Bonzini , Roy Hopkins , Ani Sinha , Luigi Leonardi , Gerd Hoffmann , Zhao Liu Subject: [PATCH v5 4/5] igvm: add support for initial register state load in native mode Date: Wed, 29 Oct 2025 11:55:54 +0100 Message-ID: <20251029105555.2492276-5-kraxel@redhat.com> In-Reply-To: <20251029105555.2492276-1-kraxel@redhat.com> References: <20251029105555.2492276-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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1761735430572154100 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 Reviewed-by: Luigi Leonardi --- include/system/igvm.h | 2 + target/i386/cpu.h | 3 + backends/igvm.c | 30 +++++----- stubs/igvm.c | 5 ++ target/i386/cpu.c | 6 ++ target/i386/igvm.c | 134 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 165 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 d0da9bfe58ce..cee1f692a1c3 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -2868,6 +2868,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 2ab7a9d96565..905bd8d98994 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 0a66e1fec939..641777578637 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -8770,6 +8770,12 @@ static void x86_cpu_reset_hold(Object *obj, ResetTyp= e type) =20 cs->halted =3D !cpu_is_bsp(cpu); =20 +#if defined(CONFIG_IGVM) + if (cpu_is_bsp(cpu)) { + qigvm_x86_bsp_reset(env); + } +#endif + if (kvm_enabled()) { kvm_arch_reset_vcpu(cpu); } diff --git a/target/i386/igvm.c b/target/i386/igvm.c index 2ed6cd052c79..457c253b030c 100644 --- a/target/i386/igvm.c +++ b/target/i386/igvm.c @@ -11,9 +11,115 @@ =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 +150,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 19:39:56 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=1761735451; cv=none; d=zohomail.com; s=zohoarc; b=YLk5nkkKclA867iXIFK/5y977tVEA5QxaKUb/KolnFt2PMrkd7oP6hIeCb6eNhz40nobnpSGfTmHDQLGny8Eq8wVXB1PPQD33P56B0otGTtY+UsgR2uuv0l9rIJxnMM3BWc7buzhjUDIHHJCpXJIK8S3D34Or13JCW8oANj7w+Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761735451; 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=N4HpBLnIFnyqEMve4ySpI/nopXb9neD6A5U9T9PtZD4=; b=WViYuWC3eDY/8OtMYiwAWV14HJ+p9pYVPhWV4L2bQIfD3JxqeZ649SCjchIdsDuJQa3LfzuMPjXBT0758/gnsc1qT5aSniKpCEv4uID/Gk9mTDZYbfMl2WiCtFwGzisteiuFuD/ZK1ySssVodNr+B0IoGw0KIiOluPAIQZbnGlM= 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 1761735451616924.7019874607837; Wed, 29 Oct 2025 03:57:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vE3qp-00033B-QK; Wed, 29 Oct 2025 06:56:23 -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 1vE3ql-0002wk-O9 for qemu-devel@nongnu.org; Wed, 29 Oct 2025 06:56:20 -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 1vE3qg-0002V9-VN for qemu-devel@nongnu.org; Wed, 29 Oct 2025 06:56:19 -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-277-wb7nSKMwPbaKo5RXFD8PBw-1; Wed, 29 Oct 2025 06:56:07 -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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C4E8E196F753; Wed, 29 Oct 2025 10:56:05 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.44.33.5]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 54DCB1955F1B; Wed, 29 Oct 2025 10:56:05 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 4EF961800622; Wed, 29 Oct 2025 11:55:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761735368; 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=N4HpBLnIFnyqEMve4ySpI/nopXb9neD6A5U9T9PtZD4=; b=DYh407RaUSFCDzkyqp7eXuwJZvVQWnN0ju8z6JplUS340g5dPOHSd6Y1E8s3af98kJHQC8 r2EDomXKvL6xUdpoUzsZu3oLCgXlNYx1ZPgcrsQeZbavO3i4x7D5X2NgKnLGqbpbLjR3iL uiKvL8Y0M+sqAPkaC6rRNGMoYenLdMc= X-MC-Unique: wb7nSKMwPbaKo5RXFD8PBw-1 X-Mimecast-MFC-AGG-ID: wb7nSKMwPbaKo5RXFD8PBw_1761735366 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Stefano Garzarella , Paolo Bonzini , Roy Hopkins , Ani Sinha , Luigi Leonardi , Gerd Hoffmann , Zhao Liu Subject: [PATCH v5 5/5] igvm: add MAINTAINERS entry Date: Wed, 29 Oct 2025 11:55:55 +0100 Message-ID: <20251029105555.2492276-6-kraxel@redhat.com> In-Reply-To: <20251029105555.2492276-1-kraxel@redhat.com> References: <20251029105555.2492276-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.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_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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: 1761735454704154100 Content-Type: text/plain; charset="utf-8" Roy Hopkins (the original author) does not respond, so the new plan going forward is that I will maintain this together with Stefano. Also add Ani as reviewer. Signed-off-by: Gerd Hoffmann Reviewed-by: Stefano Garzarella --- MAINTAINERS | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 64491c800c2c..a79eb495d047 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3906,6 +3906,16 @@ F: roms/edk2-* F: tests/data/uefi-boot-images/ F: tests/uefi-test-tools/ =20 +IGVM Firmware +M: Gerd Hoffmann +M: Stefano Garzarella +R: Ani Sinha +S: Maintained +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