libhsakmt: add Streaming Performance Monitors APIs

Signed-off-by: Gang Ba <gaba@amd.com>
Change-Id: I5c23a8dacf9bc50c740908aabe391432f2c7112e
Signed-off-by: Gang Ba <gaba@amd.com>
This commit is contained in:
Gang Ba
2020-04-27 17:58:56 -04:00
förälder 5ddd8fb68b
incheckning d675d1cce1
5 ändrade filer med 229 tillägg och 1 borttagningar
+52
Visa fil
@@ -1209,6 +1209,58 @@ hsaKmtSetMemoryUserData(
void * UserData //IN
);
/**
Acquire request exclusive use of SPM
*/
HSAKMT_STATUS
HSAKMTAPI
hsaKmtSPMAcquire(
HSAuint32 PreferredNode //IN
);
/**
Disable SPM Streamimg
*/
HSAKMT_STATUS
HSAKMTAPI
hsaKmtSPMRelease(
HSAuint32 PreferredNode //IN
);
/**
Set up the destination user mode buffer for stream performance
counter data.
PreferredNode -- note Id
SizeInBytes -- number of byte of Destination buffer for performance
counter data
timeout -- wait to collect performance counter data
DestMemoryAddress -- point to user mode buffer for stream performance
counter data
SPMMemoryAddress -- user mode buffer that contains stream performance
counter data, it ponit to current or one of DestMemoryAddress that set
before.
SizeCopied -- number of bytes of data copied from Stream Ring buffer.
*/
HSAKMT_STATUS
HSAKMTAPI
hsaKmtSPMSetDestBuffer(
HSAuint32 PreferredNode, //IN
HSAuint64 SizeInBytes, //IN
HSAuint32 timeout, //IN
void* DestMemoryAddress, //IN
void ** SPMMemoryAddress, //OUT
HSAuint32 *SizeCopied //OUT
);
#ifdef __cplusplus
} //extern "C"
#endif
+52 -1
Visa fil
@@ -628,6 +628,53 @@ struct kfd_ioctl_cross_memory_copy_args {
__u64 bytes_copied;
};
/**
* kfd_ioctl_spm_op - SPM ioctl operations
*
* @KFD_IOCTL_SPM_OP_ACQUIRE: acquire exclusive access to SPM
* @KFD_IOCTL_SPM_OP_RELEASE: release exclusive access to SPM
* @KFD_IOCTL_SPM_OP_SET_DEST_BUF: set or unset destination buffer for SPM streaming
*/
enum kfd_ioctl_spm_op {
KFD_IOCTL_SPM_OP_ACQUIRE,
KFD_IOCTL_SPM_OP_RELEASE,
KFD_IOCTL_SPM_OP_SET_DEST_BUF
};
/**
* kfd_ioctl_spm_args - Arguments for SPM ioctl
*
* @op: specifies the operation to perform
* @destptr:used for the address of the destination buffer in @KFD_IOCTL_SPM_SET_DEST_BUFFER
* @buf_size:size of the destination buffer in @KFD_IOCTL_SPM_SET_DEST_BUFFER
* @timeout: timeout to wait for the buffer to get filled
* @gpu_id: gpu ID
* @bytes_copied: bytes copied from streaming performance ring buffer
*
* If @ptr is NULL, the destination buffer address is unset and copying of counters
* is stopped.
*
* Returns negative error code on failure. On success, @KFD_IOCTL_SPM_OP_ACQUIRE and
* @KFD_IOCTL_SPM_OP_RELEASE return 0, @KFD_IOCTL_SPM_OP_SET_DEST_BUF returns the fill
* level of the previous buffer.
*/
struct kfd_ioctl_spm_args {
__u64 destptr;
__u64 spmtptr;
__u32 buf_size;
__u32 op;
__u32 timeout;
__u32 gpu_id; /* to KFD */
/* from KFD: Total amount of bytes copied */
__u64 bytes_copied;
};
struct kfd_spm_set_reg {
__u64 reg;
__u32 value;
};
#define AMDKFD_IOCTL_BASE 'K'
#define AMDKFD_IO(nr) _IO(AMDKFD_IOCTL_BASE, nr)
#define AMDKFD_IOR(nr, type) _IOR(AMDKFD_IOCTL_BASE, nr, type)
@@ -725,8 +772,12 @@ struct kfd_ioctl_cross_memory_copy_args {
#define AMDKFD_IOC_ALLOC_QUEUE_GWS \
AMDKFD_IOWR(0x1E, struct kfd_ioctl_alloc_queue_gws_args)
#define AMDKFD_IOC_RLC_SPM \
AMDKFD_IOWR(0x20, struct kfd_ioctl_spm_args)
#define AMDKFD_COMMAND_START 0x01
#define AMDKFD_COMMAND_END 0x1F
#define AMDKFD_COMMAND_END 0x21
/* non-upstream ioctls */
#define AMDKFD_IOC_IPC_IMPORT_HANDLE \