Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: John Garry <john.g.garry@oracle.com>
To: James.Bottomley@HansenPartnership.com,
	martin.petersen@oracle.com, m.szyprowski@samsung.com,
	robin.murphy@arm.com, hch@lst.de
Cc: linux-scsi@vger.kernel.org, iommu@lists.linux.dev,
	ionut.nechita@windriver.com, John Garry <john.g.garry@oracle.com>
Subject: [PATCH 1/2] dma-mapping: make dma_max_mapping_size() return 0 for no DMA capability
Date: Mon, 29 Jun 2026 08:53:09 +0000	[thread overview]
Message-ID: <20260629085310.2298552-2-john.g.garry@oracle.com> (raw)
In-Reply-To: <20260629085310.2298552-1-john.g.garry@oracle.com>

For when a device is not DMA capable, the max mapping size would be 0, so
make dma_max_mapping_size() reflect that.

Signed-off-by: John Garry <john.g.garry@oracle.com>
---
 kernel/dma/mapping.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c
index 4fe04669e5e66..7e576e5c6b8be 100644
--- a/kernel/dma/mapping.c
+++ b/kernel/dma/mapping.c
@@ -979,6 +979,9 @@ size_t dma_max_mapping_size(struct device *dev)
 	const struct dma_map_ops *ops = get_dma_ops(dev);
 	size_t size = SIZE_MAX;
 
+	if (!dev->dma_mask)
+		return 0;
+
 	if (dma_map_direct(dev, ops))
 		size = dma_direct_max_mapping_size(dev);
 	else if (use_dma_iommu(dev))
-- 
2.43.7


  reply	other threads:[~2026-06-29  8:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29  8:53 [PATCH 0/2] Drop SCSI core dev->dma_mask check John Garry
2026-06-29  8:53 ` John Garry [this message]
2026-06-29  9:10   ` [PATCH 1/2] dma-mapping: make dma_max_mapping_size() return 0 for no DMA capability sashiko-bot
2026-06-29 10:11   ` Robin Murphy
2026-06-29 10:46     ` John Garry
2026-06-29 11:09       ` Robin Murphy
2026-07-02 14:11         ` Christoph Hellwig
2026-07-02 14:32           ` John Garry
2026-07-02 14:11   ` Christoph Hellwig
2026-06-29  8:53 ` [PATCH 2/2] scsi: core: Drop dev->dma_mask check in evaluating max_sectors John Garry
2026-07-02 14:12   ` 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:
  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=20260629085310.2298552-2-john.g.garry@oracle.com \
    --to=john.g.garry@oracle.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux.dev \
    --cc=ionut.nechita@windriver.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=martin.petersen@oracle.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox