@@ -921,6 +921,7 @@ class QATTelemetryVirtualGeneralConfigRegister : public HWRegister
921
921
operation = PCM::IDX_OPERATION (val);
922
922
#ifdef __linux__
923
923
std::ostringstream sysfs_path (std::ostringstream::out);
924
+ std::string telemetry_filename;
924
925
switch (operation)
925
926
{
926
927
case PCM::QAT_TLM_START: // enable
@@ -936,6 +937,18 @@ class QATTelemetryVirtualGeneralConfigRegister : public HWRegister
936
937
std::hex << std::setw (2 ) << std::setfill (' 0' ) << d << " ." <<
937
938
std::hex << f << " /telemetry/control" ;
938
939
940
+ /* check telemetry for out-of tree driver*/
941
+ telemetry_filename = readSysFS (sysfs_path.str ().c_str (), true );
942
+ if (!telemetry_filename.size ()){
943
+ /* is not oot driver, check telemetry for in tree driver (since kernel 6.8)*/
944
+ sysfs_path.str (" " );
945
+ sysfs_path << std::string (" /sys/kernel/debug/qat_4xxx_" ) <<
946
+ std::hex << std::setw (4 ) << std::setfill (' 0' ) << domain << " :" <<
947
+ std::hex << std::setw (2 ) << std::setfill (' 0' ) << b << " :" <<
948
+ std::hex << std::setw (2 ) << std::setfill (' 0' ) << d << " ." <<
949
+ std::hex << f << " /telemetry/control" ;
950
+ }
951
+
939
952
if (writeSysFS (sysfs_path.str ().c_str (), (operation == PCM::QAT_TLM_START ? " 1" : " 0" )) == false )
940
953
{
941
954
std::cerr << " Linux sysfs: Error on control QAT telemetry operation = " << operation << " .\n " ;
@@ -951,7 +964,17 @@ class QATTelemetryVirtualGeneralConfigRegister : public HWRegister
951
964
std::hex << std::setw (2 ) << std::setfill (' 0' ) << b << " :" <<
952
965
std::hex << std::setw (2 ) << std::setfill (' 0' ) << d << " ." <<
953
966
std::hex << f << " /telemetry/device_data" ;
954
-
967
+ /* check telemetry for out-of tree driver*/
968
+ telemetry_filename = readSysFS (sysfs_path.str ().c_str (), true );
969
+ if (!telemetry_filename.size ()){
970
+ /* is not oot driver, check telemetry for in tree driver (since kernel 6.8)*/
971
+ sysfs_path.str (" " );
972
+ sysfs_path << std::string (" /sys/kernel/debug/qat_4xxx_" ) <<
973
+ std::hex << std::setw (4 ) << std::setfill (' 0' ) << domain << " :" <<
974
+ std::hex << std::setw (2 ) << std::setfill (' 0' ) << b << " :" <<
975
+ std::hex << std::setw (2 ) << std::setfill (' 0' ) << d << " ." <<
976
+ std::hex << f << " /telemetry/device_data" ;
977
+ }
955
978
data_cache.clear ();
956
979
readMapFromSysFS (sysfs_path.str ().c_str (), data_cache);
957
980
}
@@ -2382,17 +2405,28 @@ void PCM::initUncorePMUsDirect()
2382
2405
for (auto & devInfo : devInfos)
2383
2406
{
2384
2407
std::ostringstream qat_TLMCTL_sysfs_path (std::ostringstream::out);
2408
+ /* parse telemetry follow rule of out of tree driver*/
2385
2409
qat_TLMCTL_sysfs_path << std::string (" /sys/bus/pci/devices/" ) <<
2386
2410
std::hex << std::setw (4 ) << std::setfill (' 0' ) << devInfo.domain << " :" <<
2387
2411
std::hex << std::setw (2 ) << std::setfill (' 0' ) << devInfo.bus << " :" <<
2388
2412
std::hex << std::setw (2 ) << std::setfill (' 0' ) << devInfo.dev << " ." <<
2389
2413
std::hex << devInfo.func << " /telemetry/control" ;
2390
- const std::string qatTLMCTLStr = readSysFS (qat_TLMCTL_sysfs_path.str ().c_str (), true );
2414
+ std::string qatTLMCTLStr = readSysFS (qat_TLMCTL_sysfs_path.str ().c_str (), true );
2391
2415
if (!qatTLMCTLStr.size ()) // check TLM feature available or NOT.
2392
2416
{
2393
- std::cout << " Warning: IDX - QAT telemetry feature of B:0x" << std::hex << devInfo.bus << " ,D:0x" << devInfo.dev << " ,F:0x" << devInfo.func \
2394
- << " is NOT available, skipped." << std::dec << std::endl;
2395
- continue ;
2417
+ qat_TLMCTL_sysfs_path.str (" " );
2418
+ /* parse telemetry follow rule of in tree driver*/
2419
+ qat_TLMCTL_sysfs_path << std::string (" /sys/kernel/debug/qat_4xxx_" ) <<
2420
+ std::hex << std::setw (4 ) << std::setfill (' 0' ) << devInfo.domain << " :" <<
2421
+ std::hex << std::setw (2 ) << std::setfill (' 0' ) << devInfo.bus << " :" <<
2422
+ std::hex << std::setw (2 ) << std::setfill (' 0' ) << devInfo.dev << " ." <<
2423
+ std::hex << devInfo.func << " /telemetry/control" ;
2424
+ qatTLMCTLStr = readSysFS (qat_TLMCTL_sysfs_path.str ().c_str (), true );
2425
+ if (!qatTLMCTLStr.size ()){
2426
+ std::cout << " Warning: IDX - QAT telemetry feature of B:0x" << std::hex << devInfo.bus << " ,D:0x" << devInfo.dev << " ,F:0x" << devInfo.func \
2427
+ << " is NOT available, skipped." << std::dec << std::endl;
2428
+ continue ;
2429
+ }
2396
2430
}
2397
2431
idxPMUs[IDX_QAT].push_back (createQATPMU (devInfo.numa_node , devInfo.socket_id , devInfo.domain , devInfo.bus , devInfo.dev , devInfo.func ));
2398
2432
}
0 commit comments