Skip to contentSkip to conversation

DSPBRIDGE: latest set of patches

PATCH New Omar Ramirez Luna 1 participant 8 messages Jun 17, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover DSPBRIDGE: latest set of patches

These are the latest set of patches for d.o-z dspbridge.

Fernando Guzman Lugo (2):
DSPBRIDGE: Allow separate load/run addresses for Dynamic Loader
DSPBRIDGE: Reset MMU and DSP on board stop

Hari Kanigeri (3):
DSPBRIDGE: Handle properly user space pointers
DSPBRIDGE: Increased DMM size to 256MB
DSPBRIDGE: Keep DMM resources for other nodes on PROC_Detach

Omar Ramirez Luna (2):
DSPBRIDGE: Removing UTIL module
DSPBRIDGE: Shared memory size increased to 5MB

 arch/arm/plat-omap/include/dspbridge/dmm.h  |    2 +-
 arch/arm/plat-omap/include/dspbridge/util.h |  122 ----------------------
 drivers/dsp/bridge/pmgr/cmm.c               |    2 +-
 drivers/dsp/bridge/pmgr/dbll.c              |   17 +++-
 drivers/dsp/bridge/pmgr/dev.c               |    1 -
 drivers/dsp/bridge/pmgr/dmm.c               |    8 +-
 drivers/dsp/bridge/pmgr/wcd.c               |  148 ++++++++++++++++++++-------
 drivers/dsp/bridge/rmgr/drv_interface.c     |    2 +-
 drivers/dsp/bridge/rmgr/proc.c              |    4 +-
 drivers/dsp/bridge/services/clk.c           |    2 -
 drivers/dsp/bridge/services/services.c      |   15 +--
 drivers/dsp/bridge/wmd/tiomap3430.c         |    6 +-
 drivers/dsp/bridge/wmd/tiomap3430_pwr.c     |    1 -
 drivers/dsp/bridge/wmd/tiomap_io.c          |    1 -
 14 files changed, 138 insertions(+), 193 deletions(-)
 delete mode 100644 arch/arm/plat-omap/include/dspbridge/util.h
#1 lore raw

PATCH 1/7 DSPBRIDGE: Removing UTIL module

This module was deprecated, removing its source files.

---
 arch/arm/plat-omap/include/dspbridge/util.h |  122 ---------------------------
 drivers/dsp/bridge/pmgr/cmm.c               |    2 +-
 drivers/dsp/bridge/pmgr/dev.c               |    1 -
 drivers/dsp/bridge/pmgr/wcd.c               |    1 -
 drivers/dsp/bridge/services/clk.c           |    2 -
 drivers/dsp/bridge/services/services.c      |   15 +---
 drivers/dsp/bridge/wmd/tiomap3430.c         |    1 -
 drivers/dsp/bridge/wmd/tiomap3430_pwr.c     |    1 -
 drivers/dsp/bridge/wmd/tiomap_io.c          |    1 -
 9 files changed, 5 insertions(+), 141 deletions(-)
 delete mode 100644 arch/arm/plat-omap/include/dspbridge/util.h
