123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
#ifndef _XE_PT_TYPES_H_
#define _XE_PT_TYPES_H_
#include <linux/types.h>
#include "xe_page_reclaim.h"
#include "xe_pt_walk.h"
struct xe_bo;
struct xe_device;
struct xe_vma;
enum xe_cache_level {
XE_CACHE_NONE,
XE_CACHE_WT,
XE_CACHE_WB,
XE_CACHE_NONE_COMPRESSION,
XE_CACHE_WB_COMPRESSION,
__XE_CACHE_LEVEL_COUNT,
};
#define XE_VM_MAX_LEVEL 4
struct xe_pt {
struct xe_ptw base;
struct xe_bo *bo;
unsigned int level;
unsigned int num_live;
bool rebind;
bool is_compact;
#if IS_ENABLED(CONFIG_DRM_XE_DEBUG_VM)
u64 addr;
#endif
};
struct xe_pt_ops {
u64 (*pte_encode_bo)(struct xe_bo *bo, u64 bo_offset,
u16 pat_index, u32 pt_level);
u64 (*pte_encode_vma)(u64 pte, struct xe_vma *vma,
u16 pat_index, u32 pt_level);
u64 (*pte_encode_addr)(struct xe_device *xe, u64 addr,
u16 pat_index,
u32 pt_level, bool devmem, u64 flags);
u64 (*pde_encode_bo)(struct xe_bo *bo, u64 bo_offset);
};
struct xe_pt_entry {
struct xe_pt *pt;
u64 pte;
};
struct xe_vm_pgtable_update {
struct xe_bo *pt_bo;
u32 ofs;
u32 qwords;
struct xe_pt *pt;
struct xe_pt_entry *pt_entries;
unsigned int level;
u32 flags;
};
struct xe_vm_pgtable_update_op {
struct xe_vm_pgtable_update entries[XE_VM_MAX_LEVEL * 2 + 1];
struct xe_vma *vma;
struct xe_page_reclaim_list *prl;
u32 num_entries;
bool bind;
bool rebind;
};
struct xe_pt_job_ops {
u32 current_op;
struct kref refcount;
struct llist_head deferred;
struct xe_vm_pgtable_update_op *ops;
};
struct xe_vm_pgtable_update_ops {
struct xe_pt_job_ops *pt_job_ops;
struct xe_page_reclaim_list prl;
u64 start;
u64 last;
u32 num_ops;
bool needs_svm_lock;
bool needs_invalidation;
};
#endif