Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-26 Thread Paweł Sikora
On Thursday 25 of October 2012 20:06:54 Heinz Diehl wrote:
> On 25.10.2012, Pawe? Sikora wrote: 
> 
> > what is the reason of loading nouveau driver for laptops 
> > with nvidia optimus and enabling vga switcheroo
> > which doesn't work in such (optimus) cases.
> 
> You can safely compile a kernel without nouveau, your Nvidia 
> card will not be used at all since neither Linux nor the 
> proprietary nvidia driver does support optimus at this time
> (and frankly, I won't buy any further machines with opticrap).
> So having nouveau compiled and loaded seems like a waste of ressources
> in this case.

i've bought this asus laptop mostly for a developer's workstation replacement
(quad-core-i7-avx cpu with integrated gpu, with 12GB ram and 2x500GB hdd).
nvidia's addon is an optional crap :)

> For me it's important to have nouveau working, because I try/use
> Bumblebee and optirun: 
> 
> http://bumblebee-project.org/
> https://fedoraproject.org/wiki/Bumblebee

i'll try to use transformers too :-)



Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-26 Thread Paweł Sikora
On Thursday 25 of October 2012 20:06:54 Heinz Diehl wrote:
> On 25.10.2012, Paweł Sikora wrote: 
> 
> > what is the reason of loading nouveau driver for laptops 
> > with nvidia optimus and enabling vga switcheroo
> > which doesn't work in such (optimus) cases.
> 
> You can safely compile a kernel without nouveau, your Nvidia 
> card will not be used at all since neither Linux nor the 
> proprietary nvidia driver does support optimus at this time
> (and frankly, I won't buy any further machines with opticrap).
> So having nouveau compiled and loaded seems like a waste of ressources
> in this case.

i've bought this asus laptop mostly for a developer's workstation replacement
(quad-core-i7-avx cpu with integrated gpu, with 12GB ram and 2x500GB hdd).
nvidia's addon is an optional crap :)

> For me it's important to have nouveau working, because I try/use
> Bumblebee and optirun: 
> 
> http://bumblebee-project.org/
> https://fedoraproject.org/wiki/Bumblebee

i'll try to use transformers too :-)

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-25 Thread Heinz Diehl
On 25.10.2012, Pawe? Sikora wrote: 

> what is the reason of loading nouveau driver for laptops 
> with nvidia optimus and enabling vga switcheroo
> which doesn't work in such (optimus) cases.

You can safely compile a kernel without nouveau, your Nvidia 
card will not be used at all since neither Linux nor the 
proprietary nvidia driver does support optimus at this time
(and frankly, I won't buy any further machines with opticrap).
So having nouveau compiled and loaded seems like a waste of ressources
in this case.

For me it's important to have nouveau working, because I try/use
Bumblebee and optirun: 

http://bumblebee-project.org/
https://fedoraproject.org/wiki/Bumblebee



Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-25 Thread Paweł Sikora
On Saturday 20 of October 2012 11:40:04 Martin Peres wrote:
> On 20/10/2012 11:26, Heinz Diehl wrote:
> > On 20.10.2012, Linus Torvalds wrote:
> >
> >> Added more appropriate people to this. Added both i915 and nouveau
> >> people, since apparently that fine piece of hardware has both.
> >>
> >> Guys, any ideas?
> >
> > Plese see https://lkml.org/lkml/2012/10/19/371 , this is the same
> > thing going on. Reverting
> >
> >   Ben Skeggs 
> >   drm/nouveau/bios: fix shadowing of ACPI ROMs larger than 64KiB
> >
> > fixes the problem.
> 
> Can you test the attached patch too ? I rebased the previous one I sent 
> on top on 3.7-rc1 as I accidentally used an older version.
> 
> Martin

Hi all once again,

i've tested current 3.7.0-rc2-00145-g4864ccb and it works fine (boots and works
with builtin core-i7 intel video) but i have one more question - what is the 
reason
of loading nouveau driver for laptops with nvidia optimus and enabling vga 
switcheroo
which doesn't work in such (optimus) cases. or maybe i've missed something
and switchereoo works with optimus?

BR,
Pawe?.



Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-25 Thread Heinz Diehl
On 25.10.2012, Paweł Sikora wrote: 

> what is the reason of loading nouveau driver for laptops 
> with nvidia optimus and enabling vga switcheroo
> which doesn't work in such (optimus) cases.

You can safely compile a kernel without nouveau, your Nvidia 
card will not be used at all since neither Linux nor the 
proprietary nvidia driver does support optimus at this time
(and frankly, I won't buy any further machines with opticrap).
So having nouveau compiled and loaded seems like a waste of ressources
in this case.

For me it's important to have nouveau working, because I try/use
Bumblebee and optirun: 

http://bumblebee-project.org/
https://fedoraproject.org/wiki/Bumblebee

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-25 Thread Paweł Sikora
On Saturday 20 of October 2012 11:40:04 Martin Peres wrote:
> On 20/10/2012 11:26, Heinz Diehl wrote:
> > On 20.10.2012, Linus Torvalds wrote:
> >
> >> Added more appropriate people to this. Added both i915 and nouveau
> >> people, since apparently that fine piece of hardware has both.
> >>
> >> Guys, any ideas?
> >
> > Plese see https://lkml.org/lkml/2012/10/19/371 , this is the same
> > thing going on. Reverting
> >
> >   Ben Skeggs 
> >   drm/nouveau/bios: fix shadowing of ACPI ROMs larger than 64KiB
> >
> > fixes the problem.
> 
> Can you test the attached patch too ? I rebased the previous one I sent 
> on top on 3.7-rc1 as I accidentally used an older version.
> 
> Martin

Hi all once again,

i've tested current 3.7.0-rc2-00145-g4864ccb and it works fine (boots and works
with builtin core-i7 intel video) but i have one more question - what is the 
reason
of loading nouveau driver for laptops with nvidia optimus and enabling vga 
switcheroo
which doesn't work in such (optimus) cases. or maybe i've missed something
and switchereoo works with optimus?

BR,
Paweł.

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-22 Thread Ben Skeggs
On Sun, 2012-10-21 at 00:19 +0200, Marcin Slusarz wrote:
> On Sat, Oct 20, 2012 at 11:20:36PM +0200, Heinz Diehl wrote:
> > On 20.10.2012, Marcin Slusarz wrote: 
> > 
> > > Try this one.
> > 
> > It works, now I can boot again. However, nouveau seems to be dead now.
> > The dmesg output with your patch on top of 3.7-rc1 is:
> > 
> > [3.685909] [drm] Initialized i915 1.6.0 20080730 for :00:02.0 on 
> > minor 0
> > [3.687784] nouveau  [  DEVICE][:01:00.0] BOOT0  : 0x0a8800b1
> > [3.689960] nouveau  [  DEVICE][:01:00.0] Chipset: GT218 (NVA8)
> > [3.692471] nouveau  [  DEVICE][:01:00.0] Family : NV50
> > [3.695716] nouveau  [   VBIOS][:01:00.0] checking PRAMIN for 
> > image...
> > [3.697087] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.698471] nouveau  [   VBIOS][:01:00.0] checking PROM for image...
> > [3.699838] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.701223] nouveau  [   VBIOS][:01:00.0] checking ACPI for image...
> > [3.702684] ACPI Error: Field [ROMI] Base+Offset+Width 0+24+1 is beyond 
> > end of region [VROM] (length 24) (20120913/exfldio-210)
> > [3.704139] ACPI Error: Method parse/execution 
> > failed[\_SB_.PCI0.PEG1.GFX0._ROM] (Node 880142e85cf8), 
> > AE_AML_REGION_LIMIT (20120913/psparse-536)
> > [3.716183] failed to evaluate ROM got AE_AML_REGION_LIMIT
> > [3.718776] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.721349] nouveau  [   VBIOS][:01:00.0] checking PCIROM for 
> > image...
> > [3.724111] nouveau :01:00.0: Invalid ROM contents
> > [3.726663] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.729159] nouveau E[   VBIOS][:01:00.0] unable to locate usable 
> > image
> > [3.731677] nouveau E[  DEVICE][:01:00.0] failed to create 
> > 0x1001, -22
> > [3.734231] nouveau E[ DRM] failed to create 0x8080, -22
> > [3.736097] nouveau: probe of :01:00.0 failed with error -22
> > [3.740523] dracut: Starting plymouth daemon
> 
> Hmm, maybe we can't fetch 3 bytes only...
Yeah, I noticed this issue myself on a machine here while backporting
the patch to another (older) kernel.  I assumed (wrongly, apparently)
that there was just a bug in the older kernel's ACPI implementation that
had been fixed upstream already (I didn't see it on the same machine
with the current kernel)...  So, I didn't send the patch.

I'll queue it up with a -fixes batch later today.

Sorry about the trouble,
Ben.

> 
> Let's check this:
> 
> ---
> diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c 
> b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> index 824eea0..8bd71aa 100644
> --- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> @@ -192,14 +192,16 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios)
>  {
>   struct pci_dev *pdev = nv_device(bios)->pdev;
>   int ret, cnt, i;
> - u8  data[3];
> + u8  *data;
>  
>   if (!nouveau_acpi_rom_supported(pdev))
>   return;
>  
>   bios->size = 0;
> - if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3)
> + data = kmalloc(4096, GFP_KERNEL);
> + if (data && nouveau_acpi_get_bios_chunk(data, 0, 4096) >= 3)
>   bios->size = data[2] * 512;
> + kfree(data);
>   if (!bios->size)
>   return;
>  
> ---
> 
> Please attach acpidump output.




Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Lekensteyn
On Sunday 21 October 2012 16:49:08 Marcin Slusarz wrote:
> On Sun, Oct 21, 2012 at 07:38:58AM -0700, Linus Torvalds wrote:
> > On Sun, Oct 21, 2012 at 5:09 AM, Marcin Slusarz
> > 
> >  wrote:
> > > This looks like ACPI bug...
> >
> > I'm shocked to hear that firmware would be fragile.
> >
> > Anyway, here's the #1 thing to keep in mind about firmware:
> > 
> >  - firmware is always buggy.
> 
> I know. But this bug is not about broken firmware. It's about Linux kernel
> ACPI implementation, which (I think) wrongly interprets ACPI script.

The ACPI implementation is fine, it is just the fw engineers that suck. I see I 
have not cc'd the linux-vger ml when replying to a previous mail. I'll paste 
it below:

Since commit 9a334cd "drm/nouveau/bios: fix shadowing of ACPI ROMs larger than 
64KiB" chunks are not always read in multiples of 4KiB anymore (less is 
possible). That is the only obvious thing I can think of atm (besides the 
kmalloc(0) bug for which Martin submitted a patch in the previous mail).

Do you still still have an Asus laptop with the same BIOS as in 
https://bugzilla.kernel.org/show_bug.cgi?id=19702? (if yes, then the acpidump 
from that bug still applies).

This is the ACPI _ROM method that is being called:
Method (_ROM, 2, NotSerialized)  // _ROM: Read-Only Memory
{
Add (Arg0, RBUF, Local0)
ShiftLeft (Arg1, 0x03, Local1) // times 8, bytes to bits?
Name (VBUF, Buffer (Arg1) {}) 
OperationRegion (VROM, SystemMemory, Local0, Local1)
Field (VROM, ByteAcc, NoLock, Preserve)
{   
ROMI,   65536
}   

Store (ROMI, VBUF)
Return (VBUF)
}

Arg0 is the offset (0 when first reading the size), Arg1 is the number of read 
bytes (3). Note the use of Local1 in OperationRegion. The meaning there is 
bytes, but a multiple of the requested bytes is passed. So if we request 4096 
bytes, we end up with a VROM of size 32KiB. ROMI is 65536 bits (or 8192 
bytes), hence reading 4096 does not give errors. But reading only 3 bytes will 
fail. Martin, I saw your second patch (https://lkml.org/lkml/2012/10/20/150) 
which takes care of the first case, but it skips the case where the ROM is of 
an odd size (does that even happen, something like 64KiB+1 bytes? No idea.)

Addition: Conclusion: this means that the request must have a length must be 
at least 1 KiB or it will fail with the ACPI error that you have seen before. 
This AML snippet suck.

Regards,
Peter
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Lekensteyn
On Sunday 21 October 2012 16:49:08 Marcin Slusarz wrote:
> On Sun, Oct 21, 2012 at 07:38:58AM -0700, Linus Torvalds wrote:
> > On Sun, Oct 21, 2012 at 5:09 AM, Marcin Slusarz
> > 
> >  wrote:
> > > This looks like ACPI bug...
> >
> > I'm shocked to hear that firmware would be fragile.
> >
> > Anyway, here's the #1 thing to keep in mind about firmware:
> > 
> >  - firmware is always buggy.
> 
> I know. But this bug is not about broken firmware. It's about Linux kernel
> ACPI implementation, which (I think) wrongly interprets ACPI script.

The ACPI implementation is fine, it is just the fw engineers that suck. I see I 
have not cc'd the linux-vger ml when replying to a previous mail. I'll paste 
it below:

Since commit 9a334cd "drm/nouveau/bios: fix shadowing of ACPI ROMs larger than 
64KiB" chunks are not always read in multiples of 4KiB anymore (less is 
possible). That is the only obvious thing I can think of atm (besides the 
kmalloc(0) bug for which Martin submitted a patch in the previous mail).

Do you still still have an Asus laptop with the same BIOS as in 
https://bugzilla.kernel.org/show_bug.cgi?id=19702? (if yes, then the acpidump 
from that bug still applies).

This is the ACPI _ROM method that is being called:
Method (_ROM, 2, NotSerialized)  // _ROM: Read-Only Memory
{
Add (Arg0, RBUF, Local0)
ShiftLeft (Arg1, 0x03, Local1) // times 8, bytes to bits?
Name (VBUF, Buffer (Arg1) {}) 
OperationRegion (VROM, SystemMemory, Local0, Local1)
Field (VROM, ByteAcc, NoLock, Preserve)
{   
ROMI,   65536
}   

Store (ROMI, VBUF)
Return (VBUF)
}

Arg0 is the offset (0 when first reading the size), Arg1 is the number of read 
bytes (3). Note the use of Local1 in OperationRegion. The meaning there is 
bytes, but a multiple of the requested bytes is passed. So if we request 4096 
bytes, we end up with a VROM of size 32KiB. ROMI is 65536 bits (or 8192 
bytes), hence reading 4096 does not give errors. But reading only 3 bytes will 
fail. Martin, I saw your second patch (https://lkml.org/lkml/2012/10/20/150) 
which takes care of the first case, but it skips the case where the ROM is of 
an odd size (does that even happen, something like 64KiB+1 bytes? No idea.)

Addition: Conclusion: this means that the request must have a length must be 
at least 1 KiB or it will fail with the ACPI error that you have seen before. 
This AML snippet suck.

Regards,
Peter


Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Linus Torvalds
On Sun, Oct 21, 2012 at 5:49 PM, Marcin Slusarz
 wrote:
>
> I know. But this bug is not about broken firmware. It's about Linux kernel
> ACPI implementation, which (I think) wrongly interprets ACPI script.

Hmm. Len, care to comment? Marcin quoted the AML and our arguments in
an earlier thing. I don't read AML, so I was assuming it's the AML
itself that was buggy, not our interpretation of it..

   Linus


Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Ben Skeggs
On Sun, 2012-10-21 at 00:19 +0200, Marcin Slusarz wrote:
> On Sat, Oct 20, 2012 at 11:20:36PM +0200, Heinz Diehl wrote:
> > On 20.10.2012, Marcin Slusarz wrote: 
> > 
> > > Try this one.
> > 
> > It works, now I can boot again. However, nouveau seems to be dead now.
> > The dmesg output with your patch on top of 3.7-rc1 is:
> > 
> > [3.685909] [drm] Initialized i915 1.6.0 20080730 for :00:02.0 on 
> > minor 0
> > [3.687784] nouveau  [  DEVICE][:01:00.0] BOOT0  : 0x0a8800b1
> > [3.689960] nouveau  [  DEVICE][:01:00.0] Chipset: GT218 (NVA8)
> > [3.692471] nouveau  [  DEVICE][:01:00.0] Family : NV50
> > [3.695716] nouveau  [   VBIOS][:01:00.0] checking PRAMIN for 
> > image...
> > [3.697087] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.698471] nouveau  [   VBIOS][:01:00.0] checking PROM for image...
> > [3.699838] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.701223] nouveau  [   VBIOS][:01:00.0] checking ACPI for image...
> > [3.702684] ACPI Error: Field [ROMI] Base+Offset+Width 0+24+1 is beyond 
> > end of region [VROM] (length 24) (20120913/exfldio-210)
> > [3.704139] ACPI Error: Method parse/execution 
> > failed[\_SB_.PCI0.PEG1.GFX0._ROM] (Node 880142e85cf8), 
> > AE_AML_REGION_LIMIT (20120913/psparse-536)
> > [3.716183] failed to evaluate ROM got AE_AML_REGION_LIMIT
> > [3.718776] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.721349] nouveau  [   VBIOS][:01:00.0] checking PCIROM for 
> > image...
> > [3.724111] nouveau :01:00.0: Invalid ROM contents
> > [3.726663] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.729159] nouveau E[   VBIOS][:01:00.0] unable to locate usable 
> > image
> > [3.731677] nouveau E[  DEVICE][:01:00.0] failed to create 
> > 0x1001, -22
> > [3.734231] nouveau E[ DRM] failed to create 0x8080, -22
> > [3.736097] nouveau: probe of :01:00.0 failed with error -22
> > [3.740523] dracut: Starting plymouth daemon
> 
> Hmm, maybe we can't fetch 3 bytes only...
Yeah, I noticed this issue myself on a machine here while backporting
the patch to another (older) kernel.  I assumed (wrongly, apparently)
that there was just a bug in the older kernel's ACPI implementation that
had been fixed upstream already (I didn't see it on the same machine
with the current kernel)...  So, I didn't send the patch.

I'll queue it up with a -fixes batch later today.

Sorry about the trouble,
Ben.

> 
> Let's check this:
> 
> ---
> diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c 
> b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> index 824eea0..8bd71aa 100644
> --- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> @@ -192,14 +192,16 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios)
>  {
>   struct pci_dev *pdev = nv_device(bios)->pdev;
>   int ret, cnt, i;
> - u8  data[3];
> + u8  *data;
>  
>   if (!nouveau_acpi_rom_supported(pdev))
>   return;
>  
>   bios->size = 0;
> - if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3)
> + data = kmalloc(4096, GFP_KERNEL);
> + if (data && nouveau_acpi_get_bios_chunk(data, 0, 4096) >= 3)
>   bios->size = data[2] * 512;
> + kfree(data);
>   if (!bios->size)
>   return;
>  
> ---
> 
> Please attach acpidump output.


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Marcin Slusarz
On Sun, Oct 21, 2012 at 07:38:58AM -0700, Linus Torvalds wrote:
> On Sun, Oct 21, 2012 at 5:09 AM, Marcin Slusarz
>  wrote:
> >
> > This looks like ACPI bug...
> 
> I'm _shocked_ to hear that firmware would be fragile.
> 
> Anyway, here's the #1 thing to keep in mind about firmware:
> 
>  - firmware is *always* buggy.

I know. But this bug is not about broken firmware. It's about Linux kernel
ACPI implementation, which (I think) wrongly interprets ACPI script.

Marcin


Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Heinz Diehl
On 21.10.2012, Marcin Slusarz wrote: 

> > > Please attach acpidump output.
> > 
> > http://pluto.agmk.net/nv/acpidump.txt
> > 
> 
> This looks like ACPI bug...

I guess my acpidump didn't make it to the list. Anyway, here it is:

http://www.fritha.org/acpidump.gz



Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Marcin Slusarz
On Sun, Oct 21, 2012 at 08:58:07AM +0200, Pawe? Sikora wrote:
> On Sunday 21 of October 2012 00:19:48 Marcin Slusarz wrote:
> > On Sat, Oct 20, 2012 at 11:20:36PM +0200, Heinz Diehl wrote:
> > > On 20.10.2012, Marcin Slusarz wrote: 
> > > 
> > > > Try this one.
> > > 
> > > It works, now I can boot again. However, nouveau seems to be dead now.
> > > The dmesg output with your patch on top of 3.7-rc1 is:
> > > 
> > > [3.685909] [drm] Initialized i915 1.6.0 20080730 for :00:02.0 on 
> > > minor 0
> > > [3.687784] nouveau  [  DEVICE][:01:00.0] BOOT0  : 0x0a8800b1
> > > [3.689960] nouveau  [  DEVICE][:01:00.0] Chipset: GT218 (NVA8)
> > > [3.692471] nouveau  [  DEVICE][:01:00.0] Family : NV50
> > > [3.695716] nouveau  [   VBIOS][:01:00.0] checking PRAMIN for 
> > > image...
> > > [3.697087] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > > [3.698471] nouveau  [   VBIOS][:01:00.0] checking PROM for 
> > > image...
> > > [3.699838] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > > [3.701223] nouveau  [   VBIOS][:01:00.0] checking ACPI for 
> > > image...
> > > [3.702684] ACPI Error: Field [ROMI] Base+Offset+Width 0+24+1 is 
> > > beyond end of region [VROM] (length 24) (20120913/exfldio-210)
> > > [3.704139] ACPI Error: Method parse/execution 
> > > failed[\_SB_.PCI0.PEG1.GFX0._ROM] (Node 880142e85cf8), 
> > > AE_AML_REGION_LIMIT (20120913/psparse-536)
> > > [3.716183] failed to evaluate ROM got AE_AML_REGION_LIMIT
> > > [3.718776] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > > [3.721349] nouveau  [   VBIOS][:01:00.0] checking PCIROM for 
> > > image...
> > > [3.724111] nouveau :01:00.0: Invalid ROM contents
> > > [3.726663] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > > [3.729159] nouveau E[   VBIOS][:01:00.0] unable to locate usable 
> > > image
> > > [3.731677] nouveau E[  DEVICE][:01:00.0] failed to create 
> > > 0x1001, -22
> > > [3.734231] nouveau E[ DRM] failed to create 0x8080, -22
> > > [3.736097] nouveau: probe of :01:00.0 failed with error -22
> > > [3.740523] dracut: Starting plymouth daemon
> > 
> > Hmm, maybe we can't fetch 3 bytes only...
> > 
> > Let's check this:
> > 
> > ---
> > diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c 
> > b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> > index 824eea0..8bd71aa 100644
> > --- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> > +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> > @@ -192,14 +192,16 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios)
> >  {
> > struct pci_dev *pdev = nv_device(bios)->pdev;
> > int ret, cnt, i;
> > -   u8  data[3];
> > +   u8  *data;
> >  
> > if (!nouveau_acpi_rom_supported(pdev))
> > return;
> >  
> > bios->size = 0;
> > -   if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3)
> > +   data = kmalloc(4096, GFP_KERNEL);
> > +   if (data && nouveau_acpi_get_bios_chunk(data, 0, 4096) >= 3)
> > bios->size = data[2] * 512;
> > +   kfree(data);
> > if (!bios->size)
> > return;
> 
> with these both patches applied my laptop boots and gui works fine.
> here's dmesg:
> 
> (...)
> [8.751795] nouveau  [   VBIOS][:01:00.0] ... appears to be valid
> [8.751798] nouveau  [   VBIOS][:01:00.0] using image from ACPI
> [8.751895] nouveau  [   VBIOS][:01:00.0] BIT signature found
> [8.751898] nouveau  [   VBIOS][:01:00.0] version 70.08.45.00
> [8.752366] nouveau  [ DEVINIT][:01:00.0] adaptor not initialised
> [8.752368] nouveau  [   VBIOS][:01:00.0] running init tables
> [8.867660] nouveau  [ MXM][:01:00.0] no VBIOS data, nothing to do
> [8.867690] nouveau  [ PFB][:01:00.0] RAM type: DDR3
> [8.867692] nouveau  [ PFB][:01:00.0] RAM size: 512 MiB
> [8.901523] vga_switcheroo: enabled
> [8.901979] [TTM] Zone  kernel: Available graphics memory: 6104282 kiB
> [8.901980] [TTM] Zone   dma32: Available graphics memory: 2097152 kiB
> [8.901982] [TTM] Initializing pool allocator
> [8.902014] [TTM] Initializing DMA pool allocator
> [8.902180] mtrr: type mismatch for c000,1000 old: write-back new: 
> write-combining
> [8.902184] nouveau  [ DRM] VRAM: 512 MiB
> [8.902185] nouveau  [ DRM] GART: 512 MiB
> [8.902188] nouveau  [ DRM] BIT BIOS found
> [8.902190] nouveau  [ DRM] Bios version 70.08.45.00
> [8.902192] nouveau  [ DRM] TMDS table version 2.0
> [8.902194] nouveau  [ DRM] DCB version 4.0
> [8.902196] nouveau  [ DRM] DCB outp 00: 02011300 
> [8.902198] nouveau  [ DRM] DCB conn 01: 0100
> [8.903540] [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
> [8.903541] [drm] No driver support for vblank timestamp query.
> [8.903545] nouveau  [ DRM] ACPI backlight

Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Heinz Diehl
On 21.10.2012, Marcin Slusarz wrote: 

> > > Please attach acpidump output.
> > 
> > http://pluto.agmk.net/nv/acpidump.txt
> > 
> 
> This looks like ACPI bug...

I guess my acpidump didn't make it to the list. Anyway, here it is:

http://www.fritha.org/acpidump.gz

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Heinz Diehl
On 21.10.2012, Paweł Sikora wrote: 

> with these both patches applied my laptop boots and gui works fine.

The same here. The two patches together, applied to 3.7-rc1 let my
machine boot again. Here's the relevant dmesg cut:

[3.702671] nouveau  [  DEVICE][:01:00.0] BOOT0  : 0x0a8800b1
[3.704643] nouveau  [  DEVICE][:01:00.0] Chipset: GT218 (NVA8)
[3.707003] nouveau  [  DEVICE][:01:00.0] Family : NV50
[3.711393] nouveau  [   VBIOS][:01:00.0] checking PRAMIN for image...
[3.712793] nouveau  [   VBIOS][:01:00.0] ... signature not found
[3.714147] nouveau  [   VBIOS][:01:00.0] checking PROM for image...
[3.715578] nouveau  [   VBIOS][:01:00.0] ... signature not found
[3.716969] nouveau  [   VBIOS][:01:00.0] checking ACPI for image...
[4.207512] nouveau  [   VBIOS][:01:00.0] ... appears to be valid
[4.209711] nouveau  [   VBIOS][:01:00.0] using image from ACPI
[4.212469] nouveau  [   VBIOS][:01:00.0] BIT signature found
[4.214855] nouveau  [   VBIOS][:01:00.0] version 70.18.5d.00
[4.217554] nouveau  [ DEVINIT][:01:00.0] adaptor not initialised
[4.219922] nouveau  [   VBIOS][:01:00.0] running init tables
[4.342202] nouveau  [ MXM][:01:00.0] no VBIOS data, nothing to do
[4.343590] nouveau  [ PFB][:01:00.0] RAM type: DDR3
[4.344916] nouveau  [ PFB][:01:00.0] RAM size: 1024 MiB
[4.991887] vga_switcheroo: enabled
[4.993495] [TTM] Zone  kernel: Available graphics memory: 1917720 kiB
[4.994911] [TTM] Initializing pool allocator
[4.996228] [TTM] Initializing DMA pool allocator
[4.998915] nouveau  [ DRM] VRAM: 1024 MiB
[5.000251] nouveau  [ DRM] GART: 512 MiB
[5.001579] nouveau  [ DRM] BIT BIOS found
[5.002904] nouveau  [ DRM] Bios version 70.18.5d.00
[5.004229] nouveau  [ DRM] TMDS table version 2.0
[5.005545] nouveau  [ DRM] DCB version 4.0
[5.006810] nouveau  [ DRM] DCB outp 00: 02014300 
[5.008115] nouveau  [ DRM] DCB conn 00: 0040
[5.009441] nouveau  [ DRM] DCB conn 01: 00410146
[5.010745] nouveau  [ DRM] DCB conn 02: 1261
[5.012019] nouveau  [ DRM] DCB conn 03: 2330
[5.013255] nouveau  [ DRM] DCB conn 04: 0400
[5.014452] nouveau  [ DRM] DCB conn 05: 0560
[5.052344] [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
[5.053486] [drm] No driver support for vblank timestamp query.
[5.054590] nouveau  [ DRM] ACPI backlight interface available,not 
registering our own
[5.356822] nouveau  [ DRM] 3 available performance level(s)
[5.358682] nouveau  [ DRM] 0: core 135MHz shader 270MHz memory 135MHz 
voltage 850mV
[5.360442] nouveau  [ DRM] 1: core 405MHz shader 810MHz memory 405MHz 
voltage 850mV
[5.362215] nouveau  [ DRM] 3: core 606MHz shader 1468MHz memory 667MHz 
voltage 1000mV
[5.363998] nouveau  [ DRM] c: core 405MHz shader 810MHz memory 405MHz
[5.404143] nouveau  [ DRM] MM: using COPY for buffer copies
[5.481593] No connectors reported connected with modes
[5.482667] [drm] Cannot find any crtc or sizes - going 1024x768
[5.517932] nouveau  [ DRM] allocated 1024x768 fb: 0x7, bo 
88013a6d3400
[5.519236] fb1: nouveaufb frame buffer device
[5.520368] [drm] Initialized nouveau 1.1.0 20120801 for :01:00.0 on 
minor 1
[5.527378] dracut: Starting plymouth daemon

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Heinz Diehl
On 21.10.2012, Marcin Slusarz wrote: 

> On 3.6 kernel? (It doesn't exist on 3.7)
> Note that it may be in other directory than "0".

[root@wildsau linux-3.6.2]# cat .config | grep -i "nouveau"
CONFIG_DRM_NOUVEAU=m
CONFIG_DRM_NOUVEAU_BACKLIGHT=y
CONFIG_DRM_NOUVEAU_DEBUG=y

I grepped the whole disk, there's no vbios.rom at all.

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Paweł Sikora
On Sunday 21 of October 2012 00:19:48 Marcin Slusarz wrote:
> On Sat, Oct 20, 2012 at 11:20:36PM +0200, Heinz Diehl wrote:
> > On 20.10.2012, Marcin Slusarz wrote: 
> > 
> > > Try this one.
> > 
> > It works, now I can boot again. However, nouveau seems to be dead now.
> > The dmesg output with your patch on top of 3.7-rc1 is:
> > 
> > [3.685909] [drm] Initialized i915 1.6.0 20080730 for :00:02.0 on 
> > minor 0
> > [3.687784] nouveau  [  DEVICE][:01:00.0] BOOT0  : 0x0a8800b1
> > [3.689960] nouveau  [  DEVICE][:01:00.0] Chipset: GT218 (NVA8)
> > [3.692471] nouveau  [  DEVICE][:01:00.0] Family : NV50
> > [3.695716] nouveau  [   VBIOS][:01:00.0] checking PRAMIN for 
> > image...
> > [3.697087] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.698471] nouveau  [   VBIOS][:01:00.0] checking PROM for image...
> > [3.699838] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.701223] nouveau  [   VBIOS][:01:00.0] checking ACPI for image...
> > [3.702684] ACPI Error: Field [ROMI] Base+Offset+Width 0+24+1 is beyond 
> > end of region [VROM] (length 24) (20120913/exfldio-210)
> > [3.704139] ACPI Error: Method parse/execution 
> > failed[\_SB_.PCI0.PEG1.GFX0._ROM] (Node 880142e85cf8), 
> > AE_AML_REGION_LIMIT (20120913/psparse-536)
> > [3.716183] failed to evaluate ROM got AE_AML_REGION_LIMIT
> > [3.718776] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.721349] nouveau  [   VBIOS][:01:00.0] checking PCIROM for 
> > image...
> > [3.724111] nouveau :01:00.0: Invalid ROM contents
> > [3.726663] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.729159] nouveau E[   VBIOS][:01:00.0] unable to locate usable 
> > image
> > [3.731677] nouveau E[  DEVICE][:01:00.0] failed to create 
> > 0x1001, -22
> > [3.734231] nouveau E[ DRM] failed to create 0x8080, -22
> > [3.736097] nouveau: probe of :01:00.0 failed with error -22
> > [3.740523] dracut: Starting plymouth daemon
> 
> Hmm, maybe we can't fetch 3 bytes only...
> 
> Let's check this:
> 
> ---
> diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c 
> b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> index 824eea0..8bd71aa 100644
> --- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> @@ -192,14 +192,16 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios)
>  {
>   struct pci_dev *pdev = nv_device(bios)->pdev;
>   int ret, cnt, i;
> - u8  data[3];
> + u8  *data;
>  
>   if (!nouveau_acpi_rom_supported(pdev))
>   return;
>  
>   bios->size = 0;
> - if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3)
> + data = kmalloc(4096, GFP_KERNEL);
> + if (data && nouveau_acpi_get_bios_chunk(data, 0, 4096) >= 3)
>   bios->size = data[2] * 512;
> + kfree(data);
>   if (!bios->size)
>   return;