arch/arm/plat-omap/include/dspbridge/util.h deleted +0 -122
deleted file mode 100644
index e6815ca..0000000
@@ -1,122 +0,0 @@
-/*
- * util.h
- *
- * DSP-BIOS Bridge driver support functions for TI OMAP processors.
- *
- * Copyright (C) 2005-2006 Texas Instruments, Inc.
- *
- * This package is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-
-/*
- *  ======== util.h ========
- *  Purpose:
- *      Provide general purpose utility functions.
- *
- *  Public Functions:
- *      UTIL_CDTestDll
- *      UTIL_CmdLineToArgs
- *      UTIL_Exit
- *      UTIL_GetSysInfo
- *      UTIL_Init
- */
-
-#ifndef _UTIL_H
-#define _UTIL_H
-
-#include <linux/delay.h>
-#include <linux/sched.h>
-
-#include <dspbridge/utildefs.h>
-
-/*
- *  ======== UTIL_CDTestDll ========
- *  Purpose:
- *      Provides test entry point in class driver context.
- *  Parameters:
- *      cArgc:  test module command line input count.
- *      ppArgv: test module command line args.
- *  Returns:
- *      0 if successful, a negative value otherwise.
- *  Requires:
- *      UTIL initialized.
- *  Ensures:
- */
-	extern u32 UTIL_CDTestDll(IN s32 cArgc, IN char **ppArgv);
-
-/*
- *  ======== UTIL_CmdLineToArgs ========
- *  Purpose:
- *      This function re-creates C-style cmd line argc & argv from WinMain()
- *      cmd line args.
- *  Parameters:
- *      s8 *pszProgName   - The name of the program currently being executed.
- *      s8 *argv[]        - The argument vector.
- *      s8 *pCmdLine      - The pointer to the command line.
- *      bool fHasProgName   - Indicats whether a program name is supplied.
- *  Returns:
- *      Returns the number of arguments found.
- *  Requires:
- *      UTIL initialized.
- *  Ensures:
- */
-	extern s32 UTIL_CmdLineToArgs(IN char *pszProgName,
-				      IN char *argv[UTIL_MAXARGVS],
-				      IN char *pCmdLine, IN bool fHasProgName);
-
-/*
- *  ======== UTIL_Exit ========
- *  Purpose:
- *      Discontinue usage of module; free resources when reference count
- *      reaches 0.
- *  Parameters:
- *  Returns:
- *  Requires:
- *      UTIL initialized.
- *  Ensures:
- *      Resources used by module are freed when cRef reaches zero.
- */
-	extern inline void UTIL_Exit(void)
-	{
-	}
-/*
- *  ======== UTIL_GetSysInfo ========
- *  Purpose:
- *      This function return platform specific system information.
- *
- *  Parameters:
- *      pSysInfo  - address to store the system information.
- *  Returns:
- *      DSP_SOK
- *      S_FAIL
- *  Requires:
- *      UTIL initialized.
- *      pSysInfo != NULL
- *  Ensures:
- */
-	extern DSP_STATUS UTIL_GetSysInfo(OUT struct UTIL_SYSINFO *pSysInfo);
-
-/*
- *  ======== UTIL_Init ========
- *  Purpose:
- *      Initializes private state of UTIL module.
- *  Parameters:
- *  Returns:
- *      TRUE if success, else FALSE.
- *  Requires:
- *  Ensures:
- *      UTIL initialized.
- */
-	extern inline bool UTIL_Init(void)
-	{
-		return true;
-	}
-
-#endif				/* _UTIL_H */
drivers/dsp/bridge/pmgr/cmm.c +1 -1
index 99a2432..9b19be2 100644
@@ -107,7 +107,7 @@
 #include <dspbridge/list.h>
 #include <dspbridge/mem.h>
 #include <dspbridge/sync.h>
-#include <dspbridge/util.h>
+#include <dspbridge/utildefs.h>
 
 /*  ----------------------------------- Platform Manager */
 #include <dspbridge/dev.h>
drivers/dsp/bridge/pmgr/dev.c +0 -1
index 1c2f7d5..5e4e30b 100644
@@ -130,7 +130,6 @@
 #include <dspbridge/ldr.h>
 #include <dspbridge/list.h>
 #include <dspbridge/mem.h>
-#include <dspbridge/util.h>
 
 /*  ----------------------------------- Platform Manager */
 #include <dspbridge/cod.h>
drivers/dsp/bridge/pmgr/wcd.c +0 -1
index 859043d..cd84e4e 100644
@@ -108,7 +108,6 @@
 #include <dspbridge/mem.h>
 #include <dspbridge/ntfy.h>
 #include <dspbridge/services.h>
-#include <dspbridge/util.h>
 
 /*  ----------------------------------- Platform Manager */
 #include <dspbridge/chnl.h>
drivers/dsp/bridge/services/clk.c +0 -2
index f0e46a3..ff2ceea 100644
@@ -50,8 +50,6 @@
 
 /*  ----------------------------------- This */
 #include <dspbridge/clk.h>
-#include <dspbridge/util.h>
-
 
 /*  ----------------------------------- Defines, Data Structures, Typedefs */
 
drivers/dsp/bridge/services/services.c +4 -11
index 346007e..f3f700e 100644
@@ -54,7 +54,6 @@
 #include <dspbridge/reg.h>
 #include <dspbridge/sync.h>
 #include <dspbridge/clk.h>
-#include <dspbridge/util.h>
 
 /*  ----------------------------------- This */
 #include <dspbridge/services.h>
