dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/nouveau: Use write-combined maps for coherent
@ 2026-08-22  4:42 Aaron Kling via B4 Relay
  2026-09-01 14:07 ` Danilo Krummrich
  2026-09-01 20:29 ` Danilo Krummrich
  0 siblings, 2 replies; 5+ messages in thread
From: Aaron Kling via B4 Relay @ 2026-08-22  4:42 UTC (permalink / raw)
  To: Lyude Paul, Danilo Krummrich, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter
  Cc: dri-devel, nouveau, linux-kernel, Karol Herbst, Faith Ekstrand,
	Aaron Kling

From: Faith Ekstrand <faith.ekstrand@collabora.com>

On Tegra devices, uncached maps traslate to device memory, causing
unaligned accesses by userspace resulting in a SIGBUS. Instead, use
write-combined maps to ensure proper access.

This would also affect discrete cards on any Arm device. It was
determined that discrete cards regardless of cpu arch should use
write-combined maps for coherent anyways. Thus this change is made for
all gpu types.

Signed-off-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Co-developed-by: Aaron Kling <webgeek1234@gmail.com>
Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
---
Without this change, nouveau can easily hit sigbus errors in the Android
UI rendering via nvk or running vulkan deqp tests on Tegra. Changing
coherent maps to use write-combined stops the crashing.
---
Changes in v2:
- Set write-combined for coherent on all gpu types
- Link to v1: https://lore.kernel.org/r/20260725-tegra-coherent-wc-v1-1-dfdcc929c21b@gmail.com
---
 drivers/gpu/drm/nouveau/nouveau_sgdma.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
index fa3b4ebf38a83..2bd0376193aee 100644
--- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c
+++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
@@ -72,9 +72,7 @@ nouveau_sgdma_create_ttm(struct ttm_buffer_object *bo, uint32_t page_flags)
 	struct nouveau_sgdma_be *nvbe;
 	enum ttm_caching caching;
 
-	if (nvbo->force_coherent)
-		caching = ttm_uncached;
-	else if (drm->agp.bridge)
+	if (nvbo->force_coherent || drm->agp.bridge)
 		caching = ttm_write_combined;
 	else
 		caching = ttm_cached;

---
base-commit: 903c1cf6dff9964e71eda98a39e2e5d442050472
change-id: 20260725-tegra-coherent-wc-19941d1a5a60

Best regards,
-- 
Aaron Kling <webgeek1234@gmail.com>



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] drm/nouveau: Use write-combined maps for coherent
  2026-08-22  4:42 [PATCH v2] drm/nouveau: Use write-combined maps for coherent Aaron Kling via B4 Relay
@ 2026-09-01 14:07 ` Danilo Krummrich
  2026-09-01 18:03   ` Aaron Kling
  2026-09-01 20:29 ` Danilo Krummrich
  1 sibling, 1 reply; 5+ messages in thread
From: Danilo Krummrich @ 2026-09-01 14:07 UTC (permalink / raw)
  To: webgeek1234
  Cc: Lyude Paul, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, dri-devel, nouveau, linux-kernel,
	Faith Ekstrand

On 8/22/26 6:42 AM, Aaron Kling via B4 Relay wrote:
> From: Faith Ekstrand <faith.ekstrand@collabora.com>
> 
> On Tegra devices, uncached maps traslate to device memory, causing
> unaligned accesses by userspace resulting in a SIGBUS. Instead, use
> write-combined maps to ensure proper access.
> 
> This would also affect discrete cards on any Arm device. It was
> determined that discrete cards regardless of cpu arch should use
> write-combined maps for coherent anyways. Thus this change is made for
> all gpu types.
> 
> Signed-off-by: Faith Ekstrand <faith.ekstrand@collabora.com>
> Co-developed-by: Aaron Kling <webgeek1234@gmail.com>
> Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
Can you please provide a Fixes: tag? Also, please remember to Cc: stable if necessary.

Thanks,
Danilo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] drm/nouveau: Use write-combined maps for coherent
  2026-09-01 14:07 ` Danilo Krummrich
