diff options
author | Lucas De Marchi <lucas.demarchi@intel.com> | 2023-09-27 12:38:53 -0700 |
---|---|---|
committer | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2023-12-21 11:41:19 -0500 |
commit | b3bb7d9c561d664707717f8887b665ce8fef69ff (patch) | |
tree | 175bf66ad74125d93c8212c214ff4147185900b9 /drivers/gpu/drm/xe/xe_pt.c | |
parent | f24081cd6275748d4f7c5925645436ed406cec12 (diff) |
drm/xe: Remove check for vma == NULL
vma at this point can never be NULL as otherwise it would crash earlier
in the only caller, xe_pt_stage_bind_entry(). Remove the extra check and
avoid adding and removing the bits from the pte.
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://lore.kernel.org/r/20230927193902.2849159-3-lucas.demarchi@intel.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu/drm/xe/xe_pt.c')
-rw-r--r-- | drivers/gpu/drm/xe/xe_pt.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c index 01e7c8815e7d..c39e3b46df3e 100644 --- a/drivers/gpu/drm/xe/xe_pt.c +++ b/drivers/gpu/drm/xe/xe_pt.c @@ -136,14 +136,15 @@ u64 xe_pte_encode(struct xe_bo *bo, u64 bo_offset, enum xe_cache_level cache, static u64 __vma_pte_encode(u64 pte, struct xe_vma *vma, enum xe_cache_level cache, u32 pt_level) { - pte |= XE_PAGE_PRESENT | XE_PAGE_RW; + pte |= XE_PAGE_PRESENT; + + if (likely(!xe_vma_read_only(vma))) + pte |= XE_PAGE_RW; + pte |= pte_encode_cache(cache); pte |= pte_encode_ps(pt_level); - if (unlikely(vma && xe_vma_read_only(vma))) - pte &= ~XE_PAGE_RW; - - if (unlikely(vma && xe_vma_is_null(vma))) + if (unlikely(xe_vma_is_null(vma))) pte |= XE_PTE_NULL; return pte; |