diff options
| author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-05-17 05:31:37 -0400 |
|---|---|---|
| committer | Jonathan Corbet <corbet@lwn.net> | 2017-07-14 15:58:02 -0400 |
| commit | 620b470bb41c9620875f9b7e3fe2d70a7602a6b6 (patch) | |
| tree | 54772a24e683d4ff246592cea32273eb6919dcca | |
| parent | ce0f95a501b201f857909738e201729048d41be7 (diff) | |
remoteproc.txt: standardize document format
Each text file under Documentation follows a different
format. Some doesn't even have titles!
Change its representation to follow the adopted standard,
using ReST markups for it to be parseable by Sphinx:
- mark document and section titles;
- adjust identation;
- mark literal blocks
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
| -rw-r--r-- | Documentation/remoteproc.txt | 328 |
1 files changed, 189 insertions, 139 deletions
diff --git a/Documentation/remoteproc.txt b/Documentation/remoteproc.txt index f07597482351..77fb03acdbb4 100644 --- a/Documentation/remoteproc.txt +++ b/Documentation/remoteproc.txt | |||
| @@ -1,6 +1,9 @@ | |||
| 1 | ========================== | ||
| 1 | Remote Processor Framework | 2 | Remote Processor Framework |
| 3 | ========================== | ||
| 2 | 4 | ||
| 3 | 1. Introduction | 5 | Introduction |
| 6 | ============ | ||
| 4 | 7 | ||
| 5 | Modern SoCs typically have heterogeneous remote processor devices in asymmetric | 8 | Modern SoCs typically have heterogeneous remote processor devices in asymmetric |
| 6 | multiprocessing (AMP) configurations, which may be running different instances | 9 | multiprocessing (AMP) configurations, which may be running different instances |
| @@ -26,44 +29,62 @@ remoteproc will add those devices. This makes it possible to reuse the | |||
| 26 | existing virtio drivers with remote processor backends at a minimal development | 29 | existing virtio drivers with remote processor backends at a minimal development |
| 27 | cost. | 30 | cost. |
| 28 | 31 | ||
| 29 | 2. User API | 32 | User API |
| 33 | ======== | ||
| 34 | |||
| 35 | :: | ||
| 30 | 36 | ||
| 31 | int rproc_boot(struct rproc *rproc) | 37 | int rproc_boot(struct rproc *rproc) |
| 32 | - Boot a remote processor (i.e. load its firmware, power it on, ...). | 38 | |
| 33 | If the remote processor is already powered on, this function immediately | 39 | Boot a remote processor (i.e. load its firmware, power it on, ...). |
| 34 | returns (successfully). | 40 | |
| 35 | Returns 0 on success, and an appropriate error value otherwise. | 41 | If the remote processor is already powered on, this function immediately |
| 36 | Note: to use this function you should already have a valid rproc | 42 | returns (successfully). |
| 37 | handle. There are several ways to achieve that cleanly (devres, pdata, | 43 | |
| 38 | the way remoteproc_rpmsg.c does this, or, if this becomes prevalent, we | 44 | Returns 0 on success, and an appropriate error value otherwise. |
| 39 | might also consider using dev_archdata for this). | 45 | Note: to use this function you should already have a valid rproc |
| 46 | handle. There are several ways to achieve that cleanly (devres, pdata, | ||
| 47 | the way remoteproc_rpmsg.c does this, or, if this becomes prevalent, we | ||
| 48 | might also consider using dev_archdata for this). | ||
| 49 | |||
| 50 | :: | ||
| 40 | 51 | ||
| 41 | void rproc_shutdown(struct rproc *rproc) | 52 | void rproc_shutdown(struct rproc *rproc) |
| 42 | - Power off a remote processor (previously booted with rproc_boot()). | 53 | |
| 43 | In case @rproc is still being used by an additional user(s), then | 54 | Power off a remote processor (previously booted with rproc_boot()). |
| 44 | this function will just decrement the power refcount and exit, | 55 | In case @rproc is still being used by an additional user(s), then |
| 45 | without really powering off the device. | 56 | this function will just decrement the power refcount and exit, |
| 46 | Every call to rproc_boot() must (eventually) be accompanied by a call | 57 | without really powering off the device. |
| 47 | to rproc_shutdown(). Calling rproc_shutdown() redundantly is a bug. | 58 | |
| 48 | Notes: | 59 | Every call to rproc_boot() must (eventually) be accompanied by a call |
| 49 | - we're not decrementing the rproc's refcount, only the power refcount. | 60 | to rproc_shutdown(). Calling rproc_shutdown() redundantly is a bug. |
| 50 | which means that the @rproc handle stays valid even after | 61 | |
| 51 | rproc_shutdown() returns, and users can still use it with a subsequent | 62 | .. note:: |
| 52 | rproc_boot(), if needed. | 63 | |
| 64 | we're not decrementing the rproc's refcount, only the power refcount. | ||
| 65 | which means that the @rproc handle stays valid even after | ||
| 66 | rproc_shutdown() returns, and users can still use it with a subsequent | ||
| 67 | rproc_boot(), if needed. | ||
| 68 | |||
| 69 | :: | ||
| 53 | 70 | ||
| 54 | struct rproc *rproc_get_by_phandle(phandle phandle) | 71 | struct rproc *rproc_get_by_phandle(phandle phandle) |
| 55 | - Find an rproc handle using a device tree phandle. Returns the rproc | ||
| 56 | handle on success, and NULL on failure. This function increments | ||
| 57 | the remote processor's refcount, so always use rproc_put() to | ||
| 58 | decrement it back once rproc isn't needed anymore. | ||
| 59 | 72 | ||
| 60 | 3. Typical usage | 73 | Find an rproc handle using a device tree phandle. Returns the rproc |
| 74 | handle on success, and NULL on failure. This function increments | ||
| 75 | the remote processor's refcount, so always use rproc_put() to | ||
| 76 | decrement it back once rproc isn't needed anymore. | ||
| 77 | |||
| 78 | Typical usage | ||
| 79 | ============= | ||
| 61 | 80 | ||
| 62 | #include <linux/remoteproc.h> | 81 | :: |
| 63 | 82 | ||
| 64 | /* in case we were given a valid 'rproc' handle */ | 83 | #include <linux/remoteproc.h> |
| 65 | int dummy_rproc_example(struct rproc *my_rproc) | 84 | |
| 66 | { | 85 | /* in case we were given a valid 'rproc' handle */ |
| 86 | int dummy_rproc_example(struct rproc *my_rproc) | ||
| 87 | { | ||
| 67 | int ret; | 88 | int ret; |
| 68 | 89 | ||
| 69 | /* let's power on and boot our remote processor */ | 90 | /* let's power on and boot our remote processor */ |
| @@ -80,84 +101,111 @@ int dummy_rproc_example(struct rproc *my_rproc) | |||
| 80 | 101 | ||
| 81 | /* let's shut it down now */ | 102 | /* let's shut it down now */ |
| 82 | rproc_shutdown(my_rproc); | 103 | rproc_shutdown(my_rproc); |
| 83 | } | 104 | } |
| 105 | |||
| 106 | API for implementors | ||
| 107 | ==================== | ||
| 84 | 108 | ||
| 85 | 4. API for implementors | 109 | :: |
| 86 | 110 | ||
| 87 | struct rproc *rproc_alloc(struct device *dev, const char *name, | 111 | struct rproc *rproc_alloc(struct device *dev, const char *name, |
| 88 | const struct rproc_ops *ops, | 112 | const struct rproc_ops *ops, |
| 89 | const char *firmware, int len) | 113 | const char *firmware, int len) |
| 90 | - Allocate a new remote processor handle, but don't register | 114 | |
| 91 | it yet. Required parameters are the underlying device, the | 115 | Allocate a new remote processor handle, but don't register |
| 92 | name of this remote processor, platform-specific ops handlers, | 116 | it yet. Required parameters are the underlying device, the |
| 93 | the name of the firmware to boot this rproc with, and the | 117 | name of this remote processor, platform-specific ops handlers, |
| 94 | length of private data needed by the allocating rproc driver (in bytes). | 118 | the name of the firmware to boot this rproc with, and the |
| 95 | 119 | length of private data needed by the allocating rproc driver (in bytes). | |
| 96 | This function should be used by rproc implementations during | 120 | |
| 97 | initialization of the remote processor. | 121 | This function should be used by rproc implementations during |
| 98 | After creating an rproc handle using this function, and when ready, | 122 | initialization of the remote processor. |
| 99 | implementations should then call rproc_add() to complete | 123 | |
| 100 | the registration of the remote processor. | 124 | After creating an rproc handle using this function, and when ready, |
| 101 | On success, the new rproc is returned, and on failure, NULL. | 125 | implementations should then call rproc_add() to complete |
| 102 | 126 | the registration of the remote processor. | |
| 103 | Note: _never_ directly deallocate @rproc, even if it was not registered | 127 | |
| 104 | yet. Instead, when you need to unroll rproc_alloc(), use rproc_free(). | 128 | On success, the new rproc is returned, and on failure, NULL. |
| 129 | |||
| 130 | .. note:: | ||
| 131 | |||
| 132 | **never** directly deallocate @rproc, even if it was not registered | ||
| 133 | yet. Instead, when you need to unroll rproc_alloc(), use rproc_free(). | ||
| 134 | |||
| 135 | :: | ||
| 105 | 136 | ||
| 106 | void rproc_free(struct rproc *rproc) | 137 | void rproc_free(struct rproc *rproc) |
| 107 | - Free an rproc handle that was allocated by rproc_alloc. | 138 | |
| 108 | This function essentially unrolls rproc_alloc(), by decrementing the | 139 | Free an rproc handle that was allocated by rproc_alloc. |
| 109 | rproc's refcount. It doesn't directly free rproc; that would happen | 140 | |
| 110 | only if there are no other references to rproc and its refcount now | 141 | This function essentially unrolls rproc_alloc(), by decrementing the |
| 111 | dropped to zero. | 142 | rproc's refcount. It doesn't directly free rproc; that would happen |
| 143 | only if there are no other references to rproc and its refcount now | ||
| 144 | dropped to zero. | ||
| 145 | |||
| 146 | :: | ||
| 112 | 147 | ||
| 113 | int rproc_add(struct rproc *rproc) | 148 | int rproc_add(struct rproc *rproc) |
| 114 | - Register @rproc with the remoteproc framework, after it has been | 149 | |
| 115 | allocated with rproc_alloc(). | 150 | Register @rproc with the remoteproc framework, after it has been |
| 116 | This is called by the platform-specific rproc implementation, whenever | 151 | allocated with rproc_alloc(). |
| 117 | a new remote processor device is probed. | 152 | |
| 118 | Returns 0 on success and an appropriate error code otherwise. | 153 | This is called by the platform-specific rproc implementation, whenever |
| 119 | Note: this function initiates an asynchronous firmware loading | 154 | a new remote processor device is probed. |
| 120 | context, which will look for virtio devices supported by the rproc's | 155 | |
| 121 | firmware. | 156 | Returns 0 on success and an appropriate error code otherwise. |
| 122 | If found, those virtio devices will be created and added, so as a result | 157 | Note: this function initiates an asynchronous firmware loading |
| 123 | of registering this remote processor, additional virtio drivers might get | 158 | context, which will look for virtio devices supported by the rproc's |
| 124 | probed. | 159 | firmware. |
| 160 | |||
| 161 | If found, those virtio devices will be created and added, so as a result | ||
| 162 | of registering this remote processor, additional virtio drivers might get | ||
| 163 | probed. | ||
| 164 | |||
| 165 | :: | ||
| 125 | 166 | ||
| 126 | int rproc_del(struct rproc *rproc) | 167 | int rproc_del(struct rproc *rproc) |
| 127 | - Unroll rproc_add(). | ||
| 128 | This function should be called when the platform specific rproc | ||
| 129 | implementation decides to remove the rproc device. it should | ||
| 130 | _only_ be called if a previous invocation of rproc_add() | ||
| 131 | has completed successfully. | ||
| 132 | |||
