@@ -974,55 +974,60 @@ def test_power_module(device_handle, device_index):
974974 print_verbose (f" Max Limit: { properties .maxLimit } " )
975975 print_verbose (f" Domain: { get_power_domain_string (ext_properties .domain )} " )
976976
977+ limit_descs = None
977978 limit_count = c_uint32 (0 )
978- rc = pz .zesPowerGetLimitsExt (power_handles [i ], byref (limit_count ), None )
979- if not check_rc (f"zesPowerGetLimitsExt(power { i } , count)" , rc ):
980- continue
981-
982- print_verbose (f" Power Limit Descriptor Count: { limit_count .value } " )
979+ if properties .onSubdevice :
980+ print_verbose (
981+ " Skipping power limit APIs for subdevice-scoped power domain"
982+ )
983+ else :
984+ rc = pz .zesPowerGetLimitsExt (power_handles [i ], byref (limit_count ), None )
985+ if not check_rc (f"zesPowerGetLimitsExt(power { i } , count)" , rc ):
986+ continue
983987
984- limit_descs = None
985- if limit_count .value > 0 :
986- PowerLimitArray = pz .zes_power_limit_ext_desc_t * limit_count .value
987- limit_descs = PowerLimitArray ()
988+ print_verbose (f" Power Limit Descriptor Count: { limit_count .value } " )
988989
989- for limit_index in range (limit_count .value ):
990- limit_descs [limit_index ].stype = (
991- pz .ZES_STRUCTURE_TYPE_POWER_LIMIT_EXT_DESC
992- )
993- limit_descs [limit_index ].pNext = None
990+ if limit_count .value > 0 :
991+ PowerLimitArray = pz .zes_power_limit_ext_desc_t * limit_count .value
992+ limit_descs = PowerLimitArray ()
994993
995- rc = pz . zesPowerGetLimitsExt (
996- power_handles [ i ], byref ( limit_count ), limit_descs
997- )
998- if not check_rc ( f"zesPowerGetLimitsExt(power { i } , descriptors)" , rc ):
999- continue
994+ for limit_index in range ( limit_count . value ):
995+ limit_descs [ limit_index ]. stype = (
996+ pz . ZES_STRUCTURE_TYPE_POWER_LIMIT_EXT_DESC
997+ )
998+ limit_descs [ limit_index ]. pNext = None
1000999
1001- print_verbose (" Power Limit Descriptors:" )
1002- for limit_index in range (limit_count .value ):
1003- limit_desc = limit_descs [limit_index ]
1004- print_verbose (f" Descriptor { limit_index } :" )
1005- print_verbose (
1006- f" Level: { get_power_level_string (limit_desc .level )} "
1007- )
1008- print_verbose (
1009- f" Source: { get_power_source_string (limit_desc .source )} "
1010- )
1011- print_verbose (
1012- f" Limit Unit: { get_limit_unit_string (limit_desc .limitUnit )} "
1013- )
1014- print_verbose (
1015- f" Enabled State Locked: { bool (limit_desc .enabledStateLocked )} "
1016- )
1017- print_verbose (f" Enabled: { bool (limit_desc .enabled )} " )
1018- print_verbose (
1019- f" Interval Value Locked: { bool (limit_desc .intervalValueLocked )} "
1020- )
1021- print_verbose (f" Interval: { limit_desc .interval } " )
1022- print_verbose (
1023- f" Limit Value Locked: { bool (limit_desc .limitValueLocked )} "
1000+ rc = pz .zesPowerGetLimitsExt (
1001+ power_handles [i ], byref (limit_count ), limit_descs
10241002 )
1025- print_verbose (f" Limit: { limit_desc .limit } " )
1003+ if not check_rc (f"zesPowerGetLimitsExt(power { i } , descriptors)" , rc ):
1004+ continue
1005+
1006+ print_verbose (" Power Limit Descriptors:" )
1007+ for limit_index in range (limit_count .value ):
1008+ limit_desc = limit_descs [limit_index ]
1009+ print_verbose (f" Descriptor { limit_index } :" )
1010+ print_verbose (
1011+ f" Level: { get_power_level_string (limit_desc .level )} "
1012+ )
1013+ print_verbose (
1014+ f" Source: { get_power_source_string (limit_desc .source )} "
1015+ )
1016+ print_verbose (
1017+ f" Limit Unit: { get_limit_unit_string (limit_desc .limitUnit )} "
1018+ )
1019+ print_verbose (
1020+ f" Enabled State Locked: { bool (limit_desc .enabledStateLocked )} "
1021+ )
1022+ print_verbose (f" Enabled: { bool (limit_desc .enabled )} " )
1023+ print_verbose (
1024+ f" Interval Value Locked: { bool (limit_desc .intervalValueLocked )} "
1025+ )
1026+ print_verbose (f" Interval: { limit_desc .interval } " )
1027+ print_verbose (
1028+ f" Limit Value Locked: { bool (limit_desc .limitValueLocked )} "
1029+ )
1030+ print_verbose (f" Limit: { limit_desc .limit } " )
10261031
10271032 energy_counter1 = pz .zes_power_energy_counter_t ()
10281033 rc = pz .zesPowerGetEnergyCounter (power_handles [i ], byref (energy_counter1 ))
@@ -1045,7 +1050,7 @@ def test_power_module(device_handle, device_index):
10451050 else :
10461051 print_verbose (" Current Power: unavailable due to zero delta time" )
10471052
1048- if limit_descs is None :
1053+ if properties . onSubdevice or limit_descs is None :
10491054 continue
10501055
10511056 if not is_root_user ():
0 commit comments