NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-amd64/58305: nouveau on Lenovo W701 doesn't display



This is a long shot but you could try the attached patch.  There's a
very slim, but nonzero, probability that it will make a difference.
Patch should apply cleanly to HEAD and netbsd-10.

(The changes to radeon won't make a difference for your machine but
there might be analogous bugs in radeon on NetBSD.)
# HG changeset patch
# User Taylor R Campbell <riastradh%NetBSD.org@localhost>
# Date 1733687874 0
#      Sun Dec 08 19:57:54 2024 +0000
# Branch trunk
# Node ID 1540d49ea628daa5a14fd14d9b575f0417e90542
# Parent  c6804942bc0cd7b4a4f16abba36a9489c9814d80
# EXP-Topic riastradh-pr58305-nouveaucorenotifiertimeout
drm: Use rmb/wmb to order potential prefetchable/write-combining I/O.

Don't use membar_consumer/producer, which only order normal memory
operations in CPU/CPU synchronization, not prefetchable /
write-combining memory operations or CPU/device synchronization.

Normally this should use either bus_space_barrier (for prefetchable /
write-combining) or bus_dmamap_sync (for CPU/device), depending on
how the memory was mapped.  But threading those through the drm,
nouveau, and radeon abstractions is a lot of work and likely not
worth the effort.  So we'll use the Linux mmio barrier naming for
now.

Candidate fix for (among other possible issues):

PR port-amd64/58305: nouveau on Lenovo W701 doesn't display

diff -r c6804942bc0c -r 1540d49ea628 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c	Sat Dec 07 23:25:19 2024 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_bo.c	Sun Dec 08 19:57:54 2024 +0000
@@ -634,7 +634,7 @@ ioread16_native(const void __iomem *ptr)
 	uint16_t v;
 
 	v = *(const uint16_t __iomem *)ptr;
-	membar_consumer();
+	rmb();
 
 	return v;
 }
@@ -646,7 +646,7 @@ ioread32_native(const void __iomem *ptr)
 	uint32_t v;
 
 	v = *(const uint32_t __iomem *)ptr;
-	membar_consumer();
+	rmb();
 
 	return v;
 }
@@ -655,7 +655,7 @@ static inline void
 iowrite16_native(uint16_t v, void __iomem *ptr)
 {
 
-	membar_producer();
+	wmb();
 	*(uint16_t __iomem *)ptr = v;
 }
 
@@ -663,7 +663,7 @@ static inline void
 iowrite32_native(uint32_t v, void __iomem *ptr)
 {
 
-	membar_producer();
+	wmb();
 	*(uint32_t __iomem *)ptr = v;
 }
 #endif
diff -r c6804942bc0c -r 1540d49ea628 sys/external/bsd/drm2/dist/drm/nouveau/nvkm/core/nouveau_nvkm_core_gpuobj.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/core/nouveau_nvkm_core_gpuobj.c	Sat Dec 07 23:25:19 2024 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/core/nouveau_nvkm_core_gpuobj.c	Sun Dec 08 19:57:54 2024 +0000
@@ -51,7 +51,7 @@ ioread32_native(const void __iomem *ptr)
 	uint32_t v;
 
 	v = *(const uint32_t __iomem *)ptr;
-	membar_consumer();
+	rmb();
 
 	return v;
 }
@@ -60,7 +60,7 @@ static inline void
 iowrite32_native(uint32_t v, void __iomem *ptr)
 {
 
-	membar_producer();
+	wmb();
 	*(uint32_t __iomem *)ptr = v;
 }
 
diff -r c6804942bc0c -r 1540d49ea628 sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/devinit/fbmem.h
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/devinit/fbmem.h	Sat Dec 07 23:25:19 2024 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/devinit/fbmem.h	Sun Dec 08 19:57:54 2024 +0000
@@ -80,7 +80,7 @@ ioread32(const void __iomem *p)
 {
 	const uint32_t v = *(const uint32_t __iomem *)p;
 
-	membar_consumer();
+	rmb();
 
 	return v;		/* XXX nouveau byte order */
 }
@@ -89,7 +89,7 @@ static inline void
 iowrite32(uint32_t v, void __iomem *p)
 {
 
-	membar_producer();
+	wmb();
 	*(uint32_t __iomem *)p = v; /* XXX nouveau byte order */
 }
 #endif
diff -r c6804942bc0c -r 1540d49ea628 sys/external/bsd/drm2/dist/drm/radeon/radeon_r300.c
--- a/sys/external/bsd/drm2/dist/drm/radeon/radeon_r300.c	Sat Dec 07 23:25:19 2024 +0000
+++ b/sys/external/bsd/drm2/dist/drm/radeon/radeon_r300.c	Sun Dec 08 19:57:54 2024 +0000
@@ -136,7 +136,7 @@ static inline void
 fake_writel(uint32_t v, void __iomem *ptr)
 {
 
-	membar_producer();
+	wmb();
 	*(uint32_t __iomem *)ptr = v;
 }
 #endif
diff -r c6804942bc0c -r 1540d49ea628 sys/external/bsd/drm2/dist/drm/radeon/radeon_r600.c
--- a/sys/external/bsd/drm2/dist/drm/radeon/radeon_r600.c	Sat Dec 07 23:25:19 2024 +0000
+++ b/sys/external/bsd/drm2/dist/drm/radeon/radeon_r600.c	Sun Dec 08 19:57:54 2024 +0000
@@ -1091,7 +1091,7 @@ fake_readl(const void __iomem *ptr)
 	uint32_t v;
 
 	v = *(const uint32_t __iomem *)ptr;
-	membar_consumer();
+	rmb();
 
 	return v;
 }
diff -r c6804942bc0c -r 1540d49ea628 sys/external/bsd/drm2/dist/drm/radeon/radeon_rs600.c
--- a/sys/external/bsd/drm2/dist/drm/radeon/radeon_rs600.c	Sat Dec 07 23:25:19 2024 +0000
+++ b/sys/external/bsd/drm2/dist/drm/radeon/radeon_rs600.c	Sun Dec 08 19:57:54 2024 +0000
@@ -663,7 +663,7 @@ static inline void
 fake_writeq(uint64_t v, void __iomem *ptr)
 {
 
-	membar_producer();
+	wmb();
 	*(uint64_t __iomem *)ptr = v;
 }
 #endif


Home | Main Index | Thread Index | Old Index