drm/amdkfd: Use correct drm device for cgroup permission check
authorjsg <jsg@openbsd.org>
Mon, 4 Mar 2024 02:05:20 +0000 (02:05 +0000)
committerjsg <jsg@openbsd.org>
Mon, 4 Mar 2024 02:05:20 +0000 (02:05 +0000)
From Mukul Joshi
5a1bd2143fd70f35a255c02611731b509d1cebac in linux-6.6.y/6.6.19
4119734e06a7f30e7e8eb666692a58b85dca0269 in mainline linux

sys/dev/pci/drm/amd/amdkfd/kfd_priv.h

index 3287a39..12ee273 100644 (file)
@@ -1482,10 +1482,15 @@ void kfd_dec_compute_active(struct kfd_node *dev);
 
 /* Cgroup Support */
 /* Check with device cgroup if @kfd device is accessible */
-static inline int kfd_devcgroup_check_permission(struct kfd_node *kfd)
+static inline int kfd_devcgroup_check_permission(struct kfd_node *node)
 {
 #if defined(CONFIG_CGROUP_DEVICE) || defined(CONFIG_CGROUP_BPF)
-       struct drm_device *ddev = adev_to_drm(kfd->adev);
+       struct drm_device *ddev;
+
+       if (node->xcp)
+               ddev = node->xcp->ddev;
+       else
+               ddev = adev_to_drm(node->adev);
 
        return devcgroup_check_permission(DEVCG_DEV_CHAR, DRM_MAJOR,
                                          ddev->render->index,