@@ -83,7 +82,6 @@ void SERVICES_Exit(void)
 	if (cRefs == 0) {
 		/* Uninitialize all SERVICES modules here */
 		NTFY_Exit();
-		UTIL_Exit();
 		SYNC_Exit();
 		CLK_Exit();
 		REG_Exit();
@@ -109,8 +107,8 @@ void SERVICES_Exit(void)
 bool SERVICES_Init(void)
 {
 	bool fInit = true;
-       bool fCFG, fCSL, fDBG, fDPC, fKFILE, fLST, fMEM;
-       bool fREG, fSYNC, fCLK, fUTIL, fNTFY;
+	bool fCFG, fCSL, fDBG, fDPC, fKFILE, fLST, fMEM;
+	bool fREG, fSYNC, fCLK, fNTFY;
 
 	DBC_Require(cRefs >= 0);
 
@@ -131,22 +129,17 @@ bool SERVICES_Init(void)
 		fDPC = DPC_Init();
 		fKFILE = KFILE_Init();
 		fLST = LST_Init();
-		/* fREG = REG_Init(); */
 		fSYNC = SYNC_Init();
 		fCLK  = CLK_Init();
-		fUTIL = UTIL_Init();
 		fNTFY = NTFY_Init();
 
-               fInit = fCFG && fCSL && fDBG && fDPC && fKFILE &&
-                       fLST && fMEM && fREG && fSYNC && fCLK && fUTIL;
+		fInit = fCFG && fCSL && fDBG && fDPC && fKFILE &&
+			fLST && fMEM && fREG && fSYNC && fCLK;
 
 		if (!fInit) {
 			if (fNTFY)
 				NTFY_Exit();
 
-			if (fUTIL)
-				UTIL_Exit();
-
 			if (fSYNC)
 				SYNC_Exit();
 
drivers/dsp/bridge/wmd/tiomap3430.c +0 -1
index 7a9603d..4919314 100644
@@ -47,7 +47,6 @@
 
 /*  ----------------------------------- OS Adaptation Layer */
 #include <dspbridge/mem.h>
-#include <dspbridge/util.h>
 #include <dspbridge/reg.h>
 #include <dspbridge/dbreg.h>
 #include <dspbridge/cfg.h>
drivers/dsp/bridge/wmd/tiomap3430_pwr.c +0 -1
index 914474f..e5bfb26 100644
@@ -42,7 +42,6 @@
 
 /*  ----------------------------------- OS Adaptation Layer */
 #include <dspbridge/mem.h>
-#include <dspbridge/util.h>
 
 /*  ----------------------------------- Platform Manager */
 #include <dspbridge/brddefs.h>
drivers/dsp/bridge/wmd/tiomap_io.c +0 -1
index 6121e8f..5ef0f9a 100644
@@ -43,7 +43,6 @@
 
 /*  ----------------------------------- OS Adaptation Layer */
 #include <dspbridge/mem.h>
-#include <dspbridge/util.h>
 #include <dspbridge/cfg.h>
 
 /*  ----------------------------------- specific to this file */
Signature · 1 line
1.6.2.4
#2 lore raw

PATCH 2/7 DSPBRIDGE: Allow separate load/run addresses for Dynamic Loader

From: Fernando Guzman Lugo <[email protected]>

Allow separate load/run addresses for Dynamic Loader.

---
 drivers/dsp/bridge/pmgr/dbll.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
drivers/dsp/bridge/pmgr/dbll.c +13 -4
index 82430a3..5e58e80 100644
@@ -1313,6 +1313,7 @@ static int rmmAlloc(struct Dynamic_Loader_Allocate *this,
 	s32 req = -1;
 	s32 count = 0;
 	u32 allocSize = 0;
+	u32 runAddrFlag = 0;
 
 	DBC_Require(this != NULL);
 	lib = pAlloc->lib;
@@ -1357,10 +1358,9 @@ static int rmmAlloc(struct Dynamic_Loader_Allocate *this,
                        if (strcmp(szSecLastToken, "DYN_SARAM") == 0) {
 				segId = 1;
 			} else {
-                               if (strcmp(szSecLastToken,
-				   "DYN_EXTERNAL") == 0) {
+				if (strcmp(szSecLastToken,
+				   "DYN_EXTERNAL") == 0)
 					segId = 2;
-				}
 			}
 		}
 		if (segId != -1) {
@@ -1381,6 +1381,11 @@ func_cont:
 		allocSize = info->size + GEM_L1P_PREFETCH_SIZE;
 	else
 		allocSize = info->size;
+	GT_2trace(DBLL_debugMask, GT_5CLASS,
+			 "Beg info->run_addr = 0x%x, info->load_addr= 0x%x\n",
+			 info->run_addr, info->load_addr);
+	if (info->load_addr != info->run_addr)
+		runAddrFlag = 1;
 	/* TODO - ideally, we can pass the alignment requirement also
 	 * from here */
 	if (lib != NULL) {
@@ -1393,12 +1398,16 @@ func_cont:
 	} else {
 		/* RMM gives word address. Need to convert to byte address */
 		info->load_addr = rmmAddr.addr * DSPWORDSIZE;
-		info->run_addr = info->load_addr;
+		if (!runAddrFlag)
+			info->run_addr = info->load_addr;
 		info->context = (u32)rmmAddr.segid;
 		GT_3trace(DBLL_debugMask, GT_5CLASS,
 			 "Remote alloc: %s  base = 0x%lx len"
 			 "= 0x%lx\n", info->name, info->load_addr / DSPWORDSIZE,
 			 info->size / DSPWORDSIZE);
+		GT_2trace(DBLL_debugMask, GT_5CLASS,
+			 "info->run_addr = 0x%x, info->load_addr= 0x%x\n",
+			 info->run_addr, info->load_addr);
 	}
 	return retVal;
 }
Signature · 1 line
1.6.2.4
#3 lore raw

PATCH 3/7 DSPBRIDGE: Handle properly user space pointers

From: Hari Kanigeri <[email protected]>

This patch fixes bridge crash in UUID_UuidToString function. This error was due to user pointers not handled properly.

---
 drivers/dsp/bridge/pmgr/wcd.c |  147 ++++++++++++++++++++++++++++++-----------
 1 files changed, 109 insertions(+), 38 deletions(-)
drivers/dsp/bridge/pmgr/wcd.c +109 -38
index cd84e4e..995a833 100644
@@ -519,15 +519,38 @@ u32 MGRWRAP_EnumProc_Info(union Trapped_Args *args)
 u32 MGRWRAP_RegisterObject(union Trapped_Args *args)
 {
 	u32 retVal;
+	struct DSP_UUID pUuid;
+	u32 pathSize = 0;
+	char *pszPathName = NULL;
+	DSP_STATUS status = DSP_SOK;
+
+	cp_fm_usr(&pUuid, args->ARGS_MGR_REGISTEROBJECT.pUuid, status, 1);
+	if (DSP_FAILED(status))
+		goto func_end;
+	pathSize = strlen_user((char *)
+				args->ARGS_MGR_REGISTEROBJECT.pszPathName);
+	pszPathName = MEM_Alloc(pathSize, MEM_NONPAGED);
+	if (!pszPathName)
+		goto func_end;
+	retVal = strncpy_from_user(pszPathName,
+			(char *)args->ARGS_MGR_REGISTEROBJECT.pszPathName,
+			pathSize);
+	if (!retVal) {
+		status = DSP_EPOINTER;
+		goto func_end;
+	}
+	pszPathName[pathSize] = '\0';
 
 	GT_1trace(WCD_debugMask, GT_ENTER,
 		 "MGRWRAP_RegisterObject: entered pg2hMsg "
 		 "0x%x\n", args->ARGS_MGR_REGISTEROBJECT.pUuid);
-	retVal = DCD_RegisterObject(WRAP_MAP2CALLER
-		    (args->ARGS_MGR_REGISTEROBJECT.pUuid),
-		    args->ARGS_MGR_REGISTEROBJECT.objType,
-		    WRAP_MAP2CALLER(args->ARGS_MGR_REGISTEROBJECT.pszPathName));
-	return retVal;
+	status = DCD_RegisterObject(&pUuid,
+				args->ARGS_MGR_REGISTEROBJECT.objType,
+				(char *)pszPathName);
+func_end:
+	if (pszPathName)
+		MEM_Free(pszPathName);
+	return status;
 }
 
 /*
@@ -535,16 +558,21 @@ u32 MGRWRAP_RegisterObject(union Trapped_Args *args)
  */
 u32 MGRWRAP_UnregisterObject(union Trapped_Args *args)
 {
-	u32 retVal;
+	DSP_STATUS status = DSP_SOK;
+	struct DSP_UUID pUuid;
+
+	cp_fm_usr(&pUuid, args->ARGS_MGR_REGISTEROBJECT.pUuid, status, 1);
+	if (DSP_FAILED(status))
+		goto func_end;
 
 	GT_1trace(WCD_debugMask, GT_ENTER,
 		 "MGRWRAP_UnregisterObject: entered pg2hMsg"
 		 " 0x%x\n", args->ARGS_MGR_UNREGISTEROBJECT.pUuid);
-	retVal = DCD_UnregisterObject(WRAP_MAP2CALLER
-			(args->ARGS_MGR_UNREGISTEROBJECT.pUuid),
+	status = DCD_UnregisterObject(&pUuid,
 			args->ARGS_MGR_UNREGISTEROBJECT.objType);
+func_end:
+	return status;
 
-	return retVal;
 }
 
 /*
@@ -628,11 +656,15 @@ u32 PROCWRAP_Attach(union Trapped_Args *args)
 		cp_fm_usr(&attrIn, args->ARGS_PROC_ATTACH.pAttrIn, status, 1);
 		if (DSP_SUCCEEDED(status))
 			pAttrIn = &attrIn;
+		else
+			goto func_end;
+
 
 	}
 	status = PROC_Attach(args->ARGS_PROC_ATTACH.uProcessor, pAttrIn,
 			    &processor);
 	cp_to_usr(args->ARGS_PROC_ATTACH.phProcessor, &processor, status, 1);
+func_end:
 	return status;
 }
 
@@ -653,16 +685,20 @@ u32 PROCWRAP_Ctrl(union Trapped_Args *args)
 		 args->ARGS_PROC_CTRL.dwCmd,
 		 args->ARGS_PROC_CTRL.pArgs);
 	if (pSize) {
-		if (get_user(cbDataSize, pSize))
+		if (get_user(cbDataSize, pSize)) {
 			status = DSP_EFAIL;
-
+			goto func_end;
+		}
 		cbDataSize += sizeof(u32);
 		if (DSP_SUCCEEDED(status)) {
 			pArgs = MEM_Alloc(cbDataSize, MEM_NONPAGED);
-			if (pArgs == NULL)
+			if (pArgs == NULL) {
 				status = DSP_EMEMORY;
+				goto func_end;
+			}
+		} else
+			goto func_end;
 
-		}
 		cp_fm_usr(pArgs, args->ARGS_PROC_CTRL.pArgs, status,
 			 cbDataSize);
 	}
@@ -675,7 +711,7 @@ u32 PROCWRAP_Ctrl(union Trapped_Args *args)
 	/* cp_to_usr(args->ARGS_PROC_CTRL.pArgs, pArgs, status, 1);*/
 	if (pArgs)
 		MEM_Free(pArgs);
-
+func_end:
 	return status;
 }
 
@@ -767,7 +803,11 @@ u32 PROCWRAP_InvalidateMemory(union Trapped_Args *args)
  */
 u32 PROCWRAP_EnumResources(union Trapped_Args *args)
 {
-	u32 retVal;
+	DSP_STATUS status = DSP_SOK;
+	struct DSP_RESOURCEINFO pResourceInfo;
+
+	if (DSP_FAILED(status))
+		goto func_end;
 
 	GT_4trace(WCD_debugMask, GT_ENTER,
 		 "PROCWRAP_EnumResources: entered args:\n"
@@ -777,13 +817,17 @@ u32 PROCWRAP_EnumResources(union Trapped_Args *args)
 		 args->ARGS_PROC_ENUMRESOURCES.uResourceType,
 		 args->ARGS_PROC_ENUMRESOURCES.pResourceInfo,
 		 args->ARGS_PROC_ENUMRESOURCES.uResourceInfoSize);
-	retVal = PROC_GetResourceInfo(args->ARGS_PROC_ENUMRESOURCES.hProcessor,
+	status = PROC_GetResourceInfo(args->ARGS_PROC_ENUMRESOURCES.hProcessor,
 			args->ARGS_PROC_ENUMRESOURCES.uResourceType,
-			WRAP_MAP2CALLER(args->ARGS_PROC_ENUMRESOURCES.
-			pResourceInfo), args->ARGS_PROC_ENUMRESOURCES.
-			uResourceInfoSize);
+			&pResourceInfo,
+			args->ARGS_PROC_ENUMRESOURCES.uResourceInfoSize);
+	if (DSP_FAILED(status))
+		goto func_end;
+	cp_to_usr(args->ARGS_PROC_ENUMRESOURCES.pResourceInfo, &pResourceInfo,
+						status, 1);
+func_end:
+	return status;
 
-	return retVal;
 }
 
 /*
@@ -848,11 +892,14 @@ u32 PROCWRAP_Load(union Trapped_Args *args)
 		status = DSP_EMEMORY;
 
 	cp_fm_usr(argv, args->ARGS_PROC_LOAD.aArgv, status, argc);
+	if (DSP_FAILED(status))
+		goto func_cont;
+
 	for (i = 0; DSP_SUCCEEDED(status) && (i < argc); i++) {
 		if (argv[i] != NULL) {
-                        /* User space pointer to argument */
-                       temp = (char *) argv[i];
-                       len = strlen_user((char *)temp);
+			/* User space pointer to argument */
+			temp = (char *) argv[i];
+			len = strlen_user((char *)temp);
 			/* Kernel space pointer to argument */
 			argv[i] = MEM_Alloc(len, MEM_NONPAGED);
 			if (argv[i] == NULL) {
@@ -860,6 +907,9 @@ u32 PROCWRAP_Load(union Trapped_Args *args)
 				break;
 			}
 			cp_fm_usr(argv[i], temp, status, len);
+			if (DSP_FAILED(status))
+				goto func_cont;
+
 		}
 	}
 	/* TODO: validate this */
@@ -868,17 +918,21 @@ u32 PROCWRAP_Load(union Trapped_Args *args)
 		len = 0;
 		do {
 			len++;
-                       get_user(temp, args->ARGS_PROC_LOAD.aEnvp);
-               } while (temp);
+			get_user(temp, args->ARGS_PROC_LOAD.aEnvp);
+		} while (temp);
 		envp = MEM_Alloc(len * sizeof(u8 *), MEM_NONPAGED);
-		if (envp == NULL)
+		if (envp == NULL) {
 			status = DSP_EMEMORY;
+			goto func_cont;
+		}
 
 		cp_fm_usr(envp, args->ARGS_PROC_LOAD.aEnvp, status, len);
+		if (DSP_FAILED(status))
+			goto func_cont;
 		for (i = 0; DSP_SUCCEEDED(status) && (envp[i] != NULL); i++) {
-                        /* User space pointer to argument */
-                       temp = (char *)envp[i];
-                       len = strlen_user((char *)temp);
+			/* User space pointer to argument */
+			temp = (char *)envp[i];
+			len = strlen_user((char *)temp);
 			/* Kernel space pointer to argument */
 			envp[i] = MEM_Alloc(len, MEM_NONPAGED);
 			if (envp[i] == NULL) {
@@ -886,6 +940,8 @@ u32 PROCWRAP_Load(union Trapped_Args *args)
 				break;
 			}
 			cp_fm_usr(envp[i], temp, status, len);
+			if (DSP_FAILED(status))
+				goto func_cont;
 		}
 	}
 	GT_5trace(WCD_debugMask, GT_ENTER,
@@ -899,6 +955,7 @@ u32 PROCWRAP_Load(union Trapped_Args *args)
 				  args->ARGS_PROC_LOAD.iArgc,
 				  (CONST char **)argv, (CONST char **)envp);
 	}
+func_cont:
 	if (envp != NULL) {
 		i = 0;
 		while (envp[i] != NULL)
@@ -1039,7 +1096,7 @@ u32 NODEWRAP_Allocate(union Trapped_Args *args)
 {
 	DSP_STATUS status = DSP_SOK;
 	struct DSP_UUID nodeId;
-	u32 cbDataSize;
+	u32 cbDataSize = 0;
 	u32 __user *pSize = (u32 __user *)args->ARGS_NODE_ALLOCATE.pArgs;
 	u8 *pArgs = NULL;
 	struct DSP_NODEATTRIN attrIn, *pAttrIn = NULL;
@@ -1063,11 +1120,15 @@ u32 NODEWRAP_Allocate(union Trapped_Args *args)
 			 cbDataSize);
 	}
 	cp_fm_usr(&nodeId, args->ARGS_NODE_ALLOCATE.pNodeID, status, 1);
+	if (DSP_FAILED(status))
+		goto func_cont;
 	/* Optional argument */
 	if (args->ARGS_NODE_ALLOCATE.pAttrIn) {
 		cp_fm_usr(&attrIn, args->ARGS_NODE_ALLOCATE.pAttrIn, status, 1);
 		if (DSP_SUCCEEDED(status))
 			pAttrIn = &attrIn;
+		else
+			status = DSP_EMEMORY;
 
 	}
 	if (DSP_SUCCEEDED(status)) {
@@ -1076,6 +1137,7 @@ u32 NODEWRAP_Allocate(union Trapped_Args *args)
 				      pAttrIn, &hNode);
 	}
 	cp_to_usr(args->ARGS_NODE_ALLOCATE.phNode, &hNode, status, 1);
