diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2014-03-12 11:01:07 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2014-03-12 11:01:07 -0400 |
commit | ffb12cf002edbc5927079f51bebde428d601f723 (patch) | |
tree | 1f04d80df9db8883037d59c81f5836770eecfdc6 /drivers | |
parent | 1a75b8e64571a85d5e648cfdf4c40e0d9923abc5 (diff) | |
parent | c1bacbae8192dd2a9ebadd22d793b68054f6c6e5 (diff) |
Merge branch 'irq/for-gpio' into irq/core
Merge the request/release callbacks which are in a separate branch for
consumption by the gpio folks.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers')
361 files changed, 3999 insertions, 1824 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index e7515aa43d6b..6f190bc2b8b7 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -243,6 +243,8 @@ static int acpi_ac_resume(struct device *dev) | |||
243 | kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); | 243 | kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); |
244 | return 0; | 244 | return 0; |
245 | } | 245 | } |
246 | #else | ||
247 | #define acpi_ac_resume NULL | ||
246 | #endif | 248 | #endif |
247 | static SIMPLE_DEV_PM_OPS(acpi_ac_pm_ops, NULL, acpi_ac_resume); | 249 | static SIMPLE_DEV_PM_OPS(acpi_ac_pm_ops, NULL, acpi_ac_resume); |
248 | 250 | ||
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 018a42883706..797a6938d051 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -841,6 +841,8 @@ static int acpi_battery_resume(struct device *dev) | |||
841 | acpi_battery_update(battery); | 841 | acpi_battery_update(battery); |
842 | return 0; | 842 | return 0; |
843 | } | 843 | } |
844 | #else | ||
845 | #define acpi_battery_resume NULL | ||
844 | #endif | 846 | #endif |
845 | 847 | ||
846 | static SIMPLE_DEV_PM_OPS(acpi_battery_pm, NULL, acpi_battery_resume); | 848 | static SIMPLE_DEV_PM_OPS(acpi_battery_pm, NULL, acpi_battery_resume); |
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c index 10e4964d051a..afec4526c48a 100644 --- a/drivers/acpi/blacklist.c +++ b/drivers/acpi/blacklist.c | |||
@@ -260,14 +260,6 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { | |||
260 | }, | 260 | }, |
261 | { | 261 | { |
262 | .callback = dmi_disable_osi_win8, | 262 | .callback = dmi_disable_osi_win8, |
263 | .ident = "Dell Inspiron 15R SE", | ||
264 | .matches = { | ||
265 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
266 | DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7520"), | ||
267 | }, | ||
268 | }, | ||
269 | { | ||
270 | .callback = dmi_disable_osi_win8, | ||
271 | .ident = "ThinkPad Edge E530", | 263 | .ident = "ThinkPad Edge E530", |
272 | .matches = { | 264 | .matches = { |
273 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | 265 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
@@ -322,56 +314,6 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { | |||
322 | DMI_MATCH(DMI_PRODUCT_VERSION, "2349D15"), | 314 | DMI_MATCH(DMI_PRODUCT_VERSION, "2349D15"), |
323 | }, | 315 | }, |
324 | }, | 316 | }, |
325 | { | ||
326 | .callback = dmi_disable_osi_win8, | ||
327 | .ident = "HP ProBook 2013 models", | ||
328 | .matches = { | ||
329 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
330 | DMI_MATCH(DMI_PRODUCT_NAME, "HP ProBook "), | ||
331 | DMI_MATCH(DMI_PRODUCT_NAME, " G1"), | ||
332 | }, | ||
333 | }, | ||
334 | { | ||
335 | .callback = dmi_disable_osi_win8, | ||
336 | .ident = "HP EliteBook 2013 models", | ||
337 | .matches = { | ||
338 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
339 | DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook "), | ||
340 | DMI_MATCH(DMI_PRODUCT_NAME, " G1"), | ||
341 | }, | ||
342 | }, | ||
343 | { | ||
344 | .callback = dmi_disable_osi_win8, | ||
345 | .ident = "HP ZBook 14", | ||
346 | .matches = { | ||
347 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
348 | DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 14"), | ||
349 | }, | ||
350 | }, | ||
351 | { | ||
352 | .callback = dmi_disable_osi_win8, | ||
353 | .ident = "HP ZBook 15", | ||
354 | .matches = { | ||
355 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
356 | DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 15"), | ||
357 | }, | ||
358 | }, | ||
359 | { | ||
360 | .callback = dmi_disable_osi_win8, | ||
361 | .ident = "HP ZBook 17", | ||
362 | .matches = { | ||
363 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
364 | DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 17"), | ||
365 | }, | ||
366 | }, | ||
367 | { | ||
368 | .callback = dmi_disable_osi_win8, | ||
369 | .ident = "HP EliteBook 8780w", | ||
370 | .matches = { | ||
371 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
372 | DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook 8780w"), | ||
373 | }, | ||
374 | }, | ||
375 | 317 | ||
376 | /* | 318 | /* |
377 | * BIOS invocation of _OSI(Linux) is almost always a BIOS bug. | 319 | * BIOS invocation of _OSI(Linux) is almost always a BIOS bug. |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 11c11f6b8fa1..714e957a871a 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -80,6 +80,8 @@ static void acpi_button_notify(struct acpi_device *device, u32 event); | |||
80 | 80 | ||
81 | #ifdef CONFIG_PM_SLEEP | 81 | #ifdef CONFIG_PM_SLEEP |
82 | static int acpi_button_resume(struct device *dev); | 82 | static int acpi_button_resume(struct device *dev); |
83 | #else | ||
84 | #define acpi_button_resume NULL | ||
83 | #endif | 85 | #endif |
84 | static SIMPLE_DEV_PM_OPS(acpi_button_pm, NULL, acpi_button_resume); | 86 | static SIMPLE_DEV_PM_OPS(acpi_button_pm, NULL, acpi_button_resume); |
85 | 87 | ||
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index e9b3081c4fe9..5bfd769fc91f 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
@@ -713,13 +713,11 @@ static acpi_status __init find_dock_devices(acpi_handle handle, u32 lvl, | |||
713 | static ssize_t show_docked(struct device *dev, | 713 | static ssize_t show_docked(struct device *dev, |
714 | struct device_attribute *attr, char *buf) | 714 | struct device_attribute *attr, char *buf) |
715 | { | 715 | { |
716 | struct acpi_device *tmp; | ||
717 | |||
718 | struct dock_station *dock_station = dev->platform_data; | 716 | struct dock_station *dock_station = dev->platform_data; |
717 | struct acpi_device *adev = NULL; | ||
719 | 718 | ||
720 | if (!acpi_bus_get_device(dock_station->handle, &tmp)) | 719 | acpi_bus_get_device(dock_station->handle, &adev); |
721 | return snprintf(buf, PAGE_SIZE, "1\n"); | 720 | return snprintf(buf, PAGE_SIZE, "%u\n", acpi_device_enumerated(adev)); |
722 | return snprintf(buf, PAGE_SIZE, "0\n"); | ||
723 | } | 721 | } |
724 | static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL); | 722 | static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL); |
725 | 723 | ||
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 959d41acc108..d7d32c28829b 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -67,6 +67,8 @@ enum ec_command { | |||
67 | #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ | 67 | #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ |
68 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ | 68 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ |
69 | #define ACPI_EC_MSI_UDELAY 550 /* Wait 550us for MSI EC */ | 69 | #define ACPI_EC_MSI_UDELAY 550 /* Wait 550us for MSI EC */ |
70 | #define ACPI_EC_CLEAR_MAX 100 /* Maximum number of events to query | ||
71 | * when trying to clear the EC */ | ||
70 | 72 | ||
71 | enum { | 73 | enum { |
72 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ | 74 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ |
@@ -116,6 +118,7 @@ EXPORT_SYMBOL(first_ec); | |||
116 | static int EC_FLAGS_MSI; /* Out-of-spec MSI controller */ | 118 | static int EC_FLAGS_MSI; /* Out-of-spec MSI controller */ |
117 | static int EC_FLAGS_VALIDATE_ECDT; /* ASUStec ECDTs need to be validated */ | 119 | static int EC_FLAGS_VALIDATE_ECDT; /* ASUStec ECDTs need to be validated */ |
118 | static int EC_FLAGS_SKIP_DSDT_SCAN; /* Not all BIOS survive early DSDT scan */ | 120 | static int EC_FLAGS_SKIP_DSDT_SCAN; /* Not all BIOS survive early DSDT scan */ |
121 | static int EC_FLAGS_CLEAR_ON_RESUME; /* Needs acpi_ec_clear() on boot/resume */ | ||
119 | 122 | ||
120 | /* -------------------------------------------------------------------------- | 123 | /* -------------------------------------------------------------------------- |
121 | Transaction Management | 124 | Transaction Management |
@@ -440,6 +443,29 @@ acpi_handle ec_get_handle(void) | |||
440 | 443 | ||
441 | EXPORT_SYMBOL(ec_get_handle); | 444 | EXPORT_SYMBOL(ec_get_handle); |
442 | 445 | ||
446 | static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 *data); | ||
447 | |||
448 | /* | ||
449 | * Clears stale _Q events that might have accumulated in the EC. | ||
450 | * Run with locked ec mutex. | ||
451 | */ | ||
452 | static void acpi_ec_clear(struct acpi_ec *ec) | ||
453 | { | ||
454 | int i, status; | ||
455 | u8 value = 0; | ||
456 | |||
457 | for (i = 0; i < ACPI_EC_CLEAR_MAX; i++) { | ||
458 | status = acpi_ec_query_unlocked(ec, &value); | ||
459 | if (status || !value) | ||
460 | break; | ||
461 | } | ||
462 | |||
463 | if (unlikely(i == ACPI_EC_CLEAR_MAX)) | ||
464 | pr_warn("Warning: Maximum of %d stale EC events cleared\n", i); | ||
465 | else | ||
466 | pr_info("%d stale EC events cleared\n", i); | ||
467 | } | ||
468 | |||
443 | void acpi_ec_block_transactions(void) | 469 | void acpi_ec_block_transactions(void) |
444 | { | 470 | { |
445 | struct acpi_ec *ec = first_ec; | 471 | struct acpi_ec *ec = first_ec; |
@@ -463,6 +489,10 @@ void acpi_ec_unblock_transactions(void) | |||
463 | mutex_lock(&ec->mutex); | 489 | mutex_lock(&ec->mutex); |
464 | /* Allow transactions to be carried out again */ | 490 | /* Allow transactions to be carried out again */ |
465 | clear_bit(EC_FLAGS_BLOCKED, &ec->flags); | 491 | clear_bit(EC_FLAGS_BLOCKED, &ec->flags); |
492 | |||
493 | if (EC_FLAGS_CLEAR_ON_RESUME) | ||
494 | acpi_ec_clear(ec); | ||
495 | |||
466 | mutex_unlock(&ec->mutex); | 496 | mutex_unlock(&ec->mutex); |
467 | } | 497 | } |
468 | 498 | ||
@@ -821,6 +851,13 @@ static int acpi_ec_add(struct acpi_device *device) | |||
821 | 851 | ||
822 | /* EC is fully operational, allow queries */ | 852 | /* EC is fully operational, allow queries */ |
823 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); | 853 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); |
854 | |||
855 | /* Clear stale _Q events if hardware might require that */ | ||
856 | if (EC_FLAGS_CLEAR_ON_RESUME) { | ||
857 | mutex_lock(&ec->mutex); | ||
858 | acpi_ec_clear(ec); | ||
859 | mutex_unlock(&ec->mutex); | ||
860 | } | ||
824 | return ret; | 861 | return ret; |
825 | } | 862 | } |
826 | 863 | ||
@@ -922,6 +959,30 @@ static int ec_enlarge_storm_threshold(const struct dmi_system_id *id) | |||
922 | return 0; | 959 | return 0; |
923 | } | 960 | } |
924 | 961 | ||
962 | /* | ||
963 | * On some hardware it is necessary to clear events accumulated by the EC during | ||
964 | * sleep. These ECs stop reporting GPEs until they are manually polled, if too | ||
965 | * many events are accumulated. (e.g. Samsung Series 5/9 notebooks) | ||
966 | * | ||
967 | * https://bugzilla.kernel.org/show_bug.cgi?id=44161 | ||
968 | * | ||
969 | * Ideally, the EC should also be instructed NOT to accumulate events during | ||
970 | * sleep (which Windows seems to do somehow), but the interface to control this | ||
971 | * behaviour is not known at this time. | ||
972 | * | ||
973 | * Models known to be affected are Samsung 530Uxx/535Uxx/540Uxx/550Pxx/900Xxx, | ||
974 | * however it is very likely that other Samsung models are affected. | ||
975 | * | ||
976 | * On systems which don't accumulate _Q events during sleep, this extra check | ||
977 | * should be harmless. | ||
978 | */ | ||
979 | static int ec_clear_on_resume(const struct dmi_system_id *id) | ||
980 | { | ||
981 | pr_debug("Detected system needing EC poll on resume.\n"); | ||
982 | EC_FLAGS_CLEAR_ON_RESUME = 1; | ||
983 | return 0; | ||
984 | } | ||
985 | |||
925 | static struct dmi_system_id ec_dmi_table[] __initdata = { | 986 | static struct dmi_system_id ec_dmi_table[] __initdata = { |
926 | { | 987 | { |
927 | ec_skip_dsdt_scan, "Compal JFL92", { | 988 | ec_skip_dsdt_scan, "Compal JFL92", { |
@@ -965,6 +1026,9 @@ static struct dmi_system_id ec_dmi_table[] __initdata = { | |||
965 | ec_validate_ecdt, "ASUS hardware", { | 1026 | ec_validate_ecdt, "ASUS hardware", { |
966 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTek Computer Inc."), | 1027 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTek Computer Inc."), |
967 | DMI_MATCH(DMI_PRODUCT_NAME, "L4R"),}, NULL}, | 1028 | DMI_MATCH(DMI_PRODUCT_NAME, "L4R"),}, NULL}, |
1029 | { | ||
1030 | ec_clear_on_resume, "Samsung hardware", { | ||
1031 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD.")}, NULL}, | ||
968 | {}, | 1032 | {}, |
969 | }; | 1033 | }; |
970 | 1034 | ||
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 1fb62900f32a..09e423f3d8ad 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
@@ -55,6 +55,9 @@ MODULE_DEVICE_TABLE(acpi, fan_device_ids); | |||
55 | #ifdef CONFIG_PM_SLEEP | 55 | #ifdef CONFIG_PM_SLEEP |
56 | static int acpi_fan_suspend(struct device *dev); | 56 | static int acpi_fan_suspend(struct device *dev); |
57 | static int acpi_fan_resume(struct device *dev); | 57 | static int acpi_fan_resume(struct device *dev); |
58 | #else | ||
59 | #define acpi_fan_suspend NULL | ||
60 | #define acpi_fan_resume NULL | ||
58 | #endif | 61 | #endif |
59 | static SIMPLE_DEV_PM_OPS(acpi_fan_pm, acpi_fan_suspend, acpi_fan_resume); | 62 | static SIMPLE_DEV_PM_OPS(acpi_fan_pm, acpi_fan_suspend, acpi_fan_resume); |
60 | 63 | ||
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 52d45ea2bc4f..361b40c10c3f 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
@@ -430,6 +430,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
430 | pin_name(pin)); | 430 | pin_name(pin)); |
431 | } | 431 | } |
432 | 432 | ||
433 | kfree(entry); | ||
433 | return 0; | 434 | return 0; |
434 | } | 435 | } |
435 | 436 | ||
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 28baa05b8018..84243c32e29c 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
@@ -56,6 +56,12 @@ struct throttling_tstate { | |||
56 | int target_state; /* target T-state */ | 56 | int target_state; /* target T-state */ |
57 | }; | 57 | }; |
58 | 58 | ||
59 | struct acpi_processor_throttling_arg { | ||
60 | struct acpi_processor *pr; | ||
61 | int target_state; | ||
62 | bool force; | ||
63 | }; | ||
64 | |||
59 | #define THROTTLING_PRECHANGE (1) | 65 | #define THROTTLING_PRECHANGE (1) |
60 | #define THROTTLING_POSTCHANGE (2) | 66 | #define THROTTLING_POSTCHANGE (2) |
61 | 67 | ||
@@ -1060,16 +1066,24 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, | |||
1060 | return 0; | 1066 | return 0; |
1061 | } | 1067 | } |
1062 | 1068 | ||
1069 | static long acpi_processor_throttling_fn(void *data) | ||
1070 | { | ||
1071 | struct acpi_processor_throttling_arg *arg = data; | ||
1072 | struct acpi_processor *pr = arg->pr; | ||
1073 | |||
1074 | return pr->throttling.acpi_processor_set_throttling(pr, | ||
1075 | arg->target_state, arg->force); | ||
1076 | } | ||
1077 | |||
1063 | int acpi_processor_set_throttling(struct acpi_processor *pr, | 1078 | int acpi_processor_set_throttling(struct acpi_processor *pr, |
1064 | int state, bool force) | 1079 | int state, bool force) |
1065 | { | 1080 | { |
1066 | cpumask_var_t saved_mask; | ||
1067 | int ret = 0; | 1081 | int ret = 0; |
1068 | unsigned int i; | 1082 | unsigned int i; |
1069 | struct acpi_processor *match_pr; | 1083 | struct acpi_processor *match_pr; |
1070 | struct acpi_processor_throttling *p_throttling; | 1084 | struct acpi_processor_throttling *p_throttling; |
1085 | struct acpi_processor_throttling_arg arg; | ||
1071 | struct throttling_tstate t_state; | 1086 | struct throttling_tstate t_state; |
1072 | cpumask_var_t online_throttling_cpus; | ||
1073 | 1087 | ||
1074 | if (!pr) | 1088 | if (!pr) |
1075 | return -EINVAL; | 1089 | return -EINVAL; |
@@ -1080,14 +1094,6 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, | |||
1080 | if ((state < 0) || (state > (pr->throttling.state_count - 1))) | 1094 | if ((state < 0) || (state > (pr->throttling.state_count - 1))) |
1081 | return -EINVAL; | 1095 | return -EINVAL; |
1082 | 1096 | ||
1083 | if (!alloc_cpumask_var(&saved_mask, GFP_KERNEL)) | ||
1084 | return -ENOMEM; | ||
1085 | |||
1086 | if (!alloc_cpumask_var(&online_throttling_cpus, GFP_KERNEL)) { | ||
1087 | free_cpumask_var(saved_mask); | ||
1088 | return -ENOMEM; | ||
1089 | } | ||
1090 | |||
1091 | if (cpu_is_offline(pr->id)) { | 1097 | if (cpu_is_offline(pr->id)) { |
1092 | /* | 1098 | /* |
1093 | * the cpu pointed by pr->id is offline. Unnecessary to change | 1099 | * the cpu pointed by pr->id is offline. Unnecessary to change |
@@ -1096,17 +1102,15 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, | |||
1096 | return -ENODEV; | 1102 | return -ENODEV; |
1097 | } | 1103 | } |
1098 | 1104 | ||
1099 | cpumask_copy(saved_mask, ¤t->cpus_allowed); | ||
1100 | t_state.target_state = state; | 1105 | t_state.target_state = state; |
1101 | p_throttling = &(pr->throttling); | 1106 | p_throttling = &(pr->throttling); |
1102 | cpumask_and(online_throttling_cpus, cpu_online_mask, | 1107 | |
1103 | p_throttling->shared_cpu_map); | ||
1104 | /* | 1108 | /* |
1105 | * The throttling notifier will be called for every | 1109 | * The throttling notifier will be called for every |
1106 | * affected cpu in order to get one proper T-state. | 1110 | * affected cpu in order to get one proper T-state. |
1107 | * The notifier event is THROTTLING_PRECHANGE. | 1111 | * The notifier event is THROTTLING_PRECHANGE. |
1108 | */ | 1112 | */ |
1109 | for_each_cpu(i, online_throttling_cpus) { | 1113 | for_each_cpu_and(i, cpu_online_mask, p_throttling->shared_cpu_map) { |
1110 | t_state.cpu = i; | 1114 | t_state.cpu = i; |
1111 | acpi_processor_throttling_notifier(THROTTLING_PRECHANGE, | 1115 | acpi_processor_throttling_notifier(THROTTLING_PRECHANGE, |
1112 | &t_state); | 1116 | &t_state); |
@@ -1118,21 +1122,18 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, | |||
1118 | * it can be called only for the cpu pointed by pr. | 1122 | * it can be called only for the cpu pointed by pr. |
1119 | */ | 1123 | */ |
1120 | if (p_throttling->shared_type == DOMAIN_COORD_TYPE_SW_ANY) { | 1124 | if (p_throttling->shared_type == DOMAIN_COORD_TYPE_SW_ANY) { |
1121 | /* FIXME: use work_on_cpu() */ | 1125 | arg.pr = pr; |
1122 | if (set_cpus_allowed_ptr(current, cpumask_of(pr->id))) { | 1126 | arg.target_state = state; |
1123 | /* Can't migrate to the pr->id CPU. Exit */ | 1127 | arg.force = force; |
1124 | ret = -ENODEV; | 1128 | ret = work_on_cpu(pr->id, acpi_processor_throttling_fn, &arg); |
1125 | goto exit; | ||
1126 | } | ||
1127 | ret = p_throttling->acpi_processor_set_throttling(pr, | ||
1128 | t_state.target_state, force); | ||
1129 | } else { | 1129 | } else { |
1130 | /* | 1130 | /* |
1131 | * When the T-state coordination is SW_ALL or HW_ALL, | 1131 | * When the T-state coordination is SW_ALL or HW_ALL, |
1132 | * it is necessary to set T-state for every affected | 1132 | * it is necessary to set T-state for every affected |
1133 | * cpus. | 1133 | * cpus. |
1134 | */ | 1134 | */ |
1135 | for_each_cpu(i, online_throttling_cpus) { | 1135 | for_each_cpu_and(i, cpu_online_mask, |
1136 | p_throttling->shared_cpu_map) { | ||
1136 | match_pr = per_cpu(processors, i); | 1137 | match_pr = per_cpu(processors, i); |
1137 | /* | 1138 | /* |
1138 | * If the pointer is invalid, we will report the | 1139 | * If the pointer is invalid, we will report the |
@@ -1153,13 +1154,12 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, | |||
1153 | "on CPU %d\n", i)); | 1154 | "on CPU %d\n", i)); |
1154 | continue; | 1155 | continue; |
1155 | } | 1156 | } |
1156 | t_state.cpu = i; | 1157 | |
1157 | /* FIXME: use work_on_cpu() */ | 1158 | arg.pr = match_pr; |
1158 | if (set_cpus_allowed_ptr(current, cpumask_of(i))) | 1159 | arg.target_state = state; |
1159 | continue; | 1160 | arg.force = force; |
1160 | ret = match_pr->throttling. | 1161 | ret = work_on_cpu(pr->id, acpi_processor_throttling_fn, |
1161 | acpi_processor_set_throttling( | 1162 | &arg); |
1162 | match_pr, t_state.target_state, force); | ||
1163 | } | 1163 | } |
1164 | } | 1164 | } |
1165 | /* | 1165 | /* |
@@ -1168,17 +1168,12 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, | |||
1168 | * affected cpu to update the T-states. | 1168 | * affected cpu to update the T-states. |
1169 | * The notifier event is THROTTLING_POSTCHANGE | 1169 | * The notifier event is THROTTLING_POSTCHANGE |
1170 | */ | 1170 | */ |
1171 | for_each_cpu(i, online_throttling_cpus) { | 1171 | for_each_cpu_and(i, cpu_online_mask, p_throttling->shared_cpu_map) { |
1172 | t_state.cpu = i; | 1172 | t_state.cpu = i; |
1173 | acpi_processor_throttling_notifier(THROTTLING_POSTCHANGE, | 1173 | acpi_processor_throttling_notifier(THROTTLING_POSTCHANGE, |
1174 | &t_state); | 1174 | &t_state); |
1175 | } | 1175 | } |
1176 | /* restore the previous state */ | 1176 | |
1177 | /* FIXME: use work_on_cpu() */ | ||
1178 | set_cpus_allowed_ptr(current, saved_mask); | ||
1179 | exit: | ||
1180 | free_cpumask_var(online_throttling_cpus); | ||
1181 | free_cpumask_var(saved_mask); | ||
1182 | return ret; | 1177 | return ret; |
1183 | } | 1178 | } |
1184 | 1179 | ||
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c index b7201fc6f1e1..0bdacc5e26a3 100644 --- a/drivers/acpi/resource.c +++ b/drivers/acpi/resource.c | |||
@@ -77,18 +77,24 @@ bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res) | |||
77 | switch (ares->type) { | 77 | switch (ares->type) { |
78 | case ACPI_RESOURCE_TYPE_MEMORY24: | 78 | case ACPI_RESOURCE_TYPE_MEMORY24: |
79 | memory24 = &ares->data.memory24; | 79 | memory24 = &ares->data.memory24; |
80 | if (!memory24->address_length) | ||
81 | return false; | ||
80 | acpi_dev_get_memresource(res, memory24->minimum, | 82 | acpi_dev_get_memresource(res, memory24->minimum, |
81 | memory24->address_length, | 83 | memory24->address_length, |
82 | memory24->write_protect); | 84 | memory24->write_protect); |
83 | break; | 85 | break; |
84 | case ACPI_RESOURCE_TYPE_MEMORY32: | 86 | case ACPI_RESOURCE_TYPE_MEMORY32: |
85 | memory32 = &ares->data.memory32; | 87 | memory32 = &ares->data.memory32; |
88 | if (!memory32->address_length) | ||
89 | return false; | ||
86 | acpi_dev_get_memresource(res, memory32->minimum, | 90 | acpi_dev_get_memresource(res, memory32->minimum, |
87 | memory32->address_length, | 91 | memory32->address_length, |
88 | memory32->write_protect); | 92 | memory32->write_protect); |
89 | break; | 93 | break; |
90 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: | 94 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
91 | fixed_memory32 = &ares->data.fixed_memory32; | 95 | fixed_memory32 = &ares->data.fixed_memory32; |
96 | if (!fixed_memory32->address_length) | ||
97 | return false; | ||
92 | acpi_dev_get_memresource(res, fixed_memory32->address, | 98 | acpi_dev_get_memresource(res, fixed_memory32->address, |
93 | fixed_memory32->address_length, | 99 | fixed_memory32->address_length, |
94 | fixed_memory32->write_protect); | 100 | fixed_memory32->write_protect); |
@@ -144,12 +150,16 @@ bool acpi_dev_resource_io(struct acpi_resource *ares, struct resource *res) | |||
144 | switch (ares->type) { | 150 | switch (ares->type) { |
145 | case ACPI_RESOURCE_TYPE_IO: | 151 | case ACPI_RESOURCE_TYPE_IO: |
146 | io = &ares->data.io; | 152 | io = &ares->data.io; |
153 | if (!io->address_length) | ||
154 | return false; | ||
147 | acpi_dev_get_ioresource(res, io->minimum, | 155 | acpi_dev_get_ioresource(res, io->minimum, |
148 | io->address_length, | 156 | io->address_length, |
149 | io->io_decode); | 157 | io->io_decode); |
150 | break; | 158 | break; |
151 | case ACPI_RESOURCE_TYPE_FIXED_IO: | 159 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
152 | fixed_io = &ares->data.fixed_io; | 160 | fixed_io = &ares->data.fixed_io; |
161 | if (!fixed_io->address_length) | ||
162 | return false; | ||
153 | acpi_dev_get_ioresource(res, fixed_io->address, | 163 | acpi_dev_get_ioresource(res, fixed_io->address, |
154 | fixed_io->address_length, | 164 | fixed_io->address_length, |
155 | ACPI_DECODE_10); | 165 | ACPI_DECODE_10); |
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index d465ae6cdd00..dbd48498b938 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -450,7 +450,7 @@ static ssize_t acpi_battery_alarm_store(struct device *dev, | |||
450 | { | 450 | { |
451 | unsigned long x; | 451 | unsigned long x; |
452 | struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev)); | 452 | struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev)); |
453 | if (sscanf(buf, "%ld\n", &x) == 1) | 453 | if (sscanf(buf, "%lu\n", &x) == 1) |
454 | battery->alarm_capacity = x / | 454 | battery->alarm_capacity = x / |
455 | (1000 * acpi_battery_scale(battery)); | 455 | (1000 * acpi_battery_scale(battery)); |
456 | if (battery->present) | 456 | if (battery->present) |
@@ -668,6 +668,8 @@ static int acpi_sbs_resume(struct device *dev) | |||
668 | acpi_sbs_callback(sbs); | 668 | acpi_sbs_callback(sbs); |
669 | return 0; | 669 | return 0; |
670 | } | 670 | } |
671 | #else | ||
672 | #define acpi_sbs_resume NULL | ||
671 | #endif | 673 | #endif |
672 | 674 | ||
673 | static SIMPLE_DEV_PM_OPS(acpi_sbs_pm, NULL, acpi_sbs_resume); | 675 | static SIMPLE_DEV_PM_OPS(acpi_sbs_pm, NULL, acpi_sbs_resume); |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 8349a555b92b..08626c851be7 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -102,6 +102,8 @@ MODULE_DEVICE_TABLE(acpi, thermal_device_ids); | |||
102 | 102 | ||
103 | #ifdef CONFIG_PM_SLEEP | 103 | #ifdef CONFIG_PM_SLEEP |
104 | static int acpi_thermal_resume(struct device *dev); | 104 | static int acpi_thermal_resume(struct device *dev); |
105 | #else | ||
106 | #define acpi_thermal_resume NULL | ||
105 | #endif | 107 | #endif |
106 | static SIMPLE_DEV_PM_OPS(acpi_thermal_pm, NULL, acpi_thermal_resume); | 108 | static SIMPLE_DEV_PM_OPS(acpi_thermal_pm, NULL, acpi_thermal_resume); |
107 | 109 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index b727d105046d..b6ba88ed31ae 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -81,11 +81,12 @@ static bool allow_duplicates; | |||
81 | module_param(allow_duplicates, bool, 0644); | 81 | module_param(allow_duplicates, bool, 0644); |
82 | 82 | ||
83 | /* | 83 | /* |
84 | * For Windows 8 systems: if set ture and the GPU driver has | 84 | * For Windows 8 systems: used to decide if video module |
85 | * registered a backlight interface, skip registering ACPI video's. | 85 | * should skip registering backlight interface of its own. |
86 | */ | 86 | */ |
87 | static bool use_native_backlight = false; | 87 | static int use_native_backlight_param = -1; |
88 | module_param(use_native_backlight, bool, 0644); | 88 | module_param_named(use_native_backlight, use_native_backlight_param, int, 0444); |
89 | static bool use_native_backlight_dmi = false; | ||
89 | 90 | ||
90 | static int register_count; | 91 | static int register_count; |
91 | static struct mutex video_list_lock; | 92 | static struct mutex video_list_lock; |
@@ -231,9 +232,17 @@ static int acpi_video_get_next_level(struct acpi_video_device *device, | |||
231 | static int acpi_video_switch_brightness(struct acpi_video_device *device, | 232 | static int acpi_video_switch_brightness(struct acpi_video_device *device, |
232 | int event); | 233 | int event); |
233 | 234 | ||
235 | static bool acpi_video_use_native_backlight(void) | ||
236 | { | ||
237 | if (use_native_backlight_param != -1) | ||
238 | return use_native_backlight_param; | ||
239 | else | ||
240 | return use_native_backlight_dmi; | ||
241 | } | ||
242 | |||
234 | static bool acpi_video_verify_backlight_support(void) | 243 | static bool acpi_video_verify_backlight_support(void) |
235 | { | 244 | { |
236 | if (acpi_osi_is_win8() && use_native_backlight && | 245 | if (acpi_osi_is_win8() && acpi_video_use_native_backlight() && |
237 | backlight_device_registered(BACKLIGHT_RAW)) | 246 | backlight_device_registered(BACKLIGHT_RAW)) |
238 | return false; | 247 | return false; |
239 | return acpi_video_backlight_support(); | 248 | return acpi_video_backlight_support(); |
@@ -398,6 +407,12 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d) | |||
398 | return 0; | 407 | return 0; |
399 | } | 408 | } |
400 | 409 | ||
410 | static int __init video_set_use_native_backlight(const struct dmi_system_id *d) | ||
411 | { | ||
412 | use_native_backlight_dmi = true; | ||
413 | return 0; | ||
414 | } | ||
415 | |||
401 | static struct dmi_system_id video_dmi_table[] __initdata = { | 416 | static struct dmi_system_id video_dmi_table[] __initdata = { |
402 | /* | 417 | /* |
403 | * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 | 418 | * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 |
@@ -442,6 +457,120 @@ static struct dmi_system_id video_dmi_table[] __initdata = { | |||
442 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7720"), | 457 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7720"), |
443 | }, | 458 | }, |
444 | }, | 459 | }, |
460 | { | ||
461 | .callback = video_set_use_native_backlight, | ||
462 | .ident = "ThinkPad T430s", | ||
463 | .matches = { | ||
464 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
465 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T430s"), | ||
466 | }, | ||
467 | }, | ||
468 | { | ||
469 | .callback = video_set_use_native_backlight, | ||
470 | .ident = "ThinkPad X230", | ||
471 | .matches = { | ||
472 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
473 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X230"), | ||
474 | }, | ||
475 | }, | ||
476 | { | ||
477 | .callback = video_set_use_native_backlight, | ||
478 | .ident = "ThinkPad X1 Carbon", | ||
479 | .matches = { | ||
480 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
481 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X1 Carbon"), | ||
482 | }, | ||
483 | }, | ||
484 | { | ||
485 | .callback = video_set_use_native_backlight, | ||
486 | .ident = "Lenovo Yoga 13", | ||
487 | .matches = { | ||
488 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
489 | DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Yoga 13"), | ||
490 | }, | ||
491 | }, | ||
492 | { | ||
493 | .callback = video_set_use_native_backlight, | ||
494 | .ident = "Dell Inspiron 7520", | ||
495 | .matches = { | ||
496 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
497 | DMI_MATCH(DMI_PRODUCT_VERSION, "Inspiron 7520"), | ||
498 | }, | ||
499 | }, | ||
500 | { | ||
501 | .callback = video_set_use_native_backlight, | ||
502 | .ident = "Acer Aspire 5733Z", | ||
503 | .matches = { | ||
504 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
505 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5733Z"), | ||
506 | }, | ||
507 | }, | ||
508 | { | ||
509 | .callback = video_set_use_native_backlight, | ||
510 | .ident = "Acer Aspire V5-431", | ||
511 | .matches = { | ||
512 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
513 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire V5-431"), | ||
514 | }, | ||
515 | }, | ||
516 | { | ||
517 | .callback = video_set_use_native_backlight, | ||
518 | .ident = "HP ProBook 4340s", | ||
519 | .matches = { | ||
520 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
521 | DMI_MATCH(DMI_PRODUCT_VERSION, "HP ProBook 4340s"), | ||
522 | }, | ||
523 | }, | ||
524 | { | ||
525 | .callback = video_set_use_native_backlight, | ||
526 | .ident = "HP ProBook 2013 models", | ||
527 | .matches = { | ||
528 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
529 | DMI_MATCH(DMI_PRODUCT_NAME, "HP ProBook "), | ||
530 | DMI_MATCH(DMI_PRODUCT_NAME, " G1"), | ||
531 | }, | ||
532 | }, | ||
533 | { | ||
534 | .callback = video_set_use_native_backlight, | ||
535 | .ident = "HP EliteBook 2013 models", | ||
536 | .matches = { | ||
537 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
538 | DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook "), | ||
539 | DMI_MATCH(DMI_PRODUCT_NAME, " G1"), | ||
540 | }, | ||
541 | }, | ||
542 | { | ||
543 | .callback = video_set_use_native_backlight, | ||
544 | .ident = "HP ZBook 14", | ||
545 | .matches = { | ||
546 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
547 | DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 14"), | ||
548 | }, | ||
549 | }, | ||
550 | { | ||
551 | .callback = video_set_use_native_backlight, | ||
552 | .ident = "HP ZBook 15", | ||
553 | .matches = { | ||
554 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
555 | DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 15"), | ||
556 | }, | ||
557 | }, | ||
558 | { | ||
559 | .callback = video_set_use_native_backlight, | ||
560 | .ident = "HP ZBook 17", | ||
561 | .matches = { | ||
562 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
563 | DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 17"), | ||
564 | }, | ||
565 | }, | ||
566 | { | ||
567 | .callback = video_set_use_native_backlight, | ||
568 | .ident = "HP EliteBook 8780w", | ||
569 | .matches = { | ||
570 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
571 | DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook 8780w"), | ||
572 | }, | ||
573 | }, | ||
445 | {} | 574 | {} |
446 | }; | 575 | }; |
447 | 576 | ||
@@ -685,6 +814,7 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
685 | union acpi_object *o; | 814 | union acpi_object *o; |
686 | struct acpi_video_device_brightness *br = NULL; | 815 | struct acpi_video_device_brightness *br = NULL; |
687 | int result = -EINVAL; | 816 | int result = -EINVAL; |
817 | u32 value; | ||
688 | 818 | ||
689 | if (!ACPI_SUCCESS(acpi_video_device_lcd_query_levels(device, &obj))) { | 819 | if (!ACPI_SUCCESS(acpi_video_device_lcd_query_levels(device, &obj))) { |
690 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Could not query available " | 820 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Could not query available " |
@@ -715,7 +845,12 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
715 | printk(KERN_ERR PREFIX "Invalid data\n"); | 845 | printk(KERN_ERR PREFIX "Invalid data\n"); |
716 | continue; | 846 | continue; |
717 | } | 847 | } |
718 | br->levels[count] = (u32) o->integer.value; | 848 | value = (u32) o->integer.value; |
849 | /* Skip duplicate entries */ | ||
850 | if (count > 2 && br->levels[count - 1] == value) | ||
851 | continue; | ||
852 | |||
853 | br->levels[count] = value; | ||
719 | 854 | ||
720 | if (br->levels[count] > max_level) | 855 | if (br->levels[count] > max_level) |
721 | max_level = br->levels[count]; | 856 | max_level = br->levels[count]; |
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index a697b77b8865..19080c8e2f2a 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c | |||
@@ -168,22 +168,6 @@ static struct dmi_system_id video_detect_dmi_table[] = { | |||
168 | DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"), | 168 | DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"), |
169 | }, | 169 | }, |
170 | }, | 170 | }, |
171 | { | ||
172 | .callback = video_detect_force_vendor, | ||
173 | .ident = "HP EliteBook Revolve 810", | ||
174 | .matches = { | ||
175 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
176 | DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook Revolve 810 G1"), | ||
177 | }, | ||
178 | }, | ||
179 | { | ||
180 | .callback = video_detect_force_vendor, | ||
181 | .ident = "Lenovo Yoga 13", | ||
182 | .matches = { | ||
183 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
184 | DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Yoga 13"), | ||
185 | }, | ||
186 | }, | ||
187 | { }, | 171 | { }, |
188 | }; | 172 | }; |
189 | 173 | ||
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 4e737728aee2..868429a47be4 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -247,6 +247,7 @@ config SATA_HIGHBANK | |||
247 | 247 | ||
248 | config SATA_MV | 248 | config SATA_MV |
249 | tristate "Marvell SATA support" | 249 | tristate "Marvell SATA support" |
250 | select GENERIC_PHY | ||
250 | help | 251 | help |
251 | This option enables support for the Marvell Serial ATA family. | 252 | This option enables support for the Marvell Serial ATA family. |
252 | Currently supports 88SX[56]0[48][01] PCI(-X) chips, | 253 | Currently supports 88SX[56]0[48][01] PCI(-X) chips, |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index dc2756fb6f33..c81d809c111b 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -61,6 +61,7 @@ enum board_ids { | |||
61 | /* board IDs by feature in alphabetical order */ | 61 | /* board IDs by feature in alphabetical order */ |
62 | board_ahci, | 62 | board_ahci, |
63 | board_ahci_ign_iferr, | 63 | board_ahci_ign_iferr, |
64 | board_ahci_noncq, | ||
64 | board_ahci_nosntf, | 65 | board_ahci_nosntf, |
65 | board_ahci_yes_fbs, | 66 | board_ahci_yes_fbs, |
66 | 67 | ||
@@ -121,6 +122,13 @@ static const struct ata_port_info ahci_port_info[] = { | |||
121 | .udma_mask = ATA_UDMA6, | 122 | .udma_mask = ATA_UDMA6, |
122 | .port_ops = &ahci_ops, | 123 | .port_ops = &ahci_ops, |
123 | }, | 124 | }, |
125 | [board_ahci_noncq] = { | ||
126 | AHCI_HFLAGS (AHCI_HFLAG_NO_NCQ), | ||
127 | .flags = AHCI_FLAG_COMMON, | ||
128 | .pio_mask = ATA_PIO4, | ||
129 | .udma_mask = ATA_UDMA6, | ||
130 | .port_ops = &ahci_ops, | ||
131 | }, | ||
124 | [board_ahci_nosntf] = { | 132 | [board_ahci_nosntf] = { |
125 | AHCI_HFLAGS (AHCI_HFLAG_NO_SNTF), | 133 | AHCI_HFLAGS (AHCI_HFLAG_NO_SNTF), |
126 | .flags = AHCI_FLAG_COMMON, | 134 | .flags = AHCI_FLAG_COMMON, |
@@ -452,6 +460,12 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
452 | { PCI_VDEVICE(ASMEDIA, 0x0611), board_ahci }, /* ASM1061 */ | 460 | { PCI_VDEVICE(ASMEDIA, 0x0611), board_ahci }, /* ASM1061 */ |
453 | { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1062 */ | 461 | { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1062 */ |
454 | 462 | ||
463 | /* | ||
464 | * Samsung SSDs found on some macbooks. NCQ times out. | ||
465 | * https://bugzilla.kernel.org/show_bug.cgi?id=60731 | ||
466 | */ | ||
467 | { PCI_VDEVICE(SAMSUNG, 0x1600), board_ahci_noncq }, | ||
468 | |||
455 | /* Enmotus */ | 469 | /* Enmotus */ |
456 | { PCI_DEVICE(0x1c44, 0x8000), board_ahci }, | 470 | { PCI_DEVICE(0x1c44, 0x8000), board_ahci }, |
457 | 471 | ||
@@ -1170,8 +1184,10 @@ static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports, | |||
1170 | 1184 | ||
1171 | nvec = rc; | 1185 | nvec = rc; |
1172 | rc = pci_enable_msi_block(pdev, nvec); | 1186 | rc = pci_enable_msi_block(pdev, nvec); |
1173 | if (rc) | 1187 | if (rc < 0) |
1174 | goto intx; | 1188 | goto intx; |
1189 | else if (rc > 0) | ||
1190 | goto single_msi; | ||
1175 | 1191 | ||
1176 | return nvec; | 1192 | return nvec; |
1177 | 1193 | ||
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 1a3dbd1b196e..65d3f1b5966c 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -4175,6 +4175,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4175 | 4175 | ||
4176 | /* Seagate Momentus SpinPoint M8 seem to have FPMDA_AA issues */ | 4176 | /* Seagate Momentus SpinPoint M8 seem to have FPMDA_AA issues */ |
4177 | { "ST1000LM024 HN-M101MBB", "2AR10001", ATA_HORKAGE_BROKEN_FPDMA_AA }, | 4177 | { "ST1000LM024 HN-M101MBB", "2AR10001", ATA_HORKAGE_BROKEN_FPDMA_AA }, |
4178 | { "ST1000LM024 HN-M101MBB", "2BA30001", ATA_HORKAGE_BROKEN_FPDMA_AA }, | ||
4178 | 4179 | ||
4179 | /* Blacklist entries taken from Silicon Image 3124/3132 | 4180 | /* Blacklist entries taken from Silicon Image 3124/3132 |
4180 | Windows driver .inf file - also several Linux problem reports */ | 4181 | Windows driver .inf file - also several Linux problem reports */ |
@@ -4225,6 +4226,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4225 | /* devices that don't properly handle queued TRIM commands */ | 4226 | /* devices that don't properly handle queued TRIM commands */ |
4226 | { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | 4227 | { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, |
4227 | { "Crucial_CT???M500SSD1", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | 4228 | { "Crucial_CT???M500SSD1", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, |
4229 | { "Crucial_CT???M500SSD3", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | ||
4228 | 4230 | ||
4229 | /* | 4231 | /* |
4230 | * Some WD SATA-I drives spin up and down erratically when the link | 4232 | * Some WD SATA-I drives spin up and down erratically when the link |
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c index 20fd337a5731..7ccc084bf1df 100644 --- a/drivers/ata/libata-pmp.c +++ b/drivers/ata/libata-pmp.c | |||
@@ -447,8 +447,11 @@ static void sata_pmp_quirks(struct ata_port *ap) | |||
447 | * otherwise. Don't try hard to recover it. | 447 | * otherwise. Don't try hard to recover it. |
448 | */ | 448 | */ |
449 | ap->pmp_link[ap->nr_pmp_links - 1].flags |= ATA_LFLAG_NO_RETRY; | 449 | ap->pmp_link[ap->nr_pmp_links - 1].flags |= ATA_LFLAG_NO_RETRY; |
450 | } else if (vendor == 0x197b && devid == 0x2352) { | 450 | } else if (vendor == 0x197b && (devid == 0x2352 || devid == 0x0325)) { |
451 | /* chip found in Thermaltake BlackX Duet, jmicron JMB350? */ | 451 | /* |
452 | * 0x2352: found in Thermaltake BlackX Duet, jmicron JMB350? | ||
453 | * 0x0325: jmicron JMB394. | ||
454 | */ | ||
452 | ata_for_each_link(link, ap, EDGE) { | 455 | ata_for_each_link(link, ap, EDGE) { |
453 | /* SRST breaks detection and disks get misclassified | 456 | /* SRST breaks detection and disks get misclassified |
454 | * LPM disabled to avoid potential problems | 457 | * LPM disabled to avoid potential problems |
diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c index 26386f0b89a8..b0b18ec5465f 100644 --- a/drivers/ata/pata_imx.c +++ b/drivers/ata/pata_imx.c | |||
@@ -119,7 +119,9 @@ static int pata_imx_probe(struct platform_device *pdev) | |||
119 | return PTR_ERR(priv->clk); | 119 | return PTR_ERR(priv->clk); |
120 | } | 120 | } |
121 | 121 | ||
122 | clk_prepare_enable(priv->clk); | 122 | ret = clk_prepare_enable(priv->clk); |
123 | if (ret) | ||
124 | return ret; | ||
123 | 125 | ||
124 | host = ata_host_alloc(&pdev->dev, 1); | 126 | host = ata_host_alloc(&pdev->dev, 1); |
125 | if (!host) { | 127 | if (!host) { |
@@ -212,7 +214,9 @@ static int pata_imx_resume(struct device *dev) | |||
212 | struct ata_host *host = dev_get_drvdata(dev); | 214 | struct ata_host *host = dev_get_drvdata(dev); |
213 | struct pata_imx_priv *priv = host->private_data; | 215 | struct pata_imx_priv *priv = host->private_data; |
214 | 216 | ||
215 | clk_prepare_enable(priv->clk); | 217 | int ret = clk_prepare_enable(priv->clk); |
218 | if (ret) | ||
219 | return ret; | ||
216 | 220 | ||
217 | __raw_writel(priv->ata_ctl, priv->host_regs + PATA_IMX_ATA_CONTROL); | 221 | __raw_writel(priv->ata_ctl, priv->host_regs + PATA_IMX_ATA_CONTROL); |
218 | 222 | ||
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 52b8181ddafd..05c8a44adf8e 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -4104,7 +4104,6 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
4104 | if (!hpriv->port_phys) | 4104 | if (!hpriv->port_phys) |
4105 | return -ENOMEM; | 4105 | return -ENOMEM; |
4106 | host->private_data = hpriv; | 4106 | host->private_data = hpriv; |
4107 | hpriv->n_ports = n_ports; | ||
4108 | hpriv->board_idx = chip_soc; | 4107 | hpriv->board_idx = chip_soc; |
4109 | 4108 | ||
4110 | host->iomap = NULL; | 4109 | host->iomap = NULL; |
@@ -4132,13 +4131,18 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
4132 | rc = PTR_ERR(hpriv->port_phys[port]); | 4131 | rc = PTR_ERR(hpriv->port_phys[port]); |
4133 | hpriv->port_phys[port] = NULL; | 4132 | hpriv->port_phys[port] = NULL; |
4134 | if (rc != -EPROBE_DEFER) | 4133 | if (rc != -EPROBE_DEFER) |
4135 | dev_warn(&pdev->dev, "error getting phy %d", | 4134 | dev_warn(&pdev->dev, "error getting phy %d", rc); |
4136 | rc); | 4135 | |
4136 | /* Cleanup only the initialized ports */ | ||
4137 | hpriv->n_ports = port; | ||
4137 | goto err; | 4138 | goto err; |
4138 | } else | 4139 | } else |
4139 | phy_power_on(hpriv->port_phys[port]); | 4140 | phy_power_on(hpriv->port_phys[port]); |
4140 | } | 4141 | } |
4141 | 4142 | ||
4143 | /* All the ports have been initialized */ | ||
4144 | hpriv->n_ports = n_ports; | ||
4145 | |||
4142 | /* | 4146 | /* |
4143 | * (Re-)program MBUS remapping windows if we are asked to. | 4147 | * (Re-)program MBUS remapping windows if we are asked to. |
4144 | */ | 4148 | */ |
@@ -4176,7 +4180,7 @@ err: | |||
4176 | clk_disable_unprepare(hpriv->clk); | 4180 | clk_disable_unprepare(hpriv->clk); |
4177 | clk_put(hpriv->clk); | 4181 | clk_put(hpriv->clk); |
4178 | } | 4182 | } |
4179 | for (port = 0; port < n_ports; port++) { | 4183 | for (port = 0; port < hpriv->n_ports; port++) { |
4180 | if (!IS_ERR(hpriv->port_clks[port])) { | 4184 | if (!IS_ERR(hpriv->port_clks[port])) { |
4181 | clk_disable_unprepare(hpriv->port_clks[port]); | 4185 | clk_disable_unprepare(hpriv->port_clks[port]); |
4182 | clk_put(hpriv->port_clks[port]); | 4186 | clk_put(hpriv->port_clks[port]); |
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c index d67fc351343c..b7695e804635 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c | |||
@@ -157,6 +157,7 @@ static const struct sil_drivelist { | |||
157 | { "ST380011ASL", SIL_QUIRK_MOD15WRITE }, | 157 | { "ST380011ASL", SIL_QUIRK_MOD15WRITE }, |
158 | { "ST3120022ASL", SIL_QUIRK_MOD15WRITE }, | 158 | { "ST3120022ASL", SIL_QUIRK_MOD15WRITE }, |
159 | { "ST3160021ASL", SIL_QUIRK_MOD15WRITE }, | 159 | { "ST3160021ASL", SIL_QUIRK_MOD15WRITE }, |
160 | { "TOSHIBA MK2561GSYN", SIL_QUIRK_MOD15WRITE }, | ||
160 | { "Maxtor 4D060H3", SIL_QUIRK_UDMA5MAX }, | 161 | { "Maxtor 4D060H3", SIL_QUIRK_UDMA5MAX }, |
161 | { } | 162 | { } |
162 | }; | 163 | }; |
diff --git a/drivers/base/dma-buf.c b/drivers/base/dma-buf.c index 1e16cbd61da2..61d6d62cc0d3 100644 --- a/drivers/base/dma-buf.c +++ b/drivers/base/dma-buf.c | |||
@@ -616,36 +616,35 @@ static int dma_buf_describe(struct seq_file *s) | |||
616 | if (ret) | 616 | if (ret) |
617 | return ret; | 617 | return ret; |
618 | 618 | ||
619 | seq_printf(s, "\nDma-buf Objects:\n"); | 619 | seq_puts(s, "\nDma-buf Objects:\n"); |
620 | seq_printf(s, "\texp_name\tsize\tflags\tmode\tcount\n"); | 620 | seq_puts(s, "size\tflags\tmode\tcount\texp_name\n"); |
621 | 621 | ||
622 | list_for_each_entry(buf_obj, &db_list.head, list_node) { | 622 | list_for_each_entry(buf_obj, &db_list.head, list_node) { |
623 | ret = mutex_lock_interruptible(&buf_obj->lock); | 623 | ret = mutex_lock_interruptible(&buf_obj->lock); |
624 | 624 | ||
625 | if (ret) { | 625 | if (ret) { |
626 | seq_printf(s, | 626 | seq_puts(s, |
627 | "\tERROR locking buffer object: skipping\n"); | 627 | "\tERROR locking buffer object: skipping\n"); |
628 | continue; | 628 | continue; |
629 | } | 629 | } |
630 | 630 | ||
631 | seq_printf(s, "\t"); | 631 | seq_printf(s, "%08zu\t%08x\t%08x\t%08ld\t%s\n", |
632 | 632 | buf_obj->size, | |
633 | seq_printf(s, "\t%s\t%08zu\t%08x\t%08x\t%08ld\n", | ||
634 | buf_obj->exp_name, buf_obj->size, | ||
635 | buf_obj->file->f_flags, buf_obj->file->f_mode, | 633 | buf_obj->file->f_flags, buf_obj->file->f_mode, |
636 | (long)(buf_obj->file->f_count.counter)); | 634 | (long)(buf_obj->file->f_count.counter), |
635 | buf_obj->exp_name); | ||
637 | 636 | ||
638 | seq_printf(s, "\t\tAttached Devices:\n"); | 637 | seq_puts(s, "\tAttached Devices:\n"); |
639 | attach_count = 0; | 638 | attach_count = 0; |
640 | 639 | ||
641 | list_for_each_entry(attach_obj, &buf_obj->attachments, node) { | 640 | list_for_each_entry(attach_obj, &buf_obj->attachments, node) { |
642 | seq_printf(s, "\t\t"); | 641 | seq_puts(s, "\t"); |
643 | 642 | ||
644 | seq_printf(s, "%s\n", attach_obj->dev->init_name); | 643 | seq_printf(s, "%s\n", dev_name(attach_obj->dev)); |
645 | attach_count++; | 644 | attach_count++; |
646 | } | 645 | } |
647 | 646 | ||
648 | seq_printf(s, "\n\t\tTotal %d devices attached\n", | 647 | seq_printf(s, "Total %d devices attached\n\n", |
649 | attach_count); | 648 | attach_count); |
650 | 649 | ||
651 | count++; | 650 | count++; |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 8a97ddfa6122..c30df50e4440 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -1580,6 +1580,7 @@ static int fw_pm_notify(struct notifier_block *notify_block, | |||
1580 | switch (mode) { | 1580 | switch (mode) { |
1581 | case PM_HIBERNATION_PREPARE: | 1581 | case PM_HIBERNATION_PREPARE: |
1582 | case PM_SUSPEND_PREPARE: | 1582 | case PM_SUSPEND_PREPARE: |
1583 | case PM_RESTORE_PREPARE: | ||
1583 | kill_requests_without_uevent(); | 1584 | kill_requests_without_uevent(); |
1584 | device_cache_fw_images(); | 1585 | device_cache_fw_images(); |
1585 | break; | 1586 | break; |
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index 8184451b57c0..422b7d84f686 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c | |||
@@ -874,7 +874,7 @@ bio_pageinc(struct bio *bio) | |||
874 | /* Non-zero page count for non-head members of | 874 | /* Non-zero page count for non-head members of |
875 | * compound pages is no longer allowed by the kernel. | 875 | * compound pages is no longer allowed by the kernel. |
876 | */ | 876 | */ |
877 | page = compound_trans_head(bv.bv_page); | 877 | page = compound_head(bv.bv_page); |
878 | atomic_inc(&page->_count); | 878 | atomic_inc(&page->_count); |
879 | } | 879 | } |
880 | } | 880 | } |
@@ -887,7 +887,7 @@ bio_pagedec(struct bio *bio) | |||
887 | struct bvec_iter iter; | 887 | struct bvec_iter iter; |
888 | 888 | ||
889 | bio_for_each_segment(bv, bio, iter) { | 889 | bio_for_each_segment(bv, bio, iter) { |
890 | page = compound_trans_head(bv.bv_page); | 890 | page = compound_head(bv.bv_page); |
891 | atomic_dec(&page->_count); | 891 | atomic_dec(&page->_count); |
892 | } | 892 | } |
893 | } | 893 | } |
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h index b52e9a6d6aad..54174cb32feb 100644 --- a/drivers/block/mtip32xx/mtip32xx.h +++ b/drivers/block/mtip32xx/mtip32xx.h | |||
@@ -53,7 +53,7 @@ | |||
53 | #define MTIP_FTL_REBUILD_TIMEOUT_MS 2400000 | 53 | #define MTIP_FTL_REBUILD_TIMEOUT_MS 2400000 |
54 | 54 | ||
55 | /* unaligned IO handling */ | 55 | /* unaligned IO handling */ |
56 | #define MTIP_MAX_UNALIGNED_SLOTS 8 | 56 | #define MTIP_MAX_UNALIGNED_SLOTS 2 |
57 | 57 | ||
58 | /* Macro to extract the tag bit number from a tag value. */ | 58 | /* Macro to extract the tag bit number from a tag value. */ |
59 | #define MTIP_TAG_BIT(tag) (tag & 0x1F) | 59 | #define MTIP_TAG_BIT(tag) (tag & 0x1F) |
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 011e55d820b1..51c557cfd92b 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c | |||
@@ -612,6 +612,8 @@ static ssize_t disksize_store(struct device *dev, | |||
612 | 612 | ||
613 | disksize = PAGE_ALIGN(disksize); | 613 | disksize = PAGE_ALIGN(disksize); |
614 | meta = zram_meta_alloc(disksize); | 614 | meta = zram_meta_alloc(disksize); |
615 | if (!meta) | ||
616 | return -ENOMEM; | ||
615 | down_write(&zram->init_lock); | 617 | down_write(&zram->init_lock); |
616 | if (zram->init_done) { | 618 | if (zram->init_done) { |
617 | up_write(&zram->init_lock); | 619 | up_write(&zram->init_lock); |
diff --git a/drivers/clk/at91/clk-master.c b/drivers/clk/at91/clk-master.c index bd313f7816a8..c1af80bcdf20 100644 --- a/drivers/clk/at91/clk-master.c +++ b/drivers/clk/at91/clk-master.c | |||
@@ -242,7 +242,7 @@ of_at91_clk_master_setup(struct device_node *np, struct at91_pmc *pmc, | |||
242 | 242 | ||
243 | irq = irq_of_parse_and_map(np, 0); | 243 | irq = irq_of_parse_and_map(np, 0); |
244 | if (!irq) | 244 | if (!irq) |
245 | return; | 245 | goto out_free_characteristics; |
246 | 246 | ||
247 | clk = at91_clk_register_master(pmc, irq, name, num_parents, | 247 | clk = at91_clk_register_master(pmc, irq, name, num_parents, |
248 | parent_names, layout, | 248 | parent_names, layout, |
diff --git a/drivers/clk/clk-nomadik.c b/drivers/clk/clk-nomadik.c index 6a934a5296bd..05e04ce0f148 100644 --- a/drivers/clk/clk-nomadik.c +++ b/drivers/clk/clk-nomadik.c | |||
@@ -494,6 +494,9 @@ static const struct file_operations nomadik_src_clk_debugfs_ops = { | |||
494 | 494 | ||
495 | static int __init nomadik_src_clk_init_debugfs(void) | 495 | static int __init nomadik_src_clk_init_debugfs(void) |
496 | { | 496 | { |
497 | /* Vital for multiplatform */ | ||
498 | if (!src_base) | ||
499 | return -ENODEV; | ||
497 | src_pcksr0_boot = readl(src_base + SRC_PCKSR0); | 500 | src_pcksr0_boot = readl(src_base + SRC_PCKSR0); |
498 | src_pcksr1_boot = readl(src_base + SRC_PCKSR1); | 501 | src_pcksr1_boot = readl(src_base + SRC_PCKSR1); |
499 | debugfs_create_file("nomadik-src-clk", S_IFREG | S_IRUGO, | 502 | debugfs_create_file("nomadik-src-clk", S_IFREG | S_IRUGO, |
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 5517944495d8..c42e608af6bb 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -2226,24 +2226,25 @@ EXPORT_SYMBOL_GPL(devm_clk_unregister); | |||
2226 | */ | 2226 | */ |
2227 | int __clk_get(struct clk *clk) | 2227 | int __clk_get(struct clk *clk) |
2228 | { | 2228 | { |
2229 | if (clk && !try_module_get(clk->owner)) | 2229 | if (clk) { |
2230 | return 0; | 2230 | if (!try_module_get(clk->owner)) |
2231 | return 0; | ||
2231 | 2232 | ||
2232 | kref_get(&clk->ref); | 2233 | kref_get(&clk->ref); |
2234 | } | ||
2233 | return 1; | 2235 | return 1; |
2234 | } | 2236 | } |
2235 | 2237 | ||
2236 | void __clk_put(struct clk *clk) | 2238 | void __clk_put(struct clk *clk) |
2237 | { | 2239 | { |
2238 | if (WARN_ON_ONCE(IS_ERR(clk))) | 2240 | if (!clk || WARN_ON_ONCE(IS_ERR(clk))) |
2239 | return; | 2241 | return; |
2240 | 2242 | ||
2241 | clk_prepare_lock(); | 2243 | clk_prepare_lock(); |
2242 | kref_put(&clk->ref, __clk_release); | 2244 | kref_put(&clk->ref, __clk_release); |
2243 | clk_prepare_unlock(); | 2245 | clk_prepare_unlock(); |
2244 | 2246 | ||
2245 | if (clk) | 2247 | module_put(clk->owner); |
2246 | module_put(clk->owner); | ||
2247 | } | 2248 | } |
2248 | 2249 | ||
2249 | /*** clk rate change notifiers ***/ | 2250 | /*** clk rate change notifiers ***/ |
diff --git a/drivers/clk/keystone/gate.c b/drivers/clk/keystone/gate.c index 17a598398a53..86f1e362eafb 100644 --- a/drivers/clk/keystone/gate.c +++ b/drivers/clk/keystone/gate.c | |||
@@ -179,6 +179,7 @@ static struct clk *clk_register_psc(struct device *dev, | |||
179 | 179 | ||
180 | init.name = name; | 180 | init.name = name; |
181 | init.ops = &clk_psc_ops; | 181 | init.ops = &clk_psc_ops; |
182 | init.flags = 0; | ||
182 | init.parent_names = (parent_name ? &parent_name : NULL); | 183 | init.parent_names = (parent_name ? &parent_name : NULL); |
183 | init.num_parents = (parent_name ? 1 : 0); | 184 | init.num_parents = (parent_name ? 1 : 0); |
184 | 185 | ||
diff --git a/drivers/clk/mvebu/armada-370.c b/drivers/clk/mvebu/armada-370.c index 81a202d12a7a..bef198a83863 100644 --- a/drivers/clk/mvebu/armada-370.c +++ b/drivers/clk/mvebu/armada-370.c | |||
@@ -141,13 +141,6 @@ static const struct coreclk_soc_desc a370_coreclks = { | |||
141 | .num_ratios = ARRAY_SIZE(a370_coreclk_ratios), | 141 | .num_ratios = ARRAY_SIZE(a370_coreclk_ratios), |
142 | }; | 142 | }; |
143 | 143 | ||
144 | static void __init a370_coreclk_init(struct device_node *np) | ||
145 | { | ||
146 | mvebu_coreclk_setup(np, &a370_coreclks); | ||
147 | } | ||
148 | CLK_OF_DECLARE(a370_core_clk, "marvell,armada-370-core-clock", | ||
149 | a370_coreclk_init); | ||
150 | |||
151 | /* | 144 | /* |
152 | * Clock Gating Control | 145 | * Clock Gating Control |
153 | */ | 146 | */ |
@@ -168,9 +161,15 @@ static const struct clk_gating_soc_desc a370_gating_desc[] __initconst = { | |||
168 | { } | 161 | { } |
169 | }; | 162 | }; |
170 | 163 | ||
171 | static void __init a370_clk_gating_init(struct device_node *np) | 164 | static void __init a370_clk_init(struct device_node *np) |
172 | { | 165 | { |
173 | mvebu_clk_gating_setup(np, a370_gating_desc); | 166 | struct device_node *cgnp = |
167 | of_find_compatible_node(NULL, NULL, "marvell,armada-370-gating-clock"); | ||
168 | |||
169 | mvebu_coreclk_setup(np, &a370_coreclks); | ||
170 | |||
171 | if (cgnp) | ||
172 | mvebu_clk_gating_setup(cgnp, a370_gating_desc); | ||
174 | } | 173 | } |
175 | CLK_OF_DECLARE(a370_clk_gating, "marvell,armada-370-gating-clock", | 174 | CLK_OF_DECLARE(a370_clk, "marvell,armada-370-core-clock", a370_clk_init); |
176 | a370_clk_gating_init); | 175 | |
diff --git a/drivers/clk/mvebu/armada-xp.c b/drivers/clk/mvebu/armada-xp.c index 9922c4475aa8..b3094315a3c0 100644 --- a/drivers/clk/mvebu/armada-xp.c +++ b/drivers/clk/mvebu/armada-xp.c | |||
@@ -158,13 +158,6 @@ static const struct coreclk_soc_desc axp_coreclks = { | |||
158 | .num_ratios = ARRAY_SIZE(axp_coreclk_ratios), | 158 | .num_ratios = ARRAY_SIZE(axp_coreclk_ratios), |
159 | }; | 159 | }; |
160 | 160 | ||
161 | static void __init axp_coreclk_init(struct device_node *np) | ||
162 | { | ||
163 | mvebu_coreclk_setup(np, &axp_coreclks); | ||
164 | } | ||
165 | CLK_OF_DECLARE(axp_core_clk, "marvell,armada-xp-core-clock", | ||
166 | axp_coreclk_init); | ||
167 | |||
168 | /* | 161 | /* |
169 | * Clock Gating Control | 162 | * Clock Gating Control |
170 | */ | 163 | */ |
@@ -202,9 +195,14 @@ static const struct clk_gating_soc_desc axp_gating_desc[] __initconst = { | |||
202 | { } | 195 | { } |
203 | }; | 196 | }; |
204 | 197 | ||
205 | static void __init axp_clk_gating_init(struct device_node *np) | 198 | static void __init axp_clk_init(struct device_node *np) |
206 | { | 199 | { |
207 | mvebu_clk_gating_setup(np, axp_gating_desc); | 200 | struct device_node *cgnp = |
201 | of_find_compatible_node(NULL, NULL, "marvell,armada-xp-gating-clock"); | ||
202 | |||
203 | mvebu_coreclk_setup(np, &axp_coreclks); | ||
204 | |||
205 | if (cgnp) | ||
206 | mvebu_clk_gating_setup(cgnp, axp_gating_desc); | ||
208 | } | 207 | } |
209 | CLK_OF_DECLARE(axp_clk_gating, "marvell,armada-xp-gating-clock", | 208 | CLK_OF_DECLARE(axp_clk, "marvell,armada-xp-core-clock", axp_clk_init); |
210 | axp_clk_gating_init); | ||
diff --git a/drivers/clk/mvebu/dove.c b/drivers/clk/mvebu/dove.c index 38aee1e3f242..b8c2424ac926 100644 --- a/drivers/clk/mvebu/dove.c +++ b/drivers/clk/mvebu/dove.c | |||
@@ -154,12 +154,6 @@ static const struct coreclk_soc_desc dove_coreclks = { | |||
154 | .num_ratios = ARRAY_SIZE(dove_coreclk_ratios), | 154 | .num_ratios = ARRAY_SIZE(dove_coreclk_ratios), |
155 | }; | 155 | }; |
156 | 156 | ||
157 | static void __init dove_coreclk_init(struct device_node *np) | ||
158 | { | ||
159 | mvebu_coreclk_setup(np, &dove_coreclks); | ||
160 | } | ||
161 | CLK_OF_DECLARE(dove_core_clk, "marvell,dove-core-clock", dove_coreclk_init); | ||
162 | |||
163 | /* | 157 | /* |
164 | * Clock Gating Control | 158 | * Clock Gating Control |
165 | */ | 159 | */ |
@@ -186,9 +180,14 @@ static const struct clk_gating_soc_desc dove_gating_desc[] __initconst = { | |||
186 | { } | 180 | { } |
187 | }; | 181 | }; |
188 | 182 | ||
189 | static void __init dove_clk_gating_init(struct device_node *np) | 183 | static void __init dove_clk_init(struct device_node *np) |
190 | { | 184 | { |
191 | mvebu_clk_gating_setup(np, dove_gating_desc); | 185 | struct device_node *cgnp = |
186 | of_find_compatible_node(NULL, NULL, "marvell,dove-gating-clock"); | ||
187 | |||
188 | mvebu_coreclk_setup(np, &dove_coreclks); | ||
189 | |||
190 | if (cgnp) | ||
191 | mvebu_clk_gating_setup(cgnp, dove_gating_desc); | ||
192 | } | 192 | } |
193 | CLK_OF_DECLARE(dove_clk_gating, "marvell,dove-gating-clock", | 193 | CLK_OF_DECLARE(dove_clk, "marvell,dove-core-clock", dove_clk_init); |
194 | dove_clk_gating_init); | ||
diff --git a/drivers/clk/mvebu/kirkwood.c b/drivers/clk/mvebu/kirkwood.c index 2636a55f29f9..ddb666a86500 100644 --- a/drivers/clk/mvebu/kirkwood.c +++ b/drivers/clk/mvebu/kirkwood.c | |||
@@ -193,13 +193,6 @@ static const struct coreclk_soc_desc kirkwood_coreclks = { | |||
193 | .num_ratios = ARRAY_SIZE(kirkwood_coreclk_ratios), | 193 | .num_ratios = ARRAY_SIZE(kirkwood_coreclk_ratios), |
194 | }; | 194 | }; |
195 | 195 | ||
196 | static void __init kirkwood_coreclk_init(struct device_node *np) | ||
197 | { | ||
198 | mvebu_coreclk_setup(np, &kirkwood_coreclks); | ||
199 | } | ||
200 | CLK_OF_DECLARE(kirkwood_core_clk, "marvell,kirkwood-core-clock", | ||
201 | kirkwood_coreclk_init); | ||
202 | |||
203 | static const struct coreclk_soc_desc mv88f6180_coreclks = { | 196 | static const struct coreclk_soc_desc mv88f6180_coreclks = { |
204 | .get_tclk_freq = kirkwood_get_tclk_freq, | 197 | .get_tclk_freq = kirkwood_get_tclk_freq, |
205 | .get_cpu_freq = mv88f6180_get_cpu_freq, | 198 | .get_cpu_freq = mv88f6180_get_cpu_freq, |
@@ -208,13 +201,6 @@ static const struct coreclk_soc_desc mv88f6180_coreclks = { | |||
208 | .num_ratios = ARRAY_SIZE(kirkwood_coreclk_ratios), | 201 | .num_ratios = ARRAY_SIZE(kirkwood_coreclk_ratios), |
209 | }; | 202 | }; |
210 | 203 | ||
211 | static void __init mv88f6180_coreclk_init(struct device_node *np) | ||
212 | { | ||
213 | mvebu_coreclk_setup(np, &mv88f6180_coreclks); | ||
214 | } | ||
215 | CLK_OF_DECLARE(mv88f6180_core_clk, "marvell,mv88f6180-core-clock", | ||
216 | mv88f6180_coreclk_init); | ||
217 | |||
218 | /* | 204 | /* |
219 | * Clock Gating Control | 205 | * Clock Gating Control |
220 | */ | 206 | */ |
@@ -239,9 +225,21 @@ static const struct clk_gating_soc_desc kirkwood_gating_desc[] __initconst = { | |||
239 | { } | 225 | { } |
240 | }; | 226 | }; |
241 | 227 | ||
242 | static void __init kirkwood_clk_gating_init(struct device_node *np) | 228 | static void __init kirkwood_clk_init(struct device_node *np) |
243 | { | 229 | { |
244 | mvebu_clk_gating_setup(np, kirkwood_gating_desc); | 230 | struct device_node *cgnp = |
231 | of_find_compatible_node(NULL, NULL, "marvell,kirkwood-gating-clock"); | ||
232 | |||
233 | |||
234 | if (of_device_is_compatible(np, "marvell,mv88f6180-core-clock")) | ||
235 | mvebu_coreclk_setup(np, &mv88f6180_coreclks); | ||
236 | else | ||
237 | mvebu_coreclk_setup(np, &kirkwood_coreclks); | ||
238 | |||
239 | if (cgnp) | ||
240 | mvebu_clk_gating_setup(cgnp, kirkwood_gating_desc); | ||
245 | } | 241 | } |
246 | CLK_OF_DECLARE(kirkwood_clk_gating, "marvell,kirkwood-gating-clock", | 242 | CLK_OF_DECLARE(kirkwood_clk, "marvell,kirkwood-core-clock", |
247 | kirkwood_clk_gating_init); | 243 | kirkwood_clk_init); |
244 | CLK_OF_DECLARE(mv88f6180_clk, "marvell,mv88f6180-core-clock", | ||
245 | kirkwood_clk_init); | ||
diff --git a/drivers/clk/shmobile/clk-rcar-gen2.c b/drivers/clk/shmobile/clk-rcar-gen2.c index a59ec217a124..99c27b1c625b 100644 --- a/drivers/clk/shmobile/clk-rcar-gen2.c +++ b/drivers/clk/shmobile/clk-rcar-gen2.c | |||
@@ -26,6 +26,8 @@ struct rcar_gen2_cpg { | |||
26 | void __iomem *reg; | 26 | void __iomem *reg; |
27 | }; | 27 | }; |
28 | 28 | ||
29 | #define CPG_FRQCRB 0x00000004 | ||
30 | #define CPG_FRQCRB_KICK BIT(31) | ||
29 | #define CPG_SDCKCR 0x00000074 | 31 | #define CPG_SDCKCR 0x00000074 |
30 | #define CPG_PLL0CR 0x000000d8 | 32 | #define CPG_PLL0CR 0x000000d8 |
31 | #define CPG_FRQCRC 0x000000e0 | 33 | #define CPG_FRQCRC 0x000000e0 |
@@ -45,6 +47,7 @@ struct rcar_gen2_cpg { | |||
45 | struct cpg_z_clk { | 47 | struct cpg_z_clk { |
46 | struct clk_hw hw; | 48 | struct clk_hw hw; |
47 | void __iomem *reg; | 49 | void __iomem *reg; |
50 | void __iomem *kick_reg; | ||
48 | }; | 51 | }; |
49 | 52 | ||
50 | #define to_z_clk(_hw) container_of(_hw, struct cpg_z_clk, hw) | 53 | #define to_z_clk(_hw) container_of(_hw, struct cpg_z_clk, hw) |
@@ -83,17 +86,45 @@ static int cpg_z_clk_set_rate(struct clk_hw *hw, unsigned long rate, | |||
83 | { | 86 | { |
84 | struct cpg_z_clk *zclk = to_z_clk(hw); | 87 | struct cpg_z_clk *zclk = to_z_clk(hw); |
85 | unsigned int mult; | 88 | unsigned int mult; |
86 | u32 val; | 89 | u32 val, kick; |
90 | unsigned int i; | ||
87 | 91 | ||
88 | mult = div_u64((u64)rate * 32, parent_rate); | 92 | mult = div_u64((u64)rate * 32, parent_rate); |
89 | mult = clamp(mult, 1U, 32U); | 93 | mult = clamp(mult, 1U, 32U); |
90 | 94 | ||
95 | if (clk_readl(zclk->kick_reg) & CPG_FRQCRB_KICK) | ||
96 | return -EBUSY; | ||
97 | |||
91 | val = clk_readl(zclk->reg); | 98 | val = clk_readl(zclk->reg); |
92 | val &= ~CPG_FRQCRC_ZFC_MASK; | 99 | val &= ~CPG_FRQCRC_ZFC_MASK; |
93 | val |= (32 - mult) << CPG_FRQCRC_ZFC_SHIFT; | 100 | val |= (32 - mult) << CPG_FRQCRC_ZFC_SHIFT; |
94 | clk_writel(val, zclk->reg); | 101 | clk_writel(val, zclk->reg); |
95 | 102 | ||
96 | return 0; | 103 | /* |
104 | * Set KICK bit in FRQCRB to update hardware setting and wait for | ||
105 | * clock change completion. | ||
106 | */ | ||
107 | kick = clk_readl(zclk->kick_reg); | ||
108 | kick |= CPG_FRQCRB_KICK; | ||
109 | clk_writel(kick, zclk->kick_reg); | ||
110 | |||
111 | /* | ||
112 | * Note: There is no HW information about the worst case latency. | ||
113 | * | ||
114 | * Using experimental measurements, it seems that no more than | ||
115 | * ~10 iterations are needed, independently of the CPU rate. | ||
116 | * Since this value might be dependant of external xtal rate, pll1 | ||
117 | * rate or even the other emulation clocks rate, use 1000 as a | ||
118 | * "super" safe value. | ||
119 | */ | ||
120 | for (i = 1000; i; i--) { | ||
121 | if (!(clk_readl(zclk->kick_reg) & CPG_FRQCRB_KICK)) | ||
122 | return 0; | ||
123 | |||
124 | cpu_relax(); | ||
125 | } | ||
126 | |||
127 | return -ETIMEDOUT; | ||
97 | } | 128 | } |
98 | 129 | ||
99 | static const struct clk_ops cpg_z_clk_ops = { | 130 | static const struct clk_ops cpg_z_clk_ops = { |
@@ -120,6 +151,7 @@ static struct clk * __init cpg_z_clk_register(struct rcar_gen2_cpg *cpg) | |||
120 | init.num_parents = 1; | 151 | init.num_parents = 1; |
121 | 152 | ||
122 | zclk->reg = cpg->reg + CPG_FRQCRC; | 153 | zclk->reg = cpg->reg + CPG_FRQCRC; |
154 | zclk->kick_reg = cpg->reg + CPG_FRQCRB; | ||
123 | zclk->hw.init = &init; | 155 | zclk->hw.init = &init; |
124 | 156 | ||
125 | clk = clk_register(NULL, &zclk->hw); | 157 | clk = clk_register(NULL, &zclk->hw); |
@@ -186,7 +218,7 @@ rcar_gen2_cpg_register_clock(struct device_node *np, struct rcar_gen2_cpg *cpg, | |||
186 | const char *name) | 218 | const char *name) |
187 | { | 219 | { |
188 | const struct clk_div_table *table = NULL; | 220 | const struct clk_div_table *table = NULL; |
189 | const char *parent_name = "main"; | 221 | const char *parent_name; |
190 | unsigned int shift; | 222 | unsigned int shift; |
191 | unsigned int mult = 1; | 223 | unsigned int mult = 1; |
192 | unsigned int div = 1; | 224 | unsigned int div = 1; |
@@ -201,23 +233,31 @@ rcar_gen2_cpg_register_clock(struct device_node *np, struct rcar_gen2_cpg *cpg, | |||
201 | * the multiplier value. | 233 | * the multiplier value. |
202 | */ | 234 | */ |
203 | u32 value = clk_readl(cpg->reg + CPG_PLL0CR); | 235 | u32 value = clk_readl(cpg->reg + CPG_PLL0CR); |
236 | parent_name = "main"; | ||
204 | mult = ((value >> 24) & ((1 << 7) - 1)) + 1; | 237 | mult = ((value >> 24) & ((1 << 7) - 1)) + 1; |
205 | } else if (!strcmp(name, "pll1")) { | 238 | } else if (!strcmp(name, "pll1")) { |
239 | parent_name = "main"; | ||
206 | mult = config->pll1_mult / 2; | 240 | mult = config->pll1_mult / 2; |
207 | } else if (!strcmp(name, "pll3")) { | 241 | } else if (!strcmp(name, "pll3")) { |
242 | parent_name = "main"; | ||
208 | mult = config->pll3_mult; | 243 | mult = config->pll3_mult; |
209 | } else if (!strcmp(name, "lb")) { | 244 | } else if (!strcmp(name, "lb")) { |
245 | parent_name = "pll1_div2"; | ||
210 | div = cpg_mode & BIT(18) ? 36 : 24; | 246 | div = cpg_mode & BIT(18) ? 36 : 24; |
211 | } else if (!strcmp(name, "qspi")) { | 247 | } else if (!strcmp(name, "qspi")) { |
248 | parent_name = "pll1_div2"; | ||
212 | div = (cpg_mode & (BIT(3) | BIT(2) | BIT(1))) == BIT(2) | 249 | div = (cpg_mode & (BIT(3) | BIT(2) | BIT(1))) == BIT(2) |
213 | ? 16 : 20; | 250 | ? 8 : 10; |
214 | } else if (!strcmp(name, "sdh")) { | 251 | } else if (!strcmp(name, "sdh")) { |
252 | parent_name = "pll1_div2"; | ||
215 | table = cpg_sdh_div_table; | 253 | table = cpg_sdh_div_table; |
216 | shift = 8; | 254 | shift = 8; |
217 | } else if (!strcmp(name, "sd0")) { | 255 | } else if (!strcmp(name, "sd0")) { |
256 | parent_name = "pll1_div2"; | ||
218 | table = cpg_sd01_div_table; | 257 | table = cpg_sd01_div_table; |
219 | shift = 4; | 258 | shift = 4; |
220 | } else if (!strcmp(name, "sd1")) { | 259 | } else if (!strcmp(name, "sd1")) { |
260 | parent_name = "pll1_div2"; | ||
221 | table = cpg_sd01_div_table; | 261 | table = cpg_sd01_div_table; |
222 | shift = 0; | 262 | shift = 0; |
223 | } else if (!strcmp(name, "z")) { | 263 | } else if (!strcmp(name, "z")) { |
diff --git a/drivers/clk/tegra/clk-divider.c b/drivers/clk/tegra/clk-divider.c index 4d75b1f37e3a..290f9c1a3749 100644 --- a/drivers/clk/tegra/clk-divider.c +++ b/drivers/clk/tegra/clk-divider.c | |||
@@ -59,7 +59,7 @@ static int get_div(struct tegra_clk_frac_div *divider, unsigned long rate, | |||
59 | return 0; | 59 | return 0; |
60 | 60 | ||
61 | if (divider_ux1 > get_max_div(divider)) | 61 | if (divider_ux1 > get_max_div(divider)) |
62 | return -EINVAL; | 62 | return get_max_div(divider); |
63 | 63 | ||
64 | return divider_ux1; | 64 | return divider_ux1; |
65 | } | 65 | } |
diff --git a/drivers/clk/tegra/clk-id.h b/drivers/clk/tegra/clk-id.h index cf0c323f2c36..c39613c519af 100644 --- a/drivers/clk/tegra/clk-id.h +++ b/drivers/clk/tegra/clk-id.h | |||
@@ -180,9 +180,13 @@ enum clk_id { | |||
180 | tegra_clk_sbc6_8, | 180 | tegra_clk_sbc6_8, |
181 | tegra_clk_sclk, | 181 | tegra_clk_sclk, |
182 | tegra_clk_sdmmc1, | 182 | tegra_clk_sdmmc1, |
183 | tegra_clk_sdmmc1_8, | ||
183 | tegra_clk_sdmmc2, | 184 | tegra_clk_sdmmc2, |
185 | tegra_clk_sdmmc2_8, | ||
184 | tegra_clk_sdmmc3, | 186 | tegra_clk_sdmmc3, |
187 | tegra_clk_sdmmc3_8, | ||
185 | tegra_clk_sdmmc4, | 188 | tegra_clk_sdmmc4, |
189 | tegra_clk_sdmmc4_8, | ||
186 | tegra_clk_se, | 190 | tegra_clk_se, |
187 | tegra_clk_soc_therm, | 191 | tegra_clk_soc_therm, |
188 | tegra_clk_sor0, | 192 | tegra_clk_sor0, |
diff --git a/drivers/clk/tegra/clk-tegra-periph.c b/drivers/clk/tegra/clk-tegra-periph.c index 5c35885f4a7c..1fa5c3f33b20 100644 --- a/drivers/clk/tegra/clk-tegra-periph.c +++ b/drivers/clk/tegra/clk-tegra-periph.c | |||
@@ -371,9 +371,7 @@ static const char *mux_pllp3_pllc_clkm[] = { | |||
371 | static const char *mux_pllm_pllc_pllp_plla_pllc2_c3_clkm[] = { | 371 | static const char *mux_pllm_pllc_pllp_plla_pllc2_c3_clkm[] = { |
372 | "pll_m", "pll_c", "pll_p", "pll_a", "pll_c2", "pll_c3", "clk_m" | 372 | "pll_m", "pll_c", "pll_p", "pll_a", "pll_c2", "pll_c3", "clk_m" |
373 | }; | 373 | }; |
374 | static u32 mux_pllm_pllc_pllp_plla_pllc2_c3_clkm_idx[] = { | 374 | #define mux_pllm_pllc_pllp_plla_pllc2_c3_clkm_idx NULL |
375 | [0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 6, | ||
376 | }; | ||
377 | 375 | ||
378 | static const char *mux_pllm_pllc2_c_c3_pllp_plla_pllc4[] = { | 376 | static const char *mux_pllm_pllc2_c_c3_pllp_plla_pllc4[] = { |
379 | "pll_m", "pll_c2", "pll_c", "pll_c3", "pll_p", "pll_a_out0", "pll_c4", | 377 | "pll_m", "pll_c2", "pll_c", "pll_c3", "pll_p", "pll_a_out0", "pll_c4", |
@@ -465,6 +463,10 @@ static struct tegra_periph_init_data periph_clks[] = { | |||
465 | MUX("adx1", mux_plla_pllc_pllp_clkm, CLK_SOURCE_ADX1, 180, TEGRA_PERIPH_ON_APB, tegra_clk_adx1), | 463 | MUX("adx1", mux_plla_pllc_pllp_clkm, CLK_SOURCE_ADX1, 180, TEGRA_PERIPH_ON_APB, tegra_clk_adx1), |
466 | MUX("amx1", mux_plla_pllc_pllp_clkm, CLK_SOURCE_AMX1, 185, TEGRA_PERIPH_ON_APB, tegra_clk_amx1), | 464 | MUX("amx1", mux_plla_pllc_pllp_clkm, CLK_SOURCE_AMX1, 185, TEGRA_PERIPH_ON_APB, tegra_clk_amx1), |
467 | MUX("vi_sensor2", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR2, 20, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor2), | 465 | MUX("vi_sensor2", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR2, 20, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor2), |
466 | MUX8("sdmmc1", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC1, 14, 0, tegra_clk_sdmmc1_8), | ||
467 | MUX8("sdmmc2", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC2, 9, 0, tegra_clk_sdmmc2_8), | ||
468 | MUX8("sdmmc3", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC3, 69, 0, tegra_clk_sdmmc3_8), | ||
469 | MUX8("sdmmc4", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC4, 15, 0, tegra_clk_sdmmc4_8), | ||
468 | MUX8("sbc1", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC1, 41, TEGRA_PERIPH_ON_APB, tegra_clk_sbc1_8), | 470 | MUX8("sbc1", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC1, 41, TEGRA_PERIPH_ON_APB, tegra_clk_sbc1_8), |
469 | MUX8("sbc2", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC2, 44, TEGRA_PERIPH_ON_APB, tegra_clk_sbc2_8), | 471 | MUX8("sbc2", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC2, 44, TEGRA_PERIPH_ON_APB, tegra_clk_sbc2_8), |
470 | MUX8("sbc3", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC3, 46, TEGRA_PERIPH_ON_APB, tegra_clk_sbc3_8), | 472 | MUX8("sbc3", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC3, 46, TEGRA_PERIPH_ON_APB, tegra_clk_sbc3_8), |
@@ -492,7 +494,7 @@ static struct tegra_periph_init_data periph_clks[] = { | |||
492 | UART("uartb", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTB, 7, tegra_clk_uartb), | 494 | UART("uartb", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTB, 7, tegra_clk_uartb), |
493 | UART("uartc", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTC, 55, tegra_clk_uartc), | 495 | UART("uartc", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTC, 55, tegra_clk_uartc), |
494 | UART("uartd", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTD, 65, tegra_clk_uartd), | 496 | UART("uartd", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTD, 65, tegra_clk_uartd), |
495 | UART("uarte", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTE, 65, tegra_clk_uarte), | 497 | UART("uarte", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTE, 66, tegra_clk_uarte), |
496 | XUSB("xusb_host_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_HOST_SRC, 143, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_host_src), | 498 | XUSB("xusb_host_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_HOST_SRC, 143, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_host_src), |
497 | XUSB("xusb_falcon_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_FALCON_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_falcon_src), | 499 | XUSB("xusb_falcon_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_FALCON_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_falcon_src), |
498 | XUSB("xusb_fs_src", mux_clkm_48M_pllp_480M, CLK_SOURCE_XUSB_FS_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_fs_src), | 500 | XUSB("xusb_fs_src", mux_clkm_48M_pllp_480M, CLK_SOURCE_XUSB_FS_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_fs_src), |
diff --git a/drivers/clk/tegra/clk-tegra-super-gen4.c b/drivers/clk/tegra/clk-tegra-super-gen4.c index 05dce4aa2c11..feb3201c85ce 100644 --- a/drivers/clk/tegra/clk-tegra-super-gen4.c +++ b/drivers/clk/tegra/clk-tegra-super-gen4.c | |||
@@ -120,7 +120,7 @@ void __init tegra_super_clk_gen4_init(void __iomem *clk_base, | |||
120 | ARRAY_SIZE(cclk_lp_parents), | 120 | ARRAY_SIZE(cclk_lp_parents), |
121 | CLK_SET_RATE_PARENT, | 121 | CLK_SET_RATE_PARENT, |
122 | clk_base + CCLKLP_BURST_POLICY, | 122 | clk_base + CCLKLP_BURST_POLICY, |
123 | 0, 4, 8, 9, NULL); | 123 | TEGRA_DIVIDER_2, 4, 8, 9, NULL); |
124 | *dt_clk = clk; | 124 | *dt_clk = clk; |
125 | } | 125 | } |
126 | 126 | ||
diff --git a/drivers/clk/tegra/clk-tegra114.c b/drivers/clk/tegra/clk-tegra114.c index 90d9d25f2228..80431f0fb268 100644 --- a/drivers/clk/tegra/clk-tegra114.c +++ b/drivers/clk/tegra/clk-tegra114.c | |||
@@ -682,12 +682,12 @@ static struct tegra_clk tegra114_clks[tegra_clk_max] __initdata = { | |||
682 | [tegra_clk_timer] = { .dt_id = TEGRA114_CLK_TIMER, .present = true }, | 682 | [tegra_clk_timer] = { .dt_id = TEGRA114_CLK_TIMER, .present = true }, |
683 | [tegra_clk_uarta] = { .dt_id = TEGRA114_CLK_UARTA, .present = true }, | 683 | [tegra_clk_uarta] = { .dt_id = TEGRA114_CLK_UARTA, .present = true }, |
684 | [tegra_clk_uartd] = { .dt_id = TEGRA114_CLK_UARTD, .present = true }, | 684 | [tegra_clk_uartd] = { .dt_id = TEGRA114_CLK_UARTD, .present = true }, |
685 | [tegra_clk_sdmmc2] = { .dt_id = TEGRA114_CLK_SDMMC2, .present = true }, | 685 | [tegra_clk_sdmmc2_8] = { .dt_id = TEGRA114_CLK_SDMMC2, .present = true }, |
686 | [tegra_clk_i2s1] = { .dt_id = TEGRA114_CLK_I2S1, .present = true }, | 686 | [tegra_clk_i2s1] = { .dt_id = TEGRA114_CLK_I2S1, .present = true }, |
687 | [tegra_clk_i2c1] = { .dt_id = TEGRA114_CLK_I2C1, .present = true }, | 687 | [tegra_clk_i2c1] = { .dt_id = TEGRA114_CLK_I2C1, .present = true }, |
688 | [tegra_clk_ndflash] = { .dt_id = TEGRA114_CLK_NDFLASH, .present = true }, | 688 | [tegra_clk_ndflash] = { .dt_id = TEGRA114_CLK_NDFLASH, .present = true }, |
689 | [tegra_clk_sdmmc1] = { .dt_id = TEGRA114_CLK_SDMMC1, .present = true }, | 689 | [tegra_clk_sdmmc1_8] = { .dt_id = TEGRA114_CLK_SDMMC1, .present = true }, |
690 | [tegra_clk_sdmmc4] = { .dt_id = TEGRA114_CLK_SDMMC4, .present = true }, | 690 | [tegra_clk_sdmmc4_8] = { .dt_id = TEGRA114_CLK_SDMMC4, .present = true }, |
691 | [tegra_clk_pwm] = { .dt_id = TEGRA114_CLK_PWM, .present = true }, | 691 | [tegra_clk_pwm] = { .dt_id = TEGRA114_CLK_PWM, .present = true }, |
692 | [tegra_clk_i2s0] = { .dt_id = TEGRA114_CLK_I2S0, .present = true }, | 692 | [tegra_clk_i2s0] = { .dt_id = TEGRA114_CLK_I2S0, .present = true }, |
693 | [tegra_clk_i2s2] = { .dt_id = TEGRA114_CLK_I2S2, .present = true }, | 693 | [tegra_clk_i2s2] = { .dt_id = TEGRA114_CLK_I2S2, .present = true }, |
@@ -723,7 +723,7 @@ static struct tegra_clk tegra114_clks[tegra_clk_max] __initdata = { | |||
723 | [tegra_clk_bsev] = { .dt_id = TEGRA114_CLK_BSEV, .present = true }, | 723 | [tegra_clk_bsev] = { .dt_id = TEGRA114_CLK_BSEV, .present = true }, |
724 | [tegra_clk_i2c3] = { .dt_id = TEGRA114_CLK_I2C3, .present = true }, | 724 | [tegra_clk_i2c3] = { .dt_id = TEGRA114_CLK_I2C3, .present = true }, |
725 | [tegra_clk_sbc4_8] = { .dt_id = TEGRA114_CLK_SBC4, .present = true }, | 725 | [tegra_clk_sbc4_8] = { .dt_id = TEGRA114_CLK_SBC4, .present = true }, |
726 | [tegra_clk_sdmmc3] = { .dt_id = TEGRA114_CLK_SDMMC3, .present = true }, | 726 | [tegra_clk_sdmmc3_8] = { .dt_id = TEGRA114_CLK_SDMMC3, .present = true }, |
727 | [tegra_clk_owr] = { .dt_id = TEGRA114_CLK_OWR, .present = true }, | 727 | [tegra_clk_owr] = { .dt_id = TEGRA114_CLK_OWR, .present = true }, |
728 | [tegra_clk_csite] = { .dt_id = TEGRA114_CLK_CSITE, .present = true }, | 728 | [tegra_clk_csite] = { .dt_id = TEGRA114_CLK_CSITE, .present = true }, |
729 | [tegra_clk_la] = { .dt_id = TEGRA114_CLK_LA, .present = true }, | 729 | [tegra_clk_la] = { .dt_id = TEGRA114_CLK_LA, .present = true }, |
diff --git a/drivers/clk/tegra/clk-tegra124.c b/drivers/clk/tegra/clk-tegra124.c index aff86b5bc745..166e02f16c8a 100644 --- a/drivers/clk/tegra/clk-tegra124.c +++ b/drivers/clk/tegra/clk-tegra124.c | |||
@@ -516,11 +516,11 @@ static struct div_nmp pllp_nmp = { | |||
516 | }; | 516 | }; |
517 | 517 | ||
518 | static struct tegra_clk_pll_freq_table pll_p_freq_table[] = { | 518 | static struct tegra_clk_pll_freq_table pll_p_freq_table[] = { |
519 | {12000000, 216000000, 432, 12, 1, 8}, | 519 | {12000000, 408000000, 408, 12, 0, 8}, |
520 | {13000000, 216000000, 432, 13, 1, 8}, | 520 | {13000000, 408000000, 408, 13, 0, 8}, |
521 | {16800000, 216000000, 360, 14, 1, 8}, | 521 | {16800000, 408000000, 340, 14, 0, 8}, |
522 | {19200000, 216000000, 360, 16, 1, 8}, | 522 | {19200000, 408000000, 340, 16, 0, 8}, |
523 | {26000000, 216000000, 432, 26, 1, 8}, | 523 | {26000000, 408000000, 408, 26, 0, 8}, |
524 | {0, 0, 0, 0, 0, 0}, | 524 | {0, 0, 0, 0, 0, 0}, |
525 | }; | 525 | }; |
526 | 526 | ||
@@ -570,6 +570,15 @@ static struct tegra_clk_pll_params pll_a_params = { | |||
570 | .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK, | 570 | .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK, |
571 | }; | 571 | }; |
572 | 572 | ||
573 | static struct div_nmp plld_nmp = { | ||
574 | .divm_shift = 0, | ||
575 | .divm_width = 5, | ||
576 | .divn_shift = 8, | ||
577 | .divn_width = 11, | ||
578 | .divp_shift = 20, | ||
579 | .divp_width = 3, | ||
580 | }; | ||
581 | |||
573 | static struct tegra_clk_pll_freq_table pll_d_freq_table[] = { | 582 | static struct tegra_clk_pll_freq_table pll_d_freq_table[] = { |
574 | {12000000, 216000000, 864, 12, 4, 12}, | 583 | {12000000, 216000000, 864, 12, 4, 12}, |
575 | {13000000, 216000000, 864, 13, 4, 12}, | 584 | {13000000, 216000000, 864, 13, 4, 12}, |
@@ -603,19 +612,18 @@ static struct tegra_clk_pll_params pll_d_params = { | |||
603 | .lock_mask = PLL_BASE_LOCK, | 612 | .lock_mask = PLL_BASE_LOCK, |
604 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | 613 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, |
605 | .lock_delay = 1000, | 614 | .lock_delay = 1000, |
606 | .div_nmp = &pllp_nmp, | 615 | .div_nmp = &plld_nmp, |
607 | .freq_table = pll_d_freq_table, | 616 | .freq_table = pll_d_freq_table, |
608 | .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | | 617 | .flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | |
609 | TEGRA_PLL_USE_LOCK, | 618 | TEGRA_PLL_USE_LOCK, |
610 | }; | 619 | }; |
611 | 620 | ||
612 | static struct tegra_clk_pll_freq_table tegra124_pll_d2_freq_table[] = { | 621 | static struct tegra_clk_pll_freq_table tegra124_pll_d2_freq_table[] = { |
613 | { 12000000, 148500000, 99, 1, 8}, | 622 | { 12000000, 594000000, 99, 1, 2}, |
614 | { 12000000, 594000000, 99, 1, 1}, | 623 | { 13000000, 594000000, 91, 1, 2}, /* actual: 591.5 MHz */ |
615 | { 13000000, 594000000, 91, 1, 1}, /* actual: 591.5 MHz */ | 624 | { 16800000, 594000000, 71, 1, 2}, /* actual: 596.4 MHz */ |
616 | { 16800000, 594000000, 71, 1, 1}, /* actual: 596.4 MHz */ | 625 | { 19200000, 594000000, 62, 1, 2}, /* actual: 595.2 MHz */ |
617 | { 19200000, 594000000, 62, 1, 1}, /* actual: 595.2 MHz */ | 626 | { 26000000, 594000000, 91, 2, 2}, /* actual: 591.5 MHz */ |
618 | { 26000000, 594000000, 91, 2, 1}, /* actual: 591.5 MHz */ | ||
619 | { 0, 0, 0, 0, 0, 0 }, | 627 | { 0, 0, 0, 0, 0, 0 }, |
620 | }; | 628 | }; |
621 | 629 | ||
@@ -753,21 +761,19 @@ static struct tegra_clk tegra124_clks[tegra_clk_max] __initdata = { | |||
753 | [tegra_clk_rtc] = { .dt_id = TEGRA124_CLK_RTC, .present = true }, | 761 | [tegra_clk_rtc] = { .dt_id = TEGRA124_CLK_RTC, .present = true }, |
754 | [tegra_clk_timer] = { .dt_id = TEGRA124_CLK_TIMER, .present = true }, | 762 | [tegra_clk_timer] = { .dt_id = TEGRA124_CLK_TIMER, .present = true }, |
755 | [tegra_clk_uarta] = { .dt_id = TEGRA124_CLK_UARTA, .present = true }, | 763 | [tegra_clk_uarta] = { .dt_id = TEGRA124_CLK_UARTA, .present = true }, |
756 | [tegra_clk_sdmmc2] = { .dt_id = TEGRA124_CLK_SDMMC2, .present = true }, | 764 | [tegra_clk_sdmmc2_8] = { .dt_id = TEGRA124_CLK_SDMMC2, .present = true }, |
757 | [tegra_clk_i2s1] = { .dt_id = TEGRA124_CLK_I2S1, .present = true }, | 765 | [tegra_clk_i2s1] = { .dt_id = TEGRA124_CLK_I2S1, .present = true }, |
758 | [tegra_clk_i2c1] = { .dt_id = TEGRA124_CLK_I2C1, .present = true }, | 766 | [tegra_clk_i2c1] = { .dt_id = TEGRA124_CLK_I2C1, .present = true }, |
759 | [tegra_clk_ndflash] = { .dt_id = TEGRA124_CLK_NDFLASH, .present = true }, | 767 | [tegra_clk_ndflash] = { .dt_id = TEGRA124_CLK_NDFLASH, .present = true }, |
760 | [tegra_clk_sdmmc1] = { .dt_id = TEGRA124_CLK_SDMMC1, .present = true }, | 768 | [tegra_clk_sdmmc1_8] = { .dt_id = TEGRA124_CLK_SDMMC1, .present = true }, |
761 | [tegra_clk_sdmmc4] = { .dt_id = TEGRA124_CLK_SDMMC4, .present = true }, | 769 | [tegra_clk_sdmmc4_8] = { .dt_id = TEGRA124_CLK_SDMMC4, .present = true }, |
762 | [tegra_clk_pwm] = { .dt_id = TEGRA124_CLK_PWM, .present = true }, | 770 | [tegra_clk_pwm] = { .dt_id = TEGRA124_CLK_PWM, .present = true }, |
763 | [tegra_clk_i2s2] = { .dt_id = TEGRA124_CLK_I2S2, .present = true }, | 771 | [tegra_clk_i2s2] = { .dt_id = TEGRA124_CLK_I2S2, .present = true }, |
764 | [tegra_clk_gr2d] = { .dt_id = TEGRA124_CLK_GR_2D, .present = true }, | ||
765 | [tegra_clk_usbd] = { .dt_id = TEGRA124_CLK_USBD, .present = true }, | 772 | [tegra_clk_usbd] = { .dt_id = TEGRA124_CLK_USBD, .present = true }, |
766 | [tegra_clk_isp_8] = { .dt_id = TEGRA124_CLK_ISP, .present = true }, | 773 | [tegra_clk_isp_8] = { .dt_id = TEGRA124_CLK_ISP, .present = true }, |
767 | [tegra_clk_gr3d] = { .dt_id = TEGRA124_CLK_GR_3D, .present = true }, | ||
768 | [tegra_clk_disp2] = { .dt_id = TEGRA124_CLK_DISP2, .present = true }, | 774 | [tegra_clk_disp2] = { .dt_id = TEGRA124_CLK_DISP2, .present = true }, |
769 | [tegra_clk_disp1] = { .dt_id = TEGRA124_CLK_DISP1, .present = true }, | 775 | [tegra_clk_disp1] = { .dt_id = TEGRA124_CLK_DISP1, .present = true }, |
770 | [tegra_clk_host1x] = { .dt_id = TEGRA124_CLK_HOST1X, .present = true }, | 776 | [tegra_clk_host1x_8] = { .dt_id = TEGRA124_CLK_HOST1X, .present = true }, |
771 | [tegra_clk_vcp] = { .dt_id = TEGRA124_CLK_VCP, .present = true }, | 777 | [tegra_clk_vcp] = { .dt_id = TEGRA124_CLK_VCP, .present = true }, |
772 | [tegra_clk_i2s0] = { .dt_id = TEGRA124_CLK_I2S0, .present = true }, | 778 | [tegra_clk_i2s0] = { .dt_id = TEGRA124_CLK_I2S0, .present = true }, |
773 | [tegra_clk_apbdma] = { .dt_id = TEGRA124_CLK_APBDMA, .present = true }, | 779 | [tegra_clk_apbdma] = { .dt_id = TEGRA124_CLK_APBDMA, .present = true }, |
@@ -794,7 +800,7 @@ static struct tegra_clk tegra124_clks[tegra_clk_max] __initdata = { | |||
794 | [tegra_clk_uartd] = { .dt_id = TEGRA124_CLK_UARTD, .present = true }, | 800 | [tegra_clk_uartd] = { .dt_id = TEGRA124_CLK_UARTD, .present = true }, |
795 | [tegra_clk_i2c3] = { .dt_id = TEGRA124_CLK_I2C3, .present = true }, | 801 | [tegra_clk_i2c3] = { .dt_id = TEGRA124_CLK_I2C3, .present = true }, |
796 | [tegra_clk_sbc4] = { .dt_id = TEGRA124_CLK_SBC4, .present = true }, | 802 | [tegra_clk_sbc4] = { .dt_id = TEGRA124_CLK_SBC4, .present = true }, |
797 | [tegra_clk_sdmmc3] = { .dt_id = TEGRA124_CLK_SDMMC3, .present = true }, | 803 | [tegra_clk_sdmmc3_8] = { .dt_id = TEGRA124_CLK_SDMMC3, .present = true }, |
798 | [tegra_clk_pcie] = { .dt_id = TEGRA124_CLK_PCIE, .present = true }, | 804 | [tegra_clk_pcie] = { .dt_id = TEGRA124_CLK_PCIE, .present = true }, |
799 | [tegra_clk_owr] = { .dt_id = TEGRA124_CLK_OWR, .present = true }, | 805 | [tegra_clk_owr] = { .dt_id = TEGRA124_CLK_OWR, .present = true }, |
800 | [tegra_clk_afi] = { .dt_id = TEGRA124_CLK_AFI, .present = true }, | 806 | [tegra_clk_afi] = { .dt_id = TEGRA124_CLK_AFI, .present = true }, |
@@ -1286,9 +1292,9 @@ static void __init tegra124_pll_init(void __iomem *clk_base, | |||
1286 | clk_register_clkdev(clk, "pll_d2", NULL); | 1292 | clk_register_clkdev(clk, "pll_d2", NULL); |
1287 | clks[TEGRA124_CLK_PLL_D2] = clk; | 1293 | clks[TEGRA124_CLK_PLL_D2] = clk; |
1288 | 1294 | ||
1289 | /* PLLD2_OUT0 ?? */ | 1295 | /* PLLD2_OUT0 */ |
1290 | clk = clk_register_fixed_factor(NULL, "pll_d2_out0", "pll_d2", | 1296 | clk = clk_register_fixed_factor(NULL, "pll_d2_out0", "pll_d2", |
1291 | CLK_SET_RATE_PARENT, 1, 2); | 1297 | CLK_SET_RATE_PARENT, 1, 1); |
1292 | clk_register_clkdev(clk, "pll_d2_out0", NULL); | 1298 | clk_register_clkdev(clk, "pll_d2_out0", NULL); |
1293 | clks[TEGRA124_CLK_PLL_D2_OUT0] = clk; | 1299 | clks[TEGRA124_CLK_PLL_D2_OUT0] = clk; |
1294 | 1300 | ||
diff --git a/drivers/clk/tegra/clk-tegra20.c b/drivers/clk/tegra/clk-tegra20.c index dbace152b2fa..dace2b1b5ae6 100644 --- a/drivers/clk/tegra/clk-tegra20.c +++ b/drivers/clk/tegra/clk-tegra20.c | |||
@@ -574,6 +574,8 @@ static struct tegra_clk tegra20_clks[tegra_clk_max] __initdata = { | |||
574 | [tegra_clk_tvdac] = { .dt_id = TEGRA20_CLK_TVDAC, .present = true }, | 574 | [tegra_clk_tvdac] = { .dt_id = TEGRA20_CLK_TVDAC, .present = true }, |
575 | [tegra_clk_vi_sensor] = { .dt_id = TEGRA20_CLK_VI_SENSOR, .present = true }, | 575 | [tegra_clk_vi_sensor] = { .dt_id = TEGRA20_CLK_VI_SENSOR, .present = true }, |
576 | [tegra_clk_afi] = { .dt_id = TEGRA20_CLK_AFI, .present = true }, | 576 | [tegra_clk_afi] = { .dt_id = TEGRA20_CLK_AFI, .present = true }, |
577 | [tegra_clk_fuse] = { .dt_id = TEGRA20_CLK_FUSE, .present = true }, | ||
578 | [tegra_clk_kfuse] = { .dt_id = TEGRA20_CLK_KFUSE, .present = true }, | ||
577 | }; | 579 | }; |
578 | 580 | ||
579 | static unsigned long tegra20_clk_measure_input_freq(void) | 581 | static unsigned long tegra20_clk_measure_input_freq(void) |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 08ca8c9f41cd..cf485d928903 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1109,6 +1109,21 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, | |||
1109 | goto err_set_policy_cpu; | 1109 | goto err_set_policy_cpu; |
1110 | } | 1110 | } |
1111 | 1111 | ||
1112 | /* related cpus should atleast have policy->cpus */ | ||
1113 | cpumask_or(policy->related_cpus, policy->related_cpus, policy->cpus); | ||
1114 | |||
1115 | /* | ||
1116 | * affected cpus must always be the one, which are online. We aren't | ||
1117 | * managing offline cpus here. | ||
1118 | */ | ||
1119 | cpumask_and(policy->cpus, policy->cpus, cpu_online_mask); | ||
1120 | |||
1121 | if (!frozen) { | ||
1122 | policy->user_policy.min = policy->min; | ||
1123 | policy->user_policy.max = policy->max; | ||
1124 | } | ||
1125 | |||
1126 | down_write(&policy->rwsem); | ||
1112 | write_lock_irqsave(&cpufreq_driver_lock, flags); | 1127 | write_lock_irqsave(&cpufreq_driver_lock, flags); |
1113 | for_each_cpu(j, policy->cpus) | 1128 | for_each_cpu(j, policy->cpus) |
1114 | per_cpu(cpufreq_cpu_data, j) = policy; | 1129 | per_cpu(cpufreq_cpu_data, j) = policy; |
@@ -1162,20 +1177,6 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, | |||
1162 | } | 1177 | } |
1163 | } | 1178 | } |
1164 | 1179 | ||
1165 | /* related cpus should atleast have policy->cpus */ | ||
1166 | cpumask_or(policy->related_cpus, policy->related_cpus, policy->cpus); | ||
1167 | |||
1168 | /* | ||
1169 | * affected cpus must always be the one, which are online. We aren't | ||
1170 | * managing offline cpus here. | ||
1171 | */ | ||
1172 | cpumask_and(policy->cpus, policy->cpus, cpu_online_mask); | ||
1173 | |||
1174 | if (!frozen) { | ||
1175 | policy->user_policy.min = policy->min; | ||
1176 | policy->user_policy.max = policy->max; | ||
1177 | } | ||
1178 | |||
1179 | blocking_notifier_call_chain(&cpufreq_policy_notifier_list, | 1180 | blocking_notifier_call_chain(&cpufreq_policy_notifier_list, |
1180 | CPUFREQ_START, policy); | 1181 | CPUFREQ_START, policy); |
1181 | 1182 | ||
@@ -1206,6 +1207,7 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, | |||
1206 | policy->user_policy.policy = policy->policy; | 1207 | policy->user_policy.policy = policy->policy; |
1207 | policy->user_policy.governor = policy->governor; | 1208 | policy->user_policy.governor = policy->governor; |
1208 | } | 1209 | } |
1210 | up_write(&policy->rwsem); | ||
1209 | 1211 | ||
1210 | kobject_uevent(&policy->kobj, KOBJ_ADD); | 1212 | kobject_uevent(&policy->kobj, KOBJ_ADD); |
1211 | up_read(&cpufreq_rwsem); | 1213 | up_read(&cpufreq_rwsem); |
@@ -1323,8 +1325,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, | |||
1323 | up_read(&policy->rwsem); | 1325 | up_read(&policy->rwsem); |
1324 | 1326 | ||
1325 | if (cpu != policy->cpu) { | 1327 | if (cpu != policy->cpu) { |
1326 | if (!frozen) | 1328 | sysfs_remove_link(&dev->kobj, "cpufreq"); |
1327 | sysfs_remove_link(&dev->kobj, "cpufreq"); | ||
1328 | } else if (cpus > 1) { | 1329 | } else if (cpus > 1) { |
1329 | new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu); | 1330 | new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu); |
1330 | if (new_cpu >= 0) { | 1331 | if (new_cpu >= 0) { |
@@ -1547,23 +1548,16 @@ static unsigned int __cpufreq_get(unsigned int cpu) | |||
1547 | */ | 1548 | */ |
1548 | unsigned int cpufreq_get(unsigned int cpu) | 1549 | unsigned int cpufreq_get(unsigned int cpu) |
1549 | { | 1550 | { |
1550 | struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu); | 1551 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); |
1551 | unsigned int ret_freq = 0; | 1552 | unsigned int ret_freq = 0; |
1552 | 1553 | ||
1553 | if (cpufreq_disabled() || !cpufreq_driver) | 1554 | if (policy) { |
1554 | return -ENOENT; | 1555 | down_read(&policy->rwsem); |
1555 | 1556 | ret_freq = __cpufreq_get(cpu); | |
1556 | BUG_ON(!policy); | 1557 | up_read(&policy->rwsem); |
1557 | |||
1558 | if (!down_read_trylock(&cpufreq_rwsem)) | ||
1559 | return 0; | ||
1560 | |||
1561 | down_read(&policy->rwsem); | ||
1562 | |||
1563 | ret_freq = __cpufreq_get(cpu); | ||
1564 | 1558 | ||
1565 | up_read(&policy->rwsem); | 1559 | cpufreq_cpu_put(policy); |
1566 | up_read(&cpufreq_rwsem); | 1560 | } |
1567 | 1561 | ||
1568 | return ret_freq; | 1562 | return ret_freq; |
1569 | } | 1563 | } |
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index c788abf1c457..2cd36b9297f3 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -34,12 +34,15 @@ | |||
34 | 34 | ||
35 | #define SAMPLE_COUNT 3 | 35 | #define SAMPLE_COUNT 3 |
36 | 36 | ||
37 | #define BYT_RATIOS 0x66a | 37 | #define BYT_RATIOS 0x66a |
38 | #define BYT_VIDS 0x66b | 38 | #define BYT_VIDS 0x66b |
39 | #define BYT_TURBO_RATIOS 0x66c | ||
39 | 40 | ||
40 | #define FRAC_BITS 8 | 41 | |
42 | #define FRAC_BITS 6 | ||
41 | #define int_tofp(X) ((int64_t)(X) << FRAC_BITS) | 43 | #define int_tofp(X) ((int64_t)(X) << FRAC_BITS) |
42 | #define fp_toint(X) ((X) >> FRAC_BITS) | 44 | #define fp_toint(X) ((X) >> FRAC_BITS) |
45 | #define FP_ROUNDUP(X) ((X) += 1 << FRAC_BITS) | ||
43 | 46 | ||
44 | static inline int32_t mul_fp(int32_t x, int32_t y) | 47 | static inline int32_t mul_fp(int32_t x, int32_t y) |
45 | { | 48 | { |
@@ -357,7 +360,7 @@ static int byt_get_min_pstate(void) | |||
357 | { | 360 | { |
358 | u64 value; | 361 | u64 value; |
359 | rdmsrl(BYT_RATIOS, value); | 362 | rdmsrl(BYT_RATIOS, value); |
360 | return value & 0xFF; | 363 | return (value >> 8) & 0xFF; |
361 | } | 364 | } |
362 | 365 | ||
363 | static int byt_get_max_pstate(void) | 366 | static int byt_get_max_pstate(void) |
@@ -367,6 +370,13 @@ static int byt_get_max_pstate(void) | |||
367 | return (value >> 16) & 0xFF; | 370 | return (value >> 16) & 0xFF; |
368 | } | 371 | } |
369 | 372 | ||
373 | static int byt_get_turbo_pstate(void) | ||
374 | { | ||
375 | u64 value; | ||
376 | rdmsrl(BYT_TURBO_RATIOS, value); | ||
377 | return value & 0x3F; | ||
378 | } | ||
379 | |||
370 | static void byt_set_pstate(struct cpudata *cpudata, int pstate) | 380 | static void byt_set_pstate(struct cpudata *cpudata, int pstate) |
371 | { | 381 | { |
372 | u64 val; | 382 | u64 val; |
@@ -469,7 +479,7 @@ static struct cpu_defaults byt_params = { | |||
469 | .funcs = { | 479 | .funcs = { |
470 | .get_max = byt_get_max_pstate, | 480 | .get_max = byt_get_max_pstate, |
471 | .get_min = byt_get_min_pstate, | 481 | .get_min = byt_get_min_pstate, |
472 | .get_turbo = byt_get_max_pstate, | 482 | .get_turbo = byt_get_turbo_pstate, |
473 | .set = byt_set_pstate, | 483 | .set = byt_set_pstate, |
474 | .get_vid = byt_get_vid, | 484 | .get_vid = byt_get_vid, |
475 | }, | 485 | }, |
@@ -547,18 +557,20 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu) | |||
547 | static inline void intel_pstate_calc_busy(struct cpudata *cpu, | 557 | static inline void intel_pstate_calc_busy(struct cpudata *cpu, |
548 | struct sample *sample) | 558 | struct sample *sample) |
549 | { | 559 | { |
550 | u64 core_pct; | 560 | int32_t core_pct; |
551 | u64 c0_pct; | 561 | int32_t c0_pct; |
552 | 562 | ||
553 | core_pct = div64_u64(sample->aperf * 100, sample->mperf); | 563 | core_pct = div_fp(int_tofp((sample->aperf)), |
564 | int_tofp((sample->mperf))); | ||
565 | core_pct = mul_fp(core_pct, int_tofp(100)); | ||
566 | FP_ROUNDUP(core_pct); | ||
567 | |||
568 | c0_pct = div_fp(int_tofp(sample->mperf), int_tofp(sample->tsc)); | ||
554 | 569 | ||
555 | c0_pct = div64_u64(sample->mperf * 100, sample->tsc); | ||
556 | sample->freq = fp_toint( | 570 | sample->freq = fp_toint( |
557 | mul_fp(int_tofp(cpu->pstate.max_pstate), | 571 | mul_fp(int_tofp(cpu->pstate.max_pstate * 1000), core_pct)); |
558 | int_tofp(core_pct * 1000))); | ||
559 | 572 | ||
560 | sample->core_pct_busy = mul_fp(int_tofp(core_pct), | 573 | sample->core_pct_busy = mul_fp(core_pct, c0_pct); |
561 | div_fp(int_tofp(c0_pct + 1), int_tofp(100))); | ||
562 | } | 574 | } |
563 | 575 | ||
564 | static inline void intel_pstate_sample(struct cpudata *cpu) | 576 | static inline void intel_pstate_sample(struct cpudata *cpu) |
@@ -570,6 +582,10 @@ static inline void intel_pstate_sample(struct cpudata *cpu) | |||
570 | rdmsrl(MSR_IA32_MPERF, mperf); | 582 | rdmsrl(MSR_IA32_MPERF, mperf); |
571 | tsc = native_read_tsc(); | 583 | tsc = native_read_tsc(); |
572 | 584 | ||
585 | aperf = aperf >> FRAC_BITS; | ||
586 | mperf = mperf >> FRAC_BITS; | ||
587 | tsc = tsc >> FRAC_BITS; | ||
588 | |||
573 | cpu->sample_ptr = (cpu->sample_ptr + 1) % SAMPLE_COUNT; | 589 | cpu->sample_ptr = (cpu->sample_ptr + 1) % SAMPLE_COUNT; |
574 | cpu->samples[cpu->sample_ptr].aperf = aperf; | 590 | cpu->samples[cpu->sample_ptr].aperf = aperf; |
575 | cpu->samples[cpu->sample_ptr].mperf = mperf; | 591 | cpu->samples[cpu->sample_ptr].mperf = mperf; |
@@ -601,7 +617,8 @@ static inline int32_t intel_pstate_get_scaled_busy(struct cpudata *cpu) | |||
601 | core_busy = cpu->samples[cpu->sample_ptr].core_pct_busy; | 617 | core_busy = cpu->samples[cpu->sample_ptr].core_pct_busy; |
602 | max_pstate = int_tofp(cpu->pstate.max_pstate); | 618 | max_pstate = int_tofp(cpu->pstate.max_pstate); |
603 | current_pstate = int_tofp(cpu->pstate.current_pstate); | 619 | current_pstate = int_tofp(cpu->pstate.current_pstate); |
604 | return mul_fp(core_busy, div_fp(max_pstate, current_pstate)); | 620 | core_busy = mul_fp(core_busy, div_fp(max_pstate, current_pstate)); |
621 | return FP_ROUNDUP(core_busy); | ||
605 | } | 622 | } |
606 | 623 | ||
607 | static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu) | 624 | static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu) |
diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c index e10b646634d7..6684e0342792 100644 --- a/drivers/cpufreq/powernow-k8.c +++ b/drivers/cpufreq/powernow-k8.c | |||
@@ -1076,7 +1076,7 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
1076 | { | 1076 | { |
1077 | struct powernow_k8_data *data; | 1077 | struct powernow_k8_data *data; |
1078 | struct init_on_cpu init_on_cpu; | 1078 | struct init_on_cpu init_on_cpu; |
1079 | int rc; | 1079 | int rc, cpu; |
1080 | 1080 | ||
1081 | smp_call_function_single(pol->cpu, check_supported_cpu, &rc, 1); | 1081 | smp_call_function_single(pol->cpu, check_supported_cpu, &rc, 1); |
1082 | if (rc) | 1082 | if (rc) |
@@ -1140,7 +1140,9 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
1140 | pr_debug("cpu_init done, current fid 0x%x, vid 0x%x\n", | 1140 | pr_debug("cpu_init done, current fid 0x%x, vid 0x%x\n", |
1141 | data->currfid, data->currvid); | 1141 | data->currfid, data->currvid); |
1142 | 1142 | ||
1143 | per_cpu(powernow_data, pol->cpu) = data; | 1143 | /* Point all the CPUs in this policy to the same data */ |
1144 | for_each_cpu(cpu, pol->cpus) | ||
1145 | per_cpu(powernow_data, cpu) = data; | ||
1144 | 1146 | ||
1145 | return 0; | 1147 | return 0; |
1146 | 1148 | ||
@@ -1155,6 +1157,7 @@ err_out: | |||
1155 | static int powernowk8_cpu_exit(struct cpufreq_policy *pol) | 1157 | static int powernowk8_cpu_exit(struct cpufreq_policy *pol) |
1156 | { | 1158 | { |
1157 | struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu); | 1159 | struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu); |
1160 | int cpu; | ||
1158 | 1161 | ||
1159 | if (!data) | 1162 | if (!data) |
1160 | return -EINVAL; | 1163 | return -EINVAL; |
@@ -1165,7 +1168,8 @@ static int powernowk8_cpu_exit(struct cpufreq_policy *pol) | |||
1165 | 1168 | ||
1166 | kfree(data->powernow_table); | 1169 | kfree(data->powernow_table); |
1167 | kfree(data); | 1170 | kfree(data); |
1168 | per_cpu(powernow_data, pol->cpu) = NULL; | 1171 | for_each_cpu(cpu, pol->cpus) |
1172 | per_cpu(powernow_data, cpu) = NULL; | ||
1169 | 1173 | ||
1170 | return 0; | 1174 | return 0; |
1171 | } | 1175 | } |
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 4e7918339b12..19041cefabb1 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c | |||
@@ -449,6 +449,7 @@ static const struct of_device_id sdma_dt_ids[] = { | |||
449 | { .compatible = "fsl,imx51-sdma", .data = &sdma_imx51, }, | 449 | { .compatible = "fsl,imx51-sdma", .data = &sdma_imx51, }, |
450 | { .compatible = "fsl,imx35-sdma", .data = &sdma_imx35, }, | 450 | { .compatible = "fsl,imx35-sdma", .data = &sdma_imx35, }, |
451 | { .compatible = "fsl,imx31-sdma", .data = &sdma_imx31, }, | 451 | { .compatible = "fsl,imx31-sdma", .data = &sdma_imx31, }, |
452 | { .compatible = "fsl,imx25-sdma", .data = &sdma_imx25, }, | ||
452 | { /* sentinel */ } | 453 | { /* sentinel */ } |
453 | }; | 454 | }; |
454 | MODULE_DEVICE_TABLE(of, sdma_dt_ids); | 455 | MODULE_DEVICE_TABLE(of, sdma_dt_ids); |
diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c index 87529181efcc..4e3549a16132 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c | |||
@@ -77,7 +77,8 @@ static irqreturn_t ioat_dma_do_interrupt(int irq, void *data) | |||
77 | attnstatus = readl(instance->reg_base + IOAT_ATTNSTATUS_OFFSET); | 77 | attnstatus = readl(instance->reg_base + IOAT_ATTNSTATUS_OFFSET); |
78 | for_each_set_bit(bit, &attnstatus, BITS_PER_LONG) { | 78 | for_each_set_bit(bit, &attnstatus, BITS_PER_LONG) { |
79 | chan = ioat_chan_by_index(instance, bit); | 79 | chan = ioat_chan_by_index(instance, bit); |
80 | tasklet_schedule(&chan->cleanup_task); | 80 | if (test_bit(IOAT_RUN, &chan->state)) |
81 | tasklet_schedule(&chan->cleanup_task); | ||
81 | } | 82 | } |
82 | 83 | ||
83 | writeb(intrctrl, instance->reg_base + IOAT_INTRCTRL_OFFSET); | 84 | writeb(intrctrl, instance->reg_base + IOAT_INTRCTRL_OFFSET); |
@@ -93,7 +94,8 @@ static irqreturn_t ioat_dma_do_interrupt_msix(int irq, void *data) | |||
93 | { | 94 | { |
94 | struct ioat_chan_common *chan = data; | 95 | struct ioat_chan_common *chan = data; |
95 | 96 | ||
96 | tasklet_schedule(&chan->cleanup_task); | 97 | if (test_bit(IOAT_RUN, &chan->state)) |
98 | tasklet_schedule(&chan->cleanup_task); | ||
97 | 99 | ||
98 | return IRQ_HANDLED; | 100 | return IRQ_HANDLED; |
99 | } | 101 | } |
@@ -116,7 +118,6 @@ void ioat_init_channel(struct ioatdma_device *device, struct ioat_chan_common *c | |||
116 | chan->timer.function = device->timer_fn; | 118 | chan->timer.function = device->timer_fn; |
117 | chan->timer.data = data; | 119 | chan->timer.data = data; |
118 | tasklet_init(&chan->cleanup_task, device->cleanup_fn, data); | 120 | tasklet_init(&chan->cleanup_task, device->cleanup_fn, data); |
119 | tasklet_disable(&chan->cleanup_task); | ||
120 | } | 121 | } |
121 | 122 | ||
122 | /** | 123 | /** |
@@ -354,13 +355,49 @@ static int ioat1_dma_alloc_chan_resources(struct dma_chan *c) | |||
354 | writel(((u64) chan->completion_dma) >> 32, | 355 | writel(((u64) chan->completion_dma) >> 32, |
355 | chan->reg_base + IOAT_CHANCMP_OFFSET_HIGH); | 356 | chan->reg_base + IOAT_CHANCMP_OFFSET_HIGH); |
356 | 357 | ||
357 | tasklet_enable(&chan->cleanup_task); | 358 | set_bit(IOAT_RUN, &chan->state); |
358 | ioat1_dma_start_null_desc(ioat); /* give chain to dma device */ | 359 | ioat1_dma_start_null_desc(ioat); /* give chain to dma device */ |
359 | dev_dbg(to_dev(chan), "%s: allocated %d descriptors\n", | 360 | dev_dbg(to_dev(chan), "%s: allocated %d descriptors\n", |
360 | __func__, ioat->desccount); | 361 | __func__, ioat->desccount); |
361 | return ioat->desccount; | 362 | return ioat->desccount; |
362 | } | 363 | } |
363 | 364 | ||
365 | void ioat_stop(struct ioat_chan_common *chan) | ||
366 | { | ||
367 | struct ioatdma_device *device = chan->device; | ||
368 | struct pci_dev *pdev = device->pdev; | ||
369 | int chan_id = chan_num(chan); | ||
370 | struct msix_entry *msix; | ||
371 | |||
372 | /* 1/ stop irq from firing tasklets | ||
373 | * 2/ stop the tasklet from re-arming irqs | ||
374 | */ | ||
375 | clear_bit(IOAT_RUN, &chan->state); | ||
376 | |||
377 | /* flush inflight interrupts */ | ||
378 | switch (device->irq_mode) { | ||
379 | case IOAT_MSIX: | ||
380 | msix = &device->msix_entries[chan_id]; | ||
381 | synchronize_irq(msix->vector); | ||
382 | break; | ||
383 | case IOAT_MSI: | ||
384 | case IOAT_INTX: | ||
385 | synchronize_irq(pdev->irq); | ||
386 | break; | ||
387 | default: | ||
388 | break; | ||
389 | } | ||
390 | |||
391 | /* flush inflight timers */ | ||
392 | del_timer_sync(&chan->timer); | ||
393 | |||
394 | /* flush inflight tasklet runs */ | ||
395 | tasklet_kill(&chan->cleanup_task); | ||
396 | |||
397 | /* final cleanup now that everything is quiesced and can't re-arm */ | ||
398 | device->cleanup_fn((unsigned long) &chan->common); | ||
399 | } | ||
400 | |||
364 | /** | 401 | /** |
365 | * ioat1_dma_free_chan_resources - release all the descriptors | 402 | * ioat1_dma_free_chan_resources - release all the descriptors |
366 | * @chan: the channel to be cleaned | 403 | * @chan: the channel to be cleaned |
@@ -379,9 +416,7 @@ static void ioat1_dma_free_chan_resources(struct dma_chan *c) | |||
379 | if (ioat->desccount == 0) | 416 | if (ioat->desccount == 0) |
380 | return; | 417 | return; |
381 | 418 | ||
382 | tasklet_disable(&chan->cleanup_task); | 419 | ioat_stop(chan); |
383 | del_timer_sync(&chan->timer); | ||
384 | ioat1_cleanup(ioat); | ||
385 | 420 | ||
386 | /* Delay 100ms after reset to allow internal DMA logic to quiesce | 421 | /* Delay 100ms after reset to allow internal DMA logic to quiesce |
387 | * before removing DMA descriptor resources. | 422 | * before removing DMA descriptor resources. |
@@ -526,8 +561,11 @@ ioat1_dma_prep_memcpy(struct dma_chan *c, dma_addr_t dma_dest, | |||
526 | static void ioat1_cleanup_event(unsigned long data) | 561 | static void ioat1_cleanup_event(unsigned long data) |
527 | { | 562 | { |
528 | struct ioat_dma_chan *ioat = to_ioat_chan((void *) data); | 563 | struct ioat_dma_chan *ioat = to_ioat_chan((void *) data); |
564 | struct ioat_chan_common *chan = &ioat->base; | ||
529 | 565 | ||
530 | ioat1_cleanup(ioat); | 566 | ioat1_cleanup(ioat); |
567 | if (!test_bit(IOAT_RUN, &chan->state)) | ||
568 | return; | ||
531 | writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET); | 569 | writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET); |
532 | } | 570 | } |
533 | 571 | ||
diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h index 11fb877ddca9..e982f00a9843 100644 --- a/drivers/dma/ioat/dma.h +++ b/drivers/dma/ioat/dma.h | |||
@@ -356,6 +356,7 @@ bool ioat_cleanup_preamble(struct ioat_chan_common *chan, | |||
356 | void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type); | 356 | void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type); |
357 | void ioat_kobject_del(struct ioatdma_device *device); | 357 | void ioat_kobject_del(struct ioatdma_device *device); |
358 | int ioat_dma_setup_interrupts(struct ioatdma_device *device); | 358 | int ioat_dma_setup_interrupts(struct ioatdma_device *device); |
359 | void ioat_stop(struct ioat_chan_common *chan); | ||
359 | extern const struct sysfs_ops ioat_sysfs_ops; | 360 | extern const struct sysfs_ops ioat_sysfs_ops; |
360 | extern struct ioat_sysfs_entry ioat_version_attr; | 361 | extern struct ioat_sysfs_entry ioat_version_attr; |
361 | extern struct ioat_sysfs_entry ioat_cap_attr; | 362 | extern struct ioat_sysfs_entry ioat_cap_attr; |
diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c index 5d3affe7e976..8d1058085eeb 100644 --- a/drivers/dma/ioat/dma_v2.c +++ b/drivers/dma/ioat/dma_v2.c | |||
@@ -190,8 +190,11 @@ static void ioat2_cleanup(struct ioat2_dma_chan *ioat) | |||
190 | void ioat2_cleanup_event(unsigned long data) | 190 | void ioat2_cleanup_event(unsigned long data) |
191 | { | 191 | { |
192 | struct ioat2_dma_chan *ioat = to_ioat2_chan((void *) data); | 192 | struct ioat2_dma_chan *ioat = to_ioat2_chan((void *) data); |
193 | struct ioat_chan_common *chan = &ioat->base; | ||
193 | 194 | ||
194 | ioat2_cleanup(ioat); | 195 | ioat2_cleanup(ioat); |
196 | if (!test_bit(IOAT_RUN, &chan->state)) | ||
197 | return; | ||
195 | writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET); | 198 | writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET); |
196 | } | 199 | } |
197 | 200 | ||
@@ -553,10 +556,10 @@ int ioat2_alloc_chan_resources(struct dma_chan *c) | |||
553 | ioat->issued = 0; | 556 | ioat->issued = 0; |
554 | ioat->tail = 0; | 557 | ioat->tail = 0; |
555 | ioat->alloc_order = order; | 558 | ioat->alloc_order = order; |
559 | set_bit(IOAT_RUN, &chan->state); | ||
556 | spin_unlock_bh(&ioat->prep_lock); | 560 | spin_unlock_bh(&ioat->prep_lock); |
557 | spin_unlock_bh(&chan->cleanup_lock); | 561 | spin_unlock_bh(&chan->cleanup_lock); |
558 | 562 | ||
559 | tasklet_enable(&chan->cleanup_task); | ||
560 | ioat2_start_null_desc(ioat); | 563 | ioat2_start_null_desc(ioat); |
561 | 564 | ||
562 | /* check that we got off the ground */ | 565 | /* check that we got off the ground */ |
@@ -566,7 +569,6 @@ int ioat2_alloc_chan_resources(struct dma_chan *c) | |||
566 | } while (i++ < 20 && !is_ioat_active(status) && !is_ioat_idle(status)); | 569 | } while (i++ < 20 && !is_ioat_active(status) && !is_ioat_idle(status)); |
567 | 570 | ||
568 | if (is_ioat_active(status) || is_ioat_idle(status)) { | 571 | if (is_ioat_active(status) || is_ioat_idle(status)) { |
569 | set_bit(IOAT_RUN, &chan->state); | ||
570 | return 1 << ioat->alloc_order; | 572 | return 1 << ioat->alloc_order; |
571 | } else { | 573 | } else { |
572 | u32 chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET); | 574 | u32 chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET); |
@@ -809,11 +811,8 @@ void ioat2_free_chan_resources(struct dma_chan *c) | |||
809 | if (!ioat->ring) | 811 | if (!ioat->ring) |
810 | return; | 812 | return; |
811 | 813 | ||
812 | tasklet_disable(&chan->cleanup_task); | 814 | ioat_stop(chan); |
813 | del_timer_sync(&chan->timer); | ||
814 | device->cleanup_fn((unsigned long) c); | ||
815 | device->reset_hw(chan); | 815 | device->reset_hw(chan); |
816 | clear_bit(IOAT_RUN, &chan->state); | ||
817 | 816 | ||
818 | spin_lock_bh(&chan->cleanup_lock); | 817 | spin_lock_bh(&chan->cleanup_lock); |
819 | spin_lock_bh(&ioat->prep_lock); | 818 | spin_lock_bh(&ioat->prep_lock); |
diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c index 820817e97e62..b9b38a1cf92f 100644 --- a/drivers/dma/ioat/dma_v3.c +++ b/drivers/dma/ioat/dma_v3.c | |||
@@ -464,8 +464,11 @@ static void ioat3_cleanup(struct ioat2_dma_chan *ioat) | |||
464 | static void ioat3_cleanup_event(unsigned long data) | 464 | static void ioat3_cleanup_event(unsigned long data) |
465 | { | 465 | { |
466 | struct ioat2_dma_chan *ioat = to_ioat2_chan((void *) data); | 466 | struct ioat2_dma_chan *ioat = to_ioat2_chan((void *) data); |
467 | struct ioat_chan_common *chan = &ioat->base; | ||
467 | 468 | ||
468 | ioat3_cleanup(ioat); | 469 | ioat3_cleanup(ioat); |
470 | if (!test_bit(IOAT_RUN, &chan->state)) | ||
471 | return; | ||
469 | writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET); | 472 | writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET); |
470 | } | 473 | } |
471 | 474 | ||
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 00a2de957b23..bf18c786ed40 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c | |||
@@ -1641,6 +1641,7 @@ static void dma_tasklet(unsigned long data) | |||
1641 | struct d40_chan *d40c = (struct d40_chan *) data; | 1641 | struct d40_chan *d40c = (struct d40_chan *) data; |
1642 | struct d40_desc *d40d; | 1642 | struct d40_desc *d40d; |
1643 | unsigned long flags; | 1643 | unsigned long flags; |
1644 | bool callback_active; | ||
1644 | dma_async_tx_callback callback; | 1645 | dma_async_tx_callback callback; |
1645 | void *callback_param; | 1646 | void *callback_param; |
1646 | 1647 | ||
@@ -1668,6 +1669,7 @@ static void dma_tasklet(unsigned long data) | |||
1668 | } | 1669 | } |
1669 | 1670 | ||
1670 | /* Callback to client */ | 1671 | /* Callback to client */ |
1672 | callback_active = !!(d40d->txd.flags & DMA_PREP_INTERRUPT); | ||
1671 | callback = d40d->txd.callback; | 1673 | callback = d40d->txd.callback; |
1672 | callback_param = d40d->txd.callback_param; | 1674 | callback_param = d40d->txd.callback_param; |
1673 | 1675 | ||
@@ -1690,7 +1692,7 @@ static void dma_tasklet(unsigned long data) | |||
1690 | 1692 | ||
1691 | spin_unlock_irqrestore(&d40c->lock, flags); | 1693 | spin_unlock_irqrestore(&d40c->lock, flags); |
1692 | 1694 | ||
1693 | if (callback && (d40d->txd.flags & DMA_PREP_INTERRUPT)) | 1695 | if (callback_active && callback) |
1694 | callback(callback_param); | 1696 | callback(callback_param); |
1695 | 1697 | ||
1696 | return; | 1698 | return; |
diff --git a/drivers/edac/i7300_edac.c b/drivers/edac/i7300_edac.c index d63f4798f7d0..57e96a3350f0 100644 --- a/drivers/edac/i7300_edac.c +++ b/drivers/edac/i7300_edac.c | |||
@@ -943,33 +943,35 @@ static int i7300_get_devices(struct mem_ctl_info *mci) | |||
943 | 943 | ||
944 | /* Attempt to 'get' the MCH register we want */ | 944 | /* Attempt to 'get' the MCH register we want */ |
945 | pdev = NULL; | 945 | pdev = NULL; |
946 | while (!pvt->pci_dev_16_1_fsb_addr_map || | 946 | while ((pdev = pci_get_device(PCI_VENDOR_ID_INTEL, |
947 | !pvt->pci_dev_16_2_fsb_err_regs) { | 947 | PCI_DEVICE_ID_INTEL_I7300_MCH_ERR, |
948 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, | 948 | pdev))) { |
949 | PCI_DEVICE_ID_INTEL_I7300_MCH_ERR, pdev); | ||
950 | if (!pdev) { | ||
951 | /* End of list, leave */ | ||
952 | i7300_printk(KERN_ERR, | ||
953 | "'system address,Process Bus' " | ||
954 | "device not found:" | ||
955 | "vendor 0x%x device 0x%x ERR funcs " | ||
956 | "(broken BIOS?)\n", | ||
957 | PCI_VENDOR_ID_INTEL, | ||
958 | PCI_DEVICE_ID_INTEL_I7300_MCH_ERR); | ||
959 | goto error; | ||
960 | } | ||
961 | |||
962 | /* Store device 16 funcs 1 and 2 */ | 949 | /* Store device 16 funcs 1 and 2 */ |
963 | switch (PCI_FUNC(pdev->devfn)) { | 950 | switch (PCI_FUNC(pdev->devfn)) { |
964 | case 1: | 951 | case 1: |
965 | pvt->pci_dev_16_1_fsb_addr_map = pdev; | 952 | if (!pvt->pci_dev_16_1_fsb_addr_map) |
953 | pvt->pci_dev_16_1_fsb_addr_map = | ||
954 | pci_dev_get(pdev); | ||
966 | break; | 955 | break; |
967 | case 2: | 956 | case 2: |
968 | pvt->pci_dev_16_2_fsb_err_regs = pdev; | 957 | if (!pvt->pci_dev_16_2_fsb_err_regs) |
958 | pvt->pci_dev_16_2_fsb_err_regs = | ||
959 | pci_dev_get(pdev); | ||
969 | break; | 960 | break; |
970 | } | 961 | } |
971 | } | 962 | } |
972 | 963 | ||
964 | if (!pvt->pci_dev_16_1_fsb_addr_map || | ||
965 | !pvt->pci_dev_16_2_fsb_err_regs) { | ||
966 | /* At least one device was not found */ | ||
967 | i7300_printk(KERN_ERR, | ||
968 | "'system address,Process Bus' device not found:" | ||
969 | "vendor 0x%x device 0x%x ERR funcs (broken BIOS?)\n", | ||
970 | PCI_VENDOR_ID_INTEL, | ||
971 | PCI_DEVICE_ID_INTEL_I7300_MCH_ERR); | ||
972 | goto error; | ||
973 | } | ||
974 | |||
973 | edac_dbg(1, "System Address, processor bus- PCI Bus ID: %s %x:%x\n", | 975 | edac_dbg(1, "System Address, processor bus- PCI Bus ID: %s %x:%x\n", |
974 | pci_name(pvt->pci_dev_16_0_fsb_ctlr), | 976 | pci_name(pvt->pci_dev_16_0_fsb_ctlr), |
975 | pvt->pci_dev_16_0_fsb_ctlr->vendor, | 977 | pvt->pci_dev_16_0_fsb_ctlr->vendor, |
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c index 87533ca7752e..d871275196f6 100644 --- a/drivers/edac/i7core_edac.c +++ b/drivers/edac/i7core_edac.c | |||
@@ -1334,14 +1334,19 @@ static int i7core_get_onedevice(struct pci_dev **prev, | |||
1334 | * is at addr 8086:2c40, instead of 8086:2c41. So, we need | 1334 | * is at addr 8086:2c40, instead of 8086:2c41. So, we need |
1335 | * to probe for the alternate address in case of failure | 1335 | * to probe for the alternate address in case of failure |
1336 | */ | 1336 | */ |
1337 | if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_I7_NONCORE && !pdev) | 1337 | if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_I7_NONCORE && !pdev) { |
1338 | pci_dev_get(*prev); /* pci_get_device will put it */ | ||
1338 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, | 1339 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, |
1339 | PCI_DEVICE_ID_INTEL_I7_NONCORE_ALT, *prev); | 1340 | PCI_DEVICE_ID_INTEL_I7_NONCORE_ALT, *prev); |
1341 | } | ||
1340 | 1342 | ||
1341 | if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE && !pdev) | 1343 | if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE && |
1344 | !pdev) { | ||
1345 | pci_dev_get(*prev); /* pci_get_device will put it */ | ||
1342 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, | 1346 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, |
1343 | PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE_ALT, | 1347 | PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE_ALT, |
1344 | *prev); | 1348 | *prev); |
1349 | } | ||
1345 | 1350 | ||
1346 | if (!pdev) { | 1351 | if (!pdev) { |
1347 | if (*prev) { | 1352 | if (*prev) { |
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index c20602f601ee..98a14f6143a7 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c | |||
@@ -222,27 +222,19 @@ static void arizona_extcon_pulse_micbias(struct arizona_extcon_info *info) | |||
222 | struct snd_soc_dapm_context *dapm = arizona->dapm; | 222 | struct snd_soc_dapm_context *dapm = arizona->dapm; |
223 | int ret; | 223 | int ret; |
224 | 224 | ||
225 | mutex_lock(&dapm->card->dapm_mutex); | ||
226 | |||
227 | ret = snd_soc_dapm_force_enable_pin(dapm, widget); | 225 | ret = snd_soc_dapm_force_enable_pin(dapm, widget); |
228 | if (ret != 0) | 226 | if (ret != 0) |
229 | dev_warn(arizona->dev, "Failed to enable %s: %d\n", | 227 | dev_warn(arizona->dev, "Failed to enable %s: %d\n", |
230 | widget, ret); | 228 | widget, ret); |
231 | 229 | ||
232 | mutex_unlock(&dapm->card->dapm_mutex); | ||
233 | |||
234 | snd_soc_dapm_sync(dapm); | 230 | snd_soc_dapm_sync(dapm); |
235 | 231 | ||
236 | if (!arizona->pdata.micd_force_micbias) { | 232 | if (!arizona->pdata.micd_force_micbias) { |
237 | mutex_lock(&dapm->card->dapm_mutex); | ||
238 | |||
239 | ret = snd_soc_dapm_disable_pin(arizona->dapm, widget); | 233 | ret = snd_soc_dapm_disable_pin(arizona->dapm, widget); |
240 | if (ret != 0) | 234 | if (ret != 0) |
241 | dev_warn(arizona->dev, "Failed to disable %s: %d\n", | 235 | dev_warn(arizona->dev, "Failed to disable %s: %d\n", |
242 | widget, ret); | 236 | widget, ret); |
243 | 237 | ||
244 | mutex_unlock(&dapm->card->dapm_mutex); | ||
245 | |||
246 | snd_soc_dapm_sync(dapm); | 238 | snd_soc_dapm_sync(dapm); |
247 | } | 239 | } |
248 | } | 240 | } |
@@ -304,16 +296,12 @@ static void arizona_stop_mic(struct arizona_extcon_info *info) | |||
304 | ARIZONA_MICD_ENA, 0, | 296 | ARIZONA_MICD_ENA, 0, |
305 | &change); | 297 | &change); |
306 | 298 | ||
307 | mutex_lock(&dapm->card->dapm_mutex); | ||
308 | |||
309 | ret = snd_soc_dapm_disable_pin(dapm, widget); | 299 | ret = snd_soc_dapm_disable_pin(dapm, widget); |
310 | if (ret != 0) | 300 | if (ret != 0) |
311 | dev_warn(arizona->dev, | 301 | dev_warn(arizona->dev, |
312 | "Failed to disable %s: %d\n", | 302 | "Failed to disable %s: %d\n", |
313 | widget, ret); | 303 | widget, ret); |
314 | 304 | ||
315 | mutex_unlock(&dapm->card->dapm_mutex); | ||
316 | |||
317 | snd_soc_dapm_sync(dapm); | 305 | snd_soc_dapm_sync(dapm); |
318 | 306 | ||
319 | if (info->micd_reva) { | 307 | if (info->micd_reva) { |
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c index de4aa409abe2..2c6d5e118ac1 100644 --- a/drivers/firewire/core-device.c +++ b/drivers/firewire/core-device.c | |||
@@ -916,7 +916,7 @@ static int lookup_existing_device(struct device *dev, void *data) | |||
916 | old->config_rom_retries = 0; | 916 | old->config_rom_retries = 0; |
917 | fw_notice(card, "rediscovered device %s\n", dev_name(dev)); | 917 | fw_notice(card, "rediscovered device %s\n", dev_name(dev)); |
918 | 918 | ||
919 | PREPARE_DELAYED_WORK(&old->work, fw_device_update); | 919 | old->workfn = fw_device_update; |
920 | fw_schedule_device_work(old, 0); | 920 | fw_schedule_device_work(old, 0); |
921 | 921 | ||
922 | if (current_node == card->root_node) | 922 | if (current_node == card->root_node) |
@@ -1075,7 +1075,7 @@ static void fw_device_init(struct work_struct *work) | |||
1075 | if (atomic_cmpxchg(&device->state, | 1075 | if (atomic_cmpxchg(&device->state, |
1076 | FW_DEVICE_INITIALIZING, | 1076 | FW_DEVICE_INITIALIZING, |
1077 | FW_DEVICE_RUNNING) == FW_DEVICE_GONE) { | 1077 | FW_DEVICE_RUNNING) == FW_DEVICE_GONE) { |
1078 | PREPARE_DELAYED_WORK(&device->work, fw_device_shutdown); | 1078 | device->workfn = fw_device_shutdown; |
1079 | fw_schedule_device_work(device, SHUTDOWN_DELAY); | 1079 | fw_schedule_device_work(device, SHUTDOWN_DELAY); |
1080 | } else { | 1080 | } else { |
1081 | fw_notice(card, "created device %s: GUID %08x%08x, S%d00\n", | 1081 | fw_notice(card, "created device %s: GUID %08x%08x, S%d00\n", |
@@ -1196,13 +1196,20 @@ static void fw_device_refresh(struct work_struct *work) | |||
1196 | dev_name(&device->device), fw_rcode_string(ret)); | 1196 | dev_name(&device->device), fw_rcode_string(ret)); |
1197 | gone: | 1197 | gone: |
1198 | atomic_set(&device->state, FW_DEVICE_GONE); | 1198 | atomic_set(&device->state, FW_DEVICE_GONE); |
1199 | PREPARE_DELAYED_WORK(&device->work, fw_device_shutdown); | 1199 | device->workfn = fw_device_shutdown; |
1200 | fw_schedule_device_work(device, SHUTDOWN_DELAY); | 1200 | fw_schedule_device_work(device, SHUTDOWN_DELAY); |
1201 | out: | 1201 | out: |
1202 | if (node_id == card->root_node->node_id) | 1202 | if (node_id == card->root_node->node_id) |
1203 | fw_schedule_bm_work(card, 0); | 1203 | fw_schedule_bm_work(card, 0); |
1204 | } | 1204 | } |
1205 | 1205 | ||
1206 | static void fw_device_workfn(struct work_struct *work) | ||
1207 | { | ||
1208 | struct fw_device *device = container_of(to_delayed_work(work), | ||
1209 | struct fw_device, work); | ||
1210 | device->workfn(work); | ||
1211 | } | ||
1212 | |||
1206 | void fw_node_event(struct fw_card *card, struct fw_node *node, int event) | 1213 | void fw_node_event(struct fw_card *card, struct fw_node *node, int event) |
1207 | { | 1214 | { |
1208 | struct fw_device *device; | 1215 | struct fw_device *device; |
@@ -1252,7 +1259,8 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event) | |||
1252 | * power-up after getting plugged in. We schedule the | 1259 | * power-up after getting plugged in. We schedule the |
1253 | * first config rom scan half a second after bus reset. | 1260 | * first config rom scan half a second after bus reset. |
1254 | */ | 1261 | */ |
1255 | INIT_DELAYED_WORK(&device->work, fw_device_init); | 1262 | device->workfn = fw_device_init; |
1263 | INIT_DELAYED_WORK(&device->work, fw_device_workfn); | ||
1256 | fw_schedule_device_work(device, INITIAL_DELAY); | 1264 | fw_schedule_device_work(device, INITIAL_DELAY); |
1257 | break; | 1265 | break; |
1258 | 1266 | ||
@@ -1268,7 +1276,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event) | |||
1268 | if (atomic_cmpxchg(&device->state, | 1276 | if (atomic_cmpxchg(&device->state, |
1269 | FW_DEVICE_RUNNING, | 1277 | FW_DEVICE_RUNNING, |
1270 | FW_DEVICE_INITIALIZING) == FW_DEVICE_RUNNING) { | 1278 | FW_DEVICE_INITIALIZING) == FW_DEVICE_RUNNING) { |
1271 | PREPARE_DELAYED_WORK(&device->work, fw_device_refresh); | 1279 | device->workfn = fw_device_refresh; |
1272 | fw_schedule_device_work(device, | 1280 | fw_schedule_device_work(device, |
1273 | device->is_local ? 0 : INITIAL_DELAY); | 1281 | device->is_local ? 0 : INITIAL_DELAY); |
1274 | } | 1282 | } |
@@ -1283,7 +1291,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event) | |||
1283 | smp_wmb(); /* update node_id before generation */ | 1291 | smp_wmb(); /* update node_id before generation */ |
1284 | device->generation = card->generation; | 1292 | device->generation = card->generation; |
1285 | if (atomic_read(&device->state) == FW_DEVICE_RUNNING) { | 1293 | if (atomic_read(&device->state) == FW_DEVICE_RUNNING) { |
1286 | PREPARE_DELAYED_WORK(&device->work, fw_device_update); | 1294 | device->workfn = fw_device_update; |
1287 | fw_schedule_device_work(device, 0); | 1295 | fw_schedule_device_work(device, 0); |
1288 | } | 1296 | } |
1289 | break; | 1297 | break; |
@@ -1308,7 +1316,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event) | |||
1308 | device = node->data; | 1316 | device = node->data; |
1309 | if (atomic_xchg(&device->state, | 1317 | if (atomic_xchg(&device->state, |
1310 | FW_DEVICE_GONE) == FW_DEVICE_RUNNING) { | 1318 | FW_DEVICE_GONE) == FW_DEVICE_RUNNING) { |
1311 | PREPARE_DELAYED_WORK(&device->work, fw_device_shutdown); | 1319 | device->workfn = fw_device_shutdown; |
1312 | fw_schedule_device_work(device, | 1320 | fw_schedule_device_work(device, |
1313 | list_empty(&card->link) ? 0 : SHUTDOWN_DELAY); | 1321 | list_empty(&card->link) ? 0 : SHUTDOWN_DELAY); |
1314 | } | 1322 | } |
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c index 6b895986dc22..4af0a7bad7f2 100644 --- a/drivers/firewire/net.c +++ b/drivers/firewire/net.c | |||
@@ -929,8 +929,6 @@ static void fwnet_write_complete(struct fw_card *card, int rcode, | |||
929 | if (rcode == RCODE_COMPLETE) { | 929 | if (rcode == RCODE_COMPLETE) { |
930 | fwnet_transmit_packet_done(ptask); | 930 | fwnet_transmit_packet_done(ptask); |
931 | } else { | 931 | } else { |
932 | fwnet_transmit_packet_failed(ptask); | ||
933 | |||
934 | if (printk_timed_ratelimit(&j, 1000) || rcode != last_rcode) { | 932 | if (printk_timed_ratelimit(&j, 1000) || rcode != last_rcode) { |
935 | dev_err(&ptask->dev->netdev->dev, | 933 | dev_err(&ptask->dev->netdev->dev, |
936 | "fwnet_write_complete failed: %x (skipped %d)\n", | 934 | "fwnet_write_complete failed: %x (skipped %d)\n", |
@@ -938,8 +936,10 @@ static void fwnet_write_complete(struct fw_card *card, int rcode, | |||
938 | 936 | ||
939 | errors_skipped = 0; | 937 | errors_skipped = 0; |
940 | last_rcode = rcode; | 938 | last_rcode = rcode; |
941 | } else | 939 | } else { |
942 | errors_skipped++; | 940 | errors_skipped++; |
941 | } | ||
942 | fwnet_transmit_packet_failed(ptask); | ||
943 | } | 943 | } |
944 | } | 944 | } |
945 | 945 | ||
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 6f74d8d3f700..8db663219560 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
@@ -290,7 +290,6 @@ static char ohci_driver_name[] = KBUILD_MODNAME; | |||
290 | #define QUIRK_NO_MSI 0x10 | 290 | #define QUIRK_NO_MSI 0x10 |
291 | #define QUIRK_TI_SLLZ059 0x20 | 291 | #define QUIRK_TI_SLLZ059 0x20 |
292 | #define QUIRK_IR_WAKE 0x40 | 292 | #define QUIRK_IR_WAKE 0x40 |
293 | #define QUIRK_PHY_LCTRL_TIMEOUT 0x80 | ||
294 | 293 | ||
295 | /* In case of multiple matches in ohci_quirks[], only the first one is used. */ | 294 | /* In case of multiple matches in ohci_quirks[], only the first one is used. */ |
296 | static const struct { | 295 | static const struct { |
@@ -303,10 +302,7 @@ static const struct { | |||
303 | QUIRK_BE_HEADERS}, | 302 | QUIRK_BE_HEADERS}, |
304 | 303 | ||
305 | {PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_AGERE_FW643, 6, | 304 | {PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_AGERE_FW643, 6, |
306 | QUIRK_PHY_LCTRL_TIMEOUT | QUIRK_NO_MSI}, | 305 | QUIRK_NO_MSI}, |
307 | |||
308 | {PCI_VENDOR_ID_ATT, PCI_ANY_ID, PCI_ANY_ID, | ||
309 | QUIRK_PHY_LCTRL_TIMEOUT}, | ||
310 | 306 | ||
311 | {PCI_VENDOR_ID_CREATIVE, PCI_DEVICE_ID_CREATIVE_SB1394, PCI_ANY_ID, | 307 | {PCI_VENDOR_ID_CREATIVE, PCI_DEVICE_ID_CREATIVE_SB1394, PCI_ANY_ID, |
312 | QUIRK_RESET_PACKET}, | 308 | QUIRK_RESET_PACKET}, |
@@ -353,7 +349,6 @@ MODULE_PARM_DESC(quirks, "Chip quirks (default = 0" | |||
353 | ", disable MSI = " __stringify(QUIRK_NO_MSI) | 349 | ", disable MSI = " __stringify(QUIRK_NO_MSI) |
354 | ", TI SLLZ059 erratum = " __stringify(QUIRK_TI_SLLZ059) | 350 | ", TI SLLZ059 erratum = " __stringify(QUIRK_TI_SLLZ059) |
355 | ", IR wake unreliable = " __stringify(QUIRK_IR_WAKE) | 351 | ", IR wake unreliable = " __stringify(QUIRK_IR_WAKE) |
356 | ", phy LCtrl timeout = " __stringify(QUIRK_PHY_LCTRL_TIMEOUT) | ||
357 | ")"); | 352 | ")"); |
358 | 353 | ||
359 | #define OHCI_PARAM_DEBUG_AT_AR 1 | 354 | #define OHCI_PARAM_DEBUG_AT_AR 1 |
@@ -2299,9 +2294,6 @@ static int ohci_enable(struct fw_card *card, | |||
2299 | * TI TSB82AA2 + TSB81BA3(A) cards signal LPS enabled early but | 2294 | * TI TSB82AA2 + TSB81BA3(A) cards signal LPS enabled early but |
2300 | * cannot actually use the phy at that time. These need tens of | 2295 | * cannot actually use the phy at that time. These need tens of |
2301 | * millisecods pause between LPS write and first phy access too. | 2296 | * millisecods pause between LPS write and first phy access too. |
2302 | * | ||
2303 | * But do not wait for 50msec on Agere/LSI cards. Their phy | ||
2304 | * arbitration state machine may time out during such a long wait. | ||
2305 | */ | 2297 | */ |
2306 | 2298 | ||
2307 | reg_write(ohci, OHCI1394_HCControlSet, | 2299 | reg_write(ohci, OHCI1394_HCControlSet, |
@@ -2309,11 +2301,8 @@ static int ohci_enable(struct fw_card *card, | |||
2309 | OHCI1394_HCControl_postedWriteEnable); | 2301 | OHCI1394_HCControl_postedWriteEnable); |
2310 | flush_writes(ohci); | 2302 | flush_writes(ohci); |
2311 | 2303 | ||
2312 | if (!(ohci->quirks & QUIRK_PHY_LCTRL_TIMEOUT)) | 2304 | for (lps = 0, i = 0; !lps && i < 3; i++) { |
2313 | msleep(50); | 2305 | msleep(50); |
2314 | |||
2315 | for (lps = 0, i = 0; !lps && i < 150; i++) { | ||
2316 | msleep(1); | ||
2317 | lps = reg_read(ohci, OHCI1394_HCControlSet) & | 2306 | lps = reg_read(ohci, OHCI1394_HCControlSet) & |
2318 | OHCI1394_HCControl_LPS; | 2307 | OHCI1394_HCControl_LPS; |
2319 | } | 2308 | } |
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c index 281029daf98c..7aef911fdc71 100644 --- a/drivers/firewire/sbp2.c +++ b/drivers/firewire/sbp2.c | |||
@@ -146,6 +146,7 @@ struct sbp2_logical_unit { | |||
146 | */ | 146 | */ |
147 | int generation; | 147 | int generation; |
148 | int retries; | 148 | int retries; |
149 | work_func_t workfn; | ||
149 | struct delayed_work work; | 150 | struct delayed_work work; |
150 | bool has_sdev; | 151 | bool has_sdev; |
151 | bool blocked; | 152 | bool blocked; |
@@ -864,7 +865,7 @@ static void sbp2_login(struct work_struct *work) | |||
864 | /* set appropriate retry limit(s) in BUSY_TIMEOUT register */ | 865 | /* set appropriate retry limit(s) in BUSY_TIMEOUT register */ |
865 | sbp2_set_busy_timeout(lu); | 866 | sbp2_set_busy_timeout(lu); |
866 | 867 | ||
867 | PREPARE_DELAYED_WORK(&lu->work, sbp2_reconnect); | 868 | lu->workfn = sbp2_reconnect; |
868 | sbp2_agent_reset(lu); | 869 | sbp2_agent_reset(lu); |
869 | 870 | ||
870 | /* This was a re-login. */ | 871 | /* This was a re-login. */ |
@@ -918,7 +919,7 @@ static void sbp2_login(struct work_struct *work) | |||
918 | * If a bus reset happened, sbp2_update will have requeued | 919 | * If a bus reset happened, sbp2_update will have requeued |
919 | * lu->work already. Reset the work from reconnect to login. | 920 | * lu->work already. Reset the work from reconnect to login. |
920 | */ | 921 | */ |
921 | PREPARE_DELAYED_WORK(&lu->work, sbp2_login); | 922 | lu->workfn = sbp2_login; |
922 | } | 923 | } |
923 | 924 | ||
924 | static void sbp2_reconnect(struct work_struct *work) | 925 | static void sbp2_reconnect(struct work_struct *work) |
@@ -952,7 +953,7 @@ static void sbp2_reconnect(struct work_struct *work) | |||
952 | lu->retries++ >= 5) { | 953 | lu->retries++ >= 5) { |
953 | dev_err(tgt_dev(tgt), "failed to reconnect\n"); | 954 | dev_err(tgt_dev(tgt), "failed to reconnect\n"); |
954 | lu->retries = 0; | 955 | lu->retries = 0; |
955 | PREPARE_DELAYED_WORK(&lu->work, sbp2_login); | 956 | lu->workfn = sbp2_login; |
956 | } | 957 | } |
957 | sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5)); | 958 | sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5)); |
958 | 959 | ||
@@ -972,6 +973,13 @@ static void sbp2_reconnect(struct work_struct *work) | |||
972 | sbp2_conditionally_unblock(lu); | 973 | sbp2_conditionally_unblock(lu); |
973 | } | 974 | } |
974 | 975 | ||
976 | static void sbp2_lu_workfn(struct work_struct *work) | ||
977 | { | ||
978 | struct sbp2_logical_unit *lu = container_of(to_delayed_work(work), | ||
979 | struct sbp2_logical_unit, work); | ||
980 | lu->workfn(work); | ||
981 | } | ||
982 | |||
975 | static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry) | 983 | static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry) |
976 | { | 984 | { |
977 | struct sbp2_logical_unit *lu; | 985 | struct sbp2_logical_unit *lu; |
@@ -998,7 +1006,8 @@ static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry) | |||
998 | lu->blocked = false; | 1006 | lu->blocked = false; |
999 | ++tgt->dont_block; | 1007 | ++tgt->dont_block; |
1000 | INIT_LIST_HEAD(&lu->orb_list); | 1008 | INIT_LIST_HEAD(&lu->orb_list); |
1001 | INIT_DELAYED_WORK(&lu->work, sbp2_login); | 1009 | lu->workfn = sbp2_login; |
1010 | INIT_DELAYED_WORK(&lu->work, sbp2_lu_workfn); | ||
1002 | 1011 | ||
1003 | list_add_tail(&lu->link, &tgt->lu_list); | 1012 | list_add_tail(&lu->link, &tgt->lu_list); |
1004 | return 0; | 1013 | return 0; |
diff --git a/drivers/fmc/fmc-write-eeprom.c b/drivers/fmc/fmc-write-eeprom.c index ee5b47904130..9bb2cbd5c9f2 100644 --- a/drivers/fmc/fmc-write-eeprom.c +++ b/drivers/fmc/fmc-write-eeprom.c | |||
@@ -27,7 +27,7 @@ FMC_PARAM_BUSID(fwe_drv); | |||
27 | /* The "file=" is like the generic "gateware=" used elsewhere */ | 27 | /* The "file=" is like the generic "gateware=" used elsewhere */ |
28 | static char *fwe_file[FMC_MAX_CARDS]; | 28 | static char *fwe_file[FMC_MAX_CARDS]; |
29 | static int fwe_file_n; | 29 | static int fwe_file_n; |
30 | module_param_array_named(file, fwe_file, charp, &fwe_file_n, 444); | 30 | module_param_array_named(file, fwe_file, charp, &fwe_file_n, 0444); |
31 | 31 | ||
32 | static int fwe_run_tlv(struct fmc_device *fmc, const struct firmware *fw, | 32 | static int fwe_run_tlv(struct fmc_device *fmc, const struct firmware *fw, |
33 | int write) | 33 | int write) |
diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c index acf3a36c9ebc..32982da82694 100644 --- a/drivers/gpu/drm/armada/armada_drv.c +++ b/drivers/gpu/drm/armada/armada_drv.c | |||
@@ -68,15 +68,7 @@ void __armada_drm_queue_unref_work(struct drm_device *dev, | |||
68 | { | 68 | { |
69 | struct armada_private *priv = dev->dev_private; | 69 | struct armada_private *priv = dev->dev_private; |
70 | 70 | ||
71 | /* | 71 | WARN_ON(!kfifo_put(&priv->fb_unref, fb)); |
72 | * Yes, we really must jump through these hoops just to store a | ||
73 | * _pointer_ to something into the kfifo. This is utterly insane | ||
74 | * and idiotic, because it kfifo requires the _data_ pointed to by | ||
75 | * the pointer const, not the pointer itself. Not only that, but | ||
76 | * you have to pass a pointer _to_ the pointer you want stored. | ||
77 | */ | ||
78 | const struct drm_framebuffer *silly_api_alert = fb; | ||
79 | WARN_ON(!kfifo_put(&priv->fb_unref, &silly_api_alert)); | ||
80 | schedule_work(&priv->fb_unref_work); | 72 | schedule_work(&priv->fb_unref_work); |
81 | } | 73 | } |
82 | 74 | ||
diff --git a/drivers/gpu/drm/bochs/Kconfig b/drivers/gpu/drm/bochs/Kconfig index c8fcf12019f0..5f8b0c2b9a44 100644 --- a/drivers/gpu/drm/bochs/Kconfig +++ b/drivers/gpu/drm/bochs/Kconfig | |||
@@ -2,6 +2,7 @@ config DRM_BOCHS | |||
2 | tristate "DRM Support for bochs dispi vga interface (qemu stdvga)" | 2 | tristate "DRM Support for bochs dispi vga interface (qemu stdvga)" |
3 | depends on DRM && PCI | 3 | depends on DRM && PCI |
4 | select DRM_KMS_HELPER | 4 | select DRM_KMS_HELPER |
5 | select DRM_KMS_FB_HELPER | ||
5 | select FB_SYS_FILLRECT | 6 | select FB_SYS_FILLRECT |
6 | select FB_SYS_COPYAREA | 7 | select FB_SYS_COPYAREA |
7 | select FB_SYS_IMAGEBLIT | 8 | select FB_SYS_IMAGEBLIT |
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index dffc836144cc..f4dc9b7a3831 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c | |||
@@ -296,6 +296,18 @@ int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
296 | case DRM_CAP_ASYNC_PAGE_FLIP: | 296 | case DRM_CAP_ASYNC_PAGE_FLIP: |
297 | req->value = dev->mode_config.async_page_flip; | 297 | req->value = dev->mode_config.async_page_flip; |
298 | break; | 298 | break; |
299 | case DRM_CAP_CURSOR_WIDTH: | ||
300 | if (dev->mode_config.cursor_width) | ||
301 | req->value = dev->mode_config.cursor_width; | ||
302 | else | ||
303 | req->value = 64; | ||
304 | break; | ||
305 | case DRM_CAP_CURSOR_HEIGHT: | ||
306 | if (dev->mode_config.cursor_height) | ||
307 | req->value = dev->mode_config.cursor_height; | ||
308 | else | ||
309 | req->value = 64; | ||
310 | break; | ||
299 | default: | 311 | default: |
300 | return -EINVAL; | 312 | return -EINVAL; |
301 | } | 313 | } |
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index fa18cf374470..faa77f543a07 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c | |||
@@ -1151,8 +1151,10 @@ tda998x_encoder_init(struct i2c_client *client, | |||
1151 | 1151 | ||
1152 | priv->current_page = 0xff; | 1152 | priv->current_page = 0xff; |
1153 | priv->cec = i2c_new_dummy(client->adapter, 0x34); | 1153 | priv->cec = i2c_new_dummy(client->adapter, 0x34); |
1154 | if (!priv->cec) | 1154 | if (!priv->cec) { |
1155 | kfree(priv); | ||
1155 | return -ENODEV; | 1156 | return -ENODEV; |
1157 | } | ||
1156 | priv->dpms = DRM_MODE_DPMS_OFF; | 1158 | priv->dpms = DRM_MODE_DPMS_OFF; |
1157 | 1159 | ||
1158 | encoder_slave->slave_priv = priv; | 1160 | encoder_slave->slave_priv = priv; |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 04f1f02c4019..ec7bb0fc71bc 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -403,7 +403,7 @@ MODULE_DEVICE_TABLE(pci, pciidlist); | |||
403 | void intel_detect_pch(struct drm_device *dev) | 403 | void intel_detect_pch(struct drm_device *dev) |
404 | { | 404 | { |
405 | struct drm_i915_private *dev_priv = dev->dev_private; | 405 | struct drm_i915_private *dev_priv = dev->dev_private; |
406 | struct pci_dev *pch; | 406 | struct pci_dev *pch = NULL; |
407 | 407 | ||
408 | /* In all current cases, num_pipes is equivalent to the PCH_NOP setting | 408 | /* In all current cases, num_pipes is equivalent to the PCH_NOP setting |
409 | * (which really amounts to a PCH but no South Display). | 409 | * (which really amounts to a PCH but no South Display). |
@@ -424,12 +424,9 @@ void intel_detect_pch(struct drm_device *dev) | |||
424 | * all the ISA bridge devices and check for the first match, instead | 424 | * all the ISA bridge devices and check for the first match, instead |
425 | * of only checking the first one. | 425 | * of only checking the first one. |
426 | */ | 426 | */ |
427 | pch = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL); | 427 | while ((pch = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, pch))) { |
428 | while (pch) { | ||
429 | struct pci_dev *curr = pch; | ||
430 | if (pch->vendor == PCI_VENDOR_ID_INTEL) { | 428 | if (pch->vendor == PCI_VENDOR_ID_INTEL) { |
431 | unsigned short id; | 429 | unsigned short id = pch->device & INTEL_PCH_DEVICE_ID_MASK; |
432 | id = pch->device & INTEL_PCH_DEVICE_ID_MASK; | ||
433 | dev_priv->pch_id = id; | 430 | dev_priv->pch_id = id; |
434 | 431 | ||
435 | if (id == INTEL_PCH_IBX_DEVICE_ID_TYPE) { | 432 | if (id == INTEL_PCH_IBX_DEVICE_ID_TYPE) { |
@@ -461,18 +458,16 @@ void intel_detect_pch(struct drm_device *dev) | |||
461 | DRM_DEBUG_KMS("Found LynxPoint LP PCH\n"); | 458 | DRM_DEBUG_KMS("Found LynxPoint LP PCH\n"); |
462 | WARN_ON(!IS_HASWELL(dev)); | 459 | WARN_ON(!IS_HASWELL(dev)); |
463 | WARN_ON(!IS_ULT(dev)); | 460 | WARN_ON(!IS_ULT(dev)); |
464 | } else { | 461 | } else |
465 | goto check_next; | 462 | continue; |
466 | } | 463 | |
467 | pci_dev_put(pch); | ||
468 | break; | 464 | break; |
469 | } | 465 | } |
470 | check_next: | ||
471 | pch = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, curr); | ||
472 | pci_dev_put(curr); | ||
473 | } | 466 | } |
474 | if (!pch) | 467 | if (!pch) |
475 | DRM_DEBUG_KMS("No PCH found?\n"); | 468 | DRM_DEBUG_KMS("No PCH found.\n"); |
469 | |||
470 | pci_dev_put(pch); | ||
476 | } | 471 | } |
477 | 472 | ||
478 | bool i915_semaphore_is_enabled(struct drm_device *dev) | 473 | bool i915_semaphore_is_enabled(struct drm_device *dev) |
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index 1a24e84f2315..d58b4e287e32 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c | |||
@@ -82,9 +82,22 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev) | |||
82 | r = devm_request_mem_region(dev->dev, base, dev_priv->gtt.stolen_size, | 82 | r = devm_request_mem_region(dev->dev, base, dev_priv->gtt.stolen_size, |
83 | "Graphics Stolen Memory"); | 83 | "Graphics Stolen Memory"); |
84 | if (r == NULL) { | 84 | if (r == NULL) { |
85 | DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n", | 85 | /* |
86 | base, base + (uint32_t)dev_priv->gtt.stolen_size); | 86 | * One more attempt but this time requesting region from |
87 | base = 0; | 87 | * base + 1, as we have seen that this resolves the region |
88 | * conflict with the PCI Bus. | ||
89 | * This is a BIOS w/a: Some BIOS wrap stolen in the root | ||
90 | * PCI bus, but have an off-by-one error. Hence retry the | ||
91 | * reservation starting from 1 instead of 0. | ||
92 | */ | ||
93 | r = devm_request_mem_region(dev->dev, base + 1, | ||
94 | dev_priv->gtt.stolen_size - 1, | ||
95 | "Graphics Stolen Memory"); | ||
96 | if (r == NULL) { | ||
97 | DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n", | ||
98 | base, base + (uint32_t)dev_priv->gtt.stolen_size); | ||
99 | base = 0; | ||
100 | } | ||
88 | } | 101 | } |
89 | 102 | ||
90 | return base; | 103 | return base; |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 9fa24347963a..9b8a7c7ea7fc 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -1092,12 +1092,12 @@ static void assert_cursor(struct drm_i915_private *dev_priv, | |||
1092 | struct drm_device *dev = dev_priv->dev; | 1092 | struct drm_device *dev = dev_priv->dev; |
1093 | bool cur_state; | 1093 | bool cur_state; |
1094 | 1094 | ||
1095 | if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) | 1095 | if (IS_845G(dev) || IS_I865G(dev)) |
1096 | cur_state = I915_READ(CURCNTR_IVB(pipe)) & CURSOR_MODE; | ||
1097 | else if (IS_845G(dev) || IS_I865G(dev)) | ||
1098 | cur_state = I915_READ(_CURACNTR) & CURSOR_ENABLE; | 1096 | cur_state = I915_READ(_CURACNTR) & CURSOR_ENABLE; |
1099 | else | 1097 | else if (INTEL_INFO(dev)->gen <= 6 || IS_VALLEYVIEW(dev)) |
1100 | cur_state = I915_READ(CURCNTR(pipe)) & CURSOR_MODE; | 1098 | cur_state = I915_READ(CURCNTR(pipe)) & CURSOR_MODE; |
1099 | else | ||
1100 | cur_state = I915_READ(CURCNTR_IVB(pipe)) & CURSOR_MODE; | ||
1101 | 1101 | ||
1102 | WARN(cur_state != state, | 1102 | WARN(cur_state != state, |
1103 | "cursor on pipe %c assertion failure (expected %s, current %s)\n", | 1103 | "cursor on pipe %c assertion failure (expected %s, current %s)\n", |
@@ -8586,6 +8586,20 @@ static int intel_gen7_queue_flip(struct drm_device *dev, | |||
8586 | if (ring->id == RCS) | 8586 | if (ring->id == RCS) |
8587 | len += 6; | 8587 | len += 6; |
8588 | 8588 | ||
8589 | /* | ||
8590 | * BSpec MI_DISPLAY_FLIP for IVB: | ||
8591 | * "The full packet must be contained within the same cache line." | ||
8592 | * | ||
8593 | * Currently the LRI+SRM+MI_DISPLAY_FLIP all fit within the same | ||
8594 | * cacheline, if we ever start emitting more commands before | ||
8595 | * the MI_DISPLAY_FLIP we may need to first emit everything else, | ||
8596 | * then do the cacheline alignment, and finally emit the | ||
8597 | * MI_DISPLAY_FLIP. | ||
8598 | */ | ||
8599 | ret = intel_ring_cacheline_align(ring); | ||
8600 | if (ret) | ||
8601 | goto err_unpin; | ||
8602 | |||
8589 | ret = intel_ring_begin(ring, len); | 8603 | ret = intel_ring_begin(ring, len); |
8590 | if (ret) | 8604 | if (ret) |
8591 | goto err_unpin; | 8605 | goto err_unpin; |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 2f517b85b3f4..57552eb386b0 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -537,6 +537,7 @@ intel_dp_aux_native_write(struct intel_dp *intel_dp, | |||
537 | uint8_t msg[20]; | 537 | uint8_t msg[20]; |
538 | int msg_bytes; | 538 | int msg_bytes; |
539 | uint8_t ack; | 539 | uint8_t ack; |
540 | int retry; | ||
540 | 541 | ||
541 | if (WARN_ON(send_bytes > 16)) | 542 | if (WARN_ON(send_bytes > 16)) |
542 | return -E2BIG; | 543 | return -E2BIG; |
@@ -548,19 +549,21 @@ intel_dp_aux_native_write(struct intel_dp *intel_dp, | |||
548 | msg[3] = send_bytes - 1; | 549 | msg[3] = send_bytes - 1; |
549 | memcpy(&msg[4], send, send_bytes); | 550 | memcpy(&msg[4], send, send_bytes); |
550 | msg_bytes = send_bytes + 4; | 551 | msg_bytes = send_bytes + 4; |
551 | for (;;) { | 552 | for (retry = 0; retry < 7; retry++) { |
552 | ret = intel_dp_aux_ch(intel_dp, msg, msg_bytes, &ack, 1); | 553 | ret = intel_dp_aux_ch(intel_dp, msg, msg_bytes, &ack, 1); |
553 | if (ret < 0) | 554 | if (ret < 0) |
554 | return ret; | 555 | return ret; |
555 | ack >>= 4; | 556 | ack >>= 4; |
556 | if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_ACK) | 557 | if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_ACK) |
557 | break; | 558 | return send_bytes; |
558 | else if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_DEFER) | 559 | else if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_DEFER) |
559 | udelay(100); | 560 | usleep_range(400, 500); |
560 | else | 561 | else |
561 | return -EIO; | 562 | return -EIO; |
562 | } | 563 | } |
563 | return send_bytes; | 564 | |
565 | DRM_ERROR("too many retries, giving up\n"); | ||
566 | return -EIO; | ||
564 | } | 567 | } |
565 | 568 | ||
566 | /* Write a single byte to the aux channel in native mode */ | 569 | /* Write a single byte to the aux channel in native mode */ |
@@ -582,6 +585,7 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp, | |||
582 | int reply_bytes; | 585 | int reply_bytes; |
583 | uint8_t ack; | 586 | uint8_t ack; |
584 | int ret; | 587 | int ret; |
588 | int retry; | ||
585 | 589 | ||
586 | if (WARN_ON(recv_bytes > 19)) | 590 | if (WARN_ON(recv_bytes > 19)) |
587 | return -E2BIG; | 591 | return -E2BIG; |
@@ -595,7 +599,7 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp, | |||
595 | msg_bytes = 4; | 599 | msg_bytes = 4; |
596 | reply_bytes = recv_bytes + 1; | 600 | reply_bytes = recv_bytes + 1; |
597 | 601 | ||
598 | for (;;) { | 602 | for (retry = 0; retry < 7; retry++) { |
599 | ret = intel_dp_aux_ch(intel_dp, msg, msg_bytes, | 603 | ret = intel_dp_aux_ch(intel_dp, msg, msg_bytes, |
600 | reply, reply_bytes); | 604 | reply, reply_bytes); |
601 | if (ret == 0) | 605 | if (ret == 0) |
@@ -608,10 +612,13 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp, | |||
608 | return ret - 1; | 612 | return ret - 1; |
609 | } | 613 | } |
610 | else if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_DEFER) | 614 | else if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_DEFER) |
611 | udelay(100); | 615 | usleep_range(400, 500); |
612 | else | 616 | else |
613 | return -EIO; | 617 | return -EIO; |
614 | } | 618 | } |
619 | |||
620 | DRM_ERROR("too many retries, giving up\n"); | ||
621 | return -EIO; | ||
615 | } | 622 | } |
616 | 623 | ||
617 | static int | 624 | static int |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 6db0d9d17f47..ee3181ebcc92 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -845,7 +845,7 @@ static int hdmi_portclock_limit(struct intel_hdmi *hdmi) | |||
845 | { | 845 | { |
846 | struct drm_device *dev = intel_hdmi_to_dev(hdmi); | 846 | struct drm_device *dev = intel_hdmi_to_dev(hdmi); |
847 | 847 | ||
848 | if (IS_G4X(dev)) | 848 | if (!hdmi->has_hdmi_sink || IS_G4X(dev)) |
849 | return 165000; | 849 | return 165000; |
850 | else if (IS_HASWELL(dev) || INTEL_INFO(dev)->gen >= 8) | 850 | else if (IS_HASWELL(dev) || INTEL_INFO(dev)->gen >= 8) |
851 | return 300000; | 851 | return 300000; |
@@ -899,8 +899,8 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, | |||
899 | * outputs. We also need to check that the higher clock still fits | 899 | * outputs. We also need to check that the higher clock still fits |
900 | * within limits. | 900 | * within limits. |
901 | */ | 901 | */ |
902 | if (pipe_config->pipe_bpp > 8*3 && clock_12bpc <= portclock_limit | 902 | if (pipe_config->pipe_bpp > 8*3 && intel_hdmi->has_hdmi_sink && |
903 | && HAS_PCH_SPLIT(dev)) { | 903 | clock_12bpc <= portclock_limit && HAS_PCH_SPLIT(dev)) { |
904 | DRM_DEBUG_KMS("picking bpc to 12 for HDMI output\n"); | 904 | DRM_DEBUG_KMS("picking bpc to 12 for HDMI output\n"); |
905 | desired_bpp = 12*3; | 905 | desired_bpp = 12*3; |
906 | 906 | ||
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 350de359123a..079ea38f14d9 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -698,7 +698,7 @@ static void i9xx_enable_backlight(struct intel_connector *connector) | |||
698 | freq /= 0xff; | 698 | freq /= 0xff; |
699 | 699 | ||
700 | ctl = freq << 17; | 700 | ctl = freq << 17; |
701 | if (IS_GEN2(dev) && panel->backlight.combination_mode) | 701 | if (panel->backlight.combination_mode) |
702 | ctl |= BLM_LEGACY_MODE; | 702 | ctl |= BLM_LEGACY_MODE; |
703 | if (IS_PINEVIEW(dev) && panel->backlight.active_low_pwm) | 703 | if (IS_PINEVIEW(dev) && panel->backlight.active_low_pwm) |
704 | ctl |= BLM_POLARITY_PNV; | 704 | ctl |= BLM_POLARITY_PNV; |
@@ -979,7 +979,7 @@ static int i9xx_setup_backlight(struct intel_connector *connector) | |||
979 | 979 | ||
980 | ctl = I915_READ(BLC_PWM_CTL); | 980 | ctl = I915_READ(BLC_PWM_CTL); |
981 | 981 | ||
982 | if (IS_GEN2(dev)) | 982 | if (IS_GEN2(dev) || IS_I915GM(dev) || IS_I945GM(dev)) |
983 | panel->backlight.combination_mode = ctl & BLM_LEGACY_MODE; | 983 | panel->backlight.combination_mode = ctl & BLM_LEGACY_MODE; |
984 | 984 | ||
985 | if (IS_PINEVIEW(dev)) | 985 | if (IS_PINEVIEW(dev)) |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index d77cc81900f9..e1fc35a72656 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -3493,6 +3493,8 @@ static void valleyview_setup_pctx(struct drm_device *dev) | |||
3493 | u32 pcbr; | 3493 | u32 pcbr; |
3494 | int pctx_size = 24*1024; | 3494 | int pctx_size = 24*1024; |
3495 | 3495 | ||
3496 | WARN_ON(!mutex_is_locked(&dev->struct_mutex)); | ||
3497 | |||
3496 | pcbr = I915_READ(VLV_PCBR); | 3498 | pcbr = I915_READ(VLV_PCBR); |
3497 | if (pcbr) { | 3499 | if (pcbr) { |
3498 | /* BIOS set it up already, grab the pre-alloc'd space */ | 3500 | /* BIOS set it up already, grab the pre-alloc'd space */ |
@@ -3542,8 +3544,6 @@ static void valleyview_enable_rps(struct drm_device *dev) | |||
3542 | I915_WRITE(GTFIFODBG, gtfifodbg); | 3544 | I915_WRITE(GTFIFODBG, gtfifodbg); |
3543 | } | 3545 | } |
3544 | 3546 | ||
3545 | valleyview_setup_pctx(dev); | ||
3546 | |||
3547 | /* If VLV, Forcewake all wells, else re-direct to regular path */ | 3547 | /* If VLV, Forcewake all wells, else re-direct to regular path */ |
3548 | gen6_gt_force_wake_get(dev_priv, FORCEWAKE_ALL); | 3548 | gen6_gt_force_wake_get(dev_priv, FORCEWAKE_ALL); |
3549 | 3549 | ||
@@ -4395,6 +4395,8 @@ void intel_enable_gt_powersave(struct drm_device *dev) | |||
4395 | ironlake_enable_rc6(dev); | 4395 | ironlake_enable_rc6(dev); |
4396 | intel_init_emon(dev); | 4396 | intel_init_emon(dev); |
4397 | } else if (IS_GEN6(dev) || IS_GEN7(dev)) { | 4397 | } else if (IS_GEN6(dev) || IS_GEN7(dev)) { |
4398 | if (IS_VALLEYVIEW(dev)) | ||
4399 | valleyview_setup_pctx(dev); | ||
4398 | /* | 4400 | /* |
4399 | * PCU communication is slow and this doesn't need to be | 4401 | * PCU communication is slow and this doesn't need to be |
4400 | * done at any specific time, so do this out of our fast path | 4402 | * done at any specific time, so do this out of our fast path |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index b7f1742caf87..31b36c5ac894 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -1653,6 +1653,27 @@ int intel_ring_begin(struct intel_ring_buffer *ring, | |||
1653 | return 0; | 1653 | return 0; |
1654 | } | 1654 | } |
1655 | 1655 | ||
1656 | /* Align the ring tail to a cacheline boundary */ | ||
1657 | int intel_ring_cacheline_align(struct intel_ring_buffer *ring) | ||
1658 | { | ||
1659 | int num_dwords = (64 - (ring->tail & 63)) / sizeof(uint32_t); | ||
1660 | int ret; | ||
1661 | |||
1662 | if (num_dwords == 0) | ||
1663 | return 0; | ||
1664 | |||
1665 | ret = intel_ring_begin(ring, num_dwords); | ||
1666 | if (ret) | ||
1667 | return ret; | ||
1668 | |||
1669 | while (num_dwords--) | ||
1670 | intel_ring_emit(ring, MI_NOOP); | ||
1671 | |||
1672 | intel_ring_advance(ring); | ||
1673 | |||
1674 | return 0; | ||
1675 | } | ||
1676 | |||
1656 | void intel_ring_init_seqno(struct intel_ring_buffer *ring, u32 seqno) | 1677 | void intel_ring_init_seqno(struct intel_ring_buffer *ring, u32 seqno) |
1657 | { | 1678 | { |
1658 | struct drm_i915_private *dev_priv = ring->dev->dev_private; | 1679 | struct drm_i915_private *dev_priv = ring->dev->dev_private; |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index 71a73f4fe252..0b243ce33714 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h | |||
@@ -233,6 +233,7 @@ intel_write_status_page(struct intel_ring_buffer *ring, | |||
233 | void intel_cleanup_ring_buffer(struct intel_ring_buffer *ring); | 233 | void intel_cleanup_ring_buffer(struct intel_ring_buffer *ring); |
234 | 234 | ||
235 | int __must_check intel_ring_begin(struct intel_ring_buffer *ring, int n); | 235 | int __must_check intel_ring_begin(struct intel_ring_buffer *ring, int n); |
236 | int __must_check intel_ring_cacheline_align(struct intel_ring_buffer *ring); | ||
236 | static inline void intel_ring_emit(struct intel_ring_buffer *ring, | 237 | static inline void intel_ring_emit(struct intel_ring_buffer *ring, |
237 | u32 data) | 238 | u32 data) |
238 | { | 239 | { |
diff --git a/drivers/gpu/drm/nouveau/Makefile b/drivers/gpu/drm/nouveau/Makefile index e88145ba1bf5..d310c195bdfe 100644 --- a/drivers/gpu/drm/nouveau/Makefile +++ b/drivers/gpu/drm/nouveau/Makefile | |||
@@ -141,6 +141,7 @@ nouveau-y += core/subdev/mc/base.o | |||
141 | nouveau-y += core/subdev/mc/nv04.o | 141 | nouveau-y += core/subdev/mc/nv04.o |
142 | nouveau-y += core/subdev/mc/nv40.o | 142 | nouveau-y += core/subdev/mc/nv40.o |
143 | nouveau-y += core/subdev/mc/nv44.o | 143 | nouveau-y += core/subdev/mc/nv44.o |
144 | nouveau-y += core/subdev/mc/nv4c.o | ||
144 | nouveau-y += core/subdev/mc/nv50.o | 145 | nouveau-y += core/subdev/mc/nv50.o |
145 | nouveau-y += core/subdev/mc/nv94.o | 146 | nouveau-y += core/subdev/mc/nv94.o |
146 | nouveau-y += core/subdev/mc/nv98.o | 147 | nouveau-y += core/subdev/mc/nv98.o |
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/nv40.c b/drivers/gpu/drm/nouveau/core/engine/device/nv40.c index 1b653dd74a70..08b88591ed60 100644 --- a/drivers/gpu/drm/nouveau/core/engine/device/nv40.c +++ b/drivers/gpu/drm/nouveau/core/engine/device/nv40.c | |||
@@ -311,7 +311,7 @@ nv40_identify(struct nouveau_device *device) | |||
311 | device->oclass[NVDEV_SUBDEV_CLOCK ] = &nv40_clock_oclass; | 311 | device->oclass[NVDEV_SUBDEV_CLOCK ] = &nv40_clock_oclass; |
312 | device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; | 312 | device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; |
313 | device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; | 313 | device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; |
314 | device->oclass[NVDEV_SUBDEV_MC ] = nv44_mc_oclass; | 314 | device->oclass[NVDEV_SUBDEV_MC ] = nv4c_mc_oclass; |
315 | device->oclass[NVDEV_SUBDEV_BUS ] = nv31_bus_oclass; | 315 | device->oclass[NVDEV_SUBDEV_BUS ] = nv31_bus_oclass; |
316 | device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; | 316 | device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; |
317 | device->oclass[NVDEV_SUBDEV_FB ] = nv46_fb_oclass; | 317 | device->oclass[NVDEV_SUBDEV_FB ] = nv46_fb_oclass; |
@@ -334,7 +334,7 @@ nv40_identify(struct nouveau_device *device) | |||
334 | device->oclass[NVDEV_SUBDEV_CLOCK ] = &nv40_clock_oclass; | 334 | device->oclass[NVDEV_SUBDEV_CLOCK ] = &nv40_clock_oclass; |
335 | device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; | 335 | device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; |
336 | device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; | 336 | device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; |
337 | device->oclass[NVDEV_SUBDEV_MC ] = nv44_mc_oclass; | 337 | device->oclass[NVDEV_SUBDEV_MC ] = nv4c_mc_oclass; |
338 | device->oclass[NVDEV_SUBDEV_BUS ] = nv31_bus_oclass; | 338 | device->oclass[NVDEV_SUBDEV_BUS ] = nv31_bus_oclass; |
339 | device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; | 339 | device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; |
340 | device->oclass[NVDEV_SUBDEV_FB ] = nv4e_fb_oclass; | 340 | device->oclass[NVDEV_SUBDEV_FB ] = nv4e_fb_oclass; |
@@ -357,7 +357,7 @@ nv40_identify(struct nouveau_device *device) | |||
357 | device->oclass[NVDEV_SUBDEV_CLOCK ] = &nv40_clock_oclass; | 357 | device->oclass[NVDEV_SUBDEV_CLOCK ] = &nv40_clock_oclass; |
358 | device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; | 358 | device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; |
359 | device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; | 359 | device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; |
360 | device->oclass[NVDEV_SUBDEV_MC ] = nv44_mc_oclass; | 360 | device->oclass[NVDEV_SUBDEV_MC ] = nv4c_mc_oclass; |
361 | device->oclass[NVDEV_SUBDEV_BUS ] = nv31_bus_oclass; | 361 | device->oclass[NVDEV_SUBDEV_BUS ] = nv31_bus_oclass; |
362 | device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; | 362 | device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; |
363 | device->oclass[NVDEV_SUBDEV_FB ] = nv46_fb_oclass; | 363 | device->oclass[NVDEV_SUBDEV_FB ] = nv46_fb_oclass; |
@@ -380,7 +380,7 @@ nv40_identify(struct nouveau_device *device) | |||
380 | device->oclass[NVDEV_SUBDEV_CLOCK ] = &nv40_clock_oclass; | 380 | device->oclass[NVDEV_SUBDEV_CLOCK ] = &nv40_clock_oclass; |
381 | device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; | 381 | device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; |
382 | device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; | 382 | device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; |
383 | device->oclass[NVDEV_SUBDEV_MC ] = nv44_mc_oclass; | 383 | device->oclass[NVDEV_SUBDEV_MC ] = nv4c_mc_oclass; |
384 | device->oclass[NVDEV_SUBDEV_BUS ] = nv31_bus_oclass; | 384 | device->oclass[NVDEV_SUBDEV_BUS ] = nv31_bus_oclass; |
385 | device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; | 385 | device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; |
386 | device->oclass[NVDEV_SUBDEV_FB ] = nv46_fb_oclass; | 386 | device->oclass[NVDEV_SUBDEV_FB ] = nv46_fb_oclass; |
@@ -403,7 +403,7 @@ nv40_identify(struct nouveau_device *device) | |||
403 | device->oclass[NVDEV_SUBDEV_CLOCK ] = &nv40_clock_oclass; | 403 | device->oclass[NVDEV_SUBDEV_CLOCK ] = &nv40_clock_oclass; |
404 | device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; | 404 | device->oclass[NVDEV_SUBDEV_THERM ] = &nv40_therm_oclass; |
405 | device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; | 405 | device->oclass[NVDEV_SUBDEV_DEVINIT] = nv1a_devinit_oclass; |
406 | device->oclass[NVDEV_SUBDEV_MC ] = nv44_mc_oclass; | 406 | device->oclass[NVDEV_SUBDEV_MC ] = nv4c_mc_oclass; |
407 | device->oclass[NVDEV_SUBDEV_BUS ] = nv31_bus_oclass; | 407 | device->oclass[NVDEV_SUBDEV_BUS ] = nv31_bus_oclass; |
408 | device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; | 408 | device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; |
409 | device->oclass[NVDEV_SUBDEV_FB ] = nv46_fb_oclass; | 409 | device->oclass[NVDEV_SUBDEV_FB ] = nv46_fb_oclass; |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c index 940eaa5d8b9a..9ad722e4e087 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c | |||
@@ -1142,7 +1142,7 @@ nv50_disp_intr_unk20_2(struct nv50_disp_priv *priv, int head) | |||
1142 | if (conf != ~0) { | 1142 | if (conf != ~0) { |
1143 | if (outp.location == 0 && outp.type == DCB_OUTPUT_DP) { | 1143 | if (outp.location == 0 && outp.type == DCB_OUTPUT_DP) { |
1144 | u32 soff = (ffs(outp.or) - 1) * 0x08; | 1144 | u32 soff = (ffs(outp.or) - 1) * 0x08; |
1145 | u32 ctrl = nv_rd32(priv, 0x610798 + soff); | 1145 | u32 ctrl = nv_rd32(priv, 0x610794 + soff); |
1146 | u32 datarate; | 1146 | u32 datarate; |
1147 | 1147 | ||
1148 | switch ((ctrl & 0x000f0000) >> 16) { | 1148 | switch ((ctrl & 0x000f0000) >> 16) { |
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c b/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c index 9a850fe19515..54c1b5b471cd 100644 --- a/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c +++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c | |||
@@ -112,7 +112,7 @@ nve0_fifo_runlist_update(struct nve0_fifo_priv *priv, u32 engine) | |||
112 | 112 | ||
113 | nv_wr32(priv, 0x002270, cur->addr >> 12); | 113 | nv_wr32(priv, 0x002270, cur->addr >> 12); |
114 | nv_wr32(priv, 0x002274, (engine << 20) | (p >> 3)); | 114 | nv_wr32(priv, 0x002274, (engine << 20) | (p >> 3)); |
115 | if (!nv_wait(priv, 0x002284 + (engine * 4), 0x00100000, 0x00000000)) | 115 | if (!nv_wait(priv, 0x002284 + (engine * 8), 0x00100000, 0x00000000)) |
116 | nv_error(priv, "runlist %d update timeout\n", engine); | 116 | nv_error(priv, "runlist %d update timeout\n", engine); |
117 | mutex_unlock(&nv_subdev(priv)->mutex); | 117 | mutex_unlock(&nv_subdev(priv)->mutex); |
118 | } | 118 | } |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c b/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c index 30ed19c52e05..7a367c402978 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c +++ b/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c | |||
@@ -539,7 +539,7 @@ nv50_priv_tp_trap(struct nv50_graph_priv *priv, int type, u32 ustatus_old, | |||
539 | ustatus &= ~0x04030000; | 539 | ustatus &= ~0x04030000; |
540 | } | 540 | } |
541 | if (ustatus && display) { | 541 | if (ustatus && display) { |
542 | nv_error("%s - TP%d:", name, i); | 542 | nv_error(priv, "%s - TP%d:", name, i); |
543 | nouveau_bitfield_print(nv50_mpc_traps, ustatus); | 543 | nouveau_bitfield_print(nv50_mpc_traps, ustatus); |
544 | pr_cont("\n"); | 544 | pr_cont("\n"); |
545 | ustatus = 0; | 545 | ustatus = 0; |
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/mc.h b/drivers/gpu/drm/nouveau/core/include/subdev/mc.h index adc88b73d911..3c6738edd127 100644 --- a/drivers/gpu/drm/nouveau/core/include/subdev/mc.h +++ b/drivers/gpu/drm/nouveau/core/include/subdev/mc.h | |||
@@ -47,6 +47,7 @@ struct nouveau_mc_oclass { | |||
47 | extern struct nouveau_oclass *nv04_mc_oclass; | 47 | extern struct nouveau_oclass *nv04_mc_oclass; |
48 | extern struct nouveau_oclass *nv40_mc_oclass; | 48 | extern struct nouveau_oclass *nv40_mc_oclass; |
49 | extern struct nouveau_oclass *nv44_mc_oclass; | 49 | extern struct nouveau_oclass *nv44_mc_oclass; |
50 | extern struct nouveau_oclass *nv4c_mc_oclass; | ||
50 | extern struct nouveau_oclass *nv50_mc_oclass; | 51 | extern struct nouveau_oclass *nv50_mc_oclass; |
51 | extern struct nouveau_oclass *nv94_mc_oclass; | 52 | extern struct nouveau_oclass *nv94_mc_oclass; |
52 | extern struct nouveau_oclass *nv98_mc_oclass; | 53 | extern struct nouveau_oclass *nv98_mc_oclass; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c index aa0fbbec7f08..ef0c9c4a8cc3 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c | |||
@@ -130,6 +130,10 @@ nouveau_bios_shadow_prom(struct nouveau_bios *bios) | |||
130 | u16 pcir; | 130 | u16 pcir; |
131 | int i; | 131 | int i; |
132 | 132 | ||
133 | /* there is no prom on nv4x IGP's */ | ||
134 | if (device->card_type == NV_40 && device->chipset >= 0x4c) | ||
135 | return; | ||
136 | |||
133 | /* enable access to rom */ | 137 | /* enable access to rom */ |
134 | if (device->card_type >= NV_50) | 138 | if (device->card_type >= NV_50) |
135 | pcireg = 0x088050; | 139 | pcireg = 0x088050; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c index 9159a5ccee93..265d1253624a 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv1a.c | |||
@@ -36,7 +36,7 @@ nv1a_fb_oclass = &(struct nv04_fb_impl) { | |||
36 | .fini = _nouveau_fb_fini, | 36 | .fini = _nouveau_fb_fini, |
37 | }, | 37 | }, |
38 | .base.memtype = nv04_fb_memtype_valid, | 38 | .base.memtype = nv04_fb_memtype_valid, |
39 | .base.ram = &nv10_ram_oclass, | 39 | .base.ram = &nv1a_ram_oclass, |
40 | .tile.regions = 8, | 40 | .tile.regions = 8, |
41 | .tile.init = nv10_fb_tile_init, | 41 | .tile.init = nv10_fb_tile_init, |
42 | .tile.fini = nv10_fb_tile_fini, | 42 | .tile.fini = nv10_fb_tile_fini, |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/mc/nv04.h b/drivers/gpu/drm/nouveau/core/subdev/mc/nv04.h index b0d5c31606c1..81a408e7d034 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/mc/nv04.h +++ b/drivers/gpu/drm/nouveau/core/subdev/mc/nv04.h | |||
@@ -14,6 +14,7 @@ int nv04_mc_ctor(struct nouveau_object *, struct nouveau_object *, | |||
14 | extern const struct nouveau_mc_intr nv04_mc_intr[]; | 14 | extern const struct nouveau_mc_intr nv04_mc_intr[]; |
15 | int nv04_mc_init(struct nouveau_object *); | 15 | int nv04_mc_init(struct nouveau_object *); |
16 | void nv40_mc_msi_rearm(struct nouveau_mc *); | 16 | void nv40_mc_msi_rearm(struct nouveau_mc *); |
17 | int nv44_mc_init(struct nouveau_object *object); | ||
17 | int nv50_mc_init(struct nouveau_object *); | 18 | int nv50_mc_init(struct nouveau_object *); |
18 | extern const struct nouveau_mc_intr nv50_mc_intr[]; | 19 | extern const struct nouveau_mc_intr nv50_mc_intr[]; |
19 | extern const struct nouveau_mc_intr nvc0_mc_intr[]; | 20 | extern const struct nouveau_mc_intr nvc0_mc_intr[]; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/mc/nv44.c b/drivers/gpu/drm/nouveau/core/subdev/mc/nv44.c index 3bfee5c6c4f2..cc4d0d2d886e 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/mc/nv44.c +++ b/drivers/gpu/drm/nouveau/core/subdev/mc/nv44.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | #include "nv04.h" | 25 | #include "nv04.h" |
26 | 26 | ||
27 | static int | 27 | int |
28 | nv44_mc_init(struct nouveau_object *object) | 28 | nv44_mc_init(struct nouveau_object *object) |
29 | { | 29 | { |
30 | struct nv04_mc_priv *priv = (void *)object; | 30 | struct nv04_mc_priv *priv = (void *)object; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/mc/nv4c.c b/drivers/gpu/drm/nouveau/core/subdev/mc/nv4c.c new file mode 100644 index 000000000000..a75c35ccf25c --- /dev/null +++ b/drivers/gpu/drm/nouveau/core/subdev/mc/nv4c.c | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | * Copyright 2014 Ilia Mirkin | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | * Authors: Ilia Mirkin | ||
23 | */ | ||
24 | |||
25 | #include "nv04.h" | ||
26 | |||
27 | static void | ||
28 | nv4c_mc_msi_rearm(struct nouveau_mc *pmc) | ||
29 | { | ||
30 | struct nv04_mc_priv *priv = (void *)pmc; | ||
31 | nv_wr08(priv, 0x088050, 0xff); | ||
32 | } | ||
33 | |||
34 | struct nouveau_oclass * | ||
35 | nv4c_mc_oclass = &(struct nouveau_mc_oclass) { | ||
36 | .base.handle = NV_SUBDEV(MC, 0x4c), | ||
37 | .base.ofuncs = &(struct nouveau_ofuncs) { | ||
38 | .ctor = nv04_mc_ctor, | ||
39 | .dtor = _nouveau_mc_dtor, | ||
40 | .init = nv44_mc_init, | ||
41 | .fini = _nouveau_mc_fini, | ||
42 | }, | ||
43 | .intr = nv04_mc_intr, | ||
44 | .msi_rearm = nv4c_mc_msi_rearm, | ||
45 | }.base; | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c index 4ef83df2b246..83face3f608f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c | |||
@@ -106,6 +106,29 @@ static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t * | |||
106 | return 0; | 106 | return 0; |
107 | } | 107 | } |
108 | 108 | ||
109 | /* | ||
110 | * On some platforms, _DSM(nouveau_op_dsm_muid, func0) has special | ||
111 | * requirements on the fourth parameter, so a private implementation | ||
112 | * instead of using acpi_check_dsm(). | ||
113 | */ | ||
114 | static int nouveau_check_optimus_dsm(acpi_handle handle) | ||
115 | { | ||
116 | int result; | ||
117 | |||
118 | /* | ||
119 | * Function 0 returns a Buffer containing available functions. | ||
120 | * The args parameter is ignored for function 0, so just put 0 in it | ||
121 | */ | ||
122 | if (nouveau_optimus_dsm(handle, 0, 0, &result)) | ||
123 | return 0; | ||
124 | |||
125 | /* | ||
126 | * ACPI Spec v4 9.14.1: if bit 0 is zero, no function is supported. | ||
127 | * If the n-th bit is enabled, function n is supported | ||
128 | */ | ||
129 | return result & 1 && result & (1 << NOUVEAU_DSM_OPTIMUS_CAPS); | ||
130 | } | ||
131 | |||
109 | static int nouveau_dsm(acpi_handle handle, int func, int arg) | 132 | static int nouveau_dsm(acpi_handle handle, int func, int arg) |
110 | { | 133 | { |
111 | int ret = 0; | 134 | int ret = 0; |
@@ -207,8 +230,7 @@ static int nouveau_dsm_pci_probe(struct pci_dev *pdev) | |||
207 | 1 << NOUVEAU_DSM_POWER)) | 230 | 1 << NOUVEAU_DSM_POWER)) |
208 | retval |= NOUVEAU_DSM_HAS_MUX; | 231 | retval |= NOUVEAU_DSM_HAS_MUX; |
209 | 232 | ||
210 | if (acpi_check_dsm(dhandle, nouveau_op_dsm_muid, 0x00000100, | 233 | if (nouveau_check_optimus_dsm(dhandle)) |
211 | 1 << NOUVEAU_DSM_OPTIMUS_CAPS)) | ||
212 | retval |= NOUVEAU_DSM_HAS_OPT; | 234 | retval |= NOUVEAU_DSM_HAS_OPT; |
213 | 235 | ||
214 | if (retval & NOUVEAU_DSM_HAS_OPT) { | 236 | if (retval & NOUVEAU_DSM_HAS_OPT) { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 488686d490c0..4aed1714b9ab 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
@@ -1249,7 +1249,7 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem) | |||
1249 | mem->bus.is_iomem = !dev->agp->cant_use_aperture; | 1249 | mem->bus.is_iomem = !dev->agp->cant_use_aperture; |
1250 | } | 1250 | } |
1251 | #endif | 1251 | #endif |
1252 | if (!node->memtype) | 1252 | if (nv_device(drm->device)->card_type < NV_50 || !node->memtype) |
1253 | /* untiled */ | 1253 | /* untiled */ |
1254 | break; | 1254 | break; |
1255 | /* fallthrough, tiled memory */ | 1255 | /* fallthrough, tiled memory */ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 78c8e7146d56..89c484d8ac26 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
@@ -376,6 +376,8 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags) | |||
376 | if (ret) | 376 | if (ret) |
377 | goto fail_device; | 377 | goto fail_device; |
378 | 378 | ||
379 | dev->irq_enabled = true; | ||
380 | |||
379 | /* workaround an odd issue on nvc1 by disabling the device's | 381 | /* workaround an odd issue on nvc1 by disabling the device's |
380 | * nosnoop capability. hopefully won't cause issues until a | 382 | * nosnoop capability. hopefully won't cause issues until a |
381 | * better fix is found - assuming there is one... | 383 | * better fix is found - assuming there is one... |
@@ -475,6 +477,7 @@ nouveau_drm_remove(struct pci_dev *pdev) | |||
475 | struct nouveau_drm *drm = nouveau_drm(dev); | 477 | struct nouveau_drm *drm = nouveau_drm(dev); |
476 | struct nouveau_object *device; | 478 | struct nouveau_object *device; |
477 | 479 | ||
480 | dev->irq_enabled = false; | ||
478 | device = drm->client.base.device; | 481 | device = drm->client.base.device; |
479 | drm_put_dev(dev); | 482 | drm_put_dev(dev); |
480 | 483 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_vga.c b/drivers/gpu/drm/nouveau/nouveau_vga.c index 81638d7f2eff..471347edc27e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_vga.c +++ b/drivers/gpu/drm/nouveau/nouveau_vga.c | |||
@@ -14,7 +14,9 @@ nouveau_vga_set_decode(void *priv, bool state) | |||
14 | { | 14 | { |
15 | struct nouveau_device *device = nouveau_dev(priv); | 15 | struct nouveau_device *device = nouveau_dev(priv); |
16 | 16 | ||
17 | if (device->chipset >= 0x40) | 17 | if (device->card_type == NV_40 && device->chipset >= 0x4c) |
18 | nv_wr32(device, 0x088060, state); | ||
19 | else if (device->chipset >= 0x40) | ||
18 | nv_wr32(device, 0x088054, state); | 20 | nv_wr32(device, 0x088054, state); |
19 | else | 21 | else |
20 | nv_wr32(device, 0x001854, state); | 22 | nv_wr32(device, 0x001854, state); |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index a9338c85630f..daa4dd375ab1 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -559,7 +559,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
559 | u32 adjusted_clock = mode->clock; | 559 | u32 adjusted_clock = mode->clock; |
560 | int encoder_mode = atombios_get_encoder_mode(encoder); | 560 | int encoder_mode = atombios_get_encoder_mode(encoder); |
561 | u32 dp_clock = mode->clock; | 561 | u32 dp_clock = mode->clock; |
562 | int bpc = radeon_get_monitor_bpc(connector); | 562 | int bpc = radeon_crtc->bpc; |
563 | bool is_duallink = radeon_dig_monitor_is_duallink(encoder, mode->clock); | 563 | bool is_duallink = radeon_dig_monitor_is_duallink(encoder, mode->clock); |
564 | 564 | ||
565 | /* reset the pll flags */ | 565 | /* reset the pll flags */ |
@@ -1176,7 +1176,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
1176 | evergreen_tiling_fields(tiling_flags, &bankw, &bankh, &mtaspect, &tile_split); | 1176 | evergreen_tiling_fields(tiling_flags, &bankw, &bankh, &mtaspect, &tile_split); |
1177 | 1177 | ||
1178 | /* Set NUM_BANKS. */ | 1178 | /* Set NUM_BANKS. */ |
1179 | if (rdev->family >= CHIP_BONAIRE) { | 1179 | if (rdev->family >= CHIP_TAHITI) { |
1180 | unsigned tileb, index, num_banks, tile_split_bytes; | 1180 | unsigned tileb, index, num_banks, tile_split_bytes; |
1181 | 1181 | ||
1182 | /* Calculate the macrotile mode index. */ | 1182 | /* Calculate the macrotile mode index. */ |
@@ -1194,13 +1194,14 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
1194 | return -EINVAL; | 1194 | return -EINVAL; |
1195 | } | 1195 | } |
1196 | 1196 | ||
1197 | num_banks = (rdev->config.cik.macrotile_mode_array[index] >> 6) & 0x3; | 1197 | if (rdev->family >= CHIP_BONAIRE) |
1198 | num_banks = (rdev->config.cik.macrotile_mode_array[index] >> 6) & 0x3; | ||
1199 | else | ||
1200 | num_banks = (rdev->config.si.tile_mode_array[index] >> 20) & 0x3; | ||
1198 | fb_format |= EVERGREEN_GRPH_NUM_BANKS(num_banks); | 1201 | fb_format |= EVERGREEN_GRPH_NUM_BANKS(num_banks); |
1199 | } else { | 1202 | } else { |
1200 | /* SI and older. */ | 1203 | /* NI and older. */ |
1201 | if (rdev->family >= CHIP_TAHITI) | 1204 | if (rdev->family >= CHIP_CAYMAN) |
1202 | tmp = rdev->config.si.tile_config; | ||
1203 | else if (rdev->family >= CHIP_CAYMAN) | ||
1204 | tmp = rdev->config.cayman.tile_config; | 1205 | tmp = rdev->config.cayman.tile_config; |
1205 | else | 1206 | else |
1206 | tmp = rdev->config.evergreen.tile_config; | 1207 | tmp = rdev->config.evergreen.tile_config; |
@@ -1773,6 +1774,20 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc) | |||
1773 | return ATOM_PPLL1; | 1774 | return ATOM_PPLL1; |
1774 | DRM_ERROR("unable to allocate a PPLL\n"); | 1775 | DRM_ERROR("unable to allocate a PPLL\n"); |
1775 | return ATOM_PPLL_INVALID; | 1776 | return ATOM_PPLL_INVALID; |
1777 | } else if (ASIC_IS_DCE41(rdev)) { | ||
1778 | /* Don't share PLLs on DCE4.1 chips */ | ||
1779 | if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(radeon_crtc->encoder))) { | ||
1780 | if (rdev->clock.dp_extclk) | ||
1781 | /* skip PPLL programming if using ext clock */ | ||
1782 | return ATOM_PPLL_INVALID; | ||
1783 | } | ||
1784 | pll_in_use = radeon_get_pll_use_mask(crtc); | ||
1785 | if (!(pll_in_use & (1 << ATOM_PPLL1))) | ||
1786 | return ATOM_PPLL1; | ||
1787 | if (!(pll_in_use & (1 << ATOM_PPLL2))) | ||
1788 | return ATOM_PPLL2; | ||
1789 | DRM_ERROR("unable to allocate a PPLL\n"); | ||
1790 | return ATOM_PPLL_INVALID; | ||
1776 | } else if (ASIC_IS_DCE4(rdev)) { | 1791 | } else if (ASIC_IS_DCE4(rdev)) { |
1777 | /* in DP mode, the DP ref clock can come from PPLL, DCPLL, or ext clock, | 1792 | /* in DP mode, the DP ref clock can come from PPLL, DCPLL, or ext clock, |
1778 | * depending on the asic: | 1793 | * depending on the asic: |
@@ -1800,7 +1815,7 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc) | |||
1800 | if (pll != ATOM_PPLL_INVALID) | 1815 | if (pll != ATOM_PPLL_INVALID) |
1801 | return pll; | 1816 | return pll; |
1802 | } | 1817 | } |
1803 | } else if (!ASIC_IS_DCE41(rdev)) { /* Don't share PLLs on DCE4.1 chips */ | 1818 | } else { |
1804 | /* use the same PPLL for all monitors with the same clock */ | 1819 | /* use the same PPLL for all monitors with the same clock */ |
1805 | pll = radeon_get_shared_nondp_ppll(crtc); | 1820 | pll = radeon_get_shared_nondp_ppll(crtc); |
1806 | if (pll != ATOM_PPLL_INVALID) | 1821 | if (pll != ATOM_PPLL_INVALID) |
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c index a42d61571f49..607dc14d195e 100644 --- a/drivers/gpu/drm/radeon/atombios_encoders.c +++ b/drivers/gpu/drm/radeon/atombios_encoders.c | |||
@@ -464,11 +464,12 @@ atombios_tv_setup(struct drm_encoder *encoder, int action) | |||
464 | 464 | ||
465 | static u8 radeon_atom_get_bpc(struct drm_encoder *encoder) | 465 | static u8 radeon_atom_get_bpc(struct drm_encoder *encoder) |
466 | { | 466 | { |
467 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); | ||
468 | int bpc = 8; | 467 | int bpc = 8; |
469 | 468 | ||
470 | if (connector) | 469 | if (encoder->crtc) { |
471 | bpc = radeon_get_monitor_bpc(connector); | 470 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); |
471 | bpc = radeon_crtc->bpc; | ||
472 | } | ||
472 | 473 | ||
473 | switch (bpc) { | 474 | switch (bpc) { |
474 | case 0: | 475 | case 0: |
@@ -1313,7 +1314,7 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t | |||
1313 | } | 1314 | } |
1314 | if (is_dp) | 1315 | if (is_dp) |
1315 | args.v5.ucLaneNum = dp_lane_count; | 1316 | args.v5.ucLaneNum = dp_lane_count; |
1316 | else if (radeon_encoder->pixel_clock > 165000) | 1317 | else if (radeon_dig_monitor_is_duallink(encoder, radeon_encoder->pixel_clock)) |
1317 | args.v5.ucLaneNum = 8; | 1318 | args.v5.ucLaneNum = 8; |
1318 | else | 1319 | else |
1319 | args.v5.ucLaneNum = 4; | 1320 | args.v5.ucLaneNum = 4; |
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index e6419ca7cd37..e22be8458d92 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -3046,7 +3046,7 @@ static u32 cik_create_bitmask(u32 bit_width) | |||
3046 | } | 3046 | } |
3047 | 3047 | ||
3048 | /** | 3048 | /** |
3049 | * cik_select_se_sh - select which SE, SH to address | 3049 | * cik_get_rb_disabled - computes the mask of disabled RBs |
3050 | * | 3050 | * |
3051 | * @rdev: radeon_device pointer | 3051 | * @rdev: radeon_device pointer |
3052 | * @max_rb_num: max RBs (render backends) for the asic | 3052 | * @max_rb_num: max RBs (render backends) for the asic |
@@ -7902,7 +7902,8 @@ int cik_resume(struct radeon_device *rdev) | |||
7902 | /* init golden registers */ | 7902 | /* init golden registers */ |
7903 | cik_init_golden_registers(rdev); | 7903 | cik_init_golden_registers(rdev); |
7904 | 7904 | ||
7905 | radeon_pm_resume(rdev); | 7905 | if (rdev->pm.pm_method == PM_METHOD_DPM) |
7906 | radeon_pm_resume(rdev); | ||
7906 | 7907 | ||
7907 | rdev->accel_working = true; | 7908 | rdev->accel_working = true; |
7908 | r = cik_startup(rdev); | 7909 | r = cik_startup(rdev); |
diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c b/drivers/gpu/drm/radeon/dce6_afmt.c index 713a5d359901..94e858751994 100644 --- a/drivers/gpu/drm/radeon/dce6_afmt.c +++ b/drivers/gpu/drm/radeon/dce6_afmt.c | |||
@@ -278,13 +278,15 @@ static int dce6_audio_chipset_supported(struct radeon_device *rdev) | |||
278 | return !ASIC_IS_NODCE(rdev); | 278 | return !ASIC_IS_NODCE(rdev); |
279 | } | 279 | } |
280 | 280 | ||
281 | static void dce6_audio_enable(struct radeon_device *rdev, | 281 | void dce6_audio_enable(struct radeon_device *rdev, |
282 | struct r600_audio_pin *pin, | 282 | struct r600_audio_pin *pin, |
283 | bool enable) | 283 | bool enable) |
284 | { | 284 | { |
285 | if (!pin) | ||
286 | return; | ||
287 | |||
285 | WREG32_ENDPOINT(pin->offset, AZ_F0_CODEC_PIN_CONTROL_HOTPLUG_CONTROL, | 288 | WREG32_ENDPOINT(pin->offset, AZ_F0_CODEC_PIN_CONTROL_HOTPLUG_CONTROL, |
286 | AUDIO_ENABLED); | 289 | enable ? AUDIO_ENABLED : 0); |
287 | DRM_INFO("%s audio %d support\n", enable ? "Enabling" : "Disabling", pin->id); | ||
288 | } | 290 | } |
289 | 291 | ||
290 | static const u32 pin_offsets[7] = | 292 | static const u32 pin_offsets[7] = |
@@ -323,7 +325,8 @@ int dce6_audio_init(struct radeon_device *rdev) | |||
323 | rdev->audio.pin[i].connected = false; | 325 | rdev->audio.pin[i].connected = false; |
324 | rdev->audio.pin[i].offset = pin_offsets[i]; | 326 | rdev->audio.pin[i].offset = pin_offsets[i]; |
325 | rdev->audio.pin[i].id = i; | 327 | rdev->audio.pin[i].id = i; |
326 | dce6_audio_enable(rdev, &rdev->audio.pin[i], true); | 328 | /* disable audio. it will be set up later */ |
329 | dce6_audio_enable(rdev, &rdev->audio.pin[i], false); | ||
327 | } | 330 | } |
328 | 331 | ||
329 | return 0; | 332 | return 0; |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index f2b9e21ce4da..27b0ff16082e 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -1680,7 +1680,7 @@ bool evergreen_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd) | |||
1680 | case RADEON_HPD_6: | 1680 | case RADEON_HPD_6: |
1681 | if (RREG32(DC_HPD6_INT_STATUS) & DC_HPDx_SENSE) | 1681 | if (RREG32(DC_HPD6_INT_STATUS) & DC_HPDx_SENSE) |
1682 | connected = true; | 1682 | connected = true; |
1683 | break; | 1683 | break; |
1684 | default: | 1684 | default: |
1685 | break; | 1685 | break; |
1686 | } | 1686 | } |
@@ -5299,7 +5299,8 @@ int evergreen_resume(struct radeon_device *rdev) | |||
5299 | /* init golden registers */ | 5299 | /* init golden registers */ |
5300 | evergreen_init_golden_registers(rdev); | 5300 | evergreen_init_golden_registers(rdev); |
5301 | 5301 | ||
5302 | radeon_pm_resume(rdev); | 5302 | if (rdev->pm.pm_method == PM_METHOD_DPM) |
5303 | radeon_pm_resume(rdev); | ||
5303 | 5304 | ||
5304 | rdev->accel_working = true; | 5305 | rdev->accel_working = true; |
5305 | r = evergreen_startup(rdev); | 5306 | r = evergreen_startup(rdev); |
@@ -5475,9 +5476,9 @@ void evergreen_fini(struct radeon_device *rdev) | |||
5475 | radeon_wb_fini(rdev); | 5476 | radeon_wb_fini(rdev); |
5476 | radeon_ib_pool_fini(rdev); | 5477 | radeon_ib_pool_fini(rdev); |
5477 | radeon_irq_kms_fini(rdev); | 5478 | radeon_irq_kms_fini(rdev); |
5478 | evergreen_pcie_gart_fini(rdev); | ||
5479 | uvd_v1_0_fini(rdev); | 5479 | uvd_v1_0_fini(rdev); |
5480 | radeon_uvd_fini(rdev); | 5480 | radeon_uvd_fini(rdev); |
5481 | evergreen_pcie_gart_fini(rdev); | ||
5481 | r600_vram_scratch_fini(rdev); | 5482 | r600_vram_scratch_fini(rdev); |
5482 | radeon_gem_fini(rdev); | 5483 | radeon_gem_fini(rdev); |
5483 | radeon_fence_driver_fini(rdev); | 5484 | radeon_fence_driver_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c index 0c6d5cef4cf1..05b0c95813fd 100644 --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c | |||
@@ -306,6 +306,15 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode | |||
306 | return; | 306 | return; |
307 | offset = dig->afmt->offset; | 307 | offset = dig->afmt->offset; |
308 | 308 | ||
309 | /* disable audio prior to setting up hw */ | ||
310 | if (ASIC_IS_DCE6(rdev)) { | ||
311 | dig->afmt->pin = dce6_audio_get_pin(rdev); | ||
312 | dce6_audio_enable(rdev, dig->afmt->pin, false); | ||
313 | } else { | ||
314 | dig->afmt->pin = r600_audio_get_pin(rdev); | ||
315 | r600_audio_enable(rdev, dig->afmt->pin, false); | ||
316 | } | ||
317 | |||
309 | evergreen_audio_set_dto(encoder, mode->clock); | 318 | evergreen_audio_set_dto(encoder, mode->clock); |
310 | 319 | ||
311 | WREG32(HDMI_VBI_PACKET_CONTROL + offset, | 320 | WREG32(HDMI_VBI_PACKET_CONTROL + offset, |
@@ -409,12 +418,16 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode | |||
409 | WREG32(AFMT_RAMP_CONTROL1 + offset, 0x007FFFFF); | 418 | WREG32(AFMT_RAMP_CONTROL1 + offset, 0x007FFFFF); |
410 | WREG32(AFMT_RAMP_CONTROL2 + offset, 0x00000001); | 419 | WREG32(AFMT_RAMP_CONTROL2 + offset, 0x00000001); |
411 | WREG32(AFMT_RAMP_CONTROL3 + offset, 0x00000001); | 420 | WREG32(AFMT_RAMP_CONTROL3 + offset, 0x00000001); |
421 | |||
422 | /* enable audio after to setting up hw */ | ||
423 | if (ASIC_IS_DCE6(rdev)) | ||
424 | dce6_audio_enable(rdev, dig->afmt->pin, true); | ||
425 | else | ||
426 | r600_audio_enable(rdev, dig->afmt->pin, true); | ||
412 | } | 427 | } |
413 | 428 | ||
414 | void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable) | 429 | void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable) |
415 | { | 430 | { |
416 | struct drm_device *dev = encoder->dev; | ||
417 | struct radeon_device *rdev = dev->dev_private; | ||
418 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 431 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
419 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 432 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
420 | 433 | ||
@@ -427,15 +440,6 @@ void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable) | |||
427 | if (!enable && !dig->afmt->enabled) | 440 | if (!enable && !dig->afmt->enabled) |
428 | return; | 441 | return; |
429 | 442 | ||
430 | if (enable) { | ||
431 | if (ASIC_IS_DCE6(rdev)) | ||
432 | dig->afmt->pin = dce6_audio_get_pin(rdev); | ||
433 | else | ||
434 | dig->afmt->pin = r600_audio_get_pin(rdev); | ||
435 | } else { | ||
436 | dig->afmt->pin = NULL; | ||
437 | } | ||
438 | |||
439 | dig->afmt->enabled = enable; | 443 | dig->afmt->enabled = enable; |
440 | 444 | ||
441 | DRM_DEBUG("%sabling HDMI interface @ 0x%04X for encoder 0x%x\n", | 445 | DRM_DEBUG("%sabling HDMI interface @ 0x%04X for encoder 0x%x\n", |
diff --git a/drivers/gpu/drm/radeon/evergreen_smc.h b/drivers/gpu/drm/radeon/evergreen_smc.h index 76ada8cfe902..3a03ba37d043 100644 --- a/drivers/gpu/drm/radeon/evergreen_smc.h +++ b/drivers/gpu/drm/radeon/evergreen_smc.h | |||
@@ -57,7 +57,7 @@ typedef struct SMC_Evergreen_MCRegisters SMC_Evergreen_MCRegisters; | |||
57 | 57 | ||
58 | #define EVERGREEN_SMC_FIRMWARE_HEADER_LOCATION 0x100 | 58 | #define EVERGREEN_SMC_FIRMWARE_HEADER_LOCATION 0x100 |
59 | 59 | ||
60 | #define EVERGREEN_SMC_FIRMWARE_HEADER_softRegisters 0x0 | 60 | #define EVERGREEN_SMC_FIRMWARE_HEADER_softRegisters 0x8 |
61 | #define EVERGREEN_SMC_FIRMWARE_HEADER_stateTable 0xC | 61 | #define EVERGREEN_SMC_FIRMWARE_HEADER_stateTable 0xC |
62 | #define EVERGREEN_SMC_FIRMWARE_HEADER_mcRegisterTable 0x20 | 62 | #define EVERGREEN_SMC_FIRMWARE_HEADER_mcRegisterTable 0x20 |
63 | 63 | ||
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index ea932ac66fc6..bf6300cfd62d 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -2105,7 +2105,8 @@ int cayman_resume(struct radeon_device *rdev) | |||
2105 | /* init golden registers */ | 2105 | /* init golden registers */ |
2106 | ni_init_golden_registers(rdev); | 2106 | ni_init_golden_registers(rdev); |
2107 | 2107 | ||
2108 | radeon_pm_resume(rdev); | 2108 | if (rdev->pm.pm_method == PM_METHOD_DPM) |
2109 | radeon_pm_resume(rdev); | ||
2109 | 2110 | ||
2110 | rdev->accel_working = true; | 2111 | rdev->accel_working = true; |
2111 | r = cayman_startup(rdev); | 2112 | r = cayman_startup(rdev); |
diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c index 1217fbcbdcca..ca814276b075 100644 --- a/drivers/gpu/drm/radeon/ni_dpm.c +++ b/drivers/gpu/drm/radeon/ni_dpm.c | |||
@@ -2588,7 +2588,7 @@ static int ni_populate_sq_ramping_values(struct radeon_device *rdev, | |||
2588 | if (NISLANDS_DPM2_SQ_RAMP_STI_SIZE > (STI_SIZE_MASK >> STI_SIZE_SHIFT)) | 2588 | if (NISLANDS_DPM2_SQ_RAMP_STI_SIZE > (STI_SIZE_MASK >> STI_SIZE_SHIFT)) |
2589 | enable_sq_ramping = false; | 2589 | enable_sq_ramping = false; |
2590 | 2590 | ||
2591 | if (NISLANDS_DPM2_SQ_RAMP_LTI_RATIO <= (LTI_RATIO_MASK >> LTI_RATIO_SHIFT)) | 2591 | if (NISLANDS_DPM2_SQ_RAMP_LTI_RATIO > (LTI_RATIO_MASK >> LTI_RATIO_SHIFT)) |
2592 | enable_sq_ramping = false; | 2592 | enable_sq_ramping = false; |
2593 | 2593 | ||
2594 | for (i = 0; i < state->performance_level_count; i++) { | 2594 | for (i = 0; i < state->performance_level_count; i++) { |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index ef024ce3f7cc..3cc78bb66042 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -3942,8 +3942,6 @@ int r100_resume(struct radeon_device *rdev) | |||
3942 | /* Initialize surface registers */ | 3942 | /* Initialize surface registers */ |
3943 | radeon_surface_init(rdev); | 3943 | radeon_surface_init(rdev); |
3944 | 3944 | ||
3945 | radeon_pm_resume(rdev); | ||
3946 | |||
3947 | rdev->accel_working = true; | 3945 | rdev->accel_working = true; |
3948 | r = r100_startup(rdev); | 3946 | r = r100_startup(rdev); |
3949 | if (r) { | 3947 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c index 7c63ef840e86..0b658b34b33a 100644 --- a/drivers/gpu/drm/radeon/r300.c +++ b/drivers/gpu/drm/radeon/r300.c | |||
@@ -1430,8 +1430,6 @@ int r300_resume(struct radeon_device *rdev) | |||
1430 | /* Initialize surface registers */ | 1430 | /* Initialize surface registers */ |
1431 | radeon_surface_init(rdev); | 1431 | radeon_surface_init(rdev); |
1432 | 1432 | ||
1433 | radeon_pm_resume(rdev); | ||
1434 | |||
1435 | rdev->accel_working = true; | 1433 | rdev->accel_working = true; |
1436 | r = r300_startup(rdev); | 1434 | r = r300_startup(rdev); |
1437 | if (r) { | 1435 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c index 3768aab2710b..802b19220a21 100644 --- a/drivers/gpu/drm/radeon/r420.c +++ b/drivers/gpu/drm/radeon/r420.c | |||
@@ -325,8 +325,6 @@ int r420_resume(struct radeon_device *rdev) | |||
325 | /* Initialize surface registers */ | 325 | /* Initialize surface registers */ |
326 | radeon_surface_init(rdev); | 326 | radeon_surface_init(rdev); |
327 | 327 | ||
328 | radeon_pm_resume(rdev); | ||
329 | |||
330 | rdev->accel_working = true; | 328 | rdev->accel_working = true; |
331 | r = r420_startup(rdev); | 329 | r = r420_startup(rdev); |
332 | if (r) { | 330 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/r520.c b/drivers/gpu/drm/radeon/r520.c index e209eb75024f..98d6053c36c6 100644 --- a/drivers/gpu/drm/radeon/r520.c +++ b/drivers/gpu/drm/radeon/r520.c | |||
@@ -240,8 +240,6 @@ int r520_resume(struct radeon_device *rdev) | |||
240 | /* Initialize surface registers */ | 240 | /* Initialize surface registers */ |
241 | radeon_surface_init(rdev); | 241 | radeon_surface_init(rdev); |
242 | 242 | ||
243 | radeon_pm_resume(rdev); | ||
244 | |||
245 | rdev->accel_working = true; | 243 | rdev->accel_working = true; |
246 | r = r520_startup(rdev); | 244 | r = r520_startup(rdev); |
247 | if (r) { | 245 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index cdbc4171fe73..647ef4079217 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -2968,7 +2968,8 @@ int r600_resume(struct radeon_device *rdev) | |||
2968 | /* post card */ | 2968 | /* post card */ |
2969 | atom_asic_init(rdev->mode_info.atom_context); | 2969 | atom_asic_init(rdev->mode_info.atom_context); |
2970 | 2970 | ||
2971 | radeon_pm_resume(rdev); | 2971 | if (rdev->pm.pm_method == PM_METHOD_DPM) |
2972 | radeon_pm_resume(rdev); | ||
2972 | 2973 | ||
2973 | rdev->accel_working = true; | 2974 | rdev->accel_working = true; |
2974 | r = r600_startup(rdev); | 2975 | r = r600_startup(rdev); |
diff --git a/drivers/gpu/drm/radeon/r600_audio.c b/drivers/gpu/drm/radeon/r600_audio.c index 47fc2b886979..bffac10c4296 100644 --- a/drivers/gpu/drm/radeon/r600_audio.c +++ b/drivers/gpu/drm/radeon/r600_audio.c | |||
@@ -142,12 +142,15 @@ void r600_audio_update_hdmi(struct work_struct *work) | |||
142 | } | 142 | } |
143 | 143 | ||
144 | /* enable the audio stream */ | 144 | /* enable the audio stream */ |
145 | static void r600_audio_enable(struct radeon_device *rdev, | 145 | void r600_audio_enable(struct radeon_device *rdev, |
146 | struct r600_audio_pin *pin, | 146 | struct r600_audio_pin *pin, |
147 | bool enable) | 147 | bool enable) |
148 | { | 148 | { |
149 | u32 value = 0; | 149 | u32 value = 0; |
150 | 150 | ||
151 | if (!pin) | ||
152 | return; | ||
153 | |||
151 | if (ASIC_IS_DCE4(rdev)) { | 154 | if (ASIC_IS_DCE4(rdev)) { |
152 | if (enable) { | 155 | if (enable) { |
153 | value |= 0x81000000; /* Required to enable audio */ | 156 | value |= 0x81000000; /* Required to enable audio */ |
@@ -158,7 +161,6 @@ static void r600_audio_enable(struct radeon_device *rdev, | |||
158 | WREG32_P(R600_AUDIO_ENABLE, | 161 | WREG32_P(R600_AUDIO_ENABLE, |
159 | enable ? 0x81000000 : 0x0, ~0x81000000); | 162 | enable ? 0x81000000 : 0x0, ~0x81000000); |
160 | } | 163 | } |
161 | DRM_INFO("%s audio %d support\n", enable ? "Enabling" : "Disabling", pin->id); | ||
162 | } | 164 | } |
163 | 165 | ||
164 | /* | 166 | /* |
@@ -178,8 +180,8 @@ int r600_audio_init(struct radeon_device *rdev) | |||
178 | rdev->audio.pin[0].status_bits = 0; | 180 | rdev->audio.pin[0].status_bits = 0; |
179 | rdev->audio.pin[0].category_code = 0; | 181 | rdev->audio.pin[0].category_code = 0; |
180 | rdev->audio.pin[0].id = 0; | 182 | rdev->audio.pin[0].id = 0; |
181 | 183 | /* disable audio. it will be set up later */ | |
182 | r600_audio_enable(rdev, &rdev->audio.pin[0], true); | 184 | r600_audio_enable(rdev, &rdev->audio.pin[0], false); |
183 | 185 | ||
184 | return 0; | 186 | return 0; |
185 | } | 187 | } |
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c index 3016fc14f502..85a2bb28aed2 100644 --- a/drivers/gpu/drm/radeon/r600_hdmi.c +++ b/drivers/gpu/drm/radeon/r600_hdmi.c | |||
@@ -329,9 +329,6 @@ static void dce3_2_afmt_write_speaker_allocation(struct drm_encoder *encoder) | |||
329 | u8 *sadb; | 329 | u8 *sadb; |
330 | int sad_count; | 330 | int sad_count; |
331 | 331 | ||
332 | /* XXX: setting this register causes hangs on some asics */ | ||
333 | return; | ||
334 | |||
335 | list_for_each_entry(connector, &encoder->dev->mode_config.connector_list, head) { | 332 | list_for_each_entry(connector, &encoder->dev->mode_config.connector_list, head) { |
336 | if (connector->encoder == encoder) { | 333 | if (connector->encoder == encoder) { |
337 | radeon_connector = to_radeon_connector(connector); | 334 | radeon_connector = to_radeon_connector(connector); |
@@ -460,6 +457,10 @@ void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mod | |||
460 | return; | 457 | return; |
461 | offset = dig->afmt->offset; | 458 | offset = dig->afmt->offset; |
462 | 459 | ||
460 | /* disable audio prior to setting up hw */ | ||
461 | dig->afmt->pin = r600_audio_get_pin(rdev); | ||
462 | r600_audio_enable(rdev, dig->afmt->pin, false); | ||
463 | |||
463 | r600_audio_set_dto(encoder, mode->clock); | 464 | r600_audio_set_dto(encoder, mode->clock); |
464 | 465 | ||
465 | WREG32(HDMI0_VBI_PACKET_CONTROL + offset, | 466 | WREG32(HDMI0_VBI_PACKET_CONTROL + offset, |
@@ -531,6 +532,9 @@ void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mod | |||
531 | WREG32(HDMI0_RAMP_CONTROL3 + offset, 0x00000001); | 532 | WREG32(HDMI0_RAMP_CONTROL3 + offset, 0x00000001); |
532 | 533 | ||
533 | r600_hdmi_audio_workaround(encoder); | 534 | r600_hdmi_audio_workaround(encoder); |
535 | |||
536 | /* enable audio after to setting up hw */ | ||
537 | r600_audio_enable(rdev, dig->afmt->pin, true); | ||
534 | } | 538 | } |
535 | 539 | ||
536 | /* | 540 | /* |
@@ -651,11 +655,6 @@ void r600_hdmi_enable(struct drm_encoder *encoder, bool enable) | |||
651 | if (!enable && !dig->afmt->enabled) | 655 | if (!enable && !dig->afmt->enabled) |
652 | return; | 656 | return; |
653 | 657 | ||
654 | if (enable) | ||
655 | dig->afmt->pin = r600_audio_get_pin(rdev); | ||
656 | else | ||
657 | dig->afmt->pin = NULL; | ||
658 | |||
659 | /* Older chipsets require setting HDMI and routing manually */ | 658 | /* Older chipsets require setting HDMI and routing manually */ |
660 | if (!ASIC_IS_DCE3(rdev)) { | 659 | if (!ASIC_IS_DCE3(rdev)) { |
661 | if (enable) | 660 | if (enable) |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 4a8ac1cd6b4c..e887d027b6d0 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -135,6 +135,9 @@ extern int radeon_hard_reset; | |||
135 | /* R600+ */ | 135 | /* R600+ */ |
136 | #define R600_RING_TYPE_UVD_INDEX 5 | 136 | #define R600_RING_TYPE_UVD_INDEX 5 |
137 | 137 | ||
138 | /* number of hw syncs before falling back on blocking */ | ||
139 | #define RADEON_NUM_SYNCS 4 | ||
140 | |||
138 | /* hardcode those limit for now */ | 141 | /* hardcode those limit for now */ |
139 | #define RADEON_VA_IB_OFFSET (1 << 20) | 142 | #define RADEON_VA_IB_OFFSET (1 << 20) |
140 | #define RADEON_VA_RESERVED_SIZE (8 << 20) | 143 | #define RADEON_VA_RESERVED_SIZE (8 << 20) |
@@ -554,7 +557,6 @@ int radeon_mode_dumb_mmap(struct drm_file *filp, | |||
554 | /* | 557 | /* |
555 | * Semaphores. | 558 | * Semaphores. |
556 | */ | 559 | */ |
557 | /* everything here is constant */ | ||
558 | struct radeon_semaphore { | 560 | struct radeon_semaphore { |
559 | struct radeon_sa_bo *sa_bo; | 561 | struct radeon_sa_bo *sa_bo; |
560 | signed waiters; | 562 | signed waiters; |
@@ -2745,6 +2747,12 @@ int radeon_vm_bo_rmv(struct radeon_device *rdev, | |||
2745 | void r600_audio_update_hdmi(struct work_struct *work); | 2747 | void r600_audio_update_hdmi(struct work_struct *work); |
2746 | struct r600_audio_pin *r600_audio_get_pin(struct radeon_device *rdev); | 2748 | struct r600_audio_pin *r600_audio_get_pin(struct radeon_device *rdev); |
2747 | struct r600_audio_pin *dce6_audio_get_pin(struct radeon_device *rdev); | 2749 | struct r600_audio_pin *dce6_audio_get_pin(struct radeon_device *rdev); |
2750 | void r600_audio_enable(struct radeon_device *rdev, | ||
2751 | struct r600_audio_pin *pin, | ||
2752 | bool enable); | ||
2753 | void dce6_audio_enable(struct radeon_device *rdev, | ||
2754 | struct r600_audio_pin *pin, | ||
2755 | bool enable); | ||
2748 | 2756 | ||
2749 | /* | 2757 | /* |
2750 | * R600 vram scratch functions | 2758 | * R600 vram scratch functions |
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c index 485848f889f5..fa9a9c02751e 100644 --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c | |||
@@ -219,7 +219,8 @@ static int radeon_atpx_verify_interface(struct radeon_atpx *atpx) | |||
219 | memcpy(&output, info->buffer.pointer, size); | 219 | memcpy(&output, info->buffer.pointer, size); |
220 | 220 | ||
221 | /* TODO: check version? */ | 221 | /* TODO: check version? */ |
222 | printk("ATPX version %u\n", output.version); | 222 | printk("ATPX version %u, functions 0x%08x\n", |
223 | output.version, output.function_bits); | ||
223 | 224 | ||
224 | radeon_atpx_parse_functions(&atpx->functions, output.function_bits); | 225 | radeon_atpx_parse_functions(&atpx->functions, output.function_bits); |
225 | 226 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index b012cbbc3ed5..044bc98fb459 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -1521,13 +1521,16 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon) | |||
1521 | if (r) | 1521 | if (r) |
1522 | DRM_ERROR("ib ring test failed (%d).\n", r); | 1522 | DRM_ERROR("ib ring test failed (%d).\n", r); |
1523 | 1523 | ||
1524 | if (rdev->pm.dpm_enabled) { | 1524 | if ((rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled) { |
1525 | /* do dpm late init */ | 1525 | /* do dpm late init */ |
1526 | r = radeon_pm_late_init(rdev); | 1526 | r = radeon_pm_late_init(rdev); |
1527 | if (r) { | 1527 | if (r) { |
1528 | rdev->pm.dpm_enabled = false; | 1528 | rdev->pm.dpm_enabled = false; |
1529 | DRM_ERROR("radeon_pm_late_init failed, disabling dpm\n"); | 1529 | DRM_ERROR("radeon_pm_late_init failed, disabling dpm\n"); |
1530 | } | 1530 | } |
1531 | } else { | ||
1532 | /* resume old pm late */ | ||
1533 | radeon_pm_resume(rdev); | ||
1531 | } | 1534 | } |
1532 | 1535 | ||
1533 | radeon_restore_bios_scratch_regs(rdev); | 1536 | radeon_restore_bios_scratch_regs(rdev); |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index d680608f6f5b..fbd8b930f2be 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -571,6 +571,8 @@ static void radeon_crtc_init(struct drm_device *dev, int index) | |||
571 | radeon_crtc->max_cursor_width = CURSOR_WIDTH; | 571 | radeon_crtc->max_cursor_width = CURSOR_WIDTH; |
572 | radeon_crtc->max_cursor_height = CURSOR_HEIGHT; | 572 | radeon_crtc->max_cursor_height = CURSOR_HEIGHT; |
573 | } | 573 | } |
574 | dev->mode_config.cursor_width = radeon_crtc->max_cursor_width; | ||
575 | dev->mode_config.cursor_height = radeon_crtc->max_cursor_height; | ||
574 | 576 | ||
575 | #if 0 | 577 | #if 0 |
576 | radeon_crtc->mode_set.crtc = &radeon_crtc->base; | 578 | radeon_crtc->mode_set.crtc = &radeon_crtc->base; |
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 114d1672d616..2aecd6dc2610 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c | |||
@@ -537,6 +537,10 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) | |||
537 | 537 | ||
538 | radeon_vm_init(rdev, &fpriv->vm); | 538 | radeon_vm_init(rdev, &fpriv->vm); |
539 | 539 | ||
540 | r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); | ||
541 | if (r) | ||
542 | return r; | ||
543 | |||
540 | /* map the ib pool buffer read only into | 544 | /* map the ib pool buffer read only into |
541 | * virtual address space */ | 545 | * virtual address space */ |
542 | bo_va = radeon_vm_bo_add(rdev, &fpriv->vm, | 546 | bo_va = radeon_vm_bo_add(rdev, &fpriv->vm, |
@@ -544,6 +548,8 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) | |||
544 | r = radeon_vm_bo_set_addr(rdev, bo_va, RADEON_VA_IB_OFFSET, | 548 | r = radeon_vm_bo_set_addr(rdev, bo_va, RADEON_VA_IB_OFFSET, |
545 | RADEON_VM_PAGE_READABLE | | 549 | RADEON_VM_PAGE_READABLE | |
546 | RADEON_VM_PAGE_SNOOPED); | 550 | RADEON_VM_PAGE_SNOOPED); |
551 | |||
552 | radeon_bo_unreserve(rdev->ring_tmp_bo.bo); | ||
547 | if (r) { | 553 | if (r) { |
548 | radeon_vm_fini(rdev, &fpriv->vm); | 554 | radeon_vm_fini(rdev, &fpriv->vm); |
549 | kfree(fpriv); | 555 | kfree(fpriv); |
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index 1b783f0e6d3a..15e44a7281ab 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c | |||
@@ -139,7 +139,7 @@ int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib, | |||
139 | } | 139 | } |
140 | 140 | ||
141 | /* 64 dwords should be enough for fence too */ | 141 | /* 64 dwords should be enough for fence too */ |
142 | r = radeon_ring_lock(rdev, ring, 64 + RADEON_NUM_RINGS * 8); | 142 | r = radeon_ring_lock(rdev, ring, 64 + RADEON_NUM_SYNCS * 8); |
143 | if (r) { | 143 | if (r) { |
144 | dev_err(rdev->dev, "scheduling IB failed (%d).\n", r); | 144 | dev_err(rdev->dev, "scheduling IB failed (%d).\n", r); |
145 | return r; | 145 | return r; |
diff --git a/drivers/gpu/drm/radeon/radeon_semaphore.c b/drivers/gpu/drm/radeon/radeon_semaphore.c index 2b42aa1914f2..9006b32d5eed 100644 --- a/drivers/gpu/drm/radeon/radeon_semaphore.c +++ b/drivers/gpu/drm/radeon/radeon_semaphore.c | |||
@@ -34,14 +34,15 @@ | |||
34 | int radeon_semaphore_create(struct radeon_device *rdev, | 34 | int radeon_semaphore_create(struct radeon_device *rdev, |
35 | struct radeon_semaphore **semaphore) | 35 | struct radeon_semaphore **semaphore) |
36 | { | 36 | { |
37 | uint32_t *cpu_addr; | ||
37 | int i, r; | 38 | int i, r; |
38 | 39 | ||
39 | *semaphore = kmalloc(sizeof(struct radeon_semaphore), GFP_KERNEL); | 40 | *semaphore = kmalloc(sizeof(struct radeon_semaphore), GFP_KERNEL); |
40 | if (*semaphore == NULL) { | 41 | if (*semaphore == NULL) { |
41 | return -ENOMEM; | 42 | return -ENOMEM; |
42 | } | 43 | } |
43 | r = radeon_sa_bo_new(rdev, &rdev->ring_tmp_bo, | 44 | r = radeon_sa_bo_new(rdev, &rdev->ring_tmp_bo, &(*semaphore)->sa_bo, |
44 | &(*semaphore)->sa_bo, 8, 8, true); | 45 | 8 * RADEON_NUM_SYNCS, 8, true); |
45 | if (r) { | 46 | if (r) { |
46 | kfree(*semaphore); | 47 | kfree(*semaphore); |
47 | *semaphore = NULL; | 48 | *semaphore = NULL; |
@@ -49,7 +50,10 @@ int radeon_semaphore_create(struct radeon_device *rdev, | |||
49 | } | 50 | } |
50 | (*semaphore)->waiters = 0; | 51 | (*semaphore)->waiters = 0; |
51 | (*semaphore)->gpu_addr = radeon_sa_bo_gpu_addr((*semaphore)->sa_bo); | 52 | (*semaphore)->gpu_addr = radeon_sa_bo_gpu_addr((*semaphore)->sa_bo); |
52 | *((uint64_t*)radeon_sa_bo_cpu_addr((*semaphore)->sa_bo)) = 0; | 53 | |
54 | cpu_addr = radeon_sa_bo_cpu_addr((*semaphore)->sa_bo); | ||
55 | for (i = 0; i < RADEON_NUM_SYNCS; ++i) | ||
56 | cpu_addr[i] = 0; | ||
53 | 57 | ||
54 | for (i = 0; i < RADEON_NUM_RINGS; ++i) | 58 | for (i = 0; i < RADEON_NUM_RINGS; ++i) |
55 | (*semaphore)->sync_to[i] = NULL; | 59 | (*semaphore)->sync_to[i] = NULL; |
@@ -125,6 +129,7 @@ int radeon_semaphore_sync_rings(struct radeon_device *rdev, | |||
125 | struct radeon_semaphore *semaphore, | 129 | struct radeon_semaphore *semaphore, |
126 | int ring) | 130 | int ring) |
127 | { | 131 | { |
132 | unsigned count = 0; | ||
128 | int i, r; | 133 | int i, r; |
129 | 134 | ||
130 | for (i = 0; i < RADEON_NUM_RINGS; ++i) { | 135 | for (i = 0; i < RADEON_NUM_RINGS; ++i) { |
@@ -140,6 +145,12 @@ int radeon_semaphore_sync_rings(struct radeon_device *rdev, | |||
140 | return -EINVAL; | 145 | return -EINVAL; |
141 | } | 146 | } |
142 | 147 | ||
148 | if (++count > RADEON_NUM_SYNCS) { | ||
149 | /* not enough room, wait manually */ | ||
150 | radeon_fence_wait_locked(fence); | ||
151 | continue; | ||
152 | } | ||
153 | |||
143 | /* allocate enough space for sync command */ | 154 | /* allocate enough space for sync command */ |
144 | r = radeon_ring_alloc(rdev, &rdev->ring[i], 16); | 155 | r = radeon_ring_alloc(rdev, &rdev->ring[i], 16); |
145 | if (r) { | 156 | if (r) { |
@@ -164,6 +175,8 @@ int radeon_semaphore_sync_rings(struct radeon_device *rdev, | |||
164 | 175 | ||
165 | radeon_ring_commit(rdev, &rdev->ring[i]); | 176 | radeon_ring_commit(rdev, &rdev->ring[i]); |
166 | radeon_fence_note_sync(fence, ring); | 177 | radeon_fence_note_sync(fence, ring); |
178 | |||
179 | semaphore->gpu_addr += 8; | ||
167 | } | 180 | } |
168 | 181 | ||
169 | return 0; | 182 | return 0; |
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index 77f5b0c3edb8..040a2a10ea17 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c | |||
@@ -714,6 +714,9 @@ int radeon_ttm_init(struct radeon_device *rdev) | |||
714 | DRM_ERROR("Failed initializing VRAM heap.\n"); | 714 | DRM_ERROR("Failed initializing VRAM heap.\n"); |
715 | return r; | 715 | return r; |
716 | } | 716 | } |
717 | /* Change the size here instead of the init above so only lpfn is affected */ | ||
718 | radeon_ttm_set_active_vram_size(rdev, rdev->mc.visible_vram_size); | ||
719 | |||
717 | r = radeon_bo_create(rdev, 256 * 1024, PAGE_SIZE, true, | 720 | r = radeon_bo_create(rdev, 256 * 1024, PAGE_SIZE, true, |
718 | RADEON_GEM_DOMAIN_VRAM, | 721 | RADEON_GEM_DOMAIN_VRAM, |
719 | NULL, &rdev->stollen_vga_memory); | 722 | NULL, &rdev->stollen_vga_memory); |
@@ -935,7 +938,7 @@ static ssize_t radeon_ttm_gtt_read(struct file *f, char __user *buf, | |||
935 | while (size) { | 938 | while (size) { |
936 | loff_t p = *pos / PAGE_SIZE; | 939 | loff_t p = *pos / PAGE_SIZE; |
937 | unsigned off = *pos & ~PAGE_MASK; | 940 | unsigned off = *pos & ~PAGE_MASK; |
938 | ssize_t cur_size = min(size, PAGE_SIZE - off); | 941 | size_t cur_size = min_t(size_t, size, PAGE_SIZE - off); |
939 | struct page *page; | 942 | struct page *page; |
940 | void *ptr; | 943 | void *ptr; |
941 | 944 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c index 6781fee1eaad..3e6804b2b2ef 100644 --- a/drivers/gpu/drm/radeon/radeon_uvd.c +++ b/drivers/gpu/drm/radeon/radeon_uvd.c | |||
@@ -171,6 +171,8 @@ void radeon_uvd_fini(struct radeon_device *rdev) | |||
171 | 171 | ||
172 | radeon_bo_unref(&rdev->uvd.vcpu_bo); | 172 | radeon_bo_unref(&rdev->uvd.vcpu_bo); |
173 | 173 | ||
174 | radeon_ring_fini(rdev, &rdev->ring[R600_RING_TYPE_UVD_INDEX]); | ||
175 | |||
174 | release_firmware(rdev->uvd_fw); | 176 | release_firmware(rdev->uvd_fw); |
175 | } | 177 | } |
176 | 178 | ||
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c index b5c2369cda2f..130d5cc50d43 100644 --- a/drivers/gpu/drm/radeon/rs400.c +++ b/drivers/gpu/drm/radeon/rs400.c | |||
@@ -474,8 +474,6 @@ int rs400_resume(struct radeon_device *rdev) | |||
474 | /* Initialize surface registers */ | 474 | /* Initialize surface registers */ |
475 | radeon_surface_init(rdev); | 475 | radeon_surface_init(rdev); |
476 | 476 | ||
477 | radeon_pm_resume(rdev); | ||
478 | |||
479 | rdev->accel_working = true; | 477 | rdev->accel_working = true; |
480 | r = rs400_startup(rdev); | 478 | r = rs400_startup(rdev); |
481 | if (r) { | 479 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index fdcde7693032..72d3616de08e 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
@@ -1048,8 +1048,6 @@ int rs600_resume(struct radeon_device *rdev) | |||
1048 | /* Initialize surface registers */ | 1048 | /* Initialize surface registers */ |
1049 | radeon_surface_init(rdev); | 1049 | radeon_surface_init(rdev); |
1050 | 1050 | ||
1051 | radeon_pm_resume(rdev); | ||
1052 | |||
1053 | rdev->accel_working = true; | 1051 | rdev->accel_working = true; |
1054 | r = rs600_startup(rdev); | 1052 | r = rs600_startup(rdev); |
1055 | if (r) { | 1053 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c index 35950738bd5e..3462b64369bf 100644 --- a/drivers/gpu/drm/radeon/rs690.c +++ b/drivers/gpu/drm/radeon/rs690.c | |||
@@ -756,8 +756,6 @@ int rs690_resume(struct radeon_device *rdev) | |||
756 | /* Initialize surface registers */ | 756 | /* Initialize surface registers */ |
757 | radeon_surface_init(rdev); | 757 | radeon_surface_init(rdev); |
758 | 758 | ||
759 | radeon_pm_resume(rdev); | ||
760 | |||
761 | rdev->accel_working = true; | 759 | rdev->accel_working = true; |
762 | r = rs690_startup(rdev); | 760 | r = rs690_startup(rdev); |
763 | if (r) { | 761 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c index 98e8138ff779..237dd29d9f1c 100644 --- a/drivers/gpu/drm/radeon/rv515.c +++ b/drivers/gpu/drm/radeon/rv515.c | |||
@@ -586,8 +586,6 @@ int rv515_resume(struct radeon_device *rdev) | |||
586 | /* Initialize surface registers */ | 586 | /* Initialize surface registers */ |
587 | radeon_surface_init(rdev); | 587 | radeon_surface_init(rdev); |
588 | 588 | ||
589 | radeon_pm_resume(rdev); | ||
590 | |||
591 | rdev->accel_working = true; | 589 | rdev->accel_working = true; |
592 | r = rv515_startup(rdev); | 590 | r = rv515_startup(rdev); |
593 | if (r) { | 591 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 6c772e58c784..fef310773aad 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -1811,7 +1811,8 @@ int rv770_resume(struct radeon_device *rdev) | |||
1811 | /* init golden registers */ | 1811 | /* init golden registers */ |
1812 | rv770_init_golden_registers(rdev); | 1812 | rv770_init_golden_registers(rdev); |
1813 | 1813 | ||
1814 | radeon_pm_resume(rdev); | 1814 | if (rdev->pm.pm_method == PM_METHOD_DPM) |
1815 | radeon_pm_resume(rdev); | ||
1815 | 1816 | ||
1816 | rdev->accel_working = true; | 1817 | rdev->accel_working = true; |
1817 | r = rv770_startup(rdev); | 1818 | r = rv770_startup(rdev); |
@@ -1955,9 +1956,9 @@ void rv770_fini(struct radeon_device *rdev) | |||
1955 | radeon_wb_fini(rdev); | 1956 | radeon_wb_fini(rdev); |
1956 | radeon_ib_pool_fini(rdev); | 1957 | radeon_ib_pool_fini(rdev); |
1957 | radeon_irq_kms_fini(rdev); | 1958 | radeon_irq_kms_fini(rdev); |
1958 | rv770_pcie_gart_fini(rdev); | ||
1959 | uvd_v1_0_fini(rdev); | 1959 | uvd_v1_0_fini(rdev); |
1960 | radeon_uvd_fini(rdev); | 1960 | radeon_uvd_fini(rdev); |
1961 | rv770_pcie_gart_fini(rdev); | ||
1961 | r600_vram_scratch_fini(rdev); | 1962 | r600_vram_scratch_fini(rdev); |
1962 | radeon_gem_fini(rdev); | 1963 | radeon_gem_fini(rdev); |
1963 | radeon_fence_driver_fini(rdev); | 1964 | radeon_fence_driver_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c b/drivers/gpu/drm/radeon/rv770_dpm.c index 5b2ea8ac0731..b5f63f5e22a3 100644 --- a/drivers/gpu/drm/radeon/rv770_dpm.c +++ b/drivers/gpu/drm/radeon/rv770_dpm.c | |||
@@ -2526,14 +2526,7 @@ u32 rv770_dpm_get_mclk(struct radeon_device *rdev, bool low) | |||
2526 | bool rv770_dpm_vblank_too_short(struct radeon_device *rdev) | 2526 | bool rv770_dpm_vblank_too_short(struct radeon_device *rdev) |
2527 | { | 2527 | { |
2528 | u32 vblank_time = r600_dpm_get_vblank_time(rdev); | 2528 | u32 vblank_time = r600_dpm_get_vblank_time(rdev); |
2529 | u32 switch_limit = 300; | 2529 | u32 switch_limit = 200; /* 300 */ |
2530 | |||
2531 | /* quirks */ | ||
2532 | /* ASUS K70AF */ | ||
2533 | if ((rdev->pdev->device == 0x9553) && | ||
2534 | (rdev->pdev->subsystem_vendor == 0x1043) && | ||
2535 | (rdev->pdev->subsystem_device == 0x1c42)) | ||
2536 | switch_limit = 200; | ||
2537 | 2530 | ||
2538 | /* RV770 */ | 2531 | /* RV770 */ |
2539 | /* mclk switching doesn't seem to work reliably on desktop RV770s */ | 2532 | /* mclk switching doesn't seem to work reliably on desktop RV770s */ |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 83578324e5d1..9a124d0608b3 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -6618,7 +6618,8 @@ int si_resume(struct radeon_device *rdev) | |||
6618 | /* init golden registers */ | 6618 | /* init golden registers */ |
6619 | si_init_golden_registers(rdev); | 6619 | si_init_golden_registers(rdev); |
6620 | 6620 | ||
6621 | radeon_pm_resume(rdev); | 6621 | if (rdev->pm.pm_method == PM_METHOD_DPM) |
6622 | radeon_pm_resume(rdev); | ||
6622 | 6623 | ||
6623 | rdev->accel_working = true; | 6624 | rdev->accel_working = true; |
6624 | r = si_startup(rdev); | 6625 | r = si_startup(rdev); |
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index eafb0e6bc67e..0a2f5b4bca43 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c | |||
@@ -2395,7 +2395,7 @@ static int si_populate_sq_ramping_values(struct radeon_device *rdev, | |||
2395 | if (SISLANDS_DPM2_SQ_RAMP_STI_SIZE > (STI_SIZE_MASK >> STI_SIZE_SHIFT)) | 2395 | if (SISLANDS_DPM2_SQ_RAMP_STI_SIZE > (STI_SIZE_MASK >> STI_SIZE_SHIFT)) |
2396 | enable_sq_ramping = false; | 2396 | enable_sq_ramping = false; |
2397 | 2397 | ||
2398 | if (SISLANDS_DPM2_SQ_RAMP_LTI_RATIO <= (LTI_RATIO_MASK >> LTI_RATIO_SHIFT)) | 2398 | if (SISLANDS_DPM2_SQ_RAMP_LTI_RATIO > (LTI_RATIO_MASK >> LTI_RATIO_SHIFT)) |
2399 | enable_sq_ramping = false; | 2399 | enable_sq_ramping = false; |
2400 | 2400 | ||
2401 | for (i = 0; i < state->performance_level_count; i++) { | 2401 | for (i = 0; i < state->performance_level_count; i++) { |
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 88a529008ce0..c71594754f46 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c | |||
@@ -104,7 +104,7 @@ static void tegra_drm_context_free(struct tegra_drm_context *context) | |||
104 | 104 | ||
105 | static void tegra_drm_lastclose(struct drm_device *drm) | 105 | static void tegra_drm_lastclose(struct drm_device *drm) |
106 | { | 106 | { |
107 | #ifdef CONFIG_TEGRA_DRM_FBDEV | 107 | #ifdef CONFIG_DRM_TEGRA_FBDEV |
108 | struct tegra_drm *tegra = drm->dev_private; | 108 | struct tegra_drm *tegra = drm->dev_private; |
109 | 109 | ||
110 | tegra_fbdev_restore_mode(tegra->fbdev); | 110 | tegra_fbdev_restore_mode(tegra->fbdev); |
diff --git a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c index 338f7f6561d7..0266fb40479e 100644 --- a/drivers/gpu/drm/tegra/rgb.c +++ b/drivers/gpu/drm/tegra/rgb.c | |||
@@ -15,6 +15,7 @@ | |||
15 | struct tegra_rgb { | 15 | struct tegra_rgb { |
16 | struct tegra_output output; | 16 | struct tegra_output output; |
17 | struct tegra_dc *dc; | 17 | struct tegra_dc *dc; |
18 | bool enabled; | ||
18 | 19 | ||
19 | struct clk *clk_parent; | 20 | struct clk *clk_parent; |
20 | struct clk *clk; | 21 | struct clk *clk; |
@@ -89,6 +90,9 @@ static int tegra_output_rgb_enable(struct tegra_output *output) | |||
89 | struct tegra_rgb *rgb = to_rgb(output); | 90 | struct tegra_rgb *rgb = to_rgb(output); |
90 | unsigned long value; | 91 | unsigned long value; |
91 | 92 | ||
93 | if (rgb->enabled) | ||
94 | return 0; | ||
95 | |||
92 | tegra_dc_write_regs(rgb->dc, rgb_enable, ARRAY_SIZE(rgb_enable)); | 96 | tegra_dc_write_regs(rgb->dc, rgb_enable, ARRAY_SIZE(rgb_enable)); |
93 | 97 | ||
94 | value = DE_SELECT_ACTIVE | DE_CONTROL_NORMAL; | 98 | value = DE_SELECT_ACTIVE | DE_CONTROL_NORMAL; |
@@ -122,6 +126,8 @@ static int tegra_output_rgb_enable(struct tegra_output *output) | |||
122 | tegra_dc_writel(rgb->dc, GENERAL_ACT_REQ << 8, DC_CMD_STATE_CONTROL); | 126 | tegra_dc_writel(rgb->dc, GENERAL_ACT_REQ << 8, DC_CMD_STATE_CONTROL); |
123 | tegra_dc_writel(rgb->dc, GENERAL_ACT_REQ, DC_CMD_STATE_CONTROL); | 127 | tegra_dc_writel(rgb->dc, GENERAL_ACT_REQ, DC_CMD_STATE_CONTROL); |
124 | 128 | ||
129 | rgb->enabled = true; | ||
130 | |||
125 | return 0; | 131 | return 0; |
126 | } | 132 | } |
127 | 133 | ||
@@ -130,6 +136,9 @@ static int tegra_output_rgb_disable(struct tegra_output *output) | |||
130 | struct tegra_rgb *rgb = to_rgb(output); | 136 | struct tegra_rgb *rgb = to_rgb(output); |
131 | unsigned long value; | 137 | unsigned long value; |
132 | 138 | ||
139 | if (!rgb->enabled) | ||
140 | return 0; | ||
141 | |||
133 | value = tegra_dc_readl(rgb->dc, DC_CMD_DISPLAY_POWER_CONTROL); | 142 | value = tegra_dc_readl(rgb->dc, DC_CMD_DISPLAY_POWER_CONTROL); |
134 | value &= ~(PW0_ENABLE | PW1_ENABLE | PW2_ENABLE | PW3_ENABLE | | 143 | value &= ~(PW0_ENABLE | PW1_ENABLE | PW2_ENABLE | PW3_ENABLE | |
135 | PW4_ENABLE | PM0_ENABLE | PM1_ENABLE); | 144 | PW4_ENABLE | PM0_ENABLE | PM1_ENABLE); |
@@ -144,6 +153,8 @@ static int tegra_output_rgb_disable(struct tegra_output *output) | |||
144 | 153 | ||
145 | tegra_dc_write_regs(rgb->dc, rgb_disable, ARRAY_SIZE(rgb_disable)); | 154 | tegra_dc_write_regs(rgb->dc, rgb_disable, ARRAY_SIZE(rgb_disable)); |
146 | 155 | ||
156 | rgb->enabled = false; | ||
157 | |||
147 | return 0; | 158 | return 0; |
148 | } | 159 | } |
149 | 160 | ||
diff --git a/drivers/gpu/drm/ttm/ttm_agp_backend.c b/drivers/gpu/drm/ttm/ttm_agp_backend.c index 3302f99e7497..764be36397fd 100644 --- a/drivers/gpu/drm/ttm/ttm_agp_backend.c +++ b/drivers/gpu/drm/ttm/ttm_agp_backend.c | |||
@@ -126,6 +126,7 @@ struct ttm_tt *ttm_agp_tt_create(struct ttm_bo_device *bdev, | |||
126 | agp_be->ttm.func = &ttm_agp_func; | 126 | agp_be->ttm.func = &ttm_agp_func; |
127 | 127 | ||
128 | if (ttm_tt_init(&agp_be->ttm, bdev, size, page_flags, dummy_read_page)) { | 128 | if (ttm_tt_init(&agp_be->ttm, bdev, size, page_flags, dummy_read_page)) { |
129 | kfree(agp_be); | ||
129 | return NULL; | 130 | return NULL; |
130 | } | 131 | } |
131 | 132 | ||
diff --git a/drivers/gpu/drm/vmwgfx/svga3d_reg.h b/drivers/gpu/drm/vmwgfx/svga3d_reg.h index b645647b7776..f58dc7dd15c5 100644 --- a/drivers/gpu/drm/vmwgfx/svga3d_reg.h +++ b/drivers/gpu/drm/vmwgfx/svga3d_reg.h | |||
@@ -261,12 +261,7 @@ typedef enum SVGA3dSurfaceFormat { | |||
261 | /* Planar video formats. */ | 261 | /* Planar video formats. */ |
262 | SVGA3D_YV12 = 121, | 262 | SVGA3D_YV12 = 121, |
263 | 263 | ||
264 | /* Shader constant formats. */ | 264 | SVGA3D_FORMAT_MAX = 122, |
265 | SVGA3D_SURFACE_SHADERCONST_FLOAT = 122, | ||
266 | SVGA3D_SURFACE_SHADERCONST_INT = 123, | ||
267 | SVGA3D_SURFACE_SHADERCONST_BOOL = 124, | ||
268 | |||
269 | SVGA3D_FORMAT_MAX = 125, | ||
270 | } SVGA3dSurfaceFormat; | 265 | } SVGA3dSurfaceFormat; |
271 | 266 | ||
272 | typedef uint32 SVGA3dColor; /* a, r, g, b */ | 267 | typedef uint32 SVGA3dColor; /* a, r, g, b */ |
@@ -1223,9 +1218,19 @@ typedef enum { | |||
1223 | #define SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL 1129 | 1218 | #define SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL 1129 |
1224 | 1219 | ||
1225 | #define SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE 1130 | 1220 | #define SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE 1130 |
1226 | 1221 | #define SVGA_3D_CMD_GB_SCREEN_DMA 1131 | |
1222 | #define SVGA_3D_CMD_BIND_GB_SURFACE_WITH_PITCH 1132 | ||
1223 | #define SVGA_3D_CMD_GB_MOB_FENCE 1133 | ||
1224 | #define SVGA_3D_CMD_DEFINE_GB_SURFACE_V2 1134 | ||
1227 | #define SVGA_3D_CMD_DEFINE_GB_MOB64 1135 | 1225 | #define SVGA_3D_CMD_DEFINE_GB_MOB64 1135 |
1228 | #define SVGA_3D_CMD_REDEFINE_GB_MOB64 1136 | 1226 | #define SVGA_3D_CMD_REDEFINE_GB_MOB64 1136 |
1227 | #define SVGA_3D_CMD_NOP_ERROR 1137 | ||
1228 | |||
1229 | #define SVGA_3D_CMD_RESERVED1 1138 | ||
1230 | #define SVGA_3D_CMD_RESERVED2 1139 | ||
1231 | #define SVGA_3D_CMD_RESERVED3 1140 | ||
1232 | #define SVGA_3D_CMD_RESERVED4 1141 | ||
1233 | #define SVGA_3D_CMD_RESERVED5 1142 | ||
1229 | 1234 | ||
1230 | #define SVGA_3D_CMD_MAX 1142 | 1235 | #define SVGA_3D_CMD_MAX 1142 |
1231 | #define SVGA_3D_CMD_FUTURE_MAX 3000 | 1236 | #define SVGA_3D_CMD_FUTURE_MAX 3000 |
@@ -1973,8 +1978,7 @@ struct { | |||
1973 | uint32 sizeInBytes; | 1978 | uint32 sizeInBytes; |
1974 | uint32 validSizeInBytes; | 1979 | uint32 validSizeInBytes; |
1975 | SVGAMobFormat ptDepth; | 1980 | SVGAMobFormat ptDepth; |
1976 | } | 1981 | } __packed |
1977 | __attribute__((__packed__)) | ||
1978 | SVGA3dCmdSetOTableBase; /* SVGA_3D_CMD_SET_OTABLE_BASE */ | 1982 | SVGA3dCmdSetOTableBase; /* SVGA_3D_CMD_SET_OTABLE_BASE */ |
1979 | 1983 | ||
1980 | typedef | 1984 | typedef |
@@ -1984,15 +1988,13 @@ struct { | |||
1984 | uint32 sizeInBytes; | 1988 | uint32 sizeInBytes; |
1985 | uint32 validSizeInBytes; | 1989 | uint32 validSizeInBytes; |
1986 | SVGAMobFormat ptDepth; | 1990 | SVGAMobFormat ptDepth; |
1987 | } | 1991 | } __packed |
1988 | __attribute__((__packed__)) | ||
1989 | SVGA3dCmdSetOTableBase64; /* SVGA_3D_CMD_SET_OTABLE_BASE64 */ | 1992 | SVGA3dCmdSetOTableBase64; /* SVGA_3D_CMD_SET_OTABLE_BASE64 */ |
1990 | 1993 | ||
1991 | typedef | 1994 | typedef |
1992 | struct { | 1995 | struct { |
1993 | SVGAOTableType type; | 1996 | SVGAOTableType type; |
1994 | } | 1997 | } __packed |
1995 | __attribute__((__packed__)) | ||
1996 | SVGA3dCmdReadbackOTable; /* SVGA_3D_CMD_READBACK_OTABLE */ | 1998 | SVGA3dCmdReadbackOTable; /* SVGA_3D_CMD_READBACK_OTABLE */ |
1997 | 1999 | ||
1998 | /* | 2000 | /* |
@@ -2005,8 +2007,7 @@ struct SVGA3dCmdDefineGBMob { | |||
2005 | SVGAMobFormat ptDepth; | 2007 | SVGAMobFormat ptDepth; |
2006 | PPN base; | 2008 | PPN base; |
2007 | uint32 sizeInBytes; | 2009 | uint32 sizeInBytes; |
2008 | } | 2010 | } __packed |
2009 | __attribute__((__packed__)) | ||
2010 | SVGA3dCmdDefineGBMob; /* SVGA_3D_CMD_DEFINE_GB_MOB */ | 2011 | SVGA3dCmdDefineGBMob; /* SVGA_3D_CMD_DEFINE_GB_MOB */ |
2011 | 2012 | ||
2012 | 2013 | ||
@@ -2017,8 +2018,7 @@ SVGA3dCmdDefineGBMob; /* SVGA_3D_CMD_DEFINE_GB_MOB */ | |||
2017 | typedef | 2018 | typedef |
2018 | struct SVGA3dCmdDestroyGBMob { | 2019 | struct SVGA3dCmdDestroyGBMob { |
2019 | SVGAMobId mobid; | 2020 | SVGAMobId mobid; |
2020 | } | 2021 | } __packed |
2021 | __attribute__((__packed__)) | ||
2022 | SVGA3dCmdDestroyGBMob; /* SVGA_3D_CMD_DESTROY_GB_MOB */ | 2022 | SVGA3dCmdDestroyGBMob; /* SVGA_3D_CMD_DESTROY_GB_MOB */ |
2023 | 2023 | ||
2024 | /* | 2024 | /* |
@@ -2031,8 +2031,7 @@ struct SVGA3dCmdRedefineGBMob { | |||
2031 | SVGAMobFormat ptDepth; | 2031 | SVGAMobFormat ptDepth; |
2032 | PPN base; | 2032 | PPN base; |
2033 | uint32 sizeInBytes; | 2033 | uint32 sizeInBytes; |
2034 | } | 2034 | } __packed |
2035 | __attribute__((__packed__)) | ||
2036 | SVGA3dCmdRedefineGBMob; /* SVGA_3D_CMD_REDEFINE_GB_MOB */ | 2035 | SVGA3dCmdRedefineGBMob; /* SVGA_3D_CMD_REDEFINE_GB_MOB */ |
2037 | 2036 | ||
2038 | /* | 2037 | /* |
@@ -2045,8 +2044,7 @@ struct SVGA3dCmdDefineGBMob64 { | |||
2045 | SVGAMobFormat ptDepth; | 2044 | SVGAMobFormat ptDepth; |
2046 | PPN64 base; | 2045 | PPN64 base; |
2047 | uint32 sizeInBytes; | 2046 | uint32 sizeInBytes; |
2048 | } | 2047 | } __packed |
2049 | __attribute__((__packed__)) | ||
2050 | SVGA3dCmdDefineGBMob64; /* SVGA_3D_CMD_DEFINE_GB_MOB64 */ | 2048 | SVGA3dCmdDefineGBMob64; /* SVGA_3D_CMD_DEFINE_GB_MOB64 */ |
2051 | 2049 | ||
2052 | /* | 2050 | /* |
@@ -2059,8 +2057,7 @@ struct SVGA3dCmdRedefineGBMob64 { | |||
2059 | SVGAMobFormat ptDepth; | 2057 | SVGAMobFormat ptDepth; |
2060 | PPN64 base; | 2058 | PPN64 base; |
2061 | uint32 sizeInBytes; | 2059 | uint32 sizeInBytes; |
2062 | } | 2060 | } __packed |
2063 | __attribute__((__packed__)) | ||
2064 | SVGA3dCmdRedefineGBMob64; /* SVGA_3D_CMD_REDEFINE_GB_MOB64 */ | 2061 | SVGA3dCmdRedefineGBMob64; /* SVGA_3D_CMD_REDEFINE_GB_MOB64 */ |
2065 | 2062 | ||
2066 | /* | 2063 | /* |
@@ -2070,8 +2067,7 @@ SVGA3dCmdRedefineGBMob64; /* SVGA_3D_CMD_REDEFINE_GB_MOB64 */ | |||
2070 | typedef | 2067 | typedef |
2071 | struct SVGA3dCmdUpdateGBMobMapping { | 2068 | struct SVGA3dCmdUpdateGBMobMapping { |
2072 | SVGAMobId mobid; | 2069 | SVGAMobId mobid; |
2073 | } | 2070 | } __packed |
2074 | __attribute__((__packed__)) | ||
2075 | SVGA3dCmdUpdateGBMobMapping; /* SVGA_3D_CMD_UPDATE_GB_MOB_MAPPING */ | 2071 | SVGA3dCmdUpdateGBMobMapping; /* SVGA_3D_CMD_UPDATE_GB_MOB_MAPPING */ |
2076 | 2072 | ||
2077 | /* | 2073 | /* |
@@ -2087,7 +2083,8 @@ struct SVGA3dCmdDefineGBSurface { | |||
2087 | uint32 multisampleCount; | 2083 | uint32 multisampleCount; |
2088 | SVGA3dTextureFilter autogenFilter; | 2084 | SVGA3dTextureFilter autogenFilter; |
2089 | SVGA3dSize size; | 2085 | SVGA3dSize size; |
2090 | } SVGA3dCmdDefineGBSurface; /* SVGA_3D_CMD_DEFINE_GB_SURFACE */ | 2086 | } __packed |
2087 | SVGA3dCmdDefineGBSurface; /* SVGA_3D_CMD_DEFINE_GB_SURFACE */ | ||
2091 | 2088 | ||
2092 | /* | 2089 | /* |
2093 | * Destroy a guest-backed surface. | 2090 | * Destroy a guest-backed surface. |
@@ -2096,7 +2093,8 @@ struct SVGA3dCmdDefineGBSurface { | |||
2096 | typedef | 2093 | typedef |
2097 | struct SVGA3dCmdDestroyGBSurface { | 2094 | struct SVGA3dCmdDestroyGBSurface { |
2098 | uint32 sid; | 2095 | uint32 sid; |
2099 | } SVGA3dCmdDestroyGBSurface; /* SVGA_3D_CMD_DESTROY_GB_SURFACE */ | 2096 | } __packed |
2097 | SVGA3dCmdDestroyGBSurface; /* SVGA_3D_CMD_DESTROY_GB_SURFACE */ | ||
2100 | 2098 | ||
2101 | /* | 2099 | /* |
2102 | * Bind a guest-backed surface to an object. | 2100 | * Bind a guest-backed surface to an object. |
@@ -2106,7 +2104,8 @@ typedef | |||
2106 | struct SVGA3dCmdBindGBSurface { | 2104 | struct SVGA3dCmdBindGBSurface { |
2107 | uint32 sid; | 2105 | uint32 sid; |
2108 | SVGAMobId mobid; | 2106 | SVGAMobId mobid; |
2109 | } SVGA3dCmdBindGBSurface; /* SVGA_3D_CMD_BIND_GB_SURFACE */ | 2107 | } __packed |
2108 | SVGA3dCmdBindGBSurface; /* SVGA_3D_CMD_BIND_GB_SURFACE */ | ||
2110 | 2109 | ||
2111 | /* | 2110 | /* |
2112 | * Conditionally bind a mob to a guest backed surface if testMobid | 2111 | * Conditionally bind a mob to a guest backed surface if testMobid |
@@ -2123,7 +2122,7 @@ struct{ | |||
2123 | SVGAMobId testMobid; | 2122 | SVGAMobId testMobid; |
2124 | SVGAMobId mobid; | 2123 | SVGAMobId mobid; |
2125 | uint32 flags; | 2124 | uint32 flags; |
2126 | } | 2125 | } __packed |
2127 | SVGA3dCmdCondBindGBSurface; /* SVGA_3D_CMD_COND_BIND_GB_SURFACE */ | 2126 | SVGA3dCmdCondBindGBSurface; /* SVGA_3D_CMD_COND_BIND_GB_SURFACE */ |
2128 | 2127 | ||
2129 | /* | 2128 | /* |
@@ -2135,7 +2134,8 @@ typedef | |||
2135 | struct SVGA3dCmdUpdateGBImage { | 2134 | struct SVGA3dCmdUpdateGBImage { |
2136 | SVGA3dSurfaceImageId image; | 2135 | SVGA3dSurfaceImageId image; |
2137 | SVGA3dBox box; | 2136 | SVGA3dBox box; |
2138 | } SVGA3dCmdUpdateGBImage; /* SVGA_3D_CMD_UPDATE_GB_IMAGE */ | 2137 | } __packed |
2138 | SVGA3dCmdUpdateGBImage; /* SVGA_3D_CMD_UPDATE_GB_IMAGE */ | ||
2139 | 2139 | ||
2140 | /* | 2140 | /* |
2141 | * Update an entire guest-backed surface. | 2141 | * Update an entire guest-backed surface. |
@@ -2145,7 +2145,8 @@ struct SVGA3dCmdUpdateGBImage { | |||
2145 | typedef | 2145 | typedef |
2146 | struct SVGA3dCmdUpdateGBSurface { | 2146 | struct SVGA3dCmdUpdateGBSurface { |
2147 | uint32 sid; | 2147 | uint32 sid; |
2148 | } SVGA3dCmdUpdateGBSurface; /* SVGA_3D_CMD_UPDATE_GB_SURFACE */ | 2148 | } __packed |
2149 | SVGA3dCmdUpdateGBSurface; /* SVGA_3D_CMD_UPDATE_GB_SURFACE */ | ||
2149 | 2150 | ||
2150 | /* | 2151 | /* |
2151 | * Readback an image in a guest-backed surface. | 2152 | * Readback an image in a guest-backed surface. |
@@ -2155,7 +2156,8 @@ struct SVGA3dCmdUpdateGBSurface { | |||
2155 | typedef | 2156 | typedef |
2156 | struct SVGA3dCmdReadbackGBImage { | 2157 | struct SVGA3dCmdReadbackGBImage { |
2157 | SVGA3dSurfaceImageId image; | 2158 | SVGA3dSurfaceImageId image; |
2158 | } SVGA3dCmdReadbackGBImage; /* SVGA_3D_CMD_READBACK_GB_IMAGE*/ | 2159 | } __packed |
2160 | SVGA3dCmdReadbackGBImage; /* SVGA_3D_CMD_READBACK_GB_IMAGE*/ | ||
2159 | 2161 | ||
2160 | /* | 2162 | /* |
2161 | * Readback an entire guest-backed surface. | 2163 | * Readback an entire guest-backed surface. |
@@ -2165,7 +2167,8 @@ struct SVGA3dCmdReadbackGBImage { | |||
2165 | typedef | 2167 | typedef |
2166 | struct SVGA3dCmdReadbackGBSurface { | 2168 | struct SVGA3dCmdReadbackGBSurface { |
2167 | uint32 sid; | 2169 | uint32 sid; |
2168 | } SVGA3dCmdReadbackGBSurface; /* SVGA_3D_CMD_READBACK_GB_SURFACE */ | 2170 | } __packed |
2171 | SVGA3dCmdReadbackGBSurface; /* SVGA_3D_CMD_READBACK_GB_SURFACE */ | ||
2169 | 2172 | ||
2170 | /* | 2173 | /* |
2171 | * Readback a sub rect of an image in a guest-backed surface. After | 2174 | * Readback a sub rect of an image in a guest-backed surface. After |
@@ -2179,7 +2182,7 @@ struct SVGA3dCmdReadbackGBImagePartial { | |||
2179 | SVGA3dSurfaceImageId image; | 2182 | SVGA3dSurfaceImageId image; |
2180 | SVGA3dBox box; | 2183 | SVGA3dBox box; |
2181 | uint32 invertBox; | 2184 | uint32 invertBox; |
2182 | } | 2185 | } __packed |
2183 | SVGA3dCmdReadbackGBImagePartial; /* SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL */ | 2186 | SVGA3dCmdReadbackGBImagePartial; /* SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL */ |
2184 | 2187 | ||
2185 | /* | 2188 | /* |
@@ -2190,7 +2193,8 @@ SVGA3dCmdReadbackGBImagePartial; /* SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL */ | |||
2190 | typedef | 2193 | typedef |
2191 | struct SVGA3dCmdInvalidateGBImage { | 2194 | struct SVGA3dCmdInvalidateGBImage { |
2192 | SVGA3dSurfaceImageId image; | 2195 | SVGA3dSurfaceImageId image; |
2193 | } SVGA3dCmdInvalidateGBImage; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE */ | 2196 | } __packed |
2197 | SVGA3dCmdInvalidateGBImage; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE */ | ||
2194 | 2198 | ||
2195 | /* | 2199 | /* |
2196 | * Invalidate an entire guest-backed surface. | 2200 | * Invalidate an entire guest-backed surface. |
@@ -2200,7 +2204,8 @@ struct SVGA3dCmdInvalidateGBImage { | |||
2200 | typedef | 2204 | typedef |
2201 | struct SVGA3dCmdInvalidateGBSurface { | 2205 | struct SVGA3dCmdInvalidateGBSurface { |
2202 | uint32 sid; | 2206 | uint32 sid; |
2203 | } SVGA3dCmdInvalidateGBSurface; /* SVGA_3D_CMD_INVALIDATE_GB_SURFACE */ | 2207 | } __packed |
2208 | SVGA3dCmdInvalidateGBSurface; /* SVGA_3D_CMD_INVALIDATE_GB_SURFACE */ | ||
2204 | 2209 | ||
2205 | /* | 2210 | /* |
2206 | * Invalidate a sub rect of an image in a guest-backed surface. After | 2211 | * Invalidate a sub rect of an image in a guest-backed surface. After |
@@ -2214,7 +2219,7 @@ struct SVGA3dCmdInvalidateGBImagePartial { | |||
2214 | SVGA3dSurfaceImageId image; | 2219 | SVGA3dSurfaceImageId image; |
2215 | SVGA3dBox box; | 2220 | SVGA3dBox box; |
2216 | uint32 invertBox; | 2221 | uint32 invertBox; |
2217 | } | 2222 | } __packed |
2218 | SVGA3dCmdInvalidateGBImagePartial; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL */ | 2223 | SVGA3dCmdInvalidateGBImagePartial; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL */ |
2219 | 2224 | ||
2220 | /* | 2225 | /* |
@@ -2224,7 +2229,8 @@ SVGA3dCmdInvalidateGBImagePartial; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL */ | |||
2224 | typedef | 2229 | typedef |
2225 | struct SVGA3dCmdDefineGBContext { | 2230 | struct SVGA3dCmdDefineGBContext { |
2226 | uint32 cid; | 2231 | uint32 cid; |
2227 | } SVGA3dCmdDefineGBContext; /* SVGA_3D_CMD_DEFINE_GB_CONTEXT */ | 2232 | } __packed |
2233 | SVGA3dCmdDefineGBContext; /* SVGA_3D_CMD_DEFINE_GB_CONTEXT */ | ||
2228 | 2234 | ||
2229 | /* | 2235 | /* |
2230 | * Destroy a guest-backed context. | 2236 | * Destroy a guest-backed context. |
@@ -2233,7 +2239,8 @@ struct SVGA3dCmdDefineGBContext { | |||
2233 | typedef | 2239 | typedef |
2234 | struct SVGA3dCmdDestroyGBContext { | 2240 | struct SVGA3dCmdDestroyGBContext { |
2235 | uint32 cid; | 2241 | uint32 cid; |
2236 | } SVGA3dCmdDestroyGBContext; /* SVGA_3D_CMD_DESTROY_GB_CONTEXT */ | 2242 | } __packed |
2243 | SVGA3dCmdDestroyGBContext; /* SVGA_3D_CMD_DESTROY_GB_CONTEXT */ | ||
2237 | 2244 | ||
2238 | /* | 2245 | /* |
2239 | * Bind a guest-backed context. | 2246 | * Bind a guest-backed context. |
@@ -2252,7 +2259,8 @@ struct SVGA3dCmdBindGBContext { | |||
2252 | uint32 cid; | 2259 | uint32 cid; |
2253 | SVGAMobId mobid; | 2260 | SVGAMobId mobid; |
2254 | uint32 validContents; | 2261 | uint32 validContents; |
2255 | } SVGA3dCmdBindGBContext; /* SVGA_3D_CMD_BIND_GB_CONTEXT */ | 2262 | } __packed |
2263 | SVGA3dCmdBindGBContext; /* SVGA_3D_CMD_BIND_GB_CONTEXT */ | ||
2256 | 2264 | ||
2257 | /* | 2265 | /* |
2258 | * Readback a guest-backed context. | 2266 | * Readback a guest-backed context. |
@@ -2262,7 +2270,8 @@ struct SVGA3dCmdBindGBContext { | |||
2262 | typedef | 2270 | typedef |
2263 | struct SVGA3dCmdReadbackGBContext { | 2271 | struct SVGA3dCmdReadbackGBContext { |
2264 | uint32 cid; | 2272 | uint32 cid; |
2265 | } SVGA3dCmdReadbackGBContext; /* SVGA_3D_CMD_READBACK_GB_CONTEXT */ | 2273 | } __packed |
2274 | SVGA3dCmdReadbackGBContext; /* SVGA_3D_CMD_READBACK_GB_CONTEXT */ | ||
2266 | 2275 | ||
2267 | /* | 2276 | /* |
2268 | * Invalidate a guest-backed context. | 2277 | * Invalidate a guest-backed context. |
@@ -2270,7 +2279,8 @@ struct SVGA3dCmdReadbackGBContext { | |||
2270 | typedef | 2279 | typedef |
2271 | struct SVGA3dCmdInvalidateGBContext { | 2280 | struct SVGA3dCmdInvalidateGBContext { |
2272 | uint32 cid; | 2281 | uint32 cid; |
2273 | } SVGA3dCmdInvalidateGBContext; /* SVGA_3D_CMD_INVALIDATE_GB_CONTEXT */ | 2282 | } __packed |
2283 | SVGA3dCmdInvalidateGBContext; /* SVGA_3D_CMD_INVALIDATE_GB_CONTEXT */ | ||
2274 | 2284 | ||
2275 | /* | 2285 | /* |
2276 | * Define a guest-backed shader. | 2286 | * Define a guest-backed shader. |
@@ -2281,7 +2291,8 @@ struct SVGA3dCmdDefineGBShader { | |||
2281 | uint32 shid; | 2291 | uint32 shid; |
2282 | SVGA3dShaderType type; | 2292 | SVGA3dShaderType type; |
2283 | uint32 sizeInBytes; | 2293 | uint32 sizeInBytes; |
2284 | } SVGA3dCmdDefineGBShader; /* SVGA_3D_CMD_DEFINE_GB_SHADER */ | 2294 | } __packed |
2295 | SVGA3dCmdDefineGBShader; /* SVGA_3D_CMD_DEFINE_GB_SHADER */ | ||
2285 | 2296 | ||
2286 | /* | 2297 | /* |
2287 | * Bind a guest-backed shader. | 2298 | * Bind a guest-backed shader. |
@@ -2291,7 +2302,8 @@ typedef struct SVGA3dCmdBindGBShader { | |||
2291 | uint32 shid; | 2302 | uint32 shid; |
2292 | SVGAMobId mobid; | 2303 | SVGAMobId mobid; |
2293 | uint32 offsetInBytes; | 2304 | uint32 offsetInBytes; |
2294 | } SVGA3dCmdBindGBShader; /* SVGA_3D_CMD_BIND_GB_SHADER */ | 2305 | } __packed |
2306 | SVGA3dCmdBindGBShader; /* SVGA_3D_CMD_BIND_GB_SHADER */ | ||
2295 | 2307 | ||
2296 | /* | 2308 | /* |
2297 | * Destroy a guest-backed shader. | 2309 | * Destroy a guest-backed shader. |
@@ -2299,7 +2311,8 @@ typedef struct SVGA3dCmdBindGBShader { | |||
2299 | 2311 | ||
2300 | typedef struct SVGA3dCmdDestroyGBShader { | 2312 | typedef struct SVGA3dCmdDestroyGBShader { |
2301 | uint32 shid; | 2313 | uint32 shid; |
2302 | } SVGA3dCmdDestroyGBShader; /* SVGA_3D_CMD_DESTROY_GB_SHADER */ | 2314 | } __packed |
2315 | SVGA3dCmdDestroyGBShader; /* SVGA_3D_CMD_DESTROY_GB_SHADER */ | ||
2303 | 2316 | ||
2304 | typedef | 2317 | typedef |
2305 | struct { | 2318 | struct { |
@@ -2314,14 +2327,16 @@ struct { | |||
2314 | * Note that FLOAT and INT constants are 4-dwords in length, while | 2327 | * Note that FLOAT and INT constants are 4-dwords in length, while |
2315 | * BOOL constants are 1-dword in length. | 2328 | * BOOL constants are 1-dword in length. |
2316 | */ | 2329 | */ |
2317 | } SVGA3dCmdSetGBShaderConstInline; | 2330 | } __packed |
2331 | SVGA3dCmdSetGBShaderConstInline; | ||
2318 | /* SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE */ | 2332 | /* SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE */ |
2319 | 2333 | ||
2320 | typedef | 2334 | typedef |
2321 | struct { | 2335 | struct { |
2322 | uint32 cid; | 2336 | uint32 cid; |
2323 | SVGA3dQueryType type; | 2337 | SVGA3dQueryType type; |
2324 | } SVGA3dCmdBeginGBQuery; /* SVGA_3D_CMD_BEGIN_GB_QUERY */ | 2338 | } __packed |
2339 | SVGA3dCmdBeginGBQuery; /* SVGA_3D_CMD_BEGIN_GB_QUERY */ | ||
2325 | 2340 | ||
2326 | typedef | 2341 | typedef |
2327 | struct { | 2342 | struct { |
@@ -2329,7 +2344,8 @@ struct { | |||
2329 | SVGA3dQueryType type; | 2344 | SVGA3dQueryType type; |
2330 | SVGAMobId mobid; | 2345 | SVGAMobId mobid; |
2331 | uint32 offset; | 2346 | uint32 offset; |
2332 | } SVGA3dCmdEndGBQuery; /* SVGA_3D_CMD_END_GB_QUERY */ | 2347 | } __packed |
2348 | SVGA3dCmdEndGBQuery; /* SVGA_3D_CMD_END_GB_QUERY */ | ||
2333 | 2349 | ||
2334 | 2350 | ||
2335 | /* | 2351 | /* |
@@ -2346,21 +2362,22 @@ struct { | |||
2346 | SVGA3dQueryType type; | 2362 | SVGA3dQueryType type; |
2347 | SVGAMobId mobid; | 2363 | SVGAMobId mobid; |
2348 | uint32 offset; | 2364 | uint32 offset; |
2349 | } SVGA3dCmdWaitForGBQuery; /* SVGA_3D_CMD_WAIT_FOR_GB_QUERY */ | 2365 | } __packed |
2366 | SVGA3dCmdWaitForGBQuery; /* SVGA_3D_CMD_WAIT_FOR_GB_QUERY */ | ||
2350 | 2367 | ||
2351 | typedef | 2368 | typedef |
2352 | struct { | 2369 | struct { |
2353 | SVGAMobId mobid; | 2370 | SVGAMobId mobid; |
2354 | uint32 fbOffset; | 2371 | uint32 fbOffset; |
2355 | uint32 initalized; | 2372 | uint32 initalized; |
2356 | } | 2373 | } __packed |
2357 | SVGA3dCmdEnableGart; /* SVGA_3D_CMD_ENABLE_GART */ | 2374 | SVGA3dCmdEnableGart; /* SVGA_3D_CMD_ENABLE_GART */ |
2358 | 2375 | ||
2359 | typedef | 2376 | typedef |
2360 | struct { | 2377 | struct { |
2361 | SVGAMobId mobid; | 2378 | SVGAMobId mobid; |
2362 | uint32 gartOffset; | 2379 | uint32 gartOffset; |
2363 | } | 2380 | } __packed |
2364 | SVGA3dCmdMapMobIntoGart; /* SVGA_3D_CMD_MAP_MOB_INTO_GART */ | 2381 | SVGA3dCmdMapMobIntoGart; /* SVGA_3D_CMD_MAP_MOB_INTO_GART */ |
2365 | 2382 | ||
2366 | 2383 | ||
@@ -2368,7 +2385,7 @@ typedef | |||
2368 | struct { | 2385 | struct { |
2369 | uint32 gartOffset; | 2386 | uint32 gartOffset; |
2370 | uint32 numPages; | 2387 | uint32 numPages; |
2371 | } | 2388 | } __packed |
2372 | SVGA3dCmdUnmapGartRange; /* SVGA_3D_CMD_UNMAP_GART_RANGE */ | 2389 | SVGA3dCmdUnmapGartRange; /* SVGA_3D_CMD_UNMAP_GART_RANGE */ |
2373 | 2390 | ||
2374 | 2391 | ||
@@ -2385,27 +2402,27 @@ struct { | |||
2385 | int32 xRoot; | 2402 | int32 xRoot; |
2386 | int32 yRoot; | 2403 | int32 yRoot; |
2387 | uint32 flags; | 2404 | uint32 flags; |
2388 | } | 2405 | } __packed |
2389 | SVGA3dCmdDefineGBScreenTarget; /* SVGA_3D_CMD_DEFINE_GB_SCREENTARGET */ | 2406 | SVGA3dCmdDefineGBScreenTarget; /* SVGA_3D_CMD_DEFINE_GB_SCREENTARGET */ |
2390 | 2407 | ||
2391 | typedef | 2408 | typedef |
2392 | struct { | 2409 | struct { |
2393 | uint32 stid; | 2410 | uint32 stid; |
2394 | } | 2411 | } __packed |
2395 | SVGA3dCmdDestroyGBScreenTarget; /* SVGA_3D_CMD_DESTROY_GB_SCREENTARGET */ | 2412 | SVGA3dCmdDestroyGBScreenTarget; /* SVGA_3D_CMD_DESTROY_GB_SCREENTARGET */ |
2396 | 2413 | ||
2397 | typedef | 2414 | typedef |
2398 | struct { | 2415 | struct { |
2399 | uint32 stid; | 2416 | uint32 stid; |
2400 | SVGA3dSurfaceImageId image; | 2417 | SVGA3dSurfaceImageId image; |
2401 | } | 2418 | } __packed |
2402 | SVGA3dCmdBindGBScreenTarget; /* SVGA_3D_CMD_BIND_GB_SCREENTARGET */ | 2419 | SVGA3dCmdBindGBScreenTarget; /* SVGA_3D_CMD_BIND_GB_SCREENTARGET */ |
2403 | 2420 | ||
2404 | typedef | 2421 | typedef |
2405 | struct { | 2422 | struct { |
2406 | uint32 stid; | 2423 | uint32 stid; |
2407 | SVGA3dBox box; | 2424 | SVGA3dBox box; |
2408 | } | 2425 | } __packed |
2409 | SVGA3dCmdUpdateGBScreenTarget; /* SVGA_3D_CMD_UPDATE_GB_SCREENTARGET */ | 2426 | SVGA3dCmdUpdateGBScreenTarget; /* SVGA_3D_CMD_UPDATE_GB_SCREENTARGET */ |
2410 | 2427 | ||
2411 | /* | 2428 | /* |
diff --git a/drivers/gpu/drm/vmwgfx/svga3d_surfacedefs.h b/drivers/gpu/drm/vmwgfx/svga3d_surfacedefs.h index 8369c3ba10fe..ef3385096145 100644 --- a/drivers/gpu/drm/vmwgfx/svga3d_surfacedefs.h +++ b/drivers/gpu/drm/vmwgfx/svga3d_surfacedefs.h | |||
@@ -38,8 +38,11 @@ | |||
38 | 38 | ||
39 | #define DIV_ROUND_UP(x, y) (((x) + (y) - 1) / (y)) | 39 | #define DIV_ROUND_UP(x, y) (((x) + (y) - 1) / (y)) |
40 | #define max_t(type, x, y) ((x) > (y) ? (x) : (y)) | 40 | #define max_t(type, x, y) ((x) > (y) ? (x) : (y)) |
41 | #define min_t(type, x, y) ((x) < (y) ? (x) : (y)) | ||
41 | #define surf_size_struct SVGA3dSize | 42 | #define surf_size_struct SVGA3dSize |
42 | #define u32 uint32 | 43 | #define u32 uint32 |
44 | #define u64 uint64_t | ||
45 | #define U32_MAX ((u32)~0U) | ||
43 | 46 | ||
44 | #endif /* __KERNEL__ */ | 47 | #endif /* __KERNEL__ */ |
45 | 48 | ||
@@ -704,8 +707,8 @@ static const struct svga3d_surface_desc svga3d_surface_descs[] = { | |||
704 | 707 | ||
705 | static inline u32 clamped_umul32(u32 a, u32 b) | 708 | static inline u32 clamped_umul32(u32 a, u32 b) |
706 | { | 709 | { |
707 | uint64_t tmp = (uint64_t) a*b; | 710 | u64 tmp = (u64) a*b; |
708 | return (tmp > (uint64_t) ((u32) -1)) ? (u32) -1 : tmp; | 711 | return (tmp > (u64) U32_MAX) ? U32_MAX : tmp; |
709 | } | 712 | } |
710 | 713 | ||
711 | static inline const struct svga3d_surface_desc * | 714 | static inline const struct svga3d_surface_desc * |
@@ -834,7 +837,7 @@ svga3dsurface_get_serialized_size(SVGA3dSurfaceFormat format, | |||
834 | bool cubemap) | 837 | bool cubemap) |
835 | { | 838 | { |
836 | const struct svga3d_surface_desc *desc = svga3dsurface_get_desc(format); | 839 | const struct svga3d_surface_desc *desc = svga3dsurface_get_desc(format); |
837 | u32 total_size = 0; | 840 | u64 total_size = 0; |
838 | u32 mip; | 841 | u32 mip; |
839 | 842 | ||
840 | for (mip = 0; mip < num_mip_levels; mip++) { | 843 | for (mip = 0; mip < num_mip_levels; mip++) { |
@@ -847,7 +850,7 @@ svga3dsurface_get_serialized_size(SVGA3dSurfaceFormat format, | |||
847 | if (cubemap) | 850 | if (cubemap) |
848 | total_size *= SVGA3D_MAX_SURFACE_FACES; | 851 | total_size *= SVGA3D_MAX_SURFACE_FACES; |
849 | 852 | ||
850 | return total_size; | 853 | return (u32) min_t(u64, total_size, (u64) U32_MAX); |
851 | } | 854 | } |
852 | 855 | ||
853 | 856 | ||
diff --git a/drivers/gpu/drm/vmwgfx/svga_reg.h b/drivers/gpu/drm/vmwgfx/svga_reg.h index 71defa4d2d75..11323dd5196f 100644 --- a/drivers/gpu/drm/vmwgfx/svga_reg.h +++ b/drivers/gpu/drm/vmwgfx/svga_reg.h | |||
@@ -169,10 +169,17 @@ enum { | |||
169 | SVGA_REG_TRACES = 45, /* Enable trace-based updates even when FIFO is on */ | 169 | SVGA_REG_TRACES = 45, /* Enable trace-based updates even when FIFO is on */ |
170 | SVGA_REG_GMRS_MAX_PAGES = 46, /* Maximum number of 4KB pages for all GMRs */ | 170 | SVGA_REG_GMRS_MAX_PAGES = 46, /* Maximum number of 4KB pages for all GMRs */ |
171 | SVGA_REG_MEMORY_SIZE = 47, /* Total dedicated device memory excluding FIFO */ | 171 | SVGA_REG_MEMORY_SIZE = 47, /* Total dedicated device memory excluding FIFO */ |
172 | SVGA_REG_COMMAND_LOW = 48, /* Lower 32 bits and submits commands */ | ||
173 | SVGA_REG_COMMAND_HIGH = 49, /* Upper 32 bits of command buffer PA */ | ||
172 | SVGA_REG_MAX_PRIMARY_BOUNDING_BOX_MEM = 50, /* Max primary memory */ | 174 | SVGA_REG_MAX_PRIMARY_BOUNDING_BOX_MEM = 50, /* Max primary memory */ |
173 | SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB = 51, /* Suggested limit on mob mem */ | 175 | SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB = 51, /* Suggested limit on mob mem */ |
174 | SVGA_REG_DEV_CAP = 52, /* Write dev cap index, read value */ | 176 | SVGA_REG_DEV_CAP = 52, /* Write dev cap index, read value */ |
175 | SVGA_REG_TOP = 53, /* Must be 1 more than the last register */ | 177 | SVGA_REG_CMD_PREPEND_LOW = 53, |
178 | SVGA_REG_CMD_PREPEND_HIGH = 54, | ||
179 | SVGA_REG_SCREENTARGET_MAX_WIDTH = 55, | ||
180 | SVGA_REG_SCREENTARGET_MAX_HEIGHT = 56, | ||
181 | SVGA_REG_MOB_MAX_SIZE = 57, | ||
182 | SVGA_REG_TOP = 58, /* Must be 1 more than the last register */ | ||
176 | 183 | ||
177 | SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */ | 184 | SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */ |
178 | /* Next 768 (== 256*3) registers exist for colormap */ | 185 | /* Next 768 (== 256*3) registers exist for colormap */ |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c index 9426c53fb483..1e80152674b5 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c | |||
@@ -551,8 +551,7 @@ static int vmw_context_scrub_shader(struct vmw_ctx_bindinfo *bi, bool rebind) | |||
551 | cmd->header.size = sizeof(cmd->body); | 551 | cmd->header.size = sizeof(cmd->body); |
552 | cmd->body.cid = bi->ctx->id; | 552 | cmd->body.cid = bi->ctx->id; |
553 | cmd->body.type = bi->i1.shader_type; | 553 | cmd->body.type = bi->i1.shader_type; |
554 | cmd->body.shid = | 554 | cmd->body.shid = ((rebind) ? bi->res->id : SVGA3D_INVALID_ID); |
555 | cpu_to_le32((rebind) ? bi->res->id : SVGA3D_INVALID_ID); | ||
556 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); | 555 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); |
557 | 556 | ||
558 | return 0; | 557 | return 0; |
@@ -585,8 +584,7 @@ static int vmw_context_scrub_render_target(struct vmw_ctx_bindinfo *bi, | |||
585 | cmd->header.size = sizeof(cmd->body); | 584 | cmd->header.size = sizeof(cmd->body); |
586 | cmd->body.cid = bi->ctx->id; | 585 | cmd->body.cid = bi->ctx->id; |
587 | cmd->body.type = bi->i1.rt_type; | 586 | cmd->body.type = bi->i1.rt_type; |
588 | cmd->body.target.sid = | 587 | cmd->body.target.sid = ((rebind) ? bi->res->id : SVGA3D_INVALID_ID); |
589 | cpu_to_le32((rebind) ? bi->res->id : SVGA3D_INVALID_ID); | ||
590 | cmd->body.target.face = 0; | 588 | cmd->body.target.face = 0; |
591 | cmd->body.target.mipmap = 0; | 589 | cmd->body.target.mipmap = 0; |
592 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); | 590 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); |
@@ -628,8 +626,7 @@ static int vmw_context_scrub_texture(struct vmw_ctx_bindinfo *bi, | |||
628 | cmd->body.c.cid = bi->ctx->id; | 626 | cmd->body.c.cid = bi->ctx->id; |
629 | cmd->body.s1.stage = bi->i1.texture_stage; | 627 | cmd->body.s1.stage = bi->i1.texture_stage; |
630 | cmd->body.s1.name = SVGA3D_TS_BIND_TEXTURE; | 628 | cmd->body.s1.name = SVGA3D_TS_BIND_TEXTURE; |
631 | cmd->body.s1.value = | 629 | cmd->body.s1.value = ((rebind) ? bi->res->id : SVGA3D_INVALID_ID); |
632 | cpu_to_le32((rebind) ? bi->res->id : SVGA3D_INVALID_ID); | ||
633 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); | 630 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); |
634 | 631 | ||
635 | return 0; | 632 | return 0; |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 3bdc0adc656d..0083cbf99edf 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | |||
@@ -667,6 +667,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | |||
667 | dev_priv->memory_size = 512*1024*1024; | 667 | dev_priv->memory_size = 512*1024*1024; |
668 | } | 668 | } |
669 | dev_priv->max_mob_pages = 0; | 669 | dev_priv->max_mob_pages = 0; |
670 | dev_priv->max_mob_size = 0; | ||
670 | if (dev_priv->capabilities & SVGA_CAP_GBOBJECTS) { | 671 | if (dev_priv->capabilities & SVGA_CAP_GBOBJECTS) { |
671 | uint64_t mem_size = | 672 | uint64_t mem_size = |
672 | vmw_read(dev_priv, | 673 | vmw_read(dev_priv, |
@@ -676,6 +677,8 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | |||
676 | dev_priv->prim_bb_mem = | 677 | dev_priv->prim_bb_mem = |
677 | vmw_read(dev_priv, | 678 | vmw_read(dev_priv, |
678 | SVGA_REG_MAX_PRIMARY_BOUNDING_BOX_MEM); | 679 | SVGA_REG_MAX_PRIMARY_BOUNDING_BOX_MEM); |
680 | dev_priv->max_mob_size = | ||
681 | vmw_read(dev_priv, SVGA_REG_MOB_MAX_SIZE); | ||
679 | } else | 682 | } else |
680 | dev_priv->prim_bb_mem = dev_priv->vram_size; | 683 | dev_priv->prim_bb_mem = dev_priv->vram_size; |
681 | 684 | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h index ecaa302a6154..07831554dad7 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | |||
@@ -40,7 +40,7 @@ | |||
40 | #include <drm/ttm/ttm_module.h> | 40 | #include <drm/ttm/ttm_module.h> |
41 | #include "vmwgfx_fence.h" | 41 | #include "vmwgfx_fence.h" |
42 | 42 | ||
43 | #define VMWGFX_DRIVER_DATE "20121114" | 43 | #define VMWGFX_DRIVER_DATE "20140228" |
44 | #define VMWGFX_DRIVER_MAJOR 2 | 44 | #define VMWGFX_DRIVER_MAJOR 2 |
45 | #define VMWGFX_DRIVER_MINOR 5 | 45 | #define VMWGFX_DRIVER_MINOR 5 |
46 | #define VMWGFX_DRIVER_PATCHLEVEL 0 | 46 | #define VMWGFX_DRIVER_PATCHLEVEL 0 |
@@ -386,6 +386,7 @@ struct vmw_private { | |||
386 | uint32_t max_gmr_ids; | 386 | uint32_t max_gmr_ids; |
387 | uint32_t max_gmr_pages; | 387 | uint32_t max_gmr_pages; |
388 | uint32_t max_mob_pages; | 388 | uint32_t max_mob_pages; |
389 | uint32_t max_mob_size; | ||
389 | uint32_t memory_size; | 390 | uint32_t memory_size; |
390 | bool has_gmr; | 391 | bool has_gmr; |
391 | bool has_mob; | 392 | bool has_mob; |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index 269b85cc875a..efb575a7996c 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | |||
@@ -602,7 +602,7 @@ static int vmw_cmd_cid_check(struct vmw_private *dev_priv, | |||
602 | { | 602 | { |
603 | struct vmw_cid_cmd { | 603 | struct vmw_cid_cmd { |
604 | SVGA3dCmdHeader header; | 604 | SVGA3dCmdHeader header; |
605 | __le32 cid; | 605 | uint32_t cid; |
606 | } *cmd; | 606 | } *cmd; |
607 | 607 | ||
608 | cmd = container_of(header, struct vmw_cid_cmd, header); | 608 | cmd = container_of(header, struct vmw_cid_cmd, header); |
@@ -1835,7 +1835,7 @@ static int vmw_cmd_check_not_3d(struct vmw_private *dev_priv, | |||
1835 | return 0; | 1835 | return 0; |
1836 | } | 1836 | } |
1837 | 1837 | ||
1838 | static const struct vmw_cmd_entry const vmw_cmd_entries[SVGA_3D_CMD_MAX] = { | 1838 | static const struct vmw_cmd_entry vmw_cmd_entries[SVGA_3D_CMD_MAX] = { |
1839 | VMW_CMD_DEF(SVGA_3D_CMD_SURFACE_DEFINE, &vmw_cmd_invalid, | 1839 | VMW_CMD_DEF(SVGA_3D_CMD_SURFACE_DEFINE, &vmw_cmd_invalid, |
1840 | false, false, false), | 1840 | false, false, false), |
1841 | VMW_CMD_DEF(SVGA_3D_CMD_SURFACE_DESTROY, &vmw_cmd_invalid, | 1841 | VMW_CMD_DEF(SVGA_3D_CMD_SURFACE_DESTROY, &vmw_cmd_invalid, |
@@ -2032,6 +2032,9 @@ static int vmw_cmd_check(struct vmw_private *dev_priv, | |||
2032 | goto out_invalid; | 2032 | goto out_invalid; |
2033 | 2033 | ||
2034 | entry = &vmw_cmd_entries[cmd_id]; | 2034 | entry = &vmw_cmd_entries[cmd_id]; |
2035 | if (unlikely(!entry->func)) | ||
2036 | goto out_invalid; | ||
2037 | |||
2035 | if (unlikely(!entry->user_allow && !sw_context->kernel)) | 2038 | if (unlikely(!entry->user_allow && !sw_context->kernel)) |
2036 | goto out_privileged; | 2039 | goto out_privileged; |
2037 | 2040 | ||
@@ -2469,7 +2472,7 @@ int vmw_execbuf_process(struct drm_file *file_priv, | |||
2469 | if (dev_priv->has_mob) { | 2472 | if (dev_priv->has_mob) { |
2470 | ret = vmw_rebind_contexts(sw_context); | 2473 | ret = vmw_rebind_contexts(sw_context); |
2471 | if (unlikely(ret != 0)) | 2474 | if (unlikely(ret != 0)) |
2472 | goto out_err; | 2475 | goto out_unlock_binding; |
2473 | } | 2476 | } |
2474 | 2477 | ||
2475 | cmd = vmw_fifo_reserve(dev_priv, command_size); | 2478 | cmd = vmw_fifo_reserve(dev_priv, command_size); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c index f9881f9e62bd..47b70949bf3a 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | |||
@@ -102,6 +102,9 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data, | |||
102 | vmw_fp->gb_aware = true; | 102 | vmw_fp->gb_aware = true; |
103 | param->value = dev_priv->max_mob_pages * PAGE_SIZE; | 103 | param->value = dev_priv->max_mob_pages * PAGE_SIZE; |
104 | break; | 104 | break; |
105 | case DRM_VMW_PARAM_MAX_MOB_SIZE: | ||
106 | param->value = dev_priv->max_mob_size; | ||
107 | break; | ||
105 | default: | 108 | default: |
106 | DRM_ERROR("Illegal vmwgfx get param request: %d\n", | 109 | DRM_ERROR("Illegal vmwgfx get param request: %d\n", |
107 | param->param); | 110 | param->param); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c index d4a5a19cb8c3..04a64b8cd3cd 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c | |||
@@ -188,18 +188,20 @@ static void vmw_takedown_otable_base(struct vmw_private *dev_priv, | |||
188 | 188 | ||
189 | bo = otable->page_table->pt_bo; | 189 | bo = otable->page_table->pt_bo; |
190 | cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd)); | 190 | cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd)); |
191 | if (unlikely(cmd == NULL)) | 191 | if (unlikely(cmd == NULL)) { |
192 | DRM_ERROR("Failed reserving FIFO space for OTable setup.\n"); | 192 | DRM_ERROR("Failed reserving FIFO space for OTable " |
193 | 193 | "takedown.\n"); | |
194 | memset(cmd, 0, sizeof(*cmd)); | 194 | } else { |
195 | cmd->header.id = SVGA_3D_CMD_SET_OTABLE_BASE; | 195 | memset(cmd, 0, sizeof(*cmd)); |
196 | cmd->header.size = sizeof(cmd->body); | 196 | cmd->header.id = SVGA_3D_CMD_SET_OTABLE_BASE; |
197 | cmd->body.type = type; | 197 | cmd->header.size = sizeof(cmd->body); |
198 | cmd->body.baseAddress = 0; | 198 | cmd->body.type = type; |
199 | cmd->body.sizeInBytes = 0; | 199 | cmd->body.baseAddress = 0; |
200 | cmd->body.validSizeInBytes = 0; | 200 | cmd->body.sizeInBytes = 0; |
201 | cmd->body.ptDepth = SVGA3D_MOBFMT_INVALID; | 201 | cmd->body.validSizeInBytes = 0; |
202 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); | 202 | cmd->body.ptDepth = SVGA3D_MOBFMT_INVALID; |
203 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); | ||
204 | } | ||
203 | 205 | ||
204 | if (bo) { | 206 | if (bo) { |
205 | int ret; | 207 | int ret; |
@@ -562,11 +564,12 @@ void vmw_mob_unbind(struct vmw_private *dev_priv, | |||
562 | if (unlikely(cmd == NULL)) { | 564 | if (unlikely(cmd == NULL)) { |
563 | DRM_ERROR("Failed reserving FIFO space for Memory " | 565 | DRM_ERROR("Failed reserving FIFO space for Memory " |
564 | "Object unbinding.\n"); | 566 | "Object unbinding.\n"); |
567 | } else { | ||
568 | cmd->header.id = SVGA_3D_CMD_DESTROY_GB_MOB; | ||
569 | cmd->header.size = sizeof(cmd->body); | ||
570 | cmd->body.mobid = mob->id; | ||
571 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); | ||
565 | } | 572 | } |
566 | cmd->header.id = SVGA_3D_CMD_DESTROY_GB_MOB; | ||
567 | cmd->header.size = sizeof(cmd->body); | ||
568 | cmd->body.mobid = mob->id; | ||
569 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); | ||
570 | if (bo) { | 573 | if (bo) { |
571 | vmw_fence_single_bo(bo, NULL); | 574 | vmw_fence_single_bo(bo, NULL); |
572 | ttm_bo_unreserve(bo); | 575 | ttm_bo_unreserve(bo); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c index 2aa4bc6a4d60..9757b57f8388 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | |||
@@ -427,8 +427,7 @@ int vmw_dmabuf_init(struct vmw_private *dev_priv, | |||
427 | INIT_LIST_HEAD(&vmw_bo->res_list); | 427 | INIT_LIST_HEAD(&vmw_bo->res_list); |
428 | 428 | ||
429 | ret = ttm_bo_init(bdev, &vmw_bo->base, size, | 429 | ret = ttm_bo_init(bdev, &vmw_bo->base, size, |
430 | (user) ? ttm_bo_type_device : | 430 | ttm_bo_type_device, placement, |
431 | ttm_bo_type_kernel, placement, | ||
432 | 0, interruptible, | 431 | 0, interruptible, |
433 | NULL, acc_size, NULL, bo_free); | 432 | NULL, acc_size, NULL, bo_free); |
434 | return ret; | 433 | return ret; |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c index 217d941b8176..ee3856578a12 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c | |||
@@ -371,13 +371,13 @@ int vmw_shader_destroy_ioctl(struct drm_device *dev, void *data, | |||
371 | TTM_REF_USAGE); | 371 | TTM_REF_USAGE); |
372 | } | 372 | } |
373 | 373 | ||
374 | int vmw_shader_alloc(struct vmw_private *dev_priv, | 374 | static int vmw_shader_alloc(struct vmw_private *dev_priv, |
375 | struct vmw_dma_buffer *buffer, | 375 | struct vmw_dma_buffer *buffer, |
376 | size_t shader_size, | 376 | size_t shader_size, |
377 | size_t offset, | 377 | size_t offset, |
378 | SVGA3dShaderType shader_type, | 378 | SVGA3dShaderType shader_type, |
379 | struct ttm_object_file *tfile, | 379 | struct ttm_object_file *tfile, |
380 | u32 *handle) | 380 | u32 *handle) |
381 | { | 381 | { |
382 | struct vmw_user_shader *ushader; | 382 | struct vmw_user_shader *ushader; |
383 | struct vmw_resource *res, *tmp; | 383 | struct vmw_resource *res, *tmp; |
@@ -779,6 +779,8 @@ vmw_compat_shader_man_create(struct vmw_private *dev_priv) | |||
779 | int ret; | 779 | int ret; |
780 | 780 | ||
781 | man = kzalloc(sizeof(*man), GFP_KERNEL); | 781 | man = kzalloc(sizeof(*man), GFP_KERNEL); |
782 | if (man == NULL) | ||
783 | return ERR_PTR(-ENOMEM); | ||
782 | 784 | ||
783 | man->dev_priv = dev_priv; | 785 | man->dev_priv = dev_priv; |
784 | INIT_LIST_HEAD(&man->list); | 786 | INIT_LIST_HEAD(&man->list); |
diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c index 1146e3bba6e1..112f27e51bc7 100644 --- a/drivers/gpu/host1x/job.c +++ b/drivers/gpu/host1x/job.c | |||
@@ -538,7 +538,7 @@ int host1x_job_pin(struct host1x_job *job, struct device *dev) | |||
538 | 538 | ||
539 | g->base = job->gather_addr_phys[i]; | 539 | g->base = job->gather_addr_phys[i]; |
540 | 540 | ||
541 | for (j = 0; j < job->num_gathers; j++) | 541 | for (j = i + 1; j < job->num_gathers; j++) |
542 | if (job->gathers[j].bo == g->bo) | 542 | if (job->gathers[j].bo == g->bo) |
543 | job->gathers[j].handled = true; | 543 | job->gathers[j].handled = true; |
544 | 544 | ||
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c index 497558127bb3..f822fd2a1ada 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c | |||
@@ -469,6 +469,9 @@ static const struct hid_device_id apple_devices[] = { | |||
469 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, | 469 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, |
470 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI), | 470 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI), |
471 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, | 471 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
472 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, | ||
473 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS), | ||
474 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, | ||
472 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS), | 475 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS), |
473 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, | 476 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
474 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI), | 477 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI), |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 3bfac3accd22..cc32a6f96c64 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1679,6 +1679,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1679 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, | 1679 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, |
1680 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI) }, | 1680 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI) }, |
1681 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO) }, | 1681 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO) }, |
1682 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS) }, | ||
1682 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, | 1683 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, |
1683 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, | 1684 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, |
1684 | { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) }, | 1685 | { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) }, |
@@ -1779,6 +1780,8 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1779 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, | 1780 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, |
1780 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) }, | 1781 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) }, |
1781 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) }, | 1782 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) }, |
1783 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_2) }, | ||
1784 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TOUCH_COVER_2) }, | ||
1782 | { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) }, | 1785 | { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) }, |
1783 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) }, | 1786 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) }, |
1784 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1) }, | 1787 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1) }, |
diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c index 8fae6d1414cc..c24908f14934 100644 --- a/drivers/hid/hid-hyperv.c +++ b/drivers/hid/hid-hyperv.c | |||
@@ -157,6 +157,7 @@ struct mousevsc_dev { | |||
157 | u32 report_desc_size; | 157 | u32 report_desc_size; |
158 | struct hv_input_dev_info hid_dev_info; | 158 | struct hv_input_dev_info hid_dev_info; |
159 | struct hid_device *hid_device; | 159 | struct hid_device *hid_device; |
160 | u8 input_buf[HID_MAX_BUFFER_SIZE]; | ||
160 | }; | 161 | }; |
161 | 162 | ||
162 | 163 | ||
@@ -256,6 +257,7 @@ static void mousevsc_on_receive(struct hv_device *device, | |||
256 | struct synthhid_msg *hid_msg; | 257 | struct synthhid_msg *hid_msg; |
257 | struct mousevsc_dev *input_dev = hv_get_drvdata(device); | 258 | struct mousevsc_dev *input_dev = hv_get_drvdata(device); |
258 | struct synthhid_input_report *input_report; | 259 | struct synthhid_input_report *input_report; |
260 | size_t len; | ||
259 | 261 | ||
260 | pipe_msg = (struct pipe_prt_msg *)((unsigned long)packet + | 262 | pipe_msg = (struct pipe_prt_msg *)((unsigned long)packet + |
261 | (packet->offset8 << 3)); | 263 | (packet->offset8 << 3)); |
@@ -300,9 +302,12 @@ static void mousevsc_on_receive(struct hv_device *device, | |||
300 | (struct synthhid_input_report *)pipe_msg->data; | 302 | (struct synthhid_input_report *)pipe_msg->data; |
301 | if (!input_dev->init_complete) | 303 | if (!input_dev->init_complete) |
302 | break; | 304 | break; |
303 | hid_input_report(input_dev->hid_device, | 305 | |
304 | HID_INPUT_REPORT, input_report->buffer, | 306 | len = min(input_report->header.size, |
305 | input_report->header.size, 1); | 307 | (u32)sizeof(input_dev->input_buf)); |
308 | memcpy(input_dev->input_buf, input_report->buffer, len); | ||
309 | hid_input_report(input_dev->hid_device, HID_INPUT_REPORT, | ||
310 | input_dev->input_buf, len, 1); | ||
306 | break; | 311 | break; |
307 | default: | 312 | default: |
308 | pr_err("unsupported hid msg type - type %d len %d", | 313 | pr_err("unsupported hid msg type - type %d len %d", |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 5a5248f2cc07..22f28d6b33a8 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -135,6 +135,7 @@ | |||
135 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b | 135 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b |
136 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI 0x0255 | 136 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI 0x0255 |
137 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO 0x0256 | 137 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO 0x0256 |
138 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS 0x0257 | ||
138 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0290 | 139 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0290 |
139 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0291 | 140 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0291 |
140 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0292 | 141 | #define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0292 |
@@ -240,6 +241,7 @@ | |||
240 | 241 | ||
241 | #define USB_VENDOR_ID_CYGNAL 0x10c4 | 242 | #define USB_VENDOR_ID_CYGNAL 0x10c4 |
242 | #define USB_DEVICE_ID_CYGNAL_RADIO_SI470X 0x818a | 243 | #define USB_DEVICE_ID_CYGNAL_RADIO_SI470X 0x818a |
244 | #define USB_DEVICE_ID_FOCALTECH_FTXXXX_MULTITOUCH 0x81b9 | ||
243 | 245 | ||
244 | #define USB_DEVICE_ID_CYGNAL_RADIO_SI4713 0x8244 | 246 | #define USB_DEVICE_ID_CYGNAL_RADIO_SI4713 0x8244 |
245 | 247 | ||
@@ -451,6 +453,9 @@ | |||
451 | #define USB_VENDOR_ID_INTEL_1 0x8087 | 453 | #define USB_VENDOR_ID_INTEL_1 0x8087 |
452 | #define USB_DEVICE_ID_INTEL_HID_SENSOR 0x09fa | 454 | #define USB_DEVICE_ID_INTEL_HID_SENSOR 0x09fa |
453 | 455 | ||
456 | #define USB_VENDOR_ID_STM_0 0x0483 | ||
457 | #define USB_DEVICE_ID_STM_HID_SENSOR 0x91d1 | ||
458 | |||
454 | #define USB_VENDOR_ID_ION 0x15e4 | 459 | #define USB_VENDOR_ID_ION 0x15e4 |
455 | #define USB_DEVICE_ID_ICADE 0x0132 | 460 | #define USB_DEVICE_ID_ICADE 0x0132 |
456 | 461 | ||
@@ -619,6 +624,8 @@ | |||
619 | #define USB_DEVICE_ID_MS_PRESENTER_8K_USB 0x0713 | 624 | #define USB_DEVICE_ID_MS_PRESENTER_8K_USB 0x0713 |
620 | #define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K 0x0730 | 625 | #define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K 0x0730 |
621 | #define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500 0x076c | 626 | #define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500 0x076c |
627 | #define USB_DEVICE_ID_MS_TOUCH_COVER_2 0x07a7 | ||
628 | #define USB_DEVICE_ID_MS_TYPE_COVER_2 0x07a9 | ||
622 | 629 | ||
623 | #define USB_VENDOR_ID_MOJO 0x8282 | 630 | #define USB_VENDOR_ID_MOJO 0x8282 |
624 | #define USB_DEVICE_ID_RETRO_ADAPTER 0x3201 | 631 | #define USB_DEVICE_ID_RETRO_ADAPTER 0x3201 |
@@ -644,6 +651,7 @@ | |||
644 | 651 | ||
645 | #define USB_VENDOR_ID_NEXIO 0x1870 | 652 | #define USB_VENDOR_ID_NEXIO 0x1870 |
646 | #define USB_DEVICE_ID_NEXIO_MULTITOUCH_420 0x010d | 653 | #define USB_DEVICE_ID_NEXIO_MULTITOUCH_420 0x010d |
654 | #define USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750 0x0110 | ||
647 | 655 | ||
648 | #define USB_VENDOR_ID_NEXTWINDOW 0x1926 | 656 | #define USB_VENDOR_ID_NEXTWINDOW 0x1926 |
649 | #define USB_DEVICE_ID_NEXTWINDOW_TOUCHSCREEN 0x0003 | 657 | #define USB_DEVICE_ID_NEXTWINDOW_TOUCHSCREEN 0x0003 |
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index d50e7313b171..a713e6211419 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -1178,7 +1178,7 @@ static void hidinput_led_worker(struct work_struct *work) | |||
1178 | 1178 | ||
1179 | /* fall back to generic raw-output-report */ | 1179 | /* fall back to generic raw-output-report */ |
1180 | len = ((report->size - 1) >> 3) + 1 + (report->id > 0); | 1180 | len = ((report->size - 1) >> 3) + 1 + (report->id > 0); |
1181 | buf = kmalloc(len, GFP_KERNEL); | 1181 | buf = hid_alloc_report_buf(report, GFP_KERNEL); |
1182 | if (!buf) | 1182 | if (!buf) |
1183 | return; | 1183 | return; |
1184 | 1184 | ||
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c index c6ef6eed3091..404a3a8a82f1 100644 --- a/drivers/hid/hid-microsoft.c +++ b/drivers/hid/hid-microsoft.c | |||
@@ -208,6 +208,10 @@ static const struct hid_device_id ms_devices[] = { | |||
208 | .driver_data = MS_NOGET }, | 208 | .driver_data = MS_NOGET }, |
209 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500), | 209 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500), |
210 | .driver_data = MS_DUPLICATE_USAGES }, | 210 | .driver_data = MS_DUPLICATE_USAGES }, |
211 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_2), | ||
212 | .driver_data = 0 }, | ||
213 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TOUCH_COVER_2), | ||
214 | .driver_data = 0 }, | ||
211 | 215 | ||
212 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT), | 216 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT), |
213 | .driver_data = MS_PRESENTER }, | 217 | .driver_data = MS_PRESENTER }, |
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index f134d73beca1..221d503f1c24 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c | |||
@@ -1166,6 +1166,11 @@ static const struct hid_device_id mt_devices[] = { | |||
1166 | MT_USB_DEVICE(USB_VENDOR_ID_FLATFROG, | 1166 | MT_USB_DEVICE(USB_VENDOR_ID_FLATFROG, |
1167 | USB_DEVICE_ID_MULTITOUCH_3200) }, | 1167 | USB_DEVICE_ID_MULTITOUCH_3200) }, |
1168 | 1168 | ||
1169 | /* FocalTech Panels */ | ||
1170 | { .driver_data = MT_CLS_SERIAL, | ||
1171 | MT_USB_DEVICE(USB_VENDOR_ID_CYGNAL, | ||
1172 | USB_DEVICE_ID_FOCALTECH_FTXXXX_MULTITOUCH) }, | ||
1173 | |||
1169 | /* GeneralTouch panel */ | 1174 | /* GeneralTouch panel */ |
1170 | { .driver_data = MT_CLS_GENERALTOUCH_TWOFINGERS, | 1175 | { .driver_data = MT_CLS_GENERALTOUCH_TWOFINGERS, |
1171 | MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, | 1176 | MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, |
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index 46f4480035bc..9c22e14c57f0 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c | |||
@@ -665,6 +665,9 @@ static const struct hid_device_id sensor_hub_devices[] = { | |||
665 | { HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, USB_VENDOR_ID_INTEL_1, | 665 | { HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, USB_VENDOR_ID_INTEL_1, |
666 | USB_DEVICE_ID_INTEL_HID_SENSOR), | 666 | USB_DEVICE_ID_INTEL_HID_SENSOR), |
667 | .driver_data = HID_SENSOR_HUB_ENUM_QUIRK}, | 667 | .driver_data = HID_SENSOR_HUB_ENUM_QUIRK}, |
668 | { HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, USB_VENDOR_ID_STM_0, | ||
669 | USB_DEVICE_ID_STM_HID_SENSOR), | ||
670 | .driver_data = HID_SENSOR_HUB_ENUM_QUIRK}, | ||
668 | { HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, HID_ANY_ID, | 671 | { HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, HID_ANY_ID, |
669 | HID_ANY_ID) }, | 672 | HID_ANY_ID) }, |
670 | { } | 673 | { } |
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c index d1f81f52481a..42eebd14de1f 100644 --- a/drivers/hid/i2c-hid/i2c-hid.c +++ b/drivers/hid/i2c-hid/i2c-hid.c | |||
@@ -582,7 +582,7 @@ static void i2c_hid_request(struct hid_device *hid, struct hid_report *rep, | |||
582 | int ret; | 582 | int ret; |
583 | int len = i2c_hid_get_report_length(rep) - 2; | 583 | int len = i2c_hid_get_report_length(rep) - 2; |
584 | 584 | ||
585 | buf = kzalloc(len, GFP_KERNEL); | 585 | buf = hid_alloc_report_buf(rep, GFP_KERNEL); |
586 | if (!buf) | 586 | if (!buf) |
587 | return; | 587 | return; |
588 | 588 | ||
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 175ec0afb70c..dbd83878ff99 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -74,6 +74,7 @@ static const struct hid_blacklist { | |||
74 | { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, | 74 | { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, |
75 | { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET }, | 75 | { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET }, |
76 | { USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GX680R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS }, | 76 | { USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GX680R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS }, |
77 | { USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS }, | ||
77 | { USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS }, | 78 | { USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS }, |
78 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NO_INIT_REPORTS }, | 79 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NO_INIT_REPORTS }, |
79 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1, HID_QUIRK_NO_INIT_REPORTS }, | 80 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1, HID_QUIRK_NO_INIT_REPORTS }, |
diff --git a/drivers/hwmon/max1668.c b/drivers/hwmon/max1668.c index a7626358c95d..029b65e6c589 100644 --- a/drivers/hwmon/max1668.c +++ b/drivers/hwmon/max1668.c | |||
@@ -243,7 +243,7 @@ static ssize_t set_temp_min(struct device *dev, | |||
243 | data->temp_min[index] = clamp_val(temp/1000, -128, 127); | 243 | data->temp_min[index] = clamp_val(temp/1000, -128, 127); |
244 | if (i2c_smbus_write_byte_data(client, | 244 | if (i2c_smbus_write_byte_data(client, |
245 | MAX1668_REG_LIML_WR(index), | 245 | MAX1668_REG_LIML_WR(index), |
246 | data->temp_max[index])) | 246 | data->temp_min[index])) |
247 | count = -EIO; | 247 | count = -EIO; |
248 | mutex_unlock(&data->update_lock); | 248 | mutex_unlock(&data->update_lock); |
249 | 249 | ||
diff --git a/drivers/iio/gyro/Kconfig b/drivers/iio/gyro/Kconfig index 41c64a43bcab..ac2d69e34c8c 100644 --- a/drivers/iio/gyro/Kconfig +++ b/drivers/iio/gyro/Kconfig | |||
@@ -70,7 +70,7 @@ config IIO_ST_GYRO_3AXIS | |||
70 | select IIO_TRIGGERED_BUFFER if (IIO_BUFFER) | 70 | select IIO_TRIGGERED_BUFFER if (IIO_BUFFER) |
71 | help | 71 | help |
72 | Say yes here to build support for STMicroelectronics gyroscopes: | 72 | Say yes here to build support for STMicroelectronics gyroscopes: |
73 | L3G4200D, LSM330DL, L3GD20, L3GD20H, LSM330DLC, L3G4IS, LSM330. | 73 | L3G4200D, LSM330DL, L3GD20, LSM330DLC, L3G4IS, LSM330. |
74 | 74 | ||
75 | This driver can also be built as a module. If so, these modules | 75 | This driver can also be built as a module. If so, these modules |
76 | will be created: | 76 | will be created: |
diff --git a/drivers/iio/gyro/st_gyro.h b/drivers/iio/gyro/st_gyro.h index f8f2bf84a5a2..c197360c450b 100644 --- a/drivers/iio/gyro/st_gyro.h +++ b/drivers/iio/gyro/st_gyro.h | |||
@@ -19,7 +19,6 @@ | |||
19 | #define LSM330DL_GYRO_DEV_NAME "lsm330dl_gyro" | 19 | #define LSM330DL_GYRO_DEV_NAME "lsm330dl_gyro" |
20 | #define LSM330DLC_GYRO_DEV_NAME "lsm330dlc_gyro" | 20 | #define LSM330DLC_GYRO_DEV_NAME "lsm330dlc_gyro" |
21 | #define L3GD20_GYRO_DEV_NAME "l3gd20" | 21 | #define L3GD20_GYRO_DEV_NAME "l3gd20" |
22 | #define L3GD20H_GYRO_DEV_NAME "l3gd20h" | ||
23 | #define L3G4IS_GYRO_DEV_NAME "l3g4is_ui" | 22 | #define L3G4IS_GYRO_DEV_NAME "l3g4is_ui" |
24 | #define LSM330_GYRO_DEV_NAME "lsm330_gyro" | 23 | #define LSM330_GYRO_DEV_NAME "lsm330_gyro" |
25 | 24 | ||
diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c index d53d91adfb55..a8e174a47bc4 100644 --- a/drivers/iio/gyro/st_gyro_core.c +++ b/drivers/iio/gyro/st_gyro_core.c | |||
@@ -167,11 +167,10 @@ static const struct st_sensors st_gyro_sensors[] = { | |||
167 | .wai = ST_GYRO_2_WAI_EXP, | 167 | .wai = ST_GYRO_2_WAI_EXP, |
168 | .sensors_supported = { | 168 | .sensors_supported = { |
169 | [0] = L3GD20_GYRO_DEV_NAME, | 169 | [0] = L3GD20_GYRO_DEV_NAME, |
170 | [1] = L3GD20H_GYRO_DEV_NAME, | 170 | [1] = LSM330D_GYRO_DEV_NAME, |
171 | [2] = LSM330D_GYRO_DEV_NAME, | 171 | [2] = LSM330DLC_GYRO_DEV_NAME, |
172 | [3] = LSM330DLC_GYRO_DEV_NAME, | 172 | [3] = L3G4IS_GYRO_DEV_NAME, |
173 | [4] = L3G4IS_GYRO_DEV_NAME, | 173 | [4] = LSM330_GYRO_DEV_NAME, |
174 | [5] = LSM330_GYRO_DEV_NAME, | ||
175 | }, | 174 | }, |
176 | .ch = (struct iio_chan_spec *)st_gyro_16bit_channels, | 175 | .ch = (struct iio_chan_spec *)st_gyro_16bit_channels, |
177 | .odr = { | 176 | .odr = { |
diff --git a/drivers/iio/gyro/st_gyro_i2c.c b/drivers/iio/gyro/st_gyro_i2c.c index 16b8b8d70bf1..23c12f361b05 100644 --- a/drivers/iio/gyro/st_gyro_i2c.c +++ b/drivers/iio/gyro/st_gyro_i2c.c | |||
@@ -55,7 +55,6 @@ static const struct i2c_device_id st_gyro_id_table[] = { | |||
55 | { LSM330DL_GYRO_DEV_NAME }, | 55 | { LSM330DL_GYRO_DEV_NAME }, |
56 | { LSM330DLC_GYRO_DEV_NAME }, | 56 | { LSM330DLC_GYRO_DEV_NAME }, |
57 | { L3GD20_GYRO_DEV_NAME }, | 57 | { L3GD20_GYRO_DEV_NAME }, |
58 | { L3GD20H_GYRO_DEV_NAME }, | ||
59 | { L3G4IS_GYRO_DEV_NAME }, | 58 | { L3G4IS_GYRO_DEV_NAME }, |
60 | { LSM330_GYRO_DEV_NAME }, | 59 | { LSM330_GYRO_DEV_NAME }, |
61 | {}, | 60 | {}, |
diff --git a/drivers/iio/gyro/st_gyro_spi.c b/drivers/iio/gyro/st_gyro_spi.c index 94763e25caf9..b4ad3be26687 100644 --- a/drivers/iio/gyro/st_gyro_spi.c +++ b/drivers/iio/gyro/st_gyro_spi.c | |||
@@ -54,7 +54,6 @@ static const struct spi_device_id st_gyro_id_table[] = { | |||
54 | { LSM330DL_GYRO_DEV_NAME }, | 54 | { LSM330DL_GYRO_DEV_NAME }, |
55 | { LSM330DLC_GYRO_DEV_NAME }, | 55 | { LSM330DLC_GYRO_DEV_NAME }, |
56 | { L3GD20_GYRO_DEV_NAME }, | 56 | { L3GD20_GYRO_DEV_NAME }, |
57 | { L3GD20H_GYRO_DEV_NAME }, | ||
58 | { L3G4IS_GYRO_DEV_NAME }, | 57 | { L3G4IS_GYRO_DEV_NAME }, |
59 | { LSM330_GYRO_DEV_NAME }, | 58 | { LSM330_GYRO_DEV_NAME }, |
60 | {}, | 59 | {}, |
diff --git a/drivers/iio/light/cm32181.c b/drivers/iio/light/cm32181.c index f17b4e6183c6..47a6dbac2d0c 100644 --- a/drivers/iio/light/cm32181.c +++ b/drivers/iio/light/cm32181.c | |||
@@ -103,13 +103,13 @@ static int cm32181_reg_init(struct cm32181_chip *cm32181) | |||
103 | /** | 103 | /** |
104 | * cm32181_read_als_it() - Get sensor integration time (ms) | 104 | * cm32181_read_als_it() - Get sensor integration time (ms) |
105 | * @cm32181: pointer of struct cm32181 | 105 | * @cm32181: pointer of struct cm32181 |
106 | * @val: pointer of int to load the als_it value. | 106 | * @val2: pointer of int to load the als_it value. |
107 | * | 107 | * |
108 | * Report the current integartion time by millisecond. | 108 | * Report the current integartion time by millisecond. |
109 | * | 109 | * |
110 | * Return: IIO_VAL_INT for success, otherwise -EINVAL. | 110 | * Return: IIO_VAL_INT_PLUS_MICRO for success, otherwise -EINVAL. |
111 | */ | 111 | */ |
112 | static int cm32181_read_als_it(struct cm32181_chip *cm32181, int *val) | 112 | static int cm32181_read_als_it(struct cm32181_chip *cm32181, int *val2) |
113 | { | 113 | { |
114 | u16 als_it; | 114 | u16 als_it; |
115 | int i; | 115 | int i; |
@@ -119,8 +119,8 @@ static int cm32181_read_als_it(struct cm32181_chip *cm32181, int *val) | |||
119 | als_it >>= CM32181_CMD_ALS_IT_SHIFT; | 119 | als_it >>= CM32181_CMD_ALS_IT_SHIFT; |
120 | for (i = 0; i < ARRAY_SIZE(als_it_bits); i++) { | 120 | for (i = 0; i < ARRAY_SIZE(als_it_bits); i++) { |
121 | if (als_it == als_it_bits[i]) { | 121 | if (als_it == als_it_bits[i]) { |
122 | *val = als_it_value[i]; | 122 | *val2 = als_it_value[i]; |
123 | return IIO_VAL_INT; | 123 | return IIO_VAL_INT_PLUS_MICRO; |
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
@@ -221,7 +221,7 @@ static int cm32181_read_raw(struct iio_dev *indio_dev, | |||
221 | *val = cm32181->calibscale; | 221 | *val = cm32181->calibscale; |
222 | return IIO_VAL_INT; | 222 | return IIO_VAL_INT; |
223 | case IIO_CHAN_INFO_INT_TIME: | 223 | case IIO_CHAN_INFO_INT_TIME: |
224 | ret = cm32181_read_als_it(cm32181, val); | 224 | ret = cm32181_read_als_it(cm32181, val2); |
225 | return ret; | 225 | return ret; |
226 | } | 226 | } |
227 | 227 | ||
@@ -240,7 +240,7 @@ static int cm32181_write_raw(struct iio_dev *indio_dev, | |||
240 | cm32181->calibscale = val; | 240 | cm32181->calibscale = val; |
241 | return val; | 241 | return val; |
242 | case IIO_CHAN_INFO_INT_TIME: | 242 | case IIO_CHAN_INFO_INT_TIME: |
243 | ret = cm32181_write_als_it(cm32181, val); | 243 | ret = cm32181_write_als_it(cm32181, val2); |
244 | return ret; | 244 | return ret; |
245 | } | 245 | } |
246 | 246 | ||
@@ -264,7 +264,7 @@ static ssize_t cm32181_get_it_available(struct device *dev, | |||
264 | 264 | ||
265 | n = ARRAY_SIZE(als_it_value); | 265 | n = ARRAY_SIZE(als_it_value); |
266 | for (i = 0, len = 0; i < n; i++) | 266 | for (i = 0, len = 0; i < n; i++) |
267 | len += sprintf(buf + len, "%d ", als_it_value[i]); | 267 | len += sprintf(buf + len, "0.%06u ", als_it_value[i]); |
268 | return len + sprintf(buf + len, "\n"); | 268 | return len + sprintf(buf + len, "\n"); |
269 | } | 269 | } |
270 | 270 | ||
diff --git a/drivers/iio/light/cm36651.c b/drivers/iio/light/cm36651.c index 0a142af83e25..a45e07492db3 100644 --- a/drivers/iio/light/cm36651.c +++ b/drivers/iio/light/cm36651.c | |||
@@ -50,10 +50,10 @@ | |||
50 | #define CM36651_CS_CONF2_DEFAULT_BIT 0x08 | 50 | #define CM36651_CS_CONF2_DEFAULT_BIT 0x08 |
51 | 51 | ||
52 | /* CS_CONF3 channel integration time */ | 52 | /* CS_CONF3 channel integration time */ |
53 | #define CM36651_CS_IT1 0x00 /* Integration time 80000 usec */ | 53 | #define CM36651_CS_IT1 0x00 /* Integration time 80 msec */ |
54 | #define CM36651_CS_IT2 0x40 /* Integration time 160000 usec */ | 54 | #define CM36651_CS_IT2 0x40 /* Integration time 160 msec */ |
55 | #define CM36651_CS_IT3 0x80 /* Integration time 320000 usec */ | 55 | #define CM36651_CS_IT3 0x80 /* Integration time 320 msec */ |
56 | #define CM36651_CS_IT4 0xC0 /* Integration time 640000 usec */ | 56 | #define CM36651_CS_IT4 0xC0 /* Integration time 640 msec */ |
57 | 57 | ||
58 | /* PS_CONF1 command code */ | 58 | /* PS_CONF1 command code */ |
59 | #define CM36651_PS_ENABLE 0x00 | 59 | #define CM36651_PS_ENABLE 0x00 |
@@ -64,10 +64,10 @@ | |||
64 | #define CM36651_PS_PERS4 0x0C | 64 | #define CM36651_PS_PERS4 0x0C |
65 | 65 | ||
66 | /* PS_CONF1 command code: integration time */ | 66 | /* PS_CONF1 command code: integration time */ |
67 | #define CM36651_PS_IT1 0x00 /* Integration time 320 usec */ | 67 | #define CM36651_PS_IT1 0x00 /* Integration time 0.32 msec */ |
68 | #define CM36651_PS_IT2 0x10 /* Integration time 420 usec */ | 68 | #define CM36651_PS_IT2 0x10 /* Integration time 0.42 msec */ |
69 | #define CM36651_PS_IT3 0x20 /* Integration time 520 usec */ | 69 | #define CM36651_PS_IT3 0x20 /* Integration time 0.52 msec */ |
70 | #define CM36651_PS_IT4 0x30 /* Integration time 640 usec */ | 70 | #define CM36651_PS_IT4 0x30 /* Integration time 0.64 msec */ |
71 | 71 | ||
72 | /* PS_CONF1 command code: duty ratio */ | 72 | /* PS_CONF1 command code: duty ratio */ |
73 | #define CM36651_PS_DR1 0x00 /* Duty ratio 1/80 */ | 73 | #define CM36651_PS_DR1 0x00 /* Duty ratio 1/80 */ |
@@ -93,8 +93,8 @@ | |||
93 | #define CM36651_CLOSE_PROXIMITY 0x32 | 93 | #define CM36651_CLOSE_PROXIMITY 0x32 |
94 | #define CM36651_FAR_PROXIMITY 0x33 | 94 | #define CM36651_FAR_PROXIMITY 0x33 |
95 | 95 | ||
96 | #define CM36651_CS_INT_TIME_AVAIL "80000 160000 320000 640000" | 96 | #define CM36651_CS_INT_TIME_AVAIL "0.08 0.16 0.32 0.64" |
97 | #define CM36651_PS_INT_TIME_AVAIL "320 420 520 640" | 97 | #define CM36651_PS_INT_TIME_AVAIL "0.000320 0.000420 0.000520 0.000640" |
98 | 98 | ||
99 | enum cm36651_operation_mode { | 99 | enum cm36651_operation_mode { |
100 | CM36651_LIGHT_EN, | 100 | CM36651_LIGHT_EN, |
@@ -356,30 +356,30 @@ static int cm36651_read_channel(struct cm36651_data *cm36651, | |||
356 | } | 356 | } |
357 | 357 | ||
358 | static int cm36651_read_int_time(struct cm36651_data *cm36651, | 358 | static int cm36651_read_int_time(struct cm36651_data *cm36651, |
359 | struct iio_chan_spec const *chan, int *val) | 359 | struct iio_chan_spec const *chan, int *val2) |
360 | { | 360 | { |
361 | switch (chan->type) { | 361 | switch (chan->type) { |
362 | case IIO_LIGHT: | 362 | case IIO_LIGHT: |
363 | if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT1) | 363 | if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT1) |
364 | *val = 80000; | 364 | *val2 = 80000; |
365 | else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT2) | 365 | else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT2) |
366 | *val = 160000; | 366 | *val2 = 160000; |
367 | else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT3) | 367 | else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT3) |
368 | *val = 320000; | 368 | *val2 = 320000; |
369 | else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT4) | 369 | else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT4) |
370 | *val = 640000; | 370 | *val2 = 640000; |
371 | else | 371 | else |
372 | return -EINVAL; | 372 | return -EINVAL; |
373 | break; | 373 | break; |
374 | case IIO_PROXIMITY: | 374 | case IIO_PROXIMITY: |
375 | if (cm36651->ps_int_time == CM36651_PS_IT1) | 375 | if (cm36651->ps_int_time == CM36651_PS_IT1) |
376 | *val = 320; | 376 | *val2 = 320; |
377 | else if (cm36651->ps_int_time == CM36651_PS_IT2) | 377 | else if (cm36651->ps_int_time == CM36651_PS_IT2) |
378 | *val = 420; | 378 | *val2 = 420; |
379 | else if (cm36651->ps_int_time == CM36651_PS_IT3) | 379 | else if (cm36651->ps_int_time == CM36651_PS_IT3) |
380 | *val = 520; | 380 | *val2 = 520; |
381 | else if (cm36651->ps_int_time == CM36651_PS_IT4) | 381 | else if (cm36651->ps_int_time == CM36651_PS_IT4) |
382 | *val = 640; | 382 | *val2 = 640; |
383 | else | 383 | else |
384 | return -EINVAL; | 384 | return -EINVAL; |
385 | break; | 385 | break; |
@@ -387,7 +387,7 @@ static int cm36651_read_int_time(struct cm36651_data *cm36651, | |||
387 | return -EINVAL; | 387 | return -EINVAL; |
388 | } | 388 | } |
389 | 389 | ||
390 | return IIO_VAL_INT; | 390 | return IIO_VAL_INT_PLUS_MICRO; |
391 | } | 391 | } |
392 | 392 | ||
393 | static int cm36651_write_int_time(struct cm36651_data *cm36651, | 393 | static int cm36651_write_int_time(struct cm36651_data *cm36651, |
@@ -459,7 +459,8 @@ static int cm36651_read_raw(struct iio_dev *indio_dev, | |||
459 | ret = cm36651_read_channel(cm36651, chan, val); | 459 | ret = cm36651_read_channel(cm36651, chan, val); |
460 | break; | 460 | break; |
461 | case IIO_CHAN_INFO_INT_TIME: | 461 | case IIO_CHAN_INFO_INT_TIME: |
462 | ret = cm36651_read_int_time(cm36651, chan, val); | 462 | *val = 0; |
463 | ret = cm36651_read_int_time(cm36651, chan, val2); | ||
463 | break; | 464 | break; |
464 | default: | 465 | default: |
465 | ret = -EINVAL; | 466 | ret = -EINVAL; |
@@ -479,7 +480,7 @@ static int cm36651_write_raw(struct iio_dev *indio_dev, | |||
479 | int ret = -EINVAL; | 480 | int ret = -EINVAL; |
480 | 481 | ||
481 | if (mask == IIO_CHAN_INFO_INT_TIME) { | 482 | if (mask == IIO_CHAN_INFO_INT_TIME) { |
482 | ret = cm36651_write_int_time(cm36651, chan, val); | 483 | ret = cm36651_write_int_time(cm36651, chan, val2); |
483 | if (ret < 0) | 484 | if (ret < 0) |
484 | dev_err(&client->dev, "Integration time write failed\n"); | 485 | dev_err(&client->dev, "Integration time write failed\n"); |
485 | } | 486 | } |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index e81c5547e647..f9c12e92fdd6 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -53,8 +53,8 @@ | |||
53 | #include "user.h" | 53 | #include "user.h" |
54 | 54 | ||
55 | #define DRV_NAME MLX4_IB_DRV_NAME | 55 | #define DRV_NAME MLX4_IB_DRV_NAME |
56 | #define DRV_VERSION "1.0" | 56 | #define DRV_VERSION "2.2-1" |
57 | #define DRV_RELDATE "April 4, 2008" | 57 | #define DRV_RELDATE "Feb 2014" |
58 | 58 | ||
59 | #define MLX4_IB_FLOW_MAX_PRIO 0xFFF | 59 | #define MLX4_IB_FLOW_MAX_PRIO 0xFFF |
60 | #define MLX4_IB_FLOW_QPN_MASK 0xFFFFFF | 60 | #define MLX4_IB_FLOW_QPN_MASK 0xFFFFFF |
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index aa03e732b6a8..bf900579ac08 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c | |||
@@ -46,8 +46,8 @@ | |||
46 | #include "mlx5_ib.h" | 46 | #include "mlx5_ib.h" |
47 | 47 | ||
48 | #define DRIVER_NAME "mlx5_ib" | 48 | #define DRIVER_NAME "mlx5_ib" |
49 | #define DRIVER_VERSION "1.0" | 49 | #define DRIVER_VERSION "2.2-1" |
50 | #define DRIVER_RELDATE "June 2013" | 50 | #define DRIVER_RELDATE "Feb 2014" |
51 | 51 | ||
52 | MODULE_AUTHOR("Eli Cohen <eli@mellanox.com>"); | 52 | MODULE_AUTHOR("Eli Cohen <eli@mellanox.com>"); |
53 | MODULE_DESCRIPTION("Mellanox Connect-IB HCA IB driver"); | 53 | MODULE_DESCRIPTION("Mellanox Connect-IB HCA IB driver"); |
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index d18d08a076e8..8ee228e9ab5a 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
@@ -492,12 +492,11 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
492 | isert_conn->state = ISER_CONN_INIT; | 492 | isert_conn->state = ISER_CONN_INIT; |
493 | INIT_LIST_HEAD(&isert_conn->conn_accept_node); | 493 | INIT_LIST_HEAD(&isert_conn->conn_accept_node); |
494 | init_completion(&isert_conn->conn_login_comp); | 494 | init_completion(&isert_conn->conn_login_comp); |
495 | init_waitqueue_head(&isert_conn->conn_wait); | 495 | init_completion(&isert_conn->conn_wait); |
496 | init_waitqueue_head(&isert_conn->conn_wait_comp_err); | 496 | init_completion(&isert_conn->conn_wait_comp_err); |
497 | kref_init(&isert_conn->conn_kref); | 497 | kref_init(&isert_conn->conn_kref); |
498 | kref_get(&isert_conn->conn_kref); | 498 | kref_get(&isert_conn->conn_kref); |
499 | mutex_init(&isert_conn->conn_mutex); | 499 | mutex_init(&isert_conn->conn_mutex); |
500 | mutex_init(&isert_conn->conn_comp_mutex); | ||
501 | spin_lock_init(&isert_conn->conn_lock); | 500 | spin_lock_init(&isert_conn->conn_lock); |
502 | 501 | ||
503 | cma_id->context = isert_conn; | 502 | cma_id->context = isert_conn; |
@@ -688,11 +687,11 @@ isert_disconnect_work(struct work_struct *work) | |||
688 | 687 | ||
689 | pr_debug("isert_disconnect_work(): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); | 688 | pr_debug("isert_disconnect_work(): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); |
690 | mutex_lock(&isert_conn->conn_mutex); | 689 | mutex_lock(&isert_conn->conn_mutex); |
691 | isert_conn->state = ISER_CONN_DOWN; | 690 | if (isert_conn->state == ISER_CONN_UP) |
691 | isert_conn->state = ISER_CONN_TERMINATING; | ||
692 | 692 | ||
693 | if (isert_conn->post_recv_buf_count == 0 && | 693 | if (isert_conn->post_recv_buf_count == 0 && |
694 | atomic_read(&isert_conn->post_send_buf_count) == 0) { | 694 | atomic_read(&isert_conn->post_send_buf_count) == 0) { |
695 | pr_debug("Calling wake_up(&isert_conn->conn_wait);\n"); | ||
696 | mutex_unlock(&isert_conn->conn_mutex); | 695 | mutex_unlock(&isert_conn->conn_mutex); |
697 | goto wake_up; | 696 | goto wake_up; |
698 | } | 697 | } |
@@ -712,7 +711,7 @@ isert_disconnect_work(struct work_struct *work) | |||
712 | mutex_unlock(&isert_conn->conn_mutex); | 711 | mutex_unlock(&isert_conn->conn_mutex); |
713 | 712 | ||
714 | wake_up: | 713 | wake_up: |
715 | wake_up(&isert_conn->conn_wait); | 714 | complete(&isert_conn->conn_wait); |
716 | isert_put_conn(isert_conn); | 715 | isert_put_conn(isert_conn); |
717 | } | 716 | } |
718 | 717 | ||
@@ -888,16 +887,17 @@ isert_init_send_wr(struct isert_conn *isert_conn, struct isert_cmd *isert_cmd, | |||
888 | * Coalesce send completion interrupts by only setting IB_SEND_SIGNALED | 887 | * Coalesce send completion interrupts by only setting IB_SEND_SIGNALED |
889 | * bit for every ISERT_COMP_BATCH_COUNT number of ib_post_send() calls. | 888 | * bit for every ISERT_COMP_BATCH_COUNT number of ib_post_send() calls. |
890 | */ | 889 | */ |
891 | mutex_lock(&isert_conn->conn_comp_mutex); | 890 | mutex_lock(&isert_conn->conn_mutex); |
892 | if (coalesce && | 891 | if (coalesce && isert_conn->state == ISER_CONN_UP && |
893 | ++isert_conn->conn_comp_batch < ISERT_COMP_BATCH_COUNT) { | 892 | ++isert_conn->conn_comp_batch < ISERT_COMP_BATCH_COUNT) { |
893 | tx_desc->llnode_active = true; | ||
894 | llist_add(&tx_desc->comp_llnode, &isert_conn->conn_comp_llist); | 894 | llist_add(&tx_desc->comp_llnode, &isert_conn->conn_comp_llist); |
895 | mutex_unlock(&isert_conn->conn_comp_mutex); | 895 | mutex_unlock(&isert_conn->conn_mutex); |
896 | return; | 896 | return; |
897 | } | 897 | } |
898 | isert_conn->conn_comp_batch = 0; | 898 | isert_conn->conn_comp_batch = 0; |
899 | tx_desc->comp_llnode_batch = llist_del_all(&isert_conn->conn_comp_llist); | 899 | tx_desc->comp_llnode_batch = llist_del_all(&isert_conn->conn_comp_llist); |
900 | mutex_unlock(&isert_conn->conn_comp_mutex); | 900 | mutex_unlock(&isert_conn->conn_mutex); |
901 | 901 | ||
902 | send_wr->send_flags = IB_SEND_SIGNALED; | 902 | send_wr->send_flags = IB_SEND_SIGNALED; |
903 | } | 903 | } |
@@ -1464,7 +1464,7 @@ isert_put_cmd(struct isert_cmd *isert_cmd) | |||
1464 | case ISCSI_OP_SCSI_CMD: | 1464 | case ISCSI_OP_SCSI_CMD: |
1465 | spin_lock_bh(&conn->cmd_lock); | 1465 | spin_lock_bh(&conn->cmd_lock); |
1466 | if (!list_empty(&cmd->i_conn_node)) | 1466 | if (!list_empty(&cmd->i_conn_node)) |
1467 | list_del(&cmd->i_conn_node); | 1467 | list_del_init(&cmd->i_conn_node); |
1468 | spin_unlock_bh(&conn->cmd_lock); | 1468 | spin_unlock_bh(&conn->cmd_lock); |
1469 | 1469 | ||
1470 | if (cmd->data_direction == DMA_TO_DEVICE) | 1470 | if (cmd->data_direction == DMA_TO_DEVICE) |
@@ -1476,7 +1476,7 @@ isert_put_cmd(struct isert_cmd *isert_cmd) | |||
1476 | case ISCSI_OP_SCSI_TMFUNC: | 1476 | case ISCSI_OP_SCSI_TMFUNC: |
1477 | spin_lock_bh(&conn->cmd_lock); | 1477 | spin_lock_bh(&conn->cmd_lock); |
1478 | if (!list_empty(&cmd->i_conn_node)) | 1478 | if (!list_empty(&cmd->i_conn_node)) |
1479 | list_del(&cmd->i_conn_node); | 1479 | list_del_init(&cmd->i_conn_node); |
1480 | spin_unlock_bh(&conn->cmd_lock); | 1480 | spin_unlock_bh(&conn->cmd_lock); |
1481 | 1481 | ||
1482 | transport_generic_free_cmd(&cmd->se_cmd, 0); | 1482 | transport_generic_free_cmd(&cmd->se_cmd, 0); |
@@ -1486,7 +1486,7 @@ isert_put_cmd(struct isert_cmd *isert_cmd) | |||
1486 | case ISCSI_OP_TEXT: | 1486 | case ISCSI_OP_TEXT: |
1487 | spin_lock_bh(&conn->cmd_lock); | 1487 | spin_lock_bh(&conn->cmd_lock); |
1488 | if (!list_empty(&cmd->i_conn_node)) | 1488 | if (!list_empty(&cmd->i_conn_node)) |
1489 | list_del(&cmd->i_conn_node); | 1489 | list_del_init(&cmd->i_conn_node); |
1490 | spin_unlock_bh(&conn->cmd_lock); | 1490 | spin_unlock_bh(&conn->cmd_lock); |
1491 | 1491 | ||
1492 | /* | 1492 | /* |
@@ -1549,6 +1549,7 @@ isert_completion_rdma_read(struct iser_tx_desc *tx_desc, | |||
1549 | iscsit_stop_dataout_timer(cmd); | 1549 | iscsit_stop_dataout_timer(cmd); |
1550 | device->unreg_rdma_mem(isert_cmd, isert_conn); | 1550 | device->unreg_rdma_mem(isert_cmd, isert_conn); |
1551 | cmd->write_data_done = wr->cur_rdma_length; | 1551 | cmd->write_data_done = wr->cur_rdma_length; |
1552 | wr->send_wr_num = 0; | ||
1552 | 1553 | ||
1553 | pr_debug("Cmd: %p RDMA_READ comp calling execute_cmd\n", isert_cmd); | 1554 | pr_debug("Cmd: %p RDMA_READ comp calling execute_cmd\n", isert_cmd); |
1554 | spin_lock_bh(&cmd->istate_lock); | 1555 | spin_lock_bh(&cmd->istate_lock); |
@@ -1589,7 +1590,7 @@ isert_do_control_comp(struct work_struct *work) | |||
1589 | pr_debug("Calling iscsit_logout_post_handler >>>>>>>>>>>>>>\n"); | 1590 | pr_debug("Calling iscsit_logout_post_handler >>>>>>>>>>>>>>\n"); |
1590 | /* | 1591 | /* |
1591 | * Call atomic_dec(&isert_conn->post_send_buf_count) | 1592 | * Call atomic_dec(&isert_conn->post_send_buf_count) |
1592 | * from isert_free_conn() | 1593 | * from isert_wait_conn() |
1593 | */ | 1594 | */ |
1594 | isert_conn->logout_posted = true; | 1595 | isert_conn->logout_posted = true; |
1595 | iscsit_logout_post_handler(cmd, cmd->conn); | 1596 | iscsit_logout_post_handler(cmd, cmd->conn); |
@@ -1613,6 +1614,7 @@ isert_response_completion(struct iser_tx_desc *tx_desc, | |||
1613 | struct ib_device *ib_dev) | 1614 | struct ib_device *ib_dev) |
1614 | { | 1615 | { |
1615 | struct iscsi_cmd *cmd = isert_cmd->iscsi_cmd; | 1616 | struct iscsi_cmd *cmd = isert_cmd->iscsi_cmd; |
1617 | struct isert_rdma_wr *wr = &isert_cmd->rdma_wr; | ||
1616 | 1618 | ||
1617 | if (cmd->i_state == ISTATE_SEND_TASKMGTRSP || | 1619 | if (cmd->i_state == ISTATE_SEND_TASKMGTRSP || |
1618 | cmd->i_state == ISTATE_SEND_LOGOUTRSP || | 1620 | cmd->i_state == ISTATE_SEND_LOGOUTRSP || |
@@ -1624,7 +1626,7 @@ isert_response_completion(struct iser_tx_desc *tx_desc, | |||
1624 | queue_work(isert_comp_wq, &isert_cmd->comp_work); | 1626 | queue_work(isert_comp_wq, &isert_cmd->comp_work); |
1625 | return; | 1627 | return; |
1626 | } | 1628 | } |
1627 | atomic_dec(&isert_conn->post_send_buf_count); | 1629 | atomic_sub(wr->send_wr_num + 1, &isert_conn->post_send_buf_count); |
1628 | 1630 | ||
1629 | cmd->i_state = ISTATE_SENT_STATUS; | 1631 | cmd->i_state = ISTATE_SENT_STATUS; |
1630 | isert_completion_put(tx_desc, isert_cmd, ib_dev); | 1632 | isert_completion_put(tx_desc, isert_cmd, ib_dev); |
@@ -1662,7 +1664,7 @@ __isert_send_completion(struct iser_tx_desc *tx_desc, | |||
1662 | case ISER_IB_RDMA_READ: | 1664 | case ISER_IB_RDMA_READ: |
1663 | pr_debug("isert_send_completion: Got ISER_IB_RDMA_READ:\n"); | 1665 | pr_debug("isert_send_completion: Got ISER_IB_RDMA_READ:\n"); |
1664 | 1666 | ||
1665 | atomic_dec(&isert_conn->post_send_buf_count); | 1667 | atomic_sub(wr->send_wr_num, &isert_conn->post_send_buf_count); |
1666 | isert_completion_rdma_read(tx_desc, isert_cmd); | 1668 | isert_completion_rdma_read(tx_desc, isert_cmd); |
1667 | break; | 1669 | break; |
1668 | default: | 1670 | default: |
@@ -1691,31 +1693,76 @@ isert_send_completion(struct iser_tx_desc *tx_desc, | |||
1691 | } | 1693 | } |
1692 | 1694 | ||
1693 | static void | 1695 | static void |
1694 | isert_cq_comp_err(struct iser_tx_desc *tx_desc, struct isert_conn *isert_conn) | 1696 | isert_cq_drain_comp_llist(struct isert_conn *isert_conn, struct ib_device *ib_dev) |
1697 | { | ||
1698 | struct llist_node *llnode; | ||
1699 | struct isert_rdma_wr *wr; | ||
1700 | struct iser_tx_desc *t; | ||
1701 | |||
1702 | mutex_lock(&isert_conn->conn_mutex); | ||
1703 | llnode = llist_del_all(&isert_conn->conn_comp_llist); | ||
1704 | isert_conn->conn_comp_batch = 0; | ||
1705 | mutex_unlock(&isert_conn->conn_mutex); | ||
1706 | |||
1707 | while (llnode) { | ||
1708 | t = llist_entry(llnode, struct iser_tx_desc, comp_llnode); | ||
1709 | llnode = llist_next(llnode); | ||
1710 | wr = &t->isert_cmd->rdma_wr; | ||
1711 | |||
1712 | atomic_sub(wr->send_wr_num + 1, &isert_conn->post_send_buf_count); | ||
1713 | isert_completion_put(t, t->isert_cmd, ib_dev); | ||
1714 | } | ||
1715 | } | ||
1716 | |||
1717 | static void | ||
1718 | isert_cq_tx_comp_err(struct iser_tx_desc *tx_desc, struct isert_conn *isert_conn) | ||
1695 | { | 1719 | { |
1696 | struct ib_device *ib_dev = isert_conn->conn_cm_id->device; | 1720 | struct ib_device *ib_dev = isert_conn->conn_cm_id->device; |
1721 | struct isert_cmd *isert_cmd = tx_desc->isert_cmd; | ||
1722 | struct llist_node *llnode = tx_desc->comp_llnode_batch; | ||
1723 | struct isert_rdma_wr *wr; | ||
1724 | struct iser_tx_desc *t; | ||
1697 | 1725 | ||
1698 | if (tx_desc) { | 1726 | while (llnode) { |
1699 | struct isert_cmd *isert_cmd = tx_desc->isert_cmd; | 1727 | t = llist_entry(llnode, struct iser_tx_desc, comp_llnode); |
1728 | llnode = llist_next(llnode); | ||
1729 | wr = &t->isert_cmd->rdma_wr; | ||
1700 | 1730 | ||
1701 | if (!isert_cmd) | 1731 | atomic_sub(wr->send_wr_num + 1, &isert_conn->post_send_buf_count); |
1702 | isert_unmap_tx_desc(tx_desc, ib_dev); | 1732 | isert_completion_put(t, t->isert_cmd, ib_dev); |
1703 | else | ||
1704 | isert_completion_put(tx_desc, isert_cmd, ib_dev); | ||
1705 | } | 1733 | } |
1734 | tx_desc->comp_llnode_batch = NULL; | ||
1706 | 1735 | ||
1707 | if (isert_conn->post_recv_buf_count == 0 && | 1736 | if (!isert_cmd) |
1708 | atomic_read(&isert_conn->post_send_buf_count) == 0) { | 1737 | isert_unmap_tx_desc(tx_desc, ib_dev); |
1709 | pr_debug("isert_cq_comp_err >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); | 1738 | else |
1710 | pr_debug("Calling wake_up from isert_cq_comp_err\n"); | 1739 | isert_completion_put(tx_desc, isert_cmd, ib_dev); |
1740 | } | ||
1711 | 1741 | ||
1712 | mutex_lock(&isert_conn->conn_mutex); | 1742 | static void |
1713 | if (isert_conn->state != ISER_CONN_DOWN) | 1743 | isert_cq_rx_comp_err(struct isert_conn *isert_conn) |
1714 | isert_conn->state = ISER_CONN_TERMINATING; | 1744 | { |
1715 | mutex_unlock(&isert_conn->conn_mutex); | 1745 | struct ib_device *ib_dev = isert_conn->conn_cm_id->device; |
1746 | struct iscsi_conn *conn = isert_conn->conn; | ||
1716 | 1747 | ||
1717 | wake_up(&isert_conn->conn_wait_comp_err); | 1748 | if (isert_conn->post_recv_buf_count) |
1749 | return; | ||
1750 | |||
1751 | isert_cq_drain_comp_llist(isert_conn, ib_dev); | ||
1752 | |||
1753 | if (conn->sess) { | ||
1754 | target_sess_cmd_list_set_waiting(conn->sess->se_sess); | ||
1755 | target_wait_for_sess_cmds(conn->sess->se_sess); | ||
1718 | } | 1756 | } |
1757 | |||
1758 | while (atomic_read(&isert_conn->post_send_buf_count)) | ||
1759 | msleep(3000); | ||
1760 | |||
1761 | mutex_lock(&isert_conn->conn_mutex); | ||
1762 | isert_conn->state = ISER_CONN_DOWN; | ||
1763 | mutex_unlock(&isert_conn->conn_mutex); | ||
1764 | |||
1765 | complete(&isert_conn->conn_wait_comp_err); | ||
1719 | } | 1766 | } |
1720 | 1767 | ||
1721 | static void | 1768 | static void |
@@ -1740,8 +1787,14 @@ isert_cq_tx_work(struct work_struct *work) | |||
1740 | pr_debug("TX wc.status != IB_WC_SUCCESS >>>>>>>>>>>>>>\n"); | 1787 | pr_debug("TX wc.status != IB_WC_SUCCESS >>>>>>>>>>>>>>\n"); |
1741 | pr_debug("TX wc.status: 0x%08x\n", wc.status); | 1788 | pr_debug("TX wc.status: 0x%08x\n", wc.status); |
1742 | pr_debug("TX wc.vendor_err: 0x%08x\n", wc.vendor_err); | 1789 | pr_debug("TX wc.vendor_err: 0x%08x\n", wc.vendor_err); |
1743 | atomic_dec(&isert_conn->post_send_buf_count); | 1790 | |
1744 | isert_cq_comp_err(tx_desc, isert_conn); | 1791 | if (wc.wr_id != ISER_FASTREG_LI_WRID) { |
1792 | if (tx_desc->llnode_active) | ||
1793 | continue; | ||
1794 | |||
1795 | atomic_dec(&isert_conn->post_send_buf_count); | ||
1796 | isert_cq_tx_comp_err(tx_desc, isert_conn); | ||
1797 | } | ||
1745 | } | 1798 | } |
1746 | } | 1799 | } |
1747 | 1800 | ||
@@ -1784,7 +1837,7 @@ isert_cq_rx_work(struct work_struct *work) | |||
1784 | wc.vendor_err); | 1837 | wc.vendor_err); |
1785 | } | 1838 | } |
1786 | isert_conn->post_recv_buf_count--; | 1839 | isert_conn->post_recv_buf_count--; |
1787 | isert_cq_comp_err(NULL, isert_conn); | 1840 | isert_cq_rx_comp_err(isert_conn); |
1788 | } | 1841 | } |
1789 | } | 1842 | } |
1790 | 1843 | ||
@@ -2202,6 +2255,7 @@ isert_fast_reg_mr(struct fast_reg_descriptor *fr_desc, | |||
2202 | 2255 | ||
2203 | if (!fr_desc->valid) { | 2256 | if (!fr_desc->valid) { |
2204 | memset(&inv_wr, 0, sizeof(inv_wr)); | 2257 | memset(&inv_wr, 0, sizeof(inv_wr)); |
2258 | inv_wr.wr_id = ISER_FASTREG_LI_WRID; | ||
2205 | inv_wr.opcode = IB_WR_LOCAL_INV; | 2259 | inv_wr.opcode = IB_WR_LOCAL_INV; |
2206 | inv_wr.ex.invalidate_rkey = fr_desc->data_mr->rkey; | 2260 | inv_wr.ex.invalidate_rkey = fr_desc->data_mr->rkey; |
2207 | wr = &inv_wr; | 2261 | wr = &inv_wr; |
@@ -2212,6 +2266,7 @@ isert_fast_reg_mr(struct fast_reg_descriptor *fr_desc, | |||
2212 | 2266 | ||
2213 | /* Prepare FASTREG WR */ | 2267 | /* Prepare FASTREG WR */ |
2214 | memset(&fr_wr, 0, sizeof(fr_wr)); | 2268 | memset(&fr_wr, 0, sizeof(fr_wr)); |
2269 | fr_wr.wr_id = ISER_FASTREG_LI_WRID; | ||
2215 | fr_wr.opcode = IB_WR_FAST_REG_MR; | 2270 | fr_wr.opcode = IB_WR_FAST_REG_MR; |
2216 | fr_wr.wr.fast_reg.iova_start = | 2271 | fr_wr.wr.fast_reg.iova_start = |
2217 | fr_desc->data_frpl->page_list[0] + page_off; | 2272 | fr_desc->data_frpl->page_list[0] + page_off; |
@@ -2377,12 +2432,12 @@ isert_put_datain(struct iscsi_conn *conn, struct iscsi_cmd *cmd) | |||
2377 | isert_init_send_wr(isert_conn, isert_cmd, | 2432 | isert_init_send_wr(isert_conn, isert_cmd, |
2378 | &isert_cmd->tx_desc.send_wr, true); | 2433 | &isert_cmd->tx_desc.send_wr, true); |
2379 | 2434 | ||
2380 | atomic_inc(&isert_conn->post_send_buf_count); | 2435 | atomic_add(wr->send_wr_num + 1, &isert_conn->post_send_buf_count); |
2381 | 2436 | ||
2382 | rc = ib_post_send(isert_conn->conn_qp, wr->send_wr, &wr_failed); | 2437 | rc = ib_post_send(isert_conn->conn_qp, wr->send_wr, &wr_failed); |
2383 | if (rc) { | 2438 | if (rc) { |
2384 | pr_warn("ib_post_send() failed for IB_WR_RDMA_WRITE\n"); | 2439 | pr_warn("ib_post_send() failed for IB_WR_RDMA_WRITE\n"); |
2385 | atomic_dec(&isert_conn->post_send_buf_count); | 2440 | atomic_sub(wr->send_wr_num + 1, &isert_conn->post_send_buf_count); |
2386 | } | 2441 | } |
2387 | pr_debug("Cmd: %p posted RDMA_WRITE + Response for iSER Data READ\n", | 2442 | pr_debug("Cmd: %p posted RDMA_WRITE + Response for iSER Data READ\n", |
2388 | isert_cmd); | 2443 | isert_cmd); |
@@ -2410,12 +2465,12 @@ isert_get_dataout(struct iscsi_conn *conn, struct iscsi_cmd *cmd, bool recovery) | |||
2410 | return rc; | 2465 | return rc; |
2411 | } | 2466 | } |
2412 | 2467 | ||
2413 | atomic_inc(&isert_conn->post_send_buf_count); | 2468 | atomic_add(wr->send_wr_num, &isert_conn->post_send_buf_count); |
2414 | 2469 | ||
2415 | rc = ib_post_send(isert_conn->conn_qp, wr->send_wr, &wr_failed); | 2470 | rc = ib_post_send(isert_conn->conn_qp, wr->send_wr, &wr_failed); |
2416 | if (rc) { | 2471 | if (rc) { |
2417 | pr_warn("ib_post_send() failed for IB_WR_RDMA_READ\n"); | 2472 | pr_warn("ib_post_send() failed for IB_WR_RDMA_READ\n"); |
2418 | atomic_dec(&isert_conn->post_send_buf_count); | 2473 | atomic_sub(wr->send_wr_num, &isert_conn->post_send_buf_count); |
2419 | } | 2474 | } |
2420 | pr_debug("Cmd: %p posted RDMA_READ memory for ISER Data WRITE\n", | 2475 | pr_debug("Cmd: %p posted RDMA_READ memory for ISER Data WRITE\n", |
2421 | isert_cmd); | 2476 | isert_cmd); |
@@ -2702,22 +2757,11 @@ isert_free_np(struct iscsi_np *np) | |||
2702 | kfree(isert_np); | 2757 | kfree(isert_np); |
2703 | } | 2758 | } |
2704 | 2759 | ||
2705 | static int isert_check_state(struct isert_conn *isert_conn, int state) | 2760 | static void isert_wait_conn(struct iscsi_conn *conn) |
2706 | { | ||
2707 | int ret; | ||
2708 | |||
2709 | mutex_lock(&isert_conn->conn_mutex); | ||
2710 | ret = (isert_conn->state == state); | ||
2711 | mutex_unlock(&isert_conn->conn_mutex); | ||
2712 | |||
2713 | return ret; | ||
2714 | } | ||
2715 | |||
2716 | static void isert_free_conn(struct iscsi_conn *conn) | ||
2717 | { | 2761 | { |
2718 | struct isert_conn *isert_conn = conn->context; | 2762 | struct isert_conn *isert_conn = conn->context; |
2719 | 2763 | ||
2720 | pr_debug("isert_free_conn: Starting \n"); | 2764 | pr_debug("isert_wait_conn: Starting \n"); |
2721 | /* | 2765 | /* |
2722 | * Decrement post_send_buf_count for special case when called | 2766 | * Decrement post_send_buf_count for special case when called |
2723 | * from isert_do_control_comp() -> iscsit_logout_post_handler() | 2767 | * from isert_do_control_comp() -> iscsit_logout_post_handler() |
@@ -2727,38 +2771,29 @@ static void isert_free_conn(struct iscsi_conn *conn) | |||
2727 | atomic_dec(&isert_conn->post_send_buf_count); | 2771 | atomic_dec(&isert_conn->post_send_buf_count); |
2728 | 2772 | ||
2729 | if (isert_conn->conn_cm_id && isert_conn->state != ISER_CONN_DOWN) { | 2773 | if (isert_conn->conn_cm_id && isert_conn->state != ISER_CONN_DOWN) { |
2730 | pr_debug("Calling rdma_disconnect from isert_free_conn\n"); | 2774 | pr_debug("Calling rdma_disconnect from isert_wait_conn\n"); |
2731 | rdma_disconnect(isert_conn->conn_cm_id); | 2775 | rdma_disconnect(isert_conn->conn_cm_id); |
2732 | } | 2776 | } |
2733 | /* | 2777 | /* |
2734 | * Only wait for conn_wait_comp_err if the isert_conn made it | 2778 | * Only wait for conn_wait_comp_err if the isert_conn made it |
2735 | * into full feature phase.. | 2779 | * into full feature phase.. |
2736 | */ | 2780 | */ |
2737 | if (isert_conn->state == ISER_CONN_UP) { | ||
2738 | pr_debug("isert_free_conn: Before wait_event comp_err %d\n", | ||
2739 | isert_conn->state); | ||
2740 | mutex_unlock(&isert_conn->conn_mutex); | ||
2741 | |||
2742 | wait_event(isert_conn->conn_wait_comp_err, | ||
2743 | (isert_check_state(isert_conn, ISER_CONN_TERMINATING))); | ||
2744 | |||
2745 | wait_event(isert_conn->conn_wait, | ||
2746 | (isert_check_state(isert_conn, ISER_CONN_DOWN))); | ||
2747 | |||
2748 | isert_put_conn(isert_conn); | ||
2749 | return; | ||
2750 | } | ||
2751 | if (isert_conn->state == ISER_CONN_INIT) { | 2781 | if (isert_conn->state == ISER_CONN_INIT) { |
2752 | mutex_unlock(&isert_conn->conn_mutex); | 2782 | mutex_unlock(&isert_conn->conn_mutex); |
2753 | isert_put_conn(isert_conn); | ||
2754 | return; | 2783 | return; |
2755 | } | 2784 | } |
2756 | pr_debug("isert_free_conn: wait_event conn_wait %d\n", | 2785 | if (isert_conn->state == ISER_CONN_UP) |
2757 | isert_conn->state); | 2786 | isert_conn->state = ISER_CONN_TERMINATING; |
2758 | mutex_unlock(&isert_conn->conn_mutex); | 2787 | mutex_unlock(&isert_conn->conn_mutex); |
2759 | 2788 | ||
2760 | wait_event(isert_conn->conn_wait, | 2789 | wait_for_completion(&isert_conn->conn_wait_comp_err); |
2761 | (isert_check_state(isert_conn, ISER_CONN_DOWN))); | 2790 | |
2791 | wait_for_completion(&isert_conn->conn_wait); | ||
2792 | } | ||
2793 | |||
2794 | static void isert_free_conn(struct iscsi_conn *conn) | ||
2795 | { | ||
2796 | struct isert_conn *isert_conn = conn->context; | ||
2762 | 2797 | ||
2763 | isert_put_conn(isert_conn); | 2798 | isert_put_conn(isert_conn); |
2764 | } | 2799 | } |
@@ -2771,6 +2806,7 @@ static struct iscsit_transport iser_target_transport = { | |||
2771 | .iscsit_setup_np = isert_setup_np, | 2806 | .iscsit_setup_np = isert_setup_np, |
2772 | .iscsit_accept_np = isert_accept_np, | 2807 | .iscsit_accept_np = isert_accept_np, |
2773 | .iscsit_free_np = isert_free_np, | 2808 | .iscsit_free_np = isert_free_np, |
2809 | .iscsit_wait_conn = isert_wait_conn, | ||
2774 | .iscsit_free_conn = isert_free_conn, | 2810 | .iscsit_free_conn = isert_free_conn, |
2775 | .iscsit_get_login_rx = isert_get_login_rx, | 2811 | .iscsit_get_login_rx = isert_get_login_rx, |
2776 | .iscsit_put_login_tx = isert_put_login_tx, | 2812 | .iscsit_put_login_tx = isert_put_login_tx, |
diff --git a/drivers/infiniband/ulp/isert/ib_isert.h b/drivers/infiniband/ulp/isert/ib_isert.h index 708a069002f3..f6ae7f5dd408 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.h +++ b/drivers/infiniband/ulp/isert/ib_isert.h | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #define ISERT_RDMA_LISTEN_BACKLOG 10 | 7 | #define ISERT_RDMA_LISTEN_BACKLOG 10 |
8 | #define ISCSI_ISER_SG_TABLESIZE 256 | 8 | #define ISCSI_ISER_SG_TABLESIZE 256 |
9 | #define ISER_FASTREG_LI_WRID 0xffffffffffffffffULL | ||
9 | 10 | ||
10 | enum isert_desc_type { | 11 | enum isert_desc_type { |
11 | ISCSI_TX_CONTROL, | 12 | ISCSI_TX_CONTROL, |
@@ -45,6 +46,7 @@ struct iser_tx_desc { | |||
45 | struct isert_cmd *isert_cmd; | 46 | struct isert_cmd *isert_cmd; |
46 | struct llist_node *comp_llnode_batch; | 47 | struct llist_node *comp_llnode_batch; |
47 | struct llist_node comp_llnode; | 48 | struct llist_node comp_llnode; |
49 | bool llnode_active; | ||
48 | struct ib_send_wr send_wr; | 50 | struct ib_send_wr send_wr; |
49 | } __packed; | 51 | } __packed; |
50 | 52 | ||
@@ -116,8 +118,8 @@ struct isert_conn { | |||
116 | struct isert_device *conn_device; | 118 | struct isert_device *conn_device; |
117 | struct work_struct conn_logout_work; | 119 | struct work_struct conn_logout_work; |
118 | struct mutex conn_mutex; | 120 | struct mutex conn_mutex; |
119 | wait_queue_head_t conn_wait; | 121 | struct completion conn_wait; |
120 | wait_queue_head_t conn_wait_comp_err; | 122 | struct completion conn_wait_comp_err; |
121 | struct kref conn_kref; | 123 | struct kref conn_kref; |
122 | struct list_head conn_fr_pool; | 124 | struct list_head conn_fr_pool; |
123 | int conn_fr_pool_size; | 125 | int conn_fr_pool_size; |
@@ -126,7 +128,6 @@ struct isert_conn { | |||
126 | #define ISERT_COMP_BATCH_COUNT 8 | 128 | #define ISERT_COMP_BATCH_COUNT 8 |
127 | int conn_comp_batch; | 129 | int conn_comp_batch; |
128 | struct llist_head conn_comp_llist; | 130 | struct llist_head conn_comp_llist; |
129 | struct mutex conn_comp_mutex; | ||
130 | }; | 131 | }; |
131 | 132 | ||
132 | #define ISERT_MAX_CQ 64 | 133 | #define ISERT_MAX_CQ 64 |
diff --git a/drivers/input/misc/arizona-haptics.c b/drivers/input/misc/arizona-haptics.c index 7a04f54ef961..ef2e281b0a43 100644 --- a/drivers/input/misc/arizona-haptics.c +++ b/drivers/input/misc/arizona-haptics.c | |||
@@ -37,7 +37,6 @@ static void arizona_haptics_work(struct work_struct *work) | |||
37 | struct arizona_haptics, | 37 | struct arizona_haptics, |
38 | work); | 38 | work); |
39 | struct arizona *arizona = haptics->arizona; | 39 | struct arizona *arizona = haptics->arizona; |
40 | struct mutex *dapm_mutex = &arizona->dapm->card->dapm_mutex; | ||
41 | int ret; | 40 | int ret; |
42 | 41 | ||
43 | if (!haptics->arizona->dapm) { | 42 | if (!haptics->arizona->dapm) { |
@@ -67,13 +66,10 @@ static void arizona_haptics_work(struct work_struct *work) | |||
67 | return; | 66 | return; |
68 | } | 67 | } |
69 | 68 | ||
70 | mutex_lock_nested(dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
71 | |||
72 | ret = snd_soc_dapm_enable_pin(arizona->dapm, "HAPTICS"); | 69 | ret = snd_soc_dapm_enable_pin(arizona->dapm, "HAPTICS"); |
73 | if (ret != 0) { | 70 | if (ret != 0) { |
74 | dev_err(arizona->dev, "Failed to start HAPTICS: %d\n", | 71 | dev_err(arizona->dev, "Failed to start HAPTICS: %d\n", |
75 | ret); | 72 | ret); |
76 | mutex_unlock(dapm_mutex); | ||
77 | return; | 73 | return; |
78 | } | 74 | } |
79 | 75 | ||
@@ -81,21 +77,14 @@ static void arizona_haptics_work(struct work_struct *work) | |||
81 | if (ret != 0) { | 77 | if (ret != 0) { |
82 | dev_err(arizona->dev, "Failed to sync DAPM: %d\n", | 78 | dev_err(arizona->dev, "Failed to sync DAPM: %d\n", |
83 | ret); | 79 | ret); |
84 | mutex_unlock(dapm_mutex); | ||
85 | return; | 80 | return; |
86 | } | 81 | } |
87 | |||
88 | mutex_unlock(dapm_mutex); | ||
89 | |||
90 | } else { | 82 | } else { |
91 | /* This disable sequence will be a noop if already enabled */ | 83 | /* This disable sequence will be a noop if already enabled */ |
92 | mutex_lock_nested(dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
93 | |||
94 | ret = snd_soc_dapm_disable_pin(arizona->dapm, "HAPTICS"); | 84 | ret = snd_soc_dapm_disable_pin(arizona->dapm, "HAPTICS"); |
95 | if (ret != 0) { | 85 | if (ret != 0) { |
96 | dev_err(arizona->dev, "Failed to disable HAPTICS: %d\n", | 86 | dev_err(arizona->dev, "Failed to disable HAPTICS: %d\n", |
97 | ret); | 87 | ret); |
98 | mutex_unlock(dapm_mutex); | ||
99 | return; | 88 | return; |
100 | } | 89 | } |
101 | 90 | ||
@@ -103,12 +92,9 @@ static void arizona_haptics_work(struct work_struct *work) | |||
103 | if (ret != 0) { | 92 | if (ret != 0) { |
104 | dev_err(arizona->dev, "Failed to sync DAPM: %d\n", | 93 | dev_err(arizona->dev, "Failed to sync DAPM: %d\n", |
105 | ret); | 94 | ret); |
106 | mutex_unlock(dapm_mutex); | ||
107 | return; | 95 | return; |
108 | } | 96 | } |
109 | 97 | ||
110 | mutex_unlock(dapm_mutex); | ||
111 | |||
112 | ret = regmap_update_bits(arizona->regmap, | 98 | ret = regmap_update_bits(arizona->regmap, |
113 | ARIZONA_HAPTICS_CONTROL_1, | 99 | ARIZONA_HAPTICS_CONTROL_1, |
114 | ARIZONA_HAP_CTRL_MASK, | 100 | ARIZONA_HAP_CTRL_MASK, |
@@ -155,16 +141,11 @@ static int arizona_haptics_play(struct input_dev *input, void *data, | |||
155 | static void arizona_haptics_close(struct input_dev *input) | 141 | static void arizona_haptics_close(struct input_dev *input) |
156 | { | 142 | { |
157 | struct arizona_haptics *haptics = input_get_drvdata(input); | 143 | struct arizona_haptics *haptics = input_get_drvdata(input); |
158 | struct mutex *dapm_mutex = &haptics->arizona->dapm->card->dapm_mutex; | ||
159 | 144 | ||
160 | cancel_work_sync(&haptics->work); | 145 | cancel_work_sync(&haptics->work); |
161 | 146 | ||
162 | mutex_lock_nested(dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
163 | |||
164 | if (haptics->arizona->dapm) | 147 | if (haptics->arizona->dapm) |
165 | snd_soc_dapm_disable_pin(haptics->arizona->dapm, "HAPTICS"); | 148 | snd_soc_dapm_disable_pin(haptics->arizona->dapm, "HAPTICS"); |
166 | |||
167 | mutex_unlock(dapm_mutex); | ||
168 | } | 149 | } |
169 | 150 | ||
170 | static int arizona_haptics_probe(struct platform_device *pdev) | 151 | static int arizona_haptics_probe(struct platform_device *pdev) |
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 8911850c9444..1d9ab39af29f 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c | |||
@@ -79,7 +79,6 @@ | |||
79 | 79 | ||
80 | #define ARM_SMMU_PTE_CONT_SIZE (PAGE_SIZE * ARM_SMMU_PTE_CONT_ENTRIES) | 80 | #define ARM_SMMU_PTE_CONT_SIZE (PAGE_SIZE * ARM_SMMU_PTE_CONT_ENTRIES) |
81 | #define ARM_SMMU_PTE_CONT_MASK (~(ARM_SMMU_PTE_CONT_SIZE - 1)) | 81 | #define ARM_SMMU_PTE_CONT_MASK (~(ARM_SMMU_PTE_CONT_SIZE - 1)) |
82 | #define ARM_SMMU_PTE_HWTABLE_SIZE (PTRS_PER_PTE * sizeof(pte_t)) | ||
83 | 82 | ||
84 | /* Stage-1 PTE */ | 83 | /* Stage-1 PTE */ |
85 | #define ARM_SMMU_PTE_AP_UNPRIV (((pteval_t)1) << 6) | 84 | #define ARM_SMMU_PTE_AP_UNPRIV (((pteval_t)1) << 6) |
@@ -191,6 +190,9 @@ | |||
191 | #define ARM_SMMU_GR1_CBAR(n) (0x0 + ((n) << 2)) | 190 | #define ARM_SMMU_GR1_CBAR(n) (0x0 + ((n) << 2)) |
192 | #define CBAR_VMID_SHIFT 0 | 191 | #define CBAR_VMID_SHIFT 0 |
193 | #define CBAR_VMID_MASK 0xff | 192 | #define CBAR_VMID_MASK 0xff |
193 | #define CBAR_S1_BPSHCFG_SHIFT 8 | ||
194 | #define CBAR_S1_BPSHCFG_MASK 3 | ||
195 | #define CBAR_S1_BPSHCFG_NSH 3 | ||
194 | #define CBAR_S1_MEMATTR_SHIFT 12 | 196 | #define CBAR_S1_MEMATTR_SHIFT 12 |
195 | #define CBAR_S1_MEMATTR_MASK 0xf | 197 | #define CBAR_S1_MEMATTR_MASK 0xf |
196 | #define CBAR_S1_MEMATTR_WB 0xf | 198 | #define CBAR_S1_MEMATTR_WB 0xf |
@@ -393,7 +395,7 @@ struct arm_smmu_domain { | |||
393 | struct arm_smmu_cfg root_cfg; | 395 | struct arm_smmu_cfg root_cfg; |
394 | phys_addr_t output_mask; | 396 | phys_addr_t output_mask; |
395 | 397 | ||
396 | struct mutex lock; | 398 | spinlock_t lock; |
397 | }; | 399 | }; |
398 | 400 | ||
399 | static DEFINE_SPINLOCK(arm_smmu_devices_lock); | 401 | static DEFINE_SPINLOCK(arm_smmu_devices_lock); |
@@ -632,6 +634,28 @@ static irqreturn_t arm_smmu_global_fault(int irq, void *dev) | |||
632 | return IRQ_HANDLED; | 634 | return IRQ_HANDLED; |
633 | } | 635 | } |
634 | 636 | ||
637 | static void arm_smmu_flush_pgtable(struct arm_smmu_device *smmu, void *addr, | ||
638 | size_t size) | ||
639 | { | ||
640 | unsigned long offset = (unsigned long)addr & ~PAGE_MASK; | ||
641 | |||
642 | |||
643 | /* Ensure new page tables are visible to the hardware walker */ | ||
644 | if (smmu->features & ARM_SMMU_FEAT_COHERENT_WALK) { | ||
645 | dsb(); | ||
646 | } else { | ||
647 | /* | ||
648 | * If the SMMU can't walk tables in the CPU caches, treat them | ||
649 | * like non-coherent DMA since we need to flush the new entries | ||
650 | * all the way out to memory. There's no possibility of | ||
651 | * recursion here as the SMMU table walker will not be wired | ||
652 | * through another SMMU. | ||
653 | */ | ||
654 | dma_map_page(smmu->dev, virt_to_page(addr), offset, size, | ||
655 | DMA_TO_DEVICE); | ||
656 | } | ||
657 | } | ||
658 | |||
635 | static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain) | 659 | static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain) |
636 | { | 660 | { |
637 | u32 reg; | 661 | u32 reg; |
@@ -650,11 +674,16 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain) | |||
650 | if (smmu->version == 1) | 674 | if (smmu->version == 1) |
651 | reg |= root_cfg->irptndx << CBAR_IRPTNDX_SHIFT; | 675 | reg |= root_cfg->irptndx << CBAR_IRPTNDX_SHIFT; |
652 | 676 | ||
653 | /* Use the weakest memory type, so it is overridden by the pte */ | 677 | /* |
654 | if (stage1) | 678 | * Use the weakest shareability/memory types, so they are |
655 | reg |= (CBAR_S1_MEMATTR_WB << CBAR_S1_MEMATTR_SHIFT); | 679 | * overridden by the ttbcr/pte. |
656 | else | 680 | */ |
681 | if (stage1) { | ||
682 | reg |= (CBAR_S1_BPSHCFG_NSH << CBAR_S1_BPSHCFG_SHIFT) | | ||
683 | (CBAR_S1_MEMATTR_WB << CBAR_S1_MEMATTR_SHIFT); | ||
684 | } else { | ||
657 | reg |= ARM_SMMU_CB_VMID(root_cfg) << CBAR_VMID_SHIFT; | 685 | reg |= ARM_SMMU_CB_VMID(root_cfg) << CBAR_VMID_SHIFT; |
686 | } | ||
658 | writel_relaxed(reg, gr1_base + ARM_SMMU_GR1_CBAR(root_cfg->cbndx)); | 687 | writel_relaxed(reg, gr1_base + ARM_SMMU_GR1_CBAR(root_cfg->cbndx)); |
659 | 688 | ||
660 | if (smmu->version > 1) { | 689 | if (smmu->version > 1) { |
@@ -715,6 +744,8 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain) | |||
715 | } | 744 | } |
716 | 745 | ||
717 | /* TTBR0 */ | 746 | /* TTBR0 */ |
747 | arm_smmu_flush_pgtable(smmu, root_cfg->pgd, | ||
748 | PTRS_PER_PGD * sizeof(pgd_t)); | ||
718 | reg = __pa(root_cfg->pgd); | 749 | reg = __pa(root_cfg->pgd); |
719 | writel_relaxed(reg, cb_base + ARM_SMMU_CB_TTBR0_LO); | 750 | writel_relaxed(reg, cb_base + ARM_SMMU_CB_TTBR0_LO); |
720 | reg = (phys_addr_t)__pa(root_cfg->pgd) >> 32; | 751 | reg = (phys_addr_t)__pa(root_cfg->pgd) >> 32; |
@@ -901,7 +932,7 @@ static int arm_smmu_domain_init(struct iommu_domain *domain) | |||
901 | goto out_free_domain; | 932 | goto out_free_domain; |
902 | smmu_domain->root_cfg.pgd = pgd; | 933 | smmu_domain->root_cfg.pgd = pgd; |
903 | 934 | ||
904 | mutex_init(&smmu_domain->lock); | 935 | spin_lock_init(&smmu_domain->lock); |
905 | domain->priv = smmu_domain; | 936 | domain->priv = smmu_domain; |
906 | return 0; | 937 | return 0; |
907 | 938 | ||
@@ -1128,6 +1159,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) | |||
1128 | struct arm_smmu_domain *smmu_domain = domain->priv; | 1159 | struct arm_smmu_domain *smmu_domain = domain->priv; |
1129 | struct arm_smmu_device *device_smmu = dev->archdata.iommu; | 1160 | struct arm_smmu_device *device_smmu = dev->archdata.iommu; |
1130 | struct arm_smmu_master *master; | 1161 | struct arm_smmu_master *master; |
1162 | unsigned long flags; | ||
1131 | 1163 | ||
1132 | if (!device_smmu) { | 1164 | if (!device_smmu) { |
1133 | dev_err(dev, "cannot attach to SMMU, is it on the same bus?\n"); | 1165 | dev_err(dev, "cannot attach to SMMU, is it on the same bus?\n"); |
@@ -1138,7 +1170,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) | |||
1138 | * Sanity check the domain. We don't currently support domains | 1170 | * Sanity check the domain. We don't currently support domains |
1139 | * that cross between different SMMU chains. | 1171 | * that cross between different SMMU chains. |
1140 | */ | 1172 | */ |
1141 | mutex_lock(&smmu_domain->lock); | 1173 | spin_lock_irqsave(&smmu_domain->lock, flags); |
1142 | if (!smmu_domain->leaf_smmu) { | 1174 | if (!smmu_domain->leaf_smmu) { |
1143 | /* Now that we have a master, we can finalise the domain */ | 1175 | /* Now that we have a master, we can finalise the domain */ |
1144 | ret = arm_smmu_init_domain_context(domain, dev); | 1176 | ret = arm_smmu_init_domain_context(domain, dev); |
@@ -1153,7 +1185,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) | |||
1153 | dev_name(device_smmu->dev)); | 1185 | dev_name(device_smmu->dev)); |
1154 | goto err_unlock; | 1186 | goto err_unlock; |
1155 | } | 1187 | } |
1156 | mutex_unlock(&smmu_domain->lock); | 1188 | spin_unlock_irqrestore(&smmu_domain->lock, flags); |
1157 | 1189 | ||
1158 | /* Looks ok, so add the device to the domain */ | 1190 | /* Looks ok, so add the device to the domain */ |
1159 | master = find_smmu_master(smmu_domain->leaf_smmu, dev->of_node); | 1191 | master = find_smmu_master(smmu_domain->leaf_smmu, dev->of_node); |
@@ -1163,7 +1195,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) | |||
1163 | return arm_smmu_domain_add_master(smmu_domain, master); | 1195 | return arm_smmu_domain_add_master(smmu_domain, master); |
1164 | 1196 | ||
1165 | err_unlock: | 1197 | err_unlock: |
1166 | mutex_unlock(&smmu_domain->lock); | 1198 | spin_unlock_irqrestore(&smmu_domain->lock, flags); |
1167 | return ret; | 1199 | return ret; |
1168 | } | 1200 | } |
1169 | 1201 | ||
@@ -1177,23 +1209,6 @@ static void arm_smmu_detach_dev(struct iommu_domain *domain, struct device *dev) | |||
1177 | arm_smmu_domain_remove_master(smmu_domain, master); | 1209 | arm_smmu_domain_remove_master(smmu_domain, master); |
1178 | } | 1210 | } |
1179 | 1211 | ||
1180 | static void arm_smmu_flush_pgtable(struct arm_smmu_device *smmu, void *addr, | ||
1181 | size_t size) | ||
1182 | { | ||
1183 | unsigned long offset = (unsigned long)addr & ~PAGE_MASK; | ||
1184 | |||
1185 | /* | ||
1186 | * If the SMMU can't walk tables in the CPU caches, treat them | ||
1187 | * like non-coherent DMA since we need to flush the new entries | ||
1188 | * all the way out to memory. There's no possibility of recursion | ||
1189 | * here as the SMMU table walker will not be wired through another | ||
1190 | * SMMU. | ||
1191 | */ | ||
1192 | if (!(smmu->features & ARM_SMMU_FEAT_COHERENT_WALK)) | ||
1193 | dma_map_page(smmu->dev, virt_to_page(addr), offset, size, | ||
1194 | DMA_TO_DEVICE); | ||
1195 | } | ||
1196 | |||
1197 | static bool arm_smmu_pte_is_contiguous_range(unsigned long addr, | 1212 | static bool arm_smmu_pte_is_contiguous_range(unsigned long addr, |
1198 | unsigned long end) | 1213 | unsigned long end) |
1199 | { | 1214 | { |
@@ -1210,12 +1225,11 @@ static int arm_smmu_alloc_init_pte(struct arm_smmu_device *smmu, pmd_t *pmd, | |||
1210 | 1225 | ||
1211 | if (pmd_none(*pmd)) { | 1226 | if (pmd_none(*pmd)) { |
1212 | /* Allocate a new set of tables */ | 1227 | /* Allocate a new set of tables */ |
1213 | pgtable_t table = alloc_page(PGALLOC_GFP); | 1228 | pgtable_t table = alloc_page(GFP_ATOMIC|__GFP_ZERO); |
1214 | if (!table) | 1229 | if (!table) |
1215 | return -ENOMEM; | 1230 | return -ENOMEM; |
1216 | 1231 | ||
1217 | arm_smmu_flush_pgtable(smmu, page_address(table), | 1232 | arm_smmu_flush_pgtable(smmu, page_address(table), PAGE_SIZE); |
1218 | ARM_SMMU_PTE_HWTABLE_SIZE); | ||
1219 | if (!pgtable_page_ctor(table)) { | 1233 | if (!pgtable_page_ctor(table)) { |
1220 | __free_page(table); | 1234 | __free_page(table); |
1221 | return -ENOMEM; | 1235 | return -ENOMEM; |
@@ -1317,9 +1331,15 @@ static int arm_smmu_alloc_init_pmd(struct arm_smmu_device *smmu, pud_t *pud, | |||
1317 | 1331 | ||
1318 | #ifndef __PAGETABLE_PMD_FOLDED | 1332 | #ifndef __PAGETABLE_PMD_FOLDED |
1319 | if (pud_none(*pud)) { | 1333 | if (pud_none(*pud)) { |
1320 | pmd = pmd_alloc_one(NULL, addr); | 1334 | pmd = (pmd_t *)get_zeroed_page(GFP_ATOMIC); |
1321 | if (!pmd) | 1335 | if (!pmd) |
1322 | return -ENOMEM; | 1336 | return -ENOMEM; |
1337 | |||
1338 | arm_smmu_flush_pgtable(smmu, pmd, PAGE_SIZE); | ||
1339 | pud_populate(NULL, pud, pmd); | ||
1340 | arm_smmu_flush_pgtable(smmu, pud, sizeof(*pud)); | ||
1341 | |||
1342 | pmd += pmd_index(addr); | ||
1323 | } else | 1343 | } else |
1324 | #endif | 1344 | #endif |
1325 | pmd = pmd_offset(pud, addr); | 1345 | pmd = pmd_offset(pud, addr); |
@@ -1328,8 +1348,6 @@ static int arm_smmu_alloc_init_pmd(struct arm_smmu_device *smmu, pud_t *pud, | |||
1328 | next = pmd_addr_end(addr, end); | 1348 | next = pmd_addr_end(addr, end); |
1329 | ret = arm_smmu_alloc_init_pte(smmu, pmd, addr, end, pfn, | 1349 | ret = arm_smmu_alloc_init_pte(smmu, pmd, addr, end, pfn, |
1330 | flags, stage); | 1350 | flags, stage); |
1331 | pud_populate(NULL, pud, pmd); | ||
1332 | arm_smmu_flush_pgtable(smmu, pud, sizeof(*pud)); | ||
1333 | phys += next - addr; | 1351 | phys += next - addr; |
1334 | } while (pmd++, addr = next, addr < end); | 1352 | } while (pmd++, addr = next, addr < end); |
1335 | 1353 | ||
@@ -1346,9 +1364,15 @@ static int arm_smmu_alloc_init_pud(struct arm_smmu_device *smmu, pgd_t *pgd, | |||
1346 | 1364 | ||
1347 | #ifndef __PAGETABLE_PUD_FOLDED | 1365 | #ifndef __PAGETABLE_PUD_FOLDED |
1348 | if (pgd_none(*pgd)) { | 1366 | if (pgd_none(*pgd)) { |
1349 | pud = pud_alloc_one(NULL, addr); | 1367 | pud = (pud_t *)get_zeroed_page(GFP_ATOMIC); |
1350 | if (!pud) | 1368 | if (!pud) |
1351 | return -ENOMEM; | 1369 | return -ENOMEM; |
1370 | |||
1371 | arm_smmu_flush_pgtable(smmu, pud, PAGE_SIZE); | ||
1372 | pgd_populate(NULL, pgd, pud); | ||
1373 | arm_smmu_flush_pgtable(smmu, pgd, sizeof(*pgd)); | ||
1374 | |||
1375 | pud += pud_index(addr); | ||
1352 | } else | 1376 | } else |
1353 | #endif | 1377 | #endif |
1354 | pud = pud_offset(pgd, addr); | 1378 | pud = pud_offset(pgd, addr); |
@@ -1357,8 +1381,6 @@ static int arm_smmu_alloc_init_pud(struct arm_smmu_device *smmu, pgd_t *pgd, | |||
1357 | next = pud_addr_end(addr, end); | 1381 | next = pud_addr_end(addr, end); |
1358 | ret = arm_smmu_alloc_init_pmd(smmu, pud, addr, next, phys, | 1382 | ret = arm_smmu_alloc_init_pmd(smmu, pud, addr, next, phys, |
1359 | flags, stage); | 1383 | flags, stage); |
1360 | pgd_populate(NULL, pud, pgd); | ||
1361 | arm_smmu_flush_pgtable(smmu, pgd, sizeof(*pgd)); | ||
1362 | phys += next - addr; | 1384 | phys += next - addr; |
1363 | } while (pud++, addr = next, addr < end); | 1385 | } while (pud++, addr = next, addr < end); |
1364 | 1386 | ||
@@ -1375,6 +1397,7 @@ static int arm_smmu_handle_mapping(struct arm_smmu_domain *smmu_domain, | |||
1375 | struct arm_smmu_cfg *root_cfg = &smmu_domain->root_cfg; | 1397 | struct arm_smmu_cfg *root_cfg = &smmu_domain->root_cfg; |
1376 | pgd_t *pgd = root_cfg->pgd; | 1398 | pgd_t *pgd = root_cfg->pgd; |
1377 | struct arm_smmu_device *smmu = root_cfg->smmu; | 1399 | struct arm_smmu_device *smmu = root_cfg->smmu; |
1400 | unsigned long irqflags; | ||
1378 | 1401 | ||
1379 | if (root_cfg->cbar == CBAR_TYPE_S2_TRANS) { | 1402 | if (root_cfg->cbar == CBAR_TYPE_S2_TRANS) { |
1380 | stage = 2; | 1403 | stage = 2; |
@@ -1397,7 +1420,7 @@ static int arm_smmu_handle_mapping(struct arm_smmu_domain *smmu_domain, | |||
1397 | if (paddr & ~output_mask) | 1420 | if (paddr & ~output_mask) |
1398 | return -ERANGE; | 1421 | return -ERANGE; |
1399 | 1422 | ||
1400 | mutex_lock(&smmu_domain->lock); | 1423 | spin_lock_irqsave(&smmu_domain->lock, irqflags); |
1401 | pgd += pgd_index(iova); | 1424 | pgd += pgd_index(iova); |
1402 | end = iova + size; | 1425 | end = iova + size; |
1403 | do { | 1426 | do { |
@@ -1413,11 +1436,7 @@ static int arm_smmu_handle_mapping(struct arm_smmu_domain *smmu_domain, | |||
1413 | } while (pgd++, iova != end); | 1436 | } while (pgd++, iova != end); |
1414 | 1437 | ||
1415 | out_unlock: | 1438 | out_unlock: |
1416 | mutex_unlock(&smmu_domain->lock); | 1439 | spin_unlock_irqrestore(&smmu_domain->lock, irqflags); |
1417 | |||
1418 | /* Ensure new page tables are visible to the hardware walker */ | ||
1419 | if (smmu->features & ARM_SMMU_FEAT_COHERENT_WALK) | ||
1420 | dsb(); | ||
1421 | 1440 | ||
1422 | return ret; | 1441 | return ret; |
1423 | } | 1442 | } |
@@ -1987,8 +2006,10 @@ static int __init arm_smmu_init(void) | |||
1987 | if (!iommu_present(&platform_bus_type)) | 2006 | if (!iommu_present(&platform_bus_type)) |
1988 | bus_set_iommu(&platform_bus_type, &arm_smmu_ops); | 2007 | bus_set_iommu(&platform_bus_type, &arm_smmu_ops); |
1989 | 2008 | ||
2009 | #ifdef CONFIG_ARM_AMBA | ||
1990 | if (!iommu_present(&amba_bustype)) | 2010 | if (!iommu_present(&amba_bustype)) |
1991 | bus_set_iommu(&amba_bustype, &arm_smmu_ops); | 2011 | bus_set_iommu(&amba_bustype, &arm_smmu_ops); |
2012 | #endif | ||
1992 | 2013 | ||
1993 | return 0; | 2014 | return 0; |
1994 | } | 2015 | } |
diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c index d97fbe4fb9b1..80fffba7f12d 100644 --- a/drivers/iommu/omap-iommu-debug.c +++ b/drivers/iommu/omap-iommu-debug.c | |||
@@ -354,8 +354,8 @@ DEBUG_FOPS(mem); | |||
354 | return -ENOMEM; \ | 354 | return -ENOMEM; \ |
355 | } | 355 | } |
356 | 356 | ||
357 | #define DEBUG_ADD_FILE(name) __DEBUG_ADD_FILE(name, 600) | 357 | #define DEBUG_ADD_FILE(name) __DEBUG_ADD_FILE(name, 0600) |
358 | #define DEBUG_ADD_FILE_RO(name) __DEBUG_ADD_FILE(name, 400) | 358 | #define DEBUG_ADD_FILE_RO(name) __DEBUG_ADD_FILE(name, 0400) |
359 | 359 | ||
360 | static int iommu_debug_register(struct device *dev, void *data) | 360 | static int iommu_debug_register(struct device *dev, void *data) |
361 | { | 361 | { |
diff --git a/drivers/irqchip/irq-metag-ext.c b/drivers/irqchip/irq-metag-ext.c index 92c41ab4dbfd..2cb474ad8809 100644 --- a/drivers/irqchip/irq-metag-ext.c +++ b/drivers/irqchip/irq-metag-ext.c | |||
@@ -515,7 +515,7 @@ static int meta_intc_set_affinity(struct irq_data *data, | |||
515 | * one cpu (the interrupt code doesn't support it), so we just | 515 | * one cpu (the interrupt code doesn't support it), so we just |
516 | * pick the first cpu we find in 'cpumask'. | 516 | * pick the first cpu we find in 'cpumask'. |
517 | */ | 517 | */ |
518 | cpu = cpumask_any(cpumask); | 518 | cpu = cpumask_any_and(cpumask, cpu_online_mask); |
519 | thread = cpu_2_hwthread_id[cpu]; | 519 | thread = cpu_2_hwthread_id[cpu]; |
520 | 520 | ||
521 | metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR2(thread)), vec_addr); | 521 | metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR2(thread)), vec_addr); |
diff --git a/drivers/irqchip/irq-metag.c b/drivers/irqchip/irq-metag.c index 8e94d7a3b20d..c16c186d97d3 100644 --- a/drivers/irqchip/irq-metag.c +++ b/drivers/irqchip/irq-metag.c | |||
@@ -201,7 +201,7 @@ static int metag_internal_irq_set_affinity(struct irq_data *data, | |||
201 | * one cpu (the interrupt code doesn't support it), so we just | 201 | * one cpu (the interrupt code doesn't support it), so we just |
202 | * pick the first cpu we find in 'cpumask'. | 202 | * pick the first cpu we find in 'cpumask'. |
203 | */ | 203 | */ |
204 | cpu = cpumask_any(cpumask); | 204 | cpu = cpumask_any_and(cpumask, cpu_online_mask); |
205 | thread = cpu_2_hwthread_id[cpu]; | 205 | thread = cpu_2_hwthread_id[cpu]; |
206 | 206 | ||
207 | metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR1(thread)), | 207 | metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR1(thread)), |
diff --git a/drivers/irqchip/irq-orion.c b/drivers/irqchip/irq-orion.c index c3f0f41ad753..e25f246cd2fb 100644 --- a/drivers/irqchip/irq-orion.c +++ b/drivers/irqchip/irq-orion.c | |||
@@ -111,7 +111,8 @@ IRQCHIP_DECLARE(orion_intc, "marvell,orion-intc", orion_irq_init); | |||
111 | static void orion_bridge_irq_handler(unsigned int irq, struct irq_desc *desc) | 111 | static void orion_bridge_irq_handler(unsigned int irq, struct irq_desc *desc) |
112 | { | 112 | { |
113 | struct irq_domain *d = irq_get_handler_data(irq); | 113 | struct irq_domain *d = irq_get_handler_data(irq); |
114 | struct irq_chip_generic *gc = irq_get_domain_generic_chip(d, irq); | 114 | |
115 | struct irq_chip_generic *gc = irq_get_domain_generic_chip(d, 0); | ||
115 | u32 stat = readl_relaxed(gc->reg_base + ORION_BRIDGE_IRQ_CAUSE) & | 116 | u32 stat = readl_relaxed(gc->reg_base + ORION_BRIDGE_IRQ_CAUSE) & |
116 | gc->mask_cache; | 117 | gc->mask_cache; |
117 | 118 | ||
@@ -123,6 +124,19 @@ static void orion_bridge_irq_handler(unsigned int irq, struct irq_desc *desc) | |||
123 | } | 124 | } |
124 | } | 125 | } |
125 | 126 | ||
127 | /* | ||
128 | * Bridge IRQ_CAUSE is asserted regardless of IRQ_MASK register. | ||
129 | * To avoid interrupt events on stale irqs, we clear them before unmask. | ||
130 | */ | ||
131 | static unsigned int orion_bridge_irq_startup(struct irq_data *d) | ||
132 | { | ||
133 | struct irq_chip_type *ct = irq_data_get_chip_type(d); | ||
134 | |||
135 | ct->chip.irq_ack(d); | ||
136 | ct->chip.irq_unmask(d); | ||
137 | return 0; | ||
138 | } | ||
139 | |||
126 | static int __init orion_bridge_irq_init(struct device_node *np, | 140 | static int __init orion_bridge_irq_init(struct device_node *np, |
127 | struct device_node *parent) | 141 | struct device_node *parent) |
128 | { | 142 | { |
@@ -143,7 +157,7 @@ static int __init orion_bridge_irq_init(struct device_node *np, | |||
143 | } | 157 | } |
144 | 158 | ||
145 | ret = irq_alloc_domain_generic_chips(domain, nrirqs, 1, np->name, | 159 | ret = irq_alloc_domain_generic_chips(domain, nrirqs, 1, np->name, |
146 | handle_level_irq, clr, 0, IRQ_GC_INIT_MASK_CACHE); | 160 | handle_edge_irq, clr, 0, IRQ_GC_INIT_MASK_CACHE); |
147 | if (ret) { | 161 | if (ret) { |
148 | pr_err("%s: unable to alloc irq domain gc\n", np->name); | 162 | pr_err("%s: unable to alloc irq domain gc\n", np->name); |
149 | return ret; | 163 | return ret; |
@@ -176,12 +190,14 @@ static int __init orion_bridge_irq_init(struct device_node *np, | |||
176 | 190 | ||
177 | gc->chip_types[0].regs.ack = ORION_BRIDGE_IRQ_CAUSE; | 191 | gc->chip_types[0].regs.ack = ORION_BRIDGE_IRQ_CAUSE; |
178 | gc->chip_types[0].regs.mask = ORION_BRIDGE_IRQ_MASK; | 192 | gc->chip_types[0].regs.mask = ORION_BRIDGE_IRQ_MASK; |
193 | gc->chip_types[0].chip.irq_startup = orion_bridge_irq_startup; | ||
179 | gc->chip_types[0].chip.irq_ack = irq_gc_ack_clr_bit; | 194 | gc->chip_types[0].chip.irq_ack = irq_gc_ack_clr_bit; |
180 | gc->chip_types[0].chip.irq_mask = irq_gc_mask_clr_bit; | 195 | gc->chip_types[0].chip.irq_mask = irq_gc_mask_clr_bit; |
181 | gc->chip_types[0].chip.irq_unmask = irq_gc_mask_set_bit; | 196 | gc->chip_types[0].chip.irq_unmask = irq_gc_mask_set_bit; |
182 | 197 | ||
183 | /* mask all interrupts */ | 198 | /* mask and clear all interrupts */ |
184 | writel(0, gc->reg_base + ORION_BRIDGE_IRQ_MASK); | 199 | writel(0, gc->reg_base + ORION_BRIDGE_IRQ_MASK); |
200 | writel(0, gc->reg_base + ORION_BRIDGE_IRQ_CAUSE); | ||
185 | 201 | ||
186 | irq_set_handler_data(irq, domain); | 202 | irq_set_handler_data(irq, domain); |
187 | irq_set_chained_handler(irq, orion_bridge_irq_handler); | 203 | irq_set_chained_handler(irq, orion_bridge_irq_handler); |
diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig index 9a06fe883766..95ad936e6048 100644 --- a/drivers/md/Kconfig +++ b/drivers/md/Kconfig | |||
@@ -254,16 +254,6 @@ config DM_THIN_PROVISIONING | |||
254 | ---help--- | 254 | ---help--- |
255 | Provides thin provisioning and snapshots that share a data store. | 255 | Provides thin provisioning and snapshots that share a data store. |
256 | 256 | ||
257 | config DM_DEBUG_BLOCK_STACK_TRACING | ||
258 | boolean "Keep stack trace of persistent data block lock holders" | ||
259 | depends on STACKTRACE_SUPPORT && DM_PERSISTENT_DATA | ||
260 | select STACKTRACE | ||
261 | ---help--- | ||
262 | Enable this for messages that may help debug problems with the | ||
263 | block manager locking used by thin provisioning and caching. | ||
264 | |||
265 | If unsure, say N. | ||
266 | |||
267 | config DM_CACHE | 257 | config DM_CACHE |
268 | tristate "Cache target (EXPERIMENTAL)" | 258 | tristate "Cache target (EXPERIMENTAL)" |
269 | depends on BLK_DEV_DM | 259 | depends on BLK_DEV_DM |
diff --git a/drivers/md/dm-cache-policy-mq.c b/drivers/md/dm-cache-policy-mq.c index 1e018e986610..0e385e40909e 100644 --- a/drivers/md/dm-cache-policy-mq.c +++ b/drivers/md/dm-cache-policy-mq.c | |||
@@ -872,7 +872,7 @@ static void mq_destroy(struct dm_cache_policy *p) | |||
872 | { | 872 | { |
873 | struct mq_policy *mq = to_mq_policy(p); | 873 | struct mq_policy *mq = to_mq_policy(p); |
874 | 874 | ||
875 | kfree(mq->table); | 875 | vfree(mq->table); |
876 | epool_exit(&mq->cache_pool); | 876 | epool_exit(&mq->cache_pool); |
877 | epool_exit(&mq->pre_cache_pool); | 877 | epool_exit(&mq->pre_cache_pool); |
878 | kfree(mq); | 878 | kfree(mq); |
@@ -1245,7 +1245,7 @@ static struct dm_cache_policy *mq_create(dm_cblock_t cache_size, | |||
1245 | 1245 | ||
1246 | mq->nr_buckets = next_power(from_cblock(cache_size) / 2, 16); | 1246 | mq->nr_buckets = next_power(from_cblock(cache_size) / 2, 16); |
1247 | mq->hash_bits = ffs(mq->nr_buckets) - 1; | 1247 | mq->hash_bits = ffs(mq->nr_buckets) - 1; |
1248 | mq->table = kzalloc(sizeof(*mq->table) * mq->nr_buckets, GFP_KERNEL); | 1248 | mq->table = vzalloc(sizeof(*mq->table) * mq->nr_buckets); |
1249 | if (!mq->table) | 1249 | if (!mq->table) |
1250 | goto bad_alloc_table; | 1250 | goto bad_alloc_table; |
1251 | 1251 | ||
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index ffd472e015ca..1af70145fab9 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
@@ -289,6 +289,7 @@ struct per_bio_data { | |||
289 | bool tick:1; | 289 | bool tick:1; |
290 | unsigned req_nr:2; | 290 | unsigned req_nr:2; |
291 | struct dm_deferred_entry *all_io_entry; | 291 | struct dm_deferred_entry *all_io_entry; |
292 | struct dm_hook_info hook_info; | ||
292 | 293 | ||
293 | /* | 294 | /* |
294 | * writethrough fields. These MUST remain at the end of this | 295 | * writethrough fields. These MUST remain at the end of this |
@@ -297,7 +298,6 @@ struct per_bio_data { | |||
297 | */ | 298 | */ |
298 | struct cache *cache; | 299 | struct cache *cache; |
299 | dm_cblock_t cblock; | 300 | dm_cblock_t cblock; |
300 | struct dm_hook_info hook_info; | ||
301 | struct dm_bio_details bio_details; | 301 | struct dm_bio_details bio_details; |
302 | }; | 302 | }; |
303 | 303 | ||
@@ -671,15 +671,16 @@ static void remap_to_cache(struct cache *cache, struct bio *bio, | |||
671 | dm_cblock_t cblock) | 671 | dm_cblock_t cblock) |
672 | { | 672 | { |
673 | sector_t bi_sector = bio->bi_iter.bi_sector; | 673 | sector_t bi_sector = bio->bi_iter.bi_sector; |
674 | sector_t block = from_cblock(cblock); | ||
674 | 675 | ||
675 | bio->bi_bdev = cache->cache_dev->bdev; | 676 | bio->bi_bdev = cache->cache_dev->bdev; |
676 | if (!block_size_is_power_of_two(cache)) | 677 | if (!block_size_is_power_of_two(cache)) |
677 | bio->bi_iter.bi_sector = | 678 | bio->bi_iter.bi_sector = |
678 | (from_cblock(cblock) * cache->sectors_per_block) + | 679 | (block * cache->sectors_per_block) + |
679 | sector_div(bi_sector, cache->sectors_per_block); | 680 | sector_div(bi_sector, cache->sectors_per_block); |
680 | else | 681 | else |
681 | bio->bi_iter.bi_sector = | 682 | bio->bi_iter.bi_sector = |
682 | (from_cblock(cblock) << cache->sectors_per_block_shift) | | 683 | (block << cache->sectors_per_block_shift) | |
683 | (bi_sector & (cache->sectors_per_block - 1)); | 684 | (bi_sector & (cache->sectors_per_block - 1)); |
684 | } | 685 | } |
685 | 686 | ||
@@ -1010,13 +1011,15 @@ static void overwrite_endio(struct bio *bio, int err) | |||
1010 | struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); | 1011 | struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); |
1011 | unsigned long flags; | 1012 | unsigned long flags; |
1012 | 1013 | ||
1014 | dm_unhook_bio(&pb->hook_info, bio); | ||
1015 | |||
1013 | if (err) | 1016 | if (err) |
1014 | mg->err = true; | 1017 | mg->err = true; |
1015 | 1018 | ||
1019 | mg->requeue_holder = false; | ||
1020 | |||
1016 | spin_lock_irqsave(&cache->lock, flags); | 1021 | spin_lock_irqsave(&cache->lock, flags); |
1017 | list_add_tail(&mg->list, &cache->completed_migrations); | 1022 | list_add_tail(&mg->list, &cache->completed_migrations); |
1018 | dm_unhook_bio(&pb->hook_info, bio); | ||
1019 | mg->requeue_holder = false; | ||
1020 | spin_unlock_irqrestore(&cache->lock, flags); | 1023 | spin_unlock_irqrestore(&cache->lock, flags); |
1021 | 1024 | ||
1022 | wake_worker(cache); | 1025 | wake_worker(cache); |
diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c index b2b8a10e8427..3842ac738f98 100644 --- a/drivers/md/dm-io.c +++ b/drivers/md/dm-io.c | |||
@@ -201,29 +201,28 @@ static void list_dp_init(struct dpages *dp, struct page_list *pl, unsigned offse | |||
201 | /* | 201 | /* |
202 | * Functions for getting the pages from a bvec. | 202 | * Functions for getting the pages from a bvec. |
203 | */ | 203 | */ |
204 | static void bio_get_page(struct dpages *dp, | 204 | static void bio_get_page(struct dpages *dp, struct page **p, |
205 | struct page **p, unsigned long *len, unsigned *offset) | 205 | unsigned long *len, unsigned *offset) |
206 | { | 206 | { |
207 | struct bio *bio = dp->context_ptr; | 207 | struct bio_vec *bvec = dp->context_ptr; |
208 | struct bio_vec bvec = bio_iovec(bio); | 208 | *p = bvec->bv_page; |
209 | *p = bvec.bv_page; | 209 | *len = bvec->bv_len - dp->context_u; |
210 | *len = bvec.bv_len; | 210 | *offset = bvec->bv_offset + dp->context_u; |
211 | *offset = bvec.bv_offset; | ||
212 | } | 211 | } |
213 | 212 | ||
214 | static void bio_next_page(struct dpages *dp) | 213 | static void bio_next_page(struct dpages *dp) |
215 | { | 214 | { |
216 | struct bio *bio = dp->context_ptr; | 215 | struct bio_vec *bvec = dp->context_ptr; |
217 | struct bio_vec bvec = bio_iovec(bio); | 216 | dp->context_ptr = bvec + 1; |
218 | 217 | dp->context_u = 0; | |
219 | bio_advance(bio, bvec.bv_len); | ||
220 | } | 218 | } |
221 | 219 | ||
222 | static void bio_dp_init(struct dpages *dp, struct bio *bio) | 220 | static void bio_dp_init(struct dpages *dp, struct bio *bio) |
223 | { | 221 | { |
224 | dp->get_page = bio_get_page; | 222 | dp->get_page = bio_get_page; |
225 | dp->next_page = bio_next_page; | 223 | dp->next_page = bio_next_page; |
226 | dp->context_ptr = bio; | 224 | dp->context_ptr = __bvec_iter_bvec(bio->bi_io_vec, bio->bi_iter); |
225 | dp->context_u = bio->bi_iter.bi_bvec_done; | ||
227 | } | 226 | } |
228 | 227 | ||
229 | /* | 228 | /* |
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 6eb9dc9ef8f3..422a9fdeb53e 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -1626,8 +1626,11 @@ static int multipath_ioctl(struct dm_target *ti, unsigned int cmd, | |||
1626 | /* | 1626 | /* |
1627 | * Only pass ioctls through if the device sizes match exactly. | 1627 | * Only pass ioctls through if the device sizes match exactly. |
1628 | */ | 1628 | */ |
1629 | if (!r && ti->len != i_size_read(bdev->bd_inode) >> SECTOR_SHIFT) | 1629 | if (!bdev || ti->len != i_size_read(bdev->bd_inode) >> SECTOR_SHIFT) { |
1630 | r = scsi_verify_blk_ioctl(NULL, cmd); | 1630 | int err = scsi_verify_blk_ioctl(NULL, cmd); |
1631 | if (err) | ||
1632 | r = err; | ||
1633 | } | ||
1631 | 1634 | ||
1632 | if (r == -ENOTCONN && !fatal_signal_pending(current)) | 1635 | if (r == -ENOTCONN && !fatal_signal_pending(current)) |
1633 | queue_work(kmultipathd, &m->process_queued_ios); | 1636 | queue_work(kmultipathd, &m->process_queued_ios); |
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index f284e0bfb25f..7dfdb5c746d6 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
@@ -1244,6 +1244,9 @@ static int mirror_end_io(struct dm_target *ti, struct bio *bio, int error) | |||
1244 | 1244 | ||
1245 | dm_bio_restore(bd, bio); | 1245 | dm_bio_restore(bd, bio); |
1246 | bio_record->details.bi_bdev = NULL; | 1246 | bio_record->details.bi_bdev = NULL; |
1247 | |||
1248 | atomic_inc(&bio->bi_remaining); | ||
1249 | |||
1247 | queue_bio(ms, bio, rw); | 1250 | queue_bio(ms, bio, rw); |
1248 | return DM_ENDIO_INCOMPLETE; | 1251 | return DM_ENDIO_INCOMPLETE; |
1249 | } | 1252 | } |
diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c index afc3d017de4c..d6e88178d22c 100644 --- a/drivers/md/dm-snap-persistent.c +++ b/drivers/md/dm-snap-persistent.c | |||
@@ -546,6 +546,9 @@ static int read_exceptions(struct pstore *ps, | |||
546 | r = insert_exceptions(ps, area, callback, callback_context, | 546 | r = insert_exceptions(ps, area, callback, callback_context, |
547 | &full); | 547 | &full); |
548 | 548 | ||
549 | if (!full) | ||
550 | memcpy(ps->area, area, ps->store->chunk_size << SECTOR_SHIFT); | ||
551 | |||
549 | dm_bufio_release(bp); | 552 | dm_bufio_release(bp); |
550 | 553 | ||
551 | dm_bufio_forget(client, chunk); | 554 | dm_bufio_forget(client, chunk); |
diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c index 7da347665552..fb9efc829182 100644 --- a/drivers/md/dm-thin-metadata.c +++ b/drivers/md/dm-thin-metadata.c | |||
@@ -76,7 +76,7 @@ | |||
76 | 76 | ||
77 | #define THIN_SUPERBLOCK_MAGIC 27022010 | 77 | #define THIN_SUPERBLOCK_MAGIC 27022010 |
78 | #define THIN_SUPERBLOCK_LOCATION 0 | 78 | #define THIN_SUPERBLOCK_LOCATION 0 |
79 | #define THIN_VERSION 1 | 79 | #define THIN_VERSION 2 |
80 | #define THIN_METADATA_CACHE_SIZE 64 | 80 | #define THIN_METADATA_CACHE_SIZE 64 |
81 | #define SECTOR_TO_BLOCK_SHIFT 3 | 81 | #define SECTOR_TO_BLOCK_SHIFT 3 |
82 | 82 | ||
@@ -483,7 +483,7 @@ static int __write_initial_superblock(struct dm_pool_metadata *pmd) | |||
483 | 483 | ||
484 | disk_super->data_mapping_root = cpu_to_le64(pmd->root); | 484 | disk_super->data_mapping_root = cpu_to_le64(pmd->root); |
485 | disk_super->device_details_root = cpu_to_le64(pmd->details_root); | 485 | disk_super->device_details_root = cpu_to_le64(pmd->details_root); |
486 | disk_super->metadata_block_size = cpu_to_le32(THIN_METADATA_BLOCK_SIZE >> SECTOR_SHIFT); | 486 | disk_super->metadata_block_size = cpu_to_le32(THIN_METADATA_BLOCK_SIZE); |
487 | disk_super->metadata_nr_blocks = cpu_to_le64(bdev_size >> SECTOR_TO_BLOCK_SHIFT); | 487 | disk_super->metadata_nr_blocks = cpu_to_le64(bdev_size >> SECTOR_TO_BLOCK_SHIFT); |
488 | disk_super->data_block_size = cpu_to_le32(pmd->data_block_size); | 488 | disk_super->data_block_size = cpu_to_le32(pmd->data_block_size); |
489 | 489 | ||
@@ -651,7 +651,7 @@ static int __create_persistent_data_objects(struct dm_pool_metadata *pmd, bool f | |||
651 | { | 651 | { |
652 | int r; | 652 | int r; |
653 | 653 | ||
654 | pmd->bm = dm_block_manager_create(pmd->bdev, THIN_METADATA_BLOCK_SIZE, | 654 | pmd->bm = dm_block_manager_create(pmd->bdev, THIN_METADATA_BLOCK_SIZE << SECTOR_SHIFT, |
655 | THIN_METADATA_CACHE_SIZE, | 655 | THIN_METADATA_CACHE_SIZE, |
656 | THIN_MAX_CONCURRENT_LOCKS); | 656 | THIN_MAX_CONCURRENT_LOCKS); |
657 | if (IS_ERR(pmd->bm)) { | 657 | if (IS_ERR(pmd->bm)) { |
@@ -1489,6 +1489,23 @@ bool dm_thin_changed_this_transaction(struct dm_thin_device *td) | |||
1489 | return r; | 1489 | return r; |
1490 | } | 1490 | } |
1491 | 1491 | ||
1492 | bool dm_pool_changed_this_transaction(struct dm_pool_metadata *pmd) | ||
1493 | { | ||
1494 | bool r = false; | ||
1495 | struct dm_thin_device *td, *tmp; | ||
1496 | |||
1497 | down_read(&pmd->root_lock); | ||
1498 | list_for_each_entry_safe(td, tmp, &pmd->thin_devices, list) { | ||
1499 | if (td->changed) { | ||
1500 | r = td->changed; | ||
1501 | break; | ||
1502 | } | ||
1503 | } | ||
1504 | up_read(&pmd->root_lock); | ||
1505 | |||
1506 | return r; | ||
1507 | } | ||
1508 | |||
1492 | bool dm_thin_aborted_changes(struct dm_thin_device *td) | 1509 | bool dm_thin_aborted_changes(struct dm_thin_device *td) |
1493 | { | 1510 | { |
1494 | bool r; | 1511 | bool r; |
@@ -1738,3 +1755,38 @@ int dm_pool_register_metadata_threshold(struct dm_pool_metadata *pmd, | |||
1738 | 1755 | ||
1739 | return r; | 1756 | return r; |
1740 | } | 1757 | } |
1758 | |||
1759 | int dm_pool_metadata_set_needs_check(struct dm_pool_metadata *pmd) | ||
1760 | { | ||
1761 | int r; | ||
1762 | struct dm_block *sblock; | ||
1763 | struct thin_disk_superblock *disk_super; | ||
1764 | |||
1765 | down_write(&pmd->root_lock); | ||
1766 | pmd->flags |= THIN_METADATA_NEEDS_CHECK_FLAG; | ||
1767 | |||
1768 | r = superblock_lock(pmd, &sblock); | ||
1769 | if (r) { | ||
1770 | DMERR("couldn't read superblock"); | ||
1771 | goto out; | ||
1772 | } | ||
1773 | |||
1774 | disk_super = dm_block_data(sblock); | ||
1775 | disk_super->flags = cpu_to_le32(pmd->flags); | ||
1776 | |||
1777 | dm_bm_unlock(sblock); | ||
1778 | out: | ||
1779 | up_write(&pmd->root_lock); | ||
1780 | return r; | ||
1781 | } | ||
1782 | |||
1783 | bool dm_pool_metadata_needs_check(struct dm_pool_metadata *pmd) | ||
1784 | { | ||
1785 | bool needs_check; | ||
1786 | |||
1787 | down_read(&pmd->root_lock); | ||
1788 | needs_check = pmd->flags & THIN_METADATA_NEEDS_CHECK_FLAG; | ||
1789 | up_read(&pmd->root_lock); | ||
1790 | |||
1791 | return needs_check; | ||
1792 | } | ||
diff --git a/drivers/md/dm-thin-metadata.h b/drivers/md/dm-thin-metadata.h index 9a368567632f..e3c857db195a 100644 --- a/drivers/md/dm-thin-metadata.h +++ b/drivers/md/dm-thin-metadata.h | |||
@@ -9,16 +9,14 @@ | |||
9 | 9 | ||
10 | #include "persistent-data/dm-block-manager.h" | 10 | #include "persistent-data/dm-block-manager.h" |
11 | #include "persistent-data/dm-space-map.h" | 11 | #include "persistent-data/dm-space-map.h" |
12 | #include "persistent-data/dm-space-map-metadata.h" | ||
12 | 13 | ||
13 | #define THIN_METADATA_BLOCK_SIZE 4096 | 14 | #define THIN_METADATA_BLOCK_SIZE DM_SM_METADATA_BLOCK_SIZE |
14 | 15 | ||
15 | /* | 16 | /* |
16 | * The metadata device is currently limited in size. | 17 | * The metadata device is currently limited in size. |
17 | * | ||
18 | * We have one block of index, which can hold 255 index entries. Each | ||
19 | * index entry contains allocation info about 16k metadata blocks. | ||
20 | */ | 18 | */ |
21 | #define THIN_METADATA_MAX_SECTORS (255 * (1 << 14) * (THIN_METADATA_BLOCK_SIZE / (1 << SECTOR_SHIFT))) | 19 | #define THIN_METADATA_MAX_SECTORS DM_SM_METADATA_MAX_SECTORS |
22 | 20 | ||
23 | /* | 21 | /* |
24 | * A metadata device larger than 16GB triggers a warning. | 22 | * A metadata device larger than 16GB triggers a warning. |
@@ -27,6 +25,11 @@ | |||
27 | 25 | ||
28 | /*----------------------------------------------------------------*/ | 26 | /*----------------------------------------------------------------*/ |
29 | 27 | ||
28 | /* | ||
29 | * Thin metadata superblock flags. | ||
30 | */ | ||
31 | #define THIN_METADATA_NEEDS_CHECK_FLAG (1 << 0) | ||
32 | |||
30 | struct dm_pool_metadata; | 33 | struct dm_pool_metadata; |
31 | struct dm_thin_device; | 34 | struct dm_thin_device; |
32 | 35 | ||
@@ -161,6 +164,8 @@ int dm_thin_remove_block(struct dm_thin_device *td, dm_block_t block); | |||
161 | */ | 164 | */ |
162 | bool dm_thin_changed_this_transaction(struct dm_thin_device *td); | 165 | bool dm_thin_changed_this_transaction(struct dm_thin_device *td); |
163 | 166 | ||
167 | bool dm_pool_changed_this_transaction(struct dm_pool_metadata *pmd); | ||
168 | |||
164 | bool dm_thin_aborted_changes(struct dm_thin_device *td); | 169 | bool dm_thin_aborted_changes(struct dm_thin_device *td); |
165 | 170 | ||
166 | int dm_thin_get_highest_mapped_block(struct dm_thin_device *td, | 171 | int dm_thin_get_highest_mapped_block(struct dm_thin_device *td, |
@@ -202,6 +207,12 @@ int dm_pool_register_metadata_threshold(struct dm_pool_metadata *pmd, | |||
202 | dm_sm_threshold_fn fn, | 207 | dm_sm_threshold_fn fn, |
203 | void *context); | 208 | void *context); |
204 | 209 | ||
210 | /* | ||
211 | * Updates the superblock immediately. | ||
212 | */ | ||
213 | int dm_pool_metadata_set_needs_check(struct dm_pool_metadata *pmd); | ||
214 | bool dm_pool_metadata_needs_check(struct dm_pool_metadata *pmd); | ||
215 | |||
205 | /*----------------------------------------------------------------*/ | 216 | /*----------------------------------------------------------------*/ |
206 | 217 | ||
207 | #endif | 218 | #endif |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index faaf944597ab..be70d38745f7 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -130,10 +130,11 @@ static void build_virtual_key(struct dm_thin_device *td, dm_block_t b, | |||
130 | struct dm_thin_new_mapping; | 130 | struct dm_thin_new_mapping; |
131 | 131 | ||
132 | /* | 132 | /* |
133 | * The pool runs in 3 modes. Ordered in degraded order for comparisons. | 133 | * The pool runs in 4 modes. Ordered in degraded order for comparisons. |
134 | */ | 134 | */ |
135 | enum pool_mode { | 135 | enum pool_mode { |
136 | PM_WRITE, /* metadata may be changed */ | 136 | PM_WRITE, /* metadata may be changed */ |
137 | PM_OUT_OF_DATA_SPACE, /* metadata may be changed, though data may not be allocated */ | ||
137 | PM_READ_ONLY, /* metadata may not be changed */ | 138 | PM_READ_ONLY, /* metadata may not be changed */ |
138 | PM_FAIL, /* all I/O fails */ | 139 | PM_FAIL, /* all I/O fails */ |
139 | }; | 140 | }; |
@@ -198,7 +199,6 @@ struct pool { | |||
198 | }; | 199 | }; |
199 | 200 | ||
200 | static enum pool_mode get_pool_mode(struct pool *pool); | 201 | static enum pool_mode get_pool_mode(struct pool *pool); |
201 | static void out_of_data_space(struct pool *pool); | ||
202 | static void metadata_operation_failed(struct pool *pool, const char *op, int r); | 202 | static void metadata_operation_failed(struct pool *pool, const char *op, int r); |
203 | 203 | ||
204 | /* | 204 | /* |
@@ -226,6 +226,7 @@ struct thin_c { | |||
226 | 226 | ||
227 | struct pool *pool; | 227 | struct pool *pool; |
228 | struct dm_thin_device *td; | 228 | struct dm_thin_device *td; |
229 | bool requeue_mode:1; | ||
229 | }; | 230 | }; |
230 | 231 | ||
231 | /*----------------------------------------------------------------*/ | 232 | /*----------------------------------------------------------------*/ |
@@ -369,14 +370,18 @@ struct dm_thin_endio_hook { | |||
369 | struct dm_thin_new_mapping *overwrite_mapping; | 370 | struct dm_thin_new_mapping *overwrite_mapping; |
370 | }; | 371 | }; |
371 | 372 | ||
372 | static void __requeue_bio_list(struct thin_c *tc, struct bio_list *master) | 373 | static void requeue_bio_list(struct thin_c *tc, struct bio_list *master) |
373 | { | 374 | { |
374 | struct bio *bio; | 375 | struct bio *bio; |
375 | struct bio_list bios; | 376 | struct bio_list bios; |
377 | unsigned long flags; | ||
376 | 378 | ||
377 | bio_list_init(&bios); | 379 | bio_list_init(&bios); |
380 | |||
381 | spin_lock_irqsave(&tc->pool->lock, flags); | ||
378 | bio_list_merge(&bios, master); | 382 | bio_list_merge(&bios, master); |
379 | bio_list_init(master); | 383 | bio_list_init(master); |
384 | spin_unlock_irqrestore(&tc->pool->lock, flags); | ||
380 | 385 | ||
381 | while ((bio = bio_list_pop(&bios))) { | 386 | while ((bio = bio_list_pop(&bios))) { |
382 | struct dm_thin_endio_hook *h = dm_per_bio_data(bio, sizeof(struct dm_thin_endio_hook)); | 387 | struct dm_thin_endio_hook *h = dm_per_bio_data(bio, sizeof(struct dm_thin_endio_hook)); |
@@ -391,12 +396,26 @@ static void __requeue_bio_list(struct thin_c *tc, struct bio_list *master) | |||
391 | static void requeue_io(struct thin_c *tc) | 396 | static void requeue_io(struct thin_c *tc) |
392 | { | 397 | { |
393 | struct pool *pool = tc->pool; | 398 | struct pool *pool = tc->pool; |
399 | |||
400 | requeue_bio_list(tc, &pool->deferred_bios); | ||
401 | requeue_bio_list(tc, &pool->retry_on_resume_list); | ||
402 | } | ||
403 | |||
404 | static void error_retry_list(struct pool *pool) | ||
405 | { | ||
406 | struct bio *bio; | ||
394 | unsigned long flags; | 407 | unsigned long flags; |
408 | struct bio_list bios; | ||
409 | |||
410 | bio_list_init(&bios); | ||
395 | 411 | ||
396 | spin_lock_irqsave(&pool->lock, flags); | 412 | spin_lock_irqsave(&pool->lock, flags); |
397 | __requeue_bio_list(tc, &pool->deferred_bios); | 413 | bio_list_merge(&bios, &pool->retry_on_resume_list); |
398 | __requeue_bio_list(tc, &pool->retry_on_resume_list); | 414 | bio_list_init(&pool->retry_on_resume_list); |
399 | spin_unlock_irqrestore(&pool->lock, flags); | 415 | spin_unlock_irqrestore(&pool->lock, flags); |
416 | |||
417 | while ((bio = bio_list_pop(&bios))) | ||
418 | bio_io_error(bio); | ||
400 | } | 419 | } |
401 | 420 | ||
402 | /* | 421 | /* |
@@ -925,13 +944,15 @@ static void check_low_water_mark(struct pool *pool, dm_block_t free_blocks) | |||
925 | } | 944 | } |
926 | } | 945 | } |
927 | 946 | ||
947 | static void set_pool_mode(struct pool *pool, enum pool_mode new_mode); | ||
948 | |||
928 | static int alloc_data_block(struct thin_c *tc, dm_block_t *result) | 949 | static int alloc_data_block(struct thin_c *tc, dm_block_t *result) |
929 | { | 950 | { |
930 | int r; | 951 | int r; |
931 | dm_block_t free_blocks; | 952 | dm_block_t free_blocks; |
932 | struct pool *pool = tc->pool; | 953 | struct pool *pool = tc->pool; |
933 | 954 | ||
934 | if (get_pool_mode(pool) != PM_WRITE) | 955 | if (WARN_ON(get_pool_mode(pool) != PM_WRITE)) |
935 | return -EINVAL; | 956 | return -EINVAL; |
936 | 957 | ||
937 | r = dm_pool_get_free_block_count(pool->pmd, &free_blocks); | 958 | r = dm_pool_get_free_block_count(pool->pmd, &free_blocks); |
@@ -958,7 +979,7 @@ static int alloc_data_block(struct thin_c *tc, dm_block_t *result) | |||
958 | } | 979 | } |
959 | 980 | ||
960 | if (!free_blocks) { | 981 | if (!free_blocks) { |
961 | out_of_data_space(pool); | 982 | set_pool_mode(pool, PM_OUT_OF_DATA_SPACE); |
962 | return -ENOSPC; | 983 | return -ENOSPC; |
963 | } | 984 | } |
964 | } | 985 | } |
@@ -988,15 +1009,32 @@ static void retry_on_resume(struct bio *bio) | |||
988 | spin_unlock_irqrestore(&pool->lock, flags); | 1009 | spin_unlock_irqrestore(&pool->lock, flags); |
989 | } | 1010 | } |
990 | 1011 | ||
991 | static void handle_unserviceable_bio(struct pool *pool, struct bio *bio) | 1012 | static bool should_error_unserviceable_bio(struct pool *pool) |
992 | { | 1013 | { |
993 | /* | 1014 | enum pool_mode m = get_pool_mode(pool); |
994 | * When pool is read-only, no cell locking is needed because | ||
995 | * nothing is changing. | ||
996 | */ | ||
997 | WARN_ON_ONCE(get_pool_mode(pool) != PM_READ_ONLY); | ||
998 | 1015 | ||
999 | if (pool->pf.error_if_no_space) | 1016 | switch (m) { |
1017 | case PM_WRITE: | ||
1018 | /* Shouldn't get here */ | ||
1019 | DMERR_LIMIT("bio unserviceable, yet pool is in PM_WRITE mode"); | ||
1020 | return true; | ||
1021 | |||
1022 | case PM_OUT_OF_DATA_SPACE: | ||
1023 | return pool->pf.error_if_no_space; | ||
1024 | |||
1025 | case PM_READ_ONLY: | ||
1026 | case PM_FAIL: | ||
1027 | return true; | ||
1028 | default: | ||
1029 | /* Shouldn't get here */ | ||
1030 | DMERR_LIMIT("bio unserviceable, yet pool has an unknown mode"); | ||
1031 | return true; | ||
1032 | } | ||
1033 | } | ||
1034 | |||
1035 | static void handle_unserviceable_bio(struct pool *pool, struct bio *bio) | ||
1036 | { | ||
1037 | if (should_error_unserviceable_bio(pool)) | ||
1000 | bio_io_error(bio); | 1038 | bio_io_error(bio); |
1001 | else | 1039 | else |
1002 | retry_on_resume(bio); | 1040 | retry_on_resume(bio); |
@@ -1007,11 +1045,20 @@ static void retry_bios_on_resume(struct pool *pool, struct dm_bio_prison_cell *c | |||
1007 | struct bio *bio; | 1045 | struct bio *bio; |
1008 | struct bio_list bios; | 1046 | struct bio_list bios; |
1009 | 1047 | ||
1048 | if (should_error_unserviceable_bio(pool)) { | ||
1049 | cell_error(pool, cell); | ||
1050 | return; | ||
1051 | } | ||
1052 | |||
1010 | bio_list_init(&bios); | 1053 | bio_list_init(&bios); |
1011 | cell_release(pool, cell, &bios); | 1054 | cell_release(pool, cell, &bios); |
1012 | 1055 | ||
1013 | while ((bio = bio_list_pop(&bios))) | 1056 | if (should_error_unserviceable_bio(pool)) |
1014 | handle_unserviceable_bio(pool, bio); | 1057 | while ((bio = bio_list_pop(&bios))) |
1058 | bio_io_error(bio); | ||
1059 | else | ||
1060 | while ((bio = bio_list_pop(&bios))) | ||
1061 | retry_on_resume(bio); | ||
1015 | } | 1062 | } |
1016 | 1063 | ||
1017 | static void process_discard(struct thin_c *tc, struct bio *bio) | 1064 | static void process_discard(struct thin_c *tc, struct bio *bio) |
@@ -1296,6 +1343,11 @@ static void process_bio_read_only(struct thin_c *tc, struct bio *bio) | |||
1296 | } | 1343 | } |
1297 | } | 1344 | } |
1298 | 1345 | ||
1346 | static void process_bio_success(struct thin_c *tc, struct bio *bio) | ||
1347 | { | ||
1348 | bio_endio(bio, 0); | ||
1349 | } | ||
1350 | |||
1299 | static void process_bio_fail(struct thin_c *tc, struct bio *bio) | 1351 | static void process_bio_fail(struct thin_c *tc, struct bio *bio) |
1300 | { | 1352 | { |
1301 | bio_io_error(bio); | 1353 | bio_io_error(bio); |
@@ -1328,6 +1380,11 @@ static void process_deferred_bios(struct pool *pool) | |||
1328 | struct dm_thin_endio_hook *h = dm_per_bio_data(bio, sizeof(struct dm_thin_endio_hook)); | 1380 | struct dm_thin_endio_hook *h = dm_per_bio_data(bio, sizeof(struct dm_thin_endio_hook)); |
1329 | struct thin_c *tc = h->tc; | 1381 | struct thin_c *tc = h->tc; |
1330 | 1382 | ||
1383 | if (tc->requeue_mode) { | ||
1384 | bio_endio(bio, DM_ENDIO_REQUEUE); | ||
1385 | continue; | ||
1386 | } | ||
1387 | |||
1331 | /* | 1388 | /* |
1332 | * If we've got no free new_mapping structs, and processing | 1389 | * If we've got no free new_mapping structs, and processing |
1333 | * this bio might require one, we pause until there are some | 1390 | * this bio might require one, we pause until there are some |
@@ -1357,7 +1414,8 @@ static void process_deferred_bios(struct pool *pool) | |||
1357 | bio_list_init(&pool->deferred_flush_bios); | 1414 | bio_list_init(&pool->deferred_flush_bios); |
1358 | spin_unlock_irqrestore(&pool->lock, flags); | 1415 | spin_unlock_irqrestore(&pool->lock, flags); |
1359 | 1416 | ||
1360 | if (bio_list_empty(&bios) && !need_commit_due_to_time(pool)) | 1417 | if (bio_list_empty(&bios) && |
1418 | !(dm_pool_changed_this_transaction(pool->pmd) && need_commit_due_to_time(pool))) | ||
1361 | return; | 1419 | return; |
1362 | 1420 | ||
1363 | if (commit(pool)) { | 1421 | if (commit(pool)) { |
@@ -1393,51 +1451,134 @@ static void do_waker(struct work_struct *ws) | |||
1393 | 1451 | ||
1394 | /*----------------------------------------------------------------*/ | 1452 | /*----------------------------------------------------------------*/ |
1395 | 1453 | ||
1454 | struct noflush_work { | ||
1455 | struct work_struct worker; | ||
1456 | struct thin_c *tc; | ||
1457 | |||
1458 | atomic_t complete; | ||
1459 | wait_queue_head_t wait; | ||
1460 | }; | ||
1461 | |||
1462 | static void complete_noflush_work(struct noflush_work *w) | ||
1463 | { | ||
1464 | atomic_set(&w->complete, 1); | ||
1465 | wake_up(&w->wait); | ||
1466 | } | ||
1467 | |||
1468 | static void do_noflush_start(struct work_struct *ws) | ||
1469 | { | ||
1470 | struct noflush_work *w = container_of(ws, struct noflush_work, worker); | ||
1471 | w->tc->requeue_mode = true; | ||
1472 | requeue_io(w->tc); | ||
1473 | complete_noflush_work(w); | ||
1474 | } | ||
1475 | |||
1476 | static void do_noflush_stop(struct work_struct *ws) | ||
1477 | { | ||
1478 | struct noflush_work *w = container_of(ws, struct noflush_work, worker); | ||
1479 | w->tc->requeue_mode = false; | ||
1480 | complete_noflush_work(w); | ||
1481 | } | ||
1482 | |||
1483 | static void noflush_work(struct thin_c *tc, void (*fn)(struct work_struct *)) | ||
1484 | { | ||
1485 | struct noflush_work w; | ||
1486 | |||
1487 | INIT_WORK(&w.worker, fn); | ||
1488 | w.tc = tc; | ||
1489 | atomic_set(&w.complete, 0); | ||
1490 | init_waitqueue_head(&w.wait); | ||
1491 | |||
1492 | queue_work(tc->pool->wq, &w.worker); | ||
1493 | |||
1494 | wait_event(w.wait, atomic_read(&w.complete)); | ||
1495 | } | ||
1496 | |||
1497 | /*----------------------------------------------------------------*/ | ||
1498 | |||
1396 | static enum pool_mode get_pool_mode(struct pool *pool) | 1499 | static enum pool_mode get_pool_mode(struct pool *pool) |
1397 | { | 1500 | { |
1398 | return pool->pf.mode; | 1501 | return pool->pf.mode; |
1399 | } | 1502 | } |
1400 | 1503 | ||
1504 | static void notify_of_pool_mode_change(struct pool *pool, const char *new_mode) | ||
1505 | { | ||
1506 | dm_table_event(pool->ti->table); | ||
1507 | DMINFO("%s: switching pool to %s mode", | ||
1508 | dm_device_name(pool->pool_md), new_mode); | ||
1509 | } | ||
1510 | |||
1401 | static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) | 1511 | static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) |
1402 | { | 1512 | { |
1403 | int r; | 1513 | struct pool_c *pt = pool->ti->private; |
1404 | enum pool_mode old_mode = pool->pf.mode; | 1514 | bool needs_check = dm_pool_metadata_needs_check(pool->pmd); |
1515 | enum pool_mode old_mode = get_pool_mode(pool); | ||
1516 | |||
1517 | /* | ||
1518 | * Never allow the pool to transition to PM_WRITE mode if user | ||
1519 | * intervention is required to verify metadata and data consistency. | ||
1520 | */ | ||
1521 | if (new_mode == PM_WRITE && needs_check) { | ||
1522 | DMERR("%s: unable to switch pool to write mode until repaired.", | ||
1523 | dm_device_name(pool->pool_md)); | ||
1524 | if (old_mode != new_mode) | ||
1525 | new_mode = old_mode; | ||
1526 | else | ||
1527 | new_mode = PM_READ_ONLY; | ||
1528 | } | ||
1529 | /* | ||
1530 | * If we were in PM_FAIL mode, rollback of metadata failed. We're | ||
1531 | * not going to recover without a thin_repair. So we never let the | ||
1532 | * pool move out of the old mode. | ||
1533 | */ | ||
1534 | if (old_mode == PM_FAIL) | ||
1535 | new_mode = old_mode; | ||
1405 | 1536 | ||
1406 | switch (new_mode) { | 1537 | switch (new_mode) { |
1407 | case PM_FAIL: | 1538 | case PM_FAIL: |
1408 | if (old_mode != new_mode) | 1539 | if (old_mode != new_mode) |
1409 | DMERR("%s: switching pool to failure mode", | 1540 | notify_of_pool_mode_change(pool, "failure"); |
1410 | dm_device_name(pool->pool_md)); | ||
1411 | dm_pool_metadata_read_only(pool->pmd); | 1541 | dm_pool_metadata_read_only(pool->pmd); |
1412 | pool->process_bio = process_bio_fail; | 1542 | pool->process_bio = process_bio_fail; |
1413 | pool->process_discard = process_bio_fail; | 1543 | pool->process_discard = process_bio_fail; |
1414 | pool->process_prepared_mapping = process_prepared_mapping_fail; | 1544 | pool->process_prepared_mapping = process_prepared_mapping_fail; |
1415 | pool->process_prepared_discard = process_prepared_discard_fail; | 1545 | pool->process_prepared_discard = process_prepared_discard_fail; |
1546 | |||
1547 | error_retry_list(pool); | ||
1416 | break; | 1548 | break; |
1417 | 1549 | ||
1418 | case PM_READ_ONLY: | 1550 | case PM_READ_ONLY: |
1419 | if (old_mode != new_mode) | 1551 | if (old_mode != new_mode) |
1420 | DMERR("%s: switching pool to read-only mode", | 1552 | notify_of_pool_mode_change(pool, "read-only"); |
1421 | dm_device_name(pool->pool_md)); | 1553 | dm_pool_metadata_read_only(pool->pmd); |
1422 | r = dm_pool_abort_metadata(pool->pmd); | 1554 | pool->process_bio = process_bio_read_only; |
1423 | if (r) { | 1555 | pool->process_discard = process_bio_success; |
1424 | DMERR("%s: aborting transaction failed", | 1556 | pool->process_prepared_mapping = process_prepared_mapping_fail; |
1425 | dm_device_name(pool->pool_md)); | 1557 | pool->process_prepared_discard = process_prepared_discard_passdown; |
1426 | new_mode = PM_FAIL; | 1558 | |
1427 | set_pool_mode(pool, new_mode); | 1559 | error_retry_list(pool); |
1428 | } else { | 1560 | break; |
1429 | dm_pool_metadata_read_only(pool->pmd); | 1561 | |
1430 | pool->process_bio = process_bio_read_only; | 1562 | case PM_OUT_OF_DATA_SPACE: |
1431 | pool->process_discard = process_discard; | 1563 | /* |
1432 | pool->process_prepared_mapping = process_prepared_mapping_fail; | 1564 | * Ideally we'd never hit this state; the low water mark |
1433 | pool->process_prepared_discard = process_prepared_discard_passdown; | 1565 | * would trigger userland to extend the pool before we |
1434 | } | 1566 | * completely run out of data space. However, many small |
1567 | * IOs to unprovisioned space can consume data space at an | ||
1568 | * alarming rate. Adjust your low water mark if you're | ||
1569 | * frequently seeing this mode. | ||
1570 | */ | ||
1571 | if (old_mode != new_mode) | ||
1572 | notify_of_pool_mode_change(pool, "out-of-data-space"); | ||
1573 | pool->process_bio = process_bio_read_only; | ||
1574 | pool->process_discard = process_discard; | ||
1575 | pool->process_prepared_mapping = process_prepared_mapping; | ||
1576 | pool->process_prepared_discard = process_prepared_discard_passdown; | ||
1435 | break; | 1577 | break; |
1436 | 1578 | ||
1437 | case PM_WRITE: | 1579 | case PM_WRITE: |
1438 | if (old_mode != new_mode) | 1580 | if (old_mode != new_mode) |
1439 | DMINFO("%s: switching pool to write mode", | 1581 | notify_of_pool_mode_change(pool, "write"); |
1440 | dm_device_name(pool->pool_md)); | ||
1441 | dm_pool_metadata_read_write(pool->pmd); | 1582 | dm_pool_metadata_read_write(pool->pmd); |
1442 | pool->process_bio = process_bio; | 1583 | pool->process_bio = process_bio; |
1443 | pool->process_discard = process_discard; | 1584 | pool->process_discard = process_discard; |
@@ -1447,32 +1588,35 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) | |||
1447 | } | 1588 | } |
1448 | 1589 | ||
1449 | pool->pf.mode = new_mode; | 1590 | pool->pf.mode = new_mode; |
1591 | /* | ||
1592 | * The pool mode may have changed, sync it so bind_control_target() | ||
1593 | * doesn't cause an unexpected mode transition on resume. | ||
1594 | */ | ||
1595 | pt->adjusted_pf.mode = new_mode; | ||
1450 | } | 1596 | } |
1451 | 1597 | ||
1452 | /* | 1598 | static void abort_transaction(struct pool *pool) |
1453 | * Rather than calling set_pool_mode directly, use these which describe the | ||
1454 | * reason for mode degradation. | ||
1455 | */ | ||
1456 | static void out_of_data_space(struct pool *pool) | ||
1457 | { | 1599 | { |
1458 | DMERR_LIMIT("%s: no free data space available.", | 1600 | const char *dev_name = dm_device_name(pool->pool_md); |
1459 | dm_device_name(pool->pool_md)); | 1601 | |
1460 | set_pool_mode(pool, PM_READ_ONLY); | 1602 | DMERR_LIMIT("%s: aborting current metadata transaction", dev_name); |
1603 | if (dm_pool_abort_metadata(pool->pmd)) { | ||
1604 | DMERR("%s: failed to abort metadata transaction", dev_name); | ||
1605 | set_pool_mode(pool, PM_FAIL); | ||
1606 | } | ||
1607 | |||
1608 | if (dm_pool_metadata_set_needs_check(pool->pmd)) { | ||
1609 | DMERR("%s: failed to set 'needs_check' flag in metadata", dev_name); | ||
1610 | set_pool_mode(pool, PM_FAIL); | ||
1611 | } | ||
1461 | } | 1612 | } |
1462 | 1613 | ||
1463 | static void metadata_operation_failed(struct pool *pool, const char *op, int r) | 1614 | static void metadata_operation_failed(struct pool *pool, const char *op, int r) |
1464 | { | 1615 | { |
1465 | dm_block_t free_blocks; | ||
1466 | |||
1467 | DMERR_LIMIT("%s: metadata operation '%s' failed: error = %d", | 1616 | DMERR_LIMIT("%s: metadata operation '%s' failed: error = %d", |
1468 | dm_device_name(pool->pool_md), op, r); | 1617 | dm_device_name(pool->pool_md), op, r); |
1469 | 1618 | ||
1470 | if (r == -ENOSPC && | 1619 | abort_transaction(pool); |
1471 | !dm_pool_get_free_metadata_block_count(pool->pmd, &free_blocks) && | ||
1472 | !free_blocks) | ||
1473 | DMERR_LIMIT("%s: no free metadata space available.", | ||
1474 | dm_device_name(pool->pool_md)); | ||
1475 | |||
1476 | set_pool_mode(pool, PM_READ_ONLY); | 1620 | set_pool_mode(pool, PM_READ_ONLY); |
1477 | } | 1621 | } |
1478 | 1622 | ||
@@ -1523,6 +1667,11 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio) | |||
1523 | 1667 | ||
1524 | thin_hook_bio(tc, bio); | 1668 | thin_hook_bio(tc, bio); |
1525 | 1669 | ||
1670 | if (tc->requeue_mode) { | ||
1671 | bio_endio(bio, DM_ENDIO_REQUEUE); | ||
1672 | return DM_MAPIO_SUBMITTED; | ||
1673 | } | ||
1674 | |||
1526 | if (get_pool_mode(tc->pool) == PM_FAIL) { | 1675 | if (get_pool_mode(tc->pool) == PM_FAIL) { |
1527 | bio_io_error(bio); | 1676 | bio_io_error(bio); |
1528 | return DM_MAPIO_SUBMITTED; | 1677 | return DM_MAPIO_SUBMITTED; |
@@ -1686,7 +1835,7 @@ static int bind_control_target(struct pool *pool, struct dm_target *ti) | |||
1686 | /* | 1835 | /* |
1687 | * We want to make sure that a pool in PM_FAIL mode is never upgraded. | 1836 | * We want to make sure that a pool in PM_FAIL mode is never upgraded. |
1688 | */ | 1837 | */ |
1689 | enum pool_mode old_mode = pool->pf.mode; | 1838 | enum pool_mode old_mode = get_pool_mode(pool); |
1690 | enum pool_mode new_mode = pt->adjusted_pf.mode; | 1839 | enum pool_mode new_mode = pt->adjusted_pf.mode; |
1691 | 1840 | ||
1692 | /* | 1841 | /* |
@@ -1700,16 +1849,6 @@ static int bind_control_target(struct pool *pool, struct dm_target *ti) | |||
1700 | pool->pf = pt->adjusted_pf; | 1849 | pool->pf = pt->adjusted_pf; |
1701 | pool->low_water_blocks = pt->low_water_blocks; | 1850 | pool->low_water_blocks = pt->low_water_blocks; |
1702 | 1851 | ||
1703 | /* | ||
1704 | * If we were in PM_FAIL mode, rollback of metadata failed. We're | ||
1705 | * not going to recover without a thin_repair. So we never let the | ||
1706 | * pool move out of the old mode. On the other hand a PM_READ_ONLY | ||
1707 | * may have been due to a lack of metadata or data space, and may | ||
1708 | * now work (ie. if the underlying devices have been resized). | ||
1709 | */ | ||
1710 | if (old_mode == PM_FAIL) | ||
1711 | new_mode = old_mode; | ||
1712 | |||
1713 | set_pool_mode(pool, new_mode); | 1852 | set_pool_mode(pool, new_mode); |
1714 | 1853 | ||
1715 | return 0; | 1854 | return 0; |
@@ -1999,16 +2138,27 @@ static void metadata_low_callback(void *context) | |||
1999 | dm_table_event(pool->ti->table); | 2138 | dm_table_event(pool->ti->table); |
2000 | } | 2139 | } |
2001 | 2140 | ||
2002 | static sector_t get_metadata_dev_size(struct block_device *bdev) | 2141 | static sector_t get_dev_size(struct block_device *bdev) |
2142 | { | ||
2143 | return i_size_read(bdev->bd_inode) >> SECTOR_SHIFT; | ||
2144 | } | ||
2145 | |||
2146 | static void warn_if_metadata_device_too_big(struct block_device *bdev) | ||
2003 | { | 2147 | { |
2004 | sector_t metadata_dev_size = i_size_read(bdev->bd_inode) >> SECTOR_SHIFT; | 2148 | sector_t metadata_dev_size = get_dev_size(bdev); |
2005 | char buffer[BDEVNAME_SIZE]; | 2149 | char buffer[BDEVNAME_SIZE]; |
2006 | 2150 | ||
2007 | if (metadata_dev_size > THIN_METADATA_MAX_SECTORS_WARNING) { | 2151 | if (metadata_dev_size > THIN_METADATA_MAX_SECTORS_WARNING) |
2008 | DMWARN("Metadata device %s is larger than %u sectors: excess space will not be used.", | 2152 | DMWARN("Metadata device %s is larger than %u sectors: excess space will not be used.", |
2009 | bdevname(bdev, buffer), THIN_METADATA_MAX_SECTORS); | 2153 | bdevname(bdev, buffer), THIN_METADATA_MAX_SECTORS); |
2010 | metadata_dev_size = THIN_METADATA_MAX_SECTORS_WARNING; | 2154 | } |
2011 | } | 2155 | |
2156 | static sector_t get_metadata_dev_size(struct block_device *bdev) | ||
2157 | { | ||
2158 | sector_t metadata_dev_size = get_dev_size(bdev); | ||
2159 | |||
2160 | if (metadata_dev_size > THIN_METADATA_MAX_SECTORS) | ||
2161 | metadata_dev_size = THIN_METADATA_MAX_SECTORS; | ||
2012 | 2162 | ||
2013 | return metadata_dev_size; | 2163 | return metadata_dev_size; |
2014 | } | 2164 | } |
@@ -2017,7 +2167,7 @@ static dm_block_t get_metadata_dev_size_in_blocks(struct block_device *bdev) | |||
2017 | { | 2167 | { |
2018 | sector_t metadata_dev_size = get_metadata_dev_size(bdev); | 2168 | sector_t metadata_dev_size = get_metadata_dev_size(bdev); |
2019 | 2169 | ||
2020 | sector_div(metadata_dev_size, THIN_METADATA_BLOCK_SIZE >> SECTOR_SHIFT); | 2170 | sector_div(metadata_dev_size, THIN_METADATA_BLOCK_SIZE); |
2021 | 2171 | ||
2022 | return metadata_dev_size; | 2172 | return metadata_dev_size; |
2023 | } | 2173 | } |
@@ -2095,12 +2245,7 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
2095 | ti->error = "Error opening metadata block device"; | 2245 | ti->error = "Error opening metadata block device"; |
2096 | goto out_unlock; | 2246 | goto out_unlock; |
2097 | } | 2247 | } |
2098 | 2248 | warn_if_metadata_device_too_big(metadata_dev->bdev); | |
2099 | /* | ||
2100 | * Run for the side-effect of possibly issuing a warning if the | ||
2101 | * device is too big. | ||
2102 | */ | ||
2103 | (void) get_metadata_dev_size(metadata_dev->bdev); | ||
2104 | 2249 | ||
2105 | r = dm_get_device(ti, argv[1], FMODE_READ | FMODE_WRITE, &data_dev); | 2250 | r = dm_get_device(ti, argv[1], FMODE_READ | FMODE_WRITE, &data_dev); |
2106 | if (r) { | 2251 | if (r) { |
@@ -2246,6 +2391,12 @@ static int maybe_resize_data_dev(struct dm_target *ti, bool *need_commit) | |||
2246 | return -EINVAL; | 2391 | return -EINVAL; |
2247 | 2392 | ||
2248 | } else if (data_size > sb_data_size) { | 2393 | } else if (data_size > sb_data_size) { |
2394 | if (dm_pool_metadata_needs_check(pool->pmd)) { | ||
2395 | DMERR("%s: unable to grow the data device until repaired.", | ||
2396 | dm_device_name(pool->pool_md)); | ||
2397 | return 0; | ||
2398 | } | ||
2399 | |||
2249 | if (sb_data_size) | 2400 | if (sb_data_size) |
2250 | DMINFO("%s: growing the data device from %llu to %llu blocks", | 2401 | DMINFO("%s: growing the data device from %llu to %llu blocks", |
2251 | dm_device_name(pool->pool_md), | 2402 | dm_device_name(pool->pool_md), |
@@ -2287,6 +2438,13 @@ static int maybe_resize_metadata_dev(struct dm_target *ti, bool *need_commit) | |||
2287 | return -EINVAL; | 2438 | return -EINVAL; |
2288 | 2439 | ||
2289 | } else if (metadata_dev_size > sb_metadata_dev_size) { | 2440 | } else if (metadata_dev_size > sb_metadata_dev_size) { |
2441 | if (dm_pool_metadata_needs_check(pool->pmd)) { | ||
2442 | DMERR("%s: unable to grow the metadata device until repaired.", | ||
2443 | dm_device_name(pool->pool_md)); | ||
2444 | return 0; | ||
2445 | } | ||
2446 | |||
2447 | warn_if_metadata_device_too_big(pool->md_dev); | ||
2290 | DMINFO("%s: growing the metadata device from %llu to %llu blocks", | 2448 | DMINFO("%s: growing the metadata device from %llu to %llu blocks", |
2291 | dm_device_name(pool->pool_md), | 2449 | dm_device_name(pool->pool_md), |
2292 | sb_metadata_dev_size, metadata_dev_size); | 2450 | sb_metadata_dev_size, metadata_dev_size); |
@@ -2673,7 +2831,9 @@ static void pool_status(struct dm_target *ti, status_type_t type, | |||
2673 | else | 2831 | else |
2674 | DMEMIT("- "); | 2832 | DMEMIT("- "); |
2675 | 2833 | ||
2676 | if (pool->pf.mode == PM_READ_ONLY) | 2834 | if (pool->pf.mode == PM_OUT_OF_DATA_SPACE) |
2835 | DMEMIT("out_of_data_space "); | ||
2836 | else if (pool->pf.mode == PM_READ_ONLY) | ||
2677 | DMEMIT("ro "); | 2837 | DMEMIT("ro "); |
2678 | else | 2838 | else |
2679 | DMEMIT("rw "); | 2839 | DMEMIT("rw "); |
@@ -2787,7 +2947,7 @@ static struct target_type pool_target = { | |||
2787 | .name = "thin-pool", | 2947 | .name = "thin-pool", |
2788 | .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | | 2948 | .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | |
2789 | DM_TARGET_IMMUTABLE, | 2949 | DM_TARGET_IMMUTABLE, |
2790 | .version = {1, 10, 0}, | 2950 | .version = {1, 11, 0}, |
2791 | .module = THIS_MODULE, | 2951 | .module = THIS_MODULE, |
2792 | .ctr = pool_ctr, | 2952 | .ctr = pool_ctr, |
2793 | .dtr = pool_dtr, | 2953 | .dtr = pool_dtr, |
@@ -2894,6 +3054,7 @@ static int thin_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
2894 | 3054 | ||
2895 | if (get_pool_mode(tc->pool) == PM_FAIL) { | 3055 | if (get_pool_mode(tc->pool) == PM_FAIL) { |
2896 | ti->error = "Couldn't open thin device, Pool is in fail mode"; | 3056 | ti->error = "Couldn't open thin device, Pool is in fail mode"; |
3057 | r = -EINVAL; | ||
2897 | goto bad_thin_open; | 3058 | goto bad_thin_open; |
2898 | } | 3059 | } |
2899 | 3060 | ||
@@ -2905,7 +3066,7 @@ static int thin_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
2905 | 3066 | ||
2906 | r = dm_set_target_max_io_len(ti, tc->pool->sectors_per_block); | 3067 | r = dm_set_target_max_io_len(ti, tc->pool->sectors_per_block); |
2907 | if (r) | 3068 | if (r) |
2908 | goto bad_thin_open; | 3069 | goto bad_target_max_io_len; |
2909 | 3070 | ||
2910 | ti->num_flush_bios = 1; | 3071 | ti->num_flush_bios = 1; |
2911 | ti->flush_supported = true; | 3072 | ti->flush_supported = true; |
@@ -2926,6 +3087,8 @@ static int thin_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
2926 | 3087 | ||
2927 | return 0; | 3088 | return 0; |
2928 | 3089 | ||
3090 | bad_target_max_io_len: | ||
3091 | dm_pool_close_thin_device(tc->td); | ||
2929 | bad_thin_open: | 3092 | bad_thin_open: |
2930 | __pool_dec(tc->pool); | 3093 | __pool_dec(tc->pool); |
2931 | bad_pool_lookup: | 3094 | bad_pool_lookup: |
@@ -2986,10 +3149,23 @@ static int thin_endio(struct dm_target *ti, struct bio *bio, int err) | |||
2986 | return 0; | 3149 | return 0; |
2987 | } | 3150 | } |
2988 | 3151 | ||
2989 | static void thin_postsuspend(struct dm_target *ti) | 3152 | static void thin_presuspend(struct dm_target *ti) |
2990 | { | 3153 | { |
3154 | struct thin_c *tc = ti->private; | ||
3155 | |||
2991 | if (dm_noflush_suspending(ti)) | 3156 | if (dm_noflush_suspending(ti)) |
2992 | requeue_io((struct thin_c *)ti->private); | 3157 | noflush_work(tc, do_noflush_start); |
3158 | } | ||
3159 | |||
3160 | static void thin_postsuspend(struct dm_target *ti) | ||
3161 | { | ||
3162 | struct thin_c *tc = ti->private; | ||
3163 | |||
3164 | /* | ||
3165 | * The dm_noflush_suspending flag has been cleared by now, so | ||
3166 | * unfortunately we must always run this. | ||
3167 | */ | ||
3168 | noflush_work(tc, do_noflush_stop); | ||
2993 | } | 3169 | } |
2994 | 3170 | ||
2995 | /* | 3171 | /* |
@@ -3074,12 +3250,13 @@ static int thin_iterate_devices(struct dm_target *ti, | |||
3074 | 3250 | ||
3075 | static struct target_type thin_target = { | 3251 | static struct target_type thin_target = { |
3076 | .name = "thin", | 3252 | .name = "thin", |
3077 | .version = {1, 10, 0}, | 3253 | .version = {1, 11, 0}, |
3078 | .module = THIS_MODULE, | 3254 | .module = THIS_MODULE, |
3079 | .ctr = thin_ctr, | 3255 | .ctr = thin_ctr, |
3080 | .dtr = thin_dtr, | 3256 | .dtr = thin_dtr, |
3081 | .map = thin_map, | 3257 | .map = thin_map, |
3082 | .end_io = thin_endio, | 3258 | .end_io = thin_endio, |
3259 | .presuspend = thin_presuspend, | ||
3083 | .postsuspend = thin_postsuspend, | 3260 | .postsuspend = thin_postsuspend, |
3084 | .status = thin_status, | 3261 | .status = thin_status, |
3085 | .iterate_devices = thin_iterate_devices, | 3262 | .iterate_devices = thin_iterate_devices, |
diff --git a/drivers/md/persistent-data/Kconfig b/drivers/md/persistent-data/Kconfig index 19b268795415..0c2dec7aec20 100644 --- a/drivers/md/persistent-data/Kconfig +++ b/drivers/md/persistent-data/Kconfig | |||
@@ -6,3 +6,13 @@ config DM_PERSISTENT_DATA | |||
6 | ---help--- | 6 | ---help--- |
7 | Library providing immutable on-disk data structure support for | 7 | Library providing immutable on-disk data structure support for |
8 | device-mapper targets such as the thin provisioning target. | 8 | device-mapper targets such as the thin provisioning target. |
9 | |||
10 | config DM_DEBUG_BLOCK_STACK_TRACING | ||
11 | boolean "Keep stack trace of persistent data block lock holders" | ||
12 | depends on STACKTRACE_SUPPORT && DM_PERSISTENT_DATA | ||
13 | select STACKTRACE | ||
14 | ---help--- | ||
15 | Enable this for messages that may help debug problems with the | ||
16 | block manager locking used by thin provisioning and caching. | ||
17 | |||
18 | If unsure, say N. | ||
diff --git a/drivers/md/persistent-data/dm-space-map-metadata.c b/drivers/md/persistent-data/dm-space-map-metadata.c index 536782e3bcb7..786b689bdfc7 100644 --- a/drivers/md/persistent-data/dm-space-map-metadata.c +++ b/drivers/md/persistent-data/dm-space-map-metadata.c | |||
@@ -91,6 +91,69 @@ struct block_op { | |||
91 | dm_block_t block; | 91 | dm_block_t block; |
92 | }; | 92 | }; |
93 | 93 | ||
94 | struct bop_ring_buffer { | ||
95 | unsigned begin; | ||
96 | unsigned end; | ||
97 | struct block_op bops[MAX_RECURSIVE_ALLOCATIONS + 1]; | ||
98 | }; | ||
99 | |||
100 | static void brb_init(struct bop_ring_buffer *brb) | ||
101 | { | ||
102 | brb->begin = 0; | ||
103 | brb->end = 0; | ||
104 | } | ||
105 | |||
106 | static bool brb_empty(struct bop_ring_buffer *brb) | ||
107 | { | ||
108 | return brb->begin == brb->end; | ||
109 | } | ||
110 | |||
111 | static unsigned brb_next(struct bop_ring_buffer *brb, unsigned old) | ||
112 | { | ||
113 | unsigned r = old + 1; | ||
114 | return (r >= (sizeof(brb->bops) / sizeof(*brb->bops))) ? 0 : r; | ||
115 | } | ||
116 | |||
117 | static int brb_push(struct bop_ring_buffer *brb, | ||
118 | enum block_op_type type, dm_block_t b) | ||
119 | { | ||
120 | struct block_op *bop; | ||
121 | unsigned next = brb_next(brb, brb->end); | ||
122 | |||
123 | /* | ||
124 | * We don't allow the last bop to be filled, this way we can | ||
125 | * differentiate between full and empty. | ||
126 | */ | ||
127 | if (next == brb->begin) | ||
128 | return -ENOMEM; | ||
129 | |||
130 | bop = brb->bops + brb->end; | ||
131 | bop->type = type; | ||
132 | bop->block = b; | ||
133 | |||
134 | brb->end = next; | ||
135 | |||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | static int brb_pop(struct bop_ring_buffer *brb, struct block_op *result) | ||
140 | { | ||
141 | struct block_op *bop; | ||
142 | |||
143 | if (brb_empty(brb)) | ||
144 | return -ENODATA; | ||
145 | |||
146 | bop = brb->bops + brb->begin; | ||
147 | result->type = bop->type; | ||
148 | result->block = bop->block; | ||
149 | |||
150 | brb->begin = brb_next(brb, brb->begin); | ||
151 | |||
152 | return 0; | ||
153 | } | ||
154 | |||
155 | /*----------------------------------------------------------------*/ | ||
156 | |||
94 | struct sm_metadata { | 157 | struct sm_metadata { |
95 | struct dm_space_map sm; | 158 | struct dm_space_map sm; |
96 | 159 | ||
@@ -101,25 +164,20 @@ struct sm_metadata { | |||
101 | 164 | ||
102 | unsigned recursion_count; | 165 | unsigned recursion_count; |
103 | unsigned allocated_this_transaction; | 166 | unsigned allocated_this_transaction; |
104 | unsigned nr_uncommitted; | 167 | struct bop_ring_buffer uncommitted; |
105 | struct block_op uncommitted[MAX_RECURSIVE_ALLOCATIONS]; | ||
106 | 168 | ||
107 | struct threshold threshold; | 169 | struct threshold threshold; |
108 | }; | 170 | }; |
109 | 171 | ||
110 | static int add_bop(struct sm_metadata *smm, enum block_op_type type, dm_block_t b) | 172 | static int add_bop(struct sm_metadata *smm, enum block_op_type type, dm_block_t b) |
111 | { | 173 | { |
112 | struct block_op *op; | 174 | int r = brb_push(&smm->uncommitted, type, b); |
113 | 175 | ||
114 | if (smm->nr_uncommitted == MAX_RECURSIVE_ALLOCATIONS) { | 176 | if (r) { |
115 | DMERR("too many recursive allocations"); | 177 | DMERR("too many recursive allocations"); |
116 | return -ENOMEM; | 178 | return -ENOMEM; |
117 | } | 179 | } |
118 | 180 | ||
119 | op = smm->uncommitted + smm->nr_uncommitted++; | ||
120 | op->type = type; | ||
121 | op->block = b; | ||
122 | |||
123 | return 0; | 181 | return 0; |
124 | } | 182 | } |
125 | 183 | ||
@@ -158,11 +216,17 @@ static int out(struct sm_metadata *smm) | |||
158 | return -ENOMEM; | 216 | return -ENOMEM; |
159 | } | 217 | } |
160 | 218 | ||
161 | if (smm->recursion_count == 1 && smm->nr_uncommitted) { | 219 | if (smm->recursion_count == 1) { |
162 | while (smm->nr_uncommitted && !r) { | 220 | while (!brb_empty(&smm->uncommitted)) { |
163 | smm->nr_uncommitted--; | 221 | struct block_op bop; |
164 | r = commit_bop(smm, smm->uncommitted + | 222 | |
165 | smm->nr_uncommitted); | 223 | r = brb_pop(&smm->uncommitted, &bop); |
224 | if (r) { | ||
225 | DMERR("bug in bop ring buffer"); | ||
226 | break; | ||
227 | } | ||
228 | |||
229 | r = commit_bop(smm, &bop); | ||
166 | if (r) | 230 | if (r) |
167 | break; | 231 | break; |
168 | } | 232 | } |
@@ -217,7 +281,8 @@ static int sm_metadata_get_nr_free(struct dm_space_map *sm, dm_block_t *count) | |||
217 | static int sm_metadata_get_count(struct dm_space_map *sm, dm_block_t b, | 281 | static int sm_metadata_get_count(struct dm_space_map *sm, dm_block_t b, |
218 | uint32_t *result) | 282 | uint32_t *result) |
219 | { | 283 | { |
220 | int r, i; | 284 | int r; |
285 | unsigned i; | ||
221 | struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm); | 286 | struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm); |
222 | unsigned adjustment = 0; | 287 | unsigned adjustment = 0; |
223 | 288 | ||
@@ -225,8 +290,10 @@ static int sm_metadata_get_count(struct dm_space_map *sm, dm_block_t b, | |||
225 | * We may have some uncommitted adjustments to add. This list | 290 | * We may have some uncommitted adjustments to add. This list |
226 | * should always be really short. | 291 | * should always be really short. |
227 | */ | 292 | */ |
228 | for (i = 0; i < smm->nr_uncommitted; i++) { | 293 | for (i = smm->uncommitted.begin; |
229 | struct block_op *op = smm->uncommitted + i; | 294 | i != smm->uncommitted.end; |
295 | i = brb_next(&smm->uncommitted, i)) { | ||
296 | struct block_op *op = smm->uncommitted.bops + i; | ||
230 | 297 | ||
231 | if (op->block != b) | 298 | if (op->block != b) |
232 | continue; | 299 | continue; |
@@ -254,7 +321,8 @@ static int sm_metadata_get_count(struct dm_space_map *sm, dm_block_t b, | |||
254 | static int sm_metadata_count_is_more_than_one(struct dm_space_map *sm, | 321 | static int sm_metadata_count_is_more_than_one(struct dm_space_map *sm, |
255 | dm_block_t b, int *result) | 322 | dm_block_t b, int *result) |
256 | { | 323 | { |
257 | int r, i, adjustment = 0; | 324 | int r, adjustment = 0; |
325 | unsigned i; | ||
258 | struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm); | 326 | struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm); |
259 | uint32_t rc; | 327 | uint32_t rc; |
260 | 328 | ||
@@ -262,8 +330,11 @@ static int sm_metadata_count_is_more_than_one(struct dm_space_map *sm, | |||
262 | * We may have some uncommitted adjustments to add. This list | 330 | * We may have some uncommitted adjustments to add. This list |
263 | * should always be really short. | 331 | * should always be really short. |
264 | */ | 332 | */ |
265 | for (i = 0; i < smm->nr_uncommitted; i++) { | 333 | for (i = smm->uncommitted.begin; |
266 | struct block_op *op = smm->uncommitted + i; | 334 | i != smm->uncommitted.end; |
335 | i = brb_next(&smm->uncommitted, i)) { | ||
336 | |||
337 | struct block_op *op = smm->uncommitted.bops + i; | ||
267 | 338 | ||
268 | if (op->block != b) | 339 | if (op->block != b) |
269 | continue; | 340 | continue; |
@@ -671,7 +742,7 @@ int dm_sm_metadata_create(struct dm_space_map *sm, | |||
671 | smm->begin = superblock + 1; | 742 | smm->begin = superblock + 1; |
672 | smm->recursion_count = 0; | 743 | smm->recursion_count = 0; |
673 | smm->allocated_this_transaction = 0; | 744 | smm->allocated_this_transaction = 0; |
674 | smm->nr_uncommitted = 0; | 745 | brb_init(&smm->uncommitted); |
675 | threshold_init(&smm->threshold); | 746 | threshold_init(&smm->threshold); |
676 | 747 | ||
677 | memcpy(&smm->sm, &bootstrap_ops, sizeof(smm->sm)); | 748 | memcpy(&smm->sm, &bootstrap_ops, sizeof(smm->sm)); |
@@ -680,6 +751,8 @@ int dm_sm_metadata_create(struct dm_space_map *sm, | |||
680 | if (r) | 751 | if (r) |
681 | return r; | 752 | return r; |
682 | 753 | ||
754 | if (nr_blocks > DM_SM_METADATA_MAX_BLOCKS) | ||
755 | nr_blocks = DM_SM_METADATA_MAX_BLOCKS; | ||
683 | r = sm_ll_extend(&smm->ll, nr_blocks); | 756 | r = sm_ll_extend(&smm->ll, nr_blocks); |
684 | if (r) | 757 | if (r) |
685 | return r; | 758 | return r; |
@@ -713,7 +786,7 @@ int dm_sm_metadata_open(struct dm_space_map *sm, | |||
713 | smm->begin = 0; | 786 | smm->begin = 0; |
714 | smm->recursion_count = 0; | 787 | smm->recursion_count = 0; |
715 | smm->allocated_this_transaction = 0; | 788 | smm->allocated_this_transaction = 0; |
716 | smm->nr_uncommitted = 0; | 789 | brb_init(&smm->uncommitted); |
717 | threshold_init(&smm->threshold); | 790 | threshold_init(&smm->threshold); |
718 | 791 | ||
719 | memcpy(&smm->old_ll, &smm->ll, sizeof(smm->old_ll)); | 792 | memcpy(&smm->old_ll, &smm->ll, sizeof(smm->old_ll)); |
diff --git a/drivers/md/persistent-data/dm-space-map-metadata.h b/drivers/md/persistent-data/dm-space-map-metadata.h index 39bba0801cf2..64df923974d8 100644 --- a/drivers/md/persistent-data/dm-space-map-metadata.h +++ b/drivers/md/persistent-data/dm-space-map-metadata.h | |||
@@ -9,6 +9,17 @@ | |||
9 | 9 | ||
10 | #include "dm-transaction-manager.h" | 10 | #include "dm-transaction-manager.h" |
11 | 11 | ||
12 | #define DM_SM_METADATA_BLOCK_SIZE (4096 >> SECTOR_SHIFT) | ||
13 | |||
14 | /* | ||
15 | * The metadata device is currently limited in size. | ||
16 | * | ||
17 | * We have one block of index, which can hold 255 index entries. Each | ||
18 | * index entry contains allocation info about ~16k metadata blocks. | ||
19 | */ | ||
20 | #define DM_SM_METADATA_MAX_BLOCKS (255 * ((1 << 14) - 64)) | ||
21 | #define DM_SM_METADATA_MAX_SECTORS (DM_SM_METADATA_MAX_BLOCKS * DM_SM_METADATA_BLOCK_SIZE) | ||
22 | |||
12 | /* | 23 | /* |
13 | * Unfortunately we have to use two-phase construction due to the cycle | 24 | * Unfortunately we have to use two-phase construction due to the cycle |
14 | * between the tm and sm. | 25 | * between the tm and sm. |
diff --git a/drivers/mfd/da9055-i2c.c b/drivers/mfd/da9055-i2c.c index 13af7e50021e..8103e4362132 100644 --- a/drivers/mfd/da9055-i2c.c +++ b/drivers/mfd/da9055-i2c.c | |||
@@ -53,17 +53,25 @@ static int da9055_i2c_remove(struct i2c_client *i2c) | |||
53 | return 0; | 53 | return 0; |
54 | } | 54 | } |
55 | 55 | ||
56 | /* | ||
57 | * DO NOT change the device Ids. The naming is intentionally specific as both | ||
58 | * the PMIC and CODEC parts of this chip are instantiated separately as I2C | ||
59 | * devices (both have configurable I2C addresses, and are to all intents and | ||
60 | * purposes separate). As a result there are specific DA9055 ids for PMIC | ||
61 | * and CODEC, which must be different to operate together. | ||
62 | */ | ||
56 | static struct i2c_device_id da9055_i2c_id[] = { | 63 | static struct i2c_device_id da9055_i2c_id[] = { |
57 | {"da9055", 0}, | 64 | {"da9055-pmic", 0}, |
58 | { } | 65 | { } |
59 | }; | 66 | }; |
67 | MODULE_DEVICE_TABLE(i2c, da9055_i2c_id); | ||
60 | 68 | ||
61 | static struct i2c_driver da9055_i2c_driver = { | 69 | static struct i2c_driver da9055_i2c_driver = { |
62 | .probe = da9055_i2c_probe, | 70 | .probe = da9055_i2c_probe, |
63 | .remove = da9055_i2c_remove, | 71 | .remove = da9055_i2c_remove, |
64 | .id_table = da9055_i2c_id, | 72 | .id_table = da9055_i2c_id, |
65 | .driver = { | 73 | .driver = { |
66 | .name = "da9055", | 74 | .name = "da9055-pmic", |
67 | .owner = THIS_MODULE, | 75 | .owner = THIS_MODULE, |
68 | }, | 76 | }, |
69 | }; | 77 | }; |
diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c index ac514fb2b877..71aa14a6bfbb 100644 --- a/drivers/mfd/max14577.c +++ b/drivers/mfd/max14577.c | |||
@@ -173,6 +173,7 @@ static const struct i2c_device_id max14577_i2c_id[] = { | |||
173 | }; | 173 | }; |
174 | MODULE_DEVICE_TABLE(i2c, max14577_i2c_id); | 174 | MODULE_DEVICE_TABLE(i2c, max14577_i2c_id); |
175 | 175 | ||
176 | #ifdef CONFIG_PM_SLEEP | ||
176 | static int max14577_suspend(struct device *dev) | 177 | static int max14577_suspend(struct device *dev) |
177 | { | 178 | { |
178 | struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); | 179 | struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); |
@@ -208,6 +209,7 @@ static int max14577_resume(struct device *dev) | |||
208 | 209 | ||
209 | return 0; | 210 | return 0; |
210 | } | 211 | } |
212 | #endif /* CONFIG_PM_SLEEP */ | ||
211 | 213 | ||
212 | static struct of_device_id max14577_dt_match[] = { | 214 | static struct of_device_id max14577_dt_match[] = { |
213 | { .compatible = "maxim,max14577", }, | 215 | { .compatible = "maxim,max14577", }, |
diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c index be88a3bf7b85..5adede0fb04c 100644 --- a/drivers/mfd/max8997.c +++ b/drivers/mfd/max8997.c | |||
@@ -164,15 +164,15 @@ static struct max8997_platform_data *max8997_i2c_parse_dt_pdata( | |||
164 | return pd; | 164 | return pd; |
165 | } | 165 | } |
166 | 166 | ||
167 | static inline int max8997_i2c_get_driver_data(struct i2c_client *i2c, | 167 | static inline unsigned long max8997_i2c_get_driver_data(struct i2c_client *i2c, |
168 | const struct i2c_device_id *id) | 168 | const struct i2c_device_id *id) |
169 | { | 169 | { |
170 | if (IS_ENABLED(CONFIG_OF) && i2c->dev.of_node) { | 170 | if (IS_ENABLED(CONFIG_OF) && i2c->dev.of_node) { |
171 | const struct of_device_id *match; | 171 | const struct of_device_id *match; |
172 | match = of_match_node(max8997_pmic_dt_match, i2c->dev.of_node); | 172 | match = of_match_node(max8997_pmic_dt_match, i2c->dev.of_node); |
173 | return (int)match->data; | 173 | return (unsigned long)match->data; |
174 | } | 174 | } |
175 | return (int)id->driver_data; | 175 | return id->driver_data; |
176 | } | 176 | } |
177 | 177 | ||
178 | static int max8997_i2c_probe(struct i2c_client *i2c, | 178 | static int max8997_i2c_probe(struct i2c_client *i2c, |
diff --git a/drivers/mfd/max8998.c b/drivers/mfd/max8998.c index 612ca404e150..5d5e186b5d8b 100644 --- a/drivers/mfd/max8998.c +++ b/drivers/mfd/max8998.c | |||
@@ -169,16 +169,16 @@ static struct max8998_platform_data *max8998_i2c_parse_dt_pdata( | |||
169 | return pd; | 169 | return pd; |
170 | } | 170 | } |
171 | 171 | ||
172 | static inline int max8998_i2c_get_driver_data(struct i2c_client *i2c, | 172 | static inline unsigned long max8998_i2c_get_driver_data(struct i2c_client *i2c, |
173 | const struct i2c_device_id *id) | 173 | const struct i2c_device_id *id) |
174 | { | 174 | { |
175 | if (IS_ENABLED(CONFIG_OF) && i2c->dev.of_node) { | 175 | if (IS_ENABLED(CONFIG_OF) && i2c->dev.of_node) { |
176 | const struct of_device_id *match; | 176 | const struct of_device_id *match; |
177 | match = of_match_node(max8998_dt_match, i2c->dev.of_node); | 177 | match = of_match_node(max8998_dt_match, i2c->dev.of_node); |
178 | return (int)(long)match->data; | 178 | return (unsigned long)match->data; |
179 | } | 179 | } |
180 | 180 | ||
181 | return (int)id->driver_data; | 181 | return id->driver_data; |
182 | } | 182 | } |
183 | 183 | ||
184 | static int max8998_i2c_probe(struct i2c_client *i2c, | 184 | static int max8998_i2c_probe(struct i2c_client *i2c, |
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c index a139798b8065..714e2135210e 100644 --- a/drivers/mfd/sec-core.c +++ b/drivers/mfd/sec-core.c | |||
@@ -315,6 +315,7 @@ static int sec_pmic_remove(struct i2c_client *i2c) | |||
315 | return 0; | 315 | return 0; |
316 | } | 316 | } |
317 | 317 | ||
318 | #ifdef CONFIG_PM_SLEEP | ||
318 | static int sec_pmic_suspend(struct device *dev) | 319 | static int sec_pmic_suspend(struct device *dev) |
319 | { | 320 | { |
320 | struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); | 321 | struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); |
@@ -349,6 +350,7 @@ static int sec_pmic_resume(struct device *dev) | |||
349 | 350 | ||
350 | return 0; | 351 | return 0; |
351 | } | 352 | } |
353 | #endif /* CONFIG_PM_SLEEP */ | ||
352 | 354 | ||
353 | static SIMPLE_DEV_PM_OPS(sec_pmic_pm_ops, sec_pmic_suspend, sec_pmic_resume); | 355 | static SIMPLE_DEV_PM_OPS(sec_pmic_pm_ops, sec_pmic_suspend, sec_pmic_resume); |
354 | 356 | ||
diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c index 966cf65c5c36..3cc4c7084b92 100644 --- a/drivers/mfd/tps65217.c +++ b/drivers/mfd/tps65217.c | |||
@@ -158,7 +158,7 @@ static int tps65217_probe(struct i2c_client *client, | |||
158 | { | 158 | { |
159 | struct tps65217 *tps; | 159 | struct tps65217 *tps; |
160 | unsigned int version; | 160 | unsigned int version; |
161 | unsigned int chip_id = ids->driver_data; | 161 | unsigned long chip_id = ids->driver_data; |
162 | const struct of_device_id *match; | 162 | const struct of_device_id *match; |
163 | bool status_off = false; | 163 | bool status_off = false; |
164 | int ret; | 164 | int ret; |
@@ -170,7 +170,7 @@ static int tps65217_probe(struct i2c_client *client, | |||
170 | "Failed to find matching dt id\n"); | 170 | "Failed to find matching dt id\n"); |
171 | return -EINVAL; | 171 | return -EINVAL; |
172 | } | 172 | } |
173 | chip_id = (unsigned int)(unsigned long)match->data; | 173 | chip_id = (unsigned long)match->data; |
174 | status_off = of_property_read_bool(client->dev.of_node, | 174 | status_off = of_property_read_bool(client->dev.of_node, |
175 | "ti,pmic-shutdown-controller"); | 175 | "ti,pmic-shutdown-controller"); |
176 | } | 176 | } |
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index ba04f1bc70eb..e6fab94e2c8a 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c | |||
@@ -636,7 +636,7 @@ static int wm8994_i2c_probe(struct i2c_client *i2c, | |||
636 | if (i2c->dev.of_node) { | 636 | if (i2c->dev.of_node) { |
637 | of_id = of_match_device(wm8994_of_match, &i2c->dev); | 637 | of_id = of_match_device(wm8994_of_match, &i2c->dev); |
638 | if (of_id) | 638 | if (of_id) |
639 | wm8994->type = (int)of_id->data; | 639 | wm8994->type = (enum wm8994_type)of_id->data; |
640 | } else { | 640 | } else { |
641 | wm8994->type = id->driver_data; | 641 | wm8994->type = id->driver_data; |
642 | } | 642 | } |
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c index 9b809cfc2899..89a557972d1b 100644 --- a/drivers/misc/mei/client.c +++ b/drivers/misc/mei/client.c | |||
@@ -666,7 +666,6 @@ int mei_cl_read_start(struct mei_cl *cl, size_t length) | |||
666 | goto err; | 666 | goto err; |
667 | 667 | ||
668 | cb->fop_type = MEI_FOP_READ; | 668 | cb->fop_type = MEI_FOP_READ; |
669 | cl->read_cb = cb; | ||
670 | if (dev->hbuf_is_ready) { | 669 | if (dev->hbuf_is_ready) { |
671 | dev->hbuf_is_ready = false; | 670 | dev->hbuf_is_ready = false; |
672 | if (mei_hbm_cl_flow_control_req(dev, cl)) { | 671 | if (mei_hbm_cl_flow_control_req(dev, cl)) { |
@@ -678,6 +677,9 @@ int mei_cl_read_start(struct mei_cl *cl, size_t length) | |||
678 | } else { | 677 | } else { |
679 | list_add_tail(&cb->list, &dev->ctrl_wr_list.list); | 678 | list_add_tail(&cb->list, &dev->ctrl_wr_list.list); |
680 | } | 679 | } |
680 | |||
681 | cl->read_cb = cb; | ||
682 | |||
681 | return rets; | 683 | return rets; |
682 | err: | 684 | err: |
683 | mei_io_cb_free(cb); | 685 | mei_io_cb_free(cb); |
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index 357bbc54fe4b..3e049c13429c 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c | |||
@@ -197,7 +197,7 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, | |||
197 | struct mmc_queue_req *mqrq_prev = &mq->mqrq[1]; | 197 | struct mmc_queue_req *mqrq_prev = &mq->mqrq[1]; |
198 | 198 | ||
199 | if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask) | 199 | if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask) |
200 | limit = dma_max_pfn(mmc_dev(host)) << PAGE_SHIFT; | 200 | limit = (u64)dma_max_pfn(mmc_dev(host)) << PAGE_SHIFT; |
201 | 201 | ||
202 | mq->card = card; | 202 | mq->card = card; |
203 | mq->queue = blk_init_queue(mmc_request_fn, lock); | 203 | mq->queue = blk_init_queue(mmc_request_fn, lock); |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 59eba5d2c685..9715a7ba164a 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -1584,7 +1584,7 @@ read_retry: | |||
1584 | } | 1584 | } |
1585 | 1585 | ||
1586 | if (mtd->ecc_stats.failed - ecc_failures) { | 1586 | if (mtd->ecc_stats.failed - ecc_failures) { |
1587 | if (retry_mode + 1 <= chip->read_retries) { | 1587 | if (retry_mode + 1 < chip->read_retries) { |
1588 | retry_mode++; | 1588 | retry_mode++; |
1589 | ret = nand_setup_read_retry(mtd, | 1589 | ret = nand_setup_read_retry(mtd, |
1590 | retry_mode); | 1590 | retry_mode); |
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index ef4190a02b7b..bf642ceef681 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c | |||
@@ -1633,6 +1633,7 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1633 | int i; | 1633 | int i; |
1634 | dma_cap_mask_t mask; | 1634 | dma_cap_mask_t mask; |
1635 | unsigned sig; | 1635 | unsigned sig; |
1636 | unsigned oob_index; | ||
1636 | struct resource *res; | 1637 | struct resource *res; |
1637 | struct mtd_part_parser_data ppdata = {}; | 1638 | struct mtd_part_parser_data ppdata = {}; |
1638 | 1639 | ||
@@ -1826,11 +1827,14 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1826 | (mtd->writesize / | 1827 | (mtd->writesize / |
1827 | nand_chip->ecc.size); | 1828 | nand_chip->ecc.size); |
1828 | if (nand_chip->options & NAND_BUSWIDTH_16) | 1829 | if (nand_chip->options & NAND_BUSWIDTH_16) |
1829 | ecclayout->eccpos[0] = BADBLOCK_MARKER_LENGTH; | 1830 | oob_index = BADBLOCK_MARKER_LENGTH; |
1830 | else | 1831 | else |
1831 | ecclayout->eccpos[0] = 1; | 1832 | oob_index = 1; |
1832 | ecclayout->oobfree->offset = ecclayout->eccpos[0] + | 1833 | for (i = 0; i < ecclayout->eccbytes; i++, oob_index++) |
1833 | ecclayout->eccbytes; | 1834 | ecclayout->eccpos[i] = oob_index; |
1835 | /* no reserved-marker in ecclayout for this ecc-scheme */ | ||
1836 | ecclayout->oobfree->offset = | ||
1837 | ecclayout->eccpos[ecclayout->eccbytes - 1] + 1; | ||
1834 | break; | 1838 | break; |
1835 | 1839 | ||
1836 | case OMAP_ECC_BCH4_CODE_HW_DETECTION_SW: | 1840 | case OMAP_ECC_BCH4_CODE_HW_DETECTION_SW: |
@@ -1847,9 +1851,15 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1847 | ecclayout->eccbytes = nand_chip->ecc.bytes * | 1851 | ecclayout->eccbytes = nand_chip->ecc.bytes * |
1848 | (mtd->writesize / | 1852 | (mtd->writesize / |
1849 | nand_chip->ecc.size); | 1853 | nand_chip->ecc.size); |
1850 | ecclayout->eccpos[0] = BADBLOCK_MARKER_LENGTH; | 1854 | oob_index = BADBLOCK_MARKER_LENGTH; |
1851 | ecclayout->oobfree->offset = ecclayout->eccpos[0] + | 1855 | for (i = 0; i < ecclayout->eccbytes; i++, oob_index++) { |
1852 | ecclayout->eccbytes; | 1856 | ecclayout->eccpos[i] = oob_index; |
1857 | if (((i + 1) % nand_chip->ecc.bytes) == 0) | ||
1858 | oob_index++; | ||
1859 | } | ||
1860 | /* include reserved-marker in ecclayout->oobfree calculation */ | ||
1861 | ecclayout->oobfree->offset = 1 + | ||
1862 | ecclayout->eccpos[ecclayout->eccbytes - 1] + 1; | ||
1853 | /* software bch library is used for locating errors */ | 1863 | /* software bch library is used for locating errors */ |
1854 | nand_chip->ecc.priv = nand_bch_init(mtd, | 1864 | nand_chip->ecc.priv = nand_bch_init(mtd, |
1855 | nand_chip->ecc.size, | 1865 | nand_chip->ecc.size, |
@@ -1883,9 +1893,12 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1883 | ecclayout->eccbytes = nand_chip->ecc.bytes * | 1893 | ecclayout->eccbytes = nand_chip->ecc.bytes * |
1884 | (mtd->writesize / | 1894 | (mtd->writesize / |
1885 | nand_chip->ecc.size); | 1895 | nand_chip->ecc.size); |
1886 | ecclayout->eccpos[0] = BADBLOCK_MARKER_LENGTH; | 1896 | oob_index = BADBLOCK_MARKER_LENGTH; |
1887 | ecclayout->oobfree->offset = ecclayout->eccpos[0] + | 1897 | for (i = 0; i < ecclayout->eccbytes; i++, oob_index++) |
1888 | ecclayout->eccbytes; | 1898 | ecclayout->eccpos[i] = oob_index; |
1899 | /* reserved marker already included in ecclayout->eccbytes */ | ||
1900 | ecclayout->oobfree->offset = | ||
1901 | ecclayout->eccpos[ecclayout->eccbytes - 1] + 1; | ||
1889 | /* This ECC scheme requires ELM H/W block */ | 1902 | /* This ECC scheme requires ELM H/W block */ |
1890 | if (is_elm_present(info, pdata->elm_of_node, BCH4_ECC) < 0) { | 1903 | if (is_elm_present(info, pdata->elm_of_node, BCH4_ECC) < 0) { |
1891 | pr_err("nand: error: could not initialize ELM\n"); | 1904 | pr_err("nand: error: could not initialize ELM\n"); |
@@ -1913,9 +1926,15 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1913 | ecclayout->eccbytes = nand_chip->ecc.bytes * | 1926 | ecclayout->eccbytes = nand_chip->ecc.bytes * |
1914 | (mtd->writesize / | 1927 | (mtd->writesize / |
1915 | nand_chip->ecc.size); | 1928 | nand_chip->ecc.size); |
1916 | ecclayout->eccpos[0] = BADBLOCK_MARKER_LENGTH; | 1929 | oob_index = BADBLOCK_MARKER_LENGTH; |
1917 | ecclayout->oobfree->offset = ecclayout->eccpos[0] + | 1930 | for (i = 0; i < ecclayout->eccbytes; i++, oob_index++) { |
1918 | ecclayout->eccbytes; | 1931 | ecclayout->eccpos[i] = oob_index; |
1932 | if (((i + 1) % nand_chip->ecc.bytes) == 0) | ||
1933 | oob_index++; | ||
1934 | } | ||
1935 | /* include reserved-marker in ecclayout->oobfree calculation */ | ||
1936 | ecclayout->oobfree->offset = 1 + | ||
1937 | ecclayout->eccpos[ecclayout->eccbytes - 1] + 1; | ||
1919 | /* software bch library is used for locating errors */ | 1938 | /* software bch library is used for locating errors */ |
1920 | nand_chip->ecc.priv = nand_bch_init(mtd, | 1939 | nand_chip->ecc.priv = nand_bch_init(mtd, |
1921 | nand_chip->ecc.size, | 1940 | nand_chip->ecc.size, |
@@ -1956,9 +1975,12 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1956 | ecclayout->eccbytes = nand_chip->ecc.bytes * | 1975 | ecclayout->eccbytes = nand_chip->ecc.bytes * |
1957 | (mtd->writesize / | 1976 | (mtd->writesize / |
1958 | nand_chip->ecc.size); | 1977 | nand_chip->ecc.size); |
1959 | ecclayout->eccpos[0] = BADBLOCK_MARKER_LENGTH; | 1978 | oob_index = BADBLOCK_MARKER_LENGTH; |
1960 | ecclayout->oobfree->offset = ecclayout->eccpos[0] + | 1979 | for (i = 0; i < ecclayout->eccbytes; i++, oob_index++) |
1961 | ecclayout->eccbytes; | 1980 | ecclayout->eccpos[i] = oob_index; |
1981 | /* reserved marker already included in ecclayout->eccbytes */ | ||
1982 | ecclayout->oobfree->offset = | ||
1983 | ecclayout->eccpos[ecclayout->eccbytes - 1] + 1; | ||
1962 | break; | 1984 | break; |
1963 | #else | 1985 | #else |
1964 | pr_err("nand: error: CONFIG_MTD_NAND_OMAP_BCH not enabled\n"); | 1986 | pr_err("nand: error: CONFIG_MTD_NAND_OMAP_BCH not enabled\n"); |
@@ -1972,11 +1994,8 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1972 | goto return_error; | 1994 | goto return_error; |
1973 | } | 1995 | } |
1974 | 1996 | ||
1975 | /* populate remaining ECC layout data */ | 1997 | /* all OOB bytes from oobfree->offset till end off OOB are free */ |
1976 | ecclayout->oobfree->length = mtd->oobsize - (BADBLOCK_MARKER_LENGTH + | 1998 | ecclayout->oobfree->length = mtd->oobsize - ecclayout->oobfree->offset; |
1977 | ecclayout->eccbytes); | ||
1978 | for (i = 1; i < ecclayout->eccbytes; i++) | ||
1979 | ecclayout->eccpos[i] = ecclayout->eccpos[0] + i; | ||
1980 | /* check if NAND device's OOB is enough to store ECC signatures */ | 1999 | /* check if NAND device's OOB is enough to store ECC signatures */ |
1981 | if (mtd->oobsize < (ecclayout->eccbytes + BADBLOCK_MARKER_LENGTH)) { | 2000 | if (mtd->oobsize < (ecclayout->eccbytes + BADBLOCK_MARKER_LENGTH)) { |
1982 | pr_err("not enough OOB bytes required = %d, available=%d\n", | 2001 | pr_err("not enough OOB bytes required = %d, available=%d\n", |
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c index ead861307b3c..c5dad652614d 100644 --- a/drivers/mtd/ubi/fastmap.c +++ b/drivers/mtd/ubi/fastmap.c | |||
@@ -463,8 +463,8 @@ static int scan_pool(struct ubi_device *ubi, struct ubi_attach_info *ai, | |||
463 | } | 463 | } |
464 | } | 464 | } |
465 | if (found_orphan) { | 465 | if (found_orphan) { |
466 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
467 | list_del(&tmp_aeb->u.list); | 466 | list_del(&tmp_aeb->u.list); |
467 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
468 | } | 468 | } |
469 | 469 | ||
470 | new_aeb = kmem_cache_alloc(ai->aeb_slab_cache, | 470 | new_aeb = kmem_cache_alloc(ai->aeb_slab_cache, |
@@ -846,16 +846,16 @@ fail_bad: | |||
846 | ret = UBI_BAD_FASTMAP; | 846 | ret = UBI_BAD_FASTMAP; |
847 | fail: | 847 | fail: |
848 | list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &used, u.list) { | 848 | list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &used, u.list) { |
849 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
850 | list_del(&tmp_aeb->u.list); | 849 | list_del(&tmp_aeb->u.list); |
850 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
851 | } | 851 | } |
852 | list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &eba_orphans, u.list) { | 852 | list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &eba_orphans, u.list) { |
853 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
854 | list_del(&tmp_aeb->u.list); | 853 | list_del(&tmp_aeb->u.list); |
854 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
855 | } | 855 | } |
856 | list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &free, u.list) { | 856 | list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &free, u.list) { |
857 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
858 | list_del(&tmp_aeb->u.list); | 857 | list_del(&tmp_aeb->u.list); |
858 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
859 | } | 859 | } |
860 | 860 | ||
861 | return ret; | 861 | return ret; |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index f342278539d5..494b888a6568 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -139,7 +139,7 @@ config MACVTAP | |||
139 | This adds a specialized tap character device driver that is based | 139 | This adds a specialized tap character device driver that is based |
140 | on the MAC-VLAN network interface, called macvtap. A macvtap device | 140 | on the MAC-VLAN network interface, called macvtap. A macvtap device |
141 | can be added in the same way as a macvlan device, using 'type | 141 | can be added in the same way as a macvlan device, using 'type |
142 | macvlan', and then be accessed through the tap user space interface. | 142 | macvtap', and then be accessed through the tap user space interface. |
143 | 143 | ||
144 | To compile this driver as a module, choose M here: the module | 144 | To compile this driver as a module, choose M here: the module |
145 | will be called macvtap. | 145 | will be called macvtap. |
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index cce1f1bf90b4..dcde56057fe1 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -181,7 +181,7 @@ static inline int __agg_has_partner(struct aggregator *agg) | |||
181 | */ | 181 | */ |
182 | static inline void __disable_port(struct port *port) | 182 | static inline void __disable_port(struct port *port) |
183 | { | 183 | { |
184 | bond_set_slave_inactive_flags(port->slave); | 184 | bond_set_slave_inactive_flags(port->slave, BOND_SLAVE_NOTIFY_LATER); |
185 | } | 185 | } |
186 | 186 | ||
187 | /** | 187 | /** |
@@ -193,7 +193,7 @@ static inline void __enable_port(struct port *port) | |||
193 | struct slave *slave = port->slave; | 193 | struct slave *slave = port->slave; |
194 | 194 | ||
195 | if ((slave->link == BOND_LINK_UP) && IS_UP(slave->dev)) | 195 | if ((slave->link == BOND_LINK_UP) && IS_UP(slave->dev)) |
196 | bond_set_slave_active_flags(slave); | 196 | bond_set_slave_active_flags(slave, BOND_SLAVE_NOTIFY_LATER); |
197 | } | 197 | } |
198 | 198 | ||
199 | /** | 199 | /** |
@@ -1796,8 +1796,6 @@ void bond_3ad_initiate_agg_selection(struct bonding *bond, int timeout) | |||
1796 | BOND_AD_INFO(bond).agg_select_timer = timeout; | 1796 | BOND_AD_INFO(bond).agg_select_timer = timeout; |
1797 | } | 1797 | } |
1798 | 1798 | ||
1799 | static u16 aggregator_identifier; | ||
1800 | |||
1801 | /** | 1799 | /** |
1802 | * bond_3ad_initialize - initialize a bond's 802.3ad parameters and structures | 1800 | * bond_3ad_initialize - initialize a bond's 802.3ad parameters and structures |
1803 | * @bond: bonding struct to work on | 1801 | * @bond: bonding struct to work on |
@@ -1811,7 +1809,7 @@ void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution) | |||
1811 | if (!MAC_ADDRESS_EQUAL(&(BOND_AD_INFO(bond).system.sys_mac_addr), | 1809 | if (!MAC_ADDRESS_EQUAL(&(BOND_AD_INFO(bond).system.sys_mac_addr), |
1812 | bond->dev->dev_addr)) { | 1810 | bond->dev->dev_addr)) { |
1813 | 1811 | ||
1814 | aggregator_identifier = 0; | 1812 | BOND_AD_INFO(bond).aggregator_identifier = 0; |
1815 | 1813 | ||
1816 | BOND_AD_INFO(bond).system.sys_priority = 0xFFFF; | 1814 | BOND_AD_INFO(bond).system.sys_priority = 0xFFFF; |
1817 | BOND_AD_INFO(bond).system.sys_mac_addr = *((struct mac_addr *)bond->dev->dev_addr); | 1815 | BOND_AD_INFO(bond).system.sys_mac_addr = *((struct mac_addr *)bond->dev->dev_addr); |
@@ -1880,7 +1878,7 @@ void bond_3ad_bind_slave(struct slave *slave) | |||
1880 | ad_initialize_agg(aggregator); | 1878 | ad_initialize_agg(aggregator); |
1881 | 1879 | ||
1882 | aggregator->aggregator_mac_address = *((struct mac_addr *)bond->dev->dev_addr); | 1880 | aggregator->aggregator_mac_address = *((struct mac_addr *)bond->dev->dev_addr); |
1883 | aggregator->aggregator_identifier = (++aggregator_identifier); | 1881 | aggregator->aggregator_identifier = ++BOND_AD_INFO(bond).aggregator_identifier; |
1884 | aggregator->slave = slave; | 1882 | aggregator->slave = slave; |
1885 | aggregator->is_active = 0; | 1883 | aggregator->is_active = 0; |
1886 | aggregator->num_of_ports = 0; | 1884 | aggregator->num_of_ports = 0; |
@@ -2064,6 +2062,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work) | |||
2064 | struct list_head *iter; | 2062 | struct list_head *iter; |
2065 | struct slave *slave; | 2063 | struct slave *slave; |
2066 | struct port *port; | 2064 | struct port *port; |
2065 | bool should_notify_rtnl = BOND_SLAVE_NOTIFY_LATER; | ||
2067 | 2066 | ||
2068 | read_lock(&bond->lock); | 2067 | read_lock(&bond->lock); |
2069 | rcu_read_lock(); | 2068 | rcu_read_lock(); |
@@ -2121,8 +2120,19 @@ void bond_3ad_state_machine_handler(struct work_struct *work) | |||
2121 | } | 2120 | } |
2122 | 2121 | ||
2123 | re_arm: | 2122 | re_arm: |
2123 | bond_for_each_slave_rcu(bond, slave, iter) { | ||
2124 | if (slave->should_notify) { | ||
2125 | should_notify_rtnl = BOND_SLAVE_NOTIFY_NOW; | ||
2126 | break; | ||
2127 | } | ||
2128 | } | ||
2124 | rcu_read_unlock(); | 2129 | rcu_read_unlock(); |
2125 | read_unlock(&bond->lock); | 2130 | read_unlock(&bond->lock); |
2131 | |||
2132 | if (should_notify_rtnl && rtnl_trylock()) { | ||
2133 | bond_slave_state_notify(bond); | ||
2134 | rtnl_unlock(); | ||
2135 | } | ||
2126 | queue_delayed_work(bond->wq, &bond->ad_work, ad_delta_in_ticks); | 2136 | queue_delayed_work(bond->wq, &bond->ad_work, ad_delta_in_ticks); |
2127 | } | 2137 | } |
2128 | 2138 | ||
diff --git a/drivers/net/bonding/bond_3ad.h b/drivers/net/bonding/bond_3ad.h index 13dc9d3c5e34..f4dd9592ac62 100644 --- a/drivers/net/bonding/bond_3ad.h +++ b/drivers/net/bonding/bond_3ad.h | |||
@@ -253,6 +253,7 @@ struct ad_system { | |||
253 | struct ad_bond_info { | 253 | struct ad_bond_info { |
254 | struct ad_system system; /* 802.3ad system structure */ | 254 | struct ad_system system; /* 802.3ad system structure */ |
255 | u32 agg_select_timer; // Timer to select aggregator after all adapter's hand shakes | 255 | u32 agg_select_timer; // Timer to select aggregator after all adapter's hand shakes |
256 | u16 aggregator_identifier; | ||
256 | }; | 257 | }; |
257 | 258 | ||
258 | struct ad_slave_info { | 259 | struct ad_slave_info { |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 71ba18efa15b..e5628fc725c3 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -829,21 +829,25 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active) | |||
829 | if (bond_is_lb(bond)) { | 829 | if (bond_is_lb(bond)) { |
830 | bond_alb_handle_active_change(bond, new_active); | 830 | bond_alb_handle_active_change(bond, new_active); |
831 | if (old_active) | 831 | if (old_active) |
832 | bond_set_slave_inactive_flags(old_active); | 832 | bond_set_slave_inactive_flags(old_active, |
833 | BOND_SLAVE_NOTIFY_NOW); | ||
833 | if (new_active) | 834 | if (new_active) |
834 | bond_set_slave_active_flags(new_active); | 835 | bond_set_slave_active_flags(new_active, |
836 | BOND_SLAVE_NOTIFY_NOW); | ||
835 | } else { | 837 | } else { |
836 | rcu_assign_pointer(bond->curr_active_slave, new_active); | 838 | rcu_assign_pointer(bond->curr_active_slave, new_active); |
837 | } | 839 | } |
838 | 840 | ||
839 | if (bond->params.mode == BOND_MODE_ACTIVEBACKUP) { | 841 | if (bond->params.mode == BOND_MODE_ACTIVEBACKUP) { |
840 | if (old_active) | 842 | if (old_active) |
841 | bond_set_slave_inactive_flags(old_active); | 843 | bond_set_slave_inactive_flags(old_active, |
844 | BOND_SLAVE_NOTIFY_NOW); | ||
842 | 845 | ||
843 | if (new_active) { | 846 | if (new_active) { |
844 | bool should_notify_peers = false; | 847 | bool should_notify_peers = false; |
845 | 848 | ||
846 | bond_set_slave_active_flags(new_active); | 849 | bond_set_slave_active_flags(new_active, |
850 | BOND_SLAVE_NOTIFY_NOW); | ||
847 | 851 | ||
848 | if (bond->params.fail_over_mac) | 852 | if (bond->params.fail_over_mac) |
849 | bond_do_fail_over_mac(bond, new_active, | 853 | bond_do_fail_over_mac(bond, new_active, |
@@ -1193,6 +1197,11 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1193 | return -EBUSY; | 1197 | return -EBUSY; |
1194 | } | 1198 | } |
1195 | 1199 | ||
1200 | if (bond_dev == slave_dev) { | ||
1201 | pr_err("%s: cannot enslave bond to itself.\n", bond_dev->name); | ||
1202 | return -EPERM; | ||
1203 | } | ||
1204 | |||
1196 | /* vlan challenged mutual exclusion */ | 1205 | /* vlan challenged mutual exclusion */ |
1197 | /* no need to lock since we're protected by rtnl_lock */ | 1206 | /* no need to lock since we're protected by rtnl_lock */ |
1198 | if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) { | 1207 | if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) { |
@@ -1463,14 +1472,15 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1463 | 1472 | ||
1464 | switch (bond->params.mode) { | 1473 | switch (bond->params.mode) { |
1465 | case BOND_MODE_ACTIVEBACKUP: | 1474 | case BOND_MODE_ACTIVEBACKUP: |
1466 | bond_set_slave_inactive_flags(new_slave); | 1475 | bond_set_slave_inactive_flags(new_slave, |
1476 | BOND_SLAVE_NOTIFY_NOW); | ||
1467 | break; | 1477 | break; |
1468 | case BOND_MODE_8023AD: | 1478 | case BOND_MODE_8023AD: |
1469 | /* in 802.3ad mode, the internal mechanism | 1479 | /* in 802.3ad mode, the internal mechanism |
1470 | * will activate the slaves in the selected | 1480 | * will activate the slaves in the selected |
1471 | * aggregator | 1481 | * aggregator |
1472 | */ | 1482 | */ |
1473 | bond_set_slave_inactive_flags(new_slave); | 1483 | bond_set_slave_inactive_flags(new_slave, BOND_SLAVE_NOTIFY_NOW); |
1474 | /* if this is the first slave */ | 1484 | /* if this is the first slave */ |
1475 | if (!prev_slave) { | 1485 | if (!prev_slave) { |
1476 | SLAVE_AD_INFO(new_slave).id = 1; | 1486 | SLAVE_AD_INFO(new_slave).id = 1; |
@@ -1488,7 +1498,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1488 | case BOND_MODE_TLB: | 1498 | case BOND_MODE_TLB: |
1489 | case BOND_MODE_ALB: | 1499 | case BOND_MODE_ALB: |
1490 | bond_set_active_slave(new_slave); | 1500 | bond_set_active_slave(new_slave); |
1491 | bond_set_slave_inactive_flags(new_slave); | 1501 | bond_set_slave_inactive_flags(new_slave, BOND_SLAVE_NOTIFY_NOW); |
1492 | break; | 1502 | break; |
1493 | default: | 1503 | default: |
1494 | pr_debug("This slave is always active in trunk mode\n"); | 1504 | pr_debug("This slave is always active in trunk mode\n"); |
@@ -1543,9 +1553,11 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1543 | bond_set_carrier(bond); | 1553 | bond_set_carrier(bond); |
1544 | 1554 | ||
1545 | if (USES_PRIMARY(bond->params.mode)) { | 1555 | if (USES_PRIMARY(bond->params.mode)) { |
1556 | block_netpoll_tx(); | ||
1546 | write_lock_bh(&bond->curr_slave_lock); | 1557 | write_lock_bh(&bond->curr_slave_lock); |
1547 | bond_select_active_slave(bond); | 1558 | bond_select_active_slave(bond); |
1548 | write_unlock_bh(&bond->curr_slave_lock); | 1559 | write_unlock_bh(&bond->curr_slave_lock); |
1560 | unblock_netpoll_tx(); | ||
1549 | } | 1561 | } |
1550 | 1562 | ||
1551 | pr_info("%s: enslaving %s as a%s interface with a%s link.\n", | 1563 | pr_info("%s: enslaving %s as a%s interface with a%s link.\n", |
@@ -1571,10 +1583,12 @@ err_detach: | |||
1571 | if (bond->primary_slave == new_slave) | 1583 | if (bond->primary_slave == new_slave) |
1572 | bond->primary_slave = NULL; | 1584 | bond->primary_slave = NULL; |
1573 | if (bond->curr_active_slave == new_slave) { | 1585 | if (bond->curr_active_slave == new_slave) { |
1586 | block_netpoll_tx(); | ||
1574 | write_lock_bh(&bond->curr_slave_lock); | 1587 | write_lock_bh(&bond->curr_slave_lock); |
1575 | bond_change_active_slave(bond, NULL); | 1588 | bond_change_active_slave(bond, NULL); |
1576 | bond_select_active_slave(bond); | 1589 | bond_select_active_slave(bond); |
1577 | write_unlock_bh(&bond->curr_slave_lock); | 1590 | write_unlock_bh(&bond->curr_slave_lock); |
1591 | unblock_netpoll_tx(); | ||
1578 | } | 1592 | } |
1579 | slave_disable_netpoll(new_slave); | 1593 | slave_disable_netpoll(new_slave); |
1580 | 1594 | ||
@@ -1650,9 +1664,6 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1650 | return -EINVAL; | 1664 | return -EINVAL; |
1651 | } | 1665 | } |
1652 | 1666 | ||
1653 | /* release the slave from its bond */ | ||
1654 | bond->slave_cnt--; | ||
1655 | |||
1656 | bond_sysfs_slave_del(slave); | 1667 | bond_sysfs_slave_del(slave); |
1657 | 1668 | ||
1658 | bond_upper_dev_unlink(bond_dev, slave_dev); | 1669 | bond_upper_dev_unlink(bond_dev, slave_dev); |
@@ -1734,6 +1745,7 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1734 | 1745 | ||
1735 | unblock_netpoll_tx(); | 1746 | unblock_netpoll_tx(); |
1736 | synchronize_rcu(); | 1747 | synchronize_rcu(); |
1748 | bond->slave_cnt--; | ||
1737 | 1749 | ||
1738 | if (!bond_has_slaves(bond)) { | 1750 | if (!bond_has_slaves(bond)) { |
1739 | call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev); | 1751 | call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev); |
@@ -2011,7 +2023,8 @@ static void bond_miimon_commit(struct bonding *bond) | |||
2011 | 2023 | ||
2012 | if (bond->params.mode == BOND_MODE_ACTIVEBACKUP || | 2024 | if (bond->params.mode == BOND_MODE_ACTIVEBACKUP || |
2013 | bond->params.mode == BOND_MODE_8023AD) | 2025 | bond->params.mode == BOND_MODE_8023AD) |
2014 | bond_set_slave_inactive_flags(slave); | 2026 | bond_set_slave_inactive_flags(slave, |
2027 | BOND_SLAVE_NOTIFY_NOW); | ||
2015 | 2028 | ||
2016 | pr_info("%s: link status definitely down for interface %s, disabling it\n", | 2029 | pr_info("%s: link status definitely down for interface %s, disabling it\n", |
2017 | bond->dev->name, slave->dev->name); | 2030 | bond->dev->name, slave->dev->name); |
@@ -2558,7 +2571,8 @@ static void bond_ab_arp_commit(struct bonding *bond) | |||
2558 | slave->link = BOND_LINK_UP; | 2571 | slave->link = BOND_LINK_UP; |
2559 | if (bond->current_arp_slave) { | 2572 | if (bond->current_arp_slave) { |
2560 | bond_set_slave_inactive_flags( | 2573 | bond_set_slave_inactive_flags( |
2561 | bond->current_arp_slave); | 2574 | bond->current_arp_slave, |
2575 | BOND_SLAVE_NOTIFY_NOW); | ||
2562 | bond->current_arp_slave = NULL; | 2576 | bond->current_arp_slave = NULL; |
2563 | } | 2577 | } |
2564 | 2578 | ||
@@ -2578,7 +2592,8 @@ static void bond_ab_arp_commit(struct bonding *bond) | |||
2578 | slave->link_failure_count++; | 2592 | slave->link_failure_count++; |
2579 | 2593 | ||
2580 | slave->link = BOND_LINK_DOWN; | 2594 | slave->link = BOND_LINK_DOWN; |
2581 | bond_set_slave_inactive_flags(slave); | 2595 | bond_set_slave_inactive_flags(slave, |
2596 | BOND_SLAVE_NOTIFY_NOW); | ||
2582 | 2597 | ||
2583 | pr_info("%s: link status definitely down for interface %s, disabling it\n", | 2598 | pr_info("%s: link status definitely down for interface %s, disabling it\n", |
2584 | bond->dev->name, slave->dev->name); | 2599 | bond->dev->name, slave->dev->name); |
@@ -2611,17 +2626,17 @@ do_failover: | |||
2611 | 2626 | ||
2612 | /* | 2627 | /* |
2613 | * Send ARP probes for active-backup mode ARP monitor. | 2628 | * Send ARP probes for active-backup mode ARP monitor. |
2629 | * | ||
2630 | * Called with rcu_read_lock hold. | ||
2614 | */ | 2631 | */ |
2615 | static bool bond_ab_arp_probe(struct bonding *bond) | 2632 | static bool bond_ab_arp_probe(struct bonding *bond) |
2616 | { | 2633 | { |
2617 | struct slave *slave, *before = NULL, *new_slave = NULL, | 2634 | struct slave *slave, *before = NULL, *new_slave = NULL, |
2618 | *curr_arp_slave, *curr_active_slave; | 2635 | *curr_arp_slave = rcu_dereference(bond->current_arp_slave), |
2636 | *curr_active_slave = rcu_dereference(bond->curr_active_slave); | ||
2619 | struct list_head *iter; | 2637 | struct list_head *iter; |
2620 | bool found = false; | 2638 | bool found = false; |
2621 | 2639 | bool should_notify_rtnl = BOND_SLAVE_NOTIFY_LATER; | |
2622 | rcu_read_lock(); | ||
2623 | curr_arp_slave = rcu_dereference(bond->current_arp_slave); | ||
2624 | curr_active_slave = rcu_dereference(bond->curr_active_slave); | ||
2625 | 2640 | ||
2626 | if (curr_arp_slave && curr_active_slave) | 2641 | if (curr_arp_slave && curr_active_slave) |
2627 | pr_info("PROBE: c_arp %s && cas %s BAD\n", | 2642 | pr_info("PROBE: c_arp %s && cas %s BAD\n", |
@@ -2630,32 +2645,23 @@ static bool bond_ab_arp_probe(struct bonding *bond) | |||
2630 | 2645 | ||
2631 | if (curr_active_slave) { | 2646 | if (curr_active_slave) { |
2632 | bond_arp_send_all(bond, curr_active_slave); | 2647 | bond_arp_send_all(bond, curr_active_slave); |
2633 | rcu_read_unlock(); | 2648 | return should_notify_rtnl; |
2634 | return true; | ||
2635 | } | 2649 | } |
2636 | rcu_read_unlock(); | ||
2637 | 2650 | ||
2638 | /* if we don't have a curr_active_slave, search for the next available | 2651 | /* if we don't have a curr_active_slave, search for the next available |
2639 | * backup slave from the current_arp_slave and make it the candidate | 2652 | * backup slave from the current_arp_slave and make it the candidate |
2640 | * for becoming the curr_active_slave | 2653 | * for becoming the curr_active_slave |
2641 | */ | 2654 | */ |
2642 | 2655 | ||
2643 | if (!rtnl_trylock()) | ||
2644 | return false; | ||
2645 | /* curr_arp_slave might have gone away */ | ||
2646 | curr_arp_slave = ACCESS_ONCE(bond->current_arp_slave); | ||
2647 | |||
2648 | if (!curr_arp_slave) { | 2656 | if (!curr_arp_slave) { |
2649 | curr_arp_slave = bond_first_slave(bond); | 2657 | curr_arp_slave = bond_first_slave_rcu(bond); |
2650 | if (!curr_arp_slave) { | 2658 | if (!curr_arp_slave) |
2651 | rtnl_unlock(); | 2659 | return should_notify_rtnl; |
2652 | return true; | ||
2653 | } | ||
2654 | } | 2660 | } |
2655 | 2661 | ||
2656 | bond_set_slave_inactive_flags(curr_arp_slave); | 2662 | bond_set_slave_inactive_flags(curr_arp_slave, BOND_SLAVE_NOTIFY_LATER); |
2657 | 2663 | ||
2658 | bond_for_each_slave(bond, slave, iter) { | 2664 | bond_for_each_slave_rcu(bond, slave, iter) { |
2659 | if (!found && !before && IS_UP(slave->dev)) | 2665 | if (!found && !before && IS_UP(slave->dev)) |
2660 | before = slave; | 2666 | before = slave; |
2661 | 2667 | ||
@@ -2673,7 +2679,8 @@ static bool bond_ab_arp_probe(struct bonding *bond) | |||
2673 | if (slave->link_failure_count < UINT_MAX) | 2679 | if (slave->link_failure_count < UINT_MAX) |
2674 | slave->link_failure_count++; | 2680 | slave->link_failure_count++; |
2675 | 2681 | ||
2676 | bond_set_slave_inactive_flags(slave); | 2682 | bond_set_slave_inactive_flags(slave, |
2683 | BOND_SLAVE_NOTIFY_LATER); | ||
2677 | 2684 | ||
2678 | pr_info("%s: backup interface %s is now down.\n", | 2685 | pr_info("%s: backup interface %s is now down.\n", |
2679 | bond->dev->name, slave->dev->name); | 2686 | bond->dev->name, slave->dev->name); |
@@ -2685,26 +2692,31 @@ static bool bond_ab_arp_probe(struct bonding *bond) | |||
2685 | if (!new_slave && before) | 2692 | if (!new_slave && before) |
2686 | new_slave = before; | 2693 | new_slave = before; |
2687 | 2694 | ||
2688 | if (!new_slave) { | 2695 | if (!new_slave) |
2689 | rtnl_unlock(); | 2696 | goto check_state; |
2690 | return true; | ||
2691 | } | ||
2692 | 2697 | ||
2693 | new_slave->link = BOND_LINK_BACK; | 2698 | new_slave->link = BOND_LINK_BACK; |
2694 | bond_set_slave_active_flags(new_slave); | 2699 | bond_set_slave_active_flags(new_slave, BOND_SLAVE_NOTIFY_LATER); |
2695 | bond_arp_send_all(bond, new_slave); | 2700 | bond_arp_send_all(bond, new_slave); |
2696 | new_slave->jiffies = jiffies; | 2701 | new_slave->jiffies = jiffies; |
2697 | rcu_assign_pointer(bond->current_arp_slave, new_slave); | 2702 | rcu_assign_pointer(bond->current_arp_slave, new_slave); |
2698 | rtnl_unlock(); | ||
2699 | 2703 | ||
2700 | return true; | 2704 | check_state: |
2705 | bond_for_each_slave_rcu(bond, slave, iter) { | ||
2706 | if (slave->should_notify) { | ||
2707 | should_notify_rtnl = BOND_SLAVE_NOTIFY_NOW; | ||
2708 | break; | ||
2709 | } | ||
2710 | } | ||
2711 | return should_notify_rtnl; | ||
2701 | } | 2712 | } |
2702 | 2713 | ||
2703 | static void bond_activebackup_arp_mon(struct work_struct *work) | 2714 | static void bond_activebackup_arp_mon(struct work_struct *work) |
2704 | { | 2715 | { |
2705 | struct bonding *bond = container_of(work, struct bonding, | 2716 | struct bonding *bond = container_of(work, struct bonding, |
2706 | arp_work.work); | 2717 | arp_work.work); |
2707 | bool should_notify_peers = false, should_commit = false; | 2718 | bool should_notify_peers = false; |
2719 | bool should_notify_rtnl = false; | ||
2708 | int delta_in_ticks; | 2720 | int delta_in_ticks; |
2709 | 2721 | ||
2710 | delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval); | 2722 | delta_in_ticks = msecs_to_jiffies(bond->params.arp_interval); |
@@ -2713,11 +2725,12 @@ static void bond_activebackup_arp_mon(struct work_struct *work) | |||
2713 | goto re_arm; | 2725 | goto re_arm; |
2714 | 2726 | ||
2715 | rcu_read_lock(); | 2727 | rcu_read_lock(); |
2728 | |||
2716 | should_notify_peers = bond_should_notify_peers(bond); | 2729 | should_notify_peers = bond_should_notify_peers(bond); |
2717 | should_commit = bond_ab_arp_inspect(bond); | ||
2718 | rcu_read_unlock(); | ||
2719 | 2730 | ||
2720 | if (should_commit) { | 2731 | if (bond_ab_arp_inspect(bond)) { |
2732 | rcu_read_unlock(); | ||
2733 | |||
2721 | /* Race avoidance with bond_close flush of workqueue */ | 2734 | /* Race avoidance with bond_close flush of workqueue */ |
2722 | if (!rtnl_trylock()) { | 2735 | if (!rtnl_trylock()) { |
2723 | delta_in_ticks = 1; | 2736 | delta_in_ticks = 1; |
@@ -2726,23 +2739,28 @@ static void bond_activebackup_arp_mon(struct work_struct *work) | |||
2726 | } | 2739 | } |
2727 | 2740 | ||
2728 | bond_ab_arp_commit(bond); | 2741 | bond_ab_arp_commit(bond); |
2742 | |||
2729 | rtnl_unlock(); | 2743 | rtnl_unlock(); |
2744 | rcu_read_lock(); | ||
2730 | } | 2745 | } |
2731 | 2746 | ||
2732 | if (!bond_ab_arp_probe(bond)) { | 2747 | should_notify_rtnl = bond_ab_arp_probe(bond); |
2733 | /* rtnl locking failed, re-arm */ | 2748 | rcu_read_unlock(); |
2734 | delta_in_ticks = 1; | ||
2735 | should_notify_peers = false; | ||
2736 | } | ||
2737 | 2749 | ||
2738 | re_arm: | 2750 | re_arm: |
2739 | if (bond->params.arp_interval) | 2751 | if (bond->params.arp_interval) |
2740 | queue_delayed_work(bond->wq, &bond->arp_work, delta_in_ticks); | 2752 | queue_delayed_work(bond->wq, &bond->arp_work, delta_in_ticks); |
2741 | 2753 | ||
2742 | if (should_notify_peers) { | 2754 | if (should_notify_peers || should_notify_rtnl) { |
2743 | if (!rtnl_trylock()) | 2755 | if (!rtnl_trylock()) |
2744 | return; | 2756 | return; |
2745 | call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev); | 2757 | |
2758 | if (should_notify_peers) | ||
2759 | call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, | ||
2760 | bond->dev); | ||
2761 | if (should_notify_rtnl) | ||
2762 | bond_slave_state_notify(bond); | ||
2763 | |||
2746 | rtnl_unlock(); | 2764 | rtnl_unlock(); |
2747 | } | 2765 | } |
2748 | } | 2766 | } |
@@ -2864,9 +2882,12 @@ static int bond_slave_netdev_event(unsigned long event, | |||
2864 | pr_info("%s: Primary slave changed to %s, reselecting active slave.\n", | 2882 | pr_info("%s: Primary slave changed to %s, reselecting active slave.\n", |
2865 | bond->dev->name, bond->primary_slave ? slave_dev->name : | 2883 | bond->dev->name, bond->primary_slave ? slave_dev->name : |
2866 | "none"); | 2884 | "none"); |
2885 | |||
2886 | block_netpoll_tx(); | ||
2867 | write_lock_bh(&bond->curr_slave_lock); | 2887 | write_lock_bh(&bond->curr_slave_lock); |
2868 | bond_select_active_slave(bond); | 2888 | bond_select_active_slave(bond); |
2869 | write_unlock_bh(&bond->curr_slave_lock); | 2889 | write_unlock_bh(&bond->curr_slave_lock); |
2890 | unblock_netpoll_tx(); | ||
2870 | break; | 2891 | break; |
2871 | case NETDEV_FEAT_CHANGE: | 2892 | case NETDEV_FEAT_CHANGE: |
2872 | bond_compute_features(bond); | 2893 | bond_compute_features(bond); |
@@ -3039,9 +3060,11 @@ static int bond_open(struct net_device *bond_dev) | |||
3039 | bond_for_each_slave(bond, slave, iter) { | 3060 | bond_for_each_slave(bond, slave, iter) { |
3040 | if ((bond->params.mode == BOND_MODE_ACTIVEBACKUP) | 3061 | if ((bond->params.mode == BOND_MODE_ACTIVEBACKUP) |
3041 | && (slave != bond->curr_active_slave)) { | 3062 | && (slave != bond->curr_active_slave)) { |
3042 | bond_set_slave_inactive_flags(slave); | 3063 | bond_set_slave_inactive_flags(slave, |
3064 | BOND_SLAVE_NOTIFY_NOW); | ||
3043 | } else { | 3065 | } else { |
3044 | bond_set_slave_active_flags(slave); | 3066 | bond_set_slave_active_flags(slave, |
3067 | BOND_SLAVE_NOTIFY_NOW); | ||
3045 | } | 3068 | } |
3046 | } | 3069 | } |
3047 | read_unlock(&bond->curr_slave_lock); | 3070 | read_unlock(&bond->curr_slave_lock); |
@@ -3700,7 +3723,7 @@ static inline int bond_slave_override(struct bonding *bond, | |||
3700 | 3723 | ||
3701 | 3724 | ||
3702 | static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb, | 3725 | static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb, |
3703 | void *accel_priv) | 3726 | void *accel_priv, select_queue_fallback_t fallback) |
3704 | { | 3727 | { |
3705 | /* | 3728 | /* |
3706 | * This helper function exists to help dev_pick_tx get the correct | 3729 | * This helper function exists to help dev_pick_tx get the correct |
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index 11cb943222d5..c37878432717 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
15 | #include <linux/if.h> | 15 | #include <linux/if.h> |
16 | #include <linux/netdevice.h> | 16 | #include <linux/netdevice.h> |
17 | #include <linux/rwlock.h> | 17 | #include <linux/spinlock.h> |
18 | #include <linux/rcupdate.h> | 18 | #include <linux/rcupdate.h> |
19 | #include <linux/ctype.h> | 19 | #include <linux/ctype.h> |
20 | #include <linux/inet.h> | 20 | #include <linux/inet.h> |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 86ccfb9f71cc..2b0fdec695f7 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -195,7 +195,8 @@ struct slave { | |||
195 | s8 new_link; | 195 | s8 new_link; |
196 | u8 backup:1, /* indicates backup slave. Value corresponds with | 196 | u8 backup:1, /* indicates backup slave. Value corresponds with |
197 | BOND_STATE_ACTIVE and BOND_STATE_BACKUP */ | 197 | BOND_STATE_ACTIVE and BOND_STATE_BACKUP */ |
198 | inactive:1; /* indicates inactive slave */ | 198 | inactive:1, /* indicates inactive slave */ |
199 | should_notify:1; /* indicateds whether the state changed */ | ||
199 | u8 duplex; | 200 | u8 duplex; |
200 | u32 original_mtu; | 201 | u32 original_mtu; |
201 | u32 link_failure_count; | 202 | u32 link_failure_count; |
@@ -303,6 +304,24 @@ static inline void bond_set_backup_slave(struct slave *slave) | |||
303 | } | 304 | } |
304 | } | 305 | } |
305 | 306 | ||
307 | static inline void bond_set_slave_state(struct slave *slave, | ||
308 | int slave_state, bool notify) | ||
309 | { | ||
310 | if (slave->backup == slave_state) | ||
311 | return; | ||
312 | |||
313 | slave->backup = slave_state; | ||
314 | if (notify) { | ||
315 | rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_KERNEL); | ||
316 | slave->should_notify = 0; | ||
317 | } else { | ||
318 | if (slave->should_notify) | ||
319 | slave->should_notify = 0; | ||
320 | else | ||
321 | slave->should_notify = 1; | ||
322 | } | ||
323 | } | ||
324 | |||
306 | static inline void bond_slave_state_change(struct bonding *bond) | 325 | static inline void bond_slave_state_change(struct bonding *bond) |
307 | { | 326 | { |
308 | struct list_head *iter; | 327 | struct list_head *iter; |
@@ -316,6 +335,19 @@ static inline void bond_slave_state_change(struct bonding *bond) | |||
316 | } | 335 | } |
317 | } | 336 | } |
318 | 337 | ||
338 | static inline void bond_slave_state_notify(struct bonding *bond) | ||
339 | { | ||
340 | struct list_head *iter; | ||
341 | struct slave *tmp; | ||
342 | |||
343 | bond_for_each_slave(bond, tmp, iter) { | ||
344 | if (tmp->should_notify) { | ||
345 | rtmsg_ifinfo(RTM_NEWLINK, tmp->dev, 0, GFP_KERNEL); | ||
346 | tmp->should_notify = 0; | ||
347 | } | ||
348 | } | ||
349 | } | ||
350 | |||
319 | static inline int bond_slave_state(struct slave *slave) | 351 | static inline int bond_slave_state(struct slave *slave) |
320 | { | 352 | { |
321 | return slave->backup; | 353 | return slave->backup; |
@@ -343,6 +375,9 @@ static inline bool bond_is_active_slave(struct slave *slave) | |||
343 | #define BOND_ARP_VALIDATE_ALL (BOND_ARP_VALIDATE_ACTIVE | \ | 375 | #define BOND_ARP_VALIDATE_ALL (BOND_ARP_VALIDATE_ACTIVE | \ |
344 | BOND_ARP_VALIDATE_BACKUP) | 376 | BOND_ARP_VALIDATE_BACKUP) |
345 | 377 | ||
378 | #define BOND_SLAVE_NOTIFY_NOW true | ||
379 | #define BOND_SLAVE_NOTIFY_LATER false | ||
380 | |||
346 | static inline int slave_do_arp_validate(struct bonding *bond, | 381 | static inline int slave_do_arp_validate(struct bonding *bond, |
347 | struct slave *slave) | 382 | struct slave *slave) |
348 | { | 383 | { |
@@ -394,17 +429,19 @@ static inline void bond_netpoll_send_skb(const struct slave *slave, | |||
394 | } | 429 | } |
395 | #endif | 430 | #endif |
396 | 431 | ||
397 | static inline void bond_set_slave_inactive_flags(struct slave *slave) | 432 | static inline void bond_set_slave_inactive_flags(struct slave *slave, |
433 | bool notify) | ||
398 | { | 434 | { |
399 | if (!bond_is_lb(slave->bond)) | 435 | if (!bond_is_lb(slave->bond)) |
400 | bond_set_backup_slave(slave); | 436 | bond_set_slave_state(slave, BOND_STATE_BACKUP, notify); |
401 | if (!slave->bond->params.all_slaves_active) | 437 | if (!slave->bond->params.all_slaves_active) |
402 | slave->inactive = 1; | 438 | slave->inactive = 1; |
403 | } | 439 | } |
404 | 440 | ||
405 | static inline void bond_set_slave_active_flags(struct slave *slave) | 441 | static inline void bond_set_slave_active_flags(struct slave *slave, |
442 | bool notify) | ||
406 | { | 443 | { |
407 | bond_set_active_slave(slave); | 444 | bond_set_slave_state(slave, BOND_STATE_ACTIVE, notify); |
408 | slave->inactive = 0; | 445 | slave->inactive = 0; |
409 | } | 446 | } |
410 | 447 | ||
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 320bef2dba42..61376abdab39 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
@@ -144,6 +144,8 @@ | |||
144 | 144 | ||
145 | #define FLEXCAN_MB_CODE_MASK (0xf0ffffff) | 145 | #define FLEXCAN_MB_CODE_MASK (0xf0ffffff) |
146 | 146 | ||
147 | #define FLEXCAN_TIMEOUT_US (50) | ||
148 | |||
147 | /* | 149 | /* |
148 | * FLEXCAN hardware feature flags | 150 | * FLEXCAN hardware feature flags |
149 | * | 151 | * |
@@ -262,6 +264,22 @@ static inline void flexcan_write(u32 val, void __iomem *addr) | |||
262 | } | 264 | } |
263 | #endif | 265 | #endif |
264 | 266 | ||
267 | static inline int flexcan_transceiver_enable(const struct flexcan_priv *priv) | ||
268 | { | ||
269 | if (!priv->reg_xceiver) | ||
270 | return 0; | ||
271 | |||
272 | return regulator_enable(priv->reg_xceiver); | ||
273 | } | ||
274 | |||
275 | static inline int flexcan_transceiver_disable(const struct flexcan_priv *priv) | ||
276 | { | ||
277 | if (!priv->reg_xceiver) | ||
278 | return 0; | ||
279 | |||
280 | return regulator_disable(priv->reg_xceiver); | ||
281 | } | ||
282 | |||
265 | static inline int flexcan_has_and_handle_berr(const struct flexcan_priv *priv, | 283 | static inline int flexcan_has_and_handle_berr(const struct flexcan_priv *priv, |
266 | u32 reg_esr) | 284 | u32 reg_esr) |
267 | { | 285 | { |
@@ -269,26 +287,95 @@ static inline int flexcan_has_and_handle_berr(const struct flexcan_priv *priv, | |||
269 | (reg_esr & FLEXCAN_ESR_ERR_BUS); | 287 | (reg_esr & FLEXCAN_ESR_ERR_BUS); |
270 | } | 288 | } |
271 | 289 | ||
272 | static inline void flexcan_chip_enable(struct flexcan_priv *priv) | 290 | static int flexcan_chip_enable(struct flexcan_priv *priv) |
273 | { | 291 | { |
274 | struct flexcan_regs __iomem *regs = priv->base; | 292 | struct flexcan_regs __iomem *regs = priv->base; |
293 | unsigned int timeout = FLEXCAN_TIMEOUT_US / 10; | ||
275 | u32 reg; | 294 | u32 reg; |
276 | 295 | ||
277 | reg = flexcan_read(®s->mcr); | 296 | reg = flexcan_read(®s->mcr); |
278 | reg &= ~FLEXCAN_MCR_MDIS; | 297 | reg &= ~FLEXCAN_MCR_MDIS; |
279 | flexcan_write(reg, ®s->mcr); | 298 | flexcan_write(reg, ®s->mcr); |
280 | 299 | ||
281 | udelay(10); | 300 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) |
301 | usleep_range(10, 20); | ||
302 | |||
303 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK) | ||
304 | return -ETIMEDOUT; | ||
305 | |||
306 | return 0; | ||
282 | } | 307 | } |
283 | 308 | ||
284 | static inline void flexcan_chip_disable(struct flexcan_priv *priv) | 309 | static int flexcan_chip_disable(struct flexcan_priv *priv) |
285 | { | 310 | { |
286 | struct flexcan_regs __iomem *regs = priv->base; | 311 | struct flexcan_regs __iomem *regs = priv->base; |
312 | unsigned int timeout = FLEXCAN_TIMEOUT_US / 10; | ||
287 | u32 reg; | 313 | u32 reg; |
288 | 314 | ||
289 | reg = flexcan_read(®s->mcr); | 315 | reg = flexcan_read(®s->mcr); |
290 | reg |= FLEXCAN_MCR_MDIS; | 316 | reg |= FLEXCAN_MCR_MDIS; |
291 | flexcan_write(reg, ®s->mcr); | 317 | flexcan_write(reg, ®s->mcr); |
318 | |||
319 | while (timeout-- && !(flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) | ||
320 | usleep_range(10, 20); | ||
321 | |||
322 | if (!(flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) | ||
323 | return -ETIMEDOUT; | ||
324 | |||
325 | return 0; | ||
326 | } | ||
327 | |||
328 | static int flexcan_chip_freeze(struct flexcan_priv *priv) | ||
329 | { | ||
330 | struct flexcan_regs __iomem *regs = priv->base; | ||
331 | unsigned int timeout = 1000 * 1000 * 10 / priv->can.bittiming.bitrate; | ||
332 | u32 reg; | ||
333 | |||
334 | reg = flexcan_read(®s->mcr); | ||
335 | reg |= FLEXCAN_MCR_HALT; | ||
336 | flexcan_write(reg, ®s->mcr); | ||
337 | |||
338 | while (timeout-- && !(flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) | ||
339 | usleep_range(100, 200); | ||
340 | |||
341 | if (!(flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) | ||
342 | return -ETIMEDOUT; | ||
343 | |||
344 | return 0; | ||
345 | } | ||
346 | |||
347 | static int flexcan_chip_unfreeze(struct flexcan_priv *priv) | ||
348 | { | ||
349 | struct flexcan_regs __iomem *regs = priv->base; | ||
350 | unsigned int timeout = FLEXCAN_TIMEOUT_US / 10; | ||
351 | u32 reg; | ||
352 | |||
353 | reg = flexcan_read(®s->mcr); | ||
354 | reg &= ~FLEXCAN_MCR_HALT; | ||
355 | flexcan_write(reg, ®s->mcr); | ||
356 | |||
357 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) | ||
358 | usleep_range(10, 20); | ||
359 | |||
360 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK) | ||
361 | return -ETIMEDOUT; | ||
362 | |||
363 | return 0; | ||
364 | } | ||
365 | |||
366 | static int flexcan_chip_softreset(struct flexcan_priv *priv) | ||
367 | { | ||
368 | struct flexcan_regs __iomem *regs = priv->base; | ||
369 | unsigned int timeout = FLEXCAN_TIMEOUT_US / 10; | ||
370 | |||
371 | flexcan_write(FLEXCAN_MCR_SOFTRST, ®s->mcr); | ||
372 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_SOFTRST)) | ||
373 | usleep_range(10, 20); | ||
374 | |||
375 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_SOFTRST) | ||
376 | return -ETIMEDOUT; | ||
377 | |||
378 | return 0; | ||
292 | } | 379 | } |
293 | 380 | ||
294 | static int flexcan_get_berr_counter(const struct net_device *dev, | 381 | static int flexcan_get_berr_counter(const struct net_device *dev, |
@@ -709,19 +796,14 @@ static int flexcan_chip_start(struct net_device *dev) | |||
709 | u32 reg_mcr, reg_ctrl; | 796 | u32 reg_mcr, reg_ctrl; |
710 | 797 | ||
711 | /* enable module */ | 798 | /* enable module */ |
712 | flexcan_chip_enable(priv); | 799 | err = flexcan_chip_enable(priv); |
800 | if (err) | ||
801 | return err; | ||
713 | 802 | ||
714 | /* soft reset */ | 803 | /* soft reset */ |
715 | flexcan_write(FLEXCAN_MCR_SOFTRST, ®s->mcr); | 804 | err = flexcan_chip_softreset(priv); |
716 | udelay(10); | 805 | if (err) |
717 | 806 | goto out_chip_disable; | |
718 | reg_mcr = flexcan_read(®s->mcr); | ||
719 | if (reg_mcr & FLEXCAN_MCR_SOFTRST) { | ||
720 | netdev_err(dev, "Failed to softreset can module (mcr=0x%08x)\n", | ||
721 | reg_mcr); | ||
722 | err = -ENODEV; | ||
723 | goto out; | ||
724 | } | ||
725 | 807 | ||
726 | flexcan_set_bittiming(dev); | 808 | flexcan_set_bittiming(dev); |
727 | 809 | ||
@@ -788,16 +870,14 @@ static int flexcan_chip_start(struct net_device *dev) | |||
788 | if (priv->devtype_data->features & FLEXCAN_HAS_V10_FEATURES) | 870 | if (priv->devtype_data->features & FLEXCAN_HAS_V10_FEATURES) |
789 | flexcan_write(0x0, ®s->rxfgmask); | 871 | flexcan_write(0x0, ®s->rxfgmask); |
790 | 872 | ||
791 | if (priv->reg_xceiver) { | 873 | err = flexcan_transceiver_enable(priv); |
792 | err = regulator_enable(priv->reg_xceiver); | 874 | if (err) |
793 | if (err) | 875 | goto out_chip_disable; |
794 | goto out; | ||
795 | } | ||
796 | 876 | ||
797 | /* synchronize with the can bus */ | 877 | /* synchronize with the can bus */ |
798 | reg_mcr = flexcan_read(®s->mcr); | 878 | err = flexcan_chip_unfreeze(priv); |
799 | reg_mcr &= ~FLEXCAN_MCR_HALT; | 879 | if (err) |
800 | flexcan_write(reg_mcr, ®s->mcr); | 880 | goto out_transceiver_disable; |
801 | 881 | ||
802 | priv->can.state = CAN_STATE_ERROR_ACTIVE; | 882 | priv->can.state = CAN_STATE_ERROR_ACTIVE; |
803 | 883 | ||
@@ -810,7 +890,9 @@ static int flexcan_chip_start(struct net_device *dev) | |||
810 | 890 | ||
811 | return 0; | 891 | return 0; |
812 | 892 | ||
813 | out: | 893 | out_transceiver_disable: |
894 | flexcan_transceiver_disable(priv); | ||
895 | out_chip_disable: | ||
814 | flexcan_chip_disable(priv); | 896 | flexcan_chip_disable(priv); |
815 | return err; | 897 | return err; |
816 | } | 898 | } |
@@ -825,18 +907,17 @@ static void flexcan_chip_stop(struct net_device *dev) | |||
825 | { | 907 | { |
826 | struct flexcan_priv *priv = netdev_priv(dev); | 908 | struct flexcan_priv *priv = netdev_priv(dev); |
827 | struct flexcan_regs __iomem *regs = priv->base; | 909 | struct flexcan_regs __iomem *regs = priv->base; |
828 | u32 reg; | 910 | |
911 | /* freeze + disable module */ | ||
912 | flexcan_chip_freeze(priv); | ||
913 | flexcan_chip_disable(priv); | ||
829 | 914 | ||
830 | /* Disable all interrupts */ | 915 | /* Disable all interrupts */ |
831 | flexcan_write(0, ®s->imask1); | 916 | flexcan_write(0, ®s->imask1); |
917 | flexcan_write(priv->reg_ctrl_default & ~FLEXCAN_CTRL_ERR_ALL, | ||
918 | ®s->ctrl); | ||
832 | 919 | ||
833 | /* Disable + halt module */ | 920 | flexcan_transceiver_disable(priv); |
834 | reg = flexcan_read(®s->mcr); | ||
835 | reg |= FLEXCAN_MCR_MDIS | FLEXCAN_MCR_HALT; | ||
836 | flexcan_write(reg, ®s->mcr); | ||
837 | |||
838 | if (priv->reg_xceiver) | ||
839 | regulator_disable(priv->reg_xceiver); | ||
840 | priv->can.state = CAN_STATE_STOPPED; | 921 | priv->can.state = CAN_STATE_STOPPED; |
841 | 922 | ||
842 | return; | 923 | return; |
@@ -866,7 +947,7 @@ static int flexcan_open(struct net_device *dev) | |||
866 | /* start chip and queuing */ | 947 | /* start chip and queuing */ |
867 | err = flexcan_chip_start(dev); | 948 | err = flexcan_chip_start(dev); |
868 | if (err) | 949 | if (err) |
869 | goto out_close; | 950 | goto out_free_irq; |
870 | 951 | ||
871 | can_led_event(dev, CAN_LED_EVENT_OPEN); | 952 | can_led_event(dev, CAN_LED_EVENT_OPEN); |
872 | 953 | ||
@@ -875,6 +956,8 @@ static int flexcan_open(struct net_device *dev) | |||
875 | 956 | ||
876 | return 0; | 957 | return 0; |
877 | 958 | ||
959 | out_free_irq: | ||
960 | free_irq(dev->irq, dev); | ||
878 | out_close: | 961 | out_close: |
879 | close_candev(dev); | 962 | close_candev(dev); |
880 | out_disable_per: | 963 | out_disable_per: |
@@ -945,12 +1028,16 @@ static int register_flexcandev(struct net_device *dev) | |||
945 | goto out_disable_ipg; | 1028 | goto out_disable_ipg; |
946 | 1029 | ||
947 | /* select "bus clock", chip must be disabled */ | 1030 | /* select "bus clock", chip must be disabled */ |
948 | flexcan_chip_disable(priv); | 1031 | err = flexcan_chip_disable(priv); |
1032 | if (err) | ||
1033 | goto out_disable_per; | ||
949 | reg = flexcan_read(®s->ctrl); | 1034 | reg = flexcan_read(®s->ctrl); |
950 | reg |= FLEXCAN_CTRL_CLK_SRC; | 1035 | reg |= FLEXCAN_CTRL_CLK_SRC; |
951 | flexcan_write(reg, ®s->ctrl); | 1036 | flexcan_write(reg, ®s->ctrl); |
952 | 1037 | ||
953 | flexcan_chip_enable(priv); | 1038 | err = flexcan_chip_enable(priv); |
1039 | if (err) | ||
1040 | goto out_chip_disable; | ||
954 | 1041 | ||
955 | /* set freeze, halt and activate FIFO, restrict register access */ | 1042 | /* set freeze, halt and activate FIFO, restrict register access */ |
956 | reg = flexcan_read(®s->mcr); | 1043 | reg = flexcan_read(®s->mcr); |
@@ -967,14 +1054,15 @@ static int register_flexcandev(struct net_device *dev) | |||
967 | if (!(reg & FLEXCAN_MCR_FEN)) { | 1054 | if (!(reg & FLEXCAN_MCR_FEN)) { |
968 | netdev_err(dev, "Could not enable RX FIFO, unsupported core\n"); | 1055 | netdev_err(dev, "Could not enable RX FIFO, unsupported core\n"); |
969 | err = -ENODEV; | 1056 | err = -ENODEV; |
970 | goto out_disable_per; | 1057 | goto out_chip_disable; |
971 | } | 1058 | } |
972 | 1059 | ||
973 | err = register_candev(dev); | 1060 | err = register_candev(dev); |
974 | 1061 | ||
975 | out_disable_per: | ||
976 | /* disable core and turn off clocks */ | 1062 | /* disable core and turn off clocks */ |
1063 | out_chip_disable: | ||
977 | flexcan_chip_disable(priv); | 1064 | flexcan_chip_disable(priv); |
1065 | out_disable_per: | ||
978 | clk_disable_unprepare(priv->clk_per); | 1066 | clk_disable_unprepare(priv->clk_per); |
979 | out_disable_ipg: | 1067 | out_disable_ipg: |
980 | clk_disable_unprepare(priv->clk_ipg); | 1068 | clk_disable_unprepare(priv->clk_ipg); |
@@ -1104,9 +1192,10 @@ static int flexcan_probe(struct platform_device *pdev) | |||
1104 | static int flexcan_remove(struct platform_device *pdev) | 1192 | static int flexcan_remove(struct platform_device *pdev) |
1105 | { | 1193 | { |
1106 | struct net_device *dev = platform_get_drvdata(pdev); | 1194 | struct net_device *dev = platform_get_drvdata(pdev); |
1195 | struct flexcan_priv *priv = netdev_priv(dev); | ||
1107 | 1196 | ||
1108 | unregister_flexcandev(dev); | 1197 | unregister_flexcandev(dev); |
1109 | 1198 | netif_napi_del(&priv->napi); | |
1110 | free_candev(dev); | 1199 | free_candev(dev); |
1111 | 1200 | ||
1112 | return 0; | 1201 | return 0; |
@@ -1117,8 +1206,11 @@ static int flexcan_suspend(struct device *device) | |||
1117 | { | 1206 | { |
1118 | struct net_device *dev = dev_get_drvdata(device); | 1207 | struct net_device *dev = dev_get_drvdata(device); |
1119 | struct flexcan_priv *priv = netdev_priv(dev); | 1208 | struct flexcan_priv *priv = netdev_priv(dev); |
1209 | int err; | ||
1120 | 1210 | ||
1121 | flexcan_chip_disable(priv); | 1211 | err = flexcan_chip_disable(priv); |
1212 | if (err) | ||
1213 | return err; | ||
1122 | 1214 | ||
1123 | if (netif_running(dev)) { | 1215 | if (netif_running(dev)) { |
1124 | netif_stop_queue(dev); | 1216 | netif_stop_queue(dev); |
@@ -1139,9 +1231,7 @@ static int flexcan_resume(struct device *device) | |||
1139 | netif_device_attach(dev); | 1231 | netif_device_attach(dev); |
1140 | netif_start_queue(dev); | 1232 | netif_start_queue(dev); |
1141 | } | 1233 | } |
1142 | flexcan_chip_enable(priv); | 1234 | return flexcan_chip_enable(priv); |
1143 | |||
1144 | return 0; | ||
1145 | } | 1235 | } |
1146 | #endif /* CONFIG_PM_SLEEP */ | 1236 | #endif /* CONFIG_PM_SLEEP */ |
1147 | 1237 | ||
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c index 6c859bba8b65..e77d11049747 100644 --- a/drivers/net/can/usb/kvaser_usb.c +++ b/drivers/net/can/usb/kvaser_usb.c | |||
@@ -473,6 +473,8 @@ static int kvaser_usb_get_card_info(struct kvaser_usb *dev) | |||
473 | return err; | 473 | return err; |
474 | 474 | ||
475 | dev->nchannels = msg.u.cardinfo.nchannels; | 475 | dev->nchannels = msg.u.cardinfo.nchannels; |
476 | if (dev->nchannels > MAX_NET_DEVICES) | ||
477 | return -EINVAL; | ||
476 | 478 | ||
477 | return 0; | 479 | return 0; |
478 | } | 480 | } |
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c index 1f7b5aa114fa..8a7bf7dad898 100644 --- a/drivers/net/ethernet/broadcom/b44.c +++ b/drivers/net/ethernet/broadcom/b44.c | |||
@@ -1484,6 +1484,10 @@ static int b44_open(struct net_device *dev) | |||
1484 | add_timer(&bp->timer); | 1484 | add_timer(&bp->timer); |
1485 | 1485 | ||
1486 | b44_enable_ints(bp); | 1486 | b44_enable_ints(bp); |
1487 | |||
1488 | if (bp->flags & B44_FLAG_EXTERNAL_PHY) | ||
1489 | phy_start(bp->phydev); | ||
1490 | |||
1487 | netif_start_queue(dev); | 1491 | netif_start_queue(dev); |
1488 | out: | 1492 | out: |
1489 | return err; | 1493 | return err; |
@@ -1646,6 +1650,9 @@ static int b44_close(struct net_device *dev) | |||
1646 | 1650 | ||
1647 | netif_stop_queue(dev); | 1651 | netif_stop_queue(dev); |
1648 | 1652 | ||
1653 | if (bp->flags & B44_FLAG_EXTERNAL_PHY) | ||
1654 | phy_stop(bp->phydev); | ||
1655 | |||
1649 | napi_disable(&bp->napi); | 1656 | napi_disable(&bp->napi); |
1650 | 1657 | ||
1651 | del_timer_sync(&bp->timer); | 1658 | del_timer_sync(&bp->timer); |
@@ -2222,7 +2229,12 @@ static void b44_adjust_link(struct net_device *dev) | |||
2222 | } | 2229 | } |
2223 | 2230 | ||
2224 | if (status_changed) { | 2231 | if (status_changed) { |
2225 | b44_check_phy(bp); | 2232 | u32 val = br32(bp, B44_TX_CTRL); |
2233 | if (bp->flags & B44_FLAG_FULL_DUPLEX) | ||
2234 | val |= TX_CTRL_DUPLEX; | ||
2235 | else | ||
2236 | val &= ~TX_CTRL_DUPLEX; | ||
2237 | bw32(bp, B44_TX_CTRL, val); | ||
2226 | phy_print_status(phydev); | 2238 | phy_print_status(phydev); |
2227 | } | 2239 | } |
2228 | } | 2240 | } |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index 9d7419e0390b..dbcff509dc3f 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -1873,7 +1873,7 @@ void bnx2x_netif_stop(struct bnx2x *bp, int disable_hw) | |||
1873 | } | 1873 | } |
1874 | 1874 | ||
1875 | u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb, | 1875 | u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb, |
1876 | void *accel_priv) | 1876 | void *accel_priv, select_queue_fallback_t fallback) |
1877 | { | 1877 | { |
1878 | struct bnx2x *bp = netdev_priv(dev); | 1878 | struct bnx2x *bp = netdev_priv(dev); |
1879 | 1879 | ||
@@ -1895,7 +1895,7 @@ u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb, | |||
1895 | } | 1895 | } |
1896 | 1896 | ||
1897 | /* select a non-FCoE queue */ | 1897 | /* select a non-FCoE queue */ |
1898 | return __netdev_pick_tx(dev, skb) % BNX2X_NUM_ETH_QUEUES(bp); | 1898 | return fallback(dev, skb) % BNX2X_NUM_ETH_QUEUES(bp); |
1899 | } | 1899 | } |
1900 | 1900 | ||
1901 | void bnx2x_set_num_queues(struct bnx2x *bp) | 1901 | void bnx2x_set_num_queues(struct bnx2x *bp) |
@@ -3875,7 +3875,9 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3875 | xmit_type); | 3875 | xmit_type); |
3876 | } | 3876 | } |
3877 | 3877 | ||
3878 | /* Add the macs to the parsing BD this is a vf */ | 3878 | /* Add the macs to the parsing BD if this is a vf or if |
3879 | * Tx Switching is enabled. | ||
3880 | */ | ||
3879 | if (IS_VF(bp)) { | 3881 | if (IS_VF(bp)) { |
3880 | /* override GRE parameters in BD */ | 3882 | /* override GRE parameters in BD */ |
3881 | bnx2x_set_fw_mac_addr(&pbd_e2->data.mac_addr.src_hi, | 3883 | bnx2x_set_fw_mac_addr(&pbd_e2->data.mac_addr.src_hi, |
@@ -3887,6 +3889,11 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3887 | &pbd_e2->data.mac_addr.dst_mid, | 3889 | &pbd_e2->data.mac_addr.dst_mid, |
3888 | &pbd_e2->data.mac_addr.dst_lo, | 3890 | &pbd_e2->data.mac_addr.dst_lo, |
3889 | eth->h_dest); | 3891 | eth->h_dest); |
3892 | } else if (bp->flags & TX_SWITCHING) { | ||
3893 | bnx2x_set_fw_mac_addr(&pbd_e2->data.mac_addr.dst_hi, | ||
3894 | &pbd_e2->data.mac_addr.dst_mid, | ||
3895 | &pbd_e2->data.mac_addr.dst_lo, | ||
3896 | eth->h_dest); | ||
3890 | } | 3897 | } |
3891 | 3898 | ||
3892 | SET_FLAG(pbd_e2_parsing_data, | 3899 | SET_FLAG(pbd_e2_parsing_data, |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h index bfc58d488bb5..a89a40f88c25 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | |||
@@ -496,7 +496,7 @@ int bnx2x_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos); | |||
496 | 496 | ||
497 | /* select_queue callback */ | 497 | /* select_queue callback */ |
498 | u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb, | 498 | u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb, |
499 | void *accel_priv); | 499 | void *accel_priv, select_queue_fallback_t fallback); |
500 | 500 | ||
501 | static inline void bnx2x_update_rx_prod(struct bnx2x *bp, | 501 | static inline void bnx2x_update_rx_prod(struct bnx2x *bp, |
502 | struct bnx2x_fastpath *fp, | 502 | struct bnx2x_fastpath *fp, |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 3167ed6593b0..3b6d0ba86c71 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -6843,8 +6843,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) | |||
6843 | 6843 | ||
6844 | work_mask |= opaque_key; | 6844 | work_mask |= opaque_key; |
6845 | 6845 | ||
6846 | if ((desc->err_vlan & RXD_ERR_MASK) != 0 && | 6846 | if (desc->err_vlan & RXD_ERR_MASK) { |
6847 | (desc->err_vlan != RXD_ERR_ODD_NIBBLE_RCVD_MII)) { | ||
6848 | drop_it: | 6847 | drop_it: |
6849 | tg3_recycle_rx(tnapi, tpr, opaque_key, | 6848 | tg3_recycle_rx(tnapi, tpr, opaque_key, |
6850 | desc_idx, *post_ptr); | 6849 | desc_idx, *post_ptr); |
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h index ef472385bce4..04321e5a356e 100644 --- a/drivers/net/ethernet/broadcom/tg3.h +++ b/drivers/net/ethernet/broadcom/tg3.h | |||
@@ -2608,7 +2608,11 @@ struct tg3_rx_buffer_desc { | |||
2608 | #define RXD_ERR_TOO_SMALL 0x00400000 | 2608 | #define RXD_ERR_TOO_SMALL 0x00400000 |
2609 | #define RXD_ERR_NO_RESOURCES 0x00800000 | 2609 | #define RXD_ERR_NO_RESOURCES 0x00800000 |
2610 | #define RXD_ERR_HUGE_FRAME 0x01000000 | 2610 | #define RXD_ERR_HUGE_FRAME 0x01000000 |
2611 | #define RXD_ERR_MASK 0xffff0000 | 2611 | |
2612 | #define RXD_ERR_MASK (RXD_ERR_BAD_CRC | RXD_ERR_COLLISION | \ | ||
2613 | RXD_ERR_LINK_LOST | RXD_ERR_PHY_DECODE | \ | ||
2614 | RXD_ERR_MAC_ABRT | RXD_ERR_TOO_SMALL | \ | ||
2615 | RXD_ERR_NO_RESOURCES | RXD_ERR_HUGE_FRAME) | ||
2612 | 2616 | ||
2613 | u32 reserved; | 2617 | u32 reserved; |
2614 | u32 opaque; | 2618 | u32 opaque; |
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index cf64f3d0b60d..4ad1187e82fb 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c | |||
@@ -707,7 +707,8 @@ bnad_cq_process(struct bnad *bnad, struct bna_ccb *ccb, int budget) | |||
707 | else | 707 | else |
708 | skb_checksum_none_assert(skb); | 708 | skb_checksum_none_assert(skb); |
709 | 709 | ||
710 | if (flags & BNA_CQ_EF_VLAN) | 710 | if ((flags & BNA_CQ_EF_VLAN) && |
711 | (bnad->netdev->features & NETIF_F_HW_VLAN_CTAG_RX)) | ||
711 | __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(cmpl->vlan_tag)); | 712 | __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), ntohs(cmpl->vlan_tag)); |
712 | 713 | ||
713 | if (BNAD_RXBUF_IS_SK_BUFF(unmap_q->type)) | 714 | if (BNAD_RXBUF_IS_SK_BUFF(unmap_q->type)) |
@@ -2094,7 +2095,9 @@ bnad_init_rx_config(struct bnad *bnad, struct bna_rx_config *rx_config) | |||
2094 | rx_config->q1_buf_size = BFI_SMALL_RXBUF_SIZE; | 2095 | rx_config->q1_buf_size = BFI_SMALL_RXBUF_SIZE; |
2095 | } | 2096 | } |
2096 | 2097 | ||
2097 | rx_config->vlan_strip_status = BNA_STATUS_T_ENABLED; | 2098 | rx_config->vlan_strip_status = |
2099 | (bnad->netdev->features & NETIF_F_HW_VLAN_CTAG_RX) ? | ||
2100 | BNA_STATUS_T_ENABLED : BNA_STATUS_T_DISABLED; | ||
2098 | } | 2101 | } |
2099 | 2102 | ||
2100 | static void | 2103 | static void |
@@ -3245,11 +3248,6 @@ bnad_set_rx_mode(struct net_device *netdev) | |||
3245 | BNA_RXMODE_ALLMULTI; | 3248 | BNA_RXMODE_ALLMULTI; |
3246 | bna_rx_mode_set(bnad->rx_info[0].rx, new_mode, mode_mask, NULL); | 3249 | bna_rx_mode_set(bnad->rx_info[0].rx, new_mode, mode_mask, NULL); |
3247 | 3250 | ||
3248 | if (bnad->cfg_flags & BNAD_CF_PROMISC) | ||
3249 | bna_rx_vlan_strip_disable(bnad->rx_info[0].rx); | ||
3250 | else | ||
3251 | bna_rx_vlan_strip_enable(bnad->rx_info[0].rx); | ||
3252 | |||
3253 | spin_unlock_irqrestore(&bnad->bna_lock, flags); | 3251 | spin_unlock_irqrestore(&bnad->bna_lock, flags); |
3254 | } | 3252 | } |
3255 | 3253 | ||
@@ -3374,6 +3372,27 @@ bnad_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid) | |||
3374 | return 0; | 3372 | return 0; |
3375 | } | 3373 | } |
3376 | 3374 | ||
3375 | static int bnad_set_features(struct net_device *dev, netdev_features_t features) | ||
3376 | { | ||
3377 | struct bnad *bnad = netdev_priv(dev); | ||
3378 | netdev_features_t changed = features ^ dev->features; | ||
3379 | |||
3380 | if ((changed & NETIF_F_HW_VLAN_CTAG_RX) && netif_running(dev)) { | ||
3381 | unsigned long flags; | ||
3382 | |||
3383 | spin_lock_irqsave(&bnad->bna_lock, flags); | ||
3384 | |||
3385 | if (features & NETIF_F_HW_VLAN_CTAG_RX) | ||
3386 | bna_rx_vlan_strip_enable(bnad->rx_info[0].rx); | ||
3387 | else | ||
3388 | bna_rx_vlan_strip_disable(bnad->rx_info[0].rx); | ||
3389 | |||
3390 | spin_unlock_irqrestore(&bnad->bna_lock, flags); | ||
3391 | } | ||
3392 | |||
3393 | return 0; | ||
3394 | } | ||
3395 | |||
3377 | #ifdef CONFIG_NET_POLL_CONTROLLER | 3396 | #ifdef CONFIG_NET_POLL_CONTROLLER |
3378 | static void | 3397 | static void |
3379 | bnad_netpoll(struct net_device *netdev) | 3398 | bnad_netpoll(struct net_device *netdev) |
@@ -3421,6 +3440,7 @@ static const struct net_device_ops bnad_netdev_ops = { | |||
3421 | .ndo_change_mtu = bnad_change_mtu, | 3440 | .ndo_change_mtu = bnad_change_mtu, |
3422 | .ndo_vlan_rx_add_vid = bnad_vlan_rx_add_vid, | 3441 | .ndo_vlan_rx_add_vid = bnad_vlan_rx_add_vid, |
3423 | .ndo_vlan_rx_kill_vid = bnad_vlan_rx_kill_vid, | 3442 | .ndo_vlan_rx_kill_vid = bnad_vlan_rx_kill_vid, |
3443 | .ndo_set_features = bnad_set_features, | ||
3424 | #ifdef CONFIG_NET_POLL_CONTROLLER | 3444 | #ifdef CONFIG_NET_POLL_CONTROLLER |
3425 | .ndo_poll_controller = bnad_netpoll | 3445 | .ndo_poll_controller = bnad_netpoll |
3426 | #endif | 3446 | #endif |
@@ -3433,14 +3453,14 @@ bnad_netdev_init(struct bnad *bnad, bool using_dac) | |||
3433 | 3453 | ||
3434 | netdev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM | | 3454 | netdev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM | |
3435 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | 3455 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
3436 | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_TX; | 3456 | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_TX | |
3457 | NETIF_F_HW_VLAN_CTAG_RX; | ||
3437 | 3458 | ||
3438 | netdev->vlan_features = NETIF_F_SG | NETIF_F_HIGHDMA | | 3459 | netdev->vlan_features = NETIF_F_SG | NETIF_F_HIGHDMA | |
3439 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | 3460 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
3440 | NETIF_F_TSO | NETIF_F_TSO6; | 3461 | NETIF_F_TSO | NETIF_F_TSO6; |
3441 | 3462 | ||
3442 | netdev->features |= netdev->hw_features | | 3463 | netdev->features |= netdev->hw_features | NETIF_F_HW_VLAN_CTAG_FILTER; |
3443 | NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER; | ||
3444 | 3464 | ||
3445 | if (using_dac) | 3465 | if (using_dac) |
3446 | netdev->features |= NETIF_F_HIGHDMA; | 3466 | netdev->features |= NETIF_F_HIGHDMA; |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 43ab35fea48d..34e2488767d9 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -6179,6 +6179,7 @@ static struct pci_driver cxgb4_driver = { | |||
6179 | .id_table = cxgb4_pci_tbl, | 6179 | .id_table = cxgb4_pci_tbl, |
6180 | .probe = init_one, | 6180 | .probe = init_one, |
6181 | .remove = remove_one, | 6181 | .remove = remove_one, |
6182 | .shutdown = remove_one, | ||
6182 | .err_handler = &cxgb4_eeh, | 6183 | .err_handler = &cxgb4_eeh, |
6183 | }; | 6184 | }; |
6184 | 6185 | ||
diff --git a/drivers/net/ethernet/dec/tulip/tulip_core.c b/drivers/net/ethernet/dec/tulip/tulip_core.c index add05f14b38b..1642de78aac8 100644 --- a/drivers/net/ethernet/dec/tulip/tulip_core.c +++ b/drivers/net/ethernet/dec/tulip/tulip_core.c | |||
@@ -1939,6 +1939,7 @@ static void tulip_remove_one(struct pci_dev *pdev) | |||
1939 | pci_iounmap(pdev, tp->base_addr); | 1939 | pci_iounmap(pdev, tp->base_addr); |
1940 | free_netdev (dev); | 1940 | free_netdev (dev); |
1941 | pci_release_regions (pdev); | 1941 | pci_release_regions (pdev); |
1942 | pci_disable_device(pdev); | ||
1942 | 1943 | ||
1943 | /* pci_power_off (pdev, -1); */ | 1944 | /* pci_power_off (pdev, -1); */ |
1944 | } | 1945 | } |
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index 8d09615da585..05529e273050 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h | |||
@@ -350,11 +350,13 @@ struct be_drv_stats { | |||
350 | u32 roce_drops_crc; | 350 | u32 roce_drops_crc; |
351 | }; | 351 | }; |
352 | 352 | ||
353 | /* A vlan-id of 0xFFFF must be used to clear transparent vlan-tagging */ | ||
354 | #define BE_RESET_VLAN_TAG_ID 0xFFFF | ||
355 | |||
353 | struct be_vf_cfg { | 356 | struct be_vf_cfg { |
354 | unsigned char mac_addr[ETH_ALEN]; | 357 | unsigned char mac_addr[ETH_ALEN]; |
355 | int if_handle; | 358 | int if_handle; |
356 | int pmac_id; | 359 | int pmac_id; |
357 | u16 def_vid; | ||
358 | u16 vlan_tag; | 360 | u16 vlan_tag; |
359 | u32 tx_rate; | 361 | u32 tx_rate; |
360 | }; | 362 | }; |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 04ac9c6a0d39..36c80612e21a 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -913,24 +913,14 @@ static int be_ipv6_tx_stall_chk(struct be_adapter *adapter, | |||
913 | return BE3_chip(adapter) && be_ipv6_exthdr_check(skb); | 913 | return BE3_chip(adapter) && be_ipv6_exthdr_check(skb); |
914 | } | 914 | } |
915 | 915 | ||
916 | static struct sk_buff *be_xmit_workarounds(struct be_adapter *adapter, | 916 | static struct sk_buff *be_lancer_xmit_workarounds(struct be_adapter *adapter, |
917 | struct sk_buff *skb, | 917 | struct sk_buff *skb, |
918 | bool *skip_hw_vlan) | 918 | bool *skip_hw_vlan) |
919 | { | 919 | { |
920 | struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; | 920 | struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; |
921 | unsigned int eth_hdr_len; | 921 | unsigned int eth_hdr_len; |
922 | struct iphdr *ip; | 922 | struct iphdr *ip; |
923 | 923 | ||
924 | /* Lancer, SH-R ASICs have a bug wherein Packets that are 32 bytes or less | ||
925 | * may cause a transmit stall on that port. So the work-around is to | ||
926 | * pad short packets (<= 32 bytes) to a 36-byte length. | ||
927 | */ | ||
928 | if (unlikely(!BEx_chip(adapter) && skb->len <= 32)) { | ||
929 | if (skb_padto(skb, 36)) | ||
930 | goto tx_drop; | ||
931 | skb->len = 36; | ||
932 | } | ||
933 | |||
934 | /* For padded packets, BE HW modifies tot_len field in IP header | 924 | /* For padded packets, BE HW modifies tot_len field in IP header |
935 | * incorrecly when VLAN tag is inserted by HW. | 925 | * incorrecly when VLAN tag is inserted by HW. |
936 | * For padded packets, Lancer computes incorrect checksum. | 926 | * For padded packets, Lancer computes incorrect checksum. |
@@ -959,7 +949,7 @@ static struct sk_buff *be_xmit_workarounds(struct be_adapter *adapter, | |||
959 | vlan_tx_tag_present(skb)) { | 949 | vlan_tx_tag_present(skb)) { |
960 | skb = be_insert_vlan_in_pkt(adapter, skb, skip_hw_vlan); | 950 | skb = be_insert_vlan_in_pkt(adapter, skb, skip_hw_vlan); |
961 | if (unlikely(!skb)) | 951 | if (unlikely(!skb)) |
962 | goto tx_drop; | 952 | goto err; |
963 | } | 953 | } |
964 | 954 | ||
965 | /* HW may lockup when VLAN HW tagging is requested on | 955 | /* HW may lockup when VLAN HW tagging is requested on |
@@ -981,15 +971,39 @@ static struct sk_buff *be_xmit_workarounds(struct be_adapter *adapter, | |||
981 | be_vlan_tag_tx_chk(adapter, skb)) { | 971 | be_vlan_tag_tx_chk(adapter, skb)) { |
982 | skb = be_insert_vlan_in_pkt(adapter, skb, skip_hw_vlan); | 972 | skb = be_insert_vlan_in_pkt(adapter, skb, skip_hw_vlan); |
983 | if (unlikely(!skb)) | 973 | if (unlikely(!skb)) |
984 | goto tx_drop; | 974 | goto err; |
985 | } | 975 | } |
986 | 976 | ||
987 | return skb; | 977 | return skb; |
988 | tx_drop: | 978 | tx_drop: |
989 | dev_kfree_skb_any(skb); | 979 | dev_kfree_skb_any(skb); |
980 | err: | ||
990 | return NULL; | 981 | return NULL; |
991 | } | 982 | } |
992 | 983 | ||
984 | static struct sk_buff *be_xmit_workarounds(struct be_adapter *adapter, | ||
985 | struct sk_buff *skb, | ||
986 | bool *skip_hw_vlan) | ||
987 | { | ||
988 | /* Lancer, SH-R ASICs have a bug wherein Packets that are 32 bytes or | ||
989 | * less may cause a transmit stall on that port. So the work-around is | ||
990 | * to pad short packets (<= 32 bytes) to a 36-byte length. | ||
991 | */ | ||
992 | if (unlikely(!BEx_chip(adapter) && skb->len <= 32)) { | ||
993 | if (skb_padto(skb, 36)) | ||
994 | return NULL; | ||
995 | skb->len = 36; | ||
996 | } | ||
997 | |||
998 | if (BEx_chip(adapter) || lancer_chip(adapter)) { | ||
999 | skb = be_lancer_xmit_workarounds(adapter, skb, skip_hw_vlan); | ||
1000 | if (!skb) | ||
1001 | return NULL; | ||
1002 | } | ||
1003 | |||
1004 | return skb; | ||
1005 | } | ||
1006 | |||
993 | static netdev_tx_t be_xmit(struct sk_buff *skb, struct net_device *netdev) | 1007 | static netdev_tx_t be_xmit(struct sk_buff *skb, struct net_device *netdev) |
994 | { | 1008 | { |
995 | struct be_adapter *adapter = netdev_priv(netdev); | 1009 | struct be_adapter *adapter = netdev_priv(netdev); |
@@ -1157,6 +1171,14 @@ ret: | |||
1157 | return status; | 1171 | return status; |
1158 | } | 1172 | } |
1159 | 1173 | ||
1174 | static void be_clear_promisc(struct be_adapter *adapter) | ||
1175 | { | ||
1176 | adapter->promiscuous = false; | ||
1177 | adapter->flags &= ~BE_FLAGS_VLAN_PROMISC; | ||
1178 | |||
1179 | be_cmd_rx_filter(adapter, IFF_PROMISC, OFF); | ||
1180 | } | ||
1181 | |||
1160 | static void be_set_rx_mode(struct net_device *netdev) | 1182 | static void be_set_rx_mode(struct net_device *netdev) |
1161 | { | 1183 | { |
1162 | struct be_adapter *adapter = netdev_priv(netdev); | 1184 | struct be_adapter *adapter = netdev_priv(netdev); |
@@ -1170,9 +1192,7 @@ static void be_set_rx_mode(struct net_device *netdev) | |||
1170 | 1192 | ||
1171 | /* BE was previously in promiscuous mode; disable it */ | 1193 | /* BE was previously in promiscuous mode; disable it */ |
1172 | if (adapter->promiscuous) { | 1194 | if (adapter->promiscuous) { |
1173 | adapter->promiscuous = false; | 1195 | be_clear_promisc(adapter); |
1174 | be_cmd_rx_filter(adapter, IFF_PROMISC, OFF); | ||
1175 | |||
1176 | if (adapter->vlans_added) | 1196 | if (adapter->vlans_added) |
1177 | be_vid_config(adapter); | 1197 | be_vid_config(adapter); |
1178 | } | 1198 | } |
@@ -1287,24 +1307,20 @@ static int be_set_vf_vlan(struct net_device *netdev, | |||
1287 | 1307 | ||
1288 | if (vlan || qos) { | 1308 | if (vlan || qos) { |
1289 | vlan |= qos << VLAN_PRIO_SHIFT; | 1309 | vlan |= qos << VLAN_PRIO_SHIFT; |
1290 | if (vf_cfg->vlan_tag != vlan) { | 1310 | if (vf_cfg->vlan_tag != vlan) |
1291 | /* If this is new value, program it. Else skip. */ | ||
1292 | vf_cfg->vlan_tag = vlan; | ||
1293 | status = be_cmd_set_hsw_config(adapter, vlan, vf + 1, | 1311 | status = be_cmd_set_hsw_config(adapter, vlan, vf + 1, |
1294 | vf_cfg->if_handle, 0); | 1312 | vf_cfg->if_handle, 0); |
1295 | } | ||
1296 | } else { | 1313 | } else { |
1297 | /* Reset Transparent Vlan Tagging. */ | 1314 | /* Reset Transparent Vlan Tagging. */ |
1298 | vf_cfg->vlan_tag = 0; | 1315 | status = be_cmd_set_hsw_config(adapter, BE_RESET_VLAN_TAG_ID, |
1299 | vlan = vf_cfg->def_vid; | 1316 | vf + 1, vf_cfg->if_handle, 0); |
1300 | status = be_cmd_set_hsw_config(adapter, vlan, vf + 1, | ||
1301 | vf_cfg->if_handle, 0); | ||
1302 | } | 1317 | } |
1303 | 1318 | ||
1304 | 1319 | if (!status) | |
1305 | if (status) | 1320 | vf_cfg->vlan_tag = vlan; |
1321 | else | ||
1306 | dev_info(&adapter->pdev->dev, | 1322 | dev_info(&adapter->pdev->dev, |
1307 | "VLAN %d config on VF %d failed\n", vlan, vf); | 1323 | "VLAN %d config on VF %d failed\n", vlan, vf); |
1308 | return status; | 1324 | return status; |
1309 | } | 1325 | } |
1310 | 1326 | ||
@@ -3013,11 +3029,11 @@ static int be_vf_setup_init(struct be_adapter *adapter) | |||
3013 | 3029 | ||
3014 | static int be_vf_setup(struct be_adapter *adapter) | 3030 | static int be_vf_setup(struct be_adapter *adapter) |
3015 | { | 3031 | { |
3032 | struct device *dev = &adapter->pdev->dev; | ||
3016 | struct be_vf_cfg *vf_cfg; | 3033 | struct be_vf_cfg *vf_cfg; |
3017 | u16 def_vlan, lnk_speed; | ||
3018 | int status, old_vfs, vf; | 3034 | int status, old_vfs, vf; |
3019 | struct device *dev = &adapter->pdev->dev; | ||
3020 | u32 privileges; | 3035 | u32 privileges; |
3036 | u16 lnk_speed; | ||
3021 | 3037 | ||
3022 | old_vfs = pci_num_vf(adapter->pdev); | 3038 | old_vfs = pci_num_vf(adapter->pdev); |
3023 | if (old_vfs) { | 3039 | if (old_vfs) { |
@@ -3084,12 +3100,6 @@ static int be_vf_setup(struct be_adapter *adapter) | |||
3084 | if (!status) | 3100 | if (!status) |
3085 | vf_cfg->tx_rate = lnk_speed; | 3101 | vf_cfg->tx_rate = lnk_speed; |
3086 | 3102 | ||
3087 | status = be_cmd_get_hsw_config(adapter, &def_vlan, | ||
3088 | vf + 1, vf_cfg->if_handle, NULL); | ||
3089 | if (status) | ||
3090 | goto err; | ||
3091 | vf_cfg->def_vid = def_vlan; | ||
3092 | |||
3093 | if (!old_vfs) | 3103 | if (!old_vfs) |
3094 | be_cmd_enable_vf(adapter, vf + 1); | 3104 | be_cmd_enable_vf(adapter, vf + 1); |
3095 | } | 3105 | } |
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index d4782b42401b..479a7cba45c0 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
@@ -389,12 +389,6 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
389 | netdev_err(ndev, "Tx DMA memory map failed\n"); | 389 | netdev_err(ndev, "Tx DMA memory map failed\n"); |
390 | return NETDEV_TX_OK; | 390 | return NETDEV_TX_OK; |
391 | } | 391 | } |
392 | /* Send it on its way. Tell FEC it's ready, interrupt when done, | ||
393 | * it's the last BD of the frame, and to put the CRC on the end. | ||
394 | */ | ||
395 | status |= (BD_ENET_TX_READY | BD_ENET_TX_INTR | ||
396 | | BD_ENET_TX_LAST | BD_ENET_TX_TC); | ||
397 | bdp->cbd_sc = status; | ||
398 | 392 | ||
399 | if (fep->bufdesc_ex) { | 393 | if (fep->bufdesc_ex) { |
400 | 394 | ||
@@ -416,6 +410,13 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
416 | } | 410 | } |
417 | } | 411 | } |
418 | 412 | ||
413 | /* Send it on its way. Tell FEC it's ready, interrupt when done, | ||
414 | * it's the last BD of the frame, and to put the CRC on the end. | ||
415 | */ | ||
416 | status |= (BD_ENET_TX_READY | BD_ENET_TX_INTR | ||
417 | | BD_ENET_TX_LAST | BD_ENET_TX_TC); | ||
418 | bdp->cbd_sc = status; | ||
419 | |||
419 | bdp_pre = fec_enet_get_prevdesc(bdp, fep); | 420 | bdp_pre = fec_enet_get_prevdesc(bdp, fep); |
420 | if ((id_entry->driver_data & FEC_QUIRK_ERR006358) && | 421 | if ((id_entry->driver_data & FEC_QUIRK_ERR006358) && |
421 | !(bdp_pre->cbd_sc & BD_ENET_TX_READY)) { | 422 | !(bdp_pre->cbd_sc & BD_ENET_TX_READY)) { |
@@ -1778,8 +1779,6 @@ fec_enet_open(struct net_device *ndev) | |||
1778 | struct fec_enet_private *fep = netdev_priv(ndev); | 1779 | struct fec_enet_private *fep = netdev_priv(ndev); |
1779 | int ret; | 1780 | int ret; |
1780 | 1781 | ||
1781 | napi_enable(&fep->napi); | ||
1782 | |||
1783 | /* I should reset the ring buffers here, but I don't yet know | 1782 | /* I should reset the ring buffers here, but I don't yet know |
1784 | * a simple way to do that. | 1783 | * a simple way to do that. |
1785 | */ | 1784 | */ |
@@ -1794,6 +1793,8 @@ fec_enet_open(struct net_device *ndev) | |||
1794 | fec_enet_free_buffers(ndev); | 1793 | fec_enet_free_buffers(ndev); |
1795 | return ret; | 1794 | return ret; |
1796 | } | 1795 | } |
1796 | |||
1797 | napi_enable(&fep->napi); | ||
1797 | phy_start(fep->phy_dev); | 1798 | phy_start(fep->phy_dev); |
1798 | netif_start_queue(ndev); | 1799 | netif_start_queue(ndev); |
1799 | fep->opened = 1; | 1800 | fep->opened = 1; |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 6d4ada72dfd0..18076c4178b4 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -6881,7 +6881,7 @@ static inline int ixgbe_maybe_stop_tx(struct ixgbe_ring *tx_ring, u16 size) | |||
6881 | } | 6881 | } |
6882 | 6882 | ||
6883 | static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb, | 6883 | static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb, |
6884 | void *accel_priv) | 6884 | void *accel_priv, select_queue_fallback_t fallback) |
6885 | { | 6885 | { |
6886 | struct ixgbe_fwd_adapter *fwd_adapter = accel_priv; | 6886 | struct ixgbe_fwd_adapter *fwd_adapter = accel_priv; |
6887 | #ifdef IXGBE_FCOE | 6887 | #ifdef IXGBE_FCOE |
@@ -6907,7 +6907,7 @@ static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb, | |||
6907 | if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) | 6907 | if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) |
6908 | break; | 6908 | break; |
6909 | default: | 6909 | default: |
6910 | return __netdev_pick_tx(dev, skb); | 6910 | return fallback(dev, skb); |
6911 | } | 6911 | } |
6912 | 6912 | ||
6913 | f = &adapter->ring_feature[RING_F_FCOE]; | 6913 | f = &adapter->ring_feature[RING_F_FCOE]; |
@@ -6920,7 +6920,7 @@ static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb, | |||
6920 | 6920 | ||
6921 | return txq + f->offset; | 6921 | return txq + f->offset; |
6922 | #else | 6922 | #else |
6923 | return __netdev_pick_tx(dev, skb); | 6923 | return fallback(dev, skb); |
6924 | #endif | 6924 | #endif |
6925 | } | 6925 | } |
6926 | 6926 | ||
diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c index 8f9266c64c75..fd4b6aecf6ee 100644 --- a/drivers/net/ethernet/lantiq_etop.c +++ b/drivers/net/ethernet/lantiq_etop.c | |||
@@ -619,7 +619,7 @@ ltq_etop_set_multicast_list(struct net_device *dev) | |||
619 | 619 | ||
620 | static u16 | 620 | static u16 |
621 | ltq_etop_select_queue(struct net_device *dev, struct sk_buff *skb, | 621 | ltq_etop_select_queue(struct net_device *dev, struct sk_buff *skb, |
622 | void *accel_priv) | 622 | void *accel_priv, select_queue_fallback_t fallback) |
623 | { | 623 | { |
624 | /* we are currently only using the first queue */ | 624 | /* we are currently only using the first queue */ |
625 | return 0; | 625 | return 0; |
diff --git a/drivers/net/ethernet/marvell/Kconfig b/drivers/net/ethernet/marvell/Kconfig index 6300fd27f2db..68e6a6613e9a 100644 --- a/drivers/net/ethernet/marvell/Kconfig +++ b/drivers/net/ethernet/marvell/Kconfig | |||
@@ -43,12 +43,12 @@ config MVMDIO | |||
43 | This driver is used by the MV643XX_ETH and MVNETA drivers. | 43 | This driver is used by the MV643XX_ETH and MVNETA drivers. |
44 | 44 | ||
45 | config MVNETA | 45 | config MVNETA |
46 | tristate "Marvell Armada 370/XP network interface support" | 46 | tristate "Marvell Armada 370/38x/XP network interface support" |
47 | depends on MACH_ARMADA_370_XP | 47 | depends on PLAT_ORION |
48 | select MVMDIO | 48 | select MVMDIO |
49 | ---help--- | 49 | ---help--- |
50 | This driver supports the network interface units in the | 50 | This driver supports the network interface units in the |
51 | Marvell ARMADA XP and ARMADA 370 SoC family. | 51 | Marvell ARMADA XP, ARMADA 370 and ARMADA 38x SoC family. |
52 | 52 | ||
53 | Note that this driver is distinct from the mv643xx_eth | 53 | Note that this driver is distinct from the mv643xx_eth |
54 | driver, which should be used for the older Marvell SoCs | 54 | driver, which should be used for the older Marvell SoCs |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index 8e8a7eb43a2c..13457032d15f 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c | |||
@@ -629,7 +629,7 @@ static void build_inline_wqe(struct mlx4_en_tx_desc *tx_desc, struct sk_buff *sk | |||
629 | } | 629 | } |
630 | 630 | ||
631 | u16 mlx4_en_select_queue(struct net_device *dev, struct sk_buff *skb, | 631 | u16 mlx4_en_select_queue(struct net_device *dev, struct sk_buff *skb, |
632 | void *accel_priv) | 632 | void *accel_priv, select_queue_fallback_t fallback) |
633 | { | 633 | { |
634 | struct mlx4_en_priv *priv = netdev_priv(dev); | 634 | struct mlx4_en_priv *priv = netdev_priv(dev); |
635 | u16 rings_p_up = priv->num_tx_rings_p_up; | 635 | u16 rings_p_up = priv->num_tx_rings_p_up; |
@@ -641,7 +641,7 @@ u16 mlx4_en_select_queue(struct net_device *dev, struct sk_buff *skb, | |||
641 | if (vlan_tx_tag_present(skb)) | 641 | if (vlan_tx_tag_present(skb)) |
642 | up = vlan_tx_tag_get(skb) >> VLAN_PRIO_SHIFT; | 642 | up = vlan_tx_tag_get(skb) >> VLAN_PRIO_SHIFT; |
643 | 643 | ||
644 | return __netdev_pick_tx(dev, skb) % rings_p_up + up * rings_p_up; | 644 | return fallback(dev, skb) % rings_p_up + up * rings_p_up; |
645 | } | 645 | } |
646 | 646 | ||
647 | static void mlx4_bf_copy(void __iomem *dst, unsigned long *src, unsigned bytecnt) | 647 | static void mlx4_bf_copy(void __iomem *dst, unsigned long *src, unsigned bytecnt) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h index 6b65f7795215..7aec6c833973 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h | |||
@@ -51,8 +51,8 @@ | |||
51 | 51 | ||
52 | #define DRV_NAME "mlx4_core" | 52 | #define DRV_NAME "mlx4_core" |
53 | #define PFX DRV_NAME ": " | 53 | #define PFX DRV_NAME ": " |
54 | #define DRV_VERSION "1.1" | 54 | #define DRV_VERSION "2.2-1" |
55 | #define DRV_RELDATE "Dec, 2011" | 55 | #define DRV_RELDATE "Feb, 2014" |
56 | 56 | ||
57 | #define MLX4_FS_UDP_UC_EN (1 << 1) | 57 | #define MLX4_FS_UDP_UC_EN (1 << 1) |
58 | #define MLX4_FS_TCP_UC_EN (1 << 2) | 58 | #define MLX4_FS_TCP_UC_EN (1 << 2) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 3af04c3f42ea..b57e8c87a34e 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
@@ -57,8 +57,8 @@ | |||
57 | #include "en_port.h" | 57 | #include "en_port.h" |
58 | 58 | ||
59 | #define DRV_NAME "mlx4_en" | 59 | #define DRV_NAME "mlx4_en" |
60 | #define DRV_VERSION "2.0" | 60 | #define DRV_VERSION "2.2-1" |
61 | #define DRV_RELDATE "Dec 2011" | 61 | #define DRV_RELDATE "Feb 2014" |
62 | 62 | ||
63 | #define MLX4_EN_MSG_LEVEL (NETIF_MSG_LINK | NETIF_MSG_IFDOWN) | 63 | #define MLX4_EN_MSG_LEVEL (NETIF_MSG_LINK | NETIF_MSG_IFDOWN) |
64 | 64 | ||
@@ -723,7 +723,7 @@ int mlx4_en_arm_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq); | |||
723 | 723 | ||
724 | void mlx4_en_tx_irq(struct mlx4_cq *mcq); | 724 | void mlx4_en_tx_irq(struct mlx4_cq *mcq); |
725 | u16 mlx4_en_select_queue(struct net_device *dev, struct sk_buff *skb, | 725 | u16 mlx4_en_select_queue(struct net_device *dev, struct sk_buff *skb, |
726 | void *accel_priv); | 726 | void *accel_priv, select_queue_fallback_t fallback); |
727 | netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev); | 727 | netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev); |
728 | 728 | ||
729 | int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, | 729 | int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index a064f06e0cb8..23b7e2d35a93 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c | |||
@@ -46,8 +46,8 @@ | |||
46 | #include "mlx5_core.h" | 46 | #include "mlx5_core.h" |
47 | 47 | ||
48 | #define DRIVER_NAME "mlx5_core" | 48 | #define DRIVER_NAME "mlx5_core" |
49 | #define DRIVER_VERSION "1.0" | 49 | #define DRIVER_VERSION "2.2-1" |
50 | #define DRIVER_RELDATE "June 2013" | 50 | #define DRIVER_RELDATE "Feb 2014" |
51 | 51 | ||
52 | MODULE_AUTHOR("Eli Cohen <eli@mellanox.com>"); | 52 | MODULE_AUTHOR("Eli Cohen <eli@mellanox.com>"); |
53 | MODULE_DESCRIPTION("Mellanox ConnectX-IB HCA core library"); | 53 | MODULE_DESCRIPTION("Mellanox ConnectX-IB HCA core library"); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c index 4146664d4d6a..27c4f131863b 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | |||
@@ -340,6 +340,7 @@ int qlcnic_83xx_setup_intr(struct qlcnic_adapter *adapter) | |||
340 | if (qlcnic_sriov_vf_check(adapter)) | 340 | if (qlcnic_sriov_vf_check(adapter)) |
341 | return -EINVAL; | 341 | return -EINVAL; |
342 | num_msix = 1; | 342 | num_msix = 1; |
343 | adapter->drv_sds_rings = QLCNIC_SINGLE_RING; | ||
343 | adapter->drv_tx_rings = QLCNIC_SINGLE_RING; | 344 | adapter->drv_tx_rings = QLCNIC_SINGLE_RING; |
344 | } | 345 | } |
345 | } | 346 | } |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c index 77f1bce432d2..7d4f54912bad 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c | |||
@@ -807,7 +807,7 @@ qlcnic_dcb_get_pg_tc_cfg_tx(struct net_device *netdev, int tc, u8 *prio, | |||
807 | !type->tc_param_valid) | 807 | !type->tc_param_valid) |
808 | return; | 808 | return; |
809 | 809 | ||
810 | if (tc < 0 || (tc > QLC_DCB_MAX_TC)) | 810 | if (tc < 0 || (tc >= QLC_DCB_MAX_TC)) |
811 | return; | 811 | return; |
812 | 812 | ||
813 | tc_cfg = &type->tc_cfg[tc]; | 813 | tc_cfg = &type->tc_cfg[tc]; |
@@ -843,7 +843,7 @@ static void qlcnic_dcb_get_pg_bwg_cfg_tx(struct net_device *netdev, int pgid, | |||
843 | !type->tc_param_valid) | 843 | !type->tc_param_valid) |
844 | return; | 844 | return; |
845 | 845 | ||
846 | if (pgid < 0 || pgid > QLC_DCB_MAX_PG) | 846 | if (pgid < 0 || pgid >= QLC_DCB_MAX_PG) |
847 | return; | 847 | return; |
848 | 848 | ||
849 | pgcfg = &type->pg_cfg[pgid]; | 849 | pgcfg = &type->pg_cfg[pgid]; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index ba78c7481fa3..1222865cfb73 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -816,9 +816,10 @@ static int qlcnic_82xx_setup_intr(struct qlcnic_adapter *adapter) | |||
816 | 816 | ||
817 | if (!(adapter->flags & QLCNIC_MSIX_ENABLED)) { | 817 | if (!(adapter->flags & QLCNIC_MSIX_ENABLED)) { |
818 | qlcnic_disable_multi_tx(adapter); | 818 | qlcnic_disable_multi_tx(adapter); |
819 | adapter->drv_sds_rings = QLCNIC_SINGLE_RING; | ||
819 | 820 | ||
820 | err = qlcnic_enable_msi_legacy(adapter); | 821 | err = qlcnic_enable_msi_legacy(adapter); |
821 | if (!err) | 822 | if (err) |
822 | return err; | 823 | return err; |
823 | } | 824 | } |
824 | } | 825 | } |
@@ -3863,7 +3864,7 @@ int qlcnic_validate_rings(struct qlcnic_adapter *adapter, __u32 ring_cnt, | |||
3863 | strcpy(buf, "Tx"); | 3864 | strcpy(buf, "Tx"); |
3864 | } | 3865 | } |
3865 | 3866 | ||
3866 | if (!qlcnic_use_msi_x && !qlcnic_use_msi) { | 3867 | if (!QLCNIC_IS_MSI_FAMILY(adapter)) { |
3867 | netdev_err(netdev, "No RSS/TSS support in INT-x mode\n"); | 3868 | netdev_err(netdev, "No RSS/TSS support in INT-x mode\n"); |
3868 | return -EINVAL; | 3869 | return -EINVAL; |
3869 | } | 3870 | } |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c index 09acf15c3a56..e5277a632671 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c | |||
@@ -13,8 +13,6 @@ | |||
13 | #define QLC_VF_MIN_TX_RATE 100 | 13 | #define QLC_VF_MIN_TX_RATE 100 |
14 | #define QLC_VF_MAX_TX_RATE 9999 | 14 | #define QLC_VF_MAX_TX_RATE 9999 |
15 | #define QLC_MAC_OPCODE_MASK 0x7 | 15 | #define QLC_MAC_OPCODE_MASK 0x7 |
16 | #define QLC_MAC_STAR_ADD 6 | ||
17 | #define QLC_MAC_STAR_DEL 7 | ||
18 | #define QLC_VF_FLOOD_BIT BIT_16 | 16 | #define QLC_VF_FLOOD_BIT BIT_16 |
19 | #define QLC_FLOOD_MODE 0x5 | 17 | #define QLC_FLOOD_MODE 0x5 |
20 | 18 | ||
@@ -1206,13 +1204,6 @@ static int qlcnic_sriov_validate_cfg_macvlan(struct qlcnic_adapter *adapter, | |||
1206 | struct qlcnic_vport *vp = vf->vp; | 1204 | struct qlcnic_vport *vp = vf->vp; |
1207 | u8 op, new_op; | 1205 | u8 op, new_op; |
1208 | 1206 | ||
1209 | if (((cmd->req.arg[1] & QLC_MAC_OPCODE_MASK) == QLC_MAC_STAR_ADD) || | ||
1210 | ((cmd->req.arg[1] & QLC_MAC_OPCODE_MASK) == QLC_MAC_STAR_DEL)) { | ||
1211 | netdev_err(adapter->netdev, "MAC + any VLAN filter not allowed from VF %d\n", | ||
1212 | vf->pci_func); | ||
1213 | return -EINVAL; | ||
1214 | } | ||
1215 | |||
1216 | if (!(cmd->req.arg[1] & BIT_8)) | 1207 | if (!(cmd->req.arg[1] & BIT_8)) |
1217 | return -EINVAL; | 1208 | return -EINVAL; |
1218 | 1209 | ||
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 91a67ae8f17b..e9779653cd4c 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -7118,6 +7118,8 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7118 | } | 7118 | } |
7119 | 7119 | ||
7120 | mutex_init(&tp->wk.mutex); | 7120 | mutex_init(&tp->wk.mutex); |
7121 | u64_stats_init(&tp->rx_stats.syncp); | ||
7122 | u64_stats_init(&tp->tx_stats.syncp); | ||
7121 | 7123 | ||
7122 | /* Get MAC address */ | 7124 | /* Get MAC address */ |
7123 | for (i = 0; i < ETH_ALEN; i++) | 7125 | for (i = 0; i < ETH_ALEN; i++) |
diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c index eb75fbd11a01..d7a36829649a 100644 --- a/drivers/net/ethernet/sfc/ptp.c +++ b/drivers/net/ethernet/sfc/ptp.c | |||
@@ -1668,6 +1668,13 @@ void efx_ptp_event(struct efx_nic *efx, efx_qword_t *ev) | |||
1668 | struct efx_ptp_data *ptp = efx->ptp_data; | 1668 | struct efx_ptp_data *ptp = efx->ptp_data; |
1669 | int code = EFX_QWORD_FIELD(*ev, MCDI_EVENT_CODE); | 1669 | int code = EFX_QWORD_FIELD(*ev, MCDI_EVENT_CODE); |
1670 | 1670 | ||
1671 | if (!ptp) { | ||
1672 | if (net_ratelimit()) | ||
1673 | netif_warn(efx, drv, efx->net_dev, | ||
1674 | "Received PTP event but PTP not set up\n"); | ||
1675 | return; | ||
1676 | } | ||
1677 | |||
1671 | if (!ptp->enabled) | 1678 | if (!ptp->enabled) |
1672 | return; | 1679 | return; |
1673 | 1680 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig index e2f202e3932f..f2d7c702c77f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig | |||
@@ -37,6 +37,17 @@ config DWMAC_SUNXI | |||
37 | stmmac device driver. This driver is used for A20/A31 | 37 | stmmac device driver. This driver is used for A20/A31 |
38 | GMAC ethernet controller. | 38 | GMAC ethernet controller. |
39 | 39 | ||
40 | config DWMAC_STI | ||
41 | bool "STi GMAC support" | ||
42 | depends on STMMAC_PLATFORM && ARCH_STI | ||
43 | default y | ||
44 | ---help--- | ||
45 | Support for ethernet controller on STi SOCs. | ||
46 | |||
47 | This selects STi SoC glue layer support for the stmmac | ||
48 | device driver. This driver is used on for the STi series | ||
49 | SOCs GMAC ethernet controller. | ||
50 | |||
40 | config STMMAC_PCI | 51 | config STMMAC_PCI |
41 | bool "STMMAC PCI bus support" | 52 | bool "STMMAC PCI bus support" |
42 | depends on STMMAC_ETH && PCI | 53 | depends on STMMAC_ETH && PCI |
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile index ecadecea79b2..dcef28775dad 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Makefile +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile | |||
@@ -2,6 +2,7 @@ obj-$(CONFIG_STMMAC_ETH) += stmmac.o | |||
2 | stmmac-$(CONFIG_STMMAC_PLATFORM) += stmmac_platform.o | 2 | stmmac-$(CONFIG_STMMAC_PLATFORM) += stmmac_platform.o |
3 | stmmac-$(CONFIG_STMMAC_PCI) += stmmac_pci.o | 3 | stmmac-$(CONFIG_STMMAC_PCI) += stmmac_pci.o |
4 | stmmac-$(CONFIG_DWMAC_SUNXI) += dwmac-sunxi.o | 4 | stmmac-$(CONFIG_DWMAC_SUNXI) += dwmac-sunxi.o |
5 | stmmac-$(CONFIG_DWMAC_STI) += dwmac-sti.o | ||
5 | stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o \ | 6 | stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o \ |
6 | chain_mode.o dwmac_lib.o dwmac1000_core.o dwmac1000_dma.o \ | 7 | chain_mode.o dwmac_lib.o dwmac1000_core.o dwmac1000_dma.o \ |
7 | dwmac100_core.o dwmac100_dma.o enh_desc.o norm_desc.o \ | 8 | dwmac100_core.o dwmac100_dma.o enh_desc.o norm_desc.o \ |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c new file mode 100644 index 000000000000..552bbc17863c --- /dev/null +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c | |||
@@ -0,0 +1,330 @@ | |||
1 | /** | ||
2 | * dwmac-sti.c - STMicroelectronics DWMAC Specific Glue layer | ||
3 | * | ||
4 | * Copyright (C) 2003-2014 STMicroelectronics (R&D) Limited | ||
5 | * Author: Srinivas Kandagatla <srinivas.kandagatla@st.com> | ||
6 | * | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | */ | ||
13 | |||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/slab.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/stmmac.h> | ||
18 | #include <linux/phy.h> | ||
19 | #include <linux/mfd/syscon.h> | ||
20 | #include <linux/regmap.h> | ||
21 | #include <linux/clk.h> | ||
22 | #include <linux/of.h> | ||
23 | #include <linux/of_net.h> | ||
24 | |||
25 | /** | ||
26 | * STi GMAC glue logic. | ||
27 | * -------------------- | ||
28 | * | ||
29 | * _ | ||
30 | * | \ | ||
31 | * --------|0 \ ETH_SEL_INTERNAL_NOTEXT_PHYCLK | ||
32 | * phyclk | |___________________________________________ | ||
33 | * | | | (phyclk-in) | ||
34 | * --------|1 / | | ||
35 | * int-clk |_ / | | ||
36 | * | _ | ||
37 | * | | \ | ||
38 | * |_______|1 \ ETH_SEL_TX_RETIME_CLK | ||
39 | * | |___________________________ | ||
40 | * | | (tx-retime-clk) | ||
41 | * _______|0 / | ||
42 | * | |_ / | ||
43 | * _ | | ||
44 | * | \ | | ||
45 | * --------|0 \ | | ||
46 | * clk_125 | |__| | ||
47 | * | | ETH_SEL_TXCLK_NOT_CLK125 | ||
48 | * --------|1 / | ||
49 | * txclk |_ / | ||
50 | * | ||
51 | * | ||
52 | * ETH_SEL_INTERNAL_NOTEXT_PHYCLK is valid only for RMII where PHY can | ||
53 | * generate 50MHz clock or MAC can generate it. | ||
54 | * This bit is configured by "st,ext-phyclk" property. | ||
55 | * | ||
56 | * ETH_SEL_TXCLK_NOT_CLK125 is only valid for gigabit modes, where the 125Mhz | ||
57 | * clock either comes from clk-125 pin or txclk pin. This configuration is | ||
58 | * totally driven by the board wiring. This bit is configured by | ||
59 | * "st,tx-retime-src" property. | ||
60 | * | ||
61 | * TXCLK configuration is different for different phy interface modes | ||
62 | * and changes according to link speed in modes like RGMII. | ||
63 | * | ||
64 | * Below table summarizes the clock requirement and clock sources for | ||
65 | * supported phy interface modes with link speeds. | ||
66 | * ________________________________________________ | ||
67 | *| PHY_MODE | 1000 Mbit Link | 100 Mbit Link | | ||
68 | * ------------------------------------------------ | ||
69 | *| MII | n/a | 25Mhz | | ||
70 | *| | | txclk | | ||
71 | * ------------------------------------------------ | ||
72 | *| GMII | 125Mhz | 25Mhz | | ||
73 | *| | clk-125/txclk | txclk | | ||
74 | * ------------------------------------------------ | ||
75 | *| RGMII | 125Mhz | 25Mhz | | ||
76 | *| | clk-125/txclk | clkgen | | ||
77 | * ------------------------------------------------ | ||
78 | *| RMII | n/a | 25Mhz | | ||
79 | *| | |clkgen/phyclk-in | | ||
80 | * ------------------------------------------------ | ||
81 | * | ||
82 | * TX lines are always retimed with a clk, which can vary depending | ||
83 | * on the board configuration. Below is the table of these bits | ||
84 | * in eth configuration register depending on source of retime clk. | ||
85 | * | ||
86 | *--------------------------------------------------------------- | ||
87 | * src | tx_rt_clk | int_not_ext_phyclk | txclk_n_clk125| | ||
88 | *--------------------------------------------------------------- | ||
89 | * txclk | 0 | n/a | 1 | | ||
90 | *--------------------------------------------------------------- | ||
91 | * ck_125| 0 | n/a | 0 | | ||
92 | *--------------------------------------------------------------- | ||
93 | * phyclk| 1 | 0 | n/a | | ||
94 | *--------------------------------------------------------------- | ||
95 | * clkgen| 1 | 1 | n/a | | ||
96 | *--------------------------------------------------------------- | ||
97 | */ | ||
98 | |||
99 | /* Register definition */ | ||
100 | |||
101 | /* 3 bits [8:6] | ||
102 | * [6:6] ETH_SEL_TXCLK_NOT_CLK125 | ||
103 | * [7:7] ETH_SEL_INTERNAL_NOTEXT_PHYCLK | ||
104 | * [8:8] ETH_SEL_TX_RETIME_CLK | ||
105 | * | ||
106 | */ | ||
107 | |||
108 | #define TX_RETIME_SRC_MASK GENMASK(8, 6) | ||
109 | #define ETH_SEL_TX_RETIME_CLK BIT(8) | ||
110 | #define ETH_SEL_INTERNAL_NOTEXT_PHYCLK BIT(7) | ||
111 | #define ETH_SEL_TXCLK_NOT_CLK125 BIT(6) | ||
112 | |||
113 | #define ENMII_MASK GENMASK(5, 5) | ||
114 | #define ENMII BIT(5) | ||
115 | |||
116 | /** | ||
117 | * 3 bits [4:2] | ||
118 | * 000-GMII/MII | ||
119 | * 001-RGMII | ||
120 | * 010-SGMII | ||
121 | * 100-RMII | ||
122 | */ | ||
123 | #define MII_PHY_SEL_MASK GENMASK(4, 2) | ||
124 | #define ETH_PHY_SEL_RMII BIT(4) | ||
125 | #define ETH_PHY_SEL_SGMII BIT(3) | ||
126 | #define ETH_PHY_SEL_RGMII BIT(2) | ||
127 | #define ETH_PHY_SEL_GMII 0x0 | ||
128 | #define ETH_PHY_SEL_MII 0x0 | ||
129 | |||
130 | #define IS_PHY_IF_MODE_RGMII(iface) (iface == PHY_INTERFACE_MODE_RGMII || \ | ||
131 | iface == PHY_INTERFACE_MODE_RGMII_ID || \ | ||
132 | iface == PHY_INTERFACE_MODE_RGMII_RXID || \ | ||
133 | iface == PHY_INTERFACE_MODE_RGMII_TXID) | ||
134 | |||
135 | #define IS_PHY_IF_MODE_GBIT(iface) (IS_PHY_IF_MODE_RGMII(iface) || \ | ||
136 | iface == PHY_INTERFACE_MODE_GMII) | ||
137 | |||
138 | struct sti_dwmac { | ||
139 | int interface; | ||
140 | bool ext_phyclk; | ||
141 | bool is_tx_retime_src_clk_125; | ||
142 | struct clk *clk; | ||
143 | int reg; | ||
144 | struct device *dev; | ||
145 | struct regmap *regmap; | ||
146 | }; | ||
147 | |||
148 | static u32 phy_intf_sels[] = { | ||
149 | [PHY_INTERFACE_MODE_MII] = ETH_PHY_SEL_MII, | ||
150 | [PHY_INTERFACE_MODE_GMII] = ETH_PHY_SEL_GMII, | ||
151 | [PHY_INTERFACE_MODE_RGMII] = ETH_PHY_SEL_RGMII, | ||
152 | [PHY_INTERFACE_MODE_RGMII_ID] = ETH_PHY_SEL_RGMII, | ||
153 | [PHY_INTERFACE_MODE_SGMII] = ETH_PHY_SEL_SGMII, | ||
154 | [PHY_INTERFACE_MODE_RMII] = ETH_PHY_SEL_RMII, | ||
155 | }; | ||
156 | |||
157 | enum { | ||
158 | TX_RETIME_SRC_NA = 0, | ||
159 | TX_RETIME_SRC_TXCLK = 1, | ||
160 | TX_RETIME_SRC_CLK_125, | ||
161 | TX_RETIME_SRC_PHYCLK, | ||
162 | TX_RETIME_SRC_CLKGEN, | ||
163 | }; | ||
164 | |||
165 | static const char *const tx_retime_srcs[] = { | ||
166 | [TX_RETIME_SRC_NA] = "", | ||
167 | [TX_RETIME_SRC_TXCLK] = "txclk", | ||
168 | [TX_RETIME_SRC_CLK_125] = "clk_125", | ||
169 | [TX_RETIME_SRC_PHYCLK] = "phyclk", | ||
170 | [TX_RETIME_SRC_CLKGEN] = "clkgen", | ||
171 | }; | ||
172 | |||
173 | static u32 tx_retime_val[] = { | ||
174 | [TX_RETIME_SRC_TXCLK] = ETH_SEL_TXCLK_NOT_CLK125, | ||
175 | [TX_RETIME_SRC_CLK_125] = 0x0, | ||
176 | [TX_RETIME_SRC_PHYCLK] = ETH_SEL_TX_RETIME_CLK, | ||
177 | [TX_RETIME_SRC_CLKGEN] = ETH_SEL_TX_RETIME_CLK | | ||
178 | ETH_SEL_INTERNAL_NOTEXT_PHYCLK, | ||
179 | }; | ||
180 | |||
181 | static void setup_retime_src(struct sti_dwmac *dwmac, u32 spd) | ||
182 | { | ||
183 | u32 src = 0, freq = 0; | ||
184 | |||
185 | if (spd == SPEED_100) { | ||
186 | if (dwmac->interface == PHY_INTERFACE_MODE_MII || | ||
187 | dwmac->interface == PHY_INTERFACE_MODE_GMII) { | ||
188 | src = TX_RETIME_SRC_TXCLK; | ||
189 | } else if (dwmac->interface == PHY_INTERFACE_MODE_RMII) { | ||
190 | if (dwmac->ext_phyclk) { | ||
191 | src = TX_RETIME_SRC_PHYCLK; | ||
192 | } else { | ||
193 | src = TX_RETIME_SRC_CLKGEN; | ||
194 | freq = 50000000; | ||
195 | } | ||
196 | |||
197 | } else if (IS_PHY_IF_MODE_RGMII(dwmac->interface)) { | ||
198 | src = TX_RETIME_SRC_CLKGEN; | ||
199 | freq = 25000000; | ||
200 | } | ||
201 | |||
202 | if (src == TX_RETIME_SRC_CLKGEN && dwmac->clk) | ||
203 | clk_set_rate(dwmac->clk, freq); | ||
204 | |||
205 | } else if (spd == SPEED_1000) { | ||
206 | if (dwmac->is_tx_retime_src_clk_125) | ||
207 | src = TX_RETIME_SRC_CLK_125; | ||
208 | else | ||
209 | src = TX_RETIME_SRC_TXCLK; | ||
210 | } | ||
211 | |||
212 | regmap_update_bits(dwmac->regmap, dwmac->reg, | ||
213 | TX_RETIME_SRC_MASK, tx_retime_val[src]); | ||
214 | } | ||
215 | |||
216 | static void sti_dwmac_exit(struct platform_device *pdev, void *priv) | ||
217 | { | ||
218 | struct sti_dwmac *dwmac = priv; | ||
219 | |||
220 | if (dwmac->clk) | ||
221 | clk_disable_unprepare(dwmac->clk); | ||
222 | } | ||
223 | |||
224 | static void sti_fix_mac_speed(void *priv, unsigned int spd) | ||
225 | { | ||
226 | struct sti_dwmac *dwmac = priv; | ||
227 | |||
228 | setup_retime_src(dwmac, spd); | ||
229 | |||
230 | return; | ||
231 | } | ||
232 | |||
233 | static int sti_dwmac_parse_data(struct sti_dwmac *dwmac, | ||
234 | struct platform_device *pdev) | ||
235 | { | ||
236 | struct resource *res; | ||
237 | struct device *dev = &pdev->dev; | ||
238 | struct device_node *np = dev->of_node; | ||
239 | struct regmap *regmap; | ||
240 | int err; | ||
241 | |||
242 | if (!np) | ||
243 | return -EINVAL; | ||
244 | |||
245 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sti-ethconf"); | ||
246 | if (!res) | ||
247 | return -ENODATA; | ||
248 | |||
249 | regmap = syscon_regmap_lookup_by_phandle(np, "st,syscon"); | ||
250 | if (IS_ERR(regmap)) | ||
251 | return PTR_ERR(regmap); | ||
252 | |||
253 | dwmac->dev = dev; | ||
254 | dwmac->interface = of_get_phy_mode(np); | ||
255 | dwmac->regmap = regmap; | ||
256 | dwmac->reg = res->start; | ||
257 | dwmac->ext_phyclk = of_property_read_bool(np, "st,ext-phyclk"); | ||
258 | dwmac->is_tx_retime_src_clk_125 = false; | ||
259 | |||
260 | if (IS_PHY_IF_MODE_GBIT(dwmac->interface)) { | ||
261 | const char *rs; | ||
262 | |||
263 | err = of_property_read_string(np, "st,tx-retime-src", &rs); | ||
264 | if (err < 0) { | ||
265 | dev_err(dev, "st,tx-retime-src not specified\n"); | ||
266 | return err; | ||
267 | } | ||
268 | |||
269 | if (!strcasecmp(rs, "clk_125")) | ||
270 | dwmac->is_tx_retime_src_clk_125 = true; | ||
271 | } | ||
272 | |||
273 | dwmac->clk = devm_clk_get(dev, "sti-ethclk"); | ||
274 | |||
275 | if (IS_ERR(dwmac->clk)) | ||
276 | dwmac->clk = NULL; | ||
277 | |||
278 | return 0; | ||
279 | } | ||
280 | |||
281 | static int sti_dwmac_init(struct platform_device *pdev, void *priv) | ||
282 | { | ||
283 | struct sti_dwmac *dwmac = priv; | ||
284 | struct regmap *regmap = dwmac->regmap; | ||
285 | int iface = dwmac->interface; | ||
286 | u32 reg = dwmac->reg; | ||
287 | u32 val, spd; | ||
288 | |||
289 | if (dwmac->clk) | ||
290 | clk_prepare_enable(dwmac->clk); | ||
291 | |||
292 | regmap_update_bits(regmap, reg, MII_PHY_SEL_MASK, phy_intf_sels[iface]); | ||
293 | |||
294 | val = (iface == PHY_INTERFACE_MODE_REVMII) ? 0 : ENMII; | ||
295 | regmap_update_bits(regmap, reg, ENMII_MASK, val); | ||
296 | |||
297 | if (IS_PHY_IF_MODE_GBIT(iface)) | ||
298 | spd = SPEED_1000; | ||
299 | else | ||
300 | spd = SPEED_100; | ||
301 | |||
302 | setup_retime_src(dwmac, spd); | ||
303 | |||
304 | return 0; | ||
305 | } | ||
306 | |||
307 | static void *sti_dwmac_setup(struct platform_device *pdev) | ||
308 | { | ||
309 | struct sti_dwmac *dwmac; | ||
310 | int ret; | ||
311 | |||
312 | dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); | ||
313 | if (!dwmac) | ||
314 | return ERR_PTR(-ENOMEM); | ||
315 | |||
316 | ret = sti_dwmac_parse_data(dwmac, pdev); | ||
317 | if (ret) { | ||
318 | dev_err(&pdev->dev, "Unable to parse OF data\n"); | ||
319 | return ERR_PTR(ret); | ||
320 | } | ||
321 | |||
322 | return dwmac; | ||
323 | } | ||
324 | |||
325 | const struct stmmac_of_data sti_gmac_data = { | ||
326 | .fix_mac_speed = sti_fix_mac_speed, | ||
327 | .setup = sti_dwmac_setup, | ||
328 | .init = sti_dwmac_init, | ||
329 | .exit = sti_dwmac_exit, | ||
330 | }; | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index d9af26ed58ee..f9e60d7918c4 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h | |||
@@ -133,6 +133,9 @@ bool stmmac_eee_init(struct stmmac_priv *priv); | |||
133 | #ifdef CONFIG_DWMAC_SUNXI | 133 | #ifdef CONFIG_DWMAC_SUNXI |
134 | extern const struct stmmac_of_data sun7i_gmac_data; | 134 | extern const struct stmmac_of_data sun7i_gmac_data; |
135 | #endif | 135 | #endif |
136 | #ifdef CONFIG_DWMAC_STI | ||
137 | extern const struct stmmac_of_data sti_gmac_data; | ||
138 | #endif | ||
136 | extern struct platform_driver stmmac_pltfr_driver; | 139 | extern struct platform_driver stmmac_pltfr_driver; |
137 | static inline int stmmac_register_platform(void) | 140 | static inline int stmmac_register_platform(void) |
138 | { | 141 | { |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index a2e7d2c96e36..078ad0ec8593 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -1705,7 +1705,7 @@ static int stmmac_open(struct net_device *dev) | |||
1705 | priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize); | 1705 | priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize); |
1706 | priv->dma_buf_sz = STMMAC_ALIGN(buf_sz); | 1706 | priv->dma_buf_sz = STMMAC_ALIGN(buf_sz); |
1707 | 1707 | ||
1708 | alloc_dma_desc_resources(priv); | 1708 | ret = alloc_dma_desc_resources(priv); |
1709 | if (ret < 0) { | 1709 | if (ret < 0) { |
1710 | pr_err("%s: DMA descriptors allocation failed\n", __func__); | 1710 | pr_err("%s: DMA descriptors allocation failed\n", __func__); |
1711 | goto dma_desc_error; | 1711 | goto dma_desc_error; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 5884a7d2063b..c61bc72b8e90 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | |||
@@ -33,6 +33,11 @@ static const struct of_device_id stmmac_dt_ids[] = { | |||
33 | #ifdef CONFIG_DWMAC_SUNXI | 33 | #ifdef CONFIG_DWMAC_SUNXI |
34 | { .compatible = "allwinner,sun7i-a20-gmac", .data = &sun7i_gmac_data}, | 34 | { .compatible = "allwinner,sun7i-a20-gmac", .data = &sun7i_gmac_data}, |
35 | #endif | 35 | #endif |
36 | #ifdef CONFIG_DWMAC_STI | ||
37 | { .compatible = "st,stih415-dwmac", .data = &sti_gmac_data}, | ||
38 | { .compatible = "st,stih416-dwmac", .data = &sti_gmac_data}, | ||
39 | { .compatible = "st,stih127-dwmac", .data = &sti_gmac_data}, | ||
40 | #endif | ||
36 | /* SoC specific glue layers should come before generic bindings */ | 41 | /* SoC specific glue layers should come before generic bindings */ |
37 | { .compatible = "st,spear600-gmac"}, | 42 | { .compatible = "st,spear600-gmac"}, |
38 | { .compatible = "snps,dwmac-3.610"}, | 43 | { .compatible = "snps,dwmac-3.610"}, |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 1d860ce914ed..ffd4d12acf6d 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -554,7 +554,7 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable) | |||
554 | * common for both the interface as the interface shares | 554 | * common for both the interface as the interface shares |
555 | * the same hardware resource. | 555 | * the same hardware resource. |
556 | */ | 556 | */ |
557 | for (i = 0; i <= priv->data.slaves; i++) | 557 | for (i = 0; i < priv->data.slaves; i++) |
558 | if (priv->slaves[i].ndev->flags & IFF_PROMISC) | 558 | if (priv->slaves[i].ndev->flags & IFF_PROMISC) |
559 | flag = true; | 559 | flag = true; |
560 | 560 | ||
@@ -578,7 +578,7 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable) | |||
578 | unsigned long timeout = jiffies + HZ; | 578 | unsigned long timeout = jiffies + HZ; |
579 | 579 | ||
580 | /* Disable Learn for all ports */ | 580 | /* Disable Learn for all ports */ |
581 | for (i = 0; i <= priv->data.slaves; i++) { | 581 | for (i = 0; i < priv->data.slaves; i++) { |
582 | cpsw_ale_control_set(ale, i, | 582 | cpsw_ale_control_set(ale, i, |
583 | ALE_PORT_NOLEARN, 1); | 583 | ALE_PORT_NOLEARN, 1); |
584 | cpsw_ale_control_set(ale, i, | 584 | cpsw_ale_control_set(ale, i, |
@@ -606,7 +606,7 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable) | |||
606 | cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 0); | 606 | cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 0); |
607 | 607 | ||
608 | /* Enable Learn for all ports */ | 608 | /* Enable Learn for all ports */ |
609 | for (i = 0; i <= priv->data.slaves; i++) { | 609 | for (i = 0; i < priv->data.slaves; i++) { |
610 | cpsw_ale_control_set(ale, i, | 610 | cpsw_ale_control_set(ale, i, |
611 | ALE_PORT_NOLEARN, 0); | 611 | ALE_PORT_NOLEARN, 0); |
612 | cpsw_ale_control_set(ale, i, | 612 | cpsw_ale_control_set(ale, i, |
@@ -1164,11 +1164,17 @@ static void cpsw_init_host_port(struct cpsw_priv *priv) | |||
1164 | 1164 | ||
1165 | static void cpsw_slave_stop(struct cpsw_slave *slave, struct cpsw_priv *priv) | 1165 | static void cpsw_slave_stop(struct cpsw_slave *slave, struct cpsw_priv *priv) |
1166 | { | 1166 | { |
1167 | u32 slave_port; | ||
1168 | |||
1169 | slave_port = cpsw_get_slave_port(priv, slave->slave_num); | ||
1170 | |||
1167 | if (!slave->phy) | 1171 | if (!slave->phy) |
1168 | return; | 1172 | return; |
1169 | phy_stop(slave->phy); | 1173 | phy_stop(slave->phy); |
1170 | phy_disconnect(slave->phy); | 1174 | phy_disconnect(slave->phy); |
1171 | slave->phy = NULL; | 1175 | slave->phy = NULL; |
1176 | cpsw_ale_control_set(priv->ale, slave_port, | ||
1177 | ALE_PORT_STATE, ALE_PORT_STATE_DISABLE); | ||
1172 | } | 1178 | } |
1173 | 1179 | ||
1174 | static int cpsw_ndo_open(struct net_device *ndev) | 1180 | static int cpsw_ndo_open(struct net_device *ndev) |
@@ -1896,6 +1902,11 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, | |||
1896 | memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN); | 1902 | memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN); |
1897 | 1903 | ||
1898 | slave_data->phy_if = of_get_phy_mode(slave_node); | 1904 | slave_data->phy_if = of_get_phy_mode(slave_node); |
1905 | if (slave_data->phy_if < 0) { | ||
1906 | pr_err("Missing or malformed slave[%d] phy-mode property\n", | ||
1907 | i); | ||
1908 | return slave_data->phy_if; | ||
1909 | } | ||
1899 | 1910 | ||
1900 | if (data->dual_emac) { | 1911 | if (data->dual_emac) { |
1901 | if (of_property_read_u32(slave_node, "dual_emac_res_vlan", | 1912 | if (of_property_read_u32(slave_node, "dual_emac_res_vlan", |
diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c index 023237a65720..17503da9f7a5 100644 --- a/drivers/net/ethernet/tile/tilegx.c +++ b/drivers/net/ethernet/tile/tilegx.c | |||
@@ -2071,7 +2071,7 @@ static int tile_net_tx(struct sk_buff *skb, struct net_device *dev) | |||
2071 | 2071 | ||
2072 | /* Return subqueue id on this core (one per core). */ | 2072 | /* Return subqueue id on this core (one per core). */ |
2073 | static u16 tile_net_select_queue(struct net_device *dev, struct sk_buff *skb, | 2073 | static u16 tile_net_select_queue(struct net_device *dev, struct sk_buff *skb, |
2074 | void *accel_priv) | 2074 | void *accel_priv, select_queue_fallback_t fallback) |
2075 | { | 2075 | { |
2076 | return smp_processor_id(); | 2076 | return smp_processor_id(); |
2077 | } | 2077 | } |
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 1ec65feebb9e..4bfdf8c7ada0 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/netdevice.h> | 26 | #include <linux/netdevice.h> |
27 | #include <linux/of_mdio.h> | 27 | #include <linux/of_mdio.h> |
28 | #include <linux/of_platform.h> | 28 | #include <linux/of_platform.h> |
29 | #include <linux/of_irq.h> | ||
29 | #include <linux/of_address.h> | 30 | #include <linux/of_address.h> |
30 | #include <linux/skbuff.h> | 31 | #include <linux/skbuff.h> |
31 | #include <linux/spinlock.h> | 32 | #include <linux/spinlock.h> |
@@ -600,7 +601,8 @@ static void axienet_start_xmit_done(struct net_device *ndev) | |||
600 | size += status & XAXIDMA_BD_STS_ACTUAL_LEN_MASK; | 601 | size += status & XAXIDMA_BD_STS_ACTUAL_LEN_MASK; |
601 | packets++; | 602 | packets++; |
602 | 603 | ||
603 | lp->tx_bd_ci = ++lp->tx_bd_ci % TX_BD_NUM; | 604 | ++lp->tx_bd_ci; |
605 | lp->tx_bd_ci %= TX_BD_NUM; | ||
604 | cur_p = &lp->tx_bd_v[lp->tx_bd_ci]; | 606 | cur_p = &lp->tx_bd_v[lp->tx_bd_ci]; |
605 | status = cur_p->status; | 607 | status = cur_p->status; |
606 | } | 608 | } |
@@ -686,7 +688,8 @@ static int axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
686 | skb_headlen(skb), DMA_TO_DEVICE); | 688 | skb_headlen(skb), DMA_TO_DEVICE); |
687 | 689 | ||
688 | for (ii = 0; ii < num_frag; ii++) { | 690 | for (ii = 0; ii < num_frag; ii++) { |
689 | lp->tx_bd_tail = ++lp->tx_bd_tail % TX_BD_NUM; | 691 | ++lp->tx_bd_tail; |
692 | lp->tx_bd_tail %= TX_BD_NUM; | ||
690 | cur_p = &lp->tx_bd_v[lp->tx_bd_tail]; | 693 | cur_p = &lp->tx_bd_v[lp->tx_bd_tail]; |
691 | frag = &skb_shinfo(skb)->frags[ii]; | 694 | frag = &skb_shinfo(skb)->frags[ii]; |
692 | cur_p->phys = dma_map_single(ndev->dev.parent, | 695 | cur_p->phys = dma_map_single(ndev->dev.parent, |
@@ -702,7 +705,8 @@ static int axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
702 | tail_p = lp->tx_bd_p + sizeof(*lp->tx_bd_v) * lp->tx_bd_tail; | 705 | tail_p = lp->tx_bd_p + sizeof(*lp->tx_bd_v) * lp->tx_bd_tail; |
703 | /* Start the transfer */ | 706 | /* Start the transfer */ |
704 | axienet_dma_out32(lp, XAXIDMA_TX_TDESC_OFFSET, tail_p); | 707 | axienet_dma_out32(lp, XAXIDMA_TX_TDESC_OFFSET, tail_p); |
705 | lp->tx_bd_tail = ++lp->tx_bd_tail % TX_BD_NUM; | 708 | ++lp->tx_bd_tail; |
709 | lp->tx_bd_tail %= TX_BD_NUM; | ||
706 | 710 | ||
707 | return NETDEV_TX_OK; | 711 | return NETDEV_TX_OK; |
708 | } | 712 | } |
@@ -774,7 +778,8 @@ static void axienet_recv(struct net_device *ndev) | |||
774 | cur_p->status = 0; | 778 | cur_p->status = 0; |
775 | cur_p->sw_id_offset = (u32) new_skb; | 779 | cur_p->sw_id_offset = (u32) new_skb; |
776 | 780 | ||
777 | lp->rx_bd_ci = ++lp->rx_bd_ci % RX_BD_NUM; | 781 | ++lp->rx_bd_ci; |
782 | lp->rx_bd_ci %= RX_BD_NUM; | ||
778 | cur_p = &lp->rx_bd_v[lp->rx_bd_ci]; | 783 | cur_p = &lp->rx_bd_v[lp->rx_bd_ci]; |
779 | } | 784 | } |
780 | 785 | ||
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 7756118c2f0a..7141a1937360 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c | |||
@@ -88,8 +88,12 @@ static int netvsc_open(struct net_device *net) | |||
88 | { | 88 | { |
89 | struct net_device_context *net_device_ctx = netdev_priv(net); | 89 | struct net_device_context *net_device_ctx = netdev_priv(net); |
90 | struct hv_device *device_obj = net_device_ctx->device_ctx; | 90 | struct hv_device *device_obj = net_device_ctx->device_ctx; |
91 | struct netvsc_device *nvdev; | ||
92 | struct rndis_device *rdev; | ||
91 | int ret = 0; | 93 | int ret = 0; |
92 | 94 | ||
95 | netif_carrier_off(net); | ||
96 | |||
93 | /* Open up the device */ | 97 | /* Open up the device */ |
94 | ret = rndis_filter_open(device_obj); | 98 | ret = rndis_filter_open(device_obj); |
95 | if (ret != 0) { | 99 | if (ret != 0) { |
@@ -99,6 +103,11 @@ static int netvsc_open(struct net_device *net) | |||
99 | 103 | ||
100 | netif_start_queue(net); | 104 | netif_start_queue(net); |
101 | 105 | ||
106 | nvdev = hv_get_drvdata(device_obj); | ||
107 | rdev = nvdev->extension; | ||
108 | if (!rdev->link_state) | ||
109 | netif_carrier_on(net); | ||
110 | |||
102 | return ret; | 111 | return ret; |
103 | } | 112 | } |
104 | 113 | ||
@@ -229,23 +238,24 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj, | |||
229 | struct net_device *net; | 238 | struct net_device *net; |
230 | struct net_device_context *ndev_ctx; | 239 | struct net_device_context *ndev_ctx; |
231 | struct netvsc_device *net_device; | 240 | struct netvsc_device *net_device; |
241 | struct rndis_device *rdev; | ||
232 | 242 | ||
233 | net_device = hv_get_drvdata(device_obj); | 243 | net_device = hv_get_drvdata(device_obj); |
244 | rdev = net_device->extension; | ||
245 | |||
246 | rdev->link_state = status != 1; | ||
247 | |||
234 | net = net_device->ndev; | 248 | net = net_device->ndev; |
235 | 249 | ||
236 | if (!net) { | 250 | if (!net || net->reg_state != NETREG_REGISTERED) |
237 | netdev_err(net, "got link status but net device " | ||
238 | "not initialized yet\n"); | ||
239 | return; | 251 | return; |
240 | } | ||
241 | 252 | ||
253 | ndev_ctx = netdev_priv(net); | ||
242 | if (status == 1) { | 254 | if (status == 1) { |
243 | netif_carrier_on(net); | ||
244 | ndev_ctx = netdev_priv(net); | ||
245 | schedule_delayed_work(&ndev_ctx->dwork, 0); | 255 | schedule_delayed_work(&ndev_ctx->dwork, 0); |
246 | schedule_delayed_work(&ndev_ctx->dwork, msecs_to_jiffies(20)); | 256 | schedule_delayed_work(&ndev_ctx->dwork, msecs_to_jiffies(20)); |
247 | } else { | 257 | } else { |
248 | netif_carrier_off(net); | 258 | schedule_delayed_work(&ndev_ctx->dwork, 0); |
249 | } | 259 | } |
250 | } | 260 | } |
251 | 261 | ||
@@ -388,17 +398,35 @@ static const struct net_device_ops device_ops = { | |||
388 | * current context when receiving RNDIS_STATUS_MEDIA_CONNECT event. So, add | 398 | * current context when receiving RNDIS_STATUS_MEDIA_CONNECT event. So, add |
389 | * another netif_notify_peers() into a delayed work, otherwise GARP packet | 399 | * another netif_notify_peers() into a delayed work, otherwise GARP packet |
390 | * will not be sent after quick migration, and cause network disconnection. | 400 | * will not be sent after quick migration, and cause network disconnection. |
401 | * Also, we update the carrier status here. | ||
391 | */ | 402 | */ |
392 | static void netvsc_send_garp(struct work_struct *w) | 403 | static void netvsc_link_change(struct work_struct *w) |
393 | { | 404 | { |
394 | struct net_device_context *ndev_ctx; | 405 | struct net_device_context *ndev_ctx; |
395 | struct net_device *net; | 406 | struct net_device *net; |
396 | struct netvsc_device *net_device; | 407 | struct netvsc_device *net_device; |
408 | struct rndis_device *rdev; | ||
409 | bool notify; | ||
410 | |||
411 | rtnl_lock(); | ||
397 | 412 | ||
398 | ndev_ctx = container_of(w, struct net_device_context, dwork.work); | 413 | ndev_ctx = container_of(w, struct net_device_context, dwork.work); |
399 | net_device = hv_get_drvdata(ndev_ctx->device_ctx); | 414 | net_device = hv_get_drvdata(ndev_ctx->device_ctx); |
415 | rdev = net_device->extension; | ||
400 | net = net_device->ndev; | 416 | net = net_device->ndev; |
401 | netdev_notify_peers(net); | 417 | |
418 | if (rdev->link_state) { | ||
419 | netif_carrier_off(net); | ||
420 | notify = false; | ||
421 | } else { | ||
422 | netif_carrier_on(net); | ||
423 | notify = true; | ||
424 | } | ||
425 | |||
426 | rtnl_unlock(); | ||
427 | |||
428 | if (notify) | ||
429 | netdev_notify_peers(net); | ||
402 | } | 430 | } |
403 | 431 | ||
404 | 432 | ||
@@ -414,13 +442,10 @@ static int netvsc_probe(struct hv_device *dev, | |||
414 | if (!net) | 442 | if (!net) |
415 | return -ENOMEM; | 443 | return -ENOMEM; |
416 | 444 | ||
417 | /* Set initial state */ | ||
418 | netif_carrier_off(net); | ||
419 | |||
420 | net_device_ctx = netdev_priv(net); | 445 | net_device_ctx = netdev_priv(net); |
421 | net_device_ctx->device_ctx = dev; | 446 | net_device_ctx->device_ctx = dev; |
422 | hv_set_drvdata(dev, net); | 447 | hv_set_drvdata(dev, net); |
423 | INIT_DELAYED_WORK(&net_device_ctx->dwork, netvsc_send_garp); | 448 | INIT_DELAYED_WORK(&net_device_ctx->dwork, netvsc_link_change); |
424 | INIT_WORK(&net_device_ctx->work, do_set_multicast); | 449 | INIT_WORK(&net_device_ctx->work, do_set_multicast); |
425 | 450 | ||
426 | net->netdev_ops = &device_ops; | 451 | net->netdev_ops = &device_ops; |
@@ -443,8 +468,6 @@ static int netvsc_probe(struct hv_device *dev, | |||
443 | } | 468 | } |
444 | memcpy(net->dev_addr, device_info.mac_adr, ETH_ALEN); | 469 | memcpy(net->dev_addr, device_info.mac_adr, ETH_ALEN); |
445 | 470 | ||
446 | netif_carrier_on(net); | ||
447 | |||
448 | ret = register_netdev(net); | 471 | ret = register_netdev(net); |
449 | if (ret != 0) { | 472 | if (ret != 0) { |
450 | pr_err("Unable to register netdev.\n"); | 473 | pr_err("Unable to register netdev.\n"); |
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c index 177441afeb96..24b6dddd7f2f 100644 --- a/drivers/net/irda/irtty-sir.c +++ b/drivers/net/irda/irtty-sir.c | |||
@@ -522,7 +522,6 @@ static void irtty_close(struct tty_struct *tty) | |||
522 | sirdev_put_instance(priv->dev); | 522 | sirdev_put_instance(priv->dev); |
523 | 523 | ||
524 | /* Stop tty */ | 524 | /* Stop tty */ |
525 | irtty_stop_receiver(tty, TRUE); | ||
526 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 525 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
527 | if (tty->ops->stop) | 526 | if (tty->ops->stop) |
528 | tty->ops->stop(tty); | 527 | tty->ops->stop(tty); |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 8433de4509c7..1831fb7cd017 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -506,6 +506,9 @@ static int macvlan_change_mtu(struct net_device *dev, int new_mtu) | |||
506 | static struct lock_class_key macvlan_netdev_xmit_lock_key; | 506 | static struct lock_class_key macvlan_netdev_xmit_lock_key; |
507 | static struct lock_class_key macvlan_netdev_addr_lock_key; | 507 | static struct lock_class_key macvlan_netdev_addr_lock_key; |
508 | 508 | ||
509 | #define ALWAYS_ON_FEATURES \ | ||
510 | (NETIF_F_SG | NETIF_F_GEN_CSUM | NETIF_F_GSO_SOFTWARE | NETIF_F_LLTX) | ||
511 | |||
509 | #define MACVLAN_FEATURES \ | 512 | #define MACVLAN_FEATURES \ |
510 | (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \ | 513 | (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \ |
511 | NETIF_F_GSO | NETIF_F_TSO | NETIF_F_UFO | NETIF_F_GSO_ROBUST | \ | 514 | NETIF_F_GSO | NETIF_F_TSO | NETIF_F_UFO | NETIF_F_GSO_ROBUST | \ |
@@ -539,7 +542,7 @@ static int macvlan_init(struct net_device *dev) | |||
539 | dev->state = (dev->state & ~MACVLAN_STATE_MASK) | | 542 | dev->state = (dev->state & ~MACVLAN_STATE_MASK) | |
540 | (lowerdev->state & MACVLAN_STATE_MASK); | 543 | (lowerdev->state & MACVLAN_STATE_MASK); |
541 | dev->features = lowerdev->features & MACVLAN_FEATURES; | 544 | dev->features = lowerdev->features & MACVLAN_FEATURES; |
542 | dev->features |= NETIF_F_LLTX; | 545 | dev->features |= ALWAYS_ON_FEATURES; |
543 | dev->gso_max_size = lowerdev->gso_max_size; | 546 | dev->gso_max_size = lowerdev->gso_max_size; |
544 | dev->iflink = lowerdev->ifindex; | 547 | dev->iflink = lowerdev->ifindex; |
545 | dev->hard_header_len = lowerdev->hard_header_len; | 548 | dev->hard_header_len = lowerdev->hard_header_len; |
@@ -699,7 +702,7 @@ static netdev_features_t macvlan_fix_features(struct net_device *dev, | |||
699 | features = netdev_increment_features(vlan->lowerdev->features, | 702 | features = netdev_increment_features(vlan->lowerdev->features, |
700 | features, | 703 | features, |
701 | mask); | 704 | mask); |
702 | features |= NETIF_F_LLTX; | 705 | features |= ALWAYS_ON_FEATURES; |
703 | 706 | ||
704 | return features; | 707 | return features; |
705 | } | 708 | } |
@@ -879,14 +882,15 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev, | |||
879 | dev->priv_flags |= IFF_MACVLAN; | 882 | dev->priv_flags |= IFF_MACVLAN; |
880 | err = netdev_upper_dev_link(lowerdev, dev); | 883 | err = netdev_upper_dev_link(lowerdev, dev); |
881 | if (err) | 884 | if (err) |
882 | goto destroy_port; | 885 | goto unregister_netdev; |
883 | |||
884 | 886 | ||
885 | list_add_tail_rcu(&vlan->list, &port->vlans); | 887 | list_add_tail_rcu(&vlan->list, &port->vlans); |
886 | netif_stacked_transfer_operstate(lowerdev, dev); | 888 | netif_stacked_transfer_operstate(lowerdev, dev); |
887 | 889 | ||
888 | return 0; | 890 | return 0; |
889 | 891 | ||
892 | unregister_netdev: | ||
893 | unregister_netdevice(dev); | ||
890 | destroy_port: | 894 | destroy_port: |
891 | port->count -= 1; | 895 | port->count -= 1; |
892 | if (!port->count) | 896 | if (!port->count) |
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index 9414fa272160..98e7cbf720a5 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c | |||
@@ -1006,11 +1006,6 @@ static int dp83640_probe(struct phy_device *phydev) | |||
1006 | } else | 1006 | } else |
1007 | list_add_tail(&dp83640->list, &clock->phylist); | 1007 | list_add_tail(&dp83640->list, &clock->phylist); |
1008 | 1008 | ||
1009 | if (clock->chosen && !list_empty(&clock->phylist)) | ||
1010 | recalibrate(clock); | ||
1011 | else | ||
1012 | enable_broadcast(dp83640->phydev, clock->page, 1); | ||
1013 | |||
1014 | dp83640_clock_put(clock); | 1009 | dp83640_clock_put(clock); |
1015 | return 0; | 1010 | return 0; |
1016 | 1011 | ||
@@ -1063,6 +1058,14 @@ static void dp83640_remove(struct phy_device *phydev) | |||
1063 | 1058 | ||
1064 | static int dp83640_config_init(struct phy_device *phydev) | 1059 | static int dp83640_config_init(struct phy_device *phydev) |
1065 | { | 1060 | { |
1061 | struct dp83640_private *dp83640 = phydev->priv; | ||
1062 | struct dp83640_clock *clock = dp83640->clock; | ||
1063 | |||
1064 | if (clock->chosen && !list_empty(&clock->phylist)) | ||
1065 | recalibrate(clock); | ||
1066 | else | ||
1067 | enable_broadcast(phydev, clock->page, 1); | ||
1068 | |||
1066 | enable_status_frames(phydev, true); | 1069 | enable_status_frames(phydev, true); |
1067 | ext_write(0, phydev, PAGE4, PTP_CTL, PTP_ENABLE); | 1070 | ext_write(0, phydev, PAGE4, PTP_CTL, PTP_ENABLE); |
1068 | return 0; | 1071 | return 0; |
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 82514e72b3d8..4b970f7624c0 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -916,6 +916,8 @@ int genphy_read_status(struct phy_device *phydev) | |||
916 | int err; | 916 | int err; |
917 | int lpa; | 917 | int lpa; |
918 | int lpagb = 0; | 918 | int lpagb = 0; |
919 | int common_adv; | ||
920 | int common_adv_gb = 0; | ||
919 | 921 | ||
920 | /* Update the link, but return if there was an error */ | 922 | /* Update the link, but return if there was an error */ |
921 | err = genphy_update_link(phydev); | 923 | err = genphy_update_link(phydev); |
@@ -937,7 +939,7 @@ int genphy_read_status(struct phy_device *phydev) | |||
937 | 939 | ||
938 | phydev->lp_advertising = | 940 | phydev->lp_advertising = |
939 | mii_stat1000_to_ethtool_lpa_t(lpagb); | 941 | mii_stat1000_to_ethtool_lpa_t(lpagb); |
940 | lpagb &= adv << 2; | 942 | common_adv_gb = lpagb & adv << 2; |
941 | } | 943 | } |
942 | 944 | ||
943 | lpa = phy_read(phydev, MII_LPA); | 945 | lpa = phy_read(phydev, MII_LPA); |
@@ -950,25 +952,25 @@ int genphy_read_status(struct phy_device *phydev) | |||
950 | if (adv < 0) | 952 | if (adv < 0) |
951 | return adv; | 953 | return adv; |
952 | 954 | ||
953 | lpa &= adv; | 955 | common_adv = lpa & adv; |
954 | 956 | ||
955 | phydev->speed = SPEED_10; | 957 | phydev->speed = SPEED_10; |
956 | phydev->duplex = DUPLEX_HALF; | 958 | phydev->duplex = DUPLEX_HALF; |
957 | phydev->pause = 0; | 959 | phydev->pause = 0; |
958 | phydev->asym_pause = 0; | 960 | phydev->asym_pause = 0; |
959 | 961 | ||
960 | if (lpagb & (LPA_1000FULL | LPA_1000HALF)) { | 962 | if (common_adv_gb & (LPA_1000FULL | LPA_1000HALF)) { |
961 | phydev->speed = SPEED_1000; | 963 | phydev->speed = SPEED_1000; |
962 | 964 | ||
963 | if (lpagb & LPA_1000FULL) | 965 | if (common_adv_gb & LPA_1000FULL) |
964 | phydev->duplex = DUPLEX_FULL; | 966 | phydev->duplex = DUPLEX_FULL; |
965 | } else if (lpa & (LPA_100FULL | LPA_100HALF)) { | 967 | } else if (common_adv & (LPA_100FULL | LPA_100HALF)) { |
966 | phydev->speed = SPEED_100; | 968 | phydev->speed = SPEED_100; |
967 | 969 | ||
968 | if (lpa & LPA_100FULL) | 970 | if (common_adv & LPA_100FULL) |
969 | phydev->duplex = DUPLEX_FULL; | 971 | phydev->duplex = DUPLEX_FULL; |
970 | } else | 972 | } else |
971 | if (lpa & LPA_10FULL) | 973 | if (common_adv & LPA_10FULL) |
972 | phydev->duplex = DUPLEX_FULL; | 974 | phydev->duplex = DUPLEX_FULL; |
973 | 975 | ||
974 | if (phydev->duplex == DUPLEX_FULL) { | 976 | if (phydev->duplex == DUPLEX_FULL) { |
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 28407426fd6f..c8624a8235ab 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c | |||
@@ -1648,7 +1648,7 @@ static netdev_tx_t team_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1648 | } | 1648 | } |
1649 | 1649 | ||
1650 | static u16 team_select_queue(struct net_device *dev, struct sk_buff *skb, | 1650 | static u16 team_select_queue(struct net_device *dev, struct sk_buff *skb, |
1651 | void *accel_priv) | 1651 | void *accel_priv, select_queue_fallback_t fallback) |
1652 | { | 1652 | { |
1653 | /* | 1653 | /* |
1654 | * This helper function exists to help dev_pick_tx get the correct | 1654 | * This helper function exists to help dev_pick_tx get the correct |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 44c4db8450f0..26f8635b027d 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -366,7 +366,7 @@ static inline void tun_flow_save_rps_rxhash(struct tun_flow_entry *e, u32 hash) | |||
366 | * hope the rxq no. may help here. | 366 | * hope the rxq no. may help here. |
367 | */ | 367 | */ |
368 | static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb, | 368 | static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb, |
369 | void *accel_priv) | 369 | void *accel_priv, select_queue_fallback_t fallback) |
370 | { | 370 | { |
371 | struct tun_struct *tun = netdev_priv(dev); | 371 | struct tun_struct *tun = netdev_priv(dev); |
372 | struct tun_flow_entry *e; | 372 | struct tun_flow_entry *e; |
@@ -1686,7 +1686,9 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
1686 | TUN_USER_FEATURES | NETIF_F_HW_VLAN_CTAG_TX | | 1686 | TUN_USER_FEATURES | NETIF_F_HW_VLAN_CTAG_TX | |
1687 | NETIF_F_HW_VLAN_STAG_TX; | 1687 | NETIF_F_HW_VLAN_STAG_TX; |
1688 | dev->features = dev->hw_features; | 1688 | dev->features = dev->hw_features; |
1689 | dev->vlan_features = dev->features; | 1689 | dev->vlan_features = dev->features & |
1690 | ~(NETIF_F_HW_VLAN_CTAG_TX | | ||
1691 | NETIF_F_HW_VLAN_STAG_TX); | ||
1690 | 1692 | ||
1691 | INIT_LIST_HEAD(&tun->disabled); | 1693 | INIT_LIST_HEAD(&tun->disabled); |
1692 | err = tun_attach(tun, file, false); | 1694 | err = tun_attach(tun, file, false); |
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index 409499fdb157..7e7269fd3707 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig | |||
@@ -296,7 +296,6 @@ config USB_NET_SR9800 | |||
296 | tristate "CoreChip-sz SR9800 based USB 2.0 10/100 ethernet devices" | 296 | tristate "CoreChip-sz SR9800 based USB 2.0 10/100 ethernet devices" |
297 | depends on USB_USBNET | 297 | depends on USB_USBNET |
298 | select CRC32 | 298 | select CRC32 |
299 | default y | ||
300 | ---help--- | 299 | ---help--- |
301 | Say Y if you want to use one of the following 100Mbps USB Ethernet | 300 | Say Y if you want to use one of the following 100Mbps USB Ethernet |
302 | device based on the CoreChip-sz SR9800 chip. | 301 | device based on the CoreChip-sz SR9800 chip. |
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c index 9765a7d4766d..5d194093f3e1 100644 --- a/drivers/net/usb/asix_devices.c +++ b/drivers/net/usb/asix_devices.c | |||
@@ -917,7 +917,8 @@ static const struct driver_info ax88178_info = { | |||
917 | .status = asix_status, | 917 | .status = asix_status, |
918 | .link_reset = ax88178_link_reset, | 918 | .link_reset = ax88178_link_reset, |
919 | .reset = ax88178_reset, | 919 | .reset = ax88178_reset, |
920 | .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR, | 920 | .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR | |
921 | FLAG_MULTI_PACKET, | ||
921 | .rx_fixup = asix_rx_fixup_common, | 922 | .rx_fixup = asix_rx_fixup_common, |
922 | .tx_fixup = asix_tx_fixup, | 923 | .tx_fixup = asix_tx_fixup, |
923 | }; | 924 | }; |
diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index d6f64dad05bc..054e59ca6946 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c | |||
@@ -1029,20 +1029,12 @@ static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1029 | dev->mii.phy_id = 0x03; | 1029 | dev->mii.phy_id = 0x03; |
1030 | dev->mii.supports_gmii = 1; | 1030 | dev->mii.supports_gmii = 1; |
1031 | 1031 | ||
1032 | if (usb_device_no_sg_constraint(dev->udev)) | ||
1033 | dev->can_dma_sg = 1; | ||
1034 | |||
1035 | dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | 1032 | dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
1036 | NETIF_F_RXCSUM; | 1033 | NETIF_F_RXCSUM; |
1037 | 1034 | ||
1038 | dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | 1035 | dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
1039 | NETIF_F_RXCSUM; | 1036 | NETIF_F_RXCSUM; |
1040 | 1037 | ||
1041 | if (dev->can_dma_sg) { | ||
1042 | dev->net->features |= NETIF_F_SG | NETIF_F_TSO; | ||
1043 | dev->net->hw_features |= NETIF_F_SG | NETIF_F_TSO; | ||
1044 | } | ||
1045 | |||
1046 | /* Enable checksum offload */ | 1038 | /* Enable checksum offload */ |
1047 | *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | | 1039 | *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | |
1048 | AX_RXCOE_TCPV6 | AX_RXCOE_UDPV6; | 1040 | AX_RXCOE_TCPV6 | AX_RXCOE_UDPV6; |
@@ -1118,6 +1110,10 @@ static int ax88179_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
1118 | u16 hdr_off; | 1110 | u16 hdr_off; |
1119 | u32 *pkt_hdr; | 1111 | u32 *pkt_hdr; |
1120 | 1112 | ||
1113 | /* This check is no longer done by usbnet */ | ||
1114 | if (skb->len < dev->net->hard_header_len) | ||
1115 | return 0; | ||
1116 | |||
1121 | skb_trim(skb, skb->len - 4); | 1117 | skb_trim(skb, skb->len - 4); |
1122 | memcpy(&rx_hdr, skb_tail_pointer(skb), 4); | 1118 | memcpy(&rx_hdr, skb_tail_pointer(skb), 4); |
1123 | le32_to_cpus(&rx_hdr); | 1119 | le32_to_cpus(&rx_hdr); |
@@ -1391,6 +1387,19 @@ static const struct driver_info ax88178a_info = { | |||
1391 | .tx_fixup = ax88179_tx_fixup, | 1387 | .tx_fixup = ax88179_tx_fixup, |
1392 | }; | 1388 | }; |
1393 | 1389 | ||
1390 | static const struct driver_info dlink_dub1312_info = { | ||
1391 | .description = "D-Link DUB-1312 USB 3.0 to Gigabit Ethernet Adapter", | ||
1392 | .bind = ax88179_bind, | ||
1393 | .unbind = ax88179_unbind, | ||
1394 | .status = ax88179_status, | ||
1395 | .link_reset = ax88179_link_reset, | ||
1396 | .reset = ax88179_reset, | ||
1397 | .stop = ax88179_stop, | ||
1398 | .flags = FLAG_ETHER | FLAG_FRAMING_AX, | ||
1399 | .rx_fixup = ax88179_rx_fixup, | ||
1400 | .tx_fixup = ax88179_tx_fixup, | ||
1401 | }; | ||
1402 | |||
1394 | static const struct driver_info sitecom_info = { | 1403 | static const struct driver_info sitecom_info = { |
1395 | .description = "Sitecom USB 3.0 to Gigabit Adapter", | 1404 | .description = "Sitecom USB 3.0 to Gigabit Adapter", |
1396 | .bind = ax88179_bind, | 1405 | .bind = ax88179_bind, |
@@ -1417,6 +1426,19 @@ static const struct driver_info samsung_info = { | |||
1417 | .tx_fixup = ax88179_tx_fixup, | 1426 | .tx_fixup = ax88179_tx_fixup, |
1418 | }; | 1427 | }; |
1419 | 1428 | ||
1429 | static const struct driver_info lenovo_info = { | ||
1430 | .description = "Lenovo OneLinkDock Gigabit LAN", | ||
1431 | .bind = ax88179_bind, | ||
1432 | .unbind = ax88179_unbind, | ||
1433 | .status = ax88179_status, | ||
1434 | .link_reset = ax88179_link_reset, | ||
1435 | .reset = ax88179_reset, | ||
1436 | .stop = ax88179_stop, | ||
1437 | .flags = FLAG_ETHER | FLAG_FRAMING_AX, | ||
1438 | .rx_fixup = ax88179_rx_fixup, | ||
1439 | .tx_fixup = ax88179_tx_fixup, | ||
1440 | }; | ||
1441 | |||
1420 | static const struct usb_device_id products[] = { | 1442 | static const struct usb_device_id products[] = { |
1421 | { | 1443 | { |
1422 | /* ASIX AX88179 10/100/1000 */ | 1444 | /* ASIX AX88179 10/100/1000 */ |
@@ -1427,6 +1449,10 @@ static const struct usb_device_id products[] = { | |||
1427 | USB_DEVICE(0x0b95, 0x178a), | 1449 | USB_DEVICE(0x0b95, 0x178a), |
1428 | .driver_info = (unsigned long)&ax88178a_info, | 1450 | .driver_info = (unsigned long)&ax88178a_info, |
1429 | }, { | 1451 | }, { |
1452 | /* D-Link DUB-1312 USB 3.0 to Gigabit Ethernet Adapter */ | ||
1453 | USB_DEVICE(0x2001, 0x4a00), | ||
1454 | .driver_info = (unsigned long)&dlink_dub1312_info, | ||
1455 | }, { | ||
1430 | /* Sitecom USB 3.0 to Gigabit Adapter */ | 1456 | /* Sitecom USB 3.0 to Gigabit Adapter */ |
1431 | USB_DEVICE(0x0df6, 0x0072), | 1457 | USB_DEVICE(0x0df6, 0x0072), |
1432 | .driver_info = (unsigned long)&sitecom_info, | 1458 | .driver_info = (unsigned long)&sitecom_info, |
@@ -1434,6 +1460,10 @@ static const struct usb_device_id products[] = { | |||
1434 | /* Samsung USB Ethernet Adapter */ | 1460 | /* Samsung USB Ethernet Adapter */ |
1435 | USB_DEVICE(0x04e8, 0xa100), | 1461 | USB_DEVICE(0x04e8, 0xa100), |
1436 | .driver_info = (unsigned long)&samsung_info, | 1462 | .driver_info = (unsigned long)&samsung_info, |
1463 | }, { | ||
1464 | /* Lenovo OneLinkDock Gigabit LAN */ | ||
1465 | USB_DEVICE(0x17ef, 0x304b), | ||
1466 | .driver_info = (unsigned long)&lenovo_info, | ||
1437 | }, | 1467 | }, |
1438 | { }, | 1468 | { }, |
1439 | }; | 1469 | }; |
diff --git a/drivers/net/usb/gl620a.c b/drivers/net/usb/gl620a.c index e4a8a93fbaf7..1cc24e6f23e2 100644 --- a/drivers/net/usb/gl620a.c +++ b/drivers/net/usb/gl620a.c | |||
@@ -84,6 +84,10 @@ static int genelink_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
84 | u32 size; | 84 | u32 size; |
85 | u32 count; | 85 | u32 count; |
86 | 86 | ||
87 | /* This check is no longer done by usbnet */ | ||
88 | if (skb->len < dev->net->hard_header_len) | ||
89 | return 0; | ||
90 | |||
87 | header = (struct gl_header *) skb->data; | 91 | header = (struct gl_header *) skb->data; |
88 | 92 | ||
89 | // get the packet count of the received skb | 93 | // get the packet count of the received skb |
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c index a305a7b2dae6..82d844a8ebd0 100644 --- a/drivers/net/usb/mcs7830.c +++ b/drivers/net/usb/mcs7830.c | |||
@@ -526,8 +526,9 @@ static int mcs7830_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
526 | { | 526 | { |
527 | u8 status; | 527 | u8 status; |
528 | 528 | ||
529 | if (skb->len == 0) { | 529 | /* This check is no longer done by usbnet */ |
530 | dev_err(&dev->udev->dev, "unexpected empty rx frame\n"); | 530 | if (skb->len < dev->net->hard_header_len) { |
531 | dev_err(&dev->udev->dev, "unexpected tiny rx frame\n"); | ||
531 | return 0; | 532 | return 0; |
532 | } | 533 | } |
533 | 534 | ||
diff --git a/drivers/net/usb/net1080.c b/drivers/net/usb/net1080.c index 0a85d9227775..4cbdb1307f3e 100644 --- a/drivers/net/usb/net1080.c +++ b/drivers/net/usb/net1080.c | |||
@@ -364,6 +364,10 @@ static int net1080_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
364 | struct nc_trailer *trailer; | 364 | struct nc_trailer *trailer; |
365 | u16 hdr_len, packet_len; | 365 | u16 hdr_len, packet_len; |
366 | 366 | ||
367 | /* This check is no longer done by usbnet */ | ||
368 | if (skb->len < dev->net->hard_header_len) | ||
369 | return 0; | ||
370 | |||
367 | if (!(skb->len & 0x01)) { | 371 | if (!(skb->len & 0x01)) { |
368 | netdev_dbg(dev->net, "rx framesize %d range %d..%d mtu %d\n", | 372 | netdev_dbg(dev->net, "rx framesize %d range %d..%d mtu %d\n", |
369 | skb->len, dev->net->hard_header_len, dev->hard_mtu, | 373 | skb->len, dev->net->hard_header_len, dev->hard_mtu, |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index ff5c87128ffe..313cb6cd4848 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -80,10 +80,10 @@ static int qmi_wwan_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
80 | { | 80 | { |
81 | __be16 proto; | 81 | __be16 proto; |
82 | 82 | ||
83 | /* usbnet rx_complete guarantees that skb->len is at least | 83 | /* This check is no longer done by usbnet */ |
84 | * hard_header_len, so we can inspect the dest address without | 84 | if (skb->len < dev->net->hard_header_len) |
85 | * checking skb->len | 85 | return 0; |
86 | */ | 86 | |
87 | switch (skb->data[0] & 0xf0) { | 87 | switch (skb->data[0] & 0xf0) { |
88 | case 0x40: | 88 | case 0x40: |
89 | proto = htons(ETH_P_IP); | 89 | proto = htons(ETH_P_IP); |
@@ -732,6 +732,7 @@ static const struct usb_device_id products[] = { | |||
732 | {QMI_FIXED_INTF(0x1bc7, 0x1201, 2)}, /* Telit LE920 */ | 732 | {QMI_FIXED_INTF(0x1bc7, 0x1201, 2)}, /* Telit LE920 */ |
733 | {QMI_FIXED_INTF(0x0b3c, 0xc005, 6)}, /* Olivetti Olicard 200 */ | 733 | {QMI_FIXED_INTF(0x0b3c, 0xc005, 6)}, /* Olivetti Olicard 200 */ |
734 | {QMI_FIXED_INTF(0x1e2d, 0x0060, 4)}, /* Cinterion PLxx */ | 734 | {QMI_FIXED_INTF(0x1e2d, 0x0060, 4)}, /* Cinterion PLxx */ |
735 | {QMI_FIXED_INTF(0x1e2d, 0x0053, 4)}, /* Cinterion PHxx,PXxx */ | ||
735 | 736 | ||
736 | /* 4. Gobi 1000 devices */ | 737 | /* 4. Gobi 1000 devices */ |
737 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ | 738 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ |
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c index a48bc0f20c1a..524a47a28120 100644 --- a/drivers/net/usb/rndis_host.c +++ b/drivers/net/usb/rndis_host.c | |||
@@ -492,6 +492,10 @@ EXPORT_SYMBOL_GPL(rndis_unbind); | |||
492 | */ | 492 | */ |
493 | int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | 493 | int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb) |
494 | { | 494 | { |
495 | /* This check is no longer done by usbnet */ | ||
496 | if (skb->len < dev->net->hard_header_len) | ||
497 | return 0; | ||
498 | |||
495 | /* peripheral may have batched packets to us... */ | 499 | /* peripheral may have batched packets to us... */ |
496 | while (likely(skb->len)) { | 500 | while (likely(skb->len)) { |
497 | struct rndis_data_hdr *hdr = (void *)skb->data; | 501 | struct rndis_data_hdr *hdr = (void *)skb->data; |
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index f17b9e02dd34..d9e7892262fa 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c | |||
@@ -2106,6 +2106,10 @@ static void smsc75xx_rx_csum_offload(struct usbnet *dev, struct sk_buff *skb, | |||
2106 | 2106 | ||
2107 | static int smsc75xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | 2107 | static int smsc75xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) |
2108 | { | 2108 | { |
2109 | /* This check is no longer done by usbnet */ | ||
2110 | if (skb->len < dev->net->hard_header_len) | ||
2111 | return 0; | ||
2112 | |||
2109 | while (skb->len > 0) { | 2113 | while (skb->len > 0) { |
2110 | u32 rx_cmd_a, rx_cmd_b, align_count, size; | 2114 | u32 rx_cmd_a, rx_cmd_b, align_count, size; |
2111 | struct sk_buff *ax_skb; | 2115 | struct sk_buff *ax_skb; |
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 8dd54a0f7b29..424db65e4396 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c | |||
@@ -1723,6 +1723,10 @@ static void smsc95xx_rx_csum_offload(struct sk_buff *skb) | |||
1723 | 1723 | ||
1724 | static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | 1724 | static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) |
1725 | { | 1725 | { |
1726 | /* This check is no longer done by usbnet */ | ||
1727 | if (skb->len < dev->net->hard_header_len) | ||
1728 | return 0; | ||
1729 | |||
1726 | while (skb->len > 0) { | 1730 | while (skb->len > 0) { |
1727 | u32 header, align_count; | 1731 | u32 header, align_count; |
1728 | struct sk_buff *ax_skb; | 1732 | struct sk_buff *ax_skb; |
diff --git a/drivers/net/usb/sr9800.c b/drivers/net/usb/sr9800.c index 4175eb9fdeca..b94a0fbb8b3b 100644 --- a/drivers/net/usb/sr9800.c +++ b/drivers/net/usb/sr9800.c | |||
@@ -63,6 +63,10 @@ static int sr_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
63 | { | 63 | { |
64 | int offset = 0; | 64 | int offset = 0; |
65 | 65 | ||
66 | /* This check is no longer done by usbnet */ | ||
67 | if (skb->len < dev->net->hard_header_len) | ||
68 | return 0; | ||
69 | |||
66 | while (offset + sizeof(u32) < skb->len) { | 70 | while (offset + sizeof(u32) < skb->len) { |
67 | struct sk_buff *sr_skb; | 71 | struct sk_buff *sr_skb; |
68 | u16 size; | 72 | u16 size; |
@@ -823,7 +827,7 @@ static int sr9800_bind(struct usbnet *dev, struct usb_interface *intf) | |||
823 | dev->rx_urb_size = | 827 | dev->rx_urb_size = |
824 | SR9800_BULKIN_SIZE[SR9800_MAX_BULKIN_2K].size; | 828 | SR9800_BULKIN_SIZE[SR9800_MAX_BULKIN_2K].size; |
825 | } | 829 | } |
826 | netdev_dbg(dev->net, "%s : setting rx_urb_size with : %ld\n", __func__, | 830 | netdev_dbg(dev->net, "%s : setting rx_urb_size with : %zu\n", __func__, |
827 | dev->rx_urb_size); | 831 | dev->rx_urb_size); |
828 | return 0; | 832 | return 0; |
829 | 833 | ||
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 4671da755e7b..dd10d5817d2a 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -542,17 +542,19 @@ static inline void rx_process (struct usbnet *dev, struct sk_buff *skb) | |||
542 | } | 542 | } |
543 | // else network stack removes extra byte if we forced a short packet | 543 | // else network stack removes extra byte if we forced a short packet |
544 | 544 | ||
545 | if (skb->len) { | 545 | /* all data was already cloned from skb inside the driver */ |
546 | /* all data was already cloned from skb inside the driver */ | 546 | if (dev->driver_info->flags & FLAG_MULTI_PACKET) |
547 | if (dev->driver_info->flags & FLAG_MULTI_PACKET) | 547 | goto done; |
548 | dev_kfree_skb_any(skb); | 548 | |
549 | else | 549 | if (skb->len < ETH_HLEN) { |
550 | usbnet_skb_return(dev, skb); | 550 | dev->net->stats.rx_errors++; |
551 | dev->net->stats.rx_length_errors++; | ||
552 | netif_dbg(dev, rx_err, dev->net, "rx length %d\n", skb->len); | ||
553 | } else { | ||
554 | usbnet_skb_return(dev, skb); | ||
551 | return; | 555 | return; |
552 | } | 556 | } |
553 | 557 | ||
554 | netif_dbg(dev, rx_err, dev->net, "drop\n"); | ||
555 | dev->net->stats.rx_errors++; | ||
556 | done: | 558 | done: |
557 | skb_queue_tail(&dev->done, skb); | 559 | skb_queue_tail(&dev->done, skb); |
558 | } | 560 | } |
@@ -574,13 +576,6 @@ static void rx_complete (struct urb *urb) | |||
574 | switch (urb_status) { | 576 | switch (urb_status) { |
575 | /* success */ | 577 | /* success */ |
576 | case 0: | 578 | case 0: |
577 | if (skb->len < dev->net->hard_header_len) { | ||
578 | state = rx_cleanup; | ||
579 | dev->net->stats.rx_errors++; | ||
580 | dev->net->stats.rx_length_errors++; | ||
581 | netif_dbg(dev, rx_err, dev->net, | ||
582 | "rx length %d\n", skb->len); | ||
583 | } | ||
584 | break; | 579 | break; |
585 | 580 | ||
586 | /* stalls need manual reset. this is rare ... except that | 581 | /* stalls need manual reset. this is rare ... except that |
diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 2ec2041b62d4..5b374370f71c 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c | |||
@@ -285,7 +285,8 @@ static void veth_setup(struct net_device *dev) | |||
285 | dev->ethtool_ops = &veth_ethtool_ops; | 285 | dev->ethtool_ops = &veth_ethtool_ops; |
286 | dev->features |= NETIF_F_LLTX; | 286 | dev->features |= NETIF_F_LLTX; |
287 | dev->features |= VETH_FEATURES; | 287 | dev->features |= VETH_FEATURES; |
288 | dev->vlan_features = dev->features; | 288 | dev->vlan_features = dev->features & |
289 | ~(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX); | ||
289 | dev->destructor = veth_dev_free; | 290 | dev->destructor = veth_dev_free; |
290 | 291 | ||
291 | dev->hw_features = VETH_FEATURES; | 292 | dev->hw_features = VETH_FEATURES; |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index d75f8edf4fb3..5632a99cbbd2 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -1711,7 +1711,8 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
1711 | /* If we can receive ANY GSO packets, we must allocate large ones. */ | 1711 | /* If we can receive ANY GSO packets, we must allocate large ones. */ |
1712 | if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) || | 1712 | if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) || |
1713 | virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6) || | 1713 | virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6) || |
1714 | virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN)) | 1714 | virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN) || |
1715 | virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_UFO)) | ||
1715 | vi->big_packets = true; | 1716 | vi->big_packets = true; |
1716 | 1717 | ||
1717 | if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF)) | 1718 | if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF)) |
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c index d6bc7cb61bfb..1a2973b7acf2 100644 --- a/drivers/net/wireless/ath/ath5k/phy.c +++ b/drivers/net/wireless/ath/ath5k/phy.c | |||
@@ -110,7 +110,7 @@ ath5k_hw_radio_revision(struct ath5k_hw *ah, enum ieee80211_band band) | |||
110 | ath5k_hw_reg_write(ah, 0x00010000, AR5K_PHY(0x20)); | 110 | ath5k_hw_reg_write(ah, 0x00010000, AR5K_PHY(0x20)); |
111 | 111 | ||
112 | if (ah->ah_version == AR5K_AR5210) { | 112 | if (ah->ah_version == AR5K_AR5210) { |
113 | srev = ath5k_hw_reg_read(ah, AR5K_PHY(256) >> 28) & 0xf; | 113 | srev = (ath5k_hw_reg_read(ah, AR5K_PHY(256)) >> 28) & 0xf; |
114 | ret = (u16)ath5k_hw_bitswap(srev, 4) + 1; | 114 | ret = (u16)ath5k_hw_bitswap(srev, 4) + 1; |
115 | } else { | 115 | } else { |
116 | srev = (ath5k_hw_reg_read(ah, AR5K_PHY(0x100)) >> 24) & 0xff; | 116 | srev = (ath5k_hw_reg_read(ah, AR5K_PHY(0x100)) >> 24) & 0xff; |
diff --git a/drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h b/drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h index 1cc13569b17b..1b6b4d0cfa97 100644 --- a/drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9462_2p0_initvals.h | |||
@@ -57,7 +57,7 @@ static const u32 ar9462_2p0_baseband_postamble[][5] = { | |||
57 | {0x00009e14, 0x37b95d5e, 0x37b9605e, 0x3236605e, 0x32365a5e}, | 57 | {0x00009e14, 0x37b95d5e, 0x37b9605e, 0x3236605e, 0x32365a5e}, |
58 | {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 58 | {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
59 | {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, | 59 | {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, |
60 | {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, | 60 | {0x00009e20, 0x000003a5, 0x000003a5, 0x000003a5, 0x000003a5}, |
61 | {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, | 61 | {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, |
62 | {0x00009e3c, 0xcf946220, 0xcf946220, 0xcfd5c782, 0xcfd5c282}, | 62 | {0x00009e3c, 0xcf946220, 0xcf946220, 0xcfd5c782, 0xcfd5c282}, |
63 | {0x00009e44, 0x62321e27, 0x62321e27, 0xfe291e27, 0xfe291e27}, | 63 | {0x00009e44, 0x62321e27, 0x62321e27, 0xfe291e27, 0xfe291e27}, |
@@ -96,7 +96,7 @@ static const u32 ar9462_2p0_baseband_postamble[][5] = { | |||
96 | {0x0000ae04, 0x001c0000, 0x001c0000, 0x001c0000, 0x00100000}, | 96 | {0x0000ae04, 0x001c0000, 0x001c0000, 0x001c0000, 0x00100000}, |
97 | {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 97 | {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
98 | {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, | 98 | {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, |
99 | {0x0000ae20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, | 99 | {0x0000ae20, 0x000001a6, 0x000001a6, 0x000001aa, 0x000001aa}, |
100 | {0x0000b284, 0x00000000, 0x00000000, 0x00000550, 0x00000550}, | 100 | {0x0000b284, 0x00000000, 0x00000000, 0x00000550, 0x00000550}, |
101 | }; | 101 | }; |
102 | 102 | ||
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 11eab9f01fd8..303ce27964c1 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -1534,7 +1534,7 @@ EXPORT_SYMBOL(ath9k_hw_check_nav); | |||
1534 | bool ath9k_hw_check_alive(struct ath_hw *ah) | 1534 | bool ath9k_hw_check_alive(struct ath_hw *ah) |
1535 | { | 1535 | { |
1536 | int count = 50; | 1536 | int count = 50; |
1537 | u32 reg; | 1537 | u32 reg, last_val; |
1538 | 1538 | ||
1539 | if (AR_SREV_9300(ah)) | 1539 | if (AR_SREV_9300(ah)) |
1540 | return !ath9k_hw_detect_mac_hang(ah); | 1540 | return !ath9k_hw_detect_mac_hang(ah); |
@@ -1542,9 +1542,13 @@ bool ath9k_hw_check_alive(struct ath_hw *ah) | |||
1542 | if (AR_SREV_9285_12_OR_LATER(ah)) | 1542 | if (AR_SREV_9285_12_OR_LATER(ah)) |
1543 | return true; | 1543 | return true; |
1544 | 1544 | ||
1545 | last_val = REG_READ(ah, AR_OBS_BUS_1); | ||
1545 | do { | 1546 | do { |
1546 | reg = REG_READ(ah, AR_OBS_BUS_1); | 1547 | reg = REG_READ(ah, AR_OBS_BUS_1); |
1548 | if (reg != last_val) | ||
1549 | return true; | ||
1547 | 1550 | ||
1551 | last_val = reg; | ||
1548 | if ((reg & 0x7E7FFFEF) == 0x00702400) | 1552 | if ((reg & 0x7E7FFFEF) == 0x00702400) |
1549 | continue; | 1553 | continue; |
1550 | 1554 | ||
@@ -1556,6 +1560,8 @@ bool ath9k_hw_check_alive(struct ath_hw *ah) | |||
1556 | default: | 1560 | default: |
1557 | return true; | 1561 | return true; |
1558 | } | 1562 | } |
1563 | |||
1564 | udelay(1); | ||
1559 | } while (count-- > 0); | 1565 | } while (count-- > 0); |
1560 | 1566 | ||
1561 | return false; | 1567 | return false; |
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index a0ebdd000fc2..82e340d3ec60 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -732,11 +732,18 @@ static struct ath_rxbuf *ath_get_next_rx_buf(struct ath_softc *sc, | |||
732 | return NULL; | 732 | return NULL; |
733 | 733 | ||
734 | /* | 734 | /* |
735 | * mark descriptor as zero-length and set the 'more' | 735 | * Re-check previous descriptor, in case it has been filled |
736 | * flag to ensure that both buffers get discarded | 736 | * in the mean time. |
737 | */ | 737 | */ |
738 | rs->rs_datalen = 0; | 738 | ret = ath9k_hw_rxprocdesc(ah, ds, rs); |
739 | rs->rs_more = true; | 739 | if (ret == -EINPROGRESS) { |
740 | /* | ||
741 | * mark descriptor as zero-length and set the 'more' | ||
742 | * flag to ensure that both buffers get discarded | ||
743 | */ | ||
744 | rs->rs_datalen = 0; | ||
745 | rs->rs_more = true; | ||
746 | } | ||
740 | } | 747 | } |
741 | 748 | ||
742 | list_del(&bf->list); | 749 | list_del(&bf->list); |
@@ -985,32 +992,32 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc, | |||
985 | struct ath_common *common = ath9k_hw_common(ah); | 992 | struct ath_common *common = ath9k_hw_common(ah); |
986 | struct ieee80211_hdr *hdr; | 993 | struct ieee80211_hdr *hdr; |
987 | bool discard_current = sc->rx.discard_next; | 994 | bool discard_current = sc->rx.discard_next; |
988 | int ret = 0; | ||
989 | 995 | ||
990 | /* | 996 | /* |
991 | * Discard corrupt descriptors which are marked in | 997 | * Discard corrupt descriptors which are marked in |
992 | * ath_get_next_rx_buf(). | 998 | * ath_get_next_rx_buf(). |
993 | */ | 999 | */ |
994 | sc->rx.discard_next = rx_stats->rs_more; | ||
995 | if (discard_current) | 1000 | if (discard_current) |
996 | return -EINVAL; | 1001 | goto corrupt; |
1002 | |||
1003 | sc->rx.discard_next = false; | ||
997 | 1004 | ||
998 | /* | 1005 | /* |
999 | * Discard zero-length packets. | 1006 | * Discard zero-length packets. |
1000 | */ | 1007 | */ |
1001 | if (!rx_stats->rs_datalen) { | 1008 | if (!rx_stats->rs_datalen) { |
1002 | RX_STAT_INC(rx_len_err); | 1009 | RX_STAT_INC(rx_len_err); |
1003 | return -EINVAL; | 1010 | goto corrupt; |
1004 | } | 1011 | } |
1005 | 1012 | ||
1006 | /* | 1013 | /* |
1007 | * rs_status follows rs_datalen so if rs_datalen is too large | 1014 | * rs_status follows rs_datalen so if rs_datalen is too large |
1008 | * we can take a hint that hardware corrupted it, so ignore | 1015 | * we can take a hint that hardware corrupted it, so ignore |
1009 | * those frames. | 1016 | * those frames. |
1010 | */ | 1017 | */ |
1011 | if (rx_stats->rs_datalen > (common->rx_bufsize - ah->caps.rx_status_len)) { | 1018 | if (rx_stats->rs_datalen > (common->rx_bufsize - ah->caps.rx_status_len)) { |
1012 | RX_STAT_INC(rx_len_err); | 1019 | RX_STAT_INC(rx_len_err); |
1013 | return -EINVAL; | 1020 | goto corrupt; |
1014 | } | 1021 | } |
1015 | 1022 | ||
1016 | /* Only use status info from the last fragment */ | 1023 | /* Only use status info from the last fragment */ |
@@ -1024,10 +1031,8 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc, | |||
1024 | * This is different from the other corrupt descriptor | 1031 | * This is different from the other corrupt descriptor |
1025 | * condition handled above. | 1032 | * condition handled above. |
1026 | */ | 1033 | */ |
1027 | if (rx_stats->rs_status & ATH9K_RXERR_CORRUPT_DESC) { | 1034 | if (rx_stats->rs_status & ATH9K_RXERR_CORRUPT_DESC) |
1028 | ret = -EINVAL; | 1035 | goto corrupt; |
1029 | goto exit; | ||
1030 | } | ||
1031 | 1036 | ||
1032 | hdr = (struct ieee80211_hdr *) (skb->data + ah->caps.rx_status_len); | 1037 | hdr = (struct ieee80211_hdr *) (skb->data + ah->caps.rx_status_len); |
1033 | 1038 | ||
@@ -1043,18 +1048,15 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc, | |||
1043 | if (ath_process_fft(sc, hdr, rx_stats, rx_status->mactime)) | 1048 | if (ath_process_fft(sc, hdr, rx_stats, rx_status->mactime)) |
1044 | RX_STAT_INC(rx_spectral); | 1049 | RX_STAT_INC(rx_spectral); |
1045 | 1050 | ||
1046 | ret = -EINVAL; | 1051 | return -EINVAL; |
1047 | goto exit; | ||
1048 | } | 1052 | } |
1049 | 1053 | ||
1050 | /* | 1054 | /* |
1051 | * everything but the rate is checked here, the rate check is done | 1055 | * everything but the rate is checked here, the rate check is done |
1052 | * separately to avoid doing two lookups for a rate for each frame. | 1056 | * separately to avoid doing two lookups for a rate for each frame. |
1053 | */ | 1057 | */ |
1054 | if (!ath9k_rx_accept(common, hdr, rx_status, rx_stats, decrypt_error)) { | 1058 | if (!ath9k_rx_accept(common, hdr, rx_status, rx_stats, decrypt_error)) |
1055 | ret = -EINVAL; | 1059 | return -EINVAL; |
1056 | goto exit; | ||
1057 | } | ||
1058 | 1060 | ||
1059 | if (ath_is_mybeacon(common, hdr)) { | 1061 | if (ath_is_mybeacon(common, hdr)) { |
1060 | RX_STAT_INC(rx_beacons); | 1062 | RX_STAT_INC(rx_beacons); |
@@ -1064,15 +1066,11 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc, | |||
1064 | /* | 1066 | /* |
1065 | * This shouldn't happen, but have a safety check anyway. | 1067 | * This shouldn't happen, but have a safety check anyway. |
1066 | */ | 1068 | */ |
1067 | if (WARN_ON(!ah->curchan)) { | 1069 | if (WARN_ON(!ah->curchan)) |
1068 | ret = -EINVAL; | 1070 | return -EINVAL; |
1069 | goto exit; | ||
1070 | } | ||
1071 | 1071 | ||
1072 | if (ath9k_process_rate(common, hw, rx_stats, rx_status)) { | 1072 | if (ath9k_process_rate(common, hw, rx_stats, rx_status)) |
1073 | ret =-EINVAL; | 1073 | return -EINVAL; |
1074 | goto exit; | ||
1075 | } | ||
1076 | 1074 | ||
1077 | ath9k_process_rssi(common, hw, rx_stats, rx_status); | 1075 | ath9k_process_rssi(common, hw, rx_stats, rx_status); |
1078 | 1076 | ||
@@ -1087,9 +1085,11 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc, | |||
1087 | sc->rx.num_pkts++; | 1085 | sc->rx.num_pkts++; |
1088 | #endif | 1086 | #endif |
1089 | 1087 | ||
1090 | exit: | 1088 | return 0; |
1091 | sc->rx.discard_next = false; | 1089 | |
1092 | return ret; | 1090 | corrupt: |
1091 | sc->rx.discard_next = rx_stats->rs_more; | ||
1092 | return -EINVAL; | ||
1093 | } | 1093 | } |
1094 | 1094 | ||
1095 | static void ath9k_rx_skb_postprocess(struct ath_common *common, | 1095 | static void ath9k_rx_skb_postprocess(struct ath_common *common, |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 0a75e2f68c9d..f042a18c8495 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -1444,14 +1444,16 @@ void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc, | |||
1444 | for (tidno = 0, tid = &an->tid[tidno]; | 1444 | for (tidno = 0, tid = &an->tid[tidno]; |
1445 | tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { | 1445 | tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { |
1446 | 1446 | ||
1447 | if (!tid->sched) | ||
1448 | continue; | ||
1449 | |||
1450 | ac = tid->ac; | 1447 | ac = tid->ac; |
1451 | txq = ac->txq; | 1448 | txq = ac->txq; |
1452 | 1449 | ||
1453 | ath_txq_lock(sc, txq); | 1450 | ath_txq_lock(sc, txq); |
1454 | 1451 | ||
1452 | if (!tid->sched) { | ||
1453 | ath_txq_unlock(sc, txq); | ||
1454 | continue; | ||
1455 | } | ||
1456 | |||
1455 | buffered = ath_tid_has_buffered(tid); | 1457 | buffered = ath_tid_has_buffered(tid); |
1456 | 1458 | ||
1457 | tid->sched = false; | 1459 | tid->sched = false; |
@@ -2184,14 +2186,15 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
2184 | txq->stopped = true; | 2186 | txq->stopped = true; |
2185 | } | 2187 | } |
2186 | 2188 | ||
2189 | if (txctl->an) | ||
2190 | tid = ath_get_skb_tid(sc, txctl->an, skb); | ||
2191 | |||
2187 | if (info->flags & IEEE80211_TX_CTL_PS_RESPONSE) { | 2192 | if (info->flags & IEEE80211_TX_CTL_PS_RESPONSE) { |
2188 | ath_txq_unlock(sc, txq); | 2193 | ath_txq_unlock(sc, txq); |
2189 | txq = sc->tx.uapsdq; | 2194 | txq = sc->tx.uapsdq; |
2190 | ath_txq_lock(sc, txq); | 2195 | ath_txq_lock(sc, txq); |
2191 | } else if (txctl->an && | 2196 | } else if (txctl->an && |
2192 | ieee80211_is_data_present(hdr->frame_control)) { | 2197 | ieee80211_is_data_present(hdr->frame_control)) { |
2193 | tid = ath_get_skb_tid(sc, txctl->an, skb); | ||
2194 | |||
2195 | WARN_ON(tid->ac->txq != txctl->txq); | 2198 | WARN_ON(tid->ac->txq != txctl->txq); |
2196 | 2199 | ||
2197 | if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT) | 2200 | if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT) |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c index 3e991897d7ca..119ee6eaf1c3 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | |||
@@ -457,7 +457,6 @@ struct brcmf_sdio { | |||
457 | 457 | ||
458 | u8 tx_hdrlen; /* sdio bus header length for tx packet */ | 458 | u8 tx_hdrlen; /* sdio bus header length for tx packet */ |
459 | bool txglom; /* host tx glomming enable flag */ | 459 | bool txglom; /* host tx glomming enable flag */ |
460 | struct sk_buff *txglom_sgpad; /* scatter-gather padding buffer */ | ||
461 | u16 head_align; /* buffer pointer alignment */ | 460 | u16 head_align; /* buffer pointer alignment */ |
462 | u16 sgentry_align; /* scatter-gather buffer alignment */ | 461 | u16 sgentry_align; /* scatter-gather buffer alignment */ |
463 | }; | 462 | }; |
@@ -1944,9 +1943,8 @@ static int brcmf_sdio_txpkt_prep_sg(struct brcmf_sdio *bus, | |||
1944 | if (lastfrm && chain_pad) | 1943 | if (lastfrm && chain_pad) |
1945 | tail_pad += blksize - chain_pad; | 1944 | tail_pad += blksize - chain_pad; |
1946 | if (skb_tailroom(pkt) < tail_pad && pkt->len > blksize) { | 1945 | if (skb_tailroom(pkt) < tail_pad && pkt->len > blksize) { |
1947 | pkt_pad = bus->txglom_sgpad; | 1946 | pkt_pad = brcmu_pkt_buf_get_skb(tail_pad + tail_chop + |
1948 | if (pkt_pad == NULL) | 1947 | bus->head_align); |
1949 | brcmu_pkt_buf_get_skb(tail_pad + tail_chop); | ||
1950 | if (pkt_pad == NULL) | 1948 | if (pkt_pad == NULL) |
1951 | return -ENOMEM; | 1949 | return -ENOMEM; |
1952 | ret = brcmf_sdio_txpkt_hdalign(bus, pkt_pad); | 1950 | ret = brcmf_sdio_txpkt_hdalign(bus, pkt_pad); |
@@ -1957,6 +1955,7 @@ static int brcmf_sdio_txpkt_prep_sg(struct brcmf_sdio *bus, | |||
1957 | tail_chop); | 1955 | tail_chop); |
1958 | *(u32 *)(pkt_pad->cb) = ALIGN_SKB_FLAG + tail_chop; | 1956 | *(u32 *)(pkt_pad->cb) = ALIGN_SKB_FLAG + tail_chop; |
1959 | skb_trim(pkt, pkt->len - tail_chop); | 1957 | skb_trim(pkt, pkt->len - tail_chop); |
1958 | skb_trim(pkt_pad, tail_pad + tail_chop); | ||
1960 | __skb_queue_after(pktq, pkt, pkt_pad); | 1959 | __skb_queue_after(pktq, pkt, pkt_pad); |
1961 | } else { | 1960 | } else { |
1962 | ntail = pkt->data_len + tail_pad - | 1961 | ntail = pkt->data_len + tail_pad - |
@@ -2011,7 +2010,7 @@ brcmf_sdio_txpkt_prep(struct brcmf_sdio *bus, struct sk_buff_head *pktq, | |||
2011 | return ret; | 2010 | return ret; |
2012 | head_pad = (u16)ret; | 2011 | head_pad = (u16)ret; |
2013 | if (head_pad) | 2012 | if (head_pad) |
2014 | memset(pkt_next->data, 0, head_pad + bus->tx_hdrlen); | 2013 | memset(pkt_next->data + bus->tx_hdrlen, 0, head_pad); |
2015 | 2014 | ||
2016 | total_len += pkt_next->len; | 2015 | total_len += pkt_next->len; |
2017 | 2016 | ||
@@ -3486,10 +3485,6 @@ static int brcmf_sdio_bus_preinit(struct device *dev) | |||
3486 | bus->txglom = false; | 3485 | bus->txglom = false; |
3487 | value = 1; | 3486 | value = 1; |
3488 | pad_size = bus->sdiodev->func[2]->cur_blksize << 1; | 3487 | pad_size = bus->sdiodev->func[2]->cur_blksize << 1; |
3489 | bus->txglom_sgpad = brcmu_pkt_buf_get_skb(pad_size); | ||
3490 | if (!bus->txglom_sgpad) | ||
3491 | brcmf_err("allocating txglom padding skb failed, reduced performance\n"); | ||
3492 | |||
3493 | err = brcmf_iovar_data_set(bus->sdiodev->dev, "bus:rxglom", | 3488 | err = brcmf_iovar_data_set(bus->sdiodev->dev, "bus:rxglom", |
3494 | &value, sizeof(u32)); | 3489 | &value, sizeof(u32)); |
3495 | if (err < 0) { | 3490 | if (err < 0) { |
@@ -4053,7 +4048,6 @@ void brcmf_sdio_remove(struct brcmf_sdio *bus) | |||
4053 | brcmf_sdio_chip_detach(&bus->ci); | 4048 | brcmf_sdio_chip_detach(&bus->ci); |
4054 | } | 4049 | } |
4055 | 4050 | ||
4056 | brcmu_pkt_buf_free_skb(bus->txglom_sgpad); | ||
4057 | kfree(bus->rxbuf); | 4051 | kfree(bus->rxbuf); |
4058 | kfree(bus->hdrbuf); | 4052 | kfree(bus->hdrbuf); |
4059 | kfree(bus); | 4053 | kfree(bus); |
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c index d36e252d2ccb..596525528f50 100644 --- a/drivers/net/wireless/hostap/hostap_ap.c +++ b/drivers/net/wireless/hostap/hostap_ap.c | |||
@@ -147,7 +147,7 @@ static void ap_free_sta(struct ap_data *ap, struct sta_info *sta) | |||
147 | 147 | ||
148 | if (!sta->ap && sta->u.sta.challenge) | 148 | if (!sta->ap && sta->u.sta.challenge) |
149 | kfree(sta->u.sta.challenge); | 149 | kfree(sta->u.sta.challenge); |
150 | del_timer(&sta->timer); | 150 | del_timer_sync(&sta->timer); |
151 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ | 151 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ |
152 | 152 | ||
153 | kfree(sta); | 153 | kfree(sta); |
diff --git a/drivers/net/wireless/hostap/hostap_proc.c b/drivers/net/wireless/hostap/hostap_proc.c index aa7ad3a7a69b..4e5c0f8c9496 100644 --- a/drivers/net/wireless/hostap/hostap_proc.c +++ b/drivers/net/wireless/hostap/hostap_proc.c | |||
@@ -496,7 +496,7 @@ void hostap_init_proc(local_info_t *local) | |||
496 | 496 | ||
497 | void hostap_remove_proc(local_info_t *local) | 497 | void hostap_remove_proc(local_info_t *local) |
498 | { | 498 | { |
499 | remove_proc_subtree(local->ddev->name, hostap_proc); | 499 | proc_remove(local->proc); |
500 | } | 500 | } |
501 | 501 | ||
502 | 502 | ||
diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/iwlwifi/dvm/mac80211.c index c24d1d3d55f6..73086c1629ca 100644 --- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c | |||
@@ -696,6 +696,24 @@ static int iwlagn_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
696 | return ret; | 696 | return ret; |
697 | } | 697 | } |
698 | 698 | ||
699 | static inline bool iwl_enable_rx_ampdu(const struct iwl_cfg *cfg) | ||
700 | { | ||
701 | if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_RXAGG) | ||
702 | return false; | ||
703 | return true; | ||
704 | } | ||
705 | |||
706 | static inline bool iwl_enable_tx_ampdu(const struct iwl_cfg *cfg) | ||
707 | { | ||
708 | if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_TXAGG) | ||
709 | return false; | ||
710 | if (iwlwifi_mod_params.disable_11n & IWL_ENABLE_HT_TXAGG) | ||
711 | return true; | ||
712 | |||
713 | /* disabled by default */ | ||
714 | return false; | ||
715 | } | ||
716 | |||
699 | static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw, | 717 | static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw, |
700 | struct ieee80211_vif *vif, | 718 | struct ieee80211_vif *vif, |
701 | enum ieee80211_ampdu_mlme_action action, | 719 | enum ieee80211_ampdu_mlme_action action, |
@@ -717,7 +735,7 @@ static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw, | |||
717 | 735 | ||
718 | switch (action) { | 736 | switch (action) { |
719 | case IEEE80211_AMPDU_RX_START: | 737 | case IEEE80211_AMPDU_RX_START: |
720 | if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_RXAGG) | 738 | if (!iwl_enable_rx_ampdu(priv->cfg)) |
721 | break; | 739 | break; |
722 | IWL_DEBUG_HT(priv, "start Rx\n"); | 740 | IWL_DEBUG_HT(priv, "start Rx\n"); |
723 | ret = iwl_sta_rx_agg_start(priv, sta, tid, *ssn); | 741 | ret = iwl_sta_rx_agg_start(priv, sta, tid, *ssn); |
@@ -729,7 +747,7 @@ static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw, | |||
729 | case IEEE80211_AMPDU_TX_START: | 747 | case IEEE80211_AMPDU_TX_START: |
730 | if (!priv->trans->ops->txq_enable) | 748 | if (!priv->trans->ops->txq_enable) |
731 | break; | 749 | break; |
732 | if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_TXAGG) | 750 | if (!iwl_enable_tx_ampdu(priv->cfg)) |
733 | break; | 751 | break; |
734 | IWL_DEBUG_HT(priv, "start Tx\n"); | 752 | IWL_DEBUG_HT(priv, "start Tx\n"); |
735 | ret = iwlagn_tx_agg_start(priv, vif, sta, tid, ssn); | 753 | ret = iwlagn_tx_agg_start(priv, vif, sta, tid, ssn); |
diff --git a/drivers/net/wireless/iwlwifi/dvm/sta.c b/drivers/net/wireless/iwlwifi/dvm/sta.c index c0d070c5df5e..9cdd91cdf661 100644 --- a/drivers/net/wireless/iwlwifi/dvm/sta.c +++ b/drivers/net/wireless/iwlwifi/dvm/sta.c | |||
@@ -590,6 +590,7 @@ void iwl_deactivate_station(struct iwl_priv *priv, const u8 sta_id, | |||
590 | sizeof(priv->tid_data[sta_id][tid])); | 590 | sizeof(priv->tid_data[sta_id][tid])); |
591 | 591 | ||
592 | priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; | 592 | priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; |
593 | priv->stations[sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; | ||
593 | 594 | ||
594 | priv->num_stations--; | 595 | priv->num_stations--; |
595 | 596 | ||
diff --git a/drivers/net/wireless/iwlwifi/dvm/tx.c b/drivers/net/wireless/iwlwifi/dvm/tx.c index a6839dfcb82d..398dd096674c 100644 --- a/drivers/net/wireless/iwlwifi/dvm/tx.c +++ b/drivers/net/wireless/iwlwifi/dvm/tx.c | |||
@@ -1291,8 +1291,6 @@ int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv, | |||
1291 | struct iwl_compressed_ba_resp *ba_resp = (void *)pkt->data; | 1291 | struct iwl_compressed_ba_resp *ba_resp = (void *)pkt->data; |
1292 | struct iwl_ht_agg *agg; | 1292 | struct iwl_ht_agg *agg; |
1293 | struct sk_buff_head reclaimed_skbs; | 1293 | struct sk_buff_head reclaimed_skbs; |
1294 | struct ieee80211_tx_info *info; | ||
1295 | struct ieee80211_hdr *hdr; | ||
1296 | struct sk_buff *skb; | 1294 | struct sk_buff *skb; |
1297 | int sta_id; | 1295 | int sta_id; |
1298 | int tid; | 1296 | int tid; |
@@ -1379,22 +1377,28 @@ int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv, | |||
1379 | freed = 0; | 1377 | freed = 0; |
1380 | 1378 | ||
1381 | skb_queue_walk(&reclaimed_skbs, skb) { | 1379 | skb_queue_walk(&reclaimed_skbs, skb) { |
1382 | hdr = (struct ieee80211_hdr *)skb->data; | 1380 | struct ieee80211_hdr *hdr = (void *)skb->data; |
1381 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
1383 | 1382 | ||
1384 | if (ieee80211_is_data_qos(hdr->frame_control)) | 1383 | if (ieee80211_is_data_qos(hdr->frame_control)) |
1385 | freed++; | 1384 | freed++; |
1386 | else | 1385 | else |
1387 | WARN_ON_ONCE(1); | 1386 | WARN_ON_ONCE(1); |
1388 | 1387 | ||
1389 | info = IEEE80211_SKB_CB(skb); | ||
1390 | iwl_trans_free_tx_cmd(priv->trans, info->driver_data[1]); | 1388 | iwl_trans_free_tx_cmd(priv->trans, info->driver_data[1]); |
1391 | 1389 | ||
1390 | memset(&info->status, 0, sizeof(info->status)); | ||
1391 | /* Packet was transmitted successfully, failures come as single | ||
1392 | * frames because before failing a frame the firmware transmits | ||
1393 | * it without aggregation at least once. | ||
1394 | */ | ||
1395 | info->flags |= IEEE80211_TX_STAT_ACK; | ||
1396 | |||
1392 | if (freed == 1) { | 1397 | if (freed == 1) { |
1393 | /* this is the first skb we deliver in this batch */ | 1398 | /* this is the first skb we deliver in this batch */ |
1394 | /* put the rate scaling data there */ | 1399 | /* put the rate scaling data there */ |
1395 | info = IEEE80211_SKB_CB(skb); | 1400 | info = IEEE80211_SKB_CB(skb); |
1396 | memset(&info->status, 0, sizeof(info->status)); | 1401 | memset(&info->status, 0, sizeof(info->status)); |
1397 | info->flags |= IEEE80211_TX_STAT_ACK; | ||
1398 | info->flags |= IEEE80211_TX_STAT_AMPDU; | 1402 | info->flags |= IEEE80211_TX_STAT_AMPDU; |
1399 | info->status.ampdu_ack_len = ba_resp->txed_2_done; | 1403 | info->status.ampdu_ack_len = ba_resp->txed_2_done; |
1400 | info->status.ampdu_len = ba_resp->txed; | 1404 | info->status.ampdu_len = ba_resp->txed; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c index c3728163be46..75103554cd63 100644 --- a/drivers/net/wireless/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/iwlwifi/iwl-drv.c | |||
@@ -1286,7 +1286,7 @@ module_param_named(swcrypto, iwlwifi_mod_params.sw_crypto, int, S_IRUGO); | |||
1286 | MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])"); | 1286 | MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])"); |
1287 | module_param_named(11n_disable, iwlwifi_mod_params.disable_11n, uint, S_IRUGO); | 1287 | module_param_named(11n_disable, iwlwifi_mod_params.disable_11n, uint, S_IRUGO); |
1288 | MODULE_PARM_DESC(11n_disable, | 1288 | MODULE_PARM_DESC(11n_disable, |
1289 | "disable 11n functionality, bitmap: 1: full, 2: agg TX, 4: agg RX"); | 1289 | "disable 11n functionality, bitmap: 1: full, 2: disable agg TX, 4: disable agg RX, 8 enable agg TX"); |
1290 | module_param_named(amsdu_size_8K, iwlwifi_mod_params.amsdu_size_8K, | 1290 | module_param_named(amsdu_size_8K, iwlwifi_mod_params.amsdu_size_8K, |
1291 | int, S_IRUGO); | 1291 | int, S_IRUGO); |
1292 | MODULE_PARM_DESC(amsdu_size_8K, "enable 8K amsdu size (default 0)"); | 1292 | MODULE_PARM_DESC(amsdu_size_8K, "enable 8K amsdu size (default 0)"); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-modparams.h b/drivers/net/wireless/iwlwifi/iwl-modparams.h index 0a84ade7edac..b29075c3da8e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-modparams.h +++ b/drivers/net/wireless/iwlwifi/iwl-modparams.h | |||
@@ -79,9 +79,12 @@ enum iwl_power_level { | |||
79 | IWL_POWER_NUM | 79 | IWL_POWER_NUM |
80 | }; | 80 | }; |
81 | 81 | ||
82 | #define IWL_DISABLE_HT_ALL BIT(0) | 82 | enum iwl_disable_11n { |
83 | #define IWL_DISABLE_HT_TXAGG BIT(1) | 83 | IWL_DISABLE_HT_ALL = BIT(0), |
84 | #define IWL_DISABLE_HT_RXAGG BIT(2) | 84 | IWL_DISABLE_HT_TXAGG = BIT(1), |
85 | IWL_DISABLE_HT_RXAGG = BIT(2), | ||
86 | IWL_ENABLE_HT_TXAGG = BIT(3), | ||
87 | }; | ||
85 | 88 | ||
86 | /** | 89 | /** |
87 | * struct iwl_mod_params | 90 | * struct iwl_mod_params |
@@ -90,7 +93,7 @@ enum iwl_power_level { | |||
90 | * | 93 | * |
91 | * @sw_crypto: using hardware encryption, default = 0 | 94 | * @sw_crypto: using hardware encryption, default = 0 |
92 | * @disable_11n: disable 11n capabilities, default = 0, | 95 | * @disable_11n: disable 11n capabilities, default = 0, |
93 | * use IWL_DISABLE_HT_* constants | 96 | * use IWL_[DIS,EN]ABLE_HT_* constants |
94 | * @amsdu_size_8K: enable 8K amsdu size, default = 0 | 97 | * @amsdu_size_8K: enable 8K amsdu size, default = 0 |
95 | * @restart_fw: restart firmware, default = 1 | 98 | * @restart_fw: restart firmware, default = 1 |
96 | * @wd_disable: enable stuck queue check, default = 0 | 99 | * @wd_disable: enable stuck queue check, default = 0 |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 6bf9766e5982..c35b8661b395 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
@@ -328,6 +328,24 @@ static void iwl_mvm_mac_tx(struct ieee80211_hw *hw, | |||
328 | ieee80211_free_txskb(hw, skb); | 328 | ieee80211_free_txskb(hw, skb); |
329 | } | 329 | } |
330 | 330 | ||
331 | static inline bool iwl_enable_rx_ampdu(const struct iwl_cfg *cfg) | ||
332 | { | ||
333 | if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_RXAGG) | ||
334 | return false; | ||
335 | return true; | ||
336 | } | ||
337 | |||
338 | static inline bool iwl_enable_tx_ampdu(const struct iwl_cfg *cfg) | ||
339 | { | ||
340 | if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_TXAGG) | ||
341 | return false; | ||
342 | if (iwlwifi_mod_params.disable_11n & IWL_ENABLE_HT_TXAGG) | ||
343 | return true; | ||
344 | |||
345 | /* enabled by default */ | ||
346 | return true; | ||
347 | } | ||
348 | |||
331 | static int iwl_mvm_mac_ampdu_action(struct ieee80211_hw *hw, | 349 | static int iwl_mvm_mac_ampdu_action(struct ieee80211_hw *hw, |
332 | struct ieee80211_vif *vif, | 350 | struct ieee80211_vif *vif, |
333 | enum ieee80211_ampdu_mlme_action action, | 351 | enum ieee80211_ampdu_mlme_action action, |
@@ -347,7 +365,7 @@ static int iwl_mvm_mac_ampdu_action(struct ieee80211_hw *hw, | |||
347 | 365 | ||
348 | switch (action) { | 366 | switch (action) { |
349 | case IEEE80211_AMPDU_RX_START: | 367 | case IEEE80211_AMPDU_RX_START: |
350 | if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_RXAGG) { | 368 | if (!iwl_enable_rx_ampdu(mvm->cfg)) { |
351 | ret = -EINVAL; | 369 | ret = -EINVAL; |
352 | break; | 370 | break; |
353 | } | 371 | } |
@@ -357,7 +375,7 @@ static int iwl_mvm_mac_ampdu_action(struct ieee80211_hw *hw, | |||
357 | ret = iwl_mvm_sta_rx_agg(mvm, sta, tid, 0, false); | 375 | ret = iwl_mvm_sta_rx_agg(mvm, sta, tid, 0, false); |
358 | break; | 376 | break; |
359 | case IEEE80211_AMPDU_TX_START: | 377 | case IEEE80211_AMPDU_TX_START: |
360 | if (iwlwifi_mod_params.disable_11n & IWL_DISABLE_HT_TXAGG) { | 378 | if (!iwl_enable_tx_ampdu(mvm->cfg)) { |
361 | ret = -EINVAL; | 379 | ret = -EINVAL; |
362 | break; | 380 | break; |
363 | } | 381 | } |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h index e4ead86f06d6..2b0ba1fc3c82 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h | |||
@@ -152,7 +152,7 @@ enum iwl_power_scheme { | |||
152 | IWL_POWER_SCHEME_LP | 152 | IWL_POWER_SCHEME_LP |
153 | }; | 153 | }; |
154 | 154 | ||
155 | #define IWL_CONN_MAX_LISTEN_INTERVAL 70 | 155 | #define IWL_CONN_MAX_LISTEN_INTERVAL 10 |
156 | #define IWL_UAPSD_AC_INFO (IEEE80211_WMM_IE_STA_QOSINFO_AC_VO |\ | 156 | #define IWL_UAPSD_AC_INFO (IEEE80211_WMM_IE_STA_QOSINFO_AC_VO |\ |
157 | IEEE80211_WMM_IE_STA_QOSINFO_AC_VI |\ | 157 | IEEE80211_WMM_IE_STA_QOSINFO_AC_VI |\ |
158 | IEEE80211_WMM_IE_STA_QOSINFO_AC_BK |\ | 158 | IEEE80211_WMM_IE_STA_QOSINFO_AC_BK |\ |
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c index 4df12fa9d336..76ee486039d7 100644 --- a/drivers/net/wireless/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/iwlwifi/mvm/tx.c | |||
@@ -822,16 +822,12 @@ int iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, | |||
822 | struct iwl_mvm_ba_notif *ba_notif = (void *)pkt->data; | 822 | struct iwl_mvm_ba_notif *ba_notif = (void *)pkt->data; |
823 | struct sk_buff_head reclaimed_skbs; | 823 | struct sk_buff_head reclaimed_skbs; |
824 | struct iwl_mvm_tid_data *tid_data; | 824 | struct iwl_mvm_tid_data *tid_data; |
825 | struct ieee80211_tx_info *info; | ||
826 | struct ieee80211_sta *sta; | 825 | struct ieee80211_sta *sta; |
827 | struct iwl_mvm_sta *mvmsta; | 826 | struct iwl_mvm_sta *mvmsta; |
828 | struct ieee80211_hdr *hdr; | ||
829 | struct sk_buff *skb; | 827 | struct sk_buff *skb; |
830 | int sta_id, tid, freed; | 828 | int sta_id, tid, freed; |
831 | |||
832 | /* "flow" corresponds to Tx queue */ | 829 | /* "flow" corresponds to Tx queue */ |
833 | u16 scd_flow = le16_to_cpu(ba_notif->scd_flow); | 830 | u16 scd_flow = le16_to_cpu(ba_notif->scd_flow); |
834 | |||
835 | /* "ssn" is start of block-ack Tx window, corresponds to index | 831 | /* "ssn" is start of block-ack Tx window, corresponds to index |
836 | * (in Tx queue's circular buffer) of first TFD/frame in window */ | 832 | * (in Tx queue's circular buffer) of first TFD/frame in window */ |
837 | u16 ba_resp_scd_ssn = le16_to_cpu(ba_notif->scd_ssn); | 833 | u16 ba_resp_scd_ssn = le16_to_cpu(ba_notif->scd_ssn); |
@@ -888,22 +884,26 @@ int iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, | |||
888 | freed = 0; | 884 | freed = 0; |
889 | 885 | ||
890 | skb_queue_walk(&reclaimed_skbs, skb) { | 886 | skb_queue_walk(&reclaimed_skbs, skb) { |
891 | hdr = (struct ieee80211_hdr *)skb->data; | 887 | struct ieee80211_hdr *hdr = (void *)skb->data; |
888 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
892 | 889 | ||
893 | if (ieee80211_is_data_qos(hdr->frame_control)) | 890 | if (ieee80211_is_data_qos(hdr->frame_control)) |
894 | freed++; | 891 | freed++; |
895 | else | 892 | else |
896 | WARN_ON_ONCE(1); | 893 | WARN_ON_ONCE(1); |
897 | 894 | ||
898 | info = IEEE80211_SKB_CB(skb); | ||
899 | iwl_trans_free_tx_cmd(mvm->trans, info->driver_data[1]); | 895 | iwl_trans_free_tx_cmd(mvm->trans, info->driver_data[1]); |
900 | 896 | ||
897 | memset(&info->status, 0, sizeof(info->status)); | ||
898 | /* Packet was transmitted successfully, failures come as single | ||
899 | * frames because before failing a frame the firmware transmits | ||
900 | * it without aggregation at least once. | ||
901 | */ | ||
902 | info->flags |= IEEE80211_TX_STAT_ACK; | ||
903 | |||
901 | if (freed == 1) { | 904 | if (freed == 1) { |
902 | /* this is the first skb we deliver in this batch */ | 905 | /* this is the first skb we deliver in this batch */ |
903 | /* put the rate scaling data there */ | 906 | /* put the rate scaling data there */ |
904 | info = IEEE80211_SKB_CB(skb); | ||
905 | memset(&info->status, 0, sizeof(info->status)); | ||
906 | info->flags |= IEEE80211_TX_STAT_ACK; | ||
907 | info->flags |= IEEE80211_TX_STAT_AMPDU; | 907 | info->flags |= IEEE80211_TX_STAT_AMPDU; |
908 | info->status.ampdu_ack_len = ba_notif->txed_2_done; | 908 | info->status.ampdu_ack_len = ba_notif->txed_2_done; |
909 | info->status.ampdu_len = ba_notif->txed; | 909 | info->status.ampdu_len = ba_notif->txed; |
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c index 32f75007a825..cb6d189bc3e6 100644 --- a/drivers/net/wireless/libertas/cfg.c +++ b/drivers/net/wireless/libertas/cfg.c | |||
@@ -621,7 +621,7 @@ static int lbs_ret_scan(struct lbs_private *priv, unsigned long dummy, | |||
621 | id = *pos++; | 621 | id = *pos++; |
622 | elen = *pos++; | 622 | elen = *pos++; |
623 | left -= 2; | 623 | left -= 2; |
624 | if (elen > left || elen == 0) { | 624 | if (elen > left) { |
625 | lbs_deb_scan("scan response: invalid IE fmt\n"); | 625 | lbs_deb_scan("scan response: invalid IE fmt\n"); |
626 | goto done; | 626 | goto done; |
627 | } | 627 | } |
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c index 4d79761b9c87..9d3d2758ec35 100644 --- a/drivers/net/wireless/mwifiex/main.c +++ b/drivers/net/wireless/mwifiex/main.c | |||
@@ -748,7 +748,7 @@ static struct net_device_stats *mwifiex_get_stats(struct net_device *dev) | |||
748 | 748 | ||
749 | static u16 | 749 | static u16 |
750 | mwifiex_netdev_select_wmm_queue(struct net_device *dev, struct sk_buff *skb, | 750 | mwifiex_netdev_select_wmm_queue(struct net_device *dev, struct sk_buff *skb, |
751 | void *accel_priv) | 751 | void *accel_priv, select_queue_fallback_t fallback) |
752 | { | 752 | { |
753 | skb->priority = cfg80211_classify8021d(skb, NULL); | 753 | skb->priority = cfg80211_classify8021d(skb, NULL); |
754 | return mwifiex_1d_to_wmm_queue[skb->priority]; | 754 | return mwifiex_1d_to_wmm_queue[skb->priority]; |
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c index 03688aa14e8a..7fe7b53fb17a 100644 --- a/drivers/net/wireless/mwifiex/pcie.c +++ b/drivers/net/wireless/mwifiex/pcie.c | |||
@@ -1211,6 +1211,12 @@ static int mwifiex_pcie_process_recv_data(struct mwifiex_adapter *adapter) | |||
1211 | rd_index = card->rxbd_rdptr & reg->rx_mask; | 1211 | rd_index = card->rxbd_rdptr & reg->rx_mask; |
1212 | skb_data = card->rx_buf_list[rd_index]; | 1212 | skb_data = card->rx_buf_list[rd_index]; |
1213 | 1213 | ||
1214 | /* If skb allocation was failed earlier for Rx packet, | ||
1215 | * rx_buf_list[rd_index] would have been left with a NULL. | ||
1216 | */ | ||
1217 | if (!skb_data) | ||
1218 | return -ENOMEM; | ||
1219 | |||
1214 | MWIFIEX_SKB_PACB(skb_data, &buf_pa); | 1220 | MWIFIEX_SKB_PACB(skb_data, &buf_pa); |
1215 | pci_unmap_single(card->dev, buf_pa, MWIFIEX_RX_DATA_BUF_SIZE, | 1221 | pci_unmap_single(card->dev, buf_pa, MWIFIEX_RX_DATA_BUF_SIZE, |
1216 | PCI_DMA_FROMDEVICE); | 1222 | PCI_DMA_FROMDEVICE); |
@@ -1525,6 +1531,14 @@ static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter) | |||
1525 | if (adapter->ps_state == PS_STATE_SLEEP_CFM) { | 1531 | if (adapter->ps_state == PS_STATE_SLEEP_CFM) { |
1526 | mwifiex_process_sleep_confirm_resp(adapter, skb->data, | 1532 | mwifiex_process_sleep_confirm_resp(adapter, skb->data, |
1527 | skb->len); | 1533 | skb->len); |
1534 | mwifiex_pcie_enable_host_int(adapter); | ||
1535 | if (mwifiex_write_reg(adapter, | ||
1536 | PCIE_CPU_INT_EVENT, | ||
1537 | CPU_INTR_SLEEP_CFM_DONE)) { | ||
1538 | dev_warn(adapter->dev, | ||
1539 | "Write register failed\n"); | ||
1540 | return -1; | ||
1541 | } | ||
1528 | while (reg->sleep_cookie && (count++ < 10) && | 1542 | while (reg->sleep_cookie && (count++ < 10) && |
1529 | mwifiex_pcie_ok_to_access_hw(adapter)) | 1543 | mwifiex_pcie_ok_to_access_hw(adapter)) |
1530 | usleep_range(50, 60); | 1544 | usleep_range(50, 60); |
@@ -1993,23 +2007,9 @@ static void mwifiex_interrupt_status(struct mwifiex_adapter *adapter) | |||
1993 | adapter->int_status |= pcie_ireg; | 2007 | adapter->int_status |= pcie_ireg; |
1994 | spin_unlock_irqrestore(&adapter->int_lock, flags); | 2008 | spin_unlock_irqrestore(&adapter->int_lock, flags); |
1995 | 2009 | ||
1996 | if (pcie_ireg & HOST_INTR_CMD_DONE) { | 2010 | if (!adapter->pps_uapsd_mode && |
1997 | if ((adapter->ps_state == PS_STATE_SLEEP_CFM) || | 2011 | adapter->ps_state == PS_STATE_SLEEP && |
1998 | (adapter->ps_state == PS_STATE_SLEEP)) { | 2012 | mwifiex_pcie_ok_to_access_hw(adapter)) { |
1999 | mwifiex_pcie_enable_host_int(adapter); | ||
2000 | if (mwifiex_write_reg(adapter, | ||
2001 | PCIE_CPU_INT_EVENT, | ||
2002 | CPU_INTR_SLEEP_CFM_DONE) | ||
2003 | ) { | ||
2004 | dev_warn(adapter->dev, | ||
2005 | "Write register failed\n"); | ||
2006 | return; | ||
2007 | |||
2008 | } | ||
2009 | } | ||
2010 | } else if (!adapter->pps_uapsd_mode && | ||
2011 | adapter->ps_state == PS_STATE_SLEEP && | ||
2012 | mwifiex_pcie_ok_to_access_hw(adapter)) { | ||
2013 | /* Potentially for PCIe we could get other | 2013 | /* Potentially for PCIe we could get other |
2014 | * interrupts like shared. Don't change power | 2014 | * interrupts like shared. Don't change power |
2015 | * state until cookie is set */ | 2015 | * state until cookie is set */ |
diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c index e8ebbd4bc3cd..208748804a55 100644 --- a/drivers/net/wireless/mwifiex/usb.c +++ b/drivers/net/wireless/mwifiex/usb.c | |||
@@ -22,8 +22,6 @@ | |||
22 | 22 | ||
23 | #define USB_VERSION "1.0" | 23 | #define USB_VERSION "1.0" |
24 | 24 | ||
25 | static const char usbdriver_name[] = "usb8xxx"; | ||
26 | |||
27 | static struct mwifiex_if_ops usb_ops; | 25 | static struct mwifiex_if_ops usb_ops; |
28 | static struct semaphore add_remove_card_sem; | 26 | static struct semaphore add_remove_card_sem; |
29 | static struct usb_card_rec *usb_card; | 27 | static struct usb_card_rec *usb_card; |
@@ -527,13 +525,6 @@ static int mwifiex_usb_resume(struct usb_interface *intf) | |||
527 | MWIFIEX_BSS_ROLE_ANY), | 525 | MWIFIEX_BSS_ROLE_ANY), |
528 | MWIFIEX_ASYNC_CMD); | 526 | MWIFIEX_ASYNC_CMD); |
529 | 527 | ||
530 | #ifdef CONFIG_PM | ||
531 | /* Resume handler may be called due to remote wakeup, | ||
532 | * force to exit suspend anyway | ||
533 | */ | ||
534 | usb_disable_autosuspend(card->udev); | ||
535 | #endif /* CONFIG_PM */ | ||
536 | |||
537 | return 0; | 528 | return 0; |
538 | } | 529 | } |
539 | 530 | ||
@@ -567,13 +558,12 @@ static void mwifiex_usb_disconnect(struct usb_interface *intf) | |||
567 | } | 558 | } |
568 | 559 | ||
569 | static struct usb_driver mwifiex_usb_driver = { | 560 | static struct usb_driver mwifiex_usb_driver = { |
570 | .name = usbdriver_name, | 561 | .name = "mwifiex_usb", |
571 | .probe = mwifiex_usb_probe, | 562 | .probe = mwifiex_usb_probe, |
572 | .disconnect = mwifiex_usb_disconnect, | 563 | .disconnect = mwifiex_usb_disconnect, |
573 | .id_table = mwifiex_usb_table, | 564 | .id_table = mwifiex_usb_table, |
574 | .suspend = mwifiex_usb_suspend, | 565 | .suspend = mwifiex_usb_suspend, |
575 | .resume = mwifiex_usb_resume, | 566 | .resume = mwifiex_usb_resume, |
576 | .supports_autosuspend = 1, | ||
577 | }; | 567 | }; |
578 | 568 | ||
579 | static int mwifiex_usb_tx_init(struct mwifiex_adapter *adapter) | 569 | static int mwifiex_usb_tx_init(struct mwifiex_adapter *adapter) |
diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c index 13eaeed03898..981cf6e7c73b 100644 --- a/drivers/net/wireless/mwifiex/wmm.c +++ b/drivers/net/wireless/mwifiex/wmm.c | |||
@@ -559,7 +559,8 @@ mwifiex_clean_txrx(struct mwifiex_private *priv) | |||
559 | mwifiex_wmm_delete_all_ralist(priv); | 559 | mwifiex_wmm_delete_all_ralist(priv); |
560 | memcpy(tos_to_tid, ac_to_tid, sizeof(tos_to_tid)); | 560 | memcpy(tos_to_tid, ac_to_tid, sizeof(tos_to_tid)); |
561 | 561 | ||
562 | if (priv->adapter->if_ops.clean_pcie_ring) | 562 | if (priv->adapter->if_ops.clean_pcie_ring && |
563 | !priv->adapter->surprise_removed) | ||
563 | priv->adapter->if_ops.clean_pcie_ring(priv->adapter); | 564 | priv->adapter->if_ops.clean_pcie_ring(priv->adapter); |
564 | spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, flags); | 565 | spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, flags); |
565 | } | 566 | } |
diff --git a/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h b/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h index 56aee067f324..a6ad79f61bf9 100644 --- a/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h +++ b/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h | |||
@@ -15,6 +15,8 @@ | |||
15 | #ifndef RTL8187_H | 15 | #ifndef RTL8187_H |
16 | #define RTL8187_H | 16 | #define RTL8187_H |
17 | 17 | ||
18 | #include <linux/cache.h> | ||
19 | |||
18 | #include "rtl818x.h" | 20 | #include "rtl818x.h" |
19 | #include "leds.h" | 21 | #include "leds.h" |
20 | 22 | ||
@@ -139,7 +141,10 @@ struct rtl8187_priv { | |||
139 | u8 aifsn[4]; | 141 | u8 aifsn[4]; |
140 | u8 rfkill_mask; | 142 | u8 rfkill_mask; |
141 | struct { | 143 | struct { |
142 | __le64 buf; | 144 | union { |
145 | __le64 buf; | ||
146 | u8 dummy1[L1_CACHE_BYTES]; | ||
147 | } ____cacheline_aligned; | ||
143 | struct sk_buff_head queue; | 148 | struct sk_buff_head queue; |
144 | } b_tx_status; /* This queue is used by both -b and non-b devices */ | 149 | } b_tx_status; /* This queue is used by both -b and non-b devices */ |
145 | struct mutex io_mutex; | 150 | struct mutex io_mutex; |
@@ -147,7 +152,8 @@ struct rtl8187_priv { | |||
147 | u8 bits8; | 152 | u8 bits8; |
148 | __le16 bits16; | 153 | __le16 bits16; |
149 | __le32 bits32; | 154 | __le32 bits32; |
150 | } *io_dmabuf; | 155 | u8 dummy2[L1_CACHE_BYTES]; |
156 | } *io_dmabuf ____cacheline_aligned; | ||
151 | bool rfkill_off; | 157 | bool rfkill_off; |
152 | u16 seqno; | 158 | u16 seqno; |
153 | }; | 159 | }; |
diff --git a/drivers/net/wireless/rtlwifi/ps.c b/drivers/net/wireless/rtlwifi/ps.c index deedae3c5449..d1c0191a195b 100644 --- a/drivers/net/wireless/rtlwifi/ps.c +++ b/drivers/net/wireless/rtlwifi/ps.c | |||
@@ -48,7 +48,7 @@ bool rtl_ps_enable_nic(struct ieee80211_hw *hw) | |||
48 | 48 | ||
49 | /*<2> Enable Adapter */ | 49 | /*<2> Enable Adapter */ |
50 | if (rtlpriv->cfg->ops->hw_init(hw)) | 50 | if (rtlpriv->cfg->ops->hw_init(hw)) |
51 | return 1; | 51 | return false; |
52 | RT_CLEAR_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); | 52 | RT_CLEAR_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); |
53 | 53 | ||
54 | /*<3> Enable Interrupt */ | 54 | /*<3> Enable Interrupt */ |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c index a82b30a1996c..2eb0b38384dd 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c | |||
@@ -937,14 +937,26 @@ int rtl92ce_hw_init(struct ieee80211_hw *hw) | |||
937 | bool is92c; | 937 | bool is92c; |
938 | int err; | 938 | int err; |
939 | u8 tmp_u1b; | 939 | u8 tmp_u1b; |
940 | unsigned long flags; | ||
940 | 941 | ||
941 | rtlpci->being_init_adapter = true; | 942 | rtlpci->being_init_adapter = true; |
943 | |||
944 | /* Since this function can take a very long time (up to 350 ms) | ||
945 | * and can be called with irqs disabled, reenable the irqs | ||
946 | * to let the other devices continue being serviced. | ||
947 | * | ||
948 | * It is safe doing so since our own interrupts will only be enabled | ||
949 | * in a subsequent step. | ||
950 | */ | ||
951 | local_save_flags(flags); | ||
952 | local_irq_enable(); | ||
953 | |||
942 | rtlpriv->intf_ops->disable_aspm(hw); | 954 | rtlpriv->intf_ops->disable_aspm(hw); |
943 | rtstatus = _rtl92ce_init_mac(hw); | 955 | rtstatus = _rtl92ce_init_mac(hw); |
944 | if (!rtstatus) { | 956 | if (!rtstatus) { |
945 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Init MAC failed\n"); | 957 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Init MAC failed\n"); |
946 | err = 1; | 958 | err = 1; |
947 | return err; | 959 | goto exit; |
948 | } | 960 | } |
949 | 961 | ||
950 | err = rtl92c_download_fw(hw); | 962 | err = rtl92c_download_fw(hw); |
@@ -952,7 +964,7 @@ int rtl92ce_hw_init(struct ieee80211_hw *hw) | |||
952 | RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, | 964 | RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, |
953 | "Failed to download FW. Init HW without FW now..\n"); | 965 | "Failed to download FW. Init HW without FW now..\n"); |
954 | err = 1; | 966 | err = 1; |
955 | return err; | 967 | goto exit; |
956 | } | 968 | } |
957 | 969 | ||
958 | rtlhal->last_hmeboxnum = 0; | 970 | rtlhal->last_hmeboxnum = 0; |
@@ -1032,6 +1044,8 @@ int rtl92ce_hw_init(struct ieee80211_hw *hw) | |||
1032 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "under 1.5V\n"); | 1044 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "under 1.5V\n"); |
1033 | } | 1045 | } |
1034 | rtl92c_dm_init(hw); | 1046 | rtl92c_dm_init(hw); |
1047 | exit: | ||
1048 | local_irq_restore(flags); | ||
1035 | rtlpci->being_init_adapter = false; | 1049 | rtlpci->being_init_adapter = false; |
1036 | return err; | 1050 | return err; |
1037 | } | 1051 | } |
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index f9daa9e183f2..e30d80033cbc 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
@@ -907,6 +907,7 @@ static int handle_incoming_queue(struct net_device *dev, | |||
907 | 907 | ||
908 | /* Ethernet work: Delayed to here as it peeks the header. */ | 908 | /* Ethernet work: Delayed to here as it peeks the header. */ |
909 | skb->protocol = eth_type_trans(skb, dev); | 909 | skb->protocol = eth_type_trans(skb, dev); |
910 | skb_reset_network_header(skb); | ||
910 | 911 | ||
911 | if (checksum_setup(dev, skb)) { | 912 | if (checksum_setup(dev, skb)) { |
912 | kfree_skb(skb); | 913 | kfree_skb(skb); |
diff --git a/drivers/of/base.c b/drivers/of/base.c index 10b51106c854..89e888a78899 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -342,27 +342,72 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread) | |||
342 | } | 342 | } |
343 | EXPORT_SYMBOL(of_get_cpu_node); | 343 | EXPORT_SYMBOL(of_get_cpu_node); |
344 | 344 | ||
345 | /** Checks if the given "compat" string matches one of the strings in | 345 | /** |
346 | * the device's "compatible" property | 346 | * __of_device_is_compatible() - Check if the node matches given constraints |
347 | * @device: pointer to node | ||
348 | * @compat: required compatible string, NULL or "" for any match | ||
349 | * @type: required device_type value, NULL or "" for any match | ||
350 | * @name: required node name, NULL or "" for any match | ||
351 | * | ||
352 | * Checks if the given @compat, @type and @name strings match the | ||
353 | * properties of the given @device. A constraints can be skipped by | ||
354 | * passing NULL or an empty string as the constraint. | ||
355 | * | ||
356 | * Returns 0 for no match, and a positive integer on match. The return | ||
357 | * value is a relative score with larger values indicating better | ||
358 | * matches. The score is weighted for the most specific compatible value | ||
359 | * to get the highest score. Matching type is next, followed by matching | ||
360 | * name. Practically speaking, this results in the following priority | ||
361 | * order for matches: | ||
362 | * | ||
363 | * 1. specific compatible && type && name | ||
364 | * 2. specific compatible && type | ||
365 | * 3. specific compatible && name | ||
366 | * 4. specific compatible | ||
367 | * 5. general compatible && type && name | ||
368 | * 6. general compatible && type | ||
369 | * 7. general compatible && name | ||
370 | * 8. general compatible | ||
371 | * 9. type && name | ||
372 | * 10. type | ||
373 | * 11. name | ||
347 | */ | 374 | */ |
348 | static int __of_device_is_compatible(const struct device_node *device, | 375 | static int __of_device_is_compatible(const struct device_node *device, |
349 | const char *compat) | 376 | const char *compat, const char *type, const char *name) |
350 | { | 377 | { |
351 | const char* cp; | 378 | struct property *prop; |
352 | int cplen, l; | 379 | const char *cp; |
380 | int index = 0, score = 0; | ||
381 | |||
382 | /* Compatible match has highest priority */ | ||
383 | if (compat && compat[0]) { | ||
384 | prop = __of_find_property(device, "compatible", NULL); | ||
385 | for (cp = of_prop_next_string(prop, NULL); cp; | ||
386 | cp = of_prop_next_string(prop, cp), index++) { | ||
387 | if (of_compat_cmp(cp, compat, strlen(compat)) == 0) { | ||
388 | score = INT_MAX/2 - (index << 2); | ||
389 | break; | ||
390 | } | ||
391 | } | ||
392 | if (!score) | ||
393 | return 0; | ||
394 | } | ||
353 | 395 | ||
354 | cp = __of_get_property(device, "compatible", &cplen); | 396 | /* Matching type is better than matching name */ |
355 | if (cp == NULL) | 397 | if (type && type[0]) { |
356 | return 0; | 398 | if (!device->type || of_node_cmp(type, device->type)) |
357 | while (cplen > 0) { | 399 | return 0; |
358 | if (of_compat_cmp(cp, compat, strlen(compat)) == 0) | 400 | score += 2; |
359 | return 1; | ||
360 | l = strlen(cp) + 1; | ||
361 | cp += l; | ||
362 | cplen -= l; | ||
363 | } | 401 | } |
364 | 402 | ||
365 | return 0; | 403 | /* Matching name is a bit better than not */ |
404 | if (name && name[0]) { | ||
405 | if (!device->name || of_node_cmp(name, device->name)) | ||
406 | return 0; | ||
407 | score++; | ||
408 | } | ||
409 | |||
410 | return score; | ||
366 | } | 411 | } |
367 | 412 | ||
368 | /** Checks if the given "compat" string matches one of the strings in | 413 | /** Checks if the given "compat" string matches one of the strings in |
@@ -375,7 +420,7 @@ int of_device_is_compatible(const struct device_node *device, | |||
375 | int res; | 420 | int res; |
376 | 421 | ||
377 | raw_spin_lock_irqsave(&devtree_lock, flags); | 422 | raw_spin_lock_irqsave(&devtree_lock, flags); |
378 | res = __of_device_is_compatible(device, compat); | 423 | res = __of_device_is_compatible(device, compat, NULL, NULL); |
379 | raw_spin_unlock_irqrestore(&devtree_lock, flags); | 424 | raw_spin_unlock_irqrestore(&devtree_lock, flags); |
380 | return res; | 425 | return res; |
381 | } | 426 | } |
@@ -681,10 +726,7 @@ struct device_node *of_find_compatible_node(struct device_node *from, | |||
681 | raw_spin_lock_irqsave(&devtree_lock, flags); | 726 | raw_spin_lock_irqsave(&devtree_lock, flags); |
682 | np = from ? from->allnext : of_allnodes; | 727 | np = from ? from->allnext : of_allnodes; |
683 | for (; np; np = np->allnext) { | 728 | for (; np; np = np->allnext) { |
684 | if (type | 729 | if (__of_device_is_compatible(np, compatible, type, NULL) && |
685 | && !(np->type && (of_node_cmp(np->type, type) == 0))) | ||
686 | continue; | ||
687 | if (__of_device_is_compatible(np, compatible) && | ||
688 | of_node_get(np)) | 730 | of_node_get(np)) |
689 | break; | 731 | break; |
690 | } | 732 | } |
@@ -730,65 +772,26 @@ out: | |||
730 | } | 772 | } |
731 | EXPORT_SYMBOL(of_find_node_with_property); | 773 | EXPORT_SYMBOL(of_find_node_with_property); |
732 | 774 | ||
733 | static const struct of_device_id * | ||
734 | of_match_compatible(const struct of_device_id *matches, | ||
735 | const struct device_node *node) | ||
736 | { | ||
737 | const char *cp; | ||
738 | int cplen, l; | ||
739 | const struct of_device_id *m; | ||
740 | |||
741 | cp = __of_get_property(node, "compatible", &cplen); | ||
742 | while (cp && (cplen > 0)) { | ||
743 | m = matches; | ||
744 | while (m->name[0] || m->type[0] || m->compatible[0]) { | ||
745 | /* Only match for the entries without type and name */ | ||
746 | if (m->name[0] || m->type[0] || | ||
747 | of_compat_cmp(m->compatible, cp, | ||
748 | strlen(m->compatible))) | ||
749 | m++; | ||
750 | else | ||
751 | return m; | ||
752 | } | ||
753 | |||
754 | /* Get node's next compatible string */ | ||
755 | l = strlen(cp) + 1; | ||
756 | cp += l; | ||
757 | cplen -= l; | ||
758 | } | ||
759 | |||
760 | return NULL; | ||
761 | } | ||
762 | |||
763 | static | 775 | static |
764 | const struct of_device_id *__of_match_node(const struct of_device_id *matches, | 776 | const struct of_device_id *__of_match_node(const struct of_device_id *matches, |
765 | const struct device_node *node) | 777 | const struct device_node *node) |
766 | { | 778 | { |
767 | const struct of_device_id *m; | 779 | const struct of_device_id *best_match = NULL; |
780 | int score, best_score = 0; | ||
768 | 781 | ||
769 | if (!matches) | 782 | if (!matches) |
770 | return NULL; | 783 | return NULL; |
771 | 784 | ||
772 | m = of_match_compatible(matches, node); | 785 | for (; matches->name[0] || matches->type[0] || matches->compatible[0]; matches++) { |
773 | if (m) | 786 | score = __of_device_is_compatible(node, matches->compatible, |
774 | return m; | 787 | matches->type, matches->name); |
775 | 788 | if (score > best_score) { | |
776 | while (matches->name[0] || matches->type[0] || matches->compatible[0]) { | 789 | best_match = matches; |
777 | int match = 1; | 790 | best_score = score; |
778 | if (matches->name[0]) | 791 | } |
779 | match &= node->name | ||
780 | && !strcmp(matches->name, node->name); | ||
781 | if (matches->type[0]) | ||
782 | match &= node->type | ||
783 | && !strcmp(matches->type, node->type); | ||
784 | if (matches->compatible[0]) | ||
785 | match &= __of_device_is_compatible(node, | ||
786 | matches->compatible); | ||
787 | if (match) | ||
788 | return matches; | ||
789 | matches++; | ||
790 | } | 792 | } |
791 | return NULL; | 793 | |
794 | return best_match; | ||
792 | } | 795 | } |
793 | 796 | ||
794 | /** | 797 | /** |
@@ -796,12 +799,7 @@ const struct of_device_id *__of_match_node(const struct of_device_id *matches, | |||
796 | * @matches: array of of device match structures to search in | 799 | * @matches: array of of device match structures to search in |
797 | * @node: the of device structure to match against | 800 | * @node: the of device structure to match against |
798 | * | 801 | * |
799 | * Low level utility function used by device matching. We have two ways | 802 | * Low level utility function used by device matching. |
800 | * of matching: | ||
801 | * - Try to find the best compatible match by comparing each compatible | ||
802 | * string of device node with all the given matches respectively. | ||
803 | * - If the above method failed, then try to match the compatible by using | ||
804 | * __of_device_is_compatible() besides the match in type and name. | ||
805 | */ | 803 | */ |
806 | const struct of_device_id *of_match_node(const struct of_device_id *matches, | 804 | const struct of_device_id *of_match_node(const struct of_device_id *matches, |
807 | const struct device_node *node) | 805 | const struct device_node *node) |
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index 875b7b6f0d2a..5b3c24f3cde5 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
@@ -24,7 +24,11 @@ MODULE_LICENSE("GPL"); | |||
24 | 24 | ||
25 | static void of_set_phy_supported(struct phy_device *phydev, u32 max_speed) | 25 | static void of_set_phy_supported(struct phy_device *phydev, u32 max_speed) |
26 | { | 26 | { |
27 | phydev->supported |= PHY_DEFAULT_FEATURES; | 27 | /* The default values for phydev->supported are provided by the PHY |
28 | * driver "features" member, we want to reset to sane defaults fist | ||
29 | * before supporting higher speeds. | ||
30 | */ | ||
31 | phydev->supported &= PHY_DEFAULT_FEATURES; | ||
28 | 32 | ||
29 | switch (max_speed) { | 33 | switch (max_speed) { |
30 | default: | 34 | default: |
@@ -44,7 +48,7 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio, struct device_node *chi | |||
44 | { | 48 | { |
45 | struct phy_device *phy; | 49 | struct phy_device *phy; |
46 | bool is_c45; | 50 | bool is_c45; |
47 | int rc, prev_irq; | 51 | int rc; |
48 | u32 max_speed = 0; | 52 | u32 max_speed = 0; |
49 | 53 | ||
50 | is_c45 = of_device_is_compatible(child, | 54 | is_c45 = of_device_is_compatible(child, |
@@ -54,12 +58,14 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio, struct device_node *chi | |||
54 | if (!phy || IS_ERR(phy)) | 58 | if (!phy || IS_ERR(phy)) |
55 | return 1; | 59 | return 1; |
56 | 60 | ||
57 | if (mdio->irq) { | 61 | rc = irq_of_parse_and_map(child, 0); |
58 | prev_irq = mdio->irq[addr]; | 62 | if (rc > 0) { |
59 | mdio->irq[addr] = | 63 | phy->irq = rc; |
60 | irq_of_parse_and_map(child, 0); | 64 | if (mdio->irq) |
61 | if (!mdio->irq[addr]) | 65 | mdio->irq[addr] = rc; |
62 | mdio->irq[addr] = prev_irq; | 66 | } else { |
67 | if (mdio->irq) | ||
68 | phy->irq = mdio->irq[addr]; | ||
63 | } | 69 | } |
64 | 70 | ||
65 | /* Associate the OF node with the device structure so it | 71 | /* Associate the OF node with the device structure so it |
diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c index e21012bde639..6643d1920985 100644 --- a/drivers/of/selftest.c +++ b/drivers/of/selftest.c | |||
@@ -300,6 +300,72 @@ static void __init of_selftest_parse_interrupts_extended(void) | |||
300 | of_node_put(np); | 300 | of_node_put(np); |
301 | } | 301 | } |
302 | 302 | ||
303 | static struct of_device_id match_node_table[] = { | ||
304 | { .data = "A", .name = "name0", }, /* Name alone is lowest priority */ | ||
305 | { .data = "B", .type = "type1", }, /* followed by type alone */ | ||
306 | |||
307 | { .data = "Ca", .name = "name2", .type = "type1", }, /* followed by both together */ | ||
308 | { .data = "Cb", .name = "name2", }, /* Only match when type doesn't match */ | ||
309 | { .data = "Cc", .name = "name2", .type = "type2", }, | ||
310 | |||
311 | { .data = "E", .compatible = "compat3" }, | ||
312 | { .data = "G", .compatible = "compat2", }, | ||
313 | { .data = "H", .compatible = "compat2", .name = "name5", }, | ||
314 | { .data = "I", .compatible = "compat2", .type = "type1", }, | ||
315 | { .data = "J", .compatible = "compat2", .type = "type1", .name = "name8", }, | ||
316 | { .data = "K", .compatible = "compat2", .name = "name9", }, | ||
317 | {} | ||
318 | }; | ||
319 | |||
320 | static struct { | ||
321 | const char *path; | ||
322 | const char *data; | ||
323 | } match_node_tests[] = { | ||
324 | { .path = "/testcase-data/match-node/name0", .data = "A", }, | ||
325 | { .path = "/testcase-data/match-node/name1", .data = "B", }, | ||
326 | { .path = "/testcase-data/match-node/a/name2", .data = "Ca", }, | ||
327 | { .path = "/testcase-data/match-node/b/name2", .data = "Cb", }, | ||
328 | { .path = "/testcase-data/match-node/c/name2", .data = "Cc", }, | ||
329 | { .path = "/testcase-data/match-node/name3", .data = "E", }, | ||
330 | { .path = "/testcase-data/match-node/name4", .data = "G", }, | ||
331 | { .path = "/testcase-data/match-node/name5", .data = "H", }, | ||
332 | { .path = "/testcase-data/match-node/name6", .data = "G", }, | ||
333 | { .path = "/testcase-data/match-node/name7", .data = "I", }, | ||
334 | { .path = "/testcase-data/match-node/name8", .data = "J", }, | ||
335 | { .path = "/testcase-data/match-node/name9", .data = "K", }, | ||
336 | }; | ||
337 | |||
338 | static void __init of_selftest_match_node(void) | ||
339 | { | ||
340 | struct device_node *np; | ||
341 | const struct of_device_id *match; | ||
342 | int i; | ||
343 | |||
344 | for (i = 0; i < ARRAY_SIZE(match_node_tests); i++) { | ||
345 | np = of_find_node_by_path(match_node_tests[i].path); | ||
346 | if (!np) { | ||
347 | selftest(0, "missing testcase node %s\n", | ||
348 | match_node_tests[i].path); | ||
349 | continue; | ||
350 | } | ||
351 | |||
352 | match = of_match_node(match_node_table, np); | ||
353 | if (!match) { | ||
354 | selftest(0, "%s didn't match anything\n", | ||
355 | match_node_tests[i].path); | ||
356 | continue; | ||
357 | } | ||
358 | |||
359 | if (strcmp(match->data, match_node_tests[i].data) != 0) { | ||
360 | selftest(0, "%s got wrong match. expected %s, got %s\n", | ||
361 | match_node_tests[i].path, match_node_tests[i].data, | ||
362 | (const char *)match->data); | ||
363 | continue; | ||
364 | } | ||
365 | selftest(1, "passed"); | ||
366 | } | ||
367 | } | ||
368 | |||
303 | static int __init of_selftest(void) | 369 | static int __init of_selftest(void) |
304 | { | 370 | { |
305 | struct device_node *np; | 371 | struct device_node *np; |
@@ -316,6 +382,7 @@ static int __init of_selftest(void) | |||
316 | of_selftest_property_match_string(); | 382 | of_selftest_property_match_string(); |
317 | of_selftest_parse_interrupts(); | 383 | of_selftest_parse_interrupts(); |
318 | of_selftest_parse_interrupts_extended(); | 384 | of_selftest_parse_interrupts_extended(); |
385 | of_selftest_match_node(); | ||
319 | pr_info("end of selftest - %i passed, %i failed\n", | 386 | pr_info("end of selftest - %i passed, %i failed\n", |
320 | selftest_results.passed, selftest_results.failed); | 387 | selftest_results.passed, selftest_results.failed); |
321 | return 0; | 388 | return 0; |
diff --git a/drivers/of/testcase-data/testcases.dtsi b/drivers/of/testcase-data/testcases.dtsi new file mode 100644 index 000000000000..3a5b75a8e4d7 --- /dev/null +++ b/drivers/of/testcase-data/testcases.dtsi | |||
@@ -0,0 +1,3 @@ | |||
1 | #include "tests-phandle.dtsi" | ||
2 | #include "tests-interrupts.dtsi" | ||
3 | #include "tests-match.dtsi" | ||
diff --git a/drivers/of/testcase-data/tests-interrupts.dtsi b/drivers/of/testcase-data/tests-interrupts.dtsi new file mode 100644 index 000000000000..c843720bd3e5 --- /dev/null +++ b/drivers/of/testcase-data/tests-interrupts.dtsi | |||
@@ -0,0 +1,58 @@ | |||
1 | |||
2 | / { | ||
3 | testcase-data { | ||
4 | interrupts { | ||
5 | #address-cells = <1>; | ||
6 | #size-cells = <1>; | ||
7 | test_intc0: intc0 { | ||
8 | interrupt-controller; | ||
9 | #interrupt-cells = <1>; | ||
10 | }; | ||
11 | |||
12 | test_intc1: intc1 { | ||
13 | interrupt-controller; | ||
14 | #interrupt-cells = <3>; | ||
15 | }; | ||
16 | |||
17 | test_intc2: intc2 { | ||
18 | interrupt-controller; | ||
19 | #interrupt-cells = <2>; | ||
20 | }; | ||
21 | |||
22 | test_intmap0: intmap0 { | ||
23 | #interrupt-cells = <1>; | ||
24 | #address-cells = <0>; | ||
25 | interrupt-map = <1 &test_intc0 9>, | ||
26 | <2 &test_intc1 10 11 12>, | ||
27 | <3 &test_intc2 13 14>, | ||
28 | <4 &test_intc2 15 16>; | ||
29 | }; | ||
30 | |||
31 | test_intmap1: intmap1 { | ||
32 | #interrupt-cells = <2>; | ||
33 | interrupt-map = <0x5000 1 2 &test_intc0 15>; | ||
34 | }; | ||
35 | |||
36 | interrupts0 { | ||
37 | interrupt-parent = <&test_intc0>; | ||
38 | interrupts = <1>, <2>, <3>, <4>; | ||
39 | }; | ||
40 | |||
41 | interrupts1 { | ||
42 | interrupt-parent = <&test_intmap0>; | ||
43 | interrupts = <1>, <2>, <3>, <4>; | ||
44 | }; | ||
45 | |||
46 | interrupts-extended0 { | ||
47 | reg = <0x5000 0x100>; | ||
48 | interrupts-extended = <&test_intc0 1>, | ||
49 | <&test_intc1 2 3 4>, | ||
50 | <&test_intc2 5 6>, | ||
51 | <&test_intmap0 1>, | ||
52 | <&test_intmap0 2>, | ||
53 | <&test_intmap0 3>, | ||
54 | <&test_intmap1 1 2>; | ||
55 | }; | ||
56 | }; | ||
57 | }; | ||
58 | }; | ||
diff --git a/drivers/of/testcase-data/tests-match.dtsi b/drivers/of/testcase-data/tests-match.dtsi new file mode 100644 index 000000000000..c9e541129534 --- /dev/null +++ b/drivers/of/testcase-data/tests-match.dtsi | |||
@@ -0,0 +1,19 @@ | |||
1 | |||
2 | / { | ||
3 | testcase-data { | ||
4 | match-node { | ||
5 | name0 { }; | ||
6 | name1 { device_type = "type1"; }; | ||
7 | a { name2 { device_type = "type1"; }; }; | ||
8 | b { name2 { }; }; | ||
9 | c { name2 { device_type = "type2"; }; }; | ||
10 | name3 { compatible = "compat3"; }; | ||
11 | name4 { compatible = "compat2", "compat3"; }; | ||
12 | name5 { compatible = "compat2", "compat3"; }; | ||
13 | name6 { compatible = "compat1", "compat2", "compat3"; }; | ||
14 | name7 { compatible = "compat2"; device_type = "type1"; }; | ||
15 | name8 { compatible = "compat2"; device_type = "type1"; }; | ||
16 | name9 { compatible = "compat2"; }; | ||
17 | }; | ||
18 | }; | ||
19 | }; | ||
diff --git a/drivers/of/testcase-data/tests-phandle.dtsi b/drivers/of/testcase-data/tests-phandle.dtsi new file mode 100644 index 000000000000..0007d3cd7dc2 --- /dev/null +++ b/drivers/of/testcase-data/tests-phandle.dtsi | |||
@@ -0,0 +1,39 @@ | |||
1 | |||
2 | / { | ||
3 | testcase-data { | ||
4 | phandle-tests { | ||
5 | provider0: provider0 { | ||
6 | #phandle-cells = <0>; | ||
7 | }; | ||
8 | |||
9 | provider1: provider1 { | ||
10 | #phandle-cells = <1>; | ||
11 | }; | ||
12 | |||
13 | provider2: provider2 { | ||
14 | #phandle-cells = <2>; | ||
15 | }; | ||
16 | |||
17 | provider3: provider3 { | ||
18 | #phandle-cells = <3>; | ||
19 | }; | ||
20 | |||
21 | consumer-a { | ||
22 | phandle-list = <&provider1 1>, | ||
23 | <&provider2 2 0>, | ||
24 | <0>, | ||
25 | <&provider3 4 4 3>, | ||
26 | <&provider2 5 100>, | ||
27 | <&provider0>, | ||
28 | <&provider1 7>; | ||
29 | phandle-list-names = "first", "second", "third"; | ||
30 | |||
31 | phandle-list-bad-phandle = <12345678 0 0>; | ||
32 | phandle-list-bad-args = <&provider2 1 0>, | ||
33 | <&provider3 0>; | ||
34 | empty-property; | ||
35 | unterminated-string = [40 41 42 43]; | ||
36 | }; | ||
37 | }; | ||
38 | }; | ||
39 | }; | ||
diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c index 13478ecd4113..0e79665afd44 100644 --- a/drivers/pci/host/pci-mvebu.c +++ b/drivers/pci/host/pci-mvebu.c | |||
@@ -60,14 +60,6 @@ | |||
60 | #define PCIE_DEBUG_CTRL 0x1a60 | 60 | #define PCIE_DEBUG_CTRL 0x1a60 |
61 | #define PCIE_DEBUG_SOFT_RESET BIT(20) | 61 | #define PCIE_DEBUG_SOFT_RESET BIT(20) |
62 | 62 | ||
63 | /* | ||
64 | * This product ID is registered by Marvell, and used when the Marvell | ||
65 | * SoC is not the root complex, but an endpoint on the PCIe bus. It is | ||
66 | * therefore safe to re-use this PCI ID for our emulated PCI-to-PCI | ||
67 | * bridge. | ||
68 | */ | ||
69 | #define MARVELL_EMULATED_PCI_PCI_BRIDGE_ID 0x7846 | ||
70 | |||
71 | /* PCI configuration space of a PCI-to-PCI bridge */ | 63 | /* PCI configuration space of a PCI-to-PCI bridge */ |
72 | struct mvebu_sw_pci_bridge { | 64 | struct mvebu_sw_pci_bridge { |
73 | u16 vendor; | 65 | u16 vendor; |
@@ -388,7 +380,8 @@ static void mvebu_sw_pci_bridge_init(struct mvebu_pcie_port *port) | |||
388 | 380 | ||
389 | bridge->class = PCI_CLASS_BRIDGE_PCI; | 381 | bridge->class = PCI_CLASS_BRIDGE_PCI; |
390 | bridge->vendor = PCI_VENDOR_ID_MARVELL; | 382 | bridge->vendor = PCI_VENDOR_ID_MARVELL; |
391 | bridge->device = MARVELL_EMULATED_PCI_PCI_BRIDGE_ID; | 383 | bridge->device = mvebu_readl(port, PCIE_DEV_ID_OFF) >> 16; |
384 | bridge->revision = mvebu_readl(port, PCIE_DEV_REV_OFF) & 0xff; | ||
392 | bridge->header_type = PCI_HEADER_TYPE_BRIDGE; | 385 | bridge->header_type = PCI_HEADER_TYPE_BRIDGE; |
393 | bridge->cache_line_size = 0x10; | 386 | bridge->cache_line_size = 0x10; |
394 | 387 | ||
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 7a0fec6ce571..955ab7990c5b 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -545,9 +545,15 @@ static int populate_msi_sysfs(struct pci_dev *pdev) | |||
545 | return -ENOMEM; | 545 | return -ENOMEM; |
546 | list_for_each_entry(entry, &pdev->msi_list, list) { | 546 | list_for_each_entry(entry, &pdev->msi_list, list) { |
547 | char *name = kmalloc(20, GFP_KERNEL); | 547 | char *name = kmalloc(20, GFP_KERNEL); |
548 | if (!name) | ||
549 | goto error_attrs; | ||
550 | |||
548 | msi_dev_attr = kzalloc(sizeof(*msi_dev_attr), GFP_KERNEL); | 551 | msi_dev_attr = kzalloc(sizeof(*msi_dev_attr), GFP_KERNEL); |
549 | if (!msi_dev_attr) | 552 | if (!msi_dev_attr) { |
553 | kfree(name); | ||
550 | goto error_attrs; | 554 | goto error_attrs; |
555 | } | ||
556 | |||
551 | sprintf(name, "%d", entry->irq); | 557 | sprintf(name, "%d", entry->irq); |
552 | sysfs_attr_init(&msi_dev_attr->attr); | 558 | sysfs_attr_init(&msi_dev_attr->attr); |
553 | msi_dev_attr->attr.name = name; | 559 | msi_dev_attr->attr.name = name; |
@@ -589,6 +595,7 @@ error_attrs: | |||
589 | ++count; | 595 | ++count; |
590 | msi_attr = msi_attrs[count]; | 596 | msi_attr = msi_attrs[count]; |
591 | } | 597 | } |
598 | kfree(msi_attrs); | ||
592 | return ret; | 599 | return ret; |
593 | } | 600 | } |
594 | 601 | ||
@@ -959,7 +966,6 @@ EXPORT_SYMBOL(pci_disable_msi); | |||
959 | /** | 966 | /** |
960 | * pci_msix_vec_count - return the number of device's MSI-X table entries | 967 | * pci_msix_vec_count - return the number of device's MSI-X table entries |
961 | * @dev: pointer to the pci_dev data structure of MSI-X device function | 968 | * @dev: pointer to the pci_dev data structure of MSI-X device function |
962 | |||
963 | * This function returns the number of device's MSI-X table entries and | 969 | * This function returns the number of device's MSI-X table entries and |
964 | * therefore the number of MSI-X vectors device is capable of sending. | 970 | * therefore the number of MSI-X vectors device is capable of sending. |
965 | * It returns a negative errno if the device is not capable of sending MSI-X | 971 | * It returns a negative errno if the device is not capable of sending MSI-X |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 1febe90831b4..6b05f6134b68 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -1181,6 +1181,8 @@ EXPORT_SYMBOL_GPL(pci_load_and_free_saved_state); | |||
1181 | static int do_pci_enable_device(struct pci_dev *dev, int bars) | 1181 | static int do_pci_enable_device(struct pci_dev *dev, int bars) |
1182 | { | 1182 | { |
1183 | int err; | 1183 | int err; |
1184 | u16 cmd; | ||
1185 | u8 pin; | ||
1184 | 1186 | ||
1185 | err = pci_set_power_state(dev, PCI_D0); | 1187 | err = pci_set_power_state(dev, PCI_D0); |
1186 | if (err < 0 && err != -EIO) | 1188 | if (err < 0 && err != -EIO) |
@@ -1190,6 +1192,14 @@ static int do_pci_enable_device(struct pci_dev *dev, int bars) | |||
1190 | return err; | 1192 | return err; |
1191 | pci_fixup_device(pci_fixup_enable, dev); | 1193 | pci_fixup_device(pci_fixup_enable, dev); |
1192 | 1194 | ||
1195 | pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); | ||
1196 | if (pin) { | ||
1197 | pci_read_config_word(dev, PCI_COMMAND, &cmd); | ||
1198 | if (cmd & PCI_COMMAND_INTX_DISABLE) | ||
1199 | pci_write_config_word(dev, PCI_COMMAND, | ||
1200 | cmd & ~PCI_COMMAND_INTX_DISABLE); | ||
1201 | } | ||
1202 | |||
1193 | return 0; | 1203 | return 0; |
1194 | } | 1204 | } |
1195 | 1205 | ||
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index afa2354f6600..c7a551c2d5f1 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig | |||
@@ -5,7 +5,7 @@ | |||
5 | menu "PHY Subsystem" | 5 | menu "PHY Subsystem" |
6 | 6 | ||
7 | config GENERIC_PHY | 7 | config GENERIC_PHY |
8 | tristate "PHY Core" | 8 | bool "PHY Core" |
9 | help | 9 | help |
10 | Generic PHY support. | 10 | Generic PHY support. |
11 | 11 | ||
@@ -61,6 +61,7 @@ config PHY_EXYNOS_DP_VIDEO | |||
61 | config BCM_KONA_USB2_PHY | 61 | config BCM_KONA_USB2_PHY |
62 | tristate "Broadcom Kona USB2 PHY Driver" | 62 | tristate "Broadcom Kona USB2 PHY Driver" |
63 | depends on GENERIC_PHY | 63 | depends on GENERIC_PHY |
64 | depends on HAS_IOMEM | ||
64 | help | 65 | help |
65 | Enable this to support the Broadcom Kona USB 2.0 PHY. | 66 | Enable this to support the Broadcom Kona USB 2.0 PHY. |
66 | 67 | ||
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 5f5b0f4be5be..6c738376daff 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c | |||
@@ -176,6 +176,8 @@ int phy_init(struct phy *phy) | |||
176 | dev_err(&phy->dev, "phy init failed --> %d\n", ret); | 176 | dev_err(&phy->dev, "phy init failed --> %d\n", ret); |
177 | goto out; | 177 | goto out; |
178 | } | 178 | } |
179 | } else { | ||
180 | ret = 0; /* Override possible ret == -ENOTSUPP */ | ||
179 | } | 181 | } |
180 | ++phy->init_count; | 182 | ++phy->init_count; |
181 | 183 | ||
@@ -232,6 +234,8 @@ int phy_power_on(struct phy *phy) | |||
232 | dev_err(&phy->dev, "phy poweron failed --> %d\n", ret); | 234 | dev_err(&phy->dev, "phy poweron failed --> %d\n", ret); |
233 | goto out; | 235 | goto out; |
234 | } | 236 | } |
237 | } else { | ||
238 | ret = 0; /* Override possible ret == -ENOTSUPP */ | ||
235 | } | 239 | } |
236 | ++phy->power_count; | 240 | ++phy->power_count; |
237 | mutex_unlock(&phy->mutex); | 241 | mutex_unlock(&phy->mutex); |
@@ -404,17 +408,11 @@ struct phy *phy_get(struct device *dev, const char *string) | |||
404 | index = of_property_match_string(dev->of_node, "phy-names", | 408 | index = of_property_match_string(dev->of_node, "phy-names", |
405 | string); | 409 | string); |
406 | phy = of_phy_get(dev, index); | 410 | phy = of_phy_get(dev, index); |
407 | if (IS_ERR(phy)) { | ||
408 | dev_err(dev, "unable to find phy\n"); | ||
409 | return phy; | ||
410 | } | ||
411 | } else { | 411 | } else { |
412 | phy = phy_lookup(dev, string); | 412 | phy = phy_lookup(dev, string); |
413 | if (IS_ERR(phy)) { | ||
414 | dev_err(dev, "unable to find phy\n"); | ||
415 | return phy; | ||
416 | } | ||
417 | } | 413 | } |
414 | if (IS_ERR(phy)) | ||
415 | return phy; | ||
418 | 416 | ||
419 | if (!try_module_get(phy->ops->owner)) | 417 | if (!try_module_get(phy->ops->owner)) |
420 | return ERR_PTR(-EPROBE_DEFER); | 418 | return ERR_PTR(-EPROBE_DEFER); |
diff --git a/drivers/phy/phy-exynos-dp-video.c b/drivers/phy/phy-exynos-dp-video.c index 1dbe6ce7b2ce..0786fef842e7 100644 --- a/drivers/phy/phy-exynos-dp-video.c +++ b/drivers/phy/phy-exynos-dp-video.c | |||
@@ -76,10 +76,6 @@ static int exynos_dp_video_phy_probe(struct platform_device *pdev) | |||
76 | if (IS_ERR(state->regs)) | 76 | if (IS_ERR(state->regs)) |
77 | return PTR_ERR(state->regs); | 77 | return PTR_ERR(state->regs); |
78 | 78 | ||
79 | phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); | ||
80 | if (IS_ERR(phy_provider)) | ||
81 | return PTR_ERR(phy_provider); | ||
82 | |||
83 | phy = devm_phy_create(dev, &exynos_dp_video_phy_ops, NULL); | 79 | phy = devm_phy_create(dev, &exynos_dp_video_phy_ops, NULL); |
84 | if (IS_ERR(phy)) { | 80 | if (IS_ERR(phy)) { |
85 | dev_err(dev, "failed to create Display Port PHY\n"); | 81 | dev_err(dev, "failed to create Display Port PHY\n"); |
@@ -87,6 +83,10 @@ static int exynos_dp_video_phy_probe(struct platform_device *pdev) | |||
87 | } | 83 | } |
88 | phy_set_drvdata(phy, state); | 84 | phy_set_drvdata(phy, state); |
89 | 85 | ||
86 | phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); | ||
87 | if (IS_ERR(phy_provider)) | ||
88 | return PTR_ERR(phy_provider); | ||
89 | |||
90 | return 0; | 90 | return 0; |
91 | } | 91 | } |
92 | 92 | ||
diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c index 0c5efab11af1..7f139326a642 100644 --- a/drivers/phy/phy-exynos-mipi-video.c +++ b/drivers/phy/phy-exynos-mipi-video.c | |||
@@ -134,11 +134,6 @@ static int exynos_mipi_video_phy_probe(struct platform_device *pdev) | |||
134 | dev_set_drvdata(dev, state); | 134 | dev_set_drvdata(dev, state); |
135 | spin_lock_init(&state->slock); | 135 | spin_lock_init(&state->slock); |
136 | 136 | ||
137 | phy_provider = devm_of_phy_provider_register(dev, | ||
138 | exynos_mipi_video_phy_xlate); | ||
139 | if (IS_ERR(phy_provider)) | ||
140 | return PTR_ERR(phy_provider); | ||
141 | |||
142 | for (i = 0; i < EXYNOS_MIPI_PHYS_NUM; i++) { | 137 | for (i = 0; i < EXYNOS_MIPI_PHYS_NUM; i++) { |
143 | struct phy *phy = devm_phy_create(dev, | 138 | struct phy *phy = devm_phy_create(dev, |
144 | &exynos_mipi_video_phy_ops, NULL); | 139 | &exynos_mipi_video_phy_ops, NULL); |
@@ -152,6 +147,11 @@ static int exynos_mipi_video_phy_probe(struct platform_device *pdev) | |||
152 | phy_set_drvdata(phy, &state->phys[i]); | 147 | phy_set_drvdata(phy, &state->phys[i]); |
153 | } | 148 | } |
154 | 149 | ||
150 | phy_provider = devm_of_phy_provider_register(dev, | ||
151 | exynos_mipi_video_phy_xlate); | ||
152 | if (IS_ERR(phy_provider)) | ||
153 | return PTR_ERR(phy_provider); | ||
154 | |||
155 | return 0; | 155 | return 0; |
156 | } | 156 | } |
157 | 157 | ||
diff --git a/drivers/phy/phy-mvebu-sata.c b/drivers/phy/phy-mvebu-sata.c index d43786f62437..d70ecd6a1b3f 100644 --- a/drivers/phy/phy-mvebu-sata.c +++ b/drivers/phy/phy-mvebu-sata.c | |||
@@ -99,17 +99,17 @@ static int phy_mvebu_sata_probe(struct platform_device *pdev) | |||
99 | if (IS_ERR(priv->clk)) | 99 | if (IS_ERR(priv->clk)) |
100 | return PTR_ERR(priv->clk); | 100 | return PTR_ERR(priv->clk); |
101 | 101 | ||
102 | phy_provider = devm_of_phy_provider_register(&pdev->dev, | ||
103 | of_phy_simple_xlate); | ||
104 | if (IS_ERR(phy_provider)) | ||
105 | return PTR_ERR(phy_provider); | ||
106 | |||
107 | phy = devm_phy_create(&pdev->dev, &phy_mvebu_sata_ops, NULL); | 102 | phy = devm_phy_create(&pdev->dev, &phy_mvebu_sata_ops, NULL); |
108 | if (IS_ERR(phy)) | 103 | if (IS_ERR(phy)) |
109 | return PTR_ERR(phy); | 104 | return PTR_ERR(phy); |
110 | 105 | ||
111 | phy_set_drvdata(phy, priv); | 106 | phy_set_drvdata(phy, priv); |
112 | 107 | ||
108 | phy_provider = devm_of_phy_provider_register(&pdev->dev, | ||
109 | of_phy_simple_xlate); | ||
110 | if (IS_ERR(phy_provider)) | ||
111 | return PTR_ERR(phy_provider); | ||
112 | |||
113 | /* The boot loader may of left it on. Turn it off. */ | 113 | /* The boot loader may of left it on. Turn it off. */ |
114 | phy_mvebu_sata_power_off(phy); | 114 | phy_mvebu_sata_power_off(phy); |
115 | 115 | ||
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index bfc5c337f99a..7699752fba11 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c | |||
@@ -177,11 +177,6 @@ static int omap_usb2_probe(struct platform_device *pdev) | |||
177 | phy->phy.otg = otg; | 177 | phy->phy.otg = otg; |
178 | phy->phy.type = USB_PHY_TYPE_USB2; | 178 | phy->phy.type = USB_PHY_TYPE_USB2; |
179 | 179 | ||
180 | phy_provider = devm_of_phy_provider_register(phy->dev, | ||
181 | of_phy_simple_xlate); | ||
182 | if (IS_ERR(phy_provider)) | ||
183 | return PTR_ERR(phy_provider); | ||
184 | |||
185 | control_node = of_parse_phandle(node, "ctrl-module", 0); | 180 | control_node = of_parse_phandle(node, "ctrl-module", 0); |
186 | if (!control_node) { | 181 | if (!control_node) { |
187 | dev_err(&pdev->dev, "Failed to get control device phandle\n"); | 182 | dev_err(&pdev->dev, "Failed to get control device phandle\n"); |
@@ -214,6 +209,11 @@ static int omap_usb2_probe(struct platform_device *pdev) | |||
214 | 209 | ||
215 | phy_set_drvdata(generic_phy, phy); | 210 | phy_set_drvdata(generic_phy, phy); |
216 | 211 | ||
212 | phy_provider = devm_of_phy_provider_register(phy->dev, | ||
213 | of_phy_simple_xlate); | ||
214 | if (IS_ERR(phy_provider)) | ||
215 | return PTR_ERR(phy_provider); | ||
216 | |||
217 | phy->wkupclk = devm_clk_get(phy->dev, "usb_phy_cm_clk32k"); | 217 | phy->wkupclk = devm_clk_get(phy->dev, "usb_phy_cm_clk32k"); |
218 | if (IS_ERR(phy->wkupclk)) { | 218 | if (IS_ERR(phy->wkupclk)) { |
219 | dev_err(&pdev->dev, "unable to get usb_phy_cm_clk32k\n"); | 219 | dev_err(&pdev->dev, "unable to get usb_phy_cm_clk32k\n"); |
diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c index daf65e68aaab..c3ace1db8136 100644 --- a/drivers/phy/phy-twl4030-usb.c +++ b/drivers/phy/phy-twl4030-usb.c | |||
@@ -695,11 +695,6 @@ static int twl4030_usb_probe(struct platform_device *pdev) | |||
695 | otg->set_host = twl4030_set_host; | 695 | otg->set_host = twl4030_set_host; |
696 | otg->set_peripheral = twl4030_set_peripheral; | 696 | otg->set_peripheral = twl4030_set_peripheral; |
697 | 697 | ||
698 | phy_provider = devm_of_phy_provider_register(twl->dev, | ||
699 | of_phy_simple_xlate); | ||
700 | if (IS_ERR(phy_provider)) | ||
701 | return PTR_ERR(phy_provider); | ||
702 | |||
703 | phy = devm_phy_create(twl->dev, &ops, init_data); | 698 | phy = devm_phy_create(twl->dev, &ops, init_data); |
704 | if (IS_ERR(phy)) { | 699 | if (IS_ERR(phy)) { |
705 | dev_dbg(&pdev->dev, "Failed to create PHY\n"); | 700 | dev_dbg(&pdev->dev, "Failed to create PHY\n"); |
@@ -708,6 +703,11 @@ static int twl4030_usb_probe(struct platform_device *pdev) | |||
708 | 703 | ||
709 | phy_set_drvdata(phy, twl); | 704 | phy_set_drvdata(phy, twl); |
710 | 705 | ||
706 | phy_provider = devm_of_phy_provider_register(twl->dev, | ||
707 | of_phy_simple_xlate); | ||
708 | if (IS_ERR(phy_provider)) | ||
709 | return PTR_ERR(phy_provider); | ||
710 | |||
711 | /* init spinlock for workqueue */ | 711 | /* init spinlock for workqueue */ |
712 | spin_lock_init(&twl->lock); | 712 | spin_lock_init(&twl->lock); |
713 | 713 | ||
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index be361b7cd30f..1e4e69384baa 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig | |||
@@ -217,7 +217,7 @@ config PINCTRL_IMX28 | |||
217 | select PINCTRL_MXS | 217 | select PINCTRL_MXS |
218 | 218 | ||
219 | config PINCTRL_MSM | 219 | config PINCTRL_MSM |
220 | tristate | 220 | bool |
221 | select PINMUX | 221 | select PINMUX |
222 | select PINCONF | 222 | select PINCONF |
223 | select GENERIC_PINCONF | 223 | select GENERIC_PINCONF |
diff --git a/drivers/pinctrl/pinctrl-capri.c b/drivers/pinctrl/pinctrl-capri.c index 4669c53f99b0..eb2500212147 100644 --- a/drivers/pinctrl/pinctrl-capri.c +++ b/drivers/pinctrl/pinctrl-capri.c | |||
@@ -1435,7 +1435,7 @@ int __init capri_pinctrl_probe(struct platform_device *pdev) | |||
1435 | } | 1435 | } |
1436 | 1436 | ||
1437 | static struct of_device_id capri_pinctrl_of_match[] = { | 1437 | static struct of_device_id capri_pinctrl_of_match[] = { |
1438 | { .compatible = "brcm,capri-pinctrl", }, | 1438 | { .compatible = "brcm,bcm11351-pinctrl", }, |
1439 | { }, | 1439 | { }, |
1440 | }; | 1440 | }; |
1441 | 1441 | ||
diff --git a/drivers/pinctrl/pinctrl-sunxi.c b/drivers/pinctrl/pinctrl-sunxi.c index 9ccf681dad2f..f9fabe9bf47d 100644 --- a/drivers/pinctrl/pinctrl-sunxi.c +++ b/drivers/pinctrl/pinctrl-sunxi.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/clk.h> | 14 | #include <linux/clk.h> |
15 | #include <linux/gpio.h> | 15 | #include <linux/gpio.h> |
16 | #include <linux/irqdomain.h> | 16 | #include <linux/irqdomain.h> |
17 | #include <linux/irqchip/chained_irq.h> | ||
17 | #include <linux/module.h> | 18 | #include <linux/module.h> |
18 | #include <linux/of.h> | 19 | #include <linux/of.h> |
19 | #include <linux/of_address.h> | 20 | #include <linux/of_address.h> |
@@ -584,7 +585,7 @@ static int sunxi_pinctrl_irq_set_type(struct irq_data *d, | |||
584 | spin_lock_irqsave(&pctl->lock, flags); | 585 | spin_lock_irqsave(&pctl->lock, flags); |
585 | 586 | ||
586 | regval = readl(pctl->membase + reg); | 587 | regval = readl(pctl->membase + reg); |
587 | regval &= ~IRQ_CFG_IRQ_MASK; | 588 | regval &= ~(IRQ_CFG_IRQ_MASK << index); |
588 | writel(regval | (mode << index), pctl->membase + reg); | 589 | writel(regval | (mode << index), pctl->membase + reg); |
589 | 590 | ||
590 | spin_unlock_irqrestore(&pctl->lock, flags); | 591 | spin_unlock_irqrestore(&pctl->lock, flags); |
@@ -665,6 +666,7 @@ static struct irq_chip sunxi_pinctrl_irq_chip = { | |||
665 | 666 | ||
666 | static void sunxi_pinctrl_irq_handler(unsigned irq, struct irq_desc *desc) | 667 | static void sunxi_pinctrl_irq_handler(unsigned irq, struct irq_desc *desc) |
667 | { | 668 | { |
669 | struct irq_chip *chip = irq_get_chip(irq); | ||
668 | struct sunxi_pinctrl *pctl = irq_get_handler_data(irq); | 670 | struct sunxi_pinctrl *pctl = irq_get_handler_data(irq); |
669 | const unsigned long reg = readl(pctl->membase + IRQ_STATUS_REG); | 671 | const unsigned long reg = readl(pctl->membase + IRQ_STATUS_REG); |
670 | 672 | ||
@@ -674,10 +676,12 @@ static void sunxi_pinctrl_irq_handler(unsigned irq, struct irq_desc *desc) | |||
674 | if (reg) { | 676 | if (reg) { |
675 | int irqoffset; | 677 | int irqoffset; |
676 | 678 | ||
679 | chained_irq_enter(chip, desc); | ||
677 | for_each_set_bit(irqoffset, ®, SUNXI_IRQ_NUMBER) { | 680 | for_each_set_bit(irqoffset, ®, SUNXI_IRQ_NUMBER) { |
678 | int pin_irq = irq_find_mapping(pctl->domain, irqoffset); | 681 | int pin_irq = irq_find_mapping(pctl->domain, irqoffset); |
679 | generic_handle_irq(pin_irq); | 682 | generic_handle_irq(pin_irq); |
680 | } | 683 | } |
684 | chained_irq_exit(chip, desc); | ||
681 | } | 685 | } |
682 | } | 686 | } |
683 | 687 | ||
diff --git a/drivers/pinctrl/pinctrl-sunxi.h b/drivers/pinctrl/pinctrl-sunxi.h index 01c494f8a14f..552b0e97077a 100644 --- a/drivers/pinctrl/pinctrl-sunxi.h +++ b/drivers/pinctrl/pinctrl-sunxi.h | |||
@@ -511,7 +511,7 @@ static inline u32 sunxi_pull_offset(u16 pin) | |||
511 | 511 | ||
512 | static inline u32 sunxi_irq_cfg_reg(u16 irq) | 512 | static inline u32 sunxi_irq_cfg_reg(u16 irq) |
513 | { | 513 | { |
514 | u8 reg = irq / IRQ_CFG_IRQ_PER_REG; | 514 | u8 reg = irq / IRQ_CFG_IRQ_PER_REG * 0x04; |
515 | return reg + IRQ_CFG_REG; | 515 | return reg + IRQ_CFG_REG; |
516 | } | 516 | } |
517 | 517 | ||
@@ -523,7 +523,7 @@ static inline u32 sunxi_irq_cfg_offset(u16 irq) | |||
523 | 523 | ||
524 | static inline u32 sunxi_irq_ctrl_reg(u16 irq) | 524 | static inline u32 sunxi_irq_ctrl_reg(u16 irq) |
525 | { | 525 | { |
526 | u8 reg = irq / IRQ_CTRL_IRQ_PER_REG; | 526 | u8 reg = irq / IRQ_CTRL_IRQ_PER_REG * 0x04; |
527 | return reg + IRQ_CTRL_REG; | 527 | return reg + IRQ_CTRL_REG; |
528 | } | 528 | } |
529 | 529 | ||
@@ -535,7 +535,7 @@ static inline u32 sunxi_irq_ctrl_offset(u16 irq) | |||
535 | 535 | ||
536 | static inline u32 sunxi_irq_status_reg(u16 irq) | 536 | static inline u32 sunxi_irq_status_reg(u16 irq) |
537 | { | 537 | { |
538 | u8 reg = irq / IRQ_STATUS_IRQ_PER_REG; | 538 | u8 reg = irq / IRQ_STATUS_IRQ_PER_REG * 0x04; |
539 | return reg + IRQ_STATUS_REG; | 539 | return reg + IRQ_STATUS_REG; |
540 | } | 540 | } |
541 | 541 | ||
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c index 77d103fe39d9..567d6918d50b 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c | |||
@@ -89,7 +89,8 @@ enum { | |||
89 | 89 | ||
90 | /* GPSR6 */ | 90 | /* GPSR6 */ |
91 | FN_IP13_10, FN_IP13_11, FN_IP13_12, FN_IP13_13, FN_IP13_14, | 91 | FN_IP13_10, FN_IP13_11, FN_IP13_12, FN_IP13_13, FN_IP13_14, |
92 | FN_IP13_15, FN_IP13_18_16, FN_IP13_21_19, FN_IP13_22, FN_IP13_24_23, | 92 | FN_IP13_15, FN_IP13_18_16, FN_IP13_21_19, |
93 | FN_IP13_22, FN_IP13_24_23, FN_SD1_CLK, | ||
93 | FN_IP13_25, FN_IP13_26, FN_IP13_27, FN_IP13_30_28, FN_IP14_1_0, | 94 | FN_IP13_25, FN_IP13_26, FN_IP13_27, FN_IP13_30_28, FN_IP14_1_0, |
94 | FN_IP14_2, FN_IP14_3, FN_IP14_4, FN_IP14_5, FN_IP14_6, FN_IP14_7, | 95 | FN_IP14_2, FN_IP14_3, FN_IP14_4, FN_IP14_5, FN_IP14_6, FN_IP14_7, |
95 | FN_IP14_10_8, FN_IP14_13_11, FN_IP14_16_14, FN_IP14_19_17, | 96 | FN_IP14_10_8, FN_IP14_13_11, FN_IP14_16_14, FN_IP14_19_17, |
@@ -788,6 +789,7 @@ static const u16 pinmux_data[] = { | |||
788 | PINMUX_DATA(USB1_PWEN_MARK, FN_USB1_PWEN), | 789 | PINMUX_DATA(USB1_PWEN_MARK, FN_USB1_PWEN), |
789 | PINMUX_DATA(USB1_OVC_MARK, FN_USB1_OVC), | 790 | PINMUX_DATA(USB1_OVC_MARK, FN_USB1_OVC), |
790 | PINMUX_DATA(DU0_DOTCLKIN_MARK, FN_DU0_DOTCLKIN), | 791 | PINMUX_DATA(DU0_DOTCLKIN_MARK, FN_DU0_DOTCLKIN), |
792 | PINMUX_DATA(SD1_CLK_MARK, FN_SD1_CLK), | ||
791 | 793 | ||
792 | /* IPSR0 */ | 794 | /* IPSR0 */ |
793 | PINMUX_IPSR_DATA(IP0_0, D0), | 795 | PINMUX_IPSR_DATA(IP0_0, D0), |
@@ -3825,7 +3827,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = { | |||
3825 | GP_6_11_FN, FN_IP13_25, | 3827 | GP_6_11_FN, FN_IP13_25, |
3826 | GP_6_10_FN, FN_IP13_24_23, | 3828 | GP_6_10_FN, FN_IP13_24_23, |
3827 | GP_6_9_FN, FN_IP13_22, | 3829 | GP_6_9_FN, FN_IP13_22, |
3828 | 0, 0, | 3830 | GP_6_8_FN, FN_SD1_CLK, |
3829 | GP_6_7_FN, FN_IP13_21_19, | 3831 | GP_6_7_FN, FN_IP13_21_19, |
3830 | GP_6_6_FN, FN_IP13_18_16, | 3832 | GP_6_6_FN, FN_IP13_18_16, |
3831 | GP_6_5_FN, FN_IP13_15, | 3833 | GP_6_5_FN, FN_IP13_15, |
diff --git a/drivers/pinctrl/sirf/pinctrl-sirf.c b/drivers/pinctrl/sirf/pinctrl-sirf.c index a0d6152701cd..617a4916b50f 100644 --- a/drivers/pinctrl/sirf/pinctrl-sirf.c +++ b/drivers/pinctrl/sirf/pinctrl-sirf.c | |||
@@ -598,7 +598,7 @@ static unsigned int sirfsoc_gpio_irq_startup(struct irq_data *d) | |||
598 | { | 598 | { |
599 | struct sirfsoc_gpio_bank *bank = irq_data_get_irq_chip_data(d); | 599 | struct sirfsoc_gpio_bank *bank = irq_data_get_irq_chip_data(d); |
600 | 600 | ||
601 | if (gpio_lock_as_irq(&bank->chip.gc, d->hwirq)) | 601 | if (gpio_lock_as_irq(&bank->chip.gc, d->hwirq % SIRFSOC_GPIO_BANK_SIZE)) |
602 | dev_err(bank->chip.gc.dev, | 602 | dev_err(bank->chip.gc.dev, |
603 | "unable to lock HW IRQ %lu for IRQ\n", | 603 | "unable to lock HW IRQ %lu for IRQ\n", |
604 | d->hwirq); | 604 | d->hwirq); |
@@ -611,7 +611,7 @@ static void sirfsoc_gpio_irq_shutdown(struct irq_data *d) | |||
611 | struct sirfsoc_gpio_bank *bank = irq_data_get_irq_chip_data(d); | 611 | struct sirfsoc_gpio_bank *bank = irq_data_get_irq_chip_data(d); |
612 | 612 | ||
613 | sirfsoc_gpio_irq_mask(d); | 613 | sirfsoc_gpio_irq_mask(d); |
614 | gpio_unlock_as_irq(&bank->chip.gc, d->hwirq); | 614 | gpio_unlock_as_irq(&bank->chip.gc, d->hwirq % SIRFSOC_GPIO_BANK_SIZE); |
615 | } | 615 | } |
616 | 616 | ||
617 | static struct irq_chip sirfsoc_irq_chip = { | 617 | static struct irq_chip sirfsoc_irq_chip = { |
diff --git a/drivers/pwm/pwm-lp3943.c b/drivers/pwm/pwm-lp3943.c index 8a843a04c224..a40b9c34e9ff 100644 --- a/drivers/pwm/pwm-lp3943.c +++ b/drivers/pwm/pwm-lp3943.c | |||
@@ -52,8 +52,10 @@ lp3943_pwm_request_map(struct lp3943_pwm *lp3943_pwm, int hwpwm) | |||
52 | offset = pwm_map->output[i]; | 52 | offset = pwm_map->output[i]; |
53 | 53 | ||
54 | /* Return an error if the pin is already assigned */ | 54 | /* Return an error if the pin is already assigned */ |
55 | if (test_and_set_bit(offset, &lp3943->pin_used)) | 55 | if (test_and_set_bit(offset, &lp3943->pin_used)) { |
56 | kfree(pwm_map); | ||
56 | return ERR_PTR(-EBUSY); | 57 | return ERR_PTR(-EBUSY); |
58 | } | ||
57 | } | 59 | } |
58 | 60 | ||
59 | return pwm_map; | 61 | return pwm_map; |
diff --git a/drivers/rapidio/devices/tsi721.h b/drivers/rapidio/devices/tsi721.h index b4b0d83f9ef6..7061ac0ad428 100644 --- a/drivers/rapidio/devices/tsi721.h +++ b/drivers/rapidio/devices/tsi721.h | |||
@@ -678,6 +678,7 @@ struct tsi721_bdma_chan { | |||
678 | struct list_head free_list; | 678 | struct list_head free_list; |
679 | dma_cookie_t completed_cookie; | 679 | dma_cookie_t completed_cookie; |
680 | struct tasklet_struct tasklet; | 680 | struct tasklet_struct tasklet; |
681 | bool active; | ||
681 | }; | 682 | }; |
682 | 683 | ||
683 | #endif /* CONFIG_RAPIDIO_DMA_ENGINE */ | 684 | #endif /* CONFIG_RAPIDIO_DMA_ENGINE */ |
diff --git a/drivers/rapidio/devices/tsi721_dma.c b/drivers/rapidio/devices/tsi721_dma.c index 502663f5f7c6..91245f5dbe81 100644 --- a/drivers/rapidio/devices/tsi721_dma.c +++ b/drivers/rapidio/devices/tsi721_dma.c | |||
@@ -206,8 +206,8 @@ void tsi721_bdma_handler(struct tsi721_bdma_chan *bdma_chan) | |||
206 | { | 206 | { |
207 | /* Disable BDMA channel interrupts */ | 207 | /* Disable BDMA channel interrupts */ |
208 | iowrite32(0, bdma_chan->regs + TSI721_DMAC_INTE); | 208 | iowrite32(0, bdma_chan->regs + TSI721_DMAC_INTE); |
209 | 209 | if (bdma_chan->active) | |
210 | tasklet_schedule(&bdma_chan->tasklet); | 210 | tasklet_schedule(&bdma_chan->tasklet); |
211 | } | 211 | } |
212 | 212 | ||
213 | #ifdef CONFIG_PCI_MSI | 213 | #ifdef CONFIG_PCI_MSI |
@@ -562,7 +562,7 @@ static int tsi721_alloc_chan_resources(struct dma_chan *dchan) | |||
562 | } | 562 | } |
563 | #endif /* CONFIG_PCI_MSI */ | 563 | #endif /* CONFIG_PCI_MSI */ |
564 | 564 | ||
565 | tasklet_enable(&bdma_chan->tasklet); | 565 | bdma_chan->active = true; |
566 | tsi721_bdma_interrupt_enable(bdma_chan, 1); | 566 | tsi721_bdma_interrupt_enable(bdma_chan, 1); |
567 | 567 | ||
568 | return bdma_chan->bd_num - 1; | 568 | return bdma_chan->bd_num - 1; |
@@ -576,9 +576,7 @@ err_out: | |||
576 | static void tsi721_free_chan_resources(struct dma_chan *dchan) | 576 | static void tsi721_free_chan_resources(struct dma_chan *dchan) |
577 | { | 577 | { |
578 | struct tsi721_bdma_chan *bdma_chan = to_tsi721_chan(dchan); | 578 | struct tsi721_bdma_chan *bdma_chan = to_tsi721_chan(dchan); |
579 | #ifdef CONFIG_PCI_MSI | ||
580 | struct tsi721_device *priv = to_tsi721(dchan->device); | 579 | struct tsi721_device *priv = to_tsi721(dchan->device); |
581 | #endif | ||
582 | LIST_HEAD(list); | 580 | LIST_HEAD(list); |
583 | 581 | ||
584 | dev_dbg(dchan->device->dev, "%s: Entry\n", __func__); | 582 | dev_dbg(dchan->device->dev, "%s: Entry\n", __func__); |
@@ -589,14 +587,25 @@ static void tsi721_free_chan_resources(struct dma_chan *dchan) | |||
589 | BUG_ON(!list_empty(&bdma_chan->active_list)); | 587 | BUG_ON(!list_empty(&bdma_chan->active_list)); |
590 | BUG_ON(!list_empty(&bdma_chan->queue)); | 588 | BUG_ON(!list_empty(&bdma_chan->queue)); |
591 | 589 | ||
592 | tasklet_disable(&bdma_chan->tasklet); | 590 | tsi721_bdma_interrupt_enable(bdma_chan, 0); |
591 | bdma_chan->active = false; | ||
592 | |||
593 | #ifdef CONFIG_PCI_MSI | ||
594 | if (priv->flags & TSI721_USING_MSIX) { | ||
595 | synchronize_irq(priv->msix[TSI721_VECT_DMA0_DONE + | ||
596 | bdma_chan->id].vector); | ||
597 | synchronize_irq(priv->msix[TSI721_VECT_DMA0_INT + | ||
598 | bdma_chan->id].vector); | ||
599 | } else | ||
600 | #endif | ||
601 | synchronize_irq(priv->pdev->irq); | ||
602 | |||
603 | tasklet_kill(&bdma_chan->tasklet); | ||
593 | 604 | ||
594 | spin_lock_bh(&bdma_chan->lock); | 605 | spin_lock_bh(&bdma_chan->lock); |
595 | list_splice_init(&bdma_chan->free_list, &list); | 606 | list_splice_init(&bdma_chan->free_list, &list); |
596 | spin_unlock_bh(&bdma_chan->lock); | 607 | spin_unlock_bh(&bdma_chan->lock); |
597 | 608 | ||
598 | tsi721_bdma_interrupt_enable(bdma_chan, 0); | ||
599 | |||
600 | #ifdef CONFIG_PCI_MSI | 609 | #ifdef CONFIG_PCI_MSI |
601 | if (priv->flags & TSI721_USING_MSIX) { | 610 | if (priv->flags & TSI721_USING_MSIX) { |
602 | free_irq(priv->msix[TSI721_VECT_DMA0_DONE + | 611 | free_irq(priv->msix[TSI721_VECT_DMA0_DONE + |
@@ -790,6 +799,7 @@ int tsi721_register_dma(struct tsi721_device *priv) | |||
790 | bdma_chan->dchan.cookie = 1; | 799 | bdma_chan->dchan.cookie = 1; |
791 | bdma_chan->dchan.chan_id = i; | 800 | bdma_chan->dchan.chan_id = i; |
792 | bdma_chan->id = i; | 801 | bdma_chan->id = i; |
802 | bdma_chan->active = false; | ||
793 | 803 | ||
794 | spin_lock_init(&bdma_chan->lock); | 804 | spin_lock_init(&bdma_chan->lock); |
795 | 805 | ||
@@ -799,7 +809,6 @@ int tsi721_register_dma(struct tsi721_device *priv) | |||
799 | 809 | ||
800 | tasklet_init(&bdma_chan->tasklet, tsi721_dma_tasklet, | 810 | tasklet_init(&bdma_chan->tasklet, tsi721_dma_tasklet, |
801 | (unsigned long)bdma_chan); | 811 | (unsigned long)bdma_chan); |
802 | tasklet_disable(&bdma_chan->tasklet); | ||
803 | list_add_tail(&bdma_chan->dchan.device_node, | 812 | list_add_tail(&bdma_chan->dchan.device_node, |
804 | &mport->dma.channels); | 813 | &mport->dma.channels); |
805 | } | 814 | } |
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 16a309e5c024..afca1bc24f26 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -953,6 +953,8 @@ static int machine_constraints_current(struct regulator_dev *rdev, | |||
953 | return 0; | 953 | return 0; |
954 | } | 954 | } |
955 | 955 | ||
956 | static int _regulator_do_enable(struct regulator_dev *rdev); | ||
957 | |||
956 | /** | 958 | /** |
957 | * set_machine_constraints - sets regulator constraints | 959 | * set_machine_constraints - sets regulator constraints |
958 | * @rdev: regulator source | 960 | * @rdev: regulator source |
@@ -1013,10 +1015,9 @@ static int set_machine_constraints(struct regulator_dev *rdev, | |||
1013 | /* If the constraints say the regulator should be on at this point | 1015 | /* If the constraints say the regulator should be on at this point |
1014 | * and we have control then make sure it is enabled. | 1016 | * and we have control then make sure it is enabled. |
1015 | */ | 1017 | */ |
1016 | if ((rdev->constraints->always_on || rdev->constraints->boot_on) && | 1018 | if (rdev->constraints->always_on || rdev->constraints->boot_on) { |
1017 | ops->enable) { | 1019 | ret = _regulator_do_enable(rdev); |
1018 | ret = ops->enable(rdev); | 1020 | if (ret < 0 && ret != -EINVAL) { |
1019 | if (ret < 0) { | ||
1020 | rdev_err(rdev, "failed to enable\n"); | 1021 | rdev_err(rdev, "failed to enable\n"); |
1021 | goto out; | 1022 | goto out; |
1022 | } | 1023 | } |
@@ -1359,7 +1360,7 @@ static struct regulator *_regulator_get(struct device *dev, const char *id, | |||
1359 | goto found; | 1360 | goto found; |
1360 | /* Don't log an error when called from regulator_get_optional() */ | 1361 | /* Don't log an error when called from regulator_get_optional() */ |
1361 | } else if (!have_full_constraints() || exclusive) { | 1362 | } else if (!have_full_constraints() || exclusive) { |
1362 | dev_err(dev, "dummy supplies not allowed\n"); | 1363 | dev_warn(dev, "dummy supplies not allowed\n"); |
1363 | } | 1364 | } |
1364 | 1365 | ||
1365 | mutex_unlock(®ulator_list_mutex); | 1366 | mutex_unlock(®ulator_list_mutex); |
@@ -1907,8 +1908,6 @@ static int _regulator_do_disable(struct regulator_dev *rdev) | |||
1907 | 1908 | ||
1908 | trace_regulator_disable_complete(rdev_get_name(rdev)); | 1909 | trace_regulator_disable_complete(rdev_get_name(rdev)); |
1909 | 1910 | ||
1910 | _notifier_call_chain(rdev, REGULATOR_EVENT_DISABLE, | ||
1911 | NULL); | ||
1912 | return 0; | 1911 | return 0; |
1913 | } | 1912 | } |
1914 | 1913 | ||
@@ -1932,6 +1931,8 @@ static int _regulator_disable(struct regulator_dev *rdev) | |||
1932 | rdev_err(rdev, "failed to disable\n"); | 1931 | rdev_err(rdev, "failed to disable\n"); |
1933 | return ret; | 1932 | return ret; |
1934 | } | 1933 | } |
1934 | _notifier_call_chain(rdev, REGULATOR_EVENT_DISABLE, | ||
1935 | NULL); | ||
1935 | } | 1936 | } |
1936 | 1937 | ||
1937 | rdev->use_count = 0; | 1938 | rdev->use_count = 0; |
@@ -1984,20 +1985,16 @@ static int _regulator_force_disable(struct regulator_dev *rdev) | |||
1984 | { | 1985 | { |
1985 | int ret = 0; | 1986 | int ret = 0; |
1986 | 1987 | ||
1987 | /* force disable */ | 1988 | ret = _regulator_do_disable(rdev); |
1988 | if (rdev->desc->ops->disable) { | 1989 | if (ret < 0) { |
1989 | /* ah well, who wants to live forever... */ | 1990 | rdev_err(rdev, "failed to force disable\n"); |
1990 | ret = rdev->desc->ops->disable(rdev); | 1991 | return ret; |
1991 | if (ret < 0) { | ||
1992 | rdev_err(rdev, "failed to force disable\n"); | ||
1993 | return ret; | ||
1994 | } | ||
1995 | /* notify other consumers that power has been forced off */ | ||
1996 | _notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE | | ||
1997 | REGULATOR_EVENT_DISABLE, NULL); | ||
1998 | } | 1992 | } |
1999 | 1993 | ||
2000 | return ret; | 1994 | _notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE | |
1995 | REGULATOR_EVENT_DISABLE, NULL); | ||
1996 | |||
1997 | return 0; | ||
2001 | } | 1998 | } |
2002 | 1999 | ||
2003 | /** | 2000 | /** |
@@ -3630,23 +3627,18 @@ int regulator_suspend_finish(void) | |||
3630 | 3627 | ||
3631 | mutex_lock(®ulator_list_mutex); | 3628 | mutex_lock(®ulator_list_mutex); |
3632 | list_for_each_entry(rdev, ®ulator_list, list) { | 3629 | list_for_each_entry(rdev, ®ulator_list, list) { |
3633 | struct regulator_ops *ops = rdev->desc->ops; | ||
3634 | |||
3635 | mutex_lock(&rdev->mutex); | 3630 | mutex_lock(&rdev->mutex); |
3636 | if ((rdev->use_count > 0 || rdev->constraints->always_on) && | 3631 | if (rdev->use_count > 0 || rdev->constraints->always_on) { |
3637 | ops->enable) { | 3632 | error = _regulator_do_enable(rdev); |
3638 | error = ops->enable(rdev); | ||
3639 | if (error) | 3633 | if (error) |
3640 | ret = error; | 3634 | ret = error; |
3641 | } else { | 3635 | } else { |
3642 | if (!have_full_constraints()) | 3636 | if (!have_full_constraints()) |
3643 | goto unlock; | 3637 | goto unlock; |
3644 | if (!ops->disable) | ||
3645 | goto unlock; | ||
3646 | if (!_regulator_is_enabled(rdev)) | 3638 | if (!_regulator_is_enabled(rdev)) |
3647 | goto unlock; | 3639 | goto unlock; |
3648 | 3640 | ||
3649 | error = ops->disable(rdev); | 3641 | error = _regulator_do_disable(rdev); |
3650 | if (error) | 3642 | if (error) |
3651 | ret = error; | 3643 | ret = error; |
3652 | } | 3644 | } |
@@ -3820,7 +3812,7 @@ static int __init regulator_init_complete(void) | |||
3820 | ops = rdev->desc->ops; | 3812 | ops = rdev->desc->ops; |
3821 | c = rdev->constraints; | 3813 | c = rdev->constraints; |
3822 | 3814 | ||
3823 | if (!ops->disable || (c && c->always_on)) | 3815 | if (c && c->always_on) |
3824 | continue; | 3816 | continue; |
3825 | 3817 | ||
3826 | mutex_lock(&rdev->mutex); | 3818 | mutex_lock(&rdev->mutex); |
@@ -3841,7 +3833,7 @@ static int __init regulator_init_complete(void) | |||
3841 | /* We log since this may kill the system if it | 3833 | /* We log since this may kill the system if it |
3842 | * goes wrong. */ | 3834 | * goes wrong. */ |
3843 | rdev_info(rdev, "disabling\n"); | 3835 | rdev_info(rdev, "disabling\n"); |
3844 | ret = ops->disable(rdev); | 3836 | ret = _regulator_do_disable(rdev); |
3845 | if (ret != 0) | 3837 | if (ret != 0) |
3846 | rdev_err(rdev, "couldn't disable: %d\n", ret); | 3838 | rdev_err(rdev, "couldn't disable: %d\n", ret); |
3847 | } else { | 3839 | } else { |
diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c index 56727eb745df..91e99a2c8dc1 100644 --- a/drivers/regulator/da9063-regulator.c +++ b/drivers/regulator/da9063-regulator.c | |||
@@ -1,3 +1,4 @@ | |||
1 | |||
1 | /* | 2 | /* |
2 | * Regulator driver for DA9063 PMIC series | 3 | * Regulator driver for DA9063 PMIC series |
3 | * | 4 | * |
@@ -60,7 +61,8 @@ struct da9063_regulator_info { | |||
60 | .desc.ops = &da9063_ldo_ops, \ | 61 | .desc.ops = &da9063_ldo_ops, \ |
61 | .desc.min_uV = (min_mV) * 1000, \ | 62 | .desc.min_uV = (min_mV) * 1000, \ |
62 | .desc.uV_step = (step_mV) * 1000, \ | 63 | .desc.uV_step = (step_mV) * 1000, \ |
63 | .desc.n_voltages = (((max_mV) - (min_mV))/(step_mV) + 1), \ | 64 | .desc.n_voltages = (((max_mV) - (min_mV))/(step_mV) + 1 \ |
65 | + (DA9063_V##regl_name##_BIAS)), \ | ||
64 | .desc.enable_reg = DA9063_REG_##regl_name##_CONT, \ | 66 | .desc.enable_reg = DA9063_REG_##regl_name##_CONT, \ |
65 | .desc.enable_mask = DA9063_LDO_EN, \ | 67 | .desc.enable_mask = DA9063_LDO_EN, \ |
66 | .desc.vsel_reg = DA9063_REG_V##regl_name##_A, \ | 68 | .desc.vsel_reg = DA9063_REG_V##regl_name##_A, \ |
diff --git a/drivers/regulator/max14577.c b/drivers/regulator/max14577.c index 186df8785a91..e0619526708c 100644 --- a/drivers/regulator/max14577.c +++ b/drivers/regulator/max14577.c | |||
@@ -166,9 +166,10 @@ static int max14577_regulator_dt_parse_pdata(struct platform_device *pdev) | |||
166 | 166 | ||
167 | ret = of_regulator_match(&pdev->dev, np, max14577_regulator_matches, | 167 | ret = of_regulator_match(&pdev->dev, np, max14577_regulator_matches, |
168 | MAX14577_REG_MAX); | 168 | MAX14577_REG_MAX); |
169 | if (ret < 0) { | 169 | if (ret < 0) |
170 | dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", ret); | 170 | dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", ret); |
171 | } | 171 | else |
172 | ret = 0; | ||
172 | 173 | ||
173 | of_node_put(np); | 174 | of_node_put(np); |
174 | 175 | ||
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c index d7164bb75d3e..d958dfa05125 100644 --- a/drivers/regulator/s5m8767.c +++ b/drivers/regulator/s5m8767.c | |||
@@ -535,7 +535,7 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev, | |||
535 | return -ENODEV; | 535 | return -ENODEV; |
536 | } | 536 | } |
537 | 537 | ||
538 | regulators_np = of_find_node_by_name(pmic_np, "regulators"); | 538 | regulators_np = of_get_child_by_name(pmic_np, "regulators"); |
539 | if (!regulators_np) { | 539 | if (!regulators_np) { |
540 | dev_err(iodev->dev, "could not find regulators sub-node\n"); | 540 | dev_err(iodev->dev, "could not find regulators sub-node\n"); |
541 | return -EINVAL; | 541 | return -EINVAL; |
@@ -591,6 +591,8 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev, | |||
591 | rmode++; | 591 | rmode++; |
592 | } | 592 | } |
593 | 593 | ||
594 | of_node_put(regulators_np); | ||
595 | |||
594 | if (of_get_property(pmic_np, "s5m8767,pmic-buck2-uses-gpio-dvs", NULL)) { | 596 | if (of_get_property(pmic_np, "s5m8767,pmic-buck2-uses-gpio-dvs", NULL)) { |
595 | pdata->buck2_gpiodvs = true; | 597 | pdata->buck2_gpiodvs = true; |
596 | 598 | ||
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 7afd373b9595..c4cde9c08f1f 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -580,10 +580,12 @@ static int s3c_rtc_suspend(struct device *dev) | |||
580 | 580 | ||
581 | clk_enable(rtc_clk); | 581 | clk_enable(rtc_clk); |
582 | /* save TICNT for anyone using periodic interrupts */ | 582 | /* save TICNT for anyone using periodic interrupts */ |
583 | ticnt_save = readb(s3c_rtc_base + S3C2410_TICNT); | ||
584 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) { | 583 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) { |
585 | ticnt_en_save = readw(s3c_rtc_base + S3C2410_RTCCON); | 584 | ticnt_en_save = readw(s3c_rtc_base + S3C2410_RTCCON); |
586 | ticnt_en_save &= S3C64XX_RTCCON_TICEN; | 585 | ticnt_en_save &= S3C64XX_RTCCON_TICEN; |
586 | ticnt_save = readl(s3c_rtc_base + S3C2410_TICNT); | ||
587 | } else { | ||
588 | ticnt_save = readb(s3c_rtc_base + S3C2410_TICNT); | ||
587 | } | 589 | } |
588 | s3c_rtc_enable(pdev, 0); | 590 | s3c_rtc_enable(pdev, 0); |
589 | 591 | ||
@@ -605,10 +607,15 @@ static int s3c_rtc_resume(struct device *dev) | |||
605 | 607 | ||
606 | clk_enable(rtc_clk); | 608 | clk_enable(rtc_clk); |
607 | s3c_rtc_enable(pdev, 1); | 609 | s3c_rtc_enable(pdev, 1); |
608 | writeb(ticnt_save, s3c_rtc_base + S3C2410_TICNT); | 610 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) { |
609 | if (s3c_rtc_cpu_type == TYPE_S3C64XX && ticnt_en_save) { | 611 | writel(ticnt_save, s3c_rtc_base + S3C2410_TICNT); |
610 | tmp = readw(s3c_rtc_base + S3C2410_RTCCON); | 612 | if (ticnt_en_save) { |
611 | writew(tmp | ticnt_en_save, s3c_rtc_base + S3C2410_RTCCON); | 613 | tmp = readw(s3c_rtc_base + S3C2410_RTCCON); |
614 | writew(tmp | ticnt_en_save, | ||
615 | s3c_rtc_base + S3C2410_RTCCON); | ||
616 | } | ||
617 | } else { | ||
618 | writeb(ticnt_save, s3c_rtc_base + S3C2410_TICNT); | ||
612 | } | 619 | } |
613 | 620 | ||
614 | if (device_may_wakeup(dev) && wake_en) { | 621 | if (device_may_wakeup(dev) && wake_en) { |
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c index f6b9188c5af5..9f0ea6cb6922 100644 --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c | |||
@@ -610,6 +610,7 @@ void chsc_chp_online(struct chp_id chpid) | |||
610 | css_wait_for_slow_path(); | 610 | css_wait_for_slow_path(); |
611 | for_each_subchannel_staged(__s390_process_res_acc, NULL, | 611 | for_each_subchannel_staged(__s390_process_res_acc, NULL, |
612 | &link); | 612 | &link); |
613 | css_schedule_reprobe(); | ||
613 | } | 614 | } |
614 | } | 615 | } |
615 | 616 | ||
diff --git a/drivers/s390/crypto/zcrypt_msgtype6.c b/drivers/s390/crypto/zcrypt_msgtype6.c index dc542e0a3055..0bc91e46395a 100644 --- a/drivers/s390/crypto/zcrypt_msgtype6.c +++ b/drivers/s390/crypto/zcrypt_msgtype6.c | |||
@@ -311,7 +311,7 @@ static int XCRB_msg_to_type6CPRB_msgX(struct zcrypt_device *zdev, | |||
311 | } __packed * msg = ap_msg->message; | 311 | } __packed * msg = ap_msg->message; |
312 | 312 | ||
313 | int rcblen = CEIL4(xcRB->request_control_blk_length); | 313 | int rcblen = CEIL4(xcRB->request_control_blk_length); |
314 | int replylen; | 314 | int replylen, req_sumlen, resp_sumlen; |
315 | char *req_data = ap_msg->message + sizeof(struct type6_hdr) + rcblen; | 315 | char *req_data = ap_msg->message + sizeof(struct type6_hdr) + rcblen; |
316 | char *function_code; | 316 | char *function_code; |
317 | 317 | ||
@@ -321,12 +321,34 @@ static int XCRB_msg_to_type6CPRB_msgX(struct zcrypt_device *zdev, | |||
321 | xcRB->request_data_length; | 321 | xcRB->request_data_length; |
322 | if (ap_msg->length > MSGTYPE06_MAX_MSG_SIZE) | 322 | if (ap_msg->length > MSGTYPE06_MAX_MSG_SIZE) |
323 | return -EINVAL; | 323 | return -EINVAL; |
324 | |||
325 | /* Overflow check | ||
326 | sum must be greater (or equal) than the largest operand */ | ||
327 | req_sumlen = CEIL4(xcRB->request_control_blk_length) + | ||
328 | xcRB->request_data_length; | ||
329 | if ((CEIL4(xcRB->request_control_blk_length) <= | ||
330 | xcRB->request_data_length) ? | ||
331 | (req_sumlen < xcRB->request_data_length) : | ||
332 | (req_sumlen < CEIL4(xcRB->request_control_blk_length))) { | ||
333 | return -EINVAL; | ||
334 | } | ||
335 | |||
324 | replylen = sizeof(struct type86_fmt2_msg) + | 336 | replylen = sizeof(struct type86_fmt2_msg) + |
325 | CEIL4(xcRB->reply_control_blk_length) + | 337 | CEIL4(xcRB->reply_control_blk_length) + |
326 | xcRB->reply_data_length; | 338 | xcRB->reply_data_length; |
327 | if (replylen > MSGTYPE06_MAX_MSG_SIZE) | 339 | if (replylen > MSGTYPE06_MAX_MSG_SIZE) |
328 | return -EINVAL; | 340 | return -EINVAL; |
329 | 341 | ||
342 | /* Overflow check | ||
343 | sum must be greater (or equal) than the largest operand */ | ||
344 | resp_sumlen = CEIL4(xcRB->reply_control_blk_length) + | ||
345 | xcRB->reply_data_length; | ||
346 | if ((CEIL4(xcRB->reply_control_blk_length) <= xcRB->reply_data_length) ? | ||
347 | (resp_sumlen < xcRB->reply_data_length) : | ||
348 | (resp_sumlen < CEIL4(xcRB->reply_control_blk_length))) { | ||
349 | return -EINVAL; | ||
350 | } | ||
351 | |||
330 | /* prepare type6 header */ | 352 | /* prepare type6 header */ |
331 | msg->hdr = static_type6_hdrX; | 353 | msg->hdr = static_type6_hdrX; |
332 | memcpy(msg->hdr.agent_id , &(xcRB->agent_ID), sizeof(xcRB->agent_ID)); | 354 | memcpy(msg->hdr.agent_id , &(xcRB->agent_ID), sizeof(xcRB->agent_ID)); |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index c3a83df07894..795ed61a5496 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -1660,7 +1660,6 @@ int qeth_qdio_clear_card(struct qeth_card *card, int use_halt) | |||
1660 | QDIO_FLAG_CLEANUP_USING_CLEAR); | 1660 | QDIO_FLAG_CLEANUP_USING_CLEAR); |
1661 | if (rc) | 1661 | if (rc) |
1662 | QETH_CARD_TEXT_(card, 3, "1err%d", rc); | 1662 | QETH_CARD_TEXT_(card, 3, "1err%d", rc); |
1663 | qdio_free(CARD_DDEV(card)); | ||
1664 | atomic_set(&card->qdio.state, QETH_QDIO_ALLOCATED); | 1663 | atomic_set(&card->qdio.state, QETH_QDIO_ALLOCATED); |
1665 | break; | 1664 | break; |
1666 | case QETH_QDIO_CLEANING: | 1665 | case QETH_QDIO_CLEANING: |
@@ -2605,6 +2604,7 @@ static int qeth_mpc_initialize(struct qeth_card *card) | |||
2605 | return 0; | 2604 | return 0; |
2606 | out_qdio: | 2605 | out_qdio: |
2607 | qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD); | 2606 | qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD); |
2607 | qdio_free(CARD_DDEV(card)); | ||
2608 | return rc; | 2608 | return rc; |
2609 | } | 2609 | } |
2610 | 2610 | ||
@@ -4906,9 +4906,11 @@ retry: | |||
4906 | if (retries < 3) | 4906 | if (retries < 3) |
4907 | QETH_DBF_MESSAGE(2, "%s Retrying to do IDX activates.\n", | 4907 | QETH_DBF_MESSAGE(2, "%s Retrying to do IDX activates.\n", |
4908 | dev_name(&card->gdev->dev)); | 4908 | dev_name(&card->gdev->dev)); |
4909 | rc = qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD); | ||
4909 | ccw_device_set_offline(CARD_DDEV(card)); | 4910 | ccw_device_set_offline(CARD_DDEV(card)); |
4910 | ccw_device_set_offline(CARD_WDEV(card)); | 4911 | ccw_device_set_offline(CARD_WDEV(card)); |
4911 | ccw_device_set_offline(CARD_RDEV(card)); | 4912 | ccw_device_set_offline(CARD_RDEV(card)); |
4913 | qdio_free(CARD_DDEV(card)); | ||
4912 | rc = ccw_device_set_online(CARD_RDEV(card)); | 4914 | rc = ccw_device_set_online(CARD_RDEV(card)); |
4913 | if (rc) | 4915 | if (rc) |
4914 | goto retriable; | 4916 | goto retriable; |
@@ -4918,7 +4920,6 @@ retry: | |||
4918 | rc = ccw_device_set_online(CARD_DDEV(card)); | 4920 | rc = ccw_device_set_online(CARD_DDEV(card)); |
4919 | if (rc) | 4921 | if (rc) |
4920 | goto retriable; | 4922 | goto retriable; |
4921 | rc = qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD); | ||
4922 | retriable: | 4923 | retriable: |
4923 | if (rc == -ERESTARTSYS) { | 4924 | if (rc == -ERESTARTSYS) { |
4924 | QETH_DBF_TEXT(SETUP, 2, "break1"); | 4925 | QETH_DBF_TEXT(SETUP, 2, "break1"); |
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index 0710550093ce..908d82529ee9 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c | |||
@@ -1091,6 +1091,7 @@ out_remove: | |||
1091 | ccw_device_set_offline(CARD_DDEV(card)); | 1091 | ccw_device_set_offline(CARD_DDEV(card)); |
1092 | ccw_device_set_offline(CARD_WDEV(card)); | 1092 | ccw_device_set_offline(CARD_WDEV(card)); |
1093 | ccw_device_set_offline(CARD_RDEV(card)); | 1093 | ccw_device_set_offline(CARD_RDEV(card)); |
1094 | qdio_free(CARD_DDEV(card)); | ||
1094 | if (recover_flag == CARD_STATE_RECOVER) | 1095 | if (recover_flag == CARD_STATE_RECOVER) |
1095 | card->state = CARD_STATE_RECOVER; | 1096 | card->state = CARD_STATE_RECOVER; |
1096 | else | 1097 | else |
@@ -1132,6 +1133,7 @@ static int __qeth_l2_set_offline(struct ccwgroup_device *cgdev, | |||
1132 | rc = (rc2) ? rc2 : rc3; | 1133 | rc = (rc2) ? rc2 : rc3; |
1133 | if (rc) | 1134 | if (rc) |
1134 | QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); | 1135 | QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); |
1136 | qdio_free(CARD_DDEV(card)); | ||
1135 | if (recover_flag == CARD_STATE_UP) | 1137 | if (recover_flag == CARD_STATE_UP) |
1136 | card->state = CARD_STATE_RECOVER; | 1138 | card->state = CARD_STATE_RECOVER; |
1137 | /* let user_space know that device is offline */ | 1139 | /* let user_space know that device is offline */ |
@@ -1194,6 +1196,7 @@ static void qeth_l2_shutdown(struct ccwgroup_device *gdev) | |||
1194 | qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM); | 1196 | qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM); |
1195 | qeth_qdio_clear_card(card, 0); | 1197 | qeth_qdio_clear_card(card, 0); |
1196 | qeth_clear_qdio_buffers(card); | 1198 | qeth_clear_qdio_buffers(card); |
1199 | qdio_free(CARD_DDEV(card)); | ||
1197 | } | 1200 | } |
1198 | 1201 | ||
1199 | static int qeth_l2_pm_suspend(struct ccwgroup_device *gdev) | 1202 | static int qeth_l2_pm_suspend(struct ccwgroup_device *gdev) |
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 0f430424c3b8..3524d34ff694 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
@@ -3447,6 +3447,7 @@ out_remove: | |||
3447 | ccw_device_set_offline(CARD_DDEV(card)); | 3447 | ccw_device_set_offline(CARD_DDEV(card)); |
3448 | ccw_device_set_offline(CARD_WDEV(card)); | 3448 | ccw_device_set_offline(CARD_WDEV(card)); |
3449 | ccw_device_set_offline(CARD_RDEV(card)); | 3449 | ccw_device_set_offline(CARD_RDEV(card)); |
3450 | qdio_free(CARD_DDEV(card)); | ||
3450 | if (recover_flag == CARD_STATE_RECOVER) | 3451 | if (recover_flag == CARD_STATE_RECOVER) |
3451 | card->state = CARD_STATE_RECOVER; | 3452 | card->state = CARD_STATE_RECOVER; |
3452 | else | 3453 | else |
@@ -3493,6 +3494,7 @@ static int __qeth_l3_set_offline(struct ccwgroup_device *cgdev, | |||
3493 | rc = (rc2) ? rc2 : rc3; | 3494 | rc = (rc2) ? rc2 : rc3; |
3494 | if (rc) | 3495 | if (rc) |
3495 | QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); | 3496 | QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); |
3497 | qdio_free(CARD_DDEV(card)); | ||
3496 | if (recover_flag == CARD_STATE_UP) | 3498 | if (recover_flag == CARD_STATE_UP) |
3497 | card->state = CARD_STATE_RECOVER; | 3499 | card->state = CARD_STATE_RECOVER; |
3498 | /* let user_space know that device is offline */ | 3500 | /* let user_space know that device is offline */ |
@@ -3545,6 +3547,7 @@ static void qeth_l3_shutdown(struct ccwgroup_device *gdev) | |||
3545 | qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM); | 3547 | qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM); |
3546 | qeth_qdio_clear_card(card, 0); | 3548 | qeth_qdio_clear_card(card, 0); |
3547 | qeth_clear_qdio_buffers(card); | 3549 | qeth_clear_qdio_buffers(card); |
3550 | qdio_free(CARD_DDEV(card)); | ||
3548 | } | 3551 | } |
3549 | 3552 | ||
3550 | static int qeth_l3_pm_suspend(struct ccwgroup_device *gdev) | 3553 | static int qeth_l3_pm_suspend(struct ccwgroup_device *gdev) |
diff --git a/drivers/sbus/char/jsflash.c b/drivers/sbus/char/jsflash.c index 6b4678a7900a..4ccb5d869389 100644 --- a/drivers/sbus/char/jsflash.c +++ b/drivers/sbus/char/jsflash.c | |||
@@ -507,7 +507,6 @@ static int jsflash_init(void) | |||
507 | } | 507 | } |
508 | 508 | ||
509 | /* Let us be really paranoid for modifications to probing code. */ | 509 | /* Let us be really paranoid for modifications to probing code. */ |
510 | /* extern enum sparc_cpu sparc_cpu_model; */ /* in <asm/system.h> */ | ||
511 | if (sparc_cpu_model != sun4m) { | 510 | if (sparc_cpu_model != sun4m) { |
512 | /* We must be on sun4m because we use MMU Bypass ASI. */ | 511 | /* We must be on sun4m because we use MMU Bypass ASI. */ |
513 | return -ENXIO; | 512 | return -ENXIO; |
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 2eb97d7e8d12..0cb73074c199 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c | |||
@@ -790,17 +790,32 @@ static inline int test_tgt_sess_count(struct qla_tgt *tgt) | |||
790 | } | 790 | } |
791 | 791 | ||
792 | /* Called by tcm_qla2xxx configfs code */ | 792 | /* Called by tcm_qla2xxx configfs code */ |
793 | void qlt_stop_phase1(struct qla_tgt *tgt) | 793 | int qlt_stop_phase1(struct qla_tgt *tgt) |
794 | { | 794 | { |
795 | struct scsi_qla_host *vha = tgt->vha; | 795 | struct scsi_qla_host *vha = tgt->vha; |
796 | struct qla_hw_data *ha = tgt->ha; | 796 | struct qla_hw_data *ha = tgt->ha; |
797 | unsigned long flags; | 797 | unsigned long flags; |
798 | 798 | ||
799 | mutex_lock(&qla_tgt_mutex); | ||
800 | if (!vha->fc_vport) { | ||
801 | struct Scsi_Host *sh = vha->host; | ||
802 | struct fc_host_attrs *fc_host = shost_to_fc_host(sh); | ||
803 | bool npiv_vports; | ||
804 | |||
805 | spin_lock_irqsave(sh->host_lock, flags); | ||
806 | npiv_vports = (fc_host->npiv_vports_inuse); | ||
807 | spin_unlock_irqrestore(sh->host_lock, flags); | ||
808 | |||
809 | if (npiv_vports) { | ||
810 | mutex_unlock(&qla_tgt_mutex); | ||
811 | return -EPERM; | ||
812 | } | ||
813 | } | ||
799 | if (tgt->tgt_stop || tgt->tgt_stopped) { | 814 | if (tgt->tgt_stop || tgt->tgt_stopped) { |
800 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf04e, | 815 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf04e, |
801 | "Already in tgt->tgt_stop or tgt_stopped state\n"); | 816 | "Already in tgt->tgt_stop or tgt_stopped state\n"); |
802 | dump_stack(); | 817 | mutex_unlock(&qla_tgt_mutex); |
803 | return; | 818 | return -EPERM; |
804 | } | 819 | } |
805 | 820 | ||
806 | ql_dbg(ql_dbg_tgt, vha, 0xe003, "Stopping target for host %ld(%p)\n", | 821 | ql_dbg(ql_dbg_tgt, vha, 0xe003, "Stopping target for host %ld(%p)\n", |
@@ -815,6 +830,7 @@ void qlt_stop_phase1(struct qla_tgt *tgt) | |||
815 | qlt_clear_tgt_db(tgt, true); | 830 | qlt_clear_tgt_db(tgt, true); |
816 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 831 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
817 | mutex_unlock(&vha->vha_tgt.tgt_mutex); | 832 | mutex_unlock(&vha->vha_tgt.tgt_mutex); |
833 | mutex_unlock(&qla_tgt_mutex); | ||
818 | 834 | ||
819 | flush_delayed_work(&tgt->sess_del_work); | 835 | flush_delayed_work(&tgt->sess_del_work); |
820 | 836 | ||
@@ -841,6 +857,7 @@ void qlt_stop_phase1(struct qla_tgt *tgt) | |||
841 | 857 | ||
842 | /* Wait for sessions to clear out (just in case) */ | 858 | /* Wait for sessions to clear out (just in case) */ |
843 | wait_event(tgt->waitQ, test_tgt_sess_count(tgt)); | 859 | wait_event(tgt->waitQ, test_tgt_sess_count(tgt)); |
860 | return 0; | ||
844 | } | 861 | } |
845 | EXPORT_SYMBOL(qlt_stop_phase1); | 862 | EXPORT_SYMBOL(qlt_stop_phase1); |
846 | 863 | ||
@@ -3185,7 +3202,8 @@ restart: | |||
3185 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf02c, | 3202 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf02c, |
3186 | "SRR cmd %p (se_cmd %p, tag %d, op %x), " | 3203 | "SRR cmd %p (se_cmd %p, tag %d, op %x), " |
3187 | "sg_cnt=%d, offset=%d", cmd, &cmd->se_cmd, cmd->tag, | 3204 | "sg_cnt=%d, offset=%d", cmd, &cmd->se_cmd, cmd->tag, |
3188 | se_cmd->t_task_cdb[0], cmd->sg_cnt, cmd->offset); | 3205 | se_cmd->t_task_cdb ? se_cmd->t_task_cdb[0] : 0, |
3206 | cmd->sg_cnt, cmd->offset); | ||
3189 | 3207 | ||
3190 | qlt_handle_srr(vha, sctio, imm); | 3208 | qlt_handle_srr(vha, sctio, imm); |
3191 | 3209 | ||
@@ -4181,6 +4199,9 @@ int qlt_add_target(struct qla_hw_data *ha, struct scsi_qla_host *base_vha) | |||
4181 | tgt->datasegs_per_cmd = QLA_TGT_DATASEGS_PER_CMD_24XX; | 4199 | tgt->datasegs_per_cmd = QLA_TGT_DATASEGS_PER_CMD_24XX; |
4182 | tgt->datasegs_per_cont = QLA_TGT_DATASEGS_PER_CONT_24XX; | 4200 | tgt->datasegs_per_cont = QLA_TGT_DATASEGS_PER_CONT_24XX; |
4183 | 4201 | ||
4202 | if (base_vha->fc_vport) | ||
4203 | return 0; | ||
4204 | |||
4184 | mutex_lock(&qla_tgt_mutex); | 4205 | mutex_lock(&qla_tgt_mutex); |
4185 | list_add_tail(&tgt->tgt_list_entry, &qla_tgt_glist); | 4206 | list_add_tail(&tgt->tgt_list_entry, &qla_tgt_glist); |
4186 | mutex_unlock(&qla_tgt_mutex); | 4207 | mutex_unlock(&qla_tgt_mutex); |
@@ -4194,6 +4215,10 @@ int qlt_remove_target(struct qla_hw_data *ha, struct scsi_qla_host *vha) | |||
4194 | if (!vha->vha_tgt.qla_tgt) | 4215 | if (!vha->vha_tgt.qla_tgt) |
4195 | return 0; | 4216 | return 0; |
4196 | 4217 | ||
4218 | if (vha->fc_vport) { | ||
4219 | qlt_release(vha->vha_tgt.qla_tgt); | ||
4220 | return 0; | ||
4221 | } | ||
4197 | mutex_lock(&qla_tgt_mutex); | 4222 | mutex_lock(&qla_tgt_mutex); |
4198 | list_del(&vha->vha_tgt.qla_tgt->tgt_list_entry); | 4223 | list_del(&vha->vha_tgt.qla_tgt->tgt_list_entry); |
4199 | mutex_unlock(&qla_tgt_mutex); | 4224 | mutex_unlock(&qla_tgt_mutex); |
@@ -4265,6 +4290,12 @@ int qlt_lport_register(void *target_lport_ptr, u64 phys_wwpn, | |||
4265 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 4290 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
4266 | continue; | 4291 | continue; |
4267 | } | 4292 | } |
4293 | if (tgt->tgt_stop) { | ||
4294 | pr_debug("MODE_TARGET in shutdown on qla2xxx(%d)\n", | ||
4295 | host->host_no); | ||
4296 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
4297 | continue; | ||
4298 | } | ||
4268 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 4299 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
4269 | 4300 | ||
4270 | if (!scsi_host_get(host)) { | 4301 | if (!scsi_host_get(host)) { |
@@ -4279,12 +4310,11 @@ int qlt_lport_register(void *target_lport_ptr, u64 phys_wwpn, | |||
4279 | scsi_host_put(host); | 4310 | scsi_host_put(host); |
4280 | continue; | 4311 | continue; |
4281 | } | 4312 | } |
4282 | mutex_unlock(&qla_tgt_mutex); | ||
4283 | |||
4284 | rc = (*callback)(vha, target_lport_ptr, npiv_wwpn, npiv_wwnn); | 4313 | rc = (*callback)(vha, target_lport_ptr, npiv_wwpn, npiv_wwnn); |
4285 | if (rc != 0) | 4314 | if (rc != 0) |
4286 | scsi_host_put(host); | 4315 | scsi_host_put(host); |
4287 | 4316 | ||
4317 | mutex_unlock(&qla_tgt_mutex); | ||
4288 | return rc; | 4318 | return rc; |
4289 | } | 4319 | } |
4290 | mutex_unlock(&qla_tgt_mutex); | 4320 | mutex_unlock(&qla_tgt_mutex); |
diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h index 66e755cdde57..ce33d8c26406 100644 --- a/drivers/scsi/qla2xxx/qla_target.h +++ b/drivers/scsi/qla2xxx/qla_target.h | |||
@@ -1001,7 +1001,7 @@ extern void qlt_modify_vp_config(struct scsi_qla_host *, | |||
1001 | extern void qlt_probe_one_stage1(struct scsi_qla_host *, struct qla_hw_data *); | 1001 | extern void qlt_probe_one_stage1(struct scsi_qla_host *, struct qla_hw_data *); |
1002 | extern int qlt_mem_alloc(struct qla_hw_data *); | 1002 | extern int qlt_mem_alloc(struct qla_hw_data *); |
1003 | extern void qlt_mem_free(struct qla_hw_data *); | 1003 | extern void qlt_mem_free(struct qla_hw_data *); |
1004 | extern void qlt_stop_phase1(struct qla_tgt *); | 1004 | extern int qlt_stop_phase1(struct qla_tgt *); |
1005 | extern void qlt_stop_phase2(struct qla_tgt *); | 1005 | extern void qlt_stop_phase2(struct qla_tgt *); |
1006 | extern irqreturn_t qla83xx_msix_atio_q(int, void *); | 1006 | extern irqreturn_t qla83xx_msix_atio_q(int, void *); |
1007 | extern void qlt_83xx_iospace_config(struct qla_hw_data *); | 1007 | extern void qlt_83xx_iospace_config(struct qla_hw_data *); |
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 75a141bbe74d..788c4fe2b0c9 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c | |||
@@ -182,20 +182,6 @@ static int tcm_qla2xxx_npiv_parse_wwn( | |||
182 | return 0; | 182 | return 0; |
183 | } | 183 | } |
184 | 184 | ||
185 | static ssize_t tcm_qla2xxx_npiv_format_wwn(char *buf, size_t len, | ||
186 | u64 wwpn, u64 wwnn) | ||
187 | { | ||
188 | u8 b[8], b2[8]; | ||
189 | |||
190 | put_unaligned_be64(wwpn, b); | ||
191 | put_unaligned_be64(wwnn, b2); | ||
192 | return snprintf(buf, len, | ||
193 | "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x," | ||
194 | "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x", | ||
195 | b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7], | ||
196 | b2[0], b2[1], b2[2], b2[3], b2[4], b2[5], b2[6], b2[7]); | ||
197 | } | ||
198 | |||
199 | static char *tcm_qla2xxx_npiv_get_fabric_name(void) | 185 | static char *tcm_qla2xxx_npiv_get_fabric_name(void) |
200 | { | 186 | { |
201 | return "qla2xxx_npiv"; | 187 | return "qla2xxx_npiv"; |
@@ -227,15 +213,6 @@ static char *tcm_qla2xxx_get_fabric_wwn(struct se_portal_group *se_tpg) | |||
227 | return lport->lport_naa_name; | 213 | return lport->lport_naa_name; |
228 | } | 214 | } |
229 | 215 | ||
230 | static char *tcm_qla2xxx_npiv_get_fabric_wwn(struct se_portal_group *se_tpg) | ||
231 | { | ||
232 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, | ||
233 | struct tcm_qla2xxx_tpg, se_tpg); | ||
234 | struct tcm_qla2xxx_lport *lport = tpg->lport; | ||
235 | |||
236 | return &lport->lport_npiv_name[0]; | ||
237 | } | ||
238 | |||
239 | static u16 tcm_qla2xxx_get_tag(struct se_portal_group *se_tpg) | 216 | static u16 tcm_qla2xxx_get_tag(struct se_portal_group *se_tpg) |
240 | { | 217 | { |
241 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, | 218 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, |
@@ -941,15 +918,41 @@ static ssize_t tcm_qla2xxx_tpg_show_enable( | |||
941 | atomic_read(&tpg->lport_tpg_enabled)); | 918 | atomic_read(&tpg->lport_tpg_enabled)); |
942 | } | 919 | } |
943 | 920 | ||
921 | static void tcm_qla2xxx_depend_tpg(struct work_struct *work) | ||
922 | { | ||
923 | struct tcm_qla2xxx_tpg *base_tpg = container_of(work, | ||
924 | struct tcm_qla2xxx_tpg, tpg_base_work); | ||
925 | struct se_portal_group *se_tpg = &base_tpg->se_tpg; | ||
926 | struct scsi_qla_host *base_vha = base_tpg->lport->qla_vha; | ||
927 | |||
928 | if (!configfs_depend_item(se_tpg->se_tpg_tfo->tf_subsys, | ||
929 | &se_tpg->tpg_group.cg_item)) { | ||
930 | atomic_set(&base_tpg->lport_tpg_enabled, 1); | ||
931 | qlt_enable_vha(base_vha); | ||
932 | } | ||
933 | complete(&base_tpg->tpg_base_comp); | ||
934 | } | ||
935 | |||
936 | static void tcm_qla2xxx_undepend_tpg(struct work_struct *work) | ||
937 | { | ||
938 | struct tcm_qla2xxx_tpg *base_tpg = container_of(work, | ||
939 | struct tcm_qla2xxx_tpg, tpg_base_work); | ||
940 | struct se_portal_group *se_tpg = &base_tpg->se_tpg; | ||
941 | struct scsi_qla_host *base_vha = base_tpg->lport->qla_vha; | ||
942 | |||
943 | if (!qlt_stop_phase1(base_vha->vha_tgt.qla_tgt)) { | ||
944 | atomic_set(&base_tpg->lport_tpg_enabled, 0); | ||
945 | configfs_undepend_item(se_tpg->se_tpg_tfo->tf_subsys, | ||
946 | &se_tpg->tpg_group.cg_item); | ||
947 | } | ||
948 | complete(&base_tpg->tpg_base_comp); | ||
949 | } | ||
950 | |||
944 | static ssize_t tcm_qla2xxx_tpg_store_enable( | 951 | static ssize_t tcm_qla2xxx_tpg_store_enable( |
945 | struct se_portal_group *se_tpg, | 952 | struct se_portal_group *se_tpg, |
946 | const char *page, | 953 | const char *page, |
947 | size_t count) | 954 | size_t count) |
948 | { | 955 | { |
949 | struct se_wwn *se_wwn = se_tpg->se_tpg_wwn; | ||
950 | struct tcm_qla2xxx_lport *lport = container_of(se_wwn, | ||
951 | struct tcm_qla2xxx_lport, lport_wwn); | ||
952 | struct scsi_qla_host *vha = lport->qla_vha; | ||
953 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, | 956 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, |
954 | struct tcm_qla2xxx_tpg, se_tpg); | 957 | struct tcm_qla2xxx_tpg, se_tpg); |
955 | unsigned long op; | 958 | unsigned long op; |
@@ -964,19 +967,28 @@ static ssize_t tcm_qla2xxx_tpg_store_enable( | |||
964 | pr_err("Illegal value for tpg_enable: %lu\n", op); | 967 | pr_err("Illegal value for tpg_enable: %lu\n", op); |
965 | return -EINVAL; | 968 | return -EINVAL; |
966 | } | 969 | } |
967 | |||
968 | if (op) { | 970 | if (op) { |
969 | atomic_set(&tpg->lport_tpg_enabled, 1); | 971 | if (atomic_read(&tpg->lport_tpg_enabled)) |
970 | qlt_enable_vha(vha); | 972 | return -EEXIST; |
973 | |||
974 | INIT_WORK(&tpg->tpg_base_work, tcm_qla2xxx_depend_tpg); | ||
971 | } else { | 975 | } else { |
972 | if (!vha->vha_tgt.qla_tgt) { | 976 | if (!atomic_read(&tpg->lport_tpg_enabled)) |
973 | pr_err("struct qla_hw_data *vha->vha_tgt.qla_tgt is NULL\n"); | 977 | return count; |
974 | return -ENODEV; | 978 | |
975 | } | 979 | INIT_WORK(&tpg->tpg_base_work, tcm_qla2xxx_undepend_tpg); |
976 | atomic_set(&tpg->lport_tpg_enabled, 0); | ||
977 | qlt_stop_phase1(vha->vha_tgt.qla_tgt); | ||
978 | } | 980 | } |
981 | init_completion(&tpg->tpg_base_comp); | ||
982 | schedule_work(&tpg->tpg_base_work); | ||
983 | wait_for_completion(&tpg->tpg_base_comp); | ||
979 | 984 | ||
985 | if (op) { | ||
986 | if (!atomic_read(&tpg->lport_tpg_enabled)) | ||
987 | return -ENODEV; | ||
988 | } else { | ||
989 | if (atomic_read(&tpg->lport_tpg_enabled)) | ||
990 | return -EPERM; | ||
991 | } | ||
980 | return count; | 992 | return count; |
981 | } | 993 | } |
982 | 994 | ||
@@ -1053,11 +1065,64 @@ static void tcm_qla2xxx_drop_tpg(struct se_portal_group *se_tpg) | |||
1053 | /* | 1065 | /* |
1054 | * Clear local TPG=1 pointer for non NPIV mode. | 1066 | * Clear local TPG=1 pointer for non NPIV mode. |
1055 | */ | 1067 | */ |
1056 | lport->tpg_1 = NULL; | 1068 | lport->tpg_1 = NULL; |
1057 | |||
1058 | kfree(tpg); | 1069 | kfree(tpg); |
1059 | } | 1070 | } |
1060 | 1071 | ||
1072 | static ssize_t tcm_qla2xxx_npiv_tpg_show_enable( | ||
1073 | struct se_portal_group *se_tpg, | ||
1074 | char *page) | ||
1075 | { | ||
1076 | return tcm_qla2xxx_tpg_show_enable(se_tpg, page); | ||
1077 | } | ||
1078 | |||
1079 | static ssize_t tcm_qla2xxx_npiv_tpg_store_enable( | ||
1080 | struct se_portal_group *se_tpg, | ||
1081 | const char *page, | ||
1082 | size_t count) | ||
1083 | { | ||
1084 | struct se_wwn *se_wwn = se_tpg->se_tpg_wwn; | ||
1085 | struct tcm_qla2xxx_lport *lport = container_of(se_wwn, | ||
1086 | struct tcm_qla2xxx_lport, lport_wwn); | ||
1087 | struct scsi_qla_host *vha = lport->qla_vha; | ||
1088 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, | ||
1089 | struct tcm_qla2xxx_tpg, se_tpg); | ||
1090 | unsigned long op; | ||
1091 | int rc; | ||
1092 | |||
1093 | rc = kstrtoul(page, 0, &op); | ||
1094 | if (rc < 0) { | ||
1095 | pr_err("kstrtoul() returned %d\n", rc); | ||
1096 | return -EINVAL; | ||
1097 | } | ||
1098 | if ((op != 1) && (op != 0)) { | ||
1099 | pr_err("Illegal value for tpg_enable: %lu\n", op); | ||
1100 | return -EINVAL; | ||
1101 | } | ||
1102 | if (op) { | ||
1103 | if (atomic_read(&tpg->lport_tpg_enabled)) | ||
1104 | return -EEXIST; | ||
1105 | |||
1106 | atomic_set(&tpg->lport_tpg_enabled, 1); | ||
1107 | qlt_enable_vha(vha); | ||
1108 | } else { | ||
1109 | if (!atomic_read(&tpg->lport_tpg_enabled)) | ||
1110 | return count; | ||
1111 | |||
1112 | atomic_set(&tpg->lport_tpg_enabled, 0); | ||
1113 | qlt_stop_phase1(vha->vha_tgt.qla_tgt); | ||
1114 | } | ||
1115 | |||
1116 | return count; | ||
1117 | } | ||
1118 | |||
1119 | TF_TPG_BASE_ATTR(tcm_qla2xxx_npiv, enable, S_IRUGO | S_IWUSR); | ||
1120 | |||
1121 | static struct configfs_attribute *tcm_qla2xxx_npiv_tpg_attrs[] = { | ||
1122 | &tcm_qla2xxx_npiv_tpg_enable.attr, | ||
1123 | NULL, | ||
1124 | }; | ||
1125 | |||
1061 | static struct se_portal_group *tcm_qla2xxx_npiv_make_tpg( | 1126 | static struct se_portal_group *tcm_qla2xxx_npiv_make_tpg( |
1062 | struct se_wwn *wwn, | 1127 | struct se_wwn *wwn, |
1063 | struct config_group *group, | 1128 | struct config_group *group, |
@@ -1650,6 +1715,9 @@ static int tcm_qla2xxx_lport_register_npiv_cb(struct scsi_qla_host *base_vha, | |||
1650 | struct scsi_qla_host *npiv_vha; | 1715 | struct scsi_qla_host *npiv_vha; |
1651 | struct tcm_qla2xxx_lport *lport = | 1716 | struct tcm_qla2xxx_lport *lport = |
1652 | (struct tcm_qla2xxx_lport *)target_lport_ptr; | 1717 | (struct tcm_qla2xxx_lport *)target_lport_ptr; |
1718 | struct tcm_qla2xxx_lport *base_lport = | ||
1719 | (struct tcm_qla2xxx_lport *)base_vha->vha_tgt.target_lport_ptr; | ||
1720 | struct tcm_qla2xxx_tpg *base_tpg; | ||
1653 | struct fc_vport_identifiers vport_id; | 1721 | struct fc_vport_identifiers vport_id; |
1654 | 1722 | ||
1655 | if (!qla_tgt_mode_enabled(base_vha)) { | 1723 | if (!qla_tgt_mode_enabled(base_vha)) { |
@@ -1657,6 +1725,13 @@ static int tcm_qla2xxx_lport_register_npiv_cb(struct scsi_qla_host *base_vha, | |||
1657 | return -EPERM; | 1725 | return -EPERM; |
1658 | } | 1726 | } |
1659 | 1727 | ||
1728 | if (!base_lport || !base_lport->tpg_1 || | ||
1729 | !atomic_read(&base_lport->tpg_1->lport_tpg_enabled)) { | ||
1730 | pr_err("qla2xxx base_lport or tpg_1 not available\n"); | ||
1731 | return -EPERM; | ||
1732 | } | ||
1733 | base_tpg = base_lport->tpg_1; | ||
1734 | |||
1660 | memset(&vport_id, 0, sizeof(vport_id)); | 1735 | memset(&vport_id, 0, sizeof(vport_id)); |
1661 | vport_id.port_name = npiv_wwpn; | 1736 | vport_id.port_name = npiv_wwpn; |
1662 | vport_id.node_name = npiv_wwnn; | 1737 | vport_id.node_name = npiv_wwnn; |
@@ -1675,7 +1750,6 @@ static int tcm_qla2xxx_lport_register_npiv_cb(struct scsi_qla_host *base_vha, | |||
1675 | npiv_vha = (struct scsi_qla_host *)vport->dd_data; | 1750 | npiv_vha = (struct scsi_qla_host *)vport->dd_data; |
1676 | npiv_vha->vha_tgt.target_lport_ptr = target_lport_ptr; | 1751 | npiv_vha->vha_tgt.target_lport_ptr = target_lport_ptr; |
1677 | lport->qla_vha = npiv_vha; | 1752 | lport->qla_vha = npiv_vha; |
1678 | |||
1679 | scsi_host_get(npiv_vha->host); | 1753 | scsi_host_get(npiv_vha->host); |
1680 | return 0; | 1754 | return 0; |
1681 | } | 1755 | } |
@@ -1714,8 +1788,6 @@ static struct se_wwn *tcm_qla2xxx_npiv_make_lport( | |||
1714 | } | 1788 | } |
1715 | lport->lport_npiv_wwpn = npiv_wwpn; | 1789 | lport->lport_npiv_wwpn = npiv_wwpn; |
1716 | lport->lport_npiv_wwnn = npiv_wwnn; | 1790 | lport->lport_npiv_wwnn = npiv_wwnn; |
1717 | tcm_qla2xxx_npiv_format_wwn(&lport->lport_npiv_name[0], | ||
1718 | TCM_QLA2XXX_NAMELEN, npiv_wwpn, npiv_wwnn); | ||
1719 | sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) npiv_wwpn); | 1791 | sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) npiv_wwpn); |
1720 | 1792 | ||
1721 | ret = tcm_qla2xxx_init_lport(lport); | 1793 | ret = tcm_qla2xxx_init_lport(lport); |
@@ -1824,7 +1896,7 @@ static struct target_core_fabric_ops tcm_qla2xxx_ops = { | |||
1824 | static struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = { | 1896 | static struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = { |
1825 | .get_fabric_name = tcm_qla2xxx_npiv_get_fabric_name, | 1897 | .get_fabric_name = tcm_qla2xxx_npiv_get_fabric_name, |
1826 | .get_fabric_proto_ident = tcm_qla2xxx_get_fabric_proto_ident, | 1898 | .get_fabric_proto_ident = tcm_qla2xxx_get_fabric_proto_ident, |
1827 | .tpg_get_wwn = tcm_qla2xxx_npiv_get_fabric_wwn, | 1899 | .tpg_get_wwn = tcm_qla2xxx_get_fabric_wwn, |
1828 | .tpg_get_tag = tcm_qla2xxx_get_tag, | 1900 | .tpg_get_tag = tcm_qla2xxx_get_tag, |
1829 | .tpg_get_default_depth = tcm_qla2xxx_get_default_depth, | 1901 | .tpg_get_default_depth = tcm_qla2xxx_get_default_depth, |
1830 | .tpg_get_pr_transport_id = tcm_qla2xxx_get_pr_transport_id, | 1902 | .tpg_get_pr_transport_id = tcm_qla2xxx_get_pr_transport_id, |
@@ -1935,7 +2007,7 @@ static int tcm_qla2xxx_register_configfs(void) | |||
1935 | */ | 2007 | */ |
1936 | npiv_fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = tcm_qla2xxx_wwn_attrs; | 2008 | npiv_fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = tcm_qla2xxx_wwn_attrs; |
1937 | npiv_fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = | 2009 | npiv_fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = |
1938 | tcm_qla2xxx_tpg_attrs; | 2010 | tcm_qla2xxx_npiv_tpg_attrs; |
1939 | npiv_fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs = NULL; | 2011 | npiv_fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs = NULL; |
1940 | npiv_fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs = NULL; | 2012 | npiv_fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs = NULL; |
1941 | npiv_fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs = NULL; | 2013 | npiv_fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs = NULL; |
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.h b/drivers/scsi/qla2xxx/tcm_qla2xxx.h index 275d8b9a7a34..33aaac8c7d59 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.h +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.h | |||
@@ -4,8 +4,6 @@ | |||
4 | #define TCM_QLA2XXX_VERSION "v0.1" | 4 | #define TCM_QLA2XXX_VERSION "v0.1" |
5 | /* length of ASCII WWPNs including pad */ | 5 | /* length of ASCII WWPNs including pad */ |
6 | #define TCM_QLA2XXX_NAMELEN 32 | 6 | #define TCM_QLA2XXX_NAMELEN 32 |
7 | /* lenth of ASCII NPIV 'WWPN+WWNN' including pad */ | ||
8 | #define TCM_QLA2XXX_NPIV_NAMELEN 66 | ||
9 | 7 | ||
10 | #include "qla_target.h" | 8 | #include "qla_target.h" |
11 | 9 | ||
@@ -43,6 +41,9 @@ struct tcm_qla2xxx_tpg { | |||
43 | struct tcm_qla2xxx_tpg_attrib tpg_attrib; | 41 | struct tcm_qla2xxx_tpg_attrib tpg_attrib; |
44 | /* Returned by tcm_qla2xxx_make_tpg() */ | 42 | /* Returned by tcm_qla2xxx_make_tpg() */ |
45 | struct se_portal_group se_tpg; | 43 | struct se_portal_group se_tpg; |
44 | /* Items for dealing with configfs_depend_item */ | ||
45 | struct completion tpg_base_comp; | ||
46 | struct work_struct tpg_base_work; | ||
46 | }; | 47 | }; |
47 | 48 | ||
48 | struct tcm_qla2xxx_fc_loopid { | 49 | struct tcm_qla2xxx_fc_loopid { |
@@ -62,8 +63,6 @@ struct tcm_qla2xxx_lport { | |||
62 | char lport_name[TCM_QLA2XXX_NAMELEN]; | 63 | char lport_name[TCM_QLA2XXX_NAMELEN]; |
63 | /* ASCII formatted naa WWPN for VPD page 83 etc */ | 64 | /* ASCII formatted naa WWPN for VPD page 83 etc */ |
64 | char lport_naa_name[TCM_QLA2XXX_NAMELEN]; | 65 | char lport_naa_name[TCM_QLA2XXX_NAMELEN]; |
65 | /* ASCII formatted WWPN+WWNN for NPIV FC Target Lport */ | ||
66 | char lport_npiv_name[TCM_QLA2XXX_NPIV_NAMELEN]; | ||
67 | /* map for fc_port pointers in 24-bit FC Port ID space */ | 66 | /* map for fc_port pointers in 24-bit FC Port ID space */ |
68 | struct btree_head32 lport_fcport_map; | 67 | struct btree_head32 lport_fcport_map; |
69 | /* vmalloc-ed memory for fc_port pointers for 16-bit FC loop ID */ | 68 | /* vmalloc-ed memory for fc_port pointers for 16-bit FC loop ID */ |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 7bd7f0d5f050..62ec84b42e31 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -1684,7 +1684,7 @@ u64 scsi_calculate_bounce_limit(struct Scsi_Host *shost) | |||
1684 | 1684 | ||
1685 | host_dev = scsi_get_device(shost); | 1685 | host_dev = scsi_get_device(shost); |
1686 | if (host_dev && host_dev->dma_mask) | 1686 | if (host_dev && host_dev->dma_mask) |
1687 | bounce_limit = dma_max_pfn(host_dev) << PAGE_SHIFT; | 1687 | bounce_limit = (u64)dma_max_pfn(host_dev) << PAGE_SHIFT; |
1688 | 1688 | ||
1689 | return bounce_limit; | 1689 | return bounce_limit; |
1690 | } | 1690 | } |
diff --git a/drivers/spi/spi-ath79.c b/drivers/spi/spi-ath79.c index 31534b51715a..c3b2fb9b6713 100644 --- a/drivers/spi/spi-ath79.c +++ b/drivers/spi/spi-ath79.c | |||
@@ -132,9 +132,9 @@ static int ath79_spi_setup_cs(struct spi_device *spi) | |||
132 | 132 | ||
133 | flags = GPIOF_DIR_OUT; | 133 | flags = GPIOF_DIR_OUT; |
134 | if (spi->mode & SPI_CS_HIGH) | 134 | if (spi->mode & SPI_CS_HIGH) |
135 | flags |= GPIOF_INIT_HIGH; | ||
136 | else | ||
137 | flags |= GPIOF_INIT_LOW; | 135 | flags |= GPIOF_INIT_LOW; |
136 | else | ||
137 | flags |= GPIOF_INIT_HIGH; | ||
138 | 138 | ||
139 | status = gpio_request_one(cdata->gpio, flags, | 139 | status = gpio_request_one(cdata->gpio, flags, |
140 | dev_name(&spi->dev)); | 140 | dev_name(&spi->dev)); |
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index b0842f751016..5d7b07f08326 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c | |||
@@ -1455,6 +1455,14 @@ static int atmel_spi_suspend(struct device *dev) | |||
1455 | { | 1455 | { |
1456 | struct spi_master *master = dev_get_drvdata(dev); | 1456 | struct spi_master *master = dev_get_drvdata(dev); |
1457 | struct atmel_spi *as = spi_master_get_devdata(master); | 1457 | struct atmel_spi *as = spi_master_get_devdata(master); |
1458 | int ret; | ||
1459 | |||
1460 | /* Stop the queue running */ | ||
1461 | ret = spi_master_suspend(master); | ||
1462 | if (ret) { | ||
1463 | dev_warn(dev, "cannot suspend master\n"); | ||
1464 | return ret; | ||
1465 | } | ||
1458 | 1466 | ||
1459 | clk_disable_unprepare(as->clk); | 1467 | clk_disable_unprepare(as->clk); |
1460 | return 0; | 1468 | return 0; |
@@ -1464,9 +1472,16 @@ static int atmel_spi_resume(struct device *dev) | |||
1464 | { | 1472 | { |
1465 | struct spi_master *master = dev_get_drvdata(dev); | 1473 | struct spi_master *master = dev_get_drvdata(dev); |
1466 | struct atmel_spi *as = spi_master_get_devdata(master); | 1474 | struct atmel_spi *as = spi_master_get_devdata(master); |
1475 | int ret; | ||
1467 | 1476 | ||
1468 | clk_prepare_enable(as->clk); | 1477 | clk_prepare_enable(as->clk); |
1469 | return 0; | 1478 | |
1479 | /* Start the queue running */ | ||
1480 | ret = spi_master_resume(master); | ||
1481 | if (ret) | ||
1482 | dev_err(dev, "problem starting queue (%d)\n", ret); | ||
1483 | |||
1484 | return ret; | ||
1470 | } | 1485 | } |
1471 | 1486 | ||
1472 | static SIMPLE_DEV_PM_OPS(atmel_spi_pm_ops, atmel_spi_suspend, atmel_spi_resume); | 1487 | static SIMPLE_DEV_PM_OPS(atmel_spi_pm_ops, atmel_spi_suspend, atmel_spi_resume); |
diff --git a/drivers/spi/spi-coldfire-qspi.c b/drivers/spi/spi-coldfire-qspi.c index cabed8f9119e..28ae470397a9 100644 --- a/drivers/spi/spi-coldfire-qspi.c +++ b/drivers/spi/spi-coldfire-qspi.c | |||
@@ -514,7 +514,8 @@ static int mcfqspi_resume(struct device *dev) | |||
514 | #ifdef CONFIG_PM_RUNTIME | 514 | #ifdef CONFIG_PM_RUNTIME |
515 | static int mcfqspi_runtime_suspend(struct device *dev) | 515 | static int mcfqspi_runtime_suspend(struct device *dev) |
516 | { | 516 | { |
517 | struct mcfqspi *mcfqspi = dev_get_drvdata(dev); | 517 | struct spi_master *master = dev_get_drvdata(dev); |
518 | struct mcfqspi *mcfqspi = spi_master_get_devdata(master); | ||
518 | 519 | ||
519 | clk_disable(mcfqspi->clk); | 520 | clk_disable(mcfqspi->clk); |
520 | 521 | ||
@@ -523,7 +524,8 @@ static int mcfqspi_runtime_suspend(struct device *dev) | |||
523 | 524 | ||
524 | static int mcfqspi_runtime_resume(struct device *dev) | 525 | static int mcfqspi_runtime_resume(struct device *dev) |
525 | { | 526 | { |
526 | struct mcfqspi *mcfqspi = dev_get_drvdata(dev); | 527 | struct spi_master *master = dev_get_drvdata(dev); |
528 | struct mcfqspi *mcfqspi = spi_master_get_devdata(master); | ||
527 | 529 | ||
528 | clk_enable(mcfqspi->clk); | 530 | clk_enable(mcfqspi->clk); |
529 | 531 | ||
diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index ec79f726672a..a25392065d9b 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c | |||
@@ -420,7 +420,6 @@ static int dspi_suspend(struct device *dev) | |||
420 | 420 | ||
421 | static int dspi_resume(struct device *dev) | 421 | static int dspi_resume(struct device *dev) |
422 | { | 422 | { |
423 | |||
424 | struct spi_master *master = dev_get_drvdata(dev); | 423 | struct spi_master *master = dev_get_drvdata(dev); |
425 | struct fsl_dspi *dspi = spi_master_get_devdata(master); | 424 | struct fsl_dspi *dspi = spi_master_get_devdata(master); |
426 | 425 | ||
@@ -504,7 +503,7 @@ static int dspi_probe(struct platform_device *pdev) | |||
504 | clk_prepare_enable(dspi->clk); | 503 | clk_prepare_enable(dspi->clk); |
505 | 504 | ||
506 | init_waitqueue_head(&dspi->waitq); | 505 | init_waitqueue_head(&dspi->waitq); |
507 | platform_set_drvdata(pdev, dspi); | 506 | platform_set_drvdata(pdev, master); |
508 | 507 | ||
509 | ret = spi_bitbang_start(&dspi->bitbang); | 508 | ret = spi_bitbang_start(&dspi->bitbang); |
510 | if (ret != 0) { | 509 | if (ret != 0) { |
@@ -525,7 +524,8 @@ out_master_put: | |||
525 | 524 | ||
526 | static int dspi_remove(struct platform_device *pdev) | 525 | static int dspi_remove(struct platform_device *pdev) |
527 | { | 526 | { |
528 | struct fsl_dspi *dspi = platform_get_drvdata(pdev); | 527 | struct spi_master *master = platform_get_drvdata(pdev); |
528 | struct fsl_dspi *dspi = spi_master_get_devdata(master); | ||
529 | 529 | ||
530 | /* Disconnect from the SPI framework */ | 530 | /* Disconnect from the SPI framework */ |
531 | spi_bitbang_stop(&dspi->bitbang); | 531 | spi_bitbang_stop(&dspi->bitbang); |
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index a5474ef9d2a0..47f15d97e7fa 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c | |||
@@ -948,8 +948,8 @@ static int spi_imx_remove(struct platform_device *pdev) | |||
948 | spi_bitbang_stop(&spi_imx->bitbang); | 948 | spi_bitbang_stop(&spi_imx->bitbang); |
949 | 949 | ||
950 | writel(0, spi_imx->base + MXC_CSPICTRL); | 950 | writel(0, spi_imx->base + MXC_CSPICTRL); |
951 | clk_disable_unprepare(spi_imx->clk_ipg); | 951 | clk_unprepare(spi_imx->clk_ipg); |
952 | clk_disable_unprepare(spi_imx->clk_per); | 952 | clk_unprepare(spi_imx->clk_per); |
953 | spi_master_put(master); | 953 | spi_master_put(master); |
954 | 954 | ||
955 | return 0; | 955 | return 0; |
diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c index 2e7f38c7a961..88eb57e858b3 100644 --- a/drivers/spi/spi-topcliff-pch.c +++ b/drivers/spi/spi-topcliff-pch.c | |||
@@ -915,7 +915,7 @@ static void pch_spi_request_dma(struct pch_spi_data *data, int bpw) | |||
915 | /* Set Tx DMA */ | 915 | /* Set Tx DMA */ |
916 | param = &dma->param_tx; | 916 | param = &dma->param_tx; |
917 | param->dma_dev = &dma_dev->dev; | 917 | param->dma_dev = &dma_dev->dev; |
918 | param->chan_id = data->master->bus_num * 2; /* Tx = 0, 2 */ | 918 | param->chan_id = data->ch * 2; /* Tx = 0, 2 */; |
919 | param->tx_reg = data->io_base_addr + PCH_SPDWR; | 919 | param->tx_reg = data->io_base_addr + PCH_SPDWR; |
920 | param->width = width; | 920 | param->width = width; |
921 | chan = dma_request_channel(mask, pch_spi_filter, param); | 921 | chan = dma_request_channel(mask, pch_spi_filter, param); |
@@ -930,7 +930,7 @@ static void pch_spi_request_dma(struct pch_spi_data *data, int bpw) | |||
930 | /* Set Rx DMA */ | 930 | /* Set Rx DMA */ |
931 | param = &dma->param_rx; | 931 | param = &dma->param_rx; |
932 | param->dma_dev = &dma_dev->dev; | 932 | param->dma_dev = &dma_dev->dev; |
933 | param->chan_id = data->master->bus_num * 2 + 1; /* Rx = Tx + 1 */ | 933 | param->chan_id = data->ch * 2 + 1; /* Rx = Tx + 1 */; |
934 | param->rx_reg = data->io_base_addr + PCH_SPDRR; | 934 | param->rx_reg = data->io_base_addr + PCH_SPDRR; |
935 | param->width = width; | 935 | param->width = width; |
936 | chan = dma_request_channel(mask, pch_spi_filter, param); | 936 | chan = dma_request_channel(mask, pch_spi_filter, param); |
@@ -1452,6 +1452,11 @@ static int pch_spi_pd_probe(struct platform_device *plat_dev) | |||
1452 | 1452 | ||
1453 | pch_spi_set_master_mode(master); | 1453 | pch_spi_set_master_mode(master); |
1454 | 1454 | ||
1455 | if (use_dma) { | ||
1456 | dev_info(&plat_dev->dev, "Use DMA for data transfers\n"); | ||
1457 | pch_alloc_dma_buf(board_dat, data); | ||
1458 | } | ||
1459 | |||
1455 | ret = spi_register_master(master); | 1460 | ret = spi_register_master(master); |
1456 | if (ret != 0) { | 1461 | if (ret != 0) { |
1457 | dev_err(&plat_dev->dev, | 1462 | dev_err(&plat_dev->dev, |
@@ -1459,14 +1464,10 @@ static int pch_spi_pd_probe(struct platform_device *plat_dev) | |||
1459 | goto err_spi_register_master; | 1464 | goto err_spi_register_master; |
1460 | } | 1465 | } |
1461 | 1466 | ||
1462 | if (use_dma) { | ||
1463 | dev_info(&plat_dev->dev, "Use DMA for data transfers\n"); | ||
1464 | pch_alloc_dma_buf(board_dat, data); | ||
1465 | } | ||
1466 | |||
1467 | return 0; | 1467 | return 0; |
1468 | 1468 | ||
1469 | err_spi_register_master: | 1469 | err_spi_register_master: |
1470 | pch_free_dma_buf(board_dat, data); | ||
1470 | free_irq(board_dat->pdev->irq, data); | 1471 | free_irq(board_dat->pdev->irq, data); |
1471 | err_request_irq: | 1472 | err_request_irq: |
1472 | pch_spi_free_resources(board_dat, data); | 1473 | pch_spi_free_resources(board_dat, data); |
diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c index eaec1dab7fe4..1432d956769c 100644 --- a/drivers/staging/android/binder.c +++ b/drivers/staging/android/binder.c | |||
@@ -2904,7 +2904,7 @@ static int binder_node_release(struct binder_node *node, int refs) | |||
2904 | refs++; | 2904 | refs++; |
2905 | 2905 | ||
2906 | if (!ref->death) | 2906 | if (!ref->death) |
2907 | goto out; | 2907 | continue; |
2908 | 2908 | ||
2909 | death++; | 2909 | death++; |
2910 | 2910 | ||
@@ -2917,7 +2917,6 @@ static int binder_node_release(struct binder_node *node, int refs) | |||
2917 | BUG(); | 2917 | BUG(); |
2918 | } | 2918 | } |
2919 | 2919 | ||
2920 | out: | ||
2921 | binder_debug(BINDER_DEBUG_DEAD_BINDER, | 2920 | binder_debug(BINDER_DEBUG_DEAD_BINDER, |
2922 | "node %d now dead, refs %d, death %d\n", | 2921 | "node %d now dead, refs %d, death %d\n", |
2923 | node->debug_id, refs, death); | 2922 | node->debug_id, refs, death); |
diff --git a/drivers/staging/bcm/Bcmnet.c b/drivers/staging/bcm/Bcmnet.c index 8dfdd2732bdc..95a2358267ba 100644 --- a/drivers/staging/bcm/Bcmnet.c +++ b/drivers/staging/bcm/Bcmnet.c | |||
@@ -40,7 +40,7 @@ static INT bcm_close(struct net_device *dev) | |||
40 | } | 40 | } |
41 | 41 | ||
42 | static u16 bcm_select_queue(struct net_device *dev, struct sk_buff *skb, | 42 | static u16 bcm_select_queue(struct net_device *dev, struct sk_buff *skb, |
43 | void *accel_priv) | 43 | void *accel_priv, select_queue_fallback_t fallback) |
44 | { | 44 | { |
45 | return ClassifyPacket(netdev_priv(dev), skb); | 45 | return ClassifyPacket(netdev_priv(dev), skb); |
46 | } | 46 | } |
diff --git a/drivers/staging/cxt1e1/linux.c b/drivers/staging/cxt1e1/linux.c index 4a08e16e42f7..79206cb3fb94 100644 --- a/drivers/staging/cxt1e1/linux.c +++ b/drivers/staging/cxt1e1/linux.c | |||
@@ -866,6 +866,8 @@ c4_ioctl (struct net_device *ndev, struct ifreq *ifr, int cmd) | |||
866 | _IOC_SIZE (iocmd)); | 866 | _IOC_SIZE (iocmd)); |
867 | #endif | 867 | #endif |
868 | iolen = _IOC_SIZE (iocmd); | 868 | iolen = _IOC_SIZE (iocmd); |
869 | if (iolen > sizeof(arg)) | ||
870 | return -EFAULT; | ||
869 | data = ifr->ifr_data + sizeof (iocmd); | 871 | data = ifr->ifr_data + sizeof (iocmd); |
870 | if (copy_from_user (&arg, data, iolen)) | 872 | if (copy_from_user (&arg, data, iolen)) |
871 | return -EFAULT; | 873 | return -EFAULT; |
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 7fc66a6a6e36..514844efac75 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c | |||
@@ -757,6 +757,7 @@ static void mxs_lradc_finish_touch_event(struct mxs_lradc *lradc, bool valid) | |||
757 | } | 757 | } |
758 | 758 | ||
759 | /* if it is released, wait for the next touch via IRQ */ | 759 | /* if it is released, wait for the next touch via IRQ */ |
760 | lradc->cur_plate = LRADC_TOUCH; | ||
760 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1); | 761 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1); |
761 | mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1); | 762 | mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1); |
762 | } | 763 | } |
diff --git a/drivers/staging/netlogic/xlr_net.c b/drivers/staging/netlogic/xlr_net.c index d8ea25486a33..31b269a5fff7 100644 --- a/drivers/staging/netlogic/xlr_net.c +++ b/drivers/staging/netlogic/xlr_net.c | |||
@@ -307,7 +307,7 @@ static netdev_tx_t xlr_net_start_xmit(struct sk_buff *skb, | |||
307 | } | 307 | } |
308 | 308 | ||
309 | static u16 xlr_net_select_queue(struct net_device *ndev, struct sk_buff *skb, | 309 | static u16 xlr_net_select_queue(struct net_device *ndev, struct sk_buff *skb, |
310 | void *accel_priv) | 310 | void *accel_priv, select_queue_fallback_t fallback) |
311 | { | 311 | { |
312 | return (u16)smp_processor_id(); | 312 | return (u16)smp_processor_id(); |
313 | } | 313 | } |
diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c b/drivers/staging/rtl8188eu/os_dep/os_intfs.c index 68f98fa114d2..7c9ee58f47bb 100644 --- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c +++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c | |||
@@ -653,7 +653,7 @@ static unsigned int rtw_classify8021d(struct sk_buff *skb) | |||
653 | } | 653 | } |
654 | 654 | ||
655 | static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb, | 655 | static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb, |
656 | void *accel_priv) | 656 | void *accel_priv, select_queue_fallback_t fallback) |
657 | { | 657 | { |
658 | struct adapter *padapter = rtw_netdev_priv(dev); | 658 | struct adapter *padapter = rtw_netdev_priv(dev); |
659 | struct mlme_priv *pmlmepriv = &padapter->mlmepriv; | 659 | struct mlme_priv *pmlmepriv = &padapter->mlmepriv; |
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index a70dcef1419e..2f40ff5901d6 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c | |||
@@ -55,6 +55,7 @@ static struct usb_device_id rtw_usb_id_tbl[] = { | |||
55 | /****** 8188EUS ********/ | 55 | /****** 8188EUS ********/ |
56 | {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */ | 56 | {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */ |
57 | {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ | 57 | {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ |
58 | {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ | ||
58 | {} /* Terminating entry */ | 59 | {} /* Terminating entry */ |
59 | }; | 60 | }; |
60 | 61 | ||
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 7f1a7ce4b771..b83ec378d04f 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -785,7 +785,7 @@ static void iscsit_ack_from_expstatsn(struct iscsi_conn *conn, u32 exp_statsn) | |||
785 | spin_unlock_bh(&conn->cmd_lock); | 785 | spin_unlock_bh(&conn->cmd_lock); |
786 | 786 | ||
787 | list_for_each_entry_safe(cmd, cmd_p, &ack_list, i_conn_node) { | 787 | list_for_each_entry_safe(cmd, cmd_p, &ack_list, i_conn_node) { |
788 | list_del(&cmd->i_conn_node); | 788 | list_del_init(&cmd->i_conn_node); |
789 | iscsit_free_cmd(cmd, false); | 789 | iscsit_free_cmd(cmd, false); |
790 | } | 790 | } |
791 | } | 791 | } |
@@ -3708,7 +3708,7 @@ iscsit_immediate_queue(struct iscsi_conn *conn, struct iscsi_cmd *cmd, int state | |||
3708 | break; | 3708 | break; |
3709 | case ISTATE_REMOVE: | 3709 | case ISTATE_REMOVE: |
3710 | spin_lock_bh(&conn->cmd_lock); | 3710 | spin_lock_bh(&conn->cmd_lock); |
3711 | list_del(&cmd->i_conn_node); | 3711 | list_del_init(&cmd->i_conn_node); |
3712 | spin_unlock_bh(&conn->cmd_lock); | 3712 | spin_unlock_bh(&conn->cmd_lock); |
3713 | 3713 | ||
3714 | iscsit_free_cmd(cmd, false); | 3714 | iscsit_free_cmd(cmd, false); |
@@ -4151,7 +4151,7 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn) | |||
4151 | spin_lock_bh(&conn->cmd_lock); | 4151 | spin_lock_bh(&conn->cmd_lock); |
4152 | list_for_each_entry_safe(cmd, cmd_tmp, &conn->conn_cmd_list, i_conn_node) { | 4152 | list_for_each_entry_safe(cmd, cmd_tmp, &conn->conn_cmd_list, i_conn_node) { |
4153 | 4153 | ||
4154 | list_del(&cmd->i_conn_node); | 4154 | list_del_init(&cmd->i_conn_node); |
4155 | spin_unlock_bh(&conn->cmd_lock); | 4155 | spin_unlock_bh(&conn->cmd_lock); |
4156 | 4156 | ||
4157 | iscsit_increment_maxcmdsn(cmd, sess); | 4157 | iscsit_increment_maxcmdsn(cmd, sess); |
@@ -4196,6 +4196,10 @@ int iscsit_close_connection( | |||
4196 | iscsit_stop_timers_for_cmds(conn); | 4196 | iscsit_stop_timers_for_cmds(conn); |
4197 | iscsit_stop_nopin_response_timer(conn); | 4197 | iscsit_stop_nopin_response_timer(conn); |
4198 | iscsit_stop_nopin_timer(conn); | 4198 | iscsit_stop_nopin_timer(conn); |
4199 | |||
4200 | if (conn->conn_transport->iscsit_wait_conn) | ||
4201 | conn->conn_transport->iscsit_wait_conn(conn); | ||
4202 | |||
4199 | iscsit_free_queue_reqs_for_conn(conn); | 4203 | iscsit_free_queue_reqs_for_conn(conn); |
4200 | 4204 | ||
4201 | /* | 4205 | /* |
diff --git a/drivers/target/iscsi/iscsi_target_erl2.c b/drivers/target/iscsi/iscsi_target_erl2.c index 33be1fb1df32..4ca8fd2a70db 100644 --- a/drivers/target/iscsi/iscsi_target_erl2.c +++ b/drivers/target/iscsi/iscsi_target_erl2.c | |||
@@ -138,7 +138,7 @@ void iscsit_free_connection_recovery_entires(struct iscsi_session *sess) | |||
138 | list_for_each_entry_safe(cmd, cmd_tmp, | 138 | list_for_each_entry_safe(cmd, cmd_tmp, |
139 | &cr->conn_recovery_cmd_list, i_conn_node) { | 139 | &cr->conn_recovery_cmd_list, i_conn_node) { |
140 | 140 | ||
141 | list_del(&cmd->i_conn_node); | 141 | list_del_init(&cmd->i_conn_node); |
142 | cmd->conn = NULL; | 142 | cmd->conn = NULL; |
143 | spin_unlock(&cr->conn_recovery_cmd_lock); | 143 | spin_unlock(&cr->conn_recovery_cmd_lock); |
144 | iscsit_free_cmd(cmd, true); | 144 | iscsit_free_cmd(cmd, true); |
@@ -160,7 +160,7 @@ void iscsit_free_connection_recovery_entires(struct iscsi_session *sess) | |||
160 | list_for_each_entry_safe(cmd, cmd_tmp, | 160 | list_for_each_entry_safe(cmd, cmd_tmp, |
161 | &cr->conn_recovery_cmd_list, i_conn_node) { | 161 | &cr->conn_recovery_cmd_list, i_conn_node) { |
162 | 162 | ||
163 | list_del(&cmd->i_conn_node); | 163 | list_del_init(&cmd->i_conn_node); |
164 | cmd->conn = NULL; | 164 | cmd->conn = NULL; |
165 | spin_unlock(&cr->conn_recovery_cmd_lock); | 165 | spin_unlock(&cr->conn_recovery_cmd_lock); |
166 | iscsit_free_cmd(cmd, true); | 166 | iscsit_free_cmd(cmd, true); |
@@ -216,7 +216,7 @@ int iscsit_remove_cmd_from_connection_recovery( | |||
216 | } | 216 | } |
217 | cr = cmd->cr; | 217 | cr = cmd->cr; |
218 | 218 | ||
219 | list_del(&cmd->i_conn_node); | 219 | list_del_init(&cmd->i_conn_node); |
220 | return --cr->cmd_count; | 220 | return --cr->cmd_count; |
221 | } | 221 | } |
222 | 222 | ||
@@ -297,7 +297,7 @@ int iscsit_discard_unacknowledged_ooo_cmdsns_for_conn(struct iscsi_conn *conn) | |||
297 | if (!(cmd->cmd_flags & ICF_OOO_CMDSN)) | 297 | if (!(cmd->cmd_flags & ICF_OOO_CMDSN)) |
298 | continue; | 298 | continue; |
299 | 299 | ||
300 | list_del(&cmd->i_conn_node); | 300 | list_del_init(&cmd->i_conn_node); |
301 | 301 | ||
302 | spin_unlock_bh(&conn->cmd_lock); | 302 | spin_unlock_bh(&conn->cmd_lock); |
303 | iscsit_free_cmd(cmd, true); | 303 | iscsit_free_cmd(cmd, true); |
@@ -335,7 +335,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn) | |||
335 | /* | 335 | /* |
336 | * Only perform connection recovery on ISCSI_OP_SCSI_CMD or | 336 | * Only perform connection recovery on ISCSI_OP_SCSI_CMD or |
337 | * ISCSI_OP_NOOP_OUT opcodes. For all other opcodes call | 337 | * ISCSI_OP_NOOP_OUT opcodes. For all other opcodes call |
338 | * list_del(&cmd->i_conn_node); to release the command to the | 338 | * list_del_init(&cmd->i_conn_node); to release the command to the |
339 | * session pool and remove it from the connection's list. | 339 | * session pool and remove it from the connection's list. |
340 | * | 340 | * |
341 | * Also stop the DataOUT timer, which will be restarted after | 341 | * Also stop the DataOUT timer, which will be restarted after |
@@ -351,7 +351,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn) | |||
351 | " CID: %hu\n", cmd->iscsi_opcode, | 351 | " CID: %hu\n", cmd->iscsi_opcode, |
352 | cmd->init_task_tag, cmd->cmd_sn, conn->cid); | 352 | cmd->init_task_tag, cmd->cmd_sn, conn->cid); |
353 | 353 | ||
354 | list_del(&cmd->i_conn_node); | 354 | list_del_init(&cmd->i_conn_node); |
355 | spin_unlock_bh(&conn->cmd_lock); | 355 | spin_unlock_bh(&conn->cmd_lock); |
356 | iscsit_free_cmd(cmd, true); | 356 | iscsit_free_cmd(cmd, true); |
357 | spin_lock_bh(&conn->cmd_lock); | 357 | spin_lock_bh(&conn->cmd_lock); |
@@ -371,7 +371,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn) | |||
371 | */ | 371 | */ |
372 | if (!(cmd->cmd_flags & ICF_OOO_CMDSN) && !cmd->immediate_cmd && | 372 | if (!(cmd->cmd_flags & ICF_OOO_CMDSN) && !cmd->immediate_cmd && |
373 | iscsi_sna_gte(cmd->cmd_sn, conn->sess->exp_cmd_sn)) { | 373 | iscsi_sna_gte(cmd->cmd_sn, conn->sess->exp_cmd_sn)) { |
374 | list_del(&cmd->i_conn_node); | 374 | list_del_init(&cmd->i_conn_node); |
375 | spin_unlock_bh(&conn->cmd_lock); | 375 | spin_unlock_bh(&conn->cmd_lock); |
376 | iscsit_free_cmd(cmd, true); | 376 | iscsit_free_cmd(cmd, true); |
377 | spin_lock_bh(&conn->cmd_lock); | 377 | spin_lock_bh(&conn->cmd_lock); |
@@ -393,7 +393,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn) | |||
393 | 393 | ||
394 | cmd->sess = conn->sess; | 394 | cmd->sess = conn->sess; |
395 | 395 | ||
396 | list_del(&cmd->i_conn_node); | 396 | list_del_init(&cmd->i_conn_node); |
397 | spin_unlock_bh(&conn->cmd_lock); | 397 | spin_unlock_bh(&conn->cmd_lock); |
398 | 398 | ||
399 | iscsit_free_all_datain_reqs(cmd); | 399 | iscsit_free_all_datain_reqs(cmd); |
diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c index 39761837608d..44a5471de00f 100644 --- a/drivers/target/iscsi/iscsi_target_tpg.c +++ b/drivers/target/iscsi/iscsi_target_tpg.c | |||
@@ -137,7 +137,7 @@ struct iscsi_portal_group *iscsit_get_tpg_from_np( | |||
137 | list_for_each_entry(tpg, &tiqn->tiqn_tpg_list, tpg_list) { | 137 | list_for_each_entry(tpg, &tiqn->tiqn_tpg_list, tpg_list) { |
138 | 138 | ||
139 | spin_lock(&tpg->tpg_state_lock); | 139 | spin_lock(&tpg->tpg_state_lock); |
140 | if (tpg->tpg_state == TPG_STATE_FREE) { | 140 | if (tpg->tpg_state != TPG_STATE_ACTIVE) { |
141 | spin_unlock(&tpg->tpg_state_lock); | 141 | spin_unlock(&tpg->tpg_state_lock); |
142 | continue; | 142 | continue; |
143 | } | 143 | } |
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index a4489444ffbc..77e6531fb0a1 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
@@ -1074,31 +1074,36 @@ sbc_dif_copy_prot(struct se_cmd *cmd, unsigned int sectors, bool read, | |||
1074 | struct scatterlist *psg; | 1074 | struct scatterlist *psg; |
1075 | void *paddr, *addr; | 1075 | void *paddr, *addr; |
1076 | unsigned int i, len, left; | 1076 | unsigned int i, len, left; |
1077 | unsigned int offset = 0; | 1077 | unsigned int offset = sg_off; |
1078 | 1078 | ||
1079 | left = sectors * dev->prot_length; | 1079 | left = sectors * dev->prot_length; |
1080 | 1080 | ||
1081 | for_each_sg(cmd->t_prot_sg, psg, cmd->t_prot_nents, i) { | 1081 | for_each_sg(cmd->t_prot_sg, psg, cmd->t_prot_nents, i) { |
1082 | 1082 | unsigned int psg_len, copied = 0; | |
1083 | len = min(psg->length, left); | ||
1084 | if (offset >= sg->length) { | ||
1085 | sg = sg_next(sg); | ||
1086 | offset = 0; | ||
1087 | sg_off = sg->offset; | ||
1088 | } | ||
1089 | 1083 | ||
1090 | paddr = kmap_atomic(sg_page(psg)) + psg->offset; | 1084 | paddr = kmap_atomic(sg_page(psg)) + psg->offset; |
1091 | addr = kmap_atomic(sg_page(sg)) + sg_off; | 1085 | psg_len = min(left, psg->length); |
1086 | while (psg_len) { | ||
1087 | len = min(psg_len, sg->length - offset); | ||
1088 | addr = kmap_atomic(sg_page(sg)) + sg->offset + offset; | ||
1092 | 1089 | ||
1093 | if (read) | 1090 | if (read) |
1094 | memcpy(paddr, addr, len); | 1091 | memcpy(paddr + copied, addr, len); |
1095 | else | 1092 | else |
1096 | memcpy(addr, paddr, len); | 1093 | memcpy(addr, paddr + copied, len); |
1097 | 1094 | ||
1098 | left -= len; | 1095 | left -= len; |
1099 | offset += len; | 1096 | offset += len; |
1097 | copied += len; | ||
1098 | psg_len -= len; | ||
1099 | |||
1100 | if (offset >= sg->length) { | ||
1101 | sg = sg_next(sg); | ||
1102 | offset = 0; | ||
1103 | } | ||
1104 | kunmap_atomic(addr); | ||
1105 | } | ||
1100 | kunmap_atomic(paddr); | 1106 | kunmap_atomic(paddr); |
1101 | kunmap_atomic(addr); | ||
1102 | } | 1107 | } |
1103 | } | 1108 | } |
1104 | 1109 | ||
@@ -1163,7 +1168,7 @@ sbc_dif_verify_read(struct se_cmd *cmd, sector_t start, unsigned int sectors, | |||
1163 | { | 1168 | { |
1164 | struct se_device *dev = cmd->se_dev; | 1169 | struct se_device *dev = cmd->se_dev; |
1165 | struct se_dif_v1_tuple *sdt; | 1170 | struct se_dif_v1_tuple *sdt; |
1166 | struct scatterlist *dsg; | 1171 | struct scatterlist *dsg, *psg = sg; |
1167 | sector_t sector = start; | 1172 | sector_t sector = start; |
1168 | void *daddr, *paddr; | 1173 | void *daddr, *paddr; |
1169 | int i, j, offset = sg_off; | 1174 | int i, j, offset = sg_off; |
@@ -1171,14 +1176,14 @@ sbc_dif_verify_read(struct se_cmd *cmd, sector_t start, unsigned int sectors, | |||
1171 | 1176 | ||
1172 | for_each_sg(cmd->t_data_sg, dsg, cmd->t_data_nents, i) { | 1177 | for_each_sg(cmd->t_data_sg, dsg, cmd->t_data_nents, i) { |
1173 | daddr = kmap_atomic(sg_page(dsg)) + dsg->offset; | 1178 | daddr = kmap_atomic(sg_page(dsg)) + dsg->offset; |
1174 | paddr = kmap_atomic(sg_page(sg)) + sg->offset; | 1179 | paddr = kmap_atomic(sg_page(psg)) + sg->offset; |
1175 | 1180 | ||
1176 | for (j = 0; j < dsg->length; j += dev->dev_attrib.block_size) { | 1181 | for (j = 0; j < dsg->length; j += dev->dev_attrib.block_size) { |
1177 | 1182 | ||
1178 | if (offset >= sg->length) { | 1183 | if (offset >= psg->length) { |
1179 | kunmap_atomic(paddr); | 1184 | kunmap_atomic(paddr); |
1180 | sg = sg_next(sg); | 1185 | psg = sg_next(psg); |
1181 | paddr = kmap_atomic(sg_page(sg)) + sg->offset; | 1186 | paddr = kmap_atomic(sg_page(psg)) + psg->offset; |
1182 | offset = 0; | 1187 | offset = 0; |
1183 | } | 1188 | } |
1184 | 1189 | ||
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 24b4f65d8777..2956250b7225 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -1601,6 +1601,9 @@ void transport_generic_request_failure(struct se_cmd *cmd, | |||
1601 | case TCM_CHECK_CONDITION_ABORT_CMD: | 1601 | case TCM_CHECK_CONDITION_ABORT_CMD: |
1602 | case TCM_CHECK_CONDITION_UNIT_ATTENTION: | 1602 | case TCM_CHECK_CONDITION_UNIT_ATTENTION: |
1603 | case TCM_CHECK_CONDITION_NOT_READY: | 1603 | case TCM_CHECK_CONDITION_NOT_READY: |
1604 | case TCM_LOGICAL_BLOCK_GUARD_CHECK_FAILED: | ||
1605 | case TCM_LOGICAL_BLOCK_APP_TAG_CHECK_FAILED: | ||
1606 | case TCM_LOGICAL_BLOCK_REF_TAG_CHECK_FAILED: | ||
1604 | break; | 1607 | break; |
1605 | case TCM_OUT_OF_RESOURCES: | 1608 | case TCM_OUT_OF_RESOURCES: |
1606 | sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 1609 | sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index 35c066489a19..5f88d767671e 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig | |||
@@ -136,6 +136,7 @@ config SPEAR_THERMAL | |||
136 | config RCAR_THERMAL | 136 | config RCAR_THERMAL |
137 | tristate "Renesas R-Car thermal driver" | 137 | tristate "Renesas R-Car thermal driver" |
138 | depends on ARCH_SHMOBILE || COMPILE_TEST | 138 | depends on ARCH_SHMOBILE || COMPILE_TEST |
139 | depends on HAS_IOMEM | ||
139 | help | 140 | help |
140 | Enable this to plug the R-Car thermal sensor driver into the Linux | 141 | Enable this to plug the R-Car thermal sensor driver into the Linux |
141 | thermal framework. | 142 | thermal framework. |
@@ -210,8 +211,16 @@ config ACPI_INT3403_THERMAL | |||
210 | tristate "ACPI INT3403 thermal driver" | 211 | tristate "ACPI INT3403 thermal driver" |
211 | depends on X86 && ACPI | 212 | depends on X86 && ACPI |
212 | help | 213 | help |
213 | This driver uses ACPI INT3403 device objects. If present, it will | 214 | Newer laptops and tablets that use ACPI may have thermal sensors |
214 | register each INT3403 thermal sensor as a thermal zone. | 215 | outside the core CPU/SOC for thermal safety reasons. These |
216 | temperature sensors are also exposed for the OS to use via the so | ||
217 | called INT3403 ACPI object. This driver will, on devices that have | ||
218 | such sensors, expose the temperature information from these sensors | ||
219 | to userspace via the normal thermal framework. This means that a wide | ||
220 | range of applications and GUI widgets can show this information to | ||
221 | the user or use this information for making decisions. For example, | ||
222 | the Intel Thermal Daemon can use this information to allow the user | ||
223 | to select his laptop to run without turning on the fans. | ||
215 | 224 | ||
216 | menu "Texas Instruments thermal drivers" | 225 | menu "Texas Instruments thermal drivers" |
217 | source "drivers/thermal/ti-soc-thermal/Kconfig" | 226 | source "drivers/thermal/ti-soc-thermal/Kconfig" |
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 338a88bf6662..71b0ec0c370d 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c | |||
@@ -56,10 +56,15 @@ static LIST_HEAD(thermal_governor_list); | |||
56 | static DEFINE_MUTEX(thermal_list_lock); | 56 | static DEFINE_MUTEX(thermal_list_lock); |
57 | static DEFINE_MUTEX(thermal_governor_lock); | 57 | static DEFINE_MUTEX(thermal_governor_lock); |
58 | 58 | ||
59 | static struct thermal_governor *def_governor; | ||
60 | |||
59 | static struct thermal_governor *__find_governor(const char *name) | 61 | static struct thermal_governor *__find_governor(const char *name) |
60 | { | 62 | { |
61 | struct thermal_governor *pos; | 63 | struct thermal_governor *pos; |
62 | 64 | ||
65 | if (!name || !name[0]) | ||
66 | return def_governor; | ||
67 | |||
63 | list_for_each_entry(pos, &thermal_governor_list, governor_list) | 68 | list_for_each_entry(pos, &thermal_governor_list, governor_list) |
64 | if (!strnicmp(name, pos->name, THERMAL_NAME_LENGTH)) | 69 | if (!strnicmp(name, pos->name, THERMAL_NAME_LENGTH)) |
65 | return pos; | 70 | return pos; |
@@ -82,17 +87,23 @@ int thermal_register_governor(struct thermal_governor *governor) | |||
82 | if (__find_governor(governor->name) == NULL) { | 87 | if (__find_governor(governor->name) == NULL) { |
83 | err = 0; | 88 | err = 0; |
84 | list_add(&governor->governor_list, &thermal_governor_list); | 89 | list_add(&governor->governor_list, &thermal_governor_list); |
90 | if (!def_governor && !strncmp(governor->name, | ||
91 | DEFAULT_THERMAL_GOVERNOR, THERMAL_NAME_LENGTH)) | ||
92 | def_governor = governor; | ||
85 | } | 93 | } |
86 | 94 | ||
87 | mutex_lock(&thermal_list_lock); | 95 | mutex_lock(&thermal_list_lock); |
88 | 96 | ||
89 | list_for_each_entry(pos, &thermal_tz_list, node) { | 97 | list_for_each_entry(pos, &thermal_tz_list, node) { |
98 | /* | ||
99 | * only thermal zones with specified tz->tzp->governor_name | ||
100 | * may run with tz->govenor unset | ||
101 | */ | ||
90 | if (pos->governor) | 102 | if (pos->governor) |
91 | continue; | 103 | continue; |
92 | if (pos->tzp) | 104 | |
93 | name = pos->tzp->governor_name; | 105 | name = pos->tzp->governor_name; |
94 | else | 106 | |
95 | name = DEFAULT_THERMAL_GOVERNOR; | ||
96 | if (!strnicmp(name, governor->name, THERMAL_NAME_LENGTH)) | 107 | if (!strnicmp(name, governor->name, THERMAL_NAME_LENGTH)) |
97 | pos->governor = governor; | 108 | pos->governor = governor; |
98 | } | 109 | } |
@@ -342,8 +353,8 @@ static void monitor_thermal_zone(struct thermal_zone_device *tz) | |||
342 | static void handle_non_critical_trips(struct thermal_zone_device *tz, | 353 | static void handle_non_critical_trips(struct thermal_zone_device *tz, |
343 | int trip, enum thermal_trip_type trip_type) | 354 | int trip, enum thermal_trip_type trip_type) |
344 | { | 355 | { |
345 | if (tz->governor) | 356 | tz->governor ? tz->governor->throttle(tz, trip) : |
346 | tz->governor->throttle(tz, trip); | 357 | def_governor->throttle(tz, trip); |
347 | } | 358 | } |
348 | 359 | ||
349 | static void handle_critical_trips(struct thermal_zone_device *tz, | 360 | static void handle_critical_trips(struct thermal_zone_device *tz, |
@@ -1107,7 +1118,7 @@ __thermal_cooling_device_register(struct device_node *np, | |||
1107 | INIT_LIST_HEAD(&cdev->thermal_instances); | 1118 | INIT_LIST_HEAD(&cdev->thermal_instances); |
1108 | cdev->np = np; | 1119 | cdev->np = np; |
1109 | cdev->ops = ops; | 1120 | cdev->ops = ops; |
1110 | cdev->updated = true; | 1121 | cdev->updated = false; |
1111 | cdev->device.class = &thermal_class; | 1122 | cdev->device.class = &thermal_class; |
1112 | cdev->devdata = devdata; | 1123 | cdev->devdata = devdata; |
1113 | dev_set_name(&cdev->device, "cooling_device%d", cdev->id); | 1124 | dev_set_name(&cdev->device, "cooling_device%d", cdev->id); |
@@ -1533,7 +1544,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, | |||
1533 | if (tz->tzp) | 1544 | if (tz->tzp) |
1534 | tz->governor = __find_governor(tz->tzp->governor_name); | 1545 | tz->governor = __find_governor(tz->tzp->governor_name); |
1535 | else | 1546 | else |
1536 | tz->governor = __find_governor(DEFAULT_THERMAL_GOVERNOR); | 1547 | tz->governor = def_governor; |
1537 | 1548 | ||
1538 | mutex_unlock(&thermal_governor_lock); | 1549 | mutex_unlock(&thermal_governor_lock); |
1539 | 1550 | ||
diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c index 972e1c73722a..081fd7e6a9f0 100644 --- a/drivers/thermal/x86_pkg_temp_thermal.c +++ b/drivers/thermal/x86_pkg_temp_thermal.c | |||
@@ -68,6 +68,10 @@ struct phy_dev_entry { | |||
68 | struct thermal_zone_device *tzone; | 68 | struct thermal_zone_device *tzone; |
69 | }; | 69 | }; |
70 | 70 | ||
71 | static const struct thermal_zone_params pkg_temp_tz_params = { | ||
72 | .no_hwmon = true, | ||
73 | }; | ||
74 | |||
71 | /* List maintaining number of package instances */ | 75 | /* List maintaining number of package instances */ |
72 | static LIST_HEAD(phy_dev_list); | 76 | static LIST_HEAD(phy_dev_list); |
73 | static DEFINE_MUTEX(phy_dev_list_mutex); | 77 | static DEFINE_MUTEX(phy_dev_list_mutex); |
@@ -394,7 +398,6 @@ static int pkg_temp_thermal_device_add(unsigned int cpu) | |||
394 | int err; | 398 | int err; |
395 | u32 tj_max; | 399 | u32 tj_max; |
396 | struct phy_dev_entry *phy_dev_entry; | 400 | struct phy_dev_entry *phy_dev_entry; |
397 | char buffer[30]; | ||
398 | int thres_count; | 401 | int thres_count; |
399 | u32 eax, ebx, ecx, edx; | 402 | u32 eax, ebx, ecx, edx; |
400 | u8 *temp; | 403 | u8 *temp; |
@@ -440,13 +443,11 @@ static int pkg_temp_thermal_device_add(unsigned int cpu) | |||
440 | phy_dev_entry->first_cpu = cpu; | 443 | phy_dev_entry->first_cpu = cpu; |
441 | phy_dev_entry->tj_max = tj_max; | 444 | phy_dev_entry->tj_max = tj_max; |
442 | phy_dev_entry->ref_cnt = 1; | 445 | phy_dev_entry->ref_cnt = 1; |
443 | snprintf(buffer, sizeof(buffer), "pkg-temp-%d\n", | 446 | phy_dev_entry->tzone = thermal_zone_device_register("x86_pkg_temp", |
444 | phy_dev_entry->phys_proc_id); | ||
445 | phy_dev_entry->tzone = thermal_zone_device_register(buffer, | ||
446 | thres_count, | 447 | thres_count, |
447 | (thres_count == MAX_NUMBER_OF_TRIPS) ? | 448 | (thres_count == MAX_NUMBER_OF_TRIPS) ? |
448 | 0x03 : 0x01, | 449 | 0x03 : 0x01, |
449 | phy_dev_entry, &tzone_ops, NULL, 0, 0); | 450 | phy_dev_entry, &tzone_ops, &pkg_temp_tz_params, 0, 0); |
450 | if (IS_ERR(phy_dev_entry->tzone)) { | 451 | if (IS_ERR(phy_dev_entry->tzone)) { |
451 | err = PTR_ERR(phy_dev_entry->tzone); | 452 | err = PTR_ERR(phy_dev_entry->tzone); |
452 | goto err_ret_free; | 453 | goto err_ret_free; |
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index bd2715a9d8e5..c74a00ad7add 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
@@ -1267,17 +1267,16 @@ static void pty_line_name(struct tty_driver *driver, int index, char *p) | |||
1267 | * @p: output buffer of at least 7 bytes | 1267 | * @p: output buffer of at least 7 bytes |
1268 | * | 1268 | * |
1269 | * Generate a name from a driver reference and write it to the output | 1269 | * Generate a name from a driver reference and write it to the output |
1270 | * buffer. Return the number of bytes written. | 1270 | * buffer. |
1271 | * | 1271 | * |
1272 | * Locking: None | 1272 | * Locking: None |
1273 | */ | 1273 | */ |
1274 | static ssize_t tty_line_name(struct tty_driver *driver, int index, char *p) | 1274 | static void tty_line_name(struct tty_driver *driver, int index, char *p) |
1275 | { | 1275 | { |
1276 | if (driver->flags & TTY_DRIVER_UNNUMBERED_NODE) | 1276 | if (driver->flags & TTY_DRIVER_UNNUMBERED_NODE) |
1277 | return sprintf(p, "%s", driver->name); | 1277 | strcpy(p, driver->name); |
1278 | else | 1278 | else |
1279 | return sprintf(p, "%s%d", driver->name, | 1279 | sprintf(p, "%s%d", driver->name, index + driver->name_base); |
1280 | index + driver->name_base); | ||
1281 | } | 1280 | } |
1282 | 1281 | ||
1283 | /** | 1282 | /** |
@@ -3546,19 +3545,9 @@ static ssize_t show_cons_active(struct device *dev, | |||
3546 | if (i >= ARRAY_SIZE(cs)) | 3545 | if (i >= ARRAY_SIZE(cs)) |
3547 | break; | 3546 | break; |
3548 | } | 3547 | } |
3549 | while (i--) { | 3548 | while (i--) |
3550 | struct tty_driver *driver; | 3549 | count += sprintf(buf + count, "%s%d%c", |
3551 | const char *name = cs[i]->name; | 3550 | cs[i]->name, cs[i]->index, i ? ' ':'\n'); |
3552 | int index = cs[i]->index; | ||
3553 | |||
3554 | driver = cs[i]->device(cs[i], &index); | ||
3555 | if (driver) { | ||
3556 | count += tty_line_name(driver, index, buf + count); | ||
3557 | count += sprintf(buf + count, "%c", i ? ' ':'\n'); | ||
3558 | } else | ||
3559 | count += sprintf(buf + count, "%s%d%c", | ||
3560 | name, index, i ? ' ':'\n'); | ||
3561 | } | ||
3562 | console_unlock(); | 3551 | console_unlock(); |
3563 | 3552 | ||
3564 | return count; | 3553 | return count; |
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 80de2f88ed2c..4ab2cb62dfce 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c | |||
@@ -105,7 +105,7 @@ static int hw_ep_flush(struct ci_hdrc *ci, int num, int dir) | |||
105 | 105 | ||
106 | do { | 106 | do { |
107 | /* flush any pending transfer */ | 107 | /* flush any pending transfer */ |
108 | hw_write(ci, OP_ENDPTFLUSH, BIT(n), BIT(n)); | 108 | hw_write(ci, OP_ENDPTFLUSH, ~0, BIT(n)); |
109 | while (hw_read(ci, OP_ENDPTFLUSH, BIT(n))) | 109 | while (hw_read(ci, OP_ENDPTFLUSH, BIT(n))) |
110 | cpu_relax(); | 110 | cpu_relax(); |
111 | } while (hw_read(ci, OP_ENDPTSTAT, BIT(n))); | 111 | } while (hw_read(ci, OP_ENDPTSTAT, BIT(n))); |
@@ -205,7 +205,7 @@ static int hw_ep_prime(struct ci_hdrc *ci, int num, int dir, int is_ctrl) | |||
205 | if (is_ctrl && dir == RX && hw_read(ci, OP_ENDPTSETUPSTAT, BIT(num))) | 205 | if (is_ctrl && dir == RX && hw_read(ci, OP_ENDPTSETUPSTAT, BIT(num))) |
206 | return -EAGAIN; | 206 | return -EAGAIN; |
207 | 207 | ||
208 | hw_write(ci, OP_ENDPTPRIME, BIT(n), BIT(n)); | 208 | hw_write(ci, OP_ENDPTPRIME, ~0, BIT(n)); |
209 | 209 | ||
210 | while (hw_read(ci, OP_ENDPTPRIME, BIT(n))) | 210 | while (hw_read(ci, OP_ENDPTPRIME, BIT(n))) |
211 | cpu_relax(); | 211 | cpu_relax(); |
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 8d72f0c65937..062967c90b2a 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c | |||
@@ -717,6 +717,10 @@ int usb_get_configuration(struct usb_device *dev) | |||
717 | result = -ENOMEM; | 717 | result = -ENOMEM; |
718 | goto err; | 718 | goto err; |
719 | } | 719 | } |
720 | |||
721 | if (dev->quirks & USB_QUIRK_DELAY_INIT) | ||
722 | msleep(100); | ||
723 | |||
720 | result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, | 724 | result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno, |
721 | bigbuffer, length); | 725 | bigbuffer, length); |
722 | if (result < 0) { | 726 | if (result < 0) { |
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 8f37063c0a49..739ee8e8bdfd 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -47,6 +47,10 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
47 | /* Microsoft LifeCam-VX700 v2.0 */ | 47 | /* Microsoft LifeCam-VX700 v2.0 */ |
48 | { USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME }, | 48 | { USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME }, |
49 | 49 | ||
50 | /* Logitech HD Pro Webcams C920 and C930e */ | ||
51 | { USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT }, | ||
52 | { USB_DEVICE(0x046d, 0x0843), .driver_info = USB_QUIRK_DELAY_INIT }, | ||
53 | |||
50 | /* Logitech Quickcam Fusion */ | 54 | /* Logitech Quickcam Fusion */ |
51 | { USB_DEVICE(0x046d, 0x08c1), .driver_info = USB_QUIRK_RESET_RESUME }, | 55 | { USB_DEVICE(0x046d, 0x08c1), .driver_info = USB_QUIRK_RESET_RESUME }, |
52 | 56 | ||
diff --git a/drivers/usb/gadget/bcm63xx_udc.c b/drivers/usb/gadget/bcm63xx_udc.c index 888fbb43b338..e969eb809a85 100644 --- a/drivers/usb/gadget/bcm63xx_udc.c +++ b/drivers/usb/gadget/bcm63xx_udc.c | |||
@@ -360,24 +360,30 @@ static inline void usb_dma_writel(struct bcm63xx_udc *udc, u32 val, u32 off) | |||
360 | bcm_writel(val, udc->iudma_regs + off); | 360 | bcm_writel(val, udc->iudma_regs + off); |
361 | } | 361 | } |
362 | 362 | ||
363 | static inline u32 usb_dmac_readl(struct bcm63xx_udc *udc, u32 off) | 363 | static inline u32 usb_dmac_readl(struct bcm63xx_udc *udc, u32 off, int chan) |
364 | { | 364 | { |
365 | return bcm_readl(udc->iudma_regs + IUDMA_DMAC_OFFSET + off); | 365 | return bcm_readl(udc->iudma_regs + IUDMA_DMAC_OFFSET + off + |
366 | (ENETDMA_CHAN_WIDTH * chan)); | ||
366 | } | 367 | } |
367 | 368 | ||
368 | static inline void usb_dmac_writel(struct bcm63xx_udc *udc, u32 val, u32 off) | 369 | static inline void usb_dmac_writel(struct bcm63xx_udc *udc, u32 val, u32 off, |
370 | int chan) | ||
369 | { | 371 | { |
370 | bcm_writel(val, udc->iudma_regs + IUDMA_DMAC_OFFSET + off); | 372 | bcm_writel(val, udc->iudma_regs + IUDMA_DMAC_OFFSET + off + |
373 | (ENETDMA_CHAN_WIDTH * chan)); | ||
371 | } | 374 | } |
372 | 375 | ||
373 | static inline u32 usb_dmas_readl(struct bcm63xx_udc *udc, u32 off) | 376 | static inline u32 usb_dmas_readl(struct bcm63xx_udc *udc, u32 off, int chan) |
374 | { | 377 | { |
375 | return bcm_readl(udc->iudma_regs + IUDMA_DMAS_OFFSET + off); | 378 | return bcm_readl(udc->iudma_regs + IUDMA_DMAS_OFFSET + off + |
379 | (ENETDMA_CHAN_WIDTH * chan)); | ||
376 | } | 380 | } |
377 | 381 | ||
378 | static inline void usb_dmas_writel(struct bcm63xx_udc *udc, u32 val, u32 off) | 382 | static inline void usb_dmas_writel(struct bcm63xx_udc *udc, u32 val, u32 off, |
383 | int chan) | ||
379 | { | 384 | { |
380 | bcm_writel(val, udc->iudma_regs + IUDMA_DMAS_OFFSET + off); | 385 | bcm_writel(val, udc->iudma_regs + IUDMA_DMAS_OFFSET + off + |
386 | (ENETDMA_CHAN_WIDTH * chan)); | ||
381 | } | 387 | } |
382 | 388 | ||
383 | static inline void set_clocks(struct bcm63xx_udc *udc, bool is_enabled) | 389 | static inline void set_clocks(struct bcm63xx_udc *udc, bool is_enabled) |
@@ -638,7 +644,7 @@ static void iudma_write(struct bcm63xx_udc *udc, struct iudma_ch *iudma, | |||
638 | } while (!last_bd); | 644 | } while (!last_bd); |
639 | 645 | ||
640 | usb_dmac_writel(udc, ENETDMAC_CHANCFG_EN_MASK, | 646 | usb_dmac_writel(udc, ENETDMAC_CHANCFG_EN_MASK, |
641 | ENETDMAC_CHANCFG_REG(iudma->ch_idx)); | 647 | ENETDMAC_CHANCFG_REG, iudma->ch_idx); |
642 | } | 648 | } |
643 | 649 | ||
644 | /** | 650 | /** |
@@ -694,9 +700,9 @@ static void iudma_reset_channel(struct bcm63xx_udc *udc, struct iudma_ch *iudma) | |||
694 | bcm63xx_fifo_reset_ep(udc, max(0, iudma->ep_num)); | 700 | bcm63xx_fifo_reset_ep(udc, max(0, iudma->ep_num)); |
695 | 701 | ||
696 | /* stop DMA, then wait for the hardware to wrap up */ | 702 | /* stop DMA, then wait for the hardware to wrap up */ |
697 | usb_dmac_writel(udc, 0, ENETDMAC_CHANCFG_REG(ch_idx)); | 703 | usb_dmac_writel(udc, 0, ENETDMAC_CHANCFG_REG, ch_idx); |
698 | 704 | ||
699 | while (usb_dmac_readl(udc, ENETDMAC_CHANCFG_REG(ch_idx)) & | 705 | while (usb_dmac_readl(udc, ENETDMAC_CHANCFG_REG, ch_idx) & |
700 | ENETDMAC_CHANCFG_EN_MASK) { | 706 | ENETDMAC_CHANCFG_EN_MASK) { |
701 | udelay(1); | 707 | udelay(1); |
702 | 708 | ||
@@ -713,10 +719,10 @@ static void iudma_reset_channel(struct bcm63xx_udc *udc, struct iudma_ch *iudma) | |||
713 | dev_warn(udc->dev, "forcibly halting IUDMA channel %d\n", | 719 | dev_warn(udc->dev, "forcibly halting IUDMA channel %d\n", |
714 | ch_idx); | 720 | ch_idx); |
715 | usb_dmac_writel(udc, ENETDMAC_CHANCFG_BUFHALT_MASK, | 721 | usb_dmac_writel(udc, ENETDMAC_CHANCFG_BUFHALT_MASK, |
716 | ENETDMAC_CHANCFG_REG(ch_idx)); | 722 | ENETDMAC_CHANCFG_REG, ch_idx); |
717 | } | 723 | } |
718 | } | 724 | } |
719 | usb_dmac_writel(udc, ~0, ENETDMAC_IR_REG(ch_idx)); | 725 | usb_dmac_writel(udc, ~0, ENETDMAC_IR_REG, ch_idx); |
720 | 726 | ||
721 | /* don't leave "live" HW-owned entries for the next guy to step on */ | 727 | /* don't leave "live" HW-owned entries for the next guy to step on */ |
722 | for (d = iudma->bd_ring; d <= iudma->end_bd; d++) | 728 | for (d = iudma->bd_ring; d <= iudma->end_bd; d++) |
@@ -728,11 +734,11 @@ static void iudma_reset_channel(struct bcm63xx_udc *udc, struct iudma_ch *iudma) | |||
728 | 734 | ||
729 | /* set up IRQs, UBUS burst size, and BD base for this channel */ | 735 | /* set up IRQs, UBUS burst size, and BD base for this channel */ |
730 | usb_dmac_writel(udc, ENETDMAC_IR_BUFDONE_MASK, | 736 | usb_dmac_writel(udc, ENETDMAC_IR_BUFDONE_MASK, |
731 | ENETDMAC_IRMASK_REG(ch_idx)); | 737 | ENETDMAC_IRMASK_REG, ch_idx); |
732 | usb_dmac_writel(udc, 8, ENETDMAC_MAXBURST_REG(ch_idx)); | 738 | usb_dmac_writel(udc, 8, ENETDMAC_MAXBURST_REG, ch_idx); |
733 | 739 | ||
734 | usb_dmas_writel(udc, iudma->bd_ring_dma, ENETDMAS_RSTART_REG(ch_idx)); | 740 | usb_dmas_writel(udc, iudma->bd_ring_dma, ENETDMAS_RSTART_REG, ch_idx); |
735 | usb_dmas_writel(udc, 0, ENETDMAS_SRAM2_REG(ch_idx)); | 741 | usb_dmas_writel(udc, 0, ENETDMAS_SRAM2_REG, ch_idx); |
736 | } | 742 | } |
737 | 743 | ||
738 | /** | 744 | /** |
@@ -2035,7 +2041,7 @@ static irqreturn_t bcm63xx_udc_data_isr(int irq, void *dev_id) | |||
2035 | spin_lock(&udc->lock); | 2041 | spin_lock(&udc->lock); |
2036 | 2042 | ||
2037 | usb_dmac_writel(udc, ENETDMAC_IR_BUFDONE_MASK, | 2043 | usb_dmac_writel(udc, ENETDMAC_IR_BUFDONE_MASK, |
2038 | ENETDMAC_IR_REG(iudma->ch_idx)); | 2044 | ENETDMAC_IR_REG, iudma->ch_idx); |
2039 | bep = iudma->bep; | 2045 | bep = iudma->bep; |
2040 | rc = iudma_read(udc, iudma); | 2046 | rc = iudma_read(udc, iudma); |
2041 | 2047 | ||
@@ -2175,18 +2181,18 @@ static int bcm63xx_iudma_dbg_show(struct seq_file *s, void *p) | |||
2175 | seq_printf(s, " [ep%d]:\n", | 2181 | seq_printf(s, " [ep%d]:\n", |
2176 | max_t(int, iudma_defaults[ch_idx].ep_num, 0)); | 2182 | max_t(int, iudma_defaults[ch_idx].ep_num, 0)); |
2177 | seq_printf(s, " cfg: %08x; irqstat: %08x; irqmask: %08x; maxburst: %08x\n", | 2183 | seq_printf(s, " cfg: %08x; irqstat: %08x; irqmask: %08x; maxburst: %08x\n", |
2178 | usb_dmac_readl(udc, ENETDMAC_CHANCFG_REG(ch_idx)), | 2184 | usb_dmac_readl(udc, ENETDMAC_CHANCFG_REG, ch_idx), |
2179 | usb_dmac_readl(udc, ENETDMAC_IR_REG(ch_idx)), | 2185 | usb_dmac_readl(udc, ENETDMAC_IR_REG, ch_idx), |
2180 | usb_dmac_readl(udc, ENETDMAC_IRMASK_REG(ch_idx)), | 2186 | usb_dmac_readl(udc, ENETDMAC_IRMASK_REG, ch_idx), |
2181 | usb_dmac_readl(udc, ENETDMAC_MAXBURST_REG(ch_idx))); | 2187 | usb_dmac_readl(udc, ENETDMAC_MAXBURST_REG, ch_idx)); |
2182 | 2188 | ||
2183 | sram2 = usb_dmas_readl(udc, ENETDMAS_SRAM2_REG(ch_idx)); | 2189 | sram2 = usb_dmas_readl(udc, ENETDMAS_SRAM2_REG, ch_idx); |
2184 | sram3 = usb_dmas_readl(udc, ENETDMAS_SRAM3_REG(ch_idx)); | 2190 | sram3 = usb_dmas_readl(udc, ENETDMAS_SRAM3_REG, ch_idx); |
2185 | seq_printf(s, " base: %08x; index: %04x_%04x; desc: %04x_%04x %08x\n", | 2191 | seq_printf(s, " base: %08x; index: %04x_%04x; desc: %04x_%04x %08x\n", |
2186 | usb_dmas_readl(udc, ENETDMAS_RSTART_REG(ch_idx)), | 2192 | usb_dmas_readl(udc, ENETDMAS_RSTART_REG, ch_idx), |
2187 | sram2 >> 16, sram2 & 0xffff, | 2193 | sram2 >> 16, sram2 & 0xffff, |
2188 | sram3 >> 16, sram3 & 0xffff, | 2194 | sram3 >> 16, sram3 & 0xffff, |
2189 | usb_dmas_readl(udc, ENETDMAS_SRAM4_REG(ch_idx))); | 2195 | usb_dmas_readl(udc, ENETDMAS_SRAM4_REG, ch_idx)); |
2190 | seq_printf(s, " desc: %d/%d used", iudma->n_bds_used, | 2196 | seq_printf(s, " desc: %d/%d used", iudma->n_bds_used, |
2191 | iudma->n_bds); | 2197 | iudma->n_bds); |
2192 | 2198 | ||
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 306a2b52125c..2b4334394076 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
@@ -585,7 +585,6 @@ static ssize_t ffs_epfile_io(struct file *file, | |||
585 | char __user *buf, size_t len, int read) | 585 | char __user *buf, size_t len, int read) |
586 | { | 586 | { |
587 | struct ffs_epfile *epfile = file->private_data; | 587 | struct ffs_epfile *epfile = file->private_data; |
588 | struct usb_gadget *gadget = epfile->ffs->gadget; | ||
589 | struct ffs_ep *ep; | 588 | struct ffs_ep *ep; |
590 | char *data = NULL; | 589 | char *data = NULL; |
591 | ssize_t ret, data_len; | 590 | ssize_t ret, data_len; |
@@ -622,6 +621,12 @@ static ssize_t ffs_epfile_io(struct file *file, | |||
622 | /* Allocate & copy */ | 621 | /* Allocate & copy */ |
623 | if (!halt) { | 622 | if (!halt) { |
624 | /* | 623 | /* |
624 | * if we _do_ wait above, the epfile->ffs->gadget might be NULL | ||
625 | * before the waiting completes, so do not assign to 'gadget' earlier | ||
626 | */ | ||
627 | struct usb_gadget *gadget = epfile->ffs->gadget; | ||
628 | |||
629 | /* | ||
625 | * Controller may require buffer size to be aligned to | 630 | * Controller may require buffer size to be aligned to |
626 | * maxpacketsize of an out endpoint. | 631 | * maxpacketsize of an out endpoint. |
627 | */ | 632 | */ |
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c index bf7a56b6d48a..69b76efd11e9 100644 --- a/drivers/usb/gadget/printer.c +++ b/drivers/usb/gadget/printer.c | |||
@@ -1157,7 +1157,7 @@ static int __init printer_bind_config(struct usb_configuration *c) | |||
1157 | 1157 | ||
1158 | usb_gadget_set_selfpowered(gadget); | 1158 | usb_gadget_set_selfpowered(gadget); |
1159 | 1159 | ||
1160 | if (gadget->is_otg) { | 1160 | if (gadget_is_otg(gadget)) { |
1161 | otg_descriptor.bmAttributes |= USB_OTG_HNP; | 1161 | otg_descriptor.bmAttributes |= USB_OTG_HNP; |
1162 | printer_cfg_driver.descriptors = otg_desc; | 1162 | printer_cfg_driver.descriptors = otg_desc; |
1163 | printer_cfg_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP; | 1163 | printer_cfg_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP; |
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c index f04b2c3154de..dd9678f85c58 100644 --- a/drivers/usb/gadget/s3c2410_udc.c +++ b/drivers/usb/gadget/s3c2410_udc.c | |||
@@ -1629,7 +1629,7 @@ static void s3c2410_udc_reinit(struct s3c2410_udc *dev) | |||
1629 | ep->ep.desc = NULL; | 1629 | ep->ep.desc = NULL; |
1630 | ep->halted = 0; | 1630 | ep->halted = 0; |
1631 | INIT_LIST_HEAD(&ep->queue); | 1631 | INIT_LIST_HEAD(&ep->queue); |
1632 | usb_ep_set_maxpacket_limit(&ep->ep, &ep->ep.maxpacket); | 1632 | usb_ep_set_maxpacket_limit(&ep->ep, ep->ep.maxpacket); |
1633 | } | 1633 | } |
1634 | } | 1634 | } |
1635 | 1635 | ||
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 471142725ffe..81cda09b47e3 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -685,8 +685,15 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
685 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | 685 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); |
686 | u32 status, masked_status, pcd_status = 0, cmd; | 686 | u32 status, masked_status, pcd_status = 0, cmd; |
687 | int bh; | 687 | int bh; |
688 | unsigned long flags; | ||
688 | 689 | ||
689 | spin_lock (&ehci->lock); | 690 | /* |
691 | * For threadirqs option we use spin_lock_irqsave() variant to prevent | ||
692 | * deadlock with ehci hrtimer callback, because hrtimer callbacks run | ||
693 | * in interrupt context even when threadirqs is specified. We can go | ||
694 | * back to spin_lock() variant when hrtimer callbacks become threaded. | ||
695 | */ | ||
696 | spin_lock_irqsave(&ehci->lock, flags); | ||
690 | 697 | ||
691 | status = ehci_readl(ehci, &ehci->regs->status); | 698 | status = ehci_readl(ehci, &ehci->regs->status); |
692 | 699 | ||
@@ -704,7 +711,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
704 | 711 | ||
705 | /* Shared IRQ? */ | 712 | /* Shared IRQ? */ |
706 | if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) { | 713 | if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) { |
707 | spin_unlock(&ehci->lock); | 714 | spin_unlock_irqrestore(&ehci->lock, flags); |
708 | return IRQ_NONE; | 715 | return IRQ_NONE; |
709 | } | 716 | } |
710 | 717 | ||
@@ -815,7 +822,7 @@ dead: | |||
815 | 822 | ||
816 | if (bh) | 823 | if (bh) |
817 | ehci_work (ehci); | 824 | ehci_work (ehci); |
818 | spin_unlock (&ehci->lock); | 825 | spin_unlock_irqrestore(&ehci->lock, flags); |
819 | if (pcd_status) | 826 | if (pcd_status) |
820 | usb_hcd_poll_rh_status(hcd); | 827 | usb_hcd_poll_rh_status(hcd); |
821 | return IRQ_HANDLED; | 828 | return IRQ_HANDLED; |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 47b858fc50b2..7ae0c4d51741 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -238,6 +238,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) | |||
238 | int port; | 238 | int port; |
239 | int mask; | 239 | int mask; |
240 | int changed; | 240 | int changed; |
241 | bool fs_idle_delay; | ||
241 | 242 | ||
242 | ehci_dbg(ehci, "suspend root hub\n"); | 243 | ehci_dbg(ehci, "suspend root hub\n"); |
243 | 244 | ||
@@ -272,6 +273,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) | |||
272 | ehci->bus_suspended = 0; | 273 | ehci->bus_suspended = 0; |
273 | ehci->owned_ports = 0; | 274 | ehci->owned_ports = 0; |
274 | changed = 0; | 275 | changed = 0; |
276 | fs_idle_delay = false; | ||
275 | port = HCS_N_PORTS(ehci->hcs_params); | 277 | port = HCS_N_PORTS(ehci->hcs_params); |
276 | while (port--) { | 278 | while (port--) { |
277 | u32 __iomem *reg = &ehci->regs->port_status [port]; | 279 | u32 __iomem *reg = &ehci->regs->port_status [port]; |
@@ -300,16 +302,32 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) | |||
300 | } | 302 | } |
301 | 303 | ||
302 | if (t1 != t2) { | 304 | if (t1 != t2) { |
305 | /* | ||
306 | * On some controllers, Wake-On-Disconnect will | ||
307 | * generate false wakeup signals until the bus | ||
308 | * switches over to full-speed idle. For their | ||
309 | * sake, add a delay if we need one. | ||
310 | */ | ||
311 | if ((t2 & PORT_WKDISC_E) && | ||
312 | ehci_port_speed(ehci, t2) == | ||
313 | USB_PORT_STAT_HIGH_SPEED) | ||
314 | fs_idle_delay = true; | ||
303 | ehci_writel(ehci, t2, reg); | 315 | ehci_writel(ehci, t2, reg); |
304 | changed = 1; | 316 | changed = 1; |
305 | } | 317 | } |
306 | } | 318 | } |
319 | spin_unlock_irq(&ehci->lock); | ||
320 | |||
321 | if ((changed && ehci->has_tdi_phy_lpm) || fs_idle_delay) { | ||
322 | /* | ||
323 | * Wait for HCD to enter low-power mode or for the bus | ||
324 | * to switch to full-speed idle. | ||
325 | */ | ||
326 | usleep_range(5000, 5500); | ||
327 | } | ||
307 | 328 | ||
308 | if (changed && ehci->has_tdi_phy_lpm) { | 329 | if (changed && ehci->has_tdi_phy_lpm) { |
309 | spin_unlock_irq(&ehci->lock); | ||
310 | msleep(5); /* 5 ms for HCD to enter low-power mode */ | ||
311 | spin_lock_irq(&ehci->lock); | 330 | spin_lock_irq(&ehci->lock); |
312 | |||
313 | port = HCS_N_PORTS(ehci->hcs_params); | 331 | port = HCS_N_PORTS(ehci->hcs_params); |
314 | while (port--) { | 332 | while (port--) { |
315 | u32 __iomem *hostpc_reg = &ehci->regs->hostpc[port]; | 333 | u32 __iomem *hostpc_reg = &ehci->regs->hostpc[port]; |
@@ -322,8 +340,8 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) | |||
322 | port, (t3 & HOSTPC_PHCD) ? | 340 | port, (t3 & HOSTPC_PHCD) ? |
323 | "succeeded" : "failed"); | 341 | "succeeded" : "failed"); |
324 | } | 342 | } |
343 | spin_unlock_irq(&ehci->lock); | ||
325 | } | 344 | } |
326 | spin_unlock_irq(&ehci->lock); | ||
327 | 345 | ||
328 | /* Apparently some devices need a >= 1-uframe delay here */ | 346 | /* Apparently some devices need a >= 1-uframe delay here */ |
329 | if (ehci->bus_suspended) | 347 | if (ehci->bus_suspended) |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 6fe577d46fa2..924a6ccdb622 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -4733,6 +4733,9 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) | |||
4733 | /* Accept arbitrarily long scatter-gather lists */ | 4733 | /* Accept arbitrarily long scatter-gather lists */ |
4734 | hcd->self.sg_tablesize = ~0; | 4734 | hcd->self.sg_tablesize = ~0; |
4735 | 4735 | ||
4736 | /* support to build packet from discontinuous buffers */ | ||
4737 | hcd->self.no_sg_constraint = 1; | ||
4738 | |||
4736 | /* XHCI controllers don't stop the ep queue on short packets :| */ | 4739 | /* XHCI controllers don't stop the ep queue on short packets :| */ |
4737 | hcd->self.no_stop_on_short = 1; | 4740 | hcd->self.no_stop_on_short = 1; |
4738 | 4741 | ||
@@ -4757,14 +4760,6 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) | |||
4757 | /* xHCI private pointer was set in xhci_pci_probe for the second | 4760 | /* xHCI private pointer was set in xhci_pci_probe for the second |
4758 | * registered roothub. | 4761 | * registered roothub. |
4759 | */ | 4762 | */ |
4760 | xhci = hcd_to_xhci(hcd); | ||
4761 | /* | ||
4762 | * Support arbitrarily aligned sg-list entries on hosts without | ||
4763 | * TD fragment rules (which are currently unsupported). | ||
4764 | */ | ||
4765 | if (xhci->hci_version < 0x100) | ||
4766 | hcd->self.no_sg_constraint = 1; | ||
4767 | |||
4768 | return 0; | 4763 | return 0; |
4769 | } | 4764 | } |
4770 | 4765 | ||
@@ -4793,9 +4788,6 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) | |||
4793 | if (xhci->hci_version > 0x96) | 4788 | if (xhci->hci_version > 0x96) |
4794 | xhci->quirks |= XHCI_SPURIOUS_SUCCESS; | 4789 | xhci->quirks |= XHCI_SPURIOUS_SUCCESS; |
4795 | 4790 | ||
4796 | if (xhci->hci_version < 0x100) | ||
4797 | hcd->self.no_sg_constraint = 1; | ||
4798 | |||
4799 | /* Make sure the HC is halted. */ | 4791 | /* Make sure the HC is halted. */ |
4800 | retval = xhci_halt(xhci); | 4792 | retval = xhci_halt(xhci); |
4801 | if (retval) | 4793 | if (retval) |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index fc192ad9cc6a..239ad0b1ceb6 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -477,8 +477,11 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
477 | musb->port1_status |= | 477 | musb->port1_status |= |
478 | (USB_PORT_STAT_C_SUSPEND << 16) | 478 | (USB_PORT_STAT_C_SUSPEND << 16) |
479 | | MUSB_PORT_STAT_RESUME; | 479 | | MUSB_PORT_STAT_RESUME; |
480 | musb->rh_timer = jiffies | ||
481 | + msecs_to_jiffies(20); | ||
480 | schedule_delayed_work( | 482 | schedule_delayed_work( |
481 | &musb->finish_resume_work, 20); | 483 | &musb->finish_resume_work, |
484 | msecs_to_jiffies(20)); | ||
482 | 485 | ||
483 | musb->xceiv->state = OTG_STATE_A_HOST; | 486 | musb->xceiv->state = OTG_STATE_A_HOST; |
484 | musb->is_active = 1; | 487 | musb->is_active = 1; |
@@ -2157,11 +2160,19 @@ static void musb_restore_context(struct musb *musb) | |||
2157 | void __iomem *musb_base = musb->mregs; | 2160 | void __iomem *musb_base = musb->mregs; |
2158 | void __iomem *ep_target_regs; | 2161 | void __iomem *ep_target_regs; |
2159 | void __iomem *epio; | 2162 | void __iomem *epio; |
2163 | u8 power; | ||
2160 | 2164 | ||
2161 | musb_writew(musb_base, MUSB_FRAME, musb->context.frame); | 2165 | musb_writew(musb_base, MUSB_FRAME, musb->context.frame); |
2162 | musb_writeb(musb_base, MUSB_TESTMODE, musb->context.testmode); | 2166 | musb_writeb(musb_base, MUSB_TESTMODE, musb->context.testmode); |
2163 | musb_write_ulpi_buscontrol(musb->mregs, musb->context.busctl); | 2167 | musb_write_ulpi_buscontrol(musb->mregs, musb->context.busctl); |
2164 | musb_writeb(musb_base, MUSB_POWER, musb->context.power); | 2168 | |
2169 | /* Don't affect SUSPENDM/RESUME bits in POWER reg */ | ||
2170 | power = musb_readb(musb_base, MUSB_POWER); | ||
2171 | power &= MUSB_POWER_SUSPENDM | MUSB_POWER_RESUME; | ||
2172 | musb->context.power &= ~(MUSB_POWER_SUSPENDM | MUSB_POWER_RESUME); | ||
2173 | power |= musb->context.power; | ||
2174 | musb_writeb(musb_base, MUSB_POWER, power); | ||
2175 | |||
2165 | musb_writew(musb_base, MUSB_INTRTXE, musb->intrtxe); | 2176 | musb_writew(musb_base, MUSB_INTRTXE, musb->intrtxe); |
2166 | musb_writew(musb_base, MUSB_INTRRXE, musb->intrrxe); | 2177 | musb_writew(musb_base, MUSB_INTRRXE, musb->intrrxe); |
2167 | musb_writeb(musb_base, MUSB_INTRUSBE, musb->context.intrusbe); | 2178 | musb_writeb(musb_base, MUSB_INTRUSBE, musb->context.intrusbe); |
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index ed455724017b..abb38c3833ef 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
@@ -1183,6 +1183,9 @@ irqreturn_t musb_h_ep0_irq(struct musb *musb) | |||
1183 | csr = MUSB_CSR0_H_STATUSPKT | 1183 | csr = MUSB_CSR0_H_STATUSPKT |
1184 | | MUSB_CSR0_TXPKTRDY; | 1184 | | MUSB_CSR0_TXPKTRDY; |
1185 | 1185 | ||
1186 | /* disable ping token in status phase */ | ||
1187 | csr |= MUSB_CSR0_H_DIS_PING; | ||
1188 | |||
1186 | /* flag status stage */ | 1189 | /* flag status stage */ |
1187 | musb->ep0_stage = MUSB_EP0_STATUS; | 1190 | musb->ep0_stage = MUSB_EP0_STATUS; |
1188 | 1191 | ||
diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c index eb634433ef09..e2d2d8c9891b 100644 --- a/drivers/usb/musb/musb_virthub.c +++ b/drivers/usb/musb/musb_virthub.c | |||
@@ -135,7 +135,8 @@ void musb_port_suspend(struct musb *musb, bool do_suspend) | |||
135 | 135 | ||
136 | /* later, GetPortStatus will stop RESUME signaling */ | 136 | /* later, GetPortStatus will stop RESUME signaling */ |
137 | musb->port1_status |= MUSB_PORT_STAT_RESUME; | 137 | musb->port1_status |= MUSB_PORT_STAT_RESUME; |
138 | schedule_delayed_work(&musb->finish_resume_work, 20); | 138 | schedule_delayed_work(&musb->finish_resume_work, |
139 | msecs_to_jiffies(20)); | ||
139 | } | 140 | } |
140 | } | 141 | } |
141 | 142 | ||
@@ -158,7 +159,6 @@ void musb_port_reset(struct musb *musb, bool do_reset) | |||
158 | */ | 159 | */ |
159 | power = musb_readb(mbase, MUSB_POWER); | 160 | power = musb_readb(mbase, MUSB_POWER); |
160 | if (do_reset) { | 161 | if (do_reset) { |
161 | |||
162 | /* | 162 | /* |
163 | * If RESUME is set, we must make sure it stays minimum 20 ms. | 163 | * If RESUME is set, we must make sure it stays minimum 20 ms. |
164 | * Then we must clear RESUME and wait a bit to let musb start | 164 | * Then we must clear RESUME and wait a bit to let musb start |
@@ -167,11 +167,22 @@ void musb_port_reset(struct musb *musb, bool do_reset) | |||
167 | * detected". | 167 | * detected". |
168 | */ | 168 | */ |
169 | if (power & MUSB_POWER_RESUME) { | 169 | if (power & MUSB_POWER_RESUME) { |
170 | while (time_before(jiffies, musb->rh_timer)) | 170 | long remain = (unsigned long) musb->rh_timer - jiffies; |
171 | msleep(1); | 171 | |
172 | if (musb->rh_timer > 0 && remain > 0) { | ||
173 | /* take into account the minimum delay after resume */ | ||
174 | schedule_delayed_work( | ||
175 | &musb->deassert_reset_work, remain); | ||
176 | return; | ||
177 | } | ||
178 | |||
172 | musb_writeb(mbase, MUSB_POWER, | 179 | musb_writeb(mbase, MUSB_POWER, |
173 | power & ~MUSB_POWER_RESUME); | 180 | power & ~MUSB_POWER_RESUME); |
174 | msleep(1); | 181 | |
182 | /* Give the core 1 ms to clear MUSB_POWER_RESUME */ | ||
183 | schedule_delayed_work(&musb->deassert_reset_work, | ||
184 | msecs_to_jiffies(1)); | ||
185 | return; | ||
175 | } | 186 | } |
176 | 187 | ||
177 | power &= 0xf0; | 188 | power &= 0xf0; |
@@ -180,7 +191,8 @@ void musb_port_reset(struct musb *musb, bool do_reset) | |||
180 | 191 | ||
181 | musb->port1_status |= USB_PORT_STAT_RESET; | 192 | musb->port1_status |= USB_PORT_STAT_RESET; |
182 | musb->port1_status &= ~USB_PORT_STAT_ENABLE; | 193 | musb->port1_status &= ~USB_PORT_STAT_ENABLE; |
183 | schedule_delayed_work(&musb->deassert_reset_work, 50); | 194 | schedule_delayed_work(&musb->deassert_reset_work, |
195 | msecs_to_jiffies(50)); | ||
184 | } else { | 196 | } else { |
185 | dev_dbg(musb->controller, "root port reset stopped\n"); | 197 | dev_dbg(musb->controller, "root port reset stopped\n"); |
186 | musb_writeb(mbase, MUSB_POWER, | 198 | musb_writeb(mbase, MUSB_POWER, |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 2a408cdaf7b2..8aa59a2c5eb2 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -659,7 +659,6 @@ static int omap2430_runtime_suspend(struct device *dev) | |||
659 | OTG_INTERFSEL); | 659 | OTG_INTERFSEL); |
660 | 660 | ||
661 | omap2430_low_level_exit(musb); | 661 | omap2430_low_level_exit(musb); |
662 | phy_power_off(musb->phy); | ||
663 | } | 662 | } |
664 | 663 | ||
665 | return 0; | 664 | return 0; |
@@ -674,7 +673,6 @@ static int omap2430_runtime_resume(struct device *dev) | |||
674 | omap2430_low_level_init(musb); | 673 | omap2430_low_level_init(musb); |
675 | musb_writel(musb->mregs, OTG_INTERFSEL, | 674 | musb_writel(musb->mregs, OTG_INTERFSEL, |
676 | musb->context.otg_interfsel); | 675 | musb->context.otg_interfsel); |
677 | phy_power_on(musb->phy); | ||
678 | } | 676 | } |
679 | 677 | ||
680 | return 0; | 678 | return 0; |
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index 8546c8dccd51..d204f745ed05 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c | |||
@@ -159,32 +159,6 @@ put_3p3: | |||
159 | return rc; | 159 | return rc; |
160 | } | 160 | } |
161 | 161 | ||
162 | #ifdef CONFIG_PM_SLEEP | ||
163 | #define USB_PHY_SUSP_DIG_VOL 500000 | ||
164 | static int msm_hsusb_config_vddcx(int high) | ||
165 | { | ||
166 | int max_vol = USB_PHY_VDD_DIG_VOL_MAX; | ||
167 | int min_vol; | ||
168 | int ret; | ||
169 | |||
170 | if (high) | ||
171 | min_vol = USB_PHY_VDD_DIG_VOL_MIN; | ||
172 | else | ||
173 | min_vol = USB_PHY_SUSP_DIG_VOL; | ||
174 | |||
175 | ret = regulator_set_voltage(hsusb_vddcx, min_vol, max_vol); | ||
176 | if (ret) { | ||
177 | pr_err("%s: unable to set the voltage for regulator " | ||
178 | "HSUSB_VDDCX\n", __func__); | ||
179 | return ret; | ||
180 | } | ||
181 | |||
182 | pr_debug("%s: min_vol:%d max_vol:%d\n", __func__, min_vol, max_vol); | ||
183 | |||
184 | return ret; | ||
185 | } | ||
186 | #endif | ||
187 | |||
188 | static int msm_hsusb_ldo_set_mode(int on) | 162 | static int msm_hsusb_ldo_set_mode(int on) |
189 | { | 163 | { |
190 | int ret = 0; | 164 | int ret = 0; |
@@ -440,7 +414,32 @@ static int msm_otg_reset(struct usb_phy *phy) | |||
440 | #define PHY_SUSPEND_TIMEOUT_USEC (500 * 1000) | 414 | #define PHY_SUSPEND_TIMEOUT_USEC (500 * 1000) |
441 | #define PHY_RESUME_TIMEOUT_USEC (100 * 1000) | 415 | #define PHY_RESUME_TIMEOUT_USEC (100 * 1000) |
442 | 416 | ||
443 | #ifdef CONFIG_PM_SLEEP | 417 | #ifdef CONFIG_PM |
418 | |||
419 | #define USB_PHY_SUSP_DIG_VOL 500000 | ||
420 | static int msm_hsusb_config_vddcx(int high) | ||
421 | { | ||
422 | int max_vol = USB_PHY_VDD_DIG_VOL_MAX; | ||
423 | int min_vol; | ||
424 | int ret; | ||
425 | |||
426 | if (high) | ||
427 | min_vol = USB_PHY_VDD_DIG_VOL_MIN; | ||
428 | else | ||
429 | min_vol = USB_PHY_SUSP_DIG_VOL; | ||
430 | |||
431 | ret = regulator_set_voltage(hsusb_vddcx, min_vol, max_vol); | ||
432 | if (ret) { | ||
433 | pr_err("%s: unable to set the voltage for regulator " | ||
434 | "HSUSB_VDDCX\n", __func__); | ||
435 | return ret; | ||
436 | } | ||
437 | |||
438 | pr_debug("%s: min_vol:%d max_vol:%d\n", __func__, min_vol, max_vol); | ||
439 | |||
440 | return ret; | ||
441 | } | ||
442 | |||
444 | static int msm_otg_suspend(struct msm_otg *motg) | 443 | static int msm_otg_suspend(struct msm_otg *motg) |
445 | { | 444 | { |
446 | struct usb_phy *phy = &motg->phy; | 445 | struct usb_phy *phy = &motg->phy; |
@@ -1733,22 +1732,18 @@ static int msm_otg_pm_resume(struct device *dev) | |||
1733 | } | 1732 | } |
1734 | #endif | 1733 | #endif |
1735 | 1734 | ||
1736 | #ifdef CONFIG_PM | ||
1737 | static const struct dev_pm_ops msm_otg_dev_pm_ops = { | 1735 | static const struct dev_pm_ops msm_otg_dev_pm_ops = { |
1738 | SET_SYSTEM_SLEEP_PM_OPS(msm_otg_pm_suspend, msm_otg_pm_resume) | 1736 | SET_SYSTEM_SLEEP_PM_OPS(msm_otg_pm_suspend, msm_otg_pm_resume) |
1739 | SET_RUNTIME_PM_OPS(msm_otg_runtime_suspend, msm_otg_runtime_resume, | 1737 | SET_RUNTIME_PM_OPS(msm_otg_runtime_suspend, msm_otg_runtime_resume, |
1740 | msm_otg_runtime_idle) | 1738 | msm_otg_runtime_idle) |
1741 | }; | 1739 | }; |
1742 | #endif | ||
1743 | 1740 | ||
1744 | static struct platform_driver msm_otg_driver = { | 1741 | static struct platform_driver msm_otg_driver = { |
1745 | .remove = msm_otg_remove, | 1742 | .remove = msm_otg_remove, |
1746 | .driver = { | 1743 | .driver = { |
1747 | .name = DRIVER_NAME, | 1744 | .name = DRIVER_NAME, |
1748 | .owner = THIS_MODULE, | 1745 | .owner = THIS_MODULE, |
1749 | #ifdef CONFIG_PM | ||
1750 | .pm = &msm_otg_dev_pm_ops, | 1746 | .pm = &msm_otg_dev_pm_ops, |
1751 | #endif | ||
1752 | }, | 1747 | }, |
1753 | }; | 1748 | }; |
1754 | 1749 | ||
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index ee1f00f03c43..44ab12986805 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -907,6 +907,8 @@ static const struct usb_device_id id_table_combined[] = { | |||
907 | /* Crucible Devices */ | 907 | /* Crucible Devices */ |
908 | { USB_DEVICE(FTDI_VID, FTDI_CT_COMET_PID) }, | 908 | { USB_DEVICE(FTDI_VID, FTDI_CT_COMET_PID) }, |
909 | { USB_DEVICE(FTDI_VID, FTDI_Z3X_PID) }, | 909 | { USB_DEVICE(FTDI_VID, FTDI_Z3X_PID) }, |
910 | /* Cressi Devices */ | ||
911 | { USB_DEVICE(FTDI_VID, FTDI_CRESSI_PID) }, | ||
910 | { } /* Terminating entry */ | 912 | { } /* Terminating entry */ |
911 | }; | 913 | }; |
912 | 914 | ||
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 1e2d369df86e..e599fbfcde5f 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -1320,3 +1320,9 @@ | |||
1320 | * Manufacturer: Smart GSM Team | 1320 | * Manufacturer: Smart GSM Team |
1321 | */ | 1321 | */ |
1322 | #define FTDI_Z3X_PID 0x0011 | 1322 | #define FTDI_Z3X_PID 0x0011 |
1323 | |||
1324 | /* | ||
1325 | * Product: Cressi PC Interface | ||
1326 | * Manufacturer: Cressi | ||
1327 | */ | ||
1328 | #define FTDI_CRESSI_PID 0x87d0 | ||
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 216d20affba8..68fc9fe65936 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -1526,7 +1526,8 @@ static const struct usb_device_id option_ids[] = { | |||
1526 | /* Cinterion */ | 1526 | /* Cinterion */ |
1527 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) }, | 1527 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) }, |
1528 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, | 1528 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, |
1529 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) }, | 1529 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8), |
1530 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
1530 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX) }, | 1531 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX) }, |
1531 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLXX), | 1532 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLXX), |
1532 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | 1533 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index 4fb7a8f83c8a..54af4e933695 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c | |||
@@ -186,12 +186,12 @@ static bool is_invalid_reserved_pfn(unsigned long pfn) | |||
186 | if (pfn_valid(pfn)) { | 186 | if (pfn_valid(pfn)) { |
187 | bool reserved; | 187 | bool reserved; |
188 | struct page *tail = pfn_to_page(pfn); | 188 | struct page *tail = pfn_to_page(pfn); |
189 | struct page *head = compound_trans_head(tail); | 189 | struct page *head = compound_head(tail); |
190 | reserved = !!(PageReserved(head)); | 190 | reserved = !!(PageReserved(head)); |
191 | if (head != tail) { | 191 | if (head != tail) { |
192 | /* | 192 | /* |
193 | * "head" is not a dangling pointer | 193 | * "head" is not a dangling pointer |
194 | * (compound_trans_head takes care of that) | 194 | * (compound_head takes care of that) |
195 | * but the hugepage may have been split | 195 | * but the hugepage may have been split |
196 | * from under us (and we may not hold a | 196 | * from under us (and we may not hold a |
197 | * reference count on the head page so it can | 197 | * reference count on the head page so it can |
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 9a68409580d5..a0fa5de210cf 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -70,7 +70,12 @@ enum { | |||
70 | }; | 70 | }; |
71 | 71 | ||
72 | struct vhost_net_ubuf_ref { | 72 | struct vhost_net_ubuf_ref { |
73 | struct kref kref; | 73 | /* refcount follows semantics similar to kref: |
74 | * 0: object is released | ||
75 | * 1: no outstanding ubufs | ||
76 | * >1: outstanding ubufs | ||
77 | */ | ||
78 | atomic_t refcount; | ||
74 | wait_queue_head_t wait; | 79 | wait_queue_head_t wait; |
75 | struct vhost_virtqueue *vq; | 80 | struct vhost_virtqueue *vq; |
76 | }; | 81 | }; |
@@ -116,14 +121,6 @@ static void vhost_net_enable_zcopy(int vq) | |||
116 | vhost_net_zcopy_mask |= 0x1 << vq; | 121 | vhost_net_zcopy_mask |= 0x1 << vq; |
117 | } | 122 | } |
118 | 123 | ||
119 | static void vhost_net_zerocopy_done_signal(struct kref *kref) | ||
120 | { | ||
121 | struct vhost_net_ubuf_ref *ubufs; | ||
122 | |||
123 | ubufs = container_of(kref, struct vhost_net_ubuf_ref, kref); | ||
124 | wake_up(&ubufs->wait); | ||
125 | } | ||
126 | |||
127 | static struct vhost_net_ubuf_ref * | 124 | static struct vhost_net_ubuf_ref * |
128 | vhost_net_ubuf_alloc(struct vhost_virtqueue *vq, bool zcopy) | 125 | vhost_net_ubuf_alloc(struct vhost_virtqueue *vq, bool zcopy) |
129 | { | 126 | { |
@@ -134,21 +131,24 @@ vhost_net_ubuf_alloc(struct vhost_virtqueue *vq, bool zcopy) | |||
134 | ubufs = kmalloc(sizeof(*ubufs), GFP_KERNEL); | 131 | ubufs = kmalloc(sizeof(*ubufs), GFP_KERNEL); |
135 | if (!ubufs) | 132 | if (!ubufs) |
136 | return ERR_PTR(-ENOMEM); | 133 | return ERR_PTR(-ENOMEM); |
137 | kref_init(&ubufs->kref); | 134 | atomic_set(&ubufs->refcount, 1); |
138 | init_waitqueue_head(&ubufs->wait); | 135 | init_waitqueue_head(&ubufs->wait); |
139 | ubufs->vq = vq; | 136 | ubufs->vq = vq; |
140 | return ubufs; | 137 | return ubufs; |
141 | } | 138 | } |
142 | 139 | ||
143 | static void vhost_net_ubuf_put(struct vhost_net_ubuf_ref *ubufs) | 140 | static int vhost_net_ubuf_put(struct vhost_net_ubuf_ref *ubufs) |
144 | { | 141 | { |
145 | kref_put(&ubufs->kref, vhost_net_zerocopy_done_signal); | 142 | int r = atomic_sub_return(1, &ubufs->refcount); |
143 | if (unlikely(!r)) | ||
144 | wake_up(&ubufs->wait); | ||
145 | return r; | ||
146 | } | 146 | } |
147 | 147 | ||
148 | static void vhost_net_ubuf_put_and_wait(struct vhost_net_ubuf_ref *ubufs) | 148 | static void vhost_net_ubuf_put_and_wait(struct vhost_net_ubuf_ref *ubufs) |
149 | { | 149 | { |
150 | kref_put(&ubufs->kref, vhost_net_zerocopy_done_signal); | 150 | vhost_net_ubuf_put(ubufs); |
151 | wait_event(ubufs->wait, !atomic_read(&ubufs->kref.refcount)); | 151 | wait_event(ubufs->wait, !atomic_read(&ubufs->refcount)); |
152 | } | 152 | } |
153 | 153 | ||
154 | static void vhost_net_ubuf_put_wait_and_free(struct vhost_net_ubuf_ref *ubufs) | 154 | static void vhost_net_ubuf_put_wait_and_free(struct vhost_net_ubuf_ref *ubufs) |
@@ -306,23 +306,26 @@ static void vhost_zerocopy_callback(struct ubuf_info *ubuf, bool success) | |||
306 | { | 306 | { |
307 | struct vhost_net_ubuf_ref *ubufs = ubuf->ctx; | 307 | struct vhost_net_ubuf_ref *ubufs = ubuf->ctx; |
308 | struct vhost_virtqueue *vq = ubufs->vq; | 308 | struct vhost_virtqueue *vq = ubufs->vq; |
309 | int cnt = atomic_read(&ubufs->kref.refcount); | 309 | int cnt; |
310 | |||
311 | rcu_read_lock_bh(); | ||
310 | 312 | ||
311 | /* set len to mark this desc buffers done DMA */ | 313 | /* set len to mark this desc buffers done DMA */ |
312 | vq->heads[ubuf->desc].len = success ? | 314 | vq->heads[ubuf->desc].len = success ? |
313 | VHOST_DMA_DONE_LEN : VHOST_DMA_FAILED_LEN; | 315 | VHOST_DMA_DONE_LEN : VHOST_DMA_FAILED_LEN; |
314 | vhost_net_ubuf_put(ubufs); | 316 | cnt = vhost_net_ubuf_put(ubufs); |
315 | 317 | ||
316 | /* | 318 | /* |
317 | * Trigger polling thread if guest stopped submitting new buffers: | 319 | * Trigger polling thread if guest stopped submitting new buffers: |
318 | * in this case, the refcount after decrement will eventually reach 1 | 320 | * in this case, the refcount after decrement will eventually reach 1. |
319 | * so here it is 2. | ||
320 | * We also trigger polling periodically after each 16 packets | 321 | * We also trigger polling periodically after each 16 packets |
321 | * (the value 16 here is more or less arbitrary, it's tuned to trigger | 322 | * (the value 16 here is more or less arbitrary, it's tuned to trigger |
322 | * less than 10% of times). | 323 | * less than 10% of times). |
323 | */ | 324 | */ |
324 | if (cnt <= 2 || !(cnt % 16)) | 325 | if (cnt <= 1 || !(cnt % 16)) |
325 | vhost_poll_queue(&vq->poll); | 326 | vhost_poll_queue(&vq->poll); |
327 | |||
328 | rcu_read_unlock_bh(); | ||
326 | } | 329 | } |
327 | 330 | ||
328 | /* Expects to be always run from workqueue - which acts as | 331 | /* Expects to be always run from workqueue - which acts as |
@@ -420,7 +423,7 @@ static void handle_tx(struct vhost_net *net) | |||
420 | msg.msg_control = ubuf; | 423 | msg.msg_control = ubuf; |
421 | msg.msg_controllen = sizeof(ubuf); | 424 | msg.msg_controllen = sizeof(ubuf); |
422 | ubufs = nvq->ubufs; | 425 | ubufs = nvq->ubufs; |
423 | kref_get(&ubufs->kref); | 426 | atomic_inc(&ubufs->refcount); |
424 | nvq->upend_idx = (nvq->upend_idx + 1) % UIO_MAXIOV; | 427 | nvq->upend_idx = (nvq->upend_idx + 1) % UIO_MAXIOV; |
425 | } else { | 428 | } else { |
426 | msg.msg_control = NULL; | 429 | msg.msg_control = NULL; |
@@ -780,7 +783,7 @@ static void vhost_net_flush(struct vhost_net *n) | |||
780 | vhost_net_ubuf_put_and_wait(n->vqs[VHOST_NET_VQ_TX].ubufs); | 783 | vhost_net_ubuf_put_and_wait(n->vqs[VHOST_NET_VQ_TX].ubufs); |
781 | mutex_lock(&n->vqs[VHOST_NET_VQ_TX].vq.mutex); | 784 | mutex_lock(&n->vqs[VHOST_NET_VQ_TX].vq.mutex); |
782 | n->tx_flush = false; | 785 | n->tx_flush = false; |
783 | kref_init(&n->vqs[VHOST_NET_VQ_TX].ubufs->kref); | 786 | atomic_set(&n->vqs[VHOST_NET_VQ_TX].ubufs->refcount, 1); |
784 | mutex_unlock(&n->vqs[VHOST_NET_VQ_TX].vq.mutex); | 787 | mutex_unlock(&n->vqs[VHOST_NET_VQ_TX].vq.mutex); |
785 | } | 788 | } |
786 | } | 789 | } |
@@ -800,6 +803,8 @@ static int vhost_net_release(struct inode *inode, struct file *f) | |||
800 | fput(tx_sock->file); | 803 | fput(tx_sock->file); |
801 | if (rx_sock) | 804 | if (rx_sock) |
802 | fput(rx_sock->file); | 805 | fput(rx_sock->file); |
806 | /* Make sure no callbacks are outstanding */ | ||
807 | synchronize_rcu_bh(); | ||
803 | /* We do an extra flush before freeing memory, | 808 | /* We do an extra flush before freeing memory, |
804 | * since jobs can re-queue themselves. */ | 809 | * since jobs can re-queue themselves. */ |
805 | vhost_net_flush(n); | 810 | vhost_net_flush(n); |
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 0a025b8e2a12..e48d4a672580 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
@@ -1001,6 +1001,12 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) | |||
1001 | break; | 1001 | break; |
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | /* virtio-scsi spec requires byte 0 of the lun to be 1 */ | ||
1005 | if (unlikely(v_req.lun[0] != 1)) { | ||
1006 | vhost_scsi_send_bad_target(vs, vq, head, out); | ||
1007 | continue; | ||
1008 | } | ||
1009 | |||
1004 | /* Extract the tpgt */ | 1010 | /* Extract the tpgt */ |
1005 | target = v_req.lun[1]; | 1011 | target = v_req.lun[1]; |
1006 | tpg = ACCESS_ONCE(vs_tpg[target]); | 1012 | tpg = ACCESS_ONCE(vs_tpg[target]); |
diff --git a/drivers/watchdog/w83697hf_wdt.c b/drivers/watchdog/w83697hf_wdt.c index aaf2995d37f4..68b45fc9ba6a 100644 --- a/drivers/watchdog/w83697hf_wdt.c +++ b/drivers/watchdog/w83697hf_wdt.c | |||
@@ -402,7 +402,7 @@ static int __init wdt_init(void) | |||
402 | 402 | ||
403 | if (!found) { | 403 | if (!found) { |
404 | pr_err("No W83697HF/HG could be found\n"); | 404 | pr_err("No W83697HF/HG could be found\n"); |
405 | ret = -EIO; | 405 | ret = -ENODEV; |
406 | goto out; | 406 | goto out; |
407 | } | 407 | } |
408 | 408 | ||