Re: [Nouveau] AGP cards in PCI mode (fake slots like AGPro, AGP Express, AGI, AGX, XGP)

2015-09-13 Thread Ilia Mirkin
On Sun, Sep 13, 2015 at 2:57 PM, Ondrej Zary  wrote:
> Hello,
> I have a PC Chips A31G board with AGPro slot and found that nouveau does not
> work properly with it. Console works but reverts to software mode, X11 hangs
> with mouse cursor only.
>
> The slot is physically AGP 1.5V but is wired to PCI bus as the chipset (SiS
> 761) does not support AGP cards. To further complicate things, the chipset has
> AGP capability - but only for the integrated video. You can see that in the
> lspci output below - the AGP card is on bus 0 and SiS card on bus 1 (AGP bus
> behind the AGP bridge). The SiS card is not used (can be disabled in BIOS but
> it does not improve things - as the AGP capability of the host bridge remains
> active).

I believe we can handle it with a blacklist. If the chipset just
doesn't support AGP at all, we should just set agpmode=0 irrespective
of the card plugged in, right?

Shouldn't the agpgart know about this and not even allow any setting
at all? This is where we get the idea to set 8x AGP from. See
drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c for details.

The alternative is to add to nvkm_device_agp_quirks, and just add
something that matches just the host bridge vendor/device, ignoring
the chip.

>
> As seen in dmesg below, kernel tries to set AGP 8x mode for all AGP devices,
> including the AGP 4x TNT2 card which is not even connected to the AGP bridge.
>
> Setting nouveau.agpmode=0 makes it work but how can we make this case work
> automatically?
>
> Radeon driver does some "ring test" and if it fails, it disables AGP mode and
> retries. That seems to work a bit (with R7000 but not with R7200).
>
> But I think that we shouldn't even touch the AGP registers of other devices
> in this case as it might break the integrated video.
> But how can we know that the card is connected to the AGP bus? There does not
> seem to be a reliable way...
>
> dmesg:
> [   22.015411] nouveau  [  DEVICE][:00:05.0] BOOT0  : 0x20154000
> [   22.015473] nouveau  [  DEVICE][:00:05.0] Chipset: NV05 (NV05)
> [   22.015527] nouveau  [  DEVICE][:00:05.0] Family : NV04
> [   22.041131] nouveau  [   VBIOS][:00:05.0] using image from PRAMIN
> [   22.041194] nouveau  [   VBIOS][:00:05.0] BMP version 5.6
> [   22.041382] nouveau  [   VBIOS][:00:05.0] version 02.05.20.02.00
> [   22.041561] nouveau W[   VBIOS][:00:05.0] DCB table not found
> [   22.041867] nouveau W[   VBIOS][:00:05.0] DCB table not found
> [   22.042079] nouveau W[   VBIOS][:00:05.0] DCB table not found
> [   22.042133] nouveau W[   VBIOS][:00:05.0] DCB table not found
> [   22.042245] nouveau W[  PTIMER][:00:05.0] unknown input clock freq
> [   22.042306] nouveau  [ PFB][:00:05.0] RAM type: SDRAM
> [   22.042360] nouveau  [ PFB][:00:05.0] RAM size: 32 MiB
> [   22.042413] nouveau  [ PFB][:00:05.0]ZCOMP: 0 tags
> [   22.047063] nouveau  [ CLK][:00:05.0] --:
> [   22.047137] nouveau W[   VBIOS][:00:05.0] DCB table not found
> [   22.047220] agpgart-amd64 :00:00.0: AGP 3.0 bridge
> [   22.047281] agpgart: systemd-udevd tried to set rate=x12. Setting to AGP3 
> x8 mode.
> [   22.047348] agpgart-amd64 :00:00.0: putting AGP V3 device into 8x mode
> [   22.047425] nouveau :00:05.0: putting AGP V3 device into 8x mode
> [   22.047503] pci :01:00.0: putting AGP V3 device into 8x mode
> [   22.047632] [TTM] Zone  kernel: Available graphics memory: 239112 kiB
> [   22.047685] [TTM] Initializing pool allocator
> [   22.047744] [TTM] Initializing DMA pool allocator
> [   22.047814] nouveau  [ DRM] VRAM: 31 MiB
> [   22.047865] nouveau  [ DRM] GART: 64 MiB
> [   22.047918] nouveau  [ DRM] BMP version 5.6
> [   22.047971] nouveau W[ DRM] No DCB data found in VBIOS
> [   22.051250] nouveau  [ DRM] Saving VGA fonts
> [   22.099912] nouveau W[ DRM] No DCB data found in VBIOS
> [   22.101006] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
> [   22.101061] [drm] Driver supports precise vblank timestamp query.
> [   22.102645] nouveau  [ DRM] MM: using M2MF for buffer copies
> [   22.133344] nouveau  [ DRM] allocated 1280x1024 fb: 0x4000, bo db2d6c00
> [   22.133545] fbcon: nouveaufb (fb0) is primary device
> [   22.369387] nouveau E[ DRM] GPU lockup - switching to software fbcon
> [   22.378443] Console: switching to colour frame buffer device 160x64
> [   22.395704] nouveau :00:05.0: fb0: nouveaufb frame buffer device
> [   22.395808] nouveau :00:05.0: registered panic notifier
> [   22.396783] [drm] Initialized nouveau 1.2.2 20120801 for :00:05.0 on 
> minor 0
>
> lspci -vvnn:
> 00:00.0 Host bridge [0600]: Silicon Integrated Systems [SiS] 761/M761 Host 
> [1039:0761] (rev 01)
> Subsystem: Elitegroup Computer Systems Device [1019:0131]
> Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- 
> Stepping- SERR- FastB2B- DisINTx-
> Status: Cap+ 

