Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Documentation: coresight: Update coresight configuration docs

Update the CoreSight System Configuration document to cover the
use of loadable modules to add configurations and features
to the system.

Signed-off-by: Mike Leach <mike.leach@linaro.org>
Link: https://lore.kernel.org/r/20211124200038.28662-7-mike.leach@linaro.org
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

authored by

Mike Leach and committed by
Mathieu Poirier
f9809d56 7ebd0ec6

+59 -3
+59 -3
Documentation/trace/coresight/coresight-config.rst
··· 155 155 autofdo 156 156 $ cd autofdo/ 157 157 $ ls 158 - description preset1 preset3 preset5 preset7 preset9 159 - feature_refs preset2 preset4 preset6 preset8 158 + description feature_refs preset1 preset3 preset5 preset7 preset9 159 + enable preset preset2 preset4 preset6 preset8 160 160 $ cat description 161 161 Setup ETMs with strobing for autofdo 162 162 $ cat feature_refs 163 163 strobing 164 164 165 - Each preset declared has a preset<n> subdirectory declared. The values for 165 + Each preset declared has a 'preset<n>' subdirectory declared. The values for 166 166 the preset can be examined:: 167 167 168 168 $ cat preset1/values 169 169 strobing.window = 0x1388 strobing.period = 0x2 170 170 $ cat preset2/values 171 171 strobing.window = 0x1388 strobing.period = 0x4 172 + 173 + The 'enable' and 'preset' files allow the control of a configuration when 174 + using CoreSight with sysfs. 172 175 173 176 The features referenced by the configuration can be examined in the features 174 177 directory:: ··· 239 236 240 237 When configurations are selected in this way, then the trace sink used is 241 238 automatically selected. 239 + 240 + Using Configurations in sysfs 241 + ============================= 242 + 243 + Coresight can be controlled using sysfs. When this is in use then a configuration 244 + can be made active for the devices that are used in the sysfs session. 245 + 246 + In a configuration there are 'enable' and 'preset' files. 247 + 248 + To enable a configuration for use with sysfs:: 249 + 250 + $ cd configurations/autofdo 251 + $ echo 1 > enable 252 + 253 + This will then use any default parameter values in the features - which can be 254 + adjusted as described above. 255 + 256 + To use a preset<n> set of parameter values:: 257 + 258 + $ echo 3 > preset 259 + 260 + This will select preset3 for the configuration. 261 + The valid values for preset are 0 - to deselect presets, and any value of 262 + <n> where a preset<n> sub-directory is present. 263 + 264 + Note that the active sysfs configuration is a global parameter, therefore 265 + only a single configuration can be active for sysfs at any one time. 266 + Attempting to enable a second configuration will result in an error. 267 + Additionally, attempting to disable the configuration while in use will 268 + also result in an error. 269 + 270 + The use of the active configuration by sysfs is independent of the configuration 271 + used in perf. 272 + 273 + 274 + Creating and Loading Custom Configurations 275 + ========================================== 276 + 277 + Custom configurations and / or features can be dynamically loaded into the 278 + system by using a loadable module. 279 + 280 + An example of a custom configuration is found in ./samples/coresight. 281 + 282 + This creates a new configuration that uses the existing built in 283 + strobing feature, but provides a different set of presets. 284 + 285 + When the module is loaded, then the configuration appears in the configfs 286 + file system and is selectable in the same way as the built in configuration 287 + described above. 288 + 289 + Configurations can use previously loaded features. The system will ensure 290 + that it is not possible to unload a feature that is currently in use, by 291 + enforcing the unload order as the strict reverse of the load order.