In: http://lists.freebsd.org/pipermail/freebsd-ppc/2014-April/006924.html I described a problem by which X.org cannot start on my PowerMac G5 using an NVIDIA card. At first sight, the xf86-video-nv seems to be broken under powerpc64. However, after a bit more digging, things appear way more broken than that because libpciaccess has an undefined behavior on all non-x86 platforms. This is why I'm filing this under ports and not under powerpc. Take a look at this stacktrace: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 51006400 (LWP 100425)] 0x00000000506557e4 in pci_io_read8 (handle=0x0, reg=10) at common_io.c:181 181 if (reg + 1 > handle->size) (gdb) bt #0 0x00000000506557e4 in pci_io_read8 (handle=0x0, reg=10) at common_io.c:181 #1 0x00000000516286a8 in stdReadST01 (hwp=0x510f2000) at vgaHW.c:212 #2 0x000000005162c61c in vgaHWSaveColormap (scrninfp=0x510e1400, save=0x510f2048) at vgaHW.c:1124 #3 0x000000005162c708 in vgaHWSave (scrninfp=0x510e1400, save=0x510f2048, flags=5) at vgaHW.c:1155 #4 0x00000000515bd734 in NVDACSave (pScrn=0x510e1400, vgaReg=0x510f2048, nvReg=0x510f1800, saveFonts=0) at nv_dac.c:311 #5 0x00000000515c4bdc in NVSave (pScrn=0x510e1400) at nv_driver.c:2662 #6 0x00000000515c4164 in NVScreenInit (scrnIndex=0, pScreen=0x510c7f00, argc=1, argv=0xffffffffffffdc18) at nv_driver.c:2430 #7 0x0000000010044b5c in AddScreen (pfnInit=@0x5160f778: 0x515c3f8c <NVScreenInit>, argc=1, argv=0xffffffffffffdc18) at dispatch.c:3797 #8 0x00000000100bfdf8 in InitOutput (pScreenInfo=0x10332b78 <screenInfo>, argc=1, argv=0xffffffffffffdc18) at xf86Init.c:834 #9 0x0000000010021be8 in main (argc=1, argv=0xffffffffffffdc18, envp=0xffffffffffffdc28) at main.c:203 which obviously tells us why the X.org server is crashing: we are dereferencing a null pointer, and that null handle comes from the libpciaccess library. The library is called on driver initialization to get a pointer to the PCI memory (open_legacy_io) and that call fails because of a missing implementation. The code later happily stores a null pointer and uses it without care. (First problem: nowhere in the code, the call to the open_legacy_io function below is checked for success.) The libpciaccess library has this gem: static struct pci_io_handle * pci_device_freebsd_open_legacy_io(struct pci_io_handle *ret, struct pci_device *dev, pciaddr_t base, pciaddr_t size) { #if defined(__i386__) || defined(__amd64__) ret->fd = open("/dev/io", O_RDWR | O_CLOEXEC); if (ret->fd < 0) return NULL; ret->base = base; ret->size = size; return ret; #elif defined(PCI_MAGIC_IO_RANGE) ret->memory = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, aperturefd, PCI_MAGIC_IO_RANGE + base); if (ret->memory == MAP_FAILED) return NULL; ret->base = base; ret->size = size; return ret; #else return NULL; #endif } Which, as far as I can tell, is *completely* wrong because FreeBSD does not define PCI_MAGIC_IO_RANGE (can't find mentions of it neither in current nor stable/10) and thus the fallback for non-x86 platforms cannot ever work (not to mention that aperturefd is not handled at all in the freebsd_pci.c file). As it turns out, the offending function was modified in: https://bugs.freedesktop.org/show_bug.cgi?id=63583 to apparently support non-x86 platforms. Yeah, right... How-To-Repeat: Attempt to start X on a non-x86 machine with the xf86-video-nv driver (or possibly any other driver). See the server crash. I'm unsure why this is failing now given that I think this used to work fine a few months ago only. Don't know what has changed. Maybe the new Xorg is triggering this, but no idea.
Responsible Changed From-To: freebsd-ports-bugs->freebsd-x11 Over to maintainer (via the GNATS Auto Assign Tool)
Nathan fixed this, it's a bug in the nVidia driver. You can find his patch at http://people.freebsd.org/~nwhitehorn/new_xorg_ppc.diff These really should go into ports, and I thought they had. I just now ran into this problem myself, after running just fine for a long time with that patch, and it turned out I had recompiled and those patches had been lost in the Xorg update. - Justin
There's a new version of this patch at http://anacreon.physics.berkeley.edu/~nwhitehorn/ppc64-ports.diff. It includes a few other bits to fix ports on PowerPC systems. -Nathan
Author: kwm Date: Thu May 29 19:32:08 2014 New Revision: 355734 URL: http://svnweb.freebsd.org/changeset/ports/355734 QAT: https://qat.redports.org/buildarchive/r355734/ Log: x11-drivers/xf86-video-ati: On other ARCH then i386/amd64 keep the old version. Since 7.x is KMS which is not available on the other ARCHS. x11-drivers/xf86-video-nv: Fix nv driver on ppc. x11-servers/xorg-server: In the powerpc case of NEW_XORG don't overwrite EXTRA_PATCHES. Patch update: < nathanw> it works around the change in behavior in libpciaccess that the PR mentions < nathanw> by porting the relevant code from the Linux backend PR: ports/188278 Submitted by: jmmv@, nwhitehorn@ Added: head/x11-drivers/xf86-video-nv/files/ head/x11-drivers/xf86-video-nv/files/patch-src-nv_driver.c (contents, props changed) Modified: head/x11-drivers/xf86-video-ati/Makefile head/x11-servers/xorg-server/Makefile head/x11-servers/xorg-server/files/extra-new-arch-powerpc Modified: head/x11-drivers/xf86-video-ati/Makefile ============================================================================== --- head/x11-drivers/xf86-video-ati/Makefile Thu May 29 19:29:18 2014 (r355733) +++ head/x11-drivers/xf86-video-ati/Makefile Thu May 29 19:32:08 2014 (r355734) @@ -14,7 +14,8 @@ USE_XORG= xf86driproto xineramaproto xf8 .include <bsd.port.options.mk> -.if ${OSVERSION} < 1000051 || !defined(WITH_NEW_XORG) +.if ${OSVERSION} < 1000051 || !defined(WITH_NEW_XORG) || \ + (${ARCH} != i386 && ${ARCH} != amd64) ATI_VERSION= 6.14.6 ATI_REVISION= 3 CONFIGURE_ARGS+=--disable-kms Added: head/x11-drivers/xf86-video-nv/files/patch-src-nv_driver.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/x11-drivers/xf86-video-nv/files/patch-src-nv_driver.c Thu May 29 19:32:08 2014 (r355734) @@ -0,0 +1,14 @@ +--- src/nv_driver.c.orig 2014-01-19 15:24:45.000000000 -0600 ++++ src/nv_driver.c 2014-01-19 15:24:07.000000000 -0600 +@@ -1543,7 +1543,11 @@ + xf86FreeInt10(pNv->pInt); + return FALSE; + } ++#ifdef __powerpc__ /* XXX probably MI */ ++ vgaHWSetMmioFuncs(VGAHWPTR(pScrn), pNv->IOAddress, 0); ++#else + vgaHWSetStdFuncs(VGAHWPTR(pScrn)); ++#endif + + /* We use a programmable clock */ + pScrn->progClock = TRUE; Modified: head/x11-servers/xorg-server/Makefile ============================================================================== --- head/x11-servers/xorg-server/Makefile Thu May 29 19:29:18 2014 (r355733) +++ head/x11-servers/xorg-server/Makefile Thu May 29 19:32:08 2014 (r355734) @@ -124,7 +124,7 @@ EXTRA_PATCHES+= ${FILESDIR}/extra-old-ar .if ${ARCH} == ia64 PLIST_SUB+= IA64_NA="@comment " -EXTRA_PATCHES= ${.CURDIR}/files/extra-arch-ia64 +EXTRA_PATCHES+= ${.CURDIR}/files/extra-arch-ia64 .else PLIST_SUB+= IA64_NA="" .endif @@ -132,9 +132,9 @@ PLIST_SUB+= IA64_NA="" .if ${ARCH} == powerpc || ${ARCH} == powerpc64 PLIST_SUB+= PPC_NA="@comment " .if defined(WITH_NEW_XORG) -EXTRA_PATCHES= ${.CURDIR}/files/extra-new-arch-powerpc +EXTRA_PATCHES+= ${.CURDIR}/files/extra-new-arch-powerpc .else -EXTRA_PATCHES= ${.CURDIR}/files/extra-old-arch-powerpc +EXTRA_PATCHES+= ${.CURDIR}/files/extra-old-arch-powerpc .endif .else PLIST_SUB+= PPC_NA="" Modified: head/x11-servers/xorg-server/files/extra-new-arch-powerpc ============================================================================== --- head/x11-servers/xorg-server/files/extra-new-arch-powerpc Thu May 29 19:29:18 2014 (r355733) +++ head/x11-servers/xorg-server/files/extra-new-arch-powerpc Thu May 29 19:32:08 2014 (r355734) @@ -1,6 +1,27 @@ ---- hw/xfree86/os-support/bsd/ppc_video.c.orig 2012-05-17 19:09:03.000000000 +0200 -+++ hw/xfree86/os-support/bsd/ppc_video.c 2013-06-03 13:46:05.165578200 +0200 -@@ -135,7 +135,11 @@ +--- ./hw/xfree86/os-support/bsd/ppc_video.c.orig 2012-05-17 12:09:03.000000000 -0500 ++++ ./hw/xfree86/os-support/bsd/ppc_video.c 2014-01-18 14:36:42.000000000 -0600 +@@ -115,17 +115,19 @@ + Bool + xf86EnableIO() + { +- int fd = xf86Info.consoleFd; ++ int fd = open(DEV_MEM, O_RDWR); + + xf86MsgVerb(X_WARNING, 3, "xf86EnableIO %d\n", fd); + if (ioBase == MAP_FAILED) { + ioBase = mmap(NULL, 0x10000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, + 0xf2000000); + xf86MsgVerb(X_INFO, 3, "xf86EnableIO: %08x\n", ioBase); ++#if 0 /* Non-fatal */ + if (ioBase == MAP_FAILED) { + xf86MsgVerb(X_WARNING, 3, "Can't map IO space!\n"); + return FALSE; + } ++#endif + } + return TRUE; + } +@@ -135,7 +137,11 @@ { if (ioBase != MAP_FAILED) { _______________________________________________ svn-ports-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-ports-all To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Author: kwm Date: Thu May 29 19:44:48 2014 New Revision: 355735 URL: http://svnweb.freebsd.org/changeset/ports/355735 QAT: https://qat.redports.org/buildarchive/r355735/ Log: Fix compile on ppc. PR: ports/188278 Submitted by: nwhitehorn@ Added: head/multimedia/vlc/files/patch-configure (contents, props changed) Added: head/multimedia/vlc/files/patch-configure ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/multimedia/vlc/files/patch-configure Thu May 29 19:44:48 2014 (r355735) @@ -0,0 +1,25 @@ +Index: multimedia/vlc/files/patch-configure +=================================================================== +--- multimedia/vlc/files/patch-configure (revision 0) ++++ multimedia/vlc/files/patch-configure (working copy) +@@ -0,0 +1,20 @@ ++--- configure.orig 2014-02-04 19:02:27.000000000 -0600 +++++ configure 2014-02-04 19:02:39.000000000 -0600 ++@@ -26703,7 +26703,7 @@ ++ if ac_fn_c_try_compile "$LINENO"; then : ++ ac_cv_altivec_inline="yes" ++ else ++- CFLAGS="${CFLAGS} -Wa,-m7400" +++ CFLAGS="${CFLAGS} -Wa,-maltivec" ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++ /* end confdefs.h. */ ++ ++@@ -26716,7 +26716,7 @@ ++ } ++ _ACEOF ++ if ac_fn_c_try_compile "$LINENO"; then : ++- ac_cv_altivec_inline="-Wa,-m7400" +++ ac_cv_altivec_inline="-Wa,-maltivec" ++ else ++ ac_cv_altivec_inline=no ++ fi _______________________________________________ svn-ports-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-ports-all To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
State Changed From-To: open->closed Committed nathan's patch, thanks!
Author: kwm Date: Thu May 29 19:47:43 2014 New Revision: 355739 URL: http://svnweb.freebsd.org/changeset/ports/355739 QAT: https://qat.redports.org/buildarchive/r355739/ Log: Fix compile on powerpc64. PR: ports/188278 Submitted by: nwhitehorn@ Modified: head/graphics/exiv2/Makefile Modified: head/graphics/exiv2/Makefile ============================================================================== --- head/graphics/exiv2/Makefile Thu May 29 19:47:41 2014 (r355738) +++ head/graphics/exiv2/Makefile Thu May 29 19:47:43 2014 (r355739) @@ -22,6 +22,12 @@ USE_LDCONFIG= yes CPPFLAGS+= -I${LOCALBASE}/include LDFLAGS+= -L${LOCALBASE}/lib +.include <bsd.port.options.mk> + +.if ${ARCH} == powerpc64 +CFLAGS+= -mminimal-toc +.endif + post-patch: @${REINPLACE_CMD} -e 's,LDFLAGS -no-undefined -lpsapi",& ;; \ dragonfly* | freebsd*),' ${WRKSRC}/configure _______________________________________________ svn-ports-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-ports-all To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"