Skip to contentSkip to conversation

drm/nouveau: bring back blit subchannel for pre nv50 GPUs

PATCH In review Karol Herbst 3 participants 4 messages May 26, 2023 – Jul 12, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/nouveau: bring back blit subchannel for pre nv50 GPUs

1ba6113a90a0 removed a lot of the kernel GPU channel, but method 0x128 was important as otherwise the GPU spams us with CACHE_ERROR messages.

We use the blit subchannel inside our vblank handling, so we should keep at least this part.

v2: Only do it for NV11+ GPUs

Fixes 4a16dd9d18a0 ("drm/nouveau/kms: switch to drm fbdev helpers")
---
 drivers/gpu/drm/nouveau/nouveau_chan.c |  1 +
 drivers/gpu/drm/nouveau/nouveau_chan.h |  1 +
 drivers/gpu/drm/nouveau/nouveau_drm.c  | 20 +++++++++++++++++---
 3 files changed, 19 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/nouveau_chan.c +1 -0
index e648ecd0c1a0..3dfbc374478e 100644
@@ -90,6 +90,7 @@ nouveau_channel_del(struct nouveau_channel **pchan)
 		if (cli)
 			nouveau_svmm_part(chan->vmm->svmm, chan->inst);
 
+		nvif_object_dtor(&chan->blit);
 		nvif_object_dtor(&chan->nvsw);
 		nvif_object_dtor(&chan->gart);
 		nvif_object_dtor(&chan->vram);
