]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/commitdiff
New MultiProc API to update processor mapping
authorRamsey Harris <ramsey@ti.com>
Thu, 23 Apr 2015 22:23:25 +0000 (15:23 -0700)
committerRobert Tivy <rtivy@ti.com>
Fri, 24 Apr 2015 20:38:29 +0000 (13:38 -0700)
On Keystone 2, when loading DSP processors in ad hoc order,
the VirtIO channel assignment is non-deterministic. This
requires a run-time way to update the mapping of processor
to VirtIO channel. When the VirtIO channel assignment becomes
invariant, this new API will be removed.

linux/include/_lad.h
linux/src/api/MultiProc.c
linux/src/daemon/MultiProc_daemon.c
linux/src/daemon/lad.c
packages/ti/ipc/MultiProc.h

index b21cec1443672a0cd208537c5972d66b833c72f5..3cffe83a52c14991a06dd9b244c4a68d645694f0 100644 (file)
@@ -163,6 +163,7 @@ extern struct timeval start_tv;
 typedef enum {
     LAD_CONNECT = 0,
     LAD_DISCONNECT,
+    LAD_RPROC_SETID,
     LAD_IPC_GETCONFIG,
     LAD_NAMESERVER_SETUP,
     LAD_NAMESERVER_DESTROY,
@@ -204,6 +205,10 @@ struct LAD_CommandObj {
             Char name[LAD_MAXLENGTHFIFONAME];
             Char protocol[LAD_MAXLENGTHPROTOVERS];
         } connect;
+        struct {
+            Int procId;
+            Int rprocId;
+        } rprocSetId;
         struct {
             Char name[LAD_MAXENTRYNAMELEN];
             NameServer_Params params;
index 0a8435f1d1bacf67e4406ef911fe5746ac634137..015955abed9fac4f6f3d631ebdc2da0fbb40147c 100644 (file)
@@ -102,3 +102,51 @@ Void MultiProc_getConfig (MultiProc_Config * cfg)
 
     return;
 }
+
+/*
+ *  ======== MultiProc_rprocSetId ========
+ */
+Int MultiProc_rprocSetId(UInt16 procId, UInt rprocId)
+{
+    Int status;
+    LAD_ClientHandle handle;
+    struct LAD_CommandObj cmd;
+    union LAD_ResponseObj rsp;
+    UInt16 clusterId;
+
+
+    handle = LAD_findHandle();
+
+    if (handle == LAD_MAXNUMCLIENTS) {
+        PRINTVERBOSE1("MultiProc_rprocSetId: can't find connection to daemon "
+                "for pid %d\n", getpid())
+        return (-1);
+    }
+
+    cmd.cmd = LAD_RPROC_SETID;
+    cmd.clientId = handle;
+    cmd.args.rprocSetId.procId = procId;
+    cmd.args.rprocSetId.rprocId = rprocId;
+
+    if ((status = LAD_putCommand(&cmd)) != LAD_SUCCESS) {
+        PRINTVERBOSE1("MultiProc_rprocSetId: sending LAD command failed, "
+                "status=%d\n", status)
+        return (status);
+    }
+
+    if ((status = LAD_getResponse(handle, &rsp)) != LAD_SUCCESS) {
+        PRINTVERBOSE1("MultiProc_rprocSetId: no LAD response, status=%d\n",
+                status)
+        return (status);
+    }
+    status = rsp.status;
+
+    PRINTVERBOSE2("MultiProc_rprocSetId: got LAD response for client %d, "
+            "status=%d\n", handle, status)
+
+    /* update configuration in api state */
+    clusterId = procId - _MultiProc_cfg.baseIdOfCluster;
+    _MultiProc_cfg.rprocList[clusterId] = rprocId;
+
+    return (status);
+}
index a551a4d3480f1094c42ed51c63fa466cbef1c078..6570996c3760c2b4a5e95dbd3df686ec7ecb594b 100644 (file)
@@ -76,3 +76,27 @@ Void MultiProc_getConfig (MultiProc_Config * cfg)
         LOG2("\tProcId %d - \"%s\"\n", baseId + i, _MultiProc_cfg.nameList[i]);
     }
 }
+
+/*
+ *  ======== MultiProc_rprocSetId ========
+ */
+Int MultiProc_rprocSetId(UInt16 procId, UInt rprocId)
+{
+    UInt16 clusterId;
+
+
+    if (procId >= _MultiProc_cfg.numProcessors) {
+        return (MultiProc_E_INVALIDARG);
+    }
+
+    if (rprocId >= _MultiProc_cfg.numProcsInCluster) {
+        return (MultiProc_E_INVALIDARG);
+    }
+
+    clusterId = procId - _MultiProc_cfg.baseIdOfCluster;
+    _MultiProc_cfg.rprocList[clusterId] = rprocId;
+    LOG2("MultiProc_rprocSetId: clusterId=%d, rprocId=%d\n", clusterId,
+            _MultiProc_cfg.rprocList[clusterId]);
+
+    return (MultiProc_S_SUCCESS);
+}
index 2bff2aced0dd04e6d77707b170a309c17ef7890a..87b326061a1dc2c1ba22efa53d88dcc09411dc97 100644 (file)
@@ -372,6 +372,11 @@ opencommandFIFO:
 
             break;
 
+          case LAD_RPROC_SETID:
+            rsp.status = MultiProc_rprocSetId(cmd.args.rprocSetId.procId,
+                    cmd.args.rprocSetId.rprocId);
+            break;
+
           case LAD_IPC_GETCONFIG:
             Ipc_getConfig(&rsp.ipcConfig);
             break;
@@ -728,6 +733,7 @@ opencommandFIFO:
           case LAD_DISCONNECT:
             break;
 
+          case LAD_RPROC_SETID:
           case LAD_IPC_GETCONFIG:
           case LAD_NAMESERVER_SETUP:
           case LAD_NAMESERVER_DESTROY:
index 951b52e6cd5092921c9a8cc4c5900a8b2813ea19..8d4659f36e632e38d1f8cc4cef25ce2c229a99db 100644 (file)
@@ -272,6 +272,20 @@ Int MultiProc_setLocalId(UInt16 id);
  */
 Int MultiProc_setBaseIdOfCluster(UInt16 id);
 
+/*
+ *  ======== MultiProc_rprocSetId ========
+ *  Update processor ID mapping at run-time
+ *
+ *  Internal use only. This function is temporary and will be
+ *  removed in a future build.
+ *
+ *  When using remoteproc to load a DSP processor, the VirtIO channel
+ *  ID is non-deterministic. This function is part of a larger hack to
+ *  update the mapping from ProcID to VirtIO Channel ID each time a DSP
+ *  is loaded.
+ */
+Int MultiProc_rprocSetId(UInt16 procId, UInt rprocId);
+
 #if defined (__cplusplus)
 }
 #endif /* defined (__cplusplus) */