From: Jason Gunthorpe <jgg@nvidia.com>
To: Cindy Lu <lulu@redhat.com>
Cc: jasowang@redhat.com, mst@redhat.com, yi.l.liu@intel.com,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org,
netdev@vger.kernel.org
Subject: Re: [RFC 3/7] vhost: Add 3 new uapi to support iommufd
Date: Mon, 25 Sep 2023 10:49:59 -0300 [thread overview]
Message-ID: <20230925134959.GD13733@nvidia.com> (raw)
In-Reply-To: <20230923170540.1447301-4-lulu@redhat.com>
On Sun, Sep 24, 2023 at 01:05:36AM +0800, Cindy Lu wrote:
> +/* vhost vdpa set iommufd
> + * Input parameters:
> + * @iommufd: file descriptor from /dev/iommu; pass -1 to unset
> + * @group_id: identifier of the group that a virtqueue belongs to
> + * @ioas_id: IOAS identifier returned from ioctl(IOMMU_IOAS_ALLOC)
> + * Output parameters:
> + * @out_dev_id: device identifier
> + * @out_hwpt_id: hardware IO pagetable identifier
> + */
> +struct vhost_vdpa_set_iommufd {
> + __s32 iommufd;
> + __u32 group_id;
> + __u32 ioas_id;
> + __u32 out_dev_id;
> + __u32 out_hwpt_id;
> +};
> +
> +#define VHOST_VDPA_SET_IOMMU_FD \
> + _IOW(VHOST_VIRTIO, 0x7e, struct vhost_vdpa_set_iommufd)
> +
> +/*
> + * VDPA_DEVICE_ATTACH_IOMMUFD_AS -
> + * _IOW(VHOST_VIRTIO, 0x7f, struct vdpa_device_attach_iommufd_as)
> + *
> + * Attach a vdpa device to an iommufd address space specified by IOAS
> + * id.
> + *
> + * Available only after a device has been bound to iommufd via
> + * VHOST_VDPA_SET_IOMMU_FD
> + *
> + * Undo by VDPA_DEVICE_DETACH_IOMMUFD_AS or device fd close.
> + *
> + * @argsz: user filled size of this data.
> + * @flags: must be 0.
> + * @ioas_id: Input the target id which can represent an ioas
> + * allocated via iommufd subsystem.
> + *
> + * Return: 0 on success, -errno on failure.
> + */
> +struct vdpa_device_attach_iommufd_as {
> + __u32 argsz;
> + __u32 flags;
> + __u32 ioas_id;
> +};
I don't know this at all, but it seems really weird that the API
taking in the iommfd is more specific (eg includes the group_id) than
the API taking in the ioas.
I'd expect that you have one iommfd setup per virtio FD.
And the various virtio queues would be able to be linked to their own
IOAS.
I'm not sure multiple iommufd's per virito FD is worthwhile.
Jason
next prev parent reply other threads:[~2023-09-25 13:50 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-23 17:05 [RFC 0/7] vdpa: Add support for iommufd Cindy Lu
2023-09-23 17:05 ` [RFC 1/7] vhost/iommufd: Add the functions support iommufd Cindy Lu
2023-09-26 2:47 ` Jason Wang
2023-09-23 17:05 ` [RFC 2/7] Kconfig: Add the new file vhost/iommufd Cindy Lu
2023-09-23 17:05 ` [RFC 3/7] vhost: Add 3 new uapi to support iommufd Cindy Lu
2023-09-25 13:49 ` Jason Gunthorpe [this message]
2023-09-26 2:47 ` Jason Wang
2023-09-23 17:05 ` [RFC 4/7] vdpa: change the map/unmap process " Cindy Lu
2023-09-25 13:45 ` Jason Gunthorpe
2023-09-26 8:09 ` Cindy Lu
2023-09-23 17:05 ` [RFC 5/7] vdpa: Add new vdpa_config_ops Cindy Lu
2023-09-26 2:47 ` Jason Wang
2023-09-23 17:05 ` [RFC 6/7] vdpa_sim :Add support for iommufd Cindy Lu
2023-09-25 13:46 ` Jason Gunthorpe
2023-09-23 17:05 ` [RFC 7/7] iommufd: Skip the CACHE_COHERENCY and iommu group check Cindy Lu
2023-09-25 13:50 ` Jason Gunthorpe
2023-09-26 8:02 ` Cindy Lu
2023-09-26 2:46 ` [RFC 0/7] vdpa: Add support for iommufd Jason Wang
2023-10-26 6:42 ` Michael S. Tsirkin
2023-10-26 6:48 ` Cindy Lu
2023-10-26 6:49 ` Michael S. Tsirkin
2023-10-26 7:03 ` Cindy Lu
2023-11-02 10:02 ` Michael S. Tsirkin
2023-11-02 12:09 ` Cindy Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230925134959.GD13733@nvidia.com \
--to=jgg@nvidia.com \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lulu@redhat.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=yi.l.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).