Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'iwlwifi-for-kalle-2015-10-25' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-fixes

* some fixes for suspend/resume with unified FW images;
* a fix for a false-positive lockdep report;
* a fix for multi-queue that caused an unnecessary 1 second latency;
* a fix for an ACPI parsing bug that caused a misleading error message;

+129 -54
+38 -11
drivers/net/wireless/intel/iwlwifi/mvm/d3.c
··· 1087 1087 ret = iwl_mvm_switch_to_d3(mvm); 1088 1088 if (ret) 1089 1089 return ret; 1090 + } else { 1091 + /* In theory, we wouldn't have to stop a running sched 1092 + * scan in order to start another one (for 1093 + * net-detect). But in practice this doesn't seem to 1094 + * work properly, so stop any running sched_scan now. 1095 + */ 1096 + ret = iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_SCHED, true); 1097 + if (ret) 1098 + return ret; 1090 1099 } 1091 1100 1092 1101 /* rfkill release can be either for wowlan or netdetect */ ··· 1263 1254 out: 1264 1255 if (ret < 0) { 1265 1256 iwl_mvm_ref(mvm, IWL_MVM_REF_UCODE_DOWN); 1266 - ieee80211_restart_hw(mvm->hw); 1257 + if (mvm->restart_fw > 0) { 1258 + mvm->restart_fw--; 1259 + ieee80211_restart_hw(mvm->hw); 1260 + } 1267 1261 iwl_mvm_free_nd(mvm); 1268 1262 } 1269 1263 out_noreset: ··· 2100 2088 iwl_mvm_update_changed_regdom(mvm); 2101 2089 2102 2090 if (mvm->net_detect) { 2091 + /* If this is a non-unified image, we restart the FW, 2092 + * so no need to stop the netdetect scan. If that 2093 + * fails, continue and try to get the wake-up reasons, 2094 + * but trigger a HW restart by keeping a failure code 2095 + * in ret. 2096 + */ 2097 + if (unified_image) 2098 + ret = iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_NETDETECT, 2099 + false); 2100 + 2103 2101 iwl_mvm_query_netdetect_reasons(mvm, vif); 2104 2102 /* has unlocked the mutex, so skip that */ 2105 2103 goto out; ··· 2293 2271 static int iwl_mvm_d3_test_release(struct inode *inode, struct file *file) 2294 2272 { 2295 2273 struct iwl_mvm *mvm = inode->i_private; 2296 - int remaining_time = 10; 2274 + bool unified_image = fw_has_capa(&mvm->fw->ucode_capa, 2275 + IWL_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG); 2297 2276 2298 2277 mvm->d3_test_active = false; 2299 2278 ··· 2305 2282 mvm->trans->system_pm_mode = IWL_PLAT_PM_MODE_DISABLED; 2306 2283 2307 2284 iwl_abort_notification_waits(&mvm->notif_wait); 2308 - ieee80211_restart_hw(mvm->hw); 2285 + if (!unified_image) { 2286 + int remaining_time = 10; 2309 2287 2310 - /* wait for restart and disconnect all interfaces */ 2311 - while (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && 2312 - remaining_time > 0) { 2313 - remaining_time--; 2314 - msleep(1000); 2288 + ieee80211_restart_hw(mvm->hw); 2289 + 2290 + /* wait for restart and disconnect all interfaces */ 2291 + while (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && 2292 + remaining_time > 0) { 2293 + remaining_time--; 2294 + msleep(1000); 2295 + } 2296 + 2297 + if (remaining_time == 0) 2298 + IWL_ERR(mvm, "Timed out waiting for HW restart!\n"); 2315 2299 } 2316 - 2317 - if (remaining_time == 0) 2318 - IWL_ERR(mvm, "Timed out waiting for HW restart to finish!\n"); 2319 2300 2320 2301 ieee80211_iterate_active_interfaces_atomic( 2321 2302 mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
+2 -2
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
··· 1529 1529 .data = { &cmd, }, 1530 1530 .len = { sizeof(cmd) }, 1531 1531 }; 1532 - size_t delta, len; 1533 - ssize_t ret; 1532 + size_t delta; 1533 + ssize_t ret, len; 1534 1534 1535 1535 hcmd.id = iwl_cmd_id(*ppos >> 24 ? UMAC_RD_WR : LMAC_RD_WR, 1536 1536 DEBUG_GROUP, 0);
+1 -2
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
··· 4121 4121 struct iwl_mvm_internal_rxq_notif *notif, 4122 4122 u32 size) 4123 4123 { 4124 - DECLARE_WAIT_QUEUE_HEAD_ONSTACK(notif_waitq); 4125 4124 u32 qmask = BIT(mvm->trans->num_rx_queues) - 1; 4126 4125 int ret; 4127 4126 ··· 4142 4143 } 4143 4144 4144 4145 if (notif->sync) 4145 - ret = wait_event_timeout(notif_waitq, 4146 + ret = wait_event_timeout(mvm->rx_sync_waitq, 4146 4147 atomic_read(&mvm->queue_sync_counter) == 0, 4147 4148 HZ); 4148 4149 WARN_ON_ONCE(!ret);
+1
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
··· 937 937 /* sync d0i3_tx queue and IWL_MVM_STATUS_IN_D0I3 status flag */ 938 938 spinlock_t d0i3_tx_lock; 939 939 wait_queue_head_t d0i3_exit_waitq; 940 + wait_queue_head_t rx_sync_waitq; 940 941 941 942 /* BT-Coex */ 942 943 struct iwl_bt_coex_profile_notif last_bt_notif;
+1
drivers/net/wireless/intel/iwlwifi/mvm/ops.c
··· 619 619 spin_lock_init(&mvm->refs_lock); 620 620 skb_queue_head_init(&mvm->d0i3_tx); 621 621 init_waitqueue_head(&mvm->d0i3_exit_waitq); 622 + init_waitqueue_head(&mvm->rx_sync_waitq); 622 623 623 624 atomic_set(&mvm->queue_sync_counter, 0); 624 625
+2 -1
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
··· 547 547 "Received expired RX queue sync message\n"); 548 548 return; 549 549 } 550 - atomic_dec(&mvm->queue_sync_counter); 550 + if (!atomic_dec_return(&mvm->queue_sync_counter)) 551 + wake_up(&mvm->rx_sync_waitq); 551 552 } 552 553 553 554 switch (internal_notif->type) {
+27 -6
drivers/net/wireless/intel/iwlwifi/mvm/scan.c
··· 1199 1199 1200 1200 static int iwl_mvm_check_running_scans(struct iwl_mvm *mvm, int type) 1201 1201 { 1202 + bool unified_image = fw_has_capa(&mvm->fw->ucode_capa, 1203 + IWL_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG); 1204 + 1202 1205 /* This looks a bit arbitrary, but the idea is that if we run 1203 1206 * out of possible simultaneous scans and the userspace is 1204 1207 * trying to run a scan type that is already running, we ··· 1228 1225 return -EBUSY; 1229 1226 return iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_REGULAR, true); 1230 1227 case IWL_MVM_SCAN_NETDETECT: 1231 - /* No need to stop anything for net-detect since the 1232 - * firmware is restarted anyway. This way, any sched 1233 - * scans that were running will be restarted when we 1234 - * resume. 1235 - */ 1236 - return 0; 1228 + /* For non-unified images, there's no need to stop 1229 + * anything for net-detect since the firmware is 1230 + * restarted anyway. This way, any sched scans that 1231 + * were running will be restarted when we resume. 1232 + */ 1233 + if (!unified_image) 1234 + return 0; 1235 + 1236 + /* If this is a unified image and we ran out of scans, 1237 + * we need to stop something. Prefer stopping regular 1238 + * scans, because the results are useless at this 1239 + * point, and we should be able to keep running 1240 + * another scheduled scan while suspended. 1241 + */ 1242 + if (mvm->scan_status & IWL_MVM_SCAN_REGULAR_MASK) 1243 + return iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_REGULAR, 1244 + true); 1245 + if (mvm->scan_status & IWL_MVM_SCAN_SCHED_MASK) 1246 + return iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_SCHED, 1247 + true); 1248 + 1249 + /* fall through, something is wrong if no scan was 1250 + * running but we ran out of scans. 1251 + */ 1237 1252 default: 1238 1253 WARN_ON(1); 1239 1254 break;
+49 -32
drivers/net/wireless/intel/iwlwifi/pcie/drv.c
··· 541 541 MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids); 542 542 543 543 #ifdef CONFIG_ACPI 544 - #define SPL_METHOD "SPLC" 545 - #define SPL_DOMAINTYPE_MODULE BIT(0) 546 - #define SPL_DOMAINTYPE_WIFI BIT(1) 547 - #define SPL_DOMAINTYPE_WIGIG BIT(2) 548 - #define SPL_DOMAINTYPE_RFEM BIT(3) 544 + #define ACPI_SPLC_METHOD "SPLC" 545 + #define ACPI_SPLC_DOMAIN_WIFI (0x07) 549 546 550 - static u64 splx_get_pwr_limit(struct iwl_trans *trans, union acpi_object *splx) 547 + static u64 splc_get_pwr_limit(struct iwl_trans *trans, union acpi_object *splc) 551 548 { 552 - union acpi_object *limits, *domain_type, *power_limit; 549 + union acpi_object *data_pkg, *dflt_pwr_limit; 550 + int i; 553 551 554 - if (splx->type != ACPI_TYPE_PACKAGE || 555 - splx->package.count != 2 || 556 - splx->package.elements[0].type != ACPI_TYPE_INTEGER || 557 - splx->package.elements[0].integer.value != 0) { 558 - IWL_ERR(trans, "Unsupported splx structure\n"); 552 + /* We need at least two elements, one for the revision and one 553 + * for the data itself. Also check that the revision is 554 + * supported (currently only revision 0). 555 + */ 556 + if (splc->type != ACPI_TYPE_PACKAGE || 557 + splc->package.count < 2 || 558 + splc->package.elements[0].type != ACPI_TYPE_INTEGER || 559 + splc->package.elements[0].integer.value != 0) { 560 + IWL_DEBUG_INFO(trans, 561 + "Unsupported structure returned by the SPLC method. Ignoring.\n"); 559 562 return 0; 560 563 } 561 564 562 - limits = &splx->package.elements[1]; 563 - if (limits->type != ACPI_TYPE_PACKAGE || 564 - limits->package.count < 2 || 565 - limits->package.elements[0].type != ACPI_TYPE_INTEGER || 566 - limits->package.elements[1].type != ACPI_TYPE_INTEGER) { 567 - IWL_ERR(trans, "Invalid limits element\n"); 565 + /* loop through all the packages to find the one for WiFi */ 566 + for (i = 1; i < splc->package.count; i++) { 567 + union acpi_object *domain; 568 + 569 + data_pkg = &splc->package.elements[i]; 570 + 571 + /* Skip anything that is not a package with the right 572 + * amount of elements (i.e. at least 2 integers). 573 + */ 574 + if (data_pkg->type != ACPI_TYPE_PACKAGE || 575 + data_pkg->package.count < 2 || 576 + data_pkg->package.elements[0].type != ACPI_TYPE_INTEGER || 577 + data_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) 578 + continue; 579 + 580 + domain = &data_pkg->package.elements[0]; 581 + if (domain->integer.value == ACPI_SPLC_DOMAIN_WIFI) 582 + break; 583 + 584 + data_pkg = NULL; 585 + } 586 + 587 + if (!data_pkg) { 588 + IWL_DEBUG_INFO(trans, 589 + "No element for the WiFi domain returned by the SPLC method.\n"); 568 590 return 0; 569 591 } 570 592 571 - domain_type = &limits->package.elements[0]; 572 - power_limit = &limits->package.elements[1]; 573 - if (!(domain_type->integer.value & SPL_DOMAINTYPE_WIFI)) { 574 - IWL_DEBUG_INFO(trans, "WiFi power is not limited\n"); 575 - return 0; 576 - } 577 - 578 - return power_limit->integer.value; 593 + dflt_pwr_limit = &data_pkg->package.elements[1]; 594 + return dflt_pwr_limit->integer.value; 579 595 } 580 596 581 597 static void set_dflt_pwr_limit(struct iwl_trans *trans, struct pci_dev *pdev) 582 598 { 583 599 acpi_handle pxsx_handle; 584 600 acpi_handle handle; 585 - struct acpi_buffer splx = {ACPI_ALLOCATE_BUFFER, NULL}; 601 + struct acpi_buffer splc = {ACPI_ALLOCATE_BUFFER, NULL}; 586 602 acpi_status status; 587 603 588 604 pxsx_handle = ACPI_HANDLE(&pdev->dev); ··· 609 593 } 610 594 611 595 /* Get the method's handle */ 612 - status = acpi_get_handle(pxsx_handle, (acpi_string)SPL_METHOD, &handle); 596 + status = acpi_get_handle(pxsx_handle, (acpi_string)ACPI_SPLC_METHOD, 597 + &handle); 613 598 if (ACPI_FAILURE(status)) { 614 - IWL_DEBUG_INFO(trans, "SPL method not found\n"); 599 + IWL_DEBUG_INFO(trans, "SPLC method not found\n"); 615 600 return; 616 601 } 617 602 618 603 /* Call SPLC with no arguments */ 619 - status = acpi_evaluate_object(handle, NULL, NULL, &splx); 604 + status = acpi_evaluate_object(handle, NULL, NULL, &splc); 620 605 if (ACPI_FAILURE(status)) { 621 606 IWL_ERR(trans, "SPLC invocation failed (0x%x)\n", status); 622 607 return; 623 608 } 624 609 625 - trans->dflt_pwr_limit = splx_get_pwr_limit(trans, splx.pointer); 610 + trans->dflt_pwr_limit = splc_get_pwr_limit(trans, splc.pointer); 626 611 IWL_DEBUG_INFO(trans, "Default power limit set to %lld\n", 627 612 trans->dflt_pwr_limit); 628 - kfree(splx.pointer); 613 + kfree(splc.pointer); 629 614 } 630 615 631 616 #else /* CONFIG_ACPI */
+8
drivers/net/wireless/intel/iwlwifi/pcie/tx.c
··· 592 592 static int iwl_pcie_txq_init(struct iwl_trans *trans, struct iwl_txq *txq, 593 593 int slots_num, u32 txq_id) 594 594 { 595 + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 595 596 int ret; 596 597 597 598 txq->need_update = false; ··· 607 606 return ret; 608 607 609 608 spin_lock_init(&txq->lock); 609 + 610 + if (txq_id == trans_pcie->cmd_queue) { 611 + static struct lock_class_key iwl_pcie_cmd_queue_lock_class; 612 + 613 + lockdep_set_class(&txq->lock, &iwl_pcie_cmd_queue_lock_class); 614 + } 615 + 610 616 __skb_queue_head_init(&txq->overflow_q); 611 617 612 618 /*