Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * Copyright(C) 2020 Linaro Limited. All rights reserved.
0004  * Author: Mike Leach <mike.leach@linaro.org>
0005  */
0006 
0007 #include "coresight-config.h"
0008 #include "coresight-syscfg.h"
0009 
0010 /* create an alternate autofdo configuration */
0011 
0012 /* we will provide 4 sets of preset parameter values */
0013 #define AFDO2_NR_PRESETS    4
0014 /* the total number of parameters in used features - strobing has 2 */
0015 #define AFDO2_NR_PARAM_SUM  2
0016 
0017 static const char *afdo2_ref_names[] = {
0018     "strobing",
0019 };
0020 
0021 /*
0022  * set of presets leaves strobing window constant while varying period to allow
0023  * experimentation with mark / space ratios for various workloads
0024  */
0025 static u64 afdo2_presets[AFDO2_NR_PRESETS][AFDO2_NR_PARAM_SUM] = {
0026     { 1000, 100 },
0027     { 1000, 1000 },
0028     { 1000, 5000 },
0029     { 1000, 10000 },
0030 };
0031 
0032 struct cscfg_config_desc afdo2 = {
0033     .name = "autofdo2",
0034     .description = "Setup ETMs with strobing for autofdo\n"
0035     "Supplied presets allow experimentation with mark-space ratio for various loads\n",
0036     .nr_feat_refs = ARRAY_SIZE(afdo2_ref_names),
0037     .feat_ref_names = afdo2_ref_names,
0038     .nr_presets = AFDO2_NR_PRESETS,
0039     .nr_total_params = AFDO2_NR_PARAM_SUM,
0040     .presets = &afdo2_presets[0][0],
0041 };
0042 
0043 static struct cscfg_feature_desc *sample_feats[] = {
0044     NULL
0045 };
0046 
0047 static struct cscfg_config_desc *sample_cfgs[] = {
0048     &afdo2,
0049     NULL
0050 };
0051 
0052 static struct cscfg_load_owner_info mod_owner = {
0053     .type = CSCFG_OWNER_MODULE,
0054     .owner_handle = THIS_MODULE,
0055 };
0056 
0057 /* module init and exit - just load and unload configs */
0058 static int __init cscfg_sample_init(void)
0059 {
0060     return cscfg_load_config_sets(sample_cfgs, sample_feats, &mod_owner);
0061 }
0062 
0063 static void __exit cscfg_sample_exit(void)
0064 {
0065     cscfg_unload_config_sets(&mod_owner);
0066 }
0067 
0068 module_init(cscfg_sample_init);
0069 module_exit(cscfg_sample_exit);
0070 
0071 MODULE_LICENSE("GPL v2");
0072 MODULE_AUTHOR("Mike Leach <mike.leach@linaro.org>");
0073 MODULE_DESCRIPTION("CoreSight Syscfg Example");