From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 41BE9D778AC for ; Fri, 23 Jan 2026 18:25:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=c5e6KHQNxi0zfVxaoY8XkYNiy4vKr9eRDqbXHFKlre4=; b=NQes6CDQmQgoVJxc4N6q3VJ/LV 9VoyU4/yj4P6uvOYLvBxg7Gr8WadumXzabhNaSs/MSZd1ccPvelCDxS+tG7j81cHB7VK8a3Xhx4An ZP+6EH77KYDLgM8hf3GGcvp6vHt1OrqjFUbqK+N3ctAJMlqIcxnv62nc6xKlaHldceckhxrXpbWcM m7sknnIEfAzNP66kU25hYh8n+dNLaXSxO68ynbhso7bgqD/PzlwVMaFZYMmDvDLSaGDWTrNOSat8P UQzozXTOsfk3feLLO+baBcCoNMrafudmAb9SMEJlynJ6TNXc74Rav7IegZOc11Gq7VddJEwJAZcS3 88eM5QYA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vjLqm-00000009Le9-3MOZ; Fri, 23 Jan 2026 18:25:40 +0000 Received: from linux.microsoft.com ([13.77.154.182]) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vjLqk-00000009Ldn-2Kdu for linux-arm-kernel@lists.infradead.org; Fri, 23 Jan 2026 18:25:39 +0000 Received: from [100.65.200.94] (unknown [20.236.10.163]) by linux.microsoft.com (Postfix) with ESMTPSA id 1046020B716A; Fri, 23 Jan 2026 10:25:37 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 1046020B716A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1769192737; bh=c5e6KHQNxi0zfVxaoY8XkYNiy4vKr9eRDqbXHFKlre4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=rj9O+27xqHx44G8G+ZgJSTJd8WaNlkr14SPuNQ3jcmYOILcXTHDjQbS+fXzPZRo30 hYrXEXE8WoPwmCzsIMoB+eNwFEuShQJrSebppRXY4JFTpEeKY9sUVqUBgUuprSq4jM iUaQ0NcK6Yx0HC9oQBssLw3jxfHX7Bw+KEzb4KlU= Message-ID: Date: Fri, 23 Jan 2026 10:25:36 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v0 05/15] mshv: Declarations and definitions for VFIO-MSHV bridge device To: Mukesh R , linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-pci@vger.kernel.org, linux-arch@vger.kernel.org Cc: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, longli@microsoft.com, catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, joro@8bytes.org, lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org, robh@kernel.org, bhelgaas@google.com, arnd@arndb.de, mhklinux@outlook.com, romank@linux.microsoft.com References: <20260120064230.3602565-1-mrathor@linux.microsoft.com> <20260120064230.3602565-6-mrathor@linux.microsoft.com> Content-Language: en-US From: Nuno Das Neves In-Reply-To: <20260120064230.3602565-6-mrathor@linux.microsoft.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260123_102538_651002_D96E60D4 X-CRM114-Status: GOOD ( 15.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 1/19/2026 10:42 PM, Mukesh R wrote: > From: Mukesh Rathor > > Add data structs needed by the subsequent patch that introduces a new > module to implement VFIO-MSHV pseudo device. > > Signed-off-by: Mukesh Rathor > --- > drivers/hv/mshv_root.h | 23 +++++++++++++++++++++++ > include/uapi/linux/mshv.h | 31 +++++++++++++++++++++++++++++++ > 2 files changed, 54 insertions(+) > > diff --git a/drivers/hv/mshv_root.h b/drivers/hv/mshv_root.h > index c3753b009fd8..42e1da1d545b 100644 > --- a/drivers/hv/mshv_root.h > +++ b/drivers/hv/mshv_root.h > @@ -220,6 +220,29 @@ struct port_table_info { > }; > }; > > +struct mshv_device { > + const struct mshv_device_ops *device_ops; > + struct mshv_partition *device_pt; > + void *device_private; > + struct hlist_node device_ptnode; > +}; > + > +struct mshv_device_ops { > + const char *device_name; > + long (*device_create)(struct mshv_device *dev, u32 type); > + void (*device_release)(struct mshv_device *dev); > + long (*device_set_attr)(struct mshv_device *dev, > + struct mshv_device_attr *attr); > + long (*device_has_attr)(struct mshv_device *dev, > + struct mshv_device_attr *attr); > +}; > + > +extern struct mshv_device_ops mshv_vfio_device_ops; > +int mshv_vfio_ops_init(void); > +void mshv_vfio_ops_exit(void); > +long mshv_partition_ioctl_create_device(struct mshv_partition *partition, > + void __user *user_args); > + > int mshv_update_routing_table(struct mshv_partition *partition, > const struct mshv_user_irq_entry *entries, > unsigned int numents); > diff --git a/include/uapi/linux/mshv.h b/include/uapi/linux/mshv.h > index dee3ece28ce5..b7b10f9e2896 100644 > --- a/include/uapi/linux/mshv.h > +++ b/include/uapi/linux/mshv.h > @@ -252,6 +252,7 @@ struct mshv_root_hvcall { > #define MSHV_GET_GPAP_ACCESS_BITMAP _IOWR(MSHV_IOCTL, 0x06, struct mshv_gpap_access_bitmap) > /* Generic hypercall */ > #define MSHV_ROOT_HVCALL _IOWR(MSHV_IOCTL, 0x07, struct mshv_root_hvcall) > +#define MSHV_CREATE_DEVICE _IOWR(MSHV_IOCTL, 0x08, struct mshv_create_device) > With this commit, the IOCTL number is exposed to userspace but it doesn't work. Ideally the IOCTL number should be added in the commit where it becomes usable. > /* > ******************************** > @@ -402,4 +403,34 @@ struct mshv_sint_mask { > /* hv_hvcall device */ > #define MSHV_HVCALL_SETUP _IOW(MSHV_IOCTL, 0x1E, struct mshv_vtl_hvcall_setup) > #define MSHV_HVCALL _IOWR(MSHV_IOCTL, 0x1F, struct mshv_vtl_hvcall) > + > +/* device passhthru */ > +#define MSHV_CREATE_DEVICE_TEST 1 > + > +enum { > + MSHV_DEV_TYPE_VFIO, > + MSHV_DEV_TYPE_MAX, > +}; > + > +struct mshv_create_device { > + __u32 type; /* in: MSHV_DEV_TYPE_xxx */ > + __u32 fd; /* out: device handle */ > + __u32 flags; /* in: MSHV_CREATE_DEVICE_xxx */ > +}; > + > +#define MSHV_DEV_VFIO_FILE 1 > +#define MSHV_DEV_VFIO_FILE_ADD 1 > +#define MSHV_DEV_VFIO_FILE_DEL 2 > + > +struct mshv_device_attr { > + __u32 flags; /* no flags currently defined */ > + __u32 group; /* device-defined */ > + __u64 attr; /* group-defined */ > + __u64 addr; /* userspace address of attr data */ > +}; > + > +/* Device fds created with MSHV_CREATE_DEVICE */ > +#define MSHV_SET_DEVICE_ATTR _IOW(MSHV_IOCTL, 0x00, struct mshv_device_attr) > +#define MSHV_HAS_DEVICE_ATTR _IOW(MSHV_IOCTL, 0x01, struct mshv_device_attr) > + > #endif