Skip to contentSkip to conversation

ioctl32 warning on framebuffer

DISCUSSION Meelis Roos 3 participants 8 messages Jul 27, 2007 – Jul 30, 2007

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

Maybe related to the just solved X debugging problem, maybe not:

I booted todays git (d941cf5e) on my U5 and XOrg is set to autostart (the box is currently headless so I do not know whether it actually works). Anyway, XOrg startup gives these 2 lines to dmesg:

ioctl32(Xorg:1892): Unknown cmd fd(6) cmd(40584606){t:'F';sz:88} arg(ffdabb4c) on /dev/fb0 ioctl32(Xorg:1892): Unknown cmd fd(6) cmd(40184600){t:'F';sz:24} arg(ffdabb54) on /dev/fb0

Signature · 1 line
Meelis Roos ([email protected])
#1 lore raw

From: Meelis Roos <[email protected]>
Date: Fri, 27 Jul 2007 22:23:53 +0300 (EEST)

Quoted 8 lines

Maybe related to the just solved X debugging problem, maybe not:

I booted todays git (d941cf5e) on my U5 and XOrg is set to autostart (the box is currently headless so I do not know whether it actually works). Anyway, XOrg startup gives these 2 lines to dmesg:

ioctl32(Xorg:1892): Unknown cmd fd(6) cmd(40584606){t:'F';sz:88} arg(ffdabb4c) on /dev/fb0 ioctl32(Xorg:1892): Unknown cmd fd(6) cmd(40184600){t:'F';sz:24} arg(ffdabb54) on /dev/fb0

This has been there forever, I'll look at it again but I think it's one of those warnings that is hard to eliminate without a lot of internal pain implementation wise.

#2 lore raw
In reply to Meelis Roos

From: Meelis Roos <[email protected]>
Date: Fri, 27 Jul 2007 22:23:53 +0300 (EEST)

Quoted 2 lines

ioctl32(Xorg:1892): Unknown cmd fd(6) cmd(40584606){t:'F';sz:88} arg(ffdabb4c) on /dev/fb0 ioctl32(Xorg:1892): Unknown cmd fd(6) cmd(40184600){t:'F';sz:24} arg(ffdabb54) on /dev/fb0

Please give this patch a try:

drivers/video/sbuslib.c +0 -25
index 34ef859..963a454 100644
@@ -190,17 +190,6 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,
 EXPORT_SYMBOL(sbusfb_ioctl_helper);
 
 #ifdef CONFIG_COMPAT
-struct  fbcmap32 {
-	int             index;          /* first element (0 origin) */
-	int             count;
-	u32		red;
-	u32		green;
-	u32		blue;
-};
-
-#define FBIOPUTCMAP32	_IOW('F', 3, struct fbcmap32)
-#define FBIOGETCMAP32	_IOW('F', 4, struct fbcmap32)
-
 static int fbiogetputcmap(struct fb_info *info, unsigned int cmd, unsigned long arg)
 {
 	struct fbcmap32 __user *argp = (void __user *)arg;
@@ -223,20 +212,6 @@ static int fbiogetputcmap(struct fb_info *info, unsigned int cmd, unsigned long
 			(unsigned long)p);
 }
 
