drivers/gpu/drm/xe/xe_vm.h

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_vm.h

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/xe/xe_vm.h
Extension
.h
Size
12682 bytes
Lines
440
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

#ifndef _XE_VM_H_
#define _XE_VM_H_

#include "xe_assert.h"
#include "xe_bo_types.h"
#include "xe_macros.h"
#include "xe_map.h"
#include "xe_vm_types.h"

/**
 * MAX_FAULTS_SAVED_PER_VM - Maximum number of faults each vm can store before future
 * faults are discarded to prevent memory overuse
 */
#define MAX_FAULTS_SAVED_PER_VM	50

struct drm_device;
struct drm_printer;
struct drm_file;

struct ttm_buffer_object;

struct dma_fence;

struct xe_exec_queue;
struct xe_file;
struct xe_pagefault;
struct xe_sync_entry;
struct xe_svm_range;
struct drm_exec;

struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags, struct xe_file *xef);

struct xe_vm *xe_vm_lookup(struct xe_file *xef, u32 id);
int xe_vma_cmp_vma_cb(const void *key, const struct rb_node *node);

static inline struct xe_vm *xe_vm_get(struct xe_vm *vm)
{
	drm_gpuvm_get(&vm->gpuvm);
	return vm;
}

static inline void xe_vm_put(struct xe_vm *vm)
{
	drm_gpuvm_put(&vm->gpuvm);
}

int xe_vm_lock(struct xe_vm *vm, bool intr);

void xe_vm_unlock(struct xe_vm *vm);

static inline bool xe_vm_is_closed(struct xe_vm *vm)
{
	/* Only guaranteed not to change when vm->lock is held */
	return !vm->size;
}

static inline bool xe_vm_is_banned(struct xe_vm *vm)
{
	return vm->flags & XE_VM_FLAG_BANNED;
}

static inline bool xe_vm_is_closed_or_banned(struct xe_vm *vm)
{
	lockdep_assert_held(&vm->lock);
	return xe_vm_is_closed(vm) || xe_vm_is_banned(vm);
}

struct xe_vma *
xe_vm_find_overlapping_vma(struct xe_vm *vm, u64 start, u64 range);

bool xe_vma_has_default_mem_attrs(struct xe_vma *vma);

void xe_vm_find_cpu_addr_mirror_vma_range(struct xe_vm *vm,
					  u64 *start,
					  u64 *end);
/**
 * xe_vm_has_scratch() - Whether the vm is configured for scratch PTEs
 * @vm: The vm
 *
 * Return: whether the vm populates unmapped areas with scratch PTEs
 */
static inline bool xe_vm_has_scratch(const struct xe_vm *vm)
{
	return vm->flags & XE_VM_FLAG_SCRATCH_PAGE;
}

/**
 * gpuvm_to_vm() - Return the embedding xe_vm from a struct drm_gpuvm pointer
 * @gpuvm: The struct drm_gpuvm pointer
 *

Annotation

Implementation Notes