Package: src:linux Version: 3.16.5-1 Severity: normal Dear Maintainer,
The latest testing 3.16.5 kernel is built with 64K pages: *************************** $ cat /lib/modules/3.16-3-powerpc64/build/.config | grep 4K CONFIG_PPC_HAS_HASH_64K=y # CONFIG_PPC_4K_PAGES is not set CONFIG_PPC_64K_PAGES=y # CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set ************************** The problem is that nouveau driver in kernel is unable to run with non-4K pages (it's assuming 4k pages somehow). There's a fix in nouveau ml for that, but it is not included in kernel. This is causing gpu to stuck and switch to fb and screen in X become a bunch of squares with parts of image within them, like in puzzle. BTW, I can't build kernel ending with error: ld.bfd.real error: -T emulation mode is not supported (writing by mem, so I might be wrong in exact string). built with dpkg-buildpackage -j5 -a ppc64. -- Package-specific info: ** Kernel log: boot messages should be attached ** Model information revision : 1.1 (pvr 0044 0101) revision : 1.1 (pvr 0044 0101) revision : 1.1 (pvr 0044 0101) revision : 1.1 (pvr 0044 0101) platform : PowerMac model : PowerMac11,2 machine : PowerMac11,2 motherboard : PowerMac11,2 MacRISC4 Power Macintosh ** PCI devices: 0000:00:0b.0 PCI bridge [0604]: Apple Inc. CPC945 PCIe Bridge [106b:005b] (prog-if 00 [Normal decode]) Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 0, Cache Line Size: 32 bytes Bus: primary=00, secondary=0a, subordinate=0a, sec-latency=0 I/O behind bridge: 00000000-0000ffff Memory behind bridge: 90000000-afffffff Prefetchable memory behind bridge: 00000000f1000000-00000000f10fffff Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- <SERR- <PERR- BridgeCtl: Parity- SERR- NoISA- VGA- MAbort- >Reset- FastB2B- PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn- Capabilities: <access denied> 0000:0a:00.0 VGA compatible controller [0300]: NVIDIA Corporation NV43 [GeForce 6600] [10de:0141] (rev a2) (prog-if 00 [VGA controller]) Subsystem: NVIDIA Corporation Device [10de:0010] Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+ Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 0, Cache Line Size: 64 bytes Interrupt: pin A routed to IRQ 32 Region 0: Memory at a1000000 (32-bit, non-prefetchable) [size=16M] Region 1: Memory at 90000000 (64-bit, prefetchable) [size=256M] Region 3: Memory at a0000000 (64-bit, non-prefetchable) [size=16M] Expansion ROM at a2000000 [disabled] [size=128K] Capabilities: <access denied> Kernel driver in use: nouveau 0001:00:00.0 Host bridge [0600]: Apple Inc. U4 HT Bridge [106b:0074] Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort+ >SERR- <PERR- INTx- Latency: 0 Capabilities: <access denied> 0001:00:01.0 PCI bridge [0604]: Broadcom BCM5780 [HT2000] PCI-X bridge [1166:0130] (rev a3) (prog-if 00 [Normal decode]) Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 32 Bus: primary=00, secondary=04, subordinate=04, sec-latency=32 Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=slow >TAbort- <TAbort- <MAbort+ <SERR- <PERR- BridgeCtl: Parity- SERR- NoISA- VGA- MAbort- >Reset- FastB2B- PriDiscTmr- SecDiscTmr+ DiscTmrStat- DiscTmrSERREn- Capabilities: <access denied> 0001:00:02.0 PCI bridge [0604]: Broadcom BCM5780 [HT2000] PCI-X bridge [1166:0130] (rev a3) (prog-if 00 [Normal decode]) Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 32 Bus: primary=00, secondary=05, subordinate=05, sec-latency=32 Memory behind bridge: fa500000-fa5fffff Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=slow >TAbort- <TAbort- <MAbort+ <SERR- <PERR- BridgeCtl: Parity- SERR- NoISA- VGA- MAbort- >Reset- FastB2B- PriDiscTmr- SecDiscTmr+ DiscTmrStat- DiscTmrSERREn- Capabilities: <access denied> 0001:00:03.0 PCI bridge [0604]: Broadcom BCM5780 [HT2000] PCI-Express Bridge [1166:0132] (rev a3) (prog-if 00 [Normal decode]) Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Bus: primary=00, secondary=06, subordinate=06, sec-latency=32 Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- <SERR- <PERR- BridgeCtl: Parity- SERR- NoISA- VGA- MAbort- >Reset- FastB2B- PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn- Capabilities: <access denied> 0001:00:04.0 PCI bridge [0604]: Broadcom BCM5780 [HT2000] PCI-Express Bridge [1166:0132] (rev a3) (prog-if 00 [Normal decode]) Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Bus: primary=00, secondary=07, subordinate=07, sec-latency=32 Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- <SERR- <PERR- BridgeCtl: Parity- SERR- NoISA- VGA- MAbort- >Reset- FastB2B- PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn- Capabilities: <access denied> 0001:00:05.0 PCI bridge [0604]: Broadcom BCM5780 [HT2000] PCI-Express Bridge [1166:0132] (rev a3) (prog-if 00 [Normal decode]) Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Bus: primary=00, secondary=08, subordinate=08, sec-latency=32 Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- <SERR- <PERR- BridgeCtl: Parity- SERR- NoISA- VGA- MAbort- >Reset- FastB2B- PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn- Capabilities: <access denied> 0001:00:06.0 PCI bridge [0604]: Broadcom BCM5780 [HT2000] PCI-Express Bridge [1166:0132] (rev a3) (prog-if 00 [Normal decode]) Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Bus: primary=00, secondary=09, subordinate=09, sec-latency=32 Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- <SERR- <PERR- BridgeCtl: Parity- SERR- NoISA- VGA- MAbort- >Reset- FastB2B- PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn- Capabilities: <access denied> 0001:00:07.0 PCI bridge [0604]: Apple Inc. Shasta PCI Bridge [106b:0053] (prog-if 00 [Normal decode]) Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 0, Cache Line Size: 64 bytes Bus: primary=00, secondary=02, subordinate=02, sec-latency=32 Memory behind bridge: fa000000-fa3fffff Prefetchable memory behind bridge: 00000000-000fffff Secondary status: 66MHz+ FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- <SERR- <PERR- BridgeCtl: Parity- SERR- NoISA- VGA- MAbort- >Reset- FastB2B- PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn- Capabilities: <access denied> 0001:00:08.0 PCI bridge [0604]: Apple Inc. Shasta PCI Bridge [106b:0054] (prog-if 00 [Normal decode]) Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 0, Cache Line Size: 64 bytes Bus: primary=00, secondary=01, subordinate=01, sec-latency=32 Memory behind bridge: 80000000-800fffff Prefetchable memory behind bridge: 00000000-000fffff Secondary status: 66MHz+ FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort+ <SERR- <PERR- BridgeCtl: Parity- SERR- NoISA- VGA- MAbort- >Reset- FastB2B- PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn- Capabilities: <access denied> 0001:00:09.0 PCI bridge [0604]: Apple Inc. Shasta PCI Bridge [106b:0055] (prog-if 00 [Normal decode]) Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 0, Cache Line Size: 64 bytes Bus: primary=00, secondary=03, subordinate=03, sec-latency=32 Memory behind bridge: fa400000-fa4fffff Prefetchable memory behind bridge: 00000000-000fffff Secondary status: 66MHz+ FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort+ <SERR- <PERR- BridgeCtl: Parity- SERR- NoISA- VGA- MAbort- >Reset- FastB2B- PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn- Capabilities: <access denied> 0001:01:07.0 Unassigned class [ff00]: Apple Inc. Shasta Mac I/O [106b:004f] Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 16, Cache Line Size: 64 bytes Region 0: Memory at 80000000 (32-bit, non-prefetchable) [size=512K] Kernel driver in use: macio 0001:01:0b.0 USB controller [0c03]: NEC Corporation OHCI USB Controller [1033:0035] (rev 43) (prog-if 10 [OHCI]) Subsystem: NEC Corporation USB Controller [1033:0035] Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 16 (250ns min, 10500ns max), Cache Line Size: 64 bytes Interrupt: pin A routed to IRQ 70 Region 0: Memory at 80082000 (32-bit, non-prefetchable) [size=4K] Capabilities: <access denied> Kernel driver in use: ohci-pci 0001:01:0b.1 USB controller [0c03]: NEC Corporation OHCI USB Controller [1033:0035] (rev 43) (prog-if 10 [OHCI]) Subsystem: NEC Corporation USB Controller [1033:0035] Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 16 (250ns min, 10500ns max), Cache Line Size: 64 bytes Interrupt: pin B routed to IRQ 70 Region 0: Memory at 80081000 (32-bit, non-prefetchable) [size=4K] Capabilities: <access denied> Kernel driver in use: ohci-pci 0001:01:0b.2 USB controller [0c03]: NEC Corporation uPD72010x USB 2.0 Controller [1033:00e0] (rev 04) (prog-if 20 [EHCI]) Subsystem: NEC Corporation uPD72010x USB 2.0 Controller [1033:00e0] Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 16 (4000ns min, 8500ns max), Cache Line Size: 64 bytes Interrupt: pin C routed to IRQ 70 Region 0: Memory at 80080000 (32-bit, non-prefetchable) [size=256] Capabilities: <access denied> Kernel driver in use: ehci-pci 0001:03:0c.0 IDE interface [0101]: Broadcom K2 SATA [1166:0240] (prog-if 8f [Master SecP SecO PriP PriO]) Subsystem: Broadcom K2 SATA [1166:0240] Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap- 66MHz+ UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 16 Interrupt: pin ? routed to IRQ 18 Region 0: I/O ports at <unassigned> [disabled] Region 1: I/O ports at <unassigned> [disabled] Region 2: I/O ports at <unassigned> [disabled] Region 3: I/O ports at <unassigned> [disabled] Region 4: I/O ports at <unassigned> [disabled] Region 5: Memory at fa402000 (32-bit, non-prefetchable) [size=8K] Kernel driver in use: sata_svw 0001:03:0d.0 Unassigned class [ff00]: Apple Inc. Shasta IDE [106b:0050] Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR+ INTx- Latency: 32, Cache Line Size: 32 bytes Interrupt: pin ? routed to IRQ 38 Region 0: Memory at fa404000 (32-bit, non-prefetchable) [size=16K] Kernel driver in use: pata-pci-macio 0001:03:0e.0 FireWire (IEEE 1394) [0c00]: Apple Inc. Shasta Firewire [106b:0052] (prog-if 10 [OHCI]) Subsystem: Apple Inc. Device [106b:5811] Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 248 (3000ns min, 6000ns max), Cache Line Size: 64 bytes Interrupt: pin A routed to IRQ 39 Region 0: Memory at fa400000 (32-bit, non-prefetchable) [size=4K] Capabilities: <access denied> Kernel driver in use: firewire_ohci 0001:05:04.0 Ethernet controller [0200]: Broadcom Corporation NetXtreme BCM5780 Gigabit Ethernet [14e4:166a] (rev 03) Subsystem: Apple Inc. Device [106b:0085] Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 16 (16000ns min), Cache Line Size: 64 bytes Interrupt: pin A routed to IRQ 33 Region 0: Memory at fa530000 (64-bit, non-prefetchable) [size=64K] Region 2: Memory at fa520000 (64-bit, non-prefetchable) [size=64K] Capabilities: <access denied> Kernel driver in use: tg3 0001:05:04.1 Ethernet controller [0200]: Broadcom Corporation NetXtreme BCM5780 Gigabit Ethernet [14e4:166a] (rev 03) Subsystem: Apple Inc. Device [106b:0085] Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 16 (16000ns min), Cache Line Size: 64 bytes Interrupt: pin B routed to IRQ 34 Region 0: Memory at fa510000 (64-bit, non-prefetchable) [size=64K] Region 2: Memory at fa500000 (64-bit, non-prefetchable) [size=64K] Capabilities: <access denied> Kernel driver in use: tg3 ** USB devices: Bus 001 Device 004: ID 046d:081d Logitech, Inc. HD Webcam C510 Bus 001 Device 008: ID 046d:c52b Logitech, Inc. Unifying Receiver Bus 001 Device 007: ID 0557:8021 ATEN International Co., Ltd Bus 001 Device 003: ID 0409:005a NEC Corp. HighSpeed Hub Bus 001 Device 006: ID 1131:1001 Integrated System Solution Corp. KY-BT100 Bluetooth Adapter Bus 001 Device 005: ID 14cd:125c Super Top SD card reader Bus 001 Device 002: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub -- System Information: Debian Release: jessie/sid APT prefers testing APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental') Architecture: powerpc (ppc64) Kernel: Linux 3.14-2-powerpc64 (SMP w/4 CPU cores) Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages linux-image-3.16-3-powerpc64 depends on: ii debconf [debconf-2.0] 1.5.53 ii initramfs-tools [linux-initramfs-tool] 0.116 ii kmod 18-3 ii linux-base 3.5 ii module-init-tools 18-3 Versions of packages linux-image-3.16-3-powerpc64 recommends: ii firmware-linux-free 3.3 Versions of packages linux-image-3.16-3-powerpc64 suggests: pn debian-kernel-handbook <none> pn linux-doc-3.16 <none> pn mkvmlinuz <none> Versions of packages linux-image-3.16-3-powerpc64 is related to: pn firmware-atheros <none> pn firmware-bnx2 <none> pn firmware-bnx2x <none> ii firmware-brcm80211 0.43 pn firmware-intelwimax <none> pn firmware-ipw2x00 <none> pn firmware-ivtv <none> pn firmware-iwlwifi <none> pn firmware-libertas <none> ii firmware-linux 0.43 ii firmware-linux-nonfree 0.43 pn firmware-myricom <none> pn firmware-netxen <none> pn firmware-qlogic <none> pn firmware-ralink <none> ii firmware-realtek 0.43 pn xen-hypervisor <none> -- debconf information: linux-image-3.16-3-powerpc64/postinst/depmod-error-initrd-3.16-3-powerpc64: false linux-image-3.16-3-powerpc64/prerm/removing-running-kernel-3.16-3-powerpc64: true linux-image-3.16-3-powerpc64/postinst/mips-initrd-3.16-3-powerpc64:
diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c index ef3133e..44dc050 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c @@ -82,55 +82,77 @@ void nouveau_vm_map_sg_table(struct nouveau_vma *vma, u64 delta, u64 length, struct nouveau_mem *mem) { + /* + * XXX Should the "12" in a couple of places here be replaced + * with vmm->spg_shift for correctness ? Might help if we ever + * support 64k card pages on 64k PAGE_SIZE systems + */ struct nouveau_vm *vm = vma->vm; struct nouveau_vmmgr *vmm = vm->vmm; - int big = vma->node->type != vmm->spg_shift; u32 offset = vma->node->offset + (delta >> 12); - u32 bits = vma->node->type - 12; - u32 num = length >> vma->node->type; + u32 shift = vma->node->type; + u32 order = PAGE_SHIFT - shift; + u32 num = length >> PAGE_SHIFT; u32 pde = (offset >> vmm->pgt_bits) - vm->fpde; - u32 pte = (offset & ((1 << vmm->pgt_bits) - 1)) >> bits; - u32 max = 1 << (vmm->pgt_bits - bits); - unsigned m, sglen; - u32 end, len; + u32 pte = offset & ((1 << vmm->pgt_bits) - 1); + u32 max = 1 << vmm->pgt_bits; + u32 end, len, cardlen; int i; struct scatterlist *sg; - for_each_sg(mem->sg->sgl, sg, mem->sg->nents, i) { - struct nouveau_gpuobj *pgt = vm->pgt[pde].obj[big]; - sglen = sg_dma_len(sg) >> PAGE_SHIFT; + /* We don't handle "big" pages here */ + if (WARN_ON(shift != vmm->spg_shift || shift > PAGE_SHIFT)) + return; - end = pte + sglen; - if (unlikely(end >= max)) - end = max; - len = end - pte; + /* We dont' handle objects that aren't PAGE_SIZE aligned either */ + if (WARN_ON((offset << 12) & ~PAGE_MASK)) + return; - for (m = 0; m < len; m++) { - dma_addr_t addr = sg_dma_address(sg) + (m << PAGE_SHIFT); + /* Iterate sglist elements */ + for_each_sg(mem->sg->sgl, sg, mem->sg->nents, i) { + struct nouveau_gpuobj *pgt = vm->pgt[pde].obj[0]; + unsigned long m, sglen; + dma_addr_t addr; - vmm->map_sg(vma, pgt, mem, pte, 1, &addr); - num--; - pte++; + /* Number of system pages and base address */ + sglen = sg_dma_len(sg) >> PAGE_SHIFT; + addr = sg_dma_address(sg); + + /* Iterate over system pages in the segment and + * covered PDEs + */ + while(sglen) { + /* Number of card PTEs */ + cardlen = sglen << order; + end = pte + cardlen; + if (unlikely(end > max)) + end = max; + cardlen = end - pte; - if (num == 0) - goto finish; - } - if (unlikely(end >= max)) { - pde++; - pte = 0; - } - if (m < sglen) { - for (; m < sglen; m++) { - dma_addr_t addr = sg_dma_address(sg) + (m << PAGE_SHIFT); + /* Convert back to system pages after cropping */ + len = cardlen >> order; + + /* Ensure this fits system pages */ + if (WARN_ON((len << order) != cardlen)) + break; + /* For each system page in the segment */ + for (m = 0; m < len; m++) { vmm->map_sg(vma, pgt, mem, pte, 1, &addr); + addr += PAGE_SIZE; num--; - pte++; + pte += (1u << order); if (num == 0) goto finish; } - } + sglen -= len; + /* Wrap to next PDE ? */ + if (unlikely(end >= max)) { + pde++; + pte = 0; + } + } } finish: vmm->flush(vm); @@ -143,28 +165,44 @@ nouveau_vm_map_sg(struct nouveau_vma *vma, u64 delta, u64 length, struct nouveau_vm *vm = vma->vm; struct nouveau_vmmgr *vmm = vm->vmm; dma_addr_t *list = mem->pages; - int big = vma->node->type != vmm->spg_shift; u32 offset = vma->node->offset + (delta >> 12); - u32 bits = vma->node->type - 12; - u32 num = length >> vma->node->type; + u32 shift = vma->node->type; + u32 order = PAGE_SHIFT - shift; + u32 num = length >> PAGE_SHIFT; u32 pde = (offset >> vmm->pgt_bits) - vm->fpde; - u32 pte = (offset & ((1 << vmm->pgt_bits) - 1)) >> bits; - u32 max = 1 << (vmm->pgt_bits - bits); - u32 end, len; + u32 pte = offset & ((1 << vmm->pgt_bits) - 1); + u32 max = 1 << vmm->pgt_bits; + u32 end, len, cardlen; + + /* We don't handle "big" pages here */ + if (WARN_ON(shift != vmm->spg_shift || shift > PAGE_SHIFT)) + return; + + /* We dont' handle objects that aren't PAGE_SIZE aligned either */ + if (WARN_ON((offset << 12) & ~PAGE_MASK)) + return; while (num) { - struct nouveau_gpuobj *pgt = vm->pgt[pde].obj[big]; + struct nouveau_gpuobj *pgt = vm->pgt[pde].obj[0]; - end = (pte + num); - if (unlikely(end >= max)) + /* "num" is remaining system pages, check how many fit + * in the PDE + */ + end = (pte + (num << order)); + if (unlikely(end > max)) end = max; - len = end - pte; + cardlen = end - pte; + len = cardlen >> order; + + /* Ensure this fits system pages */ + if (WARN_ON((len << order) != cardlen)) + break; vmm->map_sg(vma, pgt, mem, pte, len, list); num -= len; - pte += len; list += len; + pte += cardlen; if (unlikely(end >= max)) { pde++; pte = 0; diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/nv04.c b/drivers/gpu/drm/nouveau/core/subdev/vm/nv04.c index ed45437..c1e7c11 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/vm/nv04.c +++ b/drivers/gpu/drm/nouveau/core/subdev/vm/nv04.c @@ -38,14 +38,13 @@ nv04_vm_map_sg(struct nouveau_vma *vma, struct nouveau_gpuobj *pgt, struct nouveau_mem *mem, u32 pte, u32 cnt, dma_addr_t *list) { pte = 0x00008 + (pte * 4); - while (cnt) { + while (cnt--) { u32 page = PAGE_SIZE / NV04_PDMA_PAGE; u32 phys = (u32)*list++; - while (cnt && page--) { + while (page--) { nv_wo32(pgt, pte, phys | 3); phys += NV04_PDMA_PAGE; pte += 4; - cnt -= 1; } } } diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c b/drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c index 064c762..09570d7 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c +++ b/drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c @@ -42,14 +42,13 @@ nv41_vm_map_sg(struct nouveau_vma *vma, struct nouveau_gpuobj *pgt, struct nouveau_mem *mem, u32 pte, u32 cnt, dma_addr_t *list) { pte = pte * 4; - while (cnt) { + while (cnt--) { u32 page = PAGE_SIZE / NV41_GART_PAGE; u64 phys = (u64)*list++; - while (cnt && page--) { + while (page--) { nv_wo32(pgt, pte, (phys >> 7) | 1); phys += NV41_GART_PAGE; pte += 4; - cnt -= 1; } } } diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index c0fde6b..16dce89 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -178,7 +178,7 @@ nouveau_bo_fixup_align(struct nouveau_bo *nvbo, u32 flags, *size = roundup(*size, (1 << nvbo->page_shift)); *align = max((1 << nvbo->page_shift), *align); } - + *align = roundup(*align, PAGE_SIZE); *size = roundup(*size, PAGE_SIZE); } @@ -221,7 +221,7 @@ nouveau_bo_new(struct drm_device *dev, int size, int align, nvbo->page_shift = 12; if (drm->client.base.vm) { if (!(flags & TTM_PL_FLAG_TT) && size > 256 * 1024) - nvbo->page_shift = drm->client.base.vm->vmm->lpg_shift; + nvbo->page_shift = lpg_shift; } nouveau_bo_fixup_align(nvbo, flags, &align, &size); diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c b/drivers/gpu/drm/nouveau/nouveau_ttm.c index 19e3757..b7fc456 100644 --- a/drivers/gpu/drm/nouveau/nouveau_ttm.c +++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c @@ -256,8 +256,9 @@ nv04_gart_manager_new(struct ttm_mem_type_manager *man, node->page_shift = 12; - ret = nouveau_vm_get(man->priv, mem->num_pages << 12, node->page_shift, - NV_MEM_ACCESS_RW, &node->vma[0]); + ret = nouveau_vm_get(man->priv, mem->num_pages << PAGE_SHIFT, + node->page_shift, NV_MEM_ACCESS_RW, + &node->vma[0]); if (ret) { kfree(node); return ret;