Skip to content
Snippets Groups Projects
  1. Mar 14, 2025
  2. Mar 13, 2025
    • Alex Deucher's avatar
      drm/amdgpu: drop drm_firmware_drivers_only() · f2a241df
      Alex Deucher authored
      
      There are a number of systems and cloud providers out there
      that have nomodeset hardcoded in their kernel parameters
      to block nouveau for the nvidia driver.  This prevents the
      amdgpu driver from loading. Unfortunately the end user cannot
      easily change this.  The preferred way to block modules from
      loading is to use modprobe.blacklist=<driver>.  That is what
      providers should be using to block specific drivers.
      
      Drop the check to allow the driver to load even when nomodeset
      is specified on the kernel command line.
      
      Reviewed-by: default avatarKent Russell <kent.russell@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      f2a241df
  3. Mar 07, 2025
  4. Feb 26, 2025
  5. Feb 07, 2025
  6. Feb 06, 2025
  7. Jan 30, 2025
  8. Jan 22, 2025
  9. Jan 20, 2025
  10. Jan 14, 2025
  11. Jan 13, 2025
  12. Jan 02, 2025
    • Arvind Yadav's avatar
      drm/amdgpu: Fix Illegal opcode in command stream Error · 56cb5ac5
      Arvind Yadav authored
      
      When applications closes, it triggers the drm_file_free
      function which subsequently releases all allocated buffer
      objects. Concurrently, the resume_worker thread will attempt
      to map the usermode queue. However, since the wptr buffer
      object has already been deallocated, this will result in
      an Illegal opcode error being raised in the command stream.
      
      Now replacing drm_release() with a new function
      amdgpu_drm_release(). This function will set the flag to
      prevent the scheduling of any new queue resume/map, stop
      all queues and then call drm_release().
      
      V2:
        - Replace drm_release with amdgpu_drm_release(Christian).
      
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Christian Koenig <christian.koenig@amd.com>
      Reviewed-by: default avatarShashank Sharma <shashank.sharma@amd.com>
      Signed-off-by: default avatarArvind Yadav <arvind.yadav@amd.com>
      Change-Id: I7fec40c02a2d20c4ff3cd38d7760545d0b0b2f9c
      56cb5ac5
  13. Dec 02, 2024
  14. Nov 11, 2024
    • arunpravin24's avatar
      drm/amdgpu: Implement userqueue signal/wait IOCTL · f6b8f85d
      arunpravin24 authored
      
      This patch introduces new IOCTL for userqueue secure semaphore.
      
      The signal IOCTL called from userspace application creates a drm
      syncobj and array of bo GEM handles and passed in as parameter to
      the driver to install the fence into it.
      
      The wait IOCTL gets an array of drm syncobjs, finds the fences
      attached to the drm syncobjs and obtain the array of
      memory_address/fence_value combintion which are returned to
      userspace.
      
      v2: (Christian)
          - Install fence into GEM BO object.
          - Lock all BO's using the dma resv subsystem
          - Reorder the sequence in signal IOCTL function.
          - Get write pointer from the shadow wptr
          - use userq_fence to fetch the va/value in wait IOCTL.
      
      v3: (Christian)
          - Use drm_exec helper for the proper BO drm reserve and avoid BO
            lock/unlock issues.
          - fence/fence driver reference count logic for signal/wait IOCTLs.
      
      v4: (Christian)
          - Fixed the drm_exec calling sequence
          - use dma_resv_for_each_fence_unlock if BO's are not locked
          - Modified the fence_info array storing logic.
      
      v5: (Christian)
          - Keep fence_drv until wait queue execution.
          - Add dma_fence_wait for other fences.
          - Lock BO's using drm_exec as the number of fences in them could
            change.
          - Install signaled fences as well into BO/Syncobj.
          - Move Syncobj fence installation code after the drm_exec_prepare_array.
          - Directly add dma_resv_usage_rw(args->bo_flags....
          - remove unnecessary dma_fence_put.
      
      v6: (Christian)
          - Add xarray stuff to store the fence_drv
          - Implement a function to iterate over the xarray and drop
            the fence_drv references.
          - Add drm_exec_until_all_locked() wrapper
          - Add a check that if we haven't exceeded the user allocated num_fences
            before adding dma_fence to the fences array.
      
      v7: (Christian)
          - Use memdup_user() for kmalloc_array + copy_from_user
          - Move the fence_drv references from the xarray into the newly created fence
            and drop the fence_drv references when we signal this fence.
          - Move this locking of BOs before the "if (!wait_info->num_fences)",
            this way you need this code block only once.
          - Merge the error handling code and the cleanup + return 0 code.
          - Initializing the xa should probably be done in the userq code.
          - Remove the userq back pointer stored in fence_drv.
          - Pass xarray as parameter in amdgpu_userq_walk_and_drop_fence_drv()
      
      v8: (Christian)
          - Move fence_drv references must come before adding the fence to the list.
          - Use xa_lock_irqsave_nested for nested spinlock operations.
          - userq_mgr should be per fpriv and not one per device.
          - Restructure the interrupt process code for the early exit of the loop.
          - The reference acquired in the syncobj fence replace code needs to be
            kept around.
          - Modify the dma_fence acquire placement in wait IOCTL.
          - Move USERQ_BO_WRITE flag to UAPI header file.
          - drop the fence drv reference after telling the hw to stop accessing it.
          - Add multi sync object support to userq signal IOCTL.
      
      V9: (Christian)
          - Store all the fence_drv ref to other drivers and not ourself.
          - Remove the userq fence xa implementation and replace with
            kvmalloc_array.
      
      v10: (Christian)
           - Add a comment for the userq_xa xarray
           - drop the if check of userq_fence->fence_drv_array
           - use the i variable to initialize userq_fence->fence_drv_array_count
           - drop the fence reference before you free the array in the error handling,
             otherwise it could be that some references leaked.
      
      Signed-off-by: default avatarArunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
      Suggested-by: default avatarChristian König <christian.koenig@amd.com>
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      f6b8f85d
    • arunpravin24's avatar
      drm/amdgpu: Implement a new userqueue fence driver · 6948f931
      arunpravin24 authored
      
      Developed a userqueue fence driver for the userqueue process shared
      BO synchronization.
      
      Create a dma fence having write pointer as the seqno and allocate a
      seq64 memory for each user queue process and feed this memory address
      into the firmware/hardware, thus the firmware writes the read pointer
      into the given address when the process completes it execution.
      Compare wptr and rptr, if rptr >= wptr, signal the fences for the waiting
      process to consume the buffers.
      
      v2: Worked on review comments from Christian for the following
          modifications
      
          - Add wptr as sequence number into the fence
          - Add a reference count for the fence driver
          - Add dma_fence_put below the list_del as it might
            frees the userq fence.
          - Trim unnecessary code in interrupt handler.
          - Check dma fence signaled state in dma fence creation
            function for a potential problem of hardware completing
            the job processing beforehand.
          - Add necessary locks.
          - Create a list and process all the unsignaled fences.
          - clean up fences in destroy function.
          - implement .signaled callback function
      
      v3: Worked on review comments from Christian
          - Modify naming convention for reference counted objects
          - Fix fence driver reference drop issue
          - Drop amdgpu_userq_fence_driver_process() function return value
      
      v4: Worked on review comments from Christian
          - Moved fence driver allocation into amdgpu_userq_fence_driver_alloc()
          - Added detail doc mentioning the differences b/w
            two spinlocks declared.
      
      v5: Worked on review comments from Christian
          - Check before upcast and remove local variable
          - Add error handling in fence_drv alloc function.
          - Move rptr read fn outside of the loop and remove WARN_ON in
            destroy function.
      
      v6:
        - clear the seq64 memory in user fence driver(Christian)
        - fix for the wptr va bo mapping(Christian)
        - move the fence_drv xa entry erase code from the interrupt handler
          into user fence destroy function
      
      Signed-off-by: default avatarArunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Suggested-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      6948f931
    • Shashank Sharma's avatar
      drm/amdgpu: add new IOCTL for usermode queue · 3cd2230b
      Shashank Sharma authored
      
      This patch adds:
      - A new IOCTL function to create and destroy
      - A new structure to keep all the user queue data in one place.
      - A function to generate unique index for the queue.
      
      V1: Worked on review comments from RFC patch series:
        - Alex: Keep a list of queues, instead of single queue per process.
        - Christian: Use the queue manager instead of global ptrs,
                 Don't keep the queue structure in amdgpu_ctx
      
      V2: Worked on review comments:
       - Christian:
         - Formatting of text
         - There is no need for queuing of userqueues, with idr in place
       - Alex:
         - Remove use_doorbell, its unnecessary
         - Reuse amdgpu_mqd_props for saving mqd fields
      
       - Code formatting and re-arrangement
      
      V3:
       - Integration with doorbell manager
      
      V4:
       - Accommodate MQD union related changes in UAPI (Alex)
       - Do not set the queue size twice (Bas)
      
      V5:
       - Remove wrapper functions for queue indexing (Christian)
       - Do not save the queue id/idr in queue itself (Christian)
       - Move the idr allocation in the IP independent generic space
        (Christian)
      
      V6:
       - Check the validity of input IP type (Christian)
      
      V7:
       - Move uq_func from uq_mgr to adev (Alex)
       - Add missing free(queue) for error cases (Yifan)
      
      V9:
       - Rebase
      
      V10: Addressed review comments from Christian, and added R-B:
       - Do not initialize the local variable
       - Convert DRM_ERROR to DEBUG.
      
      V11:
        - check the input flags to be zero (Alex)
      
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Christian Koenig <christian.koenig@amd.com>
      Reviewed-by: default avatarChristian Koenig <christian.koenig@amd.com>
      Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarShashank Sharma <shashank.sharma@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      3cd2230b
    • Shashank Sharma's avatar
      drm/amdgpu: add usermode queue base code · 6dfccf41
      Shashank Sharma authored
      This patch adds IP independent skeleton code for amdgpu
      usermode queue. It contains:
      - A new files with init functions of usermode queues.
      - A queue context manager in driver private data.
      
      V1: Worked on design review comments from RFC patch series:
      (https://patchwork.freedesktop.org/series/112214/
      
      )
      - Alex: Keep a list of queues, instead of single queue per process.
      - Christian: Use the queue manager instead of global ptrs,
                 Don't keep the queue structure in amdgpu_ctx
      
      V2:
       - Reformatted code, split the big patch into two
      
      V3:
      - Integration with doorbell manager
      
      V4:
      - Align the structure member names to the largest member's column
        (Luben)
      - Added SPDX license (Luben)
      
      V5:
      - Do not add amdgpu.h in amdgpu_userqueue.h (Christian).
      - Move struct amdgpu_userq_mgr into amdgpu_userqueue.h (Christian).
      
      V6: Rebase
      V9: Rebase
      V10: Rebase + Alex's R-B
      
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Christian Koenig <christian.koenig@amd.com>
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarShashank Sharma <shashank.sharma@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      6dfccf41
  15. Nov 04, 2024
  16. Oct 28, 2024
  17. Oct 15, 2024
  18. Oct 01, 2024
  19. Sep 26, 2024
  20. Sep 06, 2024
  21. Aug 30, 2024
    • Christian Brauner's avatar
      fs: move FMODE_UNSIGNED_OFFSET to fop_flags · 641bb439
      Christian Brauner authored
      This is another flag that is statically set and doesn't need to use up
      an FMODE_* bit. Move it to ->fop_flags and free up another FMODE_* bit.
      
      (1) mem_open() used from proc_mem_operations
      (2) adi_open() used from adi_fops
      (3) drm_open_helper():
          (3.1) accel_open() used from DRM_ACCEL_FOPS
          (3.2) drm_open() used from
          (3.2.1) amdgpu_driver_kms_fops
          (3.2.2) psb_gem_fops
          (3.2.3) i915_driver_fops
          (3.2.4) nouveau_driver_fops
          (3.2.5) panthor_drm_driver_fops
          (3.2.6) radeon_driver_kms_fops
          (3.2.7) tegra_drm_fops
          (3.2.8) vmwgfx_driver_fops
          (3.2.9) xe_driver_fops
          (3.2.10) DRM_GEM_FOPS
          (3.2.11) DEFINE_DRM_GEM_DMA_FOPS
      (4) struct memdev sets fmode flags based on type of device opened. For
          devices using struct mem_fops unsigned offset is used.
      
      Mark all these file operations as FOP_UNSIGNED_OFFSET and add asserts
      into the open helper to ensure that the flag is always set.
      
      Link: https://lore.kernel.org/r/20240809-work-fop_unsigned-v1-1-658e054d893e@kernel.org
      
      
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      641bb439
  22. Aug 29, 2024
  23. Aug 13, 2024
  24. Jul 15, 2024
  25. Jun 27, 2024
  26. May 17, 2024
  27. May 13, 2024
  28. May 02, 2024
  29. Apr 23, 2024
Loading