aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-01-13 23:48:42 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-13 23:48:42 -0500
commit2145199c4f0db7c517dd788abec301dc84b91bd0 (patch)
treed5ae3afd434b81a377bf3ddb3780703952a4fdc0 /drivers
parent21ebd6c68b5511b55f4f456e4ba17c2d711e3617 (diff)
parent081794564e3000e602de290d1121792c33b475a4 (diff)
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: dma-buf: Documentation update for Kconfig select nouveau: Support Optimus models for vga_switcheroo nouveau: properly check for _DSM function support dma-buf: drop option text so users don't select it. radeon: Call pci_clear_master() instead of open-coding it. gma500: Discard modes that don't fit in stolen memory drm: bump DRM_CONNECTOR_MAX_ENCODER from 2 to 3 drm/radeon/kms: Fix module parameter description format drm/radeon/kms/ni: fix packet2 handling for VM IB parser ttm/dma: Remove the WARN() which is not useful.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/Kconfig2
-rw-r--r--drivers/gpu/drm/gma500/cdv_intel_crt.c6
-rw-r--r--drivers/gpu/drm/gma500/cdv_intel_hdmi.c14
-rw-r--r--drivers/gpu/drm/gma500/oaktrail_hdmi.c6
-rw-r--r--drivers/gpu/drm/gma500/psb_intel_sdvo.c6
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_acpi.c79
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.h2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_state.c1
-rw-r--r--drivers/gpu/drm/radeon/evergreen_cs.c3
-rw-r--r--drivers/gpu/drm/radeon/r100.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c2
-rw-r--r--drivers/gpu/drm/radeon/rs600.c13
-rw-r--r--drivers/gpu/drm/ttm/ttm_page_alloc_dma.c5
13 files changed, 97 insertions, 46 deletions
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index fcbec8ac134d..7be9f79018e9 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -179,7 +179,7 @@ config GENERIC_CPU_DEVICES
179source "drivers/base/regmap/Kconfig" 179source "drivers/base/regmap/Kconfig"
180 180
181config DMA_SHARED_BUFFER 181config DMA_SHARED_BUFFER
182 bool "Buffer framework to be shared between drivers" 182 bool
183 default n 183 default n
184 select ANON_INODES 184 select ANON_INODES
185 depends on EXPERIMENTAL 185 depends on EXPERIMENTAL
diff --git a/drivers/gpu/drm/gma500/cdv_intel_crt.c b/drivers/gpu/drm/gma500/cdv_intel_crt.c
index 6d0f10b7569c..c100f3e9c920 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_crt.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_crt.c
@@ -66,6 +66,7 @@ static void cdv_intel_crt_dpms(struct drm_encoder *encoder, int mode)
66static int cdv_intel_crt_mode_valid(struct drm_connector *connector, 66static int cdv_intel_crt_mode_valid(struct drm_connector *connector,
67 struct drm_display_mode *mode) 67 struct drm_display_mode *mode)
68{ 68{
69 struct drm_psb_private *dev_priv = connector->dev->dev_private;
69 int max_clock = 0; 70 int max_clock = 0;
70 if (mode->flags & DRM_MODE_FLAG_DBLSCAN) 71 if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
71 return MODE_NO_DBLESCAN; 72 return MODE_NO_DBLESCAN;
@@ -82,6 +83,11 @@ static int cdv_intel_crt_mode_valid(struct drm_connector *connector,
82 if (mode->hdisplay > 1680 || mode->vdisplay > 1050) 83 if (mode->hdisplay > 1680 || mode->vdisplay > 1050)
83 return MODE_PANEL; 84 return MODE_PANEL;
84 85
86 /* We assume worst case scenario of 32 bpp here, since we don't know */
87 if ((ALIGN(mode->hdisplay * 4, 64) * mode->vdisplay) >
88 dev_priv->vram_stolen_size)
89 return MODE_MEM;
90
85 return MODE_OK; 91 return MODE_OK;
86} 92}
87 93
diff --git a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
index 50d7cfb51662..de25560e629d 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
@@ -241,6 +241,7 @@ static int cdv_hdmi_get_modes(struct drm_connector *connector)
241static int cdv_hdmi_mode_valid(struct drm_connector *connector, 241static int cdv_hdmi_mode_valid(struct drm_connector *connector,
242 struct drm_display_mode *mode) 242 struct drm_display_mode *mode)
243{ 243{
244 struct drm_psb_private *dev_priv = connector->dev->dev_private;
244 245
245 if (mode->clock > 165000) 246 if (mode->clock > 165000)
246 return MODE_CLOCK_HIGH; 247 return MODE_CLOCK_HIGH;
@@ -255,14 +256,11 @@ static int cdv_hdmi_mode_valid(struct drm_connector *connector,
255 if (mode->flags & DRM_MODE_FLAG_INTERLACE) 256 if (mode->flags & DRM_MODE_FLAG_INTERLACE)
256 return MODE_NO_INTERLACE; 257 return MODE_NO_INTERLACE;
257 258
258 /* 259 /* We assume worst case scenario of 32 bpp here, since we don't know */
259 * FIXME: for now we limit the size to 1680x1050 on CDV, otherwise it 260 if ((ALIGN(mode->hdisplay * 4, 64) * mode->vdisplay) >
260 * will go beyond the stolen memory size allocated to the framebuffer 261 dev_priv->vram_stolen_size)
261 */ 262 return MODE_MEM;
262 if (mode->hdisplay > 1680) 263
263 return MODE_PANEL;
264 if (mode->vdisplay > 1050)
265 return MODE_PANEL;
266 return MODE_OK; 264 return MODE_OK;
267} 265}
268 266
diff --git a/drivers/gpu/drm/gma500/oaktrail_hdmi.c b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
index 36878a60080d..025d30970cc0 100644
--- a/drivers/gpu/drm/gma500/oaktrail_hdmi.c
+++ b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
@@ -506,6 +506,7 @@ int oaktrail_crtc_hdmi_mode_set(struct drm_crtc *crtc,
506static int oaktrail_hdmi_mode_valid(struct drm_connector *connector, 506static int oaktrail_hdmi_mode_valid(struct drm_connector *connector,
507 struct drm_display_mode *mode) 507 struct drm_display_mode *mode)
508{ 508{
509 struct drm_psb_private *dev_priv = connector->dev->dev_private;
509 if (mode->clock > 165000) 510 if (mode->clock > 165000)
510 return MODE_CLOCK_HIGH; 511 return MODE_CLOCK_HIGH;
511 if (mode->clock < 20000) 512 if (mode->clock < 20000)
@@ -514,6 +515,11 @@ static int oaktrail_hdmi_mode_valid(struct drm_connector *connector,
514 if (mode->flags & DRM_MODE_FLAG_DBLSCAN) 515 if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
515 return MODE_NO_DBLESCAN; 516 return MODE_NO_DBLESCAN;
516 517
518 /* We assume worst case scenario of 32 bpp here, since we don't know */
519 if ((ALIGN(mode->hdisplay * 4, 64) * mode->vdisplay) >
520 dev_priv->vram_stolen_size)
521 return MODE_MEM;
522
517 return MODE_OK; 523 return MODE_OK;
518} 524}
519 525
diff --git a/drivers/gpu/drm/gma500/psb_intel_sdvo.c b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
index 4882b29119e0..88b42971c0fd 100644
--- a/drivers/gpu/drm/gma500/psb_intel_sdvo.c
+++ b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
@@ -1141,6 +1141,7 @@ static void psb_intel_sdvo_dpms(struct drm_encoder *encoder, int mode)
1141static int psb_intel_sdvo_mode_valid(struct drm_connector *connector, 1141static int psb_intel_sdvo_mode_valid(struct drm_connector *connector,
1142 struct drm_display_mode *mode) 1142 struct drm_display_mode *mode)
1143{ 1143{
1144 struct drm_psb_private *dev_priv = connector->dev->dev_private;
1144 struct psb_intel_sdvo *psb_intel_sdvo = intel_attached_sdvo(connector); 1145 struct psb_intel_sdvo *psb_intel_sdvo = intel_attached_sdvo(connector);
1145 1146
1146 if (mode->flags & DRM_MODE_FLAG_DBLSCAN) 1147 if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
@@ -1160,6 +1161,11 @@ static int psb_intel_sdvo_mode_valid(struct drm_connector *connector,
1160 return MODE_PANEL; 1161 return MODE_PANEL;
1161 } 1162 }
1162 1163
1164 /* We assume worst case scenario of 32 bpp here, since we don't know */
1165 if ((ALIGN(mode->hdisplay * 4, 64) * mode->vdisplay) >
1166 dev_priv->vram_stolen_size)
1167 return MODE_MEM;
1168
1163 return MODE_OK; 1169 return MODE_OK;
1164} 1170}
1165 1171
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c
index 525744d593c1..7814a760c164 100644
--- a/drivers/gpu/drm/nouveau/nouveau_acpi.c
+++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
@@ -18,12 +18,6 @@
18 18
19#include <linux/vga_switcheroo.h> 19#include <linux/vga_switcheroo.h>
20 20
21#define NOUVEAU_DSM_SUPPORTED 0x00
22#define NOUVEAU_DSM_SUPPORTED_FUNCTIONS 0x00
23
24#define NOUVEAU_DSM_ACTIVE 0x01
25#define NOUVEAU_DSM_ACTIVE_QUERY 0x00
26
27#define NOUVEAU_DSM_LED 0x02 21#define NOUVEAU_DSM_LED 0x02
28#define NOUVEAU_DSM_LED_STATE 0x00 22#define NOUVEAU_DSM_LED_STATE 0x00
29#define NOUVEAU_DSM_LED_OFF 0x10 23#define NOUVEAU_DSM_LED_OFF 0x10
@@ -35,6 +29,9 @@
35#define NOUVEAU_DSM_POWER_SPEED 0x01 29#define NOUVEAU_DSM_POWER_SPEED 0x01
36#define NOUVEAU_DSM_POWER_STAMINA 0x02 30#define NOUVEAU_DSM_POWER_STAMINA 0x02
37 31
32#define NOUVEAU_DSM_OPTIMUS_FN 0x1A
33#define NOUVEAU_DSM_OPTIMUS_ARGS 0x03000001
34
38static struct nouveau_dsm_priv { 35static struct nouveau_dsm_priv {
39 bool dsm_detected; 36 bool dsm_detected;
40 bool optimus_detected; 37 bool optimus_detected;
@@ -61,7 +58,8 @@ static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t *
61 struct acpi_object_list input; 58 struct acpi_object_list input;
62 union acpi_object params[4]; 59 union acpi_object params[4];
63 union acpi_object *obj; 60 union acpi_object *obj;
64 int err; 61 int i, err;
62 char args_buff[4];
65 63
66 input.count = 4; 64 input.count = 4;
67 input.pointer = params; 65 input.pointer = params;
@@ -73,7 +71,11 @@ static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t *
73 params[2].type = ACPI_TYPE_INTEGER; 71 params[2].type = ACPI_TYPE_INTEGER;
74 params[2].integer.value = func; 72 params[2].integer.value = func;
75 params[3].type = ACPI_TYPE_BUFFER; 73 params[3].type = ACPI_TYPE_BUFFER;
76 params[3].buffer.length = 0; 74 params[3].buffer.length = 4;
75 /* ACPI is little endian, AABBCCDD becomes {DD,CC,BB,AA} */
76 for (i = 0; i < 4; i++)
77 args_buff[i] = (arg >> i * 8) & 0xFF;
78 params[3].buffer.pointer = args_buff;
77 79
78 err = acpi_evaluate_object(handle, "_DSM", &input, &output); 80 err = acpi_evaluate_object(handle, "_DSM", &input, &output);
79 if (err) { 81 if (err) {
@@ -148,6 +150,23 @@ static int nouveau_dsm(acpi_handle handle, int func, int arg, uint32_t *result)
148 return 0; 150 return 0;
149} 151}
150 152
153/* Returns 1 if a DSM function is usable and 0 otherwise */
154static int nouveau_test_dsm(acpi_handle test_handle,
155 int (*dsm_func)(acpi_handle, int, int, uint32_t *),
156 int sfnc)
157{
158 u32 result = 0;
159
160 /* Function 0 returns a Buffer containing available functions. The args
161 * parameter is ignored for function 0, so just put 0 in it */
162 if (dsm_func(test_handle, 0, 0, &result))
163 return 0;
164
165 /* ACPI Spec v4 9.14.1: if bit 0 is zero, no function is supported. If
166 * the n-th bit is enabled, function n is supported */
167 return result & 1 && result & (1 << sfnc);
168}
169
151static int nouveau_dsm_switch_mux(acpi_handle handle, int mux_id) 170static int nouveau_dsm_switch_mux(acpi_handle handle, int mux_id)
152{ 171{
153 mxm_wmi_call_mxmx(mux_id == NOUVEAU_DSM_LED_STAMINA ? MXM_MXDS_ADAPTER_IGD : MXM_MXDS_ADAPTER_0); 172 mxm_wmi_call_mxmx(mux_id == NOUVEAU_DSM_LED_STAMINA ? MXM_MXDS_ADAPTER_IGD : MXM_MXDS_ADAPTER_0);
@@ -168,6 +187,10 @@ static int nouveau_dsm_set_discrete_state(acpi_handle handle, enum vga_switchero
168 187
169static int nouveau_dsm_switchto(enum vga_switcheroo_client_id id) 188static int nouveau_dsm_switchto(enum vga_switcheroo_client_id id)
170{ 189{
190 /* perhaps the _DSM functions are mutually exclusive, but prepare for
191 * the future */
192 if (!nouveau_dsm_priv.dsm_detected && nouveau_dsm_priv.optimus_detected)
193 return 0;
171 if (id == VGA_SWITCHEROO_IGD) 194 if (id == VGA_SWITCHEROO_IGD)
172 return nouveau_dsm_switch_mux(nouveau_dsm_priv.dhandle, NOUVEAU_DSM_LED_STAMINA); 195 return nouveau_dsm_switch_mux(nouveau_dsm_priv.dhandle, NOUVEAU_DSM_LED_STAMINA);
173 else 196 else
@@ -180,6 +203,11 @@ static int nouveau_dsm_power_state(enum vga_switcheroo_client_id id,
180 if (id == VGA_SWITCHEROO_IGD) 203 if (id == VGA_SWITCHEROO_IGD)
181 return 0; 204 return 0;
182 205
206 /* Optimus laptops have the card already disabled in
207 * nouveau_switcheroo_set_state */
208 if (!nouveau_dsm_priv.dsm_detected && nouveau_dsm_priv.optimus_detected)
209 return 0;
210
183 return nouveau_dsm_set_discrete_state(nouveau_dsm_priv.dhandle, state); 211 return nouveau_dsm_set_discrete_state(nouveau_dsm_priv.dhandle, state);
184} 212}
185 213
@@ -212,8 +240,7 @@ static int nouveau_dsm_pci_probe(struct pci_dev *pdev)
212{ 240{
213 acpi_handle dhandle, nvidia_handle; 241 acpi_handle dhandle, nvidia_handle;
214 acpi_status status; 242 acpi_status status;
215 int ret, retval = 0; 243 int retval = 0;
216 uint32_t result;
217 244
218 dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); 245 dhandle = DEVICE_ACPI_HANDLE(&pdev->dev);
219 if (!dhandle) 246 if (!dhandle)
@@ -224,13 +251,11 @@ static int nouveau_dsm_pci_probe(struct pci_dev *pdev)
224 return false; 251 return false;
225 } 252 }
226 253
227 ret = nouveau_dsm(dhandle, NOUVEAU_DSM_SUPPORTED, 254 if (nouveau_test_dsm(dhandle, nouveau_dsm, NOUVEAU_DSM_POWER))
228 NOUVEAU_DSM_SUPPORTED_FUNCTIONS, &result);
229 if (ret == 0)
230 retval |= NOUVEAU_DSM_HAS_MUX; 255 retval |= NOUVEAU_DSM_HAS_MUX;
231 256
232 ret = nouveau_optimus_dsm(dhandle, 0, 0, &result); 257 if (nouveau_test_dsm(dhandle, nouveau_optimus_dsm,
233 if (ret == 0) 258 NOUVEAU_DSM_OPTIMUS_FN))
234 retval |= NOUVEAU_DSM_HAS_OPT; 259 retval |= NOUVEAU_DSM_HAS_OPT;
235 260
236 if (retval) 261 if (retval)
@@ -269,15 +294,22 @@ static bool nouveau_dsm_detect(void)
269 } 294 }
270 295
271 if (vga_count == 2 && has_dsm && guid_valid) { 296 if (vga_count == 2 && has_dsm && guid_valid) {
272 acpi_get_name(nouveau_dsm_priv.dhandle, ACPI_FULL_PATHNAME, &buffer); 297 acpi_get_name(nouveau_dsm_priv.dhandle, ACPI_FULL_PATHNAME,
298 &buffer);
273 printk(KERN_INFO "VGA switcheroo: detected DSM switching method %s handle\n", 299 printk(KERN_INFO "VGA switcheroo: detected DSM switching method %s handle\n",
274 acpi_method_name); 300 acpi_method_name);
275 nouveau_dsm_priv.dsm_detected = true; 301 nouveau_dsm_priv.dsm_detected = true;
276 ret = true; 302 ret = true;
277 } 303 }
278 304
279 if (has_optimus == 1) 305 if (has_optimus == 1) {
306 acpi_get_name(nouveau_dsm_priv.dhandle, ACPI_FULL_PATHNAME,
307 &buffer);
308 printk(KERN_INFO "VGA switcheroo: detected Optimus DSM method %s handle\n",
309 acpi_method_name);
280 nouveau_dsm_priv.optimus_detected = true; 310 nouveau_dsm_priv.optimus_detected = true;
311 ret = true;
312 }
281 313
282 return ret; 314 return ret;
283} 315}
@@ -293,6 +325,17 @@ void nouveau_register_dsm_handler(void)
293 vga_switcheroo_register_handler(&nouveau_dsm_handler); 325 vga_switcheroo_register_handler(&nouveau_dsm_handler);
294} 326}
295 327
328/* Must be called for Optimus models before the card can be turned off */
329void nouveau_switcheroo_optimus_dsm(void)
330{
331 u32 result = 0;
332 if (!nouveau_dsm_priv.optimus_detected)
333 return;
334
335 nouveau_optimus_dsm(nouveau_dsm_priv.dhandle, NOUVEAU_DSM_OPTIMUS_FN,
336 NOUVEAU_DSM_OPTIMUS_ARGS, &result);
337}
338
296void nouveau_unregister_dsm_handler(void) 339void nouveau_unregister_dsm_handler(void)
297{ 340{
298 vga_switcheroo_unregister_handler(); 341 vga_switcheroo_unregister_handler();
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index 38134a9c7578..b82709828931 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -1055,12 +1055,14 @@ extern int nouveau_dma_wait(struct nouveau_channel *, int slots, int size);
1055#if defined(CONFIG_ACPI) 1055#if defined(CONFIG_ACPI)
1056void nouveau_register_dsm_handler(void); 1056void nouveau_register_dsm_handler(void);
1057void nouveau_unregister_dsm_handler(void); 1057void nouveau_unregister_dsm_handler(void);
1058void nouveau_switcheroo_optimus_dsm(void);
1058int nouveau_acpi_get_bios_chunk(uint8_t *bios, int offset, int len); 1059int nouveau_acpi_get_bios_chunk(uint8_t *bios, int offset, int len);
1059bool nouveau_acpi_rom_supported(struct pci_dev *pdev); 1060bool nouveau_acpi_rom_supported(struct pci_dev *pdev);
1060int nouveau_acpi_edid(struct drm_device *, struct drm_connector *); 1061int nouveau_acpi_edid(struct drm_device *, struct drm_connector *);
1061#else 1062#else
1062static inline void nouveau_register_dsm_handler(void) {} 1063static inline void nouveau_register_dsm_handler(void) {}
1063static inline void nouveau_unregister_dsm_handler(void) {} 1064static inline void nouveau_unregister_dsm_handler(void) {}
1065static inline void nouveau_switcheroo_optimus_dsm(void) {}
1064static inline bool nouveau_acpi_rom_supported(struct pci_dev *pdev) { return false; } 1066static inline bool nouveau_acpi_rom_supported(struct pci_dev *pdev) { return false; }
1065static inline int nouveau_acpi_get_bios_chunk(uint8_t *bios, int offset, int len) { return -EINVAL; } 1067static inline int nouveau_acpi_get_bios_chunk(uint8_t *bios, int offset, int len) { return -EINVAL; }
1066static inline int nouveau_acpi_edid(struct drm_device *dev, struct drm_connector *connector) { return -EINVAL; } 1068static inline int nouveau_acpi_edid(struct drm_device *dev, struct drm_connector *connector) { return -EINVAL; }
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
index f5e98910d17f..f80c5e0762ff 100644
--- a/drivers/gpu/drm/nouveau/nouveau_state.c
+++ b/drivers/gpu/drm/nouveau/nouveau_state.c
@@ -525,6 +525,7 @@ static void nouveau_switcheroo_set_state(struct pci_dev *pdev,
525 printk(KERN_ERR "VGA switcheroo: switched nouveau off\n"); 525 printk(KERN_ERR "VGA switcheroo: switched nouveau off\n");
526 dev->switch_power_state = DRM_SWITCH_POWER_CHANGING; 526 dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
527 drm_kms_helper_poll_disable(dev); 527 drm_kms_helper_poll_disable(dev);
528 nouveau_switcheroo_optimus_dsm();
528 nouveau_pci_suspend(pdev, pmm); 529 nouveau_pci_suspend(pdev, pmm);
529 dev->switch_power_state = DRM_SWITCH_POWER_OFF; 530 dev->switch_power_state = DRM_SWITCH_POWER_OFF;
530 } 531 }
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
index f7442e62c03f..8e8cd85e5c00 100644
--- a/drivers/gpu/drm/radeon/evergreen_cs.c
+++ b/drivers/gpu/drm/radeon/evergreen_cs.c
@@ -1793,10 +1793,12 @@ int evergreen_ib_parse(struct radeon_device *rdev, struct radeon_ib *ib)
1793 ret = -EINVAL; 1793 ret = -EINVAL;
1794 break; 1794 break;
1795 case PACKET_TYPE2: 1795 case PACKET_TYPE2:
1796 idx += 1;
1796 break; 1797 break;
1797 case PACKET_TYPE3: 1798 case PACKET_TYPE3:
1798 pkt.opcode = CP_PACKET3_GET_OPCODE(ib->ptr[idx]); 1799 pkt.opcode = CP_PACKET3_GET_OPCODE(ib->ptr[idx]);
1799 ret = evergreen_vm_packet3_check(rdev, ib->ptr, &pkt); 1800 ret = evergreen_vm_packet3_check(rdev, ib->ptr, &pkt);
1801 idx += pkt.count + 2;
1800 break; 1802 break;
1801 default: 1803 default:
1802 dev_err(rdev->dev, "Unknown packet type %d !\n", pkt.type); 1804 dev_err(rdev->dev, "Unknown packet type %d !\n", pkt.type);
@@ -1805,7 +1807,6 @@ int evergreen_ib_parse(struct radeon_device *rdev, struct radeon_ib *ib)
1805 } 1807 }
1806 if (ret) 1808 if (ret)
1807 break; 1809 break;
1808 idx += pkt.count + 2;
1809 } while (idx < ib->length_dw); 1810 } while (idx < ib->length_dw);
1810 1811
1811 return ret; 1812 return ret;
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 3ec81c3d5108..bfd36ab643a6 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -2186,7 +2186,6 @@ bool r100_gpu_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring)
2186void r100_bm_disable(struct radeon_device *rdev) 2186void r100_bm_disable(struct radeon_device *rdev)
2187{ 2187{
2188 u32 tmp; 2188 u32 tmp;
2189 u16 tmp16;
2190 2189
2191 /* disable bus mastering */ 2190 /* disable bus mastering */
2192 tmp = RREG32(R_000030_BUS_CNTL); 2191 tmp = RREG32(R_000030_BUS_CNTL);
@@ -2197,8 +2196,7 @@ void r100_bm_disable(struct radeon_device *rdev)
2197 WREG32(R_000030_BUS_CNTL, (tmp & 0xFFFFFFFF) | 0x00000040); 2196 WREG32(R_000030_BUS_CNTL, (tmp & 0xFFFFFFFF) | 0x00000040);
2198 tmp = RREG32(RADEON_BUS_CNTL); 2197 tmp = RREG32(RADEON_BUS_CNTL);
2199 mdelay(1); 2198 mdelay(1);
2200 pci_read_config_word(rdev->pdev, 0x4, &tmp16); 2199 pci_clear_master(rdev->pdev);
2201 pci_write_config_word(rdev->pdev, 0x4, tmp16 & 0xFFFB);
2202 mdelay(1); 2200 mdelay(1);
2203} 2201}
2204 2202
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 31da622eef63..8032f1fedb11 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -145,7 +145,7 @@ module_param_named(vramlimit, radeon_vram_limit, int, 0600);
145MODULE_PARM_DESC(agpmode, "AGP Mode (-1 == PCI)"); 145MODULE_PARM_DESC(agpmode, "AGP Mode (-1 == PCI)");
146module_param_named(agpmode, radeon_agpmode, int, 0444); 146module_param_named(agpmode, radeon_agpmode, int, 0444);
147 147
148MODULE_PARM_DESC(gartsize, "Size of PCIE/IGP gart to setup in megabytes (32,64, etc)\n"); 148MODULE_PARM_DESC(gartsize, "Size of PCIE/IGP gart to setup in megabytes (32, 64, etc)");
149module_param_named(gartsize, radeon_gart_size, int, 0600); 149module_param_named(gartsize, radeon_gart_size, int, 0600);
150 150
151MODULE_PARM_DESC(benchmark, "Run benchmark"); 151MODULE_PARM_DESC(benchmark, "Run benchmark");
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index 803e0d3c1773..ec46eb45e34c 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -322,16 +322,6 @@ void rs600_hpd_fini(struct radeon_device *rdev)
322 } 322 }
323} 323}
324 324
325void rs600_bm_disable(struct radeon_device *rdev)
326{
327 u16 tmp;
328
329 /* disable bus mastering */
330 pci_read_config_word(rdev->pdev, 0x4, &tmp);
331 pci_write_config_word(rdev->pdev, 0x4, tmp & 0xFFFB);
332 mdelay(1);
333}
334
335int rs600_asic_reset(struct radeon_device *rdev) 325int rs600_asic_reset(struct radeon_device *rdev)
336{ 326{
337 struct rv515_mc_save save; 327 struct rv515_mc_save save;
@@ -355,7 +345,8 @@ int rs600_asic_reset(struct radeon_device *rdev)
355 WREG32(RADEON_CP_RB_CNTL, tmp); 345 WREG32(RADEON_CP_RB_CNTL, tmp);
356 pci_save_state(rdev->pdev); 346 pci_save_state(rdev->pdev);
357 /* disable bus mastering */ 347 /* disable bus mastering */
358 rs600_bm_disable(rdev); 348 pci_clear_master(rdev->pdev);
349 mdelay(1);
359 /* reset GA+VAP */ 350 /* reset GA+VAP */
360 WREG32(R_0000F0_RBBM_SOFT_RESET, S_0000F0_SOFT_RESET_VAP(1) | 351 WREG32(R_0000F0_RBBM_SOFT_RESET, S_0000F0_SOFT_RESET_VAP(1) |
361 S_0000F0_SOFT_RESET_GA(1)); 352 S_0000F0_SOFT_RESET_GA(1));
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
index 37ead6995c87..0c46d8cdc6ea 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
@@ -952,10 +952,9 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev)
952 952
953 type = ttm_to_type(ttm->page_flags, ttm->caching_state); 953 type = ttm_to_type(ttm->page_flags, ttm->caching_state);
954 pool = ttm_dma_find_pool(dev, type); 954 pool = ttm_dma_find_pool(dev, type);
955 if (!pool) { 955 if (!pool)
956 WARN_ON(!pool);
957 return; 956 return;
958 } 957
959 is_cached = (ttm_dma_find_pool(pool->dev, 958 is_cached = (ttm_dma_find_pool(pool->dev,
960 ttm_to_type(ttm->page_flags, tt_cached)) == pool); 959 ttm_to_type(ttm->page_flags, tt_cached)) == pool);
961 960