+func_cont:
 	if (pArgs)
 		MEM_Free(pArgs);
 
@@ -1105,7 +1167,7 @@ u32 NODEWRAP_AllocMsgBuf(union Trapped_Args *args)
 					 args->ARGS_NODE_ALLOCMSGBUF.uSize,
 					 pAttr, &pBuffer);
 	}
-	cp_to_usr(args->ARGS_NODE_ALLOCMSGBUF.pBuffer, &pBuffer, status, 1)
+	cp_to_usr(args->ARGS_NODE_ALLOCMSGBUF.pBuffer, &pBuffer, status, 1);
 	return status;
 }
 
@@ -1146,12 +1208,16 @@ u32 NODEWRAP_Connect(union Trapped_Args *args)
 		cbDataSize += sizeof(u32);
 		if (DSP_SUCCEEDED(status)) {
 			pArgs = MEM_Alloc(cbDataSize, MEM_NONPAGED);
-			if (pArgs == NULL)
+			if (pArgs == NULL) {
 				status = DSP_EMEMORY;
+				goto func_cont;
+			}
 
 		}
 		cp_fm_usr(pArgs, args->ARGS_NODE_CONNECT.pConnParam, status,
 			 cbDataSize);
+		if (DSP_FAILED(status))
+			goto func_cont;
 	}
 	if (args->ARGS_NODE_CONNECT.pAttrs) {	/* Optional argument */
 		cp_fm_usr(&attrs, args->ARGS_NODE_CONNECT.pAttrs, status, 1);
@@ -1166,6 +1232,7 @@ u32 NODEWRAP_Connect(union Trapped_Args *args)
 				     args->ARGS_NODE_CONNECT.uOtherStream,
 				     pAttrs, (struct DSP_CBDATA *)pArgs);
 	}
