Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5468891pxu; Tue, 22 Dec 2020 19:05:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJzx+kQ9nDCAHnPgGK3mo9zrpRrpd2xJK7jkj3ZtVbCTfVR8Sear13FfuJ/wkPvRKjNZ5BBK X-Received: by 2002:a50:998f:: with SMTP id m15mr8025218edb.342.1608692743241; Tue, 22 Dec 2020 19:05:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608692743; cv=none; d=google.com; s=arc-20160816; b=j3nLl5N3Ej2adUZDD/1HJ/e8X8IkOpwCFnF0ZsGtbA3eh0ybVLb5MEPyewWTgrbdeR qLoMyueWM+P7UN6Ncso82DNkFJVYTbXjR0Dy6/2Uf80wbaYR9zXb5dXVT3NM6px010P6 73stZcVLtinXFJVm3k9oyHrjgSYMKMvHoUPZKt0iDnmu/uoTm2GO163Ksf4eX2BDyJQR GIDv3Hv9seWyluOYgTZ5c4PLGZjCphbYKL2hb4sVULc5khRCfn2qSSxBUMVQJt02XS21 PEWMLgrSAkkc7D/6mqySk4L3GrVBlqrKyZgEexMu+nHkuYb3EfIctbo3JhA+6wW6Uw8n KDxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dmarc-filter:sender:dkim-signature; bh=COpPCI35yZLocAaYqn3iaC0V3RPVM6uVwo+YuNePICU=; b=Lnede785SajkPrfvGO++TchDFRW0amO72i8vfxleETs2ijeBk3V9CFZuI4ndWr7JyG aPZyBFUfQni3QzQM525KixidOXvENGAjnB/g3QfMzp7r4ctJOAX38A33r911v5AjJ+x6 0uuNsrdNnlhmiMpNpgBKoXMJ21B721qtUEnEUOwcVWNPGHfvmHgKgZevJNpJGbbFedc+ bW6GYeqdn4N6fPn3hpTQFu7KaRuJKaal8E9t6a1z/K0gydBGhj7MauAnpnu7cjKLo827 F6ZxSdv59UmEBpEZXERv2ozU4LyeWz2oVJfmZ85oD+LIUh3+3E7Gk85p9wC72feGr1Sw 5geQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=tL0DB0Y1; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e14si12872249edy.505.2020.12.22.19.05.20; Tue, 22 Dec 2020 19:05:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=tL0DB0Y1; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731474AbgLWDDr (ORCPT + 99 others); Tue, 22 Dec 2020 22:03:47 -0500 Received: from m43-15.mailgun.net ([69.72.43.15]:26495 "EHLO m43-15.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728632AbgLWDDq (ORCPT ); Tue, 22 Dec 2020 22:03:46 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1608692600; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=COpPCI35yZLocAaYqn3iaC0V3RPVM6uVwo+YuNePICU=; b=tL0DB0Y1yd/C4chTn2x2/7RpUmMP7UZPM6Xccrpb0VLmZKrf3hIVq7e49nFlQ/E8KjH2ZaSm MS6s8XKYM6UoSvqc/s5sv/5Pkj4yag6lGEqmZVbocmQAX94luRMkbW0qBHM8V8E8BN89rzlX tEgQKg1XzxVzeQEQ7jUyr3xVpAE= X-Mailgun-Sending-Ip: 69.72.43.15 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n10.prod.us-east-1.postgun.com with SMTP id 5fe2b34b3ac69bd6b8377272 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Wed, 23 Dec 2020 03:02:35 GMT Sender: cjhuang=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 05940C433C6; Wed, 23 Dec 2020 03:02:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from cjhuang-Inspiron-7590.qca.qualcomm.com (unknown [180.166.53.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cjhuang) by smtp.codeaurora.org (Postfix) with ESMTPSA id BF241C433CA; Wed, 23 Dec 2020 03:02:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org BF241C433CA Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=cjhuang@codeaurora.org From: Carl Huang To: ath11k@lists.infradead.org Cc: linux-wireless@vger.kernel.org Subject: [PATCH 1/6] ath11k: get msi_data again after request_irq is called Date: Tue, 22 Dec 2020 22:02:20 -0500 Message-Id: <20201223030225.2345-2-cjhuang@codeaurora.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201223030225.2345-1-cjhuang@codeaurora.org> References: <20201223030225.2345-1-cjhuang@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The reservation mode of interrupts is kernel assigns a dummy vector when the interrupt is allocated and assigns a real vector when the request_irq is called. The reservation mode helps to ease vector pressure when devices with a large amount of queues/interrupts are initialized, but only a minimal subset of those queues/interrupts is actually used. So on reservation mode, the msi_data may change after request_irq is called, so ath11k reads msi_data again after request_irq is called, and then the correct msi_data is programmed into QCA6390 hardware components. Without this change, spurious interrupt occurs in case of one MSI vector. When VT-D in BIOS is enabled and ath11k can get 32 MSI vectors, ath11k always get the same msi_data before and after request_irq, that's why this change is only required when one MSI vector is to be supported. Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1 Signed-off-by: Carl Huang --- drivers/net/wireless/ath/ath11k/pci.c | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c index 78478b2..c1ae1df 100644 --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c @@ -804,6 +804,32 @@ static void ath11k_pci_disable_msi(struct ath11k_pci *ab_pci) pci_free_irq_vectors(ab_pci->pdev); } +static int ath11k_pci_config_msi_data(struct ath11k_pci *ab_pci) +{ + struct msi_desc *msi_desc; + int ret; + + msi_desc = irq_get_msi_desc(ab_pci->pdev->irq); + if (!msi_desc) { + ath11k_err(ab_pci->ab, "%s msi_desc is NULL!\n", __func__); + ret = -EINVAL; + goto free_msi_vector; + } + + ab_pci->msi_ep_base_data = msi_desc->msg.data; + + ath11k_dbg(ab_pci->ab, ATH11K_DBG_PCI, + "msi base data after request_irq is %d\n", + ab_pci->msi_ep_base_data); + + return 0; + +free_msi_vector: + pci_free_irq_vectors(ab_pci->pdev); + + return ret; +} + static int ath11k_pci_claim(struct ath11k_pci *ab_pci, struct pci_dev *pdev) { struct ath11k_base *ab = ab_pci->ab; @@ -1174,6 +1200,17 @@ static int ath11k_pci_probe(struct pci_dev *pdev, goto err_ce_free; } + /* kernel may allocate a dummy vector before request_irq and + * then allocate a real vector when request_irq is called. + * So get msi_data here again to avoid spurious interrupt + * as msi_data will configured to srngs. + */ + ret = ath11k_pci_config_msi_data(ab_pci); + if (ret) { + ath11k_err(ab, "failed to config msi_data: %d\n", ret); + goto err_ce_free; + } + ret = ath11k_core_init(ab); if (ret) { ath11k_err(ab, "failed to init core: %d\n", ret); -- 2.7.4