mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
ARM: DMA-API: better handing of DMA masks for coherent allocations
We need to start treating DMA masks as something which is specific to the bus that the device resides on, otherwise we're going to hit all sorts of nasty issues with LPAE and 32-bit DMA controllers in >32-bit systems, where memory is offset from PFN 0. In order to start doing this, we convert the DMA mask to a PFN using the device specific dma_to_pfn() macro. This is the reverse of the pfn_to_dma() macro which is used to get the DMA address for the device. This gives us a PFN mask, which we can then check against the PFN limit of the DMA zone. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
parent
42536b9f9c
commit
4dcfa60071
3 changed files with 49 additions and 6 deletions
|
@ -218,6 +218,7 @@ EXPORT_SYMBOL(arm_dma_zone_size);
|
|||
* so a successful GFP_DMA allocation will always satisfy this.
|
||||
*/
|
||||
phys_addr_t arm_dma_limit;
|
||||
unsigned long arm_dma_pfn_limit;
|
||||
|
||||
static void __init arm_adjust_dma_zone(unsigned long *size, unsigned long *hole,
|
||||
unsigned long dma_size)
|
||||
|
@ -240,6 +241,7 @@ void __init setup_dma_zone(const struct machine_desc *mdesc)
|
|||
arm_dma_limit = PHYS_OFFSET + arm_dma_zone_size - 1;
|
||||
} else
|
||||
arm_dma_limit = 0xffffffff;
|
||||
arm_dma_pfn_limit = arm_dma_limit >> PAGE_SHIFT;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue