Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/nvc0/vram: skip disabled PBFB subunits

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>

+9 -5
+9 -5
drivers/gpu/drm/nouveau/nvc0_vram.c
··· 110 110 u32 bsize = nv_rd32(dev, 0x10f20c); 111 111 u32 offset, length; 112 112 bool uniform = true; 113 - int ret, i; 113 + int ret, part; 114 114 115 115 NV_DEBUG(dev, "0x100800: 0x%08x\n", nv_rd32(dev, 0x100800)); 116 116 NV_DEBUG(dev, "parts 0x%08x bcast_mem_amount 0x%08x\n", parts, bsize); 117 117 118 118 /* read amount of vram attached to each memory controller */ 119 - for (i = 0; i < parts; i++) { 120 - u32 psize = nv_rd32(dev, 0x11020c + (i * 0x1000)); 119 + part = 0; 120 + while (parts) { 121 + u32 psize = nv_rd32(dev, 0x11020c + (part++ * 0x1000)); 122 + if (psize == 0) 123 + continue; 124 + parts--; 125 + 121 126 if (psize != bsize) { 122 127 if (psize < bsize) 123 128 bsize = psize; 124 129 uniform = false; 125 130 } 126 131 127 - NV_DEBUG(dev, "%d: mem_amount 0x%08x\n", i, psize); 128 - 132 + NV_DEBUG(dev, "%d: mem_amount 0x%08x\n", part, psize); 129 133 dev_priv->vram_size += (u64)psize << 20; 130 134 } 131 135