]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/nouveau/mmu/gf100-: virtualise setting pdb base address for invalidation
authorBen Skeggs <bskeggs@redhat.com>
Tue, 12 Feb 2019 12:28:13 +0000 (22:28 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 19 Feb 2019 23:00:00 +0000 (09:00 +1000)
It appears that Pascal and newer need something different.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgf100.c
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgk104.c
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgk20a.c
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgm200.c
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgm20b.c
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgp100.c
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgp10b.c
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmgv100.c

index 734e58c1b860209aaedca9d8fe64052c2e1090d7..68474f1f09c1e3f7a5166a0a09b7927195c9ebd1 100644 (file)
@@ -141,6 +141,8 @@ struct nvkm_vmm_func {
                     struct nvkm_vmm_map *);
        void (*flush)(struct nvkm_vmm *, int depth);
 
+       void (*invalidate_pdb)(struct nvkm_vmm *, u64 addr);
+
        u64 page_block;
        const struct nvkm_vmm_page page[];
 };
@@ -186,8 +188,9 @@ int gf100_vmm_join(struct nvkm_vmm *, struct nvkm_memory *);
 void gf100_vmm_part(struct nvkm_vmm *, struct nvkm_memory *);
 int gf100_vmm_aper(enum nvkm_memory_target);
 int gf100_vmm_valid(struct nvkm_vmm *, void *, u32, struct nvkm_vmm_map *);
-void gf100_vmm_invalidate(struct nvkm_vmm *, u32 type);
 void gf100_vmm_flush(struct nvkm_vmm *, int);
+void gf100_vmm_invalidate(struct nvkm_vmm *, u32 type);
+void gf100_vmm_invalidate_pdb(struct nvkm_vmm *, u64 addr);
 
 int gk20a_vmm_aper(enum nvkm_memory_target);
 
@@ -200,6 +203,7 @@ int gm200_vmm_join(struct nvkm_vmm *, struct nvkm_memory *);
 int gp100_vmm_join(struct nvkm_vmm *, struct nvkm_memory *);
 int gp100_vmm_valid(struct nvkm_vmm *, void *, u32, struct nvkm_vmm_map *);
 void gp100_vmm_flush(struct nvkm_vmm *, int);
+void gp100_vmm_invalidate_pdb(struct nvkm_vmm *, u64 addr);
 
 int gv100_vmm_join(struct nvkm_vmm *, struct nvkm_memory *);
 
index fc8ef801d0fe52168b54681a4839e287185ab81f..b414413b07d440937b41572aff6fef55eddbe753 100644 (file)
@@ -177,11 +177,20 @@ gf100_vmm_desc_16_16[] = {
        {}
 };
 
+void
+gf100_vmm_invalidate_pdb(struct nvkm_vmm *vmm, u64 addr)
+{
+       struct nvkm_device *device = vmm->mmu->subdev.device;
+       nvkm_wr32(device, 0x100cb8, addr);
+}
+
 void
 gf100_vmm_invalidate(struct nvkm_vmm *vmm, u32 type)
 {
        struct nvkm_subdev *subdev = &vmm->mmu->subdev;
        struct nvkm_device *device = subdev->device;
+       struct nvkm_mmu_pt *pd = vmm->pd->pt[0];
+       u64 addr = 0;
 
        mutex_lock(&subdev->mutex);
        /* Looks like maybe a "free flush slots" counter, the
@@ -192,7 +201,20 @@ gf100_vmm_invalidate(struct nvkm_vmm *vmm, u32 type)
                        break;
        );
 
-       nvkm_wr32(device, 0x100cb8, vmm->pd->pt[0]->addr >> 8);
+       if (!(type & 0x00000002) /* ALL_PDB. */) {
+               switch (nvkm_memory_target(pd->memory)) {
+               case NVKM_MEM_TARGET_VRAM: addr |= 0x00000000; break;
+               case NVKM_MEM_TARGET_HOST: addr |= 0x00000002; break;
+               case NVKM_MEM_TARGET_NCOH: addr |= 0x00000003; break;
+               default:
+                       WARN_ON(1);
+                       break;
+               }
+               addr |= (vmm->pd->pt[0]->addr >> 12) << 4;
+
+               vmm->func->invalidate_pdb(vmm, addr);
+       }
+
        nvkm_wr32(device, 0x100cbc, 0x80000000 | type);
 
        /* Wait for flush to be queued? */
