Merge drm/drm-next into drm-xe-next
authorThomas Hellström <thomas.hellstrom@linux.intel.com>
Fri, 12 Apr 2024 13:14:25 +0000 (15:14 +0200)
committerThomas Hellström <thomas.hellstrom@linux.intel.com>
Fri, 12 Apr 2024 13:14:25 +0000 (15:14 +0200)
Backmerging drm-next in order to get up-to-date and in particular
to access commit 9ca5facd0400f610f3f7f71aeb7fc0b949a48c67.

Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
1  2 
drivers/gpu/drm/xe/Kconfig
drivers/gpu/drm/xe/Makefile
drivers/gpu/drm/xe/tests/xe_migrate.c
drivers/gpu/drm/xe/xe_drm_client.c
drivers/gpu/drm/xe/xe_pm.c
drivers/gpu/drm/xe/xe_vm.c
drivers/gpu/drm/xe/xe_vm_types.h

Simple merge
Simple merge
@@@ -113,10 -112,10 +113,10 @@@ static void test_copy(struct xe_migrat
                                                   bo->size,
                                                   ttm_bo_type_kernel,
                                                   region |
 -                                                 XE_BO_NEEDS_CPU_ACCESS);
 +                                                 XE_BO_FLAG_NEEDS_CPU_ACCESS);
        if (IS_ERR(remote)) {
-               KUNIT_FAIL(test, "Failed to allocate remote bo for %s: %li\n",
-                          str, PTR_ERR(remote));
+               KUNIT_FAIL(test, "Failed to allocate remote bo for %s: %pe\n",
+                          str, remote);
                return;
        }
  
Simple merge
@@@ -413,99 -341,22 +413,99 @@@ out
        return err;
  }
  
 -int xe_pm_runtime_get(struct xe_device *xe)
 +/**
 + * xe_pm_runtime_get - Get a runtime_pm reference and resume synchronously
 + * @xe: xe device instance
 + */
 +void xe_pm_runtime_get(struct xe_device *xe)
  {
 -      return pm_runtime_get_sync(xe->drm.dev);
 +      pm_runtime_get_noresume(xe->drm.dev);
 +
 +      if (xe_pm_read_callback_task(xe) == current)
 +              return;
 +
 +      pm_runtime_resume(xe->drm.dev);
  }
  
 -int xe_pm_runtime_put(struct xe_device *xe)
 +/**
 + * xe_pm_runtime_put - Put the runtime_pm reference back and mark as idle
 + * @xe: xe device instance
 + */
 +void xe_pm_runtime_put(struct xe_device *xe)
  {
 -      pm_runtime_mark_last_busy(xe->drm.dev);
 -      return pm_runtime_put(xe->drm.dev);
 +      if (xe_pm_read_callback_task(xe) == current) {
 +              pm_runtime_put_noidle(xe->drm.dev);
 +      } else {
 +              pm_runtime_mark_last_busy(xe->drm.dev);
 +              pm_runtime_put(xe->drm.dev);
 +      }
  }
  
 +/**
 + * xe_pm_runtime_get_ioctl - Get a runtime_pm reference before ioctl
 + * @xe: xe device instance
 + *
 + * Returns: Any number greater than or equal to 0 for success, negative error
 + * code otherwise.
 + */
 +int xe_pm_runtime_get_ioctl(struct xe_device *xe)
 +{
 +      if (WARN_ON(xe_pm_read_callback_task(xe) == current))
 +              return -ELOOP;
 +
 +      return pm_runtime_get_sync(xe->drm.dev);
 +}
 +
 +/**
 + * xe_pm_runtime_get_if_active - Get a runtime_pm reference if device active
 + * @xe: xe device instance
 + *
 + * Returns: Any number greater than or equal to 0 for success, negative error
 + * code otherwise.
 + */
  int xe_pm_runtime_get_if_active(struct xe_device *xe)
  {
-       return pm_runtime_get_if_active(xe->drm.dev, true);
+       return pm_runtime_get_if_active(xe->drm.dev);
  }
  
 +/**
 + * xe_pm_runtime_get_if_in_use - Get a runtime_pm reference and resume if needed
 + * @xe: xe device instance
 + *
 + * Returns: True if device is awake and the reference was taken, false otherwise.
 + */
 +bool xe_pm_runtime_get_if_in_use(struct xe_device *xe)
 +{
 +      if (xe_pm_read_callback_task(xe) == current) {
 +              /* The device is awake, grab the ref and move on */
 +              pm_runtime_get_noresume(xe->drm.dev);
 +              return true;
 +      }
 +
 +      return pm_runtime_get_if_in_use(xe->drm.dev) > 0;
 +}
 +
 +/**
 + * xe_pm_runtime_resume_and_get - Resume, then get a runtime_pm ref if awake.
 + * @xe: xe device instance
 + *
 + * Returns: True if device is awake and the reference was taken, false otherwise.
 + */
 +bool xe_pm_runtime_resume_and_get(struct xe_device *xe)
 +{
 +      if (xe_pm_read_callback_task(xe) == current) {
 +              /* The device is awake, grab the ref and move on */
 +              pm_runtime_get_noresume(xe->drm.dev);
 +              return true;
 +      }
 +
 +      return pm_runtime_resume_and_get(xe->drm.dev) >= 0;
 +}
 +
 +/**
 + * xe_pm_assert_unbounded_bridge - Disable PM on unbounded pcie parent bridge
 + * @xe: xe device instance
 + */
  void xe_pm_assert_unbounded_bridge(struct xe_device *xe)
  {
        struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
@@@ -858,18 -917,25 +858,23 @@@ static struct xe_vma *xe_vma_create(str
  static void xe_vma_destroy_late(struct xe_vma *vma)
  {
        struct xe_vm *vm = xe_vma_vm(vma);
 -      struct xe_device *xe = vm->xe;
 -      bool read_only = xe_vma_read_only(vma);
 +
 +      if (vma->ufence) {
 +              xe_sync_ufence_put(vma->ufence);
 +              vma->ufence = NULL;
 +      }
  
+       if (vma->ufence) {
+               xe_sync_ufence_put(vma->ufence);
+               vma->ufence = NULL;
+       }
        if (xe_vma_is_userptr(vma)) {
 -              struct xe_userptr *userptr = &to_userptr_vma(vma)->userptr;
 +              struct xe_userptr_vma *uvma = to_userptr_vma(vma);
 +              struct xe_userptr *userptr = &uvma->userptr;
  
 -              if (userptr->sg) {
 -                      dma_unmap_sgtable(xe->drm.dev,
 -                                        userptr->sg,
 -                                        read_only ? DMA_TO_DEVICE :
 -                                        DMA_BIDIRECTIONAL, 0);
 -                      sg_free_table(userptr->sg);
 -                      userptr->sg = NULL;
 -              }
 +              if (userptr->sg)
 +                      xe_hmm_userptr_free_sg(uvma);
  
                /*
                 * Since userptr pages are not pinned, we can't remove
Simple merge