From nobody Sat Nov 15 12:47:41 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=1751372443; cv=none; d=zohomail.com; s=zohoarc; b=nxPYli9Bf5kbnwMUsrtxU/Y1aPT4NcHrMe5qz7k4j0blPjtj3paZQdgTcf1Co1Z5gjAXyJL4bHRzl1Dfacx/J4sg9Kam+OXabpF7r8dtC8mGZXzNT0Q3NVnUcfBxnrlVi4vaRNfS3GNHlPXvt/JF5J3rA4Z+fG/Fl6hgT6VcKyU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751372443; 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=0QJsVs3Is6GlFkBo5r07F7vLVP+L5LvCuHy0CEmKF3s=; b=KqTUciGN5nTubviKhBNuUvoD4JeLll9vLUW8zRe66DhUnEcfS62EPQndiOv6yGkICe5JOxdpWNVoNbX0P2vXSH6kor9VZ/Ii7SCXz6NGBNGZivU6crc+20rWbGdT3n10T6DE9QdvtxsIC70kdZAK+bg3Uby1bnS8hoxjfkTcRoo= 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 175137244319828.62554341017824; Tue, 1 Jul 2025 05:20:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWZyH-0001je-H3; Tue, 01 Jul 2025 08:20: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 1uWZxq-0001VB-Tg for qemu-devel@nongnu.org; Tue, 01 Jul 2025 08:20: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 1uWZxh-000606-3Y for qemu-devel@nongnu.org; Tue, 01 Jul 2025 08:19:51 -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-589-x_IODVQeNWuV6XbZeVWerg-1; Tue, 01 Jul 2025 08:18:30 -0400 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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 B6AB31944A8C; Tue, 1 Jul 2025 12:18:26 +0000 (UTC) Received: from osteffen-laptop.redhat.com (unknown [10.45.225.251]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DEB3319560AB; Tue, 1 Jul 2025 12:18:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1751372382; 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=0QJsVs3Is6GlFkBo5r07F7vLVP+L5LvCuHy0CEmKF3s=; b=D2htQj5LAOL56L7Pu9yrw+RRq3U84CMLXW29HGlVXyeqd/8XIsBEFS438iu8XifoeSbzaw c+MKDM1CFNbdG02vbBbmUdmVEqtHKn6tfkIkJeeGEBiN99P5mPJ+imDEEaGRK9kWTvMgGG QRuXhOgGsheKjr8dnBn7W6yUOhHS7Ng= X-MC-Unique: x_IODVQeNWuV6XbZeVWerg-1 X-Mimecast-MFC-AGG-ID: x_IODVQeNWuV6XbZeVWerg_1751372307 From: Oliver Steffen To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Joerg Roedel , "Michael S. Tsirkin" , Gerd Hoffmann , Marcel Apfelbaum , Eduardo Habkost , Stefano Garzarella , Richard Henderson , Oliver Steffen Subject: [RFC 1/2] hw/uefi: Add hardware-info ID for virtio mmio devices for SVSM Date: Tue, 1 Jul 2025 14:18:14 +0200 Message-ID: <20250701121815.523896-2-osteffen@redhat.com> In-Reply-To: <20250701121815.523896-1-osteffen@redhat.com> References: <20250701121815.523896-1-osteffen@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=osteffen@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, 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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=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: 1751372444672116600 Content-Type: text/plain; charset="utf-8" Add a hardware-info device ID for virtio mmio devices intended for use by a= n SVSM. The ID has already been reserved in edk2, see edk2 commit f25e3d0d2c55. Signed-off-by: Oliver Steffen Reviewed-by: Stefano Garzarella --- include/hw/uefi/hardware-info.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/hw/uefi/hardware-info.h b/include/hw/uefi/hardware-inf= o.h index 94c38cff20..d688af0e8a 100644 --- a/include/hw/uefi/hardware-info.h +++ b/include/hw/uefi/hardware-info.h @@ -14,6 +14,7 @@ typedef enum { HardwareInfoTypeUndefined =3D 0, HardwareInfoTypeHostBridge =3D 1, HardwareInfoQemuUefiVars =3D 2, + HardwareInfoVirtioMmioSvsm =3D 0x1000, } HARDWARE_INFO_TYPE; =20 typedef struct { --=20 2.50.0 From nobody Sat Nov 15 12:47:41 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=1751372470; cv=none; d=zohomail.com; s=zohoarc; b=NLlrp4TcjmR50GfnPSpA18qh4B39Gf7nhGM5dQU+oMK5/XKopjug7yRoXh+lIFD3hG6AUHXsJKCQQB0xIIJDkpYp/HaTvp/H5hSOXxWqd4CYG9ImXHrLCLvQbs02EHihMECG53oPpHdAUFtrlZ9mw+raoaun+6zxPSb1KmJl3Lk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751372470; 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=nUi9WXLHbqXC4QJiEUarnTHY0dgJlY0JhYQEljuo24c=; b=WCuK6NaATAulQpUExkTTlopzwSvpljzw05BT/cuRrXXEI0zviW8W4jGPCXxvVKhHN++QSlZql4pmG93FJv9s0YMxNr7Jbskl9a8htPPizIoe90pCSdLFhkOcLUwL2MCU5MhqVmPrdlevm6GvsTDvHoXi0tIJANd8xcE+76rsEF4= 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 1751372470562479.8938839258143; Tue, 1 Jul 2025 05:21:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWZyL-0001ot-66; Tue, 01 Jul 2025 08:20:26 -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 1uWZxq-0001VC-Uv for qemu-devel@nongnu.org; Tue, 01 Jul 2025 08:20:03 -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 1uWZxi-00060O-So for qemu-devel@nongnu.org; Tue, 01 Jul 2025 08:19:53 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-21-t8iXtT_gNU2WRvXOwKbrtA-1; Tue, 01 Jul 2025 08:18:33 -0400 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AB5EB19560BE; Tue, 1 Jul 2025 12:18:31 +0000 (UTC) Received: from osteffen-laptop.redhat.com (unknown [10.45.225.251]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6AE9F19560AB; Tue, 1 Jul 2025 12:18:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1751372385; 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=nUi9WXLHbqXC4QJiEUarnTHY0dgJlY0JhYQEljuo24c=; b=U+ZY6/t0xlgrQ1iBIJ/sJxZkFqwFrshCEG6YtXH5hfAkF9JfSVBnWD1ZtWqErBeqsnGeX7 8QTtdCYnhtpfQ+g2rjZGEwXikO51vieV/A8PWrkHGBe3AukI10M/7yWJbrg0ae9vtzbvfJ j1w+j491zw6HnAkrzL3e51ouz6Dq7M4= X-MC-Unique: t8iXtT_gNU2WRvXOwKbrtA-1 X-Mimecast-MFC-AGG-ID: t8iXtT_gNU2WRvXOwKbrtA_1751372312 From: Oliver Steffen To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Joerg Roedel , "Michael S. Tsirkin" , Gerd Hoffmann , Marcel Apfelbaum , Eduardo Habkost , Stefano Garzarella , Richard Henderson , Oliver Steffen Subject: [RFC 2/2] q35: add virtio-mmio slots Date: Tue, 1 Jul 2025 14:18:15 +0200 Message-ID: <20250701121815.523896-3-osteffen@redhat.com> In-Reply-To: <20250701121815.523896-1-osteffen@redhat.com> References: <20250701121815.523896-1-osteffen@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=osteffen@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=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: 1751372471217116600 Content-Type: text/plain; charset="utf-8" From: Gerd Hoffmann Add virtio-mmio slots to the q35 machine model, intended to be used by an SVSM. Disabled by default, enable using '-machine q35,x-svsm-virtio-mmio=3Don'. When enabled it is possible to plug up to 4 virtio devices into the slots virtio-mmio using '-device virtio-${kind}-device'. The devices can be found at base address 0xfef00000, each slot on a separate page. No IRQ is wired up, the SVSM has to drive the devices in polling mode. The base addresses are communicated to the SVSM via the etc/hardware-info fw_cfg file. Signed-off-by: Gerd Hoffmann Signed-off-by: Oliver Steffen --- hw/i386/pc.c | 18 +++++++++++++++++- hw/i386/pc_q35.c | 15 +++++++++++++++ include/hw/i386/pc.h | 1 + 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 432ab288a8..e1dbf8846d 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1584,6 +1584,21 @@ static void pc_machine_set_smbios_ep(Object *obj, Vi= sitor *v, const char *name, visit_type_SmbiosEntryPointType(v, name, &pcms->smbios_entry_point_typ= e, errp); } =20 +static bool pc_machine_get_svsm_virtio_mmio(Object *obj, Error **errp) +{ + PCMachineState *pcms =3D PC_MACHINE(obj); + + return pcms->svsm_virtio_mmio; +} + +static void pc_machine_set_svsm_virtio_mmio(Object *obj, bool value, + Error **errp) +{ + PCMachineState *pcms =3D PC_MACHINE(obj); + + pcms->svsm_virtio_mmio =3D value; +} + static void pc_machine_get_max_ram_below_4g(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) @@ -1844,7 +1859,8 @@ static void pc_machine_class_init(ObjectClass *oc, co= nst void *data) "Set IGVM configuration"); #endif =20 - + object_class_property_add_bool(oc, "x-svsm-virtio-mmio", + pc_machine_get_svsm_virtio_mmio, pc_machine_set_svsm_virtio_mmio); } =20 static const TypeInfo pc_machine_info =3D { diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index cf871cfdad..b8511ae52a 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -60,7 +60,9 @@ #include "hw/mem/nvdimm.h" #include "hw/uefi/var-service-api.h" #include "hw/i386/acpi-build.h" +#include "hw/uefi/hardware-info.h" #include "target/i386/cpu.h" +#include "exec/target_page.h" =20 /* ICH9 AHCI has 6 ports */ #define MAX_SATA_PORTS 6 @@ -335,6 +337,19 @@ static void pc_q35_init(MachineState *machine) } } #endif + + if (pcms->svsm_virtio_mmio) { + for (int dev =3D 0; dev < 4; dev++) { + HARDWARE_INFO_SIMPLE_DEVICE hwinfo =3D { + .mmio_address =3D cpu_to_le64(0xfef00000 + dev * TARGET_PA= GE_SIZE), + }; + sysbus_create_simple("virtio-mmio", hwinfo.mmio_address, + /* no irq */ NULL); + hardware_info_register(HardwareInfoVirtioMmioSvsm, + &hwinfo, sizeof(hwinfo)); + } + } + } =20 #define DEFINE_Q35_MACHINE(major, minor) \ diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 79b72c54dd..9c9f947087 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -51,6 +51,7 @@ typedef struct PCMachineState { bool i8042_enabled; bool default_bus_bypass_iommu; bool fd_bootchk; + bool svsm_virtio_mmio; uint64_t max_fw_size; =20 /* ACPI Memory hotplug IO base address */ --=20 2.50.0