with these both patches applied my laptop boots and gui works fine.
here's dmesg:

(...)
[8.751795] nouveau  [   VBIOS][:01:00.0] ... appears to be valid
[8.751798] nouveau  [   VBIOS][:01:00.0] using image from ACPI
[8.751895] nouveau  [   VBIOS][:01:00.0] BIT signature found
[8.751898] nouveau  [   VBIOS][:01:00.0] version 70.08.45.00
[8.752366] nouveau  [ DEVINIT][:01:00.0] adaptor not initialised
[8.752368] nouveau  [   VBIOS][:01:00.0] running init tables
[8.867660] nouveau  [ MXM][:01:00.0] no VBIOS data, nothing to do
[8.867690] nouveau  [ PFB][:01:00.0] RAM type: DDR3
[8.867692] nouveau  [ PFB][:01:00.0] RAM size: 512 MiB
[8.901523] vga_switcheroo: enabled
[8.901979] [TTM] Zone  kernel: Available graphics memory: 6104282 kiB
[8.901980] [TTM] Zone   dma32: Available graphics memory: 2097152 kiB
[8.901982] [TTM] Initializing pool allocator
[8.902014] [TTM] Initializing DMA pool allocator
[8.902180] mtrr: type mismatch for c000,1000 old: write-back new: 
write-combining
[8.902184] nouveau  [ DRM] VRAM: 512 MiB
[8.902185] nouveau  [ DRM] GART: 512 MiB
[8.902188] nouveau  [ DRM] BIT BIOS found
[8.902190] nouveau  [ DRM] Bios version 70.08.45.00
[8.902192] nouveau  [ DRM] TMDS table version 2.0
[8.902194] nouveau  [ DRM] DCB version 4.0
[8.902196] nouveau  [ DRM] DCB outp 00: 02011300 
[8.902198] nouveau  [ DRM] DCB conn 01: 0100
[8.903540] [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
[8.903541] [drm] No driver support for vblank timestamp query.
[8.903545] nouveau  [ DRM] ACPI backlight interface available, not 
registering our own
[8.903938] nouveau  [ DRM] 3 available performance level(s)
[8.903941] nouveau  [ DRM] 0: core 50MHz shader 101MHz memory 135MHz 
voltage 830mV
[8.903943] nouveau  [ DRM] 1: c

Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Heinz Diehl
On 20.10.2012, Marcin Slusarz wrote: 

> Try this one.

It works, now I can boot again. However, nouveau seems to be dead now.
The dmesg output with your patch on top of 3.7-rc1 is:

[3.685909] [drm] Initialized i915 1.6.0 20080730 for :00:02.0 on minor 0
[3.687784] nouveau  [  DEVICE][:01:00.0] BOOT0  : 0x0a8800b1
[3.689960] nouveau  [  DEVICE][:01:00.0] Chipset: GT218 (NVA8)
[3.692471] nouveau  [  DEVICE][:01:00.0] Family : NV50
[3.695716] nouveau  [   VBIOS][:01:00.0] checking PRAMIN for image...
[3.697087] nouveau  [   VBIOS][:01:00.0] ... signature not found
[3.698471] nouveau  [   VBIOS][:01:00.0] checking PROM for image...
[3.699838] nouveau  [   VBIOS][:01:00.0] ... signature not found
[3.701223] nouveau  [   VBIOS][:01:00.0] checking ACPI for image...
[3.702684] ACPI Error: Field [ROMI] Base+Offset+Width 0+24+1 is beyond end 
of region [VROM] (length 24) (20120913/exfldio-210)
[3.704139] ACPI Error: Method parse/execution 
failed[\_SB_.PCI0.PEG1.GFX0._ROM] (Node 880142e85cf8), AE_AML_REGION_LIMIT 
(20120913/psparse-536)
[3.716183] failed to evaluate ROM got AE_AML_REGION_LIMIT
[3.718776] nouveau  [   VBIOS][:01:00.0] ... signature not found
[3.721349] nouveau  [   VBIOS][:01:00.0] checking PCIROM for image...
[3.724111] nouveau :01:00.0: Invalid ROM contents
[3.726663] nouveau  [   VBIOS][:01:00.0] ... signature not found
[3.729159] nouveau E[   VBIOS][:01:00.0] unable to locate usable image
[3.731677] nouveau E[  DEVICE][:01:00.0] failed to create 0x1001, 
-22
[3.734231] nouveau E[ DRM] failed to create 0x8080, -22
[3.736097] nouveau: probe of :01:00.0 failed with error -22
[3.740523] dracut: Starting plymouth daemon

And here's the same output with plain vanilla 3.6.2:

[3.588791] [drm] nouveau :01:00.0: Detected an NV50 generation card 
(0x0a8800b1)
[3.599783] vga_switcheroo: enabled
[3.601303] [drm] nouveau :01:00.0: Checking PRAMIN for VBIOS
[3.602817] [drm] nouveau :01:00.0: ... BIOS signature not found
[3.604294] [drm] nouveau :01:00.0: Checking PROM for VBIOS
[3.605822] [drm] nouveau :01:00.0: ... BIOS signature not found
[3.607310] [drm] nouveau :01:00.0: Checking ACPI for VBIOS
[3.856854] [drm] nouveau :01:00.0: ... appears to be valid
[3.859409] [drm] nouveau :01:00.0: Using VBIOS from ACPI
[3.861907] [drm] nouveau :01:00.0: BIT BIOS found
[3.864369] [drm] nouveau :01:00.0: Bios version 70.18.5d.00
[3.866829] [drm] nouveau :01:00.0: TMDS table version 2.0
[3.869479] [drm] nouveau :01:00.0: MXM: no VBIOS data, nothing to do
[3.870871] [drm] nouveau :01:00.0: DCB version 4.0
[3.872220] [drm] nouveau :01:00.0: DCB outp 00: 02014300 
[3.873611] [drm] nouveau :01:00.0: DCB conn 00: 0040
[3.874994] [drm] nouveau :01:00.0: DCB conn 01: 00410146
[3.876367] [drm] nouveau :01:00.0: DCB conn 02: 1261
[3.877719] [drm] nouveau :01:00.0: DCB conn 03: 2330
[3.879043] [drm] nouveau :01:00.0: DCB conn 04: 0400
[3.880355] [drm] nouveau :01:00.0: DCB conn 05: 0560
[3.881662] [drm] nouveau :01:00.0: Adaptor not initialised, running 
VBIOS init tables.
[3.882961] [drm] nouveau :01:00.0: Parsing VBIOS init table 0 at offset 
0xDECD
[3.936538] [drm] nouveau :01:00.0: 0xDE34: i2c wr fail: -6
[3.957932] [drm] nouveau :01:00.0: Parsing VBIOS init table 1 at offset 
0xE378
[3.987046] [drm] nouveau :01:00.0: Parsing VBIOS init table 2 at offset 
0xEF4B
[3.988396] [drm] nouveau :01:00.0: Parsing VBIOS init table 3 at offset 
0xEF64
[3.990741] [drm] nouveau :01:00.0: Parsing VBIOS init table 4 at offset 
0xF04B
[3.992020] [drm] nouveau :01:00.0: Parsing VBIOS init table at offset 
0xF0B0
[4.018084] [TTM] Zone  kernel: Available graphics memory: 1917766 kiB
[4.019438] [TTM] Initializing pool allocator
[4.020694] [TTM] Initializing DMA pool allocator
[4.021914] [drm] nouveau :01:00.0: Detected 1024MiB VRAM (DDR3)
[4.024515] [drm] nouveau :01:00.0: 512 MiB GART (aperture)
[4.083748] [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
[4.084909] [drm] No driver support for vblank timestamp query.
[4.085985] [drm] nouveau :01:00.0: ACPI backlight interface available, 
not registering our own
[4.246449] [drm] nouveau :01:00.0: 3 available performance level(s)
[4.247560] [drm] nouveau :01:00.0: 0: core 135MHz shader 270MHz memory 
135MHz voltage 850mV
[4.248707] [drm] nouveau :01:00.0: 1: core 405MHz shader 810MHz memory 
405MHz voltage 850mV
[4.249807] [drm] nouveau :01:00.0: 3: core 606MHz shader 1468MHz memory 
667MHz voltage 1000mV
[4.250946] [drm] nouveau :01:00.0: c: core 405MHz shader 810MHz memory 
405MHz
[4.

Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Heinz Diehl
On 20.10.2012, Martin Peres wrote: 

> Can you test the attached patch too ? I rebased the previous one I sent on
> top on 3.7-rc1 as I accidentally used an older version.

Yes, of course.

Tried it. Unfortunately, the crash remains the same as reported.

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Heinz Diehl
On 20.10.2012, Linus Torvalds wrote:

> Added more appropriate people to this. Added both i915 and nouveau
> people, since apparently that fine piece of hardware has both.
>
> Guys, any ideas?

Plese see https://lkml.org/lkml/2012/10/19/371 , this is the same
thing going on. Reverting

 Ben Skeggs 
 drm/nouveau/bios: fix shadowing of ACPI ROMs larger than 64KiB

fixes the problem.

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Martin Peres

On 20/10/2012 11:26, Heinz Diehl wrote:

On 20.10.2012, Linus Torvalds wrote:


Added more appropriate people to this. Added both i915 and nouveau
people, since apparently that fine piece of hardware has both.

Guys, any ideas?


Plese see https://lkml.org/lkml/2012/10/19/371 , this is the same
thing going on. Reverting

  Ben Skeggs 
  drm/nouveau/bios: fix shadowing of ACPI ROMs larger than 64KiB

fixes the problem.


Can you test the attached patch too ? I rebased the previous one I sent 
on top on 3.7-rc1 as I accidentally used an older version.


Martin
>From f09d58dc23a6e48ed56a1d9bf803f800f0c59e83 Mon Sep 17 00:00:00 2001
From: Martin Peres 
Date: Sat, 20 Oct 2012 11:03:36 +0200
Subject: [PATCH] drm/nouveau/bios: improve error handling when reading the
 vbios from ACPI

Reported-by: Pawel Sikora 
Signed-off-by: Martin Peres 
---
 drivers/gpu/drm/nouveau/core/subdev/bios/base.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
index 619e7e0..519a3b3 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
@@ -188,8 +188,10 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios)
 	int ret, cnt, i;
 	u8  data[3];
 
-	if (!nouveau_acpi_rom_supported(pdev))
+	if (!nouveau_acpi_rom_supported(pdev)) {
+		bios->data = NULL;
 		return;
+	}
 
 	bios->size = 0;
 	if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3)
-- 
1.7.12.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Martin Peres

On 10/19/12 23:25, Linus Torvalds wrote:

Added more appropriate people to this. Added both i915 and nouveau
people, since apparently that fine piece of hardware has both.

Guys, any ideas?

Paweł, could you perhaps get a photo of the oops and post it
somewhere? I'm assuming the oops happens early during boot and you
never get a usable machine with dmesg - but if you do, then please do
post the whole dmesg too.

   Linus

Hi Linus,

You must have missed the oops that was attached to the mail: 
http://www.spinics.net/lists/kernel/msg1420355.html


Paweł, could you try the attached patch please ?

Martin

>From ea15dc1cf87236da78e8e88ecc3864ffab006ae0 Mon Sep 17 00:00:00 2001
From: Martin Peres 
Date: Sat, 20 Oct 2012 00:08:15 +0200
Subject: [PATCH] drm/nouveau/bios: improve error handling when reading the
 vbios from ACPI

Reported-by: Pawel Sikora 
Signed-off-by: Martin Peres 
---
 drivers/gpu/drm/nouveau/core/subdev/bios/base.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
index 2fbb6df..e31d8fc 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
@@ -188,8 +188,10 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios)
 	int cnt = 65536 / 4096;
 	int ret;
 
-	if (!nouveau_acpi_rom_supported(pdev))
+	if (!nouveau_acpi_rom_supported(pdev)) {
+		bios->data = NULL;
 		return;
+	}
 
 	bios->data = kmalloc(65536, GFP_KERNEL);
 	bios->size = 0;
-- 
1.7.12.3

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Heinz Diehl
On 21.10.2012, Pawe? Sikora wrote: 

> with these both patches applied my laptop boots and gui works fine.

The same here. The two patches together, applied to 3.7-rc1 let my
machine boot again. Here's the relevant dmesg cut:

[3.702671] nouveau  [  DEVICE][:01:00.0] BOOT0  : 0x0a8800b1
[3.704643] nouveau  [  DEVICE][:01:00.0] Chipset: GT218 (NVA8)
[3.707003] nouveau  [  DEVICE][:01:00.0] Family : NV50
[3.711393] nouveau  [   VBIOS][:01:00.0] checking PRAMIN for image...
[3.712793] nouveau  [   VBIOS][:01:00.0] ... signature not found
[3.714147] nouveau  [   VBIOS][:01:00.0] checking PROM for image...
[3.715578] nouveau  [   VBIOS][:01:00.0] ... signature not found
[3.716969] nouveau  [   VBIOS][:01:00.0] checking ACPI for image...
[4.207512] nouveau  [   VBIOS][:01:00.0] ... appears to be valid
[4.209711] nouveau  [   VBIOS][:01:00.0] using image from ACPI
[4.212469] nouveau  [   VBIOS][:01:00.0] BIT signature found
[4.214855] nouveau  [   VBIOS][:01:00.0] version 70.18.5d.00
[4.217554] nouveau  [ DEVINIT][:01:00.0] adaptor not initialised
[4.219922] nouveau  [   VBIOS][:01:00.0] running init tables
[4.342202] nouveau  [ MXM][:01:00.0] no VBIOS data, nothing to do
[4.343590] nouveau  [ PFB][:01:00.0] RAM type: DDR3
[4.344916] nouveau  [ PFB][:01:00.0] RAM size: 1024 MiB
[4.991887] vga_switcheroo: enabled
[4.993495] [TTM] Zone  kernel: Available graphics memory: 1917720 kiB
[4.994911] [TTM] Initializing pool allocator
[4.996228] [TTM] Initializing DMA pool allocator
[4.998915] nouveau  [ DRM] VRAM: 1024 MiB
[5.000251] nouveau  [ DRM] GART: 512 MiB
[5.001579] nouveau  [ DRM] BIT BIOS found
[5.002904] nouveau  [ DRM] Bios version 70.18.5d.00
[5.004229] nouveau  [ DRM] TMDS table version 2.0
[5.005545] nouveau  [ DRM] DCB version 4.0
[5.006810] nouveau  [ DRM] DCB outp 00: 02014300 
[5.008115] nouveau  [ DRM] DCB conn 00: 0040
[5.009441] nouveau  [ DRM] DCB conn 01: 00410146
[5.010745] nouveau  [ DRM] DCB conn 02: 1261
[5.012019] nouveau  [ DRM] DCB conn 03: 2330
[5.013255] nouveau  [ DRM] DCB conn 04: 0400
[5.014452] nouveau  [ DRM] DCB conn 05: 0560
[5.052344] [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
[5.053486] [drm] No driver support for vblank timestamp query.
[5.054590] nouveau  [ DRM] ACPI backlight interface available,not 
registering our own
[5.356822] nouveau  [ DRM] 3 available performance level(s)
[5.358682] nouveau  [ DRM] 0: core 135MHz shader 270MHz memory 135MHz 
voltage 850mV
[5.360442] nouveau  [ DRM] 1: core 405MHz shader 810MHz memory 405MHz 
voltage 850mV
[5.362215] nouveau  [ DRM] 3: core 606MHz shader 1468MHz memory 667MHz 
voltage 1000mV
[5.363998] nouveau  [ DRM] c: core 405MHz shader 810MHz memory 405MHz
[5.404143] nouveau  [ DRM] MM: using COPY for buffer copies
[5.481593] No connectors reported connected with modes
[5.482667] [drm] Cannot find any crtc or sizes - going 1024x768
[5.517932] nouveau  [ DRM] allocated 1024x768 fb: 0x7, bo 
88013a6d3400
[5.519236] fb1: nouveaufb frame buffer device
[5.520368] [drm] Initialized nouveau 1.1.0 20120801 for :01:00.0 on 
minor 1
[5.527378] dracut: Starting plymouth daemon



Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Heinz Diehl
On 21.10.2012, Marcin Slusarz wrote: 

> On 3.6 kernel? (It doesn't exist on 3.7)
> Note that it may be in other directory than "0".

[root at wildsau linux-3.6.2]# cat .config | grep -i "nouveau"
CONFIG_DRM_NOUVEAU=m
CONFIG_DRM_NOUVEAU_BACKLIGHT=y
CONFIG_DRM_NOUVEAU_DEBUG=y

I grepped the whole disk, there's no vbios.rom at all.



Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Linus Torvalds
On Sun, Oct 21, 2012 at 5:49 PM, Marcin Slusarz
 wrote:
>
> I know. But this bug is not about broken firmware. It's about Linux kernel
> ACPI implementation, which (I think) wrongly interprets ACPI script.

Hmm. Len, care to comment? Marcin quoted the AML and our arguments in
an earlier thing. I don't read AML, so I was assuming it's the AML
itself that was buggy, not our interpretation of it..

   Linus
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Paweł Sikora
On Sunday 21 of October 2012 00:19:48 Marcin Slusarz wrote:
> On Sat, Oct 20, 2012 at 11:20:36PM +0200, Heinz Diehl wrote:
> > On 20.10.2012, Marcin Slusarz wrote: 
> > 
> > > Try this one.
> > 
> > It works, now I can boot again. However, nouveau seems to be dead now.
> > The dmesg output with your patch on top of 3.7-rc1 is:
> > 
> > [3.685909] [drm] Initialized i915 1.6.0 20080730 for :00:02.0 on 
> > minor 0
> > [3.687784] nouveau  [  DEVICE][:01:00.0] BOOT0  : 0x0a8800b1
> > [3.689960] nouveau  [  DEVICE][:01:00.0] Chipset: GT218 (NVA8)
> > [3.692471] nouveau  [  DEVICE][:01:00.0] Family : NV50
> > [3.695716] nouveau  [   VBIOS][:01:00.0] checking PRAMIN for 
> > image...
> > [3.697087] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.698471] nouveau  [   VBIOS][:01:00.0] checking PROM for image...
> > [3.699838] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.701223] nouveau  [   VBIOS][:01:00.0] checking ACPI for image...
> > [3.702684] ACPI Error: Field [ROMI] Base+Offset+Width 0+24+1 is beyond 
> > end of region [VROM] (length 24) (20120913/exfldio-210)
> > [3.704139] ACPI Error: Method parse/execution 
> > failed[\_SB_.PCI0.PEG1.GFX0._ROM] (Node 880142e85cf8), 
> > AE_AML_REGION_LIMIT (20120913/psparse-536)
> > [3.716183] failed to evaluate ROM got AE_AML_REGION_LIMIT
> > [3.718776] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.721349] nouveau  [   VBIOS][:01:00.0] checking PCIROM for 
> > image...
> > [3.724111] nouveau :01:00.0: Invalid ROM contents
> > [3.726663] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.729159] nouveau E[   VBIOS][:01:00.0] unable to locate usable 
> > image
> > [3.731677] nouveau E[  DEVICE][:01:00.0] failed to create 
> > 0x1001, -22
> > [3.734231] nouveau E[ DRM] failed to create 0x8080, -22
> > [3.736097] nouveau: probe of :01:00.0 failed with error -22
> > [3.740523] dracut: Starting plymouth daemon
> 
> Hmm, maybe we can't fetch 3 bytes only...
> 
> Let's check this:
> 
> ---
> diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c 
> b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> index 824eea0..8bd71aa 100644
> --- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> @@ -192,14 +192,16 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios)
>  {
>   struct pci_dev *pdev = nv_device(bios)->pdev;
>   int ret, cnt, i;
> - u8  data[3];
> + u8  *data;
>  
>   if (!nouveau_acpi_rom_supported(pdev))
>   return;
>  
>   bios->size = 0;
> - if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3)
> + data = kmalloc(4096, GFP_KERNEL);
> + if (data && nouveau_acpi_get_bios_chunk(data, 0, 4096) >= 3)
>   bios->size = data[2] * 512;
> + kfree(data);
>   if (!bios->size)
>   return;

with these both patches applied my laptop boots and gui works fine.
here's dmesg:

(...)
[8.751795] nouveau  [   VBIOS][:01:00.0] ... appears to be valid
[8.751798] nouveau  [   VBIOS][:01:00.0] using image from ACPI
[8.751895] nouveau  [   VBIOS][:01:00.0] BIT signature found
[8.751898] nouveau  [   VBIOS][:01:00.0] version 70.08.45.00
[8.752366] nouveau  [ DEVINIT][:01:00.0] adaptor not initialised
[8.752368] nouveau  [   VBIOS][:01:00.0] running init tables
[8.867660] nouveau  [ MXM][:01:00.0] no VBIOS data, nothing to do
[8.867690] nouveau  [ PFB][:01:00.0] RAM type: DDR3
[8.867692] nouveau  [ PFB][:01:00.0] RAM size: 512 MiB
[8.901523] vga_switcheroo: enabled
[8.901979] [TTM] Zone  kernel: Available graphics memory: 6104282 kiB
[8.901980] [TTM] Zone   dma32: Available graphics memory: 2097152 kiB
[8.901982] [TTM] Initializing pool allocator
[8.902014] [TTM] Initializing DMA pool allocator
[8.902180] mtrr: type mismatch for c000,1000 old: write-back new: 
write-combining
[8.902184] nouveau  [ DRM] VRAM: 512 MiB
[8.902185] nouveau  [ DRM] GART: 512 MiB
[8.902188] nouveau  [ DRM] BIT BIOS found
[8.902190] nouveau  [ DRM] Bios version 70.08.45.00
[8.902192] nouveau  [ DRM] TMDS table version 2.0
[8.902194] nouveau  [ DRM] DCB version 4.0
[8.902196] nouveau  [ DRM] DCB outp 00: 02011300 
[8.902198] nouveau  [ DRM] DCB conn 01: 0100
[8.903540] [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
[8.903541] [drm] No driver support for vblank timestamp query.
[8.903545] nouveau  [ DRM] ACPI backlight interface available, not 
registering our own
[8.903938] nouveau  [ DRM] 3 available performance level(s)
[8.903941] nouveau  [ DRM] 0: core 50MHz shader 101MHz memory 135MHz 
voltage 830mV
[8.903943] nouveau  [ DRM] 1: c

Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Marcin Slusarz
On Sun, Oct 21, 2012 at 07:38:58AM -0700, Linus Torvalds wrote:
> On Sun, Oct 21, 2012 at 5:09 AM, Marcin Slusarz
>  wrote:
> >
> > This looks like ACPI bug...
> 
> I'm _shocked_ to hear that firmware would be fragile.
> 
> Anyway, here's the #1 thing to keep in mind about firmware:
> 
>  - firmware is *always* buggy.

I know. But this bug is not about broken firmware. It's about Linux kernel
ACPI implementation, which (I think) wrongly interprets ACPI script.

Marcin
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Linus Torvalds
On Sun, Oct 21, 2012 at 5:09 AM, Marcin Slusarz
 wrote:
>
> This looks like ACPI bug...

I'm _shocked_ to hear that firmware would be fragile.

Anyway, here's the #1 thing to keep in mind about firmware:

 - firmware is *always* buggy.

It's that simple. Don't expect anything else. Firmware is written by
people who have lost the will to live (why? Because they do firmware
development for a living), and the only thing keeping them going is
the drugs. And they're not the "fun" kind of drugs. The end result is
predictable. In their drug-induced haze, they make a mess.

So saying "ACPI is buggy" is like saying "water is wet". Deal with it.

> Nouveau calls this method: [...]
>
> with Arg0 == 0, Arg1 == 3 and gets:
>
> ACPI Error: Field [ROMI] Base+Offset+Width 0+24+1 is beyond end of region 
> [VROM] (length 24) (20120913/exfldio-210)
> ACPI Error: Method parse/execution failed [\_SB_.PCI0.PEGR.GFX0._ROM] (Node 
> 88033e47fe88), AE_AML_REGION_LIMIT (20120913/psparse-536)
>
> We can workaround it by aligning Arg1 to 4096 (I'm wondering what is the 
> minimal
> value), but do we really have to?

Yes, you really have to. You need to understand that ACPI has been
tested with one thing, and one thing only: Windows. Clearly windows
doesn't ask for some three-byte region. So it doesn't work. Big
surprise. Untested code written by monkeys on crack - what did you
expect?

So don't do "clever" things. When it comes to firmware, you need to
expect it to be buggy, and try to access it the way Windows accesses
it.

Now, whether Windows realy always does things with a 4kB-aligned
access, or whether you just need to make sure that you're (say)
4-byte-aligned, I don't know. Maybe doing things four (or eight, or
sixteen) bytes at a time will work. You can try. But if we know from
past experience that a 4kB block-size will work, I'd suggest just
saying

  "It's stupid, but stupid is good - we're working with firmware"

Think of firmware the way you think of hardware: it's buggy and needs
workarounds.

Linus
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Linus Torvalds
On Sun, Oct 21, 2012 at 5:09 AM, Marcin Slusarz
 wrote:
>
> This looks like ACPI bug...

I'm _shocked_ to hear that firmware would be fragile.

Anyway, here's the #1 thing to keep in mind about firmware:

 - firmware is *always* buggy.

It's that simple. Don't expect anything else. Firmware is written by
people who have lost the will to live (why? Because they do firmware
development for a living), and the only thing keeping them going is
the drugs. And they're not the "fun" kind of drugs. The end result is
predictable. In their drug-induced haze, they make a mess.

So saying "ACPI is buggy" is like saying "water is wet". Deal with it.

> Nouveau calls this method: [...]
>
> with Arg0 == 0, Arg1 == 3 and gets:
>
> ACPI Error: Field [ROMI] Base+Offset+Width 0+24+1 is beyond end of region 
> [VROM] (length 24) (20120913/exfldio-210)
> ACPI Error: Method parse/execution failed [\_SB_.PCI0.PEGR.GFX0._ROM] (Node 
> 88033e47fe88), AE_AML_REGION_LIMIT (20120913/psparse-536)
>
> We can workaround it by aligning Arg1 to 4096 (I'm wondering what is the 
> minimal
> value), but do we really have to?

Yes, you really have to. You need to understand that ACPI has been
tested with one thing, and one thing only: Windows. Clearly windows
doesn't ask for some three-byte region. So it doesn't work. Big
surprise. Untested code written by monkeys on crack - what did you
expect?

So don't do "clever" things. When it comes to firmware, you need to
expect it to be buggy, and try to access it the way Windows accesses
it.

Now, whether Windows realy always does things with a 4kB-aligned
access, or whether you just need to make sure that you're (say)
4-byte-aligned, I don't know. Maybe doing things four (or eight, or
sixteen) bytes at a time will work. You can try. But if we know from
past experience that a 4kB block-size will work, I'd suggest just
saying

  "It's stupid, but stupid is good - we're working with firmware"

Think of firmware the way you think of hardware: it's buggy and needs
workarounds.

