diff options
Diffstat (limited to 'drivers/gpu/drm/nouveau')
-rw-r--r-- | drivers/gpu/drm/nouveau/core/core/gpuobj.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/core/mm.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/subdev/bios/base.c | 30 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/subdev/bios/pll.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/subdev/therm/fan.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/subdev/vm/nv44.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bo.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_display.c | 14 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_pm.c | 6 |
12 files changed, 53 insertions, 28 deletions
diff --git a/drivers/gpu/drm/nouveau/core/core/gpuobj.c b/drivers/gpu/drm/nouveau/core/core/gpuobj.c index 1f34549aff18..70586fde69cf 100644 --- a/drivers/gpu/drm/nouveau/core/core/gpuobj.c +++ b/drivers/gpu/drm/nouveau/core/core/gpuobj.c | |||
@@ -39,6 +39,11 @@ nouveau_gpuobj_destroy(struct nouveau_gpuobj *gpuobj) | |||
39 | nv_wo32(gpuobj, i, 0x00000000); | 39 | nv_wo32(gpuobj, i, 0x00000000); |
40 | } | 40 | } |
41 | 41 | ||
42 | if (gpuobj->node) { | ||
43 | nouveau_mm_free(&nv_gpuobj(gpuobj->parent)->heap, | ||
44 | &gpuobj->node); | ||
45 | } | ||
46 | |||
42 | if (gpuobj->heap.block_size) | 47 | if (gpuobj->heap.block_size) |
43 | nouveau_mm_fini(&gpuobj->heap); | 48 | nouveau_mm_fini(&gpuobj->heap); |
44 | 49 | ||
diff --git a/drivers/gpu/drm/nouveau/core/core/mm.c b/drivers/gpu/drm/nouveau/core/core/mm.c index bfddf87926dd..4d6206448670 100644 --- a/drivers/gpu/drm/nouveau/core/core/mm.c +++ b/drivers/gpu/drm/nouveau/core/core/mm.c | |||
@@ -236,7 +236,7 @@ nouveau_mm_fini(struct nouveau_mm *mm) | |||
236 | int nodes = 0; | 236 | int nodes = 0; |
237 | 237 | ||
238 | list_for_each_entry(node, &mm->nodes, nl_entry) { | 238 | list_for_each_entry(node, &mm->nodes, nl_entry) { |
239 | if (nodes++ == mm->heap_nodes) | 239 | if (WARN_ON(nodes++ == mm->heap_nodes)) |
240 | return -EBUSY; | 240 | return -EBUSY; |
241 | } | 241 | } |
242 | 242 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c index dcb5c2befc92..70ca7d5a1aa1 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) | |||
72 | } | 72 | } |
73 | 73 | ||
74 | data = of_get_property(dn, "NVDA,BMP", &size); | 74 | data = of_get_property(dn, "NVDA,BMP", &size); |
75 | if (data) { | 75 | if (data && size) { |
76 | bios->size = size; | 76 | bios->size = size; |
77 | bios->data = kmalloc(bios->size, GFP_KERNEL); | 77 | bios->data = kmalloc(bios->size, GFP_KERNEL); |
78 | if (bios->data) | 78 | if (bios->data) |
@@ -104,6 +104,9 @@ nouveau_bios_shadow_pramin(struct nouveau_bios *bios) | |||
104 | goto out; | 104 | goto out; |
105 | 105 | ||
106 | bios->size = nv_rd08(bios, 0x700002) * 512; | 106 | bios->size = nv_rd08(bios, 0x700002) * 512; |
107 | if (!bios->size) | ||
108 | goto out; | ||
109 | |||
107 | bios->data = kmalloc(bios->size, GFP_KERNEL); | 110 | bios->data = kmalloc(bios->size, GFP_KERNEL); |
108 | if (bios->data) { | 111 | if (bios->data) { |
109 | for (i = 0; i < bios->size; i++) | 112 | for (i = 0; i < bios->size; i++) |
@@ -155,6 +158,9 @@ nouveau_bios_shadow_prom(struct nouveau_bios *bios) | |||
155 | 158 | ||
156 | /* read entire bios image to system memory */ | 159 | /* read entire bios image to system memory */ |
157 | bios->size = nv_rd08(bios, 0x300002) * 512; | 160 | bios->size = nv_rd08(bios, 0x300002) * 512; |
161 | if (!bios->size) | ||
162 | goto out; | ||
163 | |||
158 | bios->data = kmalloc(bios->size, GFP_KERNEL); | 164 | bios->data = kmalloc(bios->size, GFP_KERNEL); |
159 | if (bios->data) { | 165 | if (bios->data) { |
160 | for (i = 0; i < bios->size; i++) | 166 | for (i = 0; i < bios->size; i++) |
@@ -186,14 +192,22 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios) | |||
186 | { | 192 | { |
187 | struct pci_dev *pdev = nv_device(bios)->pdev; | 193 | struct pci_dev *pdev = nv_device(bios)->pdev; |
188 | int ret, cnt, i; | 194 | int ret, cnt, i; |
189 | u8 data[3]; | ||
190 | 195 | ||
191 | if (!nouveau_acpi_rom_supported(pdev)) | 196 | if (!nouveau_acpi_rom_supported(pdev)) { |
197 | bios->data = NULL; | ||
192 | return; | 198 | return; |
199 | } | ||
193 | 200 | ||
194 | bios->size = 0; | 201 | bios->size = 0; |
195 | if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3) | 202 | bios->data = kmalloc(4096, GFP_KERNEL); |
196 | bios->size = data[2] * 512; | 203 | if (bios->data) { |
204 | if (nouveau_acpi_get_bios_chunk(bios->data, 0, 4096) == 4096) | ||
205 | bios->size = bios->data[2] * 512; | ||
206 | kfree(bios->data); | ||
207 | } | ||
208 | |||
209 | if (!bios->size) | ||
210 | return; | ||
197 | 211 | ||
198 | bios->data = kmalloc(bios->size, GFP_KERNEL); | 212 | bios->data = kmalloc(bios->size, GFP_KERNEL); |
199 | for (i = 0; bios->data && i < bios->size; i += cnt) { | 213 | for (i = 0; bios->data && i < bios->size; i += cnt) { |
@@ -229,12 +243,14 @@ nouveau_bios_shadow_pci(struct nouveau_bios *bios) | |||
229 | static int | 243 | static int |
230 | nouveau_bios_score(struct nouveau_bios *bios, const bool writeable) | 244 | nouveau_bios_score(struct nouveau_bios *bios, const bool writeable) |
231 | { | 245 | { |
232 | if (!bios->data || bios->data[0] != 0x55 || bios->data[1] != 0xAA) { | 246 | if (bios->size < 3 || !bios->data || bios->data[0] != 0x55 || |
247 | bios->data[1] != 0xAA) { | ||
233 | nv_info(bios, "... signature not found\n"); | 248 | nv_info(bios, "... signature not found\n"); |
234 | return 0; | 249 | return 0; |
235 | } | 250 | } |
236 | 251 | ||
237 | if (nvbios_checksum(bios->data, bios->data[2] * 512)) { | 252 | if (nvbios_checksum(bios->data, |
253 | min_t(u32, bios->data[2] * 512, bios->size))) { | ||
238 | nv_info(bios, "... checksum invalid\n"); | 254 | nv_info(bios, "... checksum invalid\n"); |
239 | /* if a ro image is somewhat bad, it's probably all rubbish */ | 255 | /* if a ro image is somewhat bad, it's probably all rubbish */ |
240 | return writeable ? 2 : 1; | 256 | return writeable ? 2 : 1; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c b/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c index 9ed6e728a94c..7d750382a833 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c | |||
@@ -43,7 +43,7 @@ dcb_table(struct nouveau_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len) | |||
43 | *ver = nv_ro08(bios, dcb); | 43 | *ver = nv_ro08(bios, dcb); |
44 | 44 | ||
45 | if (*ver >= 0x41) { | 45 | if (*ver >= 0x41) { |
46 | nv_warn(bios, "DCB *ver 0x%02x unknown\n", *ver); | 46 | nv_warn(bios, "DCB version 0x%02x unknown\n", *ver); |
47 | return 0x0000; | 47 | return 0x0000; |
48 | } else | 48 | } else |
49 | if (*ver >= 0x30) { | 49 | if (*ver >= 0x30) { |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/pll.c b/drivers/gpu/drm/nouveau/core/subdev/bios/pll.c index 5e5f4cddae3c..f835501203e5 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bios/pll.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/pll.c | |||
@@ -157,11 +157,10 @@ pll_map_reg(struct nouveau_bios *bios, u32 reg, u32 *type, u8 *ver, u8 *len) | |||
157 | while (map->reg) { | 157 | while (map->reg) { |
158 | if (map->reg == reg && *ver >= 0x20) { | 158 | if (map->reg == reg && *ver >= 0x20) { |
159 | u16 addr = (data += hdr); | 159 | u16 addr = (data += hdr); |
160 | *type = map->type; | ||
160 | while (cnt--) { | 161 | while (cnt--) { |
161 | if (nv_ro32(bios, data) == map->reg) { | 162 | if (nv_ro32(bios, data) == map->reg) |
162 | *type = map->type; | ||
163 | return data; | 163 | return data; |
164 | } | ||
165 | data += *len; | 164 | data += *len; |
166 | } | 165 | } |
167 | return addr; | 166 | return addr; |
@@ -200,11 +199,10 @@ pll_map_type(struct nouveau_bios *bios, u8 type, u32 *reg, u8 *ver, u8 *len) | |||
200 | while (map->reg) { | 199 | while (map->reg) { |
201 | if (map->type == type && *ver >= 0x20) { | 200 | if (map->type == type && *ver >= 0x20) { |
202 | u16 addr = (data += hdr); | 201 | u16 addr = (data += hdr); |
202 | *reg = map->reg; | ||
203 | while (cnt--) { | 203 | while (cnt--) { |
204 | if (nv_ro32(bios, data) == map->reg) { | 204 | if (nv_ro32(bios, data) == map->reg) |
205 | *reg = map->reg; | ||
206 | return data; | 205 | return data; |
207 | } | ||
208 | data += *len; | 206 | data += *len; |
209 | } | 207 | } |
210 | return addr; | 208 | return addr; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c index 436e9efe7ef5..27fb1af7a779 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c | |||
@@ -237,6 +237,7 @@ nv50_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
237 | return ret; | 237 | return ret; |
238 | 238 | ||
239 | priv->base.ram.stolen = (u64)nv_rd32(priv, 0x100e10) << 12; | 239 | priv->base.ram.stolen = (u64)nv_rd32(priv, 0x100e10) << 12; |
240 | priv->base.ram.type = NV_MEM_TYPE_STOLEN; | ||
240 | break; | 241 | break; |
241 | default: | 242 | default: |
242 | ret = nouveau_mm_init(&priv->base.vram, rsvd_head, size, | 243 | ret = nouveau_mm_init(&priv->base.vram, rsvd_head, size, |
@@ -277,7 +278,6 @@ nv50_fb_dtor(struct nouveau_object *object) | |||
277 | __free_page(priv->r100c08_page); | 278 | __free_page(priv->r100c08_page); |
278 | } | 279 | } |
279 | 280 | ||
280 | nouveau_mm_fini(&priv->base.vram); | ||
281 | nouveau_fb_destroy(&priv->base); | 281 | nouveau_fb_destroy(&priv->base); |
282 | } | 282 | } |
283 | 283 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c b/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c index b29237970fa0..523178685180 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c | |||
@@ -134,7 +134,7 @@ nouveau_therm_fan_sense(struct nouveau_therm *therm) | |||
134 | end = ptimer->read(ptimer); | 134 | end = ptimer->read(ptimer); |
135 | 135 | ||
136 | if (cycles == 5) { | 136 | if (cycles == 5) { |
137 | tach = (u64)60000000000; | 137 | tach = (u64)60000000000ULL; |
138 | do_div(tach, (end - start)); | 138 | do_div(tach, (end - start)); |
139 | return tach; | 139 | return tach; |
140 | } else | 140 | } else |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c b/drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c index 0203e1e12caa..49050d991e75 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c +++ b/drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c | |||
@@ -92,7 +92,8 @@ nv41_vmmgr_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
92 | struct nv04_vmmgr_priv *priv; | 92 | struct nv04_vmmgr_priv *priv; |
93 | int ret; | 93 | int ret; |
94 | 94 | ||
95 | if (!nouveau_boolopt(device->cfgopt, "NvPCIE", true)) { | 95 | if (pci_find_capability(device->pdev, PCI_CAP_ID_AGP) || |
96 | !nouveau_boolopt(device->cfgopt, "NvPCIE", true)) { | ||
96 | return nouveau_object_ctor(parent, engine, &nv04_vmmgr_oclass, | 97 | return nouveau_object_ctor(parent, engine, &nv04_vmmgr_oclass, |
97 | data, size, pobject); | 98 | data, size, pobject); |
98 | } | 99 | } |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/nv44.c b/drivers/gpu/drm/nouveau/core/subdev/vm/nv44.c index 0ac18d05a146..aa8131436e3d 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/vm/nv44.c +++ b/drivers/gpu/drm/nouveau/core/subdev/vm/nv44.c | |||
@@ -163,7 +163,8 @@ nv44_vmmgr_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
163 | struct nv04_vmmgr_priv *priv; | 163 | struct nv04_vmmgr_priv *priv; |
164 | int ret; | 164 | int ret; |
165 | 165 | ||
166 | if (!nouveau_boolopt(device->cfgopt, "NvPCIE", true)) { | 166 | if (pci_find_capability(device->pdev, PCI_CAP_ID_AGP) || |
167 | !nouveau_boolopt(device->cfgopt, "NvPCIE", true)) { | ||
167 | return nouveau_object_ctor(parent, engine, &nv04_vmmgr_oclass, | 168 | return nouveau_object_ctor(parent, engine, &nv04_vmmgr_oclass, |
168 | data, size, pobject); | 169 | data, size, pobject); |
169 | } | 170 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 259e5f1adf47..35ac57f0aab6 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
@@ -456,6 +456,7 @@ static struct ttm_tt * | |||
456 | nouveau_ttm_tt_create(struct ttm_bo_device *bdev, unsigned long size, | 456 | nouveau_ttm_tt_create(struct ttm_bo_device *bdev, unsigned long size, |
457 | uint32_t page_flags, struct page *dummy_read) | 457 | uint32_t page_flags, struct page *dummy_read) |
458 | { | 458 | { |
459 | #if __OS_HAS_AGP | ||
459 | struct nouveau_drm *drm = nouveau_bdev(bdev); | 460 | struct nouveau_drm *drm = nouveau_bdev(bdev); |
460 | struct drm_device *dev = drm->dev; | 461 | struct drm_device *dev = drm->dev; |
461 | 462 | ||
@@ -463,6 +464,7 @@ nouveau_ttm_tt_create(struct ttm_bo_device *bdev, unsigned long size, | |||
463 | return ttm_agp_tt_create(bdev, dev->agp->bridge, size, | 464 | return ttm_agp_tt_create(bdev, dev->agp->bridge, size, |
464 | page_flags, dummy_read); | 465 | page_flags, dummy_read); |
465 | } | 466 | } |
467 | #endif | ||
466 | 468 | ||
467 | return nouveau_sgdma_create_ttm(bdev, size, page_flags, dummy_read); | 469 | return nouveau_sgdma_create_ttm(bdev, size, page_flags, dummy_read); |
468 | } | 470 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index 8f98e5a8c488..d2f8ffeed742 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
@@ -530,9 +530,11 @@ nouveau_page_flip_reserve(struct nouveau_bo *old_bo, | |||
530 | if (ret) | 530 | if (ret) |
531 | goto fail; | 531 | goto fail; |
532 | 532 | ||
533 | ret = ttm_bo_reserve(&old_bo->bo, false, false, false, 0); | 533 | if (likely(old_bo != new_bo)) { |
534 | if (ret) | 534 | ret = ttm_bo_reserve(&old_bo->bo, false, false, false, 0); |
535 | goto fail_unreserve; | 535 | if (ret) |
536 | goto fail_unreserve; | ||
537 | } | ||
536 | 538 | ||
537 | return 0; | 539 | return 0; |
538 | 540 | ||
@@ -551,8 +553,10 @@ nouveau_page_flip_unreserve(struct nouveau_bo *old_bo, | |||
551 | nouveau_bo_fence(new_bo, fence); | 553 | nouveau_bo_fence(new_bo, fence); |
552 | ttm_bo_unreserve(&new_bo->bo); | 554 | ttm_bo_unreserve(&new_bo->bo); |
553 | 555 | ||
554 | nouveau_bo_fence(old_bo, fence); | 556 | if (likely(old_bo != new_bo)) { |
555 | ttm_bo_unreserve(&old_bo->bo); | 557 | nouveau_bo_fence(old_bo, fence); |
558 | ttm_bo_unreserve(&old_bo->bo); | ||
559 | } | ||
556 | 560 | ||
557 | nouveau_bo_unpin(old_bo); | 561 | nouveau_bo_unpin(old_bo); |
558 | } | 562 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c index 0bf64c90aa20..5566172774df 100644 --- a/drivers/gpu/drm/nouveau/nouveau_pm.c +++ b/drivers/gpu/drm/nouveau/nouveau_pm.c | |||
@@ -52,7 +52,7 @@ nouveau_pm_perflvl_aux(struct drm_device *dev, struct nouveau_pm_level *perflvl, | |||
52 | { | 52 | { |
53 | struct nouveau_drm *drm = nouveau_drm(dev); | 53 | struct nouveau_drm *drm = nouveau_drm(dev); |
54 | struct nouveau_pm *pm = nouveau_pm(dev); | 54 | struct nouveau_pm *pm = nouveau_pm(dev); |
55 | struct nouveau_therm *therm = nouveau_therm(drm); | 55 | struct nouveau_therm *therm = nouveau_therm(drm->device); |
56 | int ret; | 56 | int ret; |
57 | 57 | ||
58 | /*XXX: not on all boards, we should control based on temperature | 58 | /*XXX: not on all boards, we should control based on temperature |
@@ -64,7 +64,6 @@ nouveau_pm_perflvl_aux(struct drm_device *dev, struct nouveau_pm_level *perflvl, | |||
64 | ret = therm->fan_set(therm, perflvl->fanspeed); | 64 | ret = therm->fan_set(therm, perflvl->fanspeed); |
65 | if (ret && ret != -ENODEV) { | 65 | if (ret && ret != -ENODEV) { |
66 | NV_ERROR(drm, "fanspeed set failed: %d\n", ret); | 66 | NV_ERROR(drm, "fanspeed set failed: %d\n", ret); |
67 | return ret; | ||
68 | } | 67 | } |
69 | } | 68 | } |
70 | 69 | ||
@@ -706,8 +705,7 @@ nouveau_hwmon_init(struct drm_device *dev) | |||
706 | struct device *hwmon_dev; | 705 | struct device *hwmon_dev; |
707 | int ret = 0; | 706 | int ret = 0; |
708 | 707 | ||
709 | if (!therm || !therm->temp_get || !therm->attr_get || | 708 | if (!therm || !therm->temp_get || !therm->attr_get || !therm->attr_set) |
710 | !therm->attr_set || therm->temp_get(therm) < 0) | ||
711 | return -ENODEV; | 709 | return -ENODEV; |
712 | 710 | ||
713 | hwmon_dev = hwmon_device_register(&dev->pdev->dev); | 711 | hwmon_dev = hwmon_device_register(&dev->pdev->dev); |