mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
coresight: syscfg: Example CoreSight configuration loadable module
An example of creating a loadable module to add CoreSight configurations into a system. In the Kernel samples/coresight directory. Signed-off-by: Mike Leach <mike.leach@linaro.org> Link: https://lore.kernel.org/r/20211124200038.28662-5-mike.leach@linaro.org Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
This commit is contained in:
parent
eb2ec49606
commit
ede5bab874
@ -1890,6 +1890,7 @@ F: Documentation/trace/coresight/*
|
|||||||
F: drivers/hwtracing/coresight/*
|
F: drivers/hwtracing/coresight/*
|
||||||
F: include/dt-bindings/arm/coresight-cti-dt.h
|
F: include/dt-bindings/arm/coresight-cti-dt.h
|
||||||
F: include/linux/coresight*
|
F: include/linux/coresight*
|
||||||
|
F: samples/coresight/*
|
||||||
F: tools/perf/arch/arm/util/auxtrace.c
|
F: tools/perf/arch/arm/util/auxtrace.c
|
||||||
F: tools/perf/arch/arm/util/cs-etm.c
|
F: tools/perf/arch/arm/util/cs-etm.c
|
||||||
F: tools/perf/arch/arm/util/cs-etm.h
|
F: tools/perf/arch/arm/util/cs-etm.h
|
||||||
|
@ -232,6 +232,15 @@ config SAMPLE_WATCH_QUEUE
|
|||||||
Build example userspace program to use the new mount_notify(),
|
Build example userspace program to use the new mount_notify(),
|
||||||
sb_notify() syscalls and the KEYCTL_WATCH_KEY keyctl() function.
|
sb_notify() syscalls and the KEYCTL_WATCH_KEY keyctl() function.
|
||||||
|
|
||||||
|
config SAMPLE_CORESIGHT_SYSCFG
|
||||||
|
tristate "Build example loadable module for CoreSight config"
|
||||||
|
depends on CORESIGHT && m
|
||||||
|
help
|
||||||
|
Build an example loadable module that adds new CoreSight features
|
||||||
|
and configuration using the CoreSight system configuration API.
|
||||||
|
This demonstrates how a user may create their own CoreSight
|
||||||
|
configurations and easily load them into the system at runtime.
|
||||||
|
|
||||||
endif # SAMPLES
|
endif # SAMPLES
|
||||||
|
|
||||||
config HAVE_SAMPLE_FTRACE_DIRECT
|
config HAVE_SAMPLE_FTRACE_DIRECT
|
||||||
|
@ -32,3 +32,4 @@ obj-$(CONFIG_SAMPLE_INTEL_MEI) += mei/
|
|||||||
subdir-$(CONFIG_SAMPLE_WATCHDOG) += watchdog
|
subdir-$(CONFIG_SAMPLE_WATCHDOG) += watchdog
|
||||||
subdir-$(CONFIG_SAMPLE_WATCH_QUEUE) += watch_queue
|
subdir-$(CONFIG_SAMPLE_WATCH_QUEUE) += watch_queue
|
||||||
obj-$(CONFIG_DEBUG_KMEMLEAK_TEST) += kmemleak/
|
obj-$(CONFIG_DEBUG_KMEMLEAK_TEST) += kmemleak/
|
||||||
|
obj-$(CONFIG_SAMPLE_CORESIGHT_SYSCFG) += coresight/
|
||||||
|
4
samples/coresight/Makefile
Normal file
4
samples/coresight/Makefile
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
|
||||||
|
obj-$(CONFIG_SAMPLE_CORESIGHT_SYSCFG) += coresight-cfg-sample.o
|
||||||
|
ccflags-y += -I$(srctree)/drivers/hwtracing/coresight
|
73
samples/coresight/coresight-cfg-sample.c
Normal file
73
samples/coresight/coresight-cfg-sample.c
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
/*
|
||||||
|
* Copyright(C) 2020 Linaro Limited. All rights reserved.
|
||||||
|
* Author: Mike Leach <mike.leach@linaro.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "coresight-config.h"
|
||||||
|
#include "coresight-syscfg.h"
|
||||||
|
|
||||||
|
/* create an alternate autofdo configuration */
|
||||||
|
|
||||||
|
/* we will provide 4 sets of preset parameter values */
|
||||||
|
#define AFDO2_NR_PRESETS 4
|
||||||
|
/* the total number of parameters in used features - strobing has 2 */
|
||||||
|
#define AFDO2_NR_PARAM_SUM 2
|
||||||
|
|
||||||
|
static const char *afdo2_ref_names[] = {
|
||||||
|
"strobing",
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* set of presets leaves strobing window constant while varying period to allow
|
||||||
|
* experimentation with mark / space ratios for various workloads
|
||||||
|
*/
|
||||||
|
static u64 afdo2_presets[AFDO2_NR_PRESETS][AFDO2_NR_PARAM_SUM] = {
|
||||||
|
{ 1000, 100 },
|
||||||
|
{ 1000, 1000 },
|
||||||
|
{ 1000, 5000 },
|
||||||
|
{ 1000, 10000 },
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cscfg_config_desc afdo2 = {
|
||||||
|
.name = "autofdo2",
|
||||||
|
.description = "Setup ETMs with strobing for autofdo\n"
|
||||||
|
"Supplied presets allow experimentation with mark-space ratio for various loads\n",
|
||||||
|
.nr_feat_refs = ARRAY_SIZE(afdo2_ref_names),
|
||||||
|
.feat_ref_names = afdo2_ref_names,
|
||||||
|
.nr_presets = AFDO2_NR_PRESETS,
|
||||||
|
.nr_total_params = AFDO2_NR_PARAM_SUM,
|
||||||
|
.presets = &afdo2_presets[0][0],
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct cscfg_feature_desc *sample_feats[] = {
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct cscfg_config_desc *sample_cfgs[] = {
|
||||||
|
&afdo2,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct cscfg_load_owner_info mod_owner = {
|
||||||
|
.type = CSCFG_OWNER_MODULE,
|
||||||
|
.owner_handle = THIS_MODULE,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* module init and exit - just load and unload configs */
|
||||||
|
static int __init cscfg_sample_init(void)
|
||||||
|
{
|
||||||
|
return cscfg_load_config_sets(sample_cfgs, sample_feats, &mod_owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __exit cscfg_sample_exit(void)
|
||||||
|
{
|
||||||
|
cscfg_unload_config_sets(&mod_owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
module_init(cscfg_sample_init);
|
||||||
|
module_exit(cscfg_sample_exit);
|
||||||
|
|
||||||
|
MODULE_LICENSE("GPL v2");
|
||||||
|
MODULE_AUTHOR("Mike Leach <mike.leach@linaro.org>");
|
||||||
|
MODULE_DESCRIPTION("CoreSight Syscfg Example");
|
Loading…
Reference in New Issue
Block a user