kfdtest: Handle GPU resource management

Currently the FindDRMRenderNode function will access the sysfs
directly to find the render node. It doesn't work with the
GPU management changes. Have changed code to call hsaKmtGetNodeProperties
instead.

Change-Id: I3bb537a323bc1e8c49f38d8aabc60c13e268aecd
Signed-off-by: Mike Li <Tianxinmike.Li@amd.com>
Этот коммит содержится в:
Mike Li
2018-09-21 11:53:23 -04:00
родитель f9bd960344
Коммит c3b47c0959
+8 -13
Просмотреть файл
@@ -126,25 +126,20 @@ HSAuint64 KFDBaseComponentTest::GetVramSize(int defaultGPUNode) {
} }
int KFDBaseComponentTest::FindDRMRenderNode(int gpuNode) { int KFDBaseComponentTest::FindDRMRenderNode(int gpuNode) {
char path[PATH_MAX], buf[PAGE_SIZE]; HsaNodeProperties *nodeProperties;
_HSAKMT_STATUS status;
snprintf(path, PATH_MAX, "/sys/class/kfd/kfd/topology/nodes/%d/properties", gpuNode); nodeProperties = new HsaNodeProperties();
int fd = open(path, O_RDONLY); status = hsaKmtGetNodeProperties(gpuNode, nodeProperties);
EXPECT_SUCCESS(status) << "Node index: " << gpuNode << "hsaKmtGetNodeProperties returned status " << status;
if (fd < 0) { if (status != HSAKMT_STATUS_SUCCESS) {
LOG() << "Failed to open " << path << std::endl; delete nodeProperties;
return -EINVAL; return -EINVAL;
} }
read(fd, buf, PAGE_SIZE); int minor = nodeProperties->DrmRenderMinor;
close(fd);
char *s = strstr(buf, "drm_render_minor");
int minor = atoi(s + 17);
if (minor < 128) { if (minor < 128) {
LOG() << "Failed to get minor number " << minor << std::endl; LOG() << "Failed to get minor number " << minor << std::endl;
return -EINVAL; return -EINVAL;