Linus


Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Marcin Slusarz
On Sun, Oct 21, 2012 at 08:58:07AM +0200, Paweł Sikora wrote:
> On Sunday 21 of October 2012 00:19:48 Marcin Slusarz wrote:
> > On Sat, Oct 20, 2012 at 11:20:36PM +0200, Heinz Diehl wrote:
> > > On 20.10.2012, Marcin Slusarz wrote: 
> > > 
> > > > Try this one.
> > > 
> > > It works, now I can boot again. However, nouveau seems to be dead now.
> > > The dmesg output with your patch on top of 3.7-rc1 is:
> > > 
> > > [3.685909] [drm] Initialized i915 1.6.0 20080730 for :00:02.0 on 
> > > minor 0
> > > [3.687784] nouveau  [  DEVICE][:01:00.0] BOOT0  : 0x0a8800b1
> > > [3.689960] nouveau  [  DEVICE][:01:00.0] Chipset: GT218 (NVA8)
> > > [3.692471] nouveau  [  DEVICE][:01:00.0] Family : NV50
> > > [3.695716] nouveau  [   VBIOS][:01:00.0] checking PRAMIN for 
> > > image...
> > > [3.697087] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > > [3.698471] nouveau  [   VBIOS][:01:00.0] checking PROM for 
> > > image...
> > > [3.699838] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > > [3.701223] nouveau  [   VBIOS][:01:00.0] checking ACPI for 
> > > image...
> > > [3.702684] ACPI Error: Field [ROMI] Base+Offset+Width 0+24+1 is 
> > > beyond end of region [VROM] (length 24) (20120913/exfldio-210)
> > > [3.704139] ACPI Error: Method parse/execution 
> > > failed[\_SB_.PCI0.PEG1.GFX0._ROM] (Node 880142e85cf8), 
> > > AE_AML_REGION_LIMIT (20120913/psparse-536)
> > > [3.716183] failed to evaluate ROM got AE_AML_REGION_LIMIT
> > > [3.718776] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > > [3.721349] nouveau  [   VBIOS][:01:00.0] checking PCIROM for 
> > > image...
> > > [3.724111] nouveau :01:00.0: Invalid ROM contents
> > > [3.726663] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > > [3.729159] nouveau E[   VBIOS][:01:00.0] unable to locate usable 
> > > image
> > > [3.731677] nouveau E[  DEVICE][:01:00.0] failed to create 
> > > 0x1001, -22
> > > [3.734231] nouveau E[ DRM] failed to create 0x8080, -22
> > > [3.736097] nouveau: probe of :01:00.0 failed with error -22
> > > [3.740523] dracut: Starting plymouth daemon
> > 
> > Hmm, maybe we can't fetch 3 bytes only...
> > 
> > Let's check this:
> > 
> > ---
> > diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c 
> > b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> > index 824eea0..8bd71aa 100644
> > --- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> > +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> > @@ -192,14 +192,16 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios)
> >  {
> > struct pci_dev *pdev = nv_device(bios)->pdev;
> > int ret, cnt, i;
> > -   u8  data[3];
> > +   u8  *data;
> >  
> > if (!nouveau_acpi_rom_supported(pdev))
> > return;
> >  
> > bios->size = 0;
> > -   if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3)
> > +   data = kmalloc(4096, GFP_KERNEL);
> > +   if (data && nouveau_acpi_get_bios_chunk(data, 0, 4096) >= 3)
> > bios->size = data[2] * 512;
> > +   kfree(data);
> > if (!bios->size)
> > return;
> 
> with these both patches applied my laptop boots and gui works fine.
> here's dmesg:
> 
> (...)
> [8.751795] nouveau  [   VBIOS][:01:00.0] ... appears to be valid
> [8.751798] nouveau  [   VBIOS][:01:00.0] using image from ACPI
> [8.751895] nouveau  [   VBIOS][:01:00.0] BIT signature found
> [8.751898] nouveau  [   VBIOS][:01:00.0] version 70.08.45.00
> [8.752366] nouveau  [ DEVINIT][:01:00.0] adaptor not initialised
> [8.752368] nouveau  [   VBIOS][:01:00.0] running init tables
> [8.867660] nouveau  [ MXM][:01:00.0] no VBIOS data, nothing to do
> [8.867690] nouveau  [ PFB][:01:00.0] RAM type: DDR3
> [8.867692] nouveau  [ PFB][:01:00.0] RAM size: 512 MiB
> [8.901523] vga_switcheroo: enabled
> [8.901979] [TTM] Zone  kernel: Available graphics memory: 6104282 kiB
> [8.901980] [TTM] Zone   dma32: Available graphics memory: 2097152 kiB
> [8.901982] [TTM] Initializing pool allocator
> [8.902014] [TTM] Initializing DMA pool allocator
> [8.902180] mtrr: type mismatch for c000,1000 old: write-back new: 
> write-combining
> [8.902184] nouveau  [ DRM] VRAM: 512 MiB
> [8.902185] nouveau  [ DRM] GART: 512 MiB
> [8.902188] nouveau  [ DRM] BIT BIOS found
> [8.902190] nouveau  [ DRM] Bios version 70.08.45.00
> [8.902192] nouveau  [ DRM] TMDS table version 2.0
> [8.902194] nouveau  [ DRM] DCB version 4.0
> [8.902196] nouveau  [ DRM] DCB outp 00: 02011300 
> [8.902198] nouveau  [ DRM] DCB conn 01: 0100
> [8.903540] [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
> [8.903541] [drm] No driver support for vblank timestamp query.
> [8.903545] nouveau  [ DRM] ACPI backlight

Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-21 Thread Marcin Slusarz
On Sat, Oct 20, 2012 at 11:20:36PM +0200, Heinz Diehl wrote:
> On 20.10.2012, Marcin Slusarz wrote: 
> 
> > Try this one.
> 
> It works, now I can boot again. However, nouveau seems to be dead now.
> The dmesg output with your patch on top of 3.7-rc1 is:
> 
> [3.685909] [drm] Initialized i915 1.6.0 20080730 for :00:02.0 on 
> minor 0
> [3.687784] nouveau  [  DEVICE][:01:00.0] BOOT0  : 0x0a8800b1
> [3.689960] nouveau  [  DEVICE][:01:00.0] Chipset: GT218 (NVA8)
> [3.692471] nouveau  [  DEVICE][:01:00.0] Family : NV50
> [3.695716] nouveau  [   VBIOS][:01:00.0] checking PRAMIN for image...
> [3.697087] nouveau  [   VBIOS][:01:00.0] ... signature not found
> [3.698471] nouveau  [   VBIOS][:01:00.0] checking PROM for image...
> [3.699838] nouveau  [   VBIOS][:01:00.0] ... signature not found
> [3.701223] nouveau  [   VBIOS][:01:00.0] checking ACPI for image...
> [3.702684] ACPI Error: Field [ROMI] Base+Offset+Width 0+24+1 is beyond 
> end of region [VROM] (length 24) (20120913/exfldio-210)
> [3.704139] ACPI Error: Method parse/execution 
> failed[\_SB_.PCI0.PEG1.GFX0._ROM] (Node 880142e85cf8), 
> AE_AML_REGION_LIMIT (20120913/psparse-536)
> [3.716183] failed to evaluate ROM got AE_AML_REGION_LIMIT
> [3.718776] nouveau  [   VBIOS][:01:00.0] ... signature not found
> [3.721349] nouveau  [   VBIOS][:01:00.0] checking PCIROM for image...
> [3.724111] nouveau :01:00.0: Invalid ROM contents
> [3.726663] nouveau  [   VBIOS][:01:00.0] ... signature not found
> [3.729159] nouveau E[   VBIOS][:01:00.0] unable to locate usable image
> [3.731677] nouveau E[  DEVICE][:01:00.0] failed to create 0x1001, 
> -22
> [3.734231] nouveau E[ DRM] failed to create 0x8080, -22
> [3.736097] nouveau: probe of :01:00.0 failed with error -22
> [3.740523] dracut: Starting plymouth daemon

Hmm, maybe we can't fetch 3 bytes only...

Let's check this:

---
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c 
b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
index 824eea0..8bd71aa 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
@@ -192,14 +192,16 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios)
 {
struct pci_dev *pdev = nv_device(bios)->pdev;
int ret, cnt, i;
-   u8  data[3];
+   u8  *data;

if (!nouveau_acpi_rom_supported(pdev))
return;

bios->size = 0;
-   if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3)
+   data = kmalloc(4096, GFP_KERNEL);
+   if (data && nouveau_acpi_get_bios_chunk(data, 0, 4096) >= 3)
bios->size = data[2] * 512;
+   kfree(data);
if (!bios->size)
return;

---