+func_cont:
 	if (pArgs)
 		MEM_Free(pArgs);
 
@@ -1358,6 +1425,8 @@ u32 NODEWRAP_GetUUIDProps(union Trapped_Args *args)
 
 
 	cp_fm_usr(&nodeId, args->ARGS_NODE_GETUUIDPROPS.pNodeID, status, 1);
+	if (DSP_FAILED(status))
+		goto func_cont;
 	pnodeProps = MEM_Alloc(sizeof(struct DSP_NDBPROPS), MEM_NONPAGED);
 	if (pnodeProps != NULL) {
 		status = NODE_GetUUIDProps(args->
@@ -1365,8 +1434,9 @@ u32 NODEWRAP_GetUUIDProps(union Trapped_Args *args)
 					  &nodeId, pnodeProps);
 		cp_to_usr(args->ARGS_NODE_GETUUIDPROPS.pNodeProps, pnodeProps,
 			 status, 1);
-	}	else
+	} else
 		status = DSP_EMEMORY;
+func_cont:
 	if (pnodeProps)
 		MEM_Free(pnodeProps);
 	return status;
@@ -1487,16 +1557,17 @@ u32 STRMWRAP_Idle(union Trapped_Args *args)
  */
 u32 STRMWRAP_Issue(union Trapped_Args *args)
 {
-	u32 retVal;
-
-	retVal = STRM_Issue(args->ARGS_STRM_ISSUE.hStream,
+	DSP_STATUS status = DSP_SOK;
+	/* No need of doing cp_fm_usr for the user buffer (pBuffer)
+	as this is done in Bridge internal function WMD_CHNL_AddIOReq
+	in chnl_sm.c */
+	status = STRM_Issue(args->ARGS_STRM_ISSUE.hStream,
 			args->ARGS_STRM_ISSUE.pBuffer,
 			args->ARGS_STRM_ISSUE.dwBytes,
 			args->ARGS_STRM_ISSUE.dwBufSize,
 			args->ARGS_STRM_ISSUE.dwArg);
 
-	/* This is a user space pointer */
-	return retVal;
+	return status;
 }
 
 /*
Signature · 1 line
1.6.2.4
#4 lore raw

PATCH 4/7 DSPBRIDGE: Shared memory size increased to 5MB

Increase the shared memory size to 5MB, bridge initialization should reserve 5MB of shared memory by default.

---
 drivers/dsp/bridge/rmgr/drv_interface.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dsp/bridge/rmgr/drv_interface.c +1 -1
index f41e153..eaac89d 100644
@@ -129,7 +129,7 @@ static s32 driver_minor = DRIVER_MINOR;
 static char *base_img;
 char *iva_img;
 static char *num_procs = "C55=1";
-static s32 shm_size = 0x400000;	/* 4 MB */
+static s32 shm_size = 0x500000;	/* 5 MB */
 static u32 phys_mempool_base;
 static u32 phys_mempool_size;
 static int tc_wordswapon;	/* Default value is always false */
Signature · 1 line
1.6.2.4
#5 lore raw

PATCH 5/7 DSPBRIDGE: Increased DMM size to 256MB

From: Hari Kanigeri <[email protected]>

This patch increases the DMM from 64MB to 256MB.

---
 arch/arm/plat-omap/include/dspbridge/dmm.h |    2 +-
 drivers/dsp/bridge/pmgr/dmm.c              |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
arch/arm/plat-omap/include/dspbridge/dmm.h +1 -1
index ef37668..37f272f 100644
@@ -41,7 +41,7 @@
 		u32 reserved;
 	} ;
 
