archive mirror
 help / color / mirror / Atom feed
From: Alexander Duyck <>
Subject: [PATCH] dma-direct: Fix return value of dma_direct_supported
Date: Wed, 03 Oct 2018 16:48:07 -0700	[thread overview]
Message-ID: <20181003234746.3586.42014.stgit@localhost.localdomain> (raw)

It appears that in commit 9d7a224b463e ("dma-direct: always allow dma mask
<= physiscal memory size") the logic of the test was changed from a "<" to
a ">=" however I don't see any reason for that change. I am assuming that
there was some additional change planned, specifically I suspect the logic
was intended to be reversed and possibly used for a return. Since that is
the case I have gone ahead and done that.

This addresses issues I had on my system that prevented me from booting
with the above mentioned commit applied on an x86_64 system w/ Intel IOMMU.

Fixes: 9d7a224b463e ("dma-direct: always allow dma mask <= physiscal memory size")
Signed-off-by: Alexander Duyck <>
 kernel/dma/direct.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
index 5a0806b5351b..65872f6c2e93 100644
--- a/kernel/dma/direct.c
+++ b/kernel/dma/direct.c
@@ -301,9 +301,7 @@ int dma_direct_supported(struct device *dev, u64 mask)
 	min_mask = min_t(u64, min_mask, (max_pfn - 1) << PAGE_SHIFT);
-	if (mask >= phys_to_dma(dev, min_mask))
-		return 0;
-	return 1;
+	return mask >= phys_to_dma(dev, min_mask);
 int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr)

             reply	other threads:[~2018-10-03 23:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-03 23:48 Alexander Duyck [this message]
2018-10-04 11:25 ` Robin Murphy
2018-10-04 15:13   ` Alexander Duyck
2018-10-05  7:17     ` Christoph Hellwig
2018-12-13 19:45     ` Lendacky, Thomas
2018-12-13 19:58       ` Christoph Hellwig

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181003234746.3586.42014.stgit@localhost.localdomain \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH] dma-direct: Fix return value of dma_direct_supported' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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