Please attach acpidump output.


Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-20 Thread Marcin Slusarz
On Sat, Oct 20, 2012 at 11:42:17PM +0200, Marcin Slusarz wrote:
> On Sat, Oct 20, 2012 at 11:20:36PM +0200, Heinz Diehl wrote:
> > On 20.10.2012, Marcin Slusarz wrote: 
> > 
> > > Try this one.
> > 
> > It works, now I can boot again. However, nouveau seems to be dead now.
> > The dmesg output with your patch on top of 3.7-rc1 is:
> > 
> > [3.685909] [drm] Initialized i915 1.6.0 20080730 for :00:02.0 on 
> > minor 0
> > [3.687784] nouveau  [  DEVICE][:01:00.0] BOOT0  : 0x0a8800b1
> > [3.689960] nouveau  [  DEVICE][:01:00.0] Chipset: GT218 (NVA8)
> > [3.692471] nouveau  [  DEVICE][:01:00.0] Family : NV50
> > [3.695716] nouveau  [   VBIOS][:01:00.0] checking PRAMIN for 
> > image...
> > [3.697087] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.698471] nouveau  [   VBIOS][:01:00.0] checking PROM for image...
> > [3.699838] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.701223] nouveau  [   VBIOS][:01:00.0] checking ACPI for image...
> > [3.702684] ACPI Error: Field [ROMI] Base+Offset+Width 0+24+1 is beyond 
> > end of region [VROM] (length 24) (20120913/exfldio-210)
> > [3.704139] ACPI Error: Method parse/execution 
> > failed[\_SB_.PCI0.PEG1.GFX0._ROM] (Node 880142e85cf8), 
> > AE_AML_REGION_LIMIT (20120913/psparse-536)
> > [3.716183] failed to evaluate ROM got AE_AML_REGION_LIMIT
> > [3.718776] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.721349] nouveau  [   VBIOS][:01:00.0] checking PCIROM for 
> > image...
> > [3.724111] nouveau :01:00.0: Invalid ROM contents
> > [3.726663] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.729159] nouveau E[   VBIOS][:01:00.0] unable to locate usable 
> > image
> > [3.731677] nouveau E[  DEVICE][:01:00.0] failed to create 
> > 0x1001, -22
> > [3.734231] nouveau E[ DRM] failed to create 0x8080, -22
> > [3.736097] nouveau: probe of :01:00.0 failed with error -22
> > [3.740523] dracut: Starting plymouth daemon
> > 
> > And here's the same output with plain vanilla 3.6.2:
> > 
> > [3.588791] [drm] nouveau :01:00.0: Detected an NV50 generation card 
> > (0x0a8800b1)
> > [3.599783] vga_switcheroo: enabled
> > [3.601303] [drm] nouveau :01:00.0: Checking PRAMIN for VBIOS
> > [3.602817] [drm] nouveau :01:00.0: ... BIOS signature not found
> > [3.604294] [drm] nouveau :01:00.0: Checking PROM for VBIOS
> > [3.605822] [drm] nouveau :01:00.0: ... BIOS signature not found
> > [3.607310] [drm] nouveau :01:00.0: Checking ACPI for VBIOS
> > [3.856854] [drm] nouveau :01:00.0: ... appears to be valid
> > [3.859409] [drm] nouveau :01:00.0: Using VBIOS from ACPI
> > [3.861907] [drm] nouveau :01:00.0: BIT BIOS found
> > [3.864369] [drm] nouveau :01:00.0: Bios version 70.18.5d.00
> > [3.866829] [drm] nouveau :01:00.0: TMDS table version 2.0
> > [3.869479] [drm] nouveau :01:00.0: MXM: no VBIOS data, nothing to do
> > [3.870871] [drm] nouveau :01:00.0: DCB version 4.0
> > [3.872220] [drm] nouveau :01:00.0: DCB outp 00: 02014300 
> > [3.873611] [drm] nouveau :01:00.0: DCB conn 00: 0040
> > [3.874994] [drm] nouveau :01:00.0: DCB conn 01: 00410146
> > [3.876367] [drm] nouveau :01:00.0: DCB conn 02: 1261
> > [3.877719] [drm] nouveau :01:00.0: DCB conn 03: 2330
> > [3.879043] [drm] nouveau :01:00.0: DCB conn 04: 0400
> > [3.880355] [drm] nouveau :01:00.0: DCB conn 05: 0560
> > [3.881662] [drm] nouveau :01:00.0: Adaptor not initialised, running 
> > VBIOS init tables.
> > [3.882961] [drm] nouveau :01:00.0: Parsing VBIOS init table 0 at 
> > offset 0xDECD
> > [3.936538] [drm] nouveau :01:00.0: 0xDE34: i2c wr fail: -6
> > [3.957932] [drm] nouveau :01:00.0: Parsing VBIOS init table 1 at 
> > offset 0xE378
> > [3.987046] [drm] nouveau :01:00.0: Parsing VBIOS init table 2 at 
> > offset 0xEF4B
> > [3.988396] [drm] nouveau :01:00.0: Parsing VBIOS init table 3 at 
> > offset 0xEF64
> > [3.990741] [drm] nouveau :01:00.0: Parsing VBIOS init table 4 at 
> > offset 0xF04B
> > [3.992020] [drm] nouveau :01:00.0: Parsing VBIOS init table at 
> > offset 0xF0B0
> > [4.018084] [TTM] Zone  kernel: Available graphics memory: 1917766 kiB
> > [4.019438] [TTM] Initializing pool allocator
> > [4.020694] [TTM] Initializing DMA pool allocator
> > [4.021914] [drm] nouveau :01:00.0: Detected 1024MiB VRAM (DDR3)
> > [4.024515] [drm] nouveau :01:00.0: 512 MiB GART (aperture)
> > [4.083748] [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
> > [4.084909] [drm] No driver support for vblank timestamp query.
> > [4.085985] [drm] nouveau :01:00.0: ACPI backlight interface 
> > available, not registering our own
> > 

Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-20 Thread Marcin Slusarz
On Sat, Oct 20, 2012 at 11:20:36PM +0200, Heinz Diehl wrote:
> On 20.10.2012, Marcin Slusarz wrote: 
> 
> > Try this one.
> 
> It works, now I can boot again. However, nouveau seems to be dead now.
> The dmesg output with your patch on top of 3.7-rc1 is:
> 
> [3.685909] [drm] Initialized i915 1.6.0 20080730 for :00:02.0 on 
> minor 0
> [3.687784] nouveau  [  DEVICE][:01:00.0] BOOT0  : 0x0a8800b1
> [3.689960] nouveau  [  DEVICE][:01:00.0] Chipset: GT218 (NVA8)
> [3.692471] nouveau  [  DEVICE][:01:00.0] Family : NV50
> [3.695716] nouveau  [   VBIOS][:01:00.0] checking PRAMIN for image...
> [3.697087] nouveau  [   VBIOS][:01:00.0] ... signature not found
> [3.698471] nouveau  [   VBIOS][:01:00.0] checking PROM for image...
> [3.699838] nouveau  [   VBIOS][:01:00.0] ... signature not found
> [3.701223] nouveau  [   VBIOS][:01:00.0] checking ACPI for image...
> [3.702684] ACPI Error: Field [ROMI] Base+Offset+Width 0+24+1 is beyond 
> end of region [VROM] (length 24) (20120913/exfldio-210)
> [3.704139] ACPI Error: Method parse/execution 
> failed[\_SB_.PCI0.PEG1.GFX0._ROM] (Node 880142e85cf8), 
> AE_AML_REGION_LIMIT (20120913/psparse-536)
> [3.716183] failed to evaluate ROM got AE_AML_REGION_LIMIT
> [3.718776] nouveau  [   VBIOS][:01:00.0] ... signature not found
> [3.721349] nouveau  [   VBIOS][:01:00.0] checking PCIROM for image...
> [3.724111] nouveau :01:00.0: Invalid ROM contents
> [3.726663] nouveau  [   VBIOS][:01:00.0] ... signature not found
> [3.729159] nouveau E[   VBIOS][:01:00.0] unable to locate usable image
> [3.731677] nouveau E[  DEVICE][:01:00.0] failed to create 0x1001, 
> -22
> [3.734231] nouveau E[ DRM] failed to create 0x8080, -22
> [3.736097] nouveau: probe of :01:00.0 failed with error -22
> [3.740523] dracut: Starting plymouth daemon
> 
> And here's the same output with plain vanilla 3.6.2:
> 
> [3.588791] [drm] nouveau :01:00.0: Detected an NV50 generation card 
> (0x0a8800b1)
> [3.599783] vga_switcheroo: enabled
> [3.601303] [drm] nouveau :01:00.0: Checking PRAMIN for VBIOS
> [3.602817] [drm] nouveau :01:00.0: ... BIOS signature not found
> [3.604294] [drm] nouveau :01:00.0: Checking PROM for VBIOS
> [3.605822] [drm] nouveau :01:00.0: ... BIOS signature not found
> [3.607310] [drm] nouveau :01:00.0: Checking ACPI for VBIOS
> [3.856854] [drm] nouveau :01:00.0: ... appears to be valid
> [3.859409] [drm] nouveau :01:00.0: Using VBIOS from ACPI
> [3.861907] [drm] nouveau :01:00.0: BIT BIOS found
> [3.864369] [drm] nouveau :01:00.0: Bios version 70.18.5d.00
> [3.866829] [drm] nouveau :01:00.0: TMDS table version 2.0
> [3.869479] [drm] nouveau :01:00.0: MXM: no VBIOS data, nothing to do
> [3.870871] [drm] nouveau :01:00.0: DCB version 4.0
> [3.872220] [drm] nouveau :01:00.0: DCB outp 00: 02014300 
> [3.873611] [drm] nouveau :01:00.0: DCB conn 00: 0040
> [3.874994] [drm] nouveau :01:00.0: DCB conn 01: 00410146
> [3.876367] [drm] nouveau :01:00.0: DCB conn 02: 1261
> [3.877719] [drm] nouveau :01:00.0: DCB conn 03: 2330
> [3.879043] [drm] nouveau :01:00.0: DCB conn 04: 0400
> [3.880355] [drm] nouveau :01:00.0: DCB conn 05: 0560
> [3.881662] [drm] nouveau :01:00.0: Adaptor not initialised, running 
> VBIOS init tables.
> [3.882961] [drm] nouveau :01:00.0: Parsing VBIOS init table 0 at 
> offset 0xDECD
> [3.936538] [drm] nouveau :01:00.0: 0xDE34: i2c wr fail: -6
> [3.957932] [drm] nouveau :01:00.0: Parsing VBIOS init table 1 at 
> offset 0xE378
> [3.987046] [drm] nouveau :01:00.0: Parsing VBIOS init table 2 at 
> offset 0xEF4B
> [3.988396] [drm] nouveau :01:00.0: Parsing VBIOS init table 3 at 
> offset 0xEF64
> [3.990741] [drm] nouveau :01:00.0: Parsing VBIOS init table 4 at 
> offset 0xF04B
> [3.992020] [drm] nouveau :01:00.0: Parsing VBIOS init table at offset 
> 0xF0B0
> [4.018084] [TTM] Zone  kernel: Available graphics memory: 1917766 kiB
> [4.019438] [TTM] Initializing pool allocator
> [4.020694] [TTM] Initializing DMA pool allocator
> [4.021914] [drm] nouveau :01:00.0: Detected 1024MiB VRAM (DDR3)
> [4.024515] [drm] nouveau :01:00.0: 512 MiB GART (aperture)
> [4.083748] [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
> [4.084909] [drm] No driver support for vblank timestamp query.
> [4.085985] [drm] nouveau :01:00.0: ACPI backlight interface 
> available, not registering our own
> [4.246449] [drm] nouveau :01:00.0: 3 available performance level(s)
> [4.247560] [drm] nouveau :01:00.0: 0: core 135MHz shader 270MHz 
> memory 135MHz voltage 850mV
> [4.248707] [drm] nouveau :01:00.0: 1: core 405MHz shader

Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-20 Thread Heinz Diehl
On 20.10.2012, Marcin Slusarz wrote: 

> Try this one.

It works, now I can boot again. However, nouveau seems to be dead now.
The dmesg output with your patch on top of 3.7-rc1 is:

[3.685909] [drm] Initialized i915 1.6.0 20080730 for :00:02.0 on minor 0
[3.687784] nouveau  [  DEVICE][:01:00.0] BOOT0  : 0x0a8800b1
[3.689960] nouveau  [  DEVICE][:01:00.0] Chipset: GT218 (NVA8)
[3.692471] nouveau  [  DEVICE][:01:00.0] Family : NV50
[3.695716] nouveau  [   VBIOS][:01:00.0] checking PRAMIN for image...
[3.697087] nouveau  [   VBIOS][:01:00.0] ... signature not found
[3.698471] nouveau  [   VBIOS][:01:00.0] checking PROM for image...
[3.699838] nouveau  [   VBIOS][:01:00.0] ... signature not found
[3.701223] nouveau  [   VBIOS][:01:00.0] checking ACPI for image...
[3.702684] ACPI Error: Field [ROMI] Base+Offset+Width 0+24+1 is beyond end 
of region [VROM] (length 24) (20120913/exfldio-210)
[3.704139] ACPI Error: Method parse/execution 
failed[\_SB_.PCI0.PEG1.GFX0._ROM] (Node 880142e85cf8), AE_AML_REGION_LIMIT 
(20120913/psparse-536)
[3.716183] failed to evaluate ROM got AE_AML_REGION_LIMIT
[3.718776] nouveau  [   VBIOS][:01:00.0] ... signature not found
[3.721349] nouveau  [   VBIOS][:01:00.0] checking PCIROM for image...
[3.724111] nouveau :01:00.0: Invalid ROM contents
[3.726663] nouveau  [   VBIOS][:01:00.0] ... signature not found
[3.729159] nouveau E[   VBIOS][:01:00.0] unable to locate usable image
[3.731677] nouveau E[  DEVICE][:01:00.0] failed to create 0x1001, 
-22
[3.734231] nouveau E[ DRM] failed to create 0x8080, -22
[3.736097] nouveau: probe of :01:00.0 failed with error -22
[3.740523] dracut: Starting plymouth daemon

And here's the same output with plain vanilla 3.6.2:

[3.588791] [drm] nouveau :01:00.0: Detected an NV50 generation card 
(0x0a8800b1)
[3.599783] vga_switcheroo: enabled
[3.601303] [drm] nouveau :01:00.0: Checking PRAMIN for VBIOS
[3.602817] [drm] nouveau :01:00.0: ... BIOS signature not found
[3.604294] [drm] nouveau :01:00.0: Checking PROM for VBIOS
[3.605822] [drm] nouveau :01:00.0: ... BIOS signature not found
[3.607310] [drm] nouveau :01:00.0: Checking ACPI for VBIOS
[3.856854] [drm] nouveau :01:00.0: ... appears to be valid
[3.859409] [drm] nouveau :01:00.0: Using VBIOS from ACPI
[3.861907] [drm] nouveau :01:00.0: BIT BIOS found
[3.864369] [drm] nouveau :01:00.0: Bios version 70.18.5d.00
[3.866829] [drm] nouveau :01:00.0: TMDS table version 2.0
[3.869479] [drm] nouveau :01:00.0: MXM: no VBIOS data, nothing to do
[3.870871] [drm] nouveau :01:00.0: DCB version 4.0
[3.872220] [drm] nouveau :01:00.0: DCB outp 00: 02014300 
[3.873611] [drm] nouveau :01:00.0: DCB conn 00: 0040
[3.874994] [drm] nouveau :01:00.0: DCB conn 01: 00410146
[3.876367] [drm] nouveau :01:00.0: DCB conn 02: 1261
[3.877719] [drm] nouveau :01:00.0: DCB conn 03: 2330
[3.879043] [drm] nouveau :01:00.0: DCB conn 04: 0400
[3.880355] [drm] nouveau :01:00.0: DCB conn 05: 0560
[3.881662] [drm] nouveau :01:00.0: Adaptor not initialised, running 
VBIOS init tables.
[3.882961] [drm] nouveau :01:00.0: Parsing VBIOS init table 0 at offset 
0xDECD
[3.936538] [drm] nouveau :01:00.0: 0xDE34: i2c wr fail: -6
[3.957932] [drm] nouveau :01:00.0: Parsing VBIOS init table 1 at offset 
0xE378
[3.987046] [drm] nouveau :01:00.0: Parsing VBIOS init table 2 at offset 
0xEF4B
[3.988396] [drm] nouveau :01:00.0: Parsing VBIOS init table 3 at offset 
0xEF64
[3.990741] [drm] nouveau :01:00.0: Parsing VBIOS init table 4 at offset 
0xF04B
[3.992020] [drm] nouveau :01:00.0: Parsing VBIOS init table at offset 
0xF0B0
[4.018084] [TTM] Zone  kernel: Available graphics memory: 1917766 kiB
[4.019438] [TTM] Initializing pool allocator
[4.020694] [TTM] Initializing DMA pool allocator
[4.021914] [drm] nouveau :01:00.0: Detected 1024MiB VRAM (DDR3)
[4.024515] [drm] nouveau :01:00.0: 512 MiB GART (aperture)
[4.083748] [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
[4.084909] [drm] No driver support for vblank timestamp query.
[4.085985] [drm] nouveau :01:00.0: ACPI backlight interface available, 
not registering our own
[4.246449] [drm] nouveau :01:00.0: 3 available performance level(s)
[4.247560] [drm] nouveau :01:00.0: 0: core 135MHz shader 270MHz memory 
135MHz voltage 850mV
[4.248707] [drm] nouveau :01:00.0: 1: core 405MHz shader 810MHz memory 
405MHz voltage 850mV
[4.249807] [drm] nouveau :01:00.0: 3: core 606MHz shader 1468MHz memory 
667MHz voltage 1000mV
[4.250946] [drm] nouveau :01:00.0: c: core 405MHz shader 810MHz memory 
405MHz
[4.

Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-20 Thread Marcin Slusarz
On Sat, Oct 20, 2012 at 10:28:46PM +0200, Marcin Slusarz wrote:
> On Sat, Oct 20, 2012 at 12:42:38PM +0200, Heinz Diehl wrote:
> > On 20.10.2012, Martin Peres wrote: 
> > 
> > > Can you test the attached patch too ? I rebased the previous one I sent on
> > > top on 3.7-rc1 as I accidentally used an older version.
> > 
> > Yes, of course.
> > 
> > Tried it. Unfortunately, the crash remains the same as reported.
> 
> Try this one.
> 
> Now, the question is: could 3.6 kernel get VBIOS by ACPI?
> If yes, please mount debugfs and send vbios.rom to me please.
> (cat /sys/kernel/debug/dri/0/vbios.rom > vbios.rom)
> 
> ---
> From: Marcin Slusarz 
> Subject: [PATCH] drm/nouveau: validate vbios size
> 
> Without checking, we could detect vbios size as 0, allocate 0-byte array
> (kmalloc returns invalid pointer for such allocation) and crash in
> nouveau_bios_score while checking for vbios signature.
> 
> Reported-by: Heinz Diehl 

And of course:
Reported-by: Pawe? Sikora 

> Signed-off-by: Marcin Slusarz 
> ---
>  drivers/gpu/drm/nouveau/core/subdev/bios/base.c | 16 +---
>  1 file changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c 
> b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> index dcb5c2b..824eea0 100644
> --- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> @@ -72,7 +72,7 @@ nouveau_bios_shadow_of(struct nouveau_bios *bios)
>   }
>  
>   data = of_get_property(dn, "NVDA,BMP", &size);
> - if (data) {
> + if (data && size) {
>   bios->size = size;
>   bios->data = kmalloc(bios->size, GFP_KERNEL);
>   if (bios->data)
> @@ -104,6 +104,9 @@ nouveau_bios_shadow_pramin(struct nouveau_bios *bios)
>   goto out;
>  
>   bios->size = nv_rd08(bios, 0x72) * 512;
> + if (!bios->size)
> + goto out;
> +
>   bios->data = kmalloc(bios->size, GFP_KERNEL);
>   if (bios->data) {
>   for (i = 0; i < bios->size; i++)
> @@ -155,6 +158,9 @@ nouveau_bios_shadow_prom(struct nouveau_bios *bios)
>  
>   /* read entire bios image to system memory */
>   bios->size = nv_rd08(bios, 0x32) * 512;
> + if (!bios->size)
> + goto out;
> +
>   bios->data = kmalloc(bios->size, GFP_KERNEL);
>   if (bios->data) {
>   for (i = 0; i < bios->size; i++)
> @@ -194,6 +200,8 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios)
>   bios->size = 0;
>   if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3)
>   bios->size = data[2] * 512;
> + if (!bios->size)
> + return;
>  
>   bios->data = kmalloc(bios->size, GFP_KERNEL);
>   for (i = 0; bios->data && i < bios->size; i += cnt) {
> @@ -229,12 +237,14 @@ nouveau_bios_shadow_pci(struct nouveau_bios *bios)
>  static int
>  nouveau_bios_score(struct nouveau_bios *bios, const bool writeable)
>  {
> - if (!bios->data || bios->data[0] != 0x55 || bios->data[1] != 0xAA) {
> + if (bios->size < 3 || !bios->data || bios->data[0] != 0x55 ||
> + bios->data[1] != 0xAA) {
>   nv_info(bios, "... signature not found\n");
>   return 0;
>   }
>  
> - if (nvbios_checksum(bios->data, bios->data[2] * 512)) {
> + if (nvbios_checksum(bios->data,
> + min_t(u32, bios->data[2] * 512, bios->size))) {
>   nv_info(bios, "... checksum invalid\n");
>   /* if a ro image is somewhat bad, it's probably all rubbish */
>   return writeable ? 2 : 1;
> -- 


Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-20 Thread Marcin Slusarz
On Sat, Oct 20, 2012 at 12:42:38PM +0200, Heinz Diehl wrote:
> On 20.10.2012, Martin Peres wrote: 
> 
> > Can you test the attached patch too ? I rebased the previous one I sent on
> > top on 3.7-rc1 as I accidentally used an older version.
> 
> Yes, of course.
> 
> Tried it. Unfortunately, the crash remains the same as reported.

Try this one.

Now, the question is: could 3.6 kernel get VBIOS by ACPI?
If yes, please mount debugfs and send vbios.rom to me please.
(cat /sys/kernel/debug/dri/0/vbios.rom > vbios.rom)

---
From: Marcin Slusarz 
Subject: [PATCH] drm/nouveau: validate vbios size

Without checking, we could detect vbios size as 0, allocate 0-byte array
(kmalloc returns invalid pointer for such allocation) and crash in
nouveau_bios_score while checking for vbios signature.

Reported-by: Heinz Diehl 
Signed-off-by: Marcin Slusarz 
---
 drivers/gpu/drm/nouveau/core/subdev/bios/base.c | 16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c 
b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
index dcb5c2b..824eea0 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
@@ -72,7 +72,7 @@ nouveau_bios_shadow_of(struct nouveau_bios *bios)
}

data = of_get_property(dn, "NVDA,BMP", &size);
-   if (data) {
+   if (data && size) {
bios->size = size;
bios->data = kmalloc(bios->size, GFP_KERNEL);
if (bios->data)
@@ -104,6 +104,9 @@ nouveau_bios_shadow_pramin(struct nouveau_bios *bios)
goto out;

bios->size = nv_rd08(bios, 0x72) * 512;
+   if (!bios->size)
+   goto out;
+
bios->data = kmalloc(bios->size, GFP_KERNEL);
if (bios->data) {
for (i = 0; i < bios->size; i++)
@@ -155,6 +158,9 @@ nouveau_bios_shadow_prom(struct nouveau_bios *bios)

/* read entire bios image to system memory */
bios->size = nv_rd08(bios, 0x32) * 512;
+   if (!bios->size)
+   goto out;
+
bios->data = kmalloc(bios->size, GFP_KERNEL);
if (bios->data) {
for (i = 0; i < bios->size; i++)
@@ -194,6 +200,8 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios)
bios->size = 0;
if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3)
bios->size = data[2] * 512;
+   if (!bios->size)
+   return;

bios->data = kmalloc(bios->size, GFP_KERNEL);
for (i = 0; bios->data && i < bios->size; i += cnt) {
@@ -229,12 +237,14 @@ nouveau_bios_shadow_pci(struct nouveau_bios *bios)
 static int
 nouveau_bios_score(struct nouveau_bios *bios, const bool writeable)
 {
-   if (!bios->data || bios->data[0] != 0x55 || bios->data[1] != 0xAA) {
+   if (bios->size < 3 || !bios->data || bios->data[0] != 0x55 ||
+   bios->data[1] != 0xAA) {
nv_info(bios, "... signature not found\n");
return 0;
}

-   if (nvbios_checksum(bios->data, bios->data[2] * 512)) {
+   if (nvbios_checksum(bios->data,
+   min_t(u32, bios->data[2] * 512, bios->size))) {
nv_info(bios, "... checksum invalid\n");
/* if a ro image is somewhat bad, it's probably all rubbish */
return writeable ? 2 : 1;
-- 
1.7.12



Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-20 Thread Marcin Slusarz
On Sat, Oct 20, 2012 at 11:20:36PM +0200, Heinz Diehl wrote:
> On 20.10.2012, Marcin Slusarz wrote: 
> 
> > Try this one.
> 
> It works, now I can boot again. However, nouveau seems to be dead now.
> The dmesg output with your patch on top of 3.7-rc1 is:
> 
> [3.685909] [drm] Initialized i915 1.6.0 20080730 for :00:02.0 on 
> minor 0
> [3.687784] nouveau  [  DEVICE][:01:00.0] BOOT0  : 0x0a8800b1
> [3.689960] nouveau  [  DEVICE][:01:00.0] Chipset: GT218 (NVA8)
> [3.692471] nouveau  [  DEVICE][:01:00.0] Family : NV50
> [3.695716] nouveau  [   VBIOS][:01:00.0] checking PRAMIN for image...
> [3.697087] nouveau  [   VBIOS][:01:00.0] ... signature not found
> [3.698471] nouveau  [   VBIOS][:01:00.0] checking PROM for image...
> [3.699838] nouveau  [   VBIOS][:01:00.0] ... signature not found
> [3.701223] nouveau  [   VBIOS][:01:00.0] checking ACPI for image...
> [3.702684] ACPI Error: Field [ROMI] Base+Offset+Width 0+24+1 is beyond 
> end of region [VROM] (length 24) (20120913/exfldio-210)
> [3.704139] ACPI Error: Method parse/execution 
> failed[\_SB_.PCI0.PEG1.GFX0._ROM] (Node 880142e85cf8), 
> AE_AML_REGION_LIMIT (20120913/psparse-536)
> [3.716183] failed to evaluate ROM got AE_AML_REGION_LIMIT
> [3.718776] nouveau  [   VBIOS][:01:00.0] ... signature not found
> [3.721349] nouveau  [   VBIOS][:01:00.0] checking PCIROM for image...
> [3.724111] nouveau :01:00.0: Invalid ROM contents
> [3.726663] nouveau  [   VBIOS][:01:00.0] ... signature not found
> [3.729159] nouveau E[   VBIOS][:01:00.0] unable to locate usable image
> [3.731677] nouveau E[  DEVICE][:01:00.0] failed to create 0x1001, 
> -22
> [3.734231] nouveau E[ DRM] failed to create 0x8080, -22
> [3.736097] nouveau: probe of :01:00.0 failed with error -22
> [3.740523] dracut: Starting plymouth daemon

Hmm, maybe we can't fetch 3 bytes only...

Let's check this:

---
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c 
b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
index 824eea0..8bd71aa 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
@@ -192,14 +192,16 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios)
 {
struct pci_dev *pdev = nv_device(bios)->pdev;
int ret, cnt, i;
-   u8  data[3];
+   u8  *data;
 
if (!nouveau_acpi_rom_supported(pdev))
return;
 
bios->size = 0;
-   if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3)
+   data = kmalloc(4096, GFP_KERNEL);
+   if (data && nouveau_acpi_get_bios_chunk(data, 0, 4096) >= 3)
bios->size = data[2] * 512;
+   kfree(data);
if (!bios->size)
return;
 
---

Please attach acpidump output.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-20 Thread Marcin Slusarz
On Sat, Oct 20, 2012 at 11:42:17PM +0200, Marcin Slusarz wrote:
> On Sat, Oct 20, 2012 at 11:20:36PM +0200, Heinz Diehl wrote:
> > On 20.10.2012, Marcin Slusarz wrote: 
> > 
> > > Try this one.
> > 
> > It works, now I can boot again. However, nouveau seems to be dead now.
> > The dmesg output with your patch on top of 3.7-rc1 is:
> > 
> > [3.685909] [drm] Initialized i915 1.6.0 20080730 for :00:02.0 on 
> > minor 0
> > [3.687784] nouveau  [  DEVICE][:01:00.0] BOOT0  : 0x0a8800b1
> > [3.689960] nouveau  [  DEVICE][:01:00.0] Chipset: GT218 (NVA8)
> > [3.692471] nouveau  [  DEVICE][:01:00.0] Family : NV50
> > [3.695716] nouveau  [   VBIOS][:01:00.0] checking PRAMIN for 
> > image...
> > [3.697087] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.698471] nouveau  [   VBIOS][:01:00.0] checking PROM for image...
> > [3.699838] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.701223] nouveau  [   VBIOS][:01:00.0] checking ACPI for image...
> > [3.702684] ACPI Error: Field [ROMI] Base+Offset+Width 0+24+1 is beyond 
> > end of region [VROM] (length 24) (20120913/exfldio-210)
> > [3.704139] ACPI Error: Method parse/execution 
> > failed[\_SB_.PCI0.PEG1.GFX0._ROM] (Node 880142e85cf8), 
> > AE_AML_REGION_LIMIT (20120913/psparse-536)
> > [3.716183] failed to evaluate ROM got AE_AML_REGION_LIMIT
> > [3.718776] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.721349] nouveau  [   VBIOS][:01:00.0] checking PCIROM for 
> > image...
> > [3.724111] nouveau :01:00.0: Invalid ROM contents
> > [3.726663] nouveau  [   VBIOS][:01:00.0] ... signature not found
> > [3.729159] nouveau E[   VBIOS][:01:00.0] unable to locate usable 
> > image
> > [3.731677] nouveau E[  DEVICE][:01:00.0] failed to create 
> > 0x1001, -22
> > [3.734231] nouveau E[ DRM] failed to create 0x8080, -22
> > [3.736097] nouveau: probe of :01:00.0 failed with error -22
> > [3.740523] dracut: Starting plymouth daemon
> > 
> > And here's the same output with plain vanilla 3.6.2:
> > 
> > [3.588791] [drm] nouveau :01:00.0: Detected an NV50 generation card 
> > (0x0a8800b1)
> > [3.599783] vga_switcheroo: enabled
> > [3.601303] [drm] nouveau :01:00.0: Checking PRAMIN for VBIOS
> > [3.602817] [drm] nouveau :01:00.0: ... BIOS signature not found
> > [3.604294] [drm] nouveau :01:00.0: Checking PROM for VBIOS
> > [3.605822] [drm] nouveau :01:00.0: ... BIOS signature not found
> > [3.607310] [drm] nouveau :01:00.0: Checking ACPI for VBIOS
> > [3.856854] [drm] nouveau :01:00.0: ... appears to be valid
> > [3.859409] [drm] nouveau :01:00.0: Using VBIOS from ACPI
> > [3.861907] [drm] nouveau :01:00.0: BIT BIOS found
> > [3.864369] [drm] nouveau :01:00.0: Bios version 70.18.5d.00
> > [3.866829] [drm] nouveau :01:00.0: TMDS table version 2.0
> > [3.869479] [drm] nouveau :01:00.0: MXM: no VBIOS data, nothing to do
> > [3.870871] [drm] nouveau :01:00.0: DCB version 4.0
> > [3.872220] [drm] nouveau :01:00.0: DCB outp 00: 02014300 
> > [3.873611] [drm] nouveau :01:00.0: DCB conn 00: 0040
> > [3.874994] [drm] nouveau :01:00.0: DCB conn 01: 00410146
> > [3.876367] [drm] nouveau :01:00.0: DCB conn 02: 1261
> > [3.877719] [drm] nouveau :01:00.0: DCB conn 03: 2330
> > [3.879043] [drm] nouveau :01:00.0: DCB conn 04: 0400
> > [3.880355] [drm] nouveau :01:00.0: DCB conn 05: 0560
> > [3.881662] [drm] nouveau :01:00.0: Adaptor not initialised, running 
> > VBIOS init tables.
> > [3.882961] [drm] nouveau :01:00.0: Parsing VBIOS init table 0 at 
> > offset 0xDECD
> > [3.936538] [drm] nouveau :01:00.0: 0xDE34: i2c wr fail: -6
> > [3.957932] [drm] nouveau :01:00.0: Parsing VBIOS init table 1 at 
> > offset 0xE378
> > [3.987046] [drm] nouveau :01:00.0: Parsing VBIOS init table 2 at 
> > offset 0xEF4B
> > [3.988396] [drm] nouveau :01:00.0: Parsing VBIOS init table 3 at 
> > offset 0xEF64
> > [3.990741] [drm] nouveau :01:00.0: Parsing VBIOS init table 4 at 
> > offset 0xF04B
> > [3.992020] [drm] nouveau :01:00.0: Parsing VBIOS init table at 
> > offset 0xF0B0
> > [4.018084] [TTM] Zone  kernel: Available graphics memory: 1917766 kiB
> > [4.019438] [TTM] Initializing pool allocator
> > [4.020694] [TTM] Initializing DMA pool allocator
> > [4.021914] [drm] nouveau :01:00.0: Detected 1024MiB VRAM (DDR3)
> > [4.024515] [drm] nouveau :01:00.0: 512 MiB GART (aperture)
> > [4.083748] [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
> > [4.084909] [drm] No driver support for vblank timestamp query.
> > [4.085985] [drm] nouveau :01:00.0: ACPI backlight interface 
> > available, not registering our own
> > 

Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-20 Thread Marcin Slusarz
On Sat, Oct 20, 2012 at 11:20:36PM +0200, Heinz Diehl wrote:
> On 20.10.2012, Marcin Slusarz wrote: 
> 
> > Try this one.
> 
> It works, now I can boot again. However, nouveau seems to be dead now.
> The dmesg output with your patch on top of 3.7-rc1 is:
> 
> [3.685909] [drm] Initialized i915 1.6.0 20080730 for :00:02.0 on 
> minor 0
> [3.687784] nouveau  [  DEVICE][:01:00.0] BOOT0  : 0x0a8800b1
> [3.689960] nouveau  [  DEVICE][:01:00.0] Chipset: GT218 (NVA8)
> [3.692471] nouveau  [  DEVICE][:01:00.0] Family : NV50
> [3.695716] nouveau  [   VBIOS][:01:00.0] checking PRAMIN for image...
> [3.697087] nouveau  [   VBIOS][:01:00.0] ... signature not found
> [3.698471] nouveau  [   VBIOS][:01:00.0] checking PROM for image...
> [3.699838] nouveau  [   VBIOS][:01:00.0] ... signature not found
> [3.701223] nouveau  [   VBIOS][:01:00.0] checking ACPI for image...
> [3.702684] ACPI Error: Field [ROMI] Base+Offset+Width 0+24+1 is beyond 
> end of region [VROM] (length 24) (20120913/exfldio-210)
> [3.704139] ACPI Error: Method parse/execution 
> failed[\_SB_.PCI0.PEG1.GFX0._ROM] (Node 880142e85cf8), 
> AE_AML_REGION_LIMIT (20120913/psparse-536)
> [3.716183] failed to evaluate ROM got AE_AML_REGION_LIMIT
> [3.718776] nouveau  [   VBIOS][:01:00.0] ... signature not found
> [3.721349] nouveau  [   VBIOS][:01:00.0] checking PCIROM for image...
> [3.724111] nouveau :01:00.0: Invalid ROM contents
> [3.726663] nouveau  [   VBIOS][:01:00.0] ... signature not found
> [3.729159] nouveau E[   VBIOS][:01:00.0] unable to locate usable image
> [3.731677] nouveau E[  DEVICE][:01:00.0] failed to create 0x1001, 
> -22
> [3.734231] nouveau E[ DRM] failed to create 0x8080, -22
> [3.736097] nouveau: probe of :01:00.0 failed with error -22
> [3.740523] dracut: Starting plymouth daemon
> 
> And here's the same output with plain vanilla 3.6.2:
> 
> [3.588791] [drm] nouveau :01:00.0: Detected an NV50 generation card 
> (0x0a8800b1)
> [3.599783] vga_switcheroo: enabled
> [3.601303] [drm] nouveau :01:00.0: Checking PRAMIN for VBIOS
> [3.602817] [drm] nouveau :01:00.0: ... BIOS signature not found
> [3.604294] [drm] nouveau :01:00.0: Checking PROM for VBIOS
> [3.605822] [drm] nouveau :01:00.0: ... BIOS signature not found
> [3.607310] [drm] nouveau :01:00.0: Checking ACPI for VBIOS
> [3.856854] [drm] nouveau :01:00.0: ... appears to be valid
> [3.859409] [drm] nouveau :01:00.0: Using VBIOS from ACPI
> [3.861907] [drm] nouveau :01:00.0: BIT BIOS found
> [3.864369] [drm] nouveau :01:00.0: Bios version 70.18.5d.00
> [3.866829] [drm] nouveau :01:00.0: TMDS table version 2.0
> [3.869479] [drm] nouveau :01:00.0: MXM: no VBIOS data, nothing to do
> [3.870871] [drm] nouveau :01:00.0: DCB version 4.0
> [3.872220] [drm] nouveau :01:00.0: DCB outp 00: 02014300 
> [3.873611] [drm] nouveau :01:00.0: DCB conn 00: 0040
> [3.874994] [drm] nouveau :01:00.0: DCB conn 01: 00410146
> [3.876367] [drm] nouveau :01:00.0: DCB conn 02: 1261
> [3.877719] [drm] nouveau :01:00.0: DCB conn 03: 2330
> [3.879043] [drm] nouveau :01:00.0: DCB conn 04: 0400
> [3.880355] [drm] nouveau :01:00.0: DCB conn 05: 0560
> [3.881662] [drm] nouveau :01:00.0: Adaptor not initialised, running 
> VBIOS init tables.
> [3.882961] [drm] nouveau :01:00.0: Parsing VBIOS init table 0 at 
> offset 0xDECD
> [3.936538] [drm] nouveau :01:00.0: 0xDE34: i2c wr fail: -6
> [3.957932] [drm] nouveau :01:00.0: Parsing VBIOS init table 1 at 
> offset 0xE378
> [3.987046] [drm] nouveau :01:00.0: Parsing VBIOS init table 2 at 
> offset 0xEF4B
> [3.988396] [drm] nouveau :01:00.0: Parsing VBIOS init table 3 at 
> offset 0xEF64
> [3.990741] [drm] nouveau :01:00.0: Parsing VBIOS init table 4 at 
> offset 0xF04B
> [3.992020] [drm] nouveau :01:00.0: Parsing VBIOS init table at offset 
> 0xF0B0
> [4.018084] [TTM] Zone  kernel: Available graphics memory: 1917766 kiB
> [4.019438] [TTM] Initializing pool allocator
> [4.020694] [TTM] Initializing DMA pool allocator
> [4.021914] [drm] nouveau :01:00.0: Detected 1024MiB VRAM (DDR3)
> [4.024515] [drm] nouveau :01:00.0: 512 MiB GART (aperture)
> [4.083748] [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
> [4.084909] [drm] No driver support for vblank timestamp query.
> [4.085985] [drm] nouveau :01:00.0: ACPI backlight interface 
> available, not registering our own
> [4.246449] [drm] nouveau :01:00.0: 3 available performance level(s)
> [4.247560] [drm] nouveau :01:00.0: 0: core 135MHz shader 270MHz 
> memory 135MHz voltage 850mV
> [4.248707] [drm] nouveau :01:00.0: 1: core 405MHz shader

Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-20 Thread Marcin Slusarz
On Sat, Oct 20, 2012 at 10:28:46PM +0200, Marcin Slusarz wrote:
> On Sat, Oct 20, 2012 at 12:42:38PM +0200, Heinz Diehl wrote:
> > On 20.10.2012, Martin Peres wrote: 
> > 
> > > Can you test the attached patch too ? I rebased the previous one I sent on
> > > top on 3.7-rc1 as I accidentally used an older version.
> > 
> > Yes, of course.
> > 
> > Tried it. Unfortunately, the crash remains the same as reported.
> 
> Try this one.
> 
> Now, the question is: could 3.6 kernel get VBIOS by ACPI?
> If yes, please mount debugfs and send vbios.rom to me please.
> (cat /sys/kernel/debug/dri/0/vbios.rom > vbios.rom)
> 
> ---
> From: Marcin Slusarz 
> Subject: [PATCH] drm/nouveau: validate vbios size
> 
> Without checking, we could detect vbios size as 0, allocate 0-byte array
> (kmalloc returns invalid pointer for such allocation) and crash in
> nouveau_bios_score while checking for vbios signature.
> 
> Reported-by: Heinz Diehl 

And of course:
Reported-by: Paweł Sikora 

> Signed-off-by: Marcin Slusarz 
> ---
>  drivers/gpu/drm/nouveau/core/subdev/bios/base.c | 16 +---
>  1 file changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c 
> b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> index dcb5c2b..824eea0 100644
> --- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
> @@ -72,7 +72,7 @@ nouveau_bios_shadow_of(struct nouveau_bios *bios)
>   }
>  
>   data = of_get_property(dn, "NVDA,BMP", &size);
> - if (data) {
> + if (data && size) {
>   bios->size = size;
>   bios->data = kmalloc(bios->size, GFP_KERNEL);
>   if (bios->data)
> @@ -104,6 +104,9 @@ nouveau_bios_shadow_pramin(struct nouveau_bios *bios)
>   goto out;
>  
>   bios->size = nv_rd08(bios, 0x72) * 512;
> + if (!bios->size)
> + goto out;
> +
>   bios->data = kmalloc(bios->size, GFP_KERNEL);
>   if (bios->data) {
>   for (i = 0; i < bios->size; i++)
> @@ -155,6 +158,9 @@ nouveau_bios_shadow_prom(struct nouveau_bios *bios)
>  
>   /* read entire bios image to system memory */
>   bios->size = nv_rd08(bios, 0x32) * 512;
> + if (!bios->size)
> + goto out;
> +
>   bios->data = kmalloc(bios->size, GFP_KERNEL);
>   if (bios->data) {
>   for (i = 0; i < bios->size; i++)
> @@ -194,6 +200,8 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios)
>   bios->size = 0;
>   if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3)
>   bios->size = data[2] * 512;
> + if (!bios->size)
> + return;
>  
>   bios->data = kmalloc(bios->size, GFP_KERNEL);
>   for (i = 0; bios->data && i < bios->size; i += cnt) {
> @@ -229,12 +237,14 @@ nouveau_bios_shadow_pci(struct nouveau_bios *bios)
>  static int
>  nouveau_bios_score(struct nouveau_bios *bios, const bool writeable)
>  {
> - if (!bios->data || bios->data[0] != 0x55 || bios->data[1] != 0xAA) {
> + if (bios->size < 3 || !bios->data || bios->data[0] != 0x55 ||
> + bios->data[1] != 0xAA) {
>   nv_info(bios, "... signature not found\n");
>   return 0;
>   }
>  
> - if (nvbios_checksum(bios->data, bios->data[2] * 512)) {
> + if (nvbios_checksum(bios->data,
> + min_t(u32, bios->data[2] * 512, bios->size))) {
>   nv_info(bios, "... checksum invalid\n");
>   /* if a ro image is somewhat bad, it's probably all rubbish */
>   return writeable ? 2 : 1;
> -- 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-20 Thread Marcin Slusarz
On Sat, Oct 20, 2012 at 12:42:38PM +0200, Heinz Diehl wrote:
> On 20.10.2012, Martin Peres wrote: 
> 
> > Can you test the attached patch too ? I rebased the previous one I sent on
> > top on 3.7-rc1 as I accidentally used an older version.
> 
> Yes, of course.
> 
> Tried it. Unfortunately, the crash remains the same as reported.

Try this one.

Now, the question is: could 3.6 kernel get VBIOS by ACPI?
If yes, please mount debugfs and send vbios.rom to me please.
(cat /sys/kernel/debug/dri/0/vbios.rom > vbios.rom)

---
From: Marcin Slusarz 
Subject: [PATCH] drm/nouveau: validate vbios size

Without checking, we could detect vbios size as 0, allocate 0-byte array
(kmalloc returns invalid pointer for such allocation) and crash in
nouveau_bios_score while checking for vbios signature.

Reported-by: Heinz Diehl 
Signed-off-by: Marcin Slusarz 
---
 drivers/gpu/drm/nouveau/core/subdev/bios/base.c | 16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c 
b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
index dcb5c2b..824eea0 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
@@ -72,7 +72,7 @@ nouveau_bios_shadow_of(struct nouveau_bios *bios)
}
 
data = of_get_property(dn, "NVDA,BMP", &size);
-   if (data) {
+   if (data && size) {
bios->size = size;
bios->data = kmalloc(bios->size, GFP_KERNEL);
if (bios->data)
@@ -104,6 +104,9 @@ nouveau_bios_shadow_pramin(struct nouveau_bios *bios)
goto out;
 
bios->size = nv_rd08(bios, 0x72) * 512;
+   if (!bios->size)
+   goto out;
+
bios->data = kmalloc(bios->size, GFP_KERNEL);
if (bios->data) {
for (i = 0; i < bios->size; i++)
@@ -155,6 +158,9 @@ nouveau_bios_shadow_prom(struct nouveau_bios *bios)
 
/* read entire bios image to system memory */
bios->size = nv_rd08(bios, 0x32) * 512;
+   if (!bios->size)
+   goto out;
+
bios->data = kmalloc(bios->size, GFP_KERNEL);
if (bios->data) {
for (i = 0; i < bios->size; i++)
@@ -194,6 +200,8 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios)
bios->size = 0;
if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3)
bios->size = data[2] * 512;
+   if (!bios->size)
+   return;
 
bios->data = kmalloc(bios->size, GFP_KERNEL);
for (i = 0; bios->data && i < bios->size; i += cnt) {
@@ -229,12 +237,14 @@ nouveau_bios_shadow_pci(struct nouveau_bios *bios)
 static int
 nouveau_bios_score(struct nouveau_bios *bios, const bool writeable)
 {
-   if (!bios->data || bios->data[0] != 0x55 || bios->data[1] != 0xAA) {
+   if (bios->size < 3 || !bios->data || bios->data[0] != 0x55 ||
+   bios->data[1] != 0xAA) {
nv_info(bios, "... signature not found\n");
return 0;
}
 
-   if (nvbios_checksum(bios->data, bios->data[2] * 512)) {
+   if (nvbios_checksum(bios->data,
+   min_t(u32, bios->data[2] * 512, bios->size))) {
nv_info(bios, "... checksum invalid\n");
/* if a ro image is somewhat bad, it's probably all rubbish */
return writeable ? 2 : 1;
-- 
1.7.12

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-20 Thread Heinz Diehl
On 20.10.2012, Martin Peres wrote: 

> Can you test the attached patch too ? I rebased the previous one I sent on
> top on 3.7-rc1 as I accidentally used an older version.

Yes, of course.

Tried it. Unfortunately, the crash remains the same as reported.



Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-20 Thread Martin Peres
On 20/10/2012 11:26, Heinz Diehl wrote:
> On 20.10.2012, Linus Torvalds wrote:
>
>> Added more appropriate people to this. Added both i915 and nouveau
>> people, since apparently that fine piece of hardware has both.
>>
>> Guys, any ideas?
>
> Plese see https://lkml.org/lkml/2012/10/19/371 , this is the same
> thing going on. Reverting
>
>   Ben Skeggs 
>   drm/nouveau/bios: fix shadowing of ACPI ROMs larger than 64KiB
>
> fixes the problem.

Can you test the attached patch too ? I rebased the previous one I sent 
on top on 3.7-rc1 as I accidentally used an older version.

Martin
-- next part --
A non-text attachment was scrubbed...
Name: 0001-drm-nouveau-bios-improve-error-handling-when-reading.patch
Type: text/x-patch
Size: 1024 bytes
Desc: not available
URL: 



Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-20 Thread Heinz Diehl
On 20.10.2012, Linus Torvalds wrote:

> Added more appropriate people to this. Added both i915 and nouveau
> people, since apparently that fine piece of hardware has both.
>
> Guys, any ideas?

Plese see https://lkml.org/lkml/2012/10/19/371 , this is the same
thing going on. Reverting

 Ben Skeggs 
 drm/nouveau/bios: fix shadowing of ACPI ROMs larger than 64KiB

fixes the problem.



Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-20 Thread Martin Peres
On 10/19/12 23:25, Linus Torvalds wrote:
> Added more appropriate people to this. Added both i915 and nouveau
> people, since apparently that fine piece of hardware has both.
>
> Guys, any ideas?
>
> Pawe?, could you perhaps get a photo of the oops and post it
> somewhere? I'm assuming the oops happens early during boot and you
> never get a usable machine with dmesg - but if you do, then please do
> post the whole dmesg too.
>
>Linus
Hi Linus,

You must have missed the oops that was attached to the mail: 
http://www.spinics.net/lists/kernel/msg1420355.html

Pawe?, could you try the attached patch please ?

Martin

-- next part --
An HTML attachment was scrubbed...
URL: 

-- next part --
A non-text attachment was scrubbed...
Name: 0001-drm-nouveau-bios-improve-error-handling-when-reading.patch
Type: text/x-patch
Size: 1018 bytes
Desc: not available
URL: 



Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-19 Thread Linus Torvalds
On Fri, Oct 19, 2012 at 3:41 PM, Martin Peres  wrote:
>
> You must have missed the oops that was attached to the mail:
> http://www.spinics.net/lists/kernel/msg1420355.html

I did indeed. So never mind about that dmesg request, Paweł ;-p

> Paweł, could you try the attached patch please ?

Thanks for being on it,

 Linus
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-19 Thread Linus Torvalds
On Fri, Oct 19, 2012 at 3:41 PM, Martin Peres  wrote:
>
> You must have missed the oops that was attached to the mail:
> http://www.spinics.net/lists/kernel/msg1420355.html

I did indeed. So never mind about that dmesg request, Pawe? ;-p

> Pawe?, could you try the attached patch please ?

Thanks for being on it,

 Linus


Re: Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-19 Thread Linus Torvalds
Added more appropriate people to this. Added both i915 and nouveau
people, since apparently that fine piece of hardware has both.

Guys, any ideas?

Paweł, could you perhaps get a photo of the oops and post it
somewhere? I'm assuming the oops happens early during boot and you
never get a usable machine with dmesg - but if you do, then please do
post the whole dmesg too.

  Linus

On Thu, Oct 18, 2012 at 12:32 AM, Paweł Sikora  wrote:
> Hi,
>
> the new 3.7.0-rc1-00078-g8d2b6b3 kernel oopses during startup on my asus 
> laptop
> with nvidia optimius crap and the builtin core-i7 graphics doesn't start.
> the 3.5/3.6 kernels work fine, so this looks like a fresh regression.
>
> BR,
> Paweł.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Linux 3.7-rc1 (nouveau_bios_score oops).

2012-10-19 Thread Linus Torvalds
Added more appropriate people to this. Added both i915 and nouveau
people, since apparently that fine piece of hardware has both.

Guys, any ideas?

Pawe?, could you perhaps get a photo of the oops and post it
somewhere? I'm assuming the oops happens early during boot and you
never get a usable machine with dmesg - but if you do, then please do
post the whole dmesg too.

  Linus

On Thu, Oct 18, 2012 at 12:32 AM, Pawe? Sikora  wrote:
> Hi,
>
> the new 3.7.0-rc1-00078-g8d2b6b3 kernel oopses during startup on my asus 
> laptop
> with nvidia optimius crap and the builtin core-i7 graphics doesn't start.
> the 3.5/3.6 kernels work fine, so this looks like a fresh regression.
>
> BR,
> Pawe?.