-#define DMMPOOLSIZE      0x4000000
+#define DMMPOOLSIZE      0x10000000
 
 /*
  *  ======== DMM_GetHandle ========
drivers/dsp/bridge/pmgr/dmm.c +4 -4
index 803de93..19b8f29 100644
@@ -103,10 +103,10 @@ static struct GT_Mask DMM_debugMask = { NULL, NULL };	/* GT trace variable */
 
 static u32 cRefs;		/* module reference count */
 struct MapPage {
-	u32   RegionSize:15;
-	u32   MappedSize:15;
-	u32   bReserved:1;
-	u32   bMapped:1;
+	u64   RegionSize:31;
+	u64   MappedSize:31;
+	u64   bReserved:1;
+	u64   bMapped:1;
 };
 
 /*  Create the free list */
Signature · 1 line
1.6.2.4
#6 lore raw

PATCH 6/7 DSPBRIDGE: Keep DMM resources for other nodes on PROC_Detach

From: Hari Kanigeri <[email protected]>

Removed resource cleanup for DMM on PROC_Detach due to LCML detaching the processor when it deletes each node, therefore resource cleanup was freeing DMM resources of other nodes that might be still in use, this would cause unexpected behavior, possibly MMU fault.

---
 drivers/dsp/bridge/rmgr/proc.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/dsp/bridge/rmgr/proc.c +1 -3
