€•–Œsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ!/translations/zh_CN/staging/rpmsg”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ!/translations/zh_TW/staging/rpmsg”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ!/translations/it_IT/staging/rpmsg”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ!/translations/ja_JP/staging/rpmsg”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ!/translations/ko_KR/staging/rpmsg”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ!/translations/sp_SP/staging/rpmsg”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒ,Remote Processor Messaging (rpmsg) Framework”h]”hŒ,Remote Processor Messaging (rpmsg) Framework”…””}”(hh¨hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hh£hžhhŸŒ;/var/lib/git/docbuild/linux/Documentation/staging/rpmsg.rst”h KubhŒnote”“”)”}”(hŒ¸This document describes the rpmsg bus and how to write rpmsg drivers. To learn how to add rpmsg support for new platforms, check out remoteproc.txt (also a resident of Documentation/).”h]”hŒ paragraph”“”)”}”(hŒ¸This document describes the rpmsg bus and how to write rpmsg drivers. To learn how to add rpmsg support for new platforms, check out remoteproc.txt (also a resident of Documentation/).”h]”hŒ¸This document describes the rpmsg bus and how to write rpmsg drivers. To learn how to add rpmsg support for new platforms, check out remoteproc.txt (also a resident of Documentation/).”…””}”(hh¿hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h Khh¹ubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hh£hžhhŸh¶h Nubh¢)”}”(hhh]”(h§)”}”(hŒ Introduction”h]”hŒ Introduction”…””}”(hhÖhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hhÓhžhhŸh¶h K ubh¾)”}”(hŒíModern SoCs typically employ heterogeneous remote processor devices in asymmetric multiprocessing (AMP) configurations, which may be running different instances of operating system, whether it's Linux or any other flavor of real-time OS.”h]”hŒïModern SoCs typically employ heterogeneous remote processor devices in asymmetric multiprocessing (AMP) configurations, which may be running different instances of operating system, whether it’s Linux or any other flavor of real-time OS.”…””}”(hhähžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h KhhÓhžhubh¾)”}”(hXOMAP4, for example, has dual Cortex-A9, dual Cortex-M3 and a C64x+ DSP. Typically, the dual cortex-A9 is running Linux in a SMP configuration, and each of the other three cores (two M3 cores and a DSP) is running its own instance of RTOS in an AMP configuration.”h]”hXOMAP4, for example, has dual Cortex-A9, dual Cortex-M3 and a C64x+ DSP. Typically, the dual cortex-A9 is running Linux in a SMP configuration, and each of the other three cores (two M3 cores and a DSP) is running its own instance of RTOS in an AMP configuration.”…””}”(hhòhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h KhhÓhžhubh¾)”}”(hŒÍTypically AMP remote processors employ dedicated DSP codecs and multimedia hardware accelerators, and therefore are often used to offload CPU-intensive multimedia tasks from the main application processor.”h]”hŒÍTypically AMP remote processors employ dedicated DSP codecs and multimedia hardware accelerators, and therefore are often used to offload CPU-intensive multimedia tasks from the main application processor.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h KhhÓhžhubh¾)”}”(hŒ­These remote processors could also be used to control latency-sensitive sensors, drive random hardware blocks, or just perform background tasks while the main CPU is idling.”h]”hŒ­These remote processors could also be used to control latency-sensitive sensors, drive random hardware blocks, or just perform background tasks while the main CPU is idling.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h KhhÓhžhubh¾)”}”(hXUsers of those remote processors can either be userland apps (e.g. multimedia frameworks talking with remote OMX components) or kernel drivers (controlling hardware accessible only by the remote processor, reserving kernel-controlled resources on behalf of the remote processor, etc..).”h]”hXUsers of those remote processors can either be userland apps (e.g. multimedia frameworks talking with remote OMX components) or kernel drivers (controlling hardware accessible only by the remote processor, reserving kernel-controlled resources on behalf of the remote processor, etc..).”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h K hhÓhžhubh¾)”}”(hŒÐRpmsg is a virtio-based messaging bus that allows kernel drivers to communicate with remote processors available on the system. In turn, drivers could then expose appropriate user space interfaces, if needed.”h]”hŒÐRpmsg is a virtio-based messaging bus that allows kernel drivers to communicate with remote processors available on the system. In turn, drivers could then expose appropriate user space interfaces, if needed.”…””}”(hj*hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h K%hhÓhžhubh¾)”}”(hXKWhen writing a driver that exposes rpmsg communication to userland, please keep in mind that remote processors might have direct access to the system's physical memory and other sensitive hardware resources (e.g. on OMAP4, remote cores and hardware accelerators may have direct access to the physical memory, gpio banks, dma controllers, i2c bus, gptimers, mailbox devices, hwspinlocks, etc..). Moreover, those remote processors might be running RTOS where every task can access the entire memory/devices exposed to the processor. To minimize the risks of rogue (or buggy) userland code exploiting remote bugs, and by that taking over the system, it is often desired to limit userland to specific rpmsg channels (see definition below) it can send messages on, and if possible, minimize how much control it has over the content of the messages.”h]”hXMWhen writing a driver that exposes rpmsg communication to userland, please keep in mind that remote processors might have direct access to the system’s physical memory and other sensitive hardware resources (e.g. on OMAP4, remote cores and hardware accelerators may have direct access to the physical memory, gpio banks, dma controllers, i2c bus, gptimers, mailbox devices, hwspinlocks, etc..). Moreover, those remote processors might be running RTOS where every task can access the entire memory/devices exposed to the processor. To minimize the risks of rogue (or buggy) userland code exploiting remote bugs, and by that taking over the system, it is often desired to limit userland to specific rpmsg channels (see definition below) it can send messages on, and if possible, minimize how much control it has over the content of the messages.”…””}”(hj8hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h K)hhÓhžhubh¾)”}”(hŒîEvery rpmsg device is a communication channel with a remote processor (thus rpmsg devices are called channels). Channels are identified by a textual name and have a local ("source") rpmsg address, and remote ("destination") rpmsg address.”h]”hŒöEvery rpmsg device is a communication channel with a remote processor (thus rpmsg devices are called channels). Channels are identified by a textual name and have a local (“sourceâ€) rpmsg address, and remote (“destinationâ€) rpmsg address.”…””}”(hjFhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h K6hhÓhžhubh¾)”}”(hX^When a driver starts listening on a channel, its rx callback is bound with a unique rpmsg local address (a 32-bit integer). This way when inbound messages arrive, the rpmsg core dispatches them to the appropriate driver according to their destination address (this is done by invoking the driver's rx handler with the payload of the inbound message).”h]”hX`When a driver starts listening on a channel, its rx callback is bound with a unique rpmsg local address (a 32-bit integer). This way when inbound messages arrive, the rpmsg core dispatches them to the appropriate driver according to their destination address (this is done by invoking the driver’s rx handler with the payload of the inbound message).”…””}”(hjThžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h K;hhÓhžhubeh}”(h]”Œ introduction”ah ]”h"]”Œ introduction”ah$]”h&]”uh1h¡hh£hžhhŸh¶h K ubh¢)”}”(hhh]”(h§)”}”(hŒUser API”h]”hŒUser API”…””}”(hjmhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hjjhžhhŸh¶h KCubhŒ literal_block”“”)”}”(hŒ@int rpmsg_send(struct rpmsg_endpoint *ept, void *data, int len);”h]”hŒ@int rpmsg_send(struct rpmsg_endpoint *ept, void *data, int len);”…””}”hj}sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1j{hŸh¶h KGhjjhžhubh¾)”}”(hXosends a message across to the remote processor from the given endpoint. The caller should specify the endpoint, the data it wants to send, and its length (in bytes). The message will be sent on the specified endpoint's channel, i.e. its source and destination address fields will be respectively set to the endpoint's src address and its parent channel dst addresses.”h]”hXssends a message across to the remote processor from the given endpoint. The caller should specify the endpoint, the data it wants to send, and its length (in bytes). The message will be sent on the specified endpoint’s channel, i.e. its source and destination address fields will be respectively set to the endpoint’s src address and its parent channel dst addresses.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h KIhjjhžhubh¾)”}”(hXIn case there are no TX buffers available, the function will block until one becomes available (i.e. until the remote processor consumes a tx buffer and puts it back on virtio's used descriptor ring), or a timeout of 15 seconds elapses. When the latter happens, -ERESTARTSYS is returned.”h]”hX!In case there are no TX buffers available, the function will block until one becomes available (i.e. until the remote processor consumes a tx buffer and puts it back on virtio’s used descriptor ring), or a timeout of 15 seconds elapses. When the latter happens, -ERESTARTSYS is returned.”…””}”(hj›hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h KPhjjhžhubh¾)”}”(hŒThe function can only be called from a process context (for now). Returns 0 on success and an appropriate error value on failure.”h]”hŒThe function can only be called from a process context (for now). Returns 0 on success and an appropriate error value on failure.”…””}”(hj©hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h KVhjjhžhubj|)”}”(hŒKint rpmsg_sendto(struct rpmsg_endpoint *ept, void *data, int len, u32 dst);”h]”hŒKint rpmsg_sendto(struct rpmsg_endpoint *ept, void *data, int len, u32 dst);”…””}”hj·sbah}”(h]”h ]”h"]”h$]”h&]”j‹jŒuh1j{hŸh¶h K[hjjhžhubh¾)”}”(hŒvsends a message across to the remote processor from a given endpoint, to a destination address provided by the caller.”h]”hŒvsends a message across to the remote processor from a given endpoint, to a destination address provided by the caller.”…””}”(hjÅhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h K]hjjhžhubh¾)”}”(hŒ~The caller should specify the endpoint, the data it wants to send, its length (in bytes), and an explicit destination address.”h]”hŒ~The caller should specify the endpoint, the data it wants to send, its length (in bytes), and an explicit destination address.”…””}”(hjÓhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h K`hjjhžhubh¾)”}”(hŒÖThe message will then be sent to the remote processor to which the endpoints's channel belongs, using the endpoints's src address, and the user-provided dst address (thus the channel's dst address will be ignored).”h]”hŒÜThe message will then be sent to the remote processor to which the endpoints’s channel belongs, using the endpoints’s src address, and the user-provided dst address (thus the channel’s dst address will be ignored).”…””}”(hjáhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h Kchjjhžhubh¾)”}”(hXIn case there are no TX buffers available, the function will block until one becomes available (i.e. until the remote processor consumes a tx buffer and puts it back on virtio's used descriptor ring), or a timeout of 15 seconds elapses. When the latter happens, -ERESTARTSYS is returned.”h]”hX!In case there are no TX buffers available, the function will block until one becomes available (i.e. until the remote processor consumes a tx buffer and puts it back on virtio’s used descriptor ring), or a timeout of 15 seconds elapses. When the latter happens, -ERESTARTSYS is returned.”…””}”(hjïhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h Khhjjhžhubh¾)”}”(hŒThe function can only be called from a process context (for now). Returns 0 on success and an appropriate error value on failure.”h]”hŒThe function can only be called from a process context (for now). Returns 0 on success and an appropriate error value on failure.”…””}”(hjýhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h Knhjjhžhubj|)”}”(hŒ“int rpmsg_send_offchannel(struct rpmsg_endpoint *ept, u32 src, u32 dst, void *data, int len);”h]”hŒ“int rpmsg_send_offchannel(struct rpmsg_endpoint *ept, u32 src, u32 dst, void *data, int len);”…””}”hj sbah}”(h]”h ]”h"]”h$]”h&]”j‹jŒuh1j{hŸh¶h Kshjjhžhubh¾)”}”(hŒesends a message across to the remote processor, using the src and dst addresses provided by the user.”h]”hŒesends a message across to the remote processor, using the src and dst addresses provided by the user.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h Kwhjjhžhubh¾)”}”(hX`The caller should specify the endpoint, the data it wants to send, its length (in bytes), and explicit source and destination addresses. The message will then be sent to the remote processor to which the endpoint's channel belongs, but the endpoint's src and channel dst addresses will be ignored (and the user-provided addresses will be used instead).”h]”hXdThe caller should specify the endpoint, the data it wants to send, its length (in bytes), and explicit source and destination addresses. The message will then be sent to the remote processor to which the endpoint’s channel belongs, but the endpoint’s src and channel dst addresses will be ignored (and the user-provided addresses will be used instead).”…””}”(hj'hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h Kzhjjhžhubh¾)”}”(hXIn case there are no TX buffers available, the function will block until one becomes available (i.e. until the remote processor consumes a tx buffer and puts it back on virtio's used descriptor ring), or a timeout of 15 seconds elapses. When the latter happens, -ERESTARTSYS is returned.”h]”hX!In case there are no TX buffers available, the function will block until one becomes available (i.e. until the remote processor consumes a tx buffer and puts it back on virtio’s used descriptor ring), or a timeout of 15 seconds elapses. When the latter happens, -ERESTARTSYS is returned.”…””}”(hj5hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h Khjjhžhubh¾)”}”(hŒThe function can only be called from a process context (for now). Returns 0 on success and an appropriate error value on failure.”h]”hŒThe function can only be called from a process context (for now). Returns 0 on success and an appropriate error value on failure.”…””}”(hjChžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h K‡hjjhžhubj|)”}”(hŒCint rpmsg_trysend(struct rpmsg_endpoint *ept, void *data, int len);”h]”hŒCint rpmsg_trysend(struct rpmsg_endpoint *ept, void *data, int len);”…””}”hjQsbah}”(h]”h ]”h"]”h$]”h&]”j‹jŒuh1j{hŸh¶h KŒhjjhžhubh¾)”}”(hXmsends a message across to the remote processor from a given endpoint. The caller should specify the endpoint, the data it wants to send, and its length (in bytes). The message will be sent on the specified endpoint's channel, i.e. its source and destination address fields will be respectively set to the endpoint's src address and its parent channel dst addresses.”h]”hXqsends a message across to the remote processor from a given endpoint. The caller should specify the endpoint, the data it wants to send, and its length (in bytes). The message will be sent on the specified endpoint’s channel, i.e. its source and destination address fields will be respectively set to the endpoint’s src address and its parent channel dst addresses.”…””}”(hj_hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h KŽhjjhžhubh¾)”}”(hŒ„In case there are no TX buffers available, the function will immediately return -ENOMEM without waiting until one becomes available.”h]”hŒ„In case there are no TX buffers available, the function will immediately return -ENOMEM without waiting until one becomes available.”…””}”(hjmhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h K•hjjhžhubh¾)”}”(hŒThe function can only be called from a process context (for now). Returns 0 on success and an appropriate error value on failure.”h]”hŒThe function can only be called from a process context (for now). Returns 0 on success and an appropriate error value on failure.”…””}”(hj{hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h K˜hjjhžhubj|)”}”(hŒMint rpmsg_trysendto(struct rpmsg_endpoint *ept, void *data, int len, u32 dst)”h]”hŒMint rpmsg_trysendto(struct rpmsg_endpoint *ept, void *data, int len, u32 dst)”…””}”hj‰sbah}”(h]”h ]”h"]”h$]”h&]”j‹jŒuh1j{hŸh¶h Khjjhžhubh¾)”}”(hŒtsends a message across to the remote processor from a given endpoint, to a destination address provided by the user.”h]”hŒtsends a message across to the remote processor from a given endpoint, to a destination address provided by the user.”…””}”(hj—hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h K hjjhžhubh¾)”}”(hŒ{The user should specify the channel, the data it wants to send, its length (in bytes), and an explicit destination address.”h]”hŒ{The user should specify the channel, the data it wants to send, its length (in bytes), and an explicit destination address.”…””}”(hj¥hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h K£hjjhžhubh¾)”}”(hŒÈThe message will then be sent to the remote processor to which the channel belongs, using the channel's src address, and the user-provided dst address (thus the channel's dst address will be ignored).”h]”hŒÌThe message will then be sent to the remote processor to which the channel belongs, using the channel’s src address, and the user-provided dst address (thus the channel’s dst address will be ignored).”…””}”(hj³hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h K¦hjjhžhubh¾)”}”(hŒ„In case there are no TX buffers available, the function will immediately return -ENOMEM without waiting until one becomes available.”h]”hŒ„In case there are no TX buffers available, the function will immediately return -ENOMEM without waiting until one becomes available.”…””}”(hjÁhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h Kªhjjhžhubh¾)”}”(hŒThe function can only be called from a process context (for now). Returns 0 on success and an appropriate error value on failure.”h]”hŒThe function can only be called from a process context (for now). Returns 0 on success and an appropriate error value on failure.”…””}”(hjÏhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h K­hjjhžhubj|)”}”(hŒ–int rpmsg_trysend_offchannel(struct rpmsg_endpoint *ept, u32 src, u32 dst, void *data, int len);”h]”hŒ–int rpmsg_trysend_offchannel(struct rpmsg_endpoint *ept, u32 src, u32 dst, void *data, int len);”…””}”hjÝsbah}”(h]”h ]”h"]”h$]”h&]”j‹jŒuh1j{hŸh¶h K²hjjhžhubh¾)”}”(hŒlsends a message across to the remote processor, using source and destination addresses provided by the user.”h]”hŒlsends a message across to the remote processor, using source and destination addresses provided by the user.”…””}”(hjëhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h K¶hjjhžhubh¾)”}”(hXIThe user should specify the channel, the data it wants to send, its length (in bytes), and explicit source and destination addresses. The message will then be sent to the remote processor to which the channel belongs, but the channel's src and dst addresses will be ignored (and the user-provided addresses will be used instead).”h]”hXKThe user should specify the channel, the data it wants to send, its length (in bytes), and explicit source and destination addresses. The message will then be sent to the remote processor to which the channel belongs, but the channel’s src and dst addresses will be ignored (and the user-provided addresses will be used instead).”…””}”(hjùhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h K¹hjjhžhubh¾)”}”(hŒ„In case there are no TX buffers available, the function will immediately return -ENOMEM without waiting until one becomes available.”h]”hŒ„In case there are no TX buffers available, the function will immediately return -ENOMEM without waiting until one becomes available.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h K¿hjjhžhubh¾)”}”(hŒThe function can only be called from a process context (for now). Returns 0 on success and an appropriate error value on failure.”h]”hŒThe function can only be called from a process context (for now). Returns 0 on success and an appropriate error value on failure.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h KÂhjjhžhubj|)”}”(hŒÔstruct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_device *rpdev, rpmsg_rx_cb_t cb, void *priv, struct rpmsg_channel_info chinfo);”h]”hŒÔstruct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_device *rpdev, rpmsg_rx_cb_t cb, void *priv, struct rpmsg_channel_info chinfo);”…””}”hj#sbah}”(h]”h ]”h"]”h$]”h&]”j‹jŒuh1j{hŸh¶h KÇhjjhžhubh¾)”}”(hŒÑevery rpmsg address in the system is bound to an rx callback (so when inbound messages arrive, they are dispatched by the rpmsg bus using the appropriate callback handler) by means of an rpmsg_endpoint struct.”h]”hŒÑevery rpmsg address in the system is bound to an rx callback (so when inbound messages arrive, they are dispatched by the rpmsg bus using the appropriate callback handler) by means of an rpmsg_endpoint struct.”…””}”(hj1hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h KËhjjhžhubh¾)”}”(hŒèThis function allows drivers to create such an endpoint, and by that, bind a callback, and possibly some private data too, to an rpmsg address (either one that is known in advance, or one that will be dynamically assigned for them).”h]”hŒèThis function allows drivers to create such an endpoint, and by that, bind a callback, and possibly some private data too, to an rpmsg address (either one that is known in advance, or one that will be dynamically assigned for them).”…””}”(hj?hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h KÏhjjhžhubh¾)”}”(hŒÖSimple rpmsg drivers need not call rpmsg_create_ept, because an endpoint is already created for them when they are probed by the rpmsg bus (using the rx callback they provide when they registered to the rpmsg bus).”h]”hŒÖSimple rpmsg drivers need not call rpmsg_create_ept, because an endpoint is already created for them when they are probed by the rpmsg bus (using the rx callback they provide when they registered to the rpmsg bus).”…””}”(hjMhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h KÔhjjhžhubh¾)”}”(hX3So things should just work for simple drivers: they already have an endpoint, their rx callback is bound to their rpmsg address, and when relevant inbound messages arrive (i.e. messages which their dst address equals to the src address of their rpmsg channel), the driver's handler is invoked to process it.”h]”hX5So things should just work for simple drivers: they already have an endpoint, their rx callback is bound to their rpmsg address, and when relevant inbound messages arrive (i.e. messages which their dst address equals to the src address of their rpmsg channel), the driver’s handler is invoked to process it.”…””}”(hj[hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h KØhjjhžhubh¾)”}”(hXšThat said, more complicated drivers might do need to allocate additional rpmsg addresses, and bind them to different rx callbacks. To accomplish that, those drivers need to call this function. Drivers should provide their channel (so the new endpoint would bind to the same remote processor their channel belongs to), an rx callback function, an optional private data (which is provided back when the rx callback is invoked), and an address they want to bind with the callback. If addr is RPMSG_ADDR_ANY, then rpmsg_create_ept will dynamically assign them an available rpmsg address (drivers should have a very good reason why not to always use RPMSG_ADDR_ANY here).”h]”hXšThat said, more complicated drivers might do need to allocate additional rpmsg addresses, and bind them to different rx callbacks. To accomplish that, those drivers need to call this function. Drivers should provide their channel (so the new endpoint would bind to the same remote processor their channel belongs to), an rx callback function, an optional private data (which is provided back when the rx callback is invoked), and an address they want to bind with the callback. If addr is RPMSG_ADDR_ANY, then rpmsg_create_ept will dynamically assign them an available rpmsg address (drivers should have a very good reason why not to always use RPMSG_ADDR_ANY here).”…””}”(hjihžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h KÞhjjhžhubh¾)”}”(hŒ?Returns a pointer to the endpoint on success, or NULL on error.”h]”hŒ?Returns a pointer to the endpoint on success, or NULL on error.”…””}”(hjwhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h Kéhjjhžhubj|)”}”(hŒ3void rpmsg_destroy_ept(struct rpmsg_endpoint *ept);”h]”hŒ3void rpmsg_destroy_ept(struct rpmsg_endpoint *ept);”…””}”hj…sbah}”(h]”h ]”h"]”h$]”h&]”j‹jŒuh1j{hŸh¶h Kíhjjhžhubh¾)”}”(hŒŒdestroys an existing rpmsg endpoint. user should provide a pointer to an rpmsg endpoint that was previously created with rpmsg_create_ept().”h]”hŒŒdestroys an existing rpmsg endpoint. user should provide a pointer to an rpmsg endpoint that was previously created with rpmsg_create_ept().”…””}”(hj“hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h Kðhjjhžhubj|)”}”(hŒ6int register_rpmsg_driver(struct rpmsg_driver *rpdrv);”h]”hŒ6int register_rpmsg_driver(struct rpmsg_driver *rpdrv);”…””}”hj¡sbah}”(h]”h ]”h"]”h$]”h&]”j‹jŒuh1j{hŸh¶h Kõhjjhžhubh¾)”}”(hXregisters an rpmsg driver with the rpmsg bus. user should provide a pointer to an rpmsg_driver struct, which contains the driver's ->probe() and ->remove() functions, an rx callback, and an id_table specifying the names of the channels this driver is interested to be probed with.”h]”hXregisters an rpmsg driver with the rpmsg bus. user should provide a pointer to an rpmsg_driver struct, which contains the driver’s ->probe() and ->remove() functions, an rx callback, and an id_table specifying the names of the channels this driver is interested to be probed with.”…””}”(hj¯hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h Køhjjhžhubj|)”}”(hŒ9void unregister_rpmsg_driver(struct rpmsg_driver *rpdrv);”h]”hŒ9void unregister_rpmsg_driver(struct rpmsg_driver *rpdrv);”…””}”hj½sbah}”(h]”h ]”h"]”h$]”h&]”j‹jŒuh1j{hŸh¶h Mhjjhžhubh¾)”}”(hŒ¾unregisters an rpmsg driver from the rpmsg bus. user should provide a pointer to a previously-registered rpmsg_driver struct. Returns 0 on success, and an appropriate error value on failure.”h]”hŒ¾unregisters an rpmsg driver from the rpmsg bus. user should provide a pointer to a previously-registered rpmsg_driver struct. Returns 0 on success, and an appropriate error value on failure.”…””}”(hjËhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h Mhjjhžhubeh}”(h]”Œuser-api”ah ]”h"]”Œuser api”ah$]”h&]”uh1h¡hh£hžhhŸh¶h KCubh¢)”}”(hhh]”(h§)”}”(hŒ Typical usage”h]”hŒ Typical usage”…””}”(hjähžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hjáhžhhŸh¶h M ubh¾)”}”(hŒ¥The following is a simple rpmsg driver, that sends an "hello!" message on probe(), and whenever it receives an incoming message, it dumps its content to the console.”h]”hŒ©The following is a simple rpmsg driver, that sends an “hello!†message on probe(), and whenever it receives an incoming message, it dumps its content to the console.”…””}”(hjòhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h M hjáhžhubj|)”}”(hXa#include #include #include static void rpmsg_sample_cb(struct rpmsg_channel *rpdev, void *data, int len, void *priv, u32 src) { print_hex_dump(KERN_INFO, "incoming message:", DUMP_PREFIX_NONE, 16, 1, data, len, true); } static int rpmsg_sample_probe(struct rpmsg_channel *rpdev) { int err; dev_info(&rpdev->dev, "chnl: 0x%x -> 0x%x\n", rpdev->src, rpdev->dst); /* send a message on our channel */ err = rpmsg_send(rpdev->ept, "hello!", 6); if (err) { pr_err("rpmsg_send failed: %d\n", err); return err; } return 0; } static void rpmsg_sample_remove(struct rpmsg_channel *rpdev) { dev_info(&rpdev->dev, "rpmsg sample client driver is removed\n"); } static struct rpmsg_device_id rpmsg_driver_sample_id_table[] = { { .name = "rpmsg-client-sample" }, { }, }; MODULE_DEVICE_TABLE(rpmsg, rpmsg_driver_sample_id_table); static struct rpmsg_driver rpmsg_sample_client = { .drv.name = KBUILD_MODNAME, .id_table = rpmsg_driver_sample_id_table, .probe = rpmsg_sample_probe, .callback = rpmsg_sample_cb, .remove = rpmsg_sample_remove, }; module_rpmsg_driver(rpmsg_sample_client);”h]”hXa#include #include #include static void rpmsg_sample_cb(struct rpmsg_channel *rpdev, void *data, int len, void *priv, u32 src) { print_hex_dump(KERN_INFO, "incoming message:", DUMP_PREFIX_NONE, 16, 1, data, len, true); } static int rpmsg_sample_probe(struct rpmsg_channel *rpdev) { int err; dev_info(&rpdev->dev, "chnl: 0x%x -> 0x%x\n", rpdev->src, rpdev->dst); /* send a message on our channel */ err = rpmsg_send(rpdev->ept, "hello!", 6); if (err) { pr_err("rpmsg_send failed: %d\n", err); return err; } return 0; } static void rpmsg_sample_remove(struct rpmsg_channel *rpdev) { dev_info(&rpdev->dev, "rpmsg sample client driver is removed\n"); } static struct rpmsg_device_id rpmsg_driver_sample_id_table[] = { { .name = "rpmsg-client-sample" }, { }, }; MODULE_DEVICE_TABLE(rpmsg, rpmsg_driver_sample_id_table); static struct rpmsg_driver rpmsg_sample_client = { .drv.name = KBUILD_MODNAME, .id_table = rpmsg_driver_sample_id_table, .probe = rpmsg_sample_probe, .callback = rpmsg_sample_cb, .remove = rpmsg_sample_remove, }; module_rpmsg_driver(rpmsg_sample_client);”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”j‹jŒuh1j{hŸh¶h Mhjáhžhubh¸)”}”(hŒNa similar sample which can be built and loaded can be found in samples/rpmsg/.”h]”h¾)”}”(hŒNa similar sample which can be built and loaded can be found in samples/rpmsg/.”h]”hŒNa similar sample which can be built and loaded can be found in samples/rpmsg/.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h MBhjubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hjáhžhhŸh¶h Nubeh}”(h]”Œ typical-usage”ah ]”h"]”Œ typical usage”ah$]”h&]”uh1h¡hh£hžhhŸh¶h M ubh¢)”}”(hhh]”(h§)”}”(hŒAllocations of rpmsg channels”h]”hŒAllocations of rpmsg channels”…””}”(hj1hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hj.hžhhŸh¶h MFubh¾)”}”(hŒDAt this point we only support dynamic allocations of rpmsg channels.”h]”hŒDAt this point we only support dynamic allocations of rpmsg channels.”…””}”(hj?hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h MHhj.hžhubh¾)”}”(hŒÍThis is possible only with remote processors that have the VIRTIO_RPMSG_F_NS virtio device feature set. This feature bit means that the remote processor supports dynamic name service announcement messages.”h]”hŒÍThis is possible only with remote processors that have the VIRTIO_RPMSG_F_NS virtio device feature set. This feature bit means that the remote processor supports dynamic name service announcement messages.”…””}”(hjMhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h MJhj.hžhubh¾)”}”(hX When this feature is enabled, creation of rpmsg devices (i.e. channels) is completely dynamic: the remote processor announces the existence of a remote rpmsg service by sending a name service message (which contains the name and rpmsg addr of the remote service, see struct rpmsg_ns_msg).”h]”hX When this feature is enabled, creation of rpmsg devices (i.e. channels) is completely dynamic: the remote processor announces the existence of a remote rpmsg service by sending a name service message (which contains the name and rpmsg addr of the remote service, see struct rpmsg_ns_msg).”…””}”(hj[hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h MNhj.hžhubh¾)”}”(hX*This message is then handled by the rpmsg bus, which in turn dynamically creates and registers an rpmsg channel (which represents the remote service). If/when a relevant rpmsg driver is registered, it will be immediately probed by the bus, and can then start sending messages to the remote service.”h]”hX*This message is then handled by the rpmsg bus, which in turn dynamically creates and registers an rpmsg channel (which represents the remote service). If/when a relevant rpmsg driver is registered, it will be immediately probed by the bus, and can then start sending messages to the remote service.”…””}”(hjihžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h MShj.hžhubh¾)”}”(hŒtThe plan is also to add static creation of rpmsg channels via the virtio config space, but it's not implemented yet.”h]”hŒvThe plan is also to add static creation of rpmsg channels via the virtio config space, but it’s not implemented yet.”…””}”(hjwhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h½hŸh¶h MXhj.hžhubeh}”(h]”Œallocations-of-rpmsg-channels”ah ]”h"]”Œallocations of rpmsg channels”ah$]”h&]”uh1h¡hh£hžhhŸh¶h MFubeh}”(h]”Œ*remote-processor-messaging-rpmsg-framework”ah ]”h"]”Œ,remote processor messaging (rpmsg) framework”ah$]”h&]”uh1h¡hhhžhhŸh¶h Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”h¶uh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(h¦NŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”j¸Œerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”h¶Œ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(j’jjgjdjÞjÛj+j(jŠj‡uŒ nametypes”}”(j’‰jg‰jÞ‰j+‰jЉuh}”(jh£jdhÓjÛjjj(jáj‡j.uŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nhžhub.