iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iommu: Don't print warning when IOMMU driver only supports unmanaged domains
@ 2019-03-22 16:04 Joerg Roedel
  2019-03-25 13:37 ` Joerg Roedel
  0 siblings, 1 reply; 2+ messages in thread
From: Joerg Roedel @ 2019-03-22 16:04 UTC (permalink / raw)
  To: iommu; +Cc: linux-kernel, Joerg Roedel

From: Joerg Roedel <jroedel@suse.de>

Print the warning about the fall-back to IOMMU_DOMAIN_DMA in
iommu_group_get_for_dev() only when such a domain was
actually allocated.

Otherwise the user will get misleading warnings in the
kernel log when the iommu driver used doesn't support
IOMMU_DOMAIN_DMA and IOMMU_DOMAIN_IDENTITY.

Fixes: fccb4e3b8ab09 ('iommu: Allow default domain type to be set on the kernel command line')
Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
 drivers/iommu/iommu.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 33a982e33716..109de67d5d72 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -1105,10 +1105,12 @@ struct iommu_group *iommu_group_get_for_dev(struct device *dev)
 
 		dom = __iommu_domain_alloc(dev->bus, iommu_def_domain_type);
 		if (!dom && iommu_def_domain_type != IOMMU_DOMAIN_DMA) {
-			dev_warn(dev,
-				 "failed to allocate default IOMMU domain of type %u; falling back to IOMMU_DOMAIN_DMA",
-				 iommu_def_domain_type);
 			dom = __iommu_domain_alloc(dev->bus, IOMMU_DOMAIN_DMA);
+			if (dom) {
+				dev_warn(dev,
+					 "failed to allocate default IOMMU domain of type %u; falling back to IOMMU_DOMAIN_DMA",
+					 iommu_def_domain_type);
+			}
 		}
 
 		group->default_domain = dom;
-- 
2.16.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iommu: Don't print warning when IOMMU driver only supports unmanaged domains
  2019-03-22 16:04 [PATCH] iommu: Don't print warning when IOMMU driver only supports unmanaged domains Joerg Roedel
@ 2019-03-25 13:37 ` Joerg Roedel
  0 siblings, 0 replies; 2+ messages in thread
From: Joerg Roedel @ 2019-03-25 13:37 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: iommu, linux-kernel

On Fri, Mar 22, 2019 at 05:04:26PM +0100, Joerg Roedel wrote:
> From: Joerg Roedel <jroedel@suse.de>
> 
> Print the warning about the fall-back to IOMMU_DOMAIN_DMA in
> iommu_group_get_for_dev() only when such a domain was
> actually allocated.
> 
> Otherwise the user will get misleading warnings in the
> kernel log when the iommu driver used doesn't support
> IOMMU_DOMAIN_DMA and IOMMU_DOMAIN_IDENTITY.
> 
> Fixes: fccb4e3b8ab09 ('iommu: Allow default domain type to be set on the kernel command line')
> Signed-off-by: Joerg Roedel <jroedel@suse.de>
> ---
>  drivers/iommu/iommu.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-25 13:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-22 16:04 [PATCH] iommu: Don't print warning when IOMMU driver only supports unmanaged domains Joerg Roedel
2019-03-25 13:37 ` Joerg Roedel

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).