Commit 1f430b8d authored by Thomas Hellström's avatar Thomas Hellström
Browse files

drm/xe/svm: Document how xe keeps drm_pagemap references



As an aid to understanding the lifetime of the drm_pagemaps used
by the xe driver, document how the xe driver keeps the
drm_pagemap references.

v3:
- Fix formatting (Matt Brost)

Suggested-by: default avatarMatthew Brost <matthew.brost@intel.com>
Signed-off-by: default avatarThomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: default avatarMatthew Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20251219113320.183860-19-thomas.hellstrom@linux.intel.com
parent 54dc5842
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -28,6 +28,27 @@
#define XE_PEER_PAGEMAP ((void *)0ul)
#define XE_PEER_VM ((void *)1ul)

/**
 * DOC: drm_pagemap reference-counting in xe:
 *
 * In addition to the drm_pagemap internal reference counting by its zone
 * device data, the xe driver holds the following long-time references:
 *
 * - struct xe_pagemap:
 *	The xe_pagemap struct derives from struct drm_pagemap and uses its
 *	reference count.
 * - SVM-enabled VMs:
 *	SVM-enabled VMs look up and keeps a reference to all xe_pagemaps on
 *	the same device.
 * - VMAs:
 *	vmas keep a reference on the drm_pagemap indicated by a gpu_madvise()
 *	call.
 *
 * In addition, all drm_pagemap or xe_pagemap pointers where lifetime cannot
 * be guaranteed by a vma reference under the vm lock should keep a reference.
 * That includes the range->pages.dpagemap pointer.
 */

static int xe_svm_get_pagemaps(struct xe_vm *vm);

void *xe_svm_private_page_owner(struct xe_vm *vm, bool force_smem)