From a8d9943dd2ffe60bf10e1db347df88b654705a14 Mon Sep 17 00:00:00 2001 From: Luden Date: Fri, 5 Feb 2016 21:21:28 +0100 Subject: Add config option to override IPU_MEM_IOBUFS carveout size Note that omap4_ion_heap_secure_input_addr needs a fixed value instead of a dynamically calculated one, which would change after overriding this carveout size, causing problems as that address is hardcoded in out Ducati. Change-Id: I5018d88c0ecf7444b133f545f963363acaf99198 --- arch/arm/mach-omap2/omap4_ion.c | 11 +++++++++++ arch/arm/plat-omap/Kconfig | 6 ++++++ drivers/remoteproc/remoteproc.c | 20 ++++++++++++++------ 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-omap2/omap4_ion.c b/arch/arm/mach-omap2/omap4_ion.c index 6233173..e591020 100755 --- a/arch/arm/mach-omap2/omap4_ion.c +++ b/arch/arm/mach-omap2/omap4_ion.c @@ -18,6 +18,9 @@ #include +/* Hardcoded Ducati heap address. */ +#define TUNA_DUCATI_HEAP_ADDR 0xba300000 + /* * Carveouts from higher end of RAM * - SMC @@ -120,7 +123,11 @@ void __init omap_ion_init(void) omap4_ion_heap_nonsec_tiler_mem_size = 0; omap4_ion_heap_tiler_mem_size = 0; } else { +#if defined(CONFIG_ION_OMAP_IPU_MEM_IOBUFS_SIZE) && CONFIG_ION_OMAP_IPU_MEM_IOBUFS_SIZE > 0 + omap4_ion_heap_secure_input_size = (SZ_1M * CONFIG_ION_OMAP_IPU_MEM_IOBUFS_SIZE); +#else omap4_ion_heap_secure_input_size = (SZ_1M * 90); +#endif #ifdef CONFIG_MACH_TUNA omap4_ion_heap_secure_output_wfdhdcp_size = 0; #else @@ -141,8 +148,12 @@ void __init omap_ion_init(void) /* carveout addresses */ omap4_smc_addr = PLAT_PHYS_OFFSET + omap_total_ram_size() - omap4_smc_size; +#ifdef CONFIG_MACH_TUNA /* fixed start address of ducati heap */ + omap4_ion_heap_secure_input_addr = TUNA_DUCATI_HEAP_ADDR; +#else omap4_ion_heap_secure_input_addr = omap4_smc_addr - omap4_ion_heap_secure_input_size; +#endif omap4_ion_heap_secure_output_wfdhdcp_addr = omap4_ion_heap_secure_input_addr - omap4_ion_heap_secure_output_wfdhdcp_size; diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index e414516..23029bd 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig @@ -306,6 +306,12 @@ config ION_OMAP_TILER_DYNAMIC_ALLOC depends on ION_OMAP default n +config ION_OMAP_IPU_MEM_IOBUFS_SIZE + int "Carveout size override for IPU_MEM_IOBUFS section of Ducati firmware." + range 0 90 + depends on ION_OMAP + default 0 + endmenu endif diff --git a/drivers/remoteproc/remoteproc.c b/drivers/remoteproc/remoteproc.c index 0f7b9a3..39489af 100755 --- a/drivers/remoteproc/remoteproc.c +++ b/drivers/remoteproc/remoteproc.c @@ -743,7 +743,7 @@ static void rproc_reset_poolmem(struct rproc *rproc) pool->cur_size = pool->mem_size; } -static int rproc_add_mem_entry(struct rproc *rproc, struct fw_resource *rsc) +static int rproc_add_mem_entry(struct rproc *rproc, struct fw_resource *rsc, u32 rsc_len) { struct rproc_mem_entry *me = rproc->memory_maps; int i = 0; @@ -761,7 +761,7 @@ static int rproc_add_mem_entry(struct rproc *rproc, struct fw_resource *rsc) if (!ret) { me->da = rsc->da; me->pa = (phys_addr_t)rsc->pa; - me->size = rsc->len; + me->size = rsc_len; #ifdef CONFIG_REMOTEPROC_CORE_DUMP /* FIXME: ION heaps are reported as RSC_CARVEOUT. We need a * better way to understand which sections are for @@ -823,6 +823,7 @@ static int rproc_handle_resources(struct rproc *rproc, struct fw_resource *rsc, u64 trace_da1 = 0; u64 cdump_da0 = 0; u64 cdump_da1 = 0; + u32 rsc_len = 0; int ret = 0; while (len >= sizeof(*rsc) && !ret) { @@ -874,7 +875,7 @@ static int rproc_handle_resources(struct rproc *rproc, struct fw_resource *rsc, *bootaddr = da; break; case RSC_DEVMEM: - ret = rproc_add_mem_entry(rproc, rsc); + ret = rproc_add_mem_entry(rproc, rsc, rsc->len); if (ret) { dev_err(dev, "can't add mem_entry %s\n", rsc->name); @@ -882,8 +883,15 @@ static int rproc_handle_resources(struct rproc *rproc, struct fw_resource *rsc, } break; case RSC_CARVEOUT: + rsc_len = rsc->len; +#if defined(CONFIG_ION_OMAP_IPU_MEM_IOBUFS_SIZE) && CONFIG_ION_OMAP_IPU_MEM_IOBUFS_SIZE > 0 + if (!strncmp("IPU_MEM_IOBUFS", rsc->name, 14)) { + dev_info(dev, "overriding IPU_MEM_IOBUFS size to %dMB\n", CONFIG_ION_OMAP_IPU_MEM_IOBUFS_SIZE); + rsc_len = CONFIG_ION_OMAP_IPU_MEM_IOBUFS_SIZE * SZ_1M; + } +#endif if (!pa) { - ret = rproc_alloc_poolmem(rproc, rsc->len, &pa); + ret = rproc_alloc_poolmem(rproc, rsc_len, &pa); if (ret) { dev_err(dev, "can't alloc poolmem %s\n", rsc->name); @@ -891,7 +899,7 @@ static int rproc_handle_resources(struct rproc *rproc, struct fw_resource *rsc, } rsc->pa = pa; } else { - ret = rproc_check_poolmem(rproc, rsc->len, pa); + ret = rproc_check_poolmem(rproc, rsc_len, pa); if (ret) { dev_err(dev, "static memory for %s " "doesn't belong to poolmem\n", @@ -899,7 +907,7 @@ static int rproc_handle_resources(struct rproc *rproc, struct fw_resource *rsc, break; } } - ret = rproc_add_mem_entry(rproc, rsc); + ret = rproc_add_mem_entry(rproc, rsc, rsc_len); if (ret) { dev_err(dev, "can't add mem_entry %s\n", rsc->name); -- cgit v1.1