* [PATCH 03/13] DSPBRIDGE: Moving functions from mem.c to drv.c
@ 2010-04-08 23:47 Gomez Castellanos, Ivan
2010-04-16 10:36 ` Víctor M. Jáquez L.
0 siblings, 1 reply; 4+ messages in thread
From: Gomez Castellanos, Ivan @ 2010-04-08 23:47 UTC (permalink / raw)
To: linux-omap@vger.kernel.org
Cc: Hiroshi DOYU, Felipe Contreras, Ameya Palande, Menon, Nishanth
>From 879cddcdad95964e7893bd30e14c815d80e29c08 Mon Sep 17 00:00:00 2001
From: Ivan Gomez Castellanos <ivan.gomez@ti.com>
Date: Tue, 23 Mar 2010 18:30:09 -0600
Subject: [PATCH 03/13] DSPBRIDGE: Moving functions from mem.c to drv.c
Since the mem.c file is going to be deleted, and as the drv.c file
is used for DSP/BIOS Bridge resource allocation, then the following
functions can be placed here and their prototypes in drv.h:
mem_ext_phys_pool_init
mem_ext_phys_pool_release
mem_ext_phys_mem_alloc
mem_alloc_phys_mem
mem_flush_cache
mem_free_phys_mem
Also, as mem_alloc_phys_mem is never called in atomic context, then
the in_atomic function is removed.
Signed-off-by: Ivan Gomez Castellanos <ivan.gomez@ti.com>
---
arch/arm/plat-omap/include/dspbridge/drv.h | 78 ++++++++++++++
arch/arm/plat-omap/include/dspbridge/mem.h | 78 --------------
drivers/dsp/bridge/rmgr/drv.c | 153 ++++++++++++++++++++++++++++
drivers/dsp/bridge/services/mem.c | 151 ---------------------------
4 files changed, 231 insertions(+), 229 deletions(-)
diff --git a/arch/arm/plat-omap/include/dspbridge/drv.h b/arch/arm/plat-omap/include/dspbridge/drv.h
index 947cbdd..eeb5e23 100644
--- a/arch/arm/plat-omap/include/dspbridge/drv.h
+++ b/arch/arm/plat-omap/include/dspbridge/drv.h
@@ -390,4 +390,82 @@ extern dsp_status drv_release_resources(IN u32 dw_context,
void bridge_recover_schedule(void);
#endif
+/*
+ * ======== mem_ext_phys_pool_init ========
+ * Purpose:
+ * Uses the physical memory chunk passed for internal consitent memory
+ * allocations.
+ * physical address based on the page frame address.
+ * Parameters:
+ * poolPhysBase starting address of the physical memory pool.
+ * poolSize size of the physical memory pool.
+ * Returns:
+ * none.
+ * Requires:
+ * - MEM initialized.
+ * - valid physical address for the base and size > 0
+ */
+extern void mem_ext_phys_pool_init(IN u32 poolPhysBase, IN u32 poolSize);
+
+/*
+ * ======== mem_ext_phys_pool_release ========
+ */
+extern void mem_ext_phys_pool_release(void);
+
+/* ======== mem_alloc_phys_mem ========
+ * Purpose:
+ * Allocate physically contiguous, uncached memory
+ * Parameters:
+ * byte_size: Number of bytes to allocate.
+ * ulAlign: Alignment Mask.
+ * pPhysicalAddress: Physical address of allocated memory.
+ * Returns:
+ * Pointer to a block of memory;
+ * NULL if memory couldn't be allocated, or if byte_size == 0.
+ * Requires:
+ * MEM initialized.
+ * Ensures:
+ * The returned pointer, if not NULL, points to a valid memory block of
+ * the size requested. Returned physical address refers to physical
+ * location of memory.
+ */
+extern void *mem_alloc_phys_mem(IN u32 byte_size,
+ IN u32 ulAlign, OUT u32 *pPhysicalAddress);
+
+/*
+ * ======== mem_flush_cache ========
+ * Purpose:
+ * Performs system cache sync with discard
+ * Parameters:
+ * pMemBuf: Pointer to memory region to be flushed.
+ * pMemBuf: Size of the memory region to be flushed.
+ * Returns:
+ * Requires:
+ * MEM is initialized.
+ * Ensures:
+ * Cache is synchronized
+ */
+extern void mem_flush_cache(void *pMemBuf, u32 byte_size, s32 FlushType);
+
+/*
+ * ======== mem_free_phys_mem ========
+ * Purpose:
+ * Free the given block of physically contiguous memory.
+ * Parameters:
+ * pVirtualAddress: Pointer to virtual memory region allocated
+ * by mem_alloc_phys_mem().
+ * pPhysicalAddress: Pointer to physical memory region allocated
+ * by mem_alloc_phys_mem().
+ * byte_size: Size of the memory region allocated by mem_alloc_phys_mem().
+ * Returns:
+ * Requires:
+ * MEM initialized.
+ * pVirtualAddress is a valid memory address returned by
+ * mem_alloc_phys_mem()
+ * Ensures:
+ * pVirtualAddress is no longer a valid pointer to memory.
+ */
+extern void mem_free_phys_mem(void *pVirtualAddress,
+ u32 pPhysicalAddress, u32 byte_size);
+
#endif /* DRV_ */
diff --git a/arch/arm/plat-omap/include/dspbridge/mem.h b/arch/arm/plat-omap/include/dspbridge/mem.h
index 47f32dd..374b971 100644
--- a/arch/arm/plat-omap/include/dspbridge/mem.h
+++ b/arch/arm/plat-omap/include/dspbridge/mem.h
@@ -68,26 +68,6 @@ extern void *mem_alloc(IN u32 byte_size, IN enum mem_poolattrs type);
} \
}
-/* ======== mem_alloc_phys_mem ========
- * Purpose:
- * Allocate physically contiguous, uncached memory
- * Parameters:
- * byte_size: Number of bytes to allocate.
- * ulAlign: Alignment Mask.
- * pPhysicalAddress: Physical address of allocated memory.
- * Returns:
- * Pointer to a block of memory;
- * NULL if memory couldn't be allocated, or if byte_size == 0.
- * Requires:
- * MEM initialized.
- * Ensures:
- * The returned pointer, if not NULL, points to a valid memory block of
- * the size requested. Returned physical address refers to physical
- * location of memory.
- */
-extern void *mem_alloc_phys_mem(IN u32 byte_size,
- IN u32 ulAlign, OUT u32 *pPhysicalAddress);
-
/*
* ======== mem_calloc ========
* Purpose:
@@ -124,42 +104,6 @@ extern void *mem_calloc(IN u32 byte_size, IN enum mem_poolattrs type);
extern void mem_exit(void);
/*
- * ======== mem_flush_cache ========
- * Purpose:
- * Performs system cache sync with discard
- * Parameters:
- * pMemBuf: Pointer to memory region to be flushed.
- * pMemBuf: Size of the memory region to be flushed.
- * Returns:
- * Requires:
- * MEM is initialized.
- * Ensures:
- * Cache is synchronized
- */
-extern void mem_flush_cache(void *pMemBuf, u32 byte_size, s32 FlushType);
-
-/*
- * ======== mem_free_phys_mem ========
- * Purpose:
- * Free the given block of physically contiguous memory.
- * Parameters:
- * pVirtualAddress: Pointer to virtual memory region allocated
- * by mem_alloc_phys_mem().
- * pPhysicalAddress: Pointer to physical memory region allocated
- * by mem_alloc_phys_mem().
- * byte_size: Size of the memory region allocated by mem_alloc_phys_mem().
- * Returns:
- * Requires:
- * MEM initialized.
- * pVirtualAddress is a valid memory address returned by
- * mem_alloc_phys_mem()
- * Ensures:
- * pVirtualAddress is no longer a valid pointer to memory.
- */
-extern void mem_free_phys_mem(void *pVirtualAddress,
- u32 pPhysicalAddress, u32 byte_size);
-
-/*
* ======== MEM_FREE_OBJECT ========
* Purpose:
* Utility macro to invalidate an object's signature, and deallocate it.
@@ -255,26 +199,4 @@ extern bool services_mem_init(void);
*/
#define MEM_UNMAP_LINEAR_ADDRESS(pBaseAddr) {}
-/*
- * ======== mem_ext_phys_pool_init ========
- * Purpose:
- * Uses the physical memory chunk passed for internal consitent memory
- * allocations.
- * physical address based on the page frame address.
- * Parameters:
- * poolPhysBase starting address of the physical memory pool.
- * poolSize size of the physical memory pool.
- * Returns:
- * none.
- * Requires:
- * - MEM initialized.
- * - valid physical address for the base and size > 0
- */
-extern void mem_ext_phys_pool_init(IN u32 poolPhysBase, IN u32 poolSize);
-
-/*
- * ======== mem_ext_phys_pool_release ========
- */
-extern void mem_ext_phys_pool_release(void);
-
#endif /* MEM_ */
diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c
index 77b54d8..04c7133 100644
--- a/drivers/dsp/bridge/rmgr/drv.c
+++ b/drivers/dsp/bridge/rmgr/drv.c
@@ -64,6 +64,14 @@ struct drv_ext {
/* ----------------------------------- Globals */
static s32 refs;
+static bool ext_phys_mem_pool_enabled;
+struct ext_phys_mem_pool {
+ u32 phys_mem_base;
+ u32 phys_mem_size;
+ u32 virt_mem_base;
+ u32 next_phys_alloc_ptr;
+};
+static struct ext_phys_mem_pool ext_mem_pool;
/* ----------------------------------- Function Prototypes */
static dsp_status request_bridge_resources(u32 dw_context, s32 fRequest);
@@ -1068,3 +1076,148 @@ static dsp_status request_bridge_resources_dsp(u32 dw_context, s32 bRequest)
/* End Mem alloc */
return status;
}
+
+void mem_ext_phys_pool_init(u32 poolPhysBase, u32 poolSize)
+{
+ u32 pool_virt_base;
+
+ /* get the virtual address for the physical memory pool passed */
+ pool_virt_base = (u32) ioremap(poolPhysBase, poolSize);
+
+ if ((void **)pool_virt_base == NULL) {
+ pr_err("%s: external physical memory map failed\n", __func__);
+ ext_phys_mem_pool_enabled = false;
+ } else {
+ ext_mem_pool.phys_mem_base = poolPhysBase;
+ ext_mem_pool.phys_mem_size = poolSize;
+ ext_mem_pool.virt_mem_base = pool_virt_base;
+ ext_mem_pool.next_phys_alloc_ptr = poolPhysBase;
+ ext_phys_mem_pool_enabled = true;
+ }
+}
+
+void mem_ext_phys_pool_release(void)
+{
+ if (ext_phys_mem_pool_enabled) {
+ iounmap((void *)(ext_mem_pool.virt_mem_base));
+ ext_phys_mem_pool_enabled = false;
+ }
+}
+
+/*
+ * ======== mem_ext_phys_mem_alloc ========
+ * Purpose:
+ * Allocate physically contiguous, uncached memory from external memory pool
+ */
+
+static void *mem_ext_phys_mem_alloc(u32 bytes, u32 align, OUT u32 * pPhysAddr)
+{
+ u32 new_alloc_ptr;
+ u32 offset;
+ u32 virt_addr;
+
+ if (align == 0)
+ align = 1;
+
+ if (bytes > ((ext_mem_pool.phys_mem_base + ext_mem_pool.phys_mem_size)
+ - ext_mem_pool.next_phys_alloc_ptr)) {
+ pPhysAddr = NULL;
+ return NULL;
+ } else {
+ offset = (ext_mem_pool.next_phys_alloc_ptr & (align - 1));
+ if (offset == 0)
+ new_alloc_ptr = ext_mem_pool.next_phys_alloc_ptr;
+ else
+ new_alloc_ptr = (ext_mem_pool.next_phys_alloc_ptr) +
+ (align - offset);
+ if ((new_alloc_ptr + bytes) <=
+ (ext_mem_pool.phys_mem_base + ext_mem_pool.phys_mem_size)) {
+ /* we can allocate */
+ *pPhysAddr = new_alloc_ptr;
+ ext_mem_pool.next_phys_alloc_ptr =
+ new_alloc_ptr + bytes;
+ virt_addr =
+ ext_mem_pool.virt_mem_base + (new_alloc_ptr -
+ ext_mem_pool.
+ phys_mem_base);
+ return (void *)virt_addr;
+ } else {
+ *pPhysAddr = 0;
+ return NULL;
+ }
+ }
+}
+
+/*
+ * ======== mem_alloc_phys_mem ========
+ * Purpose:
+ * Allocate physically contiguous, uncached memory
+ */
+void *mem_alloc_phys_mem(u32 byte_size, u32 ulAlign, OUT u32 * pPhysicalAddress)
+{
+ void *va_mem = NULL;
+ dma_addr_t pa_mem;
+
+ if (byte_size > 0) {
+ if (ext_phys_mem_pool_enabled) {
+ va_mem = mem_ext_phys_mem_alloc(byte_size, ulAlign,
+ (u32 *) &pa_mem);
+ } else
+ va_mem = dma_alloc_coherent(NULL, byte_size, &pa_mem,
+ GFP_KERNEL);
+ if (va_mem == NULL)
+ *pPhysicalAddress = 0;
+ else
+ *pPhysicalAddress = pa_mem;
+ }
+ return va_mem;
+}
+
+/*
+ * ======== mem_flush_cache ========
+ * Purpose:
+ * Flush cache
+ */
+void mem_flush_cache(void *pMemBuf, u32 byte_size, s32 FlushType)
+{
+ if (!pMemBuf)
+ return;
+
+ switch (FlushType) {
+ /* invalidate only */
+ case PROC_INVALIDATE_MEM:
+ dmac_inv_range(pMemBuf, pMemBuf + byte_size);
+ outer_inv_range(__pa((u32) pMemBuf), __pa((u32) pMemBuf +
+ byte_size));
+ break;
+ /* writeback only */
+ case PROC_WRITEBACK_MEM:
+ dmac_clean_range(pMemBuf, pMemBuf + byte_size);
+ outer_clean_range(__pa((u32) pMemBuf), __pa((u32) pMemBuf +
+ byte_size));
+ break;
+ /* writeback and invalidate */
+ case PROC_WRITEBACK_INVALIDATE_MEM:
+ dmac_flush_range(pMemBuf, pMemBuf + byte_size);
+ outer_flush_range(__pa((u32) pMemBuf), __pa((u32) pMemBuf +
+ byte_size));
+ break;
+ }
+
+}
+
+/*
+ * ======== mem_free_phys_mem ========
+ * Purpose:
+ * Free the given block of physically contiguous memory.
+ */
+void mem_free_phys_mem(void *pVirtualAddress, u32 pPhysicalAddress,
+ u32 byte_size)
+{
+ DBC_REQUIRE(pVirtualAddress != NULL);
+
+ if (!ext_phys_mem_pool_enabled)
+ dma_free_coherent(NULL, byte_size, pVirtualAddress,
+ pPhysicalAddress);
+}
+
diff --git a/drivers/dsp/bridge/services/mem.c b/drivers/dsp/bridge/services/mem.c
index 916a49f..6e8834a 100644
--- a/drivers/dsp/bridge/services/mem.c
+++ b/drivers/dsp/bridge/services/mem.c
@@ -35,87 +35,7 @@
#define MEM512MB 0x1fffffff
/* ----------------------------------- Globals */
-static bool ext_phys_mem_pool_enabled;
-struct ext_phys_mem_pool {
- u32 phys_mem_base;
- u32 phys_mem_size;
- u32 virt_mem_base;
- u32 next_phys_alloc_ptr;
-};
-
-static struct ext_phys_mem_pool ext_mem_pool;
-
-void mem_ext_phys_pool_init(u32 poolPhysBase, u32 poolSize)
-{
- u32 pool_virt_base;
-
- /* get the virtual address for the physical memory pool passed */
- pool_virt_base = (u32) ioremap(poolPhysBase, poolSize);
-
- if ((void **)pool_virt_base == NULL) {
- pr_err("%s: external physical memory map failed\n", __func__);
- ext_phys_mem_pool_enabled = false;
- } else {
- ext_mem_pool.phys_mem_base = poolPhysBase;
- ext_mem_pool.phys_mem_size = poolSize;
- ext_mem_pool.virt_mem_base = pool_virt_base;
- ext_mem_pool.next_phys_alloc_ptr = poolPhysBase;
- ext_phys_mem_pool_enabled = true;
- }
-}
-
-void mem_ext_phys_pool_release(void)
-{
- if (ext_phys_mem_pool_enabled) {
- iounmap((void *)(ext_mem_pool.virt_mem_base));
- ext_phys_mem_pool_enabled = false;
- }
-}
-
-/*
- * ======== mem_ext_phys_mem_alloc ========
- * Purpose:
- * Allocate physically contiguous, uncached memory from external memory pool
- */
-
-static void *mem_ext_phys_mem_alloc(u32 bytes, u32 align, OUT u32 * pPhysAddr)
-{
- u32 new_alloc_ptr;
- u32 offset;
- u32 virt_addr;
-
- if (align == 0)
- align = 1;
-
- if (bytes > ((ext_mem_pool.phys_mem_base + ext_mem_pool.phys_mem_size)
- - ext_mem_pool.next_phys_alloc_ptr)) {
- pPhysAddr = NULL;
- return NULL;
- } else {
- offset = (ext_mem_pool.next_phys_alloc_ptr & (align - 1));
- if (offset == 0)
- new_alloc_ptr = ext_mem_pool.next_phys_alloc_ptr;
- else
- new_alloc_ptr = (ext_mem_pool.next_phys_alloc_ptr) +
- (align - offset);
- if ((new_alloc_ptr + bytes) <=
- (ext_mem_pool.phys_mem_base + ext_mem_pool.phys_mem_size)) {
- /* we can allocate */
- *pPhysAddr = new_alloc_ptr;
- ext_mem_pool.next_phys_alloc_ptr =
- new_alloc_ptr + bytes;
- virt_addr =
- ext_mem_pool.virt_mem_base + (new_alloc_ptr -
- ext_mem_pool.
- phys_mem_base);
- return (void *)virt_addr;
- } else {
- *pPhysAddr = 0;
- return NULL;
- }
- }
-}
/*
* ======== mem_alloc ========
@@ -146,31 +66,6 @@ void *mem_alloc(u32 byte_size, enum mem_poolattrs type)
return mem;
}
-/*
- * ======== mem_alloc_phys_mem ========
- * Purpose:
- * Allocate physically contiguous, uncached memory
- */
-void *mem_alloc_phys_mem(u32 byte_size, u32 ulAlign, OUT u32 * pPhysicalAddress)
-{
- void *va_mem = NULL;
- dma_addr_t pa_mem;
-
- if (byte_size > 0) {
- if (ext_phys_mem_pool_enabled) {
- va_mem = mem_ext_phys_mem_alloc(byte_size, ulAlign,
- (u32 *) &pa_mem);
- } else
- va_mem = dma_alloc_coherent(NULL, byte_size, &pa_mem,
- (in_atomic()) ? GFP_ATOMIC :
- GFP_KERNEL);
- if (va_mem == NULL)
- *pPhysicalAddress = 0;
- else
- *pPhysicalAddress = pa_mem;
- }
- return va_mem;
-}
/*
* ======== mem_calloc ========
@@ -211,53 +106,7 @@ void mem_exit(void)
{
}
-/*
- * ======== mem_flush_cache ========
- * Purpose:
- * Flush cache
- */
-void mem_flush_cache(void *pMemBuf, u32 byte_size, s32 FlushType)
-{
- if (!pMemBuf)
- return;
-
- switch (FlushType) {
- /* invalidate only */
- case PROC_INVALIDATE_MEM:
- dmac_inv_range(pMemBuf, pMemBuf + byte_size);
- outer_inv_range(__pa((u32) pMemBuf), __pa((u32) pMemBuf +
- byte_size));
- break;
- /* writeback only */
- case PROC_WRITEBACK_MEM:
- dmac_clean_range(pMemBuf, pMemBuf + byte_size);
- outer_clean_range(__pa((u32) pMemBuf), __pa((u32) pMemBuf +
- byte_size));
- break;
- /* writeback and invalidate */
- case PROC_WRITEBACK_INVALIDATE_MEM:
- dmac_flush_range(pMemBuf, pMemBuf + byte_size);
- outer_flush_range(__pa((u32) pMemBuf), __pa((u32) pMemBuf +
- byte_size));
- break;
- }
-
-}
-
-/*
- * ======== mem_free_phys_mem ========
- * Purpose:
- * Free the given block of physically contiguous memory.
- */
-void mem_free_phys_mem(void *pVirtualAddress, u32 pPhysicalAddress,
- u32 byte_size)
-{
- DBC_REQUIRE(pVirtualAddress != NULL);
- if (!ext_phys_mem_pool_enabled)
- dma_free_coherent(NULL, byte_size, pVirtualAddress,
- pPhysicalAddress);
-}
/*
* ======== services_mem_init ========
--
1.7.0.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 03/13] DSPBRIDGE: Moving functions from mem.c to drv.c
2010-04-08 23:47 [PATCH 03/13] DSPBRIDGE: Moving functions from mem.c to drv.c Gomez Castellanos, Ivan
@ 2010-04-16 10:36 ` Víctor M. Jáquez L.
2010-04-16 11:46 ` Kanigeri, Hari
0 siblings, 1 reply; 4+ messages in thread
From: Víctor M. Jáquez L. @ 2010-04-16 10:36 UTC (permalink / raw)
To: Gomez Castellanos, Ivan
Cc: linux-omap@vger.kernel.org, Hiroshi DOYU, Felipe Contreras,
Ameya Palande, Menon, Nishanth
On Thu, Apr 08, 2010 at 06:47:13PM -0500, Gomez Castellanos, Ivan wrote:
> +/*
> + * ======== mem_flush_cache ========
> + * Purpose:
> + * Flush cache
> + */
> +void mem_flush_cache(void *pMemBuf, u32 byte_size, s32 FlushType)
> +{
> + if (!pMemBuf)
> + return;
> +
> + switch (FlushType) {
> + /* invalidate only */
> + case PROC_INVALIDATE_MEM:
> + dmac_inv_range(pMemBuf, pMemBuf + byte_size);
> + outer_inv_range(__pa((u32) pMemBuf), __pa((u32) pMemBuf +
> + byte_size));
> + break;
> + /* writeback only */
> + case PROC_WRITEBACK_MEM:
> + dmac_clean_range(pMemBuf, pMemBuf + byte_size);
> + outer_clean_range(__pa((u32) pMemBuf), __pa((u32) pMemBuf +
> + byte_size));
> + break;
> + /* writeback and invalidate */
> + case PROC_WRITEBACK_INVALIDATE_MEM:
> + dmac_flush_range(pMemBuf, pMemBuf + byte_size);
> + outer_flush_range(__pa((u32) pMemBuf), __pa((u32) pMemBuf +
> + byte_size));
> + break;
> + }
In the commit 702b94bff3c50542a6e4ab9a4f4cef093262fe65 (2.6.34) the functions
dmac_inv_range and dmac_clean_range were removed.
I'm wondering how to fix this in order to rebase to 2.6.34.
Thanks
vmjl
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH 03/13] DSPBRIDGE: Moving functions from mem.c to drv.c
2010-04-16 10:36 ` Víctor M. Jáquez L.
@ 2010-04-16 11:46 ` Kanigeri, Hari
2010-04-21 23:57 ` Nishanth Menon
0 siblings, 1 reply; 4+ messages in thread
From: Kanigeri, Hari @ 2010-04-16 11:46 UTC (permalink / raw)
To: Víctor M. Jáquez L., Gomez Castellanos, Ivan
Cc: linux-omap@vger.kernel.org, Hiroshi DOYU, Felipe Contreras,
Ameya Palande, Menon, Nishanth
Ivan,
> In the commit 702b94bff3c50542a6e4ab9a4f4cef093262fe65 (2.6.34) the
> functions
> dmac_inv_range and dmac_clean_range were removed.
>
> I'm wondering how to fix this in order to rebase to 2.6.34.
>
> Thanks
2 options:
1. Replace dmac_inv_range and dmac_clean_range functions with the new dma map and unmap functions. These are supposed to be the new functions to do the same functionality, but in our limited testing some time ago, the dma_unmap function wasn't invalidating the cache. You can check this at your end.
2. Revert the patch that deprecated these APIs to unblock you temporarily.
Thank you,
Best regards,
Hari
> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
> owner@vger.kernel.org] On Behalf Of Víctor M. Jáquez L.
> Sent: Friday, April 16, 2010 5:37 AM
> To: Gomez Castellanos, Ivan
> Cc: linux-omap@vger.kernel.org; Hiroshi DOYU; Felipe Contreras; Ameya
> Palande; Menon, Nishanth
> Subject: Re: [PATCH 03/13] DSPBRIDGE: Moving functions from mem.c to drv.c
>
> On Thu, Apr 08, 2010 at 06:47:13PM -0500, Gomez Castellanos, Ivan wrote:
>
> > +/*
> > + * ======== mem_flush_cache =======
> > + * Purpose:
> > + * Flush cache
> > + */
> > +void mem_flush_cache(void *pMemBuf, u32 byte_size, s32 FlushType)
> > +{
> > + if (!pMemBuf)
> > + return;
> > +
> > + switch (FlushType) {
> > + /* invalidate only */
> > + case PROC_INVALIDATE_MEM:
> > + dmac_inv_range(pMemBuf, pMemBuf + byte_size);
> > + outer_inv_range(__pa((u32) pMemBuf), __pa((u32) pMemBuf
> +
> > + byte_size));
> > + break;
> > + /* writeback only */
> > + case PROC_WRITEBACK_MEM:
> > + dmac_clean_range(pMemBuf, pMemBuf + byte_size);
> > + outer_clean_range(__pa((u32) pMemBuf), __pa((u32)
> pMemBuf +
> > + byte_size));
> > + break;
> > + /* writeback and invalidate */
> > + case PROC_WRITEBACK_INVALIDATE_MEM:
> > + dmac_flush_range(pMemBuf, pMemBuf + byte_size);
> > + outer_flush_range(__pa((u32) pMemBuf), __pa((u32)
> pMemBuf +
> > + byte_size));
> > + break;
> > + }
>
> In the commit 702b94bff3c50542a6e4ab9a4f4cef093262fe65 (2.6.34) the
> functions
> dmac_inv_range and dmac_clean_range were removed.
>
> I'm wondering how to fix this in order to rebase to 2.6.34.
>
> Thanks
>
> vmjl
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 03/13] DSPBRIDGE: Moving functions from mem.c to drv.c
2010-04-16 11:46 ` Kanigeri, Hari
@ 2010-04-21 23:57 ` Nishanth Menon
0 siblings, 0 replies; 4+ messages in thread
From: Nishanth Menon @ 2010-04-21 23:57 UTC (permalink / raw)
To: Kanigeri, Hari
Cc: "Víctor M. Jáquez L.", Gomez Castellanos, Ivan,
linux-omap@vger.kernel.org, Hiroshi DOYU, Felipe Contreras,
Ameya Palande
[-- Attachment #1: Type: text/plain, Size: 1369 bytes --]
Kanigeri, Hari had written, on 04/16/2010 06:46 AM, the following:
> Ivan,
>
>> In the commit 702b94bff3c50542a6e4ab9a4f4cef093262fe65 (2.6.34) the
>> functions
>> dmac_inv_range and dmac_clean_range were removed.
>>
>> I'm wondering how to fix this in order to rebase to 2.6.34.
>>
>> Thanks
>
Sharing with a wider audience my experiments:
> 2 options:
>
> 1. Replace dmac_inv_range and dmac_clean_range functions with the new dma map
>and unmap functions. These are supposed to be the new functions to do
the same
> functionality, but in our limited testing some time ago, the
dma_unmap function
> wasn't invalidating the cache. You can check this at your end.
I tried doing this with pm-wip-opp(.34-rc4) branch in kevin's tree with
the attached patch on SDP3430.
result log.txt - test results using just the userspace from
http://dev.omapzoom.org/?p=tidspbridge/userspace-dspbridge.git;a=summary
short story:
ping - pass
dmmcopy - fail - this is inline with what Hari mentioned - in short,
using map/unmap as a direct replacement is a no-go,
>
> 2. Revert the patch that deprecated these APIs to unblock you temporarily.
git revert 702b94bff3c50542a6e4ab9a4f4cef093262fe65 works.. but ofcourse
would be a temporary hack for those interested in moving on..
Will leave Hari/Omar to summarize some of the ideas they have.
--
Regards,
Nishanth Menon
[-- Attachment #2: 0001-DSPBRIDGE-mem-no-more-cache-handling.patch --]
[-- Type: text/x-patch, Size: 1232 bytes --]
>From ea35037b8bf9af0ef068248f74ce6c9dcde4df6c Mon Sep 17 00:00:00 2001
From: Nishanth Menon <nm@ti.com>
Date: Wed, 21 Apr 2010 14:49:28 -0500
Subject: [PATCH] DSPBRIDGE: mem: no more cache handling
quick hack to use map and unmap to handle invalid and clean ops
Signed-off-by: Nishanth Menon <nm@ti.com>
---
drivers/dsp/bridge/services/mem.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/dsp/bridge/services/mem.c b/drivers/dsp/bridge/services/mem.c
index 916a49f..49033e7 100644
--- a/drivers/dsp/bridge/services/mem.c
+++ b/drivers/dsp/bridge/services/mem.c
@@ -224,13 +224,13 @@ void mem_flush_cache(void *pMemBuf, u32 byte_size, s32 FlushType)
switch (FlushType) {
/* invalidate only */
case PROC_INVALIDATE_MEM:
- dmac_inv_range(pMemBuf, pMemBuf + byte_size);
+ dmac_unmap_area(pMemBuf, byte_size, DMA_TO_DEVICE);
outer_inv_range(__pa((u32) pMemBuf), __pa((u32) pMemBuf +
byte_size));
break;
/* writeback only */
case PROC_WRITEBACK_MEM:
- dmac_clean_range(pMemBuf, pMemBuf + byte_size);
+ dmac_map_area(pMemBuf, byte_size, DMA_FROM_DEVICE);
outer_clean_range(__pa((u32) pMemBuf), __pa((u32) pMemBuf +
byte_size));
break;
--
1.6.3.3
[-- Attachment #3: log.txt --]
[-- Type: text/plain, Size: 3971 bytes --]
# ./cexec.out ddspbase_tiomap3430.dof64P
DSP device detected !!
proc_load: Processor Loaded ddspbase_tiomap3430.dof64P
omap mailbox rev 4.0
proc_start: dsp in running state
DSPProcessor_Start succeeded.procwrap_detach: deprecated dspbridge ioctl
Hit any key to terminate cexec.
# ./cexec.out dynbase_tiomap3430.dof64P
DSP device detected !!
proc_load: Processor Loaded dynbase_tiomap3430.dof64P
omap mailbox rev 4.0
proc_start: dsp in running state
DSPProcessor_Start succeeded.procwrap_detach: deprecated dspbridge ioctl
Hit any key to terminate cexec.
# ./dynreg.out -r pingdyn_3430.dll64P
# ./ping.out
DSP device detected !!
DSPNodeCreate succeeded
DSPNode_registerNotify succeeded
DSPNode_run succeeded
Ping: Id 1.000000 Msg 0.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 1.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 2.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 3.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 4.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 5.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 6.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 7.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 8.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 9.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 10.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 11.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 12.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 13.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 14.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 15.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 16.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 17.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 18.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 19.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 20.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 21.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 22.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 23.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 24.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 25.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 26.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 27.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 28.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 29.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 30.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 31.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 32.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 33.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 34.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 35.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 36.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 37.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 38.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 39.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 40.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 41.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 42.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 43.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 44.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 45.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 46.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 47.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 48.000000 Mem 14816.000000
Ping: Id 1.000000 Msg 49.000000 Mem 14816.000000
procwrap_detach: deprecated dspbridge ioctl
# ./dynreg.out -r dmmcopydyn_3430.dll64P
# du -h /dspbridge/test-input
10.0M /dspbridge/test-input
# ./dmmcopy.out /dspbridge/test-input /dspbridge/test-output
DSP device detected !!
DSPProcessor_Attach succeeded.
DSPNode_Allocate succeeded.
DSPNode_Create succeeded.
DSPNode_Run succeeded.
DSPProcessor_ReserveMemory succeeded. dspAddrSend= 0x203f0000
DSPProcessor_ReserveMemory succeeded. dspAddrdRecv= 0x2040a000
DSPProcessor_Map succeeded.
DSPProcessor_Map succeeded.
Sending DMM BUFs to DSP cmd=SETUP, DspRecvBuf=0x203f02e8, DspSendBuf=0x2040a2f0
Read 102400 bytes from input file.
Writing 102400 bytes to output file.
Read 102400 bytes from input file.
Writing 102400 bytes to output file.
Sent and received buffers don't match
Press any key to continue
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-04-21 23:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-08 23:47 [PATCH 03/13] DSPBRIDGE: Moving functions from mem.c to drv.c Gomez Castellanos, Ivan
2010-04-16 10:36 ` Víctor M. Jáquez L.
2010-04-16 11:46 ` Kanigeri, Hari
2010-04-21 23:57 ` Nishanth Menon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox