[Intel-xe] [PATCH 2/9] drm/xe: Remove check for vma == NULL
Matt Roper
matthew.d.roper at intel.com
Mon Sep 25 22:31:19 UTC 2023
On Mon, Sep 25, 2023 at 03:10:42PM -0700, Lucas De Marchi wrote:
> 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.
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
Okay, this takes care of my comment on the previous patch too; I guess I
should have read ahead...
Reviewed-by: Matt Roper <matthew.d.roper at intel.com>
> ---
> drivers/gpu/drm/xe/xe_pt.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c
> index afadd399684c..0b8a45609e83 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;
> --
> 2.40.1
>
--
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
More information about the Intel-xe
mailing list