1// RPMsg dynamic endpoints binding 2 3digraph G { 4 rankdir="LR"; 5 6 subgraph roles { 7 node [style="filled", fillcolor="lightblue"]; 8 host [label="Host"]; 9 remote [label="Remote"]; 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* As vdev doesn't support name service, it will not create name service endpoint;\l* it sets vdev status to DRVIER_READY, And will notify remote.\l"]; 18 m_rpmsg_create_ep_comment [label="\lIf 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 application"]; 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, VIRTIO_DEV_DRIVER, 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_ns_cb -> m_rpmsg_create_ep -> 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, VIRTIO_DEV_DEVICE, rst_cb);"]; 52 s_rpmsg_vdev_init [label="rpdev=rpmsg_init_vdev(rpvdev, vdev, ns_bind_cb, &shm_io, NULL);"]; 53 s_rpmsg_create_ep [label="\lept=rpmsg_create_ept(ept, rdev, ept_name, ept_addr, dest_addr, \lendpoint_cb, ns_unbind_cb);\l"]; 54 s_rpmsg_ns_cb [label="\lrpmsg_ns_callback() will see if there is a local ep registered.\lIf yes, bind the ep; otherwise, call ns_binc_cb.\l"]; 55 s_rpmsg_send [label="rpmsg_send(ept,data)"]; 56 s_rpmsg_rx_cb [label="rpmsg_rx_callback()"]; 57 s_ep_cb [label="endpoint_cb(ept, data, size, src_addr)"]; 58 s_rpmsg_ns_unbind_cb [label="\lrpmsg_ns_callback() will call the previous\lregistered endpoint unbind callback\l"]; 59 60 s_remoteproc_init -> s_remoteproc_parse_rsc -> s_remoteproc_get_vdev -> 61 s_rpmsg_vdev_init -> s_rpmsg_create_ep; 62 s_rpmsg_create_ep -> s_rpmsg_ns_cb -> s_rpmsg_rx_cb -> 63 s_ep_cb -> s_rpmsg_send -> s_rpmsg_ns_unbind_cb [dir="none", style="dash"]; 64 65 } 66 67 subgraph s_comment_nodes { 68 node [group=s_comment, shape="note", style="filled", fillcolor="yellow"]; 69 rank="same"; 70 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 host set status to DRIVER READY\l"]; 71 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"]; 72 } 73 74 host -> m_remoteproc_init [dir="none"]; 75 remote -> s_remoteproc_init [dir="none"]; 76 s_rpmsg_create_ep -> m_rpmsg_ns_cb [label="NS announcement"]; 77 m_rpmsg_create_ep -> s_rpmsg_ns_cb [label="NS announcement"]; 78 m_rpmsg_send -> s_rpmsg_rx_cb [label="RPMsg data"]; 79 s_rpmsg_send -> m_rpmsg_rx_cb [label="RPMsg data"]; 80 m_rpmsg_destroy_ep -> s_rpmsg_ns_unbind_cb [label="Endpoint destroy NS"]; 81 82 m_remoteproc_init_comment -> m_remoteproc_init [dir="none"]; 83 m_remoteproc_boot_comment -> m_remoteproc_boot [dir="none"]; 84 m_rpmsg_vdev_init_comment -> m_rpmsg_vdev_init [dir="none"]; 85 m_rpmsg_create_ep_comment -> m_rpmsg_create_ep [dir="none"]; 86 m_rpmsg_send_comment -> m_rpmsg_send [dir="none"]; 87 88 s_rpmsg_vdev_init -> s_rpmsg_vdev_init_comment [dir="none"]; 89 s_rpmsg_rx_cb -> s_rpmsg_rx_cb_comment [dir="none"]; 90 91 {rank=same; host; m_remoteproc_init} 92 {rank=same; remote; s_remoteproc_init} 93 94} 95 96