From patchwork Wed Aug 27 13:09:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 4788131 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9E3C2C0338 for ; Wed, 27 Aug 2014 13:19:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 637172017D for ; Wed, 27 Aug 2014 13:19:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 21F392012D for ; Wed, 27 Aug 2014 13:19:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933594AbaH0NTp (ORCPT ); Wed, 27 Aug 2014 09:19:45 -0400 Received: from mail-lb0-f169.google.com ([209.85.217.169]:35188 "EHLO mail-lb0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933490AbaH0NTo (ORCPT ); Wed, 27 Aug 2014 09:19:44 -0400 Received: by mail-lb0-f169.google.com with SMTP id n15so324238lbi.14 for ; Wed, 27 Aug 2014 06:19:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id; bh=huNNYGUuSgBeJALtPsFu94h/DK5u5IEV02taoFVm4nk=; b=mweCEiRIq9SeHyYPM5WUNzBfWUGy6rK9PrCDinggL0DYobQxYDahTYS80QEYvuRvs7 aGFjZRl0yC4unWcyLkwkGxAHpPsXSq+I7oLS5i3OMHw7jQTeW4MqnmaUWk2Y78Wd3wd9 NgiECcd+jwggNQarOWMNaMibJlQKe5nUTEtpU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=huNNYGUuSgBeJALtPsFu94h/DK5u5IEV02taoFVm4nk=; b=gD9S8dnJ10spHYqfkFgXjXTTc+5BGN0ufgnCsWRBthVpkSPAC1zOh3dWXEIgToew7s R0Fb5LDhXfZgWelXs0CkU88R+zHmvcLoXVBDGTuyc/0Zux71N56INks78ou+QI47VlI0 UGtoDHlVqwQzp/PvsfJw0E2EcKiCFwYzQBA3rbxTTU7V3P7pmbLpm/Dn5BPp0BebSIgY tSiynHo4ApmUZUF18CIkD97mH5ZhsomiZ0bc4FYzV+Op/mfIA5glXXXyqqYhauG04eRZ OwT0sw6iZxFXTLS68iyFjMNEKhBmRMntKrMABn3k/NFbtwygQAXgUU1tDYIhf+R7VOue ehHw== X-Gm-Message-State: ALoCoQleOgQTmFt0UZ6+yWmnElTdE1B5Ff7NIVmco0R6JYiheswxTOKFRgj+MXt9BVwH+RR3R00LfVhvc7XHtfONeBlEv5FcazhpzOWD6ySybHALf6sQOuQ= X-Received: by 10.112.114.227 with SMTP id jj3mr32576484lbb.39.1409145582962; Wed, 27 Aug 2014 06:19:42 -0700 (PDT) Received: from localhost.localdomain ([91.198.246.8]) by mx.google.com with ESMTPSA id as6sm607187lbc.17.2014.08.27.06.19.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Aug 2014 06:19:42 -0700 (PDT) From: Michal Kazior To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Michal Kazior Subject: [PATCH] ath10k: re-enable interrupts properly in hw recovery Date: Wed, 27 Aug 2014 15:09:49 +0200 Message-Id: <1409144989-17934-1-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 1.8.5.3 X-DomainID: tieto.com Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Recent changes done to start/restart sequences broke hw recovery in some hw configurations. The pci transport was stopped twice however due to a workaround in the pci disabling code the disable/enable for first msi interrupt was not balanced. This ended up with irqs not being properly re-enabled and the following print out during recovery: ath10k: failed to receive control response completion, polling.. ath10k: Service connect timeout: -110 ath10k: Could not init core: -110 Legacy interrupt mode was unaffected while msi ranged mode would be partially crippled (it would miss fw indication interrupts but otherwise it worked fine). This fixes completely broken fw recovery for a single msi interrupt mode and fixes subsequent fw crash reports for msi range interrupt mode. Signed-off-by: Michal Kazior --- drivers/net/wireless/ath/ath10k/pci.c | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index 144eb8a3..4b1a7ef 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -1083,16 +1083,8 @@ static void ath10k_pci_irq_disable(struct ath10k *ar) int i; ath10k_ce_disable_interrupts(ar); - - /* Regardless how many interrupts were assigned for MSI the first one - * is always used for firmware indications (crashes). There's no way to - * mask the irq in the device so call disable_irq(). Legacy (shared) - * interrupts can be masked on the device though. - */ - if (ar_pci->num_msi_intrs > 0) - disable_irq(ar_pci->pdev->irq); - else - ath10k_pci_disable_and_clear_legacy_irq(ar); + ath10k_pci_disable_and_clear_legacy_irq(ar); + /* FIXME: How to mask all MSI interrupts? */ for (i = 0; i < max(1, ar_pci->num_msi_intrs); i++) synchronize_irq(ar_pci->pdev->irq + i); @@ -1100,15 +1092,9 @@ static void ath10k_pci_irq_disable(struct ath10k *ar) static void ath10k_pci_irq_enable(struct ath10k *ar) { - struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); - ath10k_ce_enable_interrupts(ar); - - /* See comment in ath10k_pci_irq_disable() */ - if (ar_pci->num_msi_intrs > 0) - enable_irq(ar_pci->pdev->irq); - else - ath10k_pci_enable_legacy_irq(ar); + ath10k_pci_enable_legacy_irq(ar); + /* FIXME: How to unmask all MSI interrupts? */ } static int ath10k_pci_hif_start(struct ath10k *ar) @@ -1222,14 +1208,21 @@ static void ath10k_pci_hif_stop(struct ath10k *ar) { ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif stop\n"); - ath10k_pci_irq_disable(ar); - ath10k_pci_flush(ar); - /* Most likely the device has HTT Rx ring configured. The only way to * prevent the device from accessing (and possible corrupting) host * memory is to reset the chip now. + * + * There's also no known way of masking MSI interrupts on the device. + * For ranged MSI the CE-related interrupts can be masked. However + * regardless how many MSI interrupts are assigned the first one + * is always used for firmware indications (crashes) and cannot be + * masked. To prevent the device from asserting the interrupt reset it + * before proceeding with cleanup. */ ath10k_pci_warm_reset(ar); + + ath10k_pci_irq_disable(ar); + ath10k_pci_flush(ar); } static int ath10k_pci_hif_exchange_bmi_msg(struct ath10k *ar,