From: Jason Gunthorpe via iommu <iommu@lists.linux-foundation.org>
To: Robin Murphy <robin.murphy@arm.com>
Cc: kvm@vger.kernel.org, iommu@lists.linux.dev, cohuck@redhat.com,
linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
alex.williamson@redhat.com
Subject: Re: [PATCH v2 1/2] vfio/type1: Simplify bus_type determination
Date: Thu, 23 Jun 2022 22:52:47 -0300 [thread overview]
Message-ID: <20220624015247.GK4147@nvidia.com> (raw)
In-Reply-To: <b1d13cade281a7d8acbfd0f6a33dcd086207952c.1655898523.git.robin.murphy@arm.com>
On Wed, Jun 22, 2022 at 01:04:11PM +0100, Robin Murphy wrote:
> +struct vfio_device *vfio_device_get_from_iommu(struct iommu_group *iommu_group)
> +{
> + struct vfio_group *group = vfio_group_get_from_iommu(iommu_group);
> + struct vfio_device *device;
> +
> + mutex_lock(&group->device_lock);
> + list_for_each_entry(device, &group->device_list, group_next) {
> + if (vfio_device_try_get(device)) {
> + mutex_unlock(&group->device_lock);
> + return device;
> + }
> + }
> + mutex_unlock(&group->device_lock);
> + return NULL;
> +}
FWIW, I have no objection to this general approach, and I don't think
we should make any broader API just for this.
Though I might call it something like
'vfio_get_group_representor_device()' which more strongly suggests
what it is only used for.
Thanks,
Jason
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
WARNING: multiple messages have this Message-ID (diff)
From: Jason Gunthorpe <jgg@nvidia.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: alex.williamson@redhat.com, cohuck@redhat.com,
kvm@vger.kernel.org, iommu@lists.linux.dev,
iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] vfio/type1: Simplify bus_type determination
Date: Thu, 23 Jun 2022 22:52:47 -0300 [thread overview]
Message-ID: <20220624015247.GK4147@nvidia.com> (raw)
Message-ID: <20220624015247.vMDib-xKZCK6evT3TCLukBnutUuXVq_OioPdBqJl3MI@z> (raw)
In-Reply-To: <b1d13cade281a7d8acbfd0f6a33dcd086207952c.1655898523.git.robin.murphy@arm.com>
On Wed, Jun 22, 2022 at 01:04:11PM +0100, Robin Murphy wrote:
> +struct vfio_device *vfio_device_get_from_iommu(struct iommu_group *iommu_group)
> +{
> + struct vfio_group *group = vfio_group_get_from_iommu(iommu_group);
> + struct vfio_device *device;
> +
> + mutex_lock(&group->device_lock);
> + list_for_each_entry(device, &group->device_list, group_next) {
> + if (vfio_device_try_get(device)) {
> + mutex_unlock(&group->device_lock);
> + return device;
> + }
> + }
> + mutex_unlock(&group->device_lock);
> + return NULL;
> +}
FWIW, I have no objection to this general approach, and I don't think
we should make any broader API just for this.
Though I might call it something like
'vfio_get_group_representor_device()' which more strongly suggests
what it is only used for.
Thanks,
Jason
next prev parent reply other threads:[~2022-06-24 1:52 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-22 12:04 [PATCH v2 1/2] vfio/type1: Simplify bus_type determination Robin Murphy
2022-06-22 12:04 ` Robin Murphy
2022-06-22 12:04 ` [PATCH v2 2/2] vfio: Use device_iommu_capable() Robin Murphy
2022-06-22 12:04 ` Robin Murphy
2022-06-23 1:47 ` Baolu Lu
2022-06-23 1:47 ` Baolu Lu
2022-06-22 22:17 ` [PATCH v2 1/2] vfio/type1: Simplify bus_type determination Alex Williamson
2022-06-22 22:17 ` Alex Williamson
2022-06-23 8:46 ` Tian, Kevin
2022-06-23 8:46 ` Tian, Kevin
2022-06-23 20:35 ` Alex Williamson
2022-06-23 20:35 ` Alex Williamson
2022-06-23 12:23 ` Robin Murphy
2022-06-23 12:23 ` Robin Murphy
2022-06-23 20:50 ` Jason Gunthorpe via iommu
2022-06-23 20:50 ` Jason Gunthorpe
2022-06-23 23:00 ` Alex Williamson
2022-06-23 23:00 ` Alex Williamson
2022-06-24 1:50 ` Jason Gunthorpe via iommu
2022-06-24 1:50 ` Jason Gunthorpe
2022-06-24 14:11 ` Alex Williamson
2022-06-24 14:11 ` Alex Williamson
2022-06-24 14:18 ` Jason Gunthorpe via iommu
2022-06-24 14:18 ` Jason Gunthorpe
2022-06-24 14:28 ` Alex Williamson
2022-06-24 14:28 ` Alex Williamson
2022-06-24 14:56 ` Jason Gunthorpe via iommu
2022-06-24 14:56 ` Jason Gunthorpe
2022-06-24 15:12 ` Robin Murphy
2022-06-24 15:12 ` Robin Murphy
2022-06-24 16:04 ` Alex Williamson
2022-06-24 16:04 ` Alex Williamson
2022-06-23 1:46 ` Baolu Lu
2022-06-23 1:46 ` Baolu Lu
2022-06-23 4:32 ` kernel test robot
2022-06-23 4:32 ` kernel test robot
2022-06-24 1:52 ` Jason Gunthorpe via iommu [this message]
2022-06-24 1:52 ` Jason Gunthorpe
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=20220624015247.GK4147@nvidia.com \
--to=iommu@lists.linux-foundation.org \
--cc=alex.williamson@redhat.com \
--cc=cohuck@redhat.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.