author | Robert Tivy <rtivy@ti.com> | |
Fri, 19 Jun 2015 18:11:05 +0000 (11:11 -0700) | ||
committer | Robert Tivy <rtivy@ti.com> | |
Fri, 19 Jun 2015 18:11:05 +0000 (11:11 -0700) |
index 3c26db1f6deb312045381b6596b2793332c5444b..901a6a1a94577e9273be495d83c70aab37d16708 100644 (file)
--- a/linux/include/_GateMP.h
+++ b/linux/include/_GateMP.h
/* Stop the GateMP module */
Int GateMP_stop(Void);
+Int GateMP_attach(UInt16 procId);
+Int GateMP_detach(UInt16 procId);
+
#if defined (__cplusplus)
}
#endif /* defined (__cplusplus) */
diff --git a/linux/include/_lad.h b/linux/include/_lad.h
index 3cffe83a52c14991a06dd9b244c4a68d645694f0..b0a9c821cf15391df93732dc9c92897d04ae656e 100644 (file)
--- a/linux/include/_lad.h
+++ b/linux/include/_lad.h
LAD_MESSAGEQ_DELETE,
LAD_MESSAGEQ_MSGINIT,
LAD_MULTIPROC_GETCONFIG,
+ LAD_GATEMP_ATTACH,
+ LAD_GATEMP_DETACH,
LAD_GATEMP_START,
LAD_GATEMP_GETNUMRESOURCES,
LAD_GATEMP_GETFREERESOURCE,
diff --git a/linux/src/api/Ipc.c b/linux/src/api/Ipc.c
index 42ac0cbe415ad0a8d75f71e7fd5dc3a81d60cbbd..e81700c6762a388ab40b77b614dad93b6dab87fa 100644 (file)
--- a/linux/src/api/Ipc.c
+++ b/linux/src/api/Ipc.c
{
Int status = Ipc_S_SUCCESS;
UInt16 clusterId;
+#if defined(GATEMP_SUPPORT)
+ Int ret;
+#endif
/* cannot attach to yourself */
if (MultiProc_self() == procId) {
/* hack: bind all existing message queues to remote processor */
MessageQ_bind(procId);
+#if defined(GATEMP_SUPPORT)
+ if (GateMP_isSetup()) {
+ /* establish GateMP connection to remote processor */
+ ret = GateMP_attach(procId);
+
+ if (ret < 0) {
+ PRINTVERBOSE1("Ipc_attach: failed to GateMP_attach to procId %d\n",
+ procId);
+ }
+ }
+#endif
+
/* getting here means we have successfully attached */
Ipc_module.attached[clusterId]++;
{
Int status = Ipc_S_SUCCESS;
UInt16 clusterId;
+#if defined(GATEMP_SUPPORT)
+ Int ret;
+#endif
/* cannot detach from yourself */
if (MultiProc_self() == procId) {
goto done;
}
+#if defined(GATEMP_SUPPORT)
+ if (GateMP_isSetup()) {
+ /* establish GateMP connection to remote processor */
+ ret = GateMP_detach(procId);
+
+ if (ret < 0) {
+ PRINTVERBOSE1("Ipc_detach: failed to GateMP_detach from procId %d\n",
+ procId);
+ }
+ }
+#endif
+
/* hack: unbind all existing message queues from remote processor */
MessageQ_unbind(procId);
index e9d17c2b0adcd18de9a805cf57a4a3399ac5169d..e71629dd1dbfec212fe47dcd7df062a268bdd36f 100644 (file)
.remoteProtect = GateMP_RemoteProtect_SYSTEM
};
+/*
+ * ======== GateMP_attach ========
+ * Internal function.
+ */
+Int GateMP_attach(UInt16 procId)
+{
+ Int status;
+ LAD_ClientHandle clHandle;
+ struct LAD_CommandObj cmd;
+ union LAD_ResponseObj rsp;
+
+ clHandle = LAD_findHandle();
+
+ if (clHandle == LAD_MAXNUMCLIENTS) {
+ PRINTVERBOSE0("GateMP_attach: not connected to LAD\n");
+ return (GateMP_E_RESOURCE);
+ }
+
+ cmd.cmd = LAD_GATEMP_ATTACH;
+ cmd.clientId = clHandle;
+ cmd.args.attach.procId = procId;
+
+ if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) {
+ PRINTVERBOSE1("GateMP_attach: sending LAD command failed, "
+ "status=%d\n", status);
+ return (GateMP_E_FAIL);
+ }
+
+ if ((status = LAD_getResponse(clHandle, &rsp)) != LAD_SUCCESS) {
+ PRINTVERBOSE1("GateMP_attach: no LAD response, status=%d\n",
+ status);
+ return (GateMP_E_FAIL);
+ }
+
+ status = rsp.status;
+ PRINTVERBOSE1("GateMP_attach: LAD response, status=%d\n", status)
+
+ return (status);
+}
+
+/*
+ * ======== GateMP_detach ========
+ * Internal function.
+ */
+Int GateMP_detach(UInt16 procId)
+{
+ Int status;
+ LAD_ClientHandle clHandle;
+ struct LAD_CommandObj cmd;
+ union LAD_ResponseObj rsp;
+
+ clHandle = LAD_findHandle();
+
+ if (clHandle == LAD_MAXNUMCLIENTS) {
+ PRINTVERBOSE0("GateMP_detach: not connected to LAD\n");
+ return (GateMP_E_RESOURCE);
+ }
+
+ cmd.cmd = LAD_GATEMP_DETACH;
+ cmd.clientId = clHandle;
+ cmd.args.detach.procId = procId;
+
+ if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) {
+ PRINTVERBOSE1("GateMP_detach: sending LAD command failed, "
+ "status=%d\n", status);
+ return (GateMP_E_FAIL);
+ }
+
+ if ((status = LAD_getResponse(clHandle, &rsp)) != LAD_SUCCESS) {
+ PRINTVERBOSE1("GateMP_detach: no LAD response, status=%d\n",
+ status);
+ return (GateMP_E_FAIL);
+ }
+
+ status = rsp.status;
+ PRINTVERBOSE1("GateMP_detach: LAD response, status=%d\n", status)
+
+ return (status);
+}
+
Int GateMP_start(Void)
{
Int status;
index d2db25d3bed18809991fd4058ad5ef34ed658f03..7e689d1634e06a11f2b3176205ff67bf5c1b370d 100644 (file)
GateMP_Handle defaultGate;
NameServer_Handle nameServer;
Bool isSetup;
+ Int refCount[MultiProc_MAXPROCESSORS];
+ UInt16 attachedProcId;
} GateMP_ModuleObject;
/* Internal functions */
-static Int GateMP_openDefaultGate(GateMP_Handle *handlePtr);
+static Int GateMP_openDefaultGate(GateMP_Handle *handlePtr, UInt16 procId[]);
static Int GateMP_closeDefaultGate(GateMP_Handle *handlePtr);
/* =============================================================================
.remoteCustom2InUse = NULL,
.defaultGate = NULL,
.nameServer = NULL,
- .isSetup = FALSE
+ .isSetup = FALSE,
+ .refCount = {0},
+ .attachedProcId = MultiProc_INVALIDID,
};
static GateMP_ModuleObject * GateMP_module = &GateMP_state;
* =============================================================================
*/
-/* Function to setup the gatemp module. */
+/*
+ * Function to setup the gatemp module.
+ *
+ * No need to refCount this since it's not callable by user.
+ */
Int GateMP_setup(Void)
{
Int status = GateMP_S_SUCCESS;
NameServer_Params params;
- UInt32 nsValue[NUM_INFO_FIELDS];
- UInt32 len;
- UInt32 size;
- UInt32 alignDiff;
- UInt32 offset;
- Int32 fdMem;
NameServer_Params_init(¶ms);
params.maxRuntimeEntries = MAX_RUNTIME_ENTRIES;
status = GateMP_E_FAIL;
LOG0("GateMP_setup: NameServer_create failed\n");
}
+ else {
+ GateMP_module->isSetup = TRUE;
+ }
- if (status == GateMP_S_SUCCESS) {
- do {
- sleep(1); /* Give the slaves some time to get NameServer ready */
- status = GateMP_openDefaultGate(&GateMP_module->defaultGate);
- } while (status == GateMP_E_NOTFOUND);
+ return status;
+}
+Int GateMP_attach(UInt16 procId)
+{
+ GateMP_Handle deflateGate; /* that's right, Pats fan here */
+ Int status = GateMP_S_SUCCESS;
+ UInt32 nsValue[NUM_INFO_FIELDS];
+ UInt32 len;
+ UInt32 size;
+ UInt32 alignDiff;
+ UInt32 offset;
+ Int32 fdMem;
+ UInt16 procList[2];
+ UInt16 clId;
+
+ /* procId already validated in API layer */
+ clId = procId - MultiProc_getBaseIdOfCluster();
+ if (clId >= MultiProc_getNumProcsInCluster()) {
+ LOG1("GateMP_attach: procId %d not in range for local cluster\n",
+ procId);
+ return GateMP_E_INVALIDARG;
+ }
- if (status < 0) {
- LOG0("GateMP_setup: failed to open default gate\n");
- status = GateMP_E_FAIL;
- }
+ /* must reference count because we have multiple clients */
+ if (GateMP_module->refCount[clId] > 0) {
+ GateMP_module->refCount[clId]++;
+ goto done;
+ }
+
+ procList[0] = procId;
+ procList[1] = MultiProc_INVALIDID;
+ status = GateMP_openDefaultGate(&deflateGate, procList);
+
+ if (status < 0) {
+ LOG1("GateMP_attach: failed to open default gate on procId %d\n",
+ procId);
+ goto done;
}
if (status == GateMP_S_SUCCESS) {
+ if (GateMP_module->attachedProcId != MultiProc_INVALIDID) {
+ LOG1("GateMP_attach: can't attach to procId %d\n", procId);
+ LOG1(" already attached to %d\n",
+ GateMP_module->attachedProcId);
+ status = GateMP_E_ALREADYEXISTS;
+ goto done;
+ }
+
+ GateMP_module->attachedProcId = procId;
+ GateMP_module->defaultGate = deflateGate;
+
+ GateMP_module->refCount[clId]++;
+
/* Process global info NameServer entry */
len = sizeof(nsValue);
status = NameServer_get(GateMP_module->nameServer, "_GateMP_TI_info",
- &nsValue, &len, NULL);
+ &nsValue, &len, procList);
if (status < 0) {
- LOG0("GateMP_setup: failed to find info entry\n");
+ LOG0("GateMP_attach: failed to find info entry\n");
status = GateMP_E_NOTFOUND;
}
else {
fdMem = open ("/dev/mem", O_RDWR | O_SYNC);
if (fdMem < 0){
- LOG0("GateMP_setup: failed to open the /dev/mem!\n");
- status = GateMP_E_FAIL;
- goto cleanup;
+ LOG0("GateMP_attach: failed to open the /dev/mem!\n");
+ status = GateMP_E_OSFAILURE;
+ goto done;
}
GateMP_module->numRemoteSystem = nsValue[3];
/* TODO: setup the proxy map */
-cleanup:
- /* clean up if error */
- if (status < 0) {
- GateMP_destroy();
- }
-
- GateMP_module->isSetup = TRUE;
+done:
return (status);
}
-Void GateMP_destroy(Void)
+Int GateMP_detach(UInt16 procId)
{
+ UInt16 clId;
+
+ if (procId != GateMP_module->attachedProcId) {
+ return GateMP_E_NOTFOUND;
+ }
+
+ /* procId already validated in API layer */
+ clId = procId - MultiProc_getBaseIdOfCluster();
+ if (clId >= MultiProc_getNumProcsInCluster()) {
+ LOG1("GateMP_detach: procId %d not in range for local cluster\n",
+ procId);
+ return GateMP_E_INVALIDARG;
+ }
+
+
+ /* decrement reference count regardless of outcome below */
+ if (--GateMP_module->refCount[clId] > 0) {
+ goto done;
+ }
+
if (GateMP_module->remoteSystemInUse) {
munmap((unsigned int *)GateMP_module->remoteSystemInUse,
GateMP_module->numRemoteSystem * sizeof (UInt8));
if (GateMP_module->defaultGate) {
GateMP_closeDefaultGate(&GateMP_module->defaultGate);
+ GateMP_module->attachedProcId = MultiProc_INVALIDID;
}
+done:
+
+ return GateMP_S_SUCCESS;
+}
+
+Void GateMP_destroy(Void)
+{
if (GateMP_module->nameServer) {
NameServer_delete(&GateMP_module->nameServer);
GateMP_module->nameServer = NULL;
return;
}
-/* Open default gate during GateMP_setup. Should only be called once */
-static Int GateMP_openDefaultGate(GateMP_Handle *handlePtr)
+/* Open default gate during GateMP_attach. Should only be called once */
+static Int GateMP_openDefaultGate(GateMP_Handle *handlePtr, UInt16 procId[])
{
Int status = GateMP_S_SUCCESS;
UInt32 len;
GateMP_Object * obj = NULL;
UInt32 arg;
UInt32 mask;
- UInt32 creatorProcId;
GateMP_RemoteSystemProxy_Params systemParams;
/* assert that a valid pointer has been supplied */
if (handlePtr == NULL) {
- LOG0("GateMP_open: argument cannot be null\n");
+ LOG0("GateMP_openDefaultGate: argument cannot be null\n");
status = GateMP_E_INVALIDARG;
}
len = sizeof(nsValue);
status = NameServer_get(GateMP_module->nameServer, "_GateMP_TI_dGate",
- &nsValue, &len, NULL);
+ &nsValue, &len, procId);
if (status < 0) {
*handlePtr = NULL;
else {
arg = nsValue[2];
mask = nsValue[3];
- creatorProcId = nsValue[1] >> 16;
}
}
diff --git a/linux/src/daemon/lad.c b/linux/src/daemon/lad.c
index 170c3ec6c783ae402b8cff9a869a8b8052375e1c..b9c740e2a69ee38d576c6c3c8b37cf94b37e7f5c 100644 (file)
--- a/linux/src/daemon/lad.c
+++ b/linux/src/daemon/lad.c
Int c;
#if defined(GATEMP_SUPPORT)
Int status;
+ UInt16 procId;
#endif
String tmpString;
#if DAEMON
break;
#if defined(GATEMP_SUPPORT)
+ case LAD_GATEMP_ATTACH:
+ procId = cmd.args.attach.procId;
+ LOG1("LAD_GATEMP_ATTACH: calling GateMP_attach(%d)...\n", procId)
+
+ rsp.status = GateMP_attach(procId);
+
+ LOG1(" status = %d\n", rsp.status)
+ LOG0("DONE\n")
+
+ break;
+
+ case LAD_GATEMP_DETACH:
+ procId = cmd.args.detach.procId;
+ LOG1("LAD_GATEMP_DETACH: calling GateMP_detach(%d)...\n", procId)
+
+ rsp.status = GateMP_detach(procId);
+
+ LOG1(" status = %d\n", rsp.status)
+ LOG0("DONE\n")
+
+ break;
+
case LAD_GATEMP_START:
LOG0("LAD_GATEMP_START: calling GateMP_start()...\n")
rsp.gateMPStart.nameServerHandle = GateMP_getNameServer();
- rsp.gateMPStart.status = GateMP_S_SUCCESS;;
+ rsp.gateMPStart.status = GateMP_S_SUCCESS;
LOG1(" status = %d\n", rsp.gateMPStart.status)
LOG0("DONE\n")
case LAD_MESSAGEQ_MSGINIT:
case LAD_MULTIPROC_GETCONFIG:
#if defined(GATEMP_SUPPORT)
+ case LAD_GATEMP_ATTACH:
+ case LAD_GATEMP_DETACH:
case LAD_GATEMP_START:
case LAD_GATEMP_GETNUMRESOURCES:
case LAD_GATEMP_GETFREERESOURCE:
index 98160af6aecd19e2a208c95f2f37cfc1fe4fb605..98ec273cd179716e157227c847fdedf15fc56ac6 100644 (file)
ti_sdo_ipc_GateMP_Handle *remoteHandles;
UInt8 *inUseArray;
- UInt numResources;
+ UInt size;
/* Cannot call when numOpen is non-zero. */
Assert_isTrue(obj->numOpens == 0, ti_sdo_ipc_GateMP_A_invalidDelete);
inUseArray = GateMP_module->remoteSystemInUse;
remoteHandles = GateMP_module->remoteSystemGates;
- numResources = GateMP_module->numRemoteSystem;
+ size = GateMP_module->numRemoteSystem * sizeof(UInt8);
break;
case GateMP_RemoteProtect_CUSTOM1:
inUseArray = GateMP_module->remoteCustom1InUse;
remoteHandles = GateMP_module->remoteCustom1Gates;
- numResources = GateMP_module->numRemoteCustom1;
+ size = GateMP_module->numRemoteCustom1 * sizeof(UInt8);
break;
case GateMP_RemoteProtect_CUSTOM2:
inUseArray = GateMP_module->remoteCustom2InUse;
remoteHandles = GateMP_module->remoteCustom2Gates;
- numResources = GateMP_module->numRemoteCustom2;
+ size = GateMP_module->numRemoteCustom2 * sizeof(UInt8);
break;
case GateMP_RemoteProtect_NONE:
/*
systemKey = Hwi_disable();
}
+#ifdef xdc_target__isaCompatible_v7A
+ /* ARM speculative execution might have pulled array into cache */
+ if (obj->cacheEnabled) {
+ Cache_inv(inUseArray, size, Cache_Type_ALL, TRUE);
+ }
+#endif
/* update the GateMP resource tracker */
inUseArray[obj->resourceId] = UNUSED;
if (obj->cacheEnabled) {
- Cache_wbInv(inUseArray,
- numResources * sizeof(UInt8),
- Cache_Type_ALL,
- TRUE);
+ Cache_wbInv(inUseArray, size, Cache_Type_ALL, TRUE);
}
if (GateMP_module->defaultGate != NULL) {
index 80bbafa820755fae69e01653715c82037d720090..4e89cf8e40cfea6d1010ecc758152815804521ec 100644 (file)
/*
- * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Bool ListMP_empty(ListMP_Handle handle)
{
ti_sdo_ipc_ListMP_Object *obj = (ti_sdo_ipc_ListMP_Object *)handle;
+ ti_sdo_ipc_ListMP_Attrs *attrs = obj->attrs;
Bool flag = FALSE;
IArg key;
SharedRegion_SRPtr sharedHead;
/* prevent another thread or processor from modifying the ListMP */
key = GateMP_enter((GateMP_Handle)obj->gate);
+#ifdef xdc_target__isaCompatible_v7A
+ /* ARM speculative execution might have pulled attrs into cache */
+ if (obj->cacheEnabled) {
+ Cache_inv(attrs, sizeof(ti_sdo_ipc_ListMP_Attrs), Cache_Type_ALL, TRUE);
+ }
+#endif
if (ti_sdo_ipc_SharedRegion_translate == FALSE) {
/* get the SRPtr for the head */
- sharedHead = (SharedRegion_SRPtr)&(obj->attrs->head);
+ sharedHead = (SharedRegion_SRPtr)&(attrs->head);
}
else {
/* get the SRPtr for the head */
- sharedHead = SharedRegion_getSRPtr(&(obj->attrs->head), obj->regionId);
+ sharedHead = SharedRegion_getSRPtr(&(attrs->head), obj->regionId);
}
/* if 'next' is ourself, then the ListMP must be empty */
- if (obj->attrs->head.next == sharedHead) {
+ if (attrs->head.next == sharedHead) {
flag = TRUE;
}
if (obj->cacheEnabled) {
/* invalidate the head to make sure we are not getting stale data */
- Cache_inv(&(obj->attrs->head), sizeof(ListMP_Elem), Cache_Type_ALL,
- TRUE);
+ Cache_inv(&(attrs->head), sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
}
/* leave the gate */
Ptr ListMP_getHead(ListMP_Handle handle)
{
ti_sdo_ipc_ListMP_Object *obj = (ti_sdo_ipc_ListMP_Object *)handle;
+ ti_sdo_ipc_ListMP_Attrs *attrs = obj->attrs;
ListMP_Elem *elem;
ListMP_Elem *localHeadNext;
ListMP_Elem *localNext;
/* prevent another thread or processor from modifying the ListMP */
key = GateMP_enter((GateMP_Handle)obj->gate);
+#ifdef xdc_target__isaCompatible_v7A
+ /* ARM speculative execution might have pulled attrs into cache */
+ if (obj->cacheEnabled) {
+ Cache_inv(attrs, sizeof(ti_sdo_ipc_ListMP_Attrs), Cache_Type_ALL, TRUE);
+ }
+#endif
+
if (ti_sdo_ipc_SharedRegion_translate == FALSE) {
- localHeadNext = (ListMP_Elem *)obj->attrs->head.next;
+ localHeadNext = (ListMP_Elem *)attrs->head.next;
}
else {
- localHeadNext = SharedRegion_getPtr(obj->attrs->head.next);
+ localHeadNext = SharedRegion_getPtr(attrs->head.next);
}
/* Assert that pointer is not NULL */
Assert_isTrue(localHeadNext != NULL, ti_sdo_ipc_Ipc_A_nullPointer);
/* See if the ListMP was empty */
- if (localHeadNext == (ListMP_Elem *)(&(obj->attrs->head))) {
+ if (localHeadNext == (ListMP_Elem *)(&(attrs->head))) {
/* Empty, return NULL */
elem = NULL;
}
}
/* Fix the head of the list next pointer */
- obj->attrs->head.next = elem->next;
+ attrs->head.next = elem->next;
/* Fix the prev pointer of the new first elem on the list */
localNext->prev = localHeadNext->prev;
}
if (obj->cacheEnabled) {
- Cache_wbInv(&(obj->attrs->head), sizeof(ListMP_Elem),
- Cache_Type_ALL, TRUE);
+ Cache_wbInv(&(attrs->head), sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
}
GateMP_leave((GateMP_Handle)obj->gate, key);
Ptr ListMP_getTail(ListMP_Handle handle)
{
ti_sdo_ipc_ListMP_Object *obj = (ti_sdo_ipc_ListMP_Object *)handle;
+ ti_sdo_ipc_ListMP_Attrs *attrs = obj->attrs;
ListMP_Elem *elem;
ListMP_Elem *localHeadPrev;
ListMP_Elem *localPrev;
/* prevent another thread or processor from modifying the ListMP */
key = GateMP_enter((GateMP_Handle)obj->gate);
+#ifdef xdc_target__isaCompatible_v7A
+ /* ARM speculative execution might have pulled attrs into cache */
+ if (obj->cacheEnabled) {
+ Cache_inv(attrs, sizeof(ti_sdo_ipc_ListMP_Attrs), Cache_Type_ALL, TRUE);
+ }
+#endif
+
if (ti_sdo_ipc_SharedRegion_translate == FALSE) {
- localHeadPrev = (ListMP_Elem *)obj->attrs->head.prev;
+ localHeadPrev = (ListMP_Elem *)attrs->head.prev;
}
else {
- localHeadPrev = SharedRegion_getPtr(obj->attrs->head.prev);
+ localHeadPrev = SharedRegion_getPtr(attrs->head.prev);
}
/* Assert that pointer is not NULL */
Assert_isTrue(localHeadPrev != NULL, ti_sdo_ipc_Ipc_A_nullPointer);
/* See if the ListMP was empty */
- if (localHeadPrev == (ListMP_Elem *)(&(obj->attrs->head))) {
+ if (localHeadPrev == (ListMP_Elem *)(&(attrs->head))) {
/* Empty, return NULL */
elem = NULL;
}
}
/* Fix the head of the list prev pointer */
- obj->attrs->head.prev = elem->prev;
+ attrs->head.prev = elem->prev;
/* Fix the next pointer of the new last elem on the list */
localPrev->next = localHeadPrev->next;
}
if (obj->cacheEnabled) {
- Cache_wbInv(&(obj->attrs->head), sizeof(ListMP_Elem),
- Cache_Type_ALL, TRUE);
+ Cache_wbInv(&(attrs->head), sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
}
GateMP_leave((GateMP_Handle)obj->gate, key);
if (ti_sdo_ipc_SharedRegion_translate == FALSE) {
sharedNewElem = (SharedRegion_SRPtr)newElem;
sharedCurElem = (SharedRegion_SRPtr)curElem;
- localPrevElem = (ListMP_Elem *)(curElem->prev);
}
else {
/* get SRPtr for newElem */
/* Keep track of whether an extra Cache_inv is needed */
elemIsCached = obj->cacheEnabled;
elem = (ListMP_Elem *)&(obj->attrs->head);
-
}
else {
elemIsCached = SharedRegion_isCacheEnabled(SharedRegion_getId(elem));
}
if (elemIsCached) {
- /* Invalidate because elem pulled into cache && elem != head. */
+ /* invalidate because elem pulled into cache */
Cache_inv(elem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
}
}
if (elemIsCached) {
- /* Invalidate because elem pulled into cache && elem != head. */
+ /* invalidate because elem pulled into cache */
Cache_inv(elem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
}
Int ListMP_putHead(ListMP_Handle handle, ListMP_Elem *elem)
{
ti_sdo_ipc_ListMP_Object *obj = (ti_sdo_ipc_ListMP_Object *)handle;
+ ti_sdo_ipc_ListMP_Attrs *attrs = obj->attrs;
UInt key;
UInt16 id;
ListMP_Elem *localNextElem;
/* prevent another thread or processor from modifying the ListMP */
key = GateMP_enter((GateMP_Handle)obj->gate);
+#ifdef xdc_target__isaCompatible_v7A
+ /* ARM speculative execution might have pulled attrs into cache */
+ if (obj->cacheEnabled) {
+ Cache_inv(attrs, sizeof(ti_sdo_ipc_ListMP_Attrs), Cache_Type_ALL, TRUE);
+ }
+#endif
+
id = SharedRegion_getId(elem);
if (ti_sdo_ipc_SharedRegion_translate == FALSE) {
sharedElem = (SharedRegion_SRPtr)elem;
- sharedHead = (SharedRegion_SRPtr)&(obj->attrs->head);
- localNextElem = (ListMP_Elem *)obj->attrs->head.next;
+ sharedHead = (SharedRegion_SRPtr)&(attrs->head);
+ localNextElem = (ListMP_Elem *)attrs->head.next;
}
else {
sharedElem = SharedRegion_getSRPtr(elem, id);
- sharedHead = SharedRegion_getSRPtr(&(obj->attrs->head), obj->regionId);
- localNextElem = SharedRegion_getPtr(obj->attrs->head.next);
+ sharedHead = SharedRegion_getSRPtr(&(attrs->head), obj->regionId);
+ localNextElem = SharedRegion_getPtr(attrs->head.next);
}
/* Assert that pointer is not NULL */
}
/* add the new elem into the list */
- elem->next = obj->attrs->head.next;
+ elem->next = attrs->head.next;
elem->prev = sharedHead;
localNextElem->prev = sharedElem;
- obj->attrs->head.next = sharedElem;
+ attrs->head.next = sharedElem;
if (localNextElemIsCached) {
/* Write-back because localNextElem->prev changed */
Cache_wbInv(localNextElem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
}
if (obj->cacheEnabled) {
- /* Write-back because obj->attrs->head.next changed */
- Cache_wbInv(&(obj->attrs->head), sizeof(ListMP_Elem), Cache_Type_ALL,
- TRUE);
+ /* Write-back because attrs->head.next changed */
+ Cache_wbInv(&(attrs->head), sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
}
if (SharedRegion_isCacheEnabled(id)) {
/* Write-back because elem->next & elem->prev changed */
Int ListMP_putTail(ListMP_Handle handle, ListMP_Elem *elem)
{
ti_sdo_ipc_ListMP_Object *obj = (ti_sdo_ipc_ListMP_Object *)handle;
+ ti_sdo_ipc_ListMP_Attrs *attrs = obj->attrs;
UInt key;
UInt16 id;
ListMP_Elem *localPrevElem;
/* prevent another thread or processor from modifying the ListMP */
key = GateMP_enter((GateMP_Handle)obj->gate);
+#ifdef xdc_target__isaCompatible_v7A
+ /* ARM speculative execution might have pulled attrs into cache */
+ if (obj->cacheEnabled) {
+ Cache_inv(attrs, sizeof(ti_sdo_ipc_ListMP_Attrs), Cache_Type_ALL, TRUE);
+ }
+#endif
+
id = SharedRegion_getId(elem);
if (ti_sdo_ipc_SharedRegion_translate == FALSE) {
sharedElem = (SharedRegion_SRPtr)elem;
- sharedHead = (SharedRegion_SRPtr)&(obj->attrs->head);
- localPrevElem = (ListMP_Elem *)obj->attrs->head.prev;
+ sharedHead = (SharedRegion_SRPtr)&(attrs->head);
+ localPrevElem = (ListMP_Elem *)attrs->head.prev;
}
else {
sharedElem = SharedRegion_getSRPtr(elem, id);
- sharedHead = SharedRegion_getSRPtr(&(obj->attrs->head), obj->regionId);
- localPrevElem = SharedRegion_getPtr(obj->attrs->head.prev);
+ sharedHead = SharedRegion_getSRPtr(&(attrs->head), obj->regionId);
+ localPrevElem = SharedRegion_getPtr(attrs->head.prev);
}
/* Assert that pointer is not NULL */
/* add the new elem into the list */
elem->next = sharedHead;
- elem->prev = obj->attrs->head.prev;
+ elem->prev = attrs->head.prev;
localPrevElem->next = sharedElem;
- obj->attrs->head.prev = sharedElem;
+ attrs->head.prev = sharedElem;
if (localPrevElemIsCached) {
/* Write-back because localPrevElem->next changed */
Cache_wbInv(localPrevElem, sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
}
if (obj->cacheEnabled) {
- /* Write-back because obj->attrs->head.prev changed */
- Cache_wbInv(&(obj->attrs->head), sizeof(ListMP_Elem), Cache_Type_ALL,
- TRUE);
+ /* Write-back because attrs->head.prev changed */
+ Cache_wbInv(&(attrs->head), sizeof(ListMP_Elem), Cache_Type_ALL, TRUE);
}
if (SharedRegion_isCacheEnabled(id)) {
/* Write-back because elem->next & elem->prev changed */
obj->cacheEnabled = SharedRegion_isCacheEnabled(obj->regionId);
obj->cacheLineSize = SharedRegion_getCacheLineSize(obj->regionId);
+#ifdef xdc_target__isaCompatible_v7A
+ /* ARM speculative execution might have pulled attrs into cache */
+ if (obj->cacheEnabled) {
+ Cache_inv(obj->attrs, sizeof(ti_sdo_ipc_ListMP_Attrs), Cache_Type_ALL,
+ TRUE);
+ }
+#endif
/* get the local address of the SRPtr */
localAddr = SharedRegion_getPtr(obj->attrs->gateMPAddr);
diff --git a/packages/ti/sdo/ipc/transports/TransportShm.c b/packages/ti/sdo/ipc/transports/TransportShm.c
index b53b1b977b2e8814be27804bc4f2c7091ca6815d..75d3ad41dc5c4b63d6284ef10cc01eede1871f46 100644 (file)
/* put the message to the destination queue */
MessageQ_put(queueId, msg);
-#if defined(gnu_targets_STD_) && defined (xdc_target__isaCompatible_v7A)
- __asm__ __volatile__ (
- "dmb"
- ::: "memory"
- );
-#endif
-
/* check to see if there are more messages */
msg = (MessageQ_Msg)ListMP_getHead((ListMP_Handle)obj->localList);
}
diff --git a/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/resmgr/ipc.use b/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/resmgr/ipc.use
index 76f1263cd207c2990c3f56b3333901f0f10b44ba..53b21b559742a0853076f3c82c9fa3dd3ecdc3ec 100644 (file)
followed by the path to the executable to load on that core.
Supported core ids are
OMAP54xx: IPU, DSP
- DRA7xx: IPU2, DSP1, IPU1
+ DRA7xx: IPU1, IPU2, DSP1, DSP2
Options:
-H <option> Enable/Disable Ducati hibernation. Default: 1