1*ede5bab8SMike Leach // SPDX-License-Identifier: GPL-2.0
2*ede5bab8SMike Leach /*
3*ede5bab8SMike Leach * Copyright(C) 2020 Linaro Limited. All rights reserved.
4*ede5bab8SMike Leach * Author: Mike Leach <mike.leach@linaro.org>
5*ede5bab8SMike Leach */
6*ede5bab8SMike Leach
7*ede5bab8SMike Leach #include "coresight-config.h"
8*ede5bab8SMike Leach #include "coresight-syscfg.h"
9*ede5bab8SMike Leach
10*ede5bab8SMike Leach /* create an alternate autofdo configuration */
11*ede5bab8SMike Leach
12*ede5bab8SMike Leach /* we will provide 4 sets of preset parameter values */
13*ede5bab8SMike Leach #define AFDO2_NR_PRESETS 4
14*ede5bab8SMike Leach /* the total number of parameters in used features - strobing has 2 */
15*ede5bab8SMike Leach #define AFDO2_NR_PARAM_SUM 2
16*ede5bab8SMike Leach
17*ede5bab8SMike Leach static const char *afdo2_ref_names[] = {
18*ede5bab8SMike Leach "strobing",
19*ede5bab8SMike Leach };
20*ede5bab8SMike Leach
21*ede5bab8SMike Leach /*
22*ede5bab8SMike Leach * set of presets leaves strobing window constant while varying period to allow
23*ede5bab8SMike Leach * experimentation with mark / space ratios for various workloads
24*ede5bab8SMike Leach */
25*ede5bab8SMike Leach static u64 afdo2_presets[AFDO2_NR_PRESETS][AFDO2_NR_PARAM_SUM] = {
26*ede5bab8SMike Leach { 1000, 100 },
27*ede5bab8SMike Leach { 1000, 1000 },
28*ede5bab8SMike Leach { 1000, 5000 },
29*ede5bab8SMike Leach { 1000, 10000 },
30*ede5bab8SMike Leach };
31*ede5bab8SMike Leach
32*ede5bab8SMike Leach struct cscfg_config_desc afdo2 = {
33*ede5bab8SMike Leach .name = "autofdo2",
34*ede5bab8SMike Leach .description = "Setup ETMs with strobing for autofdo\n"
35*ede5bab8SMike Leach "Supplied presets allow experimentation with mark-space ratio for various loads\n",
36*ede5bab8SMike Leach .nr_feat_refs = ARRAY_SIZE(afdo2_ref_names),
37*ede5bab8SMike Leach .feat_ref_names = afdo2_ref_names,
38*ede5bab8SMike Leach .nr_presets = AFDO2_NR_PRESETS,
39*ede5bab8SMike Leach .nr_total_params = AFDO2_NR_PARAM_SUM,
40*ede5bab8SMike Leach .presets = &afdo2_presets[0][0],
41*ede5bab8SMike Leach };
42*ede5bab8SMike Leach
43*ede5bab8SMike Leach static struct cscfg_feature_desc *sample_feats[] = {
44*ede5bab8SMike Leach NULL
45*ede5bab8SMike Leach };
46*ede5bab8SMike Leach
47*ede5bab8SMike Leach static struct cscfg_config_desc *sample_cfgs[] = {
48*ede5bab8SMike Leach &afdo2,
49*ede5bab8SMike Leach NULL
50*ede5bab8SMike Leach };
51*ede5bab8SMike Leach
52*ede5bab8SMike Leach static struct cscfg_load_owner_info mod_owner = {
53*ede5bab8SMike Leach .type = CSCFG_OWNER_MODULE,
54*ede5bab8SMike Leach .owner_handle = THIS_MODULE,
55*ede5bab8SMike Leach };
56*ede5bab8SMike Leach
57*ede5bab8SMike Leach /* module init and exit - just load and unload configs */
cscfg_sample_init(void)58*ede5bab8SMike Leach static int __init cscfg_sample_init(void)
59*ede5bab8SMike Leach {
60*ede5bab8SMike Leach return cscfg_load_config_sets(sample_cfgs, sample_feats, &mod_owner);
61*ede5bab8SMike Leach }
62*ede5bab8SMike Leach
cscfg_sample_exit(void)63*ede5bab8SMike Leach static void __exit cscfg_sample_exit(void)
64*ede5bab8SMike Leach {
65*ede5bab8SMike Leach cscfg_unload_config_sets(&mod_owner);
66*ede5bab8SMike Leach }
67*ede5bab8SMike Leach
68*ede5bab8SMike Leach module_init(cscfg_sample_init);
69*ede5bab8SMike Leach module_exit(cscfg_sample_exit);
70*ede5bab8SMike Leach
71*ede5bab8SMike Leach MODULE_LICENSE("GPL v2");
72*ede5bab8SMike Leach MODULE_AUTHOR("Mike Leach <mike.leach@linaro.org>");
73*ede5bab8SMike Leach MODULE_DESCRIPTION("CoreSight Syscfg Example");
74