Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3816785rdb; Thu, 14 Sep 2023 03:44:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFwMDRhEpXK1OxDg6bf9f8VBZ5XJ5+dHzU0O8mK9uMsL9Umsjjld11UJddlTSL873JDp9lq X-Received: by 2002:a05:6358:98a8:b0:142:d1cb:48ab with SMTP id q40-20020a05635898a800b00142d1cb48abmr6404271rwa.15.1694688258589; Thu, 14 Sep 2023 03:44:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694688258; cv=none; d=google.com; s=arc-20160816; b=n8tM4IYu+Z6+1w8ZiD1G/zF7c425kRFyxW+SvkCJ4ZAkhML2gCmcNtx9hHo7oh/jGC 4ty+sBqhmKT3Ldap7uKm0RQddOpyciMFnknLPFKsVID21fw6zg7bDMLpPZohGF4o+ZPR CGc8Kgw2tH5DXBiN9WtfSx99BpMWuZmzrGIo9n4zkkUAWNvsFtMHra7iZy+URCJrx42m IBpsG3YCYD6qtH160zdiq/sFWGHPmA70+9oL+OFyuFqjZMxOkZM03GJxfx+LbgqM+qCt 7+ix7nTg6fs45hr8vDUm0cDiS6/RRUHnlqz93iqZMoWiqOlbx0xhXmCOmh3DaQokCRNn C7TQ== 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=HkERTn2eEuq05UoX01AQweRf69Kn94kcdYhZj2C5NEU=; fh=R7jN8qUJXbrMn2MmiosToC7UwR5vJ9696qG6xzfWa9Q=; b=FAKN05WQphYfAljps8Vvwpgsbm2GedEG+aqleqqV7KLN5VfiiMQ17BuxhxebJ8uedh YP3CauF0WhsszkpUM1ui7PIBiz1E6Kjbcm1oPNeVpeWWjQr8q/VyG4mJP9QAQZvl6E/i xoHOJ9T6/idvGcwEGNvibj9hmVklxynHTwAwbi71WBfdhzggjeDQJnIvGuhRu8jesKko DZ0YjLK17obniiMG22JJP6p87UuasXhNj1Wd/qlk8wXHesB7WNQOvAricYleq91lqBP2 3HSRZc50wHxTrKOf2/ysmSOJMLpEI2sa9r/VM/SvnIYSPlnWQepu+f8E/zR7TsKOTN1Q NjUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=lR+JvmSQ; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id x64-20020a636343000000b00574057d7c0esi1272789pgb.511.2023.09.14.03.44.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 03:44:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=lR+JvmSQ; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 37CC881A7D0B; Thu, 14 Sep 2023 02:09:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237113AbjINJJP (ORCPT + 57 others); Thu, 14 Sep 2023 05:09:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237120AbjINJJF (ORCPT ); Thu, 14 Sep 2023 05:09:05 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D4E21FFA for ; Thu, 14 Sep 2023 02:08:23 -0700 (PDT) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38E6CcaZ032548; Thu, 14 Sep 2023 09:08:12 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=HkERTn2eEuq05UoX01AQweRf69Kn94kcdYhZj2C5NEU=; b=lR+JvmSQqaL/fRLceGb/t48jiYQJMEer2R1IsDFIivef3F29hBj6zPVaRNRDLlhS7qBh KzwPAoJCFyk3SzhHI8LMamK+/cKi9YJAlJbUykdA/ube3ZecWoAHw4b5cpFw/4Ixkguy haTTDV8hSzVF+OWBcoivn4cEBp5pKRlignAcpqtd1mDukuzXNi+npyEnGqKirxmBWocT 756ATrdkOTnCvEz6/X/alVGIi3MSDw4v6mz7twAQ/e4V+JsccyWiAPGMBcKprcQJMbMJ YTs9AtwGwwIcuzhIE8/09l+LOp+eyLrKR8UTF6etmAx4/CQkUERAnxXlHRkJ24g03ADS Sw== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t3r15s1na-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Sep 2023 09:08:12 +0000 Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38E98BTZ029918 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Sep 2023 09:08:11 GMT Received: from wgong-HP3-Z230-SFF-Workstation.qca.qualcomm.com (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Thu, 14 Sep 2023 02:08:09 -0700 From: Wen Gong To: CC: , , , Subject: [PATCH v2 3/4] wifi: ath12k: avoid firmware crash when reg set for WCN7850 Date: Thu, 14 Sep 2023 05:07:45 -0400 Message-ID: <20230914090746.23560-4-quic_wgong@quicinc.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230914090746.23560-1-quic_wgong@quicinc.com> References: <20230914090746.23560-1-quic_wgong@quicinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: n-wYn_13XSjCrdcOj0VVeh0euXNccWYY X-Proofpoint-ORIG-GUID: n-wYn_13XSjCrdcOj0VVeh0euXNccWYY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-14_07,2023-09-13_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 malwarescore=0 adultscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 priorityscore=1501 mlxlogscore=999 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309140078 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 (pete.vger.email [0.0.0.0]); Thu, 14 Sep 2023 02:09:23 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email For the NL80211_REGDOM_SET_BY_USER hint from cfg80211, it set the new alpha2 code to ath12k, then ath12k send WMI_SET_INIT_COUNTRY_CMDID to firmware for all chips currently. When test with WCN7850 chips, this WMI CMD leads firmware crash. For AP based chips(QCN92xx), WMI_SET_INIT_COUNTRY_CMDID is the correct command use. However, for STATION based chips(WCN7850), it need to use another WMI CMD, WMI_SET_CURRENT_COUNTRY_CMDID. Add flag current_cc_support in hardware parameters. It is used to distinguish AP/STA platform. After that, the firmware will work normal and the regulatory feature works well for WCN7850. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4 Signed-off-by: Wen Gong --- drivers/net/wireless/ath/ath12k/hw.c | 3 +++ drivers/net/wireless/ath/ath12k/hw.h | 1 + drivers/net/wireless/ath/ath12k/reg.c | 29 ++++++++++++++++++--------- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/hw.c b/drivers/net/wireless/ath/ath12k/hw.c index 5991cc91cd00..c9ed4c0e0da5 100644 --- a/drivers/net/wireless/ath/ath12k/hw.c +++ b/drivers/net/wireless/ath/ath12k/hw.c @@ -907,6 +907,7 @@ static const struct ath12k_hw_params ath12k_hw_params[] = { .hal_ops = &hal_qcn9274_ops, .qmi_cnss_feature_bitmap = BIT(CNSS_QDSS_CFG_MISS_V01), + .current_cc_support = false, }, { .name = "wcn7850 hw2.0", @@ -964,6 +965,7 @@ static const struct ath12k_hw_params ath12k_hw_params[] = { .qmi_cnss_feature_bitmap = BIT(CNSS_QDSS_CFG_MISS_V01) | BIT(CNSS_PCIE_PERST_NO_PULL_V01), + .current_cc_support = true, }, { .name = "qcn9274 hw2.0", @@ -1019,6 +1021,7 @@ static const struct ath12k_hw_params ath12k_hw_params[] = { .hal_ops = &hal_qcn9274_ops, .qmi_cnss_feature_bitmap = BIT(CNSS_QDSS_CFG_MISS_V01), + .current_cc_support = false, }, }; diff --git a/drivers/net/wireless/ath/ath12k/hw.h b/drivers/net/wireless/ath/ath12k/hw.h index e6c4223c283c..292c07bb1a8b 100644 --- a/drivers/net/wireless/ath/ath12k/hw.h +++ b/drivers/net/wireless/ath/ath12k/hw.h @@ -173,6 +173,7 @@ struct ath12k_hw_params { bool tcl_ring_retry:1; bool reoq_lut_support:1; bool supports_shadow_regs:1; + bool current_cc_support:1; u32 hal_desc_sz; u32 num_tcl_banks; diff --git a/drivers/net/wireless/ath/ath12k/reg.c b/drivers/net/wireless/ath/ath12k/reg.c index c2f2fcce9fb1..97c93a4901e6 100644 --- a/drivers/net/wireless/ath/ath12k/reg.c +++ b/drivers/net/wireless/ath/ath12k/reg.c @@ -48,6 +48,7 @@ ath12k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) { struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); struct ath12k_wmi_init_country_arg arg; + struct wmi_set_current_country_params set_current_param = {}; struct ath12k *ar = hw->priv; int ret; @@ -76,18 +77,26 @@ ath12k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) return; } - /* Set the country code to the firmware and wait for - * the WMI_REG_CHAN_LIST_CC EVENT for updating the - * reg info + /* Set the country code to the firmware. ath12k will subsequently receive + * the WMI_REG_CHAN_LIST_CC EVENT for updating the regulatory info. */ - arg.flags = ALPHA_IS_SET; - memcpy(&arg.cc_info.alpha2, request->alpha2, 2); - arg.cc_info.alpha2[2] = 0; + if (ar->ab->hw_params->current_cc_support) { + memcpy(&set_current_param.alpha2, request->alpha2, 2); - ret = ath12k_wmi_send_init_country_cmd(ar, &arg); - if (ret) - ath12k_warn(ar->ab, - "INIT Country code set to fw failed : %d\n", ret); + ret = ath12k_wmi_send_set_current_country_cmd(ar, &set_current_param); + if (ret) + ath12k_warn(ar->ab, + "failed set current country code: %d\n", ret); + } else { + arg.flags = ALPHA_IS_SET; + memcpy(&arg.cc_info.alpha2, request->alpha2, 2); + arg.cc_info.alpha2[2] = 0; + + ret = ath12k_wmi_send_init_country_cmd(ar, &arg); + if (ret) + ath12k_warn(ar->ab, + "INIT Country code set to fw failed : %d\n", ret); + } ath12k_mac_11d_scan_stop(ar); ar->regdom_set_by_user = true; -- 2.40.1