soc/fsl/qbman: Rework private memory allocations
Subsystems (3)
cover soc/fsl/qbman: Rework private memory allocations
The QBMan device requires three separate memory areas that are only accessed by the device. These areas are reserved using the OF reserved memory mechanism and associated to the device in the device trees memory-region attribute. However in order to be allocatable using the dma_alloc() APIs the reservations compatiable string must include "shared-dma-pool" and specify "no-map".
This set of changes updates the QBMan driver, PPC device trees and bindings to use the above mechasism. This work was encouraged as part of preparing this driver to work on ARM processors.
Roy Pledge (5):
soc/fsl/qbman: Use shared-dma-pool for BMan private memory allocations soc/fsl/qbman: Use shared-dma-pool for QMan private memory allocations
dts: arch/powerpc: Update Freescale DTS for QBMan memory allocations
dt-bindings: soc/fsl: Update reserved memory binding for QBMan
powerpc: Add HAVE_GENERIC_DMA_COHERENT options to Kconfig
Documentation/devicetree/bindings/soc/fsl/bman.txt | 10 +- Documentation/devicetree/bindings/soc/fsl/qman.txt | 16 +-- arch/powerpc/Kconfig | 1 + arch/powerpc/boot/dts/fsl/b4qds.dtsi | 6 ++ arch/powerpc/boot/dts/fsl/b4si-post.dtsi | 15 --- arch/powerpc/boot/dts/fsl/cyrus_p5020.dts | 6 ++ arch/powerpc/boot/dts/fsl/kmcent2.dts | 6 ++ arch/powerpc/boot/dts/fsl/kmcoge4.dts | 6 ++ arch/powerpc/boot/dts/fsl/oca4080.dts | 6 ++ arch/powerpc/boot/dts/fsl/p1023rdb.dts | 6 ++ arch/powerpc/boot/dts/fsl/p1023si-post.dtsi | 15 --- arch/powerpc/boot/dts/fsl/p2041rdb.dts | 6 ++ arch/powerpc/boot/dts/fsl/p2041si-post.dtsi | 15 --- arch/powerpc/boot/dts/fsl/p3041ds.dts | 6 ++ arch/powerpc/boot/dts/fsl/p3041si-post.dtsi | 15 --- arch/powerpc/boot/dts/fsl/p4080ds.dts | 6 ++ arch/powerpc/boot/dts/fsl/p4080si-post.dtsi | 15 --- arch/powerpc/boot/dts/fsl/p5020ds.dts | 6 ++ arch/powerpc/boot/dts/fsl/p5020si-post.dtsi | 15 --- arch/powerpc/boot/dts/fsl/p5040ds.dts | 6 ++ arch/powerpc/boot/dts/fsl/p5040si-post.dtsi | 15 --- arch/powerpc/boot/dts/fsl/t1023rdb.dts | 6 ++ arch/powerpc/boot/dts/fsl/t1023si-post.dtsi | 15 --- arch/powerpc/boot/dts/fsl/t1024qds.dts | 6 ++ arch/powerpc/boot/dts/fsl/t1024rdb.dts | 6 ++ arch/powerpc/boot/dts/fsl/t1040si-post.dtsi | 15 --- arch/powerpc/boot/dts/fsl/t104xd4rdb.dtsi | 6 ++ arch/powerpc/boot/dts/fsl/t104xqds.dtsi | 6 ++ arch/powerpc/boot/dts/fsl/t104xrdb.dtsi | 6 ++ arch/powerpc/boot/dts/fsl/t2081si-post.dtsi | 15 --- arch/powerpc/boot/dts/fsl/t208xqds.dtsi | 6 ++ arch/powerpc/boot/dts/fsl/t208xrdb.dtsi | 6 ++ arch/powerpc/boot/dts/fsl/t4240qds.dts | 6 ++ arch/powerpc/boot/dts/fsl/t4240rdb.dts | 6 ++ arch/powerpc/boot/dts/fsl/t4240si-post.dtsi | 15 --- drivers/soc/fsl/qbman/bman_ccsr.c | 27 ++++- drivers/soc/fsl/qbman/bman_priv.h | 3 + drivers/soc/fsl/qbman/qman_ccsr.c | 119 ++++++++++++--------- drivers/soc/fsl/qbman/qman_priv.h | 4 +- drivers/soc/fsl/qbman/qman_test.h | 2 - 40 files changed, 238 insertions(+), 235 deletions(-)
--
2.9.3
RFC PATCH 1/5 soc/fsl/qbman: Use shared-dma-pool for BMan private memory allocations
Use the shared-memory-pool mechanism for free buffer proxy record area allocation.
--- drivers/soc/fsl/qbman/bman_ccsr.c | 27 ++++++++++++++++++++++++++- drivers/soc/fsl/qbman/bman_priv.h | 3 +++ 2 files changed, 29 insertions(+), 1 deletion(-)
drivers/soc/fsl/qbman/bman_ccsr.c +26 -1
@@ -170,10 +170,11 @@ static int fsl_bman_probe(struct platform_device *pdev) {int ret, err_irq;struct device *dev = &pdev->dev; -struct device_node *node = dev->of_node; +struct device_node *mem_node, *node = dev->of_node;struct resource *res;u16 id, bm_pool_cnt;u8 major, minor; +u64 size; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!res) {
@@ -201,6 +202,30 @@ static int fsl_bman_probe(struct platform_device *pdev)return -ENODEV ; } + ret =of_reserved_mem_device_init (dev); +if (ret) { +dev_err (dev,"of_reserved_mem_device_init() failed 0x%x\n" , ret); +return -ENODEV ; + } + mem_node =of_parse_phandle (dev->of_node,"memory-region" ,0 ); +if (mem_node) { + ret =of_property_read_u64 (mem_node,"size" , &size); +if (ret) { +dev_err (dev,"FBPR: of_address_to_resource fails 0x%x\n" , ret); +return -ENODEV ; + } + fbpr_sz = size; + }else { +dev_err (dev,"No memory-region found for FBPR\n" ); +return -ENODEV ; + } +if (!dma_zalloc_coherent (dev, fbpr_sz, &fbpr_a,0 )) { +dev_err (dev,"Alloc FBPR memory failed\n" ); +return -ENODEV ; + } + +dev_info (dev,"Allocated FBPR 0x%llx 0x%zx\n" , fbpr_a, fbpr_sz); +bm_set_memory (fbpr_a, fbpr_sz); err_irq =platform_get_irq (pdev,0 );
drivers/soc/fsl/qbman/bman_priv.h +3 -0
@@ -33,6 +33,9 @@#include "dpaa_sys.h" #include <soc/fsl/bman.h> +#include <linux/dma-contiguous.h> +#include <linux/of_address.h> +#include <linux/dma-mapping.h> /* Portal processing (interrupt) sources */ #define BM_PIRQ_RCRI 0x00000002/* RCR Ring (below threshold) */
Signature · 1 line
2.9.3
RFC PATCH 2/5 soc/fsl/qbman: Use shared-dma-pool for QMan private memory allocations
In reply to Roy PledgeUse the shared-memory-pool mechanism for frame queue descriptor and packed frame descriptor record area allocations.
--- drivers/soc/fsl/qbman/qman_ccsr.c | 119 +++++++++++++++++++++----------------- drivers/soc/fsl/qbman/qman_priv.h | 4 +- drivers/soc/fsl/qbman/qman_test.h | 2 - 3 files changed, 68 insertions(+), 57 deletions(-)
drivers/soc/fsl/qbman/qman_ccsr.c +66 -53
@@ -400,63 +400,19 @@ static int qm_init_pfdr(struct device *dev, u32 pfdr_start, u32 num)return -ENODEV ; } -/* -* Ideally we would use the DMA API to turn rmem->base into a DMA address -* (especially if iommu translations ever get involved). Unfortunately, the -* DMA API currently does not allow mapping anything that is not backed with -* a struct page. -*/ +/* QMan needs two global memory areas initialized at boot time: +1) FQD: Frame Queue Descriptors used to manage frame queues +2) PFDR: Packed Frame Queue Descriptor Records used to store frames +Both areas are reserved using the device tree reserved memory framework +and the addresses and sizes are initialized when the QMan device is probed */ static dma_addr_t fqd_a, pfdr_a;static size_t fqd_sz, pfdr_sz; -static int qman_fqd (struct reserved_mem *rmem) -{ - fqd_a = rmem->base; - fqd_sz = rmem->size; - -WARN_ON (!(fqd_a && fqd_sz)); - -return 0 ; -} -RESERVEDMEM_OF_DECLARE (qman_fqd,"fsl,qman-fqd" , qman_fqd); - -static int qman_pfdr (struct reserved_mem *rmem) -{ - pfdr_a = rmem->base; - pfdr_sz = rmem->size; - -WARN_ON (!(pfdr_a && pfdr_sz)); - -return 0 ; -} -RESERVEDMEM_OF_DECLARE (qman_pfdr,"fsl,qman-pfdr" , qman_pfdr); -static unsigned int qm_get_fqid_maxcnt (void ) {return fqd_sz /64 ; } -/* -* Flush this memory range from data cache so that QMAN originated -* transactions for this memory region could be marked non-coherent. -*/ -static int zero_priv_mem (struct device *dev,struct device_node *node, -phys_addr_t addr,size_t sz) -{ -/* map as cacheable, non-guarded */ -void __iomem *tmpp =ioremap_prot (addr, sz,0 ); - -if (!tmpp) -return -ENOMEM ; - -memset_io (tmpp,0 , sz); -flush_dcache_range ((unsigned long )tmpp, - (unsigned long )tmpp + sz); -iounmap (tmpp); - -return 0 ; -} -static void log_edata_bits (struct device *dev,u32 bit_count) {u32 i, j, mask =0xffffffff ;
@@ -687,11 +643,12 @@ static int qman_resource_init(struct device *dev)static int fsl_qman_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -struct device_node *node = dev->of_node; +struct device_node *mem_node, *node = dev->of_node;struct resource *res;int ret, err_irq;u16 id;u8 major, minor; +u64 size; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!res) {
@@ -727,10 +684,66 @@ static int fsl_qman_probe(struct platform_device *pdev) qm_channel_caam =QMAN_CHANNEL_CAAM_REV3 ; } - ret =zero_priv_mem (dev, node, fqd_a, fqd_sz); -WARN_ON (ret); -if (ret) +/* Order of memory regions is assumed as FQD followed by PFDR +in order to ensure allocations from the correct regions the +driver initializes then allocates each piece in order */ + + ret =of_reserved_mem_device_init_by_idx (dev, dev->of_node,0 ); +if (ret) { +dev_err (dev,"of_reserved_mem_device_init_by_idx(0) failed 0x%x\n" , + ret); +return -ENODEV ; + } + mem_node =of_parse_phandle (dev->of_node,"memory-region" ,0 ); +if (mem_node) { + ret =of_property_read_u64 (mem_node,"size" , &size); +if (ret) { +dev_err (dev,"FQD: of_address_to_resource fails 0x%x\n" , ret); +return -ENODEV ; + } + fqd_sz = size; + }else { +dev_err (dev,"No memory-region found for FQD\n" ); +return -ENODEV ; + } +if (!dma_zalloc_coherent (dev, fqd_sz, &fqd_a,0 )) { +dev_err (dev,"Alloc FQD memory failed\n" ); +return -ENODEV ; + } + +dev_info (dev,"Allocated FQD 0x%llx 0x%zx\n" , fqd_a, fqd_sz); + +/* Disassociate the FQD reseverd memory area from the device because +a device can only have one DMA memory area. This should be fine +since the memory is allocated and initalized and only ever accessed +by the QMan device from now on */ +of_reserved_mem_device_release (dev); + +/* Setup PFDR memory */ + ret =of_reserved_mem_device_init_by_idx (dev, dev->of_node,1 ); +if (ret) { +dev_err (dev,"of_reserved_mem_device_init(1) failed 0x%x\n" , + ret); +return -ENODEV ; + } + mem_node =of_parse_phandle (dev->of_node,"memory-region" ,1 ); +if (mem_node) { + ret =of_property_read_u64 (mem_node,"size" , &size); +if (ret) { +dev_err (dev,"PFDR: of_address_to_resource fails 0x%x\n" , ret); +return -ENODEV ; + } + pfdr_sz = size; + }else { +dev_err (dev,"No memory-region found for PFDR\n" ); +return -ENODEV ; + } +if (!dma_zalloc_coherent (dev, pfdr_sz, &pfdr_a,0 )) { +dev_err (dev,"Alloc PFDR Failed size 0x%zx\n" , pfdr_sz);return -ENODEV ; + } + +dev_info (dev,"Allocated PFDR 0x%llx 0x%zx\n" , pfdr_a, pfdr_sz); ret =qman_init_ccsr (dev);if (ret) {
drivers/soc/fsl/qbman/qman_priv.h +2 -2
@@ -28,12 +28,12 @@* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt -#include "dpaa_sys.h" #include <soc/fsl/qman.h> #include <linux/iommu.h> +#include <linux/dma-contiguous.h> +#include <linux/of_address.h> #if defined(CONFIG_FSL_PAMU )#include <asm/fsl_pamu_stash.h>
drivers/soc/fsl/qbman/qman_test.h +0 -2
@@ -30,7 +30,5 @@#include "qman_priv.h" -#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt -int qman_test_stash (void );int qman_test_api (void );
Signature · 1 line
2.9.3
RFC PATCH 2/5 soc/fsl/qbman: Use shared-dma-pool for QMan private memory allocations
Hi Roy,
Quoted 2 lines · Roy Pledge
Use the shared-memory-pool mechanism for frame queue descriptor and packed frame descriptor record area allocations.
Thanks for persevering with this - in my opinion it's now looking like it was worth the effort :)
AFAICS the ioremap_wc() that this leads to does appear to give back something non-cacheable on PPC (assuming "pgprot_noncached_wc" isn't horrendously misnamed), and "no-map" should rule out any cacheable linear map alias existing, so it would seem that this approach should avert Scott's concerns about attribute mismatches.
Quoted 41 lines
Signed-off-by Roy Pledge <[email protected]>--- drivers/soc/fsl/qbman/qman_ccsr.c | 119 +++++++++++++++++++++----------------- drivers/soc/fsl/qbman/qman_priv.h | 4 +- drivers/soc/fsl/qbman/qman_test.h | 2 - 3 files changed, 68 insertions(+), 57 deletions(-)drivers/soc/fsl/qbman/qman_ccsr.c +5
-18@@ -400,63 +400,19 @@ static int qm_init_pfdr(struct device *dev, u32 pfdr_start, u32 num)return -ENODEV ; } -/* -* Ideally we would use the DMA API to turn rmem->base into a DMA address -* (especially if iommu translations ever get involved). Unfortunately, the -* DMA API currently does not allow mapping anything that is not backed with -* a struct page. -*/ +/* QMan needs two global memory areas initialized at boot time: +1) FQD: Frame Queue Descriptors used to manage frame queues +2) PFDR: Packed Frame Queue Descriptor Records used to store frames +Both areas are reserved using the device tree reserved memory framework +and the addresses and sizes are initialized when the QMan device is probed */ static dma_addr_t fqd_a, pfdr_a;static size_t fqd_sz, pfdr_sz; -static int qman_fqd (struct reserved_mem *rmem) -{ - fqd_a = rmem->base; - fqd_sz = rmem->size; - -WARN_ON (!(fqd_a && fqd_sz)); - -return 0 ; -} -RESERVEDMEM_OF_DECLARE (qman_fqd,"fsl,qman-fqd" , qman_fqd); - -static int qman_pfdr (struct reserved_mem *rmem)
drivers/soc/fsl/qbman/qman_ccsr.c static int qm_init_pfdr(struct device *dev, u32 pfdr_start, u32 num) · line 433
Quoted 10 lines
drivers/soc/fsl/qbman/qman_ccsr.c +0
-10-{ - pfdr_a = rmem->base; - pfdr_sz = rmem->size; - -WARN_ON (!(pfdr_a && pfdr_sz)); - -return 0 ; -} -RESERVEDMEM_OF_DECLARE (qman_pfdr,"fsl,qman-pfdr" , qman_pfdr); -
I notice that patch #1 isn't removing the equivalent bman_fbpr() handler and declaration as here - is that deliberate or just an oversight?
Quoted 55 lines
drivers/soc/fsl/qbman/qman_ccsr.c +7
-25static unsigned int qm_get_fqid_maxcnt (void ) {return fqd_sz /64 ; } -/* -* Flush this memory range from data cache so that QMAN originated -* transactions for this memory region could be marked non-coherent. -*/ -static int zero_priv_mem (struct device *dev,struct device_node *node, -phys_addr_t addr,size_t sz) -{ -/* map as cacheable, non-guarded */ -void __iomem *tmpp =ioremap_prot (addr, sz,0 ); - -if (!tmpp) -return -ENOMEM ; - -memset_io (tmpp,0 , sz); -flush_dcache_range ((unsigned long )tmpp, - (unsigned long )tmpp + sz); -iounmap (tmpp); - -return 0 ; -} -static void log_edata_bits (struct device *dev,u32 bit_count) {u32 i, j, mask =0xffffffff ;@@ -687,11 +643,12 @@ static int qman_resource_init(struct device *dev)static int fsl_qman_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -struct device_node *node = dev->of_node; +struct device_node *mem_node, *node = dev->of_node;struct resource *res;int ret, err_irq;u16 id;u8 major, minor; +u64 size; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!res) {@@ -727,10 +684,66 @@ static int fsl_qman_probe(struct platform_device *pdev) qm_channel_caam =QMAN_CHANNEL_CAAM_REV3 ; } - ret =zero_priv_mem (dev, node, fqd_a, fqd_sz); -WARN_ON (ret); -if (ret) +/* Order of memory regions is assumed as FQD followed by PFDR +in order to ensure allocations from the correct regions the +driver initializes then allocates each piece in order */ + + ret =of_reserved_mem_device_init_by_idx (dev, dev->of_node,0 );
drivers/soc/fsl/qbman/qman_ccsr.c static int fsl_qman_probe(struct platform_device *pdev) · line 701
Quoted 10 lines
drivers/soc/fsl/qbman/qman_ccsr.c +10
-0+if (ret) { +dev_err (dev,"of_reserved_mem_device_init_by_idx(0) failed 0x%x\n" , + ret); +return -ENODEV ; + } + mem_node =of_parse_phandle (dev->of_node,"memory-region" ,0 ); +if (mem_node) { + ret =of_property_read_u64 (mem_node,"size" , &size); +if (ret) { +dev_err (dev,"FQD: of_address_to_resource fails 0x%x\n" , ret);
Nit: of_address_to_resource?
drivers/soc/fsl/qbman/qman_ccsr.c static int fsl_qman_probe(struct platform_device *pdev) · line 712
Quoted 11 lines
drivers/soc/fsl/qbman/qman_ccsr.c +11
-0+return -ENODEV ; + } + fqd_sz = size; + }else { +dev_err (dev,"No memory-region found for FQD\n" ); +return -ENODEV ; + } +if (!dma_zalloc_coherent (dev, fqd_sz, &fqd_a,0 )) { +dev_err (dev,"Alloc FQD memory failed\n" ); +return -ENODEV ; + }
Between here, below, and patch #1, it looks like this "init, get size, alloc" pattern could be nicely factored out into a common helper function.
drivers/soc/fsl/qbman/qman_ccsr.c static int fsl_qman_probe(struct platform_device *pdev) · line 719
Quoted 7 lines
drivers/soc/fsl/qbman/qman_ccsr.c +7
-0+ +dev_info (dev,"Allocated FQD 0x%llx 0x%zx\n" , fqd_a, fqd_sz); + +/* Disassociate the FQD reseverd memory area from the device because +a device can only have one DMA memory area. This should be fine +since the memory is allocated and initalized and only ever accessed +by the QMan device from now on */
Typos: reserved, initialized.
drivers/soc/fsl/qbman/qman_ccsr.c static int fsl_qman_probe(struct platform_device *pdev) · line 720
Quoted 1 line
drivers/soc/fsl/qbman/qman_ccsr.c +1
-0+of_reserved_mem_device_release (dev);
I see the driver does not implement a .remove method where you would otherwise be technically expected to balance the allocation with a dma_free_coherent(), so I think this trick is acceptable. If anyone wants to change that in future, it wouldn't seem unreasonable to extend the core code to handle multiple areas per device (and at worst, I guess you could deviously juggle dev->dma_mem around the DMA API calls).
Other than those first few nits, and any possible PPC-specific angles I'm not aware of, I think the series is looking good!
Thanks,
Robin.
Quoted 61 lines
drivers/soc/fsl/qbman/qman_ccsr.c +25
-0+ +/* Setup PFDR memory */ + ret =of_reserved_mem_device_init_by_idx (dev, dev->of_node,1 ); +if (ret) { +dev_err (dev,"of_reserved_mem_device_init(1) failed 0x%x\n" , + ret); +return -ENODEV ; + } + mem_node =of_parse_phandle (dev->of_node,"memory-region" ,1 ); +if (mem_node) { + ret =of_property_read_u64 (mem_node,"size" , &size); +if (ret) { +dev_err (dev,"PFDR: of_address_to_resource fails 0x%x\n" , ret); +return -ENODEV ; + } + pfdr_sz = size; + }else { +dev_err (dev,"No memory-region found for PFDR\n" ); +return -ENODEV ; + } +if (!dma_zalloc_coherent (dev, pfdr_sz, &pfdr_a,0 )) { +dev_err (dev,"Alloc PFDR Failed size 0x%zx\n" , pfdr_sz);return -ENODEV ; + } + +dev_info (dev,"Allocated PFDR 0x%llx 0x%zx\n" , pfdr_a, pfdr_sz); ret =qman_init_ccsr (dev);if (ret) {drivers/soc/fsl/qbman/qman_priv.h +2
-2@@ -28,12 +28,12 @@* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt -#include "dpaa_sys.h" #include <soc/fsl/qman.h> #include <linux/iommu.h> +#include <linux/dma-contiguous.h> +#include <linux/of_address.h> #if defined(CONFIG_FSL_PAMU )#include <asm/fsl_pamu_stash.h> drivers/soc/fsl/qbman/qman_test.h +0
-2@@ -30,7 +30,5 @@#include "qman_priv.h" -#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt -int qman_test_stash (void );int qman_test_api (void );
Michael Ellerman
reviewerRFC PATCH 2/5 soc/fsl/qbman: Use shared-dma-pool for QMan private memory allocations
Quoted 6 lines · Robin Murphy
Hi Roy,
Quoted 2 lines · Roy Pledge
Use the shared-memory-pool mechanism for frame queue descriptor and packed frame descriptor record area allocations.
Quoted 8 lines
Thanks for persevering with this - in my opinion it's now looking like it was worth the effort :)
AFAICS the
ioremap_wc()that this leads to does appear to give back something non-cacheable on PPC (assuming "pgprot_noncached_wc" isn't horrendously misnamed), and "no-map" should rule out any cacheable linear map alias existing, so it would seem that this approach should avert Scott's concerns about attribute mismatches.
How does 'no-map' translate into something being excluded from the linear mapping?
cheers
RFC PATCH 2/5 soc/fsl/qbman: Use shared-dma-pool for QMan private memory allocations
Quoted 11 lines · Michael Ellerman
Quoted 9 lines · Robin Murphy
Hi Roy,
Quoted 2 lines · Roy Pledge
Use the shared-memory-pool mechanism for frame queue descriptor and packed frame descriptor record area allocations.
Thanks for persevering with this - in my opinion it's now looking like it was worth the effort :)
Quoted 8 lines
Quoted 5 lines
AFAICS the
ioremap_wc()that this leads to does appear to give back something non-cacheable on PPC (assuming "pgprot_noncached_wc" isn't horrendously misnamed), and "no-map" should rule out any cacheable linear map alias existing, so it would seem that this approach should avert Scott's concerns about attribute mismatches.How does 'no-map' translate into something being excluded from the linear mapping?
Reserved regions marked with "no-map" get memblock_remove()d by early_init_dt_alloc_reserved_memory_arch(). As I understand things, the linear map should only cover memblock areas, and it would be explicitly violating the semantics of "no-map" to still cover such a region.
Robin.
Quoted 3 lines
cheers
RFC PATCH 2/5 soc/fsl/qbman: Use shared-dma-pool for QMan private memory allocations
Quoted 19 lines · Robin Murphy
Quoted 18 lines · Michael Ellerman
Quoted 15 lines · Robin Murphy
Hi Roy,
Quoted 3 lines · Roy Pledge
Use the shared-memory-pool mechanism for frame queue descriptor and packed frame descriptor record area allocations.
Thanks for persevering with this - in my opinion it's now looking like it was worth the effort :)
AFAICS the
ioremap_wc()that this leads to does appear to give back something non-cacheable on PPC (assuming "pgprot_noncached_wc" isn't horrendously misnamed), and "no-map" should rule out any cacheable linear map alias existing, so it would seem that this approach should avert Scott's concerns about attribute mismatches.
Quoted 6 lines
Quoted 2 lines
How does 'no-map' translate into something being excluded from the linear mapping?
Reserved regions marked with "no-map" get memblock_remove()d by
early_init_dt_alloc_reserved_memory_arch(). As I understand things, the linear map should only cover memblock areas, and it would be explicitly violating the semantics of "no-map" to still cover such a region.
Discontiguous memory isn't supported on these PPC chips. ?Everything up to memblock_end_of_DRAM() gets mapped -- and if that were to change, the fragmentation would waste TLB1 entries.
This also breaks compatibility with existing device trees. ?I suggest putting an ifdef in the qbman driver to add the new scheme for non-PPC arches only.
-Scott
RFC PATCH 2/5 soc/fsl/qbman: Use shared-dma-pool for QMan private memory allocations
Quoted 22 lines · Scott Wood
Quoted 21 lines · Robin Murphy
Quoted 20 lines · Michael Ellerman
Quoted 7 lines · Robin Murphy
Hi Roy,
Quoted 3 lines · Roy Pledge
Use the shared-memory-pool mechanism for frame queue descriptor and packed frame descriptor record area allocations.
Quoted 8 lines
Thanks for persevering with this - in my opinion it's now looking like it was worth the effort :)
AFAICS the
ioremap_wc()that this leads to does appear to give back something non-cacheable on PPC (assuming "pgprot_noncached_wc" isn't horrendously misnamed), and "no-map" should rule out any cacheable linear map alias existing, so it would seem that this approach should avert Scott's concerns about attribute mismatches.How does 'no-map' translate into something being excluded from the linear mapping?
Quoted 8 lines
Quoted 4 lines
Reserved regions marked with "no-map" get memblock_remove()d by
early_init_dt_alloc_reserved_memory_arch(). As I understand things, the linear map should only cover memblock areas, and it would be explicitly violating the semantics of "no-map" to still cover such a region.Discontiguous memory isn't supported on these PPC chips. Everything up to
memblock_end_of_DRAM()gets mapped -- and if that were to change, the fragmentation would waste TLB1 entries.
Ah, so the "PPC-specific angles I'm not aware of" category is indeed non-empty - I guess the lack of HAVE_GENERIC_DMA_COHERENT might be related, then.
That said, though, AFAICS only certain x86 and s390 configurations ever call memblock_set_bottom_up(true), so we should be able to assume that the reserved region allocations always fall through to __memblock_find_range_top_down(). Thus if your DRAM is contiguous, then "no-map"-ing the reserved regions will simply end up pushing memblock_end_of_DRAM() down in a manner that would appear to still avoid overlaps. I can only see that going wrong if the end of DRAM wasn't at least 32MB aligned to begin with - is that ever likely to happen in practice?
Robin.
Quoted 5 lines
This also breaks compatibility with existing device trees. I suggest putting an ifdef in the qbman driver to add the new scheme for non-PPC arches only.
-Scott
RFC PATCH 2/5 soc/fsl/qbman: Use shared-dma-pool for QMan private memory allocations
Quoted 42 lines · Robin Murphy
Quoted 30 lines · Scott Wood
Quoted 28 lines · Robin Murphy
Quoted 26 lines · Michael Ellerman
Quoted 14 lines · Robin Murphy
Hi Roy,
Quoted 5 lines · Roy Pledge
Use the shared-memory-pool mechanism for frame queue descriptor and
packed frame descriptor record area allocations.Thanks for persevering with this - in my opinion it's now looking like
it was worth the effort :)Quoted 6 lines
AFAICS the
ioremap_wc()that this leads to does appear to give back something non-cacheable on PPC (assuming "pgprot_noncached_wc" isn't horrendously misnamed), and "no-map" should rule out any cacheable linear map alias existing, so it would seem that this approach should
avert Scott's concerns about attribute mismatches.How does 'no-map' translate into something being excluded from the linear mapping?
Quoted 7 lines
Quoted 4 lines
Reserved regions marked with "no-map" get memblock_remove()d by
early_init_dt_alloc_reserved_memory_arch(). As I understand things, the linear map should only cover memblock areas, and it would be explicitly violating the semantics of "no-map" to still cover such a region.Discontiguous memory isn't supported on these PPC chips.??Everything up to
memblock_end_of_DRAM()gets mapped -- and if that were to change, the fragmentation would waste TLB1 entries.Ah, so the "PPC-specific angles I'm not aware of" category is indeed non-empty - I guess the lack of
HAVE_GENERIC_DMA_COHERENTmight be related, then.
Quoted 7 lines
That said, though, AFAICS only certain x86 and s390 configurations ever call
memblock_set_bottom_up(true), so we should be able to assume that the reserved region allocations always fall through to__memblock_find_range_top_down(). Thus if your DRAM is contiguous, then "no-map"-ing the reserved regions will simply end up pushingmemblock_end_of_DRAM()down in a manner that would appear to still avoid overlaps.
Can you guarantee it will be at the end? ?What if there were other early memblock allocations (e.g. other reserved-memory regions without no-map) that came first?
Quoted 3 lines
I can only see that going wrong if the end of DRAM wasn't at
least 32MB aligned to begin with - is that ever likely to happen in practice?
Probably not, unless the user asks for an unusual memory size via mem= or similar.
-Scott
RFC PATCH 3/5 dts: arch/powerpc: Update Freescale DTS for QBMan memory allocations
In reply to Roy PledgeQBMan now uses the shared-dma-pool mechansim to manage early memory reservations.
--- arch/powerpc/boot/dts/fsl/b4qds.dtsi | 6 ++++++ arch/powerpc/boot/dts/fsl/b4si-post.dtsi | 15 --------------- arch/powerpc/boot/dts/fsl/cyrus_p5020.dts | 6 ++++++ arch/powerpc/boot/dts/fsl/kmcent2.dts | 6 ++++++ arch/powerpc/boot/dts/fsl/kmcoge4.dts | 6 ++++++ arch/powerpc/boot/dts/fsl/oca4080.dts | 6 ++++++ arch/powerpc/boot/dts/fsl/p1023rdb.dts | 6 ++++++ arch/powerpc/boot/dts/fsl/p1023si-post.dtsi | 15 --------------- arch/powerpc/boot/dts/fsl/p2041rdb.dts | 6 ++++++ arch/powerpc/boot/dts/fsl/p2041si-post.dtsi | 15 --------------- arch/powerpc/boot/dts/fsl/p3041ds.dts | 6 ++++++ arch/powerpc/boot/dts/fsl/p3041si-post.dtsi | 15 --------------- arch/powerpc/boot/dts/fsl/p4080ds.dts | 6 ++++++ arch/powerpc/boot/dts/fsl/p4080si-post.dtsi | 15 --------------- arch/powerpc/boot/dts/fsl/p5020ds.dts | 6 ++++++ arch/powerpc/boot/dts/fsl/p5020si-post.dtsi | 15 --------------- arch/powerpc/boot/dts/fsl/p5040ds.dts | 6 ++++++ arch/powerpc/boot/dts/fsl/p5040si-post.dtsi | 15 --------------- arch/powerpc/boot/dts/fsl/t1023rdb.dts | 6 ++++++ arch/powerpc/boot/dts/fsl/t1023si-post.dtsi | 15 --------------- arch/powerpc/boot/dts/fsl/t1024qds.dts | 6 ++++++ arch/powerpc/boot/dts/fsl/t1024rdb.dts | 6 ++++++ arch/powerpc/boot/dts/fsl/t1040si-post.dtsi | 15 --------------- arch/powerpc/boot/dts/fsl/t104xd4rdb.dtsi | 6 ++++++ arch/powerpc/boot/dts/fsl/t104xqds.dtsi | 6 ++++++ arch/powerpc/boot/dts/fsl/t104xrdb.dtsi | 6 ++++++ arch/powerpc/boot/dts/fsl/t2081si-post.dtsi | 15 --------------- arch/powerpc/boot/dts/fsl/t208xqds.dtsi | 6 ++++++ arch/powerpc/boot/dts/fsl/t208xrdb.dtsi | 6 ++++++ arch/powerpc/boot/dts/fsl/t4240qds.dts | 6 ++++++ arch/powerpc/boot/dts/fsl/t4240rdb.dts | 6 ++++++ arch/powerpc/boot/dts/fsl/t4240si-post.dtsi | 15 --------------- 32 files changed, 126 insertions(+), 165 deletions(-)
arch/powerpc/boot/dts/fsl/b4qds.dtsi +6 -0
@@ -110,16 +110,22 @@ ranges; bman_fbpr: bman-fbpr { + compatible = "shared-dma-pool"; size = <0 0x1000000>; alignment = <0 0x1000000>; + no-map; }; qman_fqd: qman-fqd { + compatible = "shared-dma-pool"; size = <0 0x400000>; alignment = <0 0x400000>; + no-map; }; qman_pfdr: qman-pfdr { + compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; + no-map; }; };
arch/powerpc/boot/dts/fsl/b4si-post.dtsi +0 -15
@@ -32,21 +32,6 @@ * this software, even if advised of the possibility of such damage. */ -&bman_fbpr { - compatible = "fsl,bman-fbpr"; - alloc-ranges = <0 0 0x10000 0>; -}; - -&qman_fqd { - compatible = "fsl,qman-fqd"; - alloc-ranges = <0 0 0x10000 0>; -}; - -&qman_pfdr { - compatible = "fsl,qman-pfdr"; - alloc-ranges = <0 0 0x10000 0>; -}; - &ifc { #address-cells = <2>; #size-cells = <1>;
arch/powerpc/boot/dts/fsl/cyrus_p5020.dts +6 -0
@@ -31,16 +31,22 @@ ranges; bman_fbpr: bman-fbpr { + compatible = "shared-dma-pool"; size = <0 0x1000000>; alignment = <0 0x1000000>; + no-map; }; qman_fqd: qman-fqd { + compatible = "shared-dma-pool"; size = <0 0x400000>; alignment = <0 0x400000>; + no-map; }; qman_pfdr: qman-pfdr { + compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; + no-map; }; };
arch/powerpc/boot/dts/fsl/kmcent2.dts +6 -0
@@ -28,16 +28,22 @@ ranges; bman_fbpr: bman-fbpr { + compatible = "shared-dma-pool"; size = <0 0x1000000>; alignment = <0 0x1000000>; + no-map; }; qman_fqd: qman-fqd { + compatible = "shared-dma-pool"; size = <0 0x400000>; alignment = <0 0x400000>; + no-map; }; qman_pfdr: qman-pfdr { + compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; + no-map; }; };
arch/powerpc/boot/dts/fsl/kmcoge4.dts +6 -0
@@ -31,16 +31,22 @@ ranges; bman_fbpr: bman-fbpr { + compatible = "shared-dma-pool"; size = <0 0x1000000>; alignment = <0 0x1000000>; + no-map; }; qman_fqd: qman-fqd { + compatible = "shared-dma-pool"; size = <0 0x400000>; alignment = <0 0x400000>; + no-map; }; qman_pfdr: qman-pfdr { + compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; + no-map; }; };
arch/powerpc/boot/dts/fsl/oca4080.dts +6 -0
@@ -55,16 +55,22 @@ ranges; bman_fbpr: bman-fbpr { + compatible = "shared-dma-pool"; size = <0 0x1000000>; alignment = <0 0x1000000>; + no-map; }; qman_fqd: qman-fqd { + compatible = "shared-dma-pool"; size = <0 0x400000>; alignment = <0 0x400000>; + no-map; }; qman_pfdr: qman-pfdr { + compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; + no-map; }; };
arch/powerpc/boot/dts/fsl/p1023rdb.dts +6 -0
@@ -53,16 +53,22 @@ ranges; bman_fbpr: bman-fbpr { + compatible = "shared-dma-pool"; size = <0 0x1000000>; alignment = <0 0x1000000>; + no-map; }; qman_fqd: qman-fqd { + compatible = "shared-dma-pool"; size = <0 0x400000>; alignment = <0 0x400000>; + no-map; }; qman_pfdr: qman-pfdr { + compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; + no-map; }; };
arch/powerpc/boot/dts/fsl/p1023si-post.dtsi +0 -15
@@ -32,21 +32,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -&bman_fbpr { - compatible = "fsl,bman-fbpr"; - alloc-ranges = <0 0 0x10 0>; -}; - -&qman_fqd { - compatible = "fsl,qman-fqd"; - alloc-ranges = <0 0 0x10 0>; -}; - -&qman_pfdr { - compatible = "fsl,qman-pfdr"; - alloc-ranges = <0 0 0x10 0>; -}; - &lbc { #address-cells = <2>; #size-cells = <1>;
arch/powerpc/boot/dts/fsl/p2041rdb.dts +6 -0
@@ -64,16 +64,22 @@ ranges; bman_fbpr: bman-fbpr { + compatible = "shared-dma-pool"; size = <0 0x1000000>; alignment = <0 0x1000000>; + no-map; }; qman_fqd: qman-fqd { + compatible = "shared-dma-pool"; size = <0 0x400000>; alignment = <0 0x400000>; + no-map; }; qman_pfdr: qman-pfdr { + compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; + no-map; }; };
arch/powerpc/boot/dts/fsl/p2041si-post.dtsi +0 -15
@@ -32,21 +32,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -&bman_fbpr { - compatible = "fsl,bman-fbpr"; - alloc-ranges = <0 0 0x10 0>; -}; - -&qman_fqd { - compatible = "fsl,qman-fqd"; - alloc-ranges = <0 0 0x10 0>; -}; - -&qman_pfdr { - compatible = "fsl,qman-pfdr"; - alloc-ranges = <0 0 0x10 0>; -}; - &lbc { compatible = "fsl,p2041-elbc", "fsl,elbc", "simple-bus"; interrupts = <25 2 0 0>;
arch/powerpc/boot/dts/fsl/p3041ds.dts +6 -0
@@ -65,16 +65,22 @@ ranges; bman_fbpr: bman-fbpr { + compatible = "shared-dma-pool"; size = <0 0x1000000>; alignment = <0 0x1000000>; + no-map; }; qman_fqd: qman-fqd { + compatible = "shared-dma-pool"; size = <0 0x400000>; alignment = <0 0x400000>; + no-map; }; qman_pfdr: qman-pfdr { + compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; + no-map; }; };
arch/powerpc/boot/dts/fsl/p3041si-post.dtsi +0 -15
@@ -32,21 +32,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -&bman_fbpr { - compatible = "fsl,bman-fbpr"; - alloc-ranges = <0 0 0x10 0>; -}; - -&qman_fqd { - compatible = "fsl,qman-fqd"; - alloc-ranges = <0 0 0x10 0>; -}; - -&qman_pfdr { - compatible = "fsl,qman-pfdr"; - alloc-ranges = <0 0 0x10 0>; -}; - &lbc { compatible = "fsl,p3041-elbc", "fsl,elbc", "simple-bus"; interrupts = <25 2 0 0>;
arch/powerpc/boot/dts/fsl/p4080ds.dts +6 -0
@@ -65,16 +65,22 @@ ranges; bman_fbpr: bman-fbpr { + compatible = "shared-dma-pool"; size = <0 0x1000000>; alignment = <0 0x1000000>; + no-map; }; qman_fqd: qman-fqd { + compatible = "shared-dma-pool"; size = <0 0x400000>; alignment = <0 0x400000>; + no-map; }; qman_pfdr: qman-pfdr { + compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; + no-map; }; };
arch/powerpc/boot/dts/fsl/p4080si-post.dtsi +0 -15
@@ -32,21 +32,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -&bman_fbpr { - compatible = "fsl,bman-fbpr"; - alloc-ranges = <0 0 0x10 0>; -}; - -&qman_fqd { - compatible = "fsl,qman-fqd"; - alloc-ranges = <0 0 0x10 0>; -}; - -&qman_pfdr { - compatible = "fsl,qman-pfdr"; - alloc-ranges = <0 0 0x10 0>; -}; - &lbc { compatible = "fsl,p4080-elbc", "fsl,elbc", "simple-bus"; interrupts = <25 2 0 0>;
arch/powerpc/boot/dts/fsl/p5020ds.dts +6 -0
@@ -65,16 +65,22 @@ ranges; bman_fbpr: bman-fbpr { + compatible = "shared-dma-pool"; size = <0 0x1000000>; alignment = <0 0x1000000>; + no-map; }; qman_fqd: qman-fqd { + compatible = "shared-dma-pool"; size = <0 0x400000>; alignment = <0 0x400000>; + no-map; }; qman_pfdr: qman-pfdr { + compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; + no-map; }; };
arch/powerpc/boot/dts/fsl/p5020si-post.dtsi +0 -15
@@ -32,21 +32,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -&bman_fbpr { - compatible = "fsl,bman-fbpr"; - alloc-ranges = <0 0 0x10000 0>; -}; - -&qman_fqd { - compatible = "fsl,qman-fqd"; - alloc-ranges = <0 0 0x10000 0>; -}; - -&qman_pfdr { - compatible = "fsl,qman-pfdr"; - alloc-ranges = <0 0 0x10000 0>; -}; - &lbc { compatible = "fsl,p5020-elbc", "fsl,elbc", "simple-bus"; interrupts = <25 2 0 0>;
arch/powerpc/boot/dts/fsl/p5040ds.dts +6 -0
@@ -77,16 +77,22 @@ ranges; bman_fbpr: bman-fbpr { + compatible = "shared-dma-pool"; size = <0 0x1000000>; alignment = <0 0x1000000>; + no-map; }; qman_fqd: qman-fqd { + compatible = "shared-dma-pool"; size = <0 0x400000>; alignment = <0 0x400000>; + no-map; }; qman_pfdr: qman-pfdr { + compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; + no-map; }; };
arch/powerpc/boot/dts/fsl/p5040si-post.dtsi +0 -15
@@ -32,21 +32,6 @@ * software, even if advised of the possibility of such damage. */ -&bman_fbpr { - compatible = "fsl,bman-fbpr"; - alloc-ranges = <0 0 0x10000 0>; -}; - -&qman_fqd { - compatible = "fsl,qman-fqd"; - alloc-ranges = <0 0 0x10000 0>; -}; - -&qman_pfdr { - compatible = "fsl,qman-pfdr"; - alloc-ranges = <0 0 0x10000 0>; -}; - &lbc { compatible = "fsl,p5040-elbc", "fsl,elbc", "simple-bus"; interrupts = <25 2 0 0>;
arch/powerpc/boot/dts/fsl/t1023rdb.dts +6 -0
@@ -47,18 +47,24 @@ ranges; bman_fbpr: bman-fbpr { + compatible = "shared-dma-pool"; size = <0 0x1000000>; alignment = <0 0x1000000>; + no-map; }; qman_fqd: qman-fqd { + compatible = "shared-dma-pool"; size = <0 0x400000>; alignment = <0 0x400000>; + no-map; }; qman_pfdr: qman-pfdr { + compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; + no-map; }; };
arch/powerpc/boot/dts/fsl/t1023si-post.dtsi +0 -15
@@ -34,21 +34,6 @@ #include <dt-bindings/thermal/thermal.h> -&bman_fbpr { - compatible = "fsl,bman-fbpr"; - alloc-ranges = <0 0 0x10000 0>; -}; - -&qman_fqd { - compatible = "fsl,qman-fqd"; - alloc-ranges = <0 0 0x10000 0>; -}; - -&qman_pfdr { - compatible = "fsl,qman-pfdr"; - alloc-ranges = <0 0 0x10000 0>; -}; - &ifc { #address-cells = <2>; #size-cells = <1>;
arch/powerpc/boot/dts/fsl/t1024qds.dts +6 -0
@@ -47,18 +47,24 @@ ranges; bman_fbpr: bman-fbpr { + compatible = "shared-dma-pool"; size = <0 0x1000000>; alignment = <0 0x1000000>; + no-map; }; qman_fqd: qman-fqd { + compatible = "shared-dma-pool"; size = <0 0x400000>; alignment = <0 0x400000>; + no-map; }; qman_pfdr: qman-pfdr { + compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; + no-map; }; };
arch/powerpc/boot/dts/fsl/t1024rdb.dts +6 -0
@@ -51,18 +51,24 @@ ranges; bman_fbpr: bman-fbpr { + compatible = "shared-dma-pool"; size = <0 0x1000000>; alignment = <0 0x1000000>; + no-map; }; qman_fqd: qman-fqd { + compatible = "shared-dma-pool"; size = <0 0x400000>; alignment = <0 0x400000>; + no-map; }; qman_pfdr: qman-pfdr { + compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; + no-map; }; };
arch/powerpc/boot/dts/fsl/t1040si-post.dtsi +0 -15
@@ -34,21 +34,6 @@ #include <dt-bindings/thermal/thermal.h> -&bman_fbpr { - compatible = "fsl,bman-fbpr"; - alloc-ranges = <0 0 0x10000 0>; -}; - -&qman_fqd { - compatible = "fsl,qman-fqd"; - alloc-ranges = <0 0 0x10000 0>; -}; - -&qman_pfdr { - compatible = "fsl,qman-pfdr"; - alloc-ranges = <0 0 0x10000 0>; -}; - &ifc { #address-cells = <2>; #size-cells = <1>;
arch/powerpc/boot/dts/fsl/t104xd4rdb.dtsi +6 -0
@@ -39,16 +39,22 @@ ranges; bman_fbpr: bman-fbpr { + compatible = "shared-dma-pool"; size = <0 0x1000000>; alignment = <0 0x1000000>; + no-map; }; qman_fqd: qman-fqd { + compatible = "shared-dma-pool"; size = <0 0x400000>; alignment = <0 0x400000>; + no-map; }; qman_pfdr: qman-pfdr { + compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; + no-map; }; };
arch/powerpc/boot/dts/fsl/t104xqds.dtsi +6 -0
@@ -71,16 +71,22 @@ ranges; bman_fbpr: bman-fbpr { + compatible = "shared-dma-pool"; size = <0 0x1000000>; alignment = <0 0x1000000>; + no-map; }; qman_fqd: qman-fqd { + compatible = "shared-dma-pool"; size = <0 0x400000>; alignment = <0 0x400000>; + no-map; }; qman_pfdr: qman-pfdr { + compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; + no-map }; };
arch/powerpc/boot/dts/fsl/t104xrdb.dtsi +6 -0
@@ -45,16 +45,22 @@ ranges; bman_fbpr: bman-fbpr { + compatible = "shared-dma-pool"; size = <0 0x1000000>; alignment = <0 0x1000000>; + no-map; }; qman_fqd: qman-fqd { + compatible = "shared-dma-pool"; size = <0 0x400000>; alignment = <0 0x400000>; + no-map; }; qman_pfdr: qman-pfdr { + compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; + no-map; }; };
arch/powerpc/boot/dts/fsl/t2081si-post.dtsi +0 -15
@@ -32,21 +32,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -&bman_fbpr { - compatible = "fsl,bman-fbpr"; - alloc-ranges = <0 0 0x10000 0>; -}; - -&qman_fqd { - compatible = "fsl,qman-fqd"; - alloc-ranges = <0 0 0x10000 0>; -}; - -&qman_pfdr { - compatible = "fsl,qman-pfdr"; - alloc-ranges = <0 0 0x10000 0>; -}; - &ifc { #address-cells = <2>; #size-cells = <1>;
arch/powerpc/boot/dts/fsl/t208xqds.dtsi +6 -0
@@ -45,16 +45,22 @@ ranges; bman_fbpr: bman-fbpr { + compatible = "shared-dma-pool"; size = <0 0x1000000>; alignment = <0 0x1000000>; + no-map; }; qman_fqd: qman-fqd { + compatible = "shared-dma-pool"; size = <0 0x400000>; alignment = <0 0x400000>; + no-map; }; qman_pfdr: qman-pfdr { + compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; + no-map; }; };
arch/powerpc/boot/dts/fsl/t208xrdb.dtsi +6 -0
@@ -45,16 +45,22 @@ ranges; bman_fbpr: bman-fbpr { + compatible = "shared-dma-pool"; size = <0 0x1000000>; alignment = <0 0x1000000>; + no-map; }; qman_fqd: qman-fqd { + compatible = "shared-dma-pool"; size = <0 0x400000>; alignment = <0 0x400000>; + no-map; }; qman_pfdr: qman-pfdr { + compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; + no-map; }; };
arch/powerpc/boot/dts/fsl/t4240qds.dts +6 -0
@@ -326,16 +326,22 @@ ranges; bman_fbpr: bman-fbpr { + compatible = "shared-dma-pool"; size = <0 0x1000000>; alignment = <0 0x1000000>; + no-map; }; qman_fqd: qman-fqd { + compatible = "shared-dma-pool"; size = <0 0x400000>; alignment = <0 0x400000>; + no-map; }; qman_pfdr: qman-pfdr { + compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; + no-map; }; };
arch/powerpc/boot/dts/fsl/t4240rdb.dts +6 -0
@@ -86,16 +86,22 @@ ranges; bman_fbpr: bman-fbpr { + compatible = "shared-dma-pool"; size = <0 0x1000000>; alignment = <0 0x1000000>; + no-map; }; qman_fqd: qman-fqd { + compatible = "shared-dma-pool"; size = <0 0x400000>; alignment = <0 0x400000>; + no-map; }; qman_pfdr: qman-pfdr { + compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; + no-map; }; };
arch/powerpc/boot/dts/fsl/t4240si-post.dtsi +0 -15
@@ -32,21 +32,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -&bman_fbpr { - compatible = "fsl,bman-fbpr"; - alloc-ranges = <0 0 0x10000 0>; -}; - -&qman_fqd { - compatible = "fsl,qman-fqd"; - alloc-ranges = <0 0 0x10000 0>; -}; - -&qman_pfdr { - compatible = "fsl,qman-pfdr"; - alloc-ranges = <0 0 0x10000 0>; -}; - &ifc { #address-cells = <2>; #size-cells = <1>;
Signature · 1 line
2.9.3
RFC PATCH 4/5 dt-bindings: soc/fsl: Update reserved memory binding for QBMan
In reply to Roy PledgeUpdates the QMan and BMan device tree bindings for reserved memory nodes. This makes the reserved memory allocation compatiable with the shared-dma-pool usage.
--- Documentation/devicetree/bindings/soc/fsl/bman.txt | 10 +++++----- Documentation/devicetree/bindings/soc/fsl/qman.txt | 16 +++++++++------- 2 files changed, 14 insertions(+), 12 deletions(-)
Documentation/devicetree/bindings/soc/fsl/bman.txt +5 -5
@@ -65,8 +65,8 @@ to the respective BMan instance BMan Private Memory Node BMan requires a contiguous range of physical memory used for the backing store -for BMan Free Buffer Proxy Records (FBPR). This memory is reserved/allocated as a -node under the /reserved-memory node +for BMan Free Buffer Proxy Records (FBPR). This memory is reserved/allocated as +a node under the /reserved-memory node. The BMan FBPR memory node must be named "bman-fbpr"
@@ -75,7 +75,7 @@ PROPERTIES - compatible Usage: required Value type: <stringlist> - Definition: Must inclide "fsl,bman-fbpr" + Definition: Must include "shared-mem-pool" The following constraints are relevant to the FBPR private memory: - The size must be 2^(size + 1), with size = 11..33. That is 4 KiB to
@@ -100,10 +100,10 @@ The example below shows a BMan FBPR dynamic allocation memory node ranges; bman_fbpr: bman-fbpr { - compatible = "fsl,bman-fbpr"; - alloc-ranges = <0 0 0x10 0>; + compatible = "shared-mem-pool"; size = <0 0x1000000>; alignment = <0 0x1000000>; + no-map; }; };
Documentation/devicetree/bindings/soc/fsl/qman.txt +9 -7
@@ -74,7 +74,9 @@ QMan Private Memory Nodes QMan requires two contiguous range of physical memory used for the backing store for QMan Frame Queue Descriptor (FQD) and Packed Frame Descriptor Record (PFDR). -This memory is reserved/allocated as a nodes under the /reserved-memory node +This memory is reserved/allocated as a node under the /reserved-memory node. + +For additional details about reserved memory regions see reserved-memory.txt The QMan FQD memory node must be named "qman-fqd"
@@ -83,7 +85,7 @@ PROPERTIES - compatible Usage: required Value type: <stringlist> - Definition: Must inclide "fsl,qman-fqd" + Definition: Must include "shared-dma-pool" The QMan PFDR memory node must be named "qman-pfdr"
@@ -92,7 +94,7 @@ PROPERTIES - compatible Usage: required Value type: <stringlist> - Definition: Must inclide "fsl,qman-pfdr" + Definition: Must include "shared-dma-pool" The following constraints are relevant to the FQD and PFDR private memory: - The size must be 2^(size + 1), with size = 11..29. That is 4 KiB to
@@ -117,16 +119,16 @@ The example below shows a QMan FQD and a PFDR dynamic allocation memory nodes ranges; qman_fqd: qman-fqd { - compatible = "fsl,qman-fqd"; - alloc-ranges = <0 0 0x10 0>; + compatible = "shared-dma-pool"; size = <0 0x400000>; alignment = <0 0x400000>; + no-map; }; qman_pfdr: qman-pfdr { - compatible = "fsl,qman-pfdr"; - alloc-ranges = <0 0 0x10 0>; + compatible = "shared-dma-pool"; size = <0 0x2000000>; alignment = <0 0x2000000>; + no-map; }; };
Signature · 1 line
2.9.3
Rob Herring
maintainerRFC PATCH 4/5 dt-bindings: soc/fsl: Update reserved memory binding for QBMan
Quoted 2 lines · Roy Pledge
Updates the QMan and BMan device tree bindings for reserved memory nodes. This makes the reserved memory allocation compatiable with
s/compatiable/compatible/
Quoted 1 line
the shared-dma-pool usage.
This change is not backwards compatible. Please state that and explain why that is okay. If PPC needs to not change, then the old strings and properties should remain, but deprecated.
Quoted 6 lines
Signed-off-by Roy Pledge <[email protected]>--- Documentation/devicetree/bindings/soc/fsl/bman.txt | 10 +++++----- Documentation/devicetree/bindings/soc/fsl/qman.txt | 16 +++++++++------- 2 files changed, 14 insertions(+), 12 deletions(-)
RFC PATCH 4/5 dt-bindings: soc/fsl: Update reserved memory binding for QBMan
Quoted 9 lines · Rob Herring
Quoted 2 lines · Roy Pledge
Updates the QMan and BMan device tree bindings for reserved memory nodes. This makes the reserved memory allocation compatiable with
s/compatiable/compatible/
Quoted 1 line
the shared-dma-pool usage.
This change is not backwards compatible. Please state that and explain why that is okay. If PPC needs to not change, then the old strings and properties should remain, but deprecated.
I think I can make the old device trees compatible since the "compatible" string changed without too much effort or ifdefery in the code. However I would like to eventually see all PPC users move to the new mode as I do believe it is more in alignment with the spirit of the reserved-memory framework that is in the kernel. Do I need to mention the old mode in the binding.txt file? I'm trying to keep things clean so someone reading the binding doesn't get a headache and trying to preserve my own sanity as we move forward with adding new features to this driver.
Roy
RFC PATCH 4/5 dt-bindings: soc/fsl: Update reserved memory binding for QBMan
Quoted 10 lines · Roy Pledge
Quoted 9 lines · Rob Herring
Quoted 3 lines · Roy Pledge
Updates the QMan and BMan device tree bindings for reserved memory nodes. This makes the reserved memory allocation compatiable with
s/compatiable/compatible/
Quoted 2 lines
the shared-dma-pool usage.
Quoted 8 lines
Quoted 3 lines
This change is not backwards compatible. Please state that and explain? why that is okay. If PPC needs to not change, then the old strings and? properties should remain, but deprecated.
I think I can make the old device trees compatible since the "compatible" string changed without too much effort or ifdefery in the code. ?However I would like to eventually see all PPC users move to the new mode as I do believe it is more in alignment with the spirit of the reserved-memory framework that is in the kernel.
How much benefit is there to changing PPC if you have to retain the old method anyway for compatibility? ?Whereas if you don't convert, you retain test coverage for the old device trees, and don't have to worry about the?memblock_end_of_DRAM() questions.
Quoted 1 line
??Do I need to mention the old mode in the binding.txt file??
Yes.
Quoted 4 lines
?I'm trying to keep things clean
so someone reading the binding doesn't get a headache and trying to preserve my own sanity as we move forward with adding new features to this driver.
If they're sufficiently different then just describe the new and old nodes separately rather than putting a bunch of if/else clauses in there.
-Scott
RFC PATCH 5/5 powerpc: Add HAVE_GENERIC_DMA_COHERENT options to Kconfig
In reply to Roy PledgeEnable HAVE_GENERIC_DMA_COHERENT to enable use of shared-dma-pool reserved memory mappings
--- arch/powerpc/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/Kconfig +1 -0
@@ -136,6 +136,7 @@ config PPC select HAVE_FUNCTION_GRAPH_TRACER select HAVE_FUNCTION_TRACER select HAVE_GCC_PLUGINS + select HAVE_GENERIC_DMA_COHERENT select HAVE_GENERIC_GUP select HAVE_HW_BREAKPOINT if PERF_EVENTS && (PPC_BOOK3S || PPC_8xx) select HAVE_IDE
Signature · 1 line
2.9.3