pci: Handle 5-bit and 8-bit tag field
PATCH v2 1/1 pci: Handle 5-bit and 8-bit tag field
If the hardware supports extended tag field (8-bit ones), then enabled it. This is usually done by the VBIOS, but not on some MBPs (see fdo#86537). In case extended tag field is not supported, 5-bit tag field is used which limits the possible values to 32. Apparently bits 7:0 of 0x8841c stores some number of outstanding requests, so cap it to 32 if extended tag is unsupported.
v2: Restrict changes to chipsets >= 0x84
--- drm/nouveau/nvkm/subdev/pci/base.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
drm/nouveau/nvkm/subdev/pci/base.c +25 -0
@@ -46,6 +46,14 @@ nvkm_pci_wr32(struct nvkm_pci *pci, u16 addr, u32 data) pci->func->wr32 (pci, addr, data); } +u32 +nvkm_pci_mask (struct nvkm_pci *pci,u16 addr,u32 mask,u32 add) +{ +u32 data = pci->func->rd32 (pci, addr); + pci->func->wr32 (pci, addr, (data & ~mask) | add); +return data; +} +void nvkm_pci_rom_shadow (struct nvkm_pci *pci,bool shadow) {
@@ -115,6 +123,23 @@ nvkm_pci_init(struct nvkm_subdev *subdev)if (ret)return ret; +if (pci_is_pcie (pdev) && subdev->device->chipset >=0x84 ) { +/* Tag field is 8-bit long, regardless of EXT_TAG. +* However, if EXT_TAG is disabled, only the lower 5 bits of the tag +* field should be used, limiting the number of request to 32. +* +* Apparently, 0x041c stores some limit on the number of requests +* possible, so if EXT_TAG is disabled, limit that requests number to +* 32 +* +* Fixes fdo#86537 +*/ +if (nvkm_pci_rd32 (pci,0x007c ) &0x00000020 ) +nvkm_pci_mask (pci,0x0080 ,0x00000000 ,0x00000100 ); +else +nvkm_pci_mask (pci,0x041c ,0x00000060 ,0x00000000 ); + } + pci->irq = pdev->irq;return ret; }
Signature · 6 lines
2.5.2 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 1442433134-2406-1-git-send-email-pierre.morrow-GANU6spQydw@public.gmane.org
Quoted 20 lines · Pierre Moreau
If the hardware supports extended tag field (8-bit ones), then enabled it. This is usually done by the VBIOS, but not on some MBPs (see fdo#86537). In case extended tag field is not supported, 5-bit tag field is used which limits the possible values to 32. Apparently bits 7:0 of
0x8841cstores some number of outstanding requests, so cap it to 32 if extended tag is unsupported.Fixes fdo#86537v2: Restrict changes to chipsets >=
0x84Signed-off-by Pierre Moreau <[email protected]>--- drm/nouveau/nvkm/subdev/pci/base.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)drm/nouveau/nvkm/subdev/pci/base.c +0
-0
drm/nouveau/nvkm/subdev/pci/base.c nvkm_pci_wr32(struct nvkm_pci *pci, u16 addr, u32 data) · line 50
Quoted 5 lines
drm/nouveau/nvkm/subdev/pci/base.c +2
-0@@ -46,6 +46,14 @@ nvkm_pci_wr32(struct nvkm_pci *pci, u16 addr, u32 data) pci->func->wr32 (pci, addr, data); } +u32 +nvkm_pci_mask (struct nvkm_pci *pci,u16 addr,u32 mask,u32 add)
Either add this to the header or make it static. I have a mild preference for the latter.
Quoted 16 lines
drm/nouveau/nvkm/subdev/pci/base.c +9
-0+{ +u32 data = pci->func->rd32 (pci, addr); + pci->func->wr32 (pci, addr, (data & ~mask) | add); +return data; +} +void nvkm_pci_rom_shadow (struct nvkm_pci *pci,bool shadow) {@@ -115,6 +123,23 @@ nvkm_pci_init(struct nvkm_subdev *subdev)if (ret)return ret; +if (pci_is_pcie (pdev) && subdev->device->chipset >=0x84 ) { +/* Tag field is 8-bit long, regardless of EXT_TAG. +* However, if EXT_TAG is disabled, only the lower 5 bits of the tag
drm/nouveau/nvkm/subdev/pci/base.c nvkm_pci_init(struct nvkm_subdev *subdev) · line 138
Quoted 10 lines
drm/nouveau/nvkm/subdev/pci/base.c +10
-0+* field should be used, limiting the number of request to 32. +* +* Apparently, 0x041c stores some limit on the number of requests +* possible, so if EXT_TAG is disabled, limit that requests number to +* 32 +* +* Fixes fdo#86537 +*/ +if (nvkm_pci_rd32 (pci,0x007c ) &0x00000020 ) +nvkm_pci_mask (pci,0x0080 ,0x00000000 ,0x00000100 );
Normally this is done as 0x100, 0x100, although your way works. However a future change might mask out any unwanted bits from the value as well...
Quoted 10 lines
drm/nouveau/nvkm/subdev/pci/base.c +4
-1+else +nvkm_pci_mask (pci,0x041c ,0x00000060 ,0x00000000 ); + } + pci->irq = pdev->irq;return ret; } --2.5.2
Quoted 4 lines
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau