From mboxrd@z Thu Jan 1 00:00:00 1970 From: Benjamin Herrenschmidt Subject: Re: [Bug #12608] 2.6.29-rc powerpc G5 Xorg legacy_mem regression Date: Sat, 07 Feb 2009 14:05:10 +1100 Message-ID: <1233975910.31963.56.camel@pasglop> References: <200902060849.45851.jbarnes@virtuousgeek.org> <200902061445.11379.jbarnes@virtuousgeek.org> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <200902061445.11379.jbarnes-Y1mF5jBUw70BENJcbMCuUQ@public.gmane.org> Sender: kernel-testers-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="us-ascii" To: Jesse Barnes Cc: Hugh Dickins , "Rafael J. Wysocki" , Linux Kernel Mailing List , Kernel Testers List On Fri, 2009-02-06 at 14:45 -0800, Jesse Barnes wrote: > + if (Base <= 1024*1024) { > + /* Try legacy_mem (may not be available or implemented) */ > + if ((fd = linuxOpenLegacy(dev, "legacy_mem")) < 0) { > + addr = mmap(NULL, Size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, Base); > + close(fd); > + if (addr && addr != MAP_FAILED) > + return addr; > + } > } > - return addr; > + > + /* Fall back to old method if legacy_mem fails or Base >= 1M */ > + return linuxMapPci(ScreenNum, Flags, dev, Base, Size, PCIIOC_MMAP_IS_MEM); > } I don't like the fallback if legacy_mem exists and returns an error, that's an indication that legacy memory is -not- available and thus whatever 'fallback' X will try (supposedly using /dev/mem) will be horribly broken and will probably end up scribbling all over system memory :-) Ben.