From: Dave Airlie <[email protected]>

We need to tracker large counts of spte than previously due to unref
getting delayed sometimes.

This doesn't fix LPT tracking yet, it just creates space for it.

Signed-off-by: Dave Airlie <[email protected]>

---
v2: fix memset32 wrong length
---
 drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c | 6 +++---
 drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h | 9 +++++----
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
index efc334f6104c..44daeec0aa6d 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
@@ -387,7 +387,7 @@ nvkm_vmm_sparse_ptes(const struct nvkm_vmm_desc *desc,
        } else
        if (desc->type == LPT) {
                union nvkm_pte_tracker sparse = { .s.sparse = 1 };
-               memset(&pgt->pte[ptei].u, sparse.u, ptes);
+               memset32(&pgt->pte[ptei].u, sparse.u, ptes);
        }
 }
 
@@ -399,7 +399,7 @@ nvkm_vmm_sparse_unref_ptes(struct nvkm_vmm_iter *it, bool 
pfn, u32 ptei, u32 pte
                memset(&pt->pde[ptei], 0x00, sizeof(pt->pde[0]) * ptes);
        else
        if (it->desc->type == LPT)
-               memset(&pt->pte[ptei].u, 0x00, sizeof(pt->pte[0]) * ptes);
+               memset32(&pt->pte[ptei].u, 0x00, ptes);
        return nvkm_vmm_unref_ptes(it, pfn, ptei, ptes);
 }
 
@@ -458,7 +458,7 @@ nvkm_vmm_ref_hwpt(struct nvkm_vmm_iter *it, struct 
nvkm_vmm_pt *pgd, u32 pdei)
                                        desc->func->sparse(vmm, pt, pteb, ptes);
                                else
                                        desc->func->invalid(vmm, pt, pteb, 
ptes);
-                               memset(&pgt->pte[pteb], 0x00, ptes);
+                               memset32(&pgt->pte[pteb].u, 0x00, ptes);
                        } else {
                                desc->func->unmap(vmm, pt, pteb, ptes);
                                while (ptes--)
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h 
b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h
index a6312a0e6b84..a8b08126e8dc 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h
@@ -5,11 +5,12 @@
 enum nvkm_memory_target;
 
 union nvkm_pte_tracker {
-       u8 u;
+       u32 u;
        struct {
-               u8 sparse:1;
-               u8 spte_valid:1;
-               u8 sptes:6;
+               u32 sparse:1;
+               u32 spte_valid:1;
+               u32 padding:14;
+               u32 sptes:16;
        } s;
 };
 
-- 
2.52.0

Reply via email to