diff options
author | Lucas De Marchi <lucas.demarchi@intel.com> | 2023-09-27 22:38:55 +0300 |
---|---|---|
committer | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2023-12-21 19:41:20 +0300 |
commit | 23c8495efeed0d83657de89b44a569ac406bdfad (patch) | |
tree | f0065365589370e3fde292e28571b5b7221debbe /drivers/gpu/drm/xe/xe_vm.c | |
parent | 0e5e77bd9704edf1713ebed37e2da1b4faa25a52 (diff) | |
download | linux-23c8495efeed0d83657de89b44a569ac406bdfad.tar.xz |
drm/xe/migrate: Do not hand-encode pte
Instead of encoding the pte, call a new vfunc from xe_vm to handle that.
The encoding may not be the same on every platform, so keeping it in one
place helps to better support them.
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://lore.kernel.org/r/20230927193902.2849159-5-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_vm.c')
-rw-r--r-- | drivers/gpu/drm/xe/xe_vm.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c index 72e27e6809f9..1d3569097e5f 100644 --- a/drivers/gpu/drm/xe/xe_vm.c +++ b/drivers/gpu/drm/xe/xe_vm.c @@ -1235,7 +1235,6 @@ static u64 pte_encode_cache(enum xe_cache_level cache) static u64 pte_encode_ps(u32 pt_level) { - /* XXX: Does hw support 1 GiB pages? */ XE_WARN_ON(pt_level > 2); if (pt_level == 1) @@ -1291,9 +1290,31 @@ static u64 xelp_pte_encode_vma(u64 pte, struct xe_vma *vma, return pte; } +static u64 xelp_pte_encode_addr(u64 addr, enum xe_cache_level cache, + u32 pt_level, bool devmem, u64 flags) +{ + u64 pte; + + /* Avoid passing random bits directly as flags */ + XE_WARN_ON(flags & ~XE_PTE_PS64); + + pte = addr; + pte |= XE_PAGE_PRESENT | XE_PAGE_RW; + pte |= pte_encode_cache(cache); + pte |= pte_encode_ps(pt_level); + + if (devmem) + pte |= XE_PPGTT_PTE_DM; + + pte |= flags; + + return pte; +} + static const struct xe_pt_ops xelp_pt_ops = { .pte_encode_bo = xelp_pte_encode_bo, .pte_encode_vma = xelp_pte_encode_vma, + .pte_encode_addr = xelp_pte_encode_addr, .pde_encode_bo = xelp_pde_encode_bo, }; |