mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
libcpumf: Detect PMU named pai_ext
Add a check to detect Processor Activity Instrumentation (PAI) Extension 1 facility unit. Signed-off-by: Thomas Richter <tmricht@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
dc73c77d73
commit
15158ee0ca
@@ -17,7 +17,8 @@
|
||||
#define S390_CPUS_ONLINE "/sys/devices/system/cpu/online"
|
||||
#define S390_CPUMSF_BUFFERSZ "/sys/module/kernel/parameters/cpum_sfb_size"
|
||||
#define S390_SYSFS_PAI_CRYPTO "/sys/devices/pai_crypto/"
|
||||
#define S390_SYSFS_PAI_NNPA "/sys/devices/pai_nnpa/"
|
||||
#define S390_SYSFS_PAI_EXT "/sys/devices/pai_ext/"
|
||||
#define S390_SYSFS_PAI_NNPA S390_SYSFS_PAI_EXT "events/NNPA_ALL"
|
||||
|
||||
/**
|
||||
* Read out the PMU type from a given file.
|
||||
@@ -146,6 +147,14 @@ bool libcpumf_sfb_info(unsigned long *min, unsigned long *max);
|
||||
*/
|
||||
bool libcpumf_have_pai_crypto(void);
|
||||
|
||||
/**
|
||||
* Return true if PAI_EXTENSION Facility is supported.
|
||||
*
|
||||
* @retval true PAI_EXTENSION counter Facility is available
|
||||
* @retval false PAI_EXTENSION counter Facility is not available
|
||||
*/
|
||||
bool libcpumf_have_pai_ext(void);
|
||||
|
||||
/**
|
||||
* Return true if PAI_NNPA counter Facility is supported. This PMU facility
|
||||
* supports the Neural Network Processing Assist (NNPA) counter set.
|
||||
|
||||
@@ -85,5 +85,6 @@ int main(void)
|
||||
}
|
||||
|
||||
printf("PAI NNPA support %d\n", libcpumf_have_pai_nnpa());
|
||||
printf("PAI EXTENSION support %d\n", libcpumf_have_pai_ext());
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -147,6 +147,13 @@ bool libcpumf_have_pai_crypto(void)
|
||||
return (stat(S390_SYSFS_PAI_CRYPTO, &statbuf) == -1) ? false : true;
|
||||
}
|
||||
|
||||
bool libcpumf_have_pai_ext(void)
|
||||
{
|
||||
struct stat statbuf;
|
||||
|
||||
return (stat(S390_SYSFS_PAI_EXT, &statbuf) == -1) ? false : true;
|
||||
}
|
||||
|
||||
bool libcpumf_have_pai_nnpa(void)
|
||||
{
|
||||
struct stat statbuf;
|
||||
|
||||
Reference in New Issue
Block a user