Move from direct call to kfd_ioctl to wrapping kmtIoctl
Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
This commit is contained in:
+2
-1
@@ -18,7 +18,8 @@ CFLAGS += -std=gnu99 -ggdb -pthread -fvisibility=hidden -O2
|
||||
LDFLAGS += -lrt -pthread -Wl,--version-script=libhsakmt.ver -Wl,-soname=$(LIB_NAME).$(LIB_MAJOR_VER)
|
||||
|
||||
OBJS = debug.o globals.o memory.o perfctr.o time.o version.o \
|
||||
events.o openclose.o queues.o topology.o fmm.o pmc_table.o
|
||||
events.o openclose.o queues.o topology.o fmm.o pmc_table.o \
|
||||
libhsakmt.o
|
||||
|
||||
.PHONY: all lnx lnx64a clean
|
||||
|
||||
|
||||
+1
-1
@@ -446,7 +446,7 @@ HSAKMT_STATUS fmm_init_process_apertures(){
|
||||
struct kfd_ioctl_get_process_apertures_args args;
|
||||
uint8_t node_id;
|
||||
|
||||
if (0 == kfd_ioctl(AMDKFD_IOC_GET_PROCESS_APERTURES, (void*)&args)){
|
||||
if (0 == kmtIoctl(kfd_fd, AMDKFD_IOC_GET_PROCESS_APERTURES, (void*)&args)){
|
||||
for(node_id = 0; node_id < args.num_of_nodes; node_id++){
|
||||
gpu_mem[node_id].gpu_id = args.process_apertures[node_id].gpu_id;
|
||||
gpu_mem[node_id].lds_aperture.base = PORT_UINT64_TO_VPTR(args.process_apertures[node_id].lds_base);
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#include <errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "libhsakmt.h"
|
||||
|
||||
/**
|
||||
* Call ioctl, restarting if it is interupted
|
||||
*/
|
||||
int
|
||||
kmtIoctl(int fd, unsigned long request, void *arg)
|
||||
{
|
||||
int ret;
|
||||
|
||||
do {
|
||||
ret = ioctl(fd, request, arg);
|
||||
} while (ret == -1 && (errno == EINTR || errno == EAGAIN));
|
||||
return ret;
|
||||
}
|
||||
@@ -64,7 +64,7 @@ extern pthread_mutex_t hsakmt_mutex;
|
||||
HSAKMT_STATUS validate_nodeid(uint32_t nodeid, uint32_t *gpu_id);
|
||||
uint16_t get_device_id_by_node(HSAuint32 node_id);
|
||||
|
||||
extern int kfd_ioctl(int cmdcode, void* data);
|
||||
extern int kmtIoctl(int fd, unsigned long request, void *arg);
|
||||
|
||||
/* Void pointer arithmetic (or remove -Wpointer-arith to allow void pointers arithmetic) */
|
||||
#define VOID_PTR_ADD32(ptr,n) (void*)((uint32_t*)(ptr) + n)/*ptr + offset*/
|
||||
@@ -72,5 +72,4 @@ extern int kfd_ioctl(int cmdcode, void* data);
|
||||
#define VOID_PTR_SUB(ptr,n) (void*)((uint8_t*)(ptr) - n)/*ptr - offset*/
|
||||
#define VOID_PTRS_SUB(ptr1,ptr2) (uint64_t)((uint8_t*)(ptr1) - (uint8_t*)(ptr2)) /*ptr1 - ptr2*/
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ hsaKmtSetMemoryPolicy(
|
||||
args.alternate_aperture_base = (uintptr_t)MemoryAddressAlternate;
|
||||
args.alternate_aperture_size = MemorySizeInBytes;
|
||||
|
||||
int err = kfd_ioctl(AMDKFD_IOC_SET_MEMORY_POLICY, &args);
|
||||
int err = kmtIoctl(kfd_fd, AMDKFD_IOC_SET_MEMORY_POLICY, &args);
|
||||
|
||||
return (err == -1) ? HSAKMT_STATUS_ERROR : HSAKMT_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -110,8 +110,3 @@ hsaKmtCloseKFD(void)
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
extern int kfd_ioctl(int cmdcode, void* data)
|
||||
{
|
||||
return ioctl(kfd_fd, cmdcode, data);
|
||||
}
|
||||
|
||||
+3
-3
@@ -107,7 +107,7 @@ hsaKmtCreateQueue(
|
||||
args.queue_percentage = QueuePercentage;
|
||||
args.queue_priority = Priority;
|
||||
|
||||
err = kfd_ioctl(AMDKFD_IOC_CREATE_QUEUE, &args);
|
||||
err = kmtIoctl(kfd_fd, AMDKFD_IOC_CREATE_QUEUE, &args);
|
||||
|
||||
if (err == -1)
|
||||
{
|
||||
@@ -166,7 +166,7 @@ hsaKmtUpdateQueue(
|
||||
arg.queue_percentage = QueuePercentage;
|
||||
arg.queue_priority = Priority;
|
||||
|
||||
int err = kfd_ioctl(AMDKFD_IOC_UPDATE_QUEUE, &arg);
|
||||
int err = kmtIoctl(kfd_fd, AMDKFD_IOC_UPDATE_QUEUE, &arg);
|
||||
if (err == -1)
|
||||
{
|
||||
return HSAKMT_STATUS_ERROR;
|
||||
@@ -193,7 +193,7 @@ hsaKmtDestroyQueue(
|
||||
|
||||
args.queue_id = q->queue_id;
|
||||
|
||||
int err = kfd_ioctl(AMDKFD_IOC_DESTROY_QUEUE, &args);
|
||||
int err = kmtIoctl(kfd_fd, AMDKFD_IOC_DESTROY_QUEUE, &args);
|
||||
|
||||
if (err == -1)
|
||||
{
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ hsaKmtGetClockCounters(
|
||||
|
||||
args.gpu_id = gpu_id;
|
||||
|
||||
err = kfd_ioctl(AMDKFD_IOC_GET_CLOCK_COUNTERS, &args);
|
||||
err = kmtIoctl(kfd_fd, AMDKFD_IOC_GET_CLOCK_COUNTERS, &args);
|
||||
if (err < 0) {
|
||||
result = HSAKMT_STATUS_ERROR;
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ hsaKmtGetVersion(
|
||||
struct kfd_ioctl_get_version_args args;
|
||||
memset(&args, 0, sizeof(args));
|
||||
|
||||
if (kfd_ioctl(AMDKFD_IOC_GET_VERSION, &args) == -1)
|
||||
if (kmtIoctl(kfd_fd, AMDKFD_IOC_GET_VERSION, &args) == -1)
|
||||
return HSAKMT_STATUS_ERROR;
|
||||
|
||||
VersionInfo->KernelInterfaceMajorVersion = args.major_version;
|
||||
|
||||
Viittaa uudesa ongelmassa
Block a user