drivers/gpu/drm/nouveau/nouveau_chan.h +1 -0
index e06a8ffed31a..bad7466bd0d5 100644
@@ -53,6 +53,7 @@ struct nouveau_channel {
 	u32 user_put;
 
 	struct nvif_object user;
+	struct nvif_object blit;
 
 	struct nvif_event kill;
 	atomic_t killed;
drivers/gpu/drm/nouveau/nouveau_drm.c +17 -3
index cc7c5b4a05fd..9512f1c2f871 100644
@@ -369,15 +369,29 @@ nouveau_accel_gr_init(struct nouveau_drm *drm)
 		ret = nvif_object_ctor(&drm->channel->user, "drmNvsw",
 				       NVDRM_NVSW, nouveau_abi16_swclass(drm),
 				       NULL, 0, &drm->channel->nvsw);
+
+		if (ret == 0 && device->info.chipset >= 0x11) {
+			ret = nvif_object_ctor(&drm->channel->user, "drmBlit",
+					       0x005f, 0x009f,
+					       NULL, 0, &drm->channel->blit);
+		}
+
 		if (ret == 0) {
 			struct nvif_push *push = drm->channel->chan.push;
-			ret = PUSH_WAIT(push, 2);
-			if (ret == 0)
+			ret = PUSH_WAIT(push, 8);
+			if (ret == 0) {
+				if (device->info.chipset >= 0x11) {
+					PUSH_NVSQ(push, NV05F, 0x0000, drm->channel->blit.handle);
+					PUSH_NVSQ(push, NV09F, 0x0120, 0,
+							       0x0124, 1,
+							       0x0128, 2);
+				}
 				PUSH_NVSQ(push, NV_SW, 0x0000, drm->channel->nvsw.handle);
+			}
 		}
 
 		if (ret) {
-			NV_ERROR(drm, "failed to allocate sw class, %d\n", ret);
+			NV_ERROR(drm, "failed to allocate sw or blit class, %d\n", ret);
 			nouveau_accel_gr_fini(drm);
 			return;
 		}
Signature · 1 line
2.40.1
#1 lore raw
Quoted 47 lines · Karol Herbst

1ba6113a90a0 removed a lot of the kernel GPU channel, but method 0x128 was important as otherwise the GPU spams us with CACHE_ERROR messages.

We use the blit subchannel inside our vblank handling, so we should keep at least this part.

v2: Only do it for NV11+ GPUs

Fixes 4a16dd9d18a0 ("drm/nouveau/kms: switch to drm fbdev helpers")
---
 drivers/gpu/drm/nouveau/nouveau_chan.c |  1 +
 drivers/gpu/drm/nouveau/nouveau_chan.h |  1 +
 drivers/gpu/drm/nouveau/nouveau_drm.c  | 20 +++++++++++++++++---
 3 files changed, 19 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/nouveau_chan.c +1 -0
index e648ecd0c1a0..3dfbc374478e 100644
@@ -90,6 +90,7 @@ nouveau_channel_del(struct nouveau_channel **pchan)
                if (cli)
                        nouveau_svmm_part(chan->vmm->svmm, chan->inst);
 
+               nvif_object_dtor(&chan->blit);
                nvif_object_dtor(&chan->nvsw);
                nvif_object_dtor(&chan->gart);
                nvif_object_dtor(&chan->vram);
drivers/gpu/drm/nouveau/nouveau_chan.h +1 -0
index e06a8ffed31a..bad7466bd0d5 100644
@@ -53,6 +53,7 @@ struct nouveau_channel {
        u32 user_put;
 
        struct nvif_object user;
+       struct nvif_object blit;
 
        struct nvif_event kill;
        atomic_t killed;
drivers/gpu/drm/nouveau/nouveau_drm.c +0 -0
index cc7c5b4a05fd..9512f1c2f871 100644

drivers/gpu/drm/nouveau/nouveau_drm.c nouveau_accel_gr_init(struct nouveau_drm *drm) · line 373

Quoted 5 lines
drivers/gpu/drm/nouveau/nouveau_drm.c +2 -0
@@ -369,15 +369,29 @@ nouveau_accel_gr_init(struct nouveau_drm *drm)
                ret = nvif_object_ctor(&drm->channel->user, "drmNvsw",
                                       NVDRM_NVSW, nouveau_abi16_swclass(drm),
                                       NULL, 0, &drm->channel->nvsw);
+
+               if (ret == 0 && device->info.chipset >= 0x11) {

Can you double-check that this is needed on NV15? IIRC there's some non-linearity of chipsets here which is why we had (some long time ago, not sure if it's still there), a chip class which would simplify such checks.

Cheers,

-ilia

#2 lore raw
Quoted 51 lines · Ilia Mirkin
Quoted 49 lines · Karol Herbst

1ba6113a90a0 removed a lot of the kernel GPU channel, but method 0x128 was important as otherwise the GPU spams us with CACHE_ERROR messages.

We use the blit subchannel inside our vblank handling, so we should keep at least this part.

v2: Only do it for NV11+ GPUs

Fixes 4a16dd9d18a0 ("drm/nouveau/kms: switch to drm fbdev helpers")
---
 drivers/gpu/drm/nouveau/nouveau_chan.c |  1 +
 drivers/gpu/drm/nouveau/nouveau_chan.h |  1 +
 drivers/gpu/drm/nouveau/nouveau_drm.c  | 20 +++++++++++++++++---
 3 files changed, 19 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/nouveau_chan.c +1 -0
index e648ecd0c1a0..3dfbc374478e 100644
@@ -90,6 +90,7 @@ nouveau_channel_del(struct nouveau_channel **pchan)
                if (cli)
                        nouveau_svmm_part(chan->vmm->svmm, chan->inst);
 
+               nvif_object_dtor(&chan->blit);
                nvif_object_dtor(&chan->nvsw);
                nvif_object_dtor(&chan->gart);
                nvif_object_dtor(&chan->vram);
drivers/gpu/drm/nouveau/nouveau_chan.h +1 -0
index e06a8ffed31a..bad7466bd0d5 100644
@@ -53,6 +53,7 @@ struct nouveau_channel {
        u32 user_put;
 
        struct nvif_object user;
+       struct nvif_object blit;
 
        struct nvif_event kill;
        atomic_t killed;
drivers/gpu/drm/nouveau/nouveau_drm.c +0 -0
index cc7c5b4a05fd..9512f1c2f871 100644
@@ -369,15 +369,29 @@ nouveau_accel_gr_init(struct nouveau_drm *drm)
                ret = nvif_object_ctor(&drm->channel->user, "drmNvsw",
                                       NVDRM_NVSW, nouveau_abi16_swclass(drm),
Quoted 9 lines

drivers/gpu/drm/nouveau/nouveau_drm.c nouveau_accel_gr_init(struct nouveau_drm *drm) · line 373

Quoted 3 lines
drivers/gpu/drm/nouveau/nouveau_drm.c +2 -0
                                       NULL, 0, &drm->channel->nvsw);
+
+               if (ret == 0 && device->info.chipset >= 0x11) {

Can you double-check that this is needed on NV15? IIRC there's some non-linearity of chipsets here which is why we had (some long time ago, not sure if it's still there), a chip class which would simplify such checks.

yeah, it's fine. The old code before 4a16dd9d18a0 had a "device->info.chipset >= 0x11 ? 0x009f : 0x005f" check when creating the blit object.

Quoted 4 lines

Cheers,

-ilia

Reviewed-by on v2 1/1
#3 lore raw
In reply to Karol Herbst
Quoted 4 lines · Karol Herbst

1ba6113a90a0 removed a lot of the kernel GPU channel, but method 0x128 was important as otherwise the GPU spams us with CACHE_ERROR messages.

Quoted 8 lines

We use the blit subchannel inside our vblank handling, so we should keep at least this part.

v2: Only do it for NV11+ GPUs

Fixes 4a16dd9d18a0 ("drm/nouveau/kms: switch to drm fbdev helpers")
Quoted 70 lines
---
 drivers/gpu/drm/nouveau/nouveau_chan.c |  1 +
 drivers/gpu/drm/nouveau/nouveau_chan.h |  1 +
 drivers/gpu/drm/nouveau/nouveau_drm.c  | 20 +++++++++++++++++---
 3 files changed, 19 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/nouveau_chan.c +1 -0
index e648ecd0c1a0..3dfbc374478e 100644
@@ -90,6 +90,7 @@ nouveau_channel_del(struct nouveau_channel **pchan)
                if (cli)
                        nouveau_svmm_part(chan->vmm->svmm, chan->inst);
 
+               nvif_object_dtor(&chan->blit);
                nvif_object_dtor(&chan->nvsw);
                nvif_object_dtor(&chan->gart);
                nvif_object_dtor(&chan->vram);
drivers/gpu/drm/nouveau/nouveau_chan.h +1 -0
index e06a8ffed31a..bad7466bd0d5 100644
@@ -53,6 +53,7 @@ struct nouveau_channel {
        u32 user_put;
 
        struct nvif_object user;
+       struct nvif_object blit;
 
        struct nvif_event kill;
        atomic_t killed;
drivers/gpu/drm/nouveau/nouveau_drm.c +17 -4
index cc7c5b4a05fd..9512f1c2f871 100644
@@ -369,15 +369,29 @@ nouveau_accel_gr_init(struct nouveau_drm *drm)
                ret = nvif_object_ctor(&drm->channel->user, "drmNvsw",
                                       NVDRM_NVSW, nouveau_abi16_swclass(drm),
                                       NULL, 0, &drm->channel->nvsw);
+
+               if (ret == 0 && device->info.chipset >= 0x11) {
+                       ret = nvif_object_ctor(&drm->channel->user, "drmBlit",
+                                              0x005f, 0x009f,
+                                              NULL, 0, &drm->channel->blit);
+               }
+
                if (ret == 0) {
                        struct nvif_push *push = drm->channel->chan.push;
-                       ret = PUSH_WAIT(push, 2);
-                       if (ret == 0)
+                       ret = PUSH_WAIT(push, 8);
+                       if (ret == 0) {
+                               if (device->info.chipset >= 0x11) {
+                                       PUSH_NVSQ(push, NV05F, 0x0000, drm->channel->blit.handle);
+                                       PUSH_NVSQ(push, NV09F, 0x0120, 0,
+                                                              0x0124, 1,
+                                                              0x0128, 2);
+                               }
                                PUSH_NVSQ(push, NV_SW, 0x0000, drm->channel->nvsw.handle);
+                       }
                }
 
                if (ret) {
-                       NV_ERROR(drm, "failed to allocate sw class, %d\n", ret);
+                       NV_ERROR(drm, "failed to allocate sw or blit class, %d\n", ret);
                        nouveau_accel_gr_fini(drm);
                        return;
                }
--

2.40.1