@@ -61,6 +61,19 @@ enum lwmi_feature_id_cpu {
6161 LWMI_FEATURE_ID_CPU_IPL = 0x09 ,
6262};
6363
64+ enum lwmi_feature_id_gpu {
65+ LWMI_FEATURE_ID_GPU_NV_PPAB = 0x01 ,
66+ LWMI_FEATURE_ID_GPU_NV_CTGP = 0x02 ,
67+ LWMI_FEATURE_ID_GPU_TEMP = 0x03 ,
68+ LWMI_FEATURE_ID_GPU_AC_OFFSET = 0x04 ,
69+ LWMI_FEATURE_ID_DGPU_BOOST_CLK = 0x06 ,
70+ LWMI_FEATURE_ID_DGPU_EN = 0x07 ,
71+ LWMI_FEATURE_ID_GPU_MODE = 0x08 ,
72+ LWMI_FEATURE_ID_DGPU_DIDVID = 0x09 ,
73+ LWMI_FEATURE_ID_GPU_NV_BPL = 0x0a ,
74+ LWMI_FEATURE_ID_GPU_NV_CPU_BOOST = 0x0b ,
75+ };
76+
6477#define LWMI_FEATURE_ID_FAN_RPM 0x03
6578
6679#define LWMI_TYPE_ID_CROSSLOAD 0x01
@@ -624,6 +637,66 @@ static struct tunable_attr_01 ppt_pl4_ipl_cl = {
624637 .type_id = LWMI_TYPE_ID_CROSSLOAD ,
625638};
626639
640+ static struct tunable_attr_01 gpu_nv_ppab = {
641+ .device_id = LWMI_DEVICE_ID_GPU ,
642+ .feature_id = LWMI_FEATURE_ID_GPU_NV_PPAB ,
643+ .type_id = LWMI_TYPE_ID_NONE ,
644+ };
645+
646+ static struct tunable_attr_01 gpu_nv_ctgp = {
647+ .device_id = LWMI_DEVICE_ID_GPU ,
648+ .feature_id = LWMI_FEATURE_ID_GPU_NV_CTGP ,
649+ .type_id = LWMI_TYPE_ID_NONE ,
650+ };
651+
652+ static struct tunable_attr_01 gpu_temp = {
653+ .device_id = LWMI_DEVICE_ID_GPU ,
654+ .feature_id = LWMI_FEATURE_ID_GPU_TEMP ,
655+ .type_id = LWMI_TYPE_ID_NONE ,
656+ };
657+
658+ static struct tunable_attr_01 gpu_nv_ac_offset = {
659+ .device_id = LWMI_DEVICE_ID_GPU ,
660+ .feature_id = LWMI_FEATURE_ID_GPU_AC_OFFSET ,
661+ .type_id = LWMI_TYPE_ID_NONE ,
662+ };
663+
664+ static struct tunable_attr_01 dgpu_boost_clk = {
665+ .device_id = LWMI_DEVICE_ID_GPU ,
666+ .feature_id = LWMI_FEATURE_ID_DGPU_BOOST_CLK ,
667+ .type_id = LWMI_TYPE_ID_NONE ,
668+ };
669+
670+ static struct tunable_attr_01 dgpu_enable = {
671+ .device_id = LWMI_DEVICE_ID_GPU ,
672+ .feature_id = LWMI_FEATURE_ID_DGPU_EN ,
673+ .type_id = LWMI_TYPE_ID_NONE ,
674+ };
675+
676+ static struct tunable_attr_01 gpu_mode = {
677+ .device_id = LWMI_DEVICE_ID_GPU ,
678+ .feature_id = LWMI_FEATURE_ID_GPU_MODE ,
679+ .type_id = LWMI_TYPE_ID_NONE ,
680+ };
681+
682+ static struct tunable_attr_01 dgpu_didvid = {
683+ .device_id = LWMI_DEVICE_ID_GPU ,
684+ .feature_id = LWMI_FEATURE_ID_DGPU_DIDVID ,
685+ .type_id = LWMI_TYPE_ID_NONE ,
686+ };
687+
688+ static struct tunable_attr_01 gpu_nv_bpl = {
689+ .device_id = LWMI_DEVICE_ID_GPU ,
690+ .feature_id = LWMI_FEATURE_ID_GPU_NV_BPL ,
691+ .type_id = LWMI_TYPE_ID_NONE ,
692+ };
693+
694+ static struct tunable_attr_01 gpu_nv_cpu_boost = {
695+ .device_id = LWMI_DEVICE_ID_GPU ,
696+ .feature_id = LWMI_FEATURE_ID_GPU_NV_CPU_BOOST ,
697+ .type_id = LWMI_TYPE_ID_NONE ,
698+ };
699+
627700struct capdata01_attr_group {
628701 const struct attribute_group * attr_group ;
629702 struct tunable_attr_01 * tunable_attr ;
@@ -959,6 +1032,7 @@ static bool lwmi_attr_01_is_supported(struct tunable_attr_01 *tunable_attr)
9591032 .name = _fsname, .attrs = _attrname##_attrs \
9601033 }
9611034
1035+ /* CPU tunable attributes */
9621036LWMI_ATTR_GROUP_TUNABLE_CAP01 (cpu_temp , "cpu_temp" ,
9631037 "Set the CPU thermal load limit" );
9641038LWMI_ATTR_GROUP_TUNABLE_CAP01 (ppt_cpu_cl , "ppt_cpu_cl" ,
@@ -984,9 +1058,40 @@ LWMI_ATTR_GROUP_TUNABLE_CAP01(ppt_pl4_ipl, "ppt_pl4_ipl",
9841058LWMI_ATTR_GROUP_TUNABLE_CAP01 (ppt_pl4_ipl_cl , "ppt_pl4_ipl_cl" ,
9851059 "Set the CPU cross loading instantaneous power limit" );
9861060
1061+ /* GPU tunable attributes */
1062+ LWMI_ATTR_GROUP_TUNABLE_CAP01 (dgpu_boost_clk , "dgpu_boost_clk" ,
1063+ "Set the dedicated GPU boost clock" );
1064+ LWMI_ATTR_GROUP_TUNABLE_CAP01 (dgpu_didvid , "gpu_didvid" ,
1065+ "Get the GPU device identifier and vendor identifier" );
1066+ LWMI_ATTR_GROUP_TUNABLE_CAP01 (dgpu_enable , "dgpu_enable" ,
1067+ "Set the dedicated Nvidia GPU enabled status" );
1068+ LWMI_ATTR_GROUP_TUNABLE_CAP01 (gpu_mode , "gpu_mode" ,
1069+ "Set the GPU mode by power limit" );
1070+ LWMI_ATTR_GROUP_TUNABLE_CAP01 (gpu_nv_ac_offset , "gpu_nv_ac_offset" ,
1071+ "Set the Nvidia GPU AC total processing power baseline offset" );
1072+ LWMI_ATTR_GROUP_TUNABLE_CAP01 (gpu_nv_bpl , "gpu_nv_bpl" ,
1073+ "Set the Nvidia GPU base power limit" );
1074+ LWMI_ATTR_GROUP_TUNABLE_CAP01 (gpu_nv_cpu_boost , "gpu_nv_cpu_boost" ,
1075+ "Set the Nvidia GPU to CPU dynamic boost limit" );
1076+ LWMI_ATTR_GROUP_TUNABLE_CAP01 (gpu_nv_ctgp , "gpu_nv_ctgp" ,
1077+ "Set the GPU configurable total graphics power" );
1078+ LWMI_ATTR_GROUP_TUNABLE_CAP01 (gpu_nv_ppab , "gpu_nv_ppab" ,
1079+ "Set the Nvidia GPU power performance aware boost limit" );
1080+ LWMI_ATTR_GROUP_TUNABLE_CAP01 (gpu_temp , "gpu_temp" ,
1081+ "Set the GPU thermal load limit" );
9871082
9881083static struct capdata01_attr_group cd01_attr_groups [] = {
9891084 { & cpu_temp_attr_group , & cpu_temp },
1085+ { & dgpu_boost_clk_attr_group , & dgpu_boost_clk },
1086+ { & dgpu_didvid_attr_group , & dgpu_didvid },
1087+ { & dgpu_enable_attr_group , & dgpu_enable },
1088+ { & gpu_mode_attr_group , & gpu_mode },
1089+ { & gpu_nv_ac_offset_attr_group , & gpu_nv_ac_offset },
1090+ { & gpu_nv_bpl_attr_group , & gpu_nv_bpl },
1091+ { & gpu_nv_cpu_boost_attr_group , & gpu_nv_cpu_boost },
1092+ { & gpu_nv_ctgp_attr_group , & gpu_nv_ctgp },
1093+ { & gpu_nv_ppab_attr_group , & gpu_nv_ppab },
1094+ { & gpu_temp_attr_group , & gpu_temp },
9901095 { & ppt_cpu_cl_attr_group , & ppt_cpu_cl },
9911096 { & ppt_pl1_apu_spl_attr_group , & ppt_pl1_apu_spl },
9921097 { & ppt_pl1_spl_attr_group , & ppt_pl1_spl },
0 commit comments