]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ludev.git/commitdiff
Add LPAE 36-bit phys addr adjustment for Keystone CMA allocs
authorRobert Tivy <rtivy@ti.com>
Mon, 19 Jan 2015 23:14:31 +0000 (15:14 -0800)
committerRobert Tivy <rtivy@ti.com>
Mon, 19 Jan 2015 23:14:31 +0000 (15:14 -0800)
A CMA allocation within CMEM returns a 32-bit phys addr in the "alias"
region for the 36-bit LPAE phys addr, but CMEM customers need the actual
36-bit real phys addr.  Adding 0x780000000ULL to the 'dma' address that
is returned by dma_alloc_coherent() accomplishes this.

src/cmem/module/cmemk.c

index 03e8eeb76795938a437659f43e9785da576358eb..c58bbfb1b2f8b61e8c5d8ff021fe23ec68d1255a 100644 (file)
@@ -1239,7 +1239,12 @@ alloc:
            if (bi == NBLOCKS) {
                virtp = dma_alloc_coherent(dev, size, &dma, GFP_KERNEL);
 
+#if IS_ENABLED(CONFIG_ARCH_KEYSTONE) && IS_ENABLED(CONFIG_ARM_LPAE)
+               /* adjust from 32-bit alias to 36-bit phys */
+               physp = dma + 0x780000000ULL;
+#else
                physp = dma;
+#endif
                entry->dev = dev;
                entry->kvirtp = virtp;
            }