index 43f2d29..f6045bb 100644
@@ -658,10 +658,8 @@ DSP_STATUS PROC_Detach(DSP_HPROCESSOR hProcessor)
 			DRV_GetProcContext(hProcess,
 				(struct DRV_OBJECT *)hDRVObject, &pPctxt,
 					 NULL, 0);
-			if (pPctxt != NULL) {
-				DRV_ProcFreeDMMRes(pPctxt);
+			if (pPctxt != NULL)
 				pPctxt->hProcessor = NULL;
-			}
 		}
 #endif
 		/* Notify the Client */
Signature · 1 line
1.6.2.4
#7 lore raw

PATCH 7/7 DSPBRIDGE: Reset MMU and DSP on board stop

From: Fernando Guzman Lugo <[email protected]>

This patch resets MMU and DSP by writintg into those registers, this will solve MMU faults occured when the processor is stopped.

---
 drivers/dsp/bridge/wmd/tiomap3430.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/dsp/bridge/wmd/tiomap3430.c +4 -1
index 4919314..b317015 100644
@@ -849,6 +849,9 @@ static DSP_STATUS WMD_BRD_Stop(struct WMD_DEV_CONTEXT *hDevContext)
 		       (pPtAttrs->L2NumPages * sizeof(struct PageInfo)));
 	}
 	DBG_Trace(DBG_LEVEL6, "WMD_BRD_Stop - End ****** \n");
+	HW_RST_Reset(resources.dwPrmBase, HW_RST1_IVA2);
+	HW_RST_Reset(resources.dwPrmBase, HW_RST2_IVA2);
+
 	return status;
 }
 
@@ -911,7 +914,7 @@ static DSP_STATUS WMD_BRD_Delete(struct WMD_DEV_CONTEXT *hDevContext)
 		memset((u8 *)pPtAttrs->pgInfo, 0x00,
 			(pPtAttrs->L2NumPages * sizeof(struct PageInfo)));
 	}
-	DBG_Trace(DBG_LEVEL6, "WMD_BRD_Stop - End ****** \n");
+	DBG_Trace(DBG_LEVEL6, "WMD_BRD_Delete - End ****** \n");
 	HW_RST_Reset(resources.dwPrmBase, HW_RST1_IVA2);
 	HW_RST_Reset(resources.dwPrmBase, HW_RST2_IVA2);
 
Signature · 1 line
1.6.2.4