mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
drm/imagination: Add GEM and VM related code
Add a GEM implementation based on drm_gem_shmem, and support code for the
PowerVR GPU MMU. The GPU VA manager is used for address space management.
Changes since v8:
- Updated for changes to drm_gpuvm
- Switched to dma_resv locking for vm ops
- Removed linked lists for collecting BOs in vm_context and for freeing
after ops. This is now done internally in drm_gpuvm
- Corrected license identifiers
Changes since v7:
- kernel-doc fixes
- Remove prefixes from DRM_PVR_BO_* flags
- CREATE_BO ioctl now returns an error if provided size isn't page aligned
- Optimised MMU flushes
Changes since v6:
- Don't initialise kernel_vm_ctx when using MIPS firmware processor
- Rename drm_gpuva_manager uses to drm_gpuvm
- Sync GEM object to device on creation
Changes since v5:
- Use WRITE_ONCE() when writing to page tables
- Add memory barriers to page table insertion
- Fixed double backing page alloc on page table objects
- Fix BO mask checks in DRM_IOCTL_PVR_CREATE_BO handler
- Document use of pvr_page_table_*_idx when preallocing page table objs
- Remove pvr_vm_gpuva_mapping_init()
- Remove NULL check for unmap op in remap function
- Protect gem object with mutex during drm_gpuva_link/unlink
- Defer free or release of page table pages until after TLB flush
- Use drm_gpuva_op_remap_get_unmap_range() helper
Changes since v4:
- Correct sync function in vmap/vunmap function documentation
- Update for upstream GPU VA manager
- Fix missing frees when unmapping drm_gpuva objects
- Always zero GEM BOs on creation
Changes since v3:
- Split MMU and VM code
- Register page table allocations with kmemleak
- Use drm_dev_{enter,exit}
Changes since v2:
- Use GPU VA manager
- Use drm_gem_shmem
Co-developed-by: Matt Coster <matt.coster@imgtec.com>
Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Co-developed-by: Donald Robson <donald.robson@imgtec.com>
Signed-off-by: Donald Robson <donald.robson@imgtec.com>
Signed-off-by: Sarah Walker <sarah.walker@imgtec.com>
Link: https://lore.kernel.org/r/3c96dd170efe759b73897e3675d7310a7c4b06d0.1700668843.git.donald.robson@imgtec.com
Signed-off-by: Maxime Ripard <mripard@kernel.org>
This commit is contained in:
committed by
Maxime Ripard
parent
f99f5f3ea7
commit
ff5f643de0
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "pvr_fw.h"
|
||||
#include "pvr_rogue_cr_defs.h"
|
||||
#include "pvr_vm.h"
|
||||
|
||||
#include <drm/drm_print.h>
|
||||
|
||||
@@ -312,7 +313,30 @@ pvr_device_gpu_init(struct pvr_device *pvr_dev)
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
return pvr_set_dma_info(pvr_dev);
|
||||
err = pvr_set_dma_info(pvr_dev);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (pvr_dev->fw_dev.processor_type != PVR_FW_PROCESSOR_TYPE_MIPS) {
|
||||
pvr_dev->kernel_vm_ctx = pvr_vm_create_context(pvr_dev, false);
|
||||
if (IS_ERR(pvr_dev->kernel_vm_ctx))
|
||||
return PTR_ERR(pvr_dev->kernel_vm_ctx);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* pvr_device_gpu_fini() - GPU-specific deinitialization for a PowerVR device
|
||||
* @pvr_dev: Target PowerVR device.
|
||||
*/
|
||||
static void
|
||||
pvr_device_gpu_fini(struct pvr_device *pvr_dev)
|
||||
{
|
||||
if (pvr_dev->fw_dev.processor_type != PVR_FW_PROCESSOR_TYPE_MIPS) {
|
||||
WARN_ON(!pvr_vm_context_put(pvr_dev->kernel_vm_ctx));
|
||||
pvr_dev->kernel_vm_ctx = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -364,6 +388,7 @@ pvr_device_fini(struct pvr_device *pvr_dev)
|
||||
* Deinitialization stages are performed in reverse order compared to
|
||||
* the initialization stages in pvr_device_init().
|
||||
*/
|
||||
pvr_device_gpu_fini(pvr_dev);
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
Reference in New Issue
Block a user