aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorRobin Murphy <robin.murphy@arm.com>2018-07-23 18:16:07 -0400
committerChristoph Hellwig <hch@lst.de>2018-07-27 13:01:04 -0400
commitf07d141fe9430cdf9f8a65a87c4136bd83b8ab2e (patch)
tree779f6966e477d437732e08f26a6b5c3b5dddc80c /include/linux
parent5ac65e8c89410892189ef778f567da4adafb2e2f (diff)
dma-mapping: Generalise dma_32bit_limit flag
Whilst the notion of an upstream DMA restriction is most commonly seen in PCI host bridges saddled with a 32-bit native interface, a more general version of the same issue can exist on complex SoCs where a bus or point-to-point interconnect link from a device's DMA master interface to another component along the path to memory (often an IOMMU) may carry fewer address bits than the interfaces at both ends nominally support. In order to properly deal with this, the first step is to expand the dma_32bit_limit flag into an arbitrary mask. To minimise the impact on existing code, we'll make sure to only consider this new mask valid if set. That makes sense anyway, since a mask of zero would represent DMA not being wired up at all, and that would be better handled by not providing valid ops in the first place. 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>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/device.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index 055a69dbcd18..6d3b000be57e 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -886,6 +886,8 @@ struct dev_links_info {
886 * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all 886 * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all
887 * hardware supports 64-bit addresses for consistent allocations 887 * hardware supports 64-bit addresses for consistent allocations
888 * such descriptors. 888 * such descriptors.
889 * @bus_dma_mask: Mask of an upstream bridge or bus which imposes a smaller DMA
890 * limit than the device itself supports.
889 * @dma_pfn_offset: offset of DMA memory range relatively of RAM 891 * @dma_pfn_offset: offset of DMA memory range relatively of RAM
890 * @dma_parms: A low level driver may set these to teach IOMMU code about 892 * @dma_parms: A low level driver may set these to teach IOMMU code about
891 * segment limitations. 893 * segment limitations.
@@ -912,8 +914,6 @@ struct dev_links_info {
912 * @offline: Set after successful invocation of bus type's .offline(). 914 * @offline: Set after successful invocation of bus type's .offline().
913 * @of_node_reused: Set if the device-tree node is shared with an ancestor 915 * @of_node_reused: Set if the device-tree node is shared with an ancestor
914 * device. 916 * device.
915 * @dma_32bit_limit: bridge limited to 32bit DMA even if the device itself
916 * indicates support for a higher limit in the dma_mask field.
917 * 917 *
918 * At the lowest level, every device in a Linux system is represented by an 918 * At the lowest level, every device in a Linux system is represented by an
919 * instance of struct device. The device structure contains the information 919 * instance of struct device. The device structure contains the information
@@ -967,6 +967,7 @@ struct device {
967 not all hardware supports 967 not all hardware supports
968 64 bit addresses for consistent 968 64 bit addresses for consistent
969 allocations such descriptors. */ 969 allocations such descriptors. */
970 u64 bus_dma_mask; /* upstream dma_mask constraint */
970 unsigned long dma_pfn_offset; 971 unsigned long dma_pfn_offset;
971 972
972 struct device_dma_parameters *dma_parms; 973 struct device_dma_parameters *dma_parms;
@@ -1002,7 +1003,6 @@ struct device {
1002 bool offline_disabled:1; 1003 bool offline_disabled:1;
1003 bool offline:1; 1004 bool offline:1;
1004 bool of_node_reused:1; 1005 bool of_node_reused:1;
1005 bool dma_32bit_limit:1;
1006}; 1006};
1007 1007
1008static inline struct device *kobj_to_dev(struct kobject *kobj) 1008static inline struct device *kobj_to_dev(struct kobject *kobj)