@@ -352,6 +374,7 @@ gf100_vmm_17 = {
        .aper = gf100_vmm_aper,
        .valid = gf100_vmm_valid,
        .flush = gf100_vmm_flush,
+       .invalidate_pdb = gf100_vmm_invalidate_pdb,
        .page = {
                { 17, &gf100_vmm_desc_17_17[0], NVKM_VMM_PAGE_xVxC },
                { 12, &gf100_vmm_desc_17_12[0], NVKM_VMM_PAGE_xVHx },
@@ -366,6 +389,7 @@ gf100_vmm_16 = {
        .aper = gf100_vmm_aper,
        .valid = gf100_vmm_valid,
        .flush = gf100_vmm_flush,
+       .invalidate_pdb = gf100_vmm_invalidate_pdb,
        .page = {
                { 16, &gf100_vmm_desc_16_16[0], NVKM_VMM_PAGE_xVxC },
                { 12, &gf100_vmm_desc_16_12[0], NVKM_VMM_PAGE_xVHx },
index 0ebb7bccfcd22c386118df7e45edd4571044c1d4..2679068e57ac63ef8cf623c9fb98a351e0bb1e17 100644 (file)
@@ -71,6 +71,7 @@ gk104_vmm_17 = {
        .aper = gf100_vmm_aper,
        .valid = gf100_vmm_valid,
        .flush = gf100_vmm_flush,
+       .invalidate_pdb = gf100_vmm_invalidate_pdb,
        .page = {
                { 17, &gk104_vmm_desc_17_17[0], NVKM_VMM_PAGE_xVxC },
                { 12, &gk104_vmm_desc_17_12[0], NVKM_VMM_PAGE_xVHx },
@@ -85,6 +86,7 @@ gk104_vmm_16 = {
        .aper = gf100_vmm_aper,
        .valid = gf100_vmm_valid,
        .flush = gf100_vmm_flush,
+       .invalidate_pdb = gf100_vmm_invalidate_pdb,
        .page = {
                { 16, &gk104_vmm_desc_16_16[0], NVKM_VMM_PAGE_xVxC },
                { 12, &gk104_vmm_desc_16_12[0], NVKM_VMM_PAGE_xVHx },
index 8086994a0446164c38feb56a20c57708f4866c3b..5c6f645080aec38f5b985ad540648dcd77af3e1d 100644 (file)
@@ -40,6 +40,7 @@ gk20a_vmm_17 = {
        .aper = gf100_vmm_aper,
        .valid = gf100_vmm_valid,
        .flush = gf100_vmm_flush,
+       .invalidate_pdb = gf100_vmm_invalidate_pdb,
        .page = {
                { 17, &gk104_vmm_desc_17_17[0], NVKM_VMM_PAGE_xxHC },
                { 12, &gk104_vmm_desc_17_12[0], NVKM_VMM_PAGE_xxHx },
@@ -54,6 +55,7 @@ gk20a_vmm_16 = {
        .aper = gf100_vmm_aper,
        .valid = gf100_vmm_valid,
        .flush = gf100_vmm_flush,
+       .invalidate_pdb = gf100_vmm_invalidate_pdb,
        .page = {
                { 16, &gk104_vmm_desc_16_16[0], NVKM_VMM_PAGE_xxHC },
                { 12, &gk104_vmm_desc_16_12[0], NVKM_VMM_PAGE_xxHx },
index a1676a4644fe2c6550829535643c029d8abefb5e..dd7f60753f6d98abd92b784187d61a7177326328 100644 (file)
@@ -113,6 +113,7 @@ gm200_vmm_17 = {
        .aper = gf100_vmm_aper,
        .valid = gf100_vmm_valid,
        .flush = gf100_vmm_flush,
+       .invalidate_pdb = gf100_vmm_invalidate_pdb,
        .page = {
                { 27, &gm200_vmm_desc_17_17[1], NVKM_VMM_PAGE_Sxxx },
                { 17, &gm200_vmm_desc_17_17[0], NVKM_VMM_PAGE_SVxC },
@@ -128,6 +129,7 @@ gm200_vmm_16 = {
        .aper = gf100_vmm_aper,
        .valid = gf100_vmm_valid,
        .flush = gf100_vmm_flush,
+       .invalidate_pdb = gf100_vmm_invalidate_pdb,
        .page = {
                { 27, &gm200_vmm_desc_16_16[1], NVKM_VMM_PAGE_Sxxx },
                { 16, &gm200_vmm_desc_16_16[0], NVKM_VMM_PAGE_SVxC },
index 64d4b6cff8dd23c9732ce21f0c24f2937ea552ab..57d763c9629e72254f31073a25ef980a88faabef 100644 (file)
@@ -28,6 +28,7 @@ gm20b_vmm_17 = {
        .aper = gk20a_vmm_aper,
        .valid = gf100_vmm_valid,
        .flush = gf100_vmm_flush,
+       .invalidate_pdb = gf100_vmm_invalidate_pdb,
        .page = {
                { 27, &gm200_vmm_desc_17_17[1], NVKM_VMM_PAGE_Sxxx },
                { 17, &gm200_vmm_desc_17_17[0], NVKM_VMM_PAGE_SxHC },
@@ -43,6 +44,7 @@ gm20b_vmm_16 = {
        .aper = gk20a_vmm_aper,
        .valid = gf100_vmm_valid,
        .flush = gf100_vmm_flush,
+       .invalidate_pdb = gf100_vmm_invalidate_pdb,
        .page = {
                { 27, &gm200_vmm_desc_16_16[1], NVKM_VMM_PAGE_Sxxx },
                { 16, &gm200_vmm_desc_16_16[0], NVKM_VMM_PAGE_SxHC },
index d44653acca8e8d394aaf7c3a4026fefabb5d59d2..f9c95c43c7a36b89fa035a88e8a44774dd203eb6 100644 (file)
@@ -306,6 +306,14 @@ gp100_vmm_valid(struct nvkm_vmm *vmm, void *argv, u32 argc,
        return 0;
 }
 
+void
+gp100_vmm_invalidate_pdb(struct nvkm_vmm *vmm, u64 addr)
+{
+       struct nvkm_device *device = vmm->mmu->subdev.device;
+       nvkm_wr32(device, 0x100cb8, lower_32_bits(addr));
+       nvkm_wr32(device, 0x100cec, upper_32_bits(addr));
+}
+
 void
 gp100_vmm_flush(struct nvkm_vmm *vmm, int depth)
 {
@@ -331,6 +339,7 @@ gp100_vmm = {
        .aper = gf100_vmm_aper,
        .valid = gp100_vmm_valid,
        .flush = gp100_vmm_flush,
+       .invalidate_pdb = gp100_vmm_invalidate_pdb,
        .page = {
                { 47, &gp100_vmm_desc_16[4], NVKM_VMM_PAGE_Sxxx },
                { 38, &gp100_vmm_desc_16[3], NVKM_VMM_PAGE_Sxxx },
index 3dcc6bddb32f34d601919cabae15e0a2580c055c..13d0d48bab55e22abfbdfd4be98cc183e9526910 100644 (file)
@@ -28,6 +28,7 @@ gp10b_vmm = {
        .aper = gk20a_vmm_aper,
        .valid = gp100_vmm_valid,
        .flush = gp100_vmm_flush,
+       .invalidate_pdb = gp100_vmm_invalidate_pdb,
        .page = {
                { 47, &gp100_vmm_desc_16[4], NVKM_VMM_PAGE_Sxxx },
                { 38, &gp100_vmm_desc_16[3], NVKM_VMM_PAGE_Sxxx },
index 2fa40c16e6d2e79674a4146b8b6df125e9d10858..8574bc980bbb7306275ccd04652bb480f520e6cf 100644 (file)
@@ -66,6 +66,7 @@ gv100_vmm = {
        .aper = gf100_vmm_aper,
        .valid = gp100_vmm_valid,
        .flush = gp100_vmm_flush,
+       .invalidate_pdb = gp100_vmm_invalidate_pdb,
        .page = {
                { 47, &gp100_vmm_desc_16[4], NVKM_VMM_PAGE_Sxxx },
                { 38, &gp100_vmm_desc_16[3], NVKM_VMM_PAGE_Sxxx },