-struct fbcursor32 {
-	short set;		/* what to set, choose from the list above */
-	short enable;		/* cursor on/off */
-	struct fbcurpos pos;	/* cursor position */
-	struct fbcurpos hot;	/* cursor hot spot */
-	struct fbcmap32 cmap;	/* color map info */
-	struct fbcurpos size;	/* cursor bit map size */
-	u32	image;		/* cursor image bits */
-	u32	mask;		/* cursor mask bits */
-};
-
-#define FBIOSCURSOR32	_IOW('F', 24, struct fbcursor32)
-#define FBIOGCURSOR32	_IOW('F', 25, struct fbcursor32)
-
 static int fbiogscursor(struct fb_info *info, unsigned long arg)
 {
 	struct fbcursor __user *p = compat_alloc_user_space(sizeof(*p));
fs/compat_ioctl.c +20 -0
index e440a7b..2bc1428 100644
@@ -115,6 +115,10 @@
 #include <linux/dvb/video.h>
 #include <linux/lp.h>
 
+#ifdef CONFIG_SPARC
+#include <asm/fbio.h>
+#endif
+
 static int do_ioctl32_pointer(unsigned int fd, unsigned int cmd,
 			      unsigned long arg, struct file *f)
 {
@@ -3493,6 +3497,22 @@ IGNORE_IOCTL(VFAT_IOCTL_READDIR_SHORT32)
 
 /* loop */
 IGNORE_IOCTL(LOOP_CLR_FD)
+
+#ifdef CONFIG_SPARC
+/* Sparc framebuffers, handled in sbusfb_compat_ioctl() */
+IGNORE_IOCTL(FBIOGTYPE)
+IGNORE_IOCTL(FBIOSATTR)
+IGNORE_IOCTL(FBIOGATTR)
+IGNORE_IOCTL(FBIOSVIDEO)
+IGNORE_IOCTL(FBIOGVIDEO)
+IGNORE_IOCTL(FBIOSCURPOS)
+IGNORE_IOCTL(FBIOGCURPOS)
+IGNORE_IOCTL(FBIOGCURMAX)
+IGNORE_IOCTL(FBIOPUTCMAP32)
+IGNORE_IOCTL(FBIOGETCMAP32)
+IGNORE_IOCTL(FBIOSCURSOR32)
+IGNORE_IOCTL(FBIOGCURSOR32)
+#endif
 };
 
 #define IOCTL_HASHSIZE 256
include/asm-sparc64/fbio.h +28 -0
index 500026d..b9215a0 100644
@@ -2,6 +2,7 @@
 #define __LINUX_FBIO_H
 
 #include <linux/compiler.h>
+#include <linux/types.h>
 
 /* Constants used for fbio SunOS compatibility */
 /* (C) 1996 Miguel de Icaza */
@@ -299,4 +300,31 @@ struct fb_clut32 {
 #define LEO_LD_GBL_MAP         0x01009000
 #define LEO_UNK2_MAP           0x0100a000
 
+#ifdef __KERNEL__
+struct  fbcmap32 {
+	int             index;          /* first element (0 origin) */
+	int             count;
+	u32		red;
+	u32		green;
+	u32		blue;
+};
+
+#define FBIOPUTCMAP32	_IOW('F', 3, struct fbcmap32)
+#define FBIOGETCMAP32	_IOW('F', 4, struct fbcmap32)
+
+struct fbcursor32 {
+	short set;		/* what to set, choose from the list above */
+	short enable;		/* cursor on/off */
+	struct fbcurpos pos;	/* cursor position */
+	struct fbcurpos hot;	/* cursor hot spot */
+	struct fbcmap32 cmap;	/* color map info */
+	struct fbcurpos size;	/* cursor bit map size */
+	u32	image;		/* cursor image bits */
+	u32	mask;		/* cursor mask bits */
+};
+
+#define FBIOSCURSOR32	_IOW('F', 24, struct fbcursor32)
+#define FBIOGCURSOR32	_IOW('F', 25, struct fbcursor32)
+#endif
+
 #endif /* __LINUX_FBIO_H */
#3 lore raw
In reply to Meelis Roos
Quoted 4 lines
Quoted 2 lines

ioctl32(Xorg:1892): Unknown cmd fd(6) cmd(40584606){t:'F';sz:88} arg(ffdabb4c) on /dev/fb0 ioctl32(Xorg:1892): Unknown cmd fd(6) cmd(40184600){t:'F';sz:24} arg(ffdabb54) on /dev/fb0

Please give this patch a try:

The warnings are gone but I do not know whether X actually work since the box is headless in a rack and X runs only by accident (it rised its head again when I enabled atyfb compilation). Trying to run X by hand now gives

Fatal server error:
xf86MapPciMem: Could not mmap PCI memory [base=0xe2000000,hostbase=0xe2000000,size 00] (Inappropriate ioctl for device) but this could be because OF may have disabled the device (OF thinks
there is no monitor since the ID pins in VGA connector have appearantly broken -
but no visible brokenness).

lspci tells
01:02.0 VGA compatible controller: ATI Technologies Inc 3D Rage Pro 215GP (rev 5c) (prog-if 00 [VGA])
Control: I/O- Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping+ SERR- FastB2B-
Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Interrupt: pin A routed to IRQ 13
Region 0: Memory at 1ffe1000000 (32-bit, non-prefetchable) [sizeM]
Region 1: I/O ports at <unassigned> [disabled]
Region 2: Memory at 1ffe2000000 (32-bit, non-prefetchable) [size=4K]
Expansion ROM at <ignored> [disabled]

so the memory regions are at 1ffe1000000, not e2000000 - but maybe this is remapped automatically?

So, the warnings are gone but I don't know whether this could have broken X or not.

Signature · 1 line
Meelis Roos ([email protected])
#5 lore raw
In reply to Meelis Roos

From: Meelis Roos <[email protected]>
Date: Sun, 29 Jul 2007 19:32:47 +0300 (EEST)

Quoted 10 lines

The warnings are gone but I do not know whether X actually work since the box is headless in a rack and X runs only by accident (it rised its head again when I enabled atyfb compilation). Trying to run X by hand now gives

Fatal server error:
xf86MapPciMem: Could not mmap PCI memory [base=0xe2000000,hostbase=0xe2000000,size 00] (Inappropriate ioctl for device) but this could be because OF may have disabled the device (OF thinks
there is no monitor since the ID pins in VGA connector have appearantly broken -
but no visible brokenness).

There have been several patches posted recently which should cure X on sparc64, make sure you have them all applied. It could cause exactly this error.

In particular, I think you're hitting the fs/proc/inode.c bug fix I made which got checked into Linus's tree yesterday.

...

Quoted 2 lines

so the memory regions are at 1ffe1000000, not e2000000 - but maybe this is remapped automatically?

e20000000 is the PCI bus-centric address of the device, the larger address is the physical address.

X is using the correct address for the mmap().

#6 lore raw
In reply to Meelis Roos

From: Jim Watson <[email protected]>
Date: Mon, 30 Jul 2007 08:38:11 +1000

Quoted 8 lines
Quoted 4 lines · Meelis Roos

Fatal server error:
xf86MapPciMem: Could not mmap PCI memory [base=0xe2000000,hostbase=0xe2000000,size 00] (Inappropriate ioctl for device)

A similar error message was reported here:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bugB2077

Not similar at all, that bug is fixed by the patch at the end of this email.

Meelis's bug is more likely due to the procfs regression of ->compat_ioctl() handling that 2.6.23-rc1 had until yesterday.

commit 27997abfcb1f8bb534720b18f3487de3906c7ac6

Author: David S. Miller <[email protected]>
Date:   Wed Jul 25 23:30:16 2007 -0700

[SPARC64]: Fix sun4u PCI config space accesses on sun4u.

Don't provide fake PCI config space for sun4u.

Also, put back the funny host controller space handling that at least Sabre needs. You have to read PCI host controller registers at their nature size otherwise you get zeros instead of correct values.

arch/sparc64/kernel/pci.c +10 -5
index 55ad1b8..77449a0 100644
@@ -422,10 +422,15 @@ struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
 	dev->multifunction = 0;		/* maybe a lie? */
 
 	if (host_controller) {
-		dev->vendor = 0x108e;
-		dev->device = 0x8000;
-		dev->subsystem_vendor = 0x0000;
-		dev->subsystem_device = 0x0000;
+		if (tlb_type != hypervisor) {
+			pci_read_config_word(dev, PCI_VENDOR_ID,
+					     &dev->vendor);
+			pci_read_config_word(dev, PCI_DEVICE_ID,
+					     &dev->device);
+		} else {
+			dev->vendor = PCI_VENDOR_ID_SUN;
+			dev->device = 0x80f0;
+		}
 		dev->cfg_size = 256;
 		dev->class = PCI_CLASS_BRIDGE_HOST << 8;
 		sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus),
@@ -818,7 +823,7 @@ int pci_host_bridge_read_pci_cfg(struct pci_bus *bus_dev,
 {
 	static u8 fake_pci_config[] = {
 		0x8e, 0x10, /* Vendor: 0x108e (Sun) */
-		0x00, 0x80, /* Device: 0x8000 (PBM) */
+		0xf0, 0x80, /* Device: 0x80f0 (Fire) */
 		0x46, 0x01, /* Command: 0x0146 (SERR, PARITY, MASTER, MEM) */
 		0xa0, 0x22, /* Status: 0x02a0 (DEVSEL_MED, FB2B, 66MHZ) */
 		0x00, 0x00, 0x00, 0x06, /* Class: 0x06000000 host bridge */
arch/sparc64/kernel/pci_common.c +116 -7

153 lines not on this page · raw message

#7 lore raw
In reply to Meelis Roos
Quoted 6 lines

There have been several patches posted recently which should cure X on sparc64, make sure you have them all applied. It could cause exactly this error.

In particular, I think you're hitting the fs/proc/inode.c bug fix I made which got checked into Linus's tree yesterday.

Thanks for the explanation, I appled all the patches and Xorg seems to run fine (it's now tempting to get it from the rack and try if it can actually produce a image).

Signature · 1 line
Meelis Roos ([email protected])