Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1cf6cc74 authored by Andres Rodriguez's avatar Andres Rodriguez Committed by Oded Gabbay
Browse files

drm/amdkfd: fix clock counter retrieval for node without GPU



Currently if a user requests clock counters for a node without a GPU
resource we will always return EINVAL.

Instead if no GPU resource is attached, fill the gpu_clock_counter
argument with zeroes so that we may proceed and return valid CPU
counters.

Signed-off-by: default avatarAndres Rodriguez <andres.rodriguez@amd.com>
Signed-off-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
parent ded5e562
Loading
Loading
Loading
Loading
+7 −6
Original line number Original line Diff line number Diff line
@@ -749,12 +749,13 @@ static int kfd_ioctl_get_clock_counters(struct file *filep,
	struct timespec64 time;
	struct timespec64 time;


	dev = kfd_device_by_id(args->gpu_id);
	dev = kfd_device_by_id(args->gpu_id);
	if (dev == NULL)
	if (dev)
		return -EINVAL;

		/* Reading GPU clock counter from KGD */
		/* Reading GPU clock counter from KGD */
		args->gpu_clock_counter =
		args->gpu_clock_counter =
			dev->kfd2kgd->get_gpu_clock_counter(dev->kgd);
			dev->kfd2kgd->get_gpu_clock_counter(dev->kgd);
	else
		/* Node without GPU resource */
		args->gpu_clock_counter = 0;


	/* No access to rdtsc. Using raw monotonic time */
	/* No access to rdtsc. Using raw monotonic time */
	getrawmonotonic64(&time);
	getrawmonotonic64(&time);