* [PATCH] vfio: Stop using iommu_present()
@ 2022-04-05 12:11 Robin Murphy
2022-04-05 19:04 ` Jason Gunthorpe
2022-05-12 18:21 ` Alex Williamson
0 siblings, 2 replies; 3+ messages in thread
From: Robin Murphy @ 2022-04-05 12:11 UTC (permalink / raw)
To: alex.williamson; +Cc: cohuck, iommu, kvm, linux-kernel
IOMMU groups have been mandatory for some time now, so a device without
one is necessarily a device without any usable IOMMU, therefore the
iommu_present() check is redundant (or at best unhelpful).
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
drivers/vfio/vfio.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index a4555014bd1e..7b0a7b85e77e 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -745,11 +745,11 @@ static struct vfio_group *vfio_group_find_or_alloc(struct device *dev)
iommu_group = iommu_group_get(dev);
#ifdef CONFIG_VFIO_NOIOMMU
- if (!iommu_group && noiommu && !iommu_present(dev->bus)) {
+ if (!iommu_group && noiommu) {
/*
* With noiommu enabled, create an IOMMU group for devices that
- * don't already have one and don't have an iommu_ops on their
- * bus. Taint the kernel because we're about to give a DMA
+ * don't already have one, implying no IOMMU hardware/driver
+ * exists. Taint the kernel because we're about to give a DMA
* capable device to a user without IOMMU protection.
*/
group = vfio_noiommu_group_alloc(dev, VFIO_NO_IOMMU);
--
2.28.0.dirty
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] vfio: Stop using iommu_present()
2022-04-05 12:11 [PATCH] vfio: Stop using iommu_present() Robin Murphy
@ 2022-04-05 19:04 ` Jason Gunthorpe
2022-05-12 18:21 ` Alex Williamson
1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2022-04-05 19:04 UTC (permalink / raw)
To: Robin Murphy; +Cc: alex.williamson, iommu, cohuck, linux-kernel, kvm
On Tue, Apr 05, 2022 at 01:11:54PM +0100, Robin Murphy wrote:
> IOMMU groups have been mandatory for some time now, so a device without
> one is necessarily a device without any usable IOMMU, therefore the
> iommu_present() check is redundant (or at best unhelpful).
>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
> drivers/vfio/vfio.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Jason
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] vfio: Stop using iommu_present()
2022-04-05 12:11 [PATCH] vfio: Stop using iommu_present() Robin Murphy
2022-04-05 19:04 ` Jason Gunthorpe
@ 2022-05-12 18:21 ` Alex Williamson
1 sibling, 0 replies; 3+ messages in thread
From: Alex Williamson @ 2022-05-12 18:21 UTC (permalink / raw)
To: Robin Murphy; +Cc: cohuck, iommu, kvm, linux-kernel
On Tue, 5 Apr 2022 13:11:54 +0100
Robin Murphy <robin.murphy@arm.com> wrote:
> IOMMU groups have been mandatory for some time now, so a device without
> one is necessarily a device without any usable IOMMU, therefore the
> iommu_present() check is redundant (or at best unhelpful).
>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
> drivers/vfio/vfio.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
> index a4555014bd1e..7b0a7b85e77e 100644
> --- a/drivers/vfio/vfio.c
> +++ b/drivers/vfio/vfio.c
> @@ -745,11 +745,11 @@ static struct vfio_group *vfio_group_find_or_alloc(struct device *dev)
>
> iommu_group = iommu_group_get(dev);
> #ifdef CONFIG_VFIO_NOIOMMU
> - if (!iommu_group && noiommu && !iommu_present(dev->bus)) {
> + if (!iommu_group && noiommu) {
> /*
> * With noiommu enabled, create an IOMMU group for devices that
> - * don't already have one and don't have an iommu_ops on their
> - * bus. Taint the kernel because we're about to give a DMA
> + * don't already have one, implying no IOMMU hardware/driver
> + * exists. Taint the kernel because we're about to give a DMA
> * capable device to a user without IOMMU protection.
> */
> group = vfio_noiommu_group_alloc(dev, VFIO_NO_IOMMU);
Applied to vfio next branch for v5.19. Thanks,
Alex
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-05-12 18:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 12:11 [PATCH] vfio: Stop using iommu_present() Robin Murphy
2022-04-05 19:04 ` Jason Gunthorpe
2022-05-12 18:21 ` Alex Williamson
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).