{"id":2226038,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2226038/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/patch/20260422023239.1171963-6-mrathor@linux.microsoft.com/","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/1.2/projects/28/?format=json","name":"Linux PCI development","link_name":"linux-pci","list_id":"linux-pci.vger.kernel.org","list_email":"linux-pci@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260422023239.1171963-6-mrathor@linux.microsoft.com>","list_archive_url":null,"date":"2026-04-22T02:32:31","name":"[V1,05/13] mshv: Declarations and definitions for VFIO-MSHV bridge device","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"0d641693ed4b26662ed6a2fb75e09631bf6353c6","submitter":{"id":91512,"url":"http://patchwork.ozlabs.org/api/1.2/people/91512/?format=json","name":"Mukesh R","email":"mrathor@linux.microsoft.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-pci/patch/20260422023239.1171963-6-mrathor@linux.microsoft.com/mbox/","series":[{"id":500915,"url":"http://patchwork.ozlabs.org/api/1.2/series/500915/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/list/?series=500915","date":"2026-04-22T02:32:26","name":"PCI passthru on Hyper-V (Part I)","version":1,"mbox":"http://patchwork.ozlabs.org/series/500915/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2226038/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2226038/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-pci+bounces-52900-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-pci@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=linux.microsoft.com header.i=@linux.microsoft.com\n header.a=rsa-sha256 header.s=default header.b=QGPwRGKv;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-52900-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=linux.microsoft.com\n header.i=@linux.microsoft.com header.b=\"QGPwRGKv\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=13.77.154.182","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.microsoft.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=linux.microsoft.com"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g0kD630Nkz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 12:47:50 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id DAF03306B881\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 02:34:20 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 5273638B7DA;\n\tWed, 22 Apr 2026 02:34:01 +0000 (UTC)","from linux.microsoft.com (linux.microsoft.com [13.77.154.182])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 56A7B3806C2;\n\tWed, 22 Apr 2026 02:33:45 +0000 (UTC)","from mrdev.corp.microsoft.com\n (192-184-212-33.fiber.dynamic.sonic.net [192.184.212.33])\n\tby linux.microsoft.com (Postfix) with ESMTPSA id 1C17A20B6F1B;\n\tTue, 21 Apr 2026 19:33:43 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776825236; cv=none;\n b=skL7Hy5AY2VY0UySb0c0vBchmPL8w8unqfZDMACHoxkGHoLpJIm7GreEbUQuKpqMwqpxHuntoG8goRHXuSeL255adQOPAFp0jg3O8pKMx0Se4zHHrydkW+CNo5BHIWni0L9bRY7qwn6K4yDzthvVXmIKYLI2I5c6lxlIEqWlfAM=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776825236; c=relaxed/simple;\n\tbh=i7TTD4rbc9FHgT/PqRax2hCxSF14mcjnAspWxjiAQFI=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=HmzpEgY5FxytW0hXk65MKzzCpC/ICCyao2ZfFLV8Mjh8thXoInE9Vf+Lx57+rybck0+7OoBI/zgJ4H5pK9FNDih+fMQxukclhi61W0t4yKhiknVqKnRJQNUa06wHWVgVTGZrz/dzv1zZMZtQATbH4+ZWao/IGUR2KRqN9iaUgN4=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.microsoft.com;\n spf=pass smtp.mailfrom=linux.microsoft.com;\n dkim=pass (1024-bit key) header.d=linux.microsoft.com\n header.i=@linux.microsoft.com header.b=QGPwRGKv;\n arc=none smtp.client-ip=13.77.154.182","DKIM-Filter":"OpenDKIM Filter v2.11.0 linux.microsoft.com 1C17A20B6F1B","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;\n\ts=default; t=1776825223;\n\tbh=tidzTRCfJneaHjA+fOlX3DgM/7vG+INZY/lk1h6owmY=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=QGPwRGKvHHZQ5ClWfTVBNhmOekp92Iiqn55G5NGuiCZYTUvYYvnsvCMP3fEQ0/UUA\n\t UfP+vFCUAIYN+x9a76g1Jq4uVNYbk2FK2SgvaioAPdeGy1G8DqrU8V2AAKUie1JIC5\n\t G3MyhqLY7hCDtKHMuoSDWn/oe76iNjehF9pIk1kg=","From":"Mukesh R <mrathor@linux.microsoft.com>","To":"hpa@zytor.com,\n\trobin.murphy@arm.com,\n\trobh@kernel.org,\n\twei.liu@kernel.org,\n\tmrathor@linux.microsoft.com,\n\tmhklinux@outlook.com,\n\tmuislam@microsoft.com,\n\tnamjain@linux.microsoft.com,\n\tmagnuskulke@linux.microsoft.com,\n\tanbelski@linux.microsoft.com,\n\tlinux-kernel@vger.kernel.org,\n\tlinux-hyperv@vger.kernel.org,\n\tiommu@lists.linux.dev,\n\tlinux-pci@vger.kernel.org,\n\tlinux-arch@vger.kernel.org","Cc":"kys@microsoft.com,\n\thaiyangz@microsoft.com,\n\tdecui@microsoft.com,\n\tlongli@microsoft.com,\n\ttglx@kernel.org,\n\tmingo@redhat.com,\n\tbp@alien8.de,\n\tdave.hansen@linux.intel.com,\n\tx86@kernel.org,\n\tjoro@8bytes.org,\n\twill@kernel.org,\n\tlpieralisi@kernel.org,\n\tkwilczynski@kernel.org,\n\tbhelgaas@google.com,\n\tarnd@arndb.de","Subject":"[PATCH V1 05/13] mshv: Declarations and definitions for VFIO-MSHV\n bridge device","Date":"Tue, 21 Apr 2026 19:32:31 -0700","Message-ID":"<20260422023239.1171963-6-mrathor@linux.microsoft.com>","X-Mailer":"git-send-email 2.51.2.vfs.0.1","In-Reply-To":"<20260422023239.1171963-1-mrathor@linux.microsoft.com>","References":"<20260422023239.1171963-1-mrathor@linux.microsoft.com>","Precedence":"bulk","X-Mailing-List":"linux-pci@vger.kernel.org","List-Id":"<linux-pci.vger.kernel.org>","List-Subscribe":"<mailto:linux-pci+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-pci+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"Add data structs needed by the subsequent patch that introduces a new\nmodule to implement VFIO-MSHV pseudo device.\n\nSigned-off-by: Mukesh R <mrathor@linux.microsoft.com>\n---\n drivers/hv/mshv_root.h    | 19 +++++++++++++++++++\n include/uapi/linux/mshv.h | 30 ++++++++++++++++++++++++++++++\n 2 files changed, 49 insertions(+)","diff":"diff --git a/drivers/hv/mshv_root.h b/drivers/hv/mshv_root.h\nindex a85c24dcc701..b9880d0bdc4d 100644\n--- a/drivers/hv/mshv_root.h\n+++ b/drivers/hv/mshv_root.h\n@@ -227,6 +227,25 @@ struct port_table_info {\n \t};\n };\n \n+struct mshv_device {\n+\tconst struct mshv_device_ops *device_ops;\n+\tstruct mshv_partition *device_pt;\n+\tvoid *device_private;\n+\tstruct hlist_node device_ptnode;\n+};\n+\n+struct mshv_device_ops {\n+\tconst char *device_name;\n+\tlong (*device_create)(struct mshv_device *dev);\n+\tvoid (*device_release)(struct mshv_device *dev);\n+\tlong (*device_set_attr)(struct mshv_device *dev,\n+\t\t\t\tstruct mshv_device_attr *attr);\n+\tlong (*device_has_attr)(struct mshv_device *dev,\n+\t\t\t\tstruct mshv_device_attr *attr);\n+};\n+\n+extern struct mshv_device_ops mshv_vfio_device_ops;\n+\n int mshv_update_routing_table(struct mshv_partition *partition,\n \t\t\t      const struct mshv_user_irq_entry *entries,\n \t\t\t      unsigned int numents);\ndiff --git a/include/uapi/linux/mshv.h b/include/uapi/linux/mshv.h\nindex 32ff92b6342b..4373a8243951 100644\n--- a/include/uapi/linux/mshv.h\n+++ b/include/uapi/linux/mshv.h\n@@ -404,4 +404,34 @@ struct mshv_sint_mask {\n /* hv_hvcall device */\n #define MSHV_HVCALL_SETUP        _IOW(MSHV_IOCTL, 0x1E, struct mshv_vtl_hvcall_setup)\n #define MSHV_HVCALL              _IOWR(MSHV_IOCTL, 0x1F, struct mshv_vtl_hvcall)\n+\n+/* device passhthru */\n+#define MSHV_CREATE_DEVICE_TEST\t\t1\n+\n+enum {\n+\tMSHV_DEV_TYPE_VFIO,\n+\tMSHV_DEV_TYPE_MAX,\n+};\n+\n+struct mshv_create_device {\n+\t__u32\ttype;\t     /* in: MSHV_DEV_TYPE_xxx */\n+\t__u32\tfd;\t     /* out: device handle */\n+\t__u32\tflags;\t     /* in: MSHV_CREATE_DEVICE_xxx */\n+};\n+\n+#define MSHV_DEV_VFIO_FILE      1\n+#define MSHV_DEV_VFIO_FILE_ADD\t1\n+#define MSHV_DEV_VFIO_FILE_DEL\t2\n+\n+struct mshv_device_attr {\n+\t__u32\tflags;\t\t/* no flags currently defined */\n+\t__u32\tgroup;\t\t/* device-defined */\n+\t__u64\tattr;\t\t/* group-defined */\n+\t__u64\taddr;\t\t/* userspace address of attr data */\n+};\n+\n+/* Device fds created with MSHV_CREATE_DEVICE */\n+#define MSHV_SET_DEVICE_ATTR\t_IOW(MSHV_IOCTL, 0x00, struct mshv_device_attr)\n+#define MSHV_HAS_DEVICE_ATTR\t_IOW(MSHV_IOCTL, 0x01, struct mshv_device_attr)\n+\n #endif\n","prefixes":["V1","05/13"]}