From mboxrd@z Thu Jan 1 00:00:00 1970 From: mroos@linux.ee Subject: Re: PCI Radeon RV100 detection hang on sparc64 Date: Mon, 23 Sep 2013 16:48:32 +0300 (EEST) Message-ID: References: <1346950551.30263.196.camel@thor.local> <20120906.141823.13429356729572330.davem@davemloft.net> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from smtp1.it.da.ut.ee (smtp1.it.da.ut.ee [193.40.5.66]) by gabe.freedesktop.org (Postfix) with ESMTP id 43E7CE6F65 for ; Mon, 23 Sep 2013 06:48:34 -0700 (PDT) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Dave Airlie Cc: sparclinux@vger.kernel.org, michel@daenzer.net, David Miller , dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org Resurrecting an old thread... > On Fri, Sep 7, 2012 at 4:18 AM, David Miller wrote: > > From: Michel D=E4nzer > > Date: Thu, 06 Sep 2012 18:55:51 +0200 > > > >> On Don, 2012-09-06 at 17:41 +0300, Meelis Roos wrote: > >>> This is with initialyy unmodified 3.6.0-rc4-00101-g0809095 kernel in > >>> Ultra 10 (clean, without my "Video RAM" hack that I talked in other > >>> sparclinux posts). When I saw that Sun XVR-100 was detected fine by t= he > >>> kernel, I compiled radeon drm driver with modesetting enabled and tri= ed > >>> it: > >>> > >>> [drm] radeon defaulting to kernel modesetting. > >>> [drm] radeon kernel modesetting enabled. > >>> PCI: Enabling device: (0000:02:02.0), cmd 82 > >>> [drm] initializing kernel modesetting (RV100 0x1002:0x5159 0x1002:0x0= 908). > >>> [drm] register mmio base: 0x10000000 > >>> [drm] register mmio size: 32768 > >>> [drm:radeon_device_init] *ERROR* Unable to find PCI I/O BAR > >>> > >>> And here the machine hangs. Debugging printk-s reveal that it does not > >>> find any active I/O port resources and then continues into initializi= ng > >>> the card. Down in igp_read_bios_from_vram() it successfully ioremaps > >>> memory region 0 (vram_base=3D1ff08000000 and size=3D40000) and tries = to read > >>> 2 bytes from there and hangs on reading bios[0]. > >> > >> Is the card initialized by OpenFirmware? E.g., does it display anything > >> before the kernel boots? > > > > I think Meelis gave you every single detail you need to know to > > analyze and fix this bug. > > > > He says it crashes on reading bios[0]. > > > > If you look at the function he tells you the crash occurs in, you'll > > see clearly that bios is an ioremap()'d pointer. > > > > You cannot dereference ioremap()'d pointers, you must use the proper > > accessors such as readl(). > = > we should just skip the igp reading function on not-x86, since IGP on > not x86 makes no sense. > = > the other option is to readl out the whole bios from vram instead. I made several changes. 1. In igp_read_bios_from_vram(): +#ifndef CONFIG_X86 + /* IGP only exists on X86 (32- and 64-bit) */ + return false; +#endif This gets me further. 2. Since "bios" is __iomem pointer, changed its dereferences to = readb(bios) and readb(bios+1). Maybe relevant, maybe not. 3. Next it got stuck in radeon_read_bios() trying to do kmemdup(bios, size, GFP_KERNEL); This I changed to mydup for test: +static void *mydup(uint8_t __iomem *src, size_t len, gfp_t gfp) +{ + unsigned char *p; + int i; + + p =3D kmalloc(len, gfp); + if (p) { + for (i=3D0; i