aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/acpi_memhotplug.c1
-rw-r--r--drivers/acpi/acpi_processor.c2
-rw-r--r--drivers/acpi/processor_core.c8
-rw-r--r--drivers/acpi/processor_driver.c8
-rw-r--r--drivers/acpi/processor_idle.c6
-rw-r--r--drivers/acpi/scan.c13
-rw-r--r--drivers/acpi/video.c8
-rw-r--r--drivers/base/core.c120
-rw-r--r--drivers/base/cpu.c2
-rw-r--r--drivers/base/platform.c1
-rw-r--r--drivers/base/regmap/regmap.c2
-rw-r--r--drivers/base/topology.c10
-rw-r--r--drivers/clocksource/arm_arch_timer.c8
-rw-r--r--drivers/clocksource/arm_global_timer.c8
-rw-r--r--drivers/clocksource/dummy_timer.c6
-rw-r--r--drivers/clocksource/exynos_mct.c4
-rw-r--r--drivers/clocksource/metag_generic.c6
-rw-r--r--drivers/clocksource/time-armada-370-xp.c4
-rw-r--r--drivers/clocksource/timer-marco.c4
-rw-r--r--drivers/cpufreq/cpufreq.c6
-rw-r--r--drivers/cpufreq/cpufreq_governor.c3
-rw-r--r--drivers/cpufreq/cpufreq_stats.c8
-rw-r--r--drivers/cpufreq/dbx500-cpufreq.c2
-rw-r--r--drivers/cpufreq/intel_pstate.c4
-rw-r--r--drivers/cpufreq/longhaul.c6
-rw-r--r--drivers/cpufreq/longhaul.h26
-rw-r--r--drivers/cpufreq/longrun.c6
-rw-r--r--drivers/cpufreq/omap-cpufreq.c2
-rw-r--r--drivers/cpufreq/powernow-k7.c8
-rw-r--r--drivers/cpufreq/powernow-k8.c6
-rw-r--r--drivers/cpufreq/s3c24xx-cpufreq.c4
-rw-r--r--drivers/firmware/efi/efivars.c3
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c4
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c83
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c5
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c31
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c38
-rw-r--r--drivers/gpu/drm/radeon/cik.c59
-rw-r--r--drivers/gpu/drm/radeon/cikd.h16
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c13
-rw-r--r--drivers/gpu/drm/radeon/evergreen_hdmi.c6
-rw-r--r--drivers/gpu/drm/radeon/ni.c182
-rw-r--r--drivers/gpu/drm/radeon/nid.h16
-rw-r--r--drivers/gpu/drm/radeon/r100.c11
-rw-r--r--drivers/gpu/drm/radeon/r600.c102
-rw-r--r--drivers/gpu/drm/radeon/r600_hdmi.c6
-rw-r--r--drivers/gpu/drm/radeon/r600d.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon.h10
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.c13
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.h5
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c40
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_fence.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_gart.c11
-rw-r--r--drivers/gpu/drm/radeon/radeon_irq_kms.c11
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.h2
-rw-r--r--drivers/gpu/drm/radeon/radeon_ring.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_sa.c7
-rw-r--r--drivers/gpu/drm/radeon/radeon_uvd.c111
-rw-r--r--drivers/gpu/drm/radeon/rs780_dpm.c25
-rw-r--r--drivers/gpu/drm/radeon/rs780d.h3
-rw-r--r--drivers/gpu/drm/radeon/rv6xx_dpm.c14
-rw-r--r--drivers/gpu/drm/radeon/rv770.c2
-rw-r--r--drivers/gpu/drm/radeon/rv770_dpm.c14
-rw-r--r--drivers/gpu/drm/radeon/si.c298
-rw-r--r--drivers/gpu/drm/radeon/sid.h14
-rw-r--r--drivers/gpu/drm/radeon/sumo_dpm.c14
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_drv.c9
-rw-r--r--drivers/gpu/drm/shmobile/shmob_drm_drv.c9
-rw-r--r--drivers/hwmon/abx500.c2
-rw-r--r--drivers/hwmon/coretemp.c39
-rw-r--r--drivers/hwmon/via-cputemp.c8
-rw-r--r--drivers/irqchip/irq-gic.c8
-rw-r--r--drivers/md/md.c14
-rw-r--r--drivers/md/raid1.c53
-rw-r--r--drivers/md/raid10.c11
-rw-r--r--drivers/media/pci/saa7134/saa7134-alsa.c2
-rw-r--r--drivers/net/ethernet/atheros/atl1e/atl1e_main.c24
-rw-r--r--drivers/net/ethernet/broadcom/Kconfig1
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c14
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/debugfs.c2
-rw-r--r--drivers/net/hyperv/netvsc_drv.c4
-rw-r--r--drivers/net/macvtap.c65
-rw-r--r--drivers/net/tun.c62
-rw-r--r--drivers/net/vxlan.c6
-rw-r--r--drivers/net/xen-netfront.c31
-rw-r--r--drivers/oprofile/timer_int.c4
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c2
-rw-r--r--drivers/pnp/resource.c1
-rw-r--r--drivers/s390/cio/qdio_main.c4
-rw-r--r--drivers/s390/crypto/ap_bus.c1
-rw-r--r--drivers/spi/spi-altera.c12
-rw-r--r--drivers/spi/spi-nuc900.c13
-rw-r--r--drivers/spi/spi-s3c64xx.c3
-rw-r--r--drivers/spi/spi-xilinx.c16
-rw-r--r--drivers/staging/line6/pcm.c5
-rw-r--r--drivers/video/uvesafb.c2
-rw-r--r--drivers/xen/xen-acpi-cpuhotplug.c2
99 files changed, 1365 insertions, 544 deletions
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index c711d1144044..999adb5499c7 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -323,6 +323,7 @@ static int acpi_memory_device_add(struct acpi_device *device,
323 /* Get the range from the _CRS */ 323 /* Get the range from the _CRS */
324 result = acpi_memory_get_device_resources(mem_device); 324 result = acpi_memory_get_device_resources(mem_device);
325 if (result) { 325 if (result) {
326 device->driver_data = NULL;
326 kfree(mem_device); 327 kfree(mem_device);
327 return result; 328 return result;
328 } 329 }
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index e9b01e35ac37..fd6c51cc3acb 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -340,7 +340,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
340 */ 340 */
341static DEFINE_PER_CPU(void *, processor_device_array); 341static DEFINE_PER_CPU(void *, processor_device_array);
342 342
343static int __cpuinit acpi_processor_add(struct acpi_device *device, 343static int acpi_processor_add(struct acpi_device *device,
344 const struct acpi_device_id *id) 344 const struct acpi_device_id *id)
345{ 345{
346 struct acpi_processor *pr; 346 struct acpi_processor *pr;
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 164d49569aeb..a5e9f4a5b281 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -253,7 +253,7 @@ static bool __init processor_physically_present(acpi_handle handle)
253 return true; 253 return true;
254} 254}
255 255
256static void __cpuinit acpi_set_pdc_bits(u32 *buf) 256static void acpi_set_pdc_bits(u32 *buf)
257{ 257{
258 buf[0] = ACPI_PDC_REVISION_ID; 258 buf[0] = ACPI_PDC_REVISION_ID;
259 buf[1] = 1; 259 buf[1] = 1;
@@ -265,7 +265,7 @@ static void __cpuinit acpi_set_pdc_bits(u32 *buf)
265 arch_acpi_set_pdc_bits(buf); 265 arch_acpi_set_pdc_bits(buf);
266} 266}
267 267
268static struct acpi_object_list *__cpuinit acpi_processor_alloc_pdc(void) 268static struct acpi_object_list *acpi_processor_alloc_pdc(void)
269{ 269{
270 struct acpi_object_list *obj_list; 270 struct acpi_object_list *obj_list;
271 union acpi_object *obj; 271 union acpi_object *obj;
@@ -308,7 +308,7 @@ static struct acpi_object_list *__cpuinit acpi_processor_alloc_pdc(void)
308 * _PDC is required for a BIOS-OS handshake for most of the newer 308 * _PDC is required for a BIOS-OS handshake for most of the newer
309 * ACPI processor features. 309 * ACPI processor features.
310 */ 310 */
311static int __cpuinit 311static int
312acpi_processor_eval_pdc(acpi_handle handle, struct acpi_object_list *pdc_in) 312acpi_processor_eval_pdc(acpi_handle handle, struct acpi_object_list *pdc_in)
313{ 313{
314 acpi_status status = AE_OK; 314 acpi_status status = AE_OK;
@@ -336,7 +336,7 @@ acpi_processor_eval_pdc(acpi_handle handle, struct acpi_object_list *pdc_in)
336 return status; 336 return status;
337} 337}
338 338
339void __cpuinit acpi_processor_set_pdc(acpi_handle handle) 339void acpi_processor_set_pdc(acpi_handle handle)
340{ 340{
341 struct acpi_object_list *obj_list; 341 struct acpi_object_list *obj_list;
342 342
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index 823be116619e..870eaf5fa547 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -118,9 +118,9 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
118 return; 118 return;
119} 119}
120 120
121static __cpuinit int __acpi_processor_start(struct acpi_device *device); 121static int __acpi_processor_start(struct acpi_device *device);
122 122
123static int __cpuinit acpi_cpu_soft_notify(struct notifier_block *nfb, 123static int acpi_cpu_soft_notify(struct notifier_block *nfb,
124 unsigned long action, void *hcpu) 124 unsigned long action, void *hcpu)
125{ 125{
126 unsigned int cpu = (unsigned long)hcpu; 126 unsigned int cpu = (unsigned long)hcpu;
@@ -162,7 +162,7 @@ static struct notifier_block __refdata acpi_cpu_notifier =
162 .notifier_call = acpi_cpu_soft_notify, 162 .notifier_call = acpi_cpu_soft_notify,
163}; 163};
164 164
165static __cpuinit int __acpi_processor_start(struct acpi_device *device) 165static int __acpi_processor_start(struct acpi_device *device)
166{ 166{
167 struct acpi_processor *pr = acpi_driver_data(device); 167 struct acpi_processor *pr = acpi_driver_data(device);
168 acpi_status status; 168 acpi_status status;
@@ -226,7 +226,7 @@ static __cpuinit int __acpi_processor_start(struct acpi_device *device)
226 return result; 226 return result;
227} 227}
228 228
229static int __cpuinit acpi_processor_start(struct device *dev) 229static int acpi_processor_start(struct device *dev)
230{ 230{
231 struct acpi_device *device; 231 struct acpi_device *device;
232 232
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 0461ccc92c54..f98dd00b51a9 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -96,9 +96,7 @@ static int set_max_cstate(const struct dmi_system_id *id)
96 return 0; 96 return 0;
97} 97}
98 98
99/* Actually this shouldn't be __cpuinitdata, would be better to fix the 99static struct dmi_system_id processor_power_dmi_table[] = {
100 callers to only run once -AK */
101static struct dmi_system_id __cpuinitdata processor_power_dmi_table[] = {
102 { set_max_cstate, "Clevo 5600D", { 100 { set_max_cstate, "Clevo 5600D", {
103 DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), 101 DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"),
104 DMI_MATCH(DMI_BIOS_VERSION,"SHE845M0.86C.0013.D.0302131307")}, 102 DMI_MATCH(DMI_BIOS_VERSION,"SHE845M0.86C.0013.D.0302131307")},
@@ -1165,7 +1163,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
1165 1163
1166static int acpi_processor_registered; 1164static int acpi_processor_registered;
1167 1165
1168int __cpuinit acpi_processor_power_init(struct acpi_processor *pr) 1166int acpi_processor_power_init(struct acpi_processor *pr)
1169{ 1167{
1170 acpi_status status = 0; 1168 acpi_status status = 0;
1171 int retval; 1169 int retval;
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 10985573aaa7..8a46c924effd 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -352,10 +352,12 @@ static void acpi_scan_bus_device_check(acpi_handle handle, u32 ost_source)
352 mutex_lock(&acpi_scan_lock); 352 mutex_lock(&acpi_scan_lock);
353 lock_device_hotplug(); 353 lock_device_hotplug();
354 354
355 acpi_bus_get_device(handle, &device); 355 if (ost_source != ACPI_NOTIFY_BUS_CHECK) {
356 if (device) { 356 acpi_bus_get_device(handle, &device);
357 dev_warn(&device->dev, "Attempt to re-insert\n"); 357 if (device) {
358 goto out; 358 dev_warn(&device->dev, "Attempt to re-insert\n");
359 goto out;
360 }
359 } 361 }
360 acpi_evaluate_hotplug_ost(handle, ost_source, 362 acpi_evaluate_hotplug_ost(handle, ost_source,
361 ACPI_OST_SC_INSERT_IN_PROGRESS, NULL); 363 ACPI_OST_SC_INSERT_IN_PROGRESS, NULL);
@@ -1981,6 +1983,9 @@ static acpi_status acpi_bus_device_attach(acpi_handle handle, u32 lvl_not_used,
1981 if (acpi_bus_get_device(handle, &device)) 1983 if (acpi_bus_get_device(handle, &device))
1982 return AE_CTRL_DEPTH; 1984 return AE_CTRL_DEPTH;
1983 1985
1986 if (device->handler)
1987 return AE_OK;
1988
1984 ret = acpi_scan_attach_handler(device); 1989 ret = acpi_scan_attach_handler(device);
1985 if (ret) 1990 if (ret)
1986 return ret > 0 ? AE_OK : AE_CTRL_DEPTH; 1991 return ret > 0 ? AE_OK : AE_CTRL_DEPTH;
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 5d7075d25700..e441876f5d5b 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -450,6 +450,14 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
450 }, 450 },
451 { 451 {
452 .callback = video_ignore_initial_backlight, 452 .callback = video_ignore_initial_backlight,
453 .ident = "Fujitsu E753",
454 .matches = {
455 DMI_MATCH(DMI_BOARD_VENDOR, "FUJITSU"),
456 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E753"),
457 },
458 },
459 {
460 .callback = video_ignore_initial_backlight,
453 .ident = "HP Pavilion dm4", 461 .ident = "HP Pavilion dm4",
454 .matches = { 462 .matches = {
455 DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), 463 DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
diff --git a/drivers/base/core.c b/drivers/base/core.c
index dc3ea237f086..8856d74545d9 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -528,9 +528,12 @@ static int device_add_attrs(struct device *dev)
528 int error; 528 int error;
529 529
530 if (class) { 530 if (class) {
531 error = device_add_attributes(dev, class->dev_attrs); 531 error = device_add_groups(dev, class->dev_groups);
532 if (error) 532 if (error)
533 return error; 533 return error;
534 error = device_add_attributes(dev, class->dev_attrs);
535 if (error)
536 goto err_remove_class_groups;
534 error = device_add_bin_attributes(dev, class->dev_bin_attrs); 537 error = device_add_bin_attributes(dev, class->dev_bin_attrs);
535 if (error) 538 if (error)
536 goto err_remove_class_attrs; 539 goto err_remove_class_attrs;
@@ -563,6 +566,9 @@ static int device_add_attrs(struct device *dev)
563 err_remove_class_attrs: 566 err_remove_class_attrs:
564 if (class) 567 if (class)
565 device_remove_attributes(dev, class->dev_attrs); 568 device_remove_attributes(dev, class->dev_attrs);
569 err_remove_class_groups:
570 if (class)
571 device_remove_groups(dev, class->dev_groups);
566 572
567 return error; 573 return error;
568} 574}
@@ -581,6 +587,7 @@ static void device_remove_attrs(struct device *dev)
581 if (class) { 587 if (class) {
582 device_remove_attributes(dev, class->dev_attrs); 588 device_remove_attributes(dev, class->dev_attrs);
583 device_remove_bin_attributes(dev, class->dev_bin_attrs); 589 device_remove_bin_attributes(dev, class->dev_bin_attrs);
590 device_remove_groups(dev, class->dev_groups);
584 } 591 }
585} 592}
586 593
@@ -1667,34 +1674,11 @@ static void device_create_release(struct device *dev)
1667 kfree(dev); 1674 kfree(dev);
1668} 1675}
1669 1676
1670/** 1677static struct device *
1671 * device_create_vargs - creates a device and registers it with sysfs 1678device_create_groups_vargs(struct class *class, struct device *parent,
1672 * @class: pointer to the struct class that this device should be registered to 1679 dev_t devt, void *drvdata,
1673 * @parent: pointer to the parent struct device of this new device, if any 1680 const struct attribute_group **groups,
1674 * @devt: the dev_t for the char device to be added 1681 const char *fmt, va_list args)
1675 * @drvdata: the data to be added to the device for callbacks
1676 * @fmt: string for the device's name
1677 * @args: va_list for the device's name
1678 *
1679 * This function can be used by char device classes. A struct device
1680 * will be created in sysfs, registered to the specified class.
1681 *
1682 * A "dev" file will be created, showing the dev_t for the device, if
1683 * the dev_t is not 0,0.
1684 * If a pointer to a parent struct device is passed in, the newly created
1685 * struct device will be a child of that device in sysfs.
1686 * The pointer to the struct device will be returned from the call.
1687 * Any further sysfs files that might be required can be created using this
1688 * pointer.
1689 *
1690 * Returns &struct device pointer on success, or ERR_PTR() on error.
1691 *
1692 * Note: the struct class passed to this function must have previously
1693 * been created with a call to class_create().
1694 */
1695struct device *device_create_vargs(struct class *class, struct device *parent,
1696 dev_t devt, void *drvdata, const char *fmt,
1697 va_list args)
1698{ 1682{
1699 struct device *dev = NULL; 1683 struct device *dev = NULL;
1700 int retval = -ENODEV; 1684 int retval = -ENODEV;
@@ -1711,6 +1695,7 @@ struct device *device_create_vargs(struct class *class, struct device *parent,
1711 dev->devt = devt; 1695 dev->devt = devt;
1712 dev->class = class; 1696 dev->class = class;
1713 dev->parent = parent; 1697 dev->parent = parent;
1698 dev->groups = groups;
1714 dev->release = device_create_release; 1699 dev->release = device_create_release;
1715 dev_set_drvdata(dev, drvdata); 1700 dev_set_drvdata(dev, drvdata);
1716 1701
@@ -1728,6 +1713,39 @@ error:
1728 put_device(dev); 1713 put_device(dev);
1729 return ERR_PTR(retval); 1714 return ERR_PTR(retval);
1730} 1715}
1716
1717/**
1718 * device_create_vargs - creates a device and registers it with sysfs
1719 * @class: pointer to the struct class that this device should be registered to
1720 * @parent: pointer to the parent struct device of this new device, if any
1721 * @devt: the dev_t for the char device to be added
1722 * @drvdata: the data to be added to the device for callbacks
1723 * @fmt: string for the device's name
1724 * @args: va_list for the device's name
1725 *
1726 * This function can be used by char device classes. A struct device
1727 * will be created in sysfs, registered to the specified class.
1728 *
1729 * A "dev" file will be created, showing the dev_t for the device, if
1730 * the dev_t is not 0,0.
1731 * If a pointer to a parent struct device is passed in, the newly created
1732 * struct device will be a child of that device in sysfs.
1733 * The pointer to the struct device will be returned from the call.
1734 * Any further sysfs files that might be required can be created using this
1735 * pointer.
1736 *
1737 * Returns &struct device pointer on success, or ERR_PTR() on error.
1738 *
1739 * Note: the struct class passed to this function must have previously
1740 * been created with a call to class_create().
1741 */
1742struct device *device_create_vargs(struct class *class, struct device *parent,
1743 dev_t devt, void *drvdata, const char *fmt,
1744 va_list args)
1745{
1746 return device_create_groups_vargs(class, parent, devt, drvdata, NULL,
1747 fmt, args);
1748}
1731EXPORT_SYMBOL_GPL(device_create_vargs); 1749EXPORT_SYMBOL_GPL(device_create_vargs);
1732 1750
1733/** 1751/**
@@ -1767,6 +1785,50 @@ struct device *device_create(struct class *class, struct device *parent,
1767} 1785}
1768EXPORT_SYMBOL_GPL(device_create); 1786EXPORT_SYMBOL_GPL(device_create);
1769 1787
1788/**
1789 * device_create_with_groups - creates a device and registers it with sysfs
1790 * @class: pointer to the struct class that this device should be registered to
1791 * @parent: pointer to the parent struct device of this new device, if any
1792 * @devt: the dev_t for the char device to be added
1793 * @drvdata: the data to be added to the device for callbacks
1794 * @groups: NULL-terminated list of attribute groups to be created
1795 * @fmt: string for the device's name
1796 *
1797 * This function can be used by char device classes. A struct device
1798 * will be created in sysfs, registered to the specified class.
1799 * Additional attributes specified in the groups parameter will also
1800 * be created automatically.
1801 *
1802 * A "dev" file will be created, showing the dev_t for the device, if
1803 * the dev_t is not 0,0.
1804 * If a pointer to a parent struct device is passed in, the newly created
1805 * struct device will be a child of that device in sysfs.
1806 * The pointer to the struct device will be returned from the call.
1807 * Any further sysfs files that might be required can be created using this
1808 * pointer.
1809 *
1810 * Returns &struct device pointer on success, or ERR_PTR() on error.
1811 *
1812 * Note: the struct class passed to this function must have previously
1813 * been created with a call to class_create().
1814 */
1815struct device *device_create_with_groups(struct class *class,
1816 struct device *parent, dev_t devt,
1817 void *drvdata,
1818 const struct attribute_group **groups,
1819 const char *fmt, ...)
1820{
1821 va_list vargs;
1822 struct device *dev;
1823
1824 va_start(vargs, fmt);
1825 dev = device_create_groups_vargs(class, parent, devt, drvdata, groups,
1826 fmt, vargs);
1827 va_end(vargs);
1828 return dev;
1829}
1830EXPORT_SYMBOL_GPL(device_create_with_groups);
1831
1770static int __match_devt(struct device *dev, const void *data) 1832static int __match_devt(struct device *dev, const void *data)
1771{ 1833{
1772 const dev_t *devt = data; 1834 const dev_t *devt = data;
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index a16d20e389f0..4c358bc44c72 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -278,7 +278,7 @@ static void cpu_device_release(struct device *dev)
278 * 278 *
279 * Initialize and register the CPU device. 279 * Initialize and register the CPU device.
280 */ 280 */
281int __cpuinit register_cpu(struct cpu *cpu, int num) 281int register_cpu(struct cpu *cpu, int num)
282{ 282{
283 int error; 283 int error;
284 284
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 15789875128e..3c3197a8de41 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -522,6 +522,7 @@ static void platform_drv_shutdown(struct device *_dev)
522/** 522/**
523 * __platform_driver_register - register a driver for platform-level devices 523 * __platform_driver_register - register a driver for platform-level devices
524 * @drv: platform driver structure 524 * @drv: platform driver structure
525 * @owner: owning module/driver
525 */ 526 */
526int __platform_driver_register(struct platform_driver *drv, 527int __platform_driver_register(struct platform_driver *drv,
527 struct module *owner) 528 struct module *owner)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 95920583e31e..e0d0c7d8a5c5 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1853,7 +1853,7 @@ int regmap_async_complete(struct regmap *map)
1853 int ret; 1853 int ret;
1854 1854
1855 /* Nothing to do with no async support */ 1855 /* Nothing to do with no async support */
1856 if (!map->bus->async_write) 1856 if (!map->bus || !map->bus->async_write)
1857 return 0; 1857 return 0;
1858 1858
1859 trace_regmap_async_complete_start(map->dev); 1859 trace_regmap_async_complete_start(map->dev);
diff --git a/drivers/base/topology.c b/drivers/base/topology.c
index ae989c57cd5e..2f5919ed91ab 100644
--- a/drivers/base/topology.c
+++ b/drivers/base/topology.c
@@ -143,22 +143,22 @@ static struct attribute_group topology_attr_group = {
143}; 143};
144 144
145/* Add/Remove cpu_topology interface for CPU device */ 145/* Add/Remove cpu_topology interface for CPU device */
146static int __cpuinit topology_add_dev(unsigned int cpu) 146static int topology_add_dev(unsigned int cpu)
147{ 147{
148 struct device *dev = get_cpu_device(cpu); 148 struct device *dev = get_cpu_device(cpu);
149 149
150 return sysfs_create_group(&dev->kobj, &topology_attr_group); 150 return sysfs_create_group(&dev->kobj, &topology_attr_group);
151} 151}
152 152
153static void __cpuinit topology_remove_dev(unsigned int cpu) 153static void topology_remove_dev(unsigned int cpu)
154{ 154{
155 struct device *dev = get_cpu_device(cpu); 155 struct device *dev = get_cpu_device(cpu);
156 156
157 sysfs_remove_group(&dev->kobj, &topology_attr_group); 157 sysfs_remove_group(&dev->kobj, &topology_attr_group);
158} 158}
159 159
160static int __cpuinit topology_cpu_callback(struct notifier_block *nfb, 160static int topology_cpu_callback(struct notifier_block *nfb,
161 unsigned long action, void *hcpu) 161 unsigned long action, void *hcpu)
162{ 162{
163 unsigned int cpu = (unsigned long)hcpu; 163 unsigned int cpu = (unsigned long)hcpu;
164 int rc = 0; 164 int rc = 0;
@@ -178,7 +178,7 @@ static int __cpuinit topology_cpu_callback(struct notifier_block *nfb,
178 return notifier_from_errno(rc); 178 return notifier_from_errno(rc);
179} 179}
180 180
181static int __cpuinit topology_sysfs_init(void) 181static int topology_sysfs_init(void)
182{ 182{
183 int cpu; 183 int cpu;
184 int rc; 184 int rc;
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 053d846ab5b1..ffadd836e0b5 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -123,7 +123,7 @@ static int arch_timer_set_next_event_phys(unsigned long evt,
123 return 0; 123 return 0;
124} 124}
125 125
126static int __cpuinit arch_timer_setup(struct clock_event_device *clk) 126static int arch_timer_setup(struct clock_event_device *clk)
127{ 127{
128 clk->features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_C3STOP; 128 clk->features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_C3STOP;
129 clk->name = "arch_sys_timer"; 129 clk->name = "arch_sys_timer";
@@ -221,7 +221,7 @@ struct timecounter *arch_timer_get_timecounter(void)
221 return &timecounter; 221 return &timecounter;
222} 222}
223 223
224static void __cpuinit arch_timer_stop(struct clock_event_device *clk) 224static void arch_timer_stop(struct clock_event_device *clk)
225{ 225{
226 pr_debug("arch_timer_teardown disable IRQ%d cpu #%d\n", 226 pr_debug("arch_timer_teardown disable IRQ%d cpu #%d\n",
227 clk->irq, smp_processor_id()); 227 clk->irq, smp_processor_id());
@@ -237,7 +237,7 @@ static void __cpuinit arch_timer_stop(struct clock_event_device *clk)
237 clk->set_mode(CLOCK_EVT_MODE_UNUSED, clk); 237 clk->set_mode(CLOCK_EVT_MODE_UNUSED, clk);
238} 238}
239 239
240static int __cpuinit arch_timer_cpu_notify(struct notifier_block *self, 240static int arch_timer_cpu_notify(struct notifier_block *self,
241 unsigned long action, void *hcpu) 241 unsigned long action, void *hcpu)
242{ 242{
243 /* 243 /*
@@ -256,7 +256,7 @@ static int __cpuinit arch_timer_cpu_notify(struct notifier_block *self,
256 return NOTIFY_OK; 256 return NOTIFY_OK;
257} 257}
258 258
259static struct notifier_block arch_timer_cpu_nb __cpuinitdata = { 259static struct notifier_block arch_timer_cpu_nb = {
260 .notifier_call = arch_timer_cpu_notify, 260 .notifier_call = arch_timer_cpu_notify,
261}; 261};
262 262
diff --git a/drivers/clocksource/arm_global_timer.c b/drivers/clocksource/arm_global_timer.c
index db8afc7427a6..b66c1f36066c 100644
--- a/drivers/clocksource/arm_global_timer.c
+++ b/drivers/clocksource/arm_global_timer.c
@@ -164,7 +164,7 @@ static irqreturn_t gt_clockevent_interrupt(int irq, void *dev_id)
164 return IRQ_HANDLED; 164 return IRQ_HANDLED;
165} 165}
166 166
167static int __cpuinit gt_clockevents_init(struct clock_event_device *clk) 167static int gt_clockevents_init(struct clock_event_device *clk)
168{ 168{
169 int cpu = smp_processor_id(); 169 int cpu = smp_processor_id();
170 170
@@ -221,8 +221,8 @@ static void __init gt_clocksource_init(void)
221 clocksource_register_hz(&gt_clocksource, gt_clk_rate); 221 clocksource_register_hz(&gt_clocksource, gt_clk_rate);
222} 222}
223 223
224static int __cpuinit gt_cpu_notify(struct notifier_block *self, 224static int gt_cpu_notify(struct notifier_block *self, unsigned long action,
225 unsigned long action, void *hcpu) 225 void *hcpu)
226{ 226{
227 switch (action & ~CPU_TASKS_FROZEN) { 227 switch (action & ~CPU_TASKS_FROZEN) {
228 case CPU_STARTING: 228 case CPU_STARTING:
@@ -235,7 +235,7 @@ static int __cpuinit gt_cpu_notify(struct notifier_block *self,
235 235
236 return NOTIFY_OK; 236 return NOTIFY_OK;
237} 237}
238static struct notifier_block gt_cpu_nb __cpuinitdata = { 238static struct notifier_block gt_cpu_nb = {
239 .notifier_call = gt_cpu_notify, 239 .notifier_call = gt_cpu_notify,
240}; 240};
241 241
diff --git a/drivers/clocksource/dummy_timer.c b/drivers/clocksource/dummy_timer.c
index 1f55f9620338..b3eb582d6a6f 100644
--- a/drivers/clocksource/dummy_timer.c
+++ b/drivers/clocksource/dummy_timer.c
@@ -25,7 +25,7 @@ static void dummy_timer_set_mode(enum clock_event_mode mode,
25 */ 25 */
26} 26}
27 27
28static void __cpuinit dummy_timer_setup(void) 28static void dummy_timer_setup(void)
29{ 29{
30 int cpu = smp_processor_id(); 30 int cpu = smp_processor_id();
31 struct clock_event_device *evt = __this_cpu_ptr(&dummy_timer_evt); 31 struct clock_event_device *evt = __this_cpu_ptr(&dummy_timer_evt);
@@ -41,7 +41,7 @@ static void __cpuinit dummy_timer_setup(void)
41 clockevents_register_device(evt); 41 clockevents_register_device(evt);
42} 42}
43 43
44static int __cpuinit dummy_timer_cpu_notify(struct notifier_block *self, 44static int dummy_timer_cpu_notify(struct notifier_block *self,
45 unsigned long action, void *hcpu) 45 unsigned long action, void *hcpu)
46{ 46{
47 if ((action & ~CPU_TASKS_FROZEN) == CPU_STARTING) 47 if ((action & ~CPU_TASKS_FROZEN) == CPU_STARTING)
@@ -50,7 +50,7 @@ static int __cpuinit dummy_timer_cpu_notify(struct notifier_block *self,
50 return NOTIFY_OK; 50 return NOTIFY_OK;
51} 51}
52 52
53static struct notifier_block dummy_timer_cpu_nb __cpuinitdata = { 53static struct notifier_block dummy_timer_cpu_nb = {
54 .notifier_call = dummy_timer_cpu_notify, 54 .notifier_call = dummy_timer_cpu_notify,
55}; 55};
56 56
diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c
index a70480409ea5..b2bbc415f120 100644
--- a/drivers/clocksource/exynos_mct.c
+++ b/drivers/clocksource/exynos_mct.c
@@ -400,7 +400,7 @@ static irqreturn_t exynos4_mct_tick_isr(int irq, void *dev_id)
400 return IRQ_HANDLED; 400 return IRQ_HANDLED;
401} 401}
402 402
403static int __cpuinit exynos4_local_timer_setup(struct clock_event_device *evt) 403static int exynos4_local_timer_setup(struct clock_event_device *evt)
404{ 404{
405 struct mct_clock_event_device *mevt; 405 struct mct_clock_event_device *mevt;
406 unsigned int cpu = smp_processor_id(); 406 unsigned int cpu = smp_processor_id();
@@ -448,7 +448,7 @@ static void exynos4_local_timer_stop(struct clock_event_device *evt)
448 disable_percpu_irq(mct_irqs[MCT_L0_IRQ]); 448 disable_percpu_irq(mct_irqs[MCT_L0_IRQ]);
449} 449}
450 450
451static struct local_timer_ops exynos4_mct_tick_ops __cpuinitdata = { 451static struct local_timer_ops exynos4_mct_tick_ops = {
452 .setup = exynos4_local_timer_setup, 452 .setup = exynos4_local_timer_setup,
453 .stop = exynos4_local_timer_stop, 453 .stop = exynos4_local_timer_stop,
454}; 454};
diff --git a/drivers/clocksource/metag_generic.c b/drivers/clocksource/metag_generic.c
index 6722f0e2fe40..9e4db41abe3c 100644
--- a/drivers/clocksource/metag_generic.c
+++ b/drivers/clocksource/metag_generic.c
@@ -109,7 +109,7 @@ unsigned long long sched_clock(void)
109 return ticks << HARDWARE_TO_NS_SHIFT; 109 return ticks << HARDWARE_TO_NS_SHIFT;
110} 110}
111 111
112static void __cpuinit arch_timer_setup(unsigned int cpu) 112static void arch_timer_setup(unsigned int cpu)
113{ 113{
114 unsigned int txdivtime; 114 unsigned int txdivtime;
115 struct clock_event_device *clk = &per_cpu(local_clockevent, cpu); 115 struct clock_event_device *clk = &per_cpu(local_clockevent, cpu);
@@ -154,7 +154,7 @@ static void __cpuinit arch_timer_setup(unsigned int cpu)
154 } 154 }
155} 155}
156 156
157static int __cpuinit arch_timer_cpu_notify(struct notifier_block *self, 157static int arch_timer_cpu_notify(struct notifier_block *self,
158 unsigned long action, void *hcpu) 158 unsigned long action, void *hcpu)
159{ 159{
160 int cpu = (long)hcpu; 160 int cpu = (long)hcpu;
@@ -169,7 +169,7 @@ static int __cpuinit arch_timer_cpu_notify(struct notifier_block *self,
169 return NOTIFY_OK; 169 return NOTIFY_OK;
170} 170}
171 171
172static struct notifier_block __cpuinitdata arch_timer_cpu_nb = { 172static struct notifier_block arch_timer_cpu_nb = {
173 .notifier_call = arch_timer_cpu_notify, 173 .notifier_call = arch_timer_cpu_notify,
174}; 174};
175 175
diff --git a/drivers/clocksource/time-armada-370-xp.c b/drivers/clocksource/time-armada-370-xp.c
index efdca3263afe..1b04b7e1d39b 100644
--- a/drivers/clocksource/time-armada-370-xp.c
+++ b/drivers/clocksource/time-armada-370-xp.c
@@ -167,7 +167,7 @@ static irqreturn_t armada_370_xp_timer_interrupt(int irq, void *dev_id)
167/* 167/*
168 * Setup the local clock events for a CPU. 168 * Setup the local clock events for a CPU.
169 */ 169 */
170static int __cpuinit armada_370_xp_timer_setup(struct clock_event_device *evt) 170static int armada_370_xp_timer_setup(struct clock_event_device *evt)
171{ 171{
172 u32 u; 172 u32 u;
173 int cpu = smp_processor_id(); 173 int cpu = smp_processor_id();
@@ -205,7 +205,7 @@ static void armada_370_xp_timer_stop(struct clock_event_device *evt)
205 disable_percpu_irq(evt->irq); 205 disable_percpu_irq(evt->irq);
206} 206}
207 207
208static struct local_timer_ops armada_370_xp_local_timer_ops __cpuinitdata = { 208static struct local_timer_ops armada_370_xp_local_timer_ops = {
209 .setup = armada_370_xp_timer_setup, 209 .setup = armada_370_xp_timer_setup,
210 .stop = armada_370_xp_timer_stop, 210 .stop = armada_370_xp_timer_stop,
211}; 211};
diff --git a/drivers/clocksource/timer-marco.c b/drivers/clocksource/timer-marco.c
index e5dc9129ca26..62876baa3ab9 100644
--- a/drivers/clocksource/timer-marco.c
+++ b/drivers/clocksource/timer-marco.c
@@ -184,7 +184,7 @@ static struct irqaction sirfsoc_timer1_irq = {
184 .handler = sirfsoc_timer_interrupt, 184 .handler = sirfsoc_timer_interrupt,
185}; 185};
186 186
187static int __cpuinit sirfsoc_local_timer_setup(struct clock_event_device *ce) 187static int sirfsoc_local_timer_setup(struct clock_event_device *ce)
188{ 188{
189 /* Use existing clock_event for cpu 0 */ 189 /* Use existing clock_event for cpu 0 */
190 if (!smp_processor_id()) 190 if (!smp_processor_id())
@@ -216,7 +216,7 @@ static void sirfsoc_local_timer_stop(struct clock_event_device *ce)
216 remove_irq(sirfsoc_timer1_irq.irq, &sirfsoc_timer1_irq); 216 remove_irq(sirfsoc_timer1_irq.irq, &sirfsoc_timer1_irq);
217} 217}
218 218
219static struct local_timer_ops sirfsoc_local_timer_ops __cpuinitdata = { 219static struct local_timer_ops sirfsoc_local_timer_ops = {
220 .setup = sirfsoc_local_timer_setup, 220 .setup = sirfsoc_local_timer_setup,
221 .stop = sirfsoc_local_timer_stop, 221 .stop = sirfsoc_local_timer_stop,
222}; 222};
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 0937b8d6c2a4..a4ad7339588d 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1932,7 +1932,7 @@ no_policy:
1932} 1932}
1933EXPORT_SYMBOL(cpufreq_update_policy); 1933EXPORT_SYMBOL(cpufreq_update_policy);
1934 1934
1935static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb, 1935static int cpufreq_cpu_callback(struct notifier_block *nfb,
1936 unsigned long action, void *hcpu) 1936 unsigned long action, void *hcpu)
1937{ 1937{
1938 unsigned int cpu = (unsigned long)hcpu; 1938 unsigned int cpu = (unsigned long)hcpu;
@@ -1942,13 +1942,15 @@ static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb,
1942 if (dev) { 1942 if (dev) {
1943 switch (action) { 1943 switch (action) {
1944 case CPU_ONLINE: 1944 case CPU_ONLINE:
1945 case CPU_ONLINE_FROZEN:
1945 cpufreq_add_dev(dev, NULL); 1946 cpufreq_add_dev(dev, NULL);
1946 break; 1947 break;
1947 case CPU_DOWN_PREPARE: 1948 case CPU_DOWN_PREPARE:
1948 case CPU_UP_CANCELED_FROZEN: 1949 case CPU_DOWN_PREPARE_FROZEN:
1949 __cpufreq_remove_dev(dev, NULL); 1950 __cpufreq_remove_dev(dev, NULL);
1950 break; 1951 break;
1951 case CPU_DOWN_FAILED: 1952 case CPU_DOWN_FAILED:
1953 case CPU_DOWN_FAILED_FROZEN:
1952 cpufreq_add_dev(dev, NULL); 1954 cpufreq_add_dev(dev, NULL);
1953 break; 1955 break;
1954 } 1956 }
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c
index 464587697561..7b839a8db2a7 100644
--- a/drivers/cpufreq/cpufreq_governor.c
+++ b/drivers/cpufreq/cpufreq_governor.c
@@ -25,7 +25,6 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/workqueue.h> 27#include <linux/workqueue.h>
28#include <linux/cpu.h>
29 28
30#include "cpufreq_governor.h" 29#include "cpufreq_governor.h"
31 30
@@ -137,10 +136,8 @@ void gov_queue_work(struct dbs_data *dbs_data, struct cpufreq_policy *policy,
137 if (!all_cpus) { 136 if (!all_cpus) {
138 __gov_queue_work(smp_processor_id(), dbs_data, delay); 137 __gov_queue_work(smp_processor_id(), dbs_data, delay);
139 } else { 138 } else {
140 get_online_cpus();
141 for_each_cpu(i, policy->cpus) 139 for_each_cpu(i, policy->cpus)
142 __gov_queue_work(i, dbs_data, delay); 140 __gov_queue_work(i, dbs_data, delay);
143 put_online_cpus();
144 } 141 }
145} 142}
146EXPORT_SYMBOL_GPL(gov_queue_work); 143EXPORT_SYMBOL_GPL(gov_queue_work);
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index cd9e81713a71..d37568c5ca9c 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -341,7 +341,7 @@ static int cpufreq_stat_notifier_trans(struct notifier_block *nb,
341 return 0; 341 return 0;
342} 342}
343 343
344static int __cpuinit cpufreq_stat_cpu_callback(struct notifier_block *nfb, 344static int cpufreq_stat_cpu_callback(struct notifier_block *nfb,
345 unsigned long action, 345 unsigned long action,
346 void *hcpu) 346 void *hcpu)
347{ 347{
@@ -353,13 +353,11 @@ static int __cpuinit cpufreq_stat_cpu_callback(struct notifier_block *nfb,
353 cpufreq_update_policy(cpu); 353 cpufreq_update_policy(cpu);
354 break; 354 break;
355 case CPU_DOWN_PREPARE: 355 case CPU_DOWN_PREPARE:
356 case CPU_DOWN_PREPARE_FROZEN:
356 cpufreq_stats_free_sysfs(cpu); 357 cpufreq_stats_free_sysfs(cpu);
357 break; 358 break;
358 case CPU_DEAD: 359 case CPU_DEAD:
359 cpufreq_stats_free_table(cpu); 360 case CPU_DEAD_FROZEN:
360 break;
361 case CPU_UP_CANCELED_FROZEN:
362 cpufreq_stats_free_sysfs(cpu);
363 cpufreq_stats_free_table(cpu); 361 cpufreq_stats_free_table(cpu);
364 break; 362 break;
365 } 363 }
diff --git a/drivers/cpufreq/dbx500-cpufreq.c b/drivers/cpufreq/dbx500-cpufreq.c
index 1fdb02b9f1ec..26321cdc1946 100644
--- a/drivers/cpufreq/dbx500-cpufreq.c
+++ b/drivers/cpufreq/dbx500-cpufreq.c
@@ -82,7 +82,7 @@ static unsigned int dbx500_cpufreq_getspeed(unsigned int cpu)
82 return freq_table[i].frequency; 82 return freq_table[i].frequency;
83} 83}
84 84
85static int __cpuinit dbx500_cpufreq_init(struct cpufreq_policy *policy) 85static int dbx500_cpufreq_init(struct cpufreq_policy *policy)
86{ 86{
87 int res; 87 int res;
88 88
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 07f2840ad805..b012d7600e1a 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -617,7 +617,7 @@ static int intel_pstate_verify_policy(struct cpufreq_policy *policy)
617 return 0; 617 return 0;
618} 618}
619 619
620static int __cpuinit intel_pstate_cpu_exit(struct cpufreq_policy *policy) 620static int intel_pstate_cpu_exit(struct cpufreq_policy *policy)
621{ 621{
622 int cpu = policy->cpu; 622 int cpu = policy->cpu;
623 623
@@ -627,7 +627,7 @@ static int __cpuinit intel_pstate_cpu_exit(struct cpufreq_policy *policy)
627 return 0; 627 return 0;
628} 628}
629 629
630static int __cpuinit intel_pstate_cpu_init(struct cpufreq_policy *policy) 630static int intel_pstate_cpu_init(struct cpufreq_policy *policy)
631{ 631{
632 int rc, min_pstate, max_pstate; 632 int rc, min_pstate, max_pstate;
633 struct cpudata *cpu; 633 struct cpudata *cpu;
diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c
index b6a0a7a406b0..8c49261df57d 100644
--- a/drivers/cpufreq/longhaul.c
+++ b/drivers/cpufreq/longhaul.c
@@ -422,7 +422,7 @@ static int guess_fsb(int mult)
422} 422}
423 423
424 424
425static int __cpuinit longhaul_get_ranges(void) 425static int longhaul_get_ranges(void)
426{ 426{
427 unsigned int i, j, k = 0; 427 unsigned int i, j, k = 0;
428 unsigned int ratio; 428 unsigned int ratio;
@@ -526,7 +526,7 @@ static int __cpuinit longhaul_get_ranges(void)
526} 526}
527 527
528 528
529static void __cpuinit longhaul_setup_voltagescaling(void) 529static void longhaul_setup_voltagescaling(void)
530{ 530{
531 union msr_longhaul longhaul; 531 union msr_longhaul longhaul;
532 struct mV_pos minvid, maxvid, vid; 532 struct mV_pos minvid, maxvid, vid;
@@ -780,7 +780,7 @@ static int longhaul_setup_southbridge(void)
780 return 0; 780 return 0;
781} 781}
782 782
783static int __cpuinit longhaul_cpu_init(struct cpufreq_policy *policy) 783static int longhaul_cpu_init(struct cpufreq_policy *policy)
784{ 784{
785 struct cpuinfo_x86 *c = &cpu_data(0); 785 struct cpuinfo_x86 *c = &cpu_data(0);
786 char *cpuname = NULL; 786 char *cpuname = NULL;
diff --git a/drivers/cpufreq/longhaul.h b/drivers/cpufreq/longhaul.h
index e2dc436099d1..1928b923a57b 100644
--- a/drivers/cpufreq/longhaul.h
+++ b/drivers/cpufreq/longhaul.h
@@ -56,7 +56,7 @@ union msr_longhaul {
56/* 56/*
57 * VIA C3 Samuel 1 & Samuel 2 (stepping 0) 57 * VIA C3 Samuel 1 & Samuel 2 (stepping 0)
58 */ 58 */
59static const int __cpuinitconst samuel1_mults[16] = { 59static const int samuel1_mults[16] = {
60 -1, /* 0000 -> RESERVED */ 60 -1, /* 0000 -> RESERVED */
61 30, /* 0001 -> 3.0x */ 61 30, /* 0001 -> 3.0x */
62 40, /* 0010 -> 4.0x */ 62 40, /* 0010 -> 4.0x */
@@ -75,7 +75,7 @@ static const int __cpuinitconst samuel1_mults[16] = {
75 -1, /* 1111 -> RESERVED */ 75 -1, /* 1111 -> RESERVED */
76}; 76};
77 77
78static const int __cpuinitconst samuel1_eblcr[16] = { 78static const int samuel1_eblcr[16] = {
79 50, /* 0000 -> RESERVED */ 79 50, /* 0000 -> RESERVED */
80 30, /* 0001 -> 3.0x */ 80 30, /* 0001 -> 3.0x */
81 40, /* 0010 -> 4.0x */ 81 40, /* 0010 -> 4.0x */
@@ -97,7 +97,7 @@ static const int __cpuinitconst samuel1_eblcr[16] = {
97/* 97/*
98 * VIA C3 Samuel2 Stepping 1->15 98 * VIA C3 Samuel2 Stepping 1->15
99 */ 99 */
100static const int __cpuinitconst samuel2_eblcr[16] = { 100static const int samuel2_eblcr[16] = {
101 50, /* 0000 -> 5.0x */ 101 50, /* 0000 -> 5.0x */
102 30, /* 0001 -> 3.0x */ 102 30, /* 0001 -> 3.0x */
103 40, /* 0010 -> 4.0x */ 103 40, /* 0010 -> 4.0x */
@@ -119,7 +119,7 @@ static const int __cpuinitconst samuel2_eblcr[16] = {
119/* 119/*
120 * VIA C3 Ezra 120 * VIA C3 Ezra
121 */ 121 */
122static const int __cpuinitconst ezra_mults[16] = { 122static const int ezra_mults[16] = {
123 100, /* 0000 -> 10.0x */ 123 100, /* 0000 -> 10.0x */
124 30, /* 0001 -> 3.0x */ 124 30, /* 0001 -> 3.0x */
125 40, /* 0010 -> 4.0x */ 125 40, /* 0010 -> 4.0x */
@@ -138,7 +138,7 @@ static const int __cpuinitconst ezra_mults[16] = {
138 120, /* 1111 -> 12.0x */ 138 120, /* 1111 -> 12.0x */
139}; 139};
140 140
141static const int __cpuinitconst ezra_eblcr[16] = { 141static const int ezra_eblcr[16] = {
142 50, /* 0000 -> 5.0x */ 142 50, /* 0000 -> 5.0x */
143 30, /* 0001 -> 3.0x */ 143 30, /* 0001 -> 3.0x */
144 40, /* 0010 -> 4.0x */ 144 40, /* 0010 -> 4.0x */
@@ -160,7 +160,7 @@ static const int __cpuinitconst ezra_eblcr[16] = {
160/* 160/*
161 * VIA C3 (Ezra-T) [C5M]. 161 * VIA C3 (Ezra-T) [C5M].
162 */ 162 */
163static const int __cpuinitconst ezrat_mults[32] = { 163static const int ezrat_mults[32] = {
164 100, /* 0000 -> 10.0x */ 164 100, /* 0000 -> 10.0x */
165 30, /* 0001 -> 3.0x */ 165 30, /* 0001 -> 3.0x */
166 40, /* 0010 -> 4.0x */ 166 40, /* 0010 -> 4.0x */
@@ -196,7 +196,7 @@ static const int __cpuinitconst ezrat_mults[32] = {
196 -1, /* 1111 -> RESERVED (12.0x) */ 196 -1, /* 1111 -> RESERVED (12.0x) */
197}; 197};
198 198
199static const int __cpuinitconst ezrat_eblcr[32] = { 199static const int ezrat_eblcr[32] = {
200 50, /* 0000 -> 5.0x */ 200 50, /* 0000 -> 5.0x */
201 30, /* 0001 -> 3.0x */ 201 30, /* 0001 -> 3.0x */
202 40, /* 0010 -> 4.0x */ 202 40, /* 0010 -> 4.0x */
@@ -235,7 +235,7 @@ static const int __cpuinitconst ezrat_eblcr[32] = {
235/* 235/*
236 * VIA C3 Nehemiah */ 236 * VIA C3 Nehemiah */
237 237
238static const int __cpuinitconst nehemiah_mults[32] = { 238static const int nehemiah_mults[32] = {
239 100, /* 0000 -> 10.0x */ 239 100, /* 0000 -> 10.0x */
240 -1, /* 0001 -> 16.0x */ 240 -1, /* 0001 -> 16.0x */
241 40, /* 0010 -> 4.0x */ 241 40, /* 0010 -> 4.0x */
@@ -270,7 +270,7 @@ static const int __cpuinitconst nehemiah_mults[32] = {
270 -1, /* 1111 -> 12.0x */ 270 -1, /* 1111 -> 12.0x */
271}; 271};
272 272
273static const int __cpuinitconst nehemiah_eblcr[32] = { 273static const int nehemiah_eblcr[32] = {
274 50, /* 0000 -> 5.0x */ 274 50, /* 0000 -> 5.0x */
275 160, /* 0001 -> 16.0x */ 275 160, /* 0001 -> 16.0x */
276 40, /* 0010 -> 4.0x */ 276 40, /* 0010 -> 4.0x */
@@ -315,7 +315,7 @@ struct mV_pos {
315 unsigned short pos; 315 unsigned short pos;
316}; 316};
317 317
318static const struct mV_pos __cpuinitconst vrm85_mV[32] = { 318static const struct mV_pos vrm85_mV[32] = {
319 {1250, 8}, {1200, 6}, {1150, 4}, {1100, 2}, 319 {1250, 8}, {1200, 6}, {1150, 4}, {1100, 2},
320 {1050, 0}, {1800, 30}, {1750, 28}, {1700, 26}, 320 {1050, 0}, {1800, 30}, {1750, 28}, {1700, 26},
321 {1650, 24}, {1600, 22}, {1550, 20}, {1500, 18}, 321 {1650, 24}, {1600, 22}, {1550, 20}, {1500, 18},
@@ -326,14 +326,14 @@ static const struct mV_pos __cpuinitconst vrm85_mV[32] = {
326 {1475, 17}, {1425, 15}, {1375, 13}, {1325, 11} 326 {1475, 17}, {1425, 15}, {1375, 13}, {1325, 11}
327}; 327};
328 328
329static const unsigned char __cpuinitconst mV_vrm85[32] = { 329static const unsigned char mV_vrm85[32] = {
330 0x04, 0x14, 0x03, 0x13, 0x02, 0x12, 0x01, 0x11, 330 0x04, 0x14, 0x03, 0x13, 0x02, 0x12, 0x01, 0x11,
331 0x00, 0x10, 0x0f, 0x1f, 0x0e, 0x1e, 0x0d, 0x1d, 331 0x00, 0x10, 0x0f, 0x1f, 0x0e, 0x1e, 0x0d, 0x1d,
332 0x0c, 0x1c, 0x0b, 0x1b, 0x0a, 0x1a, 0x09, 0x19, 332 0x0c, 0x1c, 0x0b, 0x1b, 0x0a, 0x1a, 0x09, 0x19,
333 0x08, 0x18, 0x07, 0x17, 0x06, 0x16, 0x05, 0x15 333 0x08, 0x18, 0x07, 0x17, 0x06, 0x16, 0x05, 0x15
334}; 334};
335 335
336static const struct mV_pos __cpuinitconst mobilevrm_mV[32] = { 336static const struct mV_pos mobilevrm_mV[32] = {
337 {1750, 31}, {1700, 30}, {1650, 29}, {1600, 28}, 337 {1750, 31}, {1700, 30}, {1650, 29}, {1600, 28},
338 {1550, 27}, {1500, 26}, {1450, 25}, {1400, 24}, 338 {1550, 27}, {1500, 26}, {1450, 25}, {1400, 24},
339 {1350, 23}, {1300, 22}, {1250, 21}, {1200, 20}, 339 {1350, 23}, {1300, 22}, {1250, 21}, {1200, 20},
@@ -344,7 +344,7 @@ static const struct mV_pos __cpuinitconst mobilevrm_mV[32] = {
344 {675, 3}, {650, 2}, {625, 1}, {600, 0} 344 {675, 3}, {650, 2}, {625, 1}, {600, 0}
345}; 345};
346 346
347static const unsigned char __cpuinitconst mV_mobilevrm[32] = { 347static const unsigned char mV_mobilevrm[32] = {
348 0x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18, 348 0x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18,
349 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 349 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10,
350 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 350 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
diff --git a/drivers/cpufreq/longrun.c b/drivers/cpufreq/longrun.c
index 8bc9f5fbbaeb..0fe041d1f77f 100644
--- a/drivers/cpufreq/longrun.c
+++ b/drivers/cpufreq/longrun.c
@@ -33,7 +33,7 @@ static unsigned int longrun_low_freq, longrun_high_freq;
33 * Reads the current LongRun policy by access to MSR_TMTA_LONGRUN_FLAGS 33 * Reads the current LongRun policy by access to MSR_TMTA_LONGRUN_FLAGS
34 * and MSR_TMTA_LONGRUN_CTRL 34 * and MSR_TMTA_LONGRUN_CTRL
35 */ 35 */
36static void __cpuinit longrun_get_policy(struct cpufreq_policy *policy) 36static void longrun_get_policy(struct cpufreq_policy *policy)
37{ 37{
38 u32 msr_lo, msr_hi; 38 u32 msr_lo, msr_hi;
39 39
@@ -163,7 +163,7 @@ static unsigned int longrun_get(unsigned int cpu)
163 * TMTA rules: 163 * TMTA rules:
164 * performance_pctg = (target_freq - low_freq)/(high_freq - low_freq) 164 * performance_pctg = (target_freq - low_freq)/(high_freq - low_freq)
165 */ 165 */
166static int __cpuinit longrun_determine_freqs(unsigned int *low_freq, 166static int longrun_determine_freqs(unsigned int *low_freq,
167 unsigned int *high_freq) 167 unsigned int *high_freq)
168{ 168{
169 u32 msr_lo, msr_hi; 169 u32 msr_lo, msr_hi;
@@ -256,7 +256,7 @@ static int __cpuinit longrun_determine_freqs(unsigned int *low_freq,
256} 256}
257 257
258 258
259static int __cpuinit longrun_cpu_init(struct cpufreq_policy *policy) 259static int longrun_cpu_init(struct cpufreq_policy *policy)
260{ 260{
261 int result = 0; 261 int result = 0;
262 262
diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c
index 29468a522ee9..f31fcfcad514 100644
--- a/drivers/cpufreq/omap-cpufreq.c
+++ b/drivers/cpufreq/omap-cpufreq.c
@@ -165,7 +165,7 @@ static inline void freq_table_free(void)
165 opp_free_cpufreq_table(mpu_dev, &freq_table); 165 opp_free_cpufreq_table(mpu_dev, &freq_table);
166} 166}
167 167
168static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy) 168static int omap_cpu_init(struct cpufreq_policy *policy)
169{ 169{
170 int result = 0; 170 int result = 0;
171 171
diff --git a/drivers/cpufreq/powernow-k7.c b/drivers/cpufreq/powernow-k7.c
index b9f80b713fda..955870877935 100644
--- a/drivers/cpufreq/powernow-k7.c
+++ b/drivers/cpufreq/powernow-k7.c
@@ -563,7 +563,7 @@ static int powernow_verify(struct cpufreq_policy *policy)
563 * We will then get the same kind of behaviour already tested under 563 * We will then get the same kind of behaviour already tested under
564 * the "well-known" other OS. 564 * the "well-known" other OS.
565 */ 565 */
566static int __cpuinit fixup_sgtc(void) 566static int fixup_sgtc(void)
567{ 567{
568 unsigned int sgtc; 568 unsigned int sgtc;
569 unsigned int m; 569 unsigned int m;
@@ -597,7 +597,7 @@ static unsigned int powernow_get(unsigned int cpu)
597} 597}
598 598
599 599
600static int __cpuinit acer_cpufreq_pst(const struct dmi_system_id *d) 600static int acer_cpufreq_pst(const struct dmi_system_id *d)
601{ 601{
602 printk(KERN_WARNING PFX 602 printk(KERN_WARNING PFX
603 "%s laptop with broken PST tables in BIOS detected.\n", 603 "%s laptop with broken PST tables in BIOS detected.\n",
@@ -615,7 +615,7 @@ static int __cpuinit acer_cpufreq_pst(const struct dmi_system_id *d)
615 * A BIOS update is all that can save them. 615 * A BIOS update is all that can save them.
616 * Mention this, and disable cpufreq. 616 * Mention this, and disable cpufreq.
617 */ 617 */
618static struct dmi_system_id __cpuinitdata powernow_dmi_table[] = { 618static struct dmi_system_id powernow_dmi_table[] = {
619 { 619 {
620 .callback = acer_cpufreq_pst, 620 .callback = acer_cpufreq_pst,
621 .ident = "Acer Aspire", 621 .ident = "Acer Aspire",
@@ -627,7 +627,7 @@ static struct dmi_system_id __cpuinitdata powernow_dmi_table[] = {
627 { } 627 { }
628}; 628};
629 629
630static int __cpuinit powernow_cpu_init(struct cpufreq_policy *policy) 630static int powernow_cpu_init(struct cpufreq_policy *policy)
631{ 631{
632 union msr_fidvidstatus fidvidstatus; 632 union msr_fidvidstatus fidvidstatus;
633 int result; 633 int result;
diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c
index 78f018f2a5de..c39d189217cb 100644
--- a/drivers/cpufreq/powernow-k8.c
+++ b/drivers/cpufreq/powernow-k8.c
@@ -1069,7 +1069,7 @@ struct init_on_cpu {
1069 int rc; 1069 int rc;
1070}; 1070};
1071 1071
1072static void __cpuinit powernowk8_cpu_init_on_cpu(void *_init_on_cpu) 1072static void powernowk8_cpu_init_on_cpu(void *_init_on_cpu)
1073{ 1073{
1074 struct init_on_cpu *init_on_cpu = _init_on_cpu; 1074 struct init_on_cpu *init_on_cpu = _init_on_cpu;
1075 1075
@@ -1096,7 +1096,7 @@ static const char missing_pss_msg[] =
1096 FW_BUG PFX "If that doesn't help, try upgrading your BIOS.\n"; 1096 FW_BUG PFX "If that doesn't help, try upgrading your BIOS.\n";
1097 1097
1098/* per CPU init entry point to the driver */ 1098/* per CPU init entry point to the driver */
1099static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) 1099static int powernowk8_cpu_init(struct cpufreq_policy *pol)
1100{ 1100{
1101 struct powernow_k8_data *data; 1101 struct powernow_k8_data *data;
1102 struct init_on_cpu init_on_cpu; 1102 struct init_on_cpu init_on_cpu;
@@ -1263,7 +1263,7 @@ static void __request_acpi_cpufreq(void)
1263} 1263}
1264 1264
1265/* driver entry point for init */ 1265/* driver entry point for init */
1266static int __cpuinit powernowk8_init(void) 1266static int powernowk8_init(void)
1267{ 1267{
1268 unsigned int i, supported_cpus = 0; 1268 unsigned int i, supported_cpus = 0;
1269 int ret; 1269 int ret;
diff --git a/drivers/cpufreq/s3c24xx-cpufreq.c b/drivers/cpufreq/s3c24xx-cpufreq.c
index 3513e7477160..87781eb20d6d 100644
--- a/drivers/cpufreq/s3c24xx-cpufreq.c
+++ b/drivers/cpufreq/s3c24xx-cpufreq.c
@@ -49,7 +49,7 @@ static struct clk *clk_hclk;
49static struct clk *clk_pclk; 49static struct clk *clk_pclk;
50static struct clk *clk_arm; 50static struct clk *clk_arm;
51 51
52#ifdef CONFIG_CPU_FREQ_S3C24XX_DEBUGFS 52#ifdef CONFIG_ARM_S3C24XX_CPUFREQ_DEBUGFS
53struct s3c_cpufreq_config *s3c_cpufreq_getconfig(void) 53struct s3c_cpufreq_config *s3c_cpufreq_getconfig(void)
54{ 54{
55 return &cpu_cur; 55 return &cpu_cur;
@@ -59,7 +59,7 @@ struct s3c_iotimings *s3c_cpufreq_getiotimings(void)
59{ 59{
60 return &s3c24xx_iotiming; 60 return &s3c24xx_iotiming;
61} 61}
62#endif /* CONFIG_CPU_FREQ_S3C24XX_DEBUGFS */ 62#endif /* CONFIG_ARM_S3C24XX_CPUFREQ_DEBUGFS */
63 63
64static void s3c_cpufreq_getcur(struct s3c_cpufreq_config *cfg) 64static void s3c_cpufreq_getcur(struct s3c_cpufreq_config *cfg)
65{ 65{
diff --git a/drivers/firmware/efi/efivars.c b/drivers/firmware/efi/efivars.c
index 8bd1bb6dbe47..8a7432a4b413 100644
--- a/drivers/firmware/efi/efivars.c
+++ b/drivers/firmware/efi/efivars.c
@@ -583,6 +583,9 @@ int efivars_sysfs_init(void)
583 struct kobject *parent_kobj = efivars_kobject(); 583 struct kobject *parent_kobj = efivars_kobject();
584 int error = 0; 584 int error = 0;
585 585
586 if (!efi_enabled(EFI_RUNTIME_SERVICES))
587 return -ENODEV;
588
586 /* No efivars has been registered yet */ 589 /* No efivars has been registered yet */
587 if (!parent_kobj) 590 if (!parent_kobj)
588 return 0; 591 return 0;
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 062cbda1bf4a..f4af1ca0fb62 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -123,10 +123,10 @@ module_param_named(preliminary_hw_support, i915_preliminary_hw_support, int, 060
123MODULE_PARM_DESC(preliminary_hw_support, 123MODULE_PARM_DESC(preliminary_hw_support,
124 "Enable preliminary hardware support. (default: false)"); 124 "Enable preliminary hardware support. (default: false)");
125 125
126int i915_disable_power_well __read_mostly = 0; 126int i915_disable_power_well __read_mostly = 1;
127module_param_named(disable_power_well, i915_disable_power_well, int, 0600); 127module_param_named(disable_power_well, i915_disable_power_well, int, 0600);
128MODULE_PARM_DESC(disable_power_well, 128MODULE_PARM_DESC(disable_power_well,
129 "Disable the power well when possible (default: false)"); 129 "Disable the power well when possible (default: true)");
130 130
131int i915_enable_ips __read_mostly = 1; 131int i915_enable_ips __read_mostly = 1;
132module_param_named(enable_ips, i915_enable_ips, int, 0600); 132module_param_named(enable_ips, i915_enable_ips, int, 0600);
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 4200c32407ec..97afd2639fb6 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1880,6 +1880,10 @@ i915_gem_object_move_to_active(struct drm_i915_gem_object *obj,
1880 u32 seqno = intel_ring_get_seqno(ring); 1880 u32 seqno = intel_ring_get_seqno(ring);
1881 1881
1882 BUG_ON(ring == NULL); 1882 BUG_ON(ring == NULL);
1883 if (obj->ring != ring && obj->last_write_seqno) {
1884 /* Keep the seqno relative to the current ring */
1885 obj->last_write_seqno = seqno;
1886 }
1883 obj->ring = ring; 1887 obj->ring = ring;
1884 1888
1885 /* Add a reference if we're newly entering the active list. */ 1889 /* Add a reference if we're newly entering the active list. */
@@ -2653,7 +2657,6 @@ static void i965_write_fence_reg(struct drm_device *dev, int reg,
2653 drm_i915_private_t *dev_priv = dev->dev_private; 2657 drm_i915_private_t *dev_priv = dev->dev_private;
2654 int fence_reg; 2658 int fence_reg;
2655 int fence_pitch_shift; 2659 int fence_pitch_shift;
2656 uint64_t val;
2657 2660
2658 if (INTEL_INFO(dev)->gen >= 6) { 2661 if (INTEL_INFO(dev)->gen >= 6) {
2659 fence_reg = FENCE_REG_SANDYBRIDGE_0; 2662 fence_reg = FENCE_REG_SANDYBRIDGE_0;
@@ -2663,8 +2666,23 @@ static void i965_write_fence_reg(struct drm_device *dev, int reg,
2663 fence_pitch_shift = I965_FENCE_PITCH_SHIFT; 2666 fence_pitch_shift = I965_FENCE_PITCH_SHIFT;
2664 } 2667 }
2665 2668
2669 fence_reg += reg * 8;
2670
2671 /* To w/a incoherency with non-atomic 64-bit register updates,
2672 * we split the 64-bit update into two 32-bit writes. In order
2673 * for a partial fence not to be evaluated between writes, we
2674 * precede the update with write to turn off the fence register,
2675 * and only enable the fence as the last step.
2676 *
2677 * For extra levels of paranoia, we make sure each step lands
2678 * before applying the next step.
2679 */
2680 I915_WRITE(fence_reg, 0);
2681 POSTING_READ(fence_reg);
2682
2666 if (obj) { 2683 if (obj) {
2667 u32 size = obj->gtt_space->size; 2684 u32 size = obj->gtt_space->size;
2685 uint64_t val;
2668 2686
2669 val = (uint64_t)((obj->gtt_offset + size - 4096) & 2687 val = (uint64_t)((obj->gtt_offset + size - 4096) &
2670 0xfffff000) << 32; 2688 0xfffff000) << 32;
@@ -2673,12 +2691,16 @@ static void i965_write_fence_reg(struct drm_device *dev, int reg,
2673 if (obj->tiling_mode == I915_TILING_Y) 2691 if (obj->tiling_mode == I915_TILING_Y)
2674 val |= 1 << I965_FENCE_TILING_Y_SHIFT; 2692 val |= 1 << I965_FENCE_TILING_Y_SHIFT;
2675 val |= I965_FENCE_REG_VALID; 2693 val |= I965_FENCE_REG_VALID;
2676 } else
2677 val = 0;
2678 2694
2679 fence_reg += reg * 8; 2695 I915_WRITE(fence_reg + 4, val >> 32);
2680 I915_WRITE64(fence_reg, val); 2696 POSTING_READ(fence_reg + 4);
2681 POSTING_READ(fence_reg); 2697
2698 I915_WRITE(fence_reg + 0, val);
2699 POSTING_READ(fence_reg);
2700 } else {
2701 I915_WRITE(fence_reg + 4, 0);
2702 POSTING_READ(fence_reg + 4);
2703 }
2682} 2704}
2683 2705
2684static void i915_write_fence_reg(struct drm_device *dev, int reg, 2706static void i915_write_fence_reg(struct drm_device *dev, int reg,
@@ -2796,56 +2818,17 @@ static inline int fence_number(struct drm_i915_private *dev_priv,
2796 return fence - dev_priv->fence_regs; 2818 return fence - dev_priv->fence_regs;
2797} 2819}
2798 2820
2799struct write_fence {
2800 struct drm_device *dev;
2801 struct drm_i915_gem_object *obj;
2802 int fence;
2803};
2804
2805static void i915_gem_write_fence__ipi(void *data)
2806{
2807 struct write_fence *args = data;
2808
2809 /* Required for SNB+ with LLC */
2810 wbinvd();
2811
2812 /* Required for VLV */
2813 i915_gem_write_fence(args->dev, args->fence, args->obj);
2814}
2815
2816static void i915_gem_object_update_fence(struct drm_i915_gem_object *obj, 2821static void i915_gem_object_update_fence(struct drm_i915_gem_object *obj,
2817 struct drm_i915_fence_reg *fence, 2822 struct drm_i915_fence_reg *fence,
2818 bool enable) 2823 bool enable)
2819{ 2824{
2820 struct drm_i915_private *dev_priv = obj->base.dev->dev_private; 2825 struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
2821 struct write_fence args = { 2826 int reg = fence_number(dev_priv, fence);
2822 .dev = obj->base.dev, 2827
2823 .fence = fence_number(dev_priv, fence), 2828 i915_gem_write_fence(obj->base.dev, reg, enable ? obj : NULL);
2824 .obj = enable ? obj : NULL,
2825 };
2826
2827 /* In order to fully serialize access to the fenced region and
2828 * the update to the fence register we need to take extreme
2829 * measures on SNB+. In theory, the write to the fence register
2830 * flushes all memory transactions before, and coupled with the
2831 * mb() placed around the register write we serialise all memory
2832 * operations with respect to the changes in the tiler. Yet, on
2833 * SNB+ we need to take a step further and emit an explicit wbinvd()
2834 * on each processor in order to manually flush all memory
2835 * transactions before updating the fence register.
2836 *
2837 * However, Valleyview complicates matter. There the wbinvd is
2838 * insufficient and unlike SNB/IVB requires the serialising
2839 * register write. (Note that that register write by itself is
2840 * conversely not sufficient for SNB+.) To compromise, we do both.
2841 */
2842 if (INTEL_INFO(args.dev)->gen >= 6)
2843 on_each_cpu(i915_gem_write_fence__ipi, &args, 1);
2844 else
2845 i915_gem_write_fence(args.dev, args.fence, args.obj);
2846 2829
2847 if (enable) { 2830 if (enable) {
2848 obj->fence_reg = args.fence; 2831 obj->fence_reg = reg;
2849 fence->obj = obj; 2832 fence->obj = obj;
2850 list_move_tail(&fence->lru_list, &dev_priv->mm.fence_list); 2833 list_move_tail(&fence->lru_list, &dev_priv->mm.fence_list);
2851 } else { 2834 } else {
@@ -4611,7 +4594,7 @@ i915_gem_inactive_shrink(struct shrinker *shrinker, struct shrink_control *sc)
4611 list_for_each_entry(obj, &dev_priv->mm.unbound_list, global_list) 4594 list_for_each_entry(obj, &dev_priv->mm.unbound_list, global_list)
4612 if (obj->pages_pin_count == 0) 4595 if (obj->pages_pin_count == 0)
4613 cnt += obj->base.size >> PAGE_SHIFT; 4596 cnt += obj->base.size >> PAGE_SHIFT;
4614 list_for_each_entry(obj, &dev_priv->mm.inactive_list, global_list) 4597 list_for_each_entry(obj, &dev_priv->mm.inactive_list, mm_list)
4615 if (obj->pin_count == 0 && obj->pages_pin_count == 0) 4598 if (obj->pin_count == 0 && obj->pages_pin_count == 0)
4616 cnt += obj->base.size >> PAGE_SHIFT; 4599 cnt += obj->base.size >> PAGE_SHIFT;
4617 4600
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index b73971234013..26e162bb3a51 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -75,7 +75,12 @@ intel_dp_max_link_bw(struct intel_dp *intel_dp)
75 case DP_LINK_BW_1_62: 75 case DP_LINK_BW_1_62:
76 case DP_LINK_BW_2_7: 76 case DP_LINK_BW_2_7:
77 break; 77 break;
78 case DP_LINK_BW_5_4: /* 1.2 capable displays may advertise higher bw */
79 max_link_bw = DP_LINK_BW_2_7;
80 break;
78 default: 81 default:
82 WARN(1, "invalid max DP link bw val %x, using 1.62Gbps\n",
83 max_link_bw);
79 max_link_bw = DP_LINK_BW_1_62; 84 max_link_bw = DP_LINK_BW_1_62;
80 break; 85 break;
81 } 86 }
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index ccbdd83f5220..d10e6735771f 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -5500,9 +5500,38 @@ void intel_gt_init(struct drm_device *dev)
5500 if (IS_VALLEYVIEW(dev)) { 5500 if (IS_VALLEYVIEW(dev)) {
5501 dev_priv->gt.force_wake_get = vlv_force_wake_get; 5501 dev_priv->gt.force_wake_get = vlv_force_wake_get;
5502 dev_priv->gt.force_wake_put = vlv_force_wake_put; 5502 dev_priv->gt.force_wake_put = vlv_force_wake_put;
5503 } else if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) { 5503 } else if (IS_HASWELL(dev)) {
5504 dev_priv->gt.force_wake_get = __gen6_gt_force_wake_mt_get; 5504 dev_priv->gt.force_wake_get = __gen6_gt_force_wake_mt_get;
5505 dev_priv->gt.force_wake_put = __gen6_gt_force_wake_mt_put; 5505 dev_priv->gt.force_wake_put = __gen6_gt_force_wake_mt_put;
5506 } else if (IS_IVYBRIDGE(dev)) {
5507 u32 ecobus;
5508
5509 /* IVB configs may use multi-threaded forcewake */
5510
5511 /* A small trick here - if the bios hasn't configured
5512 * MT forcewake, and if the device is in RC6, then
5513 * force_wake_mt_get will not wake the device and the
5514 * ECOBUS read will return zero. Which will be
5515 * (correctly) interpreted by the test below as MT
5516 * forcewake being disabled.
5517 */
5518 mutex_lock(&dev->struct_mutex);
5519 __gen6_gt_force_wake_mt_get(dev_priv);
5520 ecobus = I915_READ_NOTRACE(ECOBUS);
5521 __gen6_gt_force_wake_mt_put(dev_priv);
5522 mutex_unlock(&dev->struct_mutex);
5523
5524 if (ecobus & FORCEWAKE_MT_ENABLE) {
5525 dev_priv->gt.force_wake_get =
5526 __gen6_gt_force_wake_mt_get;
5527 dev_priv->gt.force_wake_put =
5528 __gen6_gt_force_wake_mt_put;
5529 } else {
5530 DRM_INFO("No MT forcewake available on Ivybridge, this can result in issues\n");
5531 DRM_INFO("when using vblank-synced partial screen updates.\n");
5532 dev_priv->gt.force_wake_get = __gen6_gt_force_wake_get;
5533 dev_priv->gt.force_wake_put = __gen6_gt_force_wake_put;
5534 }
5506 } else if (IS_GEN6(dev)) { 5535 } else if (IS_GEN6(dev)) {
5507 dev_priv->gt.force_wake_get = __gen6_gt_force_wake_get; 5536 dev_priv->gt.force_wake_get = __gen6_gt_force_wake_get;
5508 dev_priv->gt.force_wake_put = __gen6_gt_force_wake_put; 5537 dev_priv->gt.force_wake_put = __gen6_gt_force_wake_put;
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index e51ab552046c..664118d8c1d6 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -379,6 +379,17 @@ u32 intel_ring_get_active_head(struct intel_ring_buffer *ring)
379 return I915_READ(acthd_reg); 379 return I915_READ(acthd_reg);
380} 380}
381 381
382static void ring_setup_phys_status_page(struct intel_ring_buffer *ring)
383{
384 struct drm_i915_private *dev_priv = ring->dev->dev_private;
385 u32 addr;
386
387 addr = dev_priv->status_page_dmah->busaddr;
388 if (INTEL_INFO(ring->dev)->gen >= 4)
389 addr |= (dev_priv->status_page_dmah->busaddr >> 28) & 0xf0;
390 I915_WRITE(HWS_PGA, addr);
391}
392
382static int init_ring_common(struct intel_ring_buffer *ring) 393static int init_ring_common(struct intel_ring_buffer *ring)
383{ 394{
384 struct drm_device *dev = ring->dev; 395 struct drm_device *dev = ring->dev;
@@ -390,6 +401,11 @@ static int init_ring_common(struct intel_ring_buffer *ring)
390 if (HAS_FORCE_WAKE(dev)) 401 if (HAS_FORCE_WAKE(dev))
391 gen6_gt_force_wake_get(dev_priv); 402 gen6_gt_force_wake_get(dev_priv);
392 403
404 if (I915_NEED_GFX_HWS(dev))
405 intel_ring_setup_status_page(ring);
406 else
407 ring_setup_phys_status_page(ring);
408
393 /* Stop the ring if it's running. */ 409 /* Stop the ring if it's running. */
394 I915_WRITE_CTL(ring, 0); 410 I915_WRITE_CTL(ring, 0);
395 I915_WRITE_HEAD(ring, 0); 411 I915_WRITE_HEAD(ring, 0);
@@ -518,9 +534,6 @@ cleanup_pipe_control(struct intel_ring_buffer *ring)
518 struct pipe_control *pc = ring->private; 534 struct pipe_control *pc = ring->private;
519 struct drm_i915_gem_object *obj; 535 struct drm_i915_gem_object *obj;
520 536
521 if (!ring->private)
522 return;
523
524 obj = pc->obj; 537 obj = pc->obj;
525 538
526 kunmap(sg_page(obj->pages->sgl)); 539 kunmap(sg_page(obj->pages->sgl));
@@ -528,7 +541,6 @@ cleanup_pipe_control(struct intel_ring_buffer *ring)
528 drm_gem_object_unreference(&obj->base); 541 drm_gem_object_unreference(&obj->base);
529 542
530 kfree(pc); 543 kfree(pc);
531 ring->private = NULL;
532} 544}
533 545
534static int init_render_ring(struct intel_ring_buffer *ring) 546static int init_render_ring(struct intel_ring_buffer *ring)
@@ -601,7 +613,10 @@ static void render_ring_cleanup(struct intel_ring_buffer *ring)
601 if (HAS_BROKEN_CS_TLB(dev)) 613 if (HAS_BROKEN_CS_TLB(dev))
602 drm_gem_object_unreference(to_gem_object(ring->private)); 614 drm_gem_object_unreference(to_gem_object(ring->private));
603 615
604 cleanup_pipe_control(ring); 616 if (INTEL_INFO(dev)->gen >= 5)
617 cleanup_pipe_control(ring);
618
619 ring->private = NULL;
605} 620}
606 621
607static void 622static void
@@ -1223,7 +1238,6 @@ static int init_status_page(struct intel_ring_buffer *ring)
1223 ring->status_page.obj = obj; 1238 ring->status_page.obj = obj;
1224 memset(ring->status_page.page_addr, 0, PAGE_SIZE); 1239 memset(ring->status_page.page_addr, 0, PAGE_SIZE);
1225 1240
1226 intel_ring_setup_status_page(ring);
1227 DRM_DEBUG_DRIVER("%s hws offset: 0x%08x\n", 1241 DRM_DEBUG_DRIVER("%s hws offset: 0x%08x\n",
1228 ring->name, ring->status_page.gfx_addr); 1242 ring->name, ring->status_page.gfx_addr);
1229 1243
@@ -1237,10 +1251,9 @@ err:
1237 return ret; 1251 return ret;
1238} 1252}
1239 1253
1240static int init_phys_hws_pga(struct intel_ring_buffer *ring) 1254static int init_phys_status_page(struct intel_ring_buffer *ring)
1241{ 1255{
1242 struct drm_i915_private *dev_priv = ring->dev->dev_private; 1256 struct drm_i915_private *dev_priv = ring->dev->dev_private;
1243 u32 addr;
1244 1257
1245 if (!dev_priv->status_page_dmah) { 1258 if (!dev_priv->status_page_dmah) {
1246 dev_priv->status_page_dmah = 1259 dev_priv->status_page_dmah =
@@ -1249,11 +1262,6 @@ static int init_phys_hws_pga(struct intel_ring_buffer *ring)
1249 return -ENOMEM; 1262 return -ENOMEM;
1250 } 1263 }
1251 1264
1252 addr = dev_priv->status_page_dmah->busaddr;
1253 if (INTEL_INFO(ring->dev)->gen >= 4)
1254 addr |= (dev_priv->status_page_dmah->busaddr >> 28) & 0xf0;
1255 I915_WRITE(HWS_PGA, addr);
1256
1257 ring->status_page.page_addr = dev_priv->status_page_dmah->vaddr; 1265 ring->status_page.page_addr = dev_priv->status_page_dmah->vaddr;
1258 memset(ring->status_page.page_addr, 0, PAGE_SIZE); 1266 memset(ring->status_page.page_addr, 0, PAGE_SIZE);
1259 1267
@@ -1281,7 +1289,7 @@ static int intel_init_ring_buffer(struct drm_device *dev,
1281 return ret; 1289 return ret;
1282 } else { 1290 } else {
1283 BUG_ON(ring->id != RCS); 1291 BUG_ON(ring->id != RCS);
1284 ret = init_phys_hws_pga(ring); 1292 ret = init_phys_status_page(ring);
1285 if (ret) 1293 if (ret)
1286 return ret; 1294 return ret;
1287 } 1295 }
@@ -1893,7 +1901,7 @@ int intel_render_ring_init_dri(struct drm_device *dev, u64 start, u32 size)
1893 } 1901 }
1894 1902
1895 if (!I915_NEED_GFX_HWS(dev)) { 1903 if (!I915_NEED_GFX_HWS(dev)) {
1896 ret = init_phys_hws_pga(ring); 1904 ret = init_phys_status_page(ring);
1897 if (ret) 1905 if (ret)
1898 return ret; 1906 return ret;
1899 } 1907 }
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index ed1d91025928..6dacec4e2090 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -22,7 +22,6 @@
22 * Authors: Alex Deucher 22 * Authors: Alex Deucher
23 */ 23 */
24#include <linux/firmware.h> 24#include <linux/firmware.h>
25#include <linux/platform_device.h>
26#include <linux/slab.h> 25#include <linux/slab.h>
27#include <linux/module.h> 26#include <linux/module.h>
28#include "drmP.h" 27#include "drmP.h"
@@ -742,7 +741,6 @@ static int ci_mc_load_microcode(struct radeon_device *rdev)
742 */ 741 */
743static int cik_init_microcode(struct radeon_device *rdev) 742static int cik_init_microcode(struct radeon_device *rdev)
744{ 743{
745 struct platform_device *pdev;
746 const char *chip_name; 744 const char *chip_name;
747 size_t pfp_req_size, me_req_size, ce_req_size, 745 size_t pfp_req_size, me_req_size, ce_req_size,
748 mec_req_size, rlc_req_size, mc_req_size, 746 mec_req_size, rlc_req_size, mc_req_size,
@@ -752,13 +750,6 @@ static int cik_init_microcode(struct radeon_device *rdev)
752 750
753 DRM_DEBUG("\n"); 751 DRM_DEBUG("\n");
754 752
755 pdev = platform_device_register_simple("radeon_cp", 0, NULL, 0);
756 err = IS_ERR(pdev);
757 if (err) {
758 printk(KERN_ERR "radeon_cp: Failed to register firmware\n");
759 return -EINVAL;
760 }
761
762 switch (rdev->family) { 753 switch (rdev->family) {
763 case CHIP_BONAIRE: 754 case CHIP_BONAIRE:
764 chip_name = "BONAIRE"; 755 chip_name = "BONAIRE";
@@ -794,7 +785,7 @@ static int cik_init_microcode(struct radeon_device *rdev)
794 DRM_INFO("Loading %s Microcode\n", chip_name); 785 DRM_INFO("Loading %s Microcode\n", chip_name);
795 786
796 snprintf(fw_name, sizeof(fw_name), "radeon/%s_pfp.bin", chip_name); 787 snprintf(fw_name, sizeof(fw_name), "radeon/%s_pfp.bin", chip_name);
797 err = request_firmware(&rdev->pfp_fw, fw_name, &pdev->dev); 788 err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev);
798 if (err) 789 if (err)
799 goto out; 790 goto out;
800 if (rdev->pfp_fw->size != pfp_req_size) { 791 if (rdev->pfp_fw->size != pfp_req_size) {
@@ -806,7 +797,7 @@ static int cik_init_microcode(struct radeon_device *rdev)
806 } 797 }
807 798
808 snprintf(fw_name, sizeof(fw_name), "radeon/%s_me.bin", chip_name); 799 snprintf(fw_name, sizeof(fw_name), "radeon/%s_me.bin", chip_name);
809 err = request_firmware(&rdev->me_fw, fw_name, &pdev->dev); 800 err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
810 if (err) 801 if (err)
811 goto out; 802 goto out;
812 if (rdev->me_fw->size != me_req_size) { 803 if (rdev->me_fw->size != me_req_size) {
@@ -817,7 +808,7 @@ static int cik_init_microcode(struct radeon_device *rdev)
817 } 808 }
818 809
819 snprintf(fw_name, sizeof(fw_name), "radeon/%s_ce.bin", chip_name); 810 snprintf(fw_name, sizeof(fw_name), "radeon/%s_ce.bin", chip_name);
820 err = request_firmware(&rdev->ce_fw, fw_name, &pdev->dev); 811 err = request_firmware(&rdev->ce_fw, fw_name, rdev->dev);
821 if (err) 812 if (err)
822 goto out; 813 goto out;
823 if (rdev->ce_fw->size != ce_req_size) { 814 if (rdev->ce_fw->size != ce_req_size) {
@@ -828,7 +819,7 @@ static int cik_init_microcode(struct radeon_device *rdev)
828 } 819 }
829 820
830 snprintf(fw_name, sizeof(fw_name), "radeon/%s_mec.bin", chip_name); 821 snprintf(fw_name, sizeof(fw_name), "radeon/%s_mec.bin", chip_name);
831 err = request_firmware(&rdev->mec_fw, fw_name, &pdev->dev); 822 err = request_firmware(&rdev->mec_fw, fw_name, rdev->dev);
832 if (err) 823 if (err)
833 goto out; 824 goto out;
834 if (rdev->mec_fw->size != mec_req_size) { 825 if (rdev->mec_fw->size != mec_req_size) {
@@ -839,7 +830,7 @@ static int cik_init_microcode(struct radeon_device *rdev)
839 } 830 }
840 831
841 snprintf(fw_name, sizeof(fw_name), "radeon/%s_rlc.bin", chip_name); 832 snprintf(fw_name, sizeof(fw_name), "radeon/%s_rlc.bin", chip_name);
842 err = request_firmware(&rdev->rlc_fw, fw_name, &pdev->dev); 833 err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev);
843 if (err) 834 if (err)
844 goto out; 835 goto out;
845 if (rdev->rlc_fw->size != rlc_req_size) { 836 if (rdev->rlc_fw->size != rlc_req_size) {
@@ -850,7 +841,7 @@ static int cik_init_microcode(struct radeon_device *rdev)
850 } 841 }
851 842
852 snprintf(fw_name, sizeof(fw_name), "radeon/%s_sdma.bin", chip_name); 843 snprintf(fw_name, sizeof(fw_name), "radeon/%s_sdma.bin", chip_name);
853 err = request_firmware(&rdev->sdma_fw, fw_name, &pdev->dev); 844 err = request_firmware(&rdev->sdma_fw, fw_name, rdev->dev);
854 if (err) 845 if (err)
855 goto out; 846 goto out;
856 if (rdev->sdma_fw->size != sdma_req_size) { 847 if (rdev->sdma_fw->size != sdma_req_size) {
@@ -863,7 +854,7 @@ static int cik_init_microcode(struct radeon_device *rdev)
863 /* No MC ucode on APUs */ 854 /* No MC ucode on APUs */
864 if (!(rdev->flags & RADEON_IS_IGP)) { 855 if (!(rdev->flags & RADEON_IS_IGP)) {
865 snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); 856 snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name);
866 err = request_firmware(&rdev->mc_fw, fw_name, &pdev->dev); 857 err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev);
867 if (err) 858 if (err)
868 goto out; 859 goto out;
869 if (rdev->mc_fw->size != mc_req_size) { 860 if (rdev->mc_fw->size != mc_req_size) {
@@ -875,8 +866,6 @@ static int cik_init_microcode(struct radeon_device *rdev)
875 } 866 }
876 867
877out: 868out:
878 platform_device_unregister(pdev);
879
880 if (err) { 869 if (err) {
881 if (err != -EINVAL) 870 if (err != -EINVAL)
882 printk(KERN_ERR 871 printk(KERN_ERR
@@ -4453,6 +4442,29 @@ void cik_vm_fini(struct radeon_device *rdev)
4453} 4442}
4454 4443
4455/** 4444/**
4445 * cik_vm_decode_fault - print human readable fault info
4446 *
4447 * @rdev: radeon_device pointer
4448 * @status: VM_CONTEXT1_PROTECTION_FAULT_STATUS register value
4449 * @addr: VM_CONTEXT1_PROTECTION_FAULT_ADDR register value
4450 *
4451 * Print human readable fault information (CIK).
4452 */
4453static void cik_vm_decode_fault(struct radeon_device *rdev,
4454 u32 status, u32 addr, u32 mc_client)
4455{
4456 u32 mc_id = (status & MEMORY_CLIENT_ID_MASK) >> MEMORY_CLIENT_ID_SHIFT;
4457 u32 vmid = (status & FAULT_VMID_MASK) >> FAULT_VMID_SHIFT;
4458 u32 protections = (status & PROTECTIONS_MASK) >> PROTECTIONS_SHIFT;
4459 char *block = (char *)&mc_client;
4460
4461 printk("VM fault (0x%02x, vmid %d) at page %u, %s from %s (%d)\n",
4462 protections, vmid, addr,
4463 (status & MEMORY_CLIENT_RW_MASK) ? "write" : "read",
4464 block, mc_id);
4465}
4466
4467/**
4456 * cik_vm_flush - cik vm flush using the CP 4468 * cik_vm_flush - cik vm flush using the CP
4457 * 4469 *
4458 * @rdev: radeon_device pointer 4470 * @rdev: radeon_device pointer
@@ -5507,6 +5519,7 @@ int cik_irq_process(struct radeon_device *rdev)
5507 u32 ring_index; 5519 u32 ring_index;
5508 bool queue_hotplug = false; 5520 bool queue_hotplug = false;
5509 bool queue_reset = false; 5521 bool queue_reset = false;
5522 u32 addr, status, mc_client;
5510 5523
5511 if (!rdev->ih.enabled || rdev->shutdown) 5524 if (!rdev->ih.enabled || rdev->shutdown)
5512 return IRQ_NONE; 5525 return IRQ_NONE;
@@ -5742,11 +5755,15 @@ restart_ih:
5742 break; 5755 break;
5743 case 146: 5756 case 146:
5744 case 147: 5757 case 147:
5758 addr = RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR);
5759 status = RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS);
5760 mc_client = RREG32(VM_CONTEXT1_PROTECTION_FAULT_MCCLIENT);
5745 dev_err(rdev->dev, "GPU fault detected: %d 0x%08x\n", src_id, src_data); 5761 dev_err(rdev->dev, "GPU fault detected: %d 0x%08x\n", src_id, src_data);
5746 dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", 5762 dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n",
5747 RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR)); 5763 addr);
5748 dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", 5764 dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n",
5749 RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS)); 5765 status);
5766 cik_vm_decode_fault(rdev, status, addr, mc_client);
5750 /* reset addr and status */ 5767 /* reset addr and status */
5751 WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1); 5768 WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1);
5752 break; 5769 break;
@@ -6961,7 +6978,7 @@ int cik_uvd_resume(struct radeon_device *rdev)
6961 6978
6962 /* programm the VCPU memory controller bits 0-27 */ 6979 /* programm the VCPU memory controller bits 0-27 */
6963 addr = rdev->uvd.gpu_addr >> 3; 6980 addr = rdev->uvd.gpu_addr >> 3;
6964 size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 4) >> 3; 6981 size = RADEON_GPU_PAGE_ALIGN(rdev->uvd.fw_size + 4) >> 3;
6965 WREG32(UVD_VCPU_CACHE_OFFSET0, addr); 6982 WREG32(UVD_VCPU_CACHE_OFFSET0, addr);
6966 WREG32(UVD_VCPU_CACHE_SIZE0, size); 6983 WREG32(UVD_VCPU_CACHE_SIZE0, size);
6967 6984
diff --git a/drivers/gpu/drm/radeon/cikd.h b/drivers/gpu/drm/radeon/cikd.h
index 63514b95889a..7e9275eaef80 100644
--- a/drivers/gpu/drm/radeon/cikd.h
+++ b/drivers/gpu/drm/radeon/cikd.h
@@ -136,6 +136,22 @@
136#define VM_INVALIDATE_RESPONSE 0x147c 136#define VM_INVALIDATE_RESPONSE 0x147c
137 137
138#define VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x14DC 138#define VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x14DC
139#define PROTECTIONS_MASK (0xf << 0)
140#define PROTECTIONS_SHIFT 0
141 /* bit 0: range
142 * bit 1: pde0
143 * bit 2: valid
144 * bit 3: read
145 * bit 4: write
146 */
147#define MEMORY_CLIENT_ID_MASK (0xff << 12)
148#define MEMORY_CLIENT_ID_SHIFT 12
149#define MEMORY_CLIENT_RW_MASK (1 << 24)
150#define MEMORY_CLIENT_RW_SHIFT 24
151#define FAULT_VMID_MASK (0xf << 25)
152#define FAULT_VMID_SHIFT 25
153
154#define VM_CONTEXT1_PROTECTION_FAULT_MCCLIENT 0x14E4
139 155
140#define VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x14FC 156#define VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x14FC
141 157
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index e49059dc9b8f..038dcac7670c 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -139,6 +139,8 @@ void evergreen_pcie_gen2_enable(struct radeon_device *rdev);
139void evergreen_program_aspm(struct radeon_device *rdev); 139void evergreen_program_aspm(struct radeon_device *rdev);
140extern void cayman_cp_int_cntl_setup(struct radeon_device *rdev, 140extern void cayman_cp_int_cntl_setup(struct radeon_device *rdev,
141 int ring, u32 cp_int_cntl); 141 int ring, u32 cp_int_cntl);
142extern void cayman_vm_decode_fault(struct radeon_device *rdev,
143 u32 status, u32 addr);
142 144
143static const u32 evergreen_golden_registers[] = 145static const u32 evergreen_golden_registers[] =
144{ 146{
@@ -4586,6 +4588,7 @@ int evergreen_irq_process(struct radeon_device *rdev)
4586 bool queue_hotplug = false; 4588 bool queue_hotplug = false;
4587 bool queue_hdmi = false; 4589 bool queue_hdmi = false;
4588 bool queue_thermal = false; 4590 bool queue_thermal = false;
4591 u32 status, addr;
4589 4592
4590 if (!rdev->ih.enabled || rdev->shutdown) 4593 if (!rdev->ih.enabled || rdev->shutdown)
4591 return IRQ_NONE; 4594 return IRQ_NONE;
@@ -4872,11 +4875,14 @@ restart_ih:
4872 break; 4875 break;
4873 case 146: 4876 case 146:
4874 case 147: 4877 case 147:
4878 addr = RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR);
4879 status = RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS);
4875 dev_err(rdev->dev, "GPU fault detected: %d 0x%08x\n", src_id, src_data); 4880 dev_err(rdev->dev, "GPU fault detected: %d 0x%08x\n", src_id, src_data);
4876 dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", 4881 dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n",
4877 RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR)); 4882 addr);
4878 dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", 4883 dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n",
4879 RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS)); 4884 status);
4885 cayman_vm_decode_fault(rdev, status, addr);
4880 /* reset addr and status */ 4886 /* reset addr and status */
4881 WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1); 4887 WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1);
4882 break; 4888 break;
@@ -5509,6 +5515,9 @@ void evergreen_program_aspm(struct radeon_device *rdev)
5509 */ 5515 */
5510 bool fusion_platform = false; 5516 bool fusion_platform = false;
5511 5517
5518 if (radeon_aspm == 0)
5519 return;
5520
5512 if (!(rdev->flags & RADEON_IS_PCIE)) 5521 if (!(rdev->flags & RADEON_IS_PCIE))
5513 return; 5522 return;
5514 5523
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c
index b9c6f7675e59..b0d3fb341417 100644
--- a/drivers/gpu/drm/radeon/evergreen_hdmi.c
+++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c
@@ -177,6 +177,9 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode
177 uint32_t offset; 177 uint32_t offset;
178 ssize_t err; 178 ssize_t err;
179 179
180 if (!dig || !dig->afmt)
181 return;
182
180 /* Silent, r600_hdmi_enable will raise WARN for us */ 183 /* Silent, r600_hdmi_enable will raise WARN for us */
181 if (!dig->afmt->enabled) 184 if (!dig->afmt->enabled)
182 return; 185 return;
@@ -280,6 +283,9 @@ void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable)
280 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 283 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
281 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; 284 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
282 285
286 if (!dig || !dig->afmt)
287 return;
288
283 /* Silent, r600_hdmi_enable will raise WARN for us */ 289 /* Silent, r600_hdmi_enable will raise WARN for us */
284 if (enable && dig->afmt->enabled) 290 if (enable && dig->afmt->enabled)
285 return; 291 return;
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
index f30127cb30ef..56bd4f3be4fe 100644
--- a/drivers/gpu/drm/radeon/ni.c
+++ b/drivers/gpu/drm/radeon/ni.c
@@ -22,7 +22,6 @@
22 * Authors: Alex Deucher 22 * Authors: Alex Deucher
23 */ 23 */
24#include <linux/firmware.h> 24#include <linux/firmware.h>
25#include <linux/platform_device.h>
26#include <linux/slab.h> 25#include <linux/slab.h>
27#include <linux/module.h> 26#include <linux/module.h>
28#include <drm/drmP.h> 27#include <drm/drmP.h>
@@ -684,7 +683,6 @@ int ni_mc_load_microcode(struct radeon_device *rdev)
684 683
685int ni_init_microcode(struct radeon_device *rdev) 684int ni_init_microcode(struct radeon_device *rdev)
686{ 685{
687 struct platform_device *pdev;
688 const char *chip_name; 686 const char *chip_name;
689 const char *rlc_chip_name; 687 const char *rlc_chip_name;
690 size_t pfp_req_size, me_req_size, rlc_req_size, mc_req_size; 688 size_t pfp_req_size, me_req_size, rlc_req_size, mc_req_size;
@@ -694,13 +692,6 @@ int ni_init_microcode(struct radeon_device *rdev)
694 692
695 DRM_DEBUG("\n"); 693 DRM_DEBUG("\n");
696 694
697 pdev = platform_device_register_simple("radeon_cp", 0, NULL, 0);
698 err = IS_ERR(pdev);
699 if (err) {
700 printk(KERN_ERR "radeon_cp: Failed to register firmware\n");
701 return -EINVAL;
702 }
703
704 switch (rdev->family) { 695 switch (rdev->family) {
705 case CHIP_BARTS: 696 case CHIP_BARTS:
706 chip_name = "BARTS"; 697 chip_name = "BARTS";
@@ -753,7 +744,7 @@ int ni_init_microcode(struct radeon_device *rdev)
753 DRM_INFO("Loading %s Microcode\n", chip_name); 744 DRM_INFO("Loading %s Microcode\n", chip_name);
754 745
755 snprintf(fw_name, sizeof(fw_name), "radeon/%s_pfp.bin", chip_name); 746 snprintf(fw_name, sizeof(fw_name), "radeon/%s_pfp.bin", chip_name);
756 err = request_firmware(&rdev->pfp_fw, fw_name, &pdev->dev); 747 err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev);
757 if (err) 748 if (err)
758 goto out; 749 goto out;
759 if (rdev->pfp_fw->size != pfp_req_size) { 750 if (rdev->pfp_fw->size != pfp_req_size) {
@@ -765,7 +756,7 @@ int ni_init_microcode(struct radeon_device *rdev)
765 } 756 }
766 757
767 snprintf(fw_name, sizeof(fw_name), "radeon/%s_me.bin", chip_name); 758 snprintf(fw_name, sizeof(fw_name), "radeon/%s_me.bin", chip_name);
768 err = request_firmware(&rdev->me_fw, fw_name, &pdev->dev); 759 err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
769 if (err) 760 if (err)
770 goto out; 761 goto out;
771 if (rdev->me_fw->size != me_req_size) { 762 if (rdev->me_fw->size != me_req_size) {
@@ -776,7 +767,7 @@ int ni_init_microcode(struct radeon_device *rdev)
776 } 767 }
777 768
778 snprintf(fw_name, sizeof(fw_name), "radeon/%s_rlc.bin", rlc_chip_name); 769 snprintf(fw_name, sizeof(fw_name), "radeon/%s_rlc.bin", rlc_chip_name);
779 err = request_firmware(&rdev->rlc_fw, fw_name, &pdev->dev); 770 err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev);
780 if (err) 771 if (err)
781 goto out; 772 goto out;
782 if (rdev->rlc_fw->size != rlc_req_size) { 773 if (rdev->rlc_fw->size != rlc_req_size) {
@@ -789,7 +780,7 @@ int ni_init_microcode(struct radeon_device *rdev)
789 /* no MC ucode on TN */ 780 /* no MC ucode on TN */
790 if (!(rdev->flags & RADEON_IS_IGP)) { 781 if (!(rdev->flags & RADEON_IS_IGP)) {
791 snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); 782 snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name);
792 err = request_firmware(&rdev->mc_fw, fw_name, &pdev->dev); 783 err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev);
793 if (err) 784 if (err)
794 goto out; 785 goto out;
795 if (rdev->mc_fw->size != mc_req_size) { 786 if (rdev->mc_fw->size != mc_req_size) {
@@ -802,7 +793,7 @@ int ni_init_microcode(struct radeon_device *rdev)
802 793
803 if ((rdev->family >= CHIP_BARTS) && (rdev->family <= CHIP_CAYMAN)) { 794 if ((rdev->family >= CHIP_BARTS) && (rdev->family <= CHIP_CAYMAN)) {
804 snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); 795 snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name);
805 err = request_firmware(&rdev->smc_fw, fw_name, &pdev->dev); 796 err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
806 if (err) 797 if (err)
807 goto out; 798 goto out;
808 if (rdev->smc_fw->size != smc_req_size) { 799 if (rdev->smc_fw->size != smc_req_size) {
@@ -814,8 +805,6 @@ int ni_init_microcode(struct radeon_device *rdev)
814 } 805 }
815 806
816out: 807out:
817 platform_device_unregister(pdev);
818
819 if (err) { 808 if (err) {
820 if (err != -EINVAL) 809 if (err != -EINVAL)
821 printk(KERN_ERR 810 printk(KERN_ERR
@@ -2461,6 +2450,167 @@ void cayman_vm_fini(struct radeon_device *rdev)
2461{ 2450{
2462} 2451}
2463 2452
2453/**
2454 * cayman_vm_decode_fault - print human readable fault info
2455 *
2456 * @rdev: radeon_device pointer
2457 * @status: VM_CONTEXT1_PROTECTION_FAULT_STATUS register value
2458 * @addr: VM_CONTEXT1_PROTECTION_FAULT_ADDR register value
2459 *
2460 * Print human readable fault information (cayman/TN).
2461 */
2462void cayman_vm_decode_fault(struct radeon_device *rdev,
2463 u32 status, u32 addr)
2464{
2465 u32 mc_id = (status & MEMORY_CLIENT_ID_MASK) >> MEMORY_CLIENT_ID_SHIFT;
2466 u32 vmid = (status & FAULT_VMID_MASK) >> FAULT_VMID_SHIFT;
2467 u32 protections = (status & PROTECTIONS_MASK) >> PROTECTIONS_SHIFT;
2468 char *block;
2469
2470 switch (mc_id) {
2471 case 32:
2472 case 16:
2473 case 96:
2474 case 80:
2475 case 160:
2476 case 144:
2477 case 224:
2478 case 208:
2479 block = "CB";
2480 break;
2481 case 33:
2482 case 17:
2483 case 97:
2484 case 81:
2485 case 161:
2486 case 145:
2487 case 225:
2488 case 209:
2489 block = "CB_FMASK";
2490 break;
2491 case 34:
2492 case 18:
2493 case 98:
2494 case 82:
2495 case 162:
2496 case 146:
2497 case 226:
2498 case 210:
2499 block = "CB_CMASK";
2500 break;
2501 case 35:
2502 case 19:
2503 case 99:
2504 case 83:
2505 case 163:
2506 case 147:
2507 case 227:
2508 case 211:
2509 block = "CB_IMMED";
2510 break;
2511 case 36:
2512 case 20:
2513 case 100:
2514 case 84:
2515 case 164:
2516 case 148:
2517 case 228:
2518 case 212:
2519 block = "DB";
2520 break;
2521 case 37:
2522 case 21:
2523 case 101:
2524 case 85:
2525 case 165:
2526 case 149:
2527 case 229:
2528 case 213:
2529 block = "DB_HTILE";
2530 break;
2531 case 38:
2532 case 22:
2533 case 102:
2534 case 86:
2535 case 166:
2536 case 150:
2537 case 230:
2538 case 214:
2539 block = "SX";
2540 break;
2541 case 39:
2542 case 23:
2543 case 103:
2544 case 87:
2545 case 167:
2546 case 151:
2547 case 231:
2548 case 215:
2549 block = "DB_STEN";
2550 break;
2551 case 40:
2552 case 24:
2553 case 104:
2554 case 88:
2555 case 232:
2556 case 216:
2557 case 168:
2558 case 152:
2559 block = "TC_TFETCH";
2560 break;
2561 case 41:
2562 case 25:
2563 case 105:
2564 case 89:
2565 case 233:
2566 case 217:
2567 case 169:
2568 case 153:
2569 block = "TC_VFETCH";
2570 break;
2571 case 42:
2572 case 26:
2573 case 106:
2574 case 90:
2575 case 234:
2576 case 218:
2577 case 170:
2578 case 154:
2579 block = "VC";
2580 break;
2581 case 112:
2582 block = "CP";
2583 break;
2584 case 113:
2585 case 114:
2586 block = "SH";
2587 break;
2588 case 115:
2589 block = "VGT";
2590 break;
2591 case 178:
2592 block = "IH";
2593 break;
2594 case 51:
2595 block = "RLC";
2596 break;
2597 case 55:
2598 block = "DMA";
2599 break;
2600 case 56:
2601 block = "HDP";
2602 break;
2603 default:
2604 block = "unknown";
2605 break;
2606 }
2607
2608 printk("VM fault (0x%02x, vmid %d) at page %u, %s from %s (%d)\n",
2609 protections, vmid, addr,
2610 (status & MEMORY_CLIENT_RW_MASK) ? "write" : "read",
2611 block, mc_id);
2612}
2613
2464#define R600_ENTRY_VALID (1 << 0) 2614#define R600_ENTRY_VALID (1 << 0)
2465#define R600_PTE_SYSTEM (1 << 1) 2615#define R600_PTE_SYSTEM (1 << 1)
2466#define R600_PTE_SNOOPED (1 << 2) 2616#define R600_PTE_SNOOPED (1 << 2)
diff --git a/drivers/gpu/drm/radeon/nid.h b/drivers/gpu/drm/radeon/nid.h
index fe24a93542ec..22421bc80c0d 100644
--- a/drivers/gpu/drm/radeon/nid.h
+++ b/drivers/gpu/drm/radeon/nid.h
@@ -133,6 +133,22 @@
133#define VM_CONTEXT1_CNTL2 0x1434 133#define VM_CONTEXT1_CNTL2 0x1434
134#define VM_INVALIDATE_REQUEST 0x1478 134#define VM_INVALIDATE_REQUEST 0x1478
135#define VM_INVALIDATE_RESPONSE 0x147c 135#define VM_INVALIDATE_RESPONSE 0x147c
136#define VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x14FC
137#define VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x14DC
138#define PROTECTIONS_MASK (0xf << 0)
139#define PROTECTIONS_SHIFT 0
140 /* bit 0: range
141 * bit 2: pde0
142 * bit 3: valid
143 * bit 4: read
144 * bit 5: write
145 */
146#define MEMORY_CLIENT_ID_MASK (0xff << 12)
147#define MEMORY_CLIENT_ID_SHIFT 12
148#define MEMORY_CLIENT_RW_MASK (1 << 24)
149#define MEMORY_CLIENT_RW_SHIFT 24
150#define FAULT_VMID_MASK (0x7 << 25)
151#define FAULT_VMID_SHIFT 25
136#define VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR 0x1518 152#define VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR 0x1518
137#define VM_CONTEXT1_PROTECTION_FAULT_DEFAULT_ADDR 0x151c 153#define VM_CONTEXT1_PROTECTION_FAULT_DEFAULT_ADDR 0x151c
138#define VM_CONTEXT0_PAGE_TABLE_BASE_ADDR 0x153C 154#define VM_CONTEXT0_PAGE_TABLE_BASE_ADDR 0x153C
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index c9affefd79f6..75349cdaa84b 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -39,7 +39,6 @@
39#include "atom.h" 39#include "atom.h"
40 40
41#include <linux/firmware.h> 41#include <linux/firmware.h>
42#include <linux/platform_device.h>
43#include <linux/module.h> 42#include <linux/module.h>
44 43
45#include "r100_reg_safe.h" 44#include "r100_reg_safe.h"
@@ -989,18 +988,11 @@ void r100_ring_start(struct radeon_device *rdev, struct radeon_ring *ring)
989/* Load the microcode for the CP */ 988/* Load the microcode for the CP */
990static int r100_cp_init_microcode(struct radeon_device *rdev) 989static int r100_cp_init_microcode(struct radeon_device *rdev)
991{ 990{
992 struct platform_device *pdev;
993 const char *fw_name = NULL; 991 const char *fw_name = NULL;
994 int err; 992 int err;
995 993
996 DRM_DEBUG_KMS("\n"); 994 DRM_DEBUG_KMS("\n");
997 995
998 pdev = platform_device_register_simple("radeon_cp", 0, NULL, 0);
999 err = IS_ERR(pdev);
1000 if (err) {
1001 printk(KERN_ERR "radeon_cp: Failed to register firmware\n");
1002 return -EINVAL;
1003 }
1004 if ((rdev->family == CHIP_R100) || (rdev->family == CHIP_RV100) || 996 if ((rdev->family == CHIP_R100) || (rdev->family == CHIP_RV100) ||
1005 (rdev->family == CHIP_RV200) || (rdev->family == CHIP_RS100) || 997 (rdev->family == CHIP_RV200) || (rdev->family == CHIP_RS100) ||
1006 (rdev->family == CHIP_RS200)) { 998 (rdev->family == CHIP_RS200)) {
@@ -1042,8 +1034,7 @@ static int r100_cp_init_microcode(struct radeon_device *rdev)
1042 fw_name = FIRMWARE_R520; 1034 fw_name = FIRMWARE_R520;
1043 } 1035 }
1044 1036
1045 err = request_firmware(&rdev->me_fw, fw_name, &pdev->dev); 1037 err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
1046 platform_device_unregister(pdev);
1047 if (err) { 1038 if (err) {
1048 printk(KERN_ERR "radeon_cp: Failed to load firmware \"%s\"\n", 1039 printk(KERN_ERR "radeon_cp: Failed to load firmware \"%s\"\n",
1049 fw_name); 1040 fw_name);
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 2d3655f7f41e..393880a09412 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -28,7 +28,6 @@
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/seq_file.h> 29#include <linux/seq_file.h>
30#include <linux/firmware.h> 30#include <linux/firmware.h>
31#include <linux/platform_device.h>
32#include <linux/module.h> 31#include <linux/module.h>
33#include <drm/drmP.h> 32#include <drm/drmP.h>
34#include <drm/radeon_drm.h> 33#include <drm/radeon_drm.h>
@@ -2144,7 +2143,6 @@ void r600_cp_stop(struct radeon_device *rdev)
2144 2143
2145int r600_init_microcode(struct radeon_device *rdev) 2144int r600_init_microcode(struct radeon_device *rdev)
2146{ 2145{
2147 struct platform_device *pdev;
2148 const char *chip_name; 2146 const char *chip_name;
2149 const char *rlc_chip_name; 2147 const char *rlc_chip_name;
2150 const char *smc_chip_name = "RV770"; 2148 const char *smc_chip_name = "RV770";
@@ -2154,13 +2152,6 @@ int r600_init_microcode(struct radeon_device *rdev)
2154 2152
2155 DRM_DEBUG("\n"); 2153 DRM_DEBUG("\n");
2156 2154
2157 pdev = platform_device_register_simple("radeon_cp", 0, NULL, 0);
2158 err = IS_ERR(pdev);
2159 if (err) {
2160 printk(KERN_ERR "radeon_cp: Failed to register firmware\n");
2161 return -EINVAL;
2162 }
2163
2164 switch (rdev->family) { 2155 switch (rdev->family) {
2165 case CHIP_R600: 2156 case CHIP_R600:
2166 chip_name = "R600"; 2157 chip_name = "R600";
@@ -2272,7 +2263,7 @@ int r600_init_microcode(struct radeon_device *rdev)
2272 DRM_INFO("Loading %s Microcode\n", chip_name); 2263 DRM_INFO("Loading %s Microcode\n", chip_name);
2273 2264
2274 snprintf(fw_name, sizeof(fw_name), "radeon/%s_pfp.bin", chip_name); 2265 snprintf(fw_name, sizeof(fw_name), "radeon/%s_pfp.bin", chip_name);
2275 err = request_firmware(&rdev->pfp_fw, fw_name, &pdev->dev); 2266 err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev);
2276 if (err) 2267 if (err)
2277 goto out; 2268 goto out;
2278 if (rdev->pfp_fw->size != pfp_req_size) { 2269 if (rdev->pfp_fw->size != pfp_req_size) {
@@ -2284,7 +2275,7 @@ int r600_init_microcode(struct radeon_device *rdev)
2284 } 2275 }
2285 2276
2286 snprintf(fw_name, sizeof(fw_name), "radeon/%s_me.bin", chip_name); 2277 snprintf(fw_name, sizeof(fw_name), "radeon/%s_me.bin", chip_name);
2287 err = request_firmware(&rdev->me_fw, fw_name, &pdev->dev); 2278 err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
2288 if (err) 2279 if (err)
2289 goto out; 2280 goto out;
2290 if (rdev->me_fw->size != me_req_size) { 2281 if (rdev->me_fw->size != me_req_size) {
@@ -2295,7 +2286,7 @@ int r600_init_microcode(struct radeon_device *rdev)
2295 } 2286 }
2296 2287
2297 snprintf(fw_name, sizeof(fw_name), "radeon/%s_rlc.bin", rlc_chip_name); 2288 snprintf(fw_name, sizeof(fw_name), "radeon/%s_rlc.bin", rlc_chip_name);
2298 err = request_firmware(&rdev->rlc_fw, fw_name, &pdev->dev); 2289 err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev);
2299 if (err) 2290 if (err)
2300 goto out; 2291 goto out;
2301 if (rdev->rlc_fw->size != rlc_req_size) { 2292 if (rdev->rlc_fw->size != rlc_req_size) {
@@ -2307,7 +2298,7 @@ int r600_init_microcode(struct radeon_device *rdev)
2307 2298
2308 if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_HEMLOCK)) { 2299 if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_HEMLOCK)) {
2309 snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", smc_chip_name); 2300 snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", smc_chip_name);
2310 err = request_firmware(&rdev->smc_fw, fw_name, &pdev->dev); 2301 err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
2311 if (err) 2302 if (err)
2312 goto out; 2303 goto out;
2313 if (rdev->smc_fw->size != smc_req_size) { 2304 if (rdev->smc_fw->size != smc_req_size) {
@@ -2319,8 +2310,6 @@ int r600_init_microcode(struct radeon_device *rdev)
2319 } 2310 }
2320 2311
2321out: 2312out:
2322 platform_device_unregister(pdev);
2323
2324 if (err) { 2313 if (err) {
2325 if (err != -EINVAL) 2314 if (err != -EINVAL)
2326 printk(KERN_ERR 2315 printk(KERN_ERR
@@ -3019,7 +3008,7 @@ void r600_uvd_fence_emit(struct radeon_device *rdev,
3019 struct radeon_fence *fence) 3008 struct radeon_fence *fence)
3020{ 3009{
3021 struct radeon_ring *ring = &rdev->ring[fence->ring]; 3010 struct radeon_ring *ring = &rdev->ring[fence->ring];
3022 uint32_t addr = rdev->fence_drv[fence->ring].gpu_addr; 3011 uint64_t addr = rdev->fence_drv[fence->ring].gpu_addr;
3023 3012
3024 radeon_ring_write(ring, PACKET0(UVD_CONTEXT_ID, 0)); 3013 radeon_ring_write(ring, PACKET0(UVD_CONTEXT_ID, 0));
3025 radeon_ring_write(ring, fence->seq); 3014 radeon_ring_write(ring, fence->seq);
@@ -3145,6 +3134,87 @@ int r600_copy_blit(struct radeon_device *rdev,
3145} 3134}
3146 3135
3147/** 3136/**
3137 * r600_copy_cpdma - copy pages using the CP DMA engine
3138 *
3139 * @rdev: radeon_device pointer
3140 * @src_offset: src GPU address
3141 * @dst_offset: dst GPU address
3142 * @num_gpu_pages: number of GPU pages to xfer
3143 * @fence: radeon fence object
3144 *
3145 * Copy GPU paging using the CP DMA engine (r6xx+).
3146 * Used by the radeon ttm implementation to move pages if
3147 * registered as the asic copy callback.
3148 */
3149int r600_copy_cpdma(struct radeon_device *rdev,
3150 uint64_t src_offset, uint64_t dst_offset,
3151 unsigned num_gpu_pages,
3152 struct radeon_fence **fence)
3153{
3154 struct radeon_semaphore *sem = NULL;
3155 int ring_index = rdev->asic->copy.blit_ring_index;
3156 struct radeon_ring *ring = &rdev->ring[ring_index];
3157 u32 size_in_bytes, cur_size_in_bytes, tmp;
3158 int i, num_loops;
3159 int r = 0;
3160
3161 r = radeon_semaphore_create(rdev, &sem);
3162 if (r) {
3163 DRM_ERROR("radeon: moving bo (%d).\n", r);
3164 return r;
3165 }
3166
3167 size_in_bytes = (num_gpu_pages << RADEON_GPU_PAGE_SHIFT);
3168 num_loops = DIV_ROUND_UP(size_in_bytes, 0x1fffff);
3169 r = radeon_ring_lock(rdev, ring, num_loops * 6 + 21);
3170 if (r) {
3171 DRM_ERROR("radeon: moving bo (%d).\n", r);
3172 radeon_semaphore_free(rdev, &sem, NULL);
3173 return r;
3174 }
3175
3176 if (radeon_fence_need_sync(*fence, ring->idx)) {
3177 radeon_semaphore_sync_rings(rdev, sem, (*fence)->ring,
3178 ring->idx);
3179 radeon_fence_note_sync(*fence, ring->idx);
3180 } else {
3181 radeon_semaphore_free(rdev, &sem, NULL);
3182 }
3183
3184 for (i = 0; i < num_loops; i++) {
3185 cur_size_in_bytes = size_in_bytes;
3186 if (cur_size_in_bytes > 0x1fffff)
3187 cur_size_in_bytes = 0x1fffff;
3188 size_in_bytes -= cur_size_in_bytes;
3189 tmp = upper_32_bits(src_offset) & 0xff;
3190 if (size_in_bytes == 0)
3191 tmp |= PACKET3_CP_DMA_CP_SYNC;
3192 radeon_ring_write(ring, PACKET3(PACKET3_CP_DMA, 4));
3193 radeon_ring_write(ring, src_offset & 0xffffffff);
3194 radeon_ring_write(ring, tmp);
3195 radeon_ring_write(ring, dst_offset & 0xffffffff);
3196 radeon_ring_write(ring, upper_32_bits(dst_offset) & 0xff);
3197 radeon_ring_write(ring, cur_size_in_bytes);
3198 src_offset += cur_size_in_bytes;
3199 dst_offset += cur_size_in_bytes;
3200 }
3201 radeon_ring_write(ring, PACKET3(PACKET3_SET_CONFIG_REG, 1));
3202 radeon_ring_write(ring, (WAIT_UNTIL - PACKET3_SET_CONFIG_REG_OFFSET) >> 2);
3203 radeon_ring_write(ring, WAIT_CP_DMA_IDLE_bit);
3204
3205 r = radeon_fence_emit(rdev, fence, ring->idx);
3206 if (r) {
3207 radeon_ring_unlock_undo(rdev, ring);
3208 return r;
3209 }
3210
3211 radeon_ring_unlock_commit(rdev, ring);
3212 radeon_semaphore_free(rdev, &sem, *fence);
3213
3214 return r;
3215}
3216
3217/**
3148 * r600_copy_dma - copy pages using the DMA engine 3218 * r600_copy_dma - copy pages using the DMA engine
3149 * 3219 *
3150 * @rdev: radeon_device pointer 3220 * @rdev: radeon_device pointer
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c
index e73b2a73494a..f48240bb8c56 100644
--- a/drivers/gpu/drm/radeon/r600_hdmi.c
+++ b/drivers/gpu/drm/radeon/r600_hdmi.c
@@ -266,6 +266,9 @@ void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mod
266 uint32_t offset; 266 uint32_t offset;
267 ssize_t err; 267 ssize_t err;
268 268
269 if (!dig || !dig->afmt)
270 return;
271
269 /* Silent, r600_hdmi_enable will raise WARN for us */ 272 /* Silent, r600_hdmi_enable will raise WARN for us */
270 if (!dig->afmt->enabled) 273 if (!dig->afmt->enabled)
271 return; 274 return;
@@ -448,6 +451,9 @@ void r600_hdmi_enable(struct drm_encoder *encoder, bool enable)
448 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; 451 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
449 u32 hdmi = HDMI0_ERROR_ACK; 452 u32 hdmi = HDMI0_ERROR_ACK;
450 453
454 if (!dig || !dig->afmt)
455 return;
456
451 /* Silent, r600_hdmi_enable will raise WARN for us */ 457 /* Silent, r600_hdmi_enable will raise WARN for us */
452 if (enable && dig->afmt->enabled) 458 if (enable && dig->afmt->enabled)
453 return; 459 return;
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h
index f1b3084d8f51..8e3fe815edab 100644
--- a/drivers/gpu/drm/radeon/r600d.h
+++ b/drivers/gpu/drm/radeon/r600d.h
@@ -602,6 +602,7 @@
602#define L2_BUSY (1 << 0) 602#define L2_BUSY (1 << 0)
603 603
604#define WAIT_UNTIL 0x8040 604#define WAIT_UNTIL 0x8040
605#define WAIT_CP_DMA_IDLE_bit (1 << 8)
605#define WAIT_2D_IDLE_bit (1 << 14) 606#define WAIT_2D_IDLE_bit (1 << 14)
606#define WAIT_3D_IDLE_bit (1 << 15) 607#define WAIT_3D_IDLE_bit (1 << 15)
607#define WAIT_2D_IDLECLEAN_bit (1 << 16) 608#define WAIT_2D_IDLECLEAN_bit (1 << 16)
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 9b7025d02cd0..2f08219c39b6 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -97,6 +97,7 @@ extern int radeon_msi;
97extern int radeon_lockup_timeout; 97extern int radeon_lockup_timeout;
98extern int radeon_fastfb; 98extern int radeon_fastfb;
99extern int radeon_dpm; 99extern int radeon_dpm;
100extern int radeon_aspm;
100 101
101/* 102/*
102 * Copy from radeon_drv.h so we don't have to include both and have conflicting 103 * Copy from radeon_drv.h so we don't have to include both and have conflicting
@@ -455,6 +456,7 @@ struct radeon_sa_manager {
455 uint64_t gpu_addr; 456 uint64_t gpu_addr;
456 void *cpu_ptr; 457 void *cpu_ptr;
457 uint32_t domain; 458 uint32_t domain;
459 uint32_t align;
458}; 460};
459 461
460struct radeon_sa_bo; 462struct radeon_sa_bo;
@@ -783,6 +785,11 @@ struct radeon_mec {
783/* number of entries in page table */ 785/* number of entries in page table */
784#define RADEON_VM_PTE_COUNT (1 << RADEON_VM_BLOCK_SIZE) 786#define RADEON_VM_PTE_COUNT (1 << RADEON_VM_BLOCK_SIZE)
785 787
788/* PTBs (Page Table Blocks) need to be aligned to 32K */
789#define RADEON_VM_PTB_ALIGN_SIZE 32768
790#define RADEON_VM_PTB_ALIGN_MASK (RADEON_VM_PTB_ALIGN_SIZE - 1)
791#define RADEON_VM_PTB_ALIGN(a) (((a) + RADEON_VM_PTB_ALIGN_MASK) & ~RADEON_VM_PTB_ALIGN_MASK)
792
786struct radeon_vm { 793struct radeon_vm {
787 struct list_head list; 794 struct list_head list;
788 struct list_head va; 795 struct list_head va;
@@ -1460,6 +1467,8 @@ struct radeon_uvd {
1460 struct radeon_bo *vcpu_bo; 1467 struct radeon_bo *vcpu_bo;
1461 void *cpu_addr; 1468 void *cpu_addr;
1462 uint64_t gpu_addr; 1469 uint64_t gpu_addr;
1470 void *saved_bo;
1471 unsigned fw_size;
1463 atomic_t handles[RADEON_MAX_UVD_HANDLES]; 1472 atomic_t handles[RADEON_MAX_UVD_HANDLES];
1464 struct drm_file *filp[RADEON_MAX_UVD_HANDLES]; 1473 struct drm_file *filp[RADEON_MAX_UVD_HANDLES];
1465 struct delayed_work idle_work; 1474 struct delayed_work idle_work;
@@ -2054,7 +2063,6 @@ struct radeon_device {
2054 const struct firmware *rlc_fw; /* r6/700 RLC firmware */ 2063 const struct firmware *rlc_fw; /* r6/700 RLC firmware */
2055 const struct firmware *mc_fw; /* NI MC firmware */ 2064 const struct firmware *mc_fw; /* NI MC firmware */
2056 const struct firmware *ce_fw; /* SI CE firmware */ 2065 const struct firmware *ce_fw; /* SI CE firmware */
2057 const struct firmware *uvd_fw; /* UVD firmware */
2058 const struct firmware *mec_fw; /* CIK MEC firmware */ 2066 const struct firmware *mec_fw; /* CIK MEC firmware */
2059 const struct firmware *sdma_fw; /* CIK SDMA firmware */ 2067 const struct firmware *sdma_fw; /* CIK SDMA firmware */
2060 const struct firmware *smc_fw; /* SMC firmware */ 2068 const struct firmware *smc_fw; /* SMC firmware */
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c
index 097077499cc6..78bec1a58ed1 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.c
+++ b/drivers/gpu/drm/radeon/radeon_asic.c
@@ -1026,8 +1026,8 @@ static struct radeon_asic r600_asic = {
1026 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX, 1026 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1027 .dma = &r600_copy_dma, 1027 .dma = &r600_copy_dma,
1028 .dma_ring_index = R600_RING_TYPE_DMA_INDEX, 1028 .dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1029 .copy = &r600_copy_dma, 1029 .copy = &r600_copy_cpdma,
1030 .copy_ring_index = R600_RING_TYPE_DMA_INDEX, 1030 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1031 }, 1031 },
1032 .surface = { 1032 .surface = {
1033 .set_reg = r600_set_surface_reg, 1033 .set_reg = r600_set_surface_reg,
@@ -1119,8 +1119,8 @@ static struct radeon_asic rv6xx_asic = {
1119 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX, 1119 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1120 .dma = &r600_copy_dma, 1120 .dma = &r600_copy_dma,
1121 .dma_ring_index = R600_RING_TYPE_DMA_INDEX, 1121 .dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1122 .copy = &r600_copy_dma, 1122 .copy = &r600_copy_cpdma,
1123 .copy_ring_index = R600_RING_TYPE_DMA_INDEX, 1123 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1124 }, 1124 },
1125 .surface = { 1125 .surface = {
1126 .set_reg = r600_set_surface_reg, 1126 .set_reg = r600_set_surface_reg,
@@ -1229,8 +1229,8 @@ static struct radeon_asic rs780_asic = {
1229 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX, 1229 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1230 .dma = &r600_copy_dma, 1230 .dma = &r600_copy_dma,
1231 .dma_ring_index = R600_RING_TYPE_DMA_INDEX, 1231 .dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1232 .copy = &r600_copy_dma, 1232 .copy = &r600_copy_cpdma,
1233 .copy_ring_index = R600_RING_TYPE_DMA_INDEX, 1233 .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1234 }, 1234 },
1235 .surface = { 1235 .surface = {
1236 .set_reg = r600_set_surface_reg, 1236 .set_reg = r600_set_surface_reg,
@@ -1270,6 +1270,7 @@ static struct radeon_asic rs780_asic = {
1270 .get_sclk = &rs780_dpm_get_sclk, 1270 .get_sclk = &rs780_dpm_get_sclk,
1271 .get_mclk = &rs780_dpm_get_mclk, 1271 .get_mclk = &rs780_dpm_get_mclk,
1272 .print_power_state = &rs780_dpm_print_power_state, 1272 .print_power_state = &rs780_dpm_print_power_state,
1273 .debugfs_print_current_performance_level = &rs780_dpm_debugfs_print_current_performance_level,
1273 }, 1274 },
1274 .pflip = { 1275 .pflip = {
1275 .pre_page_flip = &rs600_pre_page_flip, 1276 .pre_page_flip = &rs600_pre_page_flip,
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h
index 45d0693cddd5..ca1895709908 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.h
+++ b/drivers/gpu/drm/radeon/radeon_asic.h
@@ -340,6 +340,9 @@ int r600_uvd_ring_test(struct radeon_device *rdev, struct radeon_ring *ring);
340int r600_copy_blit(struct radeon_device *rdev, 340int r600_copy_blit(struct radeon_device *rdev,
341 uint64_t src_offset, uint64_t dst_offset, 341 uint64_t src_offset, uint64_t dst_offset,
342 unsigned num_gpu_pages, struct radeon_fence **fence); 342 unsigned num_gpu_pages, struct radeon_fence **fence);
343int r600_copy_cpdma(struct radeon_device *rdev,
344 uint64_t src_offset, uint64_t dst_offset,
345 unsigned num_gpu_pages, struct radeon_fence **fence);
343int r600_copy_dma(struct radeon_device *rdev, 346int r600_copy_dma(struct radeon_device *rdev,
344 uint64_t src_offset, uint64_t dst_offset, 347 uint64_t src_offset, uint64_t dst_offset,
345 unsigned num_gpu_pages, struct radeon_fence **fence); 348 unsigned num_gpu_pages, struct radeon_fence **fence);
@@ -430,6 +433,8 @@ u32 rs780_dpm_get_sclk(struct radeon_device *rdev, bool low);
430u32 rs780_dpm_get_mclk(struct radeon_device *rdev, bool low); 433u32 rs780_dpm_get_mclk(struct radeon_device *rdev, bool low);
431void rs780_dpm_print_power_state(struct radeon_device *rdev, 434void rs780_dpm_print_power_state(struct radeon_device *rdev,
432 struct radeon_ps *ps); 435 struct radeon_ps *ps);
436void rs780_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
437 struct seq_file *m);
433 438
434/* uvd */ 439/* uvd */
435int r600_uvd_init(struct radeon_device *rdev); 440int r600_uvd_init(struct radeon_device *rdev);
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index fbdaff55556b..e3f3e8841789 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -3513,7 +3513,6 @@ int radeon_atom_get_memory_info(struct radeon_device *rdev,
3513 u8 frev, crev, i; 3513 u8 frev, crev, i;
3514 u16 data_offset, size; 3514 u16 data_offset, size;
3515 union vram_info *vram_info; 3515 union vram_info *vram_info;
3516 u8 *p;
3517 3516
3518 memset(mem_info, 0, sizeof(struct atom_memory_info)); 3517 memset(mem_info, 0, sizeof(struct atom_memory_info));
3519 3518
@@ -3529,13 +3528,12 @@ int radeon_atom_get_memory_info(struct radeon_device *rdev,
3529 if (module_index < vram_info->v1_3.ucNumOfVRAMModule) { 3528 if (module_index < vram_info->v1_3.ucNumOfVRAMModule) {
3530 ATOM_VRAM_MODULE_V3 *vram_module = 3529 ATOM_VRAM_MODULE_V3 *vram_module =
3531 (ATOM_VRAM_MODULE_V3 *)vram_info->v1_3.aVramInfo; 3530 (ATOM_VRAM_MODULE_V3 *)vram_info->v1_3.aVramInfo;
3532 p = (u8 *)vram_info->v1_3.aVramInfo;
3533 3531
3534 for (i = 0; i < module_index; i++) { 3532 for (i = 0; i < module_index; i++) {
3535 vram_module = (ATOM_VRAM_MODULE_V3 *)p;
3536 if (le16_to_cpu(vram_module->usSize) == 0) 3533 if (le16_to_cpu(vram_module->usSize) == 0)
3537 return -EINVAL; 3534 return -EINVAL;
3538 p += le16_to_cpu(vram_module->usSize); 3535 vram_module = (ATOM_VRAM_MODULE_V3 *)
3536 ((u8 *)vram_module + le16_to_cpu(vram_module->usSize));
3539 } 3537 }
3540 mem_info->mem_vendor = vram_module->asMemory.ucMemoryVenderID & 0xf; 3538 mem_info->mem_vendor = vram_module->asMemory.ucMemoryVenderID & 0xf;
3541 mem_info->mem_type = vram_module->asMemory.ucMemoryType & 0xf0; 3539 mem_info->mem_type = vram_module->asMemory.ucMemoryType & 0xf0;
@@ -3547,13 +3545,12 @@ int radeon_atom_get_memory_info(struct radeon_device *rdev,
3547 if (module_index < vram_info->v1_4.ucNumOfVRAMModule) { 3545 if (module_index < vram_info->v1_4.ucNumOfVRAMModule) {
3548 ATOM_VRAM_MODULE_V4 *vram_module = 3546 ATOM_VRAM_MODULE_V4 *vram_module =
3549 (ATOM_VRAM_MODULE_V4 *)vram_info->v1_4.aVramInfo; 3547 (ATOM_VRAM_MODULE_V4 *)vram_info->v1_4.aVramInfo;
3550 p = (u8 *)vram_info->v1_4.aVramInfo;
3551 3548
3552 for (i = 0; i < module_index; i++) { 3549 for (i = 0; i < module_index; i++) {
3553 vram_module = (ATOM_VRAM_MODULE_V4 *)p;
3554 if (le16_to_cpu(vram_module->usModuleSize) == 0) 3550 if (le16_to_cpu(vram_module->usModuleSize) == 0)
3555 return -EINVAL; 3551 return -EINVAL;
3556 p += le16_to_cpu(vram_module->usModuleSize); 3552 vram_module = (ATOM_VRAM_MODULE_V4 *)
3553 ((u8 *)vram_module + le16_to_cpu(vram_module->usModuleSize));
3557 } 3554 }
3558 mem_info->mem_vendor = vram_module->ucMemoryVenderID & 0xf; 3555 mem_info->mem_vendor = vram_module->ucMemoryVenderID & 0xf;
3559 mem_info->mem_type = vram_module->ucMemoryType & 0xf0; 3556 mem_info->mem_type = vram_module->ucMemoryType & 0xf0;
@@ -3572,13 +3569,12 @@ int radeon_atom_get_memory_info(struct radeon_device *rdev,
3572 if (module_index < vram_info->v2_1.ucNumOfVRAMModule) { 3569 if (module_index < vram_info->v2_1.ucNumOfVRAMModule) {
3573 ATOM_VRAM_MODULE_V7 *vram_module = 3570 ATOM_VRAM_MODULE_V7 *vram_module =
3574 (ATOM_VRAM_MODULE_V7 *)vram_info->v2_1.aVramInfo; 3571 (ATOM_VRAM_MODULE_V7 *)vram_info->v2_1.aVramInfo;
3575 p = (u8 *)vram_info->v2_1.aVramInfo;
3576 3572
3577 for (i = 0; i < module_index; i++) { 3573 for (i = 0; i < module_index; i++) {
3578 vram_module = (ATOM_VRAM_MODULE_V7 *)p;
3579 if (le16_to_cpu(vram_module->usModuleSize) == 0) 3574 if (le16_to_cpu(vram_module->usModuleSize) == 0)
3580 return -EINVAL; 3575 return -EINVAL;
3581 p += le16_to_cpu(vram_module->usModuleSize); 3576 vram_module = (ATOM_VRAM_MODULE_V7 *)
3577 ((u8 *)vram_module + le16_to_cpu(vram_module->usModuleSize));
3582 } 3578 }
3583 mem_info->mem_vendor = vram_module->ucMemoryVenderID & 0xf; 3579 mem_info->mem_vendor = vram_module->ucMemoryVenderID & 0xf;
3584 mem_info->mem_type = vram_module->ucMemoryType & 0xf0; 3580 mem_info->mem_type = vram_module->ucMemoryType & 0xf0;
@@ -3628,21 +3624,19 @@ int radeon_atom_get_mclk_range_table(struct radeon_device *rdev,
3628 if (module_index < vram_info->v1_4.ucNumOfVRAMModule) { 3624 if (module_index < vram_info->v1_4.ucNumOfVRAMModule) {
3629 ATOM_VRAM_MODULE_V4 *vram_module = 3625 ATOM_VRAM_MODULE_V4 *vram_module =
3630 (ATOM_VRAM_MODULE_V4 *)vram_info->v1_4.aVramInfo; 3626 (ATOM_VRAM_MODULE_V4 *)vram_info->v1_4.aVramInfo;
3631 ATOM_MEMORY_TIMING_FORMAT *format;
3632 p = (u8 *)vram_info->v1_4.aVramInfo;
3633 3627
3634 for (i = 0; i < module_index; i++) { 3628 for (i = 0; i < module_index; i++) {
3635 vram_module = (ATOM_VRAM_MODULE_V4 *)p;
3636 if (le16_to_cpu(vram_module->usModuleSize) == 0) 3629 if (le16_to_cpu(vram_module->usModuleSize) == 0)
3637 return -EINVAL; 3630 return -EINVAL;
3638 p += le16_to_cpu(vram_module->usModuleSize); 3631 vram_module = (ATOM_VRAM_MODULE_V4 *)
3632 ((u8 *)vram_module + le16_to_cpu(vram_module->usModuleSize));
3639 } 3633 }
3640 mclk_range_table->num_entries = (u8) 3634 mclk_range_table->num_entries = (u8)
3641 ((vram_module->usModuleSize - offsetof(ATOM_VRAM_MODULE_V4, asMemTiming)) / 3635 ((le16_to_cpu(vram_module->usModuleSize) - offsetof(ATOM_VRAM_MODULE_V4, asMemTiming)) /
3642 mem_timing_size); 3636 mem_timing_size);
3643 p = (u8 *)vram_module->asMemTiming; 3637 p = (u8 *)&vram_module->asMemTiming[0];
3644 for (i = 0; i < mclk_range_table->num_entries; i++) { 3638 for (i = 0; i < mclk_range_table->num_entries; i++) {
3645 format = (ATOM_MEMORY_TIMING_FORMAT *)p; 3639 ATOM_MEMORY_TIMING_FORMAT *format = (ATOM_MEMORY_TIMING_FORMAT *)p;
3646 mclk_range_table->mclk[i] = le32_to_cpu(format->ulClkRange); 3640 mclk_range_table->mclk[i] = le32_to_cpu(format->ulClkRange);
3647 p += mem_timing_size; 3641 p += mem_timing_size;
3648 } 3642 }
@@ -3705,17 +3699,21 @@ int radeon_atom_init_mc_reg_table(struct radeon_device *rdev,
3705 (ATOM_MEMORY_SETTING_DATA_BLOCK *) 3699 (ATOM_MEMORY_SETTING_DATA_BLOCK *)
3706 ((u8 *)reg_block + (2 * sizeof(u16)) + 3700 ((u8 *)reg_block + (2 * sizeof(u16)) +
3707 le16_to_cpu(reg_block->usRegIndexTblSize)); 3701 le16_to_cpu(reg_block->usRegIndexTblSize));
3702 ATOM_INIT_REG_INDEX_FORMAT *format = &reg_block->asRegIndexBuf[0];
3708 num_entries = (u8)((le16_to_cpu(reg_block->usRegIndexTblSize)) / 3703 num_entries = (u8)((le16_to_cpu(reg_block->usRegIndexTblSize)) /
3709 sizeof(ATOM_INIT_REG_INDEX_FORMAT)) - 1; 3704 sizeof(ATOM_INIT_REG_INDEX_FORMAT)) - 1;
3710 if (num_entries > VBIOS_MC_REGISTER_ARRAY_SIZE) 3705 if (num_entries > VBIOS_MC_REGISTER_ARRAY_SIZE)
3711 return -EINVAL; 3706 return -EINVAL;
3712 while (!(reg_block->asRegIndexBuf[i].ucPreRegDataLength & ACCESS_PLACEHOLDER) && 3707 while (i < num_entries) {
3713 (i < num_entries)) { 3708 if (format->ucPreRegDataLength & ACCESS_PLACEHOLDER)
3709 break;
3714 reg_table->mc_reg_address[i].s1 = 3710 reg_table->mc_reg_address[i].s1 =
3715 (u16)(le16_to_cpu(reg_block->asRegIndexBuf[i].usRegIndex)); 3711 (u16)(le16_to_cpu(format->usRegIndex));
3716 reg_table->mc_reg_address[i].pre_reg_data = 3712 reg_table->mc_reg_address[i].pre_reg_data =
3717 (u8)(reg_block->asRegIndexBuf[i].ucPreRegDataLength); 3713 (u8)(format->ucPreRegDataLength);
3718 i++; 3714 i++;
3715 format = (ATOM_INIT_REG_INDEX_FORMAT *)
3716 ((u8 *)format + sizeof(ATOM_INIT_REG_INDEX_FORMAT));
3719 } 3717 }
3720 reg_table->last = i; 3718 reg_table->last = i;
3721 while ((*(u32 *)reg_data != END_OF_REG_DATA_BLOCK) && 3719 while ((*(u32 *)reg_data != END_OF_REG_DATA_BLOCK) &&
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index e5419b350170..29876b1be8ec 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -167,6 +167,7 @@ int radeon_msi = -1;
167int radeon_lockup_timeout = 10000; 167int radeon_lockup_timeout = 10000;
168int radeon_fastfb = 0; 168int radeon_fastfb = 0;
169int radeon_dpm = -1; 169int radeon_dpm = -1;
170int radeon_aspm = -1;
170 171
171MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); 172MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers");
172module_param_named(no_wb, radeon_no_wb, int, 0444); 173module_param_named(no_wb, radeon_no_wb, int, 0444);
@@ -225,6 +226,9 @@ module_param_named(fastfb, radeon_fastfb, int, 0444);
225MODULE_PARM_DESC(dpm, "DPM support (1 = enable, 0 = disable, -1 = auto)"); 226MODULE_PARM_DESC(dpm, "DPM support (1 = enable, 0 = disable, -1 = auto)");
226module_param_named(dpm, radeon_dpm, int, 0444); 227module_param_named(dpm, radeon_dpm, int, 0444);
227 228
229MODULE_PARM_DESC(aspm, "ASPM support (1 = enable, 0 = disable, -1 = auto)");
230module_param_named(aspm, radeon_aspm, int, 0444);
231
228static struct pci_device_id pciidlist[] = { 232static struct pci_device_id pciidlist[] = {
229 radeon_PCI_IDS 233 radeon_PCI_IDS
230}; 234};
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c
index ddb8f8e04eb5..7ddb0efe2408 100644
--- a/drivers/gpu/drm/radeon/radeon_fence.c
+++ b/drivers/gpu/drm/radeon/radeon_fence.c
@@ -782,7 +782,7 @@ int radeon_fence_driver_start_ring(struct radeon_device *rdev, int ring)
782 782
783 } else { 783 } else {
784 /* put fence directly behind firmware */ 784 /* put fence directly behind firmware */
785 index = ALIGN(rdev->uvd_fw->size, 8); 785 index = ALIGN(rdev->uvd.fw_size, 8);
786 rdev->fence_drv[ring].cpu_addr = rdev->uvd.cpu_addr + index; 786 rdev->fence_drv[ring].cpu_addr = rdev->uvd.cpu_addr + index;
787 rdev->fence_drv[ring].gpu_addr = rdev->uvd.gpu_addr + index; 787 rdev->fence_drv[ring].gpu_addr = rdev->uvd.gpu_addr + index;
788 } 788 }
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c
index 43ec4a401f07..d9d31a383276 100644
--- a/drivers/gpu/drm/radeon/radeon_gart.c
+++ b/drivers/gpu/drm/radeon/radeon_gart.c
@@ -466,7 +466,8 @@ int radeon_vm_manager_init(struct radeon_device *rdev)
466 size += rdev->vm_manager.max_pfn * 8; 466 size += rdev->vm_manager.max_pfn * 8;
467 size *= 2; 467 size *= 2;
468 r = radeon_sa_bo_manager_init(rdev, &rdev->vm_manager.sa_manager, 468 r = radeon_sa_bo_manager_init(rdev, &rdev->vm_manager.sa_manager,
469 RADEON_GPU_PAGE_ALIGN(size), 469 RADEON_VM_PTB_ALIGN(size),
470 RADEON_VM_PTB_ALIGN_SIZE,
470 RADEON_GEM_DOMAIN_VRAM); 471 RADEON_GEM_DOMAIN_VRAM);
471 if (r) { 472 if (r) {
472 dev_err(rdev->dev, "failed to allocate vm bo (%dKB)\n", 473 dev_err(rdev->dev, "failed to allocate vm bo (%dKB)\n",
@@ -620,10 +621,10 @@ int radeon_vm_alloc_pt(struct radeon_device *rdev, struct radeon_vm *vm)
620 } 621 }
621 622
622retry: 623retry:
623 pd_size = RADEON_GPU_PAGE_ALIGN(radeon_vm_directory_size(rdev)); 624 pd_size = RADEON_VM_PTB_ALIGN(radeon_vm_directory_size(rdev));
624 r = radeon_sa_bo_new(rdev, &rdev->vm_manager.sa_manager, 625 r = radeon_sa_bo_new(rdev, &rdev->vm_manager.sa_manager,
625 &vm->page_directory, pd_size, 626 &vm->page_directory, pd_size,
626 RADEON_GPU_PAGE_SIZE, false); 627 RADEON_VM_PTB_ALIGN_SIZE, false);
627 if (r == -ENOMEM) { 628 if (r == -ENOMEM) {
628 r = radeon_vm_evict(rdev, vm); 629 r = radeon_vm_evict(rdev, vm);
629 if (r) 630 if (r)
@@ -952,8 +953,8 @@ static int radeon_vm_update_pdes(struct radeon_device *rdev,
952retry: 953retry:
953 r = radeon_sa_bo_new(rdev, &rdev->vm_manager.sa_manager, 954 r = radeon_sa_bo_new(rdev, &rdev->vm_manager.sa_manager,
954 &vm->page_tables[pt_idx], 955 &vm->page_tables[pt_idx],
955 RADEON_VM_PTE_COUNT * 8, 956 RADEON_VM_PTB_ALIGN(RADEON_VM_PTE_COUNT * 8),
956 RADEON_GPU_PAGE_SIZE, false); 957 RADEON_VM_PTB_ALIGN_SIZE, false);
957 958
958 if (r == -ENOMEM) { 959 if (r == -ENOMEM) {
959 r = radeon_vm_evict(rdev, vm); 960 r = radeon_vm_evict(rdev, vm);
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
index bcdefd1dcd43..081886b0642d 100644
--- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
@@ -260,10 +260,6 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
260{ 260{
261 int r = 0; 261 int r = 0;
262 262
263 INIT_WORK(&rdev->hotplug_work, radeon_hotplug_work_func);
264 INIT_WORK(&rdev->audio_work, r600_audio_update_hdmi);
265 INIT_WORK(&rdev->reset_work, radeon_irq_reset_work_func);
266
267 spin_lock_init(&rdev->irq.lock); 263 spin_lock_init(&rdev->irq.lock);
268 r = drm_vblank_init(rdev->ddev, rdev->num_crtc); 264 r = drm_vblank_init(rdev->ddev, rdev->num_crtc);
269 if (r) { 265 if (r) {
@@ -285,6 +281,11 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
285 rdev->irq.installed = false; 281 rdev->irq.installed = false;
286 return r; 282 return r;
287 } 283 }
284
285 INIT_WORK(&rdev->hotplug_work, radeon_hotplug_work_func);
286 INIT_WORK(&rdev->audio_work, r600_audio_update_hdmi);
287 INIT_WORK(&rdev->reset_work, radeon_irq_reset_work_func);
288
288 DRM_INFO("radeon: irq initialized.\n"); 289 DRM_INFO("radeon: irq initialized.\n");
289 return 0; 290 return 0;
290} 291}
@@ -304,8 +305,8 @@ void radeon_irq_kms_fini(struct radeon_device *rdev)
304 rdev->irq.installed = false; 305 rdev->irq.installed = false;
305 if (rdev->msi_enabled) 306 if (rdev->msi_enabled)
306 pci_disable_msi(rdev->pdev); 307 pci_disable_msi(rdev->pdev);
308 flush_work(&rdev->hotplug_work);
307 } 309 }
308 flush_work(&rdev->hotplug_work);
309} 310}
310 311
311/** 312/**
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index 0219d263e2df..2020bf4a3830 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -377,6 +377,7 @@ int radeon_bo_list_validate(struct ww_acquire_ctx *ticket,
377 domain = lobj->alt_domain; 377 domain = lobj->alt_domain;
378 goto retry; 378 goto retry;
379 } 379 }
380 ttm_eu_backoff_reservation(ticket, head);
380 return r; 381 return r;
381 } 382 }
382 } 383 }
diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h
index 91519a5622b4..49c82c480013 100644
--- a/drivers/gpu/drm/radeon/radeon_object.h
+++ b/drivers/gpu/drm/radeon/radeon_object.h
@@ -174,7 +174,7 @@ static inline void * radeon_sa_bo_cpu_addr(struct radeon_sa_bo *sa_bo)
174 174
175extern int radeon_sa_bo_manager_init(struct radeon_device *rdev, 175extern int radeon_sa_bo_manager_init(struct radeon_device *rdev,
176 struct radeon_sa_manager *sa_manager, 176 struct radeon_sa_manager *sa_manager,
177 unsigned size, u32 domain); 177 unsigned size, u32 align, u32 domain);
178extern void radeon_sa_bo_manager_fini(struct radeon_device *rdev, 178extern void radeon_sa_bo_manager_fini(struct radeon_device *rdev,
179 struct radeon_sa_manager *sa_manager); 179 struct radeon_sa_manager *sa_manager);
180extern int radeon_sa_bo_manager_start(struct radeon_device *rdev, 180extern int radeon_sa_bo_manager_start(struct radeon_device *rdev,
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c
index 5f1c51a776ed..fb5ea6208970 100644
--- a/drivers/gpu/drm/radeon/radeon_ring.c
+++ b/drivers/gpu/drm/radeon/radeon_ring.c
@@ -224,6 +224,7 @@ int radeon_ib_pool_init(struct radeon_device *rdev)
224 } 224 }
225 r = radeon_sa_bo_manager_init(rdev, &rdev->ring_tmp_bo, 225 r = radeon_sa_bo_manager_init(rdev, &rdev->ring_tmp_bo,
226 RADEON_IB_POOL_SIZE*64*1024, 226 RADEON_IB_POOL_SIZE*64*1024,
227 RADEON_GPU_PAGE_SIZE,
227 RADEON_GEM_DOMAIN_GTT); 228 RADEON_GEM_DOMAIN_GTT);
228 if (r) { 229 if (r) {
229 return r; 230 return r;
diff --git a/drivers/gpu/drm/radeon/radeon_sa.c b/drivers/gpu/drm/radeon/radeon_sa.c
index 0abe5a9431bb..f0bac68254b7 100644
--- a/drivers/gpu/drm/radeon/radeon_sa.c
+++ b/drivers/gpu/drm/radeon/radeon_sa.c
@@ -49,7 +49,7 @@ static void radeon_sa_bo_try_free(struct radeon_sa_manager *sa_manager);
49 49
50int radeon_sa_bo_manager_init(struct radeon_device *rdev, 50int radeon_sa_bo_manager_init(struct radeon_device *rdev,
51 struct radeon_sa_manager *sa_manager, 51 struct radeon_sa_manager *sa_manager,
52 unsigned size, u32 domain) 52 unsigned size, u32 align, u32 domain)
53{ 53{
54 int i, r; 54 int i, r;
55 55
@@ -57,13 +57,14 @@ int radeon_sa_bo_manager_init(struct radeon_device *rdev,
57 sa_manager->bo = NULL; 57 sa_manager->bo = NULL;
58 sa_manager->size = size; 58 sa_manager->size = size;
59 sa_manager->domain = domain; 59 sa_manager->domain = domain;
60 sa_manager->align = align;
60 sa_manager->hole = &sa_manager->olist; 61 sa_manager->hole = &sa_manager->olist;
61 INIT_LIST_HEAD(&sa_manager->olist); 62 INIT_LIST_HEAD(&sa_manager->olist);
62 for (i = 0; i < RADEON_NUM_RINGS; ++i) { 63 for (i = 0; i < RADEON_NUM_RINGS; ++i) {
63 INIT_LIST_HEAD(&sa_manager->flist[i]); 64 INIT_LIST_HEAD(&sa_manager->flist[i]);
64 } 65 }
65 66
66 r = radeon_bo_create(rdev, size, RADEON_GPU_PAGE_SIZE, true, 67 r = radeon_bo_create(rdev, size, align, true,
67 domain, NULL, &sa_manager->bo); 68 domain, NULL, &sa_manager->bo);
68 if (r) { 69 if (r) {
69 dev_err(rdev->dev, "(%d) failed to allocate bo for manager\n", r); 70 dev_err(rdev->dev, "(%d) failed to allocate bo for manager\n", r);
@@ -317,7 +318,7 @@ int radeon_sa_bo_new(struct radeon_device *rdev,
317 unsigned tries[RADEON_NUM_RINGS]; 318 unsigned tries[RADEON_NUM_RINGS];
318 int i, r; 319 int i, r;
319 320
320 BUG_ON(align > RADEON_GPU_PAGE_SIZE); 321 BUG_ON(align > sa_manager->align);
321 BUG_ON(size > sa_manager->size); 322 BUG_ON(size > sa_manager->size);
322 323
323 *sa_bo = kmalloc(sizeof(struct radeon_sa_bo), GFP_KERNEL); 324 *sa_bo = kmalloc(sizeof(struct radeon_sa_bo), GFP_KERNEL);
diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c
index 41efcec28cd8..414fd145d20e 100644
--- a/drivers/gpu/drm/radeon/radeon_uvd.c
+++ b/drivers/gpu/drm/radeon/radeon_uvd.c
@@ -56,20 +56,13 @@ static void radeon_uvd_idle_work_handler(struct work_struct *work);
56 56
57int radeon_uvd_init(struct radeon_device *rdev) 57int radeon_uvd_init(struct radeon_device *rdev)
58{ 58{
59 struct platform_device *pdev; 59 const struct firmware *fw;
60 unsigned long bo_size; 60 unsigned long bo_size;
61 const char *fw_name; 61 const char *fw_name;
62 int i, r; 62 int i, r;
63 63
64 INIT_DELAYED_WORK(&rdev->uvd.idle_work, radeon_uvd_idle_work_handler); 64 INIT_DELAYED_WORK(&rdev->uvd.idle_work, radeon_uvd_idle_work_handler);
65 65
66 pdev = platform_device_register_simple("radeon_uvd", 0, NULL, 0);
67 r = IS_ERR(pdev);
68 if (r) {
69 dev_err(rdev->dev, "radeon_uvd: Failed to register firmware\n");
70 return -EINVAL;
71 }
72
73 switch (rdev->family) { 66 switch (rdev->family) {
74 case CHIP_RV710: 67 case CHIP_RV710:
75 case CHIP_RV730: 68 case CHIP_RV730:
@@ -112,17 +105,14 @@ int radeon_uvd_init(struct radeon_device *rdev)
112 return -EINVAL; 105 return -EINVAL;
113 } 106 }
114 107
115 r = request_firmware(&rdev->uvd_fw, fw_name, &pdev->dev); 108 r = request_firmware(&fw, fw_name, rdev->dev);
116 if (r) { 109 if (r) {
117 dev_err(rdev->dev, "radeon_uvd: Can't load firmware \"%s\"\n", 110 dev_err(rdev->dev, "radeon_uvd: Can't load firmware \"%s\"\n",
118 fw_name); 111 fw_name);
119 platform_device_unregister(pdev);
120 return r; 112 return r;
121 } 113 }
122 114
123 platform_device_unregister(pdev); 115 bo_size = RADEON_GPU_PAGE_ALIGN(fw->size + 8) +
124
125 bo_size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 8) +
126 RADEON_UVD_STACK_SIZE + RADEON_UVD_HEAP_SIZE; 116 RADEON_UVD_STACK_SIZE + RADEON_UVD_HEAP_SIZE;
127 r = radeon_bo_create(rdev, bo_size, PAGE_SIZE, true, 117 r = radeon_bo_create(rdev, bo_size, PAGE_SIZE, true,
128 RADEON_GEM_DOMAIN_VRAM, NULL, &rdev->uvd.vcpu_bo); 118 RADEON_GEM_DOMAIN_VRAM, NULL, &rdev->uvd.vcpu_bo);
@@ -131,16 +121,35 @@ int radeon_uvd_init(struct radeon_device *rdev)
131 return r; 121 return r;
132 } 122 }
133 123
134 r = radeon_uvd_resume(rdev); 124 r = radeon_bo_reserve(rdev->uvd.vcpu_bo, false);
135 if (r) 125 if (r) {
126 radeon_bo_unref(&rdev->uvd.vcpu_bo);
127 dev_err(rdev->dev, "(%d) failed to reserve UVD bo\n", r);
136 return r; 128 return r;
129 }
137 130
138 memset(rdev->uvd.cpu_addr, 0, bo_size); 131 r = radeon_bo_pin(rdev->uvd.vcpu_bo, RADEON_GEM_DOMAIN_VRAM,
139 memcpy(rdev->uvd.cpu_addr, rdev->uvd_fw->data, rdev->uvd_fw->size); 132 &rdev->uvd.gpu_addr);
133 if (r) {
134 radeon_bo_unreserve(rdev->uvd.vcpu_bo);
135 radeon_bo_unref(&rdev->uvd.vcpu_bo);
136 dev_err(rdev->dev, "(%d) UVD bo pin failed\n", r);
137 return r;
138 }
140 139
141 r = radeon_uvd_suspend(rdev); 140 r = radeon_bo_kmap(rdev->uvd.vcpu_bo, &rdev->uvd.cpu_addr);
142 if (r) 141 if (r) {
142 dev_err(rdev->dev, "(%d) UVD map failed\n", r);
143 return r; 143 return r;
144 }
145
146 radeon_bo_unreserve(rdev->uvd.vcpu_bo);
147
148 rdev->uvd.fw_size = fw->size;
149 memset(rdev->uvd.cpu_addr, 0, bo_size);
150 memcpy(rdev->uvd.cpu_addr, fw->data, fw->size);
151
152 release_firmware(fw);
144 153
145 for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) { 154 for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) {
146 atomic_set(&rdev->uvd.handles[i], 0); 155 atomic_set(&rdev->uvd.handles[i], 0);
@@ -152,71 +161,47 @@ int radeon_uvd_init(struct radeon_device *rdev)
152 161
153void radeon_uvd_fini(struct radeon_device *rdev) 162void radeon_uvd_fini(struct radeon_device *rdev)
154{ 163{
155 radeon_uvd_suspend(rdev);
156 radeon_bo_unref(&rdev->uvd.vcpu_bo);
157}
158
159int radeon_uvd_suspend(struct radeon_device *rdev)
160{
161 int r; 164 int r;
162 165
163 if (rdev->uvd.vcpu_bo == NULL) 166 if (rdev->uvd.vcpu_bo == NULL)
164 return 0; 167 return;
165 168
166 r = radeon_bo_reserve(rdev->uvd.vcpu_bo, false); 169 r = radeon_bo_reserve(rdev->uvd.vcpu_bo, false);
167 if (!r) { 170 if (!r) {
168 radeon_bo_kunmap(rdev->uvd.vcpu_bo); 171 radeon_bo_kunmap(rdev->uvd.vcpu_bo);
169 radeon_bo_unpin(rdev->uvd.vcpu_bo); 172 radeon_bo_unpin(rdev->uvd.vcpu_bo);
170 rdev->uvd.cpu_addr = NULL;
171 if (!radeon_bo_pin(rdev->uvd.vcpu_bo, RADEON_GEM_DOMAIN_CPU, NULL)) {
172 radeon_bo_kmap(rdev->uvd.vcpu_bo, &rdev->uvd.cpu_addr);
173 }
174 radeon_bo_unreserve(rdev->uvd.vcpu_bo); 173 radeon_bo_unreserve(rdev->uvd.vcpu_bo);
175
176 if (rdev->uvd.cpu_addr) {
177 radeon_fence_driver_start_ring(rdev, R600_RING_TYPE_UVD_INDEX);
178 } else {
179 rdev->fence_drv[R600_RING_TYPE_UVD_INDEX].cpu_addr = NULL;
180 }
181 } 174 }
182 return r; 175
176 radeon_bo_unref(&rdev->uvd.vcpu_bo);
183} 177}
184 178
185int radeon_uvd_resume(struct radeon_device *rdev) 179int radeon_uvd_suspend(struct radeon_device *rdev)
186{ 180{
187 int r; 181 unsigned size;
188 182
189 if (rdev->uvd.vcpu_bo == NULL) 183 if (rdev->uvd.vcpu_bo == NULL)
190 return -EINVAL; 184 return 0;
191 185
192 r = radeon_bo_reserve(rdev->uvd.vcpu_bo, false); 186 size = radeon_bo_size(rdev->uvd.vcpu_bo);
193 if (r) { 187 rdev->uvd.saved_bo = kmalloc(size, GFP_KERNEL);
194 radeon_bo_unref(&rdev->uvd.vcpu_bo); 188 memcpy(rdev->uvd.saved_bo, rdev->uvd.cpu_addr, size);
195 dev_err(rdev->dev, "(%d) failed to reserve UVD bo\n", r);
196 return r;
197 }
198 189
199 /* Have been pin in cpu unmap unpin */ 190 return 0;
200 radeon_bo_kunmap(rdev->uvd.vcpu_bo); 191}
201 radeon_bo_unpin(rdev->uvd.vcpu_bo);
202 192
203 r = radeon_bo_pin(rdev->uvd.vcpu_bo, RADEON_GEM_DOMAIN_VRAM, 193int radeon_uvd_resume(struct radeon_device *rdev)
204 &rdev->uvd.gpu_addr); 194{
205 if (r) { 195 if (rdev->uvd.vcpu_bo == NULL)
206 radeon_bo_unreserve(rdev->uvd.vcpu_bo); 196 return -EINVAL;
207 radeon_bo_unref(&rdev->uvd.vcpu_bo);
208 dev_err(rdev->dev, "(%d) UVD bo pin failed\n", r);
209 return r;
210 }
211 197
212 r = radeon_bo_kmap(rdev->uvd.vcpu_bo, &rdev->uvd.cpu_addr); 198 if (rdev->uvd.saved_bo != NULL) {
213 if (r) { 199 unsigned size = radeon_bo_size(rdev->uvd.vcpu_bo);
214 dev_err(rdev->dev, "(%d) UVD map failed\n", r); 200 memcpy(rdev->uvd.cpu_addr, rdev->uvd.saved_bo, size);
215 return r; 201 kfree(rdev->uvd.saved_bo);
202 rdev->uvd.saved_bo = NULL;
216 } 203 }
217 204
218 radeon_bo_unreserve(rdev->uvd.vcpu_bo);
219
220 return 0; 205 return 0;
221} 206}
222 207
diff --git a/drivers/gpu/drm/radeon/rs780_dpm.c b/drivers/gpu/drm/radeon/rs780_dpm.c
index bef832a62fee..d1a1ce73bd45 100644
--- a/drivers/gpu/drm/radeon/rs780_dpm.c
+++ b/drivers/gpu/drm/radeon/rs780_dpm.c
@@ -28,6 +28,7 @@
28#include "r600_dpm.h" 28#include "r600_dpm.h"
29#include "rs780_dpm.h" 29#include "rs780_dpm.h"
30#include "atom.h" 30#include "atom.h"
31#include <linux/seq_file.h>
31 32
32static struct igp_ps *rs780_get_ps(struct radeon_ps *rps) 33static struct igp_ps *rs780_get_ps(struct radeon_ps *rps)
33{ 34{
@@ -961,3 +962,27 @@ u32 rs780_dpm_get_mclk(struct radeon_device *rdev, bool low)
961 962
962 return pi->bootup_uma_clk; 963 return pi->bootup_uma_clk;
963} 964}
965
966void rs780_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev,
967 struct seq_file *m)
968{
969 struct radeon_ps *rps = rdev->pm.dpm.current_ps;
970 struct igp_ps *ps = rs780_get_ps(rps);
971 u32 current_fb_div = RREG32(FVTHROT_STATUS_REG0) & CURRENT_FEEDBACK_DIV_MASK;
972 u32 func_cntl = RREG32(CG_SPLL_FUNC_CNTL);
973 u32 ref_div = ((func_cntl & SPLL_REF_DIV_MASK) >> SPLL_REF_DIV_SHIFT) + 1;
974 u32 post_div = ((func_cntl & SPLL_SW_HILEN_MASK) >> SPLL_SW_HILEN_SHIFT) + 1 +
975 ((func_cntl & SPLL_SW_LOLEN_MASK) >> SPLL_SW_LOLEN_SHIFT) + 1;
976 u32 sclk = (rdev->clock.spll.reference_freq * current_fb_div) /
977 (post_div * ref_div);
978
979 seq_printf(m, "uvd vclk: %d dclk: %d\n", rps->vclk, rps->dclk);
980
981 /* guess based on the current sclk */
982 if (sclk < (ps->sclk_low + 500))
983 seq_printf(m, "power level 0 sclk: %u vddc_index: %d\n",
984 ps->sclk_low, ps->min_voltage);
985 else
986 seq_printf(m, "power level 1 sclk: %u vddc_index: %d\n",
987 ps->sclk_high, ps->max_voltage);
988}
diff --git a/drivers/gpu/drm/radeon/rs780d.h b/drivers/gpu/drm/radeon/rs780d.h
index b1142ed1c628..cfbe9a43d97b 100644
--- a/drivers/gpu/drm/radeon/rs780d.h
+++ b/drivers/gpu/drm/radeon/rs780d.h
@@ -28,6 +28,7 @@
28# define SPLL_SLEEP (1 << 1) 28# define SPLL_SLEEP (1 << 1)
29# define SPLL_REF_DIV(x) ((x) << 2) 29# define SPLL_REF_DIV(x) ((x) << 2)
30# define SPLL_REF_DIV_MASK (7 << 2) 30# define SPLL_REF_DIV_MASK (7 << 2)
31# define SPLL_REF_DIV_SHIFT 2
31# define SPLL_FB_DIV(x) ((x) << 5) 32# define SPLL_FB_DIV(x) ((x) << 5)
32# define SPLL_FB_DIV_MASK (0xff << 2) 33# define SPLL_FB_DIV_MASK (0xff << 2)
33# define SPLL_FB_DIV_SHIFT 2 34# define SPLL_FB_DIV_SHIFT 2
@@ -36,8 +37,10 @@
36# define SPLL_PULSENUM_MASK (3 << 14) 37# define SPLL_PULSENUM_MASK (3 << 14)
37# define SPLL_SW_HILEN(x) ((x) << 16) 38# define SPLL_SW_HILEN(x) ((x) << 16)
38# define SPLL_SW_HILEN_MASK (0xf << 16) 39# define SPLL_SW_HILEN_MASK (0xf << 16)
40# define SPLL_SW_HILEN_SHIFT 16
39# define SPLL_SW_LOLEN(x) ((x) << 20) 41# define SPLL_SW_LOLEN(x) ((x) << 20)
40# define SPLL_SW_LOLEN_MASK (0xf << 20) 42# define SPLL_SW_LOLEN_MASK (0xf << 20)
43# define SPLL_SW_LOLEN_SHIFT 20
41# define SPLL_DIVEN (1 << 24) 44# define SPLL_DIVEN (1 << 24)
42# define SPLL_BYPASS_EN (1 << 25) 45# define SPLL_BYPASS_EN (1 << 25)
43# define SPLL_CHG_STATUS (1 << 29) 46# define SPLL_CHG_STATUS (1 << 29)
diff --git a/drivers/gpu/drm/radeon/rv6xx_dpm.c b/drivers/gpu/drm/radeon/rv6xx_dpm.c
index 8303de267ee5..65e33f387341 100644
--- a/drivers/gpu/drm/radeon/rv6xx_dpm.c
+++ b/drivers/gpu/drm/radeon/rv6xx_dpm.c
@@ -1763,12 +1763,14 @@ void rv6xx_setup_asic(struct radeon_device *rdev)
1763{ 1763{
1764 r600_enable_acpi_pm(rdev); 1764 r600_enable_acpi_pm(rdev);
1765 1765
1766 if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_ASPM_L0s) 1766 if (radeon_aspm != 0) {
1767 rv6xx_enable_l0s(rdev); 1767 if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_ASPM_L0s)
1768 if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_ASPM_L1) 1768 rv6xx_enable_l0s(rdev);
1769 rv6xx_enable_l1(rdev); 1769 if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_ASPM_L1)
1770 if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_TURNOFFPLL_ASPML1) 1770 rv6xx_enable_l1(rdev);
1771 rv6xx_enable_pll_sleep_in_l1(rdev); 1771 if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_TURNOFFPLL_ASPML1)
1772 rv6xx_enable_pll_sleep_in_l1(rdev);
1773 }
1772} 1774}
1773 1775
1774void rv6xx_dpm_display_configuration_changed(struct radeon_device *rdev) 1776void rv6xx_dpm_display_configuration_changed(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 4a62ad2e5399..30ea14e8854c 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -813,7 +813,7 @@ int rv770_uvd_resume(struct radeon_device *rdev)
813 813
814 /* programm the VCPU memory controller bits 0-27 */ 814 /* programm the VCPU memory controller bits 0-27 */
815 addr = rdev->uvd.gpu_addr >> 3; 815 addr = rdev->uvd.gpu_addr >> 3;
816 size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 4) >> 3; 816 size = RADEON_GPU_PAGE_ALIGN(rdev->uvd.fw_size + 4) >> 3;
817 WREG32(UVD_VCPU_CACHE_OFFSET0, addr); 817 WREG32(UVD_VCPU_CACHE_OFFSET0, addr);
818 WREG32(UVD_VCPU_CACHE_SIZE0, size); 818 WREG32(UVD_VCPU_CACHE_SIZE0, size);
819 819
diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c b/drivers/gpu/drm/radeon/rv770_dpm.c
index d914e04ea39a..2d347925f77d 100644
--- a/drivers/gpu/drm/radeon/rv770_dpm.c
+++ b/drivers/gpu/drm/radeon/rv770_dpm.c
@@ -2099,12 +2099,14 @@ void rv770_dpm_setup_asic(struct radeon_device *rdev)
2099 2099
2100 rv770_enable_acpi_pm(rdev); 2100 rv770_enable_acpi_pm(rdev);
2101 2101
2102 if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_ASPM_L0s) 2102 if (radeon_aspm != 0) {
2103 rv770_enable_l0s(rdev); 2103 if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_ASPM_L0s)
2104 if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_ASPM_L1) 2104 rv770_enable_l0s(rdev);
2105 rv770_enable_l1(rdev); 2105 if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_ASPM_L1)
2106 if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_TURNOFFPLL_ASPML1) 2106 rv770_enable_l1(rdev);
2107 rv770_enable_pll_sleep_in_l1(rdev); 2107 if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_TURNOFFPLL_ASPML1)
2108 rv770_enable_pll_sleep_in_l1(rdev);
2109 }
2108} 2110}
2109 2111
2110void rv770_dpm_display_configuration_changed(struct radeon_device *rdev) 2112void rv770_dpm_display_configuration_changed(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index 234906709067..d325280e2f9f 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -22,7 +22,6 @@
22 * Authors: Alex Deucher 22 * Authors: Alex Deucher
23 */ 23 */
24#include <linux/firmware.h> 24#include <linux/firmware.h>
25#include <linux/platform_device.h>
26#include <linux/slab.h> 25#include <linux/slab.h>
27#include <linux/module.h> 26#include <linux/module.h>
28#include <drm/drmP.h> 27#include <drm/drmP.h>
@@ -1541,7 +1540,6 @@ static int si_mc_load_microcode(struct radeon_device *rdev)
1541 1540
1542static int si_init_microcode(struct radeon_device *rdev) 1541static int si_init_microcode(struct radeon_device *rdev)
1543{ 1542{
1544 struct platform_device *pdev;
1545 const char *chip_name; 1543 const char *chip_name;
1546 const char *rlc_chip_name; 1544 const char *rlc_chip_name;
1547 size_t pfp_req_size, me_req_size, ce_req_size, rlc_req_size, mc_req_size; 1545 size_t pfp_req_size, me_req_size, ce_req_size, rlc_req_size, mc_req_size;
@@ -1551,13 +1549,6 @@ static int si_init_microcode(struct radeon_device *rdev)
1551 1549
1552 DRM_DEBUG("\n"); 1550 DRM_DEBUG("\n");
1553 1551
1554 pdev = platform_device_register_simple("radeon_cp", 0, NULL, 0);
1555 err = IS_ERR(pdev);
1556 if (err) {
1557 printk(KERN_ERR "radeon_cp: Failed to register firmware\n");
1558 return -EINVAL;
1559 }
1560
1561 switch (rdev->family) { 1552 switch (rdev->family) {
1562 case CHIP_TAHITI: 1553 case CHIP_TAHITI:
1563 chip_name = "TAHITI"; 1554 chip_name = "TAHITI";
@@ -1615,7 +1606,7 @@ static int si_init_microcode(struct radeon_device *rdev)
1615 DRM_INFO("Loading %s Microcode\n", chip_name); 1606 DRM_INFO("Loading %s Microcode\n", chip_name);
1616 1607
1617 snprintf(fw_name, sizeof(fw_name), "radeon/%s_pfp.bin", chip_name); 1608 snprintf(fw_name, sizeof(fw_name), "radeon/%s_pfp.bin", chip_name);
1618 err = request_firmware(&rdev->pfp_fw, fw_name, &pdev->dev); 1609 err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev);
1619 if (err) 1610 if (err)
1620 goto out; 1611 goto out;
1621 if (rdev->pfp_fw->size != pfp_req_size) { 1612 if (rdev->pfp_fw->size != pfp_req_size) {
@@ -1627,7 +1618,7 @@ static int si_init_microcode(struct radeon_device *rdev)
1627 } 1618 }
1628 1619
1629 snprintf(fw_name, sizeof(fw_name), "radeon/%s_me.bin", chip_name); 1620 snprintf(fw_name, sizeof(fw_name), "radeon/%s_me.bin", chip_name);
1630 err = request_firmware(&rdev->me_fw, fw_name, &pdev->dev); 1621 err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
1631 if (err) 1622 if (err)
1632 goto out; 1623 goto out;
1633 if (rdev->me_fw->size != me_req_size) { 1624 if (rdev->me_fw->size != me_req_size) {
@@ -1638,7 +1629,7 @@ static int si_init_microcode(struct radeon_device *rdev)
1638 } 1629 }
1639 1630
1640 snprintf(fw_name, sizeof(fw_name), "radeon/%s_ce.bin", chip_name); 1631 snprintf(fw_name, sizeof(fw_name), "radeon/%s_ce.bin", chip_name);
1641 err = request_firmware(&rdev->ce_fw, fw_name, &pdev->dev); 1632 err = request_firmware(&rdev->ce_fw, fw_name, rdev->dev);
1642 if (err) 1633 if (err)
1643 goto out; 1634 goto out;
1644 if (rdev->ce_fw->size != ce_req_size) { 1635 if (rdev->ce_fw->size != ce_req_size) {
@@ -1649,7 +1640,7 @@ static int si_init_microcode(struct radeon_device *rdev)
1649 } 1640 }
1650 1641
1651 snprintf(fw_name, sizeof(fw_name), "radeon/%s_rlc.bin", rlc_chip_name); 1642 snprintf(fw_name, sizeof(fw_name), "radeon/%s_rlc.bin", rlc_chip_name);
1652 err = request_firmware(&rdev->rlc_fw, fw_name, &pdev->dev); 1643 err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev);
1653 if (err) 1644 if (err)
1654 goto out; 1645 goto out;
1655 if (rdev->rlc_fw->size != rlc_req_size) { 1646 if (rdev->rlc_fw->size != rlc_req_size) {
@@ -1660,7 +1651,7 @@ static int si_init_microcode(struct radeon_device *rdev)
1660 } 1651 }
1661 1652
1662 snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); 1653 snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name);
1663 err = request_firmware(&rdev->mc_fw, fw_name, &pdev->dev); 1654 err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev);
1664 if (err) 1655 if (err)
1665 goto out; 1656 goto out;
1666 if (rdev->mc_fw->size != mc_req_size) { 1657 if (rdev->mc_fw->size != mc_req_size) {
@@ -1671,7 +1662,7 @@ static int si_init_microcode(struct radeon_device *rdev)
1671 } 1662 }
1672 1663
1673 snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); 1664 snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name);
1674 err = request_firmware(&rdev->smc_fw, fw_name, &pdev->dev); 1665 err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
1675 if (err) 1666 if (err)
1676 goto out; 1667 goto out;
1677 if (rdev->smc_fw->size != smc_req_size) { 1668 if (rdev->smc_fw->size != smc_req_size) {
@@ -1682,8 +1673,6 @@ static int si_init_microcode(struct radeon_device *rdev)
1682 } 1673 }
1683 1674
1684out: 1675out:
1685 platform_device_unregister(pdev);
1686
1687 if (err) { 1676 if (err) {
1688 if (err != -EINVAL) 1677 if (err != -EINVAL)
1689 printk(KERN_ERR 1678 printk(KERN_ERR
@@ -4401,6 +4390,270 @@ void si_vm_fini(struct radeon_device *rdev)
4401} 4390}
4402 4391
4403/** 4392/**
4393 * si_vm_decode_fault - print human readable fault info
4394 *
4395 * @rdev: radeon_device pointer
4396 * @status: VM_CONTEXT1_PROTECTION_FAULT_STATUS register value
4397 * @addr: VM_CONTEXT1_PROTECTION_FAULT_ADDR register value
4398 *
4399 * Print human readable fault information (SI).
4400 */
4401static void si_vm_decode_fault(struct radeon_device *rdev,
4402 u32 status, u32 addr)
4403{
4404 u32 mc_id = (status & MEMORY_CLIENT_ID_MASK) >> MEMORY_CLIENT_ID_SHIFT;
4405 u32 vmid = (status & FAULT_VMID_MASK) >> FAULT_VMID_SHIFT;
4406 u32 protections = (status & PROTECTIONS_MASK) >> PROTECTIONS_SHIFT;
4407 char *block;
4408
4409 if (rdev->family == CHIP_TAHITI) {
4410 switch (mc_id) {
4411 case 160:
4412 case 144:
4413 case 96:
4414 case 80:
4415 case 224:
4416 case 208:
4417 case 32:
4418 case 16:
4419 block = "CB";
4420 break;
4421 case 161:
4422 case 145:
4423 case 97:
4424 case 81:
4425 case 225:
4426 case 209:
4427 case 33:
4428 case 17:
4429 block = "CB_FMASK";
4430 break;
4431 case 162:
4432 case 146:
4433 case 98:
4434 case 82:
4435 case 226:
4436 case 210:
4437 case 34:
4438 case 18:
4439 block = "CB_CMASK";
4440 break;
4441 case 163:
4442 case 147:
4443 case 99:
4444 case 83:
4445 case 227:
4446 case 211:
4447 case 35:
4448 case 19:
4449 block = "CB_IMMED";
4450 break;
4451 case 164:
4452 case 148:
4453 case 100:
4454 case 84:
4455 case 228:
4456 case 212:
4457 case 36:
4458 case 20:
4459 block = "DB";
4460 break;
4461 case 165:
4462 case 149:
4463 case 101:
4464 case 85:
4465 case 229:
4466 case 213:
4467 case 37:
4468 case 21:
4469 block = "DB_HTILE";
4470 break;
4471 case 167:
4472 case 151:
4473 case 103:
4474 case 87:
4475 case 231:
4476 case 215:
4477 case 39:
4478 case 23:
4479 block = "DB_STEN";
4480 break;
4481 case 72:
4482 case 68:
4483 case 64:
4484 case 8:
4485 case 4:
4486 case 0:
4487 case 136:
4488 case 132:
4489 case 128:
4490 case 200:
4491 case 196:
4492 case 192:
4493 block = "TC";
4494 break;
4495 case 112:
4496 case 48:
4497 block = "CP";
4498 break;
4499 case 49:
4500 case 177:
4501 case 50:
4502 case 178:
4503 block = "SH";
4504 break;
4505 case 53:
4506 case 190:
4507 block = "VGT";
4508 break;
4509 case 117:
4510 block = "IH";
4511 break;
4512 case 51:
4513 case 115:
4514 block = "RLC";
4515 break;
4516 case 119:
4517 case 183:
4518 block = "DMA0";
4519 break;
4520 case 61:
4521 block = "DMA1";
4522 break;
4523 case 248:
4524 case 120:
4525 block = "HDP";
4526 break;
4527 default:
4528 block = "unknown";
4529 break;
4530 }
4531 } else {
4532 switch (mc_id) {
4533 case 32:
4534 case 16:
4535 case 96:
4536 case 80:
4537 case 160:
4538 case 144:
4539 case 224:
4540 case 208:
4541 block = "CB";
4542 break;
4543 case 33:
4544 case 17:
4545 case 97:
4546 case 81:
4547 case 161:
4548 case 145:
4549 case 225:
4550 case 209:
4551 block = "CB_FMASK";
4552 break;
4553 case 34:
4554 case 18:
4555 case 98:
4556 case 82:
4557 case 162:
4558 case 146:
4559 case 226:
4560 case 210:
4561 block = "CB_CMASK";
4562 break;
4563 case 35:
4564 case 19:
4565 case 99:
4566 case 83:
4567 case 163:
4568 case 147:
4569 case 227:
4570 case 211:
4571 block = "CB_IMMED";
4572 break;
4573 case 36:
4574 case 20:
4575 case 100:
4576 case 84:
4577 case 164:
4578 case 148:
4579 case 228:
4580 case 212:
4581 block = "DB";
4582 break;
4583 case 37:
4584 case 21:
4585 case 101:
4586 case 85:
4587 case 165:
4588 case 149:
4589 case 229:
4590 case 213:
4591 block = "DB_HTILE";
4592 break;
4593 case 39:
4594 case 23:
4595 case 103:
4596 case 87:
4597 case 167:
4598 case 151:
4599 case 231:
4600 case 215:
4601 block = "DB_STEN";
4602 break;
4603 case 72:
4604 case 68:
4605 case 8:
4606 case 4:
4607 case 136:
4608 case 132:
4609 case 200:
4610 case 196:
4611 block = "TC";
4612 break;
4613 case 112:
4614 case 48:
4615 block = "CP";
4616 break;
4617 case 49:
4618 case 177:
4619 case 50:
4620 case 178:
4621 block = "SH";
4622 break;
4623 case 53:
4624 block = "VGT";
4625 break;
4626 case 117:
4627 block = "IH";
4628 break;
4629 case 51:
4630 case 115:
4631 block = "RLC";
4632 break;
4633 case 119:
4634 case 183:
4635 block = "DMA0";
4636 break;
4637 case 61:
4638 block = "DMA1";
4639 break;
4640 case 248:
4641 case 120:
4642 block = "HDP";
4643 break;
4644 default:
4645 block = "unknown";
4646 break;
4647 }
4648 }
4649
4650 printk("VM fault (0x%02x, vmid %d) at page %u, %s from %s (%d)\n",
4651 protections, vmid, addr,
4652 (status & MEMORY_CLIENT_RW_MASK) ? "write" : "read",
4653 block, mc_id);
4654}
4655
4656/**
4404 * si_vm_set_page - update the page tables using the CP 4657 * si_vm_set_page - update the page tables using the CP
4405 * 4658 *
4406 * @rdev: radeon_device pointer 4659 * @rdev: radeon_device pointer
@@ -5766,6 +6019,7 @@ int si_irq_process(struct radeon_device *rdev)
5766 u32 ring_index; 6019 u32 ring_index;
5767 bool queue_hotplug = false; 6020 bool queue_hotplug = false;
5768 bool queue_thermal = false; 6021 bool queue_thermal = false;
6022 u32 status, addr;
5769 6023
5770 if (!rdev->ih.enabled || rdev->shutdown) 6024 if (!rdev->ih.enabled || rdev->shutdown)
5771 return IRQ_NONE; 6025 return IRQ_NONE;
@@ -6001,11 +6255,14 @@ restart_ih:
6001 break; 6255 break;
6002 case 146: 6256 case 146:
6003 case 147: 6257 case 147:
6258 addr = RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR);
6259 status = RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS);
6004 dev_err(rdev->dev, "GPU fault detected: %d 0x%08x\n", src_id, src_data); 6260 dev_err(rdev->dev, "GPU fault detected: %d 0x%08x\n", src_id, src_data);
6005 dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", 6261 dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n",
6006 RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR)); 6262 addr);
6007 dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", 6263 dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n",
6008 RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS)); 6264 status);
6265 si_vm_decode_fault(rdev, status, addr);
6009 /* reset addr and status */ 6266 /* reset addr and status */
6010 WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1); 6267 WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1);
6011 break; 6268 break;
@@ -6796,6 +7053,9 @@ static void si_program_aspm(struct radeon_device *rdev)
6796 bool disable_l0s = false, disable_l1 = false, disable_plloff_in_l1 = false; 7053 bool disable_l0s = false, disable_l1 = false, disable_plloff_in_l1 = false;
6797 bool disable_clkreq = false; 7054 bool disable_clkreq = false;
6798 7055
7056 if (radeon_aspm == 0)
7057 return;
7058
6799 if (!(rdev->flags & RADEON_IS_PCIE)) 7059 if (!(rdev->flags & RADEON_IS_PCIE))
6800 return; 7060 return;
6801 7061
diff --git a/drivers/gpu/drm/radeon/sid.h b/drivers/gpu/drm/radeon/sid.h
index 12a20eb77d0c..2c8da27a929f 100644
--- a/drivers/gpu/drm/radeon/sid.h
+++ b/drivers/gpu/drm/radeon/sid.h
@@ -367,6 +367,20 @@
367 367
368#define VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x14FC 368#define VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x14FC
369#define VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x14DC 369#define VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x14DC
370#define PROTECTIONS_MASK (0xf << 0)
371#define PROTECTIONS_SHIFT 0
372 /* bit 0: range
373 * bit 1: pde0
374 * bit 2: valid
375 * bit 3: read
376 * bit 4: write
377 */
378#define MEMORY_CLIENT_ID_MASK (0xff << 12)
379#define MEMORY_CLIENT_ID_SHIFT 12
380#define MEMORY_CLIENT_RW_MASK (1 << 24)
381#define MEMORY_CLIENT_RW_SHIFT 24
382#define FAULT_VMID_MASK (0xf << 25)
383#define FAULT_VMID_SHIFT 25
370 384
371#define VM_INVALIDATE_REQUEST 0x1478 385#define VM_INVALIDATE_REQUEST 0x1478
372#define VM_INVALIDATE_RESPONSE 0x147c 386#define VM_INVALIDATE_RESPONSE 0x147c
diff --git a/drivers/gpu/drm/radeon/sumo_dpm.c b/drivers/gpu/drm/radeon/sumo_dpm.c
index 11b6b9924f1b..c0a850319908 100644
--- a/drivers/gpu/drm/radeon/sumo_dpm.c
+++ b/drivers/gpu/drm/radeon/sumo_dpm.c
@@ -1732,7 +1732,13 @@ int sumo_dpm_init(struct radeon_device *rdev)
1732 pi->enable_sclk_ds = true; 1732 pi->enable_sclk_ds = true;
1733 pi->enable_dynamic_m3_arbiter = false; 1733 pi->enable_dynamic_m3_arbiter = false;
1734 pi->enable_dynamic_patch_ps = true; 1734 pi->enable_dynamic_patch_ps = true;
1735 pi->enable_gfx_power_gating = true; 1735 /* Some PALM chips don't seem to properly ungate gfx when UVD is in use;
1736 * for now just disable gfx PG.
1737 */
1738 if (rdev->family == CHIP_PALM)
1739 pi->enable_gfx_power_gating = false;
1740 else
1741 pi->enable_gfx_power_gating = true;
1736 pi->enable_gfx_clock_gating = true; 1742 pi->enable_gfx_clock_gating = true;
1737 pi->enable_mg_clock_gating = true; 1743 pi->enable_mg_clock_gating = true;
1738 pi->enable_auto_thermal_throttling = true; 1744 pi->enable_auto_thermal_throttling = true;
@@ -1845,6 +1851,8 @@ int sumo_dpm_force_performance_level(struct radeon_device *rdev,
1845 return 0; 1851 return 0;
1846 1852
1847 if (level == RADEON_DPM_FORCED_LEVEL_HIGH) { 1853 if (level == RADEON_DPM_FORCED_LEVEL_HIGH) {
1854 if (pi->enable_boost)
1855 sumo_enable_boost(rdev, rps, false);
1848 sumo_power_level_enable(rdev, ps->num_levels - 1, true); 1856 sumo_power_level_enable(rdev, ps->num_levels - 1, true);
1849 sumo_set_forced_level(rdev, ps->num_levels - 1); 1857 sumo_set_forced_level(rdev, ps->num_levels - 1);
1850 sumo_set_forced_mode_enabled(rdev); 1858 sumo_set_forced_mode_enabled(rdev);
@@ -1855,6 +1863,8 @@ int sumo_dpm_force_performance_level(struct radeon_device *rdev,
1855 sumo_set_forced_mode_enabled(rdev); 1863 sumo_set_forced_mode_enabled(rdev);
1856 sumo_set_forced_mode(rdev, false); 1864 sumo_set_forced_mode(rdev, false);
1857 } else if (level == RADEON_DPM_FORCED_LEVEL_LOW) { 1865 } else if (level == RADEON_DPM_FORCED_LEVEL_LOW) {
1866 if (pi->enable_boost)
1867 sumo_enable_boost(rdev, rps, false);
1858 sumo_power_level_enable(rdev, 0, true); 1868 sumo_power_level_enable(rdev, 0, true);
1859 sumo_set_forced_level(rdev, 0); 1869 sumo_set_forced_level(rdev, 0);
1860 sumo_set_forced_mode_enabled(rdev); 1870 sumo_set_forced_mode_enabled(rdev);
@@ -1868,6 +1878,8 @@ int sumo_dpm_force_performance_level(struct radeon_device *rdev,
1868 for (i = 0; i < ps->num_levels; i++) { 1878 for (i = 0; i < ps->num_levels; i++) {
1869 sumo_power_level_enable(rdev, i, true); 1879 sumo_power_level_enable(rdev, i, true);
1870 } 1880 }
1881 if (pi->enable_boost)
1882 sumo_enable_boost(rdev, rps, true);
1871 } 1883 }
1872 1884
1873 rdev->pm.dpm.forced_level = level; 1885 rdev->pm.dpm.forced_level = level;
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index ff82877de876..dc0fe09b2ba1 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -249,8 +249,13 @@ static struct drm_driver rcar_du_driver = {
249 .gem_vm_ops = &drm_gem_cma_vm_ops, 249 .gem_vm_ops = &drm_gem_cma_vm_ops,
250 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 250 .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
251 .prime_fd_to_handle = drm_gem_prime_fd_to_handle, 251 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
252 .gem_prime_import = drm_gem_cma_dmabuf_import, 252 .gem_prime_import = drm_gem_prime_import,
253 .gem_prime_export = drm_gem_cma_dmabuf_export, 253 .gem_prime_export = drm_gem_prime_export,
254 .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
255 .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
256 .gem_prime_vmap = drm_gem_cma_prime_vmap,
257 .gem_prime_vunmap = drm_gem_cma_prime_vunmap,
258 .gem_prime_mmap = drm_gem_cma_prime_mmap,
254 .dumb_create = rcar_du_dumb_create, 259 .dumb_create = rcar_du_dumb_create,
255 .dumb_map_offset = drm_gem_cma_dumb_map_offset, 260 .dumb_map_offset = drm_gem_cma_dumb_map_offset,
256 .dumb_destroy = drm_gem_cma_dumb_destroy, 261 .dumb_destroy = drm_gem_cma_dumb_destroy,
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
index edc10181f551..5f83f9a3ef59 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
@@ -276,8 +276,13 @@ static struct drm_driver shmob_drm_driver = {
276 .gem_vm_ops = &drm_gem_cma_vm_ops, 276 .gem_vm_ops = &drm_gem_cma_vm_ops,
277 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 277 .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
278 .prime_fd_to_handle = drm_gem_prime_fd_to_handle, 278 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
279 .gem_prime_import = drm_gem_cma_dmabuf_import, 279 .gem_prime_import = drm_gem_prime_import,
280 .gem_prime_export = drm_gem_cma_dmabuf_export, 280 .gem_prime_export = drm_gem_prime_export,
281 .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
282 .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
283 .gem_prime_vmap = drm_gem_cma_prime_vmap,
284 .gem_prime_vunmap = drm_gem_cma_prime_vunmap,
285 .gem_prime_mmap = drm_gem_cma_prime_mmap,
281 .dumb_create = drm_gem_cma_dumb_create, 286 .dumb_create = drm_gem_cma_dumb_create,
282 .dumb_map_offset = drm_gem_cma_dumb_map_offset, 287 .dumb_map_offset = drm_gem_cma_dumb_map_offset,
283 .dumb_destroy = drm_gem_cma_dumb_destroy, 288 .dumb_destroy = drm_gem_cma_dumb_destroy,
diff --git a/drivers/hwmon/abx500.c b/drivers/hwmon/abx500.c
index eee1134274c8..769fe20ec938 100644
--- a/drivers/hwmon/abx500.c
+++ b/drivers/hwmon/abx500.c
@@ -315,7 +315,7 @@ static SENSOR_DEVICE_ATTR(temp4_max_hyst, S_IWUSR | S_IRUGO,
315static SENSOR_DEVICE_ATTR(temp4_min_alarm, S_IRUGO, show_min_alarm, NULL, 3); 315static SENSOR_DEVICE_ATTR(temp4_min_alarm, S_IRUGO, show_min_alarm, NULL, 3);
316static SENSOR_DEVICE_ATTR(temp4_max_alarm, S_IRUGO, show_max_alarm, NULL, 3); 316static SENSOR_DEVICE_ATTR(temp4_max_alarm, S_IRUGO, show_max_alarm, NULL, 3);
317 317
318struct attribute *abx500_temp_attributes[] = { 318static struct attribute *abx500_temp_attributes[] = {
319 &sensor_dev_attr_name.dev_attr.attr, 319 &sensor_dev_attr_name.dev_attr.attr,
320 320
321 &sensor_dev_attr_temp1_label.dev_attr.attr, 321 &sensor_dev_attr_temp1_label.dev_attr.attr,
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index ade35cf3f488..2e5e2dc47eaf 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -195,7 +195,7 @@ struct tjmax {
195 int tjmax; 195 int tjmax;
196}; 196};
197 197
198static const struct tjmax __cpuinitconst tjmax_table[] = { 198static const struct tjmax tjmax_table[] = {
199 { "CPU 230", 100000 }, /* Model 0x1c, stepping 2 */ 199 { "CPU 230", 100000 }, /* Model 0x1c, stepping 2 */
200 { "CPU 330", 125000 }, /* Model 0x1c, stepping 2 */ 200 { "CPU 330", 125000 }, /* Model 0x1c, stepping 2 */
201 { "CPU CE4110", 110000 }, /* Model 0x1c, stepping 10 Sodaville */ 201 { "CPU CE4110", 110000 }, /* Model 0x1c, stepping 10 Sodaville */
@@ -211,7 +211,7 @@ struct tjmax_model {
211 211
212#define ANY 0xff 212#define ANY 0xff
213 213
214static const struct tjmax_model __cpuinitconst tjmax_model_table[] = { 214static const struct tjmax_model tjmax_model_table[] = {
215 { 0x1c, 10, 100000 }, /* D4xx, K4xx, N4xx, D5xx, K5xx, N5xx */ 215 { 0x1c, 10, 100000 }, /* D4xx, K4xx, N4xx, D5xx, K5xx, N5xx */
216 { 0x1c, ANY, 90000 }, /* Z5xx, N2xx, possibly others 216 { 0x1c, ANY, 90000 }, /* Z5xx, N2xx, possibly others
217 * Note: Also matches 230 and 330, 217 * Note: Also matches 230 and 330,
@@ -226,8 +226,7 @@ static const struct tjmax_model __cpuinitconst tjmax_model_table[] = {
226 { 0x36, ANY, 100000 }, /* Atom Cedar Trail/Cedarview (N2xxx, D2xxx) */ 226 { 0x36, ANY, 100000 }, /* Atom Cedar Trail/Cedarview (N2xxx, D2xxx) */
227}; 227};
228 228
229static int __cpuinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, 229static int adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
230 struct device *dev)
231{ 230{
232 /* The 100C is default for both mobile and non mobile CPUs */ 231 /* The 100C is default for both mobile and non mobile CPUs */
233 232
@@ -317,8 +316,7 @@ static int __cpuinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id,
317 return tjmax; 316 return tjmax;
318} 317}
319 318
320static int __cpuinit get_tjmax(struct cpuinfo_x86 *c, u32 id, 319static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
321 struct device *dev)
322{ 320{
323 int err; 321 int err;
324 u32 eax, edx; 322 u32 eax, edx;
@@ -367,8 +365,8 @@ static int create_name_attr(struct platform_data *pdata,
367 return device_create_file(dev, &pdata->name_attr); 365 return device_create_file(dev, &pdata->name_attr);
368} 366}
369 367
370static int __cpuinit create_core_attrs(struct temp_data *tdata, 368static int create_core_attrs(struct temp_data *tdata, struct device *dev,
371 struct device *dev, int attr_no) 369 int attr_no)
372{ 370{
373 int err, i; 371 int err, i;
374 static ssize_t (*const rd_ptr[TOTAL_ATTRS]) (struct device *dev, 372 static ssize_t (*const rd_ptr[TOTAL_ATTRS]) (struct device *dev,
@@ -401,7 +399,7 @@ exit_free:
401} 399}
402 400
403 401
404static int __cpuinit chk_ucode_version(unsigned int cpu) 402static int chk_ucode_version(unsigned int cpu)
405{ 403{
406 struct cpuinfo_x86 *c = &cpu_data(cpu); 404 struct cpuinfo_x86 *c = &cpu_data(cpu);
407 405
@@ -417,7 +415,7 @@ static int __cpuinit chk_ucode_version(unsigned int cpu)
417 return 0; 415 return 0;
418} 416}
419 417
420static struct platform_device __cpuinit *coretemp_get_pdev(unsigned int cpu) 418static struct platform_device *coretemp_get_pdev(unsigned int cpu)
421{ 419{
422 u16 phys_proc_id = TO_PHYS_ID(cpu); 420 u16 phys_proc_id = TO_PHYS_ID(cpu);
423 struct pdev_entry *p; 421 struct pdev_entry *p;
@@ -434,8 +432,7 @@ static struct platform_device __cpuinit *coretemp_get_pdev(unsigned int cpu)
434 return NULL; 432 return NULL;
435} 433}
436 434
437static struct temp_data __cpuinit *init_temp_data(unsigned int cpu, 435static struct temp_data *init_temp_data(unsigned int cpu, int pkg_flag)
438 int pkg_flag)
439{ 436{
440 struct temp_data *tdata; 437 struct temp_data *tdata;
441 438
@@ -453,8 +450,8 @@ static struct temp_data __cpuinit *init_temp_data(unsigned int cpu,
453 return tdata; 450 return tdata;
454} 451}
455 452
456static int __cpuinit create_core_data(struct platform_device *pdev, 453static int create_core_data(struct platform_device *pdev, unsigned int cpu,
457 unsigned int cpu, int pkg_flag) 454 int pkg_flag)
458{ 455{
459 struct temp_data *tdata; 456 struct temp_data *tdata;
460 struct platform_data *pdata = platform_get_drvdata(pdev); 457 struct platform_data *pdata = platform_get_drvdata(pdev);
@@ -524,7 +521,7 @@ exit_free:
524 return err; 521 return err;
525} 522}
526 523
527static void __cpuinit coretemp_add_core(unsigned int cpu, int pkg_flag) 524static void coretemp_add_core(unsigned int cpu, int pkg_flag)
528{ 525{
529 struct platform_device *pdev = coretemp_get_pdev(cpu); 526 struct platform_device *pdev = coretemp_get_pdev(cpu);
530 int err; 527 int err;
@@ -607,7 +604,7 @@ static struct platform_driver coretemp_driver = {
607 .remove = coretemp_remove, 604 .remove = coretemp_remove,
608}; 605};
609 606
610static int __cpuinit coretemp_device_add(unsigned int cpu) 607static int coretemp_device_add(unsigned int cpu)
611{ 608{
612 int err; 609 int err;
613 struct platform_device *pdev; 610 struct platform_device *pdev;
@@ -651,7 +648,7 @@ exit:
651 return err; 648 return err;
652} 649}
653 650
654static void __cpuinit coretemp_device_remove(unsigned int cpu) 651static void coretemp_device_remove(unsigned int cpu)
655{ 652{
656 struct pdev_entry *p, *n; 653 struct pdev_entry *p, *n;
657 u16 phys_proc_id = TO_PHYS_ID(cpu); 654 u16 phys_proc_id = TO_PHYS_ID(cpu);
@@ -667,7 +664,7 @@ static void __cpuinit coretemp_device_remove(unsigned int cpu)
667 mutex_unlock(&pdev_list_mutex); 664 mutex_unlock(&pdev_list_mutex);
668} 665}
669 666
670static bool __cpuinit is_any_core_online(struct platform_data *pdata) 667static bool is_any_core_online(struct platform_data *pdata)
671{ 668{
672 int i; 669 int i;
673 670
@@ -681,7 +678,7 @@ static bool __cpuinit is_any_core_online(struct platform_data *pdata)
681 return false; 678 return false;
682} 679}
683 680
684static void __cpuinit get_core_online(unsigned int cpu) 681static void get_core_online(unsigned int cpu)
685{ 682{
686 struct cpuinfo_x86 *c = &cpu_data(cpu); 683 struct cpuinfo_x86 *c = &cpu_data(cpu);
687 struct platform_device *pdev = coretemp_get_pdev(cpu); 684 struct platform_device *pdev = coretemp_get_pdev(cpu);
@@ -723,7 +720,7 @@ static void __cpuinit get_core_online(unsigned int cpu)
723 coretemp_add_core(cpu, 0); 720 coretemp_add_core(cpu, 0);
724} 721}
725 722
726static void __cpuinit put_core_offline(unsigned int cpu) 723static void put_core_offline(unsigned int cpu)
727{ 724{
728 int i, indx; 725 int i, indx;
729 struct platform_data *pdata; 726 struct platform_data *pdata;
@@ -771,7 +768,7 @@ static void __cpuinit put_core_offline(unsigned int cpu)
771 coretemp_device_remove(cpu); 768 coretemp_device_remove(cpu);
772} 769}
773 770
774static int __cpuinit coretemp_cpu_callback(struct notifier_block *nfb, 771static int coretemp_cpu_callback(struct notifier_block *nfb,
775 unsigned long action, void *hcpu) 772 unsigned long action, void *hcpu)
776{ 773{
777 unsigned int cpu = (unsigned long) hcpu; 774 unsigned int cpu = (unsigned long) hcpu;
diff --git a/drivers/hwmon/via-cputemp.c b/drivers/hwmon/via-cputemp.c
index 76f157b568ed..38944e94f65f 100644
--- a/drivers/hwmon/via-cputemp.c
+++ b/drivers/hwmon/via-cputemp.c
@@ -221,7 +221,7 @@ struct pdev_entry {
221static LIST_HEAD(pdev_list); 221static LIST_HEAD(pdev_list);
222static DEFINE_MUTEX(pdev_list_mutex); 222static DEFINE_MUTEX(pdev_list_mutex);
223 223
224static int __cpuinit via_cputemp_device_add(unsigned int cpu) 224static int via_cputemp_device_add(unsigned int cpu)
225{ 225{
226 int err; 226 int err;
227 struct platform_device *pdev; 227 struct platform_device *pdev;
@@ -262,7 +262,7 @@ exit:
262 return err; 262 return err;
263} 263}
264 264
265static void __cpuinit via_cputemp_device_remove(unsigned int cpu) 265static void via_cputemp_device_remove(unsigned int cpu)
266{ 266{
267 struct pdev_entry *p; 267 struct pdev_entry *p;
268 268
@@ -279,8 +279,8 @@ static void __cpuinit via_cputemp_device_remove(unsigned int cpu)
279 mutex_unlock(&pdev_list_mutex); 279 mutex_unlock(&pdev_list_mutex);
280} 280}
281 281
282static int __cpuinit via_cputemp_cpu_callback(struct notifier_block *nfb, 282static int via_cputemp_cpu_callback(struct notifier_block *nfb,
283 unsigned long action, void *hcpu) 283 unsigned long action, void *hcpu)
284{ 284{
285 unsigned int cpu = (unsigned long) hcpu; 285 unsigned int cpu = (unsigned long) hcpu;
286 286
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index 19ceaa60e0f4..ee7c50312066 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -414,7 +414,7 @@ static void __init gic_dist_init(struct gic_chip_data *gic)
414 writel_relaxed(1, base + GIC_DIST_CTRL); 414 writel_relaxed(1, base + GIC_DIST_CTRL);
415} 415}
416 416
417static void __cpuinit gic_cpu_init(struct gic_chip_data *gic) 417static void gic_cpu_init(struct gic_chip_data *gic)
418{ 418{
419 void __iomem *dist_base = gic_data_dist_base(gic); 419 void __iomem *dist_base = gic_data_dist_base(gic);
420 void __iomem *base = gic_data_cpu_base(gic); 420 void __iomem *base = gic_data_cpu_base(gic);
@@ -702,8 +702,8 @@ static int gic_irq_domain_xlate(struct irq_domain *d,
702} 702}
703 703
704#ifdef CONFIG_SMP 704#ifdef CONFIG_SMP
705static int __cpuinit gic_secondary_init(struct notifier_block *nfb, 705static int gic_secondary_init(struct notifier_block *nfb, unsigned long action,
706 unsigned long action, void *hcpu) 706 void *hcpu)
707{ 707{
708 if (action == CPU_STARTING || action == CPU_STARTING_FROZEN) 708 if (action == CPU_STARTING || action == CPU_STARTING_FROZEN)
709 gic_cpu_init(&gic_data[0]); 709 gic_cpu_init(&gic_data[0]);
@@ -714,7 +714,7 @@ static int __cpuinit gic_secondary_init(struct notifier_block *nfb,
714 * Notifier for enabling the GIC CPU interface. Set an arbitrarily high 714 * Notifier for enabling the GIC CPU interface. Set an arbitrarily high
715 * priority because the GIC needs to be up before the ARM generic timers. 715 * priority because the GIC needs to be up before the ARM generic timers.
716 */ 716 */
717static struct notifier_block __cpuinitdata gic_cpu_notifier = { 717static struct notifier_block gic_cpu_notifier = {
718 .notifier_call = gic_secondary_init, 718 .notifier_call = gic_secondary_init,
719 .priority = 100, 719 .priority = 100,
720}; 720};
diff --git a/drivers/md/md.c b/drivers/md/md.c
index dddc87bcf64a..9f13e13506ef 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -7716,20 +7716,6 @@ static int remove_and_add_spares(struct mddev *mddev,
7716 continue; 7716 continue;
7717 7717
7718 rdev->recovery_offset = 0; 7718 rdev->recovery_offset = 0;
7719 if (rdev->saved_raid_disk >= 0 && mddev->in_sync) {
7720 spin_lock_irq(&mddev->write_lock);
7721 if (mddev->in_sync)
7722 /* OK, this device, which is in_sync,
7723 * will definitely be noticed before
7724 * the next write, so recovery isn't
7725 * needed.
7726 */
7727 rdev->recovery_offset = mddev->recovery_cp;
7728 spin_unlock_irq(&mddev->write_lock);
7729 }
7730 if (mddev->ro && rdev->recovery_offset != MaxSector)
7731 /* not safe to add this disk now */
7732 continue;
7733 if (mddev->pers-> 7719 if (mddev->pers->
7734 hot_add_disk(mddev, rdev) == 0) { 7720 hot_add_disk(mddev, rdev) == 0) {
7735 if (sysfs_link_rdev(mddev, rdev)) 7721 if (sysfs_link_rdev(mddev, rdev))
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index ec734588a1c6..d60412c7f995 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1849,6 +1849,36 @@ static int process_checks(struct r1bio *r1_bio)
1849 int i; 1849 int i;
1850 int vcnt; 1850 int vcnt;
1851 1851
1852 /* Fix variable parts of all bios */
1853 vcnt = (r1_bio->sectors + PAGE_SIZE / 512 - 1) >> (PAGE_SHIFT - 9);
1854 for (i = 0; i < conf->raid_disks * 2; i++) {
1855 int j;
1856 int size;
1857 struct bio *b = r1_bio->bios[i];
1858 if (b->bi_end_io != end_sync_read)
1859 continue;
1860 /* fixup the bio for reuse */
1861 bio_reset(b);
1862 b->bi_vcnt = vcnt;
1863 b->bi_size = r1_bio->sectors << 9;
1864 b->bi_sector = r1_bio->sector +
1865 conf->mirrors[i].rdev->data_offset;
1866 b->bi_bdev = conf->mirrors[i].rdev->bdev;
1867 b->bi_end_io = end_sync_read;
1868 b->bi_private = r1_bio;
1869
1870 size = b->bi_size;
1871 for (j = 0; j < vcnt ; j++) {
1872 struct bio_vec *bi;
1873 bi = &b->bi_io_vec[j];
1874 bi->bv_offset = 0;
1875 if (size > PAGE_SIZE)
1876 bi->bv_len = PAGE_SIZE;
1877 else
1878 bi->bv_len = size;
1879 size -= PAGE_SIZE;
1880 }
1881 }
1852 for (primary = 0; primary < conf->raid_disks * 2; primary++) 1882 for (primary = 0; primary < conf->raid_disks * 2; primary++)
1853 if (r1_bio->bios[primary]->bi_end_io == end_sync_read && 1883 if (r1_bio->bios[primary]->bi_end_io == end_sync_read &&
1854 test_bit(BIO_UPTODATE, &r1_bio->bios[primary]->bi_flags)) { 1884 test_bit(BIO_UPTODATE, &r1_bio->bios[primary]->bi_flags)) {
@@ -1857,12 +1887,10 @@ static int process_checks(struct r1bio *r1_bio)
1857 break; 1887 break;
1858 } 1888 }
1859 r1_bio->read_disk = primary; 1889 r1_bio->read_disk = primary;
1860 vcnt = (r1_bio->sectors + PAGE_SIZE / 512 - 1) >> (PAGE_SHIFT - 9);
1861 for (i = 0; i < conf->raid_disks * 2; i++) { 1890 for (i = 0; i < conf->raid_disks * 2; i++) {
1862 int j; 1891 int j;
1863 struct bio *pbio = r1_bio->bios[primary]; 1892 struct bio *pbio = r1_bio->bios[primary];
1864 struct bio *sbio = r1_bio->bios[i]; 1893 struct bio *sbio = r1_bio->bios[i];
1865 int size;
1866 1894
1867 if (sbio->bi_end_io != end_sync_read) 1895 if (sbio->bi_end_io != end_sync_read)
1868 continue; 1896 continue;
@@ -1888,27 +1916,6 @@ static int process_checks(struct r1bio *r1_bio)
1888 rdev_dec_pending(conf->mirrors[i].rdev, mddev); 1916 rdev_dec_pending(conf->mirrors[i].rdev, mddev);
1889 continue; 1917 continue;
1890 } 1918 }
1891 /* fixup the bio for reuse */
1892 bio_reset(sbio);
1893 sbio->bi_vcnt = vcnt;
1894 sbio->bi_size = r1_bio->sectors << 9;
1895 sbio->bi_sector = r1_bio->sector +
1896 conf->mirrors[i].rdev->data_offset;
1897 sbio->bi_bdev = conf->mirrors[i].rdev->bdev;
1898 sbio->bi_end_io = end_sync_read;
1899 sbio->bi_private = r1_bio;
1900
1901 size = sbio->bi_size;
1902 for (j = 0; j < vcnt ; j++) {
1903 struct bio_vec *bi;
1904 bi = &sbio->bi_io_vec[j];
1905 bi->bv_offset = 0;
1906 if (size > PAGE_SIZE)
1907 bi->bv_len = PAGE_SIZE;
1908 else
1909 bi->bv_len = size;
1910 size -= PAGE_SIZE;
1911 }
1912 1919
1913 bio_copy_data(sbio, pbio); 1920 bio_copy_data(sbio, pbio);
1914 } 1921 }
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index cd066b63bdaf..957a719e8c2f 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2097,11 +2097,17 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio)
2097 * both 'first' and 'i', so we just compare them. 2097 * both 'first' and 'i', so we just compare them.
2098 * All vec entries are PAGE_SIZE; 2098 * All vec entries are PAGE_SIZE;
2099 */ 2099 */
2100 for (j = 0; j < vcnt; j++) 2100 int sectors = r10_bio->sectors;
2101 for (j = 0; j < vcnt; j++) {
2102 int len = PAGE_SIZE;
2103 if (sectors < (len / 512))
2104 len = sectors * 512;
2101 if (memcmp(page_address(fbio->bi_io_vec[j].bv_page), 2105 if (memcmp(page_address(fbio->bi_io_vec[j].bv_page),
2102 page_address(tbio->bi_io_vec[j].bv_page), 2106 page_address(tbio->bi_io_vec[j].bv_page),
2103 fbio->bi_io_vec[j].bv_len)) 2107 len))
2104 break; 2108 break;
2109 sectors -= len/512;
2110 }
2105 if (j == vcnt) 2111 if (j == vcnt)
2106 continue; 2112 continue;
2107 atomic64_add(r10_bio->sectors, &mddev->resync_mismatches); 2113 atomic64_add(r10_bio->sectors, &mddev->resync_mismatches);
@@ -3407,6 +3413,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr,
3407 3413
3408 if (bio->bi_end_io == end_sync_read) { 3414 if (bio->bi_end_io == end_sync_read) {
3409 md_sync_acct(bio->bi_bdev, nr_sectors); 3415 md_sync_acct(bio->bi_bdev, nr_sectors);
3416 set_bit(BIO_UPTODATE, &bio->bi_flags);
3410 generic_make_request(bio); 3417 generic_make_request(bio);
3411 } 3418 }
3412 } 3419 }
diff --git a/drivers/media/pci/saa7134/saa7134-alsa.c b/drivers/media/pci/saa7134/saa7134-alsa.c
index 10460fd3ce39..dbcdfbf8aed0 100644
--- a/drivers/media/pci/saa7134/saa7134-alsa.c
+++ b/drivers/media/pci/saa7134/saa7134-alsa.c
@@ -172,7 +172,9 @@ static void saa7134_irq_alsa_done(struct saa7134_dev *dev,
172 dprintk("irq: overrun [full=%d/%d] - Blocks in %d\n",dev->dmasound.read_count, 172 dprintk("irq: overrun [full=%d/%d] - Blocks in %d\n",dev->dmasound.read_count,
173 dev->dmasound.bufsize, dev->dmasound.blocks); 173 dev->dmasound.bufsize, dev->dmasound.blocks);
174 spin_unlock(&dev->slock); 174 spin_unlock(&dev->slock);
175 snd_pcm_stream_lock(dev->dmasound.substream);
175 snd_pcm_stop(dev->dmasound.substream,SNDRV_PCM_STATE_XRUN); 176 snd_pcm_stop(dev->dmasound.substream,SNDRV_PCM_STATE_XRUN);
177 snd_pcm_stream_unlock(dev->dmasound.substream);
176 return; 178 return;
177 } 179 }
178 180
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
index 6d1a62a84c9d..1966444590f6 100644
--- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
+++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
@@ -1678,6 +1678,7 @@ static int atl1e_tx_map(struct atl1e_adapter *adapter,
1678 u16 f; 1678 u16 f;
1679 int segment; 1679 int segment;
1680 int ring_start = adapter->tx_ring.next_to_use; 1680 int ring_start = adapter->tx_ring.next_to_use;
1681 int ring_end;
1681 1682
1682 nr_frags = skb_shinfo(skb)->nr_frags; 1683 nr_frags = skb_shinfo(skb)->nr_frags;
1683 segment = (tpd->word3 >> TPD_SEGMENT_EN_SHIFT) & TPD_SEGMENT_EN_MASK; 1684 segment = (tpd->word3 >> TPD_SEGMENT_EN_SHIFT) & TPD_SEGMENT_EN_MASK;
@@ -1721,6 +1722,15 @@ static int atl1e_tx_map(struct atl1e_adapter *adapter,
1721 map_len, PCI_DMA_TODEVICE); 1722 map_len, PCI_DMA_TODEVICE);
1722 1723
1723 if (dma_mapping_error(&adapter->pdev->dev, tx_buffer->dma)) { 1724 if (dma_mapping_error(&adapter->pdev->dev, tx_buffer->dma)) {
1725 /* We need to unwind the mappings we've done */
1726 ring_end = adapter->tx_ring.next_to_use;
1727 adapter->tx_ring.next_to_use = ring_start;
1728 while (adapter->tx_ring.next_to_use != ring_end) {
1729 tpd = atl1e_get_tpd(adapter);
1730 tx_buffer = atl1e_get_tx_buffer(adapter, tpd);
1731 pci_unmap_single(adapter->pdev, tx_buffer->dma,
1732 tx_buffer->length, PCI_DMA_TODEVICE);
1733 }
1724 /* Reset the tx rings next pointer */ 1734 /* Reset the tx rings next pointer */
1725 adapter->tx_ring.next_to_use = ring_start; 1735 adapter->tx_ring.next_to_use = ring_start;
1726 return -ENOSPC; 1736 return -ENOSPC;
@@ -1763,6 +1773,16 @@ static int atl1e_tx_map(struct atl1e_adapter *adapter,
1763 DMA_TO_DEVICE); 1773 DMA_TO_DEVICE);
1764 1774
1765 if (dma_mapping_error(&adapter->pdev->dev, tx_buffer->dma)) { 1775 if (dma_mapping_error(&adapter->pdev->dev, tx_buffer->dma)) {
1776 /* We need to unwind the mappings we've done */
1777 ring_end = adapter->tx_ring.next_to_use;
1778 adapter->tx_ring.next_to_use = ring_start;
1779 while (adapter->tx_ring.next_to_use != ring_end) {
1780 tpd = atl1e_get_tpd(adapter);
1781 tx_buffer = atl1e_get_tx_buffer(adapter, tpd);
1782 dma_unmap_page(&adapter->pdev->dev, tx_buffer->dma,
1783 tx_buffer->length, DMA_TO_DEVICE);
1784 }
1785
1766 /* Reset the ring next to use pointer */ 1786 /* Reset the ring next to use pointer */
1767 adapter->tx_ring.next_to_use = ring_start; 1787 adapter->tx_ring.next_to_use = ring_start;
1768 return -ENOSPC; 1788 return -ENOSPC;
@@ -1853,8 +1873,10 @@ static netdev_tx_t atl1e_xmit_frame(struct sk_buff *skb,
1853 return NETDEV_TX_OK; 1873 return NETDEV_TX_OK;
1854 } 1874 }
1855 1875
1856 if (atl1e_tx_map(adapter, skb, tpd)) 1876 if (atl1e_tx_map(adapter, skb, tpd)) {
1877 dev_kfree_skb_any(skb);
1857 goto out; 1878 goto out;
1879 }
1858 1880
1859 atl1e_tx_queue(adapter, tpd_req, tpd); 1881 atl1e_tx_queue(adapter, tpd_req, tpd);
1860 1882
diff --git a/drivers/net/ethernet/broadcom/Kconfig b/drivers/net/ethernet/broadcom/Kconfig
index 1d680baf43d6..52c96036dcc4 100644
--- a/drivers/net/ethernet/broadcom/Kconfig
+++ b/drivers/net/ethernet/broadcom/Kconfig
@@ -131,6 +131,7 @@ config BNX2X_SRIOV
131config BGMAC 131config BGMAC
132 tristate "BCMA bus GBit core support" 132 tristate "BCMA bus GBit core support"
133 depends on BCMA_HOST_SOC && HAS_DMA 133 depends on BCMA_HOST_SOC && HAS_DMA
134 select PHYLIB
134 ---help--- 135 ---help---
135 This driver supports GBit MAC and BCM4706 GBit MAC cores on BCMA bus. 136 This driver supports GBit MAC and BCM4706 GBit MAC cores on BCMA bus.
136 They can be found on BCM47xx SoCs and provide gigabit ethernet. 137 They can be found on BCM47xx SoCs and provide gigabit ethernet.
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 2df48bb0f1ca..181edb522450 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -782,16 +782,22 @@ static struct sk_buff *be_insert_vlan_in_pkt(struct be_adapter *adapter,
782 782
783 if (vlan_tx_tag_present(skb)) 783 if (vlan_tx_tag_present(skb))
784 vlan_tag = be_get_tx_vlan_tag(adapter, skb); 784 vlan_tag = be_get_tx_vlan_tag(adapter, skb);
785 else if (qnq_async_evt_rcvd(adapter) && adapter->pvid) 785
786 vlan_tag = adapter->pvid; 786 if (qnq_async_evt_rcvd(adapter) && adapter->pvid) {
787 if (!vlan_tag)
788 vlan_tag = adapter->pvid;
789 /* f/w workaround to set skip_hw_vlan = 1, informs the F/W to
790 * skip VLAN insertion
791 */
792 if (skip_hw_vlan)
793 *skip_hw_vlan = true;
794 }
787 795
788 if (vlan_tag) { 796 if (vlan_tag) {
789 skb = __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag); 797 skb = __vlan_put_tag(skb, htons(ETH_P_8021Q), vlan_tag);
790 if (unlikely(!skb)) 798 if (unlikely(!skb))
791 return skb; 799 return skb;
792 skb->vlan_tci = 0; 800 skb->vlan_tci = 0;
793 if (skip_hw_vlan)
794 *skip_hw_vlan = true;
795 } 801 }
796 802
797 /* Insert the outer VLAN, if any */ 803 /* Insert the outer VLAN, if any */
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c b/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c
index 4273c06e2e96..9c7194b26ee2 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c
@@ -156,7 +156,7 @@ static ssize_t average_read(struct file *filp, char __user *buf, size_t count,
156 stats = filp->private_data; 156 stats = filp->private_data;
157 spin_lock(&stats->lock); 157 spin_lock(&stats->lock);
158 if (stats->n) 158 if (stats->n)
159 field = stats->sum / stats->n; 159 field = div64_u64(stats->sum, stats->n);
160 spin_unlock(&stats->lock); 160 spin_unlock(&stats->lock);
161 ret = snprintf(tbuf, sizeof(tbuf), "%llu\n", field); 161 ret = snprintf(tbuf, sizeof(tbuf), "%llu\n", field);
162 if (ret > 0) { 162 if (ret > 0) {
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 4dccead586be..23a0fff0df52 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -431,8 +431,8 @@ static int netvsc_probe(struct hv_device *dev,
431 net->netdev_ops = &device_ops; 431 net->netdev_ops = &device_ops;
432 432
433 /* TODO: Add GSO and Checksum offload */ 433 /* TODO: Add GSO and Checksum offload */
434 net->hw_features = NETIF_F_SG; 434 net->hw_features = 0;
435 net->features = NETIF_F_SG | NETIF_F_HW_VLAN_CTAG_TX; 435 net->features = NETIF_F_HW_VLAN_CTAG_TX;
436 436
437 SET_ETHTOOL_OPS(net, &ethtool_ops); 437 SET_ETHTOOL_OPS(net, &ethtool_ops);
438 SET_NETDEV_DEV(net, &dev->device); 438 SET_NETDEV_DEV(net, &dev->device);
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 876c72246ae9..a98fb0ed6aef 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -698,6 +698,28 @@ static int macvtap_skb_to_vnet_hdr(const struct sk_buff *skb,
698 return 0; 698 return 0;
699} 699}
700 700
701static unsigned long iov_pages(const struct iovec *iv, int offset,
702 unsigned long nr_segs)
703{
704 unsigned long seg, base;
705 int pages = 0, len, size;
706
707 while (nr_segs && (offset >= iv->iov_len)) {
708 offset -= iv->iov_len;
709 ++iv;
710 --nr_segs;
711 }
712
713 for (seg = 0; seg < nr_segs; seg++) {
714 base = (unsigned long)iv[seg].iov_base + offset;
715 len = iv[seg].iov_len - offset;
716 size = ((base & ~PAGE_MASK) + len + ~PAGE_MASK) >> PAGE_SHIFT;
717 pages += size;
718 offset = 0;
719 }
720
721 return pages;
722}
701 723
702/* Get packet from user space buffer */ 724/* Get packet from user space buffer */
703static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, 725static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
@@ -744,31 +766,15 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
744 if (unlikely(count > UIO_MAXIOV)) 766 if (unlikely(count > UIO_MAXIOV))
745 goto err; 767 goto err;
746 768
747 if (m && m->msg_control && sock_flag(&q->sk, SOCK_ZEROCOPY)) 769 if (m && m->msg_control && sock_flag(&q->sk, SOCK_ZEROCOPY)) {
748 zerocopy = true; 770 copylen = vnet_hdr.hdr_len ? vnet_hdr.hdr_len : GOODCOPY_LEN;
749
750 if (zerocopy) {
751 /* Userspace may produce vectors with count greater than
752 * MAX_SKB_FRAGS, so we need to linearize parts of the skb
753 * to let the rest of data to be fit in the frags.
754 */
755 if (count > MAX_SKB_FRAGS) {
756 copylen = iov_length(iv, count - MAX_SKB_FRAGS);
757 if (copylen < vnet_hdr_len)
758 copylen = 0;
759 else
760 copylen -= vnet_hdr_len;
761 }
762 /* There are 256 bytes to be copied in skb, so there is enough
763 * room for skb expand head in case it is used.
764 * The rest buffer is mapped from userspace.
765 */
766 if (copylen < vnet_hdr.hdr_len)
767 copylen = vnet_hdr.hdr_len;
768 if (!copylen)
769 copylen = GOODCOPY_LEN;
770 linear = copylen; 771 linear = copylen;
771 } else { 772 if (iov_pages(iv, vnet_hdr_len + copylen, count)
773 <= MAX_SKB_FRAGS)
774 zerocopy = true;
775 }
776
777 if (!zerocopy) {
772 copylen = len; 778 copylen = len;
773 linear = vnet_hdr.hdr_len; 779 linear = vnet_hdr.hdr_len;
774 } 780 }
@@ -780,9 +786,15 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
780 786
781 if (zerocopy) 787 if (zerocopy)
782 err = zerocopy_sg_from_iovec(skb, iv, vnet_hdr_len, count); 788 err = zerocopy_sg_from_iovec(skb, iv, vnet_hdr_len, count);
783 else 789 else {
784 err = skb_copy_datagram_from_iovec(skb, 0, iv, vnet_hdr_len, 790 err = skb_copy_datagram_from_iovec(skb, 0, iv, vnet_hdr_len,
785 len); 791 len);
792 if (!err && m && m->msg_control) {
793 struct ubuf_info *uarg = m->msg_control;
794 uarg->callback(uarg, false);
795 }
796 }
797
786 if (err) 798 if (err)
787 goto err_kfree; 799 goto err_kfree;
788 800
@@ -873,7 +885,7 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,
873 __be16 h_vlan_proto; 885 __be16 h_vlan_proto;
874 __be16 h_vlan_TCI; 886 __be16 h_vlan_TCI;
875 } veth; 887 } veth;
876 veth.h_vlan_proto = htons(ETH_P_8021Q); 888 veth.h_vlan_proto = skb->vlan_proto;
877 veth.h_vlan_TCI = htons(vlan_tx_tag_get(skb)); 889 veth.h_vlan_TCI = htons(vlan_tx_tag_get(skb));
878 890
879 vlan_offset = offsetof(struct vlan_ethhdr, h_vlan_proto); 891 vlan_offset = offsetof(struct vlan_ethhdr, h_vlan_proto);
@@ -1107,6 +1119,7 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd,
1107 rtnl_lock(); 1119 rtnl_lock();
1108 ret = macvtap_ioctl_set_queue(file, u); 1120 ret = macvtap_ioctl_set_queue(file, u);
1109 rtnl_unlock(); 1121 rtnl_unlock();
1122 return ret;
1110 1123
1111 case TUNGETFEATURES: 1124 case TUNGETFEATURES:
1112 if (put_user(IFF_TAP | IFF_NO_PI | IFF_VNET_HDR | 1125 if (put_user(IFF_TAP | IFF_NO_PI | IFF_VNET_HDR |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 5cdcf92eb310..db690a372260 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1035,6 +1035,29 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
1035 return 0; 1035 return 0;
1036} 1036}
1037 1037
1038static unsigned long iov_pages(const struct iovec *iv, int offset,
1039 unsigned long nr_segs)
1040{
1041 unsigned long seg, base;
1042 int pages = 0, len, size;
1043
1044 while (nr_segs && (offset >= iv->iov_len)) {
1045 offset -= iv->iov_len;
1046 ++iv;
1047 --nr_segs;
1048 }
1049
1050 for (seg = 0; seg < nr_segs; seg++) {
1051 base = (unsigned long)iv[seg].iov_base + offset;
1052 len = iv[seg].iov_len - offset;
1053 size = ((base & ~PAGE_MASK) + len + ~PAGE_MASK) >> PAGE_SHIFT;
1054 pages += size;
1055 offset = 0;
1056 }
1057
1058 return pages;
1059}
1060
1038/* Get packet from user space buffer */ 1061/* Get packet from user space buffer */
1039static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, 1062static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
1040 void *msg_control, const struct iovec *iv, 1063 void *msg_control, const struct iovec *iv,
@@ -1082,32 +1105,18 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
1082 return -EINVAL; 1105 return -EINVAL;
1083 } 1106 }
1084 1107
1085 if (msg_control) 1108 if (msg_control) {
1086 zerocopy = true; 1109 /* There are 256 bytes to be copied in skb, so there is
1087 1110 * enough room for skb expand head in case it is used.
1088 if (zerocopy) {
1089 /* Userspace may produce vectors with count greater than
1090 * MAX_SKB_FRAGS, so we need to linearize parts of the skb
1091 * to let the rest of data to be fit in the frags.
1092 */
1093 if (count > MAX_SKB_FRAGS) {
1094 copylen = iov_length(iv, count - MAX_SKB_FRAGS);
1095 if (copylen < offset)
1096 copylen = 0;
1097 else
1098 copylen -= offset;
1099 } else
1100 copylen = 0;
1101 /* There are 256 bytes to be copied in skb, so there is enough
1102 * room for skb expand head in case it is used.
1103 * The rest of the buffer is mapped from userspace. 1111 * The rest of the buffer is mapped from userspace.
1104 */ 1112 */
1105 if (copylen < gso.hdr_len) 1113 copylen = gso.hdr_len ? gso.hdr_len : GOODCOPY_LEN;
1106 copylen = gso.hdr_len;
1107 if (!copylen)
1108 copylen = GOODCOPY_LEN;
1109 linear = copylen; 1114 linear = copylen;
1110 } else { 1115 if (iov_pages(iv, offset + copylen, count) <= MAX_SKB_FRAGS)
1116 zerocopy = true;
1117 }
1118
1119 if (!zerocopy) {
1111 copylen = len; 1120 copylen = len;
1112 linear = gso.hdr_len; 1121 linear = gso.hdr_len;
1113 } 1122 }
@@ -1121,8 +1130,13 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
1121 1130
1122 if (zerocopy) 1131 if (zerocopy)
1123 err = zerocopy_sg_from_iovec(skb, iv, offset, count); 1132 err = zerocopy_sg_from_iovec(skb, iv, offset, count);
1124 else 1133 else {
1125 err = skb_copy_datagram_from_iovec(skb, 0, iv, offset, len); 1134 err = skb_copy_datagram_from_iovec(skb, 0, iv, offset, len);
1135 if (!err && msg_control) {
1136 struct ubuf_info *uarg = msg_control;
1137 uarg->callback(uarg, false);
1138 }
1139 }
1126 1140
1127 if (err) { 1141 if (err) {
1128 tun->dev->stats.rx_dropped++; 1142 tun->dev->stats.rx_dropped++;
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 0ba1e7edbb1b..a5ba8dd7e6be 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1767,9 +1767,15 @@ static int vxlan_newlink(struct net *net, struct net_device *dev,
1767 1767
1768static void vxlan_dellink(struct net_device *dev, struct list_head *head) 1768static void vxlan_dellink(struct net_device *dev, struct list_head *head)
1769{ 1769{
1770 struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
1770 struct vxlan_dev *vxlan = netdev_priv(dev); 1771 struct vxlan_dev *vxlan = netdev_priv(dev);
1771 1772
1773 flush_workqueue(vxlan_wq);
1774
1775 spin_lock(&vn->sock_lock);
1772 hlist_del_rcu(&vxlan->hlist); 1776 hlist_del_rcu(&vxlan->hlist);
1777 spin_unlock(&vn->sock_lock);
1778
1773 list_del(&vxlan->next); 1779 list_del(&vxlan->next);
1774 unregister_netdevice_queue(dev, head); 1780 unregister_netdevice_queue(dev, head);
1775} 1781}
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index ff7f111fffee..36808bf25677 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -286,8 +286,7 @@ no_skb:
286 break; 286 break;
287 } 287 }
288 288
289 __skb_fill_page_desc(skb, 0, page, 0, 0); 289 skb_add_rx_frag(skb, 0, page, 0, 0, PAGE_SIZE);
290 skb_shinfo(skb)->nr_frags = 1;
291 __skb_queue_tail(&np->rx_batch, skb); 290 __skb_queue_tail(&np->rx_batch, skb);
292 } 291 }
293 292
@@ -831,7 +830,6 @@ static RING_IDX xennet_fill_frags(struct netfront_info *np,
831 struct sk_buff_head *list) 830 struct sk_buff_head *list)
832{ 831{
833 struct skb_shared_info *shinfo = skb_shinfo(skb); 832 struct skb_shared_info *shinfo = skb_shinfo(skb);
834 int nr_frags = shinfo->nr_frags;
835 RING_IDX cons = np->rx.rsp_cons; 833 RING_IDX cons = np->rx.rsp_cons;
836 struct sk_buff *nskb; 834 struct sk_buff *nskb;
837 835
@@ -840,19 +838,21 @@ static RING_IDX xennet_fill_frags(struct netfront_info *np,
840 RING_GET_RESPONSE(&np->rx, ++cons); 838 RING_GET_RESPONSE(&np->rx, ++cons);
841 skb_frag_t *nfrag = &skb_shinfo(nskb)->frags[0]; 839 skb_frag_t *nfrag = &skb_shinfo(nskb)->frags[0];
842 840
843 __skb_fill_page_desc(skb, nr_frags, 841 if (shinfo->nr_frags == MAX_SKB_FRAGS) {
844 skb_frag_page(nfrag), 842 unsigned int pull_to = NETFRONT_SKB_CB(skb)->pull_to;
845 rx->offset, rx->status);
846 843
847 skb->data_len += rx->status; 844 BUG_ON(pull_to <= skb_headlen(skb));
845 __pskb_pull_tail(skb, pull_to - skb_headlen(skb));
846 }
847 BUG_ON(shinfo->nr_frags >= MAX_SKB_FRAGS);
848
849 skb_add_rx_frag(skb, shinfo->nr_frags, skb_frag_page(nfrag),
850 rx->offset, rx->status, PAGE_SIZE);
848 851
849 skb_shinfo(nskb)->nr_frags = 0; 852 skb_shinfo(nskb)->nr_frags = 0;
850 kfree_skb(nskb); 853 kfree_skb(nskb);
851
852 nr_frags++;
853 } 854 }
854 855
855 shinfo->nr_frags = nr_frags;
856 return cons; 856 return cons;
857} 857}
858 858
@@ -933,7 +933,8 @@ static int handle_incoming_queue(struct net_device *dev,
933 while ((skb = __skb_dequeue(rxq)) != NULL) { 933 while ((skb = __skb_dequeue(rxq)) != NULL) {
934 int pull_to = NETFRONT_SKB_CB(skb)->pull_to; 934 int pull_to = NETFRONT_SKB_CB(skb)->pull_to;
935 935
936 __pskb_pull_tail(skb, pull_to - skb_headlen(skb)); 936 if (pull_to > skb_headlen(skb))
937 __pskb_pull_tail(skb, pull_to - skb_headlen(skb));
937 938
938 /* Ethernet work: Delayed to here as it peeks the header. */ 939 /* Ethernet work: Delayed to here as it peeks the header. */
939 skb->protocol = eth_type_trans(skb, dev); 940 skb->protocol = eth_type_trans(skb, dev);
@@ -1019,16 +1020,10 @@ err:
1019 skb_shinfo(skb)->frags[0].page_offset = rx->offset; 1020 skb_shinfo(skb)->frags[0].page_offset = rx->offset;
1020 skb_frag_size_set(&skb_shinfo(skb)->frags[0], rx->status); 1021 skb_frag_size_set(&skb_shinfo(skb)->frags[0], rx->status);
1021 skb->data_len = rx->status; 1022 skb->data_len = rx->status;
1023 skb->len += rx->status;
1022 1024
1023 i = xennet_fill_frags(np, skb, &tmpq); 1025 i = xennet_fill_frags(np, skb, &tmpq);
1024 1026
1025 /*
1026 * Truesize is the actual allocation size, even if the
1027 * allocation is only partially used.
1028 */
1029 skb->truesize += PAGE_SIZE * skb_shinfo(skb)->nr_frags;
1030 skb->len += skb->data_len;
1031
1032 if (rx->flags & XEN_NETRXF_csum_blank) 1027 if (rx->flags & XEN_NETRXF_csum_blank)
1033 skb->ip_summed = CHECKSUM_PARTIAL; 1028 skb->ip_summed = CHECKSUM_PARTIAL;
1034 else if (rx->flags & XEN_NETRXF_data_validated) 1029 else if (rx->flags & XEN_NETRXF_data_validated)
diff --git a/drivers/oprofile/timer_int.c b/drivers/oprofile/timer_int.c
index 93404f72dfa8..61be1d9c16c8 100644
--- a/drivers/oprofile/timer_int.c
+++ b/drivers/oprofile/timer_int.c
@@ -74,8 +74,8 @@ static void oprofile_hrtimer_stop(void)
74 put_online_cpus(); 74 put_online_cpus();
75} 75}
76 76
77static int __cpuinit oprofile_cpu_notify(struct notifier_block *self, 77static int oprofile_cpu_notify(struct notifier_block *self,
78 unsigned long action, void *hcpu) 78 unsigned long action, void *hcpu)
79{ 79{
80 long cpu = (long) hcpu; 80 long cpu = (long) hcpu;
81 81
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 9847ab163829..167f3d00c916 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -180,7 +180,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
180 struct pnp_dev *dev = data; 180 struct pnp_dev *dev = data;
181 struct acpi_resource_dma *dma; 181 struct acpi_resource_dma *dma;
182 struct acpi_resource_vendor_typed *vendor_typed; 182 struct acpi_resource_vendor_typed *vendor_typed;
183 struct resource r; 183 struct resource r = {0};
184 int i, flags; 184 int i, flags;
185 185
186 if (acpi_dev_resource_memory(res, &r) 186 if (acpi_dev_resource_memory(res, &r)
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index 3e6db1c1dc29..d95e101ffb43 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -515,6 +515,7 @@ struct pnp_resource *pnp_add_resource(struct pnp_dev *dev,
515 } 515 }
516 516
517 pnp_res->res = *res; 517 pnp_res->res = *res;
518 pnp_res->res.name = dev->name;
518 dev_dbg(&dev->dev, "%pR\n", res); 519 dev_dbg(&dev->dev, "%pR\n", res);
519 return pnp_res; 520 return pnp_res;
520} 521}
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
index fb1c1e0483ed..8ed52aa49122 100644
--- a/drivers/s390/cio/qdio_main.c
+++ b/drivers/s390/cio/qdio_main.c
@@ -1497,7 +1497,7 @@ static inline int buf_in_between(int bufnr, int start, int count)
1497static int handle_inbound(struct qdio_q *q, unsigned int callflags, 1497static int handle_inbound(struct qdio_q *q, unsigned int callflags,
1498 int bufnr, int count) 1498 int bufnr, int count)
1499{ 1499{
1500 int used, diff; 1500 int diff;
1501 1501
1502 qperf_inc(q, inbound_call); 1502 qperf_inc(q, inbound_call);
1503 1503
@@ -1530,7 +1530,7 @@ static int handle_inbound(struct qdio_q *q, unsigned int callflags,
1530 1530
1531set: 1531set:
1532 count = set_buf_states(q, bufnr, SLSB_CU_INPUT_EMPTY, count); 1532 count = set_buf_states(q, bufnr, SLSB_CU_INPUT_EMPTY, count);
1533 used = atomic_add_return(count, &q->nr_buf_used) - count; 1533 atomic_add(count, &q->nr_buf_used);
1534 1534
1535 if (need_siga_in(q)) 1535 if (need_siga_in(q))
1536 return qdio_siga_input(q); 1536 return qdio_siga_input(q);
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index f446a7705c3b..d4174b82a1a9 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -71,6 +71,7 @@ MODULE_AUTHOR("IBM Corporation");
71MODULE_DESCRIPTION("Adjunct Processor Bus driver, " \ 71MODULE_DESCRIPTION("Adjunct Processor Bus driver, " \
72 "Copyright IBM Corp. 2006, 2012"); 72 "Copyright IBM Corp. 2006, 2012");
73MODULE_LICENSE("GPL"); 73MODULE_LICENSE("GPL");
74MODULE_ALIAS("z90crypt");
74 75
75/* 76/*
76 * Module parameter 77 * Module parameter
diff --git a/drivers/spi/spi-altera.c b/drivers/spi/spi-altera.c
index 8a6bb37910da..81b9adb6e766 100644
--- a/drivers/spi/spi-altera.c
+++ b/drivers/spi/spi-altera.c
@@ -103,6 +103,16 @@ static void altera_spi_chipsel(struct spi_device *spi, int value)
103 } 103 }
104} 104}
105 105
106static int altera_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t)
107{
108 return 0;
109}
110
111static int altera_spi_setup(struct spi_device *spi)
112{
113 return 0;
114}
115
106static inline unsigned int hw_txbyte(struct altera_spi *hw, int count) 116static inline unsigned int hw_txbyte(struct altera_spi *hw, int count)
107{ 117{
108 if (hw->tx) { 118 if (hw->tx) {
@@ -221,6 +231,7 @@ static int altera_spi_probe(struct platform_device *pdev)
221 master->bus_num = pdev->id; 231 master->bus_num = pdev->id;
222 master->num_chipselect = 16; 232 master->num_chipselect = 16;
223 master->mode_bits = SPI_CS_HIGH; 233 master->mode_bits = SPI_CS_HIGH;
234 master->setup = altera_spi_setup;
224 235
225 hw = spi_master_get_devdata(master); 236 hw = spi_master_get_devdata(master);
226 platform_set_drvdata(pdev, hw); 237 platform_set_drvdata(pdev, hw);
@@ -229,6 +240,7 @@ static int altera_spi_probe(struct platform_device *pdev)
229 hw->bitbang.master = spi_master_get(master); 240 hw->bitbang.master = spi_master_get(master);
230 if (!hw->bitbang.master) 241 if (!hw->bitbang.master)
231 return err; 242 return err;
243 hw->bitbang.setup_transfer = altera_spi_setupxfer;
232 hw->bitbang.chipselect = altera_spi_chipsel; 244 hw->bitbang.chipselect = altera_spi_chipsel;
233 hw->bitbang.txrx_bufs = altera_spi_txrx; 245 hw->bitbang.txrx_bufs = altera_spi_txrx;
234 246
diff --git a/drivers/spi/spi-nuc900.c b/drivers/spi/spi-nuc900.c
index 2ad3d74ac021..150d85453c27 100644
--- a/drivers/spi/spi-nuc900.c
+++ b/drivers/spi/spi-nuc900.c
@@ -174,6 +174,17 @@ static void nuc900_spi_gobusy(struct nuc900_spi *hw)
174 spin_unlock_irqrestore(&hw->lock, flags); 174 spin_unlock_irqrestore(&hw->lock, flags);
175} 175}
176 176
177static int nuc900_spi_setupxfer(struct spi_device *spi,
178 struct spi_transfer *t)
179{
180 return 0;
181}
182
183static int nuc900_spi_setup(struct spi_device *spi)
184{
185 return 0;
186}
187
177static inline unsigned int hw_txbyte(struct nuc900_spi *hw, int count) 188static inline unsigned int hw_txbyte(struct nuc900_spi *hw, int count)
178{ 189{
179 return hw->tx ? hw->tx[count] : 0; 190 return hw->tx ? hw->tx[count] : 0;
@@ -366,8 +377,10 @@ static int nuc900_spi_probe(struct platform_device *pdev)
366 master->num_chipselect = hw->pdata->num_cs; 377 master->num_chipselect = hw->pdata->num_cs;
367 master->bus_num = hw->pdata->bus_num; 378 master->bus_num = hw->pdata->bus_num;
368 hw->bitbang.master = hw->master; 379 hw->bitbang.master = hw->master;
380 hw->bitbang.setup_transfer = nuc900_spi_setupxfer;
369 hw->bitbang.chipselect = nuc900_spi_chipsel; 381 hw->bitbang.chipselect = nuc900_spi_chipsel;
370 hw->bitbang.txrx_bufs = nuc900_spi_txrx; 382 hw->bitbang.txrx_bufs = nuc900_spi_txrx;
383 hw->bitbang.master->setup = nuc900_spi_setup;
371 384
372 hw->res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 385 hw->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
373 if (hw->res == NULL) { 386 if (hw->res == NULL) {
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index eb53df27e7ea..63e2070c6c14 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -434,6 +434,9 @@ static int s3c64xx_spi_prepare_transfer(struct spi_master *spi)
434 dma_cap_mask_t mask; 434 dma_cap_mask_t mask;
435 int ret; 435 int ret;
436 436
437 if (is_polling(sdd))
438 return 0;
439
437 dma_cap_zero(mask); 440 dma_cap_zero(mask);
438 dma_cap_set(DMA_SLAVE, mask); 441 dma_cap_set(DMA_SLAVE, mask);
439 442
diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index fb56fcfdf65e..09a942852593 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -233,6 +233,21 @@ static int xilinx_spi_setup_transfer(struct spi_device *spi,
233 return 0; 233 return 0;
234} 234}
235 235
236static int xilinx_spi_setup(struct spi_device *spi)
237{
238 /* always return 0, we can not check the number of bits.
239 * There are cases when SPI setup is called before any driver is
240 * there, in that case the SPI core defaults to 8 bits, which we
241 * do not support in some cases. But if we return an error, the
242 * SPI device would not be registered and no driver can get hold of it
243 * When the driver is there, it will call SPI setup again with the
244 * correct number of bits per transfer.
245 * If a driver setups with the wrong bit number, it will fail when
246 * it tries to do a transfer
247 */
248 return 0;
249}
250
236static void xilinx_spi_fill_tx_fifo(struct xilinx_spi *xspi) 251static void xilinx_spi_fill_tx_fifo(struct xilinx_spi *xspi)
237{ 252{
238 u8 sr; 253 u8 sr;
@@ -360,6 +375,7 @@ struct spi_master *xilinx_spi_init(struct device *dev, struct resource *mem,
360 xspi->bitbang.chipselect = xilinx_spi_chipselect; 375 xspi->bitbang.chipselect = xilinx_spi_chipselect;
361 xspi->bitbang.setup_transfer = xilinx_spi_setup_transfer; 376 xspi->bitbang.setup_transfer = xilinx_spi_setup_transfer;
362 xspi->bitbang.txrx_bufs = xilinx_spi_txrx_bufs; 377 xspi->bitbang.txrx_bufs = xilinx_spi_txrx_bufs;
378 xspi->bitbang.master->setup = xilinx_spi_setup;
363 init_completion(&xspi->done); 379 init_completion(&xspi->done);
364 380
365 if (!request_mem_region(mem->start, resource_size(mem), 381 if (!request_mem_region(mem->start, resource_size(mem),
diff --git a/drivers/staging/line6/pcm.c b/drivers/staging/line6/pcm.c
index 4795f1284906..0dd08ef51398 100644
--- a/drivers/staging/line6/pcm.c
+++ b/drivers/staging/line6/pcm.c
@@ -392,8 +392,11 @@ static int snd_line6_pcm_free(struct snd_device *device)
392*/ 392*/
393static void pcm_disconnect_substream(struct snd_pcm_substream *substream) 393static void pcm_disconnect_substream(struct snd_pcm_substream *substream)
394{ 394{
395 if (substream->runtime && snd_pcm_running(substream)) 395 if (substream->runtime && snd_pcm_running(substream)) {
396 snd_pcm_stream_lock_irq(substream);
396 snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED); 397 snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED);
398 snd_pcm_stream_unlock_irq(substream);
399 }
397} 400}
398 401
399/* 402/*
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index b963ea12d175..7aec6f39fdd5 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -1891,7 +1891,7 @@ static int uvesafb_setup(char *options)
1891 } 1891 }
1892 } 1892 }
1893 1893
1894 if (mtrr != 3 && mtrr != 1) 1894 if (mtrr != 3 && mtrr != 0)
1895 pr_warn("uvesafb: mtrr should be set to 0 or 3; %d is unsupported", mtrr); 1895 pr_warn("uvesafb: mtrr should be set to 0 or 3; %d is unsupported", mtrr);
1896 1896
1897 return 0; 1897 return 0;
diff --git a/drivers/xen/xen-acpi-cpuhotplug.c b/drivers/xen/xen-acpi-cpuhotplug.c
index 0caf4863be8c..8dae6c13063a 100644
--- a/drivers/xen/xen-acpi-cpuhotplug.c
+++ b/drivers/xen/xen-acpi-cpuhotplug.c
@@ -91,7 +91,7 @@ static int xen_acpi_processor_enable(struct acpi_device *device)
91 return 0; 91 return 0;
92} 92}
93 93
94static int __cpuinit xen_acpi_processor_add(struct acpi_device *device) 94static int xen_acpi_processor_add(struct acpi_device *device)
95{ 95{
96 int ret; 96 int ret;
97 struct acpi_processor *pr; 97 struct acpi_processor *pr;