Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2114137rdb; Mon, 20 Nov 2023 02:17:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IHI1jNch9YqgD3kU7bzNn0mOo1lXoem3NSbVMG6nWbNV823Hp1aBFu6KlVwDNwzoUOqEJ+e X-Received: by 2002:a05:6808:1826:b0:3ad:f866:39bd with SMTP id bh38-20020a056808182600b003adf86639bdmr10216730oib.27.1700475423574; Mon, 20 Nov 2023 02:17:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700475423; cv=none; d=google.com; s=arc-20160816; b=myaHNU5TLd6u062gFBfqdQvMqJjOduGHmcaD1NbTceHGGPf9czeYAkbCN8Hecu1tQ5 PS/BXo4OUWYN1gb9cqsISHMQX3G5VO43WZvb5IO2WaM2K60zFdDTDWM5E0v1w3rEjQPc fIqTvk8Ype7DcLor+GA1wpxrubJYNdP6AoDBC7QRmnLJOzB7zHmBb4gCGIHmbXnKnjVV hjeeRfrFLYCQn52ru9IpQ7Mjs1hq/uoi0k7uDrGD3uPYO3wjGYvkmVbDOQ5RxXdnqTwD ezvbwfI2nOx7zVzQyzulOnICpoc4v/f8cQ6YE+m+BpTijkCxCL/o8LXijdUe7CRzfXOu i/gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=juEHgcilkt5VcNKtK9H4syfLVfpYZGuEprhEkgp/0Ak=; fh=nsXMNwyQ6Js4V/BswY1tH4B32D/qQcO3q9PUs38uuf4=; b=eR44SupVUsyb4nr+HnMmqvVHNTKcAaoWYeDNOG1flH0/KdhdPNPKOwHurvqyVkjKGX D7GGlm9aVPc79+cjFsHQNkLsoxPXOYLBUwSTv5MS1W06DscL+nhEKDNKbIVgAfpmUWMr C/LG5OAOFNNfhyC/ej49Yw8VCvTAzSwZ2Jc3mSHcRmcHgtzoDWK8tQvtLUoL5ng7VvYa F0ifiBUNNdKtinudO1IlH8/4FlLMvuFaq06q3ySOO+YNQgsbggH2OC9CsoFHJNJnnlc3 LRLuYds+SY7QTNeWsv11HaoMuybXM93qhlngpO7mp3PHGjY2R2Hv/2Vrlol5tWMgxmq8 8yPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=aJBxvm+Z; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id b28-20020a631b1c000000b005c21c4a46ddsi5321725pgb.356.2023.11.20.02.17.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 02:17:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=aJBxvm+Z; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 55E49806CC3F; Mon, 20 Nov 2023 02:16:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233084AbjKTKQX (ORCPT + 54 others); Mon, 20 Nov 2023 05:16:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233050AbjKTKQU (ORCPT ); Mon, 20 Nov 2023 05:16:20 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC555F1 for ; Mon, 20 Nov 2023 02:16:16 -0800 (PST) Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AK9cnR9029629; Mon, 20 Nov 2023 10:16:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=juEHgcilkt5VcNKtK9H4syfLVfpYZGuEprhEkgp/0Ak=; b=aJBxvm+ZAhOD/+29eGJ9yVd+0IwwduLfB4x4pjltnByZeNBeO/QpDgETe8l0gLir4aks hv91cGSgDc3941Jpw3aAsDNaKHiw3uSp6HKeTybhVibiTycyicnU22KMCph9K0HO2fo9 qCeSjYALeAlPPJ+KAmZYgso/ifM6rZk++0zlZqfA1934AKRwMImsK+YO3VkrqHeF0gbN szkAowCu/QwLVMK8vV5v6dnwB0zYXgAhUdV2kjvxtCEy7PrEl+UNZt3p/4ZP3V16lFwC k63d3Q+f/k7cw+p1ITIhZDE6qC/rpyE2/DFw2eSNhU6uZ58eSj9xhYPlNrSUxCwN0XCv OQ== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uem9ebp4y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Nov 2023 10:16:09 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3AKAG8Ww032014 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Nov 2023 10:16:08 GMT Received: from yk-E5440.qca.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Mon, 20 Nov 2023 02:16:06 -0800 From: Kang Yang To: CC: , Subject: [PATCH 7/7] wifi: ath12k: set IRQ affinity to CPU0 in case of one MSI vector Date: Mon, 20 Nov 2023 18:15:43 +0800 Message-ID: <20231120101543.4369-8-quic_kangyang@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231120101543.4369-1-quic_kangyang@quicinc.com> References: <20231120101543.4369-1-quic_kangyang@quicinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: pVPYu_4Ce5s-k8FE_XZWv5VK2egbE6b1 X-Proofpoint-GUID: pVPYu_4Ce5s-k8FE_XZWv5VK2egbE6b1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-20_07,2023-11-17_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 mlxscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 mlxlogscore=999 lowpriorityscore=0 bulkscore=0 phishscore=0 suspectscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311200068 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 20 Nov 2023 02:16:27 -0800 (PST) With VT-d disabled on Intel platform, ath12k gets only one MSI vector. In that case, ath12k does not free IRQ when doing suspend, hence the kernel has to migrate it to CPU0 (if it was affine to other CPUs) and allocates a new MSI vector. However, ath12k has no chance to reconfig it to HW srngs during this phase, thus ath12k fails to resume. This issue can be fixed by setting IRQ affinity to CPU0 before request_irq is called. With such affinity, migration will not happen and thus the vector keeps unchanged during suspend/resume. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4 Signed-off-by: Kang Yang --- drivers/net/wireless/ath/ath12k/pci.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c index 3850331438de..77074443ce00 100644 --- a/drivers/net/wireless/ath/ath12k/pci.c +++ b/drivers/net/wireless/ath/ath12k/pci.c @@ -617,6 +617,15 @@ static int ath12k_pci_ext_irq_config(struct ath12k_base *ab) return 0; } +static int ath12k_pci_set_irq_affinity_hint(struct ath12k_pci *ab_pci, + const struct cpumask *m) +{ + if (test_bit(ATH12K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) + return 0; + + return irq_set_affinity_hint(ab_pci->pdev->irq, m); +} + static int ath12k_pci_config_irq(struct ath12k_base *ab) { struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); @@ -1359,10 +1368,16 @@ static int ath12k_pci_probe(struct pci_dev *pdev, if (ret) goto err_pci_msi_free; + ret = ath12k_pci_set_irq_affinity_hint(ab_pci, cpumask_of(0)); + if (ret) { + ath12k_err(ab, "failed to set irq affinity %d\n", ret); + goto err_pci_msi_free; + } + ret = ath12k_mhi_register(ab_pci); if (ret) { ath12k_err(ab, "failed to register mhi: %d\n", ret); - goto err_pci_msi_free; + goto err_irq_affinity_cleanup; } ret = ath12k_hal_srng_init(ab); @@ -1416,6 +1431,9 @@ static int ath12k_pci_probe(struct pci_dev *pdev, err_pci_msi_free: ath12k_pci_msi_free(ab_pci); +err_irq_affinity_cleanup: + ath12k_pci_set_irq_affinity_hint(ab_pci, NULL); + err_pci_free_region: ath12k_pci_free_region(ab_pci); @@ -1430,6 +1448,8 @@ static void ath12k_pci_remove(struct pci_dev *pdev) struct ath12k_base *ab = pci_get_drvdata(pdev); struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); + ath12k_pci_set_irq_affinity_hint(ab_pci, NULL); + if (test_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags)) { ath12k_pci_power_down(ab); ath12k_qmi_deinit_service(ab); @@ -1456,7 +1476,9 @@ static void ath12k_pci_remove(struct pci_dev *pdev) static void ath12k_pci_shutdown(struct pci_dev *pdev) { struct ath12k_base *ab = pci_get_drvdata(pdev); + struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); + ath12k_pci_set_irq_affinity_hint(ab_pci, NULL); ath12k_pci_power_down(ab); } -- 2.34.1