@ 2026-09-01 18:03   ` Aaron Kling
  2026-09-01 19:55     ` lyude
  0 siblings, 1 reply; 5+ messages in thread
From: Aaron Kling @ 2026-09-01 18:03 UTC (permalink / raw)
  To: Danilo Krummrich
  Cc: Lyude Paul, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, dri-devel, nouveau, linux-kernel,
	Faith Ekstrand

On Tue, Sep 1, 2026 at 9:07 AM Danilo Krummrich <dakr@kernel.org> wrote:
>
> On 8/22/26 6:42 AM, Aaron Kling via B4 Relay wrote:
> > From: Faith Ekstrand <faith.ekstrand@collabora.com>
> >
> > On Tegra devices, uncached maps traslate to device memory, causing
> > unaligned accesses by userspace resulting in a SIGBUS. Instead, use
> > write-combined maps to ensure proper access.
> >
> > This would also affect discrete cards on any Arm device. It was
> > determined that discrete cards regardless of cpu arch should use
> > write-combined maps for coherent anyways. Thus this change is made for
> > all gpu types.
> >
> > Signed-off-by: Faith Ekstrand <faith.ekstrand@collabora.com>
> > Co-developed-by: Aaron Kling <webgeek1234@gmail.com>
> > Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
> Can you please provide a Fixes: tag? Also, please remember to Cc: stable if necessary.

Looks like the tag is:

Fixes: 1b4ea4c5980f ("drm/ttm: set the tt caching state at creation time")

Should I send another revision just to add this, or can the subsystem
maintainer add it when picking the change up? For stable, I would like
to see this picked to 6.18 at least, since I primarily work with LTS
forks.

Aaron

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] drm/nouveau: Use write-combined maps for coherent
  2026-09-01 18:03   ` Aaron Kling
@ 2026-09-01 19:55     ` lyude
  0 siblings, 0 replies; 5+ messages in thread
From: lyude @ 2026-09-01 19:55 UTC (permalink / raw)
  To: Aaron Kling, Danilo Krummrich
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, dri-devel, nouveau, linux-kernel, Faith Ekstrand

On Tue, 2026-09-01 at 13:03 -0500, Aaron Kling wrote:
> 
> Looks like the tag is:
> 
> Fixes: 1b4ea4c5980f ("drm/ttm: set the tt caching state at creation
> time")
> 
> Should I send another revision just to add this, or can the subsystem
> maintainer add it when picking the change up? For stable, I would
> like
> to see this picked to 6.18 at least, since I primarily work with LTS
> forks.
> 
> Aaron

I would send out a respin with the tag


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] drm/nouveau: Use write-combined maps for coherent
  2026-08-22  4:42 [PATCH v2] drm/nouveau: Use write-combined maps for coherent Aaron Kling via B4 Relay
  2026-09-01 14:07 ` Danilo Krummrich
@ 2026-09-01 20:29 ` Danilo Krummrich
  1 sibling, 0 replies; 5+ messages in thread
From: Danilo Krummrich @ 2026-09-01 20:29 UTC (permalink / raw)
  To: Aaron Kling
  Cc: Lyude Paul, Danilo Krummrich, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, dri-devel,
	nouveau, linux-kernel, Karol Herbst, Faith Ekstrand

On Fri, 21 Aug 2026 23:42:59 -0500, Aaron Kling wrote:
> [PATCH v2] drm/nouveau: Use write-combined maps for coherent

Applied, thanks!

  Branch: drm-misc-fixes
  Tree:   https://gitlab.freedesktop.org/drm/misc/kernel.git

[1/1] drm/nouveau: Use write-combined maps for coherent
      commit: 774b73428e6e

The patch will appear in the next linux-next integration (typically within 24
hours on weekdays).

The patch is queued up for Linus's tree and should land in the next -rc release.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-01 20:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-22  4:42 [PATCH v2] drm/nouveau: Use write-combined maps for coherent Aaron Kling via B4 Relay
2026-09-01 14:07 ` Danilo Krummrich
2026-09-01 18:03   ` Aaron Kling
2026-09-01 19:55     ` lyude
2026-09-01 20:29 ` Danilo Krummrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox