> Date: Wed, 28 Oct 2020 23:54:40 -0400
> From: George Koehler <[email protected]>
>
> >Synopsis: linux/io.h changes broke radeondrm RV350 macppc
> >Category: powerpc
> >Environment:
> System : OpenBSD 6.8
> Details : OpenBSD 6.8-current (GENERIC) #8: Wed Oct 28 22:51:59 EDT
> 2020
>
> [email protected]:/sys/arch/macppc/compile/GENERIC
>
> Architecture: OpenBSD.macppc
> Machine : macppc
> >Description:
> Today's commits in /sys/dev/pci/drm about <linux/io.h> broke
> radeondrm RV350 on my PowerBook5,4. The screen freezes while the
> kernel is initializing radeondrm. The screen is all or almost all dark.
> The boot gets stuck without touching the filesystems.
> >How-To-Repeat:
> Boot a new kernel.
> >Fix:
> I reverted /sys/dev/pci/drm to -D 2020-10-27, and the problem
> went away. 2020-10-27 is yesterday, before these 2 commits:
> - Use the function from <linux/io.h> for all "Memory Space" IO.
> - Switch from bus_space_read/write to linux io.h interfaces...
> I kept the latest r1.61 of /sys/arch/macppc/macppc/ofw_machdep.c.
> I have not updated the kernels of my other OpenBSD machines.
Hmm, I thought I tested this properly on macppc, but apparently I
didn't. The powerpc IO stuff is a maze and I missed the Linux uses a
"sync" before doing a read. Does the diff below fix things for you?
Index: dev/pci/drm/include/linux/io.h
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/include/linux/io.h,v
retrieving revision 1.3
diff -u -p -r1.3 io.h
--- dev/pci/drm/include/linux/io.h 26 Oct 2020 14:34:46 -0000 1.3
+++ dev/pci/drm/include/linux/io.h 29 Oct 2020 13:48:24 -0000
@@ -16,12 +16,18 @@
#define memcpy_fromio(d, s, n) memcpy(d, s, n)
#define memset_io(d, b, n) memset(d, b, n)
+#ifdef __powerpc__
+#define iobarrier() mb()
+#else
+#define iobarrier() barrier()
+#endif
+
static inline u8
ioread8(const volatile void __iomem *addr)
{
uint8_t val;
- barrier();
+ iobarrier();
val = *(volatile uint8_t *)addr;
rmb();
return val;
@@ -47,7 +53,7 @@ ioread16(const volatile void __iomem *ad
{
uint16_t val;
- barrier();
+ iobarrier();
val = *(volatile uint16_t *)addr;
rmb();
return val;
@@ -58,7 +64,7 @@ ioread32(const volatile void __iomem *ad
{
uint32_t val;
- barrier();
+ iobarrier();
val = *(volatile uint32_t *)addr;
rmb();
return val;
@@ -69,7 +75,7 @@ ioread64(const volatile void __iomem *ad
{
uint64_t val;
- barrier();
+ iobarrier();
val = *(volatile uint64_t *)addr;
rmb();
return val;
@@ -103,7 +109,7 @@ ioread16(const volatile void __iomem *ad
{
uint16_t val;
- barrier();
+ iobarrier();
val = lemtoh16(addr);
rmb();
return val;
@@ -114,7 +120,7 @@ ioread32(const volatile void __iomem *ad
{
uint32_t val;
- barrier();
+ iobarrier();
val = lemtoh32(addr);
rmb();
return val;
@@ -125,7 +131,7 @@ ioread64(const volatile void __iomem *ad
{
uint64_t val;
- barrier();
+ iobarrier();
val = lemtoh64(addr);
rmb();
return val;