From: Matthew Auld <matthew.auld@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Matt Roper <matthew.d.roper@intel.com>,
Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [Intel-xe] [PATCH v3 5/7] drm/xe/migrate: rather use pte_encode helpers
Date: Mon, 25 Sep 2023 14:21:18 +0100 [thread overview]
Message-ID: <20230925132113.59900-14-matthew.auld@intel.com> (raw)
In-Reply-To: <20230925132113.59900-9-matthew.auld@intel.com>
We need to avoid using stuff like PPAT_CACHED directly, which is no
longer going to work on newer platforms. At some point we can just
directly use the pat_index, but for now just use XE_CACHE_WB.
v2 (Matt Roper):
- Rather use the 'level' local variable.
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Pallavi Mishra <pallavi.mishra@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
---
drivers/gpu/drm/xe/xe_migrate.c | 7 ++++---
drivers/gpu/drm/xe/xe_pt.c | 12 ++++++------
drivers/gpu/drm/xe/xe_pt.h | 2 ++
3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
index 46f88f3a8c58..ebae0117f577 100644
--- a/drivers/gpu/drm/xe/xe_migrate.c
+++ b/drivers/gpu/drm/xe/xe_migrate.c
@@ -257,8 +257,9 @@ static int xe_migrate_prepare_vm(struct xe_tile *tile, struct xe_migrate *m,
level = 2;
ofs = map_ofs + XE_PAGE_SIZE * level + 256 * 8;
- flags = XE_PAGE_RW | XE_PAGE_PRESENT | PPAT_CACHED |
- XE_PPGTT_PTE_DM | XE_PDPE_PS_1G;
+
+ flags = XE_PPGTT_PTE_DM;
+ flags = __xe_pte_encode(flags, XE_CACHE_WB, vm, NULL, level);
/*
* Use 1GB pages, it shouldn't matter the physical amount of
@@ -493,7 +494,7 @@ static void emit_pte(struct xe_migrate *m,
addr += vram_region_gpu_offset(bo->ttm.resource);
addr |= XE_PPGTT_PTE_DM;
}
- addr |= PPAT_CACHED | XE_PAGE_PRESENT | XE_PAGE_RW;
+ addr = __xe_pte_encode(addr, XE_CACHE_WB, m->q->vm, NULL, 0);
bb->cs[bb->len++] = lower_32_bits(addr);
bb->cs[bb->len++] = upper_32_bits(addr);
diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c
index 397ef2573c05..ddb4d9c33181 100644
--- a/drivers/gpu/drm/xe/xe_pt.c
+++ b/drivers/gpu/drm/xe/xe_pt.c
@@ -68,8 +68,8 @@ u64 xe_pde_encode(struct xe_bo *bo, u64 bo_offset)
return pde;
}
-static u64 __pte_encode(u64 pte, enum xe_cache_level cache,
- struct xe_vm *vm, struct xe_vma *vma, u32 pt_level)
+u64 __xe_pte_encode(u64 pte, enum xe_cache_level cache,
+ struct xe_vm *vm, struct xe_vma *vma, u32 pt_level)
{
struct xe_device *xe = vm->xe;
@@ -113,7 +113,7 @@ u64 xe_pte_encode(struct xe_vm *vm, struct xe_bo *bo, u64 offset, enum xe_cache_
if (xe_bo_is_vram(bo) || xe_bo_is_stolen_devmem(bo))
pte |= XE_PPGTT_PTE_DM;
- return __pte_encode(pte, cache, vm, NULL, pt_level);
+ return __xe_pte_encode(pte, cache, vm, NULL, pt_level);
}
static u64 __xe_pt_empty_pte(struct xe_tile *tile, struct xe_vm *vm,
@@ -595,9 +595,9 @@ xe_pt_stage_bind_entry(struct xe_ptw *parent, pgoff_t offset,
XE_WARN_ON(xe_walk->va_curs_start != addr);
- pte = __pte_encode(is_null ? 0 :
- xe_res_dma(curs) + xe_walk->dma_offset,
- xe_walk->cache, xe_walk->vm, xe_walk->vma, level);
+ pte = __xe_pte_encode(is_null ? 0 :
+ xe_res_dma(curs) + xe_walk->dma_offset,
+ xe_walk->cache, xe_walk->vm, xe_walk->vma, level);
pte |= xe_walk->default_pte;
/*
diff --git a/drivers/gpu/drm/xe/xe_pt.h b/drivers/gpu/drm/xe/xe_pt.h
index 4a9143bc6628..0e66436d707d 100644
--- a/drivers/gpu/drm/xe/xe_pt.h
+++ b/drivers/gpu/drm/xe/xe_pt.h
@@ -49,5 +49,7 @@ u64 xe_pde_encode(struct xe_bo *bo, u64 bo_offset);
u64 xe_pte_encode(struct xe_vm *vm, struct xe_bo *bo, u64 offset, enum xe_cache_level cache,
u32 pt_level);
+u64 __xe_pte_encode(u64 pte, enum xe_cache_level cache,
+ struct xe_vm *vm, struct xe_vma *vma, u32 pt_level);
#endif
--
2.41.0
next prev parent reply other threads:[~2023-09-25 13:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-25 13:21 [Intel-xe] [PATCH v3 0/7] PAT and cache coherency support Matthew Auld
2023-09-25 13:21 ` [Intel-xe] [PATCH v3 1/7] drm/xe/uapi: Add support for cache and coherency mode Matthew Auld
2023-09-25 18:56 ` Souza, Jose
2023-09-26 8:21 ` Matthew Auld
2023-09-25 13:21 ` [Intel-xe] [PATCH v3 2/7] drm/xe: move pat_table into device info Matthew Auld
2023-09-25 13:21 ` [Intel-xe] [PATCH v3 3/7] drm/xe/pat: trim the tgl PAT table Matthew Auld
2023-09-25 13:21 ` [Intel-xe] [PATCH v3 4/7] drm/xe/pat: annotate pat_index with coherency mode Matthew Auld
2023-09-25 13:21 ` Matthew Auld [this message]
2023-09-25 13:21 ` [Intel-xe] [PATCH v3 6/7] drm/xe: directly use pat_index for pte_encode Matthew Auld
2023-09-25 22:08 ` Matt Roper
2023-09-26 19:29 ` Lucas De Marchi
2023-09-25 13:21 ` [Intel-xe] [PATCH v3 7/7] drm/xe/uapi: support pat_index selection with vm_bind Matthew Auld
2023-09-25 13:24 ` [Intel-xe] ✗ CI.Patch_applied: failure for PAT and cache coherency support (rev4) Patchwork
2023-09-25 19:47 ` [Intel-xe] [PATCH v3 0/7] PAT and cache coherency support Souza, Jose
2023-09-26 8:23 ` Matthew Auld
2023-09-26 18:03 ` Souza, Jose
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230925132113.59900-14-matthew.auld@intel.com \
--to=matthew.auld@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=matthew.d.roper@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox