diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-04-03 13:12:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-04-03 13:12:21 -0400 |
commit | e1a7eb08ee097e97e928062a242b0de5b2599a11 (patch) | |
tree | 2e94ca0bd2ac5a53a4a7234b2f1b5f98f669cca8 /drivers/gpu/drm | |
parent | 464662b91614188b4af9df51baaa0d6b3d89a15f (diff) | |
parent | 62fb376e214d3c1bfdf6fbb77dac162f6da04d7e (diff) |
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
Pull drm fixes from Dave Airlie:
"Mainly nouveau fixes, one for a regressions in -rc1, fixes for booting
on a ppc G5, and a Kconfig fix. Two radeon fixes, one oops, one s/r
fix. One udl mmap fix. And one core drm fix to stop bad fbdev apps
overwriting bits of ram."
* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
drm: Validate requested virtual size against allocated fb size
drm/radeon: Don't dereference possibly-NULL pointer.
mm, drm/udl: fixup vma flags on mmap
drm/radeon/kms: fix fans after resume
nouveau/bios: Fix tracking of BIOS image data
nouveau: Fix crash when pci_ram_rom() returns a size of 0
drm/nouveau: select POWER_SUPPLY
drm/nouveau: inform userspace of relaxed kernel subchannel requirements
Revert "drm/nouveau: inform userspace of new kernel subchannel requirements"
drm/nouveau: oops, create m2mf for nvd9 too
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/drm_fb_helper.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/Kconfig | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bios.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_channel.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_dma.h | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_state.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/atom.c | 15 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/atom.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_object.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/udl/udl_drv.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/udl/udl_drv.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/udl/udl_gem.c | 14 |
12 files changed, 54 insertions, 16 deletions
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 7740dd26f007..a0d6e894d97c 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
@@ -559,9 +559,13 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, | |||
559 | return -EINVAL; | 559 | return -EINVAL; |
560 | 560 | ||
561 | /* Need to resize the fb object !!! */ | 561 | /* Need to resize the fb object !!! */ |
562 | if (var->bits_per_pixel > fb->bits_per_pixel || var->xres > fb->width || var->yres > fb->height) { | 562 | if (var->bits_per_pixel > fb->bits_per_pixel || |
563 | var->xres > fb->width || var->yres > fb->height || | ||
564 | var->xres_virtual > fb->width || var->yres_virtual > fb->height) { | ||
563 | DRM_DEBUG("fb userspace requested width/height/bpp is greater than current fb " | 565 | DRM_DEBUG("fb userspace requested width/height/bpp is greater than current fb " |
564 | "object %dx%d-%d > %dx%d-%d\n", var->xres, var->yres, var->bits_per_pixel, | 566 | "request %dx%d-%d (virtual %dx%d) > %dx%d-%d\n", |
567 | var->xres, var->yres, var->bits_per_pixel, | ||
568 | var->xres_virtual, var->yres_virtual, | ||
565 | fb->width, fb->height, fb->bits_per_pixel); | 569 | fb->width, fb->height, fb->bits_per_pixel); |
566 | return -EINVAL; | 570 | return -EINVAL; |
567 | } | 571 | } |
diff --git a/drivers/gpu/drm/nouveau/Kconfig b/drivers/gpu/drm/nouveau/Kconfig index ca1639918f57..97a81260485a 100644 --- a/drivers/gpu/drm/nouveau/Kconfig +++ b/drivers/gpu/drm/nouveau/Kconfig | |||
@@ -13,6 +13,7 @@ config DRM_NOUVEAU | |||
13 | select ACPI_VIDEO if ACPI && X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL && INPUT | 13 | select ACPI_VIDEO if ACPI && X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL && INPUT |
14 | select ACPI_WMI if ACPI | 14 | select ACPI_WMI if ACPI |
15 | select MXM_WMI if ACPI | 15 | select MXM_WMI if ACPI |
16 | select POWER_SUPPLY | ||
16 | help | 17 | help |
17 | Choose this option for open-source nVidia support. | 18 | Choose this option for open-source nVidia support. |
18 | 19 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 637afe71de56..1947d6139a38 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
@@ -177,14 +177,15 @@ bios_shadow_pci(struct nvbios *bios) | |||
177 | 177 | ||
178 | if (!pci_enable_rom(pdev)) { | 178 | if (!pci_enable_rom(pdev)) { |
179 | void __iomem *rom = pci_map_rom(pdev, &length); | 179 | void __iomem *rom = pci_map_rom(pdev, &length); |
180 | if (rom) { | 180 | if (rom && length) { |
181 | bios->data = kmalloc(length, GFP_KERNEL); | 181 | bios->data = kmalloc(length, GFP_KERNEL); |
182 | if (bios->data) { | 182 | if (bios->data) { |
183 | memcpy_fromio(bios->data, rom, length); | 183 | memcpy_fromio(bios->data, rom, length); |
184 | bios->length = length; | 184 | bios->length = length; |
185 | } | 185 | } |
186 | pci_unmap_rom(pdev, rom); | ||
187 | } | 186 | } |
187 | if (rom) | ||
188 | pci_unmap_rom(pdev, rom); | ||
188 | 189 | ||
189 | pci_disable_rom(pdev); | 190 | pci_disable_rom(pdev); |
190 | } | 191 | } |
@@ -272,6 +273,7 @@ bios_shadow(struct drm_device *dev) | |||
272 | mthd->score = score_vbios(bios, mthd->rw); | 273 | mthd->score = score_vbios(bios, mthd->rw); |
273 | mthd->size = bios->length; | 274 | mthd->size = bios->length; |
274 | mthd->data = bios->data; | 275 | mthd->data = bios->data; |
276 | bios->data = NULL; | ||
275 | } while (mthd->score != 3 && (++mthd)->shadow); | 277 | } while (mthd->score != 3 && (++mthd)->shadow); |
276 | 278 | ||
277 | mthd = shadow_methods; | 279 | mthd = shadow_methods; |
@@ -280,7 +282,8 @@ bios_shadow(struct drm_device *dev) | |||
280 | if (mthd->score > best->score) { | 282 | if (mthd->score > best->score) { |
281 | kfree(best->data); | 283 | kfree(best->data); |
282 | best = mthd; | 284 | best = mthd; |
283 | } | 285 | } else |
286 | kfree(mthd->data); | ||
284 | } while ((++mthd)->shadow); | 287 | } while ((++mthd)->shadow); |
285 | 288 | ||
286 | if (best->score) { | 289 | if (best->score) { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_channel.c b/drivers/gpu/drm/nouveau/nouveau_channel.c index 44e6416d4a33..846afb0bfef4 100644 --- a/drivers/gpu/drm/nouveau/nouveau_channel.c +++ b/drivers/gpu/drm/nouveau/nouveau_channel.c | |||
@@ -436,11 +436,11 @@ nouveau_ioctl_fifo_alloc(struct drm_device *dev, void *data, | |||
436 | } | 436 | } |
437 | 437 | ||
438 | if (dev_priv->card_type < NV_C0) { | 438 | if (dev_priv->card_type < NV_C0) { |
439 | init->subchan[0].handle = NvSw; | 439 | init->subchan[0].handle = 0x00000000; |
440 | init->subchan[0].grclass = NV_SW; | 440 | init->subchan[0].grclass = 0x0000; |
441 | init->nr_subchan = 1; | 441 | init->subchan[1].handle = NvSw; |
442 | } else { | 442 | init->subchan[1].grclass = NV_SW; |
443 | init->nr_subchan = 0; | 443 | init->nr_subchan = 2; |
444 | } | 444 | } |
445 | 445 | ||
446 | /* Named memory object area */ | 446 | /* Named memory object area */ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.h b/drivers/gpu/drm/nouveau/nouveau_dma.h index bcf0fd9e313e..23d4edf992b7 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dma.h +++ b/drivers/gpu/drm/nouveau/nouveau_dma.h | |||
@@ -48,8 +48,8 @@ void nv50_dma_push(struct nouveau_channel *, struct nouveau_bo *, | |||
48 | 48 | ||
49 | /* Hardcoded object assignments to subchannels (subchannel id). */ | 49 | /* Hardcoded object assignments to subchannels (subchannel id). */ |
50 | enum { | 50 | enum { |
51 | NvSubSw = 0, | 51 | NvSubM2MF = 0, |
52 | NvSubM2MF = 1, | 52 | NvSubSw = 1, |
53 | NvSub2D = 2, | 53 | NvSub2D = 2, |
54 | NvSubCtxSurf2D = 2, | 54 | NvSubCtxSurf2D = 2, |
55 | NvSubGdiRect = 3, | 55 | NvSubGdiRect = 3, |
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index a4886b36d0fa..c2a8511e855a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -642,7 +642,7 @@ nouveau_card_channel_init(struct drm_device *dev) | |||
642 | OUT_RING (chan, chan->vram_handle); | 642 | OUT_RING (chan, chan->vram_handle); |
643 | OUT_RING (chan, chan->gart_handle); | 643 | OUT_RING (chan, chan->gart_handle); |
644 | } else | 644 | } else |
645 | if (dev_priv->card_type <= NV_C0) { | 645 | if (dev_priv->card_type <= NV_D0) { |
646 | ret = nouveau_gpuobj_gr_new(chan, 0x9039, 0x9039); | 646 | ret = nouveau_gpuobj_gr_new(chan, 0x9039, 0x9039); |
647 | if (ret) | 647 | if (ret) |
648 | goto error; | 648 | goto error; |
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c index d1bd239cd9e9..5ce9bf51a8de 100644 --- a/drivers/gpu/drm/radeon/atom.c +++ b/drivers/gpu/drm/radeon/atom.c | |||
@@ -1306,8 +1306,11 @@ struct atom_context *atom_parse(struct card_info *card, void *bios) | |||
1306 | 1306 | ||
1307 | int atom_asic_init(struct atom_context *ctx) | 1307 | int atom_asic_init(struct atom_context *ctx) |
1308 | { | 1308 | { |
1309 | struct radeon_device *rdev = ctx->card->dev->dev_private; | ||
1309 | int hwi = CU16(ctx->data_table + ATOM_DATA_FWI_PTR); | 1310 | int hwi = CU16(ctx->data_table + ATOM_DATA_FWI_PTR); |
1310 | uint32_t ps[16]; | 1311 | uint32_t ps[16]; |
1312 | int ret; | ||
1313 | |||
1311 | memset(ps, 0, 64); | 1314 | memset(ps, 0, 64); |
1312 | 1315 | ||
1313 | ps[0] = cpu_to_le32(CU32(hwi + ATOM_FWI_DEFSCLK_PTR)); | 1316 | ps[0] = cpu_to_le32(CU32(hwi + ATOM_FWI_DEFSCLK_PTR)); |
@@ -1317,7 +1320,17 @@ int atom_asic_init(struct atom_context *ctx) | |||
1317 | 1320 | ||
1318 | if (!CU16(ctx->cmd_table + 4 + 2 * ATOM_CMD_INIT)) | 1321 | if (!CU16(ctx->cmd_table + 4 + 2 * ATOM_CMD_INIT)) |
1319 | return 1; | 1322 | return 1; |
1320 | return atom_execute_table(ctx, ATOM_CMD_INIT, ps); | 1323 | ret = atom_execute_table(ctx, ATOM_CMD_INIT, ps); |
1324 | if (ret) | ||
1325 | return ret; | ||
1326 | |||
1327 | memset(ps, 0, 64); | ||
1328 | |||
1329 | if (rdev->family < CHIP_R600) { | ||
1330 | if (CU16(ctx->cmd_table + 4 + 2 * ATOM_CMD_SPDFANCNTL)) | ||
1331 | atom_execute_table(ctx, ATOM_CMD_SPDFANCNTL, ps); | ||
1332 | } | ||
1333 | return ret; | ||
1321 | } | 1334 | } |
1322 | 1335 | ||
1323 | void atom_destroy(struct atom_context *ctx) | 1336 | void atom_destroy(struct atom_context *ctx) |
diff --git a/drivers/gpu/drm/radeon/atom.h b/drivers/gpu/drm/radeon/atom.h index 93cfe2086ba0..25fea631dad2 100644 --- a/drivers/gpu/drm/radeon/atom.h +++ b/drivers/gpu/drm/radeon/atom.h | |||
@@ -44,6 +44,7 @@ | |||
44 | #define ATOM_CMD_SETSCLK 0x0A | 44 | #define ATOM_CMD_SETSCLK 0x0A |
45 | #define ATOM_CMD_SETMCLK 0x0B | 45 | #define ATOM_CMD_SETMCLK 0x0B |
46 | #define ATOM_CMD_SETPCLK 0x0C | 46 | #define ATOM_CMD_SETPCLK 0x0C |
47 | #define ATOM_CMD_SPDFANCNTL 0x39 | ||
47 | 48 | ||
48 | #define ATOM_DATA_FWI_PTR 0xC | 49 | #define ATOM_DATA_FWI_PTR 0xC |
49 | #define ATOM_DATA_IIO_PTR 0x32 | 50 | #define ATOM_DATA_IIO_PTR 0x32 |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index 6f70158d34e4..df6a4dbd93f8 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -241,7 +241,8 @@ int radeon_bo_pin_restricted(struct radeon_bo *bo, u32 domain, u64 max_offset, | |||
241 | domain_start = bo->rdev->mc.vram_start; | 241 | domain_start = bo->rdev->mc.vram_start; |
242 | else | 242 | else |
243 | domain_start = bo->rdev->mc.gtt_start; | 243 | domain_start = bo->rdev->mc.gtt_start; |
244 | WARN_ON_ONCE((*gpu_addr - domain_start) > max_offset); | 244 | WARN_ON_ONCE(max_offset < |
245 | (radeon_bo_gpu_offset(bo) - domain_start)); | ||
245 | } | 246 | } |
246 | 247 | ||
247 | return 0; | 248 | return 0; |
diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c index 5340c5f3987b..53673907a6a0 100644 --- a/drivers/gpu/drm/udl/udl_drv.c +++ b/drivers/gpu/drm/udl/udl_drv.c | |||
@@ -47,7 +47,7 @@ static struct vm_operations_struct udl_gem_vm_ops = { | |||
47 | static const struct file_operations udl_driver_fops = { | 47 | static const struct file_operations udl_driver_fops = { |
48 | .owner = THIS_MODULE, | 48 | .owner = THIS_MODULE, |
49 | .open = drm_open, | 49 | .open = drm_open, |
50 | .mmap = drm_gem_mmap, | 50 | .mmap = udl_drm_gem_mmap, |
51 | .poll = drm_poll, | 51 | .poll = drm_poll, |
52 | .read = drm_read, | 52 | .read = drm_read, |
53 | .unlocked_ioctl = drm_ioctl, | 53 | .unlocked_ioctl = drm_ioctl, |
diff --git a/drivers/gpu/drm/udl/udl_drv.h b/drivers/gpu/drm/udl/udl_drv.h index 1612954a5bc4..96820d03a303 100644 --- a/drivers/gpu/drm/udl/udl_drv.h +++ b/drivers/gpu/drm/udl/udl_drv.h | |||
@@ -121,6 +121,7 @@ struct udl_gem_object *udl_gem_alloc_object(struct drm_device *dev, | |||
121 | 121 | ||
122 | int udl_gem_vmap(struct udl_gem_object *obj); | 122 | int udl_gem_vmap(struct udl_gem_object *obj); |
123 | void udl_gem_vunmap(struct udl_gem_object *obj); | 123 | void udl_gem_vunmap(struct udl_gem_object *obj); |
124 | int udl_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); | ||
124 | int udl_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); | 125 | int udl_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); |
125 | 126 | ||
126 | int udl_handle_damage(struct udl_framebuffer *fb, int x, int y, | 127 | int udl_handle_damage(struct udl_framebuffer *fb, int x, int y, |
diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_gem.c index 852642dc1187..92f19ef329b0 100644 --- a/drivers/gpu/drm/udl/udl_gem.c +++ b/drivers/gpu/drm/udl/udl_gem.c | |||
@@ -71,6 +71,20 @@ int udl_dumb_destroy(struct drm_file *file, struct drm_device *dev, | |||
71 | return drm_gem_handle_delete(file, handle); | 71 | return drm_gem_handle_delete(file, handle); |
72 | } | 72 | } |
73 | 73 | ||
74 | int udl_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma) | ||
75 | { | ||
76 | int ret; | ||
77 | |||
78 | ret = drm_gem_mmap(filp, vma); | ||
79 | if (ret) | ||
80 | return ret; | ||
81 | |||
82 | vma->vm_flags &= ~VM_PFNMAP; | ||
83 | vma->vm_flags |= VM_MIXEDMAP; | ||
84 | |||
85 | return ret; | ||
86 | } | ||
87 | |||
74 | int udl_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | 88 | int udl_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) |
75 | { | 89 | { |
76 | struct udl_gem_object *obj = to_udl_bo(vma->vm_private_data); | 90 | struct udl_gem_object *obj = to_udl_bo(vma->vm_private_data); |