From nobody Fri Apr 3 22:35:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1774274354; cv=none; d=zohomail.com; s=zohoarc; b=Mce380mBuIDlb5FQCBjuhFOOTNPE3B2bwxJJ+aW+bvtodUbf122WDcDzmXWYI3vnCceraDG70/njfKyDOgKgSg4KLYGc9ybjFhNZpjPIk7jRcIdGCGJZFgrD0wtQ/UlET58wrlM+DcZ9Heb07WvVEhmfNd6q+mRg1dhanZFvPXI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774274354; 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=Q99VB31zJMe+kwy7P7q526bcuOKPTBKL3PaUmcduhVg=; b=TEshM6XnrFqXB+dnLEoiW6gOwQWHwVbyJfKWf2VThNghvn+cTlSQtZWSwqWla8mql0wIeMO4KZO/yHv5ZRmhuwATaDKN3egetRMUwXMtkHMchL69KeZTLGEgwR5ghZ1CHGJ7Ibdlun6qFc8wXP1YuhIyoLdsbhHAXNVeW9tuuHE= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1774274354772140.99525921824193; Mon, 23 Mar 2026 06:59:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w4fnw-0008DE-7W; Mon, 23 Mar 2026 09:58:52 -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 1w4fnr-000885-7S for qemu-devel@nongnu.org; Mon, 23 Mar 2026 09:58:48 -0400 Received: from linux.microsoft.com ([13.77.154.182]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w4fnp-0006nf-OV for qemu-devel@nongnu.org; Mon, 23 Mar 2026 09:58:47 -0400 Received: from DESKTOP-TUU1E5L.localdomain (unknown [167.220.208.76]) by linux.microsoft.com (Postfix) with ESMTPSA id 108DA20B7138; Mon, 23 Mar 2026 06:58:41 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 108DA20B7138 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1774274324; bh=Q99VB31zJMe+kwy7P7q526bcuOKPTBKL3PaUmcduhVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UMugpAwPlir5DpKO9i8Us7blVSXe4E05zoCjdDxYfujRpzKhOP+wMH9RrbRjxoRfl +/sLmlCFC+M7Yscfn0ou5YM1nneprBNHqAFcP41oByX5dsdslcXwPesGVg76Cr/z25 KCR+5wXkiJV8WnAvEwOMM23oRtTMJ4oHDKwxeRG0= From: Magnus Kulke To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, Wei Liu , Richard Henderson , Marcelo Tosatti , Marcel Apfelbaum , Wei Liu , Alex Williamson , Paolo Bonzini , Zhao Liu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Magnus Kulke , Magnus Kulke , "Michael S. Tsirkin" Subject: [RFC 07/32] accel/mshv: add irq_routes to state Date: Mon, 23 Mar 2026 14:57:47 +0100 Message-Id: <20260323135812.383509-8-magnuskulke@linux.microsoft.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260323135812.383509-1-magnuskulke@linux.microsoft.com> References: <20260323135812.383509-1-magnuskulke@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=13.77.154.182; envelope-from=magnuskulke@linux.microsoft.com; helo=linux.microsoft.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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: qemu development 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 @linux.microsoft.com) X-ZM-MESSAGEID: 1774274355755158500 Content-Type: text/plain; charset="utf-8" This change adds fields related to irq routing to the MSHV state, following similar fields in the KVM implementation. So far the fields are only initialized, they will be used in subsequent commits for bookkeeping purposes and storing uncommitted interrupt routes. The TYPE_MSHV_ACCEL defines have been moved to the header. Signed-off-by: Magnus Kulke --- accel/mshv/irq.c | 10 ++++++++++ accel/mshv/mshv-all.c | 6 ++---- include/system/mshv.h | 7 +++++++ include/system/mshv_int.h | 5 +++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/accel/mshv/irq.c b/accel/mshv/irq.c index 3c238c33c3..82f2022c7c 100644 --- a/accel/mshv/irq.c +++ b/accel/mshv/irq.c @@ -396,3 +396,13 @@ int mshv_reserve_ioapic_msi_routes(int vm_fd) =20 return 0; } + +void mshv_init_irq_routing(MshvState *s) +{ + int gsi_count =3D MSHV_MAX_MSI_ROUTES; + + s->irq_routes =3D g_malloc0(sizeof(*s->irq_routes)); + s->nr_allocated_irq_routes =3D 0; + s->gsi_count =3D gsi_count; + s->used_gsi_bitmap =3D bitmap_new(gsi_count); +} diff --git a/accel/mshv/mshv-all.c b/accel/mshv/mshv-all.c index 04d248fe1d..8acb080db1 100644 --- a/accel/mshv/mshv-all.c +++ b/accel/mshv/mshv-all.c @@ -43,10 +43,6 @@ #include #include =20 -#define TYPE_MSHV_ACCEL ACCEL_CLASS_NAME("mshv") - -DECLARE_INSTANCE_CHECKER(MshvState, MSHV_STATE, TYPE_MSHV_ACCEL) - bool mshv_allowed; =20 MshvState *mshv_state; @@ -457,6 +453,8 @@ static int mshv_init(AccelState *as, MachineState *ms) =20 mshv_state =3D s; =20 + mshv_init_irq_routing(s); + register_mshv_memory_listener(s, &s->memory_listener, &address_space_m= emory, 0, "mshv-memory"); memory_listener_register(&mshv_io_listener, &address_space_io); diff --git a/include/system/mshv.h b/include/system/mshv.h index 1e96b3a606..0d1745315b 100644 --- a/include/system/mshv.h +++ b/include/system/mshv.h @@ -45,7 +45,13 @@ extern bool mshv_allowed; #define mshv_msi_via_irqfd_enabled() mshv_enabled() #endif =20 +#define TYPE_MSHV_ACCEL ACCEL_CLASS_NAME("mshv") + typedef struct MshvState MshvState; + +DECLARE_INSTANCE_CHECKER(MshvState, MSHV_STATE, + TYPE_MSHV_ACCEL) + extern MshvState *mshv_state; =20 /* interrupt */ @@ -60,5 +66,6 @@ void mshv_irqchip_release_virq(int virq); int mshv_irqchip_add_irqfd_notifier_gsi(const EventNotifier *n, const EventNotifier *rn, int virq); int mshv_irqchip_remove_irqfd_notifier_gsi(const EventNotifier *n, int vir= q); +void mshv_init_irq_routing(MshvState *s); =20 #endif diff --git a/include/system/mshv_int.h b/include/system/mshv_int.h index 70631ca6ba..56fda76a9c 100644 --- a/include/system/mshv_int.h +++ b/include/system/mshv_int.h @@ -48,6 +48,11 @@ struct MshvState { int nr_as; MshvAddressSpace *as; int fd; + /* irqchip routing */ + struct mshv_user_irq_table *irq_routes; + int nr_allocated_irq_routes; + unsigned long *used_gsi_bitmap; + unsigned int gsi_count; }; =20 typedef struct MshvMsiControl { --=20 2.34.1