All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] [RFC] ata: ahci: Respect bus DMA constraints
@ 2019-03-07  0:04 ` marek.vasut
  0 siblings, 0 replies; 36+ messages in thread
From: marek.vasut @ 2019-03-07  0:04 UTC (permalink / raw)
  To: linux-ide, linux-nvme
  Cc: Marek Vasut, Christoph Hellwig, Geert Uytterhoeven, Jens Axboe,
	Jens Axboe, Keith Busch, Robin Murphy, Sagi Grimberg,
	Wolfram Sang, linux-renesas-soc

From: Marek Vasut <marek.vasut+renesas@gmail.com>

Since commit 6c2fb2ea7636 ("of/device: Set bus DMA mask as appropriate"),
the upstream bus can constraint device DMA range. Respect that constraint
and do not change the device DMA masks if they were already set.

This is applicable e.g. on systems where the PCIe controller cannot expose
the full address space range. Such a system may have a 64bit CPU with DRAM
mapped both below and above the 32bit address space, yet the PCIe devices
can not perform DMA directly to/from the DRAM range above the 32bit limit.
Hence, for such setup to work, all the buffers must exist below the 32bit
limit.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Jens Axboe <axboe@fb.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Keith Busch <keith.busch@intel.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-renesas-soc@vger.kernel.org
To: linux-ide@vger.kernel.org
To: linux-nvme@lists.infradead.org
---
 drivers/ata/ahci.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 021ce46e2e57..2acce056dd8c 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -926,6 +926,13 @@ static int ahci_configure_dma_masks(struct pci_dev *pdev, int using_dac)
 	if (pdev->dma_mask && pdev->dma_mask < DMA_BIT_MASK(32))
 		return 0;
 
+	/*
+	 * The upstream device could have applied DMA constraints already,
+	 * respect those and do not change the DMA masks.
+	 */
+	if (pdev->dev.dma_mask && pdev->dev.coherent_dma_mask)
+		return 0;
+
 	if (using_dac &&
 	    !dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) {
 		rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64));
-- 
2.20.1


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

end of thread, other threads:[~2019-04-09 12:16 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-07  0:04 [PATCH 1/2] [RFC] ata: ahci: Respect bus DMA constraints marek.vasut
2019-03-07  0:04 ` marek.vasut
2019-03-07  0:04 ` [PATCH 2/2] [RFC] nvme-pci: " marek.vasut
2019-03-07  0:04   ` marek.vasut
2019-03-07  9:32 ` [PATCH 1/2] [RFC] ata: ahci: " Robin Murphy
2019-03-07  9:32   ` Robin Murphy
2019-03-07  9:37   ` Marek Vasut
2019-03-07  9:37     ` Marek Vasut
2019-03-07  9:48     ` Robin Murphy
2019-03-07  9:48       ` Robin Murphy
2019-03-07 11:14       ` Marek Vasut
2019-03-07 11:14         ` Marek Vasut
2019-03-08  7:18         ` Christoph Hellwig
2019-03-08  7:18           ` Christoph Hellwig
2019-03-08 23:23           ` Marek Vasut
2019-03-08 23:23             ` Marek Vasut
2019-03-13 18:30             ` Christoph Hellwig
2019-03-13 18:30               ` Christoph Hellwig
2019-03-16 21:25               ` Marek Vasut
2019-03-16 21:25                 ` Marek Vasut
2019-03-16 23:04                 ` Marek Vasut
2019-03-16 23:04                   ` Marek Vasut
2019-03-17 10:29                   ` Geert Uytterhoeven
2019-03-17 10:29                     ` Geert Uytterhoeven
2019-03-17 23:36                     ` Marek Vasut
2019-03-17 23:36                       ` Marek Vasut
2019-03-18 13:14                       ` Robin Murphy
2019-03-18 13:14                         ` Robin Murphy
2019-03-18 23:25                         ` Marek Vasut
2019-03-18 23:25                           ` Marek Vasut
2019-03-28  3:25                           ` Marek Vasut
2019-03-28  3:25                             ` Marek Vasut
2019-04-09 12:16                             ` Marek Vasut
2019-04-09 12:16                               ` Marek Vasut
2019-03-17 10:24                 ` Geert Uytterhoeven
2019-03-17 10:24                   ` Geert Uytterhoeven

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.