Re: [Nouveau] AGP cards in PCI mode (fake slots like AGPro, AGP Express, AGI, AGX, XGP)

2015-09-13 Thread Ondrej Zary
On Sunday 13 September 2015 21:12:25 Ilia Mirkin wrote:
> On Sun, Sep 13, 2015 at 2:57 PM, Ondrej Zary  
> wrote:
> > Hello,
> > I have a PC Chips A31G board with AGPro slot and found that nouveau does
> > not work properly with it. Console works but reverts to software mode,
> > X11 hangs with mouse cursor only.
> >
> > The slot is physically AGP 1.5V but is wired to PCI bus as the chipset
> > (SiS 761) does not support AGP cards. To further complicate things, the
> > chipset has AGP capability - but only for the integrated video. You can
> > see that in the lspci output below - the AGP card is on bus 0 and SiS
> > card on bus 1 (AGP bus behind the AGP bridge). The SiS card is not used
> > (can be disabled in BIOS but it does not improve things - as the AGP
> > capability of the host bridge remains active).
>
> I believe we can handle it with a blacklist. If the chipset just
> doesn't support AGP at all, we should just set agpmode=0 irrespective
> of the card plugged in, right?
>
> Shouldn't the agpgart know about this and not even allow any setting
> at all? This is where we get the idea to set 8x AGP from. See
> drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c for details.

The chipset does not support AGP slot but supports AGP for the integrated
video. So it shouldn't be completely disabled.

> The alternative is to add to nvkm_device_agp_quirks, and just add
> something that matches just the host bridge vendor/device, ignoring
> the chip.

Something like this?

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c
index 814cb51..385a90f 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c
@@ -35,6 +35,8 @@ static const struct nvkm_device_agp_quirk
 nvkm_device_agp_quirks[] = {
/* VIA Apollo PRO133x / GeForce FX 5600 Ultra - fdo#20341 */
{ PCI_VENDOR_ID_VIA, 0x0691, PCI_VENDOR_ID_NVIDIA, 0x0311, 2 },
+   /* SiS 761 does not support AGP cards, use PCI mode */
+   { PCI_VENDOR_ID_SI, 0x0761, PCI_ANY_ID, PCI_ANY_ID, 0 },
{},
 };
 
