summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Peiffer <pierre.peiffer@stericsson.com>2011-08-26 13:23:25 +0200
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-22 11:06:58 +0200
commit44a446451bde6f886f923facf15ce527ade4b96a (patch)
treec86a6177e320281ea2c98bedba370d5fef383833
parentd312fc107db52f15908d173a0b6638be57b9a431 (diff)
U8500 CM: execute services before detroying component
Force MMDSP to have executed all previous services before detroying the components: service construct / start / stop on a component could remain on the pipe when the component is destroyed. ST-Ericsson ID: 358445 ST-Ericsson Linux next: - ST-Ericsson FOSS-OUT ID: Trivial Signed-off-by: Pierre Peiffer <pierre.peiffer@stericsson.com> Change-Id: Icd8c0fe7d567128562599e928b381514e4a71fa8
-rw-r--r--drivers/staging/nmf-cm/cm/engine/component/inc/initializer.h1
-rw-r--r--drivers/staging/nmf-cm/cm/engine/component/src/binder_check.c8
-rw-r--r--drivers/staging/nmf-cm/cm/engine/component/src/initializer.c32
-rw-r--r--drivers/staging/nmf-cm/cm/engine/component/src/instantiater.c4
-rw-r--r--drivers/staging/nmf-cm/cm_debug.h9
-rw-r--r--drivers/staging/nmf-cm/cm_service.c4
-rw-r--r--drivers/staging/nmf-cm/cmld.c22
-rw-r--r--drivers/staging/nmf-cm/cmld.h4
-rw-r--r--drivers/staging/nmf-cm/inc/nmf-def.h2
-rw-r--r--drivers/staging/nmf-cm/osal-kernel.c6
10 files changed, 64 insertions, 28 deletions
diff --git a/drivers/staging/nmf-cm/cm/engine/component/inc/initializer.h b/drivers/staging/nmf-cm/cm/engine/component/inc/initializer.h
index b4416f3ce20..5ac9ec453b7 100644
--- a/drivers/staging/nmf-cm/cm/engine/component/inc/initializer.h
+++ b/drivers/staging/nmf-cm/cm/engine/component/inc/initializer.h
@@ -15,6 +15,7 @@
PUBLIC t_cm_error cm_COMP_INIT_Init(t_nmf_core_id coreId);
PUBLIC t_cm_error cm_COMP_CallService(int serviceIndex, t_component_instance *pComp, t_uint32 methodAddress);
+PUBLIC void cm_COMP_Flush(t_nmf_core_id coreId);
PUBLIC void cm_COMP_INIT_Close(t_nmf_core_id coreId);
PUBLIC t_cm_error cm_COMP_UpdateStack(t_nmf_core_id coreId, t_uint32 stackSize);
PUBLIC t_cm_error cm_COMP_ULPForceWakeup(t_nmf_core_id coreId);
diff --git a/drivers/staging/nmf-cm/cm/engine/component/src/binder_check.c b/drivers/staging/nmf-cm/cm/engine/component/src/binder_check.c
index 8a3c3c33de8..373fea0cd47 100644
--- a/drivers/staging/nmf-cm/cm/engine/component/src/binder_check.c
+++ b/drivers/staging/nmf-cm/cm/engine/component/src/binder_check.c
@@ -40,10 +40,10 @@ t_cm_error cm_checkValidClient(
t_interface_reference* itfRef = &client->interfaceReferences[itfRequire->requireIndex][itfRequire->collectionIndex];
if(itfRef->instance == (const t_component_instance*)NMF_VOID_COMPONENT)
- ERROR("CM_INTERFACE_ALREADY_BINDED(): Component (%s<%s>.s) already bound to VOID\n",
+ ERROR("CM_INTERFACE_ALREADY_BINDED(): Component (%s<%s>.%s) already bound to VOID\n",
client->pathname, client->Template->name, requiredItfClientName, 0, 0, 0);
else
- ERROR("CM_INTERFACE_ALREADY_BINDED(): Component (%s<%s>.s) already bound to another server (%s<%s>.%s)\n",
+ ERROR("CM_INTERFACE_ALREADY_BINDED(): Component (%s<%s>.%s) already bound to another server (%s<%s>.%s)\n",
client->pathname, client->Template->name, requiredItfClientName,
itfRef->instance->pathname, itfRef->instance->Template->name, itfRef->instance->Template->provides[itfRef->provideIndex].name);
return CM_INTERFACE_ALREADY_BINDED;
@@ -116,7 +116,7 @@ t_cm_error cm_checkValidBinding(
{
if(itfRef->instance == (const t_component_instance*)NMF_VOID_COMPONENT)
{
- ERROR("CM_INTERFACE_ALREADY_BINDED(): Singleton (%s<%s>.s) already bound to VOID\n",
+ ERROR("CM_INTERFACE_ALREADY_BINDED(): Singleton (%s<%s>.%s) already bound to VOID\n",
client->pathname, client->Template->name, requiredItfClientName, 0, 0, 0);
return CM_INTERFACE_ALREADY_BINDED;
}
@@ -130,7 +130,7 @@ t_cm_error cm_checkValidBinding(
}
else
{
- ERROR("CM_INTERFACE_ALREADY_BINDED(): Singleton (%s<%s>.s) already bound to different server (%s<%s>.%s)\n",
+ ERROR("CM_INTERFACE_ALREADY_BINDED(): Singleton (%s<%s>.%s) already bound to different server (%s<%s>.%s)\n",
client->pathname, client->Template->name, requiredItfClientName,
itfRef->instance->pathname, itfRef->instance->Template->name, itfRef->instance->Template->provides[itfRef->provideIndex].name);
return CM_INTERFACE_ALREADY_BINDED;
diff --git a/drivers/staging/nmf-cm/cm/engine/component/src/initializer.c b/drivers/staging/nmf-cm/cm/engine/component/src/initializer.c
index 6950efb76b6..011dfa18398 100644
--- a/drivers/staging/nmf-cm/cm/engine/component/src/initializer.c
+++ b/drivers/staging/nmf-cm/cm/engine/component/src/initializer.c
@@ -33,6 +33,7 @@ static struct {
t_nmf_fifo_arm_desc* uplinkFifo;
t_memory_handle dspfifoHandle;
t_nmf_osal_sem_handle fifoSemHandle;
+ t_uint32 servicePending; // TODO : Use sem counter instead of defining such variable (need to create new OSAL)
} initializerDesc[NB_CORE_IDS];
PUBLIC t_cm_error cm_COMP_INIT_Init(t_nmf_core_id coreId)
@@ -63,6 +64,7 @@ PUBLIC t_cm_error cm_COMP_INIT_Init(t_nmf_core_id coreId)
return error;
/* create fifo semaphore */
+ initializerDesc[coreId].servicePending = 0;
initializerDesc[coreId].fifoSemHandle = OSAL_CreateSemaphore(DEFAULT_INITIALIZER_FIFO_SIZE);
if (initializerDesc[coreId].fifoSemHandle == 0) {
dspevent_destroyDspEventFifo(initializerDesc[coreId].dspfifoHandle);
@@ -158,6 +160,31 @@ PUBLIC t_cm_error cm_COMP_CallService(
return error;
}
+PUBLIC void cm_COMP_Flush(t_nmf_core_id coreId) {
+
+ if(initializerDesc[coreId].servicePending > 0)
+ {
+ t_uint16 params[INIT_COMPONENT_CMD_SIZE];
+ t_uint32 methodAddress = cm_EEM_getExecutiveEngine(coreId)->voidAddr;
+
+ // If service still pending on MMDSP side, send a flush command (today, we reuse Destroy to not create new empty service)
+ // When we receive the result, this mean that we have flushed all previous request.
+
+ params[INIT_COMPONENT_CMD_HANDLE_INDEX] = (t_uint16)(0x0 & 0xFFFF);
+ params[INIT_COMPONENT_CMD_HANDLE_INDEX+1] = (t_uint16)(0x0 >> 16);
+ params[INIT_COMPONENT_CMD_THIS_INDEX] = (t_uint16)(0x0 & 0xFFFF);
+ params[INIT_COMPONENT_CMD_THIS_INDEX+1] = (t_uint16)(0x0 >> 16);
+ params[INIT_COMPONENT_CMD_METHOD_INDEX] = (t_uint16)(methodAddress & 0xFFFF);
+ params[INIT_COMPONENT_CMD_METHOD_INDEX+1] = (t_uint16)(methodAddress >> 16);
+
+ if (cm_COMP_generic(coreId, params, sizeof(params) / sizeof(t_uint16), NMF_DESTROY_INDEX) != CM_OK ||
+ OSAL_SEMAPHORE_WAIT_TIMEOUT(semHandle) != SYNC_OK)
+ {
+ ERROR("CM_MPC_NOT_RESPONDING: can't call flush service\n", 0, 0, 0, 0, 0, 0);
+ }
+ }
+}
+
PUBLIC void cm_COMP_INIT_Close(t_nmf_core_id coreId)
{
unsigned int i;
@@ -187,6 +214,7 @@ PUBLIC void processAsyncAcknowledge(t_nmf_core_id coreId, t_event_params_handle
{
cm_AcknowledgeEvent(initializerDesc[coreId].uplinkFifo);
+ initializerDesc[coreId].servicePending--;
OSAL_SemaphorePost(initializerDesc[coreId].fifoSemHandle,1);
}
@@ -194,6 +222,7 @@ PUBLIC void processSyncAcknowledge(t_nmf_core_id coreId, t_event_params_handle p
{
cm_AcknowledgeEvent(initializerDesc[coreId].uplinkFifo);
+ initializerDesc[coreId].servicePending--;
OSAL_SemaphorePost(initializerDesc[coreId].fifoSemHandle,1);
OSAL_SemaphorePost(semHandle,1);
}
@@ -309,6 +338,7 @@ PRIVATE t_cm_error cm_COMP_generic(
if (OSAL_SEMAPHORE_WAIT_TIMEOUT(initializerDesc[coreId].fifoSemHandle) != SYNC_OK)
return CM_MPC_NOT_RESPONDING;
+
// AllocEvent
if((_xyuv_data = cm_AllocEvent(initializerDesc[coreId].downlinkFifo)) == NULL)
{
@@ -325,6 +355,8 @@ PRIVATE t_cm_error cm_COMP_generic(
// Send Command
error = cm_PushEventTrace(initializerDesc[coreId].downlinkFifo, _xyuv_data, serviceIndex,0);
+ if(error == CM_OK)
+ initializerDesc[coreId].servicePending++;
unlock:
OSAL_UNLOCK_COM();
diff --git a/drivers/staging/nmf-cm/cm/engine/component/src/instantiater.c b/drivers/staging/nmf-cm/cm/engine/component/src/instantiater.c
index b7b42802cea..bd410c9acd9 100644
--- a/drivers/staging/nmf-cm/cm/engine/component/src/instantiater.c
+++ b/drivers/staging/nmf-cm/cm/engine/component/src/instantiater.c
@@ -745,6 +745,10 @@ t_cm_error cm_destroyInstance(t_component_instance* component, t_destroy_state f
ERROR("CM_MPC_NOT_RESPONDING: can't call destroy '%s'\n", component->pathname, 0, 0, 0, 0, 0);
}
}
+ else
+ {
+ cm_COMP_Flush(component->Template->dspId);
+ }
}
cm_delayedDestroyComponent(component);
diff --git a/drivers/staging/nmf-cm/cm_debug.h b/drivers/staging/nmf-cm/cm_debug.h
index 8afb3550c0c..26c80682d11 100644
--- a/drivers/staging/nmf-cm/cm_debug.h
+++ b/drivers/staging/nmf-cm/cm_debug.h
@@ -15,5 +15,14 @@ void cm_debug_exit(void);
void cm_debug_proc_init(struct cm_process_priv *entry);
void cm_debug_create_tcm_file(unsigned mpc_index);
void cm_debug_destroy_tcm_file(unsigned mpc_index);
+
+#else
+
+#define cm_debug_init()
+#define cm_debug_exit()
+#define cm_debug_proc_init(entry)
+#define cm_debug_create_tcm_file(mpc_index)
+#define cm_debug_destroy_tcm_file(mpc_index)
+
#endif /* CONFIG_DEBUG_FS */
#endif /* CM_DEBUG_H */
diff --git a/drivers/staging/nmf-cm/cm_service.c b/drivers/staging/nmf-cm/cm_service.c
index 06cfbc74146..70cf6f37524 100644
--- a/drivers/staging/nmf-cm/cm_service.c
+++ b/drivers/staging/nmf-cm/cm_service.c
@@ -56,7 +56,7 @@ void dispatch_service_msg(struct osal_msg *msg)
memcpy(new_msg, msg, msg_size);
plist_node_init(&new_msg->msg_entry, 0);
#ifdef CONFIG_DEBUG_FS
- if (user_has_debugfs && dump_flag_to_set
+ if (cmld_user_has_debugfs && dump_flag_to_set
&& (new_msg->d.srv.srvType == NMF_SERVICE_PANIC)) {
/*
* The reciever of this message will do the DSP
@@ -65,7 +65,7 @@ void dispatch_service_msg(struct osal_msg *msg)
new_msg->d.srv.srvData.panic.panicSource
|= DEBUGFS_DUMP_FLAG;
dump_flag_to_set = false;
- dump_done = false;
+ cmld_dump_ongoing = true;
}
#endif
spin_lock_bh(&channelPriv->bh_lock);
diff --git a/drivers/staging/nmf-cm/cmld.c b/drivers/staging/nmf-cm/cmld.c
index 4c754c55b72..9e26955d100 100644
--- a/drivers/staging/nmf-cm/cmld.c
+++ b/drivers/staging/nmf-cm/cmld.c
@@ -28,7 +28,7 @@
#include "cm_service.h"
#include "cm_dma.h"
-#define CMDRIVER_PATCH_VERSION 112
+#define CMDRIVER_PATCH_VERSION 115
#define O_FLUSH 0x1000000
static int cmld_major;
@@ -50,9 +50,9 @@ static DEFINE_MUTEX(channel_lock); /* lock used to protect previous list */
#ifdef CONFIG_DEBUG_FS
/* Debugfs support */
-bool user_has_debugfs = false;
-bool dump_done = true;
-module_param(dump_done, bool, S_IWUSR|S_IRUGO);
+bool cmld_user_has_debugfs = false;
+bool cmld_dump_ongoing = false;
+module_param(cmld_dump_ongoing, bool, S_IWUSR|S_IRUGO);
static DECLARE_WAIT_QUEUE_HEAD(dump_waitq);
#endif
@@ -88,9 +88,7 @@ static inline struct cm_process_priv *getProcessPriv(void)
entry->pid = current->tgid;
mutex_lock(&process_lock);
list_add(&entry->entry, &process_list);
-#ifdef CONFIG_DEBUG_FS
cm_debug_proc_init(entry);
-#endif
out:
mutex_unlock(&process_lock);
return entry;
@@ -692,7 +690,7 @@ static long cmld_control_ctl(struct file *file, unsigned int cmd, unsigned long
return -ENOENT;
case CM_PRIV_DEBUGFS_READY:
#ifdef CONFIG_DEBUG_FS
- user_has_debugfs = true;
+ cmld_user_has_debugfs = true;
#endif
return 0;
case CM_PRIV_DEBUGFS_DUMP_DONE:
@@ -715,10 +713,10 @@ static long cmld_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
#ifdef CONFIG_DEBUG_FS
if (cmd == CM_PRIV_DEBUGFS_DUMP_DONE) {
- dump_done = true;
+ cmld_dump_ongoing = false;
wake_up_interruptible(&dump_waitq);
return 0;
- } else if (wait_event_interruptible(dump_waitq, dump_done))
+ } else if (wait_event_interruptible(dump_waitq, (!cmld_dump_ongoing)))
return -ERESTARTSYS;
#endif
@@ -1161,13 +1159,11 @@ static int __init cmld_init_module(void)
CMDRIVER_PATCH_VERSION);
}
-#ifdef CONFIG_DEBUG_FS
cm_debug_init();
if (osal_debug_ops.domain_create) {
osal_debug_ops.domain_create(DEFAULT_SVA_DOMAIN);
osal_debug_ops.domain_create(DEFAULT_SIA_DOMAIN);
}
-#endif
/* Configure MPC Cores */
for (i=0; i<NB_MPC; i++) {
@@ -1195,9 +1191,7 @@ static int __init cmld_init_module(void)
return 0;
out_all:
-#ifdef CONFIG_DEBUG_FS
cm_debug_exit();
-#endif
free_mpc_irqs(i);
CM_ENGINE_Destroy();
i=ARRAY_SIZE(cmld_devname);
@@ -1255,9 +1249,7 @@ static void __exit cmld_cleanup_module(void)
#ifdef CM_DEBUG_ALLOC
cleanup_debug_alloc();
#endif
-#ifdef CONFIG_DEBUG_FS
cm_debug_exit();
-#endif
}
module_init(cmld_init_module);
module_exit(cmld_cleanup_module);
diff --git a/drivers/staging/nmf-cm/cmld.h b/drivers/staging/nmf-cm/cmld.h
index 5e566fa4090..4c5a5bed7e6 100644
--- a/drivers/staging/nmf-cm/cmld.h
+++ b/drivers/staging/nmf-cm/cmld.h
@@ -75,8 +75,8 @@ struct memAreaDesc_t {
extern struct list_head channel_list; /**< List of all allocated channel structures */
extern struct list_head process_list; /**< List of all allocated process private structure */
#ifdef CONFIG_DEBUG_FS
-extern bool user_has_debugfs; /**< Whether user side has proper support of debugfs to take a dump */
-extern bool dump_done; /**< Whether a dump has to be taken or not */
+extern bool cmld_user_has_debugfs; /**< Whether user side has proper support of debugfs to take a dump */
+extern bool cmld_dump_ongoing; /**< Whether a dump is on-going */
#endif
/** Lock/unlock per process mutex
diff --git a/drivers/staging/nmf-cm/inc/nmf-def.h b/drivers/staging/nmf-cm/inc/nmf-def.h
index b095eb883f4..f7a60383198 100644
--- a/drivers/staging/nmf-cm/inc/nmf-def.h
+++ b/drivers/staging/nmf-cm/inc/nmf-def.h
@@ -21,7 +21,7 @@
*
* \ingroup NMF_VERSION
*/
-#define NMF_VERSION ((2 << 16) | (10 << 8) | (114))
+#define NMF_VERSION ((2 << 16) | (10 << 8) | (115))
/*!
* \brief Get NMF major version corresponding to NMF version number
diff --git a/drivers/staging/nmf-cm/osal-kernel.c b/drivers/staging/nmf-cm/osal-kernel.c
index 12a88923f50..d50d1215646 100644
--- a/drivers/staging/nmf-cm/osal-kernel.c
+++ b/drivers/staging/nmf-cm/osal-kernel.c
@@ -847,9 +847,8 @@ void OSAL_DisablePwrRessource(t_nmf_power_resource resource, t_uint32 firstParam
return;
}
-#ifdef CONFIG_DEBUG_FS
cm_debug_destroy_tcm_file(idx);
-#endif
+
/* Stop the DSP load monitoring */
clear_bit(idx, &running_dsp);
if (osalEnv.mpc[idx].monitor_tsk) {
@@ -985,9 +984,8 @@ t_cm_error OSAL_EnablePwrRessource(t_nmf_power_resource resource, t_uint32 first
"thread: %ld\n", PTR_ERR(osalEnv.mpc[idx].monitor_tsk));
osalEnv.mpc[idx].monitor_tsk = NULL;
}
-#ifdef CONFIG_DEBUG_FS
+
cm_debug_create_tcm_file(idx);
-#endif
break;
}
case CM_OSAL_POWER_SxA_AUTOIDLE: