1// RPMsg dynamic endpoint creation
2
3digraph G {
4  rankdir="LR";
5
6  subgraph roles {
7    node [style="filled", fillcolor="lightblue"];
8    master [label="Master"];
9    slave [label="Slave"];
10  }
11
12  subgraph m_comment_nodes {
13    node [group=m_comment, shape="note", style="filled", fillcolor="yellow"];
14    rank="same";
15    m_remoteproc_init_comment [label="this is initialize rproc call"];
16    m_remoteproc_boot_comment [label="it will setup vdev before booting the remote"];
17    m_rpmsg_vdev_init_comment [label="\l* It will initialize vrings with the shared memory\l* If vdev supports name service, it will create name service endpoint;\l* it sets vdev status to DRVIER_READY, And will notify remote.\l"];
18    m_rpmsg_create_ep_comment [label="\if vdev supports name service,\lit will send out name service.\l"];
19    m_rpmsg_send_comment [label="\lIf endpoint hasn't binded, it fail\lreturn failure to indicate ep hasn't been binded.\l"];
20
21  }
22
23  subgraph m_flow_nodes {
24    node [shape="box"];
25    rank="same";
26    m_remoteproc_init [label="rproc = remoteproc_init(&remoteproc_ops, &arg);"]
27    m_remoteproc_load [label="calls remoteproc_load() to load applicaiton"];
28    m_remoteproc_boot [shape="box", label="ret=remoteproc_boot(&rproc)"];
29    m_remoteproc_get_vdev [label="vdev=remoteproc_create_virtio(rproc, rpmsg_vdev_id, MASTER, NULL);"];
30    m_rpmsg_shmpool_init[label="rpmsg_virtio_init_shm_pool(shpool, shbuf, shbuf_pool_size);"];
31    m_rpmsg_vdev_init [label="rpdev=rpmsg_init_vdev(rpvdev, vdev, ns_bind_cb, &shm_io, shpool);"];
32    m_rpmsg_ns_cb [label="\lrpmsg_ns_callback() will see if there is a local ep registered.\lIf yes, bind the ep; otherwise, call ns_bind_cb.\l"];
33    m_rpmsg_create_ep [label="\lept=rpmsg_create_ept(ept, rdev, ept_name, ept_addr, dest_addr, \lendpoint_cb, ns_unbind_cb);\l"];
34    m_rpmsg_send [label="rpmsg_send(ept,data)"];
35    m_rpmsg_rx_cb [label="rpmsg_rx_callback()"];
36    m_ep_cb [label="endpoint_cb(ept, data, size, src_addr)"];
37    m_rpmsg_destroy_ep [label="rpmsg_destroy_endpoint(ept)"];
38
39    m_remoteproc_init -> m_remoteproc_load -> m_remoteproc_boot -> m_remoteproc_get_vdev ->
40    m_rpmsg_shmpool_init -> m_rpmsg_vdev_init -> m_rpmsg_create_ep -> m_rpmsg_ns_cb -> m_rpmsg_send;
41    m_rpmsg_send -> m_rpmsg_rx_cb -> m_ep_cb ->
42    m_rpmsg_destroy_ep [dir="none", style="dashed"];
43  }
44
45  subgraph s_flow_nodes {
46    rank="same";
47    node [shape="box"];
48    s_remoteproc_init [label="rproc = remoteproc_init(&remoteproc_ops, &arg);"];
49
50    s_remoteproc_parse_rsc [label="ret = remoteproc_set_rsc_table(rproc, &rsc_table, rsc_size)"];
51    s_remoteproc_get_vdev [label="vdev=remoteproc_create_virtio(rproc, rpmsg_vdev_id, SLAVE, rst_cb);"];
52    s_rpmsg_vdev_init [label="rpdev=rpmsg_init_vdev(rpvdev, vdev, ns_bind_cb, &shm_io, NULL);"];
53    s_rpmsg_ns_cb [label="\lrpmsg_ns_callback() will see if there is a local ep registered.\lIf yes, bind the ep; otherwise, it will call ns_bind_cb()."];
54    s_rpmsg_ns_bind_cb [label="s_rpsmg_ns_bind_cb(ept_name, remote_addr)"];
55    s_rpmsg_create_ep [label="\lept=rpmsg_create_endpoint(ept, rdev, ept_name, ept_addr, remote_addr,\lendpoint_cb, ns_unbind_cb);\l"];
56    s_rpmsg_send [label="rpmsg_send(ept,data)"];
57    s_rpmsg_rx_cb [label="rpmsg_rx_callback()"];
58    s_ep_cb [label="endpoint_cb(ept, data, size, src_addr)"];
59    s_rpmsg_ns_unbind_cb [label="\lrpmsg_ns_callback() will call the previous\lregistered endpoint unbind callback\l"];
60
61    s_remoteproc_init -> s_remoteproc_parse_rsc -> s_remoteproc_get_vdev ->
62    s_rpmsg_vdev_init -> s_rpmsg_ns_cb -> s_rpmsg_ns_bind_cb ->
63    s_rpmsg_create_ep;
64    s_rpmsg_create_ep-> s_rpmsg_rx_cb -> s_ep_cb -> s_rpmsg_send ->
65    s_rpmsg_ns_unbind_cb [dir="none", style="dash"];
66
67  }
68
69  subgraph s_comment_nodes {
70    node [group=s_comment, shape="note", style="filled", fillcolor="yellow"];
71    rank="same";
72    s_rpmsg_vdev_init_comment [label="\l* If vdev supports name service, it will create name service endpoint;\l* It will not return until the master set status to DRIVER READY\l"];
73    s_rpmsg_rx_cb_comment [label="\l* It will look for the endpoint which matches the destination address.\lIf the two endpoints hasn't binded yet,\lit will set the local endpoint's destination address with the source address in the message\l"];
74  }
75
76  master -> m_remoteproc_init [dir="none"];
77  slave -> s_remoteproc_init [dir="none"];
78  s_rpmsg_create_ep -> m_rpmsg_ns_cb [label="NS annoucement"];
79  m_rpmsg_create_ep -> s_rpmsg_ns_cb [label="NS annoucement"];
80  m_rpmsg_send -> s_rpmsg_rx_cb [label="RPMsg data"];
81  s_rpmsg_send -> m_rpmsg_rx_cb [label="RPMsg data"];
82  m_rpmsg_destroy_ep -> s_rpmsg_ns_unbind_cb [label="Endpoint destroy NS"];
83
84  m_remoteproc_init_comment -> m_remoteproc_init [dir="none"];
85  m_remoteproc_boot_comment -> m_remoteproc_boot [dir="none"];
86  m_rpmsg_vdev_init_comment -> m_rpmsg_vdev_init [dir="none"];
87  m_rpmsg_create_ep_comment -> m_rpmsg_create_ep [dir="none"];
88  m_rpmsg_send_comment -> m_rpmsg_send [dir="none"];
89
90  s_rpmsg_vdev_init -> s_rpmsg_vdev_init_comment [dir="none"];
91  s_rpmsg_rx_cb -> s_rpmsg_rx_cb_comment [dir="none"];
92
93  {rank=same; master; m_remoteproc_init}
94  {rank=same; slave; s_remoteproc_init}
95
96}
97
98