Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: axienet: Allow DMA to beyond 4GB

With all DMA address accesses wrapped, we can actually support 64-bit
DMA if this option was chosen at IP integration time.
If the IP has been configured for an address width greater than 32 bits,
we assume the full 64 bit DMA width is working. In practise this will be
limited by the actual system address bus width, which will ideally be the
same as the DMA IP address width.
If this is not the case, the actual width can still be configured using a
dma-ranges property in the parent of the MAC node.

This increases the DMA mask on those systems to let the kernel choose
buffers from memory at higher addresses.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Andre Przywara and committed by
David S. Miller
5fff0151 f735c40e

+8
+8
drivers/net/ethernet/xilinx/xilinx_axienet_main.c
··· 1780 1780 struct net_device *ndev; 1781 1781 const void *mac_addr; 1782 1782 struct resource *ethres; 1783 + int addr_width = 32; 1783 1784 u32 value; 1784 1785 1785 1786 ndev = alloc_etherdev(sizeof(*lp)); ··· 1948 1947 iowrite32(0xffffffff, desc); 1949 1948 if (ioread32(desc) > 0) { 1950 1949 lp->features |= XAE_FEATURE_DMA_64BIT; 1950 + addr_width = 64; 1951 1951 dev_info(&pdev->dev, 1952 1952 "autodetected 64-bit DMA range\n"); 1953 1953 } 1954 1954 iowrite32(0x0, desc); 1955 1955 } 1956 + } 1957 + 1958 + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(addr_width)); 1959 + if (ret) { 1960 + dev_err(&pdev->dev, "No suitable DMA available\n"); 1961 + goto free_netdev; 1956 1962 } 1957 1963 1958 1964 /* Check for Ethernet core IRQ (optional) */