diff options
author | Robin Murphy <robin.murphy@arm.com> | 2018-07-23 18:16:12 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-07-27 13:01:07 -0400 |
commit | 4d8bde883bfba3e8dd3335f91b640e5a70ec0aa6 (patch) | |
tree | ef98a3deb3a6de05ef4ab94e54df266aad331d1a | |
parent | 6757cdae44449dec2af68cd4db0a5f9a30e66b38 (diff) |
OF: Don't set default coherent DMA mask
Now that we can track upstream DMA constraints properly with
bus_dma_mask instead of trying (and failing) to maintain it in
coherent_dma_mask, it doesn't make much sense for the firmware code to
be touching the latter at all. It's merely papering over bugs wherein a
driver has failed to call dma_set_coherent_mask() *and* the bus code has
not initialised any default value.
We don't really want to encourage more drivers coercing dma_mask so
we'll continue to fix that up if necessary, but add a warning to help
flush out any such buggy bus code that remains.
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r-- | drivers/of/device.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/of/device.c b/drivers/of/device.c index 0d39633e8545..5957cd4fa262 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c | |||
@@ -127,20 +127,20 @@ int of_dma_configure(struct device *dev, struct device_node *np, bool force_dma) | |||
127 | } | 127 | } |
128 | 128 | ||
129 | /* | 129 | /* |
130 | * Set default coherent_dma_mask to 32 bit. Drivers are expected to | 130 | * If @dev is expected to be DMA-capable then the bus code that created |
131 | * setup the correct supported mask. | 131 | * it should have initialised its dma_mask pointer by this point. For |
132 | * now, we'll continue the legacy behaviour of coercing it to the | ||
133 | * coherent mask if not, but we'll no longer do so quietly. | ||
132 | */ | 134 | */ |
133 | if (!dev->coherent_dma_mask) | 135 | if (!dev->dma_mask) { |
134 | dev->coherent_dma_mask = DMA_BIT_MASK(32); | 136 | dev_warn(dev, "DMA mask not set\n"); |
135 | /* | ||
136 | * Set it to coherent_dma_mask by default if the architecture | ||
137 | * code has not set it. | ||
138 | */ | ||
139 | if (!dev->dma_mask) | ||
140 | dev->dma_mask = &dev->coherent_dma_mask; | 137 | dev->dma_mask = &dev->coherent_dma_mask; |
138 | } | ||
141 | 139 | ||
142 | if (!size) | 140 | if (!size && dev->coherent_dma_mask) |
143 | size = max(dev->coherent_dma_mask, dev->coherent_dma_mask + 1); | 141 | size = max(dev->coherent_dma_mask, dev->coherent_dma_mask + 1); |
142 | else if (!size) | ||
143 | size = 1ULL << 32; | ||
144 | 144 | ||
145 | dev->dma_pfn_offset = offset; | 145 | dev->dma_pfn_offset = offset; |
146 | 146 | ||