@@ -137,8 +139,10 @@ nvkm_agp_ctor(struct nvkm_pci *pci)
while (quirk->hostbridge_vendor) {
if (info.device->vendor == quirk->hostbridge_vendor &&
info.device->device == quirk->hostbridge_device &&
-   pci->pdev->vendor == quirk->chip_vendor &&
-   pci->pdev->device == quirk->chip_device) {
+   (quirk->chip_vendor == (u16)PCI_ANY_ID ||
+   pci->pdev->vendor == quirk->chip_vendor) &&
+   (quirk->chip_device == (u16)PCI_ANY_ID ||
+   pci->pdev->device == quirk->chip_device)) {
nvkm_info(subdev, "forcing default agp mode to %dX, "
  "use NvAGP= to override\n",
  quirk->mode);
-- 
Ondrej Zary
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] AGP cards in PCI mode (fake slots like AGPro, AGP Express, AGI, AGX, XGP)

2015-09-13 Thread Ilia Mirkin
On Sun, Sep 13, 2015 at 6:01 PM, Ondrej Zary  wrote:
> On Sunday 13 September 2015 21:12:25 Ilia Mirkin wrote:
>> On Sun, Sep 13, 2015 at 2:57 PM, Ondrej Zary  
>> wrote:
>> > Hello,
>> > I have a PC Chips A31G board with AGPro slot and found that nouveau does
>> > not work properly with it. Console works but reverts to software mode,
>> > X11 hangs with mouse cursor only.
>> >
>> > The slot is physically AGP 1.5V but is wired to PCI bus as the chipset
>> > (SiS 761) does not support AGP cards. To further complicate things, the
>> > chipset has AGP capability - but only for the integrated video. You can
>> > see that in the lspci output below - the AGP card is on bus 0 and SiS
>> > card on bus 1 (AGP bus behind the AGP bridge). The SiS card is not used
>> > (can be disabled in BIOS but it does not improve things - as the AGP
>> > capability of the host bridge remains active).
>>
>> I believe we can handle it with a blacklist. If the chipset just
>> doesn't support AGP at all, we should just set agpmode=0 irrespective
>> of the card plugged in, right?
>>
>> Shouldn't the agpgart know about this and not even allow any setting
>> at all? This is where we get the idea to set 8x AGP from. See
>> drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c for details.
>
> The chipset does not support AGP slot but supports AGP for the integrated
> video. So it shouldn't be completely disabled.
>
>> The alternative is to add to nvkm_device_agp_quirks, and just add
>> something that matches just the host bridge vendor/device, ignoring
>> the chip.
>
> Something like this?

Yes, precisely what I had in mind. I don't know if this is the "right"
solution, but it'll definitely work. Ideally we'd somehow find out
from the agpgart that we shouldn't be trying to use AGP, since adding
this quirk to every agp-supporting driver seems like a pain. OTOH this
is long-dead hardware, so a quick hack like this is fine by me. radeon
has a much more extensive list IIRC, may want to add it in there as
well for good measure if it's not already there.

  -ilia

>
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c 
> b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c
> index 814cb51..385a90f 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.c
> @@ -35,6 +35,8 @@ static const struct nvkm_device_agp_quirk
>  nvkm_device_agp_quirks[] = {
> /* VIA Apollo PRO133x / GeForce FX 5600 Ultra - fdo#20341 */
> { PCI_VENDOR_ID_VIA, 0x0691, PCI_VENDOR_ID_NVIDIA, 0x0311, 2 },
> +   /* SiS 761 does not support AGP cards, use PCI mode */
> +   { PCI_VENDOR_ID_SI, 0x0761, PCI_ANY_ID, PCI_ANY_ID, 0 },
> {},
>  };
>
> @@ -137,8 +139,10 @@ nvkm_agp_ctor(struct nvkm_pci *pci)
> while (quirk->hostbridge_vendor) {
> if (info.device->vendor == quirk->hostbridge_vendor &&
> info.device->device == quirk->hostbridge_device &&
> -   pci->pdev->vendor == quirk->chip_vendor &&
> -   pci->pdev->device == quirk->chip_device) {
> +   (quirk->chip_vendor == (u16)PCI_ANY_ID ||
> +   pci->pdev->vendor == quirk->chip_vendor) &&
> +   (quirk->chip_device == (u16)PCI_ANY_ID ||
> +   pci->pdev->device == quirk->chip_device)) {
> nvkm_info(subdev, "forcing default agp mode to %dX, "
>   "use NvAGP= to override\n",
>   quirk->mode);
> --
> Ondrej Zary
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] AGP cards in PCI mode (fake slots like AGPro, AGP Express, AGI, AGX, XGP)

2015-09-13 Thread Alex Deucher
On Sun, Sep 13, 2015 at 2:57 PM, Ondrej Zary  wrote:
> Hello,
> I have a PC Chips A31G board with AGPro slot and found that nouveau does not
> work properly with it. Console works but reverts to software mode, X11 hangs
> with mouse cursor only.
>
> The slot is physically AGP 1.5V but is wired to PCI bus as the chipset (SiS
> 761) does not support AGP cards. To further complicate things, the chipset has
> AGP capability - but only for the integrated video. You can see that in the
> lspci output below - the AGP card is on bus 0 and SiS card on bus 1 (AGP bus
> behind the AGP bridge). The SiS card is not used (can be disabled in BIOS but
> it does not improve things - as the AGP capability of the host bridge remains
> active).
>
> As seen in dmesg below, kernel tries to set AGP 8x mode for all AGP devices,
> including the AGP 4x TNT2 card which is not even connected to the AGP bridge.
>
> Setting nouveau.agpmode=0 makes it work but how can we make this case work
> automatically?
>
> Radeon driver does some "ring test" and if it fails, it disables AGP mode and
> retries. That seems to work a bit (with R7000 but not with R7200).

You can boot with radeon.agpmode=-1 to force pci mode.

Alex

>
> But I think that we shouldn't even touch the AGP registers of other devices
> in this case as it might break the integrated video.
> But how can we know that the card is connected to the AGP bus? There does not
> seem to be a reliable way...
>
> dmesg:
> [   22.015411] nouveau  [  DEVICE][:00:05.0] BOOT0  : 0x20154000
> [   22.015473] nouveau  [  DEVICE][:00:05.0] Chipset: NV05 (NV05)
> [   22.015527] nouveau  [  DEVICE][:00:05.0] Family : NV04
> [   22.041131] nouveau  [   VBIOS][:00:05.0] using image from PRAMIN
> [   22.041194] nouveau  [   VBIOS][:00:05.0] BMP version 5.6
> [   22.041382] nouveau  [   VBIOS][:00:05.0] version 02.05.20.02.00
> [   22.041561] nouveau W[   VBIOS][:00:05.0] DCB table not found
> [   22.041867] nouveau W[   VBIOS][:00:05.0] DCB table not found
> [   22.042079] nouveau W[   VBIOS][:00:05.0] DCB table not found
> [   22.042133] nouveau W[   VBIOS][:00:05.0] DCB table not found
> [   22.042245] nouveau W[  PTIMER][:00:05.0] unknown input clock freq
> [   22.042306] nouveau  [ PFB][:00:05.0] RAM type: SDRAM
> [   22.042360] nouveau  [ PFB][:00:05.0] RAM size: 32 MiB
> [   22.042413] nouveau  [ PFB][:00:05.0]ZCOMP: 0 tags
> [   22.047063] nouveau  [ CLK][:00:05.0] --:
> [   22.047137] nouveau W[   VBIOS][:00:05.0] DCB table not found
> [   22.047220] agpgart-amd64 :00:00.0: AGP 3.0 bridge
> [   22.047281] agpgart: systemd-udevd tried to set rate=x12. Setting to AGP3 
> x8 mode.
> [   22.047348] agpgart-amd64 :00:00.0: putting AGP V3 device into 8x mode
> [   22.047425] nouveau :00:05.0: putting AGP V3 device into 8x mode
> [   22.047503] pci :01:00.0: putting AGP V3 device into 8x mode
> [   22.047632] [TTM] Zone  kernel: Available graphics memory: 239112 kiB
> [   22.047685] [TTM] Initializing pool allocator
> [   22.047744] [TTM] Initializing DMA pool allocator
> [   22.047814] nouveau  [ DRM] VRAM: 31 MiB
> [   22.047865] nouveau  [ DRM] GART: 64 MiB
> [   22.047918] nouveau  [ DRM] BMP version 5.6
> [   22.047971] nouveau W[ DRM] No DCB data found in VBIOS
> [   22.051250] nouveau  [ DRM] Saving VGA fonts
> [   22.099912] nouveau W[ DRM] No DCB data found in VBIOS
> [   22.101006] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
> [   22.101061] [drm] Driver supports precise vblank timestamp query.
> [   22.102645] nouveau  [ DRM] MM: using M2MF for buffer copies
> [   22.133344] nouveau  [ DRM] allocated 1280x1024 fb: 0x4000, bo db2d6c00
> [   22.133545] fbcon: nouveaufb (fb0) is primary device
> [   22.369387] nouveau E[ DRM] GPU lockup - switching to software fbcon
> [   22.378443] Console: switching to colour frame buffer device 160x64
> [   22.395704] nouveau :00:05.0: fb0: nouveaufb frame buffer device
> [   22.395808] nouveau :00:05.0: registered panic notifier
> [   22.396783] [drm] Initialized nouveau 1.2.2 20120801 for :00:05.0 on 
> minor 0
>
> lspci -vvnn:
> 00:00.0 Host bridge [0600]: Silicon Integrated Systems [SiS] 761/M761 Host 
> [1039:0761] (rev 01)
> Subsystem: Elitegroup Computer Systems Device [1019:0131]
> Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- 
> Stepping- SERR- FastB2B- DisINTx-
> Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- 
> SERR-  Latency: 32
> Region 0: Memory at f000 (32-bit, non-prefetchable) [size=64M]
> Capabilities: [a0] AGP version 3.0
> Status: RQ=32 Iso- ArqSz=2 Cal=3 SBA+ ITACoh- GART64- HTrans- 
> 64bit- FW- AGP3+ Rate=x4,x8
> Command: RQ=1 ArqSz=0 Cal=0 SBA+ AGP+ GART64- 64bit- FW- 
> Rate=x8
> Capabilities: [d0]