diff options
Diffstat (limited to 'drivers')
188 files changed, 1806 insertions, 984 deletions
diff --git a/drivers/Makefile b/drivers/Makefile index 67d2334dc41e..527a6da8d539 100644 --- a/drivers/Makefile +++ b/drivers/Makefile | |||
@@ -50,7 +50,10 @@ obj-$(CONFIG_RESET_CONTROLLER) += reset/ | |||
50 | obj-y += tty/ | 50 | obj-y += tty/ |
51 | obj-y += char/ | 51 | obj-y += char/ |
52 | 52 | ||
53 | # gpu/ comes after char for AGP vs DRM startup | 53 | # iommu/ comes before gpu as gpu are using iommu controllers |
54 | obj-$(CONFIG_IOMMU_SUPPORT) += iommu/ | ||
55 | |||
56 | # gpu/ comes after char for AGP vs DRM startup and after iommu | ||
54 | obj-y += gpu/ | 57 | obj-y += gpu/ |
55 | 58 | ||
56 | obj-$(CONFIG_CONNECTOR) += connector/ | 59 | obj-$(CONFIG_CONNECTOR) += connector/ |
@@ -141,7 +144,6 @@ obj-y += clk/ | |||
141 | 144 | ||
142 | obj-$(CONFIG_MAILBOX) += mailbox/ | 145 | obj-$(CONFIG_MAILBOX) += mailbox/ |
143 | obj-$(CONFIG_HWSPINLOCK) += hwspinlock/ | 146 | obj-$(CONFIG_HWSPINLOCK) += hwspinlock/ |
144 | obj-$(CONFIG_IOMMU_SUPPORT) += iommu/ | ||
145 | obj-$(CONFIG_REMOTEPROC) += remoteproc/ | 147 | obj-$(CONFIG_REMOTEPROC) += remoteproc/ |
146 | obj-$(CONFIG_RPMSG) += rpmsg/ | 148 | obj-$(CONFIG_RPMSG) += rpmsg/ |
147 | 149 | ||
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index 1fdf5e07a1c7..1020b1b53a17 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c | |||
@@ -170,7 +170,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr) | |||
170 | acpi_status status; | 170 | acpi_status status; |
171 | int ret; | 171 | int ret; |
172 | 172 | ||
173 | if (pr->apic_id == -1) | 173 | if (pr->phys_id == -1) |
174 | return -ENODEV; | 174 | return -ENODEV; |
175 | 175 | ||
176 | status = acpi_evaluate_integer(pr->handle, "_STA", NULL, &sta); | 176 | status = acpi_evaluate_integer(pr->handle, "_STA", NULL, &sta); |
@@ -180,13 +180,13 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr) | |||
180 | cpu_maps_update_begin(); | 180 | cpu_maps_update_begin(); |
181 | cpu_hotplug_begin(); | 181 | cpu_hotplug_begin(); |
182 | 182 | ||
183 | ret = acpi_map_lsapic(pr->handle, pr->apic_id, &pr->id); | 183 | ret = acpi_map_cpu(pr->handle, pr->phys_id, &pr->id); |
184 | if (ret) | 184 | if (ret) |
185 | goto out; | 185 | goto out; |
186 | 186 | ||
187 | ret = arch_register_cpu(pr->id); | 187 | ret = arch_register_cpu(pr->id); |
188 | if (ret) { | 188 | if (ret) { |
189 | acpi_unmap_lsapic(pr->id); | 189 | acpi_unmap_cpu(pr->id); |
190 | goto out; | 190 | goto out; |
191 | } | 191 | } |
192 | 192 | ||
@@ -215,7 +215,7 @@ static int acpi_processor_get_info(struct acpi_device *device) | |||
215 | union acpi_object object = { 0 }; | 215 | union acpi_object object = { 0 }; |
216 | struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; | 216 | struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; |
217 | struct acpi_processor *pr = acpi_driver_data(device); | 217 | struct acpi_processor *pr = acpi_driver_data(device); |
218 | int apic_id, cpu_index, device_declaration = 0; | 218 | int phys_id, cpu_index, device_declaration = 0; |
219 | acpi_status status = AE_OK; | 219 | acpi_status status = AE_OK; |
220 | static int cpu0_initialized; | 220 | static int cpu0_initialized; |
221 | unsigned long long value; | 221 | unsigned long long value; |
@@ -262,15 +262,18 @@ static int acpi_processor_get_info(struct acpi_device *device) | |||
262 | pr->acpi_id = value; | 262 | pr->acpi_id = value; |
263 | } | 263 | } |
264 | 264 | ||
265 | apic_id = acpi_get_apicid(pr->handle, device_declaration, pr->acpi_id); | 265 | phys_id = acpi_get_phys_id(pr->handle, device_declaration, pr->acpi_id); |
266 | if (apic_id < 0) | 266 | if (phys_id < 0) |
267 | acpi_handle_debug(pr->handle, "failed to get CPU APIC ID.\n"); | 267 | acpi_handle_debug(pr->handle, "failed to get CPU physical ID.\n"); |
268 | pr->apic_id = apic_id; | 268 | pr->phys_id = phys_id; |
269 | 269 | ||
270 | cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id); | 270 | cpu_index = acpi_map_cpuid(pr->phys_id, pr->acpi_id); |
271 | if (!cpu0_initialized && !acpi_has_cpu_in_madt()) { | 271 | if (!cpu0_initialized && !acpi_has_cpu_in_madt()) { |
272 | cpu0_initialized = 1; | 272 | cpu0_initialized = 1; |
273 | /* Handle UP system running SMP kernel, with no LAPIC in MADT */ | 273 | /* |
274 | * Handle UP system running SMP kernel, with no CPU | ||
275 | * entry in MADT | ||
276 | */ | ||
274 | if ((cpu_index == -1) && (num_online_cpus() == 1)) | 277 | if ((cpu_index == -1) && (num_online_cpus() == 1)) |
275 | cpu_index = 0; | 278 | cpu_index = 0; |
276 | } | 279 | } |
@@ -458,7 +461,7 @@ static void acpi_processor_remove(struct acpi_device *device) | |||
458 | 461 | ||
459 | /* Remove the CPU. */ | 462 | /* Remove the CPU. */ |
460 | arch_unregister_cpu(pr->id); | 463 | arch_unregister_cpu(pr->id); |
461 | acpi_unmap_lsapic(pr->id); | 464 | acpi_unmap_cpu(pr->id); |
462 | 465 | ||
463 | cpu_hotplug_done(); | 466 | cpu_hotplug_done(); |
464 | cpu_maps_update_done(); | 467 | cpu_maps_update_done(); |
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index c2daa85fc9f7..c0d44d394ca3 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c | |||
@@ -257,7 +257,7 @@ int acpi_bus_init_power(struct acpi_device *device) | |||
257 | 257 | ||
258 | device->power.state = ACPI_STATE_UNKNOWN; | 258 | device->power.state = ACPI_STATE_UNKNOWN; |
259 | if (!acpi_device_is_present(device)) | 259 | if (!acpi_device_is_present(device)) |
260 | return 0; | 260 | return -ENXIO; |
261 | 261 | ||
262 | result = acpi_device_get_power(device, &state); | 262 | result = acpi_device_get_power(device, &state); |
263 | if (result) | 263 | if (result) |
diff --git a/drivers/acpi/int340x_thermal.c b/drivers/acpi/int340x_thermal.c index a27d31d1ba24..9dcf83682e36 100644 --- a/drivers/acpi/int340x_thermal.c +++ b/drivers/acpi/int340x_thermal.c | |||
@@ -14,10 +14,10 @@ | |||
14 | 14 | ||
15 | #include "internal.h" | 15 | #include "internal.h" |
16 | 16 | ||
17 | #define DO_ENUMERATION 0x01 | 17 | #define INT3401_DEVICE 0X01 |
18 | static const struct acpi_device_id int340x_thermal_device_ids[] = { | 18 | static const struct acpi_device_id int340x_thermal_device_ids[] = { |
19 | {"INT3400", DO_ENUMERATION }, | 19 | {"INT3400"}, |
20 | {"INT3401"}, | 20 | {"INT3401", INT3401_DEVICE}, |
21 | {"INT3402"}, | 21 | {"INT3402"}, |
22 | {"INT3403"}, | 22 | {"INT3403"}, |
23 | {"INT3404"}, | 23 | {"INT3404"}, |
@@ -34,7 +34,10 @@ static int int340x_thermal_handler_attach(struct acpi_device *adev, | |||
34 | const struct acpi_device_id *id) | 34 | const struct acpi_device_id *id) |
35 | { | 35 | { |
36 | #if defined(CONFIG_INT340X_THERMAL) || defined(CONFIG_INT340X_THERMAL_MODULE) | 36 | #if defined(CONFIG_INT340X_THERMAL) || defined(CONFIG_INT340X_THERMAL_MODULE) |
37 | if (id->driver_data == DO_ENUMERATION) | 37 | acpi_create_platform_device(adev); |
38 | #elif defined(INTEL_SOC_DTS_THERMAL) || defined(INTEL_SOC_DTS_THERMAL_MODULE) | ||
39 | /* Intel SoC DTS thermal driver needs INT3401 to set IRQ descriptor */ | ||
40 | if (id->driver_data == INT3401_DEVICE) | ||
38 | acpi_create_platform_device(adev); | 41 | acpi_create_platform_device(adev); |
39 | #endif | 42 | #endif |
40 | return 1; | 43 | return 1; |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 342942f90a10..02e48394276c 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -69,7 +69,7 @@ static int map_madt_entry(int type, u32 acpi_id) | |||
69 | unsigned long madt_end, entry; | 69 | unsigned long madt_end, entry; |
70 | static struct acpi_table_madt *madt; | 70 | static struct acpi_table_madt *madt; |
71 | static int read_madt; | 71 | static int read_madt; |
72 | int apic_id = -1; | 72 | int phys_id = -1; /* CPU hardware ID */ |
73 | 73 | ||
74 | if (!read_madt) { | 74 | if (!read_madt) { |
75 | if (ACPI_FAILURE(acpi_get_table(ACPI_SIG_MADT, 0, | 75 | if (ACPI_FAILURE(acpi_get_table(ACPI_SIG_MADT, 0, |
@@ -79,7 +79,7 @@ static int map_madt_entry(int type, u32 acpi_id) | |||
79 | } | 79 | } |
80 | 80 | ||
81 | if (!madt) | 81 | if (!madt) |
82 | return apic_id; | 82 | return phys_id; |
83 | 83 | ||
84 | entry = (unsigned long)madt; | 84 | entry = (unsigned long)madt; |
85 | madt_end = entry + madt->header.length; | 85 | madt_end = entry + madt->header.length; |
@@ -91,18 +91,18 @@ static int map_madt_entry(int type, u32 acpi_id) | |||
91 | struct acpi_subtable_header *header = | 91 | struct acpi_subtable_header *header = |
92 | (struct acpi_subtable_header *)entry; | 92 | (struct acpi_subtable_header *)entry; |
93 | if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) { | 93 | if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) { |
94 | if (!map_lapic_id(header, acpi_id, &apic_id)) | 94 | if (!map_lapic_id(header, acpi_id, &phys_id)) |
95 | break; | 95 | break; |
96 | } else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) { | 96 | } else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) { |
97 | if (!map_x2apic_id(header, type, acpi_id, &apic_id)) | 97 | if (!map_x2apic_id(header, type, acpi_id, &phys_id)) |
98 | break; | 98 | break; |
99 | } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { | 99 | } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { |
100 | if (!map_lsapic_id(header, type, acpi_id, &apic_id)) | 100 | if (!map_lsapic_id(header, type, acpi_id, &phys_id)) |
101 | break; | 101 | break; |
102 | } | 102 | } |
103 | entry += header->length; | 103 | entry += header->length; |
104 | } | 104 | } |
105 | return apic_id; | 105 | return phys_id; |
106 | } | 106 | } |
107 | 107 | ||
108 | static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id) | 108 | static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id) |
@@ -110,7 +110,7 @@ static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id) | |||
110 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 110 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
111 | union acpi_object *obj; | 111 | union acpi_object *obj; |
112 | struct acpi_subtable_header *header; | 112 | struct acpi_subtable_header *header; |
113 | int apic_id = -1; | 113 | int phys_id = -1; |
114 | 114 | ||
115 | if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer))) | 115 | if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer))) |
116 | goto exit; | 116 | goto exit; |
@@ -126,38 +126,38 @@ static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id) | |||
126 | 126 | ||
127 | header = (struct acpi_subtable_header *)obj->buffer.pointer; | 127 | header = (struct acpi_subtable_header *)obj->buffer.pointer; |
128 | if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) | 128 | if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) |
129 | map_lapic_id(header, acpi_id, &apic_id); | 129 | map_lapic_id(header, acpi_id, &phys_id); |
130 | else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) | 130 | else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) |
131 | map_lsapic_id(header, type, acpi_id, &apic_id); | 131 | map_lsapic_id(header, type, acpi_id, &phys_id); |
132 | else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) | 132 | else if (header->type == ACPI_MADT_TYPE_LOCAL_X2APIC) |
133 | map_x2apic_id(header, type, acpi_id, &apic_id); | 133 | map_x2apic_id(header, type, acpi_id, &phys_id); |
134 | 134 | ||
135 | exit: | 135 | exit: |
136 | kfree(buffer.pointer); | 136 | kfree(buffer.pointer); |
137 | return apic_id; | 137 | return phys_id; |
138 | } | 138 | } |
139 | 139 | ||
140 | int acpi_get_apicid(acpi_handle handle, int type, u32 acpi_id) | 140 | int acpi_get_phys_id(acpi_handle handle, int type, u32 acpi_id) |
141 | { | 141 | { |
142 | int apic_id; | 142 | int phys_id; |
143 | 143 | ||
144 | apic_id = map_mat_entry(handle, type, acpi_id); | 144 | phys_id = map_mat_entry(handle, type, acpi_id); |
145 | if (apic_id == -1) | 145 | if (phys_id == -1) |
146 | apic_id = map_madt_entry(type, acpi_id); | 146 | phys_id = map_madt_entry(type, acpi_id); |
147 | 147 | ||
148 | return apic_id; | 148 | return phys_id; |
149 | } | 149 | } |
150 | 150 | ||
151 | int acpi_map_cpuid(int apic_id, u32 acpi_id) | 151 | int acpi_map_cpuid(int phys_id, u32 acpi_id) |
152 | { | 152 | { |
153 | #ifdef CONFIG_SMP | 153 | #ifdef CONFIG_SMP |
154 | int i; | 154 | int i; |
155 | #endif | 155 | #endif |
156 | 156 | ||
157 | if (apic_id == -1) { | 157 | if (phys_id == -1) { |
158 | /* | 158 | /* |
159 | * On UP processor, there is no _MAT or MADT table. | 159 | * On UP processor, there is no _MAT or MADT table. |
160 | * So above apic_id is always set to -1. | 160 | * So above phys_id is always set to -1. |
161 | * | 161 | * |
162 | * BIOS may define multiple CPU handles even for UP processor. | 162 | * BIOS may define multiple CPU handles even for UP processor. |
163 | * For example, | 163 | * For example, |
@@ -170,7 +170,7 @@ int acpi_map_cpuid(int apic_id, u32 acpi_id) | |||
170 | * Processor (CPU3, 0x03, 0x00000410, 0x06) {} | 170 | * Processor (CPU3, 0x03, 0x00000410, 0x06) {} |
171 | * } | 171 | * } |
172 | * | 172 | * |
173 | * Ignores apic_id and always returns 0 for the processor | 173 | * Ignores phys_id and always returns 0 for the processor |
174 | * handle with acpi id 0 if nr_cpu_ids is 1. | 174 | * handle with acpi id 0 if nr_cpu_ids is 1. |
175 | * This should be the case if SMP tables are not found. | 175 | * This should be the case if SMP tables are not found. |
176 | * Return -1 for other CPU's handle. | 176 | * Return -1 for other CPU's handle. |
@@ -178,28 +178,28 @@ int acpi_map_cpuid(int apic_id, u32 acpi_id) | |||
178 | if (nr_cpu_ids <= 1 && acpi_id == 0) | 178 | if (nr_cpu_ids <= 1 && acpi_id == 0) |
179 | return acpi_id; | 179 | return acpi_id; |
180 | else | 180 | else |
181 | return apic_id; | 181 | return phys_id; |
182 | } | 182 | } |
183 | 183 | ||
184 | #ifdef CONFIG_SMP | 184 | #ifdef CONFIG_SMP |
185 | for_each_possible_cpu(i) { | 185 | for_each_possible_cpu(i) { |
186 | if (cpu_physical_id(i) == apic_id) | 186 | if (cpu_physical_id(i) == phys_id) |
187 | return i; | 187 | return i; |
188 | } | 188 | } |
189 | #else | 189 | #else |
190 | /* In UP kernel, only processor 0 is valid */ | 190 | /* In UP kernel, only processor 0 is valid */ |
191 | if (apic_id == 0) | 191 | if (phys_id == 0) |
192 | return apic_id; | 192 | return phys_id; |
193 | #endif | 193 | #endif |
194 | return -1; | 194 | return -1; |
195 | } | 195 | } |
196 | 196 | ||
197 | int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id) | 197 | int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id) |
198 | { | 198 | { |
199 | int apic_id; | 199 | int phys_id; |
200 | 200 | ||
201 | apic_id = acpi_get_apicid(handle, type, acpi_id); | 201 | phys_id = acpi_get_phys_id(handle, type, acpi_id); |
202 | 202 | ||
203 | return acpi_map_cpuid(apic_id, acpi_id); | 203 | return acpi_map_cpuid(phys_id, acpi_id); |
204 | } | 204 | } |
205 | EXPORT_SYMBOL_GPL(acpi_get_cpuid); | 205 | EXPORT_SYMBOL_GPL(acpi_get_cpuid); |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 16914cc30882..dc4d8960684a 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -1001,7 +1001,7 @@ static void acpi_free_power_resources_lists(struct acpi_device *device) | |||
1001 | if (device->wakeup.flags.valid) | 1001 | if (device->wakeup.flags.valid) |
1002 | acpi_power_resources_list_free(&device->wakeup.resources); | 1002 | acpi_power_resources_list_free(&device->wakeup.resources); |
1003 | 1003 | ||
1004 | if (!device->flags.power_manageable) | 1004 | if (!device->power.flags.power_resources) |
1005 | return; | 1005 | return; |
1006 | 1006 | ||
1007 | for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3_HOT; i++) { | 1007 | for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3_HOT; i++) { |
@@ -1744,10 +1744,8 @@ static void acpi_bus_get_power_flags(struct acpi_device *device) | |||
1744 | device->power.flags.power_resources) | 1744 | device->power.flags.power_resources) |
1745 | device->power.states[ACPI_STATE_D3_COLD].flags.os_accessible = 1; | 1745 | device->power.states[ACPI_STATE_D3_COLD].flags.os_accessible = 1; |
1746 | 1746 | ||
1747 | if (acpi_bus_init_power(device)) { | 1747 | if (acpi_bus_init_power(device)) |
1748 | acpi_free_power_resources_lists(device); | ||
1749 | device->flags.power_manageable = 0; | 1748 | device->flags.power_manageable = 0; |
1750 | } | ||
1751 | } | 1749 | } |
1752 | 1750 | ||
1753 | static void acpi_bus_get_flags(struct acpi_device *device) | 1751 | static void acpi_bus_get_flags(struct acpi_device *device) |
@@ -2371,13 +2369,18 @@ static void acpi_bus_attach(struct acpi_device *device) | |||
2371 | /* Skip devices that are not present. */ | 2369 | /* Skip devices that are not present. */ |
2372 | if (!acpi_device_is_present(device)) { | 2370 | if (!acpi_device_is_present(device)) { |
2373 | device->flags.visited = false; | 2371 | device->flags.visited = false; |
2372 | device->flags.power_manageable = 0; | ||
2374 | return; | 2373 | return; |
2375 | } | 2374 | } |
2376 | if (device->handler) | 2375 | if (device->handler) |
2377 | goto ok; | 2376 | goto ok; |
2378 | 2377 | ||
2379 | if (!device->flags.initialized) { | 2378 | if (!device->flags.initialized) { |
2380 | acpi_bus_update_power(device, NULL); | 2379 | device->flags.power_manageable = |
2380 | device->power.states[ACPI_STATE_D0].flags.valid; | ||
2381 | if (acpi_bus_init_power(device)) | ||
2382 | device->flags.power_manageable = 0; | ||
2383 | |||
2381 | device->flags.initialized = true; | 2384 | device->flags.initialized = true; |
2382 | } | 2385 | } |
2383 | device->flags.visited = false; | 2386 | device->flags.visited = false; |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index c72e79d2c5ad..032db459370f 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -522,6 +522,16 @@ static struct dmi_system_id video_dmi_table[] __initdata = { | |||
522 | DMI_MATCH(DMI_PRODUCT_NAME, "370R4E/370R4V/370R5E/3570RE/370R5V"), | 522 | DMI_MATCH(DMI_PRODUCT_NAME, "370R4E/370R4V/370R5E/3570RE/370R5V"), |
523 | }, | 523 | }, |
524 | }, | 524 | }, |
525 | |||
526 | { | ||
527 | /* https://bugzilla.redhat.com/show_bug.cgi?id=1163574 */ | ||
528 | .callback = video_disable_native_backlight, | ||
529 | .ident = "Dell XPS15 L521X", | ||
530 | .matches = { | ||
531 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
532 | DMI_MATCH(DMI_PRODUCT_NAME, "XPS L521X"), | ||
533 | }, | ||
534 | }, | ||
525 | {} | 535 | {} |
526 | }; | 536 | }; |
527 | 537 | ||
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c index ae9f615382f6..aa2224aa7caa 100644 --- a/drivers/block/null_blk.c +++ b/drivers/block/null_blk.c | |||
@@ -530,7 +530,7 @@ static int null_add_dev(void) | |||
530 | goto out_cleanup_queues; | 530 | goto out_cleanup_queues; |
531 | 531 | ||
532 | nullb->q = blk_mq_init_queue(&nullb->tag_set); | 532 | nullb->q = blk_mq_init_queue(&nullb->tag_set); |
533 | if (!nullb->q) { | 533 | if (IS_ERR(nullb->q)) { |
534 | rv = -ENOMEM; | 534 | rv = -ENOMEM; |
535 | goto out_cleanup_tags; | 535 | goto out_cleanup_tags; |
536 | } | 536 | } |
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index b1d5d8797315..cb529e9a82dd 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c | |||
@@ -215,6 +215,7 @@ static void nvme_set_info(struct nvme_cmd_info *cmd, void *ctx, | |||
215 | cmd->fn = handler; | 215 | cmd->fn = handler; |
216 | cmd->ctx = ctx; | 216 | cmd->ctx = ctx; |
217 | cmd->aborted = 0; | 217 | cmd->aborted = 0; |
218 | blk_mq_start_request(blk_mq_rq_from_pdu(cmd)); | ||
218 | } | 219 | } |
219 | 220 | ||
220 | /* Special values must be less than 0x1000 */ | 221 | /* Special values must be less than 0x1000 */ |
@@ -431,8 +432,13 @@ static void req_completion(struct nvme_queue *nvmeq, void *ctx, | |||
431 | if (unlikely(status)) { | 432 | if (unlikely(status)) { |
432 | if (!(status & NVME_SC_DNR || blk_noretry_request(req)) | 433 | if (!(status & NVME_SC_DNR || blk_noretry_request(req)) |
433 | && (jiffies - req->start_time) < req->timeout) { | 434 | && (jiffies - req->start_time) < req->timeout) { |
435 | unsigned long flags; | ||
436 | |||
434 | blk_mq_requeue_request(req); | 437 | blk_mq_requeue_request(req); |
435 | blk_mq_kick_requeue_list(req->q); | 438 | spin_lock_irqsave(req->q->queue_lock, flags); |
439 | if (!blk_queue_stopped(req->q)) | ||
440 | blk_mq_kick_requeue_list(req->q); | ||
441 | spin_unlock_irqrestore(req->q->queue_lock, flags); | ||
436 | return; | 442 | return; |
437 | } | 443 | } |
438 | req->errors = nvme_error_status(status); | 444 | req->errors = nvme_error_status(status); |
@@ -664,8 +670,6 @@ static int nvme_queue_rq(struct blk_mq_hw_ctx *hctx, | |||
664 | } | 670 | } |
665 | } | 671 | } |
666 | 672 | ||
667 | blk_mq_start_request(req); | ||
668 | |||
669 | nvme_set_info(cmd, iod, req_completion); | 673 | nvme_set_info(cmd, iod, req_completion); |
670 | spin_lock_irq(&nvmeq->q_lock); | 674 | spin_lock_irq(&nvmeq->q_lock); |
671 | if (req->cmd_flags & REQ_DISCARD) | 675 | if (req->cmd_flags & REQ_DISCARD) |
@@ -835,6 +839,7 @@ static int nvme_submit_async_admin_req(struct nvme_dev *dev) | |||
835 | if (IS_ERR(req)) | 839 | if (IS_ERR(req)) |
836 | return PTR_ERR(req); | 840 | return PTR_ERR(req); |
837 | 841 | ||
842 | req->cmd_flags |= REQ_NO_TIMEOUT; | ||
838 | cmd_info = blk_mq_rq_to_pdu(req); | 843 | cmd_info = blk_mq_rq_to_pdu(req); |
839 | nvme_set_info(cmd_info, req, async_req_completion); | 844 | nvme_set_info(cmd_info, req, async_req_completion); |
840 | 845 | ||
@@ -1016,14 +1021,19 @@ static void nvme_abort_req(struct request *req) | |||
1016 | struct nvme_command cmd; | 1021 | struct nvme_command cmd; |
1017 | 1022 | ||
1018 | if (!nvmeq->qid || cmd_rq->aborted) { | 1023 | if (!nvmeq->qid || cmd_rq->aborted) { |
1024 | unsigned long flags; | ||
1025 | |||
1026 | spin_lock_irqsave(&dev_list_lock, flags); | ||
1019 | if (work_busy(&dev->reset_work)) | 1027 | if (work_busy(&dev->reset_work)) |
1020 | return; | 1028 | goto out; |
1021 | list_del_init(&dev->node); | 1029 | list_del_init(&dev->node); |
1022 | dev_warn(&dev->pci_dev->dev, | 1030 | dev_warn(&dev->pci_dev->dev, |
1023 | "I/O %d QID %d timeout, reset controller\n", | 1031 | "I/O %d QID %d timeout, reset controller\n", |
1024 | req->tag, nvmeq->qid); | 1032 | req->tag, nvmeq->qid); |
1025 | dev->reset_workfn = nvme_reset_failed_dev; | 1033 | dev->reset_workfn = nvme_reset_failed_dev; |
1026 | queue_work(nvme_workq, &dev->reset_work); | 1034 | queue_work(nvme_workq, &dev->reset_work); |
1035 | out: | ||
1036 | spin_unlock_irqrestore(&dev_list_lock, flags); | ||
1027 | return; | 1037 | return; |
1028 | } | 1038 | } |
1029 | 1039 | ||
@@ -1064,15 +1074,22 @@ static void nvme_cancel_queue_ios(struct blk_mq_hw_ctx *hctx, | |||
1064 | void *ctx; | 1074 | void *ctx; |
1065 | nvme_completion_fn fn; | 1075 | nvme_completion_fn fn; |
1066 | struct nvme_cmd_info *cmd; | 1076 | struct nvme_cmd_info *cmd; |
1067 | static struct nvme_completion cqe = { | 1077 | struct nvme_completion cqe; |
1068 | .status = cpu_to_le16(NVME_SC_ABORT_REQ << 1), | 1078 | |
1069 | }; | 1079 | if (!blk_mq_request_started(req)) |
1080 | return; | ||
1070 | 1081 | ||
1071 | cmd = blk_mq_rq_to_pdu(req); | 1082 | cmd = blk_mq_rq_to_pdu(req); |
1072 | 1083 | ||
1073 | if (cmd->ctx == CMD_CTX_CANCELLED) | 1084 | if (cmd->ctx == CMD_CTX_CANCELLED) |
1074 | return; | 1085 | return; |
1075 | 1086 | ||
1087 | if (blk_queue_dying(req->q)) | ||
1088 | cqe.status = cpu_to_le16((NVME_SC_ABORT_REQ | NVME_SC_DNR) << 1); | ||
1089 | else | ||
1090 | cqe.status = cpu_to_le16(NVME_SC_ABORT_REQ << 1); | ||
1091 | |||
1092 | |||
1076 | dev_warn(nvmeq->q_dmadev, "Cancelling I/O %d QID %d\n", | 1093 | dev_warn(nvmeq->q_dmadev, "Cancelling I/O %d QID %d\n", |
1077 | req->tag, nvmeq->qid); | 1094 | req->tag, nvmeq->qid); |
1078 | ctx = cancel_cmd_info(cmd, &fn); | 1095 | ctx = cancel_cmd_info(cmd, &fn); |
@@ -1084,17 +1101,29 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved) | |||
1084 | struct nvme_cmd_info *cmd = blk_mq_rq_to_pdu(req); | 1101 | struct nvme_cmd_info *cmd = blk_mq_rq_to_pdu(req); |
1085 | struct nvme_queue *nvmeq = cmd->nvmeq; | 1102 | struct nvme_queue *nvmeq = cmd->nvmeq; |
1086 | 1103 | ||
1087 | dev_warn(nvmeq->q_dmadev, "Timeout I/O %d QID %d\n", req->tag, | ||
1088 | nvmeq->qid); | ||
1089 | if (nvmeq->dev->initialized) | ||
1090 | nvme_abort_req(req); | ||
1091 | |||
1092 | /* | 1104 | /* |
1093 | * The aborted req will be completed on receiving the abort req. | 1105 | * The aborted req will be completed on receiving the abort req. |
1094 | * We enable the timer again. If hit twice, it'll cause a device reset, | 1106 | * We enable the timer again. If hit twice, it'll cause a device reset, |
1095 | * as the device then is in a faulty state. | 1107 | * as the device then is in a faulty state. |
1096 | */ | 1108 | */ |
1097 | return BLK_EH_RESET_TIMER; | 1109 | int ret = BLK_EH_RESET_TIMER; |
1110 | |||
1111 | dev_warn(nvmeq->q_dmadev, "Timeout I/O %d QID %d\n", req->tag, | ||
1112 | nvmeq->qid); | ||
1113 | |||
1114 | spin_lock_irq(&nvmeq->q_lock); | ||
1115 | if (!nvmeq->dev->initialized) { | ||
1116 | /* | ||
1117 | * Force cancelled command frees the request, which requires we | ||
1118 | * return BLK_EH_NOT_HANDLED. | ||
1119 | */ | ||
1120 | nvme_cancel_queue_ios(nvmeq->hctx, req, nvmeq, reserved); | ||
1121 | ret = BLK_EH_NOT_HANDLED; | ||
1122 | } else | ||
1123 | nvme_abort_req(req); | ||
1124 | spin_unlock_irq(&nvmeq->q_lock); | ||
1125 | |||
1126 | return ret; | ||
1098 | } | 1127 | } |
1099 | 1128 | ||
1100 | static void nvme_free_queue(struct nvme_queue *nvmeq) | 1129 | static void nvme_free_queue(struct nvme_queue *nvmeq) |
@@ -1131,10 +1160,16 @@ static void nvme_free_queues(struct nvme_dev *dev, int lowest) | |||
1131 | */ | 1160 | */ |
1132 | static int nvme_suspend_queue(struct nvme_queue *nvmeq) | 1161 | static int nvme_suspend_queue(struct nvme_queue *nvmeq) |
1133 | { | 1162 | { |
1134 | int vector = nvmeq->dev->entry[nvmeq->cq_vector].vector; | 1163 | int vector; |
1135 | 1164 | ||
1136 | spin_lock_irq(&nvmeq->q_lock); | 1165 | spin_lock_irq(&nvmeq->q_lock); |
1166 | if (nvmeq->cq_vector == -1) { | ||
1167 | spin_unlock_irq(&nvmeq->q_lock); | ||
1168 | return 1; | ||
1169 | } | ||
1170 | vector = nvmeq->dev->entry[nvmeq->cq_vector].vector; | ||
1137 | nvmeq->dev->online_queues--; | 1171 | nvmeq->dev->online_queues--; |
1172 | nvmeq->cq_vector = -1; | ||
1138 | spin_unlock_irq(&nvmeq->q_lock); | 1173 | spin_unlock_irq(&nvmeq->q_lock); |
1139 | 1174 | ||
1140 | irq_set_affinity_hint(vector, NULL); | 1175 | irq_set_affinity_hint(vector, NULL); |
@@ -1169,11 +1204,13 @@ static void nvme_disable_queue(struct nvme_dev *dev, int qid) | |||
1169 | adapter_delete_sq(dev, qid); | 1204 | adapter_delete_sq(dev, qid); |
1170 | adapter_delete_cq(dev, qid); | 1205 | adapter_delete_cq(dev, qid); |
1171 | } | 1206 | } |
1207 | if (!qid && dev->admin_q) | ||
1208 | blk_mq_freeze_queue_start(dev->admin_q); | ||
1172 | nvme_clear_queue(nvmeq); | 1209 | nvme_clear_queue(nvmeq); |
1173 | } | 1210 | } |
1174 | 1211 | ||
1175 | static struct nvme_queue *nvme_alloc_queue(struct nvme_dev *dev, int qid, | 1212 | static struct nvme_queue *nvme_alloc_queue(struct nvme_dev *dev, int qid, |
1176 | int depth, int vector) | 1213 | int depth) |
1177 | { | 1214 | { |
1178 | struct device *dmadev = &dev->pci_dev->dev; | 1215 | struct device *dmadev = &dev->pci_dev->dev; |
1179 | struct nvme_queue *nvmeq = kzalloc(sizeof(*nvmeq), GFP_KERNEL); | 1216 | struct nvme_queue *nvmeq = kzalloc(sizeof(*nvmeq), GFP_KERNEL); |
@@ -1199,7 +1236,6 @@ static struct nvme_queue *nvme_alloc_queue(struct nvme_dev *dev, int qid, | |||
1199 | nvmeq->cq_phase = 1; | 1236 | nvmeq->cq_phase = 1; |
1200 | nvmeq->q_db = &dev->dbs[qid * 2 * dev->db_stride]; | 1237 | nvmeq->q_db = &dev->dbs[qid * 2 * dev->db_stride]; |
1201 | nvmeq->q_depth = depth; | 1238 | nvmeq->q_depth = depth; |
1202 | nvmeq->cq_vector = vector; | ||
1203 | nvmeq->qid = qid; | 1239 | nvmeq->qid = qid; |
1204 | dev->queue_count++; | 1240 | dev->queue_count++; |
1205 | dev->queues[qid] = nvmeq; | 1241 | dev->queues[qid] = nvmeq; |
@@ -1244,6 +1280,7 @@ static int nvme_create_queue(struct nvme_queue *nvmeq, int qid) | |||
1244 | struct nvme_dev *dev = nvmeq->dev; | 1280 | struct nvme_dev *dev = nvmeq->dev; |
1245 | int result; | 1281 | int result; |
1246 | 1282 | ||
1283 | nvmeq->cq_vector = qid - 1; | ||
1247 | result = adapter_alloc_cq(dev, qid, nvmeq); | 1284 | result = adapter_alloc_cq(dev, qid, nvmeq); |
1248 | if (result < 0) | 1285 | if (result < 0) |
1249 | return result; | 1286 | return result; |
@@ -1355,6 +1392,14 @@ static struct blk_mq_ops nvme_mq_ops = { | |||
1355 | .timeout = nvme_timeout, | 1392 | .timeout = nvme_timeout, |
1356 | }; | 1393 | }; |
1357 | 1394 | ||
1395 | static void nvme_dev_remove_admin(struct nvme_dev *dev) | ||
1396 | { | ||
1397 | if (dev->admin_q && !blk_queue_dying(dev->admin_q)) { | ||
1398 | blk_cleanup_queue(dev->admin_q); | ||
1399 | blk_mq_free_tag_set(&dev->admin_tagset); | ||
1400 | } | ||
1401 | } | ||
1402 | |||
1358 | static int nvme_alloc_admin_tags(struct nvme_dev *dev) | 1403 | static int nvme_alloc_admin_tags(struct nvme_dev *dev) |
1359 | { | 1404 | { |
1360 | if (!dev->admin_q) { | 1405 | if (!dev->admin_q) { |
@@ -1370,21 +1415,20 @@ static int nvme_alloc_admin_tags(struct nvme_dev *dev) | |||
1370 | return -ENOMEM; | 1415 | return -ENOMEM; |
1371 | 1416 | ||
1372 | dev->admin_q = blk_mq_init_queue(&dev->admin_tagset); | 1417 | dev->admin_q = blk_mq_init_queue(&dev->admin_tagset); |
1373 | if (!dev->admin_q) { | 1418 | if (IS_ERR(dev->admin_q)) { |
1374 | blk_mq_free_tag_set(&dev->admin_tagset); | 1419 | blk_mq_free_tag_set(&dev->admin_tagset); |
1375 | return -ENOMEM; | 1420 | return -ENOMEM; |
1376 | } | 1421 | } |
1377 | } | 1422 | if (!blk_get_queue(dev->admin_q)) { |
1423 | nvme_dev_remove_admin(dev); | ||
1424 | return -ENODEV; | ||
1425 | } | ||
1426 | } else | ||
1427 | blk_mq_unfreeze_queue(dev->admin_q); | ||
1378 | 1428 | ||
1379 | return 0; | 1429 | return 0; |
1380 | } | 1430 | } |
1381 | 1431 | ||
1382 | static void nvme_free_admin_tags(struct nvme_dev *dev) | ||
1383 | { | ||
1384 | if (dev->admin_q) | ||
1385 | blk_mq_free_tag_set(&dev->admin_tagset); | ||
1386 | } | ||
1387 | |||
1388 | static int nvme_configure_admin_queue(struct nvme_dev *dev) | 1432 | static int nvme_configure_admin_queue(struct nvme_dev *dev) |
1389 | { | 1433 | { |
1390 | int result; | 1434 | int result; |
@@ -1416,7 +1460,7 @@ static int nvme_configure_admin_queue(struct nvme_dev *dev) | |||
1416 | 1460 | ||
1417 | nvmeq = dev->queues[0]; | 1461 | nvmeq = dev->queues[0]; |
1418 | if (!nvmeq) { | 1462 | if (!nvmeq) { |
1419 | nvmeq = nvme_alloc_queue(dev, 0, NVME_AQ_DEPTH, 0); | 1463 | nvmeq = nvme_alloc_queue(dev, 0, NVME_AQ_DEPTH); |
1420 | if (!nvmeq) | 1464 | if (!nvmeq) |
1421 | return -ENOMEM; | 1465 | return -ENOMEM; |
1422 | } | 1466 | } |
@@ -1439,18 +1483,13 @@ static int nvme_configure_admin_queue(struct nvme_dev *dev) | |||
1439 | if (result) | 1483 | if (result) |
1440 | goto free_nvmeq; | 1484 | goto free_nvmeq; |
1441 | 1485 | ||
1442 | result = nvme_alloc_admin_tags(dev); | 1486 | nvmeq->cq_vector = 0; |
1443 | if (result) | ||
1444 | goto free_nvmeq; | ||
1445 | |||
1446 | result = queue_request_irq(dev, nvmeq, nvmeq->irqname); | 1487 | result = queue_request_irq(dev, nvmeq, nvmeq->irqname); |
1447 | if (result) | 1488 | if (result) |
1448 | goto free_tags; | 1489 | goto free_nvmeq; |
1449 | 1490 | ||
1450 | return result; | 1491 | return result; |
1451 | 1492 | ||
1452 | free_tags: | ||
1453 | nvme_free_admin_tags(dev); | ||
1454 | free_nvmeq: | 1493 | free_nvmeq: |
1455 | nvme_free_queues(dev, 0); | 1494 | nvme_free_queues(dev, 0); |
1456 | return result; | 1495 | return result; |
@@ -1944,7 +1983,7 @@ static void nvme_create_io_queues(struct nvme_dev *dev) | |||
1944 | unsigned i; | 1983 | unsigned i; |
1945 | 1984 | ||
1946 | for (i = dev->queue_count; i <= dev->max_qid; i++) | 1985 | for (i = dev->queue_count; i <= dev->max_qid; i++) |
1947 | if (!nvme_alloc_queue(dev, i, dev->q_depth, i - 1)) | 1986 | if (!nvme_alloc_queue(dev, i, dev->q_depth)) |
1948 | break; | 1987 | break; |
1949 | 1988 | ||
1950 | for (i = dev->online_queues; i <= dev->queue_count - 1; i++) | 1989 | for (i = dev->online_queues; i <= dev->queue_count - 1; i++) |
@@ -2235,13 +2274,18 @@ static void nvme_wait_dq(struct nvme_delq_ctx *dq, struct nvme_dev *dev) | |||
2235 | break; | 2274 | break; |
2236 | if (!schedule_timeout(ADMIN_TIMEOUT) || | 2275 | if (!schedule_timeout(ADMIN_TIMEOUT) || |
2237 | fatal_signal_pending(current)) { | 2276 | fatal_signal_pending(current)) { |
2277 | /* | ||
2278 | * Disable the controller first since we can't trust it | ||
2279 | * at this point, but leave the admin queue enabled | ||
2280 | * until all queue deletion requests are flushed. | ||
2281 | * FIXME: This may take a while if there are more h/w | ||
2282 | * queues than admin tags. | ||
2283 | */ | ||
2238 | set_current_state(TASK_RUNNING); | 2284 | set_current_state(TASK_RUNNING); |
2239 | |||
2240 | nvme_disable_ctrl(dev, readq(&dev->bar->cap)); | 2285 | nvme_disable_ctrl(dev, readq(&dev->bar->cap)); |
2241 | nvme_disable_queue(dev, 0); | 2286 | nvme_clear_queue(dev->queues[0]); |
2242 | |||
2243 | send_sig(SIGKILL, dq->worker->task, 1); | ||
2244 | flush_kthread_worker(dq->worker); | 2287 | flush_kthread_worker(dq->worker); |
2288 | nvme_disable_queue(dev, 0); | ||
2245 | return; | 2289 | return; |
2246 | } | 2290 | } |
2247 | } | 2291 | } |
@@ -2318,7 +2362,6 @@ static void nvme_del_queue_start(struct kthread_work *work) | |||
2318 | { | 2362 | { |
2319 | struct nvme_queue *nvmeq = container_of(work, struct nvme_queue, | 2363 | struct nvme_queue *nvmeq = container_of(work, struct nvme_queue, |
2320 | cmdinfo.work); | 2364 | cmdinfo.work); |
2321 | allow_signal(SIGKILL); | ||
2322 | if (nvme_delete_sq(nvmeq)) | 2365 | if (nvme_delete_sq(nvmeq)) |
2323 | nvme_del_queue_end(nvmeq); | 2366 | nvme_del_queue_end(nvmeq); |
2324 | } | 2367 | } |
@@ -2376,6 +2419,34 @@ static void nvme_dev_list_remove(struct nvme_dev *dev) | |||
2376 | kthread_stop(tmp); | 2419 | kthread_stop(tmp); |
2377 | } | 2420 | } |
2378 | 2421 | ||
2422 | static void nvme_freeze_queues(struct nvme_dev *dev) | ||
2423 | { | ||
2424 | struct nvme_ns *ns; | ||
2425 | |||
2426 | list_for_each_entry(ns, &dev->namespaces, list) { | ||
2427 | blk_mq_freeze_queue_start(ns->queue); | ||
2428 | |||
2429 | spin_lock(ns->queue->queue_lock); | ||
2430 | queue_flag_set(QUEUE_FLAG_STOPPED, ns->queue); | ||
2431 | spin_unlock(ns->queue->queue_lock); | ||
2432 | |||
2433 | blk_mq_cancel_requeue_work(ns->queue); | ||
2434 | blk_mq_stop_hw_queues(ns->queue); | ||
2435 | } | ||
2436 | } | ||
2437 | |||
2438 | static void nvme_unfreeze_queues(struct nvme_dev *dev) | ||
2439 | { | ||
2440 | struct nvme_ns *ns; | ||
2441 | |||
2442 | list_for_each_entry(ns, &dev->namespaces, list) { | ||
2443 | queue_flag_clear_unlocked(QUEUE_FLAG_STOPPED, ns->queue); | ||
2444 | blk_mq_unfreeze_queue(ns->queue); | ||
2445 | blk_mq_start_stopped_hw_queues(ns->queue, true); | ||
2446 | blk_mq_kick_requeue_list(ns->queue); | ||
2447 | } | ||
2448 | } | ||
2449 | |||
2379 | static void nvme_dev_shutdown(struct nvme_dev *dev) | 2450 | static void nvme_dev_shutdown(struct nvme_dev *dev) |
2380 | { | 2451 | { |
2381 | int i; | 2452 | int i; |
@@ -2384,8 +2455,10 @@ static void nvme_dev_shutdown(struct nvme_dev *dev) | |||
2384 | dev->initialized = 0; | 2455 | dev->initialized = 0; |
2385 | nvme_dev_list_remove(dev); | 2456 | nvme_dev_list_remove(dev); |
2386 | 2457 | ||
2387 | if (dev->bar) | 2458 | if (dev->bar) { |
2459 | nvme_freeze_queues(dev); | ||
2388 | csts = readl(&dev->bar->csts); | 2460 | csts = readl(&dev->bar->csts); |
2461 | } | ||
2389 | if (csts & NVME_CSTS_CFS || !(csts & NVME_CSTS_RDY)) { | 2462 | if (csts & NVME_CSTS_CFS || !(csts & NVME_CSTS_RDY)) { |
2390 | for (i = dev->queue_count - 1; i >= 0; i--) { | 2463 | for (i = dev->queue_count - 1; i >= 0; i--) { |
2391 | struct nvme_queue *nvmeq = dev->queues[i]; | 2464 | struct nvme_queue *nvmeq = dev->queues[i]; |
@@ -2400,12 +2473,6 @@ static void nvme_dev_shutdown(struct nvme_dev *dev) | |||
2400 | nvme_dev_unmap(dev); | 2473 | nvme_dev_unmap(dev); |
2401 | } | 2474 | } |
2402 | 2475 | ||
2403 | static void nvme_dev_remove_admin(struct nvme_dev *dev) | ||
2404 | { | ||
2405 | if (dev->admin_q && !blk_queue_dying(dev->admin_q)) | ||
2406 | blk_cleanup_queue(dev->admin_q); | ||
2407 | } | ||
2408 | |||
2409 | static void nvme_dev_remove(struct nvme_dev *dev) | 2476 | static void nvme_dev_remove(struct nvme_dev *dev) |
2410 | { | 2477 | { |
2411 | struct nvme_ns *ns; | 2478 | struct nvme_ns *ns; |
@@ -2413,8 +2480,10 @@ static void nvme_dev_remove(struct nvme_dev *dev) | |||
2413 | list_for_each_entry(ns, &dev->namespaces, list) { | 2480 | list_for_each_entry(ns, &dev->namespaces, list) { |
2414 | if (ns->disk->flags & GENHD_FL_UP) | 2481 | if (ns->disk->flags & GENHD_FL_UP) |
2415 | del_gendisk(ns->disk); | 2482 | del_gendisk(ns->disk); |
2416 | if (!blk_queue_dying(ns->queue)) | 2483 | if (!blk_queue_dying(ns->queue)) { |
2484 | blk_mq_abort_requeue_list(ns->queue); | ||
2417 | blk_cleanup_queue(ns->queue); | 2485 | blk_cleanup_queue(ns->queue); |
2486 | } | ||
2418 | } | 2487 | } |
2419 | } | 2488 | } |
2420 | 2489 | ||
@@ -2495,6 +2564,7 @@ static void nvme_free_dev(struct kref *kref) | |||
2495 | nvme_free_namespaces(dev); | 2564 | nvme_free_namespaces(dev); |
2496 | nvme_release_instance(dev); | 2565 | nvme_release_instance(dev); |
2497 | blk_mq_free_tag_set(&dev->tagset); | 2566 | blk_mq_free_tag_set(&dev->tagset); |
2567 | blk_put_queue(dev->admin_q); | ||
2498 | kfree(dev->queues); | 2568 | kfree(dev->queues); |
2499 | kfree(dev->entry); | 2569 | kfree(dev->entry); |
2500 | kfree(dev); | 2570 | kfree(dev); |
@@ -2591,15 +2661,20 @@ static int nvme_dev_start(struct nvme_dev *dev) | |||
2591 | } | 2661 | } |
2592 | 2662 | ||
2593 | nvme_init_queue(dev->queues[0], 0); | 2663 | nvme_init_queue(dev->queues[0], 0); |
2664 | result = nvme_alloc_admin_tags(dev); | ||
2665 | if (result) | ||
2666 | goto disable; | ||
2594 | 2667 | ||
2595 | result = nvme_setup_io_queues(dev); | 2668 | result = nvme_setup_io_queues(dev); |
2596 | if (result) | 2669 | if (result) |
2597 | goto disable; | 2670 | goto free_tags; |
2598 | 2671 | ||
2599 | nvme_set_irq_hints(dev); | 2672 | nvme_set_irq_hints(dev); |
2600 | 2673 | ||
2601 | return result; | 2674 | return result; |
2602 | 2675 | ||
2676 | free_tags: | ||
2677 | nvme_dev_remove_admin(dev); | ||
2603 | disable: | 2678 | disable: |
2604 | nvme_disable_queue(dev, 0); | 2679 | nvme_disable_queue(dev, 0); |
2605 | nvme_dev_list_remove(dev); | 2680 | nvme_dev_list_remove(dev); |
@@ -2639,6 +2714,9 @@ static int nvme_dev_resume(struct nvme_dev *dev) | |||
2639 | dev->reset_workfn = nvme_remove_disks; | 2714 | dev->reset_workfn = nvme_remove_disks; |
2640 | queue_work(nvme_workq, &dev->reset_work); | 2715 | queue_work(nvme_workq, &dev->reset_work); |
2641 | spin_unlock(&dev_list_lock); | 2716 | spin_unlock(&dev_list_lock); |
2717 | } else { | ||
2718 | nvme_unfreeze_queues(dev); | ||
2719 | nvme_set_irq_hints(dev); | ||
2642 | } | 2720 | } |
2643 | dev->initialized = 1; | 2721 | dev->initialized = 1; |
2644 | return 0; | 2722 | return 0; |
@@ -2776,11 +2854,10 @@ static void nvme_remove(struct pci_dev *pdev) | |||
2776 | pci_set_drvdata(pdev, NULL); | 2854 | pci_set_drvdata(pdev, NULL); |
2777 | flush_work(&dev->reset_work); | 2855 | flush_work(&dev->reset_work); |
2778 | misc_deregister(&dev->miscdev); | 2856 | misc_deregister(&dev->miscdev); |
2779 | nvme_dev_remove(dev); | ||
2780 | nvme_dev_shutdown(dev); | 2857 | nvme_dev_shutdown(dev); |
2858 | nvme_dev_remove(dev); | ||
2781 | nvme_dev_remove_admin(dev); | 2859 | nvme_dev_remove_admin(dev); |
2782 | nvme_free_queues(dev, 0); | 2860 | nvme_free_queues(dev, 0); |
2783 | nvme_free_admin_tags(dev); | ||
2784 | nvme_release_prp_pools(dev); | 2861 | nvme_release_prp_pools(dev); |
2785 | kref_put(&dev->kref, nvme_free_dev); | 2862 | kref_put(&dev->kref, nvme_free_dev); |
2786 | } | 2863 | } |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 7ef7c098708f..cdfbd21e3597 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -638,7 +638,7 @@ static int virtblk_probe(struct virtio_device *vdev) | |||
638 | goto out_put_disk; | 638 | goto out_put_disk; |
639 | 639 | ||
640 | q = vblk->disk->queue = blk_mq_init_queue(&vblk->tag_set); | 640 | q = vblk->disk->queue = blk_mq_init_queue(&vblk->tag_set); |
641 | if (!q) { | 641 | if (IS_ERR(q)) { |
642 | err = -ENOMEM; | 642 | err = -ENOMEM; |
643 | goto out_free_tags; | 643 | goto out_free_tags; |
644 | } | 644 | } |
diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c index fd5a5e85d7dc..982b96323f82 100644 --- a/drivers/char/ipmi/ipmi_ssif.c +++ b/drivers/char/ipmi/ipmi_ssif.c | |||
@@ -969,7 +969,8 @@ static void sender(void *send_info, | |||
969 | 969 | ||
970 | do_gettimeofday(&t); | 970 | do_gettimeofday(&t); |
971 | pr_info("**Enqueue %02x %02x: %ld.%6.6ld\n", | 971 | pr_info("**Enqueue %02x %02x: %ld.%6.6ld\n", |
972 | msg->data[0], msg->data[1], t.tv_sec, t.tv_usec); | 972 | msg->data[0], msg->data[1], |
973 | (long) t.tv_sec, (long) t.tv_usec); | ||
973 | } | 974 | } |
974 | } | 975 | } |
975 | 976 | ||
diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c index 380478562b7d..5c062548957c 100644 --- a/drivers/dma/dw/core.c +++ b/drivers/dma/dw/core.c | |||
@@ -1505,7 +1505,6 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata) | |||
1505 | dw->regs = chip->regs; | 1505 | dw->regs = chip->regs; |
1506 | chip->dw = dw; | 1506 | chip->dw = dw; |
1507 | 1507 | ||
1508 | pm_runtime_enable(chip->dev); | ||
1509 | pm_runtime_get_sync(chip->dev); | 1508 | pm_runtime_get_sync(chip->dev); |
1510 | 1509 | ||
1511 | dw_params = dma_read_byaddr(chip->regs, DW_PARAMS); | 1510 | dw_params = dma_read_byaddr(chip->regs, DW_PARAMS); |
@@ -1703,7 +1702,6 @@ int dw_dma_remove(struct dw_dma_chip *chip) | |||
1703 | } | 1702 | } |
1704 | 1703 | ||
1705 | pm_runtime_put_sync_suspend(chip->dev); | 1704 | pm_runtime_put_sync_suspend(chip->dev); |
1706 | pm_runtime_disable(chip->dev); | ||
1707 | return 0; | 1705 | return 0; |
1708 | } | 1706 | } |
1709 | EXPORT_SYMBOL_GPL(dw_dma_remove); | 1707 | EXPORT_SYMBOL_GPL(dw_dma_remove); |
diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c index a630161473a4..32ea1aca7a0e 100644 --- a/drivers/dma/dw/platform.c +++ b/drivers/dma/dw/platform.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/device.h> | 16 | #include <linux/device.h> |
17 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
18 | #include <linux/pm_runtime.h> | ||
18 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
19 | #include <linux/dmaengine.h> | 20 | #include <linux/dmaengine.h> |
20 | #include <linux/dma-mapping.h> | 21 | #include <linux/dma-mapping.h> |
@@ -185,6 +186,8 @@ static int dw_probe(struct platform_device *pdev) | |||
185 | if (err) | 186 | if (err) |
186 | return err; | 187 | return err; |
187 | 188 | ||
189 | pm_runtime_enable(&pdev->dev); | ||
190 | |||
188 | err = dw_dma_probe(chip, pdata); | 191 | err = dw_dma_probe(chip, pdata); |
189 | if (err) | 192 | if (err) |
190 | goto err_dw_dma_probe; | 193 | goto err_dw_dma_probe; |
@@ -205,6 +208,7 @@ static int dw_probe(struct platform_device *pdev) | |||
205 | return 0; | 208 | return 0; |
206 | 209 | ||
207 | err_dw_dma_probe: | 210 | err_dw_dma_probe: |
211 | pm_runtime_disable(&pdev->dev); | ||
208 | clk_disable_unprepare(chip->clk); | 212 | clk_disable_unprepare(chip->clk); |
209 | return err; | 213 | return err; |
210 | } | 214 | } |
@@ -217,6 +221,7 @@ static int dw_remove(struct platform_device *pdev) | |||
217 | of_dma_controller_free(pdev->dev.of_node); | 221 | of_dma_controller_free(pdev->dev.of_node); |
218 | 222 | ||
219 | dw_dma_remove(chip); | 223 | dw_dma_remove(chip); |
224 | pm_runtime_disable(&pdev->dev); | ||
220 | clk_disable_unprepare(chip->clk); | 225 | clk_disable_unprepare(chip->clk); |
221 | 226 | ||
222 | return 0; | 227 | return 0; |
diff --git a/drivers/gpio/gpio-dln2.c b/drivers/gpio/gpio-dln2.c index 978b51eae2ec..ce3c1558cb0a 100644 --- a/drivers/gpio/gpio-dln2.c +++ b/drivers/gpio/gpio-dln2.c | |||
@@ -47,13 +47,6 @@ | |||
47 | 47 | ||
48 | #define DLN2_GPIO_MAX_PINS 32 | 48 | #define DLN2_GPIO_MAX_PINS 32 |
49 | 49 | ||
50 | struct dln2_irq_work { | ||
51 | struct work_struct work; | ||
52 | struct dln2_gpio *dln2; | ||
53 | int pin; | ||
54 | int type; | ||
55 | }; | ||
56 | |||
57 | struct dln2_gpio { | 50 | struct dln2_gpio { |
58 | struct platform_device *pdev; | 51 | struct platform_device *pdev; |
59 | struct gpio_chip gpio; | 52 | struct gpio_chip gpio; |
@@ -64,10 +57,12 @@ struct dln2_gpio { | |||
64 | */ | 57 | */ |
65 | DECLARE_BITMAP(output_enabled, DLN2_GPIO_MAX_PINS); | 58 | DECLARE_BITMAP(output_enabled, DLN2_GPIO_MAX_PINS); |
66 | 59 | ||
67 | DECLARE_BITMAP(irqs_masked, DLN2_GPIO_MAX_PINS); | 60 | /* active IRQs - not synced to hardware */ |
68 | DECLARE_BITMAP(irqs_enabled, DLN2_GPIO_MAX_PINS); | 61 | DECLARE_BITMAP(unmasked_irqs, DLN2_GPIO_MAX_PINS); |
69 | DECLARE_BITMAP(irqs_pending, DLN2_GPIO_MAX_PINS); | 62 | /* active IRQS - synced to hardware */ |
70 | struct dln2_irq_work *irq_work; | 63 | DECLARE_BITMAP(enabled_irqs, DLN2_GPIO_MAX_PINS); |
64 | int irq_type[DLN2_GPIO_MAX_PINS]; | ||
65 | struct mutex irq_lock; | ||
71 | }; | 66 | }; |
72 | 67 | ||
73 | struct dln2_gpio_pin { | 68 | struct dln2_gpio_pin { |
@@ -141,16 +136,16 @@ static int dln2_gpio_pin_get_out_val(struct dln2_gpio *dln2, unsigned int pin) | |||
141 | return !!ret; | 136 | return !!ret; |
142 | } | 137 | } |
143 | 138 | ||
144 | static void dln2_gpio_pin_set_out_val(struct dln2_gpio *dln2, | 139 | static int dln2_gpio_pin_set_out_val(struct dln2_gpio *dln2, |
145 | unsigned int pin, int value) | 140 | unsigned int pin, int value) |
146 | { | 141 | { |
147 | struct dln2_gpio_pin_val req = { | 142 | struct dln2_gpio_pin_val req = { |
148 | .pin = cpu_to_le16(pin), | 143 | .pin = cpu_to_le16(pin), |
149 | .value = value, | 144 | .value = value, |
150 | }; | 145 | }; |
151 | 146 | ||
152 | dln2_transfer_tx(dln2->pdev, DLN2_GPIO_PIN_SET_OUT_VAL, &req, | 147 | return dln2_transfer_tx(dln2->pdev, DLN2_GPIO_PIN_SET_OUT_VAL, &req, |
153 | sizeof(req)); | 148 | sizeof(req)); |
154 | } | 149 | } |
155 | 150 | ||
156 | #define DLN2_GPIO_DIRECTION_IN 0 | 151 | #define DLN2_GPIO_DIRECTION_IN 0 |
@@ -267,6 +262,13 @@ static int dln2_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | |||
267 | static int dln2_gpio_direction_output(struct gpio_chip *chip, unsigned offset, | 262 | static int dln2_gpio_direction_output(struct gpio_chip *chip, unsigned offset, |
268 | int value) | 263 | int value) |
269 | { | 264 | { |
265 | struct dln2_gpio *dln2 = container_of(chip, struct dln2_gpio, gpio); | ||
266 | int ret; | ||
267 | |||
268 | ret = dln2_gpio_pin_set_out_val(dln2, offset, value); | ||
269 | if (ret < 0) | ||
270 | return ret; | ||
271 | |||
270 | return dln2_gpio_set_direction(chip, offset, DLN2_GPIO_DIRECTION_OUT); | 272 | return dln2_gpio_set_direction(chip, offset, DLN2_GPIO_DIRECTION_OUT); |
271 | } | 273 | } |
272 | 274 | ||
@@ -297,36 +299,13 @@ static int dln2_gpio_set_event_cfg(struct dln2_gpio *dln2, unsigned pin, | |||
297 | &req, sizeof(req)); | 299 | &req, sizeof(req)); |
298 | } | 300 | } |
299 | 301 | ||
300 | static void dln2_irq_work(struct work_struct *w) | 302 | static void dln2_irq_unmask(struct irq_data *irqd) |
301 | { | ||
302 | struct dln2_irq_work *iw = container_of(w, struct dln2_irq_work, work); | ||
303 | struct dln2_gpio *dln2 = iw->dln2; | ||
304 | u8 type = iw->type & DLN2_GPIO_EVENT_MASK; | ||
305 | |||
306 | if (test_bit(iw->pin, dln2->irqs_enabled)) | ||
307 | dln2_gpio_set_event_cfg(dln2, iw->pin, type, 0); | ||
308 | else | ||
309 | dln2_gpio_set_event_cfg(dln2, iw->pin, DLN2_GPIO_EVENT_NONE, 0); | ||
310 | } | ||
311 | |||
312 | static void dln2_irq_enable(struct irq_data *irqd) | ||
313 | { | ||
314 | struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd); | ||
315 | struct dln2_gpio *dln2 = container_of(gc, struct dln2_gpio, gpio); | ||
316 | int pin = irqd_to_hwirq(irqd); | ||
317 | |||
318 | set_bit(pin, dln2->irqs_enabled); | ||
319 | schedule_work(&dln2->irq_work[pin].work); | ||
320 | } | ||
321 | |||
322 | static void dln2_irq_disable(struct irq_data *irqd) | ||
323 | { | 303 | { |
324 | struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd); | 304 | struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd); |
325 | struct dln2_gpio *dln2 = container_of(gc, struct dln2_gpio, gpio); | 305 | struct dln2_gpio *dln2 = container_of(gc, struct dln2_gpio, gpio); |
326 | int pin = irqd_to_hwirq(irqd); | 306 | int pin = irqd_to_hwirq(irqd); |
327 | 307 | ||
328 | clear_bit(pin, dln2->irqs_enabled); | 308 | set_bit(pin, dln2->unmasked_irqs); |
329 | schedule_work(&dln2->irq_work[pin].work); | ||
330 | } | 309 | } |
331 | 310 | ||
332 | static void dln2_irq_mask(struct irq_data *irqd) | 311 | static void dln2_irq_mask(struct irq_data *irqd) |
@@ -335,27 +314,7 @@ static void dln2_irq_mask(struct irq_data *irqd) | |||
335 | struct dln2_gpio *dln2 = container_of(gc, struct dln2_gpio, gpio); | 314 | struct dln2_gpio *dln2 = container_of(gc, struct dln2_gpio, gpio); |
336 | int pin = irqd_to_hwirq(irqd); | 315 | int pin = irqd_to_hwirq(irqd); |
337 | 316 | ||
338 | set_bit(pin, dln2->irqs_masked); | 317 | clear_bit(pin, dln2->unmasked_irqs); |
339 | } | ||
340 | |||
341 | static void dln2_irq_unmask(struct irq_data *irqd) | ||
342 | { | ||
343 | struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd); | ||
344 | struct dln2_gpio *dln2 = container_of(gc, struct dln2_gpio, gpio); | ||
345 | struct device *dev = dln2->gpio.dev; | ||
346 | int pin = irqd_to_hwirq(irqd); | ||
347 | |||
348 | if (test_and_clear_bit(pin, dln2->irqs_pending)) { | ||
349 | int irq; | ||
350 | |||
351 | irq = irq_find_mapping(dln2->gpio.irqdomain, pin); | ||
352 | if (!irq) { | ||
353 | dev_err(dev, "pin %d not mapped to IRQ\n", pin); | ||
354 | return; | ||
355 | } | ||
356 | |||
357 | generic_handle_irq(irq); | ||
358 | } | ||
359 | } | 318 | } |
360 | 319 | ||
361 | static int dln2_irq_set_type(struct irq_data *irqd, unsigned type) | 320 | static int dln2_irq_set_type(struct irq_data *irqd, unsigned type) |
@@ -366,19 +325,19 @@ static int dln2_irq_set_type(struct irq_data *irqd, unsigned type) | |||
366 | 325 | ||
367 | switch (type) { | 326 | switch (type) { |
368 | case IRQ_TYPE_LEVEL_HIGH: | 327 | case IRQ_TYPE_LEVEL_HIGH: |
369 | dln2->irq_work[pin].type = DLN2_GPIO_EVENT_LVL_HIGH; | 328 | dln2->irq_type[pin] = DLN2_GPIO_EVENT_LVL_HIGH; |
370 | break; | 329 | break; |
371 | case IRQ_TYPE_LEVEL_LOW: | 330 | case IRQ_TYPE_LEVEL_LOW: |
372 | dln2->irq_work[pin].type = DLN2_GPIO_EVENT_LVL_LOW; | 331 | dln2->irq_type[pin] = DLN2_GPIO_EVENT_LVL_LOW; |
373 | break; | 332 | break; |
374 | case IRQ_TYPE_EDGE_BOTH: | 333 | case IRQ_TYPE_EDGE_BOTH: |
375 | dln2->irq_work[pin].type = DLN2_GPIO_EVENT_CHANGE; | 334 | dln2->irq_type[pin] = DLN2_GPIO_EVENT_CHANGE; |
376 | break; | 335 | break; |
377 | case IRQ_TYPE_EDGE_RISING: | 336 | case IRQ_TYPE_EDGE_RISING: |
378 | dln2->irq_work[pin].type = DLN2_GPIO_EVENT_CHANGE_RISING; | 337 | dln2->irq_type[pin] = DLN2_GPIO_EVENT_CHANGE_RISING; |
379 | break; | 338 | break; |
380 | case IRQ_TYPE_EDGE_FALLING: | 339 | case IRQ_TYPE_EDGE_FALLING: |
381 | dln2->irq_work[pin].type = DLN2_GPIO_EVENT_CHANGE_FALLING; | 340 | dln2->irq_type[pin] = DLN2_GPIO_EVENT_CHANGE_FALLING; |
382 | break; | 341 | break; |
383 | default: | 342 | default: |
384 | return -EINVAL; | 343 | return -EINVAL; |
@@ -387,13 +346,50 @@ static int dln2_irq_set_type(struct irq_data *irqd, unsigned type) | |||
387 | return 0; | 346 | return 0; |
388 | } | 347 | } |
389 | 348 | ||
349 | static void dln2_irq_bus_lock(struct irq_data *irqd) | ||
350 | { | ||
351 | struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd); | ||
352 | struct dln2_gpio *dln2 = container_of(gc, struct dln2_gpio, gpio); | ||
353 | |||
354 | mutex_lock(&dln2->irq_lock); | ||
355 | } | ||
356 | |||
357 | static void dln2_irq_bus_unlock(struct irq_data *irqd) | ||
358 | { | ||
359 | struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd); | ||
360 | struct dln2_gpio *dln2 = container_of(gc, struct dln2_gpio, gpio); | ||
361 | int pin = irqd_to_hwirq(irqd); | ||
362 | int enabled, unmasked; | ||
363 | unsigned type; | ||
364 | int ret; | ||
365 | |||
366 | enabled = test_bit(pin, dln2->enabled_irqs); | ||
367 | unmasked = test_bit(pin, dln2->unmasked_irqs); | ||
368 | |||
369 | if (enabled != unmasked) { | ||
370 | if (unmasked) { | ||
371 | type = dln2->irq_type[pin] & DLN2_GPIO_EVENT_MASK; | ||
372 | set_bit(pin, dln2->enabled_irqs); | ||
373 | } else { | ||
374 | type = DLN2_GPIO_EVENT_NONE; | ||
375 | clear_bit(pin, dln2->enabled_irqs); | ||
376 | } | ||
377 | |||
378 | ret = dln2_gpio_set_event_cfg(dln2, pin, type, 0); | ||
379 | if (ret) | ||
380 | dev_err(dln2->gpio.dev, "failed to set event\n"); | ||
381 | } | ||
382 | |||
383 | mutex_unlock(&dln2->irq_lock); | ||
384 | } | ||
385 | |||
390 | static struct irq_chip dln2_gpio_irqchip = { | 386 | static struct irq_chip dln2_gpio_irqchip = { |
391 | .name = "dln2-irq", | 387 | .name = "dln2-irq", |
392 | .irq_enable = dln2_irq_enable, | ||
393 | .irq_disable = dln2_irq_disable, | ||
394 | .irq_mask = dln2_irq_mask, | 388 | .irq_mask = dln2_irq_mask, |
395 | .irq_unmask = dln2_irq_unmask, | 389 | .irq_unmask = dln2_irq_unmask, |
396 | .irq_set_type = dln2_irq_set_type, | 390 | .irq_set_type = dln2_irq_set_type, |
391 | .irq_bus_lock = dln2_irq_bus_lock, | ||
392 | .irq_bus_sync_unlock = dln2_irq_bus_unlock, | ||
397 | }; | 393 | }; |
398 | 394 | ||
399 | static void dln2_gpio_event(struct platform_device *pdev, u16 echo, | 395 | static void dln2_gpio_event(struct platform_device *pdev, u16 echo, |
@@ -425,14 +421,7 @@ static void dln2_gpio_event(struct platform_device *pdev, u16 echo, | |||
425 | return; | 421 | return; |
426 | } | 422 | } |
427 | 423 | ||
428 | if (!test_bit(pin, dln2->irqs_enabled)) | 424 | switch (dln2->irq_type[pin]) { |
429 | return; | ||
430 | if (test_bit(pin, dln2->irqs_masked)) { | ||
431 | set_bit(pin, dln2->irqs_pending); | ||
432 | return; | ||
433 | } | ||
434 | |||
435 | switch (dln2->irq_work[pin].type) { | ||
436 | case DLN2_GPIO_EVENT_CHANGE_RISING: | 425 | case DLN2_GPIO_EVENT_CHANGE_RISING: |
437 | if (event->value) | 426 | if (event->value) |
438 | generic_handle_irq(irq); | 427 | generic_handle_irq(irq); |
@@ -451,7 +440,7 @@ static int dln2_gpio_probe(struct platform_device *pdev) | |||
451 | struct dln2_gpio *dln2; | 440 | struct dln2_gpio *dln2; |
452 | struct device *dev = &pdev->dev; | 441 | struct device *dev = &pdev->dev; |
453 | int pins; | 442 | int pins; |
454 | int i, ret; | 443 | int ret; |
455 | 444 | ||
456 | pins = dln2_gpio_get_pin_count(pdev); | 445 | pins = dln2_gpio_get_pin_count(pdev); |
457 | if (pins < 0) { | 446 | if (pins < 0) { |
@@ -467,15 +456,7 @@ static int dln2_gpio_probe(struct platform_device *pdev) | |||
467 | if (!dln2) | 456 | if (!dln2) |
468 | return -ENOMEM; | 457 | return -ENOMEM; |
469 | 458 | ||
470 | dln2->irq_work = devm_kcalloc(&pdev->dev, pins, | 459 | mutex_init(&dln2->irq_lock); |
471 | sizeof(struct dln2_irq_work), GFP_KERNEL); | ||
472 | if (!dln2->irq_work) | ||
473 | return -ENOMEM; | ||
474 | for (i = 0; i < pins; i++) { | ||
475 | INIT_WORK(&dln2->irq_work[i].work, dln2_irq_work); | ||
476 | dln2->irq_work[i].pin = i; | ||
477 | dln2->irq_work[i].dln2 = dln2; | ||
478 | } | ||
479 | 460 | ||
480 | dln2->pdev = pdev; | 461 | dln2->pdev = pdev; |
481 | 462 | ||
@@ -529,11 +510,8 @@ out: | |||
529 | static int dln2_gpio_remove(struct platform_device *pdev) | 510 | static int dln2_gpio_remove(struct platform_device *pdev) |
530 | { | 511 | { |
531 | struct dln2_gpio *dln2 = platform_get_drvdata(pdev); | 512 | struct dln2_gpio *dln2 = platform_get_drvdata(pdev); |
532 | int i; | ||
533 | 513 | ||
534 | dln2_unregister_event_cb(pdev, DLN2_GPIO_CONDITION_MET_EV); | 514 | dln2_unregister_event_cb(pdev, DLN2_GPIO_CONDITION_MET_EV); |
535 | for (i = 0; i < dln2->gpio.ngpio; i++) | ||
536 | flush_work(&dln2->irq_work[i].work); | ||
537 | gpiochip_remove(&dln2->gpio); | 515 | gpiochip_remove(&dln2->gpio); |
538 | 516 | ||
539 | return 0; | 517 | return 0; |
diff --git a/drivers/gpio/gpio-grgpio.c b/drivers/gpio/gpio-grgpio.c index 09daaf2aeb56..3a5a71050559 100644 --- a/drivers/gpio/gpio-grgpio.c +++ b/drivers/gpio/gpio-grgpio.c | |||
@@ -441,7 +441,8 @@ static int grgpio_probe(struct platform_device *ofdev) | |||
441 | err = gpiochip_add(gc); | 441 | err = gpiochip_add(gc); |
442 | if (err) { | 442 | if (err) { |
443 | dev_err(&ofdev->dev, "Could not add gpiochip\n"); | 443 | dev_err(&ofdev->dev, "Could not add gpiochip\n"); |
444 | irq_domain_remove(priv->domain); | 444 | if (priv->domain) |
445 | irq_domain_remove(priv->domain); | ||
445 | return err; | 446 | return err; |
446 | } | 447 | } |
447 | 448 | ||
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 66e40398b3d3..e620807418ea 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile | |||
@@ -37,6 +37,7 @@ obj-$(CONFIG_DRM_MIPI_DSI) += drm_mipi_dsi.o | |||
37 | obj-$(CONFIG_DRM_TTM) += ttm/ | 37 | obj-$(CONFIG_DRM_TTM) += ttm/ |
38 | obj-$(CONFIG_DRM_TDFX) += tdfx/ | 38 | obj-$(CONFIG_DRM_TDFX) += tdfx/ |
39 | obj-$(CONFIG_DRM_R128) += r128/ | 39 | obj-$(CONFIG_DRM_R128) += r128/ |
40 | obj-$(CONFIG_HSA_AMD) += amd/amdkfd/ | ||
40 | obj-$(CONFIG_DRM_RADEON)+= radeon/ | 41 | obj-$(CONFIG_DRM_RADEON)+= radeon/ |
41 | obj-$(CONFIG_DRM_MGA) += mga/ | 42 | obj-$(CONFIG_DRM_MGA) += mga/ |
42 | obj-$(CONFIG_DRM_I810) += i810/ | 43 | obj-$(CONFIG_DRM_I810) += i810/ |
@@ -67,4 +68,3 @@ obj-$(CONFIG_DRM_IMX) += imx/ | |||
67 | obj-y += i2c/ | 68 | obj-y += i2c/ |
68 | obj-y += panel/ | 69 | obj-y += panel/ |
69 | obj-y += bridge/ | 70 | obj-y += bridge/ |
70 | obj-$(CONFIG_HSA_AMD) += amd/amdkfd/ | ||
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c index 7d4974b83af7..fcfdf23e1913 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <uapi/linux/kfd_ioctl.h> | 31 | #include <uapi/linux/kfd_ioctl.h> |
32 | #include <linux/time.h> | 32 | #include <linux/time.h> |
33 | #include <linux/mm.h> | 33 | #include <linux/mm.h> |
34 | #include <linux/uaccess.h> | ||
35 | #include <uapi/asm-generic/mman-common.h> | 34 | #include <uapi/asm-generic/mman-common.h> |
36 | #include <asm/processor.h> | 35 | #include <asm/processor.h> |
37 | #include "kfd_priv.h" | 36 | #include "kfd_priv.h" |
@@ -127,17 +126,14 @@ static int kfd_open(struct inode *inode, struct file *filep) | |||
127 | return 0; | 126 | return 0; |
128 | } | 127 | } |
129 | 128 | ||
130 | static long kfd_ioctl_get_version(struct file *filep, struct kfd_process *p, | 129 | static int kfd_ioctl_get_version(struct file *filep, struct kfd_process *p, |
131 | void __user *arg) | 130 | void *data) |
132 | { | 131 | { |
133 | struct kfd_ioctl_get_version_args args; | 132 | struct kfd_ioctl_get_version_args *args = data; |
134 | int err = 0; | 133 | int err = 0; |
135 | 134 | ||
136 | args.major_version = KFD_IOCTL_MAJOR_VERSION; | 135 | args->major_version = KFD_IOCTL_MAJOR_VERSION; |
137 | args.minor_version = KFD_IOCTL_MINOR_VERSION; | 136 | args->minor_version = KFD_IOCTL_MINOR_VERSION; |
138 | |||
139 | if (copy_to_user(arg, &args, sizeof(args))) | ||
140 | err = -EFAULT; | ||
141 | 137 | ||
142 | return err; | 138 | return err; |
143 | } | 139 | } |
@@ -221,10 +217,10 @@ static int set_queue_properties_from_user(struct queue_properties *q_properties, | |||
221 | return 0; | 217 | return 0; |
222 | } | 218 | } |
223 | 219 | ||
224 | static long kfd_ioctl_create_queue(struct file *filep, struct kfd_process *p, | 220 | static int kfd_ioctl_create_queue(struct file *filep, struct kfd_process *p, |
225 | void __user *arg) | 221 | void *data) |
226 | { | 222 | { |
227 | struct kfd_ioctl_create_queue_args args; | 223 | struct kfd_ioctl_create_queue_args *args = data; |
228 | struct kfd_dev *dev; | 224 | struct kfd_dev *dev; |
229 | int err = 0; | 225 | int err = 0; |
230 | unsigned int queue_id; | 226 | unsigned int queue_id; |
@@ -233,16 +229,13 @@ static long kfd_ioctl_create_queue(struct file *filep, struct kfd_process *p, | |||
233 | 229 | ||
234 | memset(&q_properties, 0, sizeof(struct queue_properties)); | 230 | memset(&q_properties, 0, sizeof(struct queue_properties)); |
235 | 231 | ||
236 | if (copy_from_user(&args, arg, sizeof(args))) | ||
237 | return -EFAULT; | ||
238 | |||
239 | pr_debug("kfd: creating queue ioctl\n"); | 232 | pr_debug("kfd: creating queue ioctl\n"); |
240 | 233 | ||
241 | err = set_queue_properties_from_user(&q_properties, &args); | 234 | err = set_queue_properties_from_user(&q_properties, args); |
242 | if (err) | 235 | if (err) |
243 | return err; | 236 | return err; |
244 | 237 | ||
245 | dev = kfd_device_by_id(args.gpu_id); | 238 | dev = kfd_device_by_id(args->gpu_id); |
246 | if (dev == NULL) | 239 | if (dev == NULL) |
247 | return -EINVAL; | 240 | return -EINVAL; |
248 | 241 | ||
@@ -250,7 +243,7 @@ static long kfd_ioctl_create_queue(struct file *filep, struct kfd_process *p, | |||
250 | 243 | ||
251 | pdd = kfd_bind_process_to_device(dev, p); | 244 | pdd = kfd_bind_process_to_device(dev, p); |
252 | if (IS_ERR(pdd)) { | 245 | if (IS_ERR(pdd)) { |
253 | err = PTR_ERR(pdd); | 246 | err = -ESRCH; |
254 | goto err_bind_process; | 247 | goto err_bind_process; |
255 | } | 248 | } |
256 | 249 | ||
@@ -263,33 +256,26 @@ static long kfd_ioctl_create_queue(struct file *filep, struct kfd_process *p, | |||
263 | if (err != 0) | 256 | if (err != 0) |
264 | goto err_create_queue; | 257 | goto err_create_queue; |
265 | 258 | ||
266 | args.queue_id = queue_id; | 259 | args->queue_id = queue_id; |
267 | 260 | ||
268 | /* Return gpu_id as doorbell offset for mmap usage */ | 261 | /* Return gpu_id as doorbell offset for mmap usage */ |
269 | args.doorbell_offset = args.gpu_id << PAGE_SHIFT; | 262 | args->doorbell_offset = args->gpu_id << PAGE_SHIFT; |
270 | |||
271 | if (copy_to_user(arg, &args, sizeof(args))) { | ||
272 | err = -EFAULT; | ||
273 | goto err_copy_args_out; | ||
274 | } | ||
275 | 263 | ||
276 | mutex_unlock(&p->mutex); | 264 | mutex_unlock(&p->mutex); |
277 | 265 | ||
278 | pr_debug("kfd: queue id %d was created successfully\n", args.queue_id); | 266 | pr_debug("kfd: queue id %d was created successfully\n", args->queue_id); |
279 | 267 | ||
280 | pr_debug("ring buffer address == 0x%016llX\n", | 268 | pr_debug("ring buffer address == 0x%016llX\n", |
281 | args.ring_base_address); | 269 | args->ring_base_address); |
282 | 270 | ||
283 | pr_debug("read ptr address == 0x%016llX\n", | 271 | pr_debug("read ptr address == 0x%016llX\n", |
284 | args.read_pointer_address); | 272 | args->read_pointer_address); |
285 | 273 | ||
286 | pr_debug("write ptr address == 0x%016llX\n", | 274 | pr_debug("write ptr address == 0x%016llX\n", |
287 | args.write_pointer_address); | 275 | args->write_pointer_address); |
288 | 276 | ||
289 | return 0; | 277 | return 0; |
290 | 278 | ||
291 | err_copy_args_out: | ||
292 | pqm_destroy_queue(&p->pqm, queue_id); | ||
293 | err_create_queue: | 279 | err_create_queue: |
294 | err_bind_process: | 280 | err_bind_process: |
295 | mutex_unlock(&p->mutex); | 281 | mutex_unlock(&p->mutex); |
@@ -297,99 +283,90 @@ err_bind_process: | |||
297 | } | 283 | } |
298 | 284 | ||
299 | static int kfd_ioctl_destroy_queue(struct file *filp, struct kfd_process *p, | 285 | static int kfd_ioctl_destroy_queue(struct file *filp, struct kfd_process *p, |
300 | void __user *arg) | 286 | void *data) |
301 | { | 287 | { |
302 | int retval; | 288 | int retval; |
303 | struct kfd_ioctl_destroy_queue_args args; | 289 | struct kfd_ioctl_destroy_queue_args *args = data; |
304 | |||
305 | if (copy_from_user(&args, arg, sizeof(args))) | ||
306 | return -EFAULT; | ||
307 | 290 | ||
308 | pr_debug("kfd: destroying queue id %d for PASID %d\n", | 291 | pr_debug("kfd: destroying queue id %d for PASID %d\n", |
309 | args.queue_id, | 292 | args->queue_id, |
310 | p->pasid); | 293 | p->pasid); |
311 | 294 | ||
312 | mutex_lock(&p->mutex); | 295 | mutex_lock(&p->mutex); |
313 | 296 | ||
314 | retval = pqm_destroy_queue(&p->pqm, args.queue_id); | 297 | retval = pqm_destroy_queue(&p->pqm, args->queue_id); |
315 | 298 | ||
316 | mutex_unlock(&p->mutex); | 299 | mutex_unlock(&p->mutex); |
317 | return retval; | 300 | return retval; |
318 | } | 301 | } |
319 | 302 | ||
320 | static int kfd_ioctl_update_queue(struct file *filp, struct kfd_process *p, | 303 | static int kfd_ioctl_update_queue(struct file *filp, struct kfd_process *p, |
321 | void __user *arg) | 304 | void *data) |
322 | { | 305 | { |
323 | int retval; | 306 | int retval; |
324 | struct kfd_ioctl_update_queue_args args; | 307 | struct kfd_ioctl_update_queue_args *args = data; |
325 | struct queue_properties properties; | 308 | struct queue_properties properties; |
326 | 309 | ||
327 | if (copy_from_user(&args, arg, sizeof(args))) | 310 | if (args->queue_percentage > KFD_MAX_QUEUE_PERCENTAGE) { |
328 | return -EFAULT; | ||
329 | |||
330 | if (args.queue_percentage > KFD_MAX_QUEUE_PERCENTAGE) { | ||
331 | pr_err("kfd: queue percentage must be between 0 to KFD_MAX_QUEUE_PERCENTAGE\n"); | 311 | pr_err("kfd: queue percentage must be between 0 to KFD_MAX_QUEUE_PERCENTAGE\n"); |
332 | return -EINVAL; | 312 | return -EINVAL; |
333 | } | 313 | } |
334 | 314 | ||
335 | if (args.queue_priority > KFD_MAX_QUEUE_PRIORITY) { | 315 | if (args->queue_priority > KFD_MAX_QUEUE_PRIORITY) { |
336 | pr_err("kfd: queue priority must be between 0 to KFD_MAX_QUEUE_PRIORITY\n"); | 316 | pr_err("kfd: queue priority must be between 0 to KFD_MAX_QUEUE_PRIORITY\n"); |
337 | return -EINVAL; | 317 | return -EINVAL; |
338 | } | 318 | } |
339 | 319 | ||
340 | if ((args.ring_base_address) && | 320 | if ((args->ring_base_address) && |
341 | (!access_ok(VERIFY_WRITE, | 321 | (!access_ok(VERIFY_WRITE, |
342 | (const void __user *) args.ring_base_address, | 322 | (const void __user *) args->ring_base_address, |
343 | sizeof(uint64_t)))) { | 323 | sizeof(uint64_t)))) { |
344 | pr_err("kfd: can't access ring base address\n"); | 324 | pr_err("kfd: can't access ring base address\n"); |
345 | return -EFAULT; | 325 | return -EFAULT; |
346 | } | 326 | } |
347 | 327 | ||
348 | if (!is_power_of_2(args.ring_size) && (args.ring_size != 0)) { | 328 | if (!is_power_of_2(args->ring_size) && (args->ring_size != 0)) { |
349 | pr_err("kfd: ring size must be a power of 2 or 0\n"); | 329 | pr_err("kfd: ring size must be a power of 2 or 0\n"); |
350 | return -EINVAL; | 330 | return -EINVAL; |
351 | } | 331 | } |
352 | 332 | ||
353 | properties.queue_address = args.ring_base_address; | 333 | properties.queue_address = args->ring_base_address; |
354 | properties.queue_size = args.ring_size; | 334 | properties.queue_size = args->ring_size; |
355 | properties.queue_percent = args.queue_percentage; | 335 | properties.queue_percent = args->queue_percentage; |
356 | properties.priority = args.queue_priority; | 336 | properties.priority = args->queue_priority; |
357 | 337 | ||
358 | pr_debug("kfd: updating queue id %d for PASID %d\n", | 338 | pr_debug("kfd: updating queue id %d for PASID %d\n", |
359 | args.queue_id, p->pasid); | 339 | args->queue_id, p->pasid); |
360 | 340 | ||
361 | mutex_lock(&p->mutex); | 341 | mutex_lock(&p->mutex); |
362 | 342 | ||
363 | retval = pqm_update_queue(&p->pqm, args.queue_id, &properties); | 343 | retval = pqm_update_queue(&p->pqm, args->queue_id, &properties); |
364 | 344 | ||
365 | mutex_unlock(&p->mutex); | 345 | mutex_unlock(&p->mutex); |
366 | 346 | ||
367 | return retval; | 347 | return retval; |
368 | } | 348 | } |
369 | 349 | ||
370 | static long kfd_ioctl_set_memory_policy(struct file *filep, | 350 | static int kfd_ioctl_set_memory_policy(struct file *filep, |
371 | struct kfd_process *p, void __user *arg) | 351 | struct kfd_process *p, void *data) |
372 | { | 352 | { |
373 | struct kfd_ioctl_set_memory_policy_args args; | 353 | struct kfd_ioctl_set_memory_policy_args *args = data; |
374 | struct kfd_dev *dev; | 354 | struct kfd_dev *dev; |
375 | int err = 0; | 355 | int err = 0; |
376 | struct kfd_process_device *pdd; | 356 | struct kfd_process_device *pdd; |
377 | enum cache_policy default_policy, alternate_policy; | 357 | enum cache_policy default_policy, alternate_policy; |
378 | 358 | ||
379 | if (copy_from_user(&args, arg, sizeof(args))) | 359 | if (args->default_policy != KFD_IOC_CACHE_POLICY_COHERENT |
380 | return -EFAULT; | 360 | && args->default_policy != KFD_IOC_CACHE_POLICY_NONCOHERENT) { |
381 | |||
382 | if (args.default_policy != KFD_IOC_CACHE_POLICY_COHERENT | ||
383 | && args.default_policy != KFD_IOC_CACHE_POLICY_NONCOHERENT) { | ||
384 | return -EINVAL; | 361 | return -EINVAL; |
385 | } | 362 | } |
386 | 363 | ||
387 | if (args.alternate_policy != KFD_IOC_CACHE_POLICY_COHERENT | 364 | if (args->alternate_policy != KFD_IOC_CACHE_POLICY_COHERENT |
388 | && args.alternate_policy != KFD_IOC_CACHE_POLICY_NONCOHERENT) { | 365 | && args->alternate_policy != KFD_IOC_CACHE_POLICY_NONCOHERENT) { |
389 | return -EINVAL; | 366 | return -EINVAL; |
390 | } | 367 | } |
391 | 368 | ||
392 | dev = kfd_device_by_id(args.gpu_id); | 369 | dev = kfd_device_by_id(args->gpu_id); |
393 | if (dev == NULL) | 370 | if (dev == NULL) |
394 | return -EINVAL; | 371 | return -EINVAL; |
395 | 372 | ||
@@ -397,23 +374,23 @@ static long kfd_ioctl_set_memory_policy(struct file *filep, | |||
397 | 374 | ||
398 | pdd = kfd_bind_process_to_device(dev, p); | 375 | pdd = kfd_bind_process_to_device(dev, p); |
399 | if (IS_ERR(pdd)) { | 376 | if (IS_ERR(pdd)) { |
400 | err = PTR_ERR(pdd); | 377 | err = -ESRCH; |
401 | goto out; | 378 | goto out; |
402 | } | 379 | } |
403 | 380 | ||
404 | default_policy = (args.default_policy == KFD_IOC_CACHE_POLICY_COHERENT) | 381 | default_policy = (args->default_policy == KFD_IOC_CACHE_POLICY_COHERENT) |
405 | ? cache_policy_coherent : cache_policy_noncoherent; | 382 | ? cache_policy_coherent : cache_policy_noncoherent; |
406 | 383 | ||
407 | alternate_policy = | 384 | alternate_policy = |
408 | (args.alternate_policy == KFD_IOC_CACHE_POLICY_COHERENT) | 385 | (args->alternate_policy == KFD_IOC_CACHE_POLICY_COHERENT) |
409 | ? cache_policy_coherent : cache_policy_noncoherent; | 386 | ? cache_policy_coherent : cache_policy_noncoherent; |
410 | 387 | ||
411 | if (!dev->dqm->set_cache_memory_policy(dev->dqm, | 388 | if (!dev->dqm->set_cache_memory_policy(dev->dqm, |
412 | &pdd->qpd, | 389 | &pdd->qpd, |
413 | default_policy, | 390 | default_policy, |
414 | alternate_policy, | 391 | alternate_policy, |
415 | (void __user *)args.alternate_aperture_base, | 392 | (void __user *)args->alternate_aperture_base, |
416 | args.alternate_aperture_size)) | 393 | args->alternate_aperture_size)) |
417 | err = -EINVAL; | 394 | err = -EINVAL; |
418 | 395 | ||
419 | out: | 396 | out: |
@@ -422,53 +399,44 @@ out: | |||
422 | return err; | 399 | return err; |
423 | } | 400 | } |
424 | 401 | ||
425 | static long kfd_ioctl_get_clock_counters(struct file *filep, | 402 | static int kfd_ioctl_get_clock_counters(struct file *filep, |
426 | struct kfd_process *p, void __user *arg) | 403 | struct kfd_process *p, void *data) |
427 | { | 404 | { |
428 | struct kfd_ioctl_get_clock_counters_args args; | 405 | struct kfd_ioctl_get_clock_counters_args *args = data; |
429 | struct kfd_dev *dev; | 406 | struct kfd_dev *dev; |
430 | struct timespec time; | 407 | struct timespec time; |
431 | 408 | ||
432 | if (copy_from_user(&args, arg, sizeof(args))) | 409 | dev = kfd_device_by_id(args->gpu_id); |
433 | return -EFAULT; | ||
434 | |||
435 | dev = kfd_device_by_id(args.gpu_id); | ||
436 | if (dev == NULL) | 410 | if (dev == NULL) |
437 | return -EINVAL; | 411 | return -EINVAL; |
438 | 412 | ||
439 | /* Reading GPU clock counter from KGD */ | 413 | /* Reading GPU clock counter from KGD */ |
440 | args.gpu_clock_counter = kfd2kgd->get_gpu_clock_counter(dev->kgd); | 414 | args->gpu_clock_counter = kfd2kgd->get_gpu_clock_counter(dev->kgd); |
441 | 415 | ||
442 | /* No access to rdtsc. Using raw monotonic time */ | 416 | /* No access to rdtsc. Using raw monotonic time */ |
443 | getrawmonotonic(&time); | 417 | getrawmonotonic(&time); |
444 | args.cpu_clock_counter = (uint64_t)timespec_to_ns(&time); | 418 | args->cpu_clock_counter = (uint64_t)timespec_to_ns(&time); |
445 | 419 | ||
446 | get_monotonic_boottime(&time); | 420 | get_monotonic_boottime(&time); |
447 | args.system_clock_counter = (uint64_t)timespec_to_ns(&time); | 421 | args->system_clock_counter = (uint64_t)timespec_to_ns(&time); |
448 | 422 | ||
449 | /* Since the counter is in nano-seconds we use 1GHz frequency */ | 423 | /* Since the counter is in nano-seconds we use 1GHz frequency */ |
450 | args.system_clock_freq = 1000000000; | 424 | args->system_clock_freq = 1000000000; |
451 | |||
452 | if (copy_to_user(arg, &args, sizeof(args))) | ||
453 | return -EFAULT; | ||
454 | 425 | ||
455 | return 0; | 426 | return 0; |
456 | } | 427 | } |
457 | 428 | ||
458 | 429 | ||
459 | static int kfd_ioctl_get_process_apertures(struct file *filp, | 430 | static int kfd_ioctl_get_process_apertures(struct file *filp, |
460 | struct kfd_process *p, void __user *arg) | 431 | struct kfd_process *p, void *data) |
461 | { | 432 | { |
462 | struct kfd_ioctl_get_process_apertures_args args; | 433 | struct kfd_ioctl_get_process_apertures_args *args = data; |
463 | struct kfd_process_device_apertures *pAperture; | 434 | struct kfd_process_device_apertures *pAperture; |
464 | struct kfd_process_device *pdd; | 435 | struct kfd_process_device *pdd; |
465 | 436 | ||
466 | dev_dbg(kfd_device, "get apertures for PASID %d", p->pasid); | 437 | dev_dbg(kfd_device, "get apertures for PASID %d", p->pasid); |
467 | 438 | ||
468 | if (copy_from_user(&args, arg, sizeof(args))) | 439 | args->num_of_nodes = 0; |
469 | return -EFAULT; | ||
470 | |||
471 | args.num_of_nodes = 0; | ||
472 | 440 | ||
473 | mutex_lock(&p->mutex); | 441 | mutex_lock(&p->mutex); |
474 | 442 | ||
@@ -477,7 +445,8 @@ static int kfd_ioctl_get_process_apertures(struct file *filp, | |||
477 | /* Run over all pdd of the process */ | 445 | /* Run over all pdd of the process */ |
478 | pdd = kfd_get_first_process_device_data(p); | 446 | pdd = kfd_get_first_process_device_data(p); |
479 | do { | 447 | do { |
480 | pAperture = &args.process_apertures[args.num_of_nodes]; | 448 | pAperture = |
449 | &args->process_apertures[args->num_of_nodes]; | ||
481 | pAperture->gpu_id = pdd->dev->id; | 450 | pAperture->gpu_id = pdd->dev->id; |
482 | pAperture->lds_base = pdd->lds_base; | 451 | pAperture->lds_base = pdd->lds_base; |
483 | pAperture->lds_limit = pdd->lds_limit; | 452 | pAperture->lds_limit = pdd->lds_limit; |
@@ -487,7 +456,7 @@ static int kfd_ioctl_get_process_apertures(struct file *filp, | |||
487 | pAperture->scratch_limit = pdd->scratch_limit; | 456 | pAperture->scratch_limit = pdd->scratch_limit; |
488 | 457 | ||
489 | dev_dbg(kfd_device, | 458 | dev_dbg(kfd_device, |
490 | "node id %u\n", args.num_of_nodes); | 459 | "node id %u\n", args->num_of_nodes); |
491 | dev_dbg(kfd_device, | 460 | dev_dbg(kfd_device, |
492 | "gpu id %u\n", pdd->dev->id); | 461 | "gpu id %u\n", pdd->dev->id); |
493 | dev_dbg(kfd_device, | 462 | dev_dbg(kfd_device, |
@@ -503,80 +472,131 @@ static int kfd_ioctl_get_process_apertures(struct file *filp, | |||
503 | dev_dbg(kfd_device, | 472 | dev_dbg(kfd_device, |
504 | "scratch_limit %llX\n", pdd->scratch_limit); | 473 | "scratch_limit %llX\n", pdd->scratch_limit); |
505 | 474 | ||
506 | args.num_of_nodes++; | 475 | args->num_of_nodes++; |
507 | } while ((pdd = kfd_get_next_process_device_data(p, pdd)) != NULL && | 476 | } while ((pdd = kfd_get_next_process_device_data(p, pdd)) != NULL && |
508 | (args.num_of_nodes < NUM_OF_SUPPORTED_GPUS)); | 477 | (args->num_of_nodes < NUM_OF_SUPPORTED_GPUS)); |
509 | } | 478 | } |
510 | 479 | ||
511 | mutex_unlock(&p->mutex); | 480 | mutex_unlock(&p->mutex); |
512 | 481 | ||
513 | if (copy_to_user(arg, &args, sizeof(args))) | ||
514 | return -EFAULT; | ||
515 | |||
516 | return 0; | 482 | return 0; |
517 | } | 483 | } |
518 | 484 | ||
485 | #define AMDKFD_IOCTL_DEF(ioctl, _func, _flags) \ | ||
486 | [_IOC_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags, .cmd_drv = 0, .name = #ioctl} | ||
487 | |||
488 | /** Ioctl table */ | ||
489 | static const struct amdkfd_ioctl_desc amdkfd_ioctls[] = { | ||
490 | AMDKFD_IOCTL_DEF(AMDKFD_IOC_GET_VERSION, | ||
491 | kfd_ioctl_get_version, 0), | ||
492 | |||
493 | AMDKFD_IOCTL_DEF(AMDKFD_IOC_CREATE_QUEUE, | ||
494 | kfd_ioctl_create_queue, 0), | ||
495 | |||
496 | AMDKFD_IOCTL_DEF(AMDKFD_IOC_DESTROY_QUEUE, | ||
497 | kfd_ioctl_destroy_queue, 0), | ||
498 | |||
499 | AMDKFD_IOCTL_DEF(AMDKFD_IOC_SET_MEMORY_POLICY, | ||
500 | kfd_ioctl_set_memory_policy, 0), | ||
501 | |||
502 | AMDKFD_IOCTL_DEF(AMDKFD_IOC_GET_CLOCK_COUNTERS, | ||
503 | kfd_ioctl_get_clock_counters, 0), | ||
504 | |||
505 | AMDKFD_IOCTL_DEF(AMDKFD_IOC_GET_PROCESS_APERTURES, | ||
506 | kfd_ioctl_get_process_apertures, 0), | ||
507 | |||
508 | AMDKFD_IOCTL_DEF(AMDKFD_IOC_UPDATE_QUEUE, | ||
509 | kfd_ioctl_update_queue, 0), | ||
510 | }; | ||
511 | |||
512 | #define AMDKFD_CORE_IOCTL_COUNT ARRAY_SIZE(amdkfd_ioctls) | ||
513 | |||
519 | static long kfd_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) | 514 | static long kfd_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) |
520 | { | 515 | { |
521 | struct kfd_process *process; | 516 | struct kfd_process *process; |
522 | long err = -EINVAL; | 517 | amdkfd_ioctl_t *func; |
518 | const struct amdkfd_ioctl_desc *ioctl = NULL; | ||
519 | unsigned int nr = _IOC_NR(cmd); | ||
520 | char stack_kdata[128]; | ||
521 | char *kdata = NULL; | ||
522 | unsigned int usize, asize; | ||
523 | int retcode = -EINVAL; | ||
523 | 524 | ||
524 | dev_dbg(kfd_device, | 525 | if (nr >= AMDKFD_CORE_IOCTL_COUNT) |
525 | "ioctl cmd 0x%x (#%d), arg 0x%lx\n", | 526 | goto err_i1; |
526 | cmd, _IOC_NR(cmd), arg); | 527 | |
528 | if ((nr >= AMDKFD_COMMAND_START) && (nr < AMDKFD_COMMAND_END)) { | ||
529 | u32 amdkfd_size; | ||
530 | |||
531 | ioctl = &amdkfd_ioctls[nr]; | ||
532 | |||
533 | amdkfd_size = _IOC_SIZE(ioctl->cmd); | ||
534 | usize = asize = _IOC_SIZE(cmd); | ||
535 | if (amdkfd_size > asize) | ||
536 | asize = amdkfd_size; | ||
537 | |||
538 | cmd = ioctl->cmd; | ||
539 | } else | ||
540 | goto err_i1; | ||
541 | |||
542 | dev_dbg(kfd_device, "ioctl cmd 0x%x (#%d), arg 0x%lx\n", cmd, nr, arg); | ||
527 | 543 | ||
528 | process = kfd_get_process(current); | 544 | process = kfd_get_process(current); |
529 | if (IS_ERR(process)) | 545 | if (IS_ERR(process)) { |
530 | return PTR_ERR(process); | 546 | dev_dbg(kfd_device, "no process\n"); |
547 | goto err_i1; | ||
548 | } | ||
531 | 549 | ||
532 | switch (cmd) { | 550 | /* Do not trust userspace, use our own definition */ |
533 | case KFD_IOC_GET_VERSION: | 551 | func = ioctl->func; |
534 | err = kfd_ioctl_get_version(filep, process, (void __user *)arg); | 552 | |
535 | break; | 553 | if (unlikely(!func)) { |
536 | case KFD_IOC_CREATE_QUEUE: | 554 | dev_dbg(kfd_device, "no function\n"); |
537 | err = kfd_ioctl_create_queue(filep, process, | 555 | retcode = -EINVAL; |
538 | (void __user *)arg); | 556 | goto err_i1; |
539 | break; | ||
540 | |||
541 | case KFD_IOC_DESTROY_QUEUE: | ||
542 | err = kfd_ioctl_destroy_queue(filep, process, | ||
543 | (void __user *)arg); | ||
544 | break; | ||
545 | |||
546 | case KFD_IOC_SET_MEMORY_POLICY: | ||
547 | err = kfd_ioctl_set_memory_policy(filep, process, | ||
548 | (void __user *)arg); | ||
549 | break; | ||
550 | |||
551 | case KFD_IOC_GET_CLOCK_COUNTERS: | ||
552 | err = kfd_ioctl_get_clock_counters(filep, process, | ||
553 | (void __user *)arg); | ||
554 | break; | ||
555 | |||
556 | case KFD_IOC_GET_PROCESS_APERTURES: | ||
557 | err = kfd_ioctl_get_process_apertures(filep, process, | ||
558 | (void __user *)arg); | ||
559 | break; | ||
560 | |||
561 | case KFD_IOC_UPDATE_QUEUE: | ||
562 | err = kfd_ioctl_update_queue(filep, process, | ||
563 | (void __user *)arg); | ||
564 | break; | ||
565 | |||
566 | default: | ||
567 | dev_err(kfd_device, | ||
568 | "unknown ioctl cmd 0x%x, arg 0x%lx)\n", | ||
569 | cmd, arg); | ||
570 | err = -EINVAL; | ||
571 | break; | ||
572 | } | 557 | } |
573 | 558 | ||
574 | if (err < 0) | 559 | if (cmd & (IOC_IN | IOC_OUT)) { |
575 | dev_err(kfd_device, | 560 | if (asize <= sizeof(stack_kdata)) { |
576 | "ioctl error %ld for ioctl cmd 0x%x (#%d)\n", | 561 | kdata = stack_kdata; |
577 | err, cmd, _IOC_NR(cmd)); | 562 | } else { |
563 | kdata = kmalloc(asize, GFP_KERNEL); | ||
564 | if (!kdata) { | ||
565 | retcode = -ENOMEM; | ||
566 | goto err_i1; | ||
567 | } | ||
568 | } | ||
569 | if (asize > usize) | ||
570 | memset(kdata + usize, 0, asize - usize); | ||
571 | } | ||
578 | 572 | ||
579 | return err; | 573 | if (cmd & IOC_IN) { |
574 | if (copy_from_user(kdata, (void __user *)arg, usize) != 0) { | ||
575 | retcode = -EFAULT; | ||
576 | goto err_i1; | ||
577 | } | ||
578 | } else if (cmd & IOC_OUT) { | ||
579 | memset(kdata, 0, usize); | ||
580 | } | ||
581 | |||
582 | retcode = func(filep, process, kdata); | ||
583 | |||
584 | if (cmd & IOC_OUT) | ||
585 | if (copy_to_user((void __user *)arg, kdata, usize) != 0) | ||
586 | retcode = -EFAULT; | ||
587 | |||
588 | err_i1: | ||
589 | if (!ioctl) | ||
590 | dev_dbg(kfd_device, "invalid ioctl: pid=%d, cmd=0x%02x, nr=0x%02x\n", | ||
591 | task_pid_nr(current), cmd, nr); | ||
592 | |||
593 | if (kdata != stack_kdata) | ||
594 | kfree(kdata); | ||
595 | |||
596 | if (retcode) | ||
597 | dev_dbg(kfd_device, "ret = %d\n", retcode); | ||
598 | |||
599 | return retcode; | ||
580 | } | 600 | } |
581 | 601 | ||
582 | static int kfd_mmap(struct file *filp, struct vm_area_struct *vma) | 602 | static int kfd_mmap(struct file *filp, struct vm_area_struct *vma) |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index 924e90c072e5..9c8961d22360 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | |||
@@ -161,6 +161,9 @@ static void deallocate_vmid(struct device_queue_manager *dqm, | |||
161 | { | 161 | { |
162 | int bit = qpd->vmid - KFD_VMID_START_OFFSET; | 162 | int bit = qpd->vmid - KFD_VMID_START_OFFSET; |
163 | 163 | ||
164 | /* Release the vmid mapping */ | ||
165 | set_pasid_vmid_mapping(dqm, 0, qpd->vmid); | ||
166 | |||
164 | set_bit(bit, (unsigned long *)&dqm->vmid_bitmap); | 167 | set_bit(bit, (unsigned long *)&dqm->vmid_bitmap); |
165 | qpd->vmid = 0; | 168 | qpd->vmid = 0; |
166 | q->properties.vmid = 0; | 169 | q->properties.vmid = 0; |
@@ -272,6 +275,18 @@ static int create_compute_queue_nocpsch(struct device_queue_manager *dqm, | |||
272 | return retval; | 275 | return retval; |
273 | } | 276 | } |
274 | 277 | ||
278 | pr_debug("kfd: loading mqd to hqd on pipe (%d) queue (%d)\n", | ||
279 | q->pipe, | ||
280 | q->queue); | ||
281 | |||
282 | retval = mqd->load_mqd(mqd, q->mqd, q->pipe, | ||
283 | q->queue, q->properties.write_ptr); | ||
284 | if (retval != 0) { | ||
285 | deallocate_hqd(dqm, q); | ||
286 | mqd->uninit_mqd(mqd, q->mqd, q->mqd_mem_obj); | ||
287 | return retval; | ||
288 | } | ||
289 | |||
275 | return 0; | 290 | return 0; |
276 | } | 291 | } |
277 | 292 | ||
@@ -320,6 +335,7 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q) | |||
320 | { | 335 | { |
321 | int retval; | 336 | int retval; |
322 | struct mqd_manager *mqd; | 337 | struct mqd_manager *mqd; |
338 | bool prev_active = false; | ||
323 | 339 | ||
324 | BUG_ON(!dqm || !q || !q->mqd); | 340 | BUG_ON(!dqm || !q || !q->mqd); |
325 | 341 | ||
@@ -330,10 +346,18 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q) | |||
330 | return -ENOMEM; | 346 | return -ENOMEM; |
331 | } | 347 | } |
332 | 348 | ||
333 | retval = mqd->update_mqd(mqd, q->mqd, &q->properties); | ||
334 | if (q->properties.is_active == true) | 349 | if (q->properties.is_active == true) |
350 | prev_active = true; | ||
351 | |||
352 | /* | ||
353 | * | ||
354 | * check active state vs. the previous state | ||
355 | * and modify counter accordingly | ||
356 | */ | ||
357 | retval = mqd->update_mqd(mqd, q->mqd, &q->properties); | ||
358 | if ((q->properties.is_active == true) && (prev_active == false)) | ||
335 | dqm->queue_count++; | 359 | dqm->queue_count++; |
336 | else | 360 | else if ((q->properties.is_active == false) && (prev_active == true)) |
337 | dqm->queue_count--; | 361 | dqm->queue_count--; |
338 | 362 | ||
339 | if (sched_policy != KFD_SCHED_POLICY_NO_HWS) | 363 | if (sched_policy != KFD_SCHED_POLICY_NO_HWS) |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c index adc31474e786..4c3828cf45bf 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c | |||
@@ -184,7 +184,7 @@ static bool is_occupied(struct mqd_manager *mm, void *mqd, | |||
184 | uint32_t queue_id) | 184 | uint32_t queue_id) |
185 | { | 185 | { |
186 | 186 | ||
187 | return kfd2kgd->hqd_is_occupies(mm->dev->kgd, queue_address, | 187 | return kfd2kgd->hqd_is_occupied(mm->dev->kgd, queue_address, |
188 | pipe_id, queue_id); | 188 | pipe_id, queue_id); |
189 | 189 | ||
190 | } | 190 | } |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_pasid.c b/drivers/gpu/drm/amd/amdkfd/kfd_pasid.c index 71699ad97d74..4c25ef504f79 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_pasid.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_pasid.c | |||
@@ -32,7 +32,7 @@ int kfd_pasid_init(void) | |||
32 | { | 32 | { |
33 | pasid_limit = max_num_of_processes; | 33 | pasid_limit = max_num_of_processes; |
34 | 34 | ||
35 | pasid_bitmap = kzalloc(BITS_TO_LONGS(pasid_limit), GFP_KERNEL); | 35 | pasid_bitmap = kcalloc(BITS_TO_LONGS(pasid_limit), sizeof(long), GFP_KERNEL); |
36 | if (!pasid_bitmap) | 36 | if (!pasid_bitmap) |
37 | return -ENOMEM; | 37 | return -ENOMEM; |
38 | 38 | ||
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h index f9fb81e3bb09..a5edb29507e3 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h | |||
@@ -463,6 +463,24 @@ struct kfd_process { | |||
463 | bool is_32bit_user_mode; | 463 | bool is_32bit_user_mode; |
464 | }; | 464 | }; |
465 | 465 | ||
466 | /** | ||
467 | * Ioctl function type. | ||
468 | * | ||
469 | * \param filep pointer to file structure. | ||
470 | * \param p amdkfd process pointer. | ||
471 | * \param data pointer to arg that was copied from user. | ||
472 | */ | ||
473 | typedef int amdkfd_ioctl_t(struct file *filep, struct kfd_process *p, | ||
474 | void *data); | ||
475 | |||
476 | struct amdkfd_ioctl_desc { | ||
477 | unsigned int cmd; | ||
478 | int flags; | ||
479 | amdkfd_ioctl_t *func; | ||
480 | unsigned int cmd_drv; | ||
481 | const char *name; | ||
482 | }; | ||
483 | |||
466 | void kfd_process_create_wq(void); | 484 | void kfd_process_create_wq(void); |
467 | void kfd_process_destroy_wq(void); | 485 | void kfd_process_destroy_wq(void); |
468 | struct kfd_process *kfd_create_process(const struct task_struct *); | 486 | struct kfd_process *kfd_create_process(const struct task_struct *); |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c index b11792d7e70e..cca1708fd811 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c | |||
@@ -921,7 +921,7 @@ static int kfd_build_sysfs_node_tree(void) | |||
921 | uint32_t i = 0; | 921 | uint32_t i = 0; |
922 | 922 | ||
923 | list_for_each_entry(dev, &topology_device_list, list) { | 923 | list_for_each_entry(dev, &topology_device_list, list) { |
924 | ret = kfd_build_sysfs_node_entry(dev, 0); | 924 | ret = kfd_build_sysfs_node_entry(dev, i); |
925 | if (ret < 0) | 925 | if (ret < 0) |
926 | return ret; | 926 | return ret; |
927 | i++; | 927 | i++; |
diff --git a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h index 47b551970a14..96a512208fad 100644 --- a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h +++ b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h | |||
@@ -183,7 +183,7 @@ struct kfd2kgd_calls { | |||
183 | int (*hqd_load)(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id, | 183 | int (*hqd_load)(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id, |
184 | uint32_t queue_id, uint32_t __user *wptr); | 184 | uint32_t queue_id, uint32_t __user *wptr); |
185 | 185 | ||
186 | bool (*hqd_is_occupies)(struct kgd_dev *kgd, uint64_t queue_address, | 186 | bool (*hqd_is_occupied)(struct kgd_dev *kgd, uint64_t queue_address, |
187 | uint32_t pipe_id, uint32_t queue_id); | 187 | uint32_t pipe_id, uint32_t queue_id); |
188 | 188 | ||
189 | int (*hqd_destroy)(struct kgd_dev *kgd, uint32_t reset_type, | 189 | int (*hqd_destroy)(struct kgd_dev *kgd, uint32_t reset_type, |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 70d0f0f06f1a..e9f891c432f8 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1756,8 +1756,6 @@ struct drm_i915_private { | |||
1756 | */ | 1756 | */ |
1757 | struct workqueue_struct *dp_wq; | 1757 | struct workqueue_struct *dp_wq; |
1758 | 1758 | ||
1759 | uint32_t bios_vgacntr; | ||
1760 | |||
1761 | /* Abstract the submission mechanism (legacy ringbuffer or execlists) away */ | 1759 | /* Abstract the submission mechanism (legacy ringbuffer or execlists) away */ |
1762 | struct { | 1760 | struct { |
1763 | int (*do_execbuf)(struct drm_device *dev, struct drm_file *file, | 1761 | int (*do_execbuf)(struct drm_device *dev, struct drm_file *file, |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 52adcb680be3..c11603b4cf1d 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1048,6 +1048,7 @@ int | |||
1048 | i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, | 1048 | i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, |
1049 | struct drm_file *file) | 1049 | struct drm_file *file) |
1050 | { | 1050 | { |
1051 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1051 | struct drm_i915_gem_pwrite *args = data; | 1052 | struct drm_i915_gem_pwrite *args = data; |
1052 | struct drm_i915_gem_object *obj; | 1053 | struct drm_i915_gem_object *obj; |
1053 | int ret; | 1054 | int ret; |
@@ -1067,9 +1068,11 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, | |||
1067 | return -EFAULT; | 1068 | return -EFAULT; |
1068 | } | 1069 | } |
1069 | 1070 | ||
1071 | intel_runtime_pm_get(dev_priv); | ||
1072 | |||
1070 | ret = i915_mutex_lock_interruptible(dev); | 1073 | ret = i915_mutex_lock_interruptible(dev); |
1071 | if (ret) | 1074 | if (ret) |
1072 | return ret; | 1075 | goto put_rpm; |
1073 | 1076 | ||
1074 | obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle)); | 1077 | obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle)); |
1075 | if (&obj->base == NULL) { | 1078 | if (&obj->base == NULL) { |
@@ -1121,6 +1124,9 @@ out: | |||
1121 | drm_gem_object_unreference(&obj->base); | 1124 | drm_gem_object_unreference(&obj->base); |
1122 | unlock: | 1125 | unlock: |
1123 | mutex_unlock(&dev->struct_mutex); | 1126 | mutex_unlock(&dev->struct_mutex); |
1127 | put_rpm: | ||
1128 | intel_runtime_pm_put(dev_priv); | ||
1129 | |||
1124 | return ret; | 1130 | return ret; |
1125 | } | 1131 | } |
1126 | 1132 | ||
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 996c2931c499..d0d3dfbe6d2a 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -3725,8 +3725,6 @@ static bool i8xx_handle_vblank(struct drm_device *dev, | |||
3725 | if ((iir & flip_pending) == 0) | 3725 | if ((iir & flip_pending) == 0) |
3726 | goto check_page_flip; | 3726 | goto check_page_flip; |
3727 | 3727 | ||
3728 | intel_prepare_page_flip(dev, plane); | ||
3729 | |||
3730 | /* We detect FlipDone by looking for the change in PendingFlip from '1' | 3728 | /* We detect FlipDone by looking for the change in PendingFlip from '1' |
3731 | * to '0' on the following vblank, i.e. IIR has the Pendingflip | 3729 | * to '0' on the following vblank, i.e. IIR has the Pendingflip |
3732 | * asserted following the MI_DISPLAY_FLIP, but ISR is deasserted, hence | 3730 | * asserted following the MI_DISPLAY_FLIP, but ISR is deasserted, hence |
@@ -3736,6 +3734,7 @@ static bool i8xx_handle_vblank(struct drm_device *dev, | |||
3736 | if (I915_READ16(ISR) & flip_pending) | 3734 | if (I915_READ16(ISR) & flip_pending) |
3737 | goto check_page_flip; | 3735 | goto check_page_flip; |
3738 | 3736 | ||
3737 | intel_prepare_page_flip(dev, plane); | ||
3739 | intel_finish_page_flip(dev, pipe); | 3738 | intel_finish_page_flip(dev, pipe); |
3740 | return true; | 3739 | return true; |
3741 | 3740 | ||
@@ -3907,8 +3906,6 @@ static bool i915_handle_vblank(struct drm_device *dev, | |||
3907 | if ((iir & flip_pending) == 0) | 3906 | if ((iir & flip_pending) == 0) |
3908 | goto check_page_flip; | 3907 | goto check_page_flip; |
3909 | 3908 | ||
3910 | intel_prepare_page_flip(dev, plane); | ||
3911 | |||
3912 | /* We detect FlipDone by looking for the change in PendingFlip from '1' | 3909 | /* We detect FlipDone by looking for the change in PendingFlip from '1' |
3913 | * to '0' on the following vblank, i.e. IIR has the Pendingflip | 3910 | * to '0' on the following vblank, i.e. IIR has the Pendingflip |
3914 | * asserted following the MI_DISPLAY_FLIP, but ISR is deasserted, hence | 3911 | * asserted following the MI_DISPLAY_FLIP, but ISR is deasserted, hence |
@@ -3918,6 +3915,7 @@ static bool i915_handle_vblank(struct drm_device *dev, | |||
3918 | if (I915_READ(ISR) & flip_pending) | 3915 | if (I915_READ(ISR) & flip_pending) |
3919 | goto check_page_flip; | 3916 | goto check_page_flip; |
3920 | 3917 | ||
3918 | intel_prepare_page_flip(dev, plane); | ||
3921 | intel_finish_page_flip(dev, pipe); | 3919 | intel_finish_page_flip(dev, pipe); |
3922 | return true; | 3920 | return true; |
3923 | 3921 | ||
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index fb3e3d429191..e2af1383b179 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -13057,11 +13057,7 @@ static void i915_disable_vga(struct drm_device *dev) | |||
13057 | vga_put(dev->pdev, VGA_RSRC_LEGACY_IO); | 13057 | vga_put(dev->pdev, VGA_RSRC_LEGACY_IO); |
13058 | udelay(300); | 13058 | udelay(300); |
13059 | 13059 | ||
13060 | /* | 13060 | I915_WRITE(vga_reg, VGA_DISP_DISABLE); |
13061 | * Fujitsu-Siemens Lifebook S6010 (830) has problems resuming | ||
13062 | * from S3 without preserving (some of?) the other bits. | ||
13063 | */ | ||
13064 | I915_WRITE(vga_reg, dev_priv->bios_vgacntr | VGA_DISP_DISABLE); | ||
13065 | POSTING_READ(vga_reg); | 13061 | POSTING_READ(vga_reg); |
13066 | } | 13062 | } |
13067 | 13063 | ||
@@ -13146,8 +13142,6 @@ void intel_modeset_init(struct drm_device *dev) | |||
13146 | 13142 | ||
13147 | intel_shared_dpll_init(dev); | 13143 | intel_shared_dpll_init(dev); |
13148 | 13144 | ||
13149 | /* save the BIOS value before clobbering it */ | ||
13150 | dev_priv->bios_vgacntr = I915_READ(i915_vgacntrl_reg(dev)); | ||
13151 | /* Just disable it once at startup */ | 13145 | /* Just disable it once at startup */ |
13152 | i915_disable_vga(dev); | 13146 | i915_disable_vga(dev); |
13153 | intel_setup_outputs(dev); | 13147 | intel_setup_outputs(dev); |
diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c index f5a78d53e297..ac6da7102fbb 100644 --- a/drivers/gpu/drm/i915/intel_runtime_pm.c +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c | |||
@@ -615,29 +615,6 @@ static void chv_pipe_power_well_disable(struct drm_i915_private *dev_priv, | |||
615 | vlv_power_sequencer_reset(dev_priv); | 615 | vlv_power_sequencer_reset(dev_priv); |
616 | } | 616 | } |
617 | 617 | ||
618 | static void check_power_well_state(struct drm_i915_private *dev_priv, | ||
619 | struct i915_power_well *power_well) | ||
620 | { | ||
621 | bool enabled = power_well->ops->is_enabled(dev_priv, power_well); | ||
622 | |||
623 | if (power_well->always_on || !i915.disable_power_well) { | ||
624 | if (!enabled) | ||
625 | goto mismatch; | ||
626 | |||
627 | return; | ||
628 | } | ||
629 | |||
630 | if (enabled != (power_well->count > 0)) | ||
631 | goto mismatch; | ||
632 | |||
633 | return; | ||
634 | |||
635 | mismatch: | ||
636 | WARN(1, "state mismatch for '%s' (always_on %d hw state %d use-count %d disable_power_well %d\n", | ||
637 | power_well->name, power_well->always_on, enabled, | ||
638 | power_well->count, i915.disable_power_well); | ||
639 | } | ||
640 | |||
641 | /** | 618 | /** |
642 | * intel_display_power_get - grab a power domain reference | 619 | * intel_display_power_get - grab a power domain reference |
643 | * @dev_priv: i915 device instance | 620 | * @dev_priv: i915 device instance |
@@ -669,8 +646,6 @@ void intel_display_power_get(struct drm_i915_private *dev_priv, | |||
669 | power_well->ops->enable(dev_priv, power_well); | 646 | power_well->ops->enable(dev_priv, power_well); |
670 | power_well->hw_enabled = true; | 647 | power_well->hw_enabled = true; |
671 | } | 648 | } |
672 | |||
673 | check_power_well_state(dev_priv, power_well); | ||
674 | } | 649 | } |
675 | 650 | ||
676 | power_domains->domain_use_count[domain]++; | 651 | power_domains->domain_use_count[domain]++; |
@@ -709,8 +684,6 @@ void intel_display_power_put(struct drm_i915_private *dev_priv, | |||
709 | power_well->hw_enabled = false; | 684 | power_well->hw_enabled = false; |
710 | power_well->ops->disable(dev_priv, power_well); | 685 | power_well->ops->disable(dev_priv, power_well); |
711 | } | 686 | } |
712 | |||
713 | check_power_well_state(dev_priv, power_well); | ||
714 | } | 687 | } |
715 | 688 | ||
716 | mutex_unlock(&power_domains->lock); | 689 | mutex_unlock(&power_domains->lock); |
diff --git a/drivers/gpu/drm/nouveau/core/core/event.c b/drivers/gpu/drm/nouveau/core/core/event.c index ff2b434b3db4..760947e380c9 100644 --- a/drivers/gpu/drm/nouveau/core/core/event.c +++ b/drivers/gpu/drm/nouveau/core/core/event.c | |||
@@ -26,7 +26,7 @@ | |||
26 | void | 26 | void |
27 | nvkm_event_put(struct nvkm_event *event, u32 types, int index) | 27 | nvkm_event_put(struct nvkm_event *event, u32 types, int index) |
28 | { | 28 | { |
29 | BUG_ON(!spin_is_locked(&event->refs_lock)); | 29 | assert_spin_locked(&event->refs_lock); |
30 | while (types) { | 30 | while (types) { |
31 | int type = __ffs(types); types &= ~(1 << type); | 31 | int type = __ffs(types); types &= ~(1 << type); |
32 | if (--event->refs[index * event->types_nr + type] == 0) { | 32 | if (--event->refs[index * event->types_nr + type] == 0) { |
@@ -39,7 +39,7 @@ nvkm_event_put(struct nvkm_event *event, u32 types, int index) | |||
39 | void | 39 | void |
40 | nvkm_event_get(struct nvkm_event *event, u32 types, int index) | 40 | nvkm_event_get(struct nvkm_event *event, u32 types, int index) |
41 | { | 41 | { |
42 | BUG_ON(!spin_is_locked(&event->refs_lock)); | 42 | assert_spin_locked(&event->refs_lock); |
43 | while (types) { | 43 | while (types) { |
44 | int type = __ffs(types); types &= ~(1 << type); | 44 | int type = __ffs(types); types &= ~(1 << type); |
45 | if (++event->refs[index * event->types_nr + type] == 1) { | 45 | if (++event->refs[index * event->types_nr + type] == 1) { |
diff --git a/drivers/gpu/drm/nouveau/core/core/notify.c b/drivers/gpu/drm/nouveau/core/core/notify.c index d1bcde55e9d7..839a32577680 100644 --- a/drivers/gpu/drm/nouveau/core/core/notify.c +++ b/drivers/gpu/drm/nouveau/core/core/notify.c | |||
@@ -98,7 +98,7 @@ nvkm_notify_send(struct nvkm_notify *notify, void *data, u32 size) | |||
98 | struct nvkm_event *event = notify->event; | 98 | struct nvkm_event *event = notify->event; |
99 | unsigned long flags; | 99 | unsigned long flags; |
100 | 100 | ||
101 | BUG_ON(!spin_is_locked(&event->list_lock)); | 101 | assert_spin_locked(&event->list_lock); |
102 | BUG_ON(size != notify->size); | 102 | BUG_ON(size != notify->size); |
103 | 103 | ||
104 | spin_lock_irqsave(&event->refs_lock, flags); | 104 | spin_lock_irqsave(&event->refs_lock, flags); |
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/nve0.c b/drivers/gpu/drm/nouveau/core/engine/device/nve0.c index 674da1f095b2..732922690653 100644 --- a/drivers/gpu/drm/nouveau/core/engine/device/nve0.c +++ b/drivers/gpu/drm/nouveau/core/engine/device/nve0.c | |||
@@ -249,6 +249,39 @@ nve0_identify(struct nouveau_device *device) | |||
249 | device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; | 249 | device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; |
250 | device->oclass[NVDEV_ENGINE_PERFMON] = &nvf0_perfmon_oclass; | 250 | device->oclass[NVDEV_ENGINE_PERFMON] = &nvf0_perfmon_oclass; |
251 | break; | 251 | break; |
252 | case 0x106: | ||
253 | device->cname = "GK208B"; | ||
254 | device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; | ||
255 | device->oclass[NVDEV_SUBDEV_GPIO ] = nve0_gpio_oclass; | ||
256 | device->oclass[NVDEV_SUBDEV_I2C ] = nve0_i2c_oclass; | ||
257 | device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; | ||
258 | device->oclass[NVDEV_SUBDEV_CLOCK ] = &nve0_clock_oclass; | ||
259 | device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; | ||
260 | device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; | ||
261 | device->oclass[NVDEV_SUBDEV_DEVINIT] = nvc0_devinit_oclass; | ||
262 | device->oclass[NVDEV_SUBDEV_MC ] = gk20a_mc_oclass; | ||
263 | device->oclass[NVDEV_SUBDEV_BUS ] = nvc0_bus_oclass; | ||
264 | device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass; | ||
265 | device->oclass[NVDEV_SUBDEV_FB ] = nve0_fb_oclass; | ||
266 | device->oclass[NVDEV_SUBDEV_LTC ] = gk104_ltc_oclass; | ||
267 | device->oclass[NVDEV_SUBDEV_IBUS ] = &nve0_ibus_oclass; | ||
268 | device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; | ||
269 | device->oclass[NVDEV_SUBDEV_VM ] = &nvc0_vmmgr_oclass; | ||
270 | device->oclass[NVDEV_SUBDEV_BAR ] = &nvc0_bar_oclass; | ||
271 | device->oclass[NVDEV_SUBDEV_PWR ] = nv108_pwr_oclass; | ||
272 | device->oclass[NVDEV_SUBDEV_VOLT ] = &nv40_volt_oclass; | ||
273 | device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvd0_dmaeng_oclass; | ||
274 | device->oclass[NVDEV_ENGINE_FIFO ] = nv108_fifo_oclass; | ||
275 | device->oclass[NVDEV_ENGINE_SW ] = nvc0_software_oclass; | ||
276 | device->oclass[NVDEV_ENGINE_GR ] = nv108_graph_oclass; | ||
277 | device->oclass[NVDEV_ENGINE_DISP ] = nvf0_disp_oclass; | ||
278 | device->oclass[NVDEV_ENGINE_COPY0 ] = &nve0_copy0_oclass; | ||
279 | device->oclass[NVDEV_ENGINE_COPY1 ] = &nve0_copy1_oclass; | ||
280 | device->oclass[NVDEV_ENGINE_COPY2 ] = &nve0_copy2_oclass; | ||
281 | device->oclass[NVDEV_ENGINE_BSP ] = &nve0_bsp_oclass; | ||
282 | device->oclass[NVDEV_ENGINE_VP ] = &nve0_vp_oclass; | ||
283 | device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; | ||
284 | break; | ||
252 | case 0x108: | 285 | case 0x108: |
253 | device->cname = "GK208"; | 286 | device->cname = "GK208"; |
254 | device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; | 287 | device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/shadowramin.c b/drivers/gpu/drm/nouveau/core/subdev/bios/shadowramin.c index 5e58bba0dd5c..a7a890fad1e5 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bios/shadowramin.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/shadowramin.c | |||
@@ -44,8 +44,10 @@ static void | |||
44 | pramin_fini(void *data) | 44 | pramin_fini(void *data) |
45 | { | 45 | { |
46 | struct priv *priv = data; | 46 | struct priv *priv = data; |
47 | nv_wr32(priv->bios, 0x001700, priv->bar0); | 47 | if (priv) { |
48 | kfree(priv); | 48 | nv_wr32(priv->bios, 0x001700, priv->bar0); |
49 | kfree(priv); | ||
50 | } | ||
49 | } | 51 | } |
50 | 52 | ||
51 | static void * | 53 | static void * |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvaa.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvaa.c index 00f2ca7e44a5..033a8e999497 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvaa.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvaa.c | |||
@@ -24,34 +24,71 @@ | |||
24 | 24 | ||
25 | #include "nv50.h" | 25 | #include "nv50.h" |
26 | 26 | ||
27 | struct nvaa_ram_priv { | ||
28 | struct nouveau_ram base; | ||
29 | u64 poller_base; | ||
30 | }; | ||
31 | |||
27 | static int | 32 | static int |
28 | nvaa_ram_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | 33 | nvaa_ram_ctor(struct nouveau_object *parent, struct nouveau_object *engine, |
29 | struct nouveau_oclass *oclass, void *data, u32 datasize, | 34 | struct nouveau_oclass *oclass, void *data, u32 datasize, |
30 | struct nouveau_object **pobject) | 35 | struct nouveau_object **pobject) |
31 | { | 36 | { |
32 | const u32 rsvd_head = ( 256 * 1024) >> 12; /* vga memory */ | 37 | u32 rsvd_head = ( 256 * 1024); /* vga memory */ |
33 | const u32 rsvd_tail = (1024 * 1024) >> 12; /* vbios etc */ | 38 | u32 rsvd_tail = (1024 * 1024); /* vbios etc */ |
34 | struct nouveau_fb *pfb = nouveau_fb(parent); | 39 | struct nouveau_fb *pfb = nouveau_fb(parent); |
35 | struct nouveau_ram *ram; | 40 | struct nvaa_ram_priv *priv; |
36 | int ret; | 41 | int ret; |
37 | 42 | ||
38 | ret = nouveau_ram_create(parent, engine, oclass, &ram); | 43 | ret = nouveau_ram_create(parent, engine, oclass, &priv); |
39 | *pobject = nv_object(ram); | 44 | *pobject = nv_object(priv); |
40 | if (ret) | 45 | if (ret) |
41 | return ret; | 46 | return ret; |
42 | 47 | ||
43 | ram->size = nv_rd32(pfb, 0x10020c); | 48 | priv->base.type = NV_MEM_TYPE_STOLEN; |
44 | ram->size = (ram->size & 0xffffff00) | ((ram->size & 0x000000ff) << 32); | 49 | priv->base.stolen = (u64)nv_rd32(pfb, 0x100e10) << 12; |
50 | priv->base.size = (u64)nv_rd32(pfb, 0x100e14) << 12; | ||
45 | 51 | ||
46 | ret = nouveau_mm_init(&pfb->vram, rsvd_head, (ram->size >> 12) - | 52 | rsvd_tail += 0x1000; |
47 | (rsvd_head + rsvd_tail), 1); | 53 | priv->poller_base = priv->base.size - rsvd_tail; |
54 | |||
55 | ret = nouveau_mm_init(&pfb->vram, rsvd_head >> 12, | ||
56 | (priv->base.size - (rsvd_head + rsvd_tail)) >> 12, | ||
57 | 1); | ||
48 | if (ret) | 58 | if (ret) |
49 | return ret; | 59 | return ret; |
50 | 60 | ||
51 | ram->type = NV_MEM_TYPE_STOLEN; | 61 | priv->base.get = nv50_ram_get; |
52 | ram->stolen = (u64)nv_rd32(pfb, 0x100e10) << 12; | 62 | priv->base.put = nv50_ram_put; |
53 | ram->get = nv50_ram_get; | 63 | return 0; |
54 | ram->put = nv50_ram_put; | 64 | } |
65 | |||
66 | static int | ||
67 | nvaa_ram_init(struct nouveau_object *object) | ||
68 | { | ||
69 | struct nouveau_fb *pfb = nouveau_fb(object); | ||
70 | struct nvaa_ram_priv *priv = (void *)object; | ||
71 | int ret; | ||
72 | u64 dniso, hostnb, flush; | ||
73 | |||
74 | ret = nouveau_ram_init(&priv->base); | ||
75 | if (ret) | ||
76 | return ret; | ||
77 | |||
78 | dniso = ((priv->base.size - (priv->poller_base + 0x00)) >> 5) - 1; | ||
79 | hostnb = ((priv->base.size - (priv->poller_base + 0x20)) >> 5) - 1; | ||
80 | flush = ((priv->base.size - (priv->poller_base + 0x40)) >> 5) - 1; | ||
81 | |||
82 | /* Enable NISO poller for various clients and set their associated | ||
83 | * read address, only for MCP77/78 and MCP79/7A. (fd#25701) | ||
84 | */ | ||
85 | nv_wr32(pfb, 0x100c18, dniso); | ||
86 | nv_mask(pfb, 0x100c14, 0x00000000, 0x00000001); | ||
87 | nv_wr32(pfb, 0x100c1c, hostnb); | ||
88 | nv_mask(pfb, 0x100c14, 0x00000000, 0x00000002); | ||
89 | nv_wr32(pfb, 0x100c24, flush); | ||
90 | nv_mask(pfb, 0x100c14, 0x00000000, 0x00010000); | ||
91 | |||
55 | return 0; | 92 | return 0; |
56 | } | 93 | } |
57 | 94 | ||
@@ -60,7 +97,7 @@ nvaa_ram_oclass = { | |||
60 | .ofuncs = &(struct nouveau_ofuncs) { | 97 | .ofuncs = &(struct nouveau_ofuncs) { |
61 | .ctor = nvaa_ram_ctor, | 98 | .ctor = nvaa_ram_ctor, |
62 | .dtor = _nouveau_ram_dtor, | 99 | .dtor = _nouveau_ram_dtor, |
63 | .init = _nouveau_ram_init, | 100 | .init = nvaa_ram_init, |
64 | .fini = _nouveau_ram_fini, | 101 | .fini = _nouveau_ram_fini, |
65 | }, | 102 | }, |
66 | }; | 103 | }; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/mc/nv4c.c b/drivers/gpu/drm/nouveau/core/subdev/mc/nv4c.c index a75c35ccf25c..165401c4045c 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/mc/nv4c.c +++ b/drivers/gpu/drm/nouveau/core/subdev/mc/nv4c.c | |||
@@ -24,13 +24,6 @@ | |||
24 | 24 | ||
25 | #include "nv04.h" | 25 | #include "nv04.h" |
26 | 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 * | 27 | struct nouveau_oclass * |
35 | nv4c_mc_oclass = &(struct nouveau_mc_oclass) { | 28 | nv4c_mc_oclass = &(struct nouveau_mc_oclass) { |
36 | .base.handle = NV_SUBDEV(MC, 0x4c), | 29 | .base.handle = NV_SUBDEV(MC, 0x4c), |
@@ -41,5 +34,4 @@ nv4c_mc_oclass = &(struct nouveau_mc_oclass) { | |||
41 | .fini = _nouveau_mc_fini, | 34 | .fini = _nouveau_mc_fini, |
42 | }, | 35 | }, |
43 | .intr = nv04_mc_intr, | 36 | .intr = nv04_mc_intr, |
44 | .msi_rearm = nv4c_mc_msi_rearm, | ||
45 | }.base; | 37 | }.base; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 21ec561edc99..bba2960d3dfb 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
@@ -1572,8 +1572,10 @@ nouveau_ttm_tt_unpopulate(struct ttm_tt *ttm) | |||
1572 | * so use the DMA API for them. | 1572 | * so use the DMA API for them. |
1573 | */ | 1573 | */ |
1574 | if (!nv_device_is_cpu_coherent(device) && | 1574 | if (!nv_device_is_cpu_coherent(device) && |
1575 | ttm->caching_state == tt_uncached) | 1575 | ttm->caching_state == tt_uncached) { |
1576 | ttm_dma_unpopulate(ttm_dma, dev->dev); | 1576 | ttm_dma_unpopulate(ttm_dma, dev->dev); |
1577 | return; | ||
1578 | } | ||
1577 | 1579 | ||
1578 | #if __OS_HAS_AGP | 1580 | #if __OS_HAS_AGP |
1579 | if (drm->agp.stat == ENABLED) { | 1581 | if (drm->agp.stat == ENABLED) { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 42c34babc2e5..bf0f9e21d714 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c | |||
@@ -36,7 +36,14 @@ void | |||
36 | nouveau_gem_object_del(struct drm_gem_object *gem) | 36 | nouveau_gem_object_del(struct drm_gem_object *gem) |
37 | { | 37 | { |
38 | struct nouveau_bo *nvbo = nouveau_gem_object(gem); | 38 | struct nouveau_bo *nvbo = nouveau_gem_object(gem); |
39 | struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev); | ||
39 | struct ttm_buffer_object *bo = &nvbo->bo; | 40 | struct ttm_buffer_object *bo = &nvbo->bo; |
41 | struct device *dev = drm->dev->dev; | ||
42 | int ret; | ||
43 | |||
44 | ret = pm_runtime_get_sync(dev); | ||
45 | if (WARN_ON(ret < 0 && ret != -EACCES)) | ||
46 | return; | ||
40 | 47 | ||
41 | if (gem->import_attach) | 48 | if (gem->import_attach) |
42 | drm_prime_gem_destroy(gem, nvbo->bo.sg); | 49 | drm_prime_gem_destroy(gem, nvbo->bo.sg); |
@@ -46,6 +53,9 @@ nouveau_gem_object_del(struct drm_gem_object *gem) | |||
46 | /* reset filp so nouveau_bo_del_ttm() can test for it */ | 53 | /* reset filp so nouveau_bo_del_ttm() can test for it */ |
47 | gem->filp = NULL; | 54 | gem->filp = NULL; |
48 | ttm_bo_unref(&bo); | 55 | ttm_bo_unref(&bo); |
56 | |||
57 | pm_runtime_mark_last_busy(dev); | ||
58 | pm_runtime_put_autosuspend(dev); | ||
49 | } | 59 | } |
50 | 60 | ||
51 | int | 61 | int |
@@ -53,7 +63,9 @@ nouveau_gem_object_open(struct drm_gem_object *gem, struct drm_file *file_priv) | |||
53 | { | 63 | { |
54 | struct nouveau_cli *cli = nouveau_cli(file_priv); | 64 | struct nouveau_cli *cli = nouveau_cli(file_priv); |
55 | struct nouveau_bo *nvbo = nouveau_gem_object(gem); | 65 | struct nouveau_bo *nvbo = nouveau_gem_object(gem); |
66 | struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev); | ||
56 | struct nouveau_vma *vma; | 67 | struct nouveau_vma *vma; |
68 | struct device *dev = drm->dev->dev; | ||
57 | int ret; | 69 | int ret; |
58 | 70 | ||
59 | if (!cli->vm) | 71 | if (!cli->vm) |
@@ -71,11 +83,16 @@ nouveau_gem_object_open(struct drm_gem_object *gem, struct drm_file *file_priv) | |||
71 | goto out; | 83 | goto out; |
72 | } | 84 | } |
73 | 85 | ||
86 | ret = pm_runtime_get_sync(dev); | ||
87 | if (ret < 0 && ret != -EACCES) | ||
88 | goto out; | ||
89 | |||
74 | ret = nouveau_bo_vma_add(nvbo, cli->vm, vma); | 90 | ret = nouveau_bo_vma_add(nvbo, cli->vm, vma); |
75 | if (ret) { | 91 | if (ret) |
76 | kfree(vma); | 92 | kfree(vma); |
77 | goto out; | 93 | |
78 | } | 94 | pm_runtime_mark_last_busy(dev); |
95 | pm_runtime_put_autosuspend(dev); | ||
79 | } else { | 96 | } else { |
80 | vma->refcount++; | 97 | vma->refcount++; |
81 | } | 98 | } |
@@ -129,6 +146,8 @@ nouveau_gem_object_close(struct drm_gem_object *gem, struct drm_file *file_priv) | |||
129 | { | 146 | { |
130 | struct nouveau_cli *cli = nouveau_cli(file_priv); | 147 | struct nouveau_cli *cli = nouveau_cli(file_priv); |
131 | struct nouveau_bo *nvbo = nouveau_gem_object(gem); | 148 | struct nouveau_bo *nvbo = nouveau_gem_object(gem); |
149 | struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev); | ||
150 | struct device *dev = drm->dev->dev; | ||
132 | struct nouveau_vma *vma; | 151 | struct nouveau_vma *vma; |
133 | int ret; | 152 | int ret; |
134 | 153 | ||
@@ -141,8 +160,14 @@ nouveau_gem_object_close(struct drm_gem_object *gem, struct drm_file *file_priv) | |||
141 | 160 | ||
142 | vma = nouveau_bo_vma_find(nvbo, cli->vm); | 161 | vma = nouveau_bo_vma_find(nvbo, cli->vm); |
143 | if (vma) { | 162 | if (vma) { |
144 | if (--vma->refcount == 0) | 163 | if (--vma->refcount == 0) { |
145 | nouveau_gem_object_unmap(nvbo, vma); | 164 | ret = pm_runtime_get_sync(dev); |
165 | if (!WARN_ON(ret < 0 && ret != -EACCES)) { | ||
166 | nouveau_gem_object_unmap(nvbo, vma); | ||
167 | pm_runtime_mark_last_busy(dev); | ||
168 | pm_runtime_put_autosuspend(dev); | ||
169 | } | ||
170 | } | ||
146 | } | 171 | } |
147 | ttm_bo_unreserve(&nvbo->bo); | 172 | ttm_bo_unreserve(&nvbo->bo); |
148 | } | 173 | } |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index d59ec491dbb9..ed644a4f6f57 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -1851,10 +1851,9 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc) | |||
1851 | return pll; | 1851 | return pll; |
1852 | } | 1852 | } |
1853 | /* otherwise, pick one of the plls */ | 1853 | /* otherwise, pick one of the plls */ |
1854 | if ((rdev->family == CHIP_KAVERI) || | 1854 | if ((rdev->family == CHIP_KABINI) || |
1855 | (rdev->family == CHIP_KABINI) || | ||
1856 | (rdev->family == CHIP_MULLINS)) { | 1855 | (rdev->family == CHIP_MULLINS)) { |
1857 | /* KB/KV/ML has PPLL1 and PPLL2 */ | 1856 | /* KB/ML has PPLL1 and PPLL2 */ |
1858 | pll_in_use = radeon_get_pll_use_mask(crtc); | 1857 | pll_in_use = radeon_get_pll_use_mask(crtc); |
1859 | if (!(pll_in_use & (1 << ATOM_PPLL2))) | 1858 | if (!(pll_in_use & (1 << ATOM_PPLL2))) |
1860 | return ATOM_PPLL2; | 1859 | return ATOM_PPLL2; |
@@ -1863,7 +1862,7 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc) | |||
1863 | DRM_ERROR("unable to allocate a PPLL\n"); | 1862 | DRM_ERROR("unable to allocate a PPLL\n"); |
1864 | return ATOM_PPLL_INVALID; | 1863 | return ATOM_PPLL_INVALID; |
1865 | } else { | 1864 | } else { |
1866 | /* CI has PPLL0, PPLL1, and PPLL2 */ | 1865 | /* CI/KV has PPLL0, PPLL1, and PPLL2 */ |
1867 | pll_in_use = radeon_get_pll_use_mask(crtc); | 1866 | pll_in_use = radeon_get_pll_use_mask(crtc); |
1868 | if (!(pll_in_use & (1 << ATOM_PPLL2))) | 1867 | if (!(pll_in_use & (1 << ATOM_PPLL2))) |
1869 | return ATOM_PPLL2; | 1868 | return ATOM_PPLL2; |
@@ -2155,6 +2154,7 @@ static void atombios_crtc_disable(struct drm_crtc *crtc) | |||
2155 | case ATOM_PPLL0: | 2154 | case ATOM_PPLL0: |
2156 | /* disable the ppll */ | 2155 | /* disable the ppll */ |
2157 | if ((rdev->family == CHIP_ARUBA) || | 2156 | if ((rdev->family == CHIP_ARUBA) || |
2157 | (rdev->family == CHIP_KAVERI) || | ||
2158 | (rdev->family == CHIP_BONAIRE) || | 2158 | (rdev->family == CHIP_BONAIRE) || |
2159 | (rdev->family == CHIP_HAWAII)) | 2159 | (rdev->family == CHIP_HAWAII)) |
2160 | atombios_crtc_program_pll(crtc, radeon_crtc->crtc_id, radeon_crtc->pll_id, | 2160 | atombios_crtc_program_pll(crtc, radeon_crtc->crtc_id, radeon_crtc->pll_id, |
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index 11ba9d21b89b..db42a670f995 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
@@ -492,6 +492,10 @@ int radeon_dp_mode_valid_helper(struct drm_connector *connector, | |||
492 | struct radeon_connector_atom_dig *dig_connector; | 492 | struct radeon_connector_atom_dig *dig_connector; |
493 | int dp_clock; | 493 | int dp_clock; |
494 | 494 | ||
495 | if ((mode->clock > 340000) && | ||
496 | (!radeon_connector_is_dp12_capable(connector))) | ||
497 | return MODE_CLOCK_HIGH; | ||
498 | |||
495 | if (!radeon_connector->con_priv) | 499 | if (!radeon_connector->con_priv) |
496 | return MODE_CLOCK_HIGH; | 500 | return MODE_CLOCK_HIGH; |
497 | dig_connector = radeon_connector->con_priv; | 501 | dig_connector = radeon_connector->con_priv; |
diff --git a/drivers/gpu/drm/radeon/cikd.h b/drivers/gpu/drm/radeon/cikd.h index ba85986febea..03003f8a6de6 100644 --- a/drivers/gpu/drm/radeon/cikd.h +++ b/drivers/gpu/drm/radeon/cikd.h | |||
@@ -2156,4 +2156,6 @@ | |||
2156 | #define ATC_VM_APERTURE1_HIGH_ADDR 0x330Cu | 2156 | #define ATC_VM_APERTURE1_HIGH_ADDR 0x330Cu |
2157 | #define ATC_VM_APERTURE1_LOW_ADDR 0x3304u | 2157 | #define ATC_VM_APERTURE1_LOW_ADDR 0x3304u |
2158 | 2158 | ||
2159 | #define IH_VMID_0_LUT 0x3D40u | ||
2160 | |||
2159 | #endif | 2161 | #endif |
diff --git a/drivers/gpu/drm/radeon/dce3_1_afmt.c b/drivers/gpu/drm/radeon/dce3_1_afmt.c index 2fe8cfc966d9..bafdf92a5732 100644 --- a/drivers/gpu/drm/radeon/dce3_1_afmt.c +++ b/drivers/gpu/drm/radeon/dce3_1_afmt.c | |||
@@ -103,7 +103,7 @@ static void dce3_2_afmt_write_sad_regs(struct drm_encoder *encoder) | |||
103 | } | 103 | } |
104 | 104 | ||
105 | sad_count = drm_edid_to_sad(radeon_connector->edid, &sads); | 105 | sad_count = drm_edid_to_sad(radeon_connector->edid, &sads); |
106 | if (sad_count < 0) { | 106 | if (sad_count <= 0) { |
107 | DRM_ERROR("Couldn't read SADs: %d\n", sad_count); | 107 | DRM_ERROR("Couldn't read SADs: %d\n", sad_count); |
108 | return; | 108 | return; |
109 | } | 109 | } |
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c index 9b42001295ba..e3e9c10cfba9 100644 --- a/drivers/gpu/drm/radeon/kv_dpm.c +++ b/drivers/gpu/drm/radeon/kv_dpm.c | |||
@@ -2745,13 +2745,11 @@ int kv_dpm_init(struct radeon_device *rdev) | |||
2745 | pi->enable_auto_thermal_throttling = true; | 2745 | pi->enable_auto_thermal_throttling = true; |
2746 | pi->disable_nb_ps3_in_battery = false; | 2746 | pi->disable_nb_ps3_in_battery = false; |
2747 | if (radeon_bapm == -1) { | 2747 | if (radeon_bapm == -1) { |
2748 | /* There are stability issues reported on with | 2748 | /* only enable bapm on KB, ML by default */ |
2749 | * bapm enabled on an asrock system. | 2749 | if (rdev->family == CHIP_KABINI || rdev->family == CHIP_MULLINS) |
2750 | */ | ||
2751 | if (rdev->pdev->subsystem_vendor == 0x1849) | ||
2752 | pi->bapm_enable = false; | ||
2753 | else | ||
2754 | pi->bapm_enable = true; | 2750 | pi->bapm_enable = true; |
2751 | else | ||
2752 | pi->bapm_enable = false; | ||
2755 | } else if (radeon_bapm == 0) { | 2753 | } else if (radeon_bapm == 0) { |
2756 | pi->bapm_enable = false; | 2754 | pi->bapm_enable = false; |
2757 | } else { | 2755 | } else { |
diff --git a/drivers/gpu/drm/radeon/radeon_kfd.c b/drivers/gpu/drm/radeon/radeon_kfd.c index 242fd8b1b221..8bf87f1203cc 100644 --- a/drivers/gpu/drm/radeon/radeon_kfd.c +++ b/drivers/gpu/drm/radeon/radeon_kfd.c | |||
@@ -72,7 +72,7 @@ static int kgd_init_pipeline(struct kgd_dev *kgd, uint32_t pipe_id, | |||
72 | static int kgd_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id, | 72 | static int kgd_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id, |
73 | uint32_t queue_id, uint32_t __user *wptr); | 73 | uint32_t queue_id, uint32_t __user *wptr); |
74 | 74 | ||
75 | static bool kgd_hqd_is_occupies(struct kgd_dev *kgd, uint64_t queue_address, | 75 | static bool kgd_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address, |
76 | uint32_t pipe_id, uint32_t queue_id); | 76 | uint32_t pipe_id, uint32_t queue_id); |
77 | 77 | ||
78 | static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type, | 78 | static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type, |
@@ -92,7 +92,7 @@ static const struct kfd2kgd_calls kfd2kgd = { | |||
92 | .init_memory = kgd_init_memory, | 92 | .init_memory = kgd_init_memory, |
93 | .init_pipeline = kgd_init_pipeline, | 93 | .init_pipeline = kgd_init_pipeline, |
94 | .hqd_load = kgd_hqd_load, | 94 | .hqd_load = kgd_hqd_load, |
95 | .hqd_is_occupies = kgd_hqd_is_occupies, | 95 | .hqd_is_occupied = kgd_hqd_is_occupied, |
96 | .hqd_destroy = kgd_hqd_destroy, | 96 | .hqd_destroy = kgd_hqd_destroy, |
97 | .get_fw_version = get_fw_version | 97 | .get_fw_version = get_fw_version |
98 | }; | 98 | }; |
@@ -101,6 +101,7 @@ static const struct kgd2kfd_calls *kgd2kfd; | |||
101 | 101 | ||
102 | bool radeon_kfd_init(void) | 102 | bool radeon_kfd_init(void) |
103 | { | 103 | { |
104 | #if defined(CONFIG_HSA_AMD_MODULE) | ||
104 | bool (*kgd2kfd_init_p)(unsigned, const struct kfd2kgd_calls*, | 105 | bool (*kgd2kfd_init_p)(unsigned, const struct kfd2kgd_calls*, |
105 | const struct kgd2kfd_calls**); | 106 | const struct kgd2kfd_calls**); |
106 | 107 | ||
@@ -117,6 +118,17 @@ bool radeon_kfd_init(void) | |||
117 | } | 118 | } |
118 | 119 | ||
119 | return true; | 120 | return true; |
121 | #elif defined(CONFIG_HSA_AMD) | ||
122 | if (!kgd2kfd_init(KFD_INTERFACE_VERSION, &kfd2kgd, &kgd2kfd)) { | ||
123 | kgd2kfd = NULL; | ||
124 | |||
125 | return false; | ||
126 | } | ||
127 | |||
128 | return true; | ||
129 | #else | ||
130 | return false; | ||
131 | #endif | ||
120 | } | 132 | } |
121 | 133 | ||
122 | void radeon_kfd_fini(void) | 134 | void radeon_kfd_fini(void) |
@@ -378,6 +390,10 @@ static int kgd_set_pasid_vmid_mapping(struct kgd_dev *kgd, unsigned int pasid, | |||
378 | cpu_relax(); | 390 | cpu_relax(); |
379 | write_register(kgd, ATC_VMID_PASID_MAPPING_UPDATE_STATUS, 1U << vmid); | 391 | write_register(kgd, ATC_VMID_PASID_MAPPING_UPDATE_STATUS, 1U << vmid); |
380 | 392 | ||
393 | /* Mapping vmid to pasid also for IH block */ | ||
394 | write_register(kgd, IH_VMID_0_LUT + vmid * sizeof(uint32_t), | ||
395 | pasid_mapping); | ||
396 | |||
381 | return 0; | 397 | return 0; |
382 | } | 398 | } |
383 | 399 | ||
@@ -517,7 +533,7 @@ static int kgd_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id, | |||
517 | return 0; | 533 | return 0; |
518 | } | 534 | } |
519 | 535 | ||
520 | static bool kgd_hqd_is_occupies(struct kgd_dev *kgd, uint64_t queue_address, | 536 | static bool kgd_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address, |
521 | uint32_t pipe_id, uint32_t queue_id) | 537 | uint32_t pipe_id, uint32_t queue_id) |
522 | { | 538 | { |
523 | uint32_t act; | 539 | uint32_t act; |
@@ -556,6 +572,7 @@ static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type, | |||
556 | if (timeout == 0) { | 572 | if (timeout == 0) { |
557 | pr_err("kfd: cp queue preemption time out (%dms)\n", | 573 | pr_err("kfd: cp queue preemption time out (%dms)\n", |
558 | temp); | 574 | temp); |
575 | release_queue(kgd); | ||
559 | return -ETIME; | 576 | return -ETIME; |
560 | } | 577 | } |
561 | msleep(20); | 578 | msleep(20); |
diff --git a/drivers/gpu/drm/radeon/radeon_state.c b/drivers/gpu/drm/radeon/radeon_state.c index 535403e0c8a2..15aee723db77 100644 --- a/drivers/gpu/drm/radeon/radeon_state.c +++ b/drivers/gpu/drm/radeon/radeon_state.c | |||
@@ -1703,7 +1703,7 @@ static int radeon_cp_dispatch_texture(struct drm_device * dev, | |||
1703 | u32 format; | 1703 | u32 format; |
1704 | u32 *buffer; | 1704 | u32 *buffer; |
1705 | const u8 __user *data; | 1705 | const u8 __user *data; |
1706 | int size, dwords, tex_width, blit_width, spitch; | 1706 | unsigned int size, dwords, tex_width, blit_width, spitch; |
1707 | u32 height; | 1707 | u32 height; |
1708 | int i; | 1708 | int i; |
1709 | u32 texpitch, microtile; | 1709 | u32 texpitch, microtile; |
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 230b6f887cd8..dfdc26970022 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
@@ -27,7 +27,8 @@ if HID | |||
27 | 27 | ||
28 | config HID_BATTERY_STRENGTH | 28 | config HID_BATTERY_STRENGTH |
29 | bool "Battery level reporting for HID devices" | 29 | bool "Battery level reporting for HID devices" |
30 | depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY | 30 | depends on HID |
31 | select POWER_SUPPLY | ||
31 | default n | 32 | default n |
32 | ---help--- | 33 | ---help--- |
33 | This option adds support of reporting battery strength (for HID devices | 34 | This option adds support of reporting battery strength (for HID devices |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index c3d0ac1a0988..8b638792cb43 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1805,6 +1805,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1805 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, | 1805 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, |
1806 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_I405X) }, | 1806 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_I405X) }, |
1807 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X) }, | 1807 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X) }, |
1808 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2) }, | ||
1808 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X) }, | 1809 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X) }, |
1809 | { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, | 1810 | { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, |
1810 | { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) }, | 1811 | { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) }, |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 7460f3402298..9243359c1821 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -526,6 +526,7 @@ | |||
526 | #define USB_DEVICE_ID_KYE_GPEN_560 0x5003 | 526 | #define USB_DEVICE_ID_KYE_GPEN_560 0x5003 |
527 | #define USB_DEVICE_ID_KYE_EASYPEN_I405X 0x5010 | 527 | #define USB_DEVICE_ID_KYE_EASYPEN_I405X 0x5010 |
528 | #define USB_DEVICE_ID_KYE_MOUSEPEN_I608X 0x5011 | 528 | #define USB_DEVICE_ID_KYE_MOUSEPEN_I608X 0x5011 |
529 | #define USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2 0x501a | ||
529 | #define USB_DEVICE_ID_KYE_EASYPEN_M610X 0x5013 | 530 | #define USB_DEVICE_ID_KYE_EASYPEN_M610X 0x5013 |
530 | 531 | ||
531 | #define USB_VENDOR_ID_LABTEC 0x1020 | 532 | #define USB_VENDOR_ID_LABTEC 0x1020 |
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index e0a0f06ac5ef..9505605b6e22 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -312,6 +312,9 @@ static const struct hid_device_id hid_battery_quirks[] = { | |||
312 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI), | 312 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI), |
313 | HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, | 313 | HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, |
314 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, | 314 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, |
315 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO), | ||
316 | HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, | ||
317 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, | ||
315 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI), | 318 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI), |
316 | HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, | 319 | HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, |
317 | {} | 320 | {} |
diff --git a/drivers/hid/hid-kye.c b/drivers/hid/hid-kye.c index b92bf01a1ae8..158fcf577fae 100644 --- a/drivers/hid/hid-kye.c +++ b/drivers/hid/hid-kye.c | |||
@@ -323,6 +323,7 @@ static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, | |||
323 | } | 323 | } |
324 | break; | 324 | break; |
325 | case USB_DEVICE_ID_KYE_MOUSEPEN_I608X: | 325 | case USB_DEVICE_ID_KYE_MOUSEPEN_I608X: |
326 | case USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2: | ||
326 | if (*rsize == MOUSEPEN_I608X_RDESC_ORIG_SIZE) { | 327 | if (*rsize == MOUSEPEN_I608X_RDESC_ORIG_SIZE) { |
327 | rdesc = mousepen_i608x_rdesc_fixed; | 328 | rdesc = mousepen_i608x_rdesc_fixed; |
328 | *rsize = sizeof(mousepen_i608x_rdesc_fixed); | 329 | *rsize = sizeof(mousepen_i608x_rdesc_fixed); |
@@ -415,6 +416,7 @@ static int kye_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
415 | switch (id->product) { | 416 | switch (id->product) { |
416 | case USB_DEVICE_ID_KYE_EASYPEN_I405X: | 417 | case USB_DEVICE_ID_KYE_EASYPEN_I405X: |
417 | case USB_DEVICE_ID_KYE_MOUSEPEN_I608X: | 418 | case USB_DEVICE_ID_KYE_MOUSEPEN_I608X: |
419 | case USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2: | ||
418 | case USB_DEVICE_ID_KYE_EASYPEN_M610X: | 420 | case USB_DEVICE_ID_KYE_EASYPEN_M610X: |
419 | ret = kye_tablet_enable(hdev); | 421 | ret = kye_tablet_enable(hdev); |
420 | if (ret) { | 422 | if (ret) { |
@@ -446,6 +448,8 @@ static const struct hid_device_id kye_devices[] = { | |||
446 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, | 448 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, |
447 | USB_DEVICE_ID_KYE_MOUSEPEN_I608X) }, | 449 | USB_DEVICE_ID_KYE_MOUSEPEN_I608X) }, |
448 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, | 450 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, |
451 | USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2) }, | ||
452 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, | ||
449 | USB_DEVICE_ID_KYE_EASYPEN_M610X) }, | 453 | USB_DEVICE_ID_KYE_EASYPEN_M610X) }, |
450 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, | 454 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, |
451 | USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) }, | 455 | USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) }, |
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c index c917ab61aafa..5bc6d80d5be7 100644 --- a/drivers/hid/hid-logitech-dj.c +++ b/drivers/hid/hid-logitech-dj.c | |||
@@ -962,10 +962,24 @@ static int logi_dj_raw_event(struct hid_device *hdev, | |||
962 | 962 | ||
963 | switch (data[0]) { | 963 | switch (data[0]) { |
964 | case REPORT_ID_DJ_SHORT: | 964 | case REPORT_ID_DJ_SHORT: |
965 | if (size != DJREPORT_SHORT_LENGTH) { | ||
966 | dev_err(&hdev->dev, "DJ report of bad size (%d)", size); | ||
967 | return false; | ||
968 | } | ||
965 | return logi_dj_dj_event(hdev, report, data, size); | 969 | return logi_dj_dj_event(hdev, report, data, size); |
966 | case REPORT_ID_HIDPP_SHORT: | 970 | case REPORT_ID_HIDPP_SHORT: |
967 | /* intentional fallthrough */ | 971 | if (size != HIDPP_REPORT_SHORT_LENGTH) { |
972 | dev_err(&hdev->dev, | ||
973 | "Short HID++ report of bad size (%d)", size); | ||
974 | return false; | ||
975 | } | ||
976 | return logi_dj_hidpp_event(hdev, report, data, size); | ||
968 | case REPORT_ID_HIDPP_LONG: | 977 | case REPORT_ID_HIDPP_LONG: |
978 | if (size != HIDPP_REPORT_LONG_LENGTH) { | ||
979 | dev_err(&hdev->dev, | ||
980 | "Long HID++ report of bad size (%d)", size); | ||
981 | return false; | ||
982 | } | ||
969 | return logi_dj_hidpp_event(hdev, report, data, size); | 983 | return logi_dj_hidpp_event(hdev, report, data, size); |
970 | } | 984 | } |
971 | 985 | ||
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c index 2f420c0b6609..a93cefe0e522 100644 --- a/drivers/hid/hid-logitech-hidpp.c +++ b/drivers/hid/hid-logitech-hidpp.c | |||
@@ -282,6 +282,33 @@ static inline bool hidpp_report_is_connect_event(struct hidpp_report *report) | |||
282 | (report->rap.sub_id == 0x41); | 282 | (report->rap.sub_id == 0x41); |
283 | } | 283 | } |
284 | 284 | ||
285 | /** | ||
286 | * hidpp_prefix_name() prefixes the current given name with "Logitech ". | ||
287 | */ | ||
288 | static void hidpp_prefix_name(char **name, int name_length) | ||
289 | { | ||
290 | #define PREFIX_LENGTH 9 /* "Logitech " */ | ||
291 | |||
292 | int new_length; | ||
293 | char *new_name; | ||
294 | |||
295 | if (name_length > PREFIX_LENGTH && | ||
296 | strncmp(*name, "Logitech ", PREFIX_LENGTH) == 0) | ||
297 | /* The prefix has is already in the name */ | ||
298 | return; | ||
299 | |||
300 | new_length = PREFIX_LENGTH + name_length; | ||
301 | new_name = kzalloc(new_length, GFP_KERNEL); | ||
302 | if (!new_name) | ||
303 | return; | ||
304 | |||
305 | snprintf(new_name, new_length, "Logitech %s", *name); | ||
306 | |||
307 | kfree(*name); | ||
308 | |||
309 | *name = new_name; | ||
310 | } | ||
311 | |||
285 | /* -------------------------------------------------------------------------- */ | 312 | /* -------------------------------------------------------------------------- */ |
286 | /* HIDP++ 1.0 commands */ | 313 | /* HIDP++ 1.0 commands */ |
287 | /* -------------------------------------------------------------------------- */ | 314 | /* -------------------------------------------------------------------------- */ |
@@ -321,6 +348,10 @@ static char *hidpp_get_unifying_name(struct hidpp_device *hidpp_dev) | |||
321 | return NULL; | 348 | return NULL; |
322 | 349 | ||
323 | memcpy(name, &response.rap.params[2], len); | 350 | memcpy(name, &response.rap.params[2], len); |
351 | |||
352 | /* include the terminating '\0' */ | ||
353 | hidpp_prefix_name(&name, len + 1); | ||
354 | |||
324 | return name; | 355 | return name; |
325 | } | 356 | } |
326 | 357 | ||
@@ -498,6 +529,9 @@ static char *hidpp_get_device_name(struct hidpp_device *hidpp) | |||
498 | index += ret; | 529 | index += ret; |
499 | } | 530 | } |
500 | 531 | ||
532 | /* include the terminating '\0' */ | ||
533 | hidpp_prefix_name(&name, __name_length + 1); | ||
534 | |||
501 | return name; | 535 | return name; |
502 | } | 536 | } |
503 | 537 | ||
@@ -794,18 +828,25 @@ static int wtp_raw_event(struct hid_device *hdev, u8 *data, int size) | |||
794 | 828 | ||
795 | switch (data[0]) { | 829 | switch (data[0]) { |
796 | case 0x02: | 830 | case 0x02: |
831 | if (size < 2) { | ||
832 | hid_err(hdev, "Received HID report of bad size (%d)", | ||
833 | size); | ||
834 | return 1; | ||
835 | } | ||
797 | if (hidpp->quirks & HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS) { | 836 | if (hidpp->quirks & HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS) { |
798 | input_event(wd->input, EV_KEY, BTN_LEFT, | 837 | input_event(wd->input, EV_KEY, BTN_LEFT, |
799 | !!(data[1] & 0x01)); | 838 | !!(data[1] & 0x01)); |
800 | input_event(wd->input, EV_KEY, BTN_RIGHT, | 839 | input_event(wd->input, EV_KEY, BTN_RIGHT, |
801 | !!(data[1] & 0x02)); | 840 | !!(data[1] & 0x02)); |
802 | input_sync(wd->input); | 841 | input_sync(wd->input); |
842 | return 0; | ||
803 | } else { | 843 | } else { |
804 | if (size < 21) | 844 | if (size < 21) |
805 | return 1; | 845 | return 1; |
806 | return wtp_mouse_raw_xy_event(hidpp, &data[7]); | 846 | return wtp_mouse_raw_xy_event(hidpp, &data[7]); |
807 | } | 847 | } |
808 | case REPORT_ID_HIDPP_LONG: | 848 | case REPORT_ID_HIDPP_LONG: |
849 | /* size is already checked in hidpp_raw_event. */ | ||
809 | if ((report->fap.feature_index != wd->mt_feature_index) || | 850 | if ((report->fap.feature_index != wd->mt_feature_index) || |
810 | (report->fap.funcindex_clientid != EVENT_TOUCHPAD_RAW_XY)) | 851 | (report->fap.funcindex_clientid != EVENT_TOUCHPAD_RAW_XY)) |
811 | return 1; | 852 | return 1; |
diff --git a/drivers/hid/hid-roccat-pyra.c b/drivers/hid/hid-roccat-pyra.c index 1a07e07d99a0..47d7e74231e5 100644 --- a/drivers/hid/hid-roccat-pyra.c +++ b/drivers/hid/hid-roccat-pyra.c | |||
@@ -35,6 +35,8 @@ static struct class *pyra_class; | |||
35 | static void profile_activated(struct pyra_device *pyra, | 35 | static void profile_activated(struct pyra_device *pyra, |
36 | unsigned int new_profile) | 36 | unsigned int new_profile) |
37 | { | 37 | { |
38 | if (new_profile >= ARRAY_SIZE(pyra->profile_settings)) | ||
39 | return; | ||
38 | pyra->actual_profile = new_profile; | 40 | pyra->actual_profile = new_profile; |
39 | pyra->actual_cpi = pyra->profile_settings[pyra->actual_profile].y_cpi; | 41 | pyra->actual_cpi = pyra->profile_settings[pyra->actual_profile].y_cpi; |
40 | } | 42 | } |
@@ -257,9 +259,11 @@ static ssize_t pyra_sysfs_write_settings(struct file *fp, | |||
257 | if (off != 0 || count != PYRA_SIZE_SETTINGS) | 259 | if (off != 0 || count != PYRA_SIZE_SETTINGS) |
258 | return -EINVAL; | 260 | return -EINVAL; |
259 | 261 | ||
260 | mutex_lock(&pyra->pyra_lock); | ||
261 | |||
262 | settings = (struct pyra_settings const *)buf; | 262 | settings = (struct pyra_settings const *)buf; |
263 | if (settings->startup_profile >= ARRAY_SIZE(pyra->profile_settings)) | ||
264 | return -EINVAL; | ||
265 | |||
266 | mutex_lock(&pyra->pyra_lock); | ||
263 | 267 | ||
264 | retval = pyra_set_settings(usb_dev, settings); | 268 | retval = pyra_set_settings(usb_dev, settings); |
265 | if (retval) { | 269 | if (retval) { |
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c index d32037cbf9db..d43e967e7533 100644 --- a/drivers/hid/i2c-hid/i2c-hid.c +++ b/drivers/hid/i2c-hid/i2c-hid.c | |||
@@ -706,12 +706,7 @@ static int i2c_hid_start(struct hid_device *hid) | |||
706 | 706 | ||
707 | static void i2c_hid_stop(struct hid_device *hid) | 707 | static void i2c_hid_stop(struct hid_device *hid) |
708 | { | 708 | { |
709 | struct i2c_client *client = hid->driver_data; | ||
710 | struct i2c_hid *ihid = i2c_get_clientdata(client); | ||
711 | |||
712 | hid->claimed = 0; | 709 | hid->claimed = 0; |
713 | |||
714 | i2c_hid_free_buffers(ihid); | ||
715 | } | 710 | } |
716 | 711 | ||
717 | static int i2c_hid_open(struct hid_device *hid) | 712 | static int i2c_hid_open(struct hid_device *hid) |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index dc89be90b35e..b27b3d33ebab 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -124,6 +124,7 @@ static const struct hid_blacklist { | |||
124 | { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS, HID_QUIRK_MULTI_INPUT }, | 124 | { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS, HID_QUIRK_MULTI_INPUT }, |
125 | { USB_VENDOR_ID_SIGMA_MICRO, USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD, HID_QUIRK_NO_INIT_REPORTS }, | 125 | { USB_VENDOR_ID_SIGMA_MICRO, USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD, HID_QUIRK_NO_INIT_REPORTS }, |
126 | { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X, HID_QUIRK_MULTI_INPUT }, | 126 | { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X, HID_QUIRK_MULTI_INPUT }, |
127 | { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2, HID_QUIRK_MULTI_INPUT }, | ||
127 | { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X, HID_QUIRK_MULTI_INPUT }, | 128 | { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X, HID_QUIRK_MULTI_INPUT }, |
128 | { USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_DUOSENSE, HID_QUIRK_NO_INIT_REPORTS }, | 129 | { USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_DUOSENSE, HID_QUIRK_NO_INIT_REPORTS }, |
129 | { USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD, HID_QUIRK_NO_INIT_REPORTS }, | 130 | { USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD, HID_QUIRK_NO_INIT_REPORTS }, |
diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c index e37412da15f5..b99de00e57b8 100644 --- a/drivers/iio/adc/ad799x.c +++ b/drivers/iio/adc/ad799x.c | |||
@@ -143,9 +143,15 @@ static int ad799x_write_config(struct ad799x_state *st, u16 val) | |||
143 | case ad7998: | 143 | case ad7998: |
144 | return i2c_smbus_write_word_swapped(st->client, AD7998_CONF_REG, | 144 | return i2c_smbus_write_word_swapped(st->client, AD7998_CONF_REG, |
145 | val); | 145 | val); |
146 | default: | 146 | case ad7992: |
147 | case ad7993: | ||
148 | case ad7994: | ||
147 | return i2c_smbus_write_byte_data(st->client, AD7998_CONF_REG, | 149 | return i2c_smbus_write_byte_data(st->client, AD7998_CONF_REG, |
148 | val); | 150 | val); |
151 | default: | ||
152 | /* Will be written when doing a conversion */ | ||
153 | st->config = val; | ||
154 | return 0; | ||
149 | } | 155 | } |
150 | } | 156 | } |
151 | 157 | ||
@@ -155,8 +161,13 @@ static int ad799x_read_config(struct ad799x_state *st) | |||
155 | case ad7997: | 161 | case ad7997: |
156 | case ad7998: | 162 | case ad7998: |
157 | return i2c_smbus_read_word_swapped(st->client, AD7998_CONF_REG); | 163 | return i2c_smbus_read_word_swapped(st->client, AD7998_CONF_REG); |
158 | default: | 164 | case ad7992: |
165 | case ad7993: | ||
166 | case ad7994: | ||
159 | return i2c_smbus_read_byte_data(st->client, AD7998_CONF_REG); | 167 | return i2c_smbus_read_byte_data(st->client, AD7998_CONF_REG); |
168 | default: | ||
169 | /* No readback support */ | ||
170 | return st->config; | ||
160 | } | 171 | } |
161 | } | 172 | } |
162 | 173 | ||
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index 866fe904cba2..90c8cb727cc7 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c | |||
@@ -449,6 +449,9 @@ static int iio_channel_read(struct iio_channel *chan, int *val, int *val2, | |||
449 | if (val2 == NULL) | 449 | if (val2 == NULL) |
450 | val2 = &unused; | 450 | val2 = &unused; |
451 | 451 | ||
452 | if(!iio_channel_has_info(chan->channel, info)) | ||
453 | return -EINVAL; | ||
454 | |||
452 | if (chan->indio_dev->info->read_raw_multi) { | 455 | if (chan->indio_dev->info->read_raw_multi) { |
453 | ret = chan->indio_dev->info->read_raw_multi(chan->indio_dev, | 456 | ret = chan->indio_dev->info->read_raw_multi(chan->indio_dev, |
454 | chan->channel, INDIO_MAX_RAW_ELEMENTS, | 457 | chan->channel, INDIO_MAX_RAW_ELEMENTS, |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 1232336b960e..40dfbc0444c0 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -4029,14 +4029,6 @@ static int device_notifier(struct notifier_block *nb, | |||
4029 | if (action != BUS_NOTIFY_REMOVED_DEVICE) | 4029 | if (action != BUS_NOTIFY_REMOVED_DEVICE) |
4030 | return 0; | 4030 | return 0; |
4031 | 4031 | ||
4032 | /* | ||
4033 | * If the device is still attached to a device driver we can't | ||
4034 | * tear down the domain yet as DMA mappings may still be in use. | ||
4035 | * Wait for the BUS_NOTIFY_UNBOUND_DRIVER event to do that. | ||
4036 | */ | ||
4037 | if (action == BUS_NOTIFY_DEL_DEVICE && dev->driver != NULL) | ||
4038 | return 0; | ||
4039 | |||
4040 | domain = find_domain(dev); | 4032 | domain = find_domain(dev); |
4041 | if (!domain) | 4033 | if (!domain) |
4042 | return 0; | 4034 | return 0; |
@@ -4428,6 +4420,10 @@ static int intel_iommu_attach_device(struct iommu_domain *domain, | |||
4428 | domain_remove_one_dev_info(old_domain, dev); | 4420 | domain_remove_one_dev_info(old_domain, dev); |
4429 | else | 4421 | else |
4430 | domain_remove_dev_info(old_domain); | 4422 | domain_remove_dev_info(old_domain); |
4423 | |||
4424 | if (!domain_type_is_vm_or_si(old_domain) && | ||
4425 | list_empty(&old_domain->devices)) | ||
4426 | domain_exit(old_domain); | ||
4431 | } | 4427 | } |
4432 | } | 4428 | } |
4433 | 4429 | ||
diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c index 68dfb0fd5ee9..748693192c20 100644 --- a/drivers/iommu/ipmmu-vmsa.c +++ b/drivers/iommu/ipmmu-vmsa.c | |||
@@ -558,7 +558,7 @@ static pmd_t *ipmmu_alloc_pmd(struct ipmmu_vmsa_device *mmu, pgd_t *pgd, | |||
558 | 558 | ||
559 | static u64 ipmmu_page_prot(unsigned int prot, u64 type) | 559 | static u64 ipmmu_page_prot(unsigned int prot, u64 type) |
560 | { | 560 | { |
561 | u64 pgprot = ARM_VMSA_PTE_XN | ARM_VMSA_PTE_nG | ARM_VMSA_PTE_AF | 561 | u64 pgprot = ARM_VMSA_PTE_nG | ARM_VMSA_PTE_AF |
562 | | ARM_VMSA_PTE_SH_IS | ARM_VMSA_PTE_AP_UNPRIV | 562 | | ARM_VMSA_PTE_SH_IS | ARM_VMSA_PTE_AP_UNPRIV |
563 | | ARM_VMSA_PTE_NS | type; | 563 | | ARM_VMSA_PTE_NS | type; |
564 | 564 | ||
@@ -568,8 +568,8 @@ static u64 ipmmu_page_prot(unsigned int prot, u64 type) | |||
568 | if (prot & IOMMU_CACHE) | 568 | if (prot & IOMMU_CACHE) |
569 | pgprot |= IMMAIR_ATTR_IDX_WBRWA << ARM_VMSA_PTE_ATTRINDX_SHIFT; | 569 | pgprot |= IMMAIR_ATTR_IDX_WBRWA << ARM_VMSA_PTE_ATTRINDX_SHIFT; |
570 | 570 | ||
571 | if (prot & IOMMU_EXEC) | 571 | if (prot & IOMMU_NOEXEC) |
572 | pgprot &= ~ARM_VMSA_PTE_XN; | 572 | pgprot |= ARM_VMSA_PTE_XN; |
573 | else if (!(prot & (IOMMU_READ | IOMMU_WRITE))) | 573 | else if (!(prot & (IOMMU_READ | IOMMU_WRITE))) |
574 | /* If no access create a faulting entry to avoid TLB fills. */ | 574 | /* If no access create a faulting entry to avoid TLB fills. */ |
575 | pgprot &= ~ARM_VMSA_PTE_PAGE; | 575 | pgprot &= ~ARM_VMSA_PTE_PAGE; |
diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index b2023af384b9..6a8b1ec4a48a 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c | |||
@@ -1009,7 +1009,6 @@ static struct platform_driver rk_iommu_driver = { | |||
1009 | .remove = rk_iommu_remove, | 1009 | .remove = rk_iommu_remove, |
1010 | .driver = { | 1010 | .driver = { |
1011 | .name = "rk_iommu", | 1011 | .name = "rk_iommu", |
1012 | .owner = THIS_MODULE, | ||
1013 | .of_match_table = of_match_ptr(rk_iommu_dt_ids), | 1012 | .of_match_table = of_match_ptr(rk_iommu_dt_ids), |
1014 | }, | 1013 | }, |
1015 | }; | 1014 | }; |
diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c index a82e542ffc21..0b380603a578 100644 --- a/drivers/isdn/hardware/eicon/message.c +++ b/drivers/isdn/hardware/eicon/message.c | |||
@@ -4880,7 +4880,7 @@ static void sig_ind(PLCI *plci) | |||
4880 | byte SS_Ind[] = "\x05\x02\x00\x02\x00\x00"; /* Hold_Ind struct*/ | 4880 | byte SS_Ind[] = "\x05\x02\x00\x02\x00\x00"; /* Hold_Ind struct*/ |
4881 | byte CF_Ind[] = "\x09\x02\x00\x06\x00\x00\x00\x00\x00\x00"; | 4881 | byte CF_Ind[] = "\x09\x02\x00\x06\x00\x00\x00\x00\x00\x00"; |
4882 | byte Interr_Err_Ind[] = "\x0a\x02\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; | 4882 | byte Interr_Err_Ind[] = "\x0a\x02\x00\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; |
4883 | byte CONF_Ind[] = "\x09\x16\x00\x06\x00\x00\0x00\0x00\0x00\0x00"; | 4883 | byte CONF_Ind[] = "\x09\x16\x00\x06\x00\x00\x00\x00\x00\x00"; |
4884 | byte force_mt_info = false; | 4884 | byte force_mt_info = false; |
4885 | byte dir; | 4885 | byte dir; |
4886 | dword d; | 4886 | dword d; |
diff --git a/drivers/leds/leds-netxbig.c b/drivers/leds/leds-netxbig.c index 26515c27ea8c..25e419752a7b 100644 --- a/drivers/leds/leds-netxbig.c +++ b/drivers/leds/leds-netxbig.c | |||
@@ -330,18 +330,18 @@ create_netxbig_led(struct platform_device *pdev, | |||
330 | led_dat->sata = 0; | 330 | led_dat->sata = 0; |
331 | led_dat->cdev.brightness = LED_OFF; | 331 | led_dat->cdev.brightness = LED_OFF; |
332 | led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; | 332 | led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; |
333 | /* | ||
334 | * If available, expose the SATA activity blink capability through | ||
335 | * a "sata" sysfs attribute. | ||
336 | */ | ||
337 | if (led_dat->mode_val[NETXBIG_LED_SATA] != NETXBIG_LED_INVALID_MODE) | ||
338 | led_dat->cdev.groups = netxbig_led_groups; | ||
339 | led_dat->mode_addr = template->mode_addr; | 333 | led_dat->mode_addr = template->mode_addr; |
340 | led_dat->mode_val = template->mode_val; | 334 | led_dat->mode_val = template->mode_val; |
341 | led_dat->bright_addr = template->bright_addr; | 335 | led_dat->bright_addr = template->bright_addr; |
342 | led_dat->bright_max = (1 << pdata->gpio_ext->num_data) - 1; | 336 | led_dat->bright_max = (1 << pdata->gpio_ext->num_data) - 1; |
343 | led_dat->timer = pdata->timer; | 337 | led_dat->timer = pdata->timer; |
344 | led_dat->num_timer = pdata->num_timer; | 338 | led_dat->num_timer = pdata->num_timer; |
339 | /* | ||
340 | * If available, expose the SATA activity blink capability through | ||
341 | * a "sata" sysfs attribute. | ||
342 | */ | ||
343 | if (led_dat->mode_val[NETXBIG_LED_SATA] != NETXBIG_LED_INVALID_MODE) | ||
344 | led_dat->cdev.groups = netxbig_led_groups; | ||
345 | 345 | ||
346 | return led_classdev_register(&pdev->dev, &led_dat->cdev); | 346 | return led_classdev_register(&pdev->dev, &led_dat->cdev); |
347 | } | 347 | } |
diff --git a/drivers/mcb/mcb-internal.h b/drivers/mcb/mcb-internal.h index f956ef26c0ce..fb7493dcfb79 100644 --- a/drivers/mcb/mcb-internal.h +++ b/drivers/mcb/mcb-internal.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #define PCI_DEVICE_ID_MEN_CHAMELEON 0x4d45 | 7 | #define PCI_DEVICE_ID_MEN_CHAMELEON 0x4d45 |
8 | #define CHAMELEON_FILENAME_LEN 12 | 8 | #define CHAMELEON_FILENAME_LEN 12 |
9 | #define CHAMELEONV2_MAGIC 0xabce | 9 | #define CHAMELEONV2_MAGIC 0xabce |
10 | #define CHAM_HEADER_SIZE 0x200 | ||
10 | 11 | ||
11 | enum chameleon_descriptor_type { | 12 | enum chameleon_descriptor_type { |
12 | CHAMELEON_DTYPE_GENERAL = 0x0, | 13 | CHAMELEON_DTYPE_GENERAL = 0x0, |
diff --git a/drivers/mcb/mcb-pci.c b/drivers/mcb/mcb-pci.c index b59181965643..5e1bd5db02c8 100644 --- a/drivers/mcb/mcb-pci.c +++ b/drivers/mcb/mcb-pci.c | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | struct priv { | 18 | struct priv { |
19 | struct mcb_bus *bus; | 19 | struct mcb_bus *bus; |
20 | phys_addr_t mapbase; | ||
20 | void __iomem *base; | 21 | void __iomem *base; |
21 | }; | 22 | }; |
22 | 23 | ||
@@ -31,8 +32,8 @@ static int mcb_pci_get_irq(struct mcb_device *mdev) | |||
31 | 32 | ||
32 | static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | 33 | static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
33 | { | 34 | { |
35 | struct resource *res; | ||
34 | struct priv *priv; | 36 | struct priv *priv; |
35 | phys_addr_t mapbase; | ||
36 | int ret; | 37 | int ret; |
37 | int num_cells; | 38 | int num_cells; |
38 | unsigned long flags; | 39 | unsigned long flags; |
@@ -47,19 +48,21 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
47 | return -ENODEV; | 48 | return -ENODEV; |
48 | } | 49 | } |
49 | 50 | ||
50 | mapbase = pci_resource_start(pdev, 0); | 51 | priv->mapbase = pci_resource_start(pdev, 0); |
51 | if (!mapbase) { | 52 | if (!priv->mapbase) { |
52 | dev_err(&pdev->dev, "No PCI resource\n"); | 53 | dev_err(&pdev->dev, "No PCI resource\n"); |
53 | goto err_start; | 54 | goto err_start; |
54 | } | 55 | } |
55 | 56 | ||
56 | ret = pci_request_region(pdev, 0, KBUILD_MODNAME); | 57 | res = request_mem_region(priv->mapbase, CHAM_HEADER_SIZE, |
57 | if (ret) { | 58 | KBUILD_MODNAME); |
58 | dev_err(&pdev->dev, "Failed to request PCI BARs\n"); | 59 | if (IS_ERR(res)) { |
60 | dev_err(&pdev->dev, "Failed to request PCI memory\n"); | ||
61 | ret = PTR_ERR(res); | ||
59 | goto err_start; | 62 | goto err_start; |
60 | } | 63 | } |
61 | 64 | ||
62 | priv->base = pci_iomap(pdev, 0, 0); | 65 | priv->base = ioremap(priv->mapbase, CHAM_HEADER_SIZE); |
63 | if (!priv->base) { | 66 | if (!priv->base) { |
64 | dev_err(&pdev->dev, "Cannot ioremap\n"); | 67 | dev_err(&pdev->dev, "Cannot ioremap\n"); |
65 | ret = -ENOMEM; | 68 | ret = -ENOMEM; |
@@ -84,7 +87,7 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
84 | 87 | ||
85 | priv->bus->get_irq = mcb_pci_get_irq; | 88 | priv->bus->get_irq = mcb_pci_get_irq; |
86 | 89 | ||
87 | ret = chameleon_parse_cells(priv->bus, mapbase, priv->base); | 90 | ret = chameleon_parse_cells(priv->bus, priv->mapbase, priv->base); |
88 | if (ret < 0) | 91 | if (ret < 0) |
89 | goto err_drvdata; | 92 | goto err_drvdata; |
90 | num_cells = ret; | 93 | num_cells = ret; |
@@ -93,8 +96,10 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
93 | 96 | ||
94 | mcb_bus_add_devices(priv->bus); | 97 | mcb_bus_add_devices(priv->bus); |
95 | 98 | ||
99 | return 0; | ||
100 | |||
96 | err_drvdata: | 101 | err_drvdata: |
97 | pci_iounmap(pdev, priv->base); | 102 | iounmap(priv->base); |
98 | err_ioremap: | 103 | err_ioremap: |
99 | pci_release_region(pdev, 0); | 104 | pci_release_region(pdev, 0); |
100 | err_start: | 105 | err_start: |
@@ -107,6 +112,10 @@ static void mcb_pci_remove(struct pci_dev *pdev) | |||
107 | struct priv *priv = pci_get_drvdata(pdev); | 112 | struct priv *priv = pci_get_drvdata(pdev); |
108 | 113 | ||
109 | mcb_release_bus(priv->bus); | 114 | mcb_release_bus(priv->bus); |
115 | |||
116 | iounmap(priv->base); | ||
117 | release_region(priv->mapbase, CHAM_HEADER_SIZE); | ||
118 | pci_disable_device(pdev); | ||
110 | } | 119 | } |
111 | 120 | ||
112 | static const struct pci_device_id mcb_pci_tbl[] = { | 121 | static const struct pci_device_id mcb_pci_tbl[] = { |
diff --git a/drivers/misc/cxl/context.c b/drivers/misc/cxl/context.c index 51fd6b524371..d1b55fe62817 100644 --- a/drivers/misc/cxl/context.c +++ b/drivers/misc/cxl/context.c | |||
@@ -100,6 +100,46 @@ int cxl_context_init(struct cxl_context *ctx, struct cxl_afu *afu, bool master, | |||
100 | return 0; | 100 | return 0; |
101 | } | 101 | } |
102 | 102 | ||
103 | static int cxl_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | ||
104 | { | ||
105 | struct cxl_context *ctx = vma->vm_file->private_data; | ||
106 | unsigned long address = (unsigned long)vmf->virtual_address; | ||
107 | u64 area, offset; | ||
108 | |||
109 | offset = vmf->pgoff << PAGE_SHIFT; | ||
110 | |||
111 | pr_devel("%s: pe: %i address: 0x%lx offset: 0x%llx\n", | ||
112 | __func__, ctx->pe, address, offset); | ||
113 | |||
114 | if (ctx->afu->current_mode == CXL_MODE_DEDICATED) { | ||
115 | area = ctx->afu->psn_phys; | ||
116 | if (offset > ctx->afu->adapter->ps_size) | ||
117 | return VM_FAULT_SIGBUS; | ||
118 | } else { | ||
119 | area = ctx->psn_phys; | ||
120 | if (offset > ctx->psn_size) | ||
121 | return VM_FAULT_SIGBUS; | ||
122 | } | ||
123 | |||
124 | mutex_lock(&ctx->status_mutex); | ||
125 | |||
126 | if (ctx->status != STARTED) { | ||
127 | mutex_unlock(&ctx->status_mutex); | ||
128 | pr_devel("%s: Context not started, failing problem state access\n", __func__); | ||
129 | return VM_FAULT_SIGBUS; | ||
130 | } | ||
131 | |||
132 | vm_insert_pfn(vma, address, (area + offset) >> PAGE_SHIFT); | ||
133 | |||
134 | mutex_unlock(&ctx->status_mutex); | ||
135 | |||
136 | return VM_FAULT_NOPAGE; | ||
137 | } | ||
138 | |||
139 | static const struct vm_operations_struct cxl_mmap_vmops = { | ||
140 | .fault = cxl_mmap_fault, | ||
141 | }; | ||
142 | |||
103 | /* | 143 | /* |
104 | * Map a per-context mmio space into the given vma. | 144 | * Map a per-context mmio space into the given vma. |
105 | */ | 145 | */ |
@@ -108,26 +148,25 @@ int cxl_context_iomap(struct cxl_context *ctx, struct vm_area_struct *vma) | |||
108 | u64 len = vma->vm_end - vma->vm_start; | 148 | u64 len = vma->vm_end - vma->vm_start; |
109 | len = min(len, ctx->psn_size); | 149 | len = min(len, ctx->psn_size); |
110 | 150 | ||
111 | if (ctx->afu->current_mode == CXL_MODE_DEDICATED) { | 151 | if (ctx->afu->current_mode != CXL_MODE_DEDICATED) { |
112 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 152 | /* make sure there is a valid per process space for this AFU */ |
113 | return vm_iomap_memory(vma, ctx->afu->psn_phys, ctx->afu->adapter->ps_size); | 153 | if ((ctx->master && !ctx->afu->psa) || (!ctx->afu->pp_psa)) { |
114 | } | 154 | pr_devel("AFU doesn't support mmio space\n"); |
155 | return -EINVAL; | ||
156 | } | ||
115 | 157 | ||
116 | /* make sure there is a valid per process space for this AFU */ | 158 | /* Can't mmap until the AFU is enabled */ |
117 | if ((ctx->master && !ctx->afu->psa) || (!ctx->afu->pp_psa)) { | 159 | if (!ctx->afu->enabled) |
118 | pr_devel("AFU doesn't support mmio space\n"); | 160 | return -EBUSY; |
119 | return -EINVAL; | ||
120 | } | 161 | } |
121 | 162 | ||
122 | /* Can't mmap until the AFU is enabled */ | ||
123 | if (!ctx->afu->enabled) | ||
124 | return -EBUSY; | ||
125 | |||
126 | pr_devel("%s: mmio physical: %llx pe: %i master:%i\n", __func__, | 163 | pr_devel("%s: mmio physical: %llx pe: %i master:%i\n", __func__, |
127 | ctx->psn_phys, ctx->pe , ctx->master); | 164 | ctx->psn_phys, ctx->pe , ctx->master); |
128 | 165 | ||
166 | vma->vm_flags |= VM_IO | VM_PFNMAP; | ||
129 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 167 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
130 | return vm_iomap_memory(vma, ctx->psn_phys, len); | 168 | vma->vm_ops = &cxl_mmap_vmops; |
169 | return 0; | ||
131 | } | 170 | } |
132 | 171 | ||
133 | /* | 172 | /* |
@@ -150,12 +189,6 @@ static void __detach_context(struct cxl_context *ctx) | |||
150 | afu_release_irqs(ctx); | 189 | afu_release_irqs(ctx); |
151 | flush_work(&ctx->fault_work); /* Only needed for dedicated process */ | 190 | flush_work(&ctx->fault_work); /* Only needed for dedicated process */ |
152 | wake_up_all(&ctx->wq); | 191 | wake_up_all(&ctx->wq); |
153 | |||
154 | /* Release Problem State Area mapping */ | ||
155 | mutex_lock(&ctx->mapping_lock); | ||
156 | if (ctx->mapping) | ||
157 | unmap_mapping_range(ctx->mapping, 0, 0, 1); | ||
158 | mutex_unlock(&ctx->mapping_lock); | ||
159 | } | 192 | } |
160 | 193 | ||
161 | /* | 194 | /* |
@@ -184,6 +217,17 @@ void cxl_context_detach_all(struct cxl_afu *afu) | |||
184 | * created and torn down after the IDR removed | 217 | * created and torn down after the IDR removed |
185 | */ | 218 | */ |
186 | __detach_context(ctx); | 219 | __detach_context(ctx); |
220 | |||
221 | /* | ||
222 | * We are force detaching - remove any active PSA mappings so | ||
223 | * userspace cannot interfere with the card if it comes back. | ||
224 | * Easiest way to exercise this is to unbind and rebind the | ||
225 | * driver via sysfs while it is in use. | ||
226 | */ | ||
227 | mutex_lock(&ctx->mapping_lock); | ||
228 | if (ctx->mapping) | ||
229 | unmap_mapping_range(ctx->mapping, 0, 0, 1); | ||
230 | mutex_unlock(&ctx->mapping_lock); | ||
187 | } | 231 | } |
188 | mutex_unlock(&afu->contexts_lock); | 232 | mutex_unlock(&afu->contexts_lock); |
189 | } | 233 | } |
diff --git a/drivers/misc/cxl/file.c b/drivers/misc/cxl/file.c index e9f2f10dbb37..b15d8113877c 100644 --- a/drivers/misc/cxl/file.c +++ b/drivers/misc/cxl/file.c | |||
@@ -140,18 +140,20 @@ static long afu_ioctl_start_work(struct cxl_context *ctx, | |||
140 | 140 | ||
141 | pr_devel("%s: pe: %i\n", __func__, ctx->pe); | 141 | pr_devel("%s: pe: %i\n", __func__, ctx->pe); |
142 | 142 | ||
143 | mutex_lock(&ctx->status_mutex); | 143 | /* Do this outside the status_mutex to avoid a circular dependency with |
144 | if (ctx->status != OPENED) { | 144 | * the locking in cxl_mmap_fault() */ |
145 | rc = -EIO; | ||
146 | goto out; | ||
147 | } | ||
148 | |||
149 | if (copy_from_user(&work, uwork, | 145 | if (copy_from_user(&work, uwork, |
150 | sizeof(struct cxl_ioctl_start_work))) { | 146 | sizeof(struct cxl_ioctl_start_work))) { |
151 | rc = -EFAULT; | 147 | rc = -EFAULT; |
152 | goto out; | 148 | goto out; |
153 | } | 149 | } |
154 | 150 | ||
151 | mutex_lock(&ctx->status_mutex); | ||
152 | if (ctx->status != OPENED) { | ||
153 | rc = -EIO; | ||
154 | goto out; | ||
155 | } | ||
156 | |||
155 | /* | 157 | /* |
156 | * if any of the reserved fields are set or any of the unused | 158 | * if any of the reserved fields are set or any of the unused |
157 | * flags are set it's invalid | 159 | * flags are set it's invalid |
diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c index ff2755062b44..06ff0a2ec960 100644 --- a/drivers/misc/mei/hw-me.c +++ b/drivers/misc/mei/hw-me.c | |||
@@ -234,6 +234,18 @@ static int mei_me_hw_reset(struct mei_device *dev, bool intr_enable) | |||
234 | struct mei_me_hw *hw = to_me_hw(dev); | 234 | struct mei_me_hw *hw = to_me_hw(dev); |
235 | u32 hcsr = mei_hcsr_read(hw); | 235 | u32 hcsr = mei_hcsr_read(hw); |
236 | 236 | ||
237 | /* H_RST may be found lit before reset is started, | ||
238 | * for example if preceding reset flow hasn't completed. | ||
239 | * In that case asserting H_RST will be ignored, therefore | ||
240 | * we need to clean H_RST bit to start a successful reset sequence. | ||
241 | */ | ||
242 | if ((hcsr & H_RST) == H_RST) { | ||
243 | dev_warn(dev->dev, "H_RST is set = 0x%08X", hcsr); | ||
244 | hcsr &= ~H_RST; | ||
245 | mei_me_reg_write(hw, H_CSR, hcsr); | ||
246 | hcsr = mei_hcsr_read(hw); | ||
247 | } | ||
248 | |||
237 | hcsr |= H_RST | H_IG | H_IS; | 249 | hcsr |= H_RST | H_IG | H_IS; |
238 | 250 | ||
239 | if (intr_enable) | 251 | if (intr_enable) |
diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c index e3e56d35f0ee..970314e0aac8 100644 --- a/drivers/mmc/host/sdhci-acpi.c +++ b/drivers/mmc/host/sdhci-acpi.c | |||
@@ -247,6 +247,7 @@ static const struct sdhci_acpi_uid_slot sdhci_acpi_uids[] = { | |||
247 | { "INT33BB" , "3" , &sdhci_acpi_slot_int_sd }, | 247 | { "INT33BB" , "3" , &sdhci_acpi_slot_int_sd }, |
248 | { "INT33C6" , NULL, &sdhci_acpi_slot_int_sdio }, | 248 | { "INT33C6" , NULL, &sdhci_acpi_slot_int_sdio }, |
249 | { "INT3436" , NULL, &sdhci_acpi_slot_int_sdio }, | 249 | { "INT3436" , NULL, &sdhci_acpi_slot_int_sdio }, |
250 | { "INT344D" , NULL, &sdhci_acpi_slot_int_sdio }, | ||
250 | { "PNP0D40" }, | 251 | { "PNP0D40" }, |
251 | { }, | 252 | { }, |
252 | }; | 253 | }; |
@@ -257,6 +258,7 @@ static const struct acpi_device_id sdhci_acpi_ids[] = { | |||
257 | { "INT33BB" }, | 258 | { "INT33BB" }, |
258 | { "INT33C6" }, | 259 | { "INT33C6" }, |
259 | { "INT3436" }, | 260 | { "INT3436" }, |
261 | { "INT344D" }, | ||
260 | { "PNP0D40" }, | 262 | { "PNP0D40" }, |
261 | { }, | 263 | { }, |
262 | }; | 264 | }; |
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c index 03427755b902..4f38554ce679 100644 --- a/drivers/mmc/host/sdhci-pci.c +++ b/drivers/mmc/host/sdhci-pci.c | |||
@@ -993,6 +993,31 @@ static const struct pci_device_id pci_ids[] = { | |||
993 | .subdevice = PCI_ANY_ID, | 993 | .subdevice = PCI_ANY_ID, |
994 | .driver_data = (kernel_ulong_t)&sdhci_intel_mrfl_mmc, | 994 | .driver_data = (kernel_ulong_t)&sdhci_intel_mrfl_mmc, |
995 | }, | 995 | }, |
996 | |||
997 | { | ||
998 | .vendor = PCI_VENDOR_ID_INTEL, | ||
999 | .device = PCI_DEVICE_ID_INTEL_SPT_EMMC, | ||
1000 | .subvendor = PCI_ANY_ID, | ||
1001 | .subdevice = PCI_ANY_ID, | ||
1002 | .driver_data = (kernel_ulong_t)&sdhci_intel_byt_emmc, | ||
1003 | }, | ||
1004 | |||
1005 | { | ||
1006 | .vendor = PCI_VENDOR_ID_INTEL, | ||
1007 | .device = PCI_DEVICE_ID_INTEL_SPT_SDIO, | ||
1008 | .subvendor = PCI_ANY_ID, | ||
1009 | .subdevice = PCI_ANY_ID, | ||
1010 | .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sdio, | ||
1011 | }, | ||
1012 | |||
1013 | { | ||
1014 | .vendor = PCI_VENDOR_ID_INTEL, | ||
1015 | .device = PCI_DEVICE_ID_INTEL_SPT_SD, | ||
1016 | .subvendor = PCI_ANY_ID, | ||
1017 | .subdevice = PCI_ANY_ID, | ||
1018 | .driver_data = (kernel_ulong_t)&sdhci_intel_byt_sd, | ||
1019 | }, | ||
1020 | |||
996 | { | 1021 | { |
997 | .vendor = PCI_VENDOR_ID_O2, | 1022 | .vendor = PCI_VENDOR_ID_O2, |
998 | .device = PCI_DEVICE_ID_O2_8120, | 1023 | .device = PCI_DEVICE_ID_O2_8120, |
diff --git a/drivers/mmc/host/sdhci-pci.h b/drivers/mmc/host/sdhci-pci.h index d57c3d169914..1ec684d06d54 100644 --- a/drivers/mmc/host/sdhci-pci.h +++ b/drivers/mmc/host/sdhci-pci.h | |||
@@ -21,6 +21,9 @@ | |||
21 | #define PCI_DEVICE_ID_INTEL_CLV_EMMC0 0x08e5 | 21 | #define PCI_DEVICE_ID_INTEL_CLV_EMMC0 0x08e5 |
22 | #define PCI_DEVICE_ID_INTEL_CLV_EMMC1 0x08e6 | 22 | #define PCI_DEVICE_ID_INTEL_CLV_EMMC1 0x08e6 |
23 | #define PCI_DEVICE_ID_INTEL_QRK_SD 0x08A7 | 23 | #define PCI_DEVICE_ID_INTEL_QRK_SD 0x08A7 |
24 | #define PCI_DEVICE_ID_INTEL_SPT_EMMC 0x9d2b | ||
25 | #define PCI_DEVICE_ID_INTEL_SPT_SDIO 0x9d2c | ||
26 | #define PCI_DEVICE_ID_INTEL_SPT_SD 0x9d2d | ||
24 | 27 | ||
25 | /* | 28 | /* |
26 | * PCI registers | 29 | * PCI registers |
diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c index 45238871192d..ca3424e7ef71 100644 --- a/drivers/mmc/host/sdhci-pxav3.c +++ b/drivers/mmc/host/sdhci-pxav3.c | |||
@@ -300,13 +300,6 @@ static int sdhci_pxav3_probe(struct platform_device *pdev) | |||
300 | if (IS_ERR(host)) | 300 | if (IS_ERR(host)) |
301 | return PTR_ERR(host); | 301 | return PTR_ERR(host); |
302 | 302 | ||
303 | if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) { | ||
304 | ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info()); | ||
305 | if (ret < 0) | ||
306 | goto err_mbus_win; | ||
307 | } | ||
308 | |||
309 | |||
310 | pltfm_host = sdhci_priv(host); | 303 | pltfm_host = sdhci_priv(host); |
311 | pltfm_host->priv = pxa; | 304 | pltfm_host->priv = pxa; |
312 | 305 | ||
@@ -325,6 +318,12 @@ static int sdhci_pxav3_probe(struct platform_device *pdev) | |||
325 | if (!IS_ERR(pxa->clk_core)) | 318 | if (!IS_ERR(pxa->clk_core)) |
326 | clk_prepare_enable(pxa->clk_core); | 319 | clk_prepare_enable(pxa->clk_core); |
327 | 320 | ||
321 | if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) { | ||
322 | ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info()); | ||
323 | if (ret < 0) | ||
324 | goto err_mbus_win; | ||
325 | } | ||
326 | |||
328 | /* enable 1/8V DDR capable */ | 327 | /* enable 1/8V DDR capable */ |
329 | host->mmc->caps |= MMC_CAP_1_8V_DDR; | 328 | host->mmc->caps |= MMC_CAP_1_8V_DDR; |
330 | 329 | ||
@@ -396,11 +395,11 @@ err_add_host: | |||
396 | pm_runtime_disable(&pdev->dev); | 395 | pm_runtime_disable(&pdev->dev); |
397 | err_of_parse: | 396 | err_of_parse: |
398 | err_cd_req: | 397 | err_cd_req: |
398 | err_mbus_win: | ||
399 | clk_disable_unprepare(pxa->clk_io); | 399 | clk_disable_unprepare(pxa->clk_io); |
400 | if (!IS_ERR(pxa->clk_core)) | 400 | if (!IS_ERR(pxa->clk_core)) |
401 | clk_disable_unprepare(pxa->clk_core); | 401 | clk_disable_unprepare(pxa->clk_core); |
402 | err_clk_get: | 402 | err_clk_get: |
403 | err_mbus_win: | ||
404 | sdhci_pltfm_free(pdev); | 403 | sdhci_pltfm_free(pdev); |
405 | return ret; | 404 | return ret; |
406 | } | 405 | } |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index cbb245b58538..f1a488ee432f 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -259,8 +259,6 @@ static void sdhci_reinit(struct sdhci_host *host) | |||
259 | 259 | ||
260 | del_timer_sync(&host->tuning_timer); | 260 | del_timer_sync(&host->tuning_timer); |
261 | host->flags &= ~SDHCI_NEEDS_RETUNING; | 261 | host->flags &= ~SDHCI_NEEDS_RETUNING; |
262 | host->mmc->max_blk_count = | ||
263 | (host->quirks & SDHCI_QUIRK_NO_MULTIBLOCK) ? 1 : 65535; | ||
264 | } | 262 | } |
265 | sdhci_enable_card_detection(host); | 263 | sdhci_enable_card_detection(host); |
266 | } | 264 | } |
@@ -1273,6 +1271,12 @@ static void sdhci_set_power(struct sdhci_host *host, unsigned char mode, | |||
1273 | spin_unlock_irq(&host->lock); | 1271 | spin_unlock_irq(&host->lock); |
1274 | mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd); | 1272 | mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd); |
1275 | spin_lock_irq(&host->lock); | 1273 | spin_lock_irq(&host->lock); |
1274 | |||
1275 | if (mode != MMC_POWER_OFF) | ||
1276 | sdhci_writeb(host, SDHCI_POWER_ON, SDHCI_POWER_CONTROL); | ||
1277 | else | ||
1278 | sdhci_writeb(host, 0, SDHCI_POWER_CONTROL); | ||
1279 | |||
1276 | return; | 1280 | return; |
1277 | } | 1281 | } |
1278 | 1282 | ||
@@ -1353,6 +1357,8 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
1353 | 1357 | ||
1354 | sdhci_runtime_pm_get(host); | 1358 | sdhci_runtime_pm_get(host); |
1355 | 1359 | ||
1360 | present = mmc_gpio_get_cd(host->mmc); | ||
1361 | |||
1356 | spin_lock_irqsave(&host->lock, flags); | 1362 | spin_lock_irqsave(&host->lock, flags); |
1357 | 1363 | ||
1358 | WARN_ON(host->mrq != NULL); | 1364 | WARN_ON(host->mrq != NULL); |
@@ -1381,7 +1387,6 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
1381 | * zero: cd-gpio is used, and card is removed | 1387 | * zero: cd-gpio is used, and card is removed |
1382 | * one: cd-gpio is used, and card is present | 1388 | * one: cd-gpio is used, and card is present |
1383 | */ | 1389 | */ |
1384 | present = mmc_gpio_get_cd(host->mmc); | ||
1385 | if (present < 0) { | 1390 | if (present < 0) { |
1386 | /* If polling, assume that the card is always present. */ | 1391 | /* If polling, assume that the card is always present. */ |
1387 | if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) | 1392 | if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) |
@@ -1880,6 +1885,18 @@ static int sdhci_card_busy(struct mmc_host *mmc) | |||
1880 | return !(present_state & SDHCI_DATA_LVL_MASK); | 1885 | return !(present_state & SDHCI_DATA_LVL_MASK); |
1881 | } | 1886 | } |
1882 | 1887 | ||
1888 | static int sdhci_prepare_hs400_tuning(struct mmc_host *mmc, struct mmc_ios *ios) | ||
1889 | { | ||
1890 | struct sdhci_host *host = mmc_priv(mmc); | ||
1891 | unsigned long flags; | ||
1892 | |||
1893 | spin_lock_irqsave(&host->lock, flags); | ||
1894 | host->flags |= SDHCI_HS400_TUNING; | ||
1895 | spin_unlock_irqrestore(&host->lock, flags); | ||
1896 | |||
1897 | return 0; | ||
1898 | } | ||
1899 | |||
1883 | static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) | 1900 | static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) |
1884 | { | 1901 | { |
1885 | struct sdhci_host *host = mmc_priv(mmc); | 1902 | struct sdhci_host *host = mmc_priv(mmc); |
@@ -1887,10 +1904,18 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) | |||
1887 | int tuning_loop_counter = MAX_TUNING_LOOP; | 1904 | int tuning_loop_counter = MAX_TUNING_LOOP; |
1888 | int err = 0; | 1905 | int err = 0; |
1889 | unsigned long flags; | 1906 | unsigned long flags; |
1907 | unsigned int tuning_count = 0; | ||
1908 | bool hs400_tuning; | ||
1890 | 1909 | ||
1891 | sdhci_runtime_pm_get(host); | 1910 | sdhci_runtime_pm_get(host); |
1892 | spin_lock_irqsave(&host->lock, flags); | 1911 | spin_lock_irqsave(&host->lock, flags); |
1893 | 1912 | ||
1913 | hs400_tuning = host->flags & SDHCI_HS400_TUNING; | ||
1914 | host->flags &= ~SDHCI_HS400_TUNING; | ||
1915 | |||
1916 | if (host->tuning_mode == SDHCI_TUNING_MODE_1) | ||
1917 | tuning_count = host->tuning_count; | ||
1918 | |||
1894 | /* | 1919 | /* |
1895 | * The Host Controller needs tuning only in case of SDR104 mode | 1920 | * The Host Controller needs tuning only in case of SDR104 mode |
1896 | * and for SDR50 mode when Use Tuning for SDR50 is set in the | 1921 | * and for SDR50 mode when Use Tuning for SDR50 is set in the |
@@ -1899,8 +1924,20 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) | |||
1899 | * tuning function has to be executed. | 1924 | * tuning function has to be executed. |
1900 | */ | 1925 | */ |
1901 | switch (host->timing) { | 1926 | switch (host->timing) { |
1927 | /* HS400 tuning is done in HS200 mode */ | ||
1902 | case MMC_TIMING_MMC_HS400: | 1928 | case MMC_TIMING_MMC_HS400: |
1929 | err = -EINVAL; | ||
1930 | goto out_unlock; | ||
1931 | |||
1903 | case MMC_TIMING_MMC_HS200: | 1932 | case MMC_TIMING_MMC_HS200: |
1933 | /* | ||
1934 | * Periodic re-tuning for HS400 is not expected to be needed, so | ||
1935 | * disable it here. | ||
1936 | */ | ||
1937 | if (hs400_tuning) | ||
1938 | tuning_count = 0; | ||
1939 | break; | ||
1940 | |||
1904 | case MMC_TIMING_UHS_SDR104: | 1941 | case MMC_TIMING_UHS_SDR104: |
1905 | break; | 1942 | break; |
1906 | 1943 | ||
@@ -1911,9 +1948,7 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) | |||
1911 | /* FALLTHROUGH */ | 1948 | /* FALLTHROUGH */ |
1912 | 1949 | ||
1913 | default: | 1950 | default: |
1914 | spin_unlock_irqrestore(&host->lock, flags); | 1951 | goto out_unlock; |
1915 | sdhci_runtime_pm_put(host); | ||
1916 | return 0; | ||
1917 | } | 1952 | } |
1918 | 1953 | ||
1919 | if (host->ops->platform_execute_tuning) { | 1954 | if (host->ops->platform_execute_tuning) { |
@@ -2037,24 +2072,11 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) | |||
2037 | } | 2072 | } |
2038 | 2073 | ||
2039 | out: | 2074 | out: |
2040 | /* | 2075 | host->flags &= ~SDHCI_NEEDS_RETUNING; |
2041 | * If this is the very first time we are here, we start the retuning | 2076 | |
2042 | * timer. Since only during the first time, SDHCI_NEEDS_RETUNING | 2077 | if (tuning_count) { |
2043 | * flag won't be set, we check this condition before actually starting | ||
2044 | * the timer. | ||
2045 | */ | ||
2046 | if (!(host->flags & SDHCI_NEEDS_RETUNING) && host->tuning_count && | ||
2047 | (host->tuning_mode == SDHCI_TUNING_MODE_1)) { | ||
2048 | host->flags |= SDHCI_USING_RETUNING_TIMER; | 2078 | host->flags |= SDHCI_USING_RETUNING_TIMER; |
2049 | mod_timer(&host->tuning_timer, jiffies + | 2079 | mod_timer(&host->tuning_timer, jiffies + tuning_count * HZ); |
2050 | host->tuning_count * HZ); | ||
2051 | /* Tuning mode 1 limits the maximum data length to 4MB */ | ||
2052 | mmc->max_blk_count = (4 * 1024 * 1024) / mmc->max_blk_size; | ||
2053 | } else if (host->flags & SDHCI_USING_RETUNING_TIMER) { | ||
2054 | host->flags &= ~SDHCI_NEEDS_RETUNING; | ||
2055 | /* Reload the new initial value for timer */ | ||
2056 | mod_timer(&host->tuning_timer, jiffies + | ||
2057 | host->tuning_count * HZ); | ||
2058 | } | 2080 | } |
2059 | 2081 | ||
2060 | /* | 2082 | /* |
@@ -2070,6 +2092,7 @@ out: | |||
2070 | 2092 | ||
2071 | sdhci_writel(host, host->ier, SDHCI_INT_ENABLE); | 2093 | sdhci_writel(host, host->ier, SDHCI_INT_ENABLE); |
2072 | sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); | 2094 | sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); |
2095 | out_unlock: | ||
2073 | spin_unlock_irqrestore(&host->lock, flags); | 2096 | spin_unlock_irqrestore(&host->lock, flags); |
2074 | sdhci_runtime_pm_put(host); | 2097 | sdhci_runtime_pm_put(host); |
2075 | 2098 | ||
@@ -2110,15 +2133,18 @@ static void sdhci_card_event(struct mmc_host *mmc) | |||
2110 | { | 2133 | { |
2111 | struct sdhci_host *host = mmc_priv(mmc); | 2134 | struct sdhci_host *host = mmc_priv(mmc); |
2112 | unsigned long flags; | 2135 | unsigned long flags; |
2136 | int present; | ||
2113 | 2137 | ||
2114 | /* First check if client has provided their own card event */ | 2138 | /* First check if client has provided their own card event */ |
2115 | if (host->ops->card_event) | 2139 | if (host->ops->card_event) |
2116 | host->ops->card_event(host); | 2140 | host->ops->card_event(host); |
2117 | 2141 | ||
2142 | present = sdhci_do_get_cd(host); | ||
2143 | |||
2118 | spin_lock_irqsave(&host->lock, flags); | 2144 | spin_lock_irqsave(&host->lock, flags); |
2119 | 2145 | ||
2120 | /* Check host->mrq first in case we are runtime suspended */ | 2146 | /* Check host->mrq first in case we are runtime suspended */ |
2121 | if (host->mrq && !sdhci_do_get_cd(host)) { | 2147 | if (host->mrq && !present) { |
2122 | pr_err("%s: Card removed during transfer!\n", | 2148 | pr_err("%s: Card removed during transfer!\n", |
2123 | mmc_hostname(host->mmc)); | 2149 | mmc_hostname(host->mmc)); |
2124 | pr_err("%s: Resetting controller.\n", | 2150 | pr_err("%s: Resetting controller.\n", |
@@ -2142,6 +2168,7 @@ static const struct mmc_host_ops sdhci_ops = { | |||
2142 | .hw_reset = sdhci_hw_reset, | 2168 | .hw_reset = sdhci_hw_reset, |
2143 | .enable_sdio_irq = sdhci_enable_sdio_irq, | 2169 | .enable_sdio_irq = sdhci_enable_sdio_irq, |
2144 | .start_signal_voltage_switch = sdhci_start_signal_voltage_switch, | 2170 | .start_signal_voltage_switch = sdhci_start_signal_voltage_switch, |
2171 | .prepare_hs400_tuning = sdhci_prepare_hs400_tuning, | ||
2145 | .execute_tuning = sdhci_execute_tuning, | 2172 | .execute_tuning = sdhci_execute_tuning, |
2146 | .card_event = sdhci_card_event, | 2173 | .card_event = sdhci_card_event, |
2147 | .card_busy = sdhci_card_busy, | 2174 | .card_busy = sdhci_card_busy, |
@@ -3260,8 +3287,9 @@ int sdhci_add_host(struct sdhci_host *host) | |||
3260 | mmc->max_segs = SDHCI_MAX_SEGS; | 3287 | mmc->max_segs = SDHCI_MAX_SEGS; |
3261 | 3288 | ||
3262 | /* | 3289 | /* |
3263 | * Maximum number of sectors in one transfer. Limited by DMA boundary | 3290 | * Maximum number of sectors in one transfer. Limited by SDMA boundary |
3264 | * size (512KiB). | 3291 | * size (512KiB). Note some tuning modes impose a 4MiB limit, but this |
3292 | * is less anyway. | ||
3265 | */ | 3293 | */ |
3266 | mmc->max_req_size = 524288; | 3294 | mmc->max_req_size = 524288; |
3267 | 3295 | ||
diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c index 1fcd5568a352..f3470d96837a 100644 --- a/drivers/net/ethernet/allwinner/sun4i-emac.c +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c | |||
@@ -850,8 +850,10 @@ static int emac_probe(struct platform_device *pdev) | |||
850 | } | 850 | } |
851 | 851 | ||
852 | db->clk = devm_clk_get(&pdev->dev, NULL); | 852 | db->clk = devm_clk_get(&pdev->dev, NULL); |
853 | if (IS_ERR(db->clk)) | 853 | if (IS_ERR(db->clk)) { |
854 | ret = PTR_ERR(db->clk); | ||
854 | goto out; | 855 | goto out; |
856 | } | ||
855 | 857 | ||
856 | clk_prepare_enable(db->clk); | 858 | clk_prepare_enable(db->clk); |
857 | 859 | ||
diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c index 3498760dc22a..760c72c6e2ac 100644 --- a/drivers/net/ethernet/altera/altera_tse_main.c +++ b/drivers/net/ethernet/altera/altera_tse_main.c | |||
@@ -1170,10 +1170,6 @@ tx_request_irq_error: | |||
1170 | init_error: | 1170 | init_error: |
1171 | free_skbufs(dev); | 1171 | free_skbufs(dev); |
1172 | alloc_skbuf_error: | 1172 | alloc_skbuf_error: |
1173 | if (priv->phydev) { | ||
1174 | phy_disconnect(priv->phydev); | ||
1175 | priv->phydev = NULL; | ||
1176 | } | ||
1177 | phy_error: | 1173 | phy_error: |
1178 | return ret; | 1174 | return ret; |
1179 | } | 1175 | } |
@@ -1186,12 +1182,9 @@ static int tse_shutdown(struct net_device *dev) | |||
1186 | int ret; | 1182 | int ret; |
1187 | unsigned long int flags; | 1183 | unsigned long int flags; |
1188 | 1184 | ||
1189 | /* Stop and disconnect the PHY */ | 1185 | /* Stop the PHY */ |
1190 | if (priv->phydev) { | 1186 | if (priv->phydev) |
1191 | phy_stop(priv->phydev); | 1187 | phy_stop(priv->phydev); |
1192 | phy_disconnect(priv->phydev); | ||
1193 | priv->phydev = NULL; | ||
1194 | } | ||
1195 | 1188 | ||
1196 | netif_stop_queue(dev); | 1189 | netif_stop_queue(dev); |
1197 | napi_disable(&priv->napi); | 1190 | napi_disable(&priv->napi); |
@@ -1525,6 +1518,10 @@ err_free_netdev: | |||
1525 | static int altera_tse_remove(struct platform_device *pdev) | 1518 | static int altera_tse_remove(struct platform_device *pdev) |
1526 | { | 1519 | { |
1527 | struct net_device *ndev = platform_get_drvdata(pdev); | 1520 | struct net_device *ndev = platform_get_drvdata(pdev); |
1521 | struct altera_tse_private *priv = netdev_priv(ndev); | ||
1522 | |||
1523 | if (priv->phydev) | ||
1524 | phy_disconnect(priv->phydev); | ||
1528 | 1525 | ||
1529 | platform_set_drvdata(pdev, NULL); | 1526 | platform_set_drvdata(pdev, NULL); |
1530 | altera_tse_mdio_destroy(ndev); | 1527 | altera_tse_mdio_destroy(ndev); |
diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c index e398eda07298..c8af3ce3ea38 100644 --- a/drivers/net/ethernet/atheros/alx/main.c +++ b/drivers/net/ethernet/atheros/alx/main.c | |||
@@ -184,15 +184,16 @@ static void alx_schedule_reset(struct alx_priv *alx) | |||
184 | schedule_work(&alx->reset_wk); | 184 | schedule_work(&alx->reset_wk); |
185 | } | 185 | } |
186 | 186 | ||
187 | static bool alx_clean_rx_irq(struct alx_priv *alx, int budget) | 187 | static int alx_clean_rx_irq(struct alx_priv *alx, int budget) |
188 | { | 188 | { |
189 | struct alx_rx_queue *rxq = &alx->rxq; | 189 | struct alx_rx_queue *rxq = &alx->rxq; |
190 | struct alx_rrd *rrd; | 190 | struct alx_rrd *rrd; |
191 | struct alx_buffer *rxb; | 191 | struct alx_buffer *rxb; |
192 | struct sk_buff *skb; | 192 | struct sk_buff *skb; |
193 | u16 length, rfd_cleaned = 0; | 193 | u16 length, rfd_cleaned = 0; |
194 | int work = 0; | ||
194 | 195 | ||
195 | while (budget > 0) { | 196 | while (work < budget) { |
196 | rrd = &rxq->rrd[rxq->rrd_read_idx]; | 197 | rrd = &rxq->rrd[rxq->rrd_read_idx]; |
197 | if (!(rrd->word3 & cpu_to_le32(1 << RRD_UPDATED_SHIFT))) | 198 | if (!(rrd->word3 & cpu_to_le32(1 << RRD_UPDATED_SHIFT))) |
198 | break; | 199 | break; |
@@ -203,7 +204,7 @@ static bool alx_clean_rx_irq(struct alx_priv *alx, int budget) | |||
203 | ALX_GET_FIELD(le32_to_cpu(rrd->word0), | 204 | ALX_GET_FIELD(le32_to_cpu(rrd->word0), |
204 | RRD_NOR) != 1) { | 205 | RRD_NOR) != 1) { |
205 | alx_schedule_reset(alx); | 206 | alx_schedule_reset(alx); |
206 | return 0; | 207 | return work; |
207 | } | 208 | } |
208 | 209 | ||
209 | rxb = &rxq->bufs[rxq->read_idx]; | 210 | rxb = &rxq->bufs[rxq->read_idx]; |
@@ -243,7 +244,7 @@ static bool alx_clean_rx_irq(struct alx_priv *alx, int budget) | |||
243 | } | 244 | } |
244 | 245 | ||
245 | napi_gro_receive(&alx->napi, skb); | 246 | napi_gro_receive(&alx->napi, skb); |
246 | budget--; | 247 | work++; |
247 | 248 | ||
248 | next_pkt: | 249 | next_pkt: |
249 | if (++rxq->read_idx == alx->rx_ringsz) | 250 | if (++rxq->read_idx == alx->rx_ringsz) |
@@ -258,21 +259,22 @@ next_pkt: | |||
258 | if (rfd_cleaned) | 259 | if (rfd_cleaned) |
259 | alx_refill_rx_ring(alx, GFP_ATOMIC); | 260 | alx_refill_rx_ring(alx, GFP_ATOMIC); |
260 | 261 | ||
261 | return budget > 0; | 262 | return work; |
262 | } | 263 | } |
263 | 264 | ||
264 | static int alx_poll(struct napi_struct *napi, int budget) | 265 | static int alx_poll(struct napi_struct *napi, int budget) |
265 | { | 266 | { |
266 | struct alx_priv *alx = container_of(napi, struct alx_priv, napi); | 267 | struct alx_priv *alx = container_of(napi, struct alx_priv, napi); |
267 | struct alx_hw *hw = &alx->hw; | 268 | struct alx_hw *hw = &alx->hw; |
268 | bool complete = true; | ||
269 | unsigned long flags; | 269 | unsigned long flags; |
270 | bool tx_complete; | ||
271 | int work; | ||
270 | 272 | ||
271 | complete = alx_clean_tx_irq(alx) && | 273 | tx_complete = alx_clean_tx_irq(alx); |
272 | alx_clean_rx_irq(alx, budget); | 274 | work = alx_clean_rx_irq(alx, budget); |
273 | 275 | ||
274 | if (!complete) | 276 | if (!tx_complete || work == budget) |
275 | return 1; | 277 | return budget; |
276 | 278 | ||
277 | napi_complete(&alx->napi); | 279 | napi_complete(&alx->napi); |
278 | 280 | ||
@@ -284,7 +286,7 @@ static int alx_poll(struct napi_struct *napi, int budget) | |||
284 | 286 | ||
285 | alx_post_write(hw); | 287 | alx_post_write(hw); |
286 | 288 | ||
287 | return 0; | 289 | return work; |
288 | } | 290 | } |
289 | 291 | ||
290 | static irqreturn_t alx_intr_handle(struct alx_priv *alx, u32 intr) | 292 | static irqreturn_t alx_intr_handle(struct alx_priv *alx, u32 intr) |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 553dcd8a9df2..96bf01ba32dd 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -7413,6 +7413,8 @@ static inline void tg3_netif_start(struct tg3 *tp) | |||
7413 | } | 7413 | } |
7414 | 7414 | ||
7415 | static void tg3_irq_quiesce(struct tg3 *tp) | 7415 | static void tg3_irq_quiesce(struct tg3 *tp) |
7416 | __releases(tp->lock) | ||
7417 | __acquires(tp->lock) | ||
7416 | { | 7418 | { |
7417 | int i; | 7419 | int i; |
7418 | 7420 | ||
@@ -7421,8 +7423,12 @@ static void tg3_irq_quiesce(struct tg3 *tp) | |||
7421 | tp->irq_sync = 1; | 7423 | tp->irq_sync = 1; |
7422 | smp_mb(); | 7424 | smp_mb(); |
7423 | 7425 | ||
7426 | spin_unlock_bh(&tp->lock); | ||
7427 | |||
7424 | for (i = 0; i < tp->irq_cnt; i++) | 7428 | for (i = 0; i < tp->irq_cnt; i++) |
7425 | synchronize_irq(tp->napi[i].irq_vec); | 7429 | synchronize_irq(tp->napi[i].irq_vec); |
7430 | |||
7431 | spin_lock_bh(&tp->lock); | ||
7426 | } | 7432 | } |
7427 | 7433 | ||
7428 | /* Fully shutdown all tg3 driver activity elsewhere in the system. | 7434 | /* Fully shutdown all tg3 driver activity elsewhere in the system. |
@@ -9018,6 +9024,8 @@ static void tg3_restore_clk(struct tg3 *tp) | |||
9018 | 9024 | ||
9019 | /* tp->lock is held. */ | 9025 | /* tp->lock is held. */ |
9020 | static int tg3_chip_reset(struct tg3 *tp) | 9026 | static int tg3_chip_reset(struct tg3 *tp) |
9027 | __releases(tp->lock) | ||
9028 | __acquires(tp->lock) | ||
9021 | { | 9029 | { |
9022 | u32 val; | 9030 | u32 val; |
9023 | void (*write_op)(struct tg3 *, u32, u32); | 9031 | void (*write_op)(struct tg3 *, u32, u32); |
@@ -9073,9 +9081,13 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
9073 | } | 9081 | } |
9074 | smp_mb(); | 9082 | smp_mb(); |
9075 | 9083 | ||
9084 | tg3_full_unlock(tp); | ||
9085 | |||
9076 | for (i = 0; i < tp->irq_cnt; i++) | 9086 | for (i = 0; i < tp->irq_cnt; i++) |
9077 | synchronize_irq(tp->napi[i].irq_vec); | 9087 | synchronize_irq(tp->napi[i].irq_vec); |
9078 | 9088 | ||
9089 | tg3_full_lock(tp, 0); | ||
9090 | |||
9079 | if (tg3_asic_rev(tp) == ASIC_REV_57780) { | 9091 | if (tg3_asic_rev(tp) == ASIC_REV_57780) { |
9080 | val = tr32(TG3_PCIE_LNKCTL) & ~TG3_PCIE_LNKCTL_L1_PLL_PD_EN; | 9092 | val = tr32(TG3_PCIE_LNKCTL) & ~TG3_PCIE_LNKCTL_L1_PLL_PD_EN; |
9081 | tw32(TG3_PCIE_LNKCTL, val | TG3_PCIE_LNKCTL_L1_PLL_PD_DIS); | 9093 | tw32(TG3_PCIE_LNKCTL, val | TG3_PCIE_LNKCTL_L1_PLL_PD_DIS); |
@@ -10903,11 +10915,13 @@ static void tg3_timer(unsigned long __opaque) | |||
10903 | { | 10915 | { |
10904 | struct tg3 *tp = (struct tg3 *) __opaque; | 10916 | struct tg3 *tp = (struct tg3 *) __opaque; |
10905 | 10917 | ||
10906 | if (tp->irq_sync || tg3_flag(tp, RESET_TASK_PENDING)) | ||
10907 | goto restart_timer; | ||
10908 | |||
10909 | spin_lock(&tp->lock); | 10918 | spin_lock(&tp->lock); |
10910 | 10919 | ||
10920 | if (tp->irq_sync || tg3_flag(tp, RESET_TASK_PENDING)) { | ||
10921 | spin_unlock(&tp->lock); | ||
10922 | goto restart_timer; | ||
10923 | } | ||
10924 | |||
10911 | if (tg3_asic_rev(tp) == ASIC_REV_5717 || | 10925 | if (tg3_asic_rev(tp) == ASIC_REV_5717 || |
10912 | tg3_flag(tp, 57765_CLASS)) | 10926 | tg3_flag(tp, 57765_CLASS)) |
10913 | tg3_chk_missed_msi(tp); | 10927 | tg3_chk_missed_msi(tp); |
@@ -11101,11 +11115,13 @@ static void tg3_reset_task(struct work_struct *work) | |||
11101 | struct tg3 *tp = container_of(work, struct tg3, reset_task); | 11115 | struct tg3 *tp = container_of(work, struct tg3, reset_task); |
11102 | int err; | 11116 | int err; |
11103 | 11117 | ||
11118 | rtnl_lock(); | ||
11104 | tg3_full_lock(tp, 0); | 11119 | tg3_full_lock(tp, 0); |
11105 | 11120 | ||
11106 | if (!netif_running(tp->dev)) { | 11121 | if (!netif_running(tp->dev)) { |
11107 | tg3_flag_clear(tp, RESET_TASK_PENDING); | 11122 | tg3_flag_clear(tp, RESET_TASK_PENDING); |
11108 | tg3_full_unlock(tp); | 11123 | tg3_full_unlock(tp); |
11124 | rtnl_unlock(); | ||
11109 | return; | 11125 | return; |
11110 | } | 11126 | } |
11111 | 11127 | ||
@@ -11138,6 +11154,7 @@ out: | |||
11138 | tg3_phy_start(tp); | 11154 | tg3_phy_start(tp); |
11139 | 11155 | ||
11140 | tg3_flag_clear(tp, RESET_TASK_PENDING); | 11156 | tg3_flag_clear(tp, RESET_TASK_PENDING); |
11157 | rtnl_unlock(); | ||
11141 | } | 11158 | } |
11142 | 11159 | ||
11143 | static int tg3_request_irq(struct tg3 *tp, int irq_num) | 11160 | static int tg3_request_irq(struct tg3 *tp, int irq_num) |
diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c index 55eb7f2af2b4..7ef55f5fa664 100644 --- a/drivers/net/ethernet/cadence/at91_ether.c +++ b/drivers/net/ethernet/cadence/at91_ether.c | |||
@@ -340,7 +340,7 @@ static int __init at91ether_probe(struct platform_device *pdev) | |||
340 | res = PTR_ERR(lp->pclk); | 340 | res = PTR_ERR(lp->pclk); |
341 | goto err_free_dev; | 341 | goto err_free_dev; |
342 | } | 342 | } |
343 | clk_enable(lp->pclk); | 343 | clk_prepare_enable(lp->pclk); |
344 | 344 | ||
345 | lp->hclk = ERR_PTR(-ENOENT); | 345 | lp->hclk = ERR_PTR(-ENOENT); |
346 | lp->tx_clk = ERR_PTR(-ENOENT); | 346 | lp->tx_clk = ERR_PTR(-ENOENT); |
@@ -406,7 +406,7 @@ static int __init at91ether_probe(struct platform_device *pdev) | |||
406 | err_out_unregister_netdev: | 406 | err_out_unregister_netdev: |
407 | unregister_netdev(dev); | 407 | unregister_netdev(dev); |
408 | err_disable_clock: | 408 | err_disable_clock: |
409 | clk_disable(lp->pclk); | 409 | clk_disable_unprepare(lp->pclk); |
410 | err_free_dev: | 410 | err_free_dev: |
411 | free_netdev(dev); | 411 | free_netdev(dev); |
412 | return res; | 412 | return res; |
@@ -424,7 +424,7 @@ static int at91ether_remove(struct platform_device *pdev) | |||
424 | kfree(lp->mii_bus->irq); | 424 | kfree(lp->mii_bus->irq); |
425 | mdiobus_free(lp->mii_bus); | 425 | mdiobus_free(lp->mii_bus); |
426 | unregister_netdev(dev); | 426 | unregister_netdev(dev); |
427 | clk_disable(lp->pclk); | 427 | clk_disable_unprepare(lp->pclk); |
428 | free_netdev(dev); | 428 | free_netdev(dev); |
429 | 429 | ||
430 | return 0; | 430 | return 0; |
@@ -440,7 +440,7 @@ static int at91ether_suspend(struct platform_device *pdev, pm_message_t mesg) | |||
440 | netif_stop_queue(net_dev); | 440 | netif_stop_queue(net_dev); |
441 | netif_device_detach(net_dev); | 441 | netif_device_detach(net_dev); |
442 | 442 | ||
443 | clk_disable(lp->pclk); | 443 | clk_disable_unprepare(lp->pclk); |
444 | } | 444 | } |
445 | return 0; | 445 | return 0; |
446 | } | 446 | } |
@@ -451,7 +451,7 @@ static int at91ether_resume(struct platform_device *pdev) | |||
451 | struct macb *lp = netdev_priv(net_dev); | 451 | struct macb *lp = netdev_priv(net_dev); |
452 | 452 | ||
453 | if (netif_running(net_dev)) { | 453 | if (netif_running(net_dev)) { |
454 | clk_enable(lp->pclk); | 454 | clk_prepare_enable(lp->pclk); |
455 | 455 | ||
456 | netif_device_attach(net_dev); | 456 | netif_device_attach(net_dev); |
457 | netif_start_queue(net_dev); | 457 | netif_start_queue(net_dev); |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c index 2215d432a059..a936ee8958c7 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | |||
@@ -2430,7 +2430,7 @@ static void cfg_queues(struct adapter *adapter) | |||
2430 | */ | 2430 | */ |
2431 | n10g = 0; | 2431 | n10g = 0; |
2432 | for_each_port(adapter, pidx) | 2432 | for_each_port(adapter, pidx) |
2433 | n10g += is_10g_port(&adap2pinfo(adapter, pidx)->link_cfg); | 2433 | n10g += is_x_10g_port(&adap2pinfo(adapter, pidx)->link_cfg); |
2434 | 2434 | ||
2435 | /* | 2435 | /* |
2436 | * We default to 1 queue per non-10G port and up to # of cores queues | 2436 | * We default to 1 queue per non-10G port and up to # of cores queues |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c index 21dc9a20308c..60426cf890a7 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c | |||
@@ -323,6 +323,8 @@ int t4vf_port_init(struct adapter *adapter, int pidx) | |||
323 | return v; | 323 | return v; |
324 | 324 | ||
325 | v = be32_to_cpu(port_rpl.u.info.lstatus_to_modtype); | 325 | v = be32_to_cpu(port_rpl.u.info.lstatus_to_modtype); |
326 | pi->mdio_addr = (v & FW_PORT_CMD_MDIOCAP_F) ? | ||
327 | FW_PORT_CMD_MDIOADDR_G(v) : -1; | ||
326 | pi->port_type = FW_PORT_CMD_PTYPE_G(v); | 328 | pi->port_type = FW_PORT_CMD_PTYPE_G(v); |
327 | pi->mod_type = FW_PORT_MOD_TYPE_NA; | 329 | pi->mod_type = FW_PORT_MOD_TYPE_NA; |
328 | 330 | ||
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index 705f334ebb85..b29e027c476e 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c | |||
@@ -1616,7 +1616,7 @@ static int enic_open(struct net_device *netdev) | |||
1616 | if (vnic_rq_desc_used(&enic->rq[i]) == 0) { | 1616 | if (vnic_rq_desc_used(&enic->rq[i]) == 0) { |
1617 | netdev_err(netdev, "Unable to alloc receive buffers\n"); | 1617 | netdev_err(netdev, "Unable to alloc receive buffers\n"); |
1618 | err = -ENOMEM; | 1618 | err = -ENOMEM; |
1619 | goto err_out_notify_unset; | 1619 | goto err_out_free_rq; |
1620 | } | 1620 | } |
1621 | } | 1621 | } |
1622 | 1622 | ||
@@ -1649,7 +1649,9 @@ static int enic_open(struct net_device *netdev) | |||
1649 | 1649 | ||
1650 | return 0; | 1650 | return 0; |
1651 | 1651 | ||
1652 | err_out_notify_unset: | 1652 | err_out_free_rq: |
1653 | for (i = 0; i < enic->rq_count; i++) | ||
1654 | vnic_rq_clean(&enic->rq[i], enic_free_rq_buf); | ||
1653 | enic_dev_notify_unset(enic); | 1655 | enic_dev_notify_unset(enic); |
1654 | err_out_free_intr: | 1656 | err_out_free_intr: |
1655 | enic_free_intr(enic); | 1657 | enic_free_intr(enic); |
diff --git a/drivers/net/ethernet/dnet.c b/drivers/net/ethernet/dnet.c index a379c3e4b57f..13d00a38a5bd 100644 --- a/drivers/net/ethernet/dnet.c +++ b/drivers/net/ethernet/dnet.c | |||
@@ -398,13 +398,8 @@ static int dnet_poll(struct napi_struct *napi, int budget) | |||
398 | * break out of while loop if there are no more | 398 | * break out of while loop if there are no more |
399 | * packets waiting | 399 | * packets waiting |
400 | */ | 400 | */ |
401 | if (!(dnet_readl(bp, RX_FIFO_WCNT) >> 16)) { | 401 | if (!(dnet_readl(bp, RX_FIFO_WCNT) >> 16)) |
402 | napi_complete(napi); | 402 | break; |
403 | int_enable = dnet_readl(bp, INTR_ENB); | ||
404 | int_enable |= DNET_INTR_SRC_RX_CMDFIFOAF; | ||
405 | dnet_writel(bp, int_enable, INTR_ENB); | ||
406 | return 0; | ||
407 | } | ||
408 | 403 | ||
409 | cmd_word = dnet_readl(bp, RX_LEN_FIFO); | 404 | cmd_word = dnet_readl(bp, RX_LEN_FIFO); |
410 | pkt_len = cmd_word & 0xFFFF; | 405 | pkt_len = cmd_word & 0xFFFF; |
@@ -433,20 +428,17 @@ static int dnet_poll(struct napi_struct *napi, int budget) | |||
433 | "size %u.\n", dev->name, pkt_len); | 428 | "size %u.\n", dev->name, pkt_len); |
434 | } | 429 | } |
435 | 430 | ||
436 | budget -= npackets; | ||
437 | |||
438 | if (npackets < budget) { | 431 | if (npackets < budget) { |
439 | /* We processed all packets available. Tell NAPI it can | 432 | /* We processed all packets available. Tell NAPI it can |
440 | * stop polling then re-enable rx interrupts */ | 433 | * stop polling then re-enable rx interrupts. |
434 | */ | ||
441 | napi_complete(napi); | 435 | napi_complete(napi); |
442 | int_enable = dnet_readl(bp, INTR_ENB); | 436 | int_enable = dnet_readl(bp, INTR_ENB); |
443 | int_enable |= DNET_INTR_SRC_RX_CMDFIFOAF; | 437 | int_enable |= DNET_INTR_SRC_RX_CMDFIFOAF; |
444 | dnet_writel(bp, int_enable, INTR_ENB); | 438 | dnet_writel(bp, int_enable, INTR_ENB); |
445 | return 0; | ||
446 | } | 439 | } |
447 | 440 | ||
448 | /* There are still packets waiting */ | 441 | return npackets; |
449 | return 1; | ||
450 | } | 442 | } |
451 | 443 | ||
452 | static irqreturn_t dnet_interrupt(int irq, void *dev_id) | 444 | static irqreturn_t dnet_interrupt(int irq, void *dev_id) |
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h index 469691ad4a1e..40132929daf7 100644 --- a/drivers/net/ethernet/freescale/fec.h +++ b/drivers/net/ethernet/freescale/fec.h | |||
@@ -424,6 +424,8 @@ struct bufdesc_ex { | |||
424 | * (40ns * 6). | 424 | * (40ns * 6). |
425 | */ | 425 | */ |
426 | #define FEC_QUIRK_BUG_CAPTURE (1 << 10) | 426 | #define FEC_QUIRK_BUG_CAPTURE (1 << 10) |
427 | /* Controller has only one MDIO bus */ | ||
428 | #define FEC_QUIRK_SINGLE_MDIO (1 << 11) | ||
427 | 429 | ||
428 | struct fec_enet_priv_tx_q { | 430 | struct fec_enet_priv_tx_q { |
429 | int index; | 431 | int index; |
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 5ebdf8dc8a31..bba87775419d 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
@@ -91,7 +91,8 @@ static struct platform_device_id fec_devtype[] = { | |||
91 | .driver_data = 0, | 91 | .driver_data = 0, |
92 | }, { | 92 | }, { |
93 | .name = "imx28-fec", | 93 | .name = "imx28-fec", |
94 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME, | 94 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME | |
95 | FEC_QUIRK_SINGLE_MDIO, | ||
95 | }, { | 96 | }, { |
96 | .name = "imx6q-fec", | 97 | .name = "imx6q-fec", |
97 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | | 98 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | |
@@ -1937,7 +1938,7 @@ static int fec_enet_mii_init(struct platform_device *pdev) | |||
1937 | int err = -ENXIO, i; | 1938 | int err = -ENXIO, i; |
1938 | 1939 | ||
1939 | /* | 1940 | /* |
1940 | * The dual fec interfaces are not equivalent with enet-mac. | 1941 | * The i.MX28 dual fec interfaces are not equal. |
1941 | * Here are the differences: | 1942 | * Here are the differences: |
1942 | * | 1943 | * |
1943 | * - fec0 supports MII & RMII modes while fec1 only supports RMII | 1944 | * - fec0 supports MII & RMII modes while fec1 only supports RMII |
@@ -1952,7 +1953,7 @@ static int fec_enet_mii_init(struct platform_device *pdev) | |||
1952 | * mdio interface in board design, and need to be configured by | 1953 | * mdio interface in board design, and need to be configured by |
1953 | * fec0 mii_bus. | 1954 | * fec0 mii_bus. |
1954 | */ | 1955 | */ |
1955 | if ((fep->quirks & FEC_QUIRK_ENET_MAC) && fep->dev_id > 0) { | 1956 | if ((fep->quirks & FEC_QUIRK_SINGLE_MDIO) && fep->dev_id > 0) { |
1956 | /* fec1 uses fec0 mii_bus */ | 1957 | /* fec1 uses fec0 mii_bus */ |
1957 | if (mii_cnt && fec0_mii_bus) { | 1958 | if (mii_cnt && fec0_mii_bus) { |
1958 | fep->mii_bus = fec0_mii_bus; | 1959 | fep->mii_bus = fec0_mii_bus; |
@@ -2015,7 +2016,7 @@ static int fec_enet_mii_init(struct platform_device *pdev) | |||
2015 | mii_cnt++; | 2016 | mii_cnt++; |
2016 | 2017 | ||
2017 | /* save fec0 mii_bus */ | 2018 | /* save fec0 mii_bus */ |
2018 | if (fep->quirks & FEC_QUIRK_ENET_MAC) | 2019 | if (fep->quirks & FEC_QUIRK_SINGLE_MDIO) |
2019 | fec0_mii_bus = fep->mii_bus; | 2020 | fec0_mii_bus = fep->mii_bus; |
2020 | 2021 | ||
2021 | return 0; | 2022 | return 0; |
@@ -3129,6 +3130,7 @@ fec_probe(struct platform_device *pdev) | |||
3129 | pdev->id_entry = of_id->data; | 3130 | pdev->id_entry = of_id->data; |
3130 | fep->quirks = pdev->id_entry->driver_data; | 3131 | fep->quirks = pdev->id_entry->driver_data; |
3131 | 3132 | ||
3133 | fep->netdev = ndev; | ||
3132 | fep->num_rx_queues = num_rx_qs; | 3134 | fep->num_rx_queues = num_rx_qs; |
3133 | fep->num_tx_queues = num_tx_qs; | 3135 | fep->num_tx_queues = num_tx_qs; |
3134 | 3136 | ||
diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig index 5b8300a32bf5..4d61ef50b465 100644 --- a/drivers/net/ethernet/intel/Kconfig +++ b/drivers/net/ethernet/intel/Kconfig | |||
@@ -281,6 +281,17 @@ config I40E_DCB | |||
281 | 281 | ||
282 | If unsure, say N. | 282 | If unsure, say N. |
283 | 283 | ||
284 | config I40E_FCOE | ||
285 | bool "Fibre Channel over Ethernet (FCoE)" | ||
286 | default n | ||
287 | depends on I40E && DCB && FCOE | ||
288 | ---help--- | ||
289 | Say Y here if you want to use Fibre Channel over Ethernet (FCoE) | ||
290 | in the driver. This will create new netdev for exclusive FCoE | ||
291 | use with XL710 FCoE offloads enabled. | ||
292 | |||
293 | If unsure, say N. | ||
294 | |||
284 | config I40EVF | 295 | config I40EVF |
285 | tristate "Intel(R) XL710 X710 Virtual Function Ethernet support" | 296 | tristate "Intel(R) XL710 X710 Virtual Function Ethernet support" |
286 | depends on PCI_MSI | 297 | depends on PCI_MSI |
diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c index 781065eb5431..e9c3a87e5b11 100644 --- a/drivers/net/ethernet/intel/e100.c +++ b/drivers/net/ethernet/intel/e100.c | |||
@@ -1543,7 +1543,7 @@ static int e100_phy_init(struct nic *nic) | |||
1543 | mdio_write(netdev, nic->mii.phy_id, MII_BMCR, bmcr); | 1543 | mdio_write(netdev, nic->mii.phy_id, MII_BMCR, bmcr); |
1544 | } else if ((nic->mac >= mac_82550_D102) || ((nic->flags & ich) && | 1544 | } else if ((nic->mac >= mac_82550_D102) || ((nic->flags & ich) && |
1545 | (mdio_read(netdev, nic->mii.phy_id, MII_TPISTATUS) & 0x8000) && | 1545 | (mdio_read(netdev, nic->mii.phy_id, MII_TPISTATUS) & 0x8000) && |
1546 | !(nic->eeprom[eeprom_cnfg_mdix] & eeprom_mdix_enabled))) { | 1546 | (nic->eeprom[eeprom_cnfg_mdix] & eeprom_mdix_enabled))) { |
1547 | /* enable/disable MDI/MDI-X auto-switching. */ | 1547 | /* enable/disable MDI/MDI-X auto-switching. */ |
1548 | mdio_write(netdev, nic->mii.phy_id, MII_NCONFIG, | 1548 | mdio_write(netdev, nic->mii.phy_id, MII_NCONFIG, |
1549 | nic->mii.force_media ? 0 : NCONFIG_AUTO_SWITCH); | 1549 | nic->mii.force_media ? 0 : NCONFIG_AUTO_SWITCH); |
diff --git a/drivers/net/ethernet/intel/i40e/Makefile b/drivers/net/ethernet/intel/i40e/Makefile index 4b94ddb29c24..c40581999121 100644 --- a/drivers/net/ethernet/intel/i40e/Makefile +++ b/drivers/net/ethernet/intel/i40e/Makefile | |||
@@ -44,4 +44,4 @@ i40e-objs := i40e_main.o \ | |||
44 | i40e_virtchnl_pf.o | 44 | i40e_virtchnl_pf.o |
45 | 45 | ||
46 | i40e-$(CONFIG_I40E_DCB) += i40e_dcb.o i40e_dcb_nl.o | 46 | i40e-$(CONFIG_I40E_DCB) += i40e_dcb.o i40e_dcb_nl.o |
47 | i40e-$(CONFIG_FCOE:m=y) += i40e_fcoe.o | 47 | i40e-$(CONFIG_I40E_FCOE) += i40e_fcoe.o |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c index 433a55886ad2..cb0de455683e 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c +++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c | |||
@@ -829,7 +829,7 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n, | |||
829 | if (desc_n >= ring->count || desc_n < 0) { | 829 | if (desc_n >= ring->count || desc_n < 0) { |
830 | dev_info(&pf->pdev->dev, | 830 | dev_info(&pf->pdev->dev, |
831 | "descriptor %d not found\n", desc_n); | 831 | "descriptor %d not found\n", desc_n); |
832 | return; | 832 | goto out; |
833 | } | 833 | } |
834 | if (!is_rx_ring) { | 834 | if (!is_rx_ring) { |
835 | txd = I40E_TX_DESC(ring, desc_n); | 835 | txd = I40E_TX_DESC(ring, desc_n); |
@@ -855,6 +855,8 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n, | |||
855 | } else { | 855 | } else { |
856 | dev_info(&pf->pdev->dev, "dump desc rx/tx <vsi_seid> <ring_id> [<desc_n>]\n"); | 856 | dev_info(&pf->pdev->dev, "dump desc rx/tx <vsi_seid> <ring_id> [<desc_n>]\n"); |
857 | } | 857 | } |
858 | |||
859 | out: | ||
858 | kfree(ring); | 860 | kfree(ring); |
859 | } | 861 | } |
860 | 862 | ||
diff --git a/drivers/net/ethernet/intel/i40e/i40e_osdep.h b/drivers/net/ethernet/intel/i40e/i40e_osdep.h index 045b5c4b98b3..ad802dd0f67a 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_osdep.h +++ b/drivers/net/ethernet/intel/i40e/i40e_osdep.h | |||
@@ -78,7 +78,7 @@ do { \ | |||
78 | } while (0) | 78 | } while (0) |
79 | 79 | ||
80 | typedef enum i40e_status_code i40e_status; | 80 | typedef enum i40e_status_code i40e_status; |
81 | #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) | 81 | #ifdef CONFIG_I40E_FCOE |
82 | #define I40E_FCOE | 82 | #define I40E_FCOE |
83 | #endif /* CONFIG_FCOE or CONFIG_FCOE_MODULE */ | 83 | #endif |
84 | #endif /* _I40E_OSDEP_H_ */ | 84 | #endif /* _I40E_OSDEP_H_ */ |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index 04b441460bbd..cecb340898fe 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c | |||
@@ -658,6 +658,8 @@ static inline u32 i40e_get_head(struct i40e_ring *tx_ring) | |||
658 | return le32_to_cpu(*(volatile __le32 *)head); | 658 | return le32_to_cpu(*(volatile __le32 *)head); |
659 | } | 659 | } |
660 | 660 | ||
661 | #define WB_STRIDE 0x3 | ||
662 | |||
661 | /** | 663 | /** |
662 | * i40e_clean_tx_irq - Reclaim resources after transmit completes | 664 | * i40e_clean_tx_irq - Reclaim resources after transmit completes |
663 | * @tx_ring: tx ring to clean | 665 | * @tx_ring: tx ring to clean |
@@ -759,6 +761,18 @@ static bool i40e_clean_tx_irq(struct i40e_ring *tx_ring, int budget) | |||
759 | tx_ring->q_vector->tx.total_bytes += total_bytes; | 761 | tx_ring->q_vector->tx.total_bytes += total_bytes; |
760 | tx_ring->q_vector->tx.total_packets += total_packets; | 762 | tx_ring->q_vector->tx.total_packets += total_packets; |
761 | 763 | ||
764 | /* check to see if there are any non-cache aligned descriptors | ||
765 | * waiting to be written back, and kick the hardware to force | ||
766 | * them to be written back in case of napi polling | ||
767 | */ | ||
768 | if (budget && | ||
769 | !((i & WB_STRIDE) == WB_STRIDE) && | ||
770 | !test_bit(__I40E_DOWN, &tx_ring->vsi->state) && | ||
771 | (I40E_DESC_UNUSED(tx_ring) != tx_ring->count)) | ||
772 | tx_ring->arm_wb = true; | ||
773 | else | ||
774 | tx_ring->arm_wb = false; | ||
775 | |||
762 | if (check_for_tx_hang(tx_ring) && i40e_check_tx_hang(tx_ring)) { | 776 | if (check_for_tx_hang(tx_ring) && i40e_check_tx_hang(tx_ring)) { |
763 | /* schedule immediate reset if we believe we hung */ | 777 | /* schedule immediate reset if we believe we hung */ |
764 | dev_info(tx_ring->dev, "Detected Tx Unit Hang\n" | 778 | dev_info(tx_ring->dev, "Detected Tx Unit Hang\n" |
@@ -777,13 +791,16 @@ static bool i40e_clean_tx_irq(struct i40e_ring *tx_ring, int budget) | |||
777 | netif_stop_subqueue(tx_ring->netdev, tx_ring->queue_index); | 791 | netif_stop_subqueue(tx_ring->netdev, tx_ring->queue_index); |
778 | 792 | ||
779 | dev_info(tx_ring->dev, | 793 | dev_info(tx_ring->dev, |
780 | "tx hang detected on queue %d, resetting adapter\n", | 794 | "tx hang detected on queue %d, reset requested\n", |
781 | tx_ring->queue_index); | 795 | tx_ring->queue_index); |
782 | 796 | ||
783 | tx_ring->netdev->netdev_ops->ndo_tx_timeout(tx_ring->netdev); | 797 | /* do not fire the reset immediately, wait for the stack to |
798 | * decide we are truly stuck, also prevents every queue from | ||
799 | * simultaneously requesting a reset | ||
800 | */ | ||
784 | 801 | ||
785 | /* the adapter is about to reset, no point in enabling stuff */ | 802 | /* the adapter is about to reset, no point in enabling polling */ |
786 | return true; | 803 | budget = 1; |
787 | } | 804 | } |
788 | 805 | ||
789 | netdev_tx_completed_queue(netdev_get_tx_queue(tx_ring->netdev, | 806 | netdev_tx_completed_queue(netdev_get_tx_queue(tx_ring->netdev, |
@@ -806,7 +823,25 @@ static bool i40e_clean_tx_irq(struct i40e_ring *tx_ring, int budget) | |||
806 | } | 823 | } |
807 | } | 824 | } |
808 | 825 | ||
809 | return budget > 0; | 826 | return !!budget; |
827 | } | ||
828 | |||
829 | /** | ||
830 | * i40e_force_wb - Arm hardware to do a wb on noncache aligned descriptors | ||
831 | * @vsi: the VSI we care about | ||
832 | * @q_vector: the vector on which to force writeback | ||
833 | * | ||
834 | **/ | ||
835 | static void i40e_force_wb(struct i40e_vsi *vsi, struct i40e_q_vector *q_vector) | ||
836 | { | ||
837 | u32 val = I40E_PFINT_DYN_CTLN_INTENA_MASK | | ||
838 | I40E_PFINT_DYN_CTLN_SWINT_TRIG_MASK | | ||
839 | I40E_PFINT_DYN_CTLN_SW_ITR_INDX_ENA_MASK | ||
840 | /* allow 00 to be written to the index */; | ||
841 | |||
842 | wr32(&vsi->back->hw, | ||
843 | I40E_PFINT_DYN_CTLN(q_vector->v_idx + vsi->base_vector - 1), | ||
844 | val); | ||
810 | } | 845 | } |
811 | 846 | ||
812 | /** | 847 | /** |
@@ -1290,9 +1325,7 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi, | |||
1290 | * so the total length of IPv4 header is IHL*4 bytes | 1325 | * so the total length of IPv4 header is IHL*4 bytes |
1291 | * The UDP_0 bit *may* bet set if the *inner* header is UDP | 1326 | * The UDP_0 bit *may* bet set if the *inner* header is UDP |
1292 | */ | 1327 | */ |
1293 | if (ipv4_tunnel && | 1328 | if (ipv4_tunnel) { |
1294 | (decoded.inner_prot != I40E_RX_PTYPE_INNER_PROT_UDP) && | ||
1295 | !(rx_status & (1 << I40E_RX_DESC_STATUS_UDP_0_SHIFT))) { | ||
1296 | skb->transport_header = skb->mac_header + | 1329 | skb->transport_header = skb->mac_header + |
1297 | sizeof(struct ethhdr) + | 1330 | sizeof(struct ethhdr) + |
1298 | (ip_hdr(skb)->ihl * 4); | 1331 | (ip_hdr(skb)->ihl * 4); |
@@ -1302,15 +1335,19 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi, | |||
1302 | skb->protocol == htons(ETH_P_8021AD)) | 1335 | skb->protocol == htons(ETH_P_8021AD)) |
1303 | ? VLAN_HLEN : 0; | 1336 | ? VLAN_HLEN : 0; |
1304 | 1337 | ||
1305 | rx_udp_csum = udp_csum(skb); | 1338 | if ((ip_hdr(skb)->protocol == IPPROTO_UDP) && |
1306 | iph = ip_hdr(skb); | 1339 | (udp_hdr(skb)->check != 0)) { |
1307 | csum = csum_tcpudp_magic( | 1340 | rx_udp_csum = udp_csum(skb); |
1308 | iph->saddr, iph->daddr, | 1341 | iph = ip_hdr(skb); |
1309 | (skb->len - skb_transport_offset(skb)), | 1342 | csum = csum_tcpudp_magic( |
1310 | IPPROTO_UDP, rx_udp_csum); | 1343 | iph->saddr, iph->daddr, |
1344 | (skb->len - skb_transport_offset(skb)), | ||
1345 | IPPROTO_UDP, rx_udp_csum); | ||
1311 | 1346 | ||
1312 | if (udp_hdr(skb)->check != csum) | 1347 | if (udp_hdr(skb)->check != csum) |
1313 | goto checksum_fail; | 1348 | goto checksum_fail; |
1349 | |||
1350 | } /* else its GRE and so no outer UDP header */ | ||
1314 | } | 1351 | } |
1315 | 1352 | ||
1316 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1353 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
@@ -1581,6 +1618,7 @@ int i40e_napi_poll(struct napi_struct *napi, int budget) | |||
1581 | struct i40e_vsi *vsi = q_vector->vsi; | 1618 | struct i40e_vsi *vsi = q_vector->vsi; |
1582 | struct i40e_ring *ring; | 1619 | struct i40e_ring *ring; |
1583 | bool clean_complete = true; | 1620 | bool clean_complete = true; |
1621 | bool arm_wb = false; | ||
1584 | int budget_per_ring; | 1622 | int budget_per_ring; |
1585 | 1623 | ||
1586 | if (test_bit(__I40E_DOWN, &vsi->state)) { | 1624 | if (test_bit(__I40E_DOWN, &vsi->state)) { |
@@ -1591,8 +1629,10 @@ int i40e_napi_poll(struct napi_struct *napi, int budget) | |||
1591 | /* Since the actual Tx work is minimal, we can give the Tx a larger | 1629 | /* Since the actual Tx work is minimal, we can give the Tx a larger |
1592 | * budget and be more aggressive about cleaning up the Tx descriptors. | 1630 | * budget and be more aggressive about cleaning up the Tx descriptors. |
1593 | */ | 1631 | */ |
1594 | i40e_for_each_ring(ring, q_vector->tx) | 1632 | i40e_for_each_ring(ring, q_vector->tx) { |
1595 | clean_complete &= i40e_clean_tx_irq(ring, vsi->work_limit); | 1633 | clean_complete &= i40e_clean_tx_irq(ring, vsi->work_limit); |
1634 | arm_wb |= ring->arm_wb; | ||
1635 | } | ||
1596 | 1636 | ||
1597 | /* We attempt to distribute budget to each Rx queue fairly, but don't | 1637 | /* We attempt to distribute budget to each Rx queue fairly, but don't |
1598 | * allow the budget to go below 1 because that would exit polling early. | 1638 | * allow the budget to go below 1 because that would exit polling early. |
@@ -1603,8 +1643,11 @@ int i40e_napi_poll(struct napi_struct *napi, int budget) | |||
1603 | clean_complete &= i40e_clean_rx_irq(ring, budget_per_ring); | 1643 | clean_complete &= i40e_clean_rx_irq(ring, budget_per_ring); |
1604 | 1644 | ||
1605 | /* If work not completed, return budget and polling will return */ | 1645 | /* If work not completed, return budget and polling will return */ |
1606 | if (!clean_complete) | 1646 | if (!clean_complete) { |
1647 | if (arm_wb) | ||
1648 | i40e_force_wb(vsi, q_vector); | ||
1607 | return budget; | 1649 | return budget; |
1650 | } | ||
1608 | 1651 | ||
1609 | /* Work is done so exit the polling mode and re-enable the interrupt */ | 1652 | /* Work is done so exit the polling mode and re-enable the interrupt */ |
1610 | napi_complete(napi); | 1653 | napi_complete(napi); |
@@ -1840,17 +1883,16 @@ static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb, | |||
1840 | if (err < 0) | 1883 | if (err < 0) |
1841 | return err; | 1884 | return err; |
1842 | 1885 | ||
1843 | if (protocol == htons(ETH_P_IP)) { | 1886 | iph = skb->encapsulation ? inner_ip_hdr(skb) : ip_hdr(skb); |
1844 | iph = skb->encapsulation ? inner_ip_hdr(skb) : ip_hdr(skb); | 1887 | ipv6h = skb->encapsulation ? inner_ipv6_hdr(skb) : ipv6_hdr(skb); |
1888 | |||
1889 | if (iph->version == 4) { | ||
1845 | tcph = skb->encapsulation ? inner_tcp_hdr(skb) : tcp_hdr(skb); | 1890 | tcph = skb->encapsulation ? inner_tcp_hdr(skb) : tcp_hdr(skb); |
1846 | iph->tot_len = 0; | 1891 | iph->tot_len = 0; |
1847 | iph->check = 0; | 1892 | iph->check = 0; |
1848 | tcph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, | 1893 | tcph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr, |
1849 | 0, IPPROTO_TCP, 0); | 1894 | 0, IPPROTO_TCP, 0); |
1850 | } else if (skb_is_gso_v6(skb)) { | 1895 | } else if (ipv6h->version == 6) { |
1851 | |||
1852 | ipv6h = skb->encapsulation ? inner_ipv6_hdr(skb) | ||
1853 | : ipv6_hdr(skb); | ||
1854 | tcph = skb->encapsulation ? inner_tcp_hdr(skb) : tcp_hdr(skb); | 1896 | tcph = skb->encapsulation ? inner_tcp_hdr(skb) : tcp_hdr(skb); |
1855 | ipv6h->payload_len = 0; | 1897 | ipv6h->payload_len = 0; |
1856 | tcph->check = ~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr, | 1898 | tcph->check = ~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr, |
@@ -1946,13 +1988,9 @@ static void i40e_tx_enable_csum(struct sk_buff *skb, u32 tx_flags, | |||
1946 | I40E_TX_CTX_EXT_IP_IPV4_NO_CSUM; | 1988 | I40E_TX_CTX_EXT_IP_IPV4_NO_CSUM; |
1947 | } | 1989 | } |
1948 | } else if (tx_flags & I40E_TX_FLAGS_IPV6) { | 1990 | } else if (tx_flags & I40E_TX_FLAGS_IPV6) { |
1949 | if (tx_flags & I40E_TX_FLAGS_TSO) { | 1991 | *cd_tunneling |= I40E_TX_CTX_EXT_IP_IPV6; |
1950 | *cd_tunneling |= I40E_TX_CTX_EXT_IP_IPV6; | 1992 | if (tx_flags & I40E_TX_FLAGS_TSO) |
1951 | ip_hdr(skb)->check = 0; | 1993 | ip_hdr(skb)->check = 0; |
1952 | } else { | ||
1953 | *cd_tunneling |= | ||
1954 | I40E_TX_CTX_EXT_IP_IPV4_NO_CSUM; | ||
1955 | } | ||
1956 | } | 1994 | } |
1957 | 1995 | ||
1958 | /* Now set the ctx descriptor fields */ | 1996 | /* Now set the ctx descriptor fields */ |
@@ -1962,7 +2000,10 @@ static void i40e_tx_enable_csum(struct sk_buff *skb, u32 tx_flags, | |||
1962 | ((skb_inner_network_offset(skb) - | 2000 | ((skb_inner_network_offset(skb) - |
1963 | skb_transport_offset(skb)) >> 1) << | 2001 | skb_transport_offset(skb)) >> 1) << |
1964 | I40E_TXD_CTX_QW0_NATLEN_SHIFT; | 2002 | I40E_TXD_CTX_QW0_NATLEN_SHIFT; |
1965 | 2003 | if (this_ip_hdr->version == 6) { | |
2004 | tx_flags &= ~I40E_TX_FLAGS_IPV4; | ||
2005 | tx_flags |= I40E_TX_FLAGS_IPV6; | ||
2006 | } | ||
1966 | } else { | 2007 | } else { |
1967 | network_hdr_len = skb_network_header_len(skb); | 2008 | network_hdr_len = skb_network_header_len(skb); |
1968 | this_ip_hdr = ip_hdr(skb); | 2009 | this_ip_hdr = ip_hdr(skb); |
@@ -2198,7 +2239,6 @@ static void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb, | |||
2198 | /* Place RS bit on last descriptor of any packet that spans across the | 2239 | /* Place RS bit on last descriptor of any packet that spans across the |
2199 | * 4th descriptor (WB_STRIDE aka 0x3) in a 64B cacheline. | 2240 | * 4th descriptor (WB_STRIDE aka 0x3) in a 64B cacheline. |
2200 | */ | 2241 | */ |
2201 | #define WB_STRIDE 0x3 | ||
2202 | if (((i & WB_STRIDE) != WB_STRIDE) && | 2242 | if (((i & WB_STRIDE) != WB_STRIDE) && |
2203 | (first <= &tx_ring->tx_bi[i]) && | 2243 | (first <= &tx_ring->tx_bi[i]) && |
2204 | (first >= &tx_ring->tx_bi[i & ~WB_STRIDE])) { | 2244 | (first >= &tx_ring->tx_bi[i & ~WB_STRIDE])) { |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h index e60d3accb2e2..18b00231d2f1 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h | |||
@@ -241,6 +241,7 @@ struct i40e_ring { | |||
241 | unsigned long last_rx_timestamp; | 241 | unsigned long last_rx_timestamp; |
242 | 242 | ||
243 | bool ring_active; /* is ring online or not */ | 243 | bool ring_active; /* is ring online or not */ |
244 | bool arm_wb; /* do something to arm write back */ | ||
244 | 245 | ||
245 | /* stats structs */ | 246 | /* stats structs */ |
246 | struct i40e_queue_stats stats; | 247 | struct i40e_queue_stats stats; |
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c index 051ea94bdcd3..0f69ef81751a 100644 --- a/drivers/net/ethernet/intel/igb/e1000_82575.c +++ b/drivers/net/ethernet/intel/igb/e1000_82575.c | |||
@@ -1125,7 +1125,7 @@ static s32 igb_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask) | |||
1125 | u32 swmask = mask; | 1125 | u32 swmask = mask; |
1126 | u32 fwmask = mask << 16; | 1126 | u32 fwmask = mask << 16; |
1127 | s32 ret_val = 0; | 1127 | s32 ret_val = 0; |
1128 | s32 i = 0, timeout = 200; /* FIXME: find real value to use here */ | 1128 | s32 i = 0, timeout = 200; |
1129 | 1129 | ||
1130 | while (i < timeout) { | 1130 | while (i < timeout) { |
1131 | if (igb_get_hw_semaphore(hw)) { | 1131 | if (igb_get_hw_semaphore(hw)) { |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 943cbd47d832..03e9eb0dc761 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -1829,7 +1829,7 @@ static int mlx4_init_hca(struct mlx4_dev *dev) | |||
1829 | err = mlx4_dev_cap(dev, &dev_cap); | 1829 | err = mlx4_dev_cap(dev, &dev_cap); |
1830 | if (err) { | 1830 | if (err) { |
1831 | mlx4_err(dev, "QUERY_DEV_CAP command failed, aborting\n"); | 1831 | mlx4_err(dev, "QUERY_DEV_CAP command failed, aborting\n"); |
1832 | goto err_stop_fw; | 1832 | return err; |
1833 | } | 1833 | } |
1834 | 1834 | ||
1835 | choose_steering_mode(dev, &dev_cap); | 1835 | choose_steering_mode(dev, &dev_cap); |
@@ -1860,7 +1860,7 @@ static int mlx4_init_hca(struct mlx4_dev *dev) | |||
1860 | &init_hca); | 1860 | &init_hca); |
1861 | if ((long long) icm_size < 0) { | 1861 | if ((long long) icm_size < 0) { |
1862 | err = icm_size; | 1862 | err = icm_size; |
1863 | goto err_stop_fw; | 1863 | return err; |
1864 | } | 1864 | } |
1865 | 1865 | ||
1866 | dev->caps.max_fmr_maps = (1 << (32 - ilog2(dev->caps.num_mpts))) - 1; | 1866 | dev->caps.max_fmr_maps = (1 << (32 - ilog2(dev->caps.num_mpts))) - 1; |
@@ -1874,7 +1874,7 @@ static int mlx4_init_hca(struct mlx4_dev *dev) | |||
1874 | 1874 | ||
1875 | err = mlx4_init_icm(dev, &dev_cap, &init_hca, icm_size); | 1875 | err = mlx4_init_icm(dev, &dev_cap, &init_hca, icm_size); |
1876 | if (err) | 1876 | if (err) |
1877 | goto err_stop_fw; | 1877 | return err; |
1878 | 1878 | ||
1879 | err = mlx4_INIT_HCA(dev, &init_hca); | 1879 | err = mlx4_INIT_HCA(dev, &init_hca); |
1880 | if (err) { | 1880 | if (err) { |
@@ -1886,7 +1886,7 @@ static int mlx4_init_hca(struct mlx4_dev *dev) | |||
1886 | err = mlx4_query_func(dev, &dev_cap); | 1886 | err = mlx4_query_func(dev, &dev_cap); |
1887 | if (err < 0) { | 1887 | if (err < 0) { |
1888 | mlx4_err(dev, "QUERY_FUNC command failed, aborting.\n"); | 1888 | mlx4_err(dev, "QUERY_FUNC command failed, aborting.\n"); |
1889 | goto err_stop_fw; | 1889 | goto err_close; |
1890 | } else if (err & MLX4_QUERY_FUNC_NUM_SYS_EQS) { | 1890 | } else if (err & MLX4_QUERY_FUNC_NUM_SYS_EQS) { |
1891 | dev->caps.num_eqs = dev_cap.max_eqs; | 1891 | dev->caps.num_eqs = dev_cap.max_eqs; |
1892 | dev->caps.reserved_eqs = dev_cap.reserved_eqs; | 1892 | dev->caps.reserved_eqs = dev_cap.reserved_eqs; |
@@ -2006,11 +2006,6 @@ err_free_icm: | |||
2006 | if (!mlx4_is_slave(dev)) | 2006 | if (!mlx4_is_slave(dev)) |
2007 | mlx4_free_icms(dev); | 2007 | mlx4_free_icms(dev); |
2008 | 2008 | ||
2009 | err_stop_fw: | ||
2010 | if (!mlx4_is_slave(dev)) { | ||
2011 | mlx4_UNMAP_FA(dev); | ||
2012 | mlx4_free_icm(dev, priv->fw.fw_icm, 0); | ||
2013 | } | ||
2014 | return err; | 2009 | return err; |
2015 | } | 2010 | } |
2016 | 2011 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c index d6f549685c0f..7094a9c70fd5 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mr.c +++ b/drivers/net/ethernet/mellanox/mlx4/mr.c | |||
@@ -584,6 +584,7 @@ EXPORT_SYMBOL_GPL(mlx4_mr_free); | |||
584 | void mlx4_mr_rereg_mem_cleanup(struct mlx4_dev *dev, struct mlx4_mr *mr) | 584 | void mlx4_mr_rereg_mem_cleanup(struct mlx4_dev *dev, struct mlx4_mr *mr) |
585 | { | 585 | { |
586 | mlx4_mtt_cleanup(dev, &mr->mtt); | 586 | mlx4_mtt_cleanup(dev, &mr->mtt); |
587 | mr->mtt.order = -1; | ||
587 | } | 588 | } |
588 | EXPORT_SYMBOL_GPL(mlx4_mr_rereg_mem_cleanup); | 589 | EXPORT_SYMBOL_GPL(mlx4_mr_rereg_mem_cleanup); |
589 | 590 | ||
@@ -593,14 +594,14 @@ int mlx4_mr_rereg_mem_write(struct mlx4_dev *dev, struct mlx4_mr *mr, | |||
593 | { | 594 | { |
594 | int err; | 595 | int err; |
595 | 596 | ||
596 | mpt_entry->start = cpu_to_be64(iova); | ||
597 | mpt_entry->length = cpu_to_be64(size); | ||
598 | mpt_entry->entity_size = cpu_to_be32(page_shift); | ||
599 | |||
600 | err = mlx4_mtt_init(dev, npages, page_shift, &mr->mtt); | 597 | err = mlx4_mtt_init(dev, npages, page_shift, &mr->mtt); |
601 | if (err) | 598 | if (err) |
602 | return err; | 599 | return err; |
603 | 600 | ||
601 | mpt_entry->start = cpu_to_be64(mr->iova); | ||
602 | mpt_entry->length = cpu_to_be64(mr->size); | ||
603 | mpt_entry->entity_size = cpu_to_be32(mr->mtt.page_shift); | ||
604 | |||
604 | mpt_entry->pd_flags &= cpu_to_be32(MLX4_MPT_PD_MASK | | 605 | mpt_entry->pd_flags &= cpu_to_be32(MLX4_MPT_PD_MASK | |
605 | MLX4_MPT_PD_FLAG_EN_INV); | 606 | MLX4_MPT_PD_FLAG_EN_INV); |
606 | mpt_entry->flags &= cpu_to_be32(MLX4_MPT_FLAG_FREE | | 607 | mpt_entry->flags &= cpu_to_be32(MLX4_MPT_FLAG_FREE | |
diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c index af099057f0e9..71af98bb72cb 100644 --- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c +++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c | |||
@@ -4033,8 +4033,10 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
4033 | (void)pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); | 4033 | (void)pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); |
4034 | mgp->cmd = dma_alloc_coherent(&pdev->dev, sizeof(*mgp->cmd), | 4034 | mgp->cmd = dma_alloc_coherent(&pdev->dev, sizeof(*mgp->cmd), |
4035 | &mgp->cmd_bus, GFP_KERNEL); | 4035 | &mgp->cmd_bus, GFP_KERNEL); |
4036 | if (mgp->cmd == NULL) | 4036 | if (!mgp->cmd) { |
4037 | status = -ENOMEM; | ||
4037 | goto abort_with_enabled; | 4038 | goto abort_with_enabled; |
4039 | } | ||
4038 | 4040 | ||
4039 | mgp->board_span = pci_resource_len(pdev, 0); | 4041 | mgp->board_span = pci_resource_len(pdev, 0); |
4040 | mgp->iomem_base = pci_resource_start(pdev, 0); | 4042 | mgp->iomem_base = pci_resource_start(pdev, 0); |
diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c index c2f09af5c25b..4847713211ca 100644 --- a/drivers/net/ethernet/qlogic/qla3xxx.c +++ b/drivers/net/ethernet/qlogic/qla3xxx.c | |||
@@ -146,10 +146,7 @@ static int ql_wait_for_drvr_lock(struct ql3_adapter *qdev) | |||
146 | { | 146 | { |
147 | int i = 0; | 147 | int i = 0; |
148 | 148 | ||
149 | while (i < 10) { | 149 | do { |
150 | if (i) | ||
151 | ssleep(1); | ||
152 | |||
153 | if (ql_sem_lock(qdev, | 150 | if (ql_sem_lock(qdev, |
154 | QL_DRVR_SEM_MASK, | 151 | QL_DRVR_SEM_MASK, |
155 | (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index) | 152 | (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index) |
@@ -158,7 +155,8 @@ static int ql_wait_for_drvr_lock(struct ql3_adapter *qdev) | |||
158 | "driver lock acquired\n"); | 155 | "driver lock acquired\n"); |
159 | return 1; | 156 | return 1; |
160 | } | 157 | } |
161 | } | 158 | ssleep(1); |
159 | } while (++i < 10); | ||
162 | 160 | ||
163 | netdev_err(qdev->ndev, "Timed out waiting for driver lock...\n"); | 161 | netdev_err(qdev->ndev, "Timed out waiting for driver lock...\n"); |
164 | return 0; | 162 | return 0; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 9929b97cfb36..2528c3fb6b90 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -2605,6 +2605,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2605 | } else { | 2605 | } else { |
2606 | dev_err(&pdev->dev, | 2606 | dev_err(&pdev->dev, |
2607 | "%s: failed. Please Reboot\n", __func__); | 2607 | "%s: failed. Please Reboot\n", __func__); |
2608 | err = -ENODEV; | ||
2608 | goto err_out_free_hw; | 2609 | goto err_out_free_hw; |
2609 | } | 2610 | } |
2610 | 2611 | ||
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index c29ba80ae02b..37583a9d8853 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -473,6 +473,7 @@ static struct sh_eth_cpu_data r8a777x_data = { | |||
473 | .eesr_err_check = EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE | | 473 | .eesr_err_check = EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE | |
474 | EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE | | 474 | EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE | |
475 | EESR_ECI, | 475 | EESR_ECI, |
476 | .fdr_value = 0x00000f0f, | ||
476 | 477 | ||
477 | .apr = 1, | 478 | .apr = 1, |
478 | .mpr = 1, | 479 | .mpr = 1, |
@@ -495,6 +496,7 @@ static struct sh_eth_cpu_data r8a779x_data = { | |||
495 | .eesr_err_check = EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE | | 496 | .eesr_err_check = EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE | |
496 | EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE | | 497 | EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE | |
497 | EESR_ECI, | 498 | EESR_ECI, |
499 | .fdr_value = 0x00000f0f, | ||
498 | 500 | ||
499 | .apr = 1, | 501 | .apr = 1, |
500 | .mpr = 1, | 502 | .mpr = 1, |
@@ -536,6 +538,8 @@ static struct sh_eth_cpu_data sh7724_data = { | |||
536 | EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE | | 538 | EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE | |
537 | EESR_ECI, | 539 | EESR_ECI, |
538 | 540 | ||
541 | .trscer_err_mask = DESC_I_RINT8, | ||
542 | |||
539 | .apr = 1, | 543 | .apr = 1, |
540 | .mpr = 1, | 544 | .mpr = 1, |
541 | .tpauser = 1, | 545 | .tpauser = 1, |
@@ -856,6 +860,9 @@ static void sh_eth_set_default_cpu_data(struct sh_eth_cpu_data *cd) | |||
856 | 860 | ||
857 | if (!cd->eesr_err_check) | 861 | if (!cd->eesr_err_check) |
858 | cd->eesr_err_check = DEFAULT_EESR_ERR_CHECK; | 862 | cd->eesr_err_check = DEFAULT_EESR_ERR_CHECK; |
863 | |||
864 | if (!cd->trscer_err_mask) | ||
865 | cd->trscer_err_mask = DEFAULT_TRSCER_ERR_MASK; | ||
859 | } | 866 | } |
860 | 867 | ||
861 | static int sh_eth_check_reset(struct net_device *ndev) | 868 | static int sh_eth_check_reset(struct net_device *ndev) |
@@ -1294,7 +1301,7 @@ static int sh_eth_dev_init(struct net_device *ndev, bool start) | |||
1294 | /* Frame recv control (enable multiple-packets per rx irq) */ | 1301 | /* Frame recv control (enable multiple-packets per rx irq) */ |
1295 | sh_eth_write(ndev, RMCR_RNC, RMCR); | 1302 | sh_eth_write(ndev, RMCR_RNC, RMCR); |
1296 | 1303 | ||
1297 | sh_eth_write(ndev, DESC_I_RINT8 | DESC_I_RINT5 | DESC_I_TINT2, TRSCER); | 1304 | sh_eth_write(ndev, mdp->cd->trscer_err_mask, TRSCER); |
1298 | 1305 | ||
1299 | if (mdp->cd->bculr) | 1306 | if (mdp->cd->bculr) |
1300 | sh_eth_write(ndev, 0x800, BCULR); /* Burst sycle set */ | 1307 | sh_eth_write(ndev, 0x800, BCULR); /* Burst sycle set */ |
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h index 22301bf9c21d..71f5de1171bd 100644 --- a/drivers/net/ethernet/renesas/sh_eth.h +++ b/drivers/net/ethernet/renesas/sh_eth.h | |||
@@ -369,6 +369,8 @@ enum DESC_I_BIT { | |||
369 | DESC_I_RINT1 = 0x0001, | 369 | DESC_I_RINT1 = 0x0001, |
370 | }; | 370 | }; |
371 | 371 | ||
372 | #define DEFAULT_TRSCER_ERR_MASK (DESC_I_RINT8 | DESC_I_RINT5 | DESC_I_TINT2) | ||
373 | |||
372 | /* RPADIR */ | 374 | /* RPADIR */ |
373 | enum RPADIR_BIT { | 375 | enum RPADIR_BIT { |
374 | RPADIR_PADS1 = 0x20000, RPADIR_PADS0 = 0x10000, | 376 | RPADIR_PADS1 = 0x20000, RPADIR_PADS0 = 0x10000, |
@@ -470,6 +472,9 @@ struct sh_eth_cpu_data { | |||
470 | unsigned long tx_check; | 472 | unsigned long tx_check; |
471 | unsigned long eesr_err_check; | 473 | unsigned long eesr_err_check; |
472 | 474 | ||
475 | /* Error mask */ | ||
476 | unsigned long trscer_err_mask; | ||
477 | |||
473 | /* hardware features */ | 478 | /* hardware features */ |
474 | unsigned long irq_flags; /* IRQ configuration flags */ | 479 | unsigned long irq_flags; /* IRQ configuration flags */ |
475 | unsigned no_psr:1; /* EtherC DO NOT have PSR */ | 480 | unsigned no_psr:1; /* EtherC DO NOT have PSR */ |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index c560f9aeb55d..64d1cef4cda1 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -610,7 +610,7 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable) | |||
610 | 610 | ||
611 | /* Clear all mcast from ALE */ | 611 | /* Clear all mcast from ALE */ |
612 | cpsw_ale_flush_multicast(ale, ALE_ALL_PORTS << | 612 | cpsw_ale_flush_multicast(ale, ALE_ALL_PORTS << |
613 | priv->host_port); | 613 | priv->host_port, -1); |
614 | 614 | ||
615 | /* Flood All Unicast Packets to Host port */ | 615 | /* Flood All Unicast Packets to Host port */ |
616 | cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 1); | 616 | cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 1); |
@@ -634,6 +634,12 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable) | |||
634 | static void cpsw_ndo_set_rx_mode(struct net_device *ndev) | 634 | static void cpsw_ndo_set_rx_mode(struct net_device *ndev) |
635 | { | 635 | { |
636 | struct cpsw_priv *priv = netdev_priv(ndev); | 636 | struct cpsw_priv *priv = netdev_priv(ndev); |
637 | int vid; | ||
638 | |||
639 | if (priv->data.dual_emac) | ||
640 | vid = priv->slaves[priv->emac_port].port_vlan; | ||
641 | else | ||
642 | vid = priv->data.default_vlan; | ||
637 | 643 | ||
638 | if (ndev->flags & IFF_PROMISC) { | 644 | if (ndev->flags & IFF_PROMISC) { |
639 | /* Enable promiscuous mode */ | 645 | /* Enable promiscuous mode */ |
@@ -649,7 +655,8 @@ static void cpsw_ndo_set_rx_mode(struct net_device *ndev) | |||
649 | cpsw_ale_set_allmulti(priv->ale, priv->ndev->flags & IFF_ALLMULTI); | 655 | cpsw_ale_set_allmulti(priv->ale, priv->ndev->flags & IFF_ALLMULTI); |
650 | 656 | ||
651 | /* Clear all mcast from ALE */ | 657 | /* Clear all mcast from ALE */ |
652 | cpsw_ale_flush_multicast(priv->ale, ALE_ALL_PORTS << priv->host_port); | 658 | cpsw_ale_flush_multicast(priv->ale, ALE_ALL_PORTS << priv->host_port, |
659 | vid); | ||
653 | 660 | ||
654 | if (!netdev_mc_empty(ndev)) { | 661 | if (!netdev_mc_empty(ndev)) { |
655 | struct netdev_hw_addr *ha; | 662 | struct netdev_hw_addr *ha; |
@@ -757,6 +764,14 @@ requeue: | |||
757 | static irqreturn_t cpsw_interrupt(int irq, void *dev_id) | 764 | static irqreturn_t cpsw_interrupt(int irq, void *dev_id) |
758 | { | 765 | { |
759 | struct cpsw_priv *priv = dev_id; | 766 | struct cpsw_priv *priv = dev_id; |
767 | int value = irq - priv->irqs_table[0]; | ||
768 | |||
769 | /* NOTICE: Ending IRQ here. The trick with the 'value' variable above | ||
770 | * is to make sure we will always write the correct value to the EOI | ||
771 | * register. Namely 0 for RX_THRESH Interrupt, 1 for RX Interrupt, 2 | ||
772 | * for TX Interrupt and 3 for MISC Interrupt. | ||
773 | */ | ||
774 | cpdma_ctlr_eoi(priv->dma, value); | ||
760 | 775 | ||
761 | cpsw_intr_disable(priv); | 776 | cpsw_intr_disable(priv); |
762 | if (priv->irq_enabled == true) { | 777 | if (priv->irq_enabled == true) { |
@@ -786,8 +801,6 @@ static int cpsw_poll(struct napi_struct *napi, int budget) | |||
786 | int num_tx, num_rx; | 801 | int num_tx, num_rx; |
787 | 802 | ||
788 | num_tx = cpdma_chan_process(priv->txch, 128); | 803 | num_tx = cpdma_chan_process(priv->txch, 128); |
789 | if (num_tx) | ||
790 | cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX); | ||
791 | 804 | ||
792 | num_rx = cpdma_chan_process(priv->rxch, budget); | 805 | num_rx = cpdma_chan_process(priv->rxch, budget); |
793 | if (num_rx < budget) { | 806 | if (num_rx < budget) { |
@@ -795,7 +808,6 @@ static int cpsw_poll(struct napi_struct *napi, int budget) | |||
795 | 808 | ||
796 | napi_complete(napi); | 809 | napi_complete(napi); |
797 | cpsw_intr_enable(priv); | 810 | cpsw_intr_enable(priv); |
798 | cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX); | ||
799 | prim_cpsw = cpsw_get_slave_priv(priv, 0); | 811 | prim_cpsw = cpsw_get_slave_priv(priv, 0); |
800 | if (prim_cpsw->irq_enabled == false) { | 812 | if (prim_cpsw->irq_enabled == false) { |
801 | prim_cpsw->irq_enabled = true; | 813 | prim_cpsw->irq_enabled = true; |
@@ -1310,8 +1322,6 @@ static int cpsw_ndo_open(struct net_device *ndev) | |||
1310 | napi_enable(&priv->napi); | 1322 | napi_enable(&priv->napi); |
1311 | cpdma_ctlr_start(priv->dma); | 1323 | cpdma_ctlr_start(priv->dma); |
1312 | cpsw_intr_enable(priv); | 1324 | cpsw_intr_enable(priv); |
1313 | cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX); | ||
1314 | cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX); | ||
1315 | 1325 | ||
1316 | prim_cpsw = cpsw_get_slave_priv(priv, 0); | 1326 | prim_cpsw = cpsw_get_slave_priv(priv, 0); |
1317 | if (prim_cpsw->irq_enabled == false) { | 1327 | if (prim_cpsw->irq_enabled == false) { |
@@ -1578,9 +1588,6 @@ static void cpsw_ndo_tx_timeout(struct net_device *ndev) | |||
1578 | cpdma_chan_start(priv->txch); | 1588 | cpdma_chan_start(priv->txch); |
1579 | cpdma_ctlr_int_ctrl(priv->dma, true); | 1589 | cpdma_ctlr_int_ctrl(priv->dma, true); |
1580 | cpsw_intr_enable(priv); | 1590 | cpsw_intr_enable(priv); |
1581 | cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX); | ||
1582 | cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX); | ||
1583 | |||
1584 | } | 1591 | } |
1585 | 1592 | ||
1586 | static int cpsw_ndo_set_mac_address(struct net_device *ndev, void *p) | 1593 | static int cpsw_ndo_set_mac_address(struct net_device *ndev, void *p) |
@@ -1620,9 +1627,6 @@ static void cpsw_ndo_poll_controller(struct net_device *ndev) | |||
1620 | cpsw_interrupt(ndev->irq, priv); | 1627 | cpsw_interrupt(ndev->irq, priv); |
1621 | cpdma_ctlr_int_ctrl(priv->dma, true); | 1628 | cpdma_ctlr_int_ctrl(priv->dma, true); |
1622 | cpsw_intr_enable(priv); | 1629 | cpsw_intr_enable(priv); |
1623 | cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX); | ||
1624 | cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX); | ||
1625 | |||
1626 | } | 1630 | } |
1627 | #endif | 1631 | #endif |
1628 | 1632 | ||
diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c index 097ebe7077ac..5246b3a18ff8 100644 --- a/drivers/net/ethernet/ti/cpsw_ale.c +++ b/drivers/net/ethernet/ti/cpsw_ale.c | |||
@@ -234,7 +234,7 @@ static void cpsw_ale_flush_mcast(struct cpsw_ale *ale, u32 *ale_entry, | |||
234 | cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE); | 234 | cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE); |
235 | } | 235 | } |
236 | 236 | ||
237 | int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask) | 237 | int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask, int vid) |
238 | { | 238 | { |
239 | u32 ale_entry[ALE_ENTRY_WORDS]; | 239 | u32 ale_entry[ALE_ENTRY_WORDS]; |
240 | int ret, idx; | 240 | int ret, idx; |
@@ -245,6 +245,14 @@ int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask) | |||
245 | if (ret != ALE_TYPE_ADDR && ret != ALE_TYPE_VLAN_ADDR) | 245 | if (ret != ALE_TYPE_ADDR && ret != ALE_TYPE_VLAN_ADDR) |
246 | continue; | 246 | continue; |
247 | 247 | ||
248 | /* if vid passed is -1 then remove all multicast entry from | ||
249 | * the table irrespective of vlan id, if a valid vlan id is | ||
250 | * passed then remove only multicast added to that vlan id. | ||
251 | * if vlan id doesn't match then move on to next entry. | ||
252 | */ | ||
253 | if (vid != -1 && cpsw_ale_get_vlan_id(ale_entry) != vid) | ||
254 | continue; | ||
255 | |||
248 | if (cpsw_ale_get_mcast(ale_entry)) { | 256 | if (cpsw_ale_get_mcast(ale_entry)) { |
249 | u8 addr[6]; | 257 | u8 addr[6]; |
250 | 258 | ||
diff --git a/drivers/net/ethernet/ti/cpsw_ale.h b/drivers/net/ethernet/ti/cpsw_ale.h index c0d4127aa549..af1e7ecd87c6 100644 --- a/drivers/net/ethernet/ti/cpsw_ale.h +++ b/drivers/net/ethernet/ti/cpsw_ale.h | |||
@@ -92,7 +92,7 @@ void cpsw_ale_stop(struct cpsw_ale *ale); | |||
92 | 92 | ||
93 | int cpsw_ale_set_ageout(struct cpsw_ale *ale, int ageout); | 93 | int cpsw_ale_set_ageout(struct cpsw_ale *ale, int ageout); |
94 | int cpsw_ale_flush(struct cpsw_ale *ale, int port_mask); | 94 | int cpsw_ale_flush(struct cpsw_ale *ale, int port_mask); |
95 | int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask); | 95 | int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask, int vid); |
96 | int cpsw_ale_add_ucast(struct cpsw_ale *ale, u8 *addr, int port, | 96 | int cpsw_ale_add_ucast(struct cpsw_ale *ale, u8 *addr, int port, |
97 | int flags, u16 vid); | 97 | int flags, u16 vid); |
98 | int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port, | 98 | int cpsw_ale_del_ucast(struct cpsw_ale *ale, u8 *addr, int port, |
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c index 9c2d91ea0af4..dbcbf0c5bcfa 100644 --- a/drivers/net/ethernet/xilinx/ll_temac_main.c +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c | |||
@@ -1043,6 +1043,7 @@ static int temac_of_probe(struct platform_device *op) | |||
1043 | lp->regs = of_iomap(op->dev.of_node, 0); | 1043 | lp->regs = of_iomap(op->dev.of_node, 0); |
1044 | if (!lp->regs) { | 1044 | if (!lp->regs) { |
1045 | dev_err(&op->dev, "could not map temac regs.\n"); | 1045 | dev_err(&op->dev, "could not map temac regs.\n"); |
1046 | rc = -ENOMEM; | ||
1046 | goto nodev; | 1047 | goto nodev; |
1047 | } | 1048 | } |
1048 | 1049 | ||
@@ -1062,6 +1063,7 @@ static int temac_of_probe(struct platform_device *op) | |||
1062 | np = of_parse_phandle(op->dev.of_node, "llink-connected", 0); | 1063 | np = of_parse_phandle(op->dev.of_node, "llink-connected", 0); |
1063 | if (!np) { | 1064 | if (!np) { |
1064 | dev_err(&op->dev, "could not find DMA node\n"); | 1065 | dev_err(&op->dev, "could not find DMA node\n"); |
1066 | rc = -ENODEV; | ||
1065 | goto err_iounmap; | 1067 | goto err_iounmap; |
1066 | } | 1068 | } |
1067 | 1069 | ||
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index c18a0c637c44..a6d2860b712c 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c | |||
@@ -1501,6 +1501,7 @@ static int axienet_of_probe(struct platform_device *op) | |||
1501 | lp->regs = of_iomap(op->dev.of_node, 0); | 1501 | lp->regs = of_iomap(op->dev.of_node, 0); |
1502 | if (!lp->regs) { | 1502 | if (!lp->regs) { |
1503 | dev_err(&op->dev, "could not map Axi Ethernet regs.\n"); | 1503 | dev_err(&op->dev, "could not map Axi Ethernet regs.\n"); |
1504 | ret = -ENOMEM; | ||
1504 | goto nodev; | 1505 | goto nodev; |
1505 | } | 1506 | } |
1506 | /* Setup checksum offload, but default to off if not specified */ | 1507 | /* Setup checksum offload, but default to off if not specified */ |
@@ -1563,6 +1564,7 @@ static int axienet_of_probe(struct platform_device *op) | |||
1563 | np = of_parse_phandle(op->dev.of_node, "axistream-connected", 0); | 1564 | np = of_parse_phandle(op->dev.of_node, "axistream-connected", 0); |
1564 | if (!np) { | 1565 | if (!np) { |
1565 | dev_err(&op->dev, "could not find DMA node\n"); | 1566 | dev_err(&op->dev, "could not find DMA node\n"); |
1567 | ret = -ENODEV; | ||
1566 | goto err_iounmap; | 1568 | goto err_iounmap; |
1567 | } | 1569 | } |
1568 | lp->dma_regs = of_iomap(np, 0); | 1570 | lp->dma_regs = of_iomap(np, 0); |
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c index 24858799c204..9d4ce388510a 100644 --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c | |||
@@ -1109,6 +1109,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev) | |||
1109 | res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0); | 1109 | res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0); |
1110 | if (!res) { | 1110 | if (!res) { |
1111 | dev_err(dev, "no IRQ found\n"); | 1111 | dev_err(dev, "no IRQ found\n"); |
1112 | rc = -ENXIO; | ||
1112 | goto error; | 1113 | goto error; |
1113 | } | 1114 | } |
1114 | 1115 | ||
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 93e224217e24..f7ff493f1e73 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c | |||
@@ -629,6 +629,7 @@ static int team_change_mode(struct team *team, const char *kind) | |||
629 | static void team_notify_peers_work(struct work_struct *work) | 629 | static void team_notify_peers_work(struct work_struct *work) |
630 | { | 630 | { |
631 | struct team *team; | 631 | struct team *team; |
632 | int val; | ||
632 | 633 | ||
633 | team = container_of(work, struct team, notify_peers.dw.work); | 634 | team = container_of(work, struct team, notify_peers.dw.work); |
634 | 635 | ||
@@ -636,9 +637,14 @@ static void team_notify_peers_work(struct work_struct *work) | |||
636 | schedule_delayed_work(&team->notify_peers.dw, 0); | 637 | schedule_delayed_work(&team->notify_peers.dw, 0); |
637 | return; | 638 | return; |
638 | } | 639 | } |
640 | val = atomic_dec_if_positive(&team->notify_peers.count_pending); | ||
641 | if (val < 0) { | ||
642 | rtnl_unlock(); | ||
643 | return; | ||
644 | } | ||
639 | call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, team->dev); | 645 | call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, team->dev); |
640 | rtnl_unlock(); | 646 | rtnl_unlock(); |
641 | if (!atomic_dec_and_test(&team->notify_peers.count_pending)) | 647 | if (val) |
642 | schedule_delayed_work(&team->notify_peers.dw, | 648 | schedule_delayed_work(&team->notify_peers.dw, |
643 | msecs_to_jiffies(team->notify_peers.interval)); | 649 | msecs_to_jiffies(team->notify_peers.interval)); |
644 | } | 650 | } |
@@ -669,6 +675,7 @@ static void team_notify_peers_fini(struct team *team) | |||
669 | static void team_mcast_rejoin_work(struct work_struct *work) | 675 | static void team_mcast_rejoin_work(struct work_struct *work) |
670 | { | 676 | { |
671 | struct team *team; | 677 | struct team *team; |
678 | int val; | ||
672 | 679 | ||
673 | team = container_of(work, struct team, mcast_rejoin.dw.work); | 680 | team = container_of(work, struct team, mcast_rejoin.dw.work); |
674 | 681 | ||
@@ -676,9 +683,14 @@ static void team_mcast_rejoin_work(struct work_struct *work) | |||
676 | schedule_delayed_work(&team->mcast_rejoin.dw, 0); | 683 | schedule_delayed_work(&team->mcast_rejoin.dw, 0); |
677 | return; | 684 | return; |
678 | } | 685 | } |
686 | val = atomic_dec_if_positive(&team->mcast_rejoin.count_pending); | ||
687 | if (val < 0) { | ||
688 | rtnl_unlock(); | ||
689 | return; | ||
690 | } | ||
679 | call_netdevice_notifiers(NETDEV_RESEND_IGMP, team->dev); | 691 | call_netdevice_notifiers(NETDEV_RESEND_IGMP, team->dev); |
680 | rtnl_unlock(); | 692 | rtnl_unlock(); |
681 | if (!atomic_dec_and_test(&team->mcast_rejoin.count_pending)) | 693 | if (val) |
682 | schedule_delayed_work(&team->mcast_rejoin.dw, | 694 | schedule_delayed_work(&team->mcast_rejoin.dw, |
683 | msecs_to_jiffies(team->mcast_rejoin.interval)); | 695 | msecs_to_jiffies(team->mcast_rejoin.interval)); |
684 | } | 696 | } |
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c index dcb6d33141e0..1e9cdca37014 100644 --- a/drivers/net/usb/kaweth.c +++ b/drivers/net/usb/kaweth.c | |||
@@ -1276,7 +1276,7 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int* actual_length) | |||
1276 | awd.done = 0; | 1276 | awd.done = 0; |
1277 | 1277 | ||
1278 | urb->context = &awd; | 1278 | urb->context = &awd; |
1279 | status = usb_submit_urb(urb, GFP_NOIO); | 1279 | status = usb_submit_urb(urb, GFP_ATOMIC); |
1280 | if (status) { | 1280 | if (status) { |
1281 | // something went wrong | 1281 | // something went wrong |
1282 | usb_free_urb(urb); | 1282 | usb_free_urb(urb); |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index b8a82b86f909..602dc6668c3a 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -56,6 +56,8 @@ struct qmi_wwan_state { | |||
56 | /* default ethernet address used by the modem */ | 56 | /* default ethernet address used by the modem */ |
57 | static const u8 default_modem_addr[ETH_ALEN] = {0x02, 0x50, 0xf3}; | 57 | static const u8 default_modem_addr[ETH_ALEN] = {0x02, 0x50, 0xf3}; |
58 | 58 | ||
59 | static const u8 buggy_fw_addr[ETH_ALEN] = {0x00, 0xa0, 0xc6, 0x00, 0x00, 0x00}; | ||
60 | |||
59 | /* Make up an ethernet header if the packet doesn't have one. | 61 | /* Make up an ethernet header if the packet doesn't have one. |
60 | * | 62 | * |
61 | * A firmware bug common among several devices cause them to send raw | 63 | * A firmware bug common among several devices cause them to send raw |
@@ -332,10 +334,12 @@ next_desc: | |||
332 | usb_driver_release_interface(driver, info->data); | 334 | usb_driver_release_interface(driver, info->data); |
333 | } | 335 | } |
334 | 336 | ||
335 | /* Never use the same address on both ends of the link, even | 337 | /* Never use the same address on both ends of the link, even if the |
336 | * if the buggy firmware told us to. | 338 | * buggy firmware told us to. Or, if device is assigned the well-known |
339 | * buggy firmware MAC address, replace it with a random address, | ||
337 | */ | 340 | */ |
338 | if (ether_addr_equal(dev->net->dev_addr, default_modem_addr)) | 341 | if (ether_addr_equal(dev->net->dev_addr, default_modem_addr) || |
342 | ether_addr_equal(dev->net->dev_addr, buggy_fw_addr)) | ||
339 | eth_hw_addr_random(dev->net); | 343 | eth_hw_addr_random(dev->net); |
340 | 344 | ||
341 | /* make MAC addr easily distinguishable from an IP header */ | 345 | /* make MAC addr easily distinguishable from an IP header */ |
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 2d1c77e81836..57ec23e8ccfa 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
@@ -1897,6 +1897,22 @@ static void _rtl8152_set_rx_mode(struct net_device *netdev) | |||
1897 | netif_wake_queue(netdev); | 1897 | netif_wake_queue(netdev); |
1898 | } | 1898 | } |
1899 | 1899 | ||
1900 | static netdev_features_t | ||
1901 | rtl8152_features_check(struct sk_buff *skb, struct net_device *dev, | ||
1902 | netdev_features_t features) | ||
1903 | { | ||
1904 | u32 mss = skb_shinfo(skb)->gso_size; | ||
1905 | int max_offset = mss ? GTTCPHO_MAX : TCPHO_MAX; | ||
1906 | int offset = skb_transport_offset(skb); | ||
1907 | |||
1908 | if ((mss || skb->ip_summed == CHECKSUM_PARTIAL) && offset > max_offset) | ||
1909 | features &= ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK); | ||
1910 | else if ((skb->len + sizeof(struct tx_desc)) > agg_buf_sz) | ||
1911 | features &= ~NETIF_F_GSO_MASK; | ||
1912 | |||
1913 | return features; | ||
1914 | } | ||
1915 | |||
1900 | static netdev_tx_t rtl8152_start_xmit(struct sk_buff *skb, | 1916 | static netdev_tx_t rtl8152_start_xmit(struct sk_buff *skb, |
1901 | struct net_device *netdev) | 1917 | struct net_device *netdev) |
1902 | { | 1918 | { |
@@ -3706,6 +3722,7 @@ static const struct net_device_ops rtl8152_netdev_ops = { | |||
3706 | .ndo_set_mac_address = rtl8152_set_mac_address, | 3722 | .ndo_set_mac_address = rtl8152_set_mac_address, |
3707 | .ndo_change_mtu = rtl8152_change_mtu, | 3723 | .ndo_change_mtu = rtl8152_change_mtu, |
3708 | .ndo_validate_addr = eth_validate_addr, | 3724 | .ndo_validate_addr = eth_validate_addr, |
3725 | .ndo_features_check = rtl8152_features_check, | ||
3709 | }; | 3726 | }; |
3710 | 3727 | ||
3711 | static void r8152b_get_version(struct r8152 *tp) | 3728 | static void r8152b_get_version(struct r8152 *tp) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-7000.c b/drivers/net/wireless/iwlwifi/iwl-7000.c index e5be2d21868f..a5f9198d5747 100644 --- a/drivers/net/wireless/iwlwifi/iwl-7000.c +++ b/drivers/net/wireless/iwlwifi/iwl-7000.c | |||
@@ -69,8 +69,8 @@ | |||
69 | #include "iwl-agn-hw.h" | 69 | #include "iwl-agn-hw.h" |
70 | 70 | ||
71 | /* Highest firmware API version supported */ | 71 | /* Highest firmware API version supported */ |
72 | #define IWL7260_UCODE_API_MAX 10 | 72 | #define IWL7260_UCODE_API_MAX 12 |
73 | #define IWL3160_UCODE_API_MAX 10 | 73 | #define IWL3160_UCODE_API_MAX 12 |
74 | 74 | ||
75 | /* Oldest version we won't warn about */ | 75 | /* Oldest version we won't warn about */ |
76 | #define IWL7260_UCODE_API_OK 10 | 76 | #define IWL7260_UCODE_API_OK 10 |
@@ -105,7 +105,7 @@ | |||
105 | #define IWL7265_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode" | 105 | #define IWL7265_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode" |
106 | 106 | ||
107 | #define IWL7265D_FW_PRE "iwlwifi-7265D-" | 107 | #define IWL7265D_FW_PRE "iwlwifi-7265D-" |
108 | #define IWL7265D_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode" | 108 | #define IWL7265D_MODULE_FIRMWARE(api) IWL7265D_FW_PRE __stringify(api) ".ucode" |
109 | 109 | ||
110 | #define NVM_HW_SECTION_NUM_FAMILY_7000 0 | 110 | #define NVM_HW_SECTION_NUM_FAMILY_7000 0 |
111 | 111 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-8000.c b/drivers/net/wireless/iwlwifi/iwl-8000.c index bf0a95cb7153..3668fc57e770 100644 --- a/drivers/net/wireless/iwlwifi/iwl-8000.c +++ b/drivers/net/wireless/iwlwifi/iwl-8000.c | |||
@@ -69,7 +69,7 @@ | |||
69 | #include "iwl-agn-hw.h" | 69 | #include "iwl-agn-hw.h" |
70 | 70 | ||
71 | /* Highest firmware API version supported */ | 71 | /* Highest firmware API version supported */ |
72 | #define IWL8000_UCODE_API_MAX 10 | 72 | #define IWL8000_UCODE_API_MAX 12 |
73 | 73 | ||
74 | /* Oldest version we won't warn about */ | 74 | /* Oldest version we won't warn about */ |
75 | #define IWL8000_UCODE_API_OK 10 | 75 | #define IWL8000_UCODE_API_OK 10 |
diff --git a/drivers/net/wireless/iwlwifi/iwl-fw-file.h b/drivers/net/wireless/iwlwifi/iwl-fw-file.h index f2a047f6bb3e..1bbe4fc47b97 100644 --- a/drivers/net/wireless/iwlwifi/iwl-fw-file.h +++ b/drivers/net/wireless/iwlwifi/iwl-fw-file.h | |||
@@ -243,6 +243,9 @@ enum iwl_ucode_tlv_flag { | |||
243 | * @IWL_UCODE_TLV_API_SF_NO_DUMMY_NOTIF: ucode supports disabling dummy notif. | 243 | * @IWL_UCODE_TLV_API_SF_NO_DUMMY_NOTIF: ucode supports disabling dummy notif. |
244 | * @IWL_UCODE_TLV_API_FRAGMENTED_SCAN: This ucode supports active dwell time | 244 | * @IWL_UCODE_TLV_API_FRAGMENTED_SCAN: This ucode supports active dwell time |
245 | * longer than the passive one, which is essential for fragmented scan. | 245 | * longer than the passive one, which is essential for fragmented scan. |
246 | * @IWL_UCODE_TLV_API_BASIC_DWELL: use only basic dwell time in scan command, | ||
247 | * regardless of the band or the number of the probes. FW will calculate | ||
248 | * the actual dwell time. | ||
246 | */ | 249 | */ |
247 | enum iwl_ucode_tlv_api { | 250 | enum iwl_ucode_tlv_api { |
248 | IWL_UCODE_TLV_API_WOWLAN_CONFIG_TID = BIT(0), | 251 | IWL_UCODE_TLV_API_WOWLAN_CONFIG_TID = BIT(0), |
@@ -253,6 +256,7 @@ enum iwl_ucode_tlv_api { | |||
253 | IWL_UCODE_TLV_API_LMAC_SCAN = BIT(6), | 256 | IWL_UCODE_TLV_API_LMAC_SCAN = BIT(6), |
254 | IWL_UCODE_TLV_API_SF_NO_DUMMY_NOTIF = BIT(7), | 257 | IWL_UCODE_TLV_API_SF_NO_DUMMY_NOTIF = BIT(7), |
255 | IWL_UCODE_TLV_API_FRAGMENTED_SCAN = BIT(8), | 258 | IWL_UCODE_TLV_API_FRAGMENTED_SCAN = BIT(8), |
259 | IWL_UCODE_TLV_API_BASIC_DWELL = BIT(13), | ||
256 | }; | 260 | }; |
257 | 261 | ||
258 | /** | 262 | /** |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h index 1f2acf47bfb2..201846de94e7 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h | |||
@@ -672,6 +672,7 @@ struct iwl_scan_channel_opt { | |||
672 | * @IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED: all passive scans will be fragmented | 672 | * @IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED: all passive scans will be fragmented |
673 | * @IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED: insert WFA vendor-specific TPC report | 673 | * @IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED: insert WFA vendor-specific TPC report |
674 | * and DS parameter set IEs into probe requests. | 674 | * and DS parameter set IEs into probe requests. |
675 | * @IWL_MVM_LMAC_SCAN_FLAG_MATCH: Send match found notification on matches | ||
675 | */ | 676 | */ |
676 | enum iwl_mvm_lmac_scan_flags { | 677 | enum iwl_mvm_lmac_scan_flags { |
677 | IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL = BIT(0), | 678 | IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL = BIT(0), |
@@ -681,6 +682,7 @@ enum iwl_mvm_lmac_scan_flags { | |||
681 | IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS = BIT(4), | 682 | IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS = BIT(4), |
682 | IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED = BIT(5), | 683 | IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED = BIT(5), |
683 | IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED = BIT(6), | 684 | IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED = BIT(6), |
685 | IWL_MVM_LMAC_SCAN_FLAG_MATCH = BIT(9), | ||
684 | }; | 686 | }; |
685 | 687 | ||
686 | enum iwl_scan_priority { | 688 | enum iwl_scan_priority { |
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index e5294d01181e..ec9a8e7bae1d 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c | |||
@@ -171,15 +171,21 @@ static void iwl_mvm_scan_fill_ssids(struct iwl_ssid_ie *cmd_ssid, | |||
171 | * already included in the probe template, so we need to set only | 171 | * already included in the probe template, so we need to set only |
172 | * req->n_ssids - 1 bits in addition to the first bit. | 172 | * req->n_ssids - 1 bits in addition to the first bit. |
173 | */ | 173 | */ |
174 | static u16 iwl_mvm_get_active_dwell(enum ieee80211_band band, int n_ssids) | 174 | static u16 iwl_mvm_get_active_dwell(struct iwl_mvm *mvm, |
175 | enum ieee80211_band band, int n_ssids) | ||
175 | { | 176 | { |
177 | if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BASIC_DWELL) | ||
178 | return 10; | ||
176 | if (band == IEEE80211_BAND_2GHZ) | 179 | if (band == IEEE80211_BAND_2GHZ) |
177 | return 20 + 3 * (n_ssids + 1); | 180 | return 20 + 3 * (n_ssids + 1); |
178 | return 10 + 2 * (n_ssids + 1); | 181 | return 10 + 2 * (n_ssids + 1); |
179 | } | 182 | } |
180 | 183 | ||
181 | static u16 iwl_mvm_get_passive_dwell(enum ieee80211_band band) | 184 | static u16 iwl_mvm_get_passive_dwell(struct iwl_mvm *mvm, |
185 | enum ieee80211_band band) | ||
182 | { | 186 | { |
187 | if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BASIC_DWELL) | ||
188 | return 110; | ||
183 | return band == IEEE80211_BAND_2GHZ ? 100 + 20 : 100 + 10; | 189 | return band == IEEE80211_BAND_2GHZ ? 100 + 20 : 100 + 10; |
184 | } | 190 | } |
185 | 191 | ||
@@ -331,7 +337,8 @@ static void iwl_mvm_scan_calc_params(struct iwl_mvm *mvm, | |||
331 | */ | 337 | */ |
332 | if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { | 338 | if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { |
333 | u32 passive_dwell = | 339 | u32 passive_dwell = |
334 | iwl_mvm_get_passive_dwell(IEEE80211_BAND_2GHZ); | 340 | iwl_mvm_get_passive_dwell(mvm, |
341 | IEEE80211_BAND_2GHZ); | ||
335 | params->max_out_time = passive_dwell; | 342 | params->max_out_time = passive_dwell; |
336 | } else { | 343 | } else { |
337 | params->passive_fragmented = true; | 344 | params->passive_fragmented = true; |
@@ -348,8 +355,8 @@ not_bound: | |||
348 | params->dwell[band].passive = frag_passive_dwell; | 355 | params->dwell[band].passive = frag_passive_dwell; |
349 | else | 356 | else |
350 | params->dwell[band].passive = | 357 | params->dwell[band].passive = |
351 | iwl_mvm_get_passive_dwell(band); | 358 | iwl_mvm_get_passive_dwell(mvm, band); |
352 | params->dwell[band].active = iwl_mvm_get_active_dwell(band, | 359 | params->dwell[band].active = iwl_mvm_get_active_dwell(mvm, band, |
353 | n_ssids); | 360 | n_ssids); |
354 | } | 361 | } |
355 | } | 362 | } |
@@ -1448,6 +1455,8 @@ int iwl_mvm_unified_sched_scan_lmac(struct iwl_mvm *mvm, | |||
1448 | 1455 | ||
1449 | if (iwl_mvm_scan_pass_all(mvm, req)) | 1456 | if (iwl_mvm_scan_pass_all(mvm, req)) |
1450 | flags |= IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL; | 1457 | flags |= IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL; |
1458 | else | ||
1459 | flags |= IWL_MVM_LMAC_SCAN_FLAG_MATCH; | ||
1451 | 1460 | ||
1452 | if (req->n_ssids == 1 && req->ssids[0].ssid_len != 0) | 1461 | if (req->n_ssids == 1 && req->ssids[0].ssid_len != 0) |
1453 | flags |= IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION; | 1462 | flags |= IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c index 4f15d9decc81..4333306ccdee 100644 --- a/drivers/net/wireless/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/iwlwifi/mvm/tx.c | |||
@@ -108,8 +108,12 @@ void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb, | |||
108 | tx_flags &= ~TX_CMD_FLG_SEQ_CTL; | 108 | tx_flags &= ~TX_CMD_FLG_SEQ_CTL; |
109 | } | 109 | } |
110 | 110 | ||
111 | /* tid_tspec will default to 0 = BE when QOS isn't enabled */ | 111 | /* Default to 0 (BE) when tid_spec is set to IWL_TID_NON_QOS */ |
112 | ac = tid_to_mac80211_ac[tx_cmd->tid_tspec]; | 112 | if (tx_cmd->tid_tspec < IWL_MAX_TID_COUNT) |
113 | ac = tid_to_mac80211_ac[tx_cmd->tid_tspec]; | ||
114 | else | ||
115 | ac = tid_to_mac80211_ac[0]; | ||
116 | |||
113 | tx_flags |= iwl_mvm_bt_coex_tx_prio(mvm, hdr, info, ac) << | 117 | tx_flags |= iwl_mvm_bt_coex_tx_prio(mvm, hdr, info, ac) << |
114 | TX_CMD_FLG_BT_PRIO_POS; | 118 | TX_CMD_FLG_BT_PRIO_POS; |
115 | 119 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/utils.c b/drivers/net/wireless/iwlwifi/mvm/utils.c index e56e77ef5d2e..917431e30f74 100644 --- a/drivers/net/wireless/iwlwifi/mvm/utils.c +++ b/drivers/net/wireless/iwlwifi/mvm/utils.c | |||
@@ -665,7 +665,7 @@ bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm) | |||
665 | if (num_of_ant(mvm->fw->valid_rx_ant) == 1) | 665 | if (num_of_ant(mvm->fw->valid_rx_ant) == 1) |
666 | return false; | 666 | return false; |
667 | 667 | ||
668 | if (!mvm->cfg->rx_with_siso_diversity) | 668 | if (mvm->cfg->rx_with_siso_diversity) |
669 | return false; | 669 | return false; |
670 | 670 | ||
671 | ieee80211_iterate_active_interfaces_atomic( | 671 | ieee80211_iterate_active_interfaces_atomic( |
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c index 2f0c4b170344..d5aadb00dd9e 100644 --- a/drivers/net/wireless/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/iwlwifi/pcie/drv.c | |||
@@ -527,8 +527,10 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
527 | else if (cfg == &iwl7265_n_cfg) | 527 | else if (cfg == &iwl7265_n_cfg) |
528 | cfg_7265d = &iwl7265d_n_cfg; | 528 | cfg_7265d = &iwl7265d_n_cfg; |
529 | if (cfg_7265d && | 529 | if (cfg_7265d && |
530 | (iwl_trans->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_7265D) | 530 | (iwl_trans->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_7265D) { |
531 | cfg = cfg_7265d; | 531 | cfg = cfg_7265d; |
532 | iwl_trans->cfg = cfg_7265d; | ||
533 | } | ||
532 | #endif | 534 | #endif |
533 | 535 | ||
534 | pci_set_drvdata(pdev, iwl_trans); | 536 | pci_set_drvdata(pdev, iwl_trans); |
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 846a2e6e34d8..c70efb9a6e78 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
@@ -666,7 +666,8 @@ tx_status_ok: | |||
666 | } | 666 | } |
667 | 667 | ||
668 | static int _rtl_pci_init_one_rxdesc(struct ieee80211_hw *hw, | 668 | static int _rtl_pci_init_one_rxdesc(struct ieee80211_hw *hw, |
669 | u8 *entry, int rxring_idx, int desc_idx) | 669 | struct sk_buff *new_skb, u8 *entry, |
670 | int rxring_idx, int desc_idx) | ||
670 | { | 671 | { |
671 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 672 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
672 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | 673 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
@@ -674,11 +675,15 @@ static int _rtl_pci_init_one_rxdesc(struct ieee80211_hw *hw, | |||
674 | u8 tmp_one = 1; | 675 | u8 tmp_one = 1; |
675 | struct sk_buff *skb; | 676 | struct sk_buff *skb; |
676 | 677 | ||
678 | if (likely(new_skb)) { | ||
679 | skb = new_skb; | ||
680 | goto remap; | ||
681 | } | ||
677 | skb = dev_alloc_skb(rtlpci->rxbuffersize); | 682 | skb = dev_alloc_skb(rtlpci->rxbuffersize); |
678 | if (!skb) | 683 | if (!skb) |
679 | return 0; | 684 | return 0; |
680 | rtlpci->rx_ring[rxring_idx].rx_buf[desc_idx] = skb; | ||
681 | 685 | ||
686 | remap: | ||
682 | /* just set skb->cb to mapping addr for pci_unmap_single use */ | 687 | /* just set skb->cb to mapping addr for pci_unmap_single use */ |
683 | *((dma_addr_t *)skb->cb) = | 688 | *((dma_addr_t *)skb->cb) = |
684 | pci_map_single(rtlpci->pdev, skb_tail_pointer(skb), | 689 | pci_map_single(rtlpci->pdev, skb_tail_pointer(skb), |
@@ -686,6 +691,7 @@ static int _rtl_pci_init_one_rxdesc(struct ieee80211_hw *hw, | |||
686 | bufferaddress = *((dma_addr_t *)skb->cb); | 691 | bufferaddress = *((dma_addr_t *)skb->cb); |
687 | if (pci_dma_mapping_error(rtlpci->pdev, bufferaddress)) | 692 | if (pci_dma_mapping_error(rtlpci->pdev, bufferaddress)) |
688 | return 0; | 693 | return 0; |
694 | rtlpci->rx_ring[rxring_idx].rx_buf[desc_idx] = skb; | ||
689 | if (rtlpriv->use_new_trx_flow) { | 695 | if (rtlpriv->use_new_trx_flow) { |
690 | rtlpriv->cfg->ops->set_desc(hw, (u8 *)entry, false, | 696 | rtlpriv->cfg->ops->set_desc(hw, (u8 *)entry, false, |
691 | HW_DESC_RX_PREPARE, | 697 | HW_DESC_RX_PREPARE, |
@@ -781,6 +787,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) | |||
781 | /*rx pkt */ | 787 | /*rx pkt */ |
782 | struct sk_buff *skb = rtlpci->rx_ring[rxring_idx].rx_buf[ | 788 | struct sk_buff *skb = rtlpci->rx_ring[rxring_idx].rx_buf[ |
783 | rtlpci->rx_ring[rxring_idx].idx]; | 789 | rtlpci->rx_ring[rxring_idx].idx]; |
790 | struct sk_buff *new_skb; | ||
784 | 791 | ||
785 | if (rtlpriv->use_new_trx_flow) { | 792 | if (rtlpriv->use_new_trx_flow) { |
786 | rx_remained_cnt = | 793 | rx_remained_cnt = |
@@ -807,6 +814,13 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) | |||
807 | pci_unmap_single(rtlpci->pdev, *((dma_addr_t *)skb->cb), | 814 | pci_unmap_single(rtlpci->pdev, *((dma_addr_t *)skb->cb), |
808 | rtlpci->rxbuffersize, PCI_DMA_FROMDEVICE); | 815 | rtlpci->rxbuffersize, PCI_DMA_FROMDEVICE); |
809 | 816 | ||
817 | /* get a new skb - if fail, old one will be reused */ | ||
818 | new_skb = dev_alloc_skb(rtlpci->rxbuffersize); | ||
819 | if (unlikely(!new_skb)) { | ||
820 | pr_err("Allocation of new skb failed in %s\n", | ||
821 | __func__); | ||
822 | goto no_new; | ||
823 | } | ||
810 | if (rtlpriv->use_new_trx_flow) { | 824 | if (rtlpriv->use_new_trx_flow) { |
811 | buffer_desc = | 825 | buffer_desc = |
812 | &rtlpci->rx_ring[rxring_idx].buffer_desc | 826 | &rtlpci->rx_ring[rxring_idx].buffer_desc |
@@ -911,14 +925,16 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) | |||
911 | schedule_work(&rtlpriv->works.lps_change_work); | 925 | schedule_work(&rtlpriv->works.lps_change_work); |
912 | } | 926 | } |
913 | end: | 927 | end: |
928 | skb = new_skb; | ||
929 | no_new: | ||
914 | if (rtlpriv->use_new_trx_flow) { | 930 | if (rtlpriv->use_new_trx_flow) { |
915 | _rtl_pci_init_one_rxdesc(hw, (u8 *)buffer_desc, | 931 | _rtl_pci_init_one_rxdesc(hw, skb, (u8 *)buffer_desc, |
916 | rxring_idx, | 932 | rxring_idx, |
917 | rtlpci->rx_ring[rxring_idx].idx); | 933 | rtlpci->rx_ring[rxring_idx].idx); |
918 | } else { | 934 | } else { |
919 | _rtl_pci_init_one_rxdesc(hw, (u8 *)pdesc, rxring_idx, | 935 | _rtl_pci_init_one_rxdesc(hw, skb, (u8 *)pdesc, |
936 | rxring_idx, | ||
920 | rtlpci->rx_ring[rxring_idx].idx); | 937 | rtlpci->rx_ring[rxring_idx].idx); |
921 | |||
922 | if (rtlpci->rx_ring[rxring_idx].idx == | 938 | if (rtlpci->rx_ring[rxring_idx].idx == |
923 | rtlpci->rxringcount - 1) | 939 | rtlpci->rxringcount - 1) |
924 | rtlpriv->cfg->ops->set_desc(hw, (u8 *)pdesc, | 940 | rtlpriv->cfg->ops->set_desc(hw, (u8 *)pdesc, |
@@ -1307,7 +1323,7 @@ static int _rtl_pci_init_rx_ring(struct ieee80211_hw *hw, int rxring_idx) | |||
1307 | rtlpci->rx_ring[rxring_idx].idx = 0; | 1323 | rtlpci->rx_ring[rxring_idx].idx = 0; |
1308 | for (i = 0; i < rtlpci->rxringcount; i++) { | 1324 | for (i = 0; i < rtlpci->rxringcount; i++) { |
1309 | entry = &rtlpci->rx_ring[rxring_idx].buffer_desc[i]; | 1325 | entry = &rtlpci->rx_ring[rxring_idx].buffer_desc[i]; |
1310 | if (!_rtl_pci_init_one_rxdesc(hw, (u8 *)entry, | 1326 | if (!_rtl_pci_init_one_rxdesc(hw, NULL, (u8 *)entry, |
1311 | rxring_idx, i)) | 1327 | rxring_idx, i)) |
1312 | return -ENOMEM; | 1328 | return -ENOMEM; |
1313 | } | 1329 | } |
@@ -1332,7 +1348,7 @@ static int _rtl_pci_init_rx_ring(struct ieee80211_hw *hw, int rxring_idx) | |||
1332 | 1348 | ||
1333 | for (i = 0; i < rtlpci->rxringcount; i++) { | 1349 | for (i = 0; i < rtlpci->rxringcount; i++) { |
1334 | entry = &rtlpci->rx_ring[rxring_idx].desc[i]; | 1350 | entry = &rtlpci->rx_ring[rxring_idx].desc[i]; |
1335 | if (!_rtl_pci_init_one_rxdesc(hw, (u8 *)entry, | 1351 | if (!_rtl_pci_init_one_rxdesc(hw, NULL, (u8 *)entry, |
1336 | rxring_idx, i)) | 1352 | rxring_idx, i)) |
1337 | return -ENOMEM; | 1353 | return -ENOMEM; |
1338 | } | 1354 | } |
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c index efbaf2ae1999..794204e34fba 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c | |||
@@ -737,6 +737,7 @@ static void connect(struct backend_info *be) | |||
737 | } | 737 | } |
738 | 738 | ||
739 | queue->remaining_credit = credit_bytes; | 739 | queue->remaining_credit = credit_bytes; |
740 | queue->credit_usec = credit_usec; | ||
740 | 741 | ||
741 | err = connect_rings(be, queue); | 742 | err = connect_rings(be, queue); |
742 | if (err) { | 743 | if (err) { |
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 22bcb4e12e2a..d8c10764f130 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
@@ -88,10 +88,8 @@ struct netfront_cb { | |||
88 | #define IRQ_NAME_SIZE (QUEUE_NAME_SIZE + 3) | 88 | #define IRQ_NAME_SIZE (QUEUE_NAME_SIZE + 3) |
89 | 89 | ||
90 | struct netfront_stats { | 90 | struct netfront_stats { |
91 | u64 rx_packets; | 91 | u64 packets; |
92 | u64 tx_packets; | 92 | u64 bytes; |
93 | u64 rx_bytes; | ||
94 | u64 tx_bytes; | ||
95 | struct u64_stats_sync syncp; | 93 | struct u64_stats_sync syncp; |
96 | }; | 94 | }; |
97 | 95 | ||
@@ -160,7 +158,8 @@ struct netfront_info { | |||
160 | struct netfront_queue *queues; | 158 | struct netfront_queue *queues; |
161 | 159 | ||
162 | /* Statistics */ | 160 | /* Statistics */ |
163 | struct netfront_stats __percpu *stats; | 161 | struct netfront_stats __percpu *rx_stats; |
162 | struct netfront_stats __percpu *tx_stats; | ||
164 | 163 | ||
165 | atomic_t rx_gso_checksum_fixup; | 164 | atomic_t rx_gso_checksum_fixup; |
166 | }; | 165 | }; |
@@ -565,7 +564,7 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
565 | { | 564 | { |
566 | unsigned short id; | 565 | unsigned short id; |
567 | struct netfront_info *np = netdev_priv(dev); | 566 | struct netfront_info *np = netdev_priv(dev); |
568 | struct netfront_stats *stats = this_cpu_ptr(np->stats); | 567 | struct netfront_stats *tx_stats = this_cpu_ptr(np->tx_stats); |
569 | struct xen_netif_tx_request *tx; | 568 | struct xen_netif_tx_request *tx; |
570 | char *data = skb->data; | 569 | char *data = skb->data; |
571 | RING_IDX i; | 570 | RING_IDX i; |
@@ -672,10 +671,10 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
672 | if (notify) | 671 | if (notify) |
673 | notify_remote_via_irq(queue->tx_irq); | 672 | notify_remote_via_irq(queue->tx_irq); |
674 | 673 | ||
675 | u64_stats_update_begin(&stats->syncp); | 674 | u64_stats_update_begin(&tx_stats->syncp); |
676 | stats->tx_bytes += skb->len; | 675 | tx_stats->bytes += skb->len; |
677 | stats->tx_packets++; | 676 | tx_stats->packets++; |
678 | u64_stats_update_end(&stats->syncp); | 677 | u64_stats_update_end(&tx_stats->syncp); |
679 | 678 | ||
680 | /* Note: It is not safe to access skb after xennet_tx_buf_gc()! */ | 679 | /* Note: It is not safe to access skb after xennet_tx_buf_gc()! */ |
681 | xennet_tx_buf_gc(queue); | 680 | xennet_tx_buf_gc(queue); |
@@ -931,7 +930,7 @@ static int checksum_setup(struct net_device *dev, struct sk_buff *skb) | |||
931 | static int handle_incoming_queue(struct netfront_queue *queue, | 930 | static int handle_incoming_queue(struct netfront_queue *queue, |
932 | struct sk_buff_head *rxq) | 931 | struct sk_buff_head *rxq) |
933 | { | 932 | { |
934 | struct netfront_stats *stats = this_cpu_ptr(queue->info->stats); | 933 | struct netfront_stats *rx_stats = this_cpu_ptr(queue->info->rx_stats); |
935 | int packets_dropped = 0; | 934 | int packets_dropped = 0; |
936 | struct sk_buff *skb; | 935 | struct sk_buff *skb; |
937 | 936 | ||
@@ -952,10 +951,10 @@ static int handle_incoming_queue(struct netfront_queue *queue, | |||
952 | continue; | 951 | continue; |
953 | } | 952 | } |
954 | 953 | ||
955 | u64_stats_update_begin(&stats->syncp); | 954 | u64_stats_update_begin(&rx_stats->syncp); |
956 | stats->rx_packets++; | 955 | rx_stats->packets++; |
957 | stats->rx_bytes += skb->len; | 956 | rx_stats->bytes += skb->len; |
958 | u64_stats_update_end(&stats->syncp); | 957 | u64_stats_update_end(&rx_stats->syncp); |
959 | 958 | ||
960 | /* Pass it up. */ | 959 | /* Pass it up. */ |
961 | napi_gro_receive(&queue->napi, skb); | 960 | napi_gro_receive(&queue->napi, skb); |
@@ -1079,18 +1078,22 @@ static struct rtnl_link_stats64 *xennet_get_stats64(struct net_device *dev, | |||
1079 | int cpu; | 1078 | int cpu; |
1080 | 1079 | ||
1081 | for_each_possible_cpu(cpu) { | 1080 | for_each_possible_cpu(cpu) { |
1082 | struct netfront_stats *stats = per_cpu_ptr(np->stats, cpu); | 1081 | struct netfront_stats *rx_stats = per_cpu_ptr(np->rx_stats, cpu); |
1082 | struct netfront_stats *tx_stats = per_cpu_ptr(np->tx_stats, cpu); | ||
1083 | u64 rx_packets, rx_bytes, tx_packets, tx_bytes; | 1083 | u64 rx_packets, rx_bytes, tx_packets, tx_bytes; |
1084 | unsigned int start; | 1084 | unsigned int start; |
1085 | 1085 | ||
1086 | do { | 1086 | do { |
1087 | start = u64_stats_fetch_begin_irq(&stats->syncp); | 1087 | start = u64_stats_fetch_begin_irq(&tx_stats->syncp); |
1088 | tx_packets = tx_stats->packets; | ||
1089 | tx_bytes = tx_stats->bytes; | ||
1090 | } while (u64_stats_fetch_retry_irq(&tx_stats->syncp, start)); | ||
1088 | 1091 | ||
1089 | rx_packets = stats->rx_packets; | 1092 | do { |
1090 | tx_packets = stats->tx_packets; | 1093 | start = u64_stats_fetch_begin_irq(&rx_stats->syncp); |
1091 | rx_bytes = stats->rx_bytes; | 1094 | rx_packets = rx_stats->packets; |
1092 | tx_bytes = stats->tx_bytes; | 1095 | rx_bytes = rx_stats->bytes; |
1093 | } while (u64_stats_fetch_retry_irq(&stats->syncp, start)); | 1096 | } while (u64_stats_fetch_retry_irq(&rx_stats->syncp, start)); |
1094 | 1097 | ||
1095 | tot->rx_packets += rx_packets; | 1098 | tot->rx_packets += rx_packets; |
1096 | tot->tx_packets += tx_packets; | 1099 | tot->tx_packets += tx_packets; |
@@ -1275,6 +1278,15 @@ static const struct net_device_ops xennet_netdev_ops = { | |||
1275 | #endif | 1278 | #endif |
1276 | }; | 1279 | }; |
1277 | 1280 | ||
1281 | static void xennet_free_netdev(struct net_device *netdev) | ||
1282 | { | ||
1283 | struct netfront_info *np = netdev_priv(netdev); | ||
1284 | |||
1285 | free_percpu(np->rx_stats); | ||
1286 | free_percpu(np->tx_stats); | ||
1287 | free_netdev(netdev); | ||
1288 | } | ||
1289 | |||
1278 | static struct net_device *xennet_create_dev(struct xenbus_device *dev) | 1290 | static struct net_device *xennet_create_dev(struct xenbus_device *dev) |
1279 | { | 1291 | { |
1280 | int err; | 1292 | int err; |
@@ -1295,8 +1307,11 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev) | |||
1295 | np->queues = NULL; | 1307 | np->queues = NULL; |
1296 | 1308 | ||
1297 | err = -ENOMEM; | 1309 | err = -ENOMEM; |
1298 | np->stats = netdev_alloc_pcpu_stats(struct netfront_stats); | 1310 | np->rx_stats = netdev_alloc_pcpu_stats(struct netfront_stats); |
1299 | if (np->stats == NULL) | 1311 | if (np->rx_stats == NULL) |
1312 | goto exit; | ||
1313 | np->tx_stats = netdev_alloc_pcpu_stats(struct netfront_stats); | ||
1314 | if (np->tx_stats == NULL) | ||
1300 | goto exit; | 1315 | goto exit; |
1301 | 1316 | ||
1302 | netdev->netdev_ops = &xennet_netdev_ops; | 1317 | netdev->netdev_ops = &xennet_netdev_ops; |
@@ -1327,7 +1342,7 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev) | |||
1327 | return netdev; | 1342 | return netdev; |
1328 | 1343 | ||
1329 | exit: | 1344 | exit: |
1330 | free_netdev(netdev); | 1345 | xennet_free_netdev(netdev); |
1331 | return ERR_PTR(err); | 1346 | return ERR_PTR(err); |
1332 | } | 1347 | } |
1333 | 1348 | ||
@@ -1369,7 +1384,7 @@ static int netfront_probe(struct xenbus_device *dev, | |||
1369 | return 0; | 1384 | return 0; |
1370 | 1385 | ||
1371 | fail: | 1386 | fail: |
1372 | free_netdev(netdev); | 1387 | xennet_free_netdev(netdev); |
1373 | dev_set_drvdata(&dev->dev, NULL); | 1388 | dev_set_drvdata(&dev->dev, NULL); |
1374 | return err; | 1389 | return err; |
1375 | } | 1390 | } |
@@ -2189,9 +2204,7 @@ static int xennet_remove(struct xenbus_device *dev) | |||
2189 | info->queues = NULL; | 2204 | info->queues = NULL; |
2190 | } | 2205 | } |
2191 | 2206 | ||
2192 | free_percpu(info->stats); | 2207 | xennet_free_netdev(info->netdev); |
2193 | |||
2194 | free_netdev(info->netdev); | ||
2195 | 2208 | ||
2196 | return 0; | 2209 | return 0; |
2197 | } | 2210 | } |
diff --git a/drivers/phy/phy-miphy28lp.c b/drivers/phy/phy-miphy28lp.c index e34da13885e8..27fa62ce6136 100644 --- a/drivers/phy/phy-miphy28lp.c +++ b/drivers/phy/phy-miphy28lp.c | |||
@@ -1050,7 +1050,8 @@ static int miphy28lp_init(struct phy *phy) | |||
1050 | ret = miphy28lp_init_usb3(miphy_phy); | 1050 | ret = miphy28lp_init_usb3(miphy_phy); |
1051 | break; | 1051 | break; |
1052 | default: | 1052 | default: |
1053 | return -EINVAL; | 1053 | ret = -EINVAL; |
1054 | break; | ||
1054 | } | 1055 | } |
1055 | 1056 | ||
1056 | mutex_unlock(&miphy_dev->miphy_mutex); | 1057 | mutex_unlock(&miphy_dev->miphy_mutex); |
diff --git a/drivers/phy/phy-omap-control.c b/drivers/phy/phy-omap-control.c index c96e8183a8ff..efe724f97e02 100644 --- a/drivers/phy/phy-omap-control.c +++ b/drivers/phy/phy-omap-control.c | |||
@@ -29,10 +29,9 @@ | |||
29 | /** | 29 | /** |
30 | * omap_control_pcie_pcs - set the PCS delay count | 30 | * omap_control_pcie_pcs - set the PCS delay count |
31 | * @dev: the control module device | 31 | * @dev: the control module device |
32 | * @id: index of the pcie PHY (should be 1 or 2) | ||
33 | * @delay: 8 bit delay value | 32 | * @delay: 8 bit delay value |
34 | */ | 33 | */ |
35 | void omap_control_pcie_pcs(struct device *dev, u8 id, u8 delay) | 34 | void omap_control_pcie_pcs(struct device *dev, u8 delay) |
36 | { | 35 | { |
37 | u32 val; | 36 | u32 val; |
38 | struct omap_control_phy *control_phy; | 37 | struct omap_control_phy *control_phy; |
@@ -55,8 +54,8 @@ void omap_control_pcie_pcs(struct device *dev, u8 id, u8 delay) | |||
55 | 54 | ||
56 | val = readl(control_phy->pcie_pcs); | 55 | val = readl(control_phy->pcie_pcs); |
57 | val &= ~(OMAP_CTRL_PCIE_PCS_MASK << | 56 | val &= ~(OMAP_CTRL_PCIE_PCS_MASK << |
58 | (id * OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT)); | 57 | OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT); |
59 | val |= delay << (id * OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT); | 58 | val |= (delay << OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT); |
60 | writel(val, control_phy->pcie_pcs); | 59 | writel(val, control_phy->pcie_pcs); |
61 | } | 60 | } |
62 | EXPORT_SYMBOL_GPL(omap_control_pcie_pcs); | 61 | EXPORT_SYMBOL_GPL(omap_control_pcie_pcs); |
diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c index fb02a67c9181..a2b08f3ccb03 100644 --- a/drivers/phy/phy-sun4i-usb.c +++ b/drivers/phy/phy-sun4i-usb.c | |||
@@ -244,7 +244,8 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) | |||
244 | else | 244 | else |
245 | data->num_phys = 3; | 245 | data->num_phys = 3; |
246 | 246 | ||
247 | if (of_device_is_compatible(np, "allwinner,sun4i-a10-usb-phy")) | 247 | if (of_device_is_compatible(np, "allwinner,sun4i-a10-usb-phy") || |
248 | of_device_is_compatible(np, "allwinner,sun6i-a31-usb-phy")) | ||
248 | data->disc_thresh = 3; | 249 | data->disc_thresh = 3; |
249 | else | 250 | else |
250 | data->disc_thresh = 2; | 251 | data->disc_thresh = 2; |
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c index 1387b4d4afe3..465de2c800f2 100644 --- a/drivers/phy/phy-ti-pipe3.c +++ b/drivers/phy/phy-ti-pipe3.c | |||
@@ -82,7 +82,6 @@ struct ti_pipe3 { | |||
82 | struct clk *refclk; | 82 | struct clk *refclk; |
83 | struct clk *div_clk; | 83 | struct clk *div_clk; |
84 | struct pipe3_dpll_map *dpll_map; | 84 | struct pipe3_dpll_map *dpll_map; |
85 | u8 id; | ||
86 | }; | 85 | }; |
87 | 86 | ||
88 | static struct pipe3_dpll_map dpll_map_usb[] = { | 87 | static struct pipe3_dpll_map dpll_map_usb[] = { |
@@ -217,8 +216,13 @@ static int ti_pipe3_init(struct phy *x) | |||
217 | u32 val; | 216 | u32 val; |
218 | int ret = 0; | 217 | int ret = 0; |
219 | 218 | ||
219 | /* | ||
220 | * Set pcie_pcs register to 0x96 for proper functioning of phy | ||
221 | * as recommended in AM572x TRM SPRUHZ6, section 18.5.2.2, table | ||
222 | * 18-1804. | ||
223 | */ | ||
220 | if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) { | 224 | if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-pcie")) { |
221 | omap_control_pcie_pcs(phy->control_dev, phy->id, 0xF1); | 225 | omap_control_pcie_pcs(phy->control_dev, 0x96); |
222 | return 0; | 226 | return 0; |
223 | } | 227 | } |
224 | 228 | ||
@@ -347,8 +351,6 @@ static int ti_pipe3_probe(struct platform_device *pdev) | |||
347 | } | 351 | } |
348 | 352 | ||
349 | if (of_device_is_compatible(node, "ti,phy-pipe3-pcie")) { | 353 | if (of_device_is_compatible(node, "ti,phy-pipe3-pcie")) { |
350 | if (of_property_read_u8(node, "id", &phy->id) < 0) | ||
351 | phy->id = 1; | ||
352 | 354 | ||
353 | clk = devm_clk_get(phy->dev, "dpll_ref"); | 355 | clk = devm_clk_get(phy->dev, "dpll_ref"); |
354 | if (IS_ERR(clk)) { | 356 | if (IS_ERR(clk)) { |
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index ba74f0aa60c7..3c22dbebc80f 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c | |||
@@ -89,6 +89,7 @@ struct rockchip_iomux { | |||
89 | * @reg_pull: optional separate register for additional pull settings | 89 | * @reg_pull: optional separate register for additional pull settings |
90 | * @clk: clock of the gpio bank | 90 | * @clk: clock of the gpio bank |
91 | * @irq: interrupt of the gpio bank | 91 | * @irq: interrupt of the gpio bank |
92 | * @saved_enables: Saved content of GPIO_INTEN at suspend time. | ||
92 | * @pin_base: first pin number | 93 | * @pin_base: first pin number |
93 | * @nr_pins: number of pins in this bank | 94 | * @nr_pins: number of pins in this bank |
94 | * @name: name of the bank | 95 | * @name: name of the bank |
@@ -107,6 +108,7 @@ struct rockchip_pin_bank { | |||
107 | struct regmap *regmap_pull; | 108 | struct regmap *regmap_pull; |
108 | struct clk *clk; | 109 | struct clk *clk; |
109 | int irq; | 110 | int irq; |
111 | u32 saved_enables; | ||
110 | u32 pin_base; | 112 | u32 pin_base; |
111 | u8 nr_pins; | 113 | u8 nr_pins; |
112 | char *name; | 114 | char *name; |
@@ -1543,6 +1545,51 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type) | |||
1543 | return 0; | 1545 | return 0; |
1544 | } | 1546 | } |
1545 | 1547 | ||
1548 | static void rockchip_irq_suspend(struct irq_data *d) | ||
1549 | { | ||
1550 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | ||
1551 | struct rockchip_pin_bank *bank = gc->private; | ||
1552 | |||
1553 | bank->saved_enables = irq_reg_readl(gc, GPIO_INTEN); | ||
1554 | irq_reg_writel(gc, gc->wake_active, GPIO_INTEN); | ||
1555 | } | ||
1556 | |||
1557 | static void rockchip_irq_resume(struct irq_data *d) | ||
1558 | { | ||
1559 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | ||
1560 | struct rockchip_pin_bank *bank = gc->private; | ||
1561 | |||
1562 | irq_reg_writel(gc, bank->saved_enables, GPIO_INTEN); | ||
1563 | } | ||
1564 | |||
1565 | static void rockchip_irq_disable(struct irq_data *d) | ||
1566 | { | ||
1567 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | ||
1568 | u32 val; | ||
1569 | |||
1570 | irq_gc_lock(gc); | ||
1571 | |||
1572 | val = irq_reg_readl(gc, GPIO_INTEN); | ||
1573 | val &= ~d->mask; | ||
1574 | irq_reg_writel(gc, val, GPIO_INTEN); | ||
1575 | |||
1576 | irq_gc_unlock(gc); | ||
1577 | } | ||
1578 | |||
1579 | static void rockchip_irq_enable(struct irq_data *d) | ||
1580 | { | ||
1581 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | ||
1582 | u32 val; | ||
1583 | |||
1584 | irq_gc_lock(gc); | ||
1585 | |||
1586 | val = irq_reg_readl(gc, GPIO_INTEN); | ||
1587 | val |= d->mask; | ||
1588 | irq_reg_writel(gc, val, GPIO_INTEN); | ||
1589 | |||
1590 | irq_gc_unlock(gc); | ||
1591 | } | ||
1592 | |||
1546 | static int rockchip_interrupts_register(struct platform_device *pdev, | 1593 | static int rockchip_interrupts_register(struct platform_device *pdev, |
1547 | struct rockchip_pinctrl *info) | 1594 | struct rockchip_pinctrl *info) |
1548 | { | 1595 | { |
@@ -1581,12 +1628,16 @@ static int rockchip_interrupts_register(struct platform_device *pdev, | |||
1581 | gc = irq_get_domain_generic_chip(bank->domain, 0); | 1628 | gc = irq_get_domain_generic_chip(bank->domain, 0); |
1582 | gc->reg_base = bank->reg_base; | 1629 | gc->reg_base = bank->reg_base; |
1583 | gc->private = bank; | 1630 | gc->private = bank; |
1584 | gc->chip_types[0].regs.mask = GPIO_INTEN; | 1631 | gc->chip_types[0].regs.mask = GPIO_INTMASK; |
1585 | gc->chip_types[0].regs.ack = GPIO_PORTS_EOI; | 1632 | gc->chip_types[0].regs.ack = GPIO_PORTS_EOI; |
1586 | gc->chip_types[0].chip.irq_ack = irq_gc_ack_set_bit; | 1633 | gc->chip_types[0].chip.irq_ack = irq_gc_ack_set_bit; |
1587 | gc->chip_types[0].chip.irq_mask = irq_gc_mask_clr_bit; | 1634 | gc->chip_types[0].chip.irq_mask = irq_gc_mask_set_bit; |
1588 | gc->chip_types[0].chip.irq_unmask = irq_gc_mask_set_bit; | 1635 | gc->chip_types[0].chip.irq_unmask = irq_gc_mask_clr_bit; |
1636 | gc->chip_types[0].chip.irq_enable = rockchip_irq_enable; | ||
1637 | gc->chip_types[0].chip.irq_disable = rockchip_irq_disable; | ||
1589 | gc->chip_types[0].chip.irq_set_wake = irq_gc_set_wake; | 1638 | gc->chip_types[0].chip.irq_set_wake = irq_gc_set_wake; |
1639 | gc->chip_types[0].chip.irq_suspend = rockchip_irq_suspend; | ||
1640 | gc->chip_types[0].chip.irq_resume = rockchip_irq_resume; | ||
1590 | gc->chip_types[0].chip.irq_set_type = rockchip_irq_set_type; | 1641 | gc->chip_types[0].chip.irq_set_type = rockchip_irq_set_type; |
1591 | gc->wake_enabled = IRQ_MSK(bank->nr_pins); | 1642 | gc->wake_enabled = IRQ_MSK(bank->nr_pins); |
1592 | 1643 | ||
diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c index 7c9d51382248..9e5ec00084bb 100644 --- a/drivers/pinctrl/pinctrl-st.c +++ b/drivers/pinctrl/pinctrl-st.c | |||
@@ -1012,8 +1012,10 @@ static void st_pinconf_dbg_show(struct pinctrl_dev *pctldev, | |||
1012 | struct seq_file *s, unsigned pin_id) | 1012 | struct seq_file *s, unsigned pin_id) |
1013 | { | 1013 | { |
1014 | unsigned long config; | 1014 | unsigned long config; |
1015 | st_pinconf_get(pctldev, pin_id, &config); | ||
1016 | 1015 | ||
1016 | mutex_unlock(&pctldev->mutex); | ||
1017 | st_pinconf_get(pctldev, pin_id, &config); | ||
1018 | mutex_lock(&pctldev->mutex); | ||
1017 | seq_printf(s, "[OE:%ld,PU:%ld,OD:%ld]\n" | 1019 | seq_printf(s, "[OE:%ld,PU:%ld,OD:%ld]\n" |
1018 | "\t\t[retime:%ld,invclk:%ld,clknotdat:%ld," | 1020 | "\t\t[retime:%ld,invclk:%ld,clknotdat:%ld," |
1019 | "de:%ld,rt-clk:%ld,rt-delay:%ld]", | 1021 | "de:%ld,rt-clk:%ld,rt-delay:%ld]", |
@@ -1443,6 +1445,7 @@ static struct gpio_chip st_gpio_template = { | |||
1443 | 1445 | ||
1444 | static struct irq_chip st_gpio_irqchip = { | 1446 | static struct irq_chip st_gpio_irqchip = { |
1445 | .name = "GPIO", | 1447 | .name = "GPIO", |
1448 | .irq_disable = st_gpio_irq_mask, | ||
1446 | .irq_mask = st_gpio_irq_mask, | 1449 | .irq_mask = st_gpio_irq_mask, |
1447 | .irq_unmask = st_gpio_irq_unmask, | 1450 | .irq_unmask = st_gpio_irq_unmask, |
1448 | .irq_set_type = st_gpio_irq_set_type, | 1451 | .irq_set_type = st_gpio_irq_set_type, |
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index 91e97ec01418..4d41bf75c233 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c | |||
@@ -1163,9 +1163,13 @@ static inline int ap_test_config_card_id(unsigned int id) | |||
1163 | */ | 1163 | */ |
1164 | static inline int ap_test_config_domain(unsigned int domain) | 1164 | static inline int ap_test_config_domain(unsigned int domain) |
1165 | { | 1165 | { |
1166 | if (!ap_configuration) | 1166 | if (!ap_configuration) /* QCI not supported */ |
1167 | return 1; | 1167 | if (domain < 16) |
1168 | return ap_test_config(ap_configuration->aqm, domain); | 1168 | return 1; /* then domains 0...15 are configured */ |
1169 | else | ||
1170 | return 0; | ||
1171 | else | ||
1172 | return ap_test_config(ap_configuration->aqm, domain); | ||
1169 | } | 1173 | } |
1170 | 1174 | ||
1171 | /** | 1175 | /** |
diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c index 86c72ba0a0cd..f8c5fc371c4c 100644 --- a/drivers/staging/vt6655/baseband.c +++ b/drivers/staging/vt6655/baseband.c | |||
@@ -2177,7 +2177,7 @@ bool BBbVT3253Init(struct vnt_private *priv) | |||
2177 | /* Init ANT B select,RX Config CR10 = 0x28->0x2A, 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted) */ | 2177 | /* Init ANT B select,RX Config CR10 = 0x28->0x2A, 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted) */ |
2178 | /*bResult &= BBbWriteEmbedded(dwIoBase,0x0a,0x28);*/ | 2178 | /*bResult &= BBbWriteEmbedded(dwIoBase,0x0a,0x28);*/ |
2179 | /* Select VC1/VC2, CR215 = 0x02->0x06 */ | 2179 | /* Select VC1/VC2, CR215 = 0x02->0x06 */ |
2180 | bResult &= BBbWriteEmbedded(dwIoBase, 0xd7, 0x06); | 2180 | bResult &= BBbWriteEmbedded(priv, 0xd7, 0x06); |
2181 | /* }} */ | 2181 | /* }} */ |
2182 | 2182 | ||
2183 | for (ii = 0; ii < CB_VT3253B0_AGC; ii++) | 2183 | for (ii = 0; ii < CB_VT3253B0_AGC; ii++) |
diff --git a/drivers/staging/vt6655/channel.c b/drivers/staging/vt6655/channel.c index c8f739dd346e..70f870541f92 100644 --- a/drivers/staging/vt6655/channel.c +++ b/drivers/staging/vt6655/channel.c | |||
@@ -182,6 +182,14 @@ bool set_channel(void *pDeviceHandler, unsigned int uConnectionChannel) | |||
182 | if (pDevice->byCurrentCh == uConnectionChannel) | 182 | if (pDevice->byCurrentCh == uConnectionChannel) |
183 | return bResult; | 183 | return bResult; |
184 | 184 | ||
185 | /* Set VGA to max sensitivity */ | ||
186 | if (pDevice->bUpdateBBVGA && | ||
187 | pDevice->byBBVGACurrent != pDevice->abyBBVGA[0]) { | ||
188 | pDevice->byBBVGACurrent = pDevice->abyBBVGA[0]; | ||
189 | |||
190 | BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent); | ||
191 | } | ||
192 | |||
185 | /* clear NAV */ | 193 | /* clear NAV */ |
186 | MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MACCR, MACCR_CLRNAV); | 194 | MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MACCR, MACCR_CLRNAV); |
187 | 195 | ||
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 83e4162c0094..cd1a277d853b 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c | |||
@@ -1232,7 +1232,7 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) | |||
1232 | 1232 | ||
1233 | head_td = priv->apCurrTD[dma_idx]; | 1233 | head_td = priv->apCurrTD[dma_idx]; |
1234 | 1234 | ||
1235 | head_td->m_td1TD1.byTCR = (TCR_EDP|TCR_STP); | 1235 | head_td->m_td1TD1.byTCR = 0; |
1236 | 1236 | ||
1237 | head_td->pTDInfo->skb = skb; | 1237 | head_td->pTDInfo->skb = skb; |
1238 | 1238 | ||
@@ -1257,6 +1257,11 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) | |||
1257 | 1257 | ||
1258 | priv->bPWBitOn = false; | 1258 | priv->bPWBitOn = false; |
1259 | 1259 | ||
1260 | /* Set TSR1 & ReqCount in TxDescHead */ | ||
1261 | head_td->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP | EDMSDU); | ||
1262 | head_td->m_td1TD1.wReqCount = | ||
1263 | cpu_to_le16((u16)head_td->pTDInfo->dwReqCount); | ||
1264 | |||
1260 | head_td->pTDInfo->byFlags = TD_FLAGS_NETIF_SKB; | 1265 | head_td->pTDInfo->byFlags = TD_FLAGS_NETIF_SKB; |
1261 | 1266 | ||
1262 | if (dma_idx == TYPE_AC0DMA) | 1267 | if (dma_idx == TYPE_AC0DMA) |
@@ -1500,9 +1505,11 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, | |||
1500 | if (conf->enable_beacon) { | 1505 | if (conf->enable_beacon) { |
1501 | vnt_beacon_enable(priv, vif, conf); | 1506 | vnt_beacon_enable(priv, vif, conf); |
1502 | 1507 | ||
1503 | MACvRegBitsOn(priv, MAC_REG_TCR, TCR_AUTOBCNTX); | 1508 | MACvRegBitsOn(priv->PortOffset, MAC_REG_TCR, |
1509 | TCR_AUTOBCNTX); | ||
1504 | } else { | 1510 | } else { |
1505 | MACvRegBitsOff(priv, MAC_REG_TCR, TCR_AUTOBCNTX); | 1511 | MACvRegBitsOff(priv->PortOffset, MAC_REG_TCR, |
1512 | TCR_AUTOBCNTX); | ||
1506 | } | 1513 | } |
1507 | } | 1514 | } |
1508 | 1515 | ||
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index 61c39dd7ad01..b5b0155961f2 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c | |||
@@ -1204,13 +1204,10 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, | |||
1204 | 1204 | ||
1205 | ptdCurr = (PSTxDesc)pHeadTD; | 1205 | ptdCurr = (PSTxDesc)pHeadTD; |
1206 | 1206 | ||
1207 | ptdCurr->pTDInfo->dwReqCount = cbReqCount - uPadding; | 1207 | ptdCurr->pTDInfo->dwReqCount = cbReqCount; |
1208 | ptdCurr->pTDInfo->dwHeaderLength = cbHeaderLength; | 1208 | ptdCurr->pTDInfo->dwHeaderLength = cbHeaderLength; |
1209 | ptdCurr->pTDInfo->skb_dma = ptdCurr->pTDInfo->buf_dma; | 1209 | ptdCurr->pTDInfo->skb_dma = ptdCurr->pTDInfo->buf_dma; |
1210 | ptdCurr->buff_addr = cpu_to_le32(ptdCurr->pTDInfo->skb_dma); | 1210 | ptdCurr->buff_addr = cpu_to_le32(ptdCurr->pTDInfo->skb_dma); |
1211 | /* Set TSR1 & ReqCount in TxDescHead */ | ||
1212 | ptdCurr->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP | EDMSDU); | ||
1213 | ptdCurr->m_td1TD1.wReqCount = cpu_to_le16((unsigned short)(cbReqCount)); | ||
1214 | 1211 | ||
1215 | return cbHeaderLength; | 1212 | return cbHeaderLength; |
1216 | } | 1213 | } |
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 55f6774f706f..aebde3289c50 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -2027,10 +2027,10 @@ iscsit_process_text_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, | |||
2027 | goto reject; | 2027 | goto reject; |
2028 | } | 2028 | } |
2029 | if (!strncmp("=All", text_ptr, 4)) { | 2029 | if (!strncmp("=All", text_ptr, 4)) { |
2030 | cmd->cmd_flags |= IFC_SENDTARGETS_ALL; | 2030 | cmd->cmd_flags |= ICF_SENDTARGETS_ALL; |
2031 | } else if (!strncmp("=iqn.", text_ptr, 5) || | 2031 | } else if (!strncmp("=iqn.", text_ptr, 5) || |
2032 | !strncmp("=eui.", text_ptr, 5)) { | 2032 | !strncmp("=eui.", text_ptr, 5)) { |
2033 | cmd->cmd_flags |= IFC_SENDTARGETS_SINGLE; | 2033 | cmd->cmd_flags |= ICF_SENDTARGETS_SINGLE; |
2034 | } else { | 2034 | } else { |
2035 | pr_err("Unable to locate valid SendTargets=%s value\n", text_ptr); | 2035 | pr_err("Unable to locate valid SendTargets=%s value\n", text_ptr); |
2036 | goto reject; | 2036 | goto reject; |
@@ -3415,10 +3415,10 @@ iscsit_build_sendtargets_response(struct iscsi_cmd *cmd, | |||
3415 | return -ENOMEM; | 3415 | return -ENOMEM; |
3416 | } | 3416 | } |
3417 | /* | 3417 | /* |
3418 | * Locate pointer to iqn./eui. string for IFC_SENDTARGETS_SINGLE | 3418 | * Locate pointer to iqn./eui. string for ICF_SENDTARGETS_SINGLE |
3419 | * explicit case.. | 3419 | * explicit case.. |
3420 | */ | 3420 | */ |
3421 | if (cmd->cmd_flags & IFC_SENDTARGETS_SINGLE) { | 3421 | if (cmd->cmd_flags & ICF_SENDTARGETS_SINGLE) { |
3422 | text_ptr = strchr(text_in, '='); | 3422 | text_ptr = strchr(text_in, '='); |
3423 | if (!text_ptr) { | 3423 | if (!text_ptr) { |
3424 | pr_err("Unable to locate '=' string in text_in:" | 3424 | pr_err("Unable to locate '=' string in text_in:" |
@@ -3434,7 +3434,7 @@ iscsit_build_sendtargets_response(struct iscsi_cmd *cmd, | |||
3434 | 3434 | ||
3435 | spin_lock(&tiqn_lock); | 3435 | spin_lock(&tiqn_lock); |
3436 | list_for_each_entry(tiqn, &g_tiqn_list, tiqn_list) { | 3436 | list_for_each_entry(tiqn, &g_tiqn_list, tiqn_list) { |
3437 | if ((cmd->cmd_flags & IFC_SENDTARGETS_SINGLE) && | 3437 | if ((cmd->cmd_flags & ICF_SENDTARGETS_SINGLE) && |
3438 | strcmp(tiqn->tiqn, text_ptr)) { | 3438 | strcmp(tiqn->tiqn, text_ptr)) { |
3439 | continue; | 3439 | continue; |
3440 | } | 3440 | } |
@@ -3512,7 +3512,7 @@ eob: | |||
3512 | if (end_of_buf) | 3512 | if (end_of_buf) |
3513 | break; | 3513 | break; |
3514 | 3514 | ||
3515 | if (cmd->cmd_flags & IFC_SENDTARGETS_SINGLE) | 3515 | if (cmd->cmd_flags & ICF_SENDTARGETS_SINGLE) |
3516 | break; | 3516 | break; |
3517 | } | 3517 | } |
3518 | spin_unlock(&tiqn_lock); | 3518 | spin_unlock(&tiqn_lock); |
diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h index 09a522bae222..cbcff38ac9b7 100644 --- a/drivers/target/iscsi/iscsi_target_core.h +++ b/drivers/target/iscsi/iscsi_target_core.h | |||
@@ -135,8 +135,8 @@ enum cmd_flags_table { | |||
135 | ICF_CONTIG_MEMORY = 0x00000020, | 135 | ICF_CONTIG_MEMORY = 0x00000020, |
136 | ICF_ATTACHED_TO_RQUEUE = 0x00000040, | 136 | ICF_ATTACHED_TO_RQUEUE = 0x00000040, |
137 | ICF_OOO_CMDSN = 0x00000080, | 137 | ICF_OOO_CMDSN = 0x00000080, |
138 | IFC_SENDTARGETS_ALL = 0x00000100, | 138 | ICF_SENDTARGETS_ALL = 0x00000100, |
139 | IFC_SENDTARGETS_SINGLE = 0x00000200, | 139 | ICF_SENDTARGETS_SINGLE = 0x00000200, |
140 | }; | 140 | }; |
141 | 141 | ||
142 | /* struct iscsi_cmd->i_state */ | 142 | /* struct iscsi_cmd->i_state */ |
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 7653cfb027a2..58f49ff69b14 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
@@ -1103,51 +1103,6 @@ int se_dev_set_queue_depth(struct se_device *dev, u32 queue_depth) | |||
1103 | } | 1103 | } |
1104 | EXPORT_SYMBOL(se_dev_set_queue_depth); | 1104 | EXPORT_SYMBOL(se_dev_set_queue_depth); |
1105 | 1105 | ||
1106 | int se_dev_set_fabric_max_sectors(struct se_device *dev, u32 fabric_max_sectors) | ||
1107 | { | ||
1108 | int block_size = dev->dev_attrib.block_size; | ||
1109 | |||
1110 | if (dev->export_count) { | ||
1111 | pr_err("dev[%p]: Unable to change SE Device" | ||
1112 | " fabric_max_sectors while export_count is %d\n", | ||
1113 | dev, dev->export_count); | ||
1114 | return -EINVAL; | ||
1115 | } | ||
1116 | if (!fabric_max_sectors) { | ||
1117 | pr_err("dev[%p]: Illegal ZERO value for" | ||
1118 | " fabric_max_sectors\n", dev); | ||
1119 | return -EINVAL; | ||
1120 | } | ||
1121 | if (fabric_max_sectors < DA_STATUS_MAX_SECTORS_MIN) { | ||
1122 | pr_err("dev[%p]: Passed fabric_max_sectors: %u less than" | ||
1123 | " DA_STATUS_MAX_SECTORS_MIN: %u\n", dev, fabric_max_sectors, | ||
1124 | DA_STATUS_MAX_SECTORS_MIN); | ||
1125 | return -EINVAL; | ||
1126 | } | ||
1127 | if (fabric_max_sectors > DA_STATUS_MAX_SECTORS_MAX) { | ||
1128 | pr_err("dev[%p]: Passed fabric_max_sectors: %u" | ||
1129 | " greater than DA_STATUS_MAX_SECTORS_MAX:" | ||
1130 | " %u\n", dev, fabric_max_sectors, | ||
1131 | DA_STATUS_MAX_SECTORS_MAX); | ||
1132 | return -EINVAL; | ||
1133 | } | ||
1134 | /* | ||
1135 | * Align max_sectors down to PAGE_SIZE to follow transport_allocate_data_tasks() | ||
1136 | */ | ||
1137 | if (!block_size) { | ||
1138 | block_size = 512; | ||
1139 | pr_warn("Defaulting to 512 for zero block_size\n"); | ||
1140 | } | ||
1141 | fabric_max_sectors = se_dev_align_max_sectors(fabric_max_sectors, | ||
1142 | block_size); | ||
1143 | |||
1144 | dev->dev_attrib.fabric_max_sectors = fabric_max_sectors; | ||
1145 | pr_debug("dev[%p]: SE Device max_sectors changed to %u\n", | ||
1146 | dev, fabric_max_sectors); | ||
1147 | return 0; | ||
1148 | } | ||
1149 | EXPORT_SYMBOL(se_dev_set_fabric_max_sectors); | ||
1150 | |||
1151 | int se_dev_set_optimal_sectors(struct se_device *dev, u32 optimal_sectors) | 1106 | int se_dev_set_optimal_sectors(struct se_device *dev, u32 optimal_sectors) |
1152 | { | 1107 | { |
1153 | if (dev->export_count) { | 1108 | if (dev->export_count) { |
@@ -1156,10 +1111,10 @@ int se_dev_set_optimal_sectors(struct se_device *dev, u32 optimal_sectors) | |||
1156 | dev, dev->export_count); | 1111 | dev, dev->export_count); |
1157 | return -EINVAL; | 1112 | return -EINVAL; |
1158 | } | 1113 | } |
1159 | if (optimal_sectors > dev->dev_attrib.fabric_max_sectors) { | 1114 | if (optimal_sectors > dev->dev_attrib.hw_max_sectors) { |
1160 | pr_err("dev[%p]: Passed optimal_sectors %u cannot be" | 1115 | pr_err("dev[%p]: Passed optimal_sectors %u cannot be" |
1161 | " greater than fabric_max_sectors: %u\n", dev, | 1116 | " greater than hw_max_sectors: %u\n", dev, |
1162 | optimal_sectors, dev->dev_attrib.fabric_max_sectors); | 1117 | optimal_sectors, dev->dev_attrib.hw_max_sectors); |
1163 | return -EINVAL; | 1118 | return -EINVAL; |
1164 | } | 1119 | } |
1165 | 1120 | ||
@@ -1553,8 +1508,6 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name) | |||
1553 | dev->dev_attrib.unmap_granularity_alignment = | 1508 | dev->dev_attrib.unmap_granularity_alignment = |
1554 | DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT; | 1509 | DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT; |
1555 | dev->dev_attrib.max_write_same_len = DA_MAX_WRITE_SAME_LEN; | 1510 | dev->dev_attrib.max_write_same_len = DA_MAX_WRITE_SAME_LEN; |
1556 | dev->dev_attrib.fabric_max_sectors = DA_FABRIC_MAX_SECTORS; | ||
1557 | dev->dev_attrib.optimal_sectors = DA_FABRIC_MAX_SECTORS; | ||
1558 | 1511 | ||
1559 | xcopy_lun = &dev->xcopy_lun; | 1512 | xcopy_lun = &dev->xcopy_lun; |
1560 | xcopy_lun->lun_se_dev = dev; | 1513 | xcopy_lun->lun_se_dev = dev; |
@@ -1595,6 +1548,7 @@ int target_configure_device(struct se_device *dev) | |||
1595 | dev->dev_attrib.hw_max_sectors = | 1548 | dev->dev_attrib.hw_max_sectors = |
1596 | se_dev_align_max_sectors(dev->dev_attrib.hw_max_sectors, | 1549 | se_dev_align_max_sectors(dev->dev_attrib.hw_max_sectors, |
1597 | dev->dev_attrib.hw_block_size); | 1550 | dev->dev_attrib.hw_block_size); |
1551 | dev->dev_attrib.optimal_sectors = dev->dev_attrib.hw_max_sectors; | ||
1598 | 1552 | ||
1599 | dev->dev_index = scsi_get_new_index(SCSI_DEVICE_INDEX); | 1553 | dev->dev_index = scsi_get_new_index(SCSI_DEVICE_INDEX); |
1600 | dev->creation_time = get_jiffies_64(); | 1554 | dev->creation_time = get_jiffies_64(); |
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index c2aea099ea4a..d836de200a03 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c | |||
@@ -621,7 +621,16 @@ fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, | |||
621 | struct fd_prot fd_prot; | 621 | struct fd_prot fd_prot; |
622 | sense_reason_t rc; | 622 | sense_reason_t rc; |
623 | int ret = 0; | 623 | int ret = 0; |
624 | 624 | /* | |
625 | * We are currently limited by the number of iovecs (2048) per | ||
626 | * single vfs_[writev,readv] call. | ||
627 | */ | ||
628 | if (cmd->data_length > FD_MAX_BYTES) { | ||
629 | pr_err("FILEIO: Not able to process I/O of %u bytes due to" | ||
630 | "FD_MAX_BYTES: %u iovec count limitiation\n", | ||
631 | cmd->data_length, FD_MAX_BYTES); | ||
632 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
633 | } | ||
625 | /* | 634 | /* |
626 | * Call vectorized fileio functions to map struct scatterlist | 635 | * Call vectorized fileio functions to map struct scatterlist |
627 | * physical memory addresses to struct iovec virtual memory. | 636 | * physical memory addresses to struct iovec virtual memory. |
@@ -959,7 +968,6 @@ static struct configfs_attribute *fileio_backend_dev_attrs[] = { | |||
959 | &fileio_dev_attrib_hw_block_size.attr, | 968 | &fileio_dev_attrib_hw_block_size.attr, |
960 | &fileio_dev_attrib_block_size.attr, | 969 | &fileio_dev_attrib_block_size.attr, |
961 | &fileio_dev_attrib_hw_max_sectors.attr, | 970 | &fileio_dev_attrib_hw_max_sectors.attr, |
962 | &fileio_dev_attrib_fabric_max_sectors.attr, | ||
963 | &fileio_dev_attrib_optimal_sectors.attr, | 971 | &fileio_dev_attrib_optimal_sectors.attr, |
964 | &fileio_dev_attrib_hw_queue_depth.attr, | 972 | &fileio_dev_attrib_hw_queue_depth.attr, |
965 | &fileio_dev_attrib_queue_depth.attr, | 973 | &fileio_dev_attrib_queue_depth.attr, |
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 3efff94fbd97..78346b850968 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c | |||
@@ -124,7 +124,7 @@ static int iblock_configure_device(struct se_device *dev) | |||
124 | q = bdev_get_queue(bd); | 124 | q = bdev_get_queue(bd); |
125 | 125 | ||
126 | dev->dev_attrib.hw_block_size = bdev_logical_block_size(bd); | 126 | dev->dev_attrib.hw_block_size = bdev_logical_block_size(bd); |
127 | dev->dev_attrib.hw_max_sectors = UINT_MAX; | 127 | dev->dev_attrib.hw_max_sectors = queue_max_hw_sectors(q); |
128 | dev->dev_attrib.hw_queue_depth = q->nr_requests; | 128 | dev->dev_attrib.hw_queue_depth = q->nr_requests; |
129 | 129 | ||
130 | /* | 130 | /* |
@@ -883,7 +883,6 @@ static struct configfs_attribute *iblock_backend_dev_attrs[] = { | |||
883 | &iblock_dev_attrib_hw_block_size.attr, | 883 | &iblock_dev_attrib_hw_block_size.attr, |
884 | &iblock_dev_attrib_block_size.attr, | 884 | &iblock_dev_attrib_block_size.attr, |
885 | &iblock_dev_attrib_hw_max_sectors.attr, | 885 | &iblock_dev_attrib_hw_max_sectors.attr, |
886 | &iblock_dev_attrib_fabric_max_sectors.attr, | ||
887 | &iblock_dev_attrib_optimal_sectors.attr, | 886 | &iblock_dev_attrib_optimal_sectors.attr, |
888 | &iblock_dev_attrib_hw_queue_depth.attr, | 887 | &iblock_dev_attrib_hw_queue_depth.attr, |
889 | &iblock_dev_attrib_queue_depth.attr, | 888 | &iblock_dev_attrib_queue_depth.attr, |
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index d56f2aaba9af..283cf786ef98 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c | |||
@@ -528,6 +528,18 @@ static int core_scsi3_pr_seq_non_holder( | |||
528 | 528 | ||
529 | return 0; | 529 | return 0; |
530 | } | 530 | } |
531 | } else if (we && registered_nexus) { | ||
532 | /* | ||
533 | * Reads are allowed for Write Exclusive locks | ||
534 | * from all registrants. | ||
535 | */ | ||
536 | if (cmd->data_direction == DMA_FROM_DEVICE) { | ||
537 | pr_debug("Allowing READ CDB: 0x%02x for %s" | ||
538 | " reservation\n", cdb[0], | ||
539 | core_scsi3_pr_dump_type(pr_reg_type)); | ||
540 | |||
541 | return 0; | ||
542 | } | ||
531 | } | 543 | } |
532 | pr_debug("%s Conflict for %sregistered nexus %s CDB: 0x%2x" | 544 | pr_debug("%s Conflict for %sregistered nexus %s CDB: 0x%2x" |
533 | " for %s reservation\n", transport_dump_cmd_direction(cmd), | 545 | " for %s reservation\n", transport_dump_cmd_direction(cmd), |
diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c index 60ebd170a561..98e83ac5661b 100644 --- a/drivers/target/target_core_rd.c +++ b/drivers/target/target_core_rd.c | |||
@@ -657,7 +657,6 @@ static struct configfs_attribute *rd_mcp_backend_dev_attrs[] = { | |||
657 | &rd_mcp_dev_attrib_hw_block_size.attr, | 657 | &rd_mcp_dev_attrib_hw_block_size.attr, |
658 | &rd_mcp_dev_attrib_block_size.attr, | 658 | &rd_mcp_dev_attrib_block_size.attr, |
659 | &rd_mcp_dev_attrib_hw_max_sectors.attr, | 659 | &rd_mcp_dev_attrib_hw_max_sectors.attr, |
660 | &rd_mcp_dev_attrib_fabric_max_sectors.attr, | ||
661 | &rd_mcp_dev_attrib_optimal_sectors.attr, | 660 | &rd_mcp_dev_attrib_optimal_sectors.attr, |
662 | &rd_mcp_dev_attrib_hw_queue_depth.attr, | 661 | &rd_mcp_dev_attrib_hw_queue_depth.attr, |
663 | &rd_mcp_dev_attrib_queue_depth.attr, | 662 | &rd_mcp_dev_attrib_queue_depth.attr, |
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 11bea1952435..cd4bed7b2757 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
@@ -953,21 +953,6 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) | |||
953 | 953 | ||
954 | if (cmd->se_cmd_flags & SCF_SCSI_DATA_CDB) { | 954 | if (cmd->se_cmd_flags & SCF_SCSI_DATA_CDB) { |
955 | unsigned long long end_lba; | 955 | unsigned long long end_lba; |
956 | |||
957 | if (sectors > dev->dev_attrib.fabric_max_sectors) { | ||
958 | printk_ratelimited(KERN_ERR "SCSI OP %02xh with too" | ||
959 | " big sectors %u exceeds fabric_max_sectors:" | ||
960 | " %u\n", cdb[0], sectors, | ||
961 | dev->dev_attrib.fabric_max_sectors); | ||
962 | return TCM_INVALID_CDB_FIELD; | ||
963 | } | ||
964 | if (sectors > dev->dev_attrib.hw_max_sectors) { | ||
965 | printk_ratelimited(KERN_ERR "SCSI OP %02xh with too" | ||
966 | " big sectors %u exceeds backend hw_max_sectors:" | ||
967 | " %u\n", cdb[0], sectors, | ||
968 | dev->dev_attrib.hw_max_sectors); | ||
969 | return TCM_INVALID_CDB_FIELD; | ||
970 | } | ||
971 | check_lba: | 956 | check_lba: |
972 | end_lba = dev->transport->get_blocks(dev) + 1; | 957 | end_lba = dev->transport->get_blocks(dev) + 1; |
973 | if (cmd->t_task_lba + sectors > end_lba) { | 958 | if (cmd->t_task_lba + sectors > end_lba) { |
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 1307600fe726..4c71657da56a 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c | |||
@@ -505,7 +505,6 @@ static sense_reason_t | |||
505 | spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf) | 505 | spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf) |
506 | { | 506 | { |
507 | struct se_device *dev = cmd->se_dev; | 507 | struct se_device *dev = cmd->se_dev; |
508 | u32 max_sectors; | ||
509 | int have_tp = 0; | 508 | int have_tp = 0; |
510 | int opt, min; | 509 | int opt, min; |
511 | 510 | ||
@@ -539,9 +538,7 @@ spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf) | |||
539 | /* | 538 | /* |
540 | * Set MAXIMUM TRANSFER LENGTH | 539 | * Set MAXIMUM TRANSFER LENGTH |
541 | */ | 540 | */ |
542 | max_sectors = min(dev->dev_attrib.fabric_max_sectors, | 541 | put_unaligned_be32(dev->dev_attrib.hw_max_sectors, &buf[8]); |
543 | dev->dev_attrib.hw_max_sectors); | ||
544 | put_unaligned_be32(max_sectors, &buf[8]); | ||
545 | 542 | ||
546 | /* | 543 | /* |
547 | * Set OPTIMAL TRANSFER LENGTH | 544 | * Set OPTIMAL TRANSFER LENGTH |
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index 8bfa61c9693d..1157b559683b 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c | |||
@@ -1118,7 +1118,6 @@ static struct configfs_attribute *tcmu_backend_dev_attrs[] = { | |||
1118 | &tcmu_dev_attrib_hw_block_size.attr, | 1118 | &tcmu_dev_attrib_hw_block_size.attr, |
1119 | &tcmu_dev_attrib_block_size.attr, | 1119 | &tcmu_dev_attrib_block_size.attr, |
1120 | &tcmu_dev_attrib_hw_max_sectors.attr, | 1120 | &tcmu_dev_attrib_hw_max_sectors.attr, |
1121 | &tcmu_dev_attrib_fabric_max_sectors.attr, | ||
1122 | &tcmu_dev_attrib_optimal_sectors.attr, | 1121 | &tcmu_dev_attrib_optimal_sectors.attr, |
1123 | &tcmu_dev_attrib_hw_queue_depth.attr, | 1122 | &tcmu_dev_attrib_hw_queue_depth.attr, |
1124 | &tcmu_dev_attrib_queue_depth.attr, | 1123 | &tcmu_dev_attrib_queue_depth.attr, |
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index c1188ac053c9..2ccbc0788353 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c | |||
@@ -608,6 +608,7 @@ static int imx_thermal_suspend(struct device *dev) | |||
608 | regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_MEASURE_TEMP); | 608 | regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_MEASURE_TEMP); |
609 | regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_POWER_DOWN); | 609 | regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_POWER_DOWN); |
610 | data->mode = THERMAL_DEVICE_DISABLED; | 610 | data->mode = THERMAL_DEVICE_DISABLED; |
611 | clk_disable_unprepare(data->thermal_clk); | ||
611 | 612 | ||
612 | return 0; | 613 | return 0; |
613 | } | 614 | } |
@@ -617,6 +618,7 @@ static int imx_thermal_resume(struct device *dev) | |||
617 | struct imx_thermal_data *data = dev_get_drvdata(dev); | 618 | struct imx_thermal_data *data = dev_get_drvdata(dev); |
618 | struct regmap *map = data->tempmon; | 619 | struct regmap *map = data->tempmon; |
619 | 620 | ||
621 | clk_prepare_enable(data->thermal_clk); | ||
620 | /* Enabled thermal sensor after resume */ | 622 | /* Enabled thermal sensor after resume */ |
621 | regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_POWER_DOWN); | 623 | regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_POWER_DOWN); |
622 | regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_MEASURE_TEMP); | 624 | regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_MEASURE_TEMP); |
diff --git a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c index 231cabc16e16..2c2ec7666eb1 100644 --- a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c +++ b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c | |||
@@ -119,15 +119,11 @@ int acpi_parse_trt(acpi_handle handle, int *trt_count, struct trt **trtp, | |||
119 | continue; | 119 | continue; |
120 | 120 | ||
121 | result = acpi_bus_get_device(trt->source, &adev); | 121 | result = acpi_bus_get_device(trt->source, &adev); |
122 | if (!result) | 122 | if (result) |
123 | acpi_create_platform_device(adev); | ||
124 | else | ||
125 | pr_warn("Failed to get source ACPI device\n"); | 123 | pr_warn("Failed to get source ACPI device\n"); |
126 | 124 | ||
127 | result = acpi_bus_get_device(trt->target, &adev); | 125 | result = acpi_bus_get_device(trt->target, &adev); |
128 | if (!result) | 126 | if (result) |
129 | acpi_create_platform_device(adev); | ||
130 | else | ||
131 | pr_warn("Failed to get target ACPI device\n"); | 127 | pr_warn("Failed to get target ACPI device\n"); |
132 | } | 128 | } |
133 | 129 | ||
@@ -206,16 +202,12 @@ int acpi_parse_art(acpi_handle handle, int *art_count, struct art **artp, | |||
206 | 202 | ||
207 | if (art->source) { | 203 | if (art->source) { |
208 | result = acpi_bus_get_device(art->source, &adev); | 204 | result = acpi_bus_get_device(art->source, &adev); |
209 | if (!result) | 205 | if (result) |
210 | acpi_create_platform_device(adev); | ||
211 | else | ||
212 | pr_warn("Failed to get source ACPI device\n"); | 206 | pr_warn("Failed to get source ACPI device\n"); |
213 | } | 207 | } |
214 | if (art->target) { | 208 | if (art->target) { |
215 | result = acpi_bus_get_device(art->target, &adev); | 209 | result = acpi_bus_get_device(art->target, &adev); |
216 | if (!result) | 210 | if (result) |
217 | acpi_create_platform_device(adev); | ||
218 | else | ||
219 | pr_warn("Failed to get source ACPI device\n"); | 211 | pr_warn("Failed to get source ACPI device\n"); |
220 | } | 212 | } |
221 | } | 213 | } |
diff --git a/drivers/thermal/int340x_thermal/processor_thermal_device.c b/drivers/thermal/int340x_thermal/processor_thermal_device.c index 31bb553aac26..0fe5dbbea968 100644 --- a/drivers/thermal/int340x_thermal/processor_thermal_device.c +++ b/drivers/thermal/int340x_thermal/processor_thermal_device.c | |||
@@ -130,6 +130,8 @@ static int proc_thermal_add(struct device *dev, | |||
130 | int ret; | 130 | int ret; |
131 | 131 | ||
132 | adev = ACPI_COMPANION(dev); | 132 | adev = ACPI_COMPANION(dev); |
133 | if (!adev) | ||
134 | return -ENODEV; | ||
133 | 135 | ||
134 | status = acpi_evaluate_object(adev->handle, "PPCC", NULL, &buf); | 136 | status = acpi_evaluate_object(adev->handle, "PPCC", NULL, &buf); |
135 | if (ACPI_FAILURE(status)) | 137 | if (ACPI_FAILURE(status)) |
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index e145b66df444..d717f3dab6f1 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c | |||
@@ -149,7 +149,7 @@ EXPORT_SYMBOL_GPL(of_thermal_is_trip_valid); | |||
149 | * | 149 | * |
150 | * Return: pointer to trip points table, NULL otherwise | 150 | * Return: pointer to trip points table, NULL otherwise |
151 | */ | 151 | */ |
152 | const struct thermal_trip * const | 152 | const struct thermal_trip * |
153 | of_thermal_get_trip_points(struct thermal_zone_device *tz) | 153 | of_thermal_get_trip_points(struct thermal_zone_device *tz) |
154 | { | 154 | { |
155 | struct __thermal_zone *data = tz->devdata; | 155 | struct __thermal_zone *data = tz->devdata; |
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 8803e693fe68..2580a4872f90 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c | |||
@@ -63,7 +63,7 @@ struct rcar_thermal_priv { | |||
63 | struct mutex lock; | 63 | struct mutex lock; |
64 | struct list_head list; | 64 | struct list_head list; |
65 | int id; | 65 | int id; |
66 | int ctemp; | 66 | u32 ctemp; |
67 | }; | 67 | }; |
68 | 68 | ||
69 | #define rcar_thermal_for_each_priv(pos, common) \ | 69 | #define rcar_thermal_for_each_priv(pos, common) \ |
@@ -145,7 +145,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv) | |||
145 | { | 145 | { |
146 | struct device *dev = rcar_priv_to_dev(priv); | 146 | struct device *dev = rcar_priv_to_dev(priv); |
147 | int i; | 147 | int i; |
148 | int ctemp, old, new; | 148 | u32 ctemp, old, new; |
149 | int ret = -EINVAL; | 149 | int ret = -EINVAL; |
150 | 150 | ||
151 | mutex_lock(&priv->lock); | 151 | mutex_lock(&priv->lock); |
@@ -372,6 +372,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
372 | int i; | 372 | int i; |
373 | int ret = -ENODEV; | 373 | int ret = -ENODEV; |
374 | int idle = IDLE_INTERVAL; | 374 | int idle = IDLE_INTERVAL; |
375 | u32 enr_bits = 0; | ||
375 | 376 | ||
376 | common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL); | 377 | common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL); |
377 | if (!common) | 378 | if (!common) |
@@ -390,7 +391,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
390 | 391 | ||
391 | /* | 392 | /* |
392 | * platform has IRQ support. | 393 | * platform has IRQ support. |
393 | * Then, drier use common register | 394 | * Then, driver uses common registers |
394 | */ | 395 | */ |
395 | 396 | ||
396 | ret = devm_request_irq(dev, irq->start, rcar_thermal_irq, 0, | 397 | ret = devm_request_irq(dev, irq->start, rcar_thermal_irq, 0, |
@@ -408,9 +409,6 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
408 | if (IS_ERR(common->base)) | 409 | if (IS_ERR(common->base)) |
409 | return PTR_ERR(common->base); | 410 | return PTR_ERR(common->base); |
410 | 411 | ||
411 | /* enable temperature comparation */ | ||
412 | rcar_thermal_common_write(common, ENR, 0x00030303); | ||
413 | |||
414 | idle = 0; /* polling delay is not needed */ | 412 | idle = 0; /* polling delay is not needed */ |
415 | } | 413 | } |
416 | 414 | ||
@@ -452,8 +450,15 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
452 | rcar_thermal_irq_enable(priv); | 450 | rcar_thermal_irq_enable(priv); |
453 | 451 | ||
454 | list_move_tail(&priv->list, &common->head); | 452 | list_move_tail(&priv->list, &common->head); |
453 | |||
454 | /* update ENR bits */ | ||
455 | enr_bits |= 3 << (i * 8); | ||
455 | } | 456 | } |
456 | 457 | ||
458 | /* enable temperature comparation */ | ||
459 | if (irq) | ||
460 | rcar_thermal_common_write(common, ENR, enr_bits); | ||
461 | |||
457 | platform_set_drvdata(pdev, common); | 462 | platform_set_drvdata(pdev, common); |
458 | 463 | ||
459 | dev_info(dev, "%d sensor probed\n", i); | 464 | dev_info(dev, "%d sensor probed\n", i); |
diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index 9083e7520623..0531c752fbbb 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h | |||
@@ -91,7 +91,7 @@ int of_parse_thermal_zones(void); | |||
91 | void of_thermal_destroy_zones(void); | 91 | void of_thermal_destroy_zones(void); |
92 | int of_thermal_get_ntrips(struct thermal_zone_device *); | 92 | int of_thermal_get_ntrips(struct thermal_zone_device *); |
93 | bool of_thermal_is_trip_valid(struct thermal_zone_device *, int); | 93 | bool of_thermal_is_trip_valid(struct thermal_zone_device *, int); |
94 | const struct thermal_trip * const | 94 | const struct thermal_trip * |
95 | of_thermal_get_trip_points(struct thermal_zone_device *); | 95 | of_thermal_get_trip_points(struct thermal_zone_device *); |
96 | #else | 96 | #else |
97 | static inline int of_parse_thermal_zones(void) { return 0; } | 97 | static inline int of_parse_thermal_zones(void) { return 0; } |
@@ -105,7 +105,7 @@ static inline bool of_thermal_is_trip_valid(struct thermal_zone_device *tz, | |||
105 | { | 105 | { |
106 | return 0; | 106 | return 0; |
107 | } | 107 | } |
108 | static inline const struct thermal_trip * const | 108 | static inline const struct thermal_trip * |
109 | of_thermal_get_trip_points(struct thermal_zone_device *tz) | 109 | of_thermal_get_trip_points(struct thermal_zone_device *tz) |
110 | { | 110 | { |
111 | return NULL; | 111 | return NULL; |
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index d2b496750d59..4ddfa60c9222 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c | |||
@@ -2399,17 +2399,12 @@ static unsigned int n_tty_poll(struct tty_struct *tty, struct file *file, | |||
2399 | 2399 | ||
2400 | poll_wait(file, &tty->read_wait, wait); | 2400 | poll_wait(file, &tty->read_wait, wait); |
2401 | poll_wait(file, &tty->write_wait, wait); | 2401 | poll_wait(file, &tty->write_wait, wait); |
2402 | if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) | ||
2403 | mask |= POLLHUP; | ||
2404 | if (input_available_p(tty, 1)) | 2402 | if (input_available_p(tty, 1)) |
2405 | mask |= POLLIN | POLLRDNORM; | 2403 | mask |= POLLIN | POLLRDNORM; |
2406 | else if (mask & POLLHUP) { | ||
2407 | tty_flush_to_ldisc(tty); | ||
2408 | if (input_available_p(tty, 1)) | ||
2409 | mask |= POLLIN | POLLRDNORM; | ||
2410 | } | ||
2411 | if (tty->packet && tty->link->ctrl_status) | 2404 | if (tty->packet && tty->link->ctrl_status) |
2412 | mask |= POLLPRI | POLLIN | POLLRDNORM; | 2405 | mask |= POLLPRI | POLLIN | POLLRDNORM; |
2406 | if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) | ||
2407 | mask |= POLLHUP; | ||
2413 | if (tty_hung_up_p(file)) | 2408 | if (tty_hung_up_p(file)) |
2414 | mask |= POLLHUP; | 2409 | mask |= POLLHUP; |
2415 | if (!(mask & (POLLHUP | POLLIN | POLLRDNORM))) { | 2410 | if (!(mask & (POLLHUP | POLLIN | POLLRDNORM))) { |
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c index 31feeb2d0a66..d1f8dc6aabcb 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c | |||
@@ -1815,7 +1815,7 @@ pci_wch_ch353_setup(struct serial_private *priv, | |||
1815 | } | 1815 | } |
1816 | 1816 | ||
1817 | static int | 1817 | static int |
1818 | pci_wch_ch382_setup(struct serial_private *priv, | 1818 | pci_wch_ch38x_setup(struct serial_private *priv, |
1819 | const struct pciserial_board *board, | 1819 | const struct pciserial_board *board, |
1820 | struct uart_8250_port *port, int idx) | 1820 | struct uart_8250_port *port, int idx) |
1821 | { | 1821 | { |
@@ -1880,6 +1880,7 @@ pci_wch_ch382_setup(struct serial_private *priv, | |||
1880 | 1880 | ||
1881 | #define PCIE_VENDOR_ID_WCH 0x1c00 | 1881 | #define PCIE_VENDOR_ID_WCH 0x1c00 |
1882 | #define PCIE_DEVICE_ID_WCH_CH382_2S1P 0x3250 | 1882 | #define PCIE_DEVICE_ID_WCH_CH382_2S1P 0x3250 |
1883 | #define PCIE_DEVICE_ID_WCH_CH384_4S 0x3470 | ||
1883 | 1884 | ||
1884 | /* Unknown vendors/cards - this should not be in linux/pci_ids.h */ | 1885 | /* Unknown vendors/cards - this should not be in linux/pci_ids.h */ |
1885 | #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584 | 1886 | #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584 |
@@ -2571,13 +2572,21 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { | |||
2571 | .subdevice = PCI_ANY_ID, | 2572 | .subdevice = PCI_ANY_ID, |
2572 | .setup = pci_wch_ch353_setup, | 2573 | .setup = pci_wch_ch353_setup, |
2573 | }, | 2574 | }, |
2574 | /* WCH CH382 2S1P card (16750 clone) */ | 2575 | /* WCH CH382 2S1P card (16850 clone) */ |
2575 | { | 2576 | { |
2576 | .vendor = PCIE_VENDOR_ID_WCH, | 2577 | .vendor = PCIE_VENDOR_ID_WCH, |
2577 | .device = PCIE_DEVICE_ID_WCH_CH382_2S1P, | 2578 | .device = PCIE_DEVICE_ID_WCH_CH382_2S1P, |
2578 | .subvendor = PCI_ANY_ID, | 2579 | .subvendor = PCI_ANY_ID, |
2579 | .subdevice = PCI_ANY_ID, | 2580 | .subdevice = PCI_ANY_ID, |
2580 | .setup = pci_wch_ch382_setup, | 2581 | .setup = pci_wch_ch38x_setup, |
2582 | }, | ||
2583 | /* WCH CH384 4S card (16850 clone) */ | ||
2584 | { | ||
2585 | .vendor = PCIE_VENDOR_ID_WCH, | ||
2586 | .device = PCIE_DEVICE_ID_WCH_CH384_4S, | ||
2587 | .subvendor = PCI_ANY_ID, | ||
2588 | .subdevice = PCI_ANY_ID, | ||
2589 | .setup = pci_wch_ch38x_setup, | ||
2581 | }, | 2590 | }, |
2582 | /* | 2591 | /* |
2583 | * ASIX devices with FIFO bug | 2592 | * ASIX devices with FIFO bug |
@@ -2876,6 +2885,7 @@ enum pci_board_num_t { | |||
2876 | pbn_fintek_4, | 2885 | pbn_fintek_4, |
2877 | pbn_fintek_8, | 2886 | pbn_fintek_8, |
2878 | pbn_fintek_12, | 2887 | pbn_fintek_12, |
2888 | pbn_wch384_4, | ||
2879 | }; | 2889 | }; |
2880 | 2890 | ||
2881 | /* | 2891 | /* |
@@ -3675,6 +3685,14 @@ static struct pciserial_board pci_boards[] = { | |||
3675 | .base_baud = 115200, | 3685 | .base_baud = 115200, |
3676 | .first_offset = 0x40, | 3686 | .first_offset = 0x40, |
3677 | }, | 3687 | }, |
3688 | |||
3689 | [pbn_wch384_4] = { | ||
3690 | .flags = FL_BASE0, | ||
3691 | .num_ports = 4, | ||
3692 | .base_baud = 115200, | ||
3693 | .uart_offset = 8, | ||
3694 | .first_offset = 0xC0, | ||
3695 | }, | ||
3678 | }; | 3696 | }; |
3679 | 3697 | ||
3680 | static const struct pci_device_id blacklist[] = { | 3698 | static const struct pci_device_id blacklist[] = { |
@@ -3687,6 +3705,7 @@ static const struct pci_device_id blacklist[] = { | |||
3687 | { PCI_DEVICE(0x4348, 0x7053), }, /* WCH CH353 2S1P */ | 3705 | { PCI_DEVICE(0x4348, 0x7053), }, /* WCH CH353 2S1P */ |
3688 | { PCI_DEVICE(0x4348, 0x5053), }, /* WCH CH353 1S1P */ | 3706 | { PCI_DEVICE(0x4348, 0x5053), }, /* WCH CH353 1S1P */ |
3689 | { PCI_DEVICE(0x1c00, 0x3250), }, /* WCH CH382 2S1P */ | 3707 | { PCI_DEVICE(0x1c00, 0x3250), }, /* WCH CH382 2S1P */ |
3708 | { PCI_DEVICE(0x1c00, 0x3470), }, /* WCH CH384 4S */ | ||
3690 | }; | 3709 | }; |
3691 | 3710 | ||
3692 | /* | 3711 | /* |
@@ -5400,6 +5419,10 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
5400 | PCI_ANY_ID, PCI_ANY_ID, | 5419 | PCI_ANY_ID, PCI_ANY_ID, |
5401 | 0, 0, pbn_b0_bt_2_115200 }, | 5420 | 0, 0, pbn_b0_bt_2_115200 }, |
5402 | 5421 | ||
5422 | { PCIE_VENDOR_ID_WCH, PCIE_DEVICE_ID_WCH_CH384_4S, | ||
5423 | PCI_ANY_ID, PCI_ANY_ID, | ||
5424 | 0, 0, pbn_wch384_4 }, | ||
5425 | |||
5403 | /* | 5426 | /* |
5404 | * Commtech, Inc. Fastcom adapters | 5427 | * Commtech, Inc. Fastcom adapters |
5405 | */ | 5428 | */ |
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index 19273e31d224..107e80722575 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c | |||
@@ -1757,32 +1757,43 @@ static struct s3c24xx_serial_drv_data s5pv210_serial_drv_data = { | |||
1757 | #endif | 1757 | #endif |
1758 | 1758 | ||
1759 | #if defined(CONFIG_ARCH_EXYNOS) | 1759 | #if defined(CONFIG_ARCH_EXYNOS) |
1760 | #define EXYNOS_COMMON_SERIAL_DRV_DATA \ | ||
1761 | .info = &(struct s3c24xx_uart_info) { \ | ||
1762 | .name = "Samsung Exynos UART", \ | ||
1763 | .type = PORT_S3C6400, \ | ||
1764 | .has_divslot = 1, \ | ||
1765 | .rx_fifomask = S5PV210_UFSTAT_RXMASK, \ | ||
1766 | .rx_fifoshift = S5PV210_UFSTAT_RXSHIFT, \ | ||
1767 | .rx_fifofull = S5PV210_UFSTAT_RXFULL, \ | ||
1768 | .tx_fifofull = S5PV210_UFSTAT_TXFULL, \ | ||
1769 | .tx_fifomask = S5PV210_UFSTAT_TXMASK, \ | ||
1770 | .tx_fifoshift = S5PV210_UFSTAT_TXSHIFT, \ | ||
1771 | .def_clk_sel = S3C2410_UCON_CLKSEL0, \ | ||
1772 | .num_clks = 1, \ | ||
1773 | .clksel_mask = 0, \ | ||
1774 | .clksel_shift = 0, \ | ||
1775 | }, \ | ||
1776 | .def_cfg = &(struct s3c2410_uartcfg) { \ | ||
1777 | .ucon = S5PV210_UCON_DEFAULT, \ | ||
1778 | .ufcon = S5PV210_UFCON_DEFAULT, \ | ||
1779 | .has_fracval = 1, \ | ||
1780 | } \ | ||
1781 | |||
1760 | static struct s3c24xx_serial_drv_data exynos4210_serial_drv_data = { | 1782 | static struct s3c24xx_serial_drv_data exynos4210_serial_drv_data = { |
1761 | .info = &(struct s3c24xx_uart_info) { | 1783 | EXYNOS_COMMON_SERIAL_DRV_DATA, |
1762 | .name = "Samsung Exynos4 UART", | ||
1763 | .type = PORT_S3C6400, | ||
1764 | .has_divslot = 1, | ||
1765 | .rx_fifomask = S5PV210_UFSTAT_RXMASK, | ||
1766 | .rx_fifoshift = S5PV210_UFSTAT_RXSHIFT, | ||
1767 | .rx_fifofull = S5PV210_UFSTAT_RXFULL, | ||
1768 | .tx_fifofull = S5PV210_UFSTAT_TXFULL, | ||
1769 | .tx_fifomask = S5PV210_UFSTAT_TXMASK, | ||
1770 | .tx_fifoshift = S5PV210_UFSTAT_TXSHIFT, | ||
1771 | .def_clk_sel = S3C2410_UCON_CLKSEL0, | ||
1772 | .num_clks = 1, | ||
1773 | .clksel_mask = 0, | ||
1774 | .clksel_shift = 0, | ||
1775 | }, | ||
1776 | .def_cfg = &(struct s3c2410_uartcfg) { | ||
1777 | .ucon = S5PV210_UCON_DEFAULT, | ||
1778 | .ufcon = S5PV210_UFCON_DEFAULT, | ||
1779 | .has_fracval = 1, | ||
1780 | }, | ||
1781 | .fifosize = { 256, 64, 16, 16 }, | 1784 | .fifosize = { 256, 64, 16, 16 }, |
1782 | }; | 1785 | }; |
1786 | |||
1787 | static struct s3c24xx_serial_drv_data exynos5433_serial_drv_data = { | ||
1788 | EXYNOS_COMMON_SERIAL_DRV_DATA, | ||
1789 | .fifosize = { 64, 256, 16, 256 }, | ||
1790 | }; | ||
1791 | |||
1783 | #define EXYNOS4210_SERIAL_DRV_DATA ((kernel_ulong_t)&exynos4210_serial_drv_data) | 1792 | #define EXYNOS4210_SERIAL_DRV_DATA ((kernel_ulong_t)&exynos4210_serial_drv_data) |
1793 | #define EXYNOS5433_SERIAL_DRV_DATA ((kernel_ulong_t)&exynos5433_serial_drv_data) | ||
1784 | #else | 1794 | #else |
1785 | #define EXYNOS4210_SERIAL_DRV_DATA (kernel_ulong_t)NULL | 1795 | #define EXYNOS4210_SERIAL_DRV_DATA (kernel_ulong_t)NULL |
1796 | #define EXYNOS5433_SERIAL_DRV_DATA (kernel_ulong_t)NULL | ||
1786 | #endif | 1797 | #endif |
1787 | 1798 | ||
1788 | static struct platform_device_id s3c24xx_serial_driver_ids[] = { | 1799 | static struct platform_device_id s3c24xx_serial_driver_ids[] = { |
@@ -1804,6 +1815,9 @@ static struct platform_device_id s3c24xx_serial_driver_ids[] = { | |||
1804 | }, { | 1815 | }, { |
1805 | .name = "exynos4210-uart", | 1816 | .name = "exynos4210-uart", |
1806 | .driver_data = EXYNOS4210_SERIAL_DRV_DATA, | 1817 | .driver_data = EXYNOS4210_SERIAL_DRV_DATA, |
1818 | }, { | ||
1819 | .name = "exynos5433-uart", | ||
1820 | .driver_data = EXYNOS5433_SERIAL_DRV_DATA, | ||
1807 | }, | 1821 | }, |
1808 | { }, | 1822 | { }, |
1809 | }; | 1823 | }; |
@@ -1823,6 +1837,8 @@ static const struct of_device_id s3c24xx_uart_dt_match[] = { | |||
1823 | .data = (void *)S5PV210_SERIAL_DRV_DATA }, | 1837 | .data = (void *)S5PV210_SERIAL_DRV_DATA }, |
1824 | { .compatible = "samsung,exynos4210-uart", | 1838 | { .compatible = "samsung,exynos4210-uart", |
1825 | .data = (void *)EXYNOS4210_SERIAL_DRV_DATA }, | 1839 | .data = (void *)EXYNOS4210_SERIAL_DRV_DATA }, |
1840 | { .compatible = "samsung,exynos5433-uart", | ||
1841 | .data = (void *)EXYNOS5433_SERIAL_DRV_DATA }, | ||
1826 | {}, | 1842 | {}, |
1827 | }; | 1843 | }; |
1828 | MODULE_DEVICE_TABLE(of, s3c24xx_uart_dt_match); | 1844 | MODULE_DEVICE_TABLE(of, s3c24xx_uart_dt_match); |
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 57ca61b14670..984605bb5bf1 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c | |||
@@ -2164,7 +2164,9 @@ uart_report_port(struct uart_driver *drv, struct uart_port *port) | |||
2164 | break; | 2164 | break; |
2165 | } | 2165 | } |
2166 | 2166 | ||
2167 | dev_info(port->dev, "%s%d at %s (irq = %d, base_baud = %d) is a %s\n", | 2167 | printk(KERN_INFO "%s%s%s%d at %s (irq = %d, base_baud = %d) is a %s\n", |
2168 | port->dev ? dev_name(port->dev) : "", | ||
2169 | port->dev ? ": " : "", | ||
2168 | drv->dev_name, | 2170 | drv->dev_name, |
2169 | drv->tty_driver->name_base + port->line, | 2171 | drv->tty_driver->name_base + port->line, |
2170 | address, port->irq, port->uartclk / 16, uart_type(port)); | 2172 | address, port->irq, port->uartclk / 16, uart_type(port)); |
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 4f35b43e2475..51f066aa375e 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
@@ -1464,6 +1464,9 @@ static int tty_reopen(struct tty_struct *tty) | |||
1464 | driver->subtype == PTY_TYPE_MASTER) | 1464 | driver->subtype == PTY_TYPE_MASTER) |
1465 | return -EIO; | 1465 | return -EIO; |
1466 | 1466 | ||
1467 | if (test_bit(TTY_EXCLUSIVE, &tty->flags) && !capable(CAP_SYS_ADMIN)) | ||
1468 | return -EBUSY; | ||
1469 | |||
1467 | tty->count++; | 1470 | tty->count++; |
1468 | 1471 | ||
1469 | WARN_ON(!tty->ldisc); | 1472 | WARN_ON(!tty->ldisc); |
@@ -2106,10 +2109,6 @@ retry_open: | |||
2106 | retval = -ENODEV; | 2109 | retval = -ENODEV; |
2107 | filp->f_flags = saved_flags; | 2110 | filp->f_flags = saved_flags; |
2108 | 2111 | ||
2109 | if (!retval && test_bit(TTY_EXCLUSIVE, &tty->flags) && | ||
2110 | !capable(CAP_SYS_ADMIN)) | ||
2111 | retval = -EBUSY; | ||
2112 | |||
2113 | if (retval) { | 2112 | if (retval) { |
2114 | #ifdef TTY_DEBUG_HANGUP | 2113 | #ifdef TTY_DEBUG_HANGUP |
2115 | printk(KERN_DEBUG "%s: error %d in opening %s...\n", __func__, | 2114 | printk(KERN_DEBUG "%s: error %d in opening %s...\n", __func__, |
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 5b9825a4538a..a57dc8866fc5 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c | |||
@@ -669,7 +669,6 @@ static int ci_hdrc_probe(struct platform_device *pdev) | |||
669 | if (!ci) | 669 | if (!ci) |
670 | return -ENOMEM; | 670 | return -ENOMEM; |
671 | 671 | ||
672 | platform_set_drvdata(pdev, ci); | ||
673 | ci->dev = dev; | 672 | ci->dev = dev; |
674 | ci->platdata = dev_get_platdata(dev); | 673 | ci->platdata = dev_get_platdata(dev); |
675 | ci->imx28_write_fix = !!(ci->platdata->flags & | 674 | ci->imx28_write_fix = !!(ci->platdata->flags & |
@@ -783,6 +782,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) | |||
783 | } | 782 | } |
784 | } | 783 | } |
785 | 784 | ||
785 | platform_set_drvdata(pdev, ci); | ||
786 | ret = devm_request_irq(dev, ci->irq, ci_irq, IRQF_SHARED, | 786 | ret = devm_request_irq(dev, ci->irq, ci_irq, IRQF_SHARED, |
787 | ci->platdata->name, ci); | 787 | ci->platdata->name, ci); |
788 | if (ret) | 788 | if (ret) |
diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c index c1694cff1eaf..48731d0bab35 100644 --- a/drivers/usb/chipidea/host.c +++ b/drivers/usb/chipidea/host.c | |||
@@ -91,6 +91,7 @@ static int host_start(struct ci_hdrc *ci) | |||
91 | if (!hcd) | 91 | if (!hcd) |
92 | return -ENOMEM; | 92 | return -ENOMEM; |
93 | 93 | ||
94 | dev_set_drvdata(ci->dev, ci); | ||
94 | hcd->rsrc_start = ci->hw_bank.phys; | 95 | hcd->rsrc_start = ci->hw_bank.phys; |
95 | hcd->rsrc_len = ci->hw_bank.size; | 96 | hcd->rsrc_len = ci->hw_bank.size; |
96 | hcd->regs = ci->hw_bank.abs; | 97 | hcd->regs = ci->hw_bank.abs; |
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 200168ec2d75..79242008085b 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c | |||
@@ -2567,7 +2567,7 @@ error: | |||
2567 | * s3c_hsotg_ep_disable - disable given endpoint | 2567 | * s3c_hsotg_ep_disable - disable given endpoint |
2568 | * @ep: The endpoint to disable. | 2568 | * @ep: The endpoint to disable. |
2569 | */ | 2569 | */ |
2570 | static int s3c_hsotg_ep_disable(struct usb_ep *ep) | 2570 | static int s3c_hsotg_ep_disable_force(struct usb_ep *ep, bool force) |
2571 | { | 2571 | { |
2572 | struct s3c_hsotg_ep *hs_ep = our_ep(ep); | 2572 | struct s3c_hsotg_ep *hs_ep = our_ep(ep); |
2573 | struct dwc2_hsotg *hsotg = hs_ep->parent; | 2573 | struct dwc2_hsotg *hsotg = hs_ep->parent; |
@@ -2588,7 +2588,7 @@ static int s3c_hsotg_ep_disable(struct usb_ep *ep) | |||
2588 | 2588 | ||
2589 | spin_lock_irqsave(&hsotg->lock, flags); | 2589 | spin_lock_irqsave(&hsotg->lock, flags); |
2590 | /* terminate all requests with shutdown */ | 2590 | /* terminate all requests with shutdown */ |
2591 | kill_all_requests(hsotg, hs_ep, -ESHUTDOWN, false); | 2591 | kill_all_requests(hsotg, hs_ep, -ESHUTDOWN, force); |
2592 | 2592 | ||
2593 | hsotg->fifo_map &= ~(1<<hs_ep->fifo_index); | 2593 | hsotg->fifo_map &= ~(1<<hs_ep->fifo_index); |
2594 | hs_ep->fifo_index = 0; | 2594 | hs_ep->fifo_index = 0; |
@@ -2609,6 +2609,10 @@ static int s3c_hsotg_ep_disable(struct usb_ep *ep) | |||
2609 | return 0; | 2609 | return 0; |
2610 | } | 2610 | } |
2611 | 2611 | ||
2612 | static int s3c_hsotg_ep_disable(struct usb_ep *ep) | ||
2613 | { | ||
2614 | return s3c_hsotg_ep_disable_force(ep, false); | ||
2615 | } | ||
2612 | /** | 2616 | /** |
2613 | * on_list - check request is on the given endpoint | 2617 | * on_list - check request is on the given endpoint |
2614 | * @ep: The endpoint to check. | 2618 | * @ep: The endpoint to check. |
@@ -2924,7 +2928,7 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget) | |||
2924 | 2928 | ||
2925 | /* all endpoints should be shutdown */ | 2929 | /* all endpoints should be shutdown */ |
2926 | for (ep = 1; ep < hsotg->num_of_eps; ep++) | 2930 | for (ep = 1; ep < hsotg->num_of_eps; ep++) |
2927 | s3c_hsotg_ep_disable(&hsotg->eps[ep].ep); | 2931 | s3c_hsotg_ep_disable_force(&hsotg->eps[ep].ep, true); |
2928 | 2932 | ||
2929 | spin_lock_irqsave(&hsotg->lock, flags); | 2933 | spin_lock_irqsave(&hsotg->lock, flags); |
2930 | 2934 | ||
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 7c4faf738747..b642a2f998f9 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c | |||
@@ -33,6 +33,8 @@ | |||
33 | #define PCI_DEVICE_ID_INTEL_BYT 0x0f37 | 33 | #define PCI_DEVICE_ID_INTEL_BYT 0x0f37 |
34 | #define PCI_DEVICE_ID_INTEL_MRFLD 0x119e | 34 | #define PCI_DEVICE_ID_INTEL_MRFLD 0x119e |
35 | #define PCI_DEVICE_ID_INTEL_BSW 0x22B7 | 35 | #define PCI_DEVICE_ID_INTEL_BSW 0x22B7 |
36 | #define PCI_DEVICE_ID_INTEL_SPTLP 0x9d30 | ||
37 | #define PCI_DEVICE_ID_INTEL_SPTH 0xa130 | ||
36 | 38 | ||
37 | struct dwc3_pci { | 39 | struct dwc3_pci { |
38 | struct device *dev; | 40 | struct device *dev; |
@@ -219,6 +221,8 @@ static const struct pci_device_id dwc3_pci_id_table[] = { | |||
219 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BSW), }, | 221 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BSW), }, |
220 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), }, | 222 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), }, |
221 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), }, | 223 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), }, |
224 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SPTLP), }, | ||
225 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SPTH), }, | ||
222 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), }, | 226 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), }, |
223 | { } /* Terminating Entry */ | 227 | { } /* Terminating Entry */ |
224 | }; | 228 | }; |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index f03b136ecfce..8f65ab3a3b92 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -882,8 +882,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting) | |||
882 | 882 | ||
883 | if (i == (request->num_mapped_sgs - 1) || | 883 | if (i == (request->num_mapped_sgs - 1) || |
884 | sg_is_last(s)) { | 884 | sg_is_last(s)) { |
885 | if (list_is_last(&req->list, | 885 | if (list_empty(&dep->request_list)) |
886 | &dep->request_list)) | ||
887 | last_one = true; | 886 | last_one = true; |
888 | chain = false; | 887 | chain = false; |
889 | } | 888 | } |
@@ -901,6 +900,9 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting) | |||
901 | if (last_one) | 900 | if (last_one) |
902 | break; | 901 | break; |
903 | } | 902 | } |
903 | |||
904 | if (last_one) | ||
905 | break; | ||
904 | } else { | 906 | } else { |
905 | dma = req->request.dma; | 907 | dma = req->request.dma; |
906 | length = req->request.length; | 908 | length = req->request.length; |
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c index 6e04e302dc3a..a1bc3e3a0b09 100644 --- a/drivers/usb/gadget/function/f_hid.c +++ b/drivers/usb/gadget/function/f_hid.c | |||
@@ -399,8 +399,9 @@ static int hidg_setup(struct usb_function *f, | |||
399 | value = __le16_to_cpu(ctrl->wValue); | 399 | value = __le16_to_cpu(ctrl->wValue); |
400 | length = __le16_to_cpu(ctrl->wLength); | 400 | length = __le16_to_cpu(ctrl->wLength); |
401 | 401 | ||
402 | VDBG(cdev, "hid_setup crtl_request : bRequestType:0x%x bRequest:0x%x " | 402 | VDBG(cdev, |
403 | "Value:0x%x\n", ctrl->bRequestType, ctrl->bRequest, value); | 403 | "%s crtl_request : bRequestType:0x%x bRequest:0x%x Value:0x%x\n", |
404 | __func__, ctrl->bRequestType, ctrl->bRequest, value); | ||
404 | 405 | ||
405 | switch ((ctrl->bRequestType << 8) | ctrl->bRequest) { | 406 | switch ((ctrl->bRequestType << 8) | ctrl->bRequest) { |
406 | case ((USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8 | 407 | case ((USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8 |
diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c index a90440300735..259b656c0b3e 100644 --- a/drivers/usb/gadget/function/f_midi.c +++ b/drivers/usb/gadget/function/f_midi.c | |||
@@ -520,7 +520,7 @@ static void f_midi_transmit(struct f_midi *midi, struct usb_request *req) | |||
520 | req = midi_alloc_ep_req(ep, midi->buflen); | 520 | req = midi_alloc_ep_req(ep, midi->buflen); |
521 | 521 | ||
522 | if (!req) { | 522 | if (!req) { |
523 | ERROR(midi, "gmidi_transmit: alloc_ep_request failed\n"); | 523 | ERROR(midi, "%s: alloc_ep_request failed\n", __func__); |
524 | return; | 524 | return; |
525 | } | 525 | } |
526 | req->length = 0; | 526 | req->length = 0; |
diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1.c index f7b203293205..e9715845f82e 100644 --- a/drivers/usb/gadget/function/f_uac1.c +++ b/drivers/usb/gadget/function/f_uac1.c | |||
@@ -897,7 +897,6 @@ static void f_audio_free_inst(struct usb_function_instance *f) | |||
897 | struct f_uac1_opts *opts; | 897 | struct f_uac1_opts *opts; |
898 | 898 | ||
899 | opts = container_of(f, struct f_uac1_opts, func_inst); | 899 | opts = container_of(f, struct f_uac1_opts, func_inst); |
900 | gaudio_cleanup(opts->card); | ||
901 | if (opts->fn_play_alloc) | 900 | if (opts->fn_play_alloc) |
902 | kfree(opts->fn_play); | 901 | kfree(opts->fn_play); |
903 | if (opts->fn_cap_alloc) | 902 | if (opts->fn_cap_alloc) |
@@ -935,6 +934,7 @@ static void f_audio_free(struct usb_function *f) | |||
935 | struct f_audio *audio = func_to_audio(f); | 934 | struct f_audio *audio = func_to_audio(f); |
936 | struct f_uac1_opts *opts; | 935 | struct f_uac1_opts *opts; |
937 | 936 | ||
937 | gaudio_cleanup(&audio->card); | ||
938 | opts = container_of(f->fi, struct f_uac1_opts, func_inst); | 938 | opts = container_of(f->fi, struct f_uac1_opts, func_inst); |
939 | kfree(audio); | 939 | kfree(audio); |
940 | mutex_lock(&opts->lock); | 940 | mutex_lock(&opts->lock); |
diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c index c744e4975d74..db49ec4c748e 100644 --- a/drivers/usb/gadget/legacy/inode.c +++ b/drivers/usb/gadget/legacy/inode.c | |||
@@ -441,6 +441,7 @@ ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
441 | kbuf = memdup_user(buf, len); | 441 | kbuf = memdup_user(buf, len); |
442 | if (IS_ERR(kbuf)) { | 442 | if (IS_ERR(kbuf)) { |
443 | value = PTR_ERR(kbuf); | 443 | value = PTR_ERR(kbuf); |
444 | kbuf = NULL; | ||
444 | goto free1; | 445 | goto free1; |
445 | } | 446 | } |
446 | 447 | ||
@@ -449,6 +450,7 @@ ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
449 | data->name, len, (int) value); | 450 | data->name, len, (int) value); |
450 | free1: | 451 | free1: |
451 | mutex_unlock(&data->lock); | 452 | mutex_unlock(&data->lock); |
453 | kfree (kbuf); | ||
452 | return value; | 454 | return value; |
453 | } | 455 | } |
454 | 456 | ||
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index ce882371786b..9f93bed42052 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c | |||
@@ -716,10 +716,10 @@ static int queue_dma(struct usba_udc *udc, struct usba_ep *ep, | |||
716 | req->using_dma = 1; | 716 | req->using_dma = 1; |
717 | req->ctrl = USBA_BF(DMA_BUF_LEN, req->req.length) | 717 | req->ctrl = USBA_BF(DMA_BUF_LEN, req->req.length) |
718 | | USBA_DMA_CH_EN | USBA_DMA_END_BUF_IE | 718 | | USBA_DMA_CH_EN | USBA_DMA_END_BUF_IE |
719 | | USBA_DMA_END_TR_EN | USBA_DMA_END_TR_IE; | 719 | | USBA_DMA_END_BUF_EN; |
720 | 720 | ||
721 | if (ep->is_in) | 721 | if (!ep->is_in) |
722 | req->ctrl |= USBA_DMA_END_BUF_EN; | 722 | req->ctrl |= USBA_DMA_END_TR_EN | USBA_DMA_END_TR_IE; |
723 | 723 | ||
724 | /* | 724 | /* |
725 | * Add this request to the queue and submit for DMA if | 725 | * Add this request to the queue and submit for DMA if |
@@ -828,7 +828,7 @@ static int usba_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) | |||
828 | { | 828 | { |
829 | struct usba_ep *ep = to_usba_ep(_ep); | 829 | struct usba_ep *ep = to_usba_ep(_ep); |
830 | struct usba_udc *udc = ep->udc; | 830 | struct usba_udc *udc = ep->udc; |
831 | struct usba_request *req = to_usba_req(_req); | 831 | struct usba_request *req; |
832 | unsigned long flags; | 832 | unsigned long flags; |
833 | u32 status; | 833 | u32 status; |
834 | 834 | ||
@@ -837,6 +837,16 @@ static int usba_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) | |||
837 | 837 | ||
838 | spin_lock_irqsave(&udc->lock, flags); | 838 | spin_lock_irqsave(&udc->lock, flags); |
839 | 839 | ||
840 | list_for_each_entry(req, &ep->queue, queue) { | ||
841 | if (&req->req == _req) | ||
842 | break; | ||
843 | } | ||
844 | |||
845 | if (&req->req != _req) { | ||
846 | spin_unlock_irqrestore(&udc->lock, flags); | ||
847 | return -EINVAL; | ||
848 | } | ||
849 | |||
840 | if (req->using_dma) { | 850 | if (req->using_dma) { |
841 | /* | 851 | /* |
842 | * If this request is currently being transferred, | 852 | * If this request is currently being transferred, |
@@ -1563,7 +1573,6 @@ static void usba_ep_irq(struct usba_udc *udc, struct usba_ep *ep) | |||
1563 | if ((epstatus & epctrl) & USBA_RX_BK_RDY) { | 1573 | if ((epstatus & epctrl) & USBA_RX_BK_RDY) { |
1564 | DBG(DBG_BUS, "%s: RX data ready\n", ep->ep.name); | 1574 | DBG(DBG_BUS, "%s: RX data ready\n", ep->ep.name); |
1565 | receive_data(ep); | 1575 | receive_data(ep); |
1566 | usba_ep_writel(ep, CLR_STA, USBA_RX_BK_RDY); | ||
1567 | } | 1576 | } |
1568 | } | 1577 | } |
1569 | 1578 | ||
diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c index ff67ceac77c4..d4fe8d769bd6 100644 --- a/drivers/usb/gadget/udc/bdc/bdc_ep.c +++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c | |||
@@ -718,10 +718,11 @@ static int ep_queue(struct bdc_ep *ep, struct bdc_req *req) | |||
718 | struct bdc *bdc; | 718 | struct bdc *bdc; |
719 | int ret = 0; | 719 | int ret = 0; |
720 | 720 | ||
721 | bdc = ep->bdc; | ||
722 | if (!req || !ep || !ep->usb_ep.desc) | 721 | if (!req || !ep || !ep->usb_ep.desc) |
723 | return -EINVAL; | 722 | return -EINVAL; |
724 | 723 | ||
724 | bdc = ep->bdc; | ||
725 | |||
725 | req->usb_req.actual = 0; | 726 | req->usb_req.actual = 0; |
726 | req->usb_req.status = -EINPROGRESS; | 727 | req->usb_req.status = -EINPROGRESS; |
727 | req->epnum = ep->ep_num; | 728 | req->epnum = ep->ep_num; |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index e113fd73aeae..f9a332775c47 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -1581,6 +1581,10 @@ iso_stream_schedule ( | |||
1581 | else | 1581 | else |
1582 | next = (now + 2 + 7) & ~0x07; /* full frame cache */ | 1582 | next = (now + 2 + 7) & ~0x07; /* full frame cache */ |
1583 | 1583 | ||
1584 | /* If needed, initialize last_iso_frame so that this URB will be seen */ | ||
1585 | if (ehci->isoc_count == 0) | ||
1586 | ehci->last_iso_frame = now >> 3; | ||
1587 | |||
1584 | /* | 1588 | /* |
1585 | * Use ehci->last_iso_frame as the base. There can't be any | 1589 | * Use ehci->last_iso_frame as the base. There can't be any |
1586 | * TDs scheduled for earlier than that. | 1590 | * TDs scheduled for earlier than that. |
@@ -1600,11 +1604,11 @@ iso_stream_schedule ( | |||
1600 | */ | 1604 | */ |
1601 | now2 = (now - base) & (mod - 1); | 1605 | now2 = (now - base) & (mod - 1); |
1602 | 1606 | ||
1603 | /* Is the schedule already full? */ | 1607 | /* Is the schedule about to wrap around? */ |
1604 | if (unlikely(!empty && start < period)) { | 1608 | if (unlikely(!empty && start < period)) { |
1605 | ehci_dbg(ehci, "iso sched full %p (%u-%u < %u mod %u)\n", | 1609 | ehci_dbg(ehci, "request %p would overflow (%u-%u < %u mod %u)\n", |
1606 | urb, stream->next_uframe, base, period, mod); | 1610 | urb, stream->next_uframe, base, period, mod); |
1607 | status = -ENOSPC; | 1611 | status = -EFBIG; |
1608 | goto fail; | 1612 | goto fail; |
1609 | } | 1613 | } |
1610 | 1614 | ||
@@ -1671,10 +1675,6 @@ iso_stream_schedule ( | |||
1671 | urb->start_frame = start & (mod - 1); | 1675 | urb->start_frame = start & (mod - 1); |
1672 | if (!stream->highspeed) | 1676 | if (!stream->highspeed) |
1673 | urb->start_frame >>= 3; | 1677 | urb->start_frame >>= 3; |
1674 | |||
1675 | /* Make sure scan_isoc() sees these */ | ||
1676 | if (ehci->isoc_count == 0) | ||
1677 | ehci->last_iso_frame = now >> 3; | ||
1678 | return status; | 1678 | return status; |
1679 | 1679 | ||
1680 | fail: | 1680 | fail: |
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index 19a9af1b4d74..ff9af29b4e9f 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c | |||
@@ -451,7 +451,7 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
451 | 451 | ||
452 | u_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "nvidia,phy", 0); | 452 | u_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "nvidia,phy", 0); |
453 | if (IS_ERR(u_phy)) { | 453 | if (IS_ERR(u_phy)) { |
454 | err = PTR_ERR(u_phy); | 454 | err = -EPROBE_DEFER; |
455 | goto cleanup_clk_en; | 455 | goto cleanup_clk_en; |
456 | } | 456 | } |
457 | hcd->usb_phy = u_phy; | 457 | hcd->usb_phy = u_phy; |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index dd483c13565b..ce636466edb7 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
@@ -567,7 +567,8 @@ static void quirk_usb_handoff_ohci(struct pci_dev *pdev) | |||
567 | { | 567 | { |
568 | void __iomem *base; | 568 | void __iomem *base; |
569 | u32 control; | 569 | u32 control; |
570 | u32 fminterval; | 570 | u32 fminterval = 0; |
571 | bool no_fminterval = false; | ||
571 | int cnt; | 572 | int cnt; |
572 | 573 | ||
573 | if (!mmio_resource_enabled(pdev, 0)) | 574 | if (!mmio_resource_enabled(pdev, 0)) |
@@ -577,6 +578,13 @@ static void quirk_usb_handoff_ohci(struct pci_dev *pdev) | |||
577 | if (base == NULL) | 578 | if (base == NULL) |
578 | return; | 579 | return; |
579 | 580 | ||
581 | /* | ||
582 | * ULi M5237 OHCI controller locks the whole system when accessing | ||
583 | * the OHCI_FMINTERVAL offset. | ||
584 | */ | ||
585 | if (pdev->vendor == PCI_VENDOR_ID_AL && pdev->device == 0x5237) | ||
586 | no_fminterval = true; | ||
587 | |||
580 | control = readl(base + OHCI_CONTROL); | 588 | control = readl(base + OHCI_CONTROL); |
581 | 589 | ||
582 | /* On PA-RISC, PDC can leave IR set incorrectly; ignore it there. */ | 590 | /* On PA-RISC, PDC can leave IR set incorrectly; ignore it there. */ |
@@ -615,7 +623,9 @@ static void quirk_usb_handoff_ohci(struct pci_dev *pdev) | |||
615 | } | 623 | } |
616 | 624 | ||
617 | /* software reset of the controller, preserving HcFmInterval */ | 625 | /* software reset of the controller, preserving HcFmInterval */ |
618 | fminterval = readl(base + OHCI_FMINTERVAL); | 626 | if (!no_fminterval) |
627 | fminterval = readl(base + OHCI_FMINTERVAL); | ||
628 | |||
619 | writel(OHCI_HCR, base + OHCI_CMDSTATUS); | 629 | writel(OHCI_HCR, base + OHCI_CMDSTATUS); |
620 | 630 | ||
621 | /* reset requires max 10 us delay */ | 631 | /* reset requires max 10 us delay */ |
@@ -624,7 +634,9 @@ static void quirk_usb_handoff_ohci(struct pci_dev *pdev) | |||
624 | break; | 634 | break; |
625 | udelay(1); | 635 | udelay(1); |
626 | } | 636 | } |
627 | writel(fminterval, base + OHCI_FMINTERVAL); | 637 | |
638 | if (!no_fminterval) | ||
639 | writel(fminterval, base + OHCI_FMINTERVAL); | ||
628 | 640 | ||
629 | /* Now the controller is safely in SUSPEND and nothing can wake it up */ | 641 | /* Now the controller is safely in SUSPEND and nothing can wake it up */ |
630 | iounmap(base); | 642 | iounmap(base); |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 142b601f9563..7f76c8a12f89 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -82,6 +82,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
82 | "must be suspended extra slowly", | 82 | "must be suspended extra slowly", |
83 | pdev->revision); | 83 | pdev->revision); |
84 | } | 84 | } |
85 | if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK) | ||
86 | xhci->quirks |= XHCI_BROKEN_STREAMS; | ||
85 | /* Fresco Logic confirms: all revisions of this chip do not | 87 | /* Fresco Logic confirms: all revisions of this chip do not |
86 | * support MSI, even though some of them claim to in their PCI | 88 | * support MSI, even though some of them claim to in their PCI |
87 | * capabilities. | 89 | * capabilities. |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 01fcbb5eb06e..c50d8d202618 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -3803,6 +3803,15 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, | |||
3803 | return -EINVAL; | 3803 | return -EINVAL; |
3804 | } | 3804 | } |
3805 | 3805 | ||
3806 | if (setup == SETUP_CONTEXT_ONLY) { | ||
3807 | slot_ctx = xhci_get_slot_ctx(xhci, virt_dev->out_ctx); | ||
3808 | if (GET_SLOT_STATE(le32_to_cpu(slot_ctx->dev_state)) == | ||
3809 | SLOT_STATE_DEFAULT) { | ||
3810 | xhci_dbg(xhci, "Slot already in default state\n"); | ||
3811 | return 0; | ||
3812 | } | ||
3813 | } | ||
3814 | |||
3806 | command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); | 3815 | command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); |
3807 | if (!command) | 3816 | if (!command) |
3808 | return -ENOMEM; | 3817 | return -ENOMEM; |
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 9d68372dd9aa..b005010240e5 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig | |||
@@ -72,6 +72,8 @@ config USB_MUSB_DA8XX | |||
72 | 72 | ||
73 | config USB_MUSB_TUSB6010 | 73 | config USB_MUSB_TUSB6010 |
74 | tristate "TUSB6010" | 74 | tristate "TUSB6010" |
75 | depends on ARCH_OMAP2PLUS || COMPILE_TEST | ||
76 | depends on NOP_USB_XCEIV = USB_MUSB_HDRC # both built-in or both modules | ||
75 | 77 | ||
76 | config USB_MUSB_OMAP2PLUS | 78 | config USB_MUSB_OMAP2PLUS |
77 | tristate "OMAP2430 and onwards" | 79 | tristate "OMAP2430 and onwards" |
@@ -85,6 +87,7 @@ config USB_MUSB_AM35X | |||
85 | config USB_MUSB_DSPS | 87 | config USB_MUSB_DSPS |
86 | tristate "TI DSPS platforms" | 88 | tristate "TI DSPS platforms" |
87 | select USB_MUSB_AM335X_CHILD | 89 | select USB_MUSB_AM335X_CHILD |
90 | depends on ARCH_OMAP2PLUS || COMPILE_TEST | ||
88 | depends on OF_IRQ | 91 | depends on OF_IRQ |
89 | 92 | ||
90 | config USB_MUSB_BLACKFIN | 93 | config USB_MUSB_BLACKFIN |
@@ -93,6 +96,7 @@ config USB_MUSB_BLACKFIN | |||
93 | 96 | ||
94 | config USB_MUSB_UX500 | 97 | config USB_MUSB_UX500 |
95 | tristate "Ux500 platforms" | 98 | tristate "Ux500 platforms" |
99 | depends on ARCH_U8500 || COMPILE_TEST | ||
96 | 100 | ||
97 | config USB_MUSB_JZ4740 | 101 | config USB_MUSB_JZ4740 |
98 | tristate "JZ4740" | 102 | tristate "JZ4740" |
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index a441a2de8619..178250145613 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c | |||
@@ -63,7 +63,7 @@ static void bfin_writew(void __iomem *addr, unsigned offset, u16 data) | |||
63 | bfin_write16(addr + offset, data); | 63 | bfin_write16(addr + offset, data); |
64 | } | 64 | } |
65 | 65 | ||
66 | static void binf_writel(void __iomem *addr, unsigned offset, u32 data) | 66 | static void bfin_writel(void __iomem *addr, unsigned offset, u32 data) |
67 | { | 67 | { |
68 | bfin_write16(addr + offset, (u16)data); | 68 | bfin_write16(addr + offset, (u16)data); |
69 | } | 69 | } |
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index f64fd964dc6d..c39a16ad7832 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c | |||
@@ -628,9 +628,9 @@ static int cppi41_dma_controller_start(struct cppi41_dma_controller *controller) | |||
628 | ret = of_property_read_string_index(np, "dma-names", i, &str); | 628 | ret = of_property_read_string_index(np, "dma-names", i, &str); |
629 | if (ret) | 629 | if (ret) |
630 | goto err; | 630 | goto err; |
631 | if (!strncmp(str, "tx", 2)) | 631 | if (strstarts(str, "tx")) |
632 | is_tx = 1; | 632 | is_tx = 1; |
633 | else if (!strncmp(str, "rx", 2)) | 633 | else if (strstarts(str, "rx")) |
634 | is_tx = 0; | 634 | is_tx = 0; |
635 | else { | 635 | else { |
636 | dev_err(dev, "Wrong dmatype %s\n", str); | 636 | dev_err(dev, "Wrong dmatype %s\n", str); |
diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c index ad3701a97389..48131aa8472c 100644 --- a/drivers/usb/musb/musb_debugfs.c +++ b/drivers/usb/musb/musb_debugfs.c | |||
@@ -59,20 +59,12 @@ static const struct musb_register_map musb_regmap[] = { | |||
59 | { "RxMaxPp", MUSB_RXMAXP, 16 }, | 59 | { "RxMaxPp", MUSB_RXMAXP, 16 }, |
60 | { "RxCSR", MUSB_RXCSR, 16 }, | 60 | { "RxCSR", MUSB_RXCSR, 16 }, |
61 | { "RxCount", MUSB_RXCOUNT, 16 }, | 61 | { "RxCount", MUSB_RXCOUNT, 16 }, |
62 | { "ConfigData", MUSB_CONFIGDATA,8 }, | ||
63 | { "IntrRxE", MUSB_INTRRXE, 16 }, | 62 | { "IntrRxE", MUSB_INTRRXE, 16 }, |
64 | { "IntrTxE", MUSB_INTRTXE, 16 }, | 63 | { "IntrTxE", MUSB_INTRTXE, 16 }, |
65 | { "IntrUsbE", MUSB_INTRUSBE, 8 }, | 64 | { "IntrUsbE", MUSB_INTRUSBE, 8 }, |
66 | { "DevCtl", MUSB_DEVCTL, 8 }, | 65 | { "DevCtl", MUSB_DEVCTL, 8 }, |
67 | { "BabbleCtl", MUSB_BABBLE_CTL,8 }, | ||
68 | { "TxFIFOsz", MUSB_TXFIFOSZ, 8 }, | ||
69 | { "RxFIFOsz", MUSB_RXFIFOSZ, 8 }, | ||
70 | { "TxFIFOadd", MUSB_TXFIFOADD, 16 }, | ||
71 | { "RxFIFOadd", MUSB_RXFIFOADD, 16 }, | ||
72 | { "VControl", 0x68, 32 }, | 66 | { "VControl", 0x68, 32 }, |
73 | { "HWVers", 0x69, 16 }, | 67 | { "HWVers", 0x69, 16 }, |
74 | { "EPInfo", MUSB_EPINFO, 8 }, | ||
75 | { "RAMInfo", MUSB_RAMINFO, 8 }, | ||
76 | { "LinkInfo", MUSB_LINKINFO, 8 }, | 68 | { "LinkInfo", MUSB_LINKINFO, 8 }, |
77 | { "VPLen", MUSB_VPLEN, 8 }, | 69 | { "VPLen", MUSB_VPLEN, 8 }, |
78 | { "HS_EOF1", MUSB_HS_EOF1, 8 }, | 70 | { "HS_EOF1", MUSB_HS_EOF1, 8 }, |
@@ -103,6 +95,16 @@ static const struct musb_register_map musb_regmap[] = { | |||
103 | { "DMA_CNTLch7", 0x274, 16 }, | 95 | { "DMA_CNTLch7", 0x274, 16 }, |
104 | { "DMA_ADDRch7", 0x278, 32 }, | 96 | { "DMA_ADDRch7", 0x278, 32 }, |
105 | { "DMA_COUNTch7", 0x27C, 32 }, | 97 | { "DMA_COUNTch7", 0x27C, 32 }, |
98 | #ifndef CONFIG_BLACKFIN | ||
99 | { "ConfigData", MUSB_CONFIGDATA,8 }, | ||
100 | { "BabbleCtl", MUSB_BABBLE_CTL,8 }, | ||
101 | { "TxFIFOsz", MUSB_TXFIFOSZ, 8 }, | ||
102 | { "RxFIFOsz", MUSB_RXFIFOSZ, 8 }, | ||
103 | { "TxFIFOadd", MUSB_TXFIFOADD, 16 }, | ||
104 | { "RxFIFOadd", MUSB_RXFIFOADD, 16 }, | ||
105 | { "EPInfo", MUSB_EPINFO, 8 }, | ||
106 | { "RAMInfo", MUSB_RAMINFO, 8 }, | ||
107 | #endif | ||
106 | { } /* Terminating Entry */ | 108 | { } /* Terminating Entry */ |
107 | }; | 109 | }; |
108 | 110 | ||
@@ -197,30 +199,30 @@ static ssize_t musb_test_mode_write(struct file *file, | |||
197 | if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) | 199 | if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) |
198 | return -EFAULT; | 200 | return -EFAULT; |
199 | 201 | ||
200 | if (!strncmp(buf, "force host", 9)) | 202 | if (strstarts(buf, "force host")) |
201 | test = MUSB_TEST_FORCE_HOST; | 203 | test = MUSB_TEST_FORCE_HOST; |
202 | 204 | ||
203 | if (!strncmp(buf, "fifo access", 11)) | 205 | if (strstarts(buf, "fifo access")) |
204 | test = MUSB_TEST_FIFO_ACCESS; | 206 | test = MUSB_TEST_FIFO_ACCESS; |
205 | 207 | ||
206 | if (!strncmp(buf, "force full-speed", 15)) | 208 | if (strstarts(buf, "force full-speed")) |
207 | test = MUSB_TEST_FORCE_FS; | 209 | test = MUSB_TEST_FORCE_FS; |
208 | 210 | ||
209 | if (!strncmp(buf, "force high-speed", 15)) | 211 | if (strstarts(buf, "force high-speed")) |
210 | test = MUSB_TEST_FORCE_HS; | 212 | test = MUSB_TEST_FORCE_HS; |
211 | 213 | ||
212 | if (!strncmp(buf, "test packet", 10)) { | 214 | if (strstarts(buf, "test packet")) { |
213 | test = MUSB_TEST_PACKET; | 215 | test = MUSB_TEST_PACKET; |
214 | musb_load_testpacket(musb); | 216 | musb_load_testpacket(musb); |
215 | } | 217 | } |
216 | 218 | ||
217 | if (!strncmp(buf, "test K", 6)) | 219 | if (strstarts(buf, "test K")) |
218 | test = MUSB_TEST_K; | 220 | test = MUSB_TEST_K; |
219 | 221 | ||
220 | if (!strncmp(buf, "test J", 6)) | 222 | if (strstarts(buf, "test J")) |
221 | test = MUSB_TEST_J; | 223 | test = MUSB_TEST_J; |
222 | 224 | ||
223 | if (!strncmp(buf, "test SE0 NAK", 12)) | 225 | if (strstarts(buf, "test SE0 NAK")) |
224 | test = MUSB_TEST_SE0_NAK; | 226 | test = MUSB_TEST_SE0_NAK; |
225 | 227 | ||
226 | musb_writeb(musb->mregs, MUSB_TESTMODE, test); | 228 | musb_writeb(musb->mregs, MUSB_TESTMODE, test); |
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 23d474d3d7f4..883a9adfdfff 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
@@ -2663,7 +2663,6 @@ void musb_host_cleanup(struct musb *musb) | |||
2663 | if (musb->port_mode == MUSB_PORT_MODE_GADGET) | 2663 | if (musb->port_mode == MUSB_PORT_MODE_GADGET) |
2664 | return; | 2664 | return; |
2665 | usb_remove_hcd(musb->hcd); | 2665 | usb_remove_hcd(musb->hcd); |
2666 | musb->hcd = NULL; | ||
2667 | } | 2666 | } |
2668 | 2667 | ||
2669 | void musb_host_free(struct musb *musb) | 2668 | void musb_host_free(struct musb *musb) |
diff --git a/drivers/usb/phy/phy-mv-usb.c b/drivers/usb/phy/phy-mv-usb.c index 699e38c73d82..697a741a0cb1 100644 --- a/drivers/usb/phy/phy-mv-usb.c +++ b/drivers/usb/phy/phy-mv-usb.c | |||
@@ -338,7 +338,6 @@ static void mv_otg_update_inputs(struct mv_otg *mvotg) | |||
338 | static void mv_otg_update_state(struct mv_otg *mvotg) | 338 | static void mv_otg_update_state(struct mv_otg *mvotg) |
339 | { | 339 | { |
340 | struct mv_otg_ctrl *otg_ctrl = &mvotg->otg_ctrl; | 340 | struct mv_otg_ctrl *otg_ctrl = &mvotg->otg_ctrl; |
341 | struct usb_phy *phy = &mvotg->phy; | ||
342 | int old_state = mvotg->phy.otg->state; | 341 | int old_state = mvotg->phy.otg->state; |
343 | 342 | ||
344 | switch (old_state) { | 343 | switch (old_state) { |
@@ -858,10 +857,10 @@ static int mv_otg_suspend(struct platform_device *pdev, pm_message_t state) | |||
858 | { | 857 | { |
859 | struct mv_otg *mvotg = platform_get_drvdata(pdev); | 858 | struct mv_otg *mvotg = platform_get_drvdata(pdev); |
860 | 859 | ||
861 | if (mvotg->phy.state != OTG_STATE_B_IDLE) { | 860 | if (mvotg->phy.otg->state != OTG_STATE_B_IDLE) { |
862 | dev_info(&pdev->dev, | 861 | dev_info(&pdev->dev, |
863 | "OTG state is not B_IDLE, it is %d!\n", | 862 | "OTG state is not B_IDLE, it is %d!\n", |
864 | mvotg->phy.state); | 863 | mvotg->phy.otg->state); |
865 | return -EAGAIN; | 864 | return -EAGAIN; |
866 | } | 865 | } |
867 | 866 | ||
diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c index b4066a001ba0..ccfdfb24b240 100644 --- a/drivers/usb/phy/phy.c +++ b/drivers/usb/phy/phy.c | |||
@@ -34,7 +34,7 @@ static struct usb_phy *__usb_find_phy(struct list_head *list, | |||
34 | return phy; | 34 | return phy; |
35 | } | 35 | } |
36 | 36 | ||
37 | return ERR_PTR(-ENODEV); | 37 | return ERR_PTR(-EPROBE_DEFER); |
38 | } | 38 | } |
39 | 39 | ||
40 | static struct usb_phy *__usb_find_phy_dev(struct device *dev, | 40 | static struct usb_phy *__usb_find_phy_dev(struct device *dev, |
@@ -59,6 +59,9 @@ static struct usb_phy *__of_usb_find_phy(struct device_node *node) | |||
59 | { | 59 | { |
60 | struct usb_phy *phy; | 60 | struct usb_phy *phy; |
61 | 61 | ||
62 | if (!of_device_is_available(node)) | ||
63 | return ERR_PTR(-ENODEV); | ||
64 | |||
62 | list_for_each_entry(phy, &phy_list, head) { | 65 | list_for_each_entry(phy, &phy_list, head) { |
63 | if (node != phy->dev->of_node) | 66 | if (node != phy->dev->of_node) |
64 | continue; | 67 | continue; |
@@ -66,7 +69,7 @@ static struct usb_phy *__of_usb_find_phy(struct device_node *node) | |||
66 | return phy; | 69 | return phy; |
67 | } | 70 | } |
68 | 71 | ||
69 | return ERR_PTR(-ENODEV); | 72 | return ERR_PTR(-EPROBE_DEFER); |
70 | } | 73 | } |
71 | 74 | ||
72 | static void devm_usb_phy_release(struct device *dev, void *res) | 75 | static void devm_usb_phy_release(struct device *dev, void *res) |
@@ -190,10 +193,13 @@ struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev, | |||
190 | spin_lock_irqsave(&phy_lock, flags); | 193 | spin_lock_irqsave(&phy_lock, flags); |
191 | 194 | ||
192 | phy = __of_usb_find_phy(node); | 195 | phy = __of_usb_find_phy(node); |
193 | if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) { | 196 | if (IS_ERR(phy)) { |
194 | if (!IS_ERR(phy)) | 197 | devres_free(ptr); |
195 | phy = ERR_PTR(-EPROBE_DEFER); | 198 | goto err1; |
199 | } | ||
196 | 200 | ||
201 | if (!try_module_get(phy->dev->driver->owner)) { | ||
202 | phy = ERR_PTR(-ENODEV); | ||
197 | devres_free(ptr); | 203 | devres_free(ptr); |
198 | goto err1; | 204 | goto err1; |
199 | } | 205 | } |
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c index 8d7fc48b1f30..29fa1c3d0089 100644 --- a/drivers/usb/serial/console.c +++ b/drivers/usb/serial/console.c | |||
@@ -46,6 +46,8 @@ static struct console usbcons; | |||
46 | * ------------------------------------------------------------ | 46 | * ------------------------------------------------------------ |
47 | */ | 47 | */ |
48 | 48 | ||
49 | static const struct tty_operations usb_console_fake_tty_ops = { | ||
50 | }; | ||
49 | 51 | ||
50 | /* | 52 | /* |
51 | * The parsing of the command line works exactly like the | 53 | * The parsing of the command line works exactly like the |
@@ -137,13 +139,17 @@ static int usb_console_setup(struct console *co, char *options) | |||
137 | goto reset_open_count; | 139 | goto reset_open_count; |
138 | } | 140 | } |
139 | kref_init(&tty->kref); | 141 | kref_init(&tty->kref); |
140 | tty_port_tty_set(&port->port, tty); | ||
141 | tty->driver = usb_serial_tty_driver; | 142 | tty->driver = usb_serial_tty_driver; |
142 | tty->index = co->index; | 143 | tty->index = co->index; |
144 | init_ldsem(&tty->ldisc_sem); | ||
145 | INIT_LIST_HEAD(&tty->tty_files); | ||
146 | kref_get(&tty->driver->kref); | ||
147 | tty->ops = &usb_console_fake_tty_ops; | ||
143 | if (tty_init_termios(tty)) { | 148 | if (tty_init_termios(tty)) { |
144 | retval = -ENOMEM; | 149 | retval = -ENOMEM; |
145 | goto free_tty; | 150 | goto put_tty; |
146 | } | 151 | } |
152 | tty_port_tty_set(&port->port, tty); | ||
147 | } | 153 | } |
148 | 154 | ||
149 | /* only call the device specific open if this | 155 | /* only call the device specific open if this |
@@ -161,7 +167,7 @@ static int usb_console_setup(struct console *co, char *options) | |||
161 | serial->type->set_termios(tty, port, &dummy); | 167 | serial->type->set_termios(tty, port, &dummy); |
162 | 168 | ||
163 | tty_port_tty_set(&port->port, NULL); | 169 | tty_port_tty_set(&port->port, NULL); |
164 | kfree(tty); | 170 | tty_kref_put(tty); |
165 | } | 171 | } |
166 | set_bit(ASYNCB_INITIALIZED, &port->port.flags); | 172 | set_bit(ASYNCB_INITIALIZED, &port->port.flags); |
167 | } | 173 | } |
@@ -177,8 +183,8 @@ static int usb_console_setup(struct console *co, char *options) | |||
177 | 183 | ||
178 | fail: | 184 | fail: |
179 | tty_port_tty_set(&port->port, NULL); | 185 | tty_port_tty_set(&port->port, NULL); |
180 | free_tty: | 186 | put_tty: |
181 | kfree(tty); | 187 | tty_kref_put(tty); |
182 | reset_open_count: | 188 | reset_open_count: |
183 | port->port.count = 0; | 189 | port->port.count = 0; |
184 | usb_autopm_put_interface(serial->interface); | 190 | usb_autopm_put_interface(serial->interface); |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 6c4eb3cf5efd..f4c56fc1a9f6 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -120,10 +120,12 @@ static const struct usb_device_id id_table[] = { | |||
120 | { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */ | 120 | { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */ |
121 | { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */ | 121 | { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */ |
122 | { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */ | 122 | { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */ |
123 | { USB_DEVICE(0x10C4, 0x8875) }, /* CEL MeshConnect USB Stick */ | 123 | { USB_DEVICE(0x10C4, 0x8856) }, /* CEL EM357 ZigBee USB Stick - LR */ |
124 | { USB_DEVICE(0x10C4, 0x8857) }, /* CEL EM357 ZigBee USB Stick */ | ||
124 | { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ | 125 | { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ |
125 | { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ | 126 | { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ |
126 | { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ | 127 | { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ |
128 | { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */ | ||
127 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ | 129 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ |
128 | { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ | 130 | { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ |
129 | { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */ | 131 | { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */ |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 1bd192290b08..ccf1df7c4b80 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -286,7 +286,7 @@ static int usb_serial_generic_submit_read_urb(struct usb_serial_port *port, | |||
286 | 286 | ||
287 | res = usb_submit_urb(port->read_urbs[index], mem_flags); | 287 | res = usb_submit_urb(port->read_urbs[index], mem_flags); |
288 | if (res) { | 288 | if (res) { |
289 | if (res != -EPERM) { | 289 | if (res != -EPERM && res != -ENODEV) { |
290 | dev_err(&port->dev, | 290 | dev_err(&port->dev, |
291 | "%s - usb_submit_urb failed: %d\n", | 291 | "%s - usb_submit_urb failed: %d\n", |
292 | __func__, res); | 292 | __func__, res); |
@@ -373,7 +373,7 @@ void usb_serial_generic_read_bulk_callback(struct urb *urb) | |||
373 | __func__, urb->status); | 373 | __func__, urb->status); |
374 | return; | 374 | return; |
375 | default: | 375 | default: |
376 | dev_err(&port->dev, "%s - nonzero urb status: %d\n", | 376 | dev_dbg(&port->dev, "%s - nonzero urb status: %d\n", |
377 | __func__, urb->status); | 377 | __func__, urb->status); |
378 | goto resubmit; | 378 | goto resubmit; |
379 | } | 379 | } |
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 077c714f1285..e07b15ed5814 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -410,6 +410,8 @@ static void usa26_instat_callback(struct urb *urb) | |||
410 | } | 410 | } |
411 | port = serial->port[msg->port]; | 411 | port = serial->port[msg->port]; |
412 | p_priv = usb_get_serial_port_data(port); | 412 | p_priv = usb_get_serial_port_data(port); |
413 | if (!p_priv) | ||
414 | goto resubmit; | ||
413 | 415 | ||
414 | /* Update handshaking pin state information */ | 416 | /* Update handshaking pin state information */ |
415 | old_dcd_state = p_priv->dcd_state; | 417 | old_dcd_state = p_priv->dcd_state; |
@@ -420,7 +422,7 @@ static void usa26_instat_callback(struct urb *urb) | |||
420 | 422 | ||
421 | if (old_dcd_state != p_priv->dcd_state) | 423 | if (old_dcd_state != p_priv->dcd_state) |
422 | tty_port_tty_hangup(&port->port, true); | 424 | tty_port_tty_hangup(&port->port, true); |
423 | 425 | resubmit: | |
424 | /* Resubmit urb so we continue receiving */ | 426 | /* Resubmit urb so we continue receiving */ |
425 | err = usb_submit_urb(urb, GFP_ATOMIC); | 427 | err = usb_submit_urb(urb, GFP_ATOMIC); |
426 | if (err != 0) | 428 | if (err != 0) |
@@ -527,6 +529,8 @@ static void usa28_instat_callback(struct urb *urb) | |||
527 | } | 529 | } |
528 | port = serial->port[msg->port]; | 530 | port = serial->port[msg->port]; |
529 | p_priv = usb_get_serial_port_data(port); | 531 | p_priv = usb_get_serial_port_data(port); |
532 | if (!p_priv) | ||
533 | goto resubmit; | ||
530 | 534 | ||
531 | /* Update handshaking pin state information */ | 535 | /* Update handshaking pin state information */ |
532 | old_dcd_state = p_priv->dcd_state; | 536 | old_dcd_state = p_priv->dcd_state; |
@@ -537,7 +541,7 @@ static void usa28_instat_callback(struct urb *urb) | |||
537 | 541 | ||
538 | if (old_dcd_state != p_priv->dcd_state && old_dcd_state) | 542 | if (old_dcd_state != p_priv->dcd_state && old_dcd_state) |
539 | tty_port_tty_hangup(&port->port, true); | 543 | tty_port_tty_hangup(&port->port, true); |
540 | 544 | resubmit: | |
541 | /* Resubmit urb so we continue receiving */ | 545 | /* Resubmit urb so we continue receiving */ |
542 | err = usb_submit_urb(urb, GFP_ATOMIC); | 546 | err = usb_submit_urb(urb, GFP_ATOMIC); |
543 | if (err != 0) | 547 | if (err != 0) |
@@ -607,6 +611,8 @@ static void usa49_instat_callback(struct urb *urb) | |||
607 | } | 611 | } |
608 | port = serial->port[msg->portNumber]; | 612 | port = serial->port[msg->portNumber]; |
609 | p_priv = usb_get_serial_port_data(port); | 613 | p_priv = usb_get_serial_port_data(port); |
614 | if (!p_priv) | ||
615 | goto resubmit; | ||
610 | 616 | ||
611 | /* Update handshaking pin state information */ | 617 | /* Update handshaking pin state information */ |
612 | old_dcd_state = p_priv->dcd_state; | 618 | old_dcd_state = p_priv->dcd_state; |
@@ -617,7 +623,7 @@ static void usa49_instat_callback(struct urb *urb) | |||
617 | 623 | ||
618 | if (old_dcd_state != p_priv->dcd_state && old_dcd_state) | 624 | if (old_dcd_state != p_priv->dcd_state && old_dcd_state) |
619 | tty_port_tty_hangup(&port->port, true); | 625 | tty_port_tty_hangup(&port->port, true); |
620 | 626 | resubmit: | |
621 | /* Resubmit urb so we continue receiving */ | 627 | /* Resubmit urb so we continue receiving */ |
622 | err = usb_submit_urb(urb, GFP_ATOMIC); | 628 | err = usb_submit_urb(urb, GFP_ATOMIC); |
623 | if (err != 0) | 629 | if (err != 0) |
@@ -855,6 +861,8 @@ static void usa90_instat_callback(struct urb *urb) | |||
855 | 861 | ||
856 | port = serial->port[0]; | 862 | port = serial->port[0]; |
857 | p_priv = usb_get_serial_port_data(port); | 863 | p_priv = usb_get_serial_port_data(port); |
864 | if (!p_priv) | ||
865 | goto resubmit; | ||
858 | 866 | ||
859 | /* Update handshaking pin state information */ | 867 | /* Update handshaking pin state information */ |
860 | old_dcd_state = p_priv->dcd_state; | 868 | old_dcd_state = p_priv->dcd_state; |
@@ -865,7 +873,7 @@ static void usa90_instat_callback(struct urb *urb) | |||
865 | 873 | ||
866 | if (old_dcd_state != p_priv->dcd_state && old_dcd_state) | 874 | if (old_dcd_state != p_priv->dcd_state && old_dcd_state) |
867 | tty_port_tty_hangup(&port->port, true); | 875 | tty_port_tty_hangup(&port->port, true); |
868 | 876 | resubmit: | |
869 | /* Resubmit urb so we continue receiving */ | 877 | /* Resubmit urb so we continue receiving */ |
870 | err = usb_submit_urb(urb, GFP_ATOMIC); | 878 | err = usb_submit_urb(urb, GFP_ATOMIC); |
871 | if (err != 0) | 879 | if (err != 0) |
@@ -926,6 +934,8 @@ static void usa67_instat_callback(struct urb *urb) | |||
926 | 934 | ||
927 | port = serial->port[msg->port]; | 935 | port = serial->port[msg->port]; |
928 | p_priv = usb_get_serial_port_data(port); | 936 | p_priv = usb_get_serial_port_data(port); |
937 | if (!p_priv) | ||
938 | goto resubmit; | ||
929 | 939 | ||
930 | /* Update handshaking pin state information */ | 940 | /* Update handshaking pin state information */ |
931 | old_dcd_state = p_priv->dcd_state; | 941 | old_dcd_state = p_priv->dcd_state; |
@@ -934,7 +944,7 @@ static void usa67_instat_callback(struct urb *urb) | |||
934 | 944 | ||
935 | if (old_dcd_state != p_priv->dcd_state && old_dcd_state) | 945 | if (old_dcd_state != p_priv->dcd_state && old_dcd_state) |
936 | tty_port_tty_hangup(&port->port, true); | 946 | tty_port_tty_hangup(&port->port, true); |
937 | 947 | resubmit: | |
938 | /* Resubmit urb so we continue receiving */ | 948 | /* Resubmit urb so we continue receiving */ |
939 | err = usb_submit_urb(urb, GFP_ATOMIC); | 949 | err = usb_submit_urb(urb, GFP_ATOMIC); |
940 | if (err != 0) | 950 | if (err != 0) |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 7a4c21b4f676..efdcee15b520 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -234,6 +234,8 @@ static void option_instat_callback(struct urb *urb); | |||
234 | 234 | ||
235 | #define QUALCOMM_VENDOR_ID 0x05C6 | 235 | #define QUALCOMM_VENDOR_ID 0x05C6 |
236 | 236 | ||
237 | #define SIERRA_VENDOR_ID 0x1199 | ||
238 | |||
237 | #define CMOTECH_VENDOR_ID 0x16d8 | 239 | #define CMOTECH_VENDOR_ID 0x16d8 |
238 | #define CMOTECH_PRODUCT_6001 0x6001 | 240 | #define CMOTECH_PRODUCT_6001 0x6001 |
239 | #define CMOTECH_PRODUCT_CMU_300 0x6002 | 241 | #define CMOTECH_PRODUCT_CMU_300 0x6002 |
@@ -512,7 +514,7 @@ enum option_blacklist_reason { | |||
512 | OPTION_BLACKLIST_RESERVED_IF = 2 | 514 | OPTION_BLACKLIST_RESERVED_IF = 2 |
513 | }; | 515 | }; |
514 | 516 | ||
515 | #define MAX_BL_NUM 8 | 517 | #define MAX_BL_NUM 11 |
516 | struct option_blacklist_info { | 518 | struct option_blacklist_info { |
517 | /* bitfield of interface numbers for OPTION_BLACKLIST_SENDSETUP */ | 519 | /* bitfield of interface numbers for OPTION_BLACKLIST_SENDSETUP */ |
518 | const unsigned long sendsetup; | 520 | const unsigned long sendsetup; |
@@ -601,6 +603,11 @@ static const struct option_blacklist_info telit_le920_blacklist = { | |||
601 | .reserved = BIT(1) | BIT(5), | 603 | .reserved = BIT(1) | BIT(5), |
602 | }; | 604 | }; |
603 | 605 | ||
606 | static const struct option_blacklist_info sierra_mc73xx_blacklist = { | ||
607 | .sendsetup = BIT(0) | BIT(2), | ||
608 | .reserved = BIT(8) | BIT(10) | BIT(11), | ||
609 | }; | ||
610 | |||
604 | static const struct usb_device_id option_ids[] = { | 611 | static const struct usb_device_id option_ids[] = { |
605 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, | 612 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, |
606 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, | 613 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, |
@@ -1098,6 +1105,8 @@ static const struct usb_device_id option_ids[] = { | |||
1098 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ | 1105 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ |
1099 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ | 1106 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ |
1100 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ | 1107 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ |
1108 | { USB_DEVICE_INTERFACE_CLASS(SIERRA_VENDOR_ID, 0x68c0, 0xff), | ||
1109 | .driver_info = (kernel_ulong_t)&sierra_mc73xx_blacklist }, /* MC73xx */ | ||
1101 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, | 1110 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, |
1102 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, | 1111 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, |
1103 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003), | 1112 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003), |
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index cb3e14780a7e..9c63897b3a56 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
@@ -142,7 +142,6 @@ static const struct usb_device_id id_table[] = { | |||
142 | {DEVICE_SWI(0x0f3d, 0x68a2)}, /* Sierra Wireless MC7700 */ | 142 | {DEVICE_SWI(0x0f3d, 0x68a2)}, /* Sierra Wireless MC7700 */ |
143 | {DEVICE_SWI(0x114f, 0x68a2)}, /* Sierra Wireless MC7750 */ | 143 | {DEVICE_SWI(0x114f, 0x68a2)}, /* Sierra Wireless MC7750 */ |
144 | {DEVICE_SWI(0x1199, 0x68a2)}, /* Sierra Wireless MC7710 */ | 144 | {DEVICE_SWI(0x1199, 0x68a2)}, /* Sierra Wireless MC7710 */ |
145 | {DEVICE_SWI(0x1199, 0x68c0)}, /* Sierra Wireless MC73xx */ | ||
146 | {DEVICE_SWI(0x1199, 0x901c)}, /* Sierra Wireless EM7700 */ | 145 | {DEVICE_SWI(0x1199, 0x901c)}, /* Sierra Wireless EM7700 */ |
147 | {DEVICE_SWI(0x1199, 0x901f)}, /* Sierra Wireless EM7355 */ | 146 | {DEVICE_SWI(0x1199, 0x901f)}, /* Sierra Wireless EM7355 */ |
148 | {DEVICE_SWI(0x1199, 0x9040)}, /* Sierra Wireless Modem */ | 147 | {DEVICE_SWI(0x1199, 0x9040)}, /* Sierra Wireless Modem */ |
diff --git a/drivers/usb/storage/uas-detect.h b/drivers/usb/storage/uas-detect.h index 8a6f371ed6e7..9893d696fc97 100644 --- a/drivers/usb/storage/uas-detect.h +++ b/drivers/usb/storage/uas-detect.h | |||
@@ -69,16 +69,39 @@ static int uas_use_uas_driver(struct usb_interface *intf, | |||
69 | return 0; | 69 | return 0; |
70 | 70 | ||
71 | /* | 71 | /* |
72 | * ASM1051 and older ASM1053 devices have the same usb-id, and UAS is | 72 | * ASMedia has a number of usb3 to sata bridge chips, at the time of |
73 | * broken on the ASM1051, use the number of streams to differentiate. | 73 | * this writing the following versions exist: |
74 | * New ASM1053-s also support 32 streams, but have a different prod-id. | 74 | * ASM1051 - no uas support version |
75 | * ASM1051 - with broken (*) uas support | ||
76 | * ASM1053 - with working uas support | ||
77 | * ASM1153 - with working uas support | ||
78 | * | ||
79 | * Devices with these chips re-use a number of device-ids over the | ||
80 | * entire line, so the device-id is useless to determine if we're | ||
81 | * dealing with an ASM1051 (which we want to avoid). | ||
82 | * | ||
83 | * The ASM1153 can be identified by config.MaxPower == 0, | ||
84 | * where as the ASM105x models have config.MaxPower == 36. | ||
85 | * | ||
86 | * Differentiating between the ASM1053 and ASM1051 is trickier, when | ||
87 | * connected over USB-3 we can look at the number of streams supported, | ||
88 | * ASM1051 supports 32 streams, where as early ASM1053 versions support | ||
89 | * 16 streams, newer ASM1053-s also support 32 streams, but have a | ||
90 | * different prod-id. | ||
91 | * | ||
92 | * (*) ASM1051 chips do work with UAS with some disks (with the | ||
93 | * US_FL_NO_REPORT_OPCODES quirk), but are broken with other disks | ||
75 | */ | 94 | */ |
76 | if (le16_to_cpu(udev->descriptor.idVendor) == 0x174c && | 95 | if (le16_to_cpu(udev->descriptor.idVendor) == 0x174c && |
77 | le16_to_cpu(udev->descriptor.idProduct) == 0x55aa) { | 96 | (le16_to_cpu(udev->descriptor.idProduct) == 0x5106 || |
78 | if (udev->speed < USB_SPEED_SUPER) { | 97 | le16_to_cpu(udev->descriptor.idProduct) == 0x55aa)) { |
98 | if (udev->actconfig->desc.bMaxPower == 0) { | ||
99 | /* ASM1153, do nothing */ | ||
100 | } else if (udev->speed < USB_SPEED_SUPER) { | ||
79 | /* No streams info, assume ASM1051 */ | 101 | /* No streams info, assume ASM1051 */ |
80 | flags |= US_FL_IGNORE_UAS; | 102 | flags |= US_FL_IGNORE_UAS; |
81 | } else if (usb_ss_max_streams(&eps[1]->ss_ep_comp) == 32) { | 103 | } else if (usb_ss_max_streams(&eps[1]->ss_ep_comp) == 32) { |
104 | /* Possibly an ASM1051, disable uas */ | ||
82 | flags |= US_FL_IGNORE_UAS; | 105 | flags |= US_FL_IGNORE_UAS; |
83 | } | 106 | } |
84 | } | 107 | } |
diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h index 18a283d6de1c..6df4357d9ee3 100644 --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h | |||
@@ -40,6 +40,16 @@ | |||
40 | * and don't forget to CC: the USB development list <linux-usb@vger.kernel.org> | 40 | * and don't forget to CC: the USB development list <linux-usb@vger.kernel.org> |
41 | */ | 41 | */ |
42 | 42 | ||
43 | /* | ||
44 | * Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SCSI | ||
45 | * commands in UAS mode. Observed with the 1.28 firmware; are there others? | ||
46 | */ | ||
47 | UNUSUAL_DEV(0x0984, 0x0301, 0x0128, 0x0128, | ||
48 | "Apricorn", | ||
49 | "", | ||
50 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
51 | US_FL_IGNORE_UAS), | ||
52 | |||
43 | /* https://bugzilla.kernel.org/show_bug.cgi?id=79511 */ | 53 | /* https://bugzilla.kernel.org/show_bug.cgi?id=79511 */ |
44 | UNUSUAL_DEV(0x0bc2, 0x2312, 0x0000, 0x9999, | 54 | UNUSUAL_DEV(0x0bc2, 0x2312, 0x0000, 0x9999, |
45 | "Seagate", | 55 | "Seagate", |
@@ -68,6 +78,20 @@ UNUSUAL_DEV(0x0bc2, 0xa003, 0x0000, 0x9999, | |||
68 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 78 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
69 | US_FL_NO_ATA_1X), | 79 | US_FL_NO_ATA_1X), |
70 | 80 | ||
81 | /* Reported-by: Marcin ZajÄ…czkowski <mszpak@wp.pl> */ | ||
82 | UNUSUAL_DEV(0x0bc2, 0xa013, 0x0000, 0x9999, | ||
83 | "Seagate", | ||
84 | "Backup Plus", | ||
85 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
86 | US_FL_NO_ATA_1X), | ||
87 | |||
88 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ | ||
89 | UNUSUAL_DEV(0x0bc2, 0xa0a4, 0x0000, 0x9999, | ||
90 | "Seagate", | ||
91 | "Backup Plus Desk", | ||
92 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
93 | US_FL_NO_ATA_1X), | ||
94 | |||
71 | /* https://bbs.archlinux.org/viewtopic.php?id=183190 */ | 95 | /* https://bbs.archlinux.org/viewtopic.php?id=183190 */ |
72 | UNUSUAL_DEV(0x0bc2, 0xab20, 0x0000, 0x9999, | 96 | UNUSUAL_DEV(0x0bc2, 0xab20, 0x0000, 0x9999, |
73 | "Seagate", | 97 | "Seagate", |
@@ -82,6 +106,13 @@ UNUSUAL_DEV(0x0bc2, 0xab21, 0x0000, 0x9999, | |||
82 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 106 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
83 | US_FL_NO_ATA_1X), | 107 | US_FL_NO_ATA_1X), |
84 | 108 | ||
109 | /* Reported-by: G. Richard Bellamy <rbellamy@pteradigm.com> */ | ||
110 | UNUSUAL_DEV(0x0bc2, 0xab2a, 0x0000, 0x9999, | ||
111 | "Seagate", | ||
112 | "BUP Fast HDD", | ||
113 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
114 | US_FL_NO_ATA_1X), | ||
115 | |||
85 | /* Reported-by: Claudio Bizzarri <claudio.bizzarri@gmail.com> */ | 116 | /* Reported-by: Claudio Bizzarri <claudio.bizzarri@gmail.com> */ |
86 | UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999, | 117 | UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999, |
87 | "JMicron", | 118 | "JMicron", |
@@ -89,14 +120,6 @@ UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999, | |||
89 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 120 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
90 | US_FL_NO_REPORT_OPCODES), | 121 | US_FL_NO_REPORT_OPCODES), |
91 | 122 | ||
92 | /* Most ASM1051 based devices have issues with uas, blacklist them all */ | ||
93 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ | ||
94 | UNUSUAL_DEV(0x174c, 0x5106, 0x0000, 0x9999, | ||
95 | "ASMedia", | ||
96 | "ASM1051", | ||
97 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
98 | US_FL_IGNORE_UAS), | ||
99 | |||
100 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ | 123 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ |
101 | UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, | 124 | UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, |
102 | "VIA", | 125 | "VIA", |
@@ -104,6 +127,13 @@ UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, | |||
104 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 127 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
105 | US_FL_NO_ATA_1X), | 128 | US_FL_NO_ATA_1X), |
106 | 129 | ||
130 | /* Reported-by: Takeo Nakayama <javhera@gmx.com> */ | ||
131 | UNUSUAL_DEV(0x357d, 0x7788, 0x0000, 0x9999, | ||
132 | "JMicron", | ||
133 | "JMS566", | ||
134 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
135 | US_FL_NO_REPORT_OPCODES), | ||
136 | |||
107 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ | 137 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ |
108 | UNUSUAL_DEV(0x4971, 0x1012, 0x0000, 0x9999, | 138 | UNUSUAL_DEV(0x4971, 0x1012, 0x0000, 0x9999, |
109 | "Hitachi", | 139 | "Hitachi", |
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 255201f22126..7cc0122a18ce 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c | |||
@@ -840,13 +840,11 @@ static const struct vfio_device_ops vfio_pci_ops = { | |||
840 | 840 | ||
841 | static int vfio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | 841 | static int vfio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
842 | { | 842 | { |
843 | u8 type; | ||
844 | struct vfio_pci_device *vdev; | 843 | struct vfio_pci_device *vdev; |
845 | struct iommu_group *group; | 844 | struct iommu_group *group; |
846 | int ret; | 845 | int ret; |
847 | 846 | ||
848 | pci_read_config_byte(pdev, PCI_HEADER_TYPE, &type); | 847 | if (pdev->hdr_type != PCI_HEADER_TYPE_NORMAL) |
849 | if ((type & PCI_HEADER_TYPE) != PCI_HEADER_TYPE_NORMAL) | ||
850 | return -EINVAL; | 848 | return -EINVAL; |
851 | 849 | ||
852 | group = iommu_group_get(&pdev->dev); | 850 | group = iommu_group_get(&pdev->dev); |
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 14419a8ccbb6..d415d69dc237 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -538,7 +538,7 @@ static int get_rx_bufs(struct vhost_virtqueue *vq, | |||
538 | ++headcount; | 538 | ++headcount; |
539 | seg += in; | 539 | seg += in; |
540 | } | 540 | } |
541 | heads[headcount - 1].len = cpu_to_vhost32(vq, len - datalen); | 541 | heads[headcount - 1].len = cpu_to_vhost32(vq, len + datalen); |
542 | *iovcount = seg; | 542 | *iovcount = seg; |
543 | if (unlikely(log)) | 543 | if (unlikely(log)) |
544 | *log_num = nlogs; | 544 | *log_num = nlogs; |
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 01c01cb3933f..d695b1673ae5 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
@@ -911,6 +911,23 @@ vhost_scsi_map_iov_to_prot(struct tcm_vhost_cmd *cmd, | |||
911 | return 0; | 911 | return 0; |
912 | } | 912 | } |
913 | 913 | ||
914 | static int vhost_scsi_to_tcm_attr(int attr) | ||
915 | { | ||
916 | switch (attr) { | ||
917 | case VIRTIO_SCSI_S_SIMPLE: | ||
918 | return TCM_SIMPLE_TAG; | ||
919 | case VIRTIO_SCSI_S_ORDERED: | ||
920 | return TCM_ORDERED_TAG; | ||
921 | case VIRTIO_SCSI_S_HEAD: | ||
922 | return TCM_HEAD_TAG; | ||
923 | case VIRTIO_SCSI_S_ACA: | ||
924 | return TCM_ACA_TAG; | ||
925 | default: | ||
926 | break; | ||
927 | } | ||
928 | return TCM_SIMPLE_TAG; | ||
929 | } | ||
930 | |||
914 | static void tcm_vhost_submission_work(struct work_struct *work) | 931 | static void tcm_vhost_submission_work(struct work_struct *work) |
915 | { | 932 | { |
916 | struct tcm_vhost_cmd *cmd = | 933 | struct tcm_vhost_cmd *cmd = |
@@ -936,9 +953,10 @@ static void tcm_vhost_submission_work(struct work_struct *work) | |||
936 | rc = target_submit_cmd_map_sgls(se_cmd, tv_nexus->tvn_se_sess, | 953 | rc = target_submit_cmd_map_sgls(se_cmd, tv_nexus->tvn_se_sess, |
937 | cmd->tvc_cdb, &cmd->tvc_sense_buf[0], | 954 | cmd->tvc_cdb, &cmd->tvc_sense_buf[0], |
938 | cmd->tvc_lun, cmd->tvc_exp_data_len, | 955 | cmd->tvc_lun, cmd->tvc_exp_data_len, |
939 | cmd->tvc_task_attr, cmd->tvc_data_direction, | 956 | vhost_scsi_to_tcm_attr(cmd->tvc_task_attr), |
940 | TARGET_SCF_ACK_KREF, sg_ptr, cmd->tvc_sgl_count, | 957 | cmd->tvc_data_direction, TARGET_SCF_ACK_KREF, |
941 | NULL, 0, sg_prot_ptr, cmd->tvc_prot_sgl_count); | 958 | sg_ptr, cmd->tvc_sgl_count, NULL, 0, sg_prot_ptr, |
959 | cmd->tvc_prot_sgl_count); | ||
942 | if (rc < 0) { | 960 | if (rc < 0) { |
943 | transport_send_check_condition_and_sense(se_cmd, | 961 | transport_send_check_condition_and_sense(se_cmd, |
944 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); | 962 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); |
diff --git a/drivers/video/fbdev/broadsheetfb.c b/drivers/video/fbdev/broadsheetfb.c index 1c29bd19e3d5..0e5fde1d3ffb 100644 --- a/drivers/video/fbdev/broadsheetfb.c +++ b/drivers/video/fbdev/broadsheetfb.c | |||
@@ -636,7 +636,7 @@ static int broadsheet_spiflash_rewrite_sector(struct broadsheetfb_par *par, | |||
636 | err = broadsheet_spiflash_read_range(par, start_sector_addr, | 636 | err = broadsheet_spiflash_read_range(par, start_sector_addr, |
637 | data_start_addr, sector_buffer); | 637 | data_start_addr, sector_buffer); |
638 | if (err) | 638 | if (err) |
639 | return err; | 639 | goto out; |
640 | } | 640 | } |
641 | 641 | ||
642 | /* now we copy our data into the right place in the sector buffer */ | 642 | /* now we copy our data into the right place in the sector buffer */ |
@@ -657,7 +657,7 @@ static int broadsheet_spiflash_rewrite_sector(struct broadsheetfb_par *par, | |||
657 | err = broadsheet_spiflash_read_range(par, tail_start_addr, | 657 | err = broadsheet_spiflash_read_range(par, tail_start_addr, |
658 | tail_len, sector_buffer + tail_start_addr); | 658 | tail_len, sector_buffer + tail_start_addr); |
659 | if (err) | 659 | if (err) |
660 | return err; | 660 | goto out; |
661 | } | 661 | } |
662 | 662 | ||
663 | /* if we got here we have the full sector that we want to rewrite. */ | 663 | /* if we got here we have the full sector that we want to rewrite. */ |
@@ -665,11 +665,13 @@ static int broadsheet_spiflash_rewrite_sector(struct broadsheetfb_par *par, | |||
665 | /* first erase the sector */ | 665 | /* first erase the sector */ |
666 | err = broadsheet_spiflash_erase_sector(par, start_sector_addr); | 666 | err = broadsheet_spiflash_erase_sector(par, start_sector_addr); |
667 | if (err) | 667 | if (err) |
668 | return err; | 668 | goto out; |
669 | 669 | ||
670 | /* now write it */ | 670 | /* now write it */ |
671 | err = broadsheet_spiflash_write_sector(par, start_sector_addr, | 671 | err = broadsheet_spiflash_write_sector(par, start_sector_addr, |
672 | sector_buffer, sector_size); | 672 | sector_buffer, sector_size); |
673 | out: | ||
674 | kfree(sector_buffer); | ||
673 | return err; | 675 | return err; |
674 | } | 676 | } |
675 | 677 | ||
diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c index 92cac803dee3..1085c0432158 100644 --- a/drivers/video/fbdev/simplefb.c +++ b/drivers/video/fbdev/simplefb.c | |||
@@ -402,7 +402,7 @@ static int __init simplefb_init(void) | |||
402 | if (ret) | 402 | if (ret) |
403 | return ret; | 403 | return ret; |
404 | 404 | ||
405 | if (IS_ENABLED(CONFIG_OF) && of_chosen) { | 405 | if (IS_ENABLED(CONFIG_OF_ADDRESS) && of_chosen) { |
406 | for_each_child_of_node(of_chosen, np) { | 406 | for_each_child_of_node(of_chosen, np) { |
407 | if (of_device_is_compatible(np, "simple-framebuffer")) | 407 | if (of_device_is_compatible(np, "simple-framebuffer")) |
408 | of_platform_device_create(np, NULL, NULL); | 408 | of_platform_device_create(np, NULL, NULL); |
diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c index 2ef9529809d8..9756f21b809e 100644 --- a/drivers/virtio/virtio_pci_common.c +++ b/drivers/virtio/virtio_pci_common.c | |||
@@ -282,6 +282,7 @@ void vp_del_vqs(struct virtio_device *vdev) | |||
282 | 282 | ||
283 | vp_free_vectors(vdev); | 283 | vp_free_vectors(vdev); |
284 | kfree(vp_dev->vqs); | 284 | kfree(vp_dev->vqs); |
285 | vp_dev->vqs = NULL; | ||
285 | } | 286 | } |
286 | 287 | ||
287 | static int vp_try_to_find_vqs(struct virtio_device *vdev, unsigned nvqs, | 288 | static int vp_try_to_find_vqs(struct virtio_device *vdev, unsigned nvqs, |
@@ -421,15 +422,6 @@ int vp_set_vq_affinity(struct virtqueue *vq, int cpu) | |||
421 | return 0; | 422 | return 0; |
422 | } | 423 | } |
423 | 424 | ||
424 | void virtio_pci_release_dev(struct device *_d) | ||
425 | { | ||
426 | /* | ||
427 | * No need for a release method as we allocate/free | ||
428 | * all devices together with the pci devices. | ||
429 | * Provide an empty one to avoid getting a warning from core. | ||
430 | */ | ||
431 | } | ||
432 | |||
433 | #ifdef CONFIG_PM_SLEEP | 425 | #ifdef CONFIG_PM_SLEEP |
434 | static int virtio_pci_freeze(struct device *dev) | 426 | static int virtio_pci_freeze(struct device *dev) |
435 | { | 427 | { |
diff --git a/drivers/virtio/virtio_pci_common.h b/drivers/virtio/virtio_pci_common.h index adddb647b21d..5a497289b7e9 100644 --- a/drivers/virtio/virtio_pci_common.h +++ b/drivers/virtio/virtio_pci_common.h | |||
@@ -126,7 +126,6 @@ const char *vp_bus_name(struct virtio_device *vdev); | |||
126 | * - ignore the affinity request if we're using INTX | 126 | * - ignore the affinity request if we're using INTX |
127 | */ | 127 | */ |
128 | int vp_set_vq_affinity(struct virtqueue *vq, int cpu); | 128 | int vp_set_vq_affinity(struct virtqueue *vq, int cpu); |
129 | void virtio_pci_release_dev(struct device *); | ||
130 | 129 | ||
131 | int virtio_pci_legacy_probe(struct pci_dev *pci_dev, | 130 | int virtio_pci_legacy_probe(struct pci_dev *pci_dev, |
132 | const struct pci_device_id *id); | 131 | const struct pci_device_id *id); |
diff --git a/drivers/virtio/virtio_pci_legacy.c b/drivers/virtio/virtio_pci_legacy.c index 6c76f0f5658c..a5486e65e04b 100644 --- a/drivers/virtio/virtio_pci_legacy.c +++ b/drivers/virtio/virtio_pci_legacy.c | |||
@@ -211,6 +211,17 @@ static const struct virtio_config_ops virtio_pci_config_ops = { | |||
211 | .set_vq_affinity = vp_set_vq_affinity, | 211 | .set_vq_affinity = vp_set_vq_affinity, |
212 | }; | 212 | }; |
213 | 213 | ||
214 | static void virtio_pci_release_dev(struct device *_d) | ||
215 | { | ||
216 | struct virtio_device *vdev = dev_to_virtio(_d); | ||
217 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); | ||
218 | |||
219 | /* As struct device is a kobject, it's not safe to | ||
220 | * free the memory (including the reference counter itself) | ||
221 | * until it's release callback. */ | ||
222 | kfree(vp_dev); | ||
223 | } | ||
224 | |||
214 | /* the PCI probing function */ | 225 | /* the PCI probing function */ |
215 | int virtio_pci_legacy_probe(struct pci_dev *pci_dev, | 226 | int virtio_pci_legacy_probe(struct pci_dev *pci_dev, |
216 | const struct pci_device_id *id) | 227 | const struct pci_device_id *id) |
@@ -302,5 +313,4 @@ void virtio_pci_legacy_remove(struct pci_dev *pci_dev) | |||
302 | pci_iounmap(pci_dev, vp_dev->ioaddr); | 313 | pci_iounmap(pci_dev, vp_dev->ioaddr); |
303 | pci_release_regions(pci_dev); | 314 | pci_release_regions(pci_dev); |
304 | pci_disable_device(pci_dev); | 315 | pci_disable_device(pci_dev); |
305 | kfree(vp_dev); | ||
306 | } | 316 | } |