From patchwork Tue Apr 8 06:06:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Kumar Singh X-Patchwork-Id: 879736 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78E7025F96C for ; Tue, 8 Apr 2025 06:06:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092409; cv=none; b=P4bY7R4PqJagzYoJgg1sBHZtf8yjwBRBgoTWUMCF5ZUGkgowuJ+OpFFzfc3MMfFnd2qXDJc4QgonFu2qGJCfzXF1q7xvU+zPMPXAY7Ejd03kM78voVpA78L3r6Jl6BY37ETOHt0JDEXpf95zCvTl9mnFYHef+pkoRK+HyJfzd04= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092409; c=relaxed/simple; bh=up8smwyoeKohrCL41Ryqyh2BJ+BYqb2FoKl0wvhn+pU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UbivDfUorZd6Hjo53XnrGoevs8DcG3TMJJo70LCINUNMVbt23dwk0Itr98yAVrjkbpHXhJaunvkFgn/oUDZGkjoFlAjZdaMAdCdqjPFI7D4Yp6YJknt+9Tuff3Jxvv98NGUK3jZWCWuVPTfmzuVMbhQteLD3hC4Sust7bUY2CQI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=RjR5P/NC; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="RjR5P/NC" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5382GMw6014970 for ; Tue, 8 Apr 2025 06:06:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= ZRh4aDWzSVC8Ic0j6UCADc43xdjA1WQ09ueDbR4CgJ4=; b=RjR5P/NCFhe+D0Q5 2Tx7W4ozMJ116r/3m0wRblUucZXdy/+WMiVyyFIRRdEDexbC/WIAN/CFgSAWhHTb 0+kjXKs2z2E/5r37/0RfYyIWKqTGGp2+d/cg1XOTMm9ULWjO2oYJ5Haab8yKeDu1 Xz1SW+FgmwxcgrtBjwDbVw7HxSk2Fqe4uKh0YdpXtcGWUT7fZlAvES1myb6hMvkY V7IFZtuqzDPg7c2xDlp3qu/u9XC/33rL4N+7RxsRAD7MYew79DO0LnV5nNAuqSLe wwyd80gLJIelh0E0CxfB/4feojWH5zXU3/qSRPqc50VLaBGS6ljvN2fvJlXFySzQ ywIGbw== Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45twbuepcy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 08 Apr 2025 06:06:46 +0000 (GMT) Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-736b5f9279cso4802477b3a.2 for ; Mon, 07 Apr 2025 23:06:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744092406; x=1744697206; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZRh4aDWzSVC8Ic0j6UCADc43xdjA1WQ09ueDbR4CgJ4=; b=eggncxEYASm6P7HDZiee4TdQgYD1+eBaepWgLAitdWyFLjl47lFALpUYlX74R5lTn7 SyfG8eW1NEn124zqRjslXa+AFr7PBoZB4wsZ80+RtJNw8agrvSNFavdwSa/8m8CuQYjh CnN3W++PEGG0MTkOSHExjSabduG7+gCd532ofndDsjVUvxCfIzPe2HHBC3g85W7ML6qX YROX0UsZBGam+Krw6dHOWgZFlPLGYsAZnilgGrEIOR4NgPinEYwRZC8nJuoegqouqMxd KMvOGxgh8pGHW0I+yfu2PucOVQbeUvOj/UoLOnW8mTEvHmn9RcFkbUCqVklvrQV9n3vy dw9A== X-Forwarded-Encrypted: i=1; AJvYcCVhy1718j5V7YWbLCA/s3ukieBuP4yZZDDuur1Ig10M5xZG+y4lECELrQePSctPxXqGgR4Iu7QgR5qwfUvGUg==@vger.kernel.org X-Gm-Message-State: AOJu0YwnvrS6KpzPnhC/2DwL3wWqxNIpOjaqcnPmoxFkWPUD6qB8StKC 5Wqy1yzu9UvkMcIVbzm7b20Zn/F/rE1YgK4SFQcXOCDYe7VmnmCPY6BMyl7eglEnk6S+SN3Ov9u yAKRBvCj+E/du2D/+7j1a0KiauI7fEXK7qdYaTs568A5i3tXN2j432LTVrHYEQyRoUg== X-Gm-Gg: ASbGnct4N00mivMCaOZeTkP1mQwQPTU7IoBcj1uSLYMWxtYVNKR6JWQBMpS1JqPSykd qbM2k20PInR732Z8aD13sl7mLxZqKyPInXoPjQluhCRSdyagCzhrJZP7ryaT+64G0sKBtE+kTmL q7YtLw8OO4PHDrdn0JbYjJxTPa7Y4ANdVlqalopAfecQ8zjB25xLufUViuZgGCaR+8U+aLuX+Y+ bj/IH1NlqXn8cVVrQ0EdrsuTGoi93tEKIVWGUl60v2Gf7wYI5ql7jXu8vguWymeXmdOBBKWIZ/W RLkVrFVN8U32cADGn2Jlpldsr9pNFUT2OFJntGuAzmYCkx2oD1KaV6SXV1grEotp98CNtYVjHbu EvZiEKiDtinxwqFDwCPePNKngStbjy5pg700bv281 X-Received: by 2002:a05:6a20:430e:b0:1f5:9aac:64dc with SMTP id adf61e73a8af0-201046669b7mr21491139637.20.1744092405517; Mon, 07 Apr 2025 23:06:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEE49W85eT/fLzhiTWBG/SxZbu6DecyAqbza+jaSMRXdtL50P/KdWMEi40rhdrIzkfKQ5rqfw== X-Received: by 2002:a05:6a20:430e:b0:1f5:9aac:64dc with SMTP id adf61e73a8af0-201046669b7mr21491106637.20.1744092405175; Mon, 07 Apr 2025 23:06:45 -0700 (PDT) Received: from hu-adisi-blr.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af9bc35079fsm6863981a12.41.2025.04.07.23.06.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Apr 2025 23:06:44 -0700 (PDT) From: Aditya Kumar Singh Date: Tue, 08 Apr 2025 11:36:29 +0530 Subject: [PATCH ath-next v4 1/9] wifi: ath12k: fix SLUB BUG - Object already free in ath12k_reg_free() Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250408-fix_reboot_issues_with_hw_grouping-v4-1-95e7bf048595@oss.qualcomm.com> References: <20250408-fix_reboot_issues_with_hw_grouping-v4-0-95e7bf048595@oss.qualcomm.com> In-Reply-To: <20250408-fix_reboot_issues_with_hw_grouping-v4-0-95e7bf048595@oss.qualcomm.com> To: Johannes Berg , Jeff Johnson , Karthikeyan Periyasamy , Kalle Valo , Harshitha Prem Cc: Jeff Johnson , linux-wireless@vger.kernel.org, ath12k@lists.infradead.org, linux-kernel@vger.kernel.org, Aditya Kumar Singh X-Mailer: b4 0.14.2 X-Proofpoint-GUID: vvhXSqQpVQMbgVZ0RSAIZuXX2t_J_Nra X-Proofpoint-ORIG-GUID: vvhXSqQpVQMbgVZ0RSAIZuXX2t_J_Nra X-Authority-Analysis: v=2.4 cv=dbeA3WXe c=1 sm=1 tr=0 ts=67f4bcf6 cx=c_pps a=m5Vt/hrsBiPMCU0y4gIsQw==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=IkcTkHD0fZMA:10 a=XR8D0OoHHMoA:10 a=EUspDBNiAAAA:8 a=Qd74P0o9topwJXlKkrcA:9 a=QEXdDO2ut3YA:10 a=IoOABgeZipijB_acs4fv:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-04-08_02,2025-04-07_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 mlxlogscore=751 phishscore=0 mlxscore=0 spamscore=0 malwarescore=0 clxscore=1015 adultscore=0 priorityscore=1501 lowpriorityscore=20 bulkscore=20 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2504080042 During rmmod of ath12k module with SLUB debug enabled, following print is seen - ============================================================================= BUG kmalloc-1k (Not tainted): Object already free ----------------------------------------------------------------------------- Allocated in ath12k_reg_build_regd+0x94/0xa20 [ath12k] age=10470 cpu=0 pid=0 __kmalloc_noprof+0xf4/0x368 ath12k_reg_build_regd+0x94/0xa20 [ath12k] ath12k_wmi_op_rx+0x199c/0x2c14 [ath12k] ath12k_htc_rx_completion_handler+0x398/0x554 [ath12k] ath12k_ce_per_engine_service+0x248/0x368 [ath12k] ath12k_pci_ce_workqueue+0x28/0x50 [ath12k] process_one_work+0x14c/0x28c bh_worker+0x22c/0x27c workqueue_softirq_action+0x80/0x90 tasklet_action+0x14/0x3c handle_softirqs+0x108/0x240 __do_softirq+0x14/0x20 Freed in ath12k_reg_free+0x40/0x74 [ath12k] age=136 cpu=2 pid=166 kfree+0x148/0x248 ath12k_reg_free+0x40/0x74 [ath12k] ath12k_core_hw_group_destroy+0x68/0xac [ath12k] ath12k_core_deinit+0xd8/0x124 [ath12k] ath12k_pci_remove+0x6c/0x130 [ath12k] pci_device_remove+0x44/0xe8 device_remove+0x4c/0x80 device_release_driver_internal+0x1d0/0x22c driver_detach+0x50/0x98 bus_remove_driver+0x70/0xf4 driver_unregister+0x30/0x60 pci_unregister_driver+0x24/0x9c ath12k_pci_exit+0x18/0x24 [ath12k] __arm64_sys_delete_module+0x1a0/0x2a8 invoke_syscall+0x48/0x110 el0_svc_common.constprop.0+0x40/0xe0 Slab 0xfffffdffc0033600 objects=10 used=6 fp=0xffff000000cdcc00 flags=0x3fffe0000000240(workingset|head|node=0|zone=0|lastcpupid=0x1ffff) Object 0xffff000000cdcc00 @offset=19456 fp=0xffff000000cde400 [...] This issue arises because in ath12k_core_hw_group_destroy(), each device calls ath12k_core_soc_destroy() for itself and all its partners within the same group. Since ath12k_core_hw_group_destroy() is invoked for each device, this results in a double free condition, eventually causing the SLUB bug. To resolve this, set the freed pointers to NULL. And since there could be a race condition to read these pointers, guard these with the available mutex lock. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Fixes: 6f245ea0ec6c ("wifi: ath12k: introduce device group abstraction") Signed-off-by: Aditya Kumar Singh --- drivers/net/wireless/ath/ath12k/reg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/ath/ath12k/reg.c b/drivers/net/wireless/ath/ath12k/reg.c index 893650f76fb2d9f24177d524c5a979693b543657..3260df2ad60059117d5340c27a3b82fdcfabd02b 100644 --- a/drivers/net/wireless/ath/ath12k/reg.c +++ b/drivers/net/wireless/ath/ath12k/reg.c @@ -817,8 +817,12 @@ void ath12k_reg_free(struct ath12k_base *ab) { int i; + mutex_lock(&ab->core_lock); for (i = 0; i < ab->hw_params->max_radios; i++) { kfree(ab->default_regd[i]); kfree(ab->new_regd[i]); + ab->default_regd[i] = NULL; + ab->new_regd[i] = NULL; } + mutex_unlock(&ab->core_lock); } From patchwork Tue Apr 8 06:06:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Kumar Singh X-Patchwork-Id: 879332 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD82625FA11 for ; Tue, 8 Apr 2025 06:06:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092412; cv=none; b=UrCtwRk3bwWUxpw5Zke/i8/9DoKLiPzPw/pUkGtBmMRbjEHtZbUrLvm+SGbQZstTYO2D/Vs3MmkJ0xSsJDIrZgYIftQWSwywMeEQpPPPoLN7KFI/NAeZbXzn9EBMPDnWdt8obT/Bw5Yy9T06vXer0A/c2C2as1XzJJ8A4mVrAOo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092412; c=relaxed/simple; bh=xEj5Kb2MB3HDyXSvN3wvDUPq7daHgQbTj1SE/1fqDsI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mpYrSTbuKhgYAf/eK7xxbLJck/4oH5mgwArpIWy4PaTyB2yMnRNn9amD3zDkcCJ0DX4NHYZQig/h6n1BrQLg5yDX2zLuVIq1t3Ur3/leWJ38vZ4VoJyzOkxi6nUN4VLiY0vShBu9RjUCUmlTcdvh0F7wfnRO0YPH5OW88gbfMkE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=ABiyXUcn; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="ABiyXUcn" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5382JKj0014111 for ; Tue, 8 Apr 2025 06:06:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= Y5ujiX5TN5af/Xz2nXtG8TY2vWPEQMb7zUFnh+HQG/4=; b=ABiyXUcnVozxCzRN ilaS22toGlAQCHZOvqc4gpBzy08p0nwqiAw9ANTcGb0Fi3QVO0UDM2ak6z7Zq5T8 eXdNEGV5fywsdYiEZhP79GLA7jFoLgSBQhZYYY2zEfcVsogKFkU9ps6AAQb3l9cR Hz6LSwuRn85DY283HvU+gjzqpIVPEwEBn2a/gT4r3Vp/oCAiOWL1sXY55QAdtFCp rE7gEwh80AflKT5uiFU9/DUB8eZ+qRDOfGD7Jeig6arQPH9/xAjatnR5kP+PEfSU w1e6r/5b95aSUg4uh6epbcFRdCDxnk0JuvpM8iMpYP93AXnLLdt9duwcZw9usYoL 5l17UA== Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45twpm6ngc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 08 Apr 2025 06:06:49 +0000 (GMT) Received: by mail-pf1-f197.google.com with SMTP id d2e1a72fcca58-7394792f83cso3888513b3a.3 for ; Mon, 07 Apr 2025 23:06:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744092409; x=1744697209; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y5ujiX5TN5af/Xz2nXtG8TY2vWPEQMb7zUFnh+HQG/4=; b=QBlXf/+hLbP2KOybaHE+ZJn5aXl5R8UCpe5LpXZHCCKSjz+dz6nbB0zwQcEE1BrGJg hmXuzk63OGfyr04moJ1LoqmqRO5URzhmmc9MnIgx7/LY2/yT78kKNZWyWyiY8DCvC9Ll 4kiEqEhm1da9qtwyAaMpPkpTQuRuY7484ZA7RNW6H2WwjX41r+qu+YwifqXNQBQGVn2U ZJkfG8dhIxDX/1N+LwDTYluVZR70DHui+1tyNfFgHzVvfY7/5zpUjoLKngQVRDN5FRxJ A+mlEHzZ5ouqg1/F1yHfaOo5EasIG6DFDIcK43GnZ9/wiEC0oEfZ/lEq68cu/cpp6J2v 7G9w== X-Forwarded-Encrypted: i=1; AJvYcCUh5+XUNfTq3QYnVGumbIbNhgjPgUcjXQqBwYaJtA19x+g++r4ClCga/vYaRsNG+E8qJqU8gDiR2wLm0/Wu9g==@vger.kernel.org X-Gm-Message-State: AOJu0YzVkvFu2zHIfLzTy3hjM84FpwWSWnwt4MlhBGVZ89OHACwncq7a gDw1gwZn5NgT+AJFFMXwPzlr6OCwDX/KdQn2vaBtDUPgNSeJN2SCXIUoAge7/QoS38XaU3SvDMM m6iiEVdtdDC9hA5lXPqz/Ab4pdESCQwMQZY+uHLwMTGUgnggEUb0K0Ysfhb+8pD+HdQ== X-Gm-Gg: ASbGncueRSOhOfbyQuEjp+Qm7OpyNrj1Ar1PjaM6SiUNSroeEsRSPHhwt0lcXZKDK1g 7mj+hM5RRdxAt5m1U0MKBGS2CgTBPPxhnZN+cadiav1awOjPdWcWrtqrd2BIeq3HusCx5fQCK/v PIsT8IKyo2ZELLIGZr87s363c9y7o5245dl5lnYJ8kpfo52Vf692Ln/umcVMvy8LflpVyI0z6Iv LkEwX7zAVNHIsWZvSEQFMgnwqkEz67/3QcAxj1TDEDAAElTLAOF1DUstbL3NqjYl6NLC+mWEuQp +JJtIcrs7TSwt3x166NarVfJQc3mVXvFI6BE2jeyU6LQ09io75l44Qas7umAHweD4d/D/4FnJOy CtJETqTt2TzjaaJlkfB8BpblYwUQ8vTYzUfrpqnDz X-Received: by 2002:a05:6a20:9f8e:b0:1f5:8c05:e8f8 with SMTP id adf61e73a8af0-20113c73e57mr17364081637.25.1744092408639; Mon, 07 Apr 2025 23:06:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGadxRg+Aatc3BVZKnOOTHXj5Tb2ipywTu5R8ckJegG5HqK4rmz9F5E/4Lt9SmzvAPVlzUrng== X-Received: by 2002:a05:6a20:9f8e:b0:1f5:8c05:e8f8 with SMTP id adf61e73a8af0-20113c73e57mr17364052637.25.1744092408234; Mon, 07 Apr 2025 23:06:48 -0700 (PDT) Received: from hu-adisi-blr.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af9bc35079fsm6863981a12.41.2025.04.07.23.06.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Apr 2025 23:06:47 -0700 (PDT) From: Aditya Kumar Singh Date: Tue, 08 Apr 2025 11:36:30 +0530 Subject: [PATCH ath-next v4 2/9] wifi: ath12k: add reference counting for core attachment to hardware group Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250408-fix_reboot_issues_with_hw_grouping-v4-2-95e7bf048595@oss.qualcomm.com> References: <20250408-fix_reboot_issues_with_hw_grouping-v4-0-95e7bf048595@oss.qualcomm.com> In-Reply-To: <20250408-fix_reboot_issues_with_hw_grouping-v4-0-95e7bf048595@oss.qualcomm.com> To: Johannes Berg , Jeff Johnson , Karthikeyan Periyasamy , Kalle Valo , Harshitha Prem Cc: Jeff Johnson , linux-wireless@vger.kernel.org, ath12k@lists.infradead.org, linux-kernel@vger.kernel.org, Aditya Kumar Singh X-Mailer: b4 0.14.2 X-Proofpoint-GUID: C5oVmJddjqst0K7_p3JmmLj3N7o0tf5g X-Proofpoint-ORIG-GUID: C5oVmJddjqst0K7_p3JmmLj3N7o0tf5g X-Authority-Analysis: v=2.4 cv=MpRS63ae c=1 sm=1 tr=0 ts=67f4bcf9 cx=c_pps a=rEQLjTOiSrHUhVqRoksmgQ==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=IkcTkHD0fZMA:10 a=XR8D0OoHHMoA:10 a=EUspDBNiAAAA:8 a=PROE_fPfuV2Hua9vZMcA:9 a=QEXdDO2ut3YA:10 a=2VI0MkxyNR6bbpdq8BZq:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-04-08_02,2025-04-07_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 impostorscore=0 spamscore=0 bulkscore=0 suspectscore=0 malwarescore=0 adultscore=0 phishscore=0 mlxscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2504080042 Currently, driver does not manage reference counting for attaching and detaching cores to/from hardware groups. This can lead to issues when multiple cores are involved. Or with same core, attach/detach is called multiple times back to back. Fix this issue by using reference counting. With that, it is now ensured that the core is properly attached or detached from the hardware group and even back to back calls will not alter the count. Additionally, add some debug logs during the attachment and detachment events for better debugging and tracking. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Aditya Kumar Singh --- drivers/net/wireless/ath/ath12k/core.c | 47 +++++++++++++++++++++++++++++++--- drivers/net/wireless/ath/ath12k/core.h | 15 +---------- 2 files changed, 44 insertions(+), 18 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c index 0e71935b272033c5322e76a01e931087ced875ca..8a571a615313d2f1190fe9afae02dfd385ede7a3 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -640,9 +640,49 @@ struct reserved_mem *ath12k_core_get_reserved_mem(struct ath12k_base *ab, return rmem; } +static inline +void ath12k_core_to_group_ref_get(struct ath12k_base *ab) +{ + struct ath12k_hw_group *ag = ab->ag; + + lockdep_assert_held(&ag->mutex); + + if (ab->hw_group_ref) { + ath12k_dbg(ab, ATH12K_DBG_BOOT, "core already attached to group %d\n", + ag->id); + return; + } + + ab->hw_group_ref = true; + ag->num_started++; + + ath12k_dbg(ab, ATH12K_DBG_BOOT, "core attached to group %d, num_started %d\n", + ag->id, ag->num_started); +} + +static inline +void ath12k_core_to_group_ref_put(struct ath12k_base *ab) +{ + struct ath12k_hw_group *ag = ab->ag; + + lockdep_assert_held(&ag->mutex); + + if (!ab->hw_group_ref) { + ath12k_dbg(ab, ATH12K_DBG_BOOT, "core already de-attached from group %d\n", + ag->id); + return; + } + + ab->hw_group_ref = false; + ag->num_started--; + + ath12k_dbg(ab, ATH12K_DBG_BOOT, "core de-attached from group %d, num_started %d\n", + ag->id, ag->num_started); +} + static void ath12k_core_stop(struct ath12k_base *ab) { - ath12k_core_stopped(ab); + ath12k_core_to_group_ref_put(ab); if (!test_bit(ATH12K_FLAG_CRASH_FLUSH, &ab->dev_flags)) ath12k_qmi_firmware_stop(ab); @@ -879,9 +919,8 @@ static int ath12k_core_start(struct ath12k_base *ab) ath12k_acpi_set_dsm_func(ab); - if (!test_bit(ATH12K_FLAG_RECOVERY, &ab->dev_flags)) - /* Indicate the core start in the appropriate group */ - ath12k_core_started(ab); + /* Indicate the core start in the appropriate group */ + ath12k_core_to_group_ref_get(ab); return 0; diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h index e8d2a0c859f6260d48c4c636793cf3a24c1c61b6..75fb4a99af9442e3c3f042602cc5b26842aa5231 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -1121,6 +1121,7 @@ struct ath12k_base { struct ath12k_wsi_info wsi_info; enum ath12k_firmware_mode fw_mode; struct ath12k_ftm_event_obj ftm_event_obj; + bool hw_group_ref; /* must be last */ u8 drv_priv[] __aligned(sizeof(void *)); @@ -1375,20 +1376,6 @@ static inline struct ath12k_hw_group *ath12k_ab_to_ag(struct ath12k_base *ab) return ab->ag; } -static inline void ath12k_core_started(struct ath12k_base *ab) -{ - lockdep_assert_held(&ab->ag->mutex); - - ab->ag->num_started++; -} - -static inline void ath12k_core_stopped(struct ath12k_base *ab) -{ - lockdep_assert_held(&ab->ag->mutex); - - ab->ag->num_started--; -} - static inline struct ath12k_base *ath12k_ag_to_ab(struct ath12k_hw_group *ag, u8 device_id) { From patchwork Tue Apr 8 06:06:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Kumar Singh X-Patchwork-Id: 879735 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91D2E261375 for ; Tue, 8 Apr 2025 06:06:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092415; cv=none; b=ABReBNQxYBbf0BfbtuJF5TM82vbo8lsygA7vO/i/c8u+DMbyXb9GRy9wNoRbY9dcVQR5A+na/IJqRpx6oHciGK3NdETzx+dn3nyr15G8G+WcmA6j9bAo9+kYQ9nTxUmOUQwbMVDW9TMUV+mN+VZyZoGAes+XGGwNpzKQ+wGAFB4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092415; c=relaxed/simple; bh=Qg2tuu0wK5R2PRbA4sG9GA532XpVl4FSIzs+bRLlMCg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=T+csANCV5gGgO+N8RUzXbl9p396DFHwU2kSDC8fJ0CPMtTtdoOBM4rxcKJIgD5VBt7SljBfru/BEBkud8BexpcTZAc1SPXlW3q3mTTGOdWdYialoeF3KB/46fv67s9BHP7FN3ocQG6teGL/AmYC+qMC8YBZkDkqOwa+ilAt0/7o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=Q90arvgM; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="Q90arvgM" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5382HMFJ023306 for ; Tue, 8 Apr 2025 06:06:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= pxD1d8+SURGaW2WmT3Vs97sir9axBka6nu3u7fHBVV4=; b=Q90arvgMkL3TE1WA mysAs83NjH5kzrWE3STROVHVvYMG77Sh+YFpUtpIf1QZG58NkwHrA4uwgCHwJsJ1 Tr7gNTz9tCZ+PyhONtCnVhLi0qPVM1kZ4aP2Q9Lzanu0CWwXgUZ6mUF7DRm5/Dbk pQCqNRcrYBovURYF5PhbVfyf0GynOtA8I+gwyuMWW6NhNp3HZIoV0q+1jvmntwKI DtwLEYYsa0q9DxlmV8uPMgp+RsTb+Sg/nZRSzg45ITSsEjfU10+xfwdcZ0QIURDj YN7TNezaQy9rxyq2GIGpERK1pBtrdsyWLa0KXoYTaaLQ6PYIL7phPkGaJWmRBDvF LKG/TQ== Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45twftekp1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 08 Apr 2025 06:06:52 +0000 (GMT) Received: by mail-pf1-f197.google.com with SMTP id d2e1a72fcca58-73009f59215so6176225b3a.1 for ; Mon, 07 Apr 2025 23:06:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744092412; x=1744697212; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pxD1d8+SURGaW2WmT3Vs97sir9axBka6nu3u7fHBVV4=; b=mJt7OjlsoS4oI8PF7fwBweB8CsCs2E/zVmLnJ6zHFDu/jaNnOIyjbzlDE7jcgpE92d 0KJgtmXugefxY3RAAalRUw2veIAyXKPNY5Olze8MylCMoDrHfyIgLzqroO2j7XOw2xkV Zrvl3OgTCOyOoVoK38JHiilHmS/NSlP6IAJ+pGvwU2STGrqzuQc1wp/VQhhsSYPODEU4 pmF3b9Br5Pm381241zhw1I62q7BGYGTbamC2y3NxoNpGIHJ0ZR3YS6AHqnfXEVzDF5/C 8qXGTVC/B739C+7Y6LXHfPA0iS9WEOjeEEXHelweEK10H8/kM+/N+RIY2UgLKMNrK4RC BDOg== X-Forwarded-Encrypted: i=1; AJvYcCUhnKELagy75vmmrG3UuxRcQetYI01t16cHZ3PaMZhzNe+u3ajHaR5TTUNbT87eAgB63Xm7LTnlqzDKI7hedw==@vger.kernel.org X-Gm-Message-State: AOJu0YzbL4FCMMWWrMD7TO1h7PMGa/8JkJ6xgiX5zSHzSWxuz8Gu2Odn HvKNWLu0U6o+RbPmeeTJgAN+vH8laeSR8eoUu5SPY5B6vo+JBFp4C7cDKalgs75qA4ATaaepix5 /uE1fd+T7rvHI7aEmQKyZm4nmCCUgb4pmLRcnTTmD+JWOmtae3nR3/kwZFeWAvYbYQQ== X-Gm-Gg: ASbGncuCoL5GT0kflzwRi4RZWL8WJqq/f/w6l+0xLBBiWeQQZ3I1vrfFdxaSNuR1O/Y NnuaBRuaOyYfLDsl4UIxkeXf9vwC2a1ElhCh6W6j0emz+9iAxSfDAKIAl9PCW13c0rlGggCnd1N hUygrzcPm2oOBr1EPxdEhgAg8i9oR8ZyyHjGqoaAZhwWOf4G0pds0xHF5hN0i7rRQwaW7JhaQIK Gt6NTrE7gLaENasHyMcC7o4y0GHNzN8rzu9CB1jqPOA3NUqNfzUHlEwU2/cXol26f0l9ewD52JN mT8fzw0CdCZdMxzQ81OhRywYtkb+KJy4YdFQCB7Gyh2yAH9zm0qkmuDIHPvOEDx+lcLaaRCpxli 3wTVjphBZlJLUFDeuqxbhoZrryOWn07yzTsnEMGcJ X-Received: by 2002:a05:6a20:2d06:b0:1f5:5ed0:4d75 with SMTP id adf61e73a8af0-20108139fbamr29100387637.31.1744092411713; Mon, 07 Apr 2025 23:06:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGGNs6YIAjtRMwCSgr1KcB95nwYEiAKpz4GyZD+0pmYEVFXHVcTPMA7Lk9EKDFmHiBoEw/Jaw== X-Received: by 2002:a05:6a20:2d06:b0:1f5:5ed0:4d75 with SMTP id adf61e73a8af0-20108139fbamr29100341637.31.1744092411321; Mon, 07 Apr 2025 23:06:51 -0700 (PDT) Received: from hu-adisi-blr.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af9bc35079fsm6863981a12.41.2025.04.07.23.06.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Apr 2025 23:06:51 -0700 (PDT) From: Aditya Kumar Singh Date: Tue, 08 Apr 2025 11:36:31 +0530 Subject: [PATCH ath-next v4 3/9] wifi: ath12k: fix failed to set mhi state error during reboot with hardware grouping Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250408-fix_reboot_issues_with_hw_grouping-v4-3-95e7bf048595@oss.qualcomm.com> References: <20250408-fix_reboot_issues_with_hw_grouping-v4-0-95e7bf048595@oss.qualcomm.com> In-Reply-To: <20250408-fix_reboot_issues_with_hw_grouping-v4-0-95e7bf048595@oss.qualcomm.com> To: Johannes Berg , Jeff Johnson , Karthikeyan Periyasamy , Kalle Valo , Harshitha Prem Cc: Jeff Johnson , linux-wireless@vger.kernel.org, ath12k@lists.infradead.org, linux-kernel@vger.kernel.org, Aditya Kumar Singh X-Mailer: b4 0.14.2 X-Authority-Analysis: v=2.4 cv=B5+50PtM c=1 sm=1 tr=0 ts=67f4bcfc cx=c_pps a=rEQLjTOiSrHUhVqRoksmgQ==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=IkcTkHD0fZMA:10 a=XR8D0OoHHMoA:10 a=EUspDBNiAAAA:8 a=zZIk_WvpsQkbQcpLs4gA:9 a=QEXdDO2ut3YA:10 a=2VI0MkxyNR6bbpdq8BZq:22 X-Proofpoint-GUID: uGcZZirGaO7qNVJuwySdY8jlDiz30h0B X-Proofpoint-ORIG-GUID: uGcZZirGaO7qNVJuwySdY8jlDiz30h0B X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-04-08_02,2025-04-07_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 suspectscore=0 malwarescore=0 bulkscore=0 phishscore=0 spamscore=0 priorityscore=1501 adultscore=0 impostorscore=0 lowpriorityscore=0 mlxscore=0 clxscore=1015 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2504080042 With hardware grouping, during reboot, whenever a device is removed, it powers down itself and all its partner devices in the same group. Now this is done by all devices and hence there is multiple power down for devices and hence the following error messages can be seen: ath12k_pci 0002:01:00.0: failed to set mhi state POWER_OFF(3) in current mhi state (0x0) ath12k_pci 0002:01:00.0: failed to set mhi state: POWER_OFF(3) ath12k_pci 0002:01:00.0: failed to set mhi state DEINIT(1) in current mhi state (0x0) ath12k_pci 0002:01:00.0: failed to set mhi state: DEINIT(1) ath12k_pci 0003:01:00.0: failed to set mhi state POWER_OFF(3) in current mhi state (0x0) ath12k_pci 0003:01:00.0: failed to set mhi state: POWER_OFF(3) ath12k_pci 0003:01:00.0: failed to set mhi state DEINIT(1) in current mhi state (0x0) ath12k_pci 0003:01:00.0: failed to set mhi state: DEINIT(1) ath12k_pci 0004:01:00.0: failed to set mhi state POWER_OFF(3) in current mhi state (0x0) ath12k_pci 0004:01:00.0: failed to set mhi state: POWER_OFF(3) To prevent this, check if the ATH12K_PCI_FLAG_INIT_DONE flag is already set before powering down. If it is set, it indicates that another partner device has already performed the power down, and this device can skip this step. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Aditya Kumar Singh --- drivers/net/wireless/ath/ath12k/pci.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c index 7f1bb150f326b317157f6721d990d61a27f38d6a..aae1989c686bda37c12544e72338bbfbc5f75042 100644 --- a/drivers/net/wireless/ath/ath12k/pci.c +++ b/drivers/net/wireless/ath/ath12k/pci.c @@ -1487,6 +1487,9 @@ void ath12k_pci_power_down(struct ath12k_base *ab, bool is_suspend) { struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); + if (!test_bit(ATH12K_PCI_FLAG_INIT_DONE, &ab_pci->flags)) + return; + /* restore aspm in case firmware bootup fails */ ath12k_pci_aspm_restore(ab_pci); From patchwork Tue Apr 8 06:06:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Kumar Singh X-Patchwork-Id: 879331 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3D8D2620C1 for ; Tue, 8 Apr 2025 06:06:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092419; cv=none; b=ebJNSYt7+WTNxFrkfu/3Z0fsbDCb7BgZgVmq2+f5zbfrVTUsd0ZsAwM1ML4tcmhAm8eUvuzYIy0FczCJAvzdQXfJVwgaI3iucvLW2HHyE2QmQXnIzLDxtc0ZatA9bmYJ9ksa9CpIfWsD3S5ANfnLJxt6xbK8o15VTZGzD0rgc9I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092419; c=relaxed/simple; bh=370njgXLQlbYRp5dbJwp/vCqAvoxCiM7iy2NC3LtsHs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ESt3qRrUafG+7vORUK6XUWB+nv5r3IkYZ3X2att4Hg9D7eLwYTV2fhk1SyvPpeg/Z88naygYwjrqLlc3d0/SvB1rx6uEIPtlWZ1lkpzzIBIYB/qRd299oHILRsTK2Id43/fq0f6vl9wa7Qkls3Vxbs+cQentdgUAQdClvHZKInI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=DbmQXOy0; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="DbmQXOy0" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5382GVP0019761 for ; Tue, 8 Apr 2025 06:06:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= hmNs+Dli57VD9IZqVjh4DV7yH/D+861TzD/ZVcimqfs=; b=DbmQXOy0CSvJiPBt Tdm+P6p9sps1/NEvXsK9bGHZguauFuqPvd8z0wxyxNVkEOCEVPfdKsqbJ5YopUqA tV/nLZke/caYirmLtK6NX9p286O/KZ2nAzW9uM3Cto6THK5Ww433KYpg170A4Ldv E2xQQtVQjvniR/8I+C3LfNkn/M84iLF4KEhGk87cQocOg+psp5h4BLxVncObMwmj f93oQm6xtRl/XucrdoPJ3vYkNGwNPzQgA36ZSK8p7kzlpECMCqwXaAxHVnTwPhJ8 lwrmJy0iljTbfXDhuMqB1BFINGTAJaTnUbuQmhABqWlhiwHTpQszZqE8mtfws1oH rpSkBw== Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45twg3emum-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 08 Apr 2025 06:06:56 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-6c8f99fef10so5839650a12.3 for ; Mon, 07 Apr 2025 23:06:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744092415; x=1744697215; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hmNs+Dli57VD9IZqVjh4DV7yH/D+861TzD/ZVcimqfs=; b=WMe4cIwaby5KyzDSQkzo6DOrwicj0Q8Fns721dBTtyV8qF2oXsYL4RHGUvBWXtaxp0 9chSlSTPkF684AOC/eXgg6R+hAJixwLibakYpHL499lcdSqEx7kW0UA8Eq8q7jwq4CnJ Ziuft8yk9S0BuE5gUQEeEEd2edP1X3zG9jor6moJoJjHHoLzAbaN0OvQRsau8w4YX+l+ miEqX9w3a0f2D7Wp5Iv0ho3njqu3MwwK/0TMleYu+zTQTAO1pYM8ezLaLk1e0mHpLnkx MSVZ4VukrkZ1SiQB/dygcC2hgMmO0BfKugJUl/n1IkbaC657t9QhXX2Sx5m2FLDQE7EL bovg== X-Forwarded-Encrypted: i=1; AJvYcCUtnlkpQIrAbFVGuwnlA6eoWs4k2ypVrwKZ9l5XzRzIl4uZrh06iLroZp65xJcPU0Jwm7ITEPfoAviG6rYX9g==@vger.kernel.org X-Gm-Message-State: AOJu0Yz67XcqAVCzbqvYlvG0r0byLeO+WoXSpmQMLMeLDS20/6HPY2Ki jfu/b8MYlhiXFA25Epckn7igFoUsXXVi5IAktUCcfACvJK/pMCpjFyVmScKkdgzqw3DY4A0Pf1T sw/lF9opAAQ+CxIaflp+/sC68qdaAQtBHkmBQooKovvfQrp3ATwzqfgmvX5jWr78Hag== X-Gm-Gg: ASbGncvNgX+vp0aT2+Agb/hrIxaj6suRnMy9IVXdmIxHfvxK/225w4LC9+YUYtoks0/ j5vbv/KuCeLbv0ylf8xK18c9UeKOuurZyWaSQRcVer/e2duMspLLw6KogJEndoaRwWcmVirHFSm oGvU44rs2Xgg+4ya+VW0UHJ6FRO1DXiORfJzpvyUtA3D8ylx/DUD3DoTy1O5eaAKuKmYhgkGwti F/2GcmT44+CeUHtXTiSw7c5tQsLnwI5QKGFiKH5WFH2owi+Rm3YUpxKB6EYu8LOWpsAiYs32lsT HB46bUmbxTD5vQapss+YtyT3BcXz5vp30QLlAouEZIvOV+hiXGJnu/I68E2m5gWKua20e/zNDk9 SUzIlAUsIu0nZUicmEobSfRhYSthubEE46/CNfdFC X-Received: by 2002:a05:6a20:2d14:b0:1f5:709d:e0c6 with SMTP id adf61e73a8af0-201047a3028mr20649701637.42.1744092414740; Mon, 07 Apr 2025 23:06:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEWTZekfKLMCAEMlcaqVGQtNPhQy8cuaqM2WzkcJnwPiRfIo5wEm7mrFmj0K0CA+mBi9nPVIg== X-Received: by 2002:a05:6a20:2d14:b0:1f5:709d:e0c6 with SMTP id adf61e73a8af0-201047a3028mr20649669637.42.1744092414362; Mon, 07 Apr 2025 23:06:54 -0700 (PDT) Received: from hu-adisi-blr.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af9bc35079fsm6863981a12.41.2025.04.07.23.06.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Apr 2025 23:06:54 -0700 (PDT) From: Aditya Kumar Singh Date: Tue, 08 Apr 2025 11:36:32 +0530 Subject: [PATCH ath-next v4 4/9] wifi: ath12k: fix ATH12K_FLAG_REGISTERED flag handling Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250408-fix_reboot_issues_with_hw_grouping-v4-4-95e7bf048595@oss.qualcomm.com> References: <20250408-fix_reboot_issues_with_hw_grouping-v4-0-95e7bf048595@oss.qualcomm.com> In-Reply-To: <20250408-fix_reboot_issues_with_hw_grouping-v4-0-95e7bf048595@oss.qualcomm.com> To: Johannes Berg , Jeff Johnson , Karthikeyan Periyasamy , Kalle Valo , Harshitha Prem Cc: Jeff Johnson , linux-wireless@vger.kernel.org, ath12k@lists.infradead.org, linux-kernel@vger.kernel.org, Aditya Kumar Singh X-Mailer: b4 0.14.2 X-Proofpoint-GUID: NjVULsjxys13OqX-zXUvW6uUA8diEI-6 X-Proofpoint-ORIG-GUID: NjVULsjxys13OqX-zXUvW6uUA8diEI-6 X-Authority-Analysis: v=2.4 cv=I/9lRMgg c=1 sm=1 tr=0 ts=67f4bd00 cx=c_pps a=Qgeoaf8Lrialg5Z894R3/Q==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=IkcTkHD0fZMA:10 a=XR8D0OoHHMoA:10 a=EUspDBNiAAAA:8 a=FkGa1SFpmQEPtfWTPJ4A:9 a=QEXdDO2ut3YA:10 a=x9snwWr2DeNwDh03kgHS:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-04-08_02,2025-04-07_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 spamscore=0 clxscore=1011 malwarescore=0 adultscore=0 priorityscore=1501 impostorscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2504080042 Commit a5686ae820fa ("wifi: ath12k: move ATH12K_FLAG_REGISTERED handling to ath12k_mac_register()") relocated the setting of the ATH12K_FLAG_REGISTERED flag to the ath12k_mac_register() function. However, this function only accesses the first device (ab) via ag->ab[0], resulting in the flag being set only for the first device in the group. Similarly, ath12k_mac_unregister() only unsets the flag for the first device. The flag should actually be set for all devices in the group to avoid issues during recovery. Hence, move setting and clearing of this flag in the function ath12k_core_hw_group_start() and ath12k_core_hw_group_stop() respectively. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Fixes: a5686ae820fa ("wifi: ath12k: move ATH12K_FLAG_REGISTERED handling to ath12k_mac_register()") Signed-off-by: Aditya Kumar Singh --- drivers/net/wireless/ath/ath12k/core.c | 5 +++++ drivers/net/wireless/ath/ath12k/mac.c | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c index 8a571a615313d2f1190fe9afae02dfd385ede7a3..cb2a99d110d5c9ec2c092fe1a2b776b6265c4126 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -958,6 +958,9 @@ static void ath12k_core_hw_group_stop(struct ath12k_hw_group *ag) ab = ag->ab[i]; if (!ab) continue; + + clear_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags); + ath12k_core_device_cleanup(ab); } @@ -1093,6 +1096,8 @@ static int ath12k_core_hw_group_start(struct ath12k_hw_group *ag) mutex_lock(&ab->core_lock); + set_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags); + ret = ath12k_core_pdev_create(ab); if (ret) { ath12k_err(ab, "failed to create pdev core %d\n", ret); diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index 2b6bdc3d2b11a8a5f5733352826c724c671fd49a..5c3c9267e937484cc5f5a7d8032fb3911b4e921c 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -11773,7 +11773,6 @@ void ath12k_mac_mlo_teardown(struct ath12k_hw_group *ag) int ath12k_mac_register(struct ath12k_hw_group *ag) { - struct ath12k_base *ab = ag->ab[0]; struct ath12k_hw *ah; int i; int ret; @@ -11786,8 +11785,6 @@ int ath12k_mac_register(struct ath12k_hw_group *ag) goto err; } - set_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags); - return 0; err: @@ -11804,12 +11801,9 @@ int ath12k_mac_register(struct ath12k_hw_group *ag) void ath12k_mac_unregister(struct ath12k_hw_group *ag) { - struct ath12k_base *ab = ag->ab[0]; struct ath12k_hw *ah; int i; - clear_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags); - for (i = ag->num_hw - 1; i >= 0; i--) { ah = ath12k_ag_to_ah(ag, i); if (!ah) From patchwork Tue Apr 8 06:06:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Kumar Singh X-Patchwork-Id: 879734 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BA262620E8 for ; Tue, 8 Apr 2025 06:06:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092420; cv=none; b=a1jd8CmAXtWmeqgV5DHRxvsiKquhKPHqRuIpK9VEKL3kA3x+5a/5xGfxXsvP1PO8gZ7RyIRMXKQWRvu3Yeb5fyw8i21n2dh+7qhTD86cHpAtsoVd4j07rwRn+qcxpeTN8qAmOLBnIhXxTVkx3O3xkedN4rIpfh+job3JWqRLzXE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092420; c=relaxed/simple; bh=IS9JUQNEXbcjFsJwqQld8Af4tR93LGAzSpGELVi0uxI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=f70DvsZdbrbv5dFHqllMQQ/Bg7J/BEfeTneY9LsDxL8Djf2Q3fZT8XXX5iNjUlgVhsquXsVN9WXAEN5kBbtdIefO0F0tVAi2P56nz2tMsp8wq/1g7FEinMSmRlEGlDrc38jX9yeDzQkI5Y6N4piH6t5Z95rwhqmZJ2qi+OpNxcg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=XUJZrGbd; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="XUJZrGbd" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5382GfxF015965 for ; Tue, 8 Apr 2025 06:06:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= o6ANBOqm+FiRypMhdH8047TO8EdqBvFBZWgckBGsDFA=; b=XUJZrGbdeos3HrnX XrSgA6xaIKcv8ySusU8gbY0+zXeDveJO2b9sXbJU018QHJ+cDDAgNFgch7zyNMS7 9xPdNm4nXdYfTs2OQBBCyBXkjmxAQQZzL3L1LEzFFdN22gZHFkQGURQjBpFh3ABz +3NcMKr+09MgPIvklf2tG7R8vc1fl5aRhLK9cIa5XHq7dnncL0hMWHlgioEqPiRX Hen8MGQRvGswMrspM1yLuzEAey8OgehF8Ec+tKjnQRP7DFFgUllVYskxvlenQorS 1eqiMITKcJh+JOvLsl1BIe7Q2tR55jxtaHzAFkTlh73IeW46cgdUxIx1JZCPA73c uMIwJA== Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45twftekpx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 08 Apr 2025 06:06:58 +0000 (GMT) Received: by mail-pf1-f197.google.com with SMTP id d2e1a72fcca58-739071bdf2eso3792278b3a.2 for ; Mon, 07 Apr 2025 23:06:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744092418; x=1744697218; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o6ANBOqm+FiRypMhdH8047TO8EdqBvFBZWgckBGsDFA=; b=oLnD5cMnXWCEE0DGrh4IgOeDKQBWynMg1kQF67GQSLzva9MrmGb8PBN0sFwLiwFidr H2BQQDOPx1yy5J2BP0punnH4Sj54urLpS6WLvUWPpDML+8mp3Gxmu8Ub20eTHzI8bW/u 4E6ssKbTIHGBycpznWqbohaOT3+X0+9K8G6Ei7EMbgRTEMz6btC9agsgfmE+O3wm0cnt 0/GVsMJq41wPauk9Zxm3XgSwiAeWHuIaod4bOIsRXnGsEoYeLxETJsEfvx4gGBUoBe85 qj0BHp5xGWTcmehlRHaE9UIYY/u/Vcco2uuV0SUSkJyxcptfgv7jchN71ehM8A2dq6R5 7UOw== X-Forwarded-Encrypted: i=1; AJvYcCUtoQ+CTUEZ6gHPD7DRfCIs1K5SqWZ0QNTaCFHkoCE9L878FgzIUQPe1/I15FS4iu5cKBJOT1WgF4jGyPkQNA==@vger.kernel.org X-Gm-Message-State: AOJu0YzUDRYLWNNwfbaruwbBNgSkODtNC35Zmkk6ZqUfPhUp1mM3H2Ai WLSQCw6wOs2VZiv9J5NLAB2pKGOIGOdf19L63GdZmh8CFDj23yaOR+etnbH2+/vnMfppoTiBG9i kjmKN9Klgw8eM3giryAJWZxRYMqXerM91qyXBamroVCu0CyoQsyzPsEU8e0tjEUkJTw== X-Gm-Gg: ASbGncsSq6zJ1fgdiWmh5MAgcn1JeSeBGuvKrev46abDukBg3kOLM3rP6zIGjYhv75t kEOBc6CIhVeSY1WNW9ttkB2DxQmhy7NjYOG1b/BcOM2ovkDsjufc/AGKKffGtr6AkRqsn6a5ULd 2wfn4gd1Vp3FREQBOCT2inJyqo0UzeOjSBrjxb4rYI0greNj1h1m6W+d+vj1BucoigwgprgRjXc q+ON/H9kXLK4CxunWxqezdKEPZsHNSZbpdnQhaPzn9CHMGhXyOX6YjBP5pv1oRVGtCc3t9voH78 AeBXOaLDsYud+LwVB/dHDf0/f2FHe+nOTKN6A75Bd7KtLBgzCOTxJK+fmxSjea2h5x0OyJe6e6x q5appzSl8F+ymo92Yz9c9uFtpzYpxaXc378EJOcSP X-Received: by 2002:a05:6a00:2410:b0:730:7600:aeab with SMTP id d2e1a72fcca58-73b6aa78298mr13548265b3a.13.1744092417861; Mon, 07 Apr 2025 23:06:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGtwlsb6E3Suvk7p5xaMWgdWjGgmaVwWbrEHvBE+yrmvdnE1XhramEak+pBayohMqzjrBY9Qg== X-Received: by 2002:a05:6a00:2410:b0:730:7600:aeab with SMTP id d2e1a72fcca58-73b6aa78298mr13548238b3a.13.1744092417396; Mon, 07 Apr 2025 23:06:57 -0700 (PDT) Received: from hu-adisi-blr.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af9bc35079fsm6863981a12.41.2025.04.07.23.06.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Apr 2025 23:06:57 -0700 (PDT) From: Aditya Kumar Singh Date: Tue, 08 Apr 2025 11:36:33 +0530 Subject: [PATCH ath-next v4 5/9] wifi: ath12k: fix firmware assert during reboot with hardware grouping Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250408-fix_reboot_issues_with_hw_grouping-v4-5-95e7bf048595@oss.qualcomm.com> References: <20250408-fix_reboot_issues_with_hw_grouping-v4-0-95e7bf048595@oss.qualcomm.com> In-Reply-To: <20250408-fix_reboot_issues_with_hw_grouping-v4-0-95e7bf048595@oss.qualcomm.com> To: Johannes Berg , Jeff Johnson , Karthikeyan Periyasamy , Kalle Valo , Harshitha Prem Cc: Jeff Johnson , linux-wireless@vger.kernel.org, ath12k@lists.infradead.org, linux-kernel@vger.kernel.org, Aditya Kumar Singh X-Mailer: b4 0.14.2 X-Authority-Analysis: v=2.4 cv=B5+50PtM c=1 sm=1 tr=0 ts=67f4bd02 cx=c_pps a=rEQLjTOiSrHUhVqRoksmgQ==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=IkcTkHD0fZMA:10 a=XR8D0OoHHMoA:10 a=EUspDBNiAAAA:8 a=fe55Uragd4x0HF6_gBkA:9 a=QEXdDO2ut3YA:10 a=2VI0MkxyNR6bbpdq8BZq:22 X-Proofpoint-GUID: Qcum12MeLcKqsGXWq7toBjxEY7qhAkMf X-Proofpoint-ORIG-GUID: Qcum12MeLcKqsGXWq7toBjxEY7qhAkMf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-04-08_02,2025-04-07_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 suspectscore=0 malwarescore=0 bulkscore=0 phishscore=0 spamscore=0 priorityscore=1501 adultscore=0 impostorscore=0 lowpriorityscore=0 mlxscore=0 clxscore=1011 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2504080042 At present, during PCI shutdown, the power down is only executed for a single device. However, when operating in a group, all devices need to be powered down simultaneously. Failure to do so will result in a firmware assertion. Hence, introduce a new ath12k_pci_hw_group_power_down() and call it during power down. This will ensure that all partner devices are properly powered down. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Aditya Kumar Singh --- drivers/net/wireless/ath/ath12k/pci.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c index aae1989c686bda37c12544e72338bbfbc5f75042..8ee532dcc2652ef4b92bc4c4346af47b783a6708 100644 --- a/drivers/net/wireless/ath/ath12k/pci.c +++ b/drivers/net/wireless/ath/ath12k/pci.c @@ -1757,13 +1757,34 @@ static void ath12k_pci_remove(struct pci_dev *pdev) ath12k_core_free(ab); } +static void ath12k_pci_hw_group_power_down(struct ath12k_hw_group *ag) +{ + struct ath12k_base *ab; + int i; + + if (!ag) + return; + + mutex_lock(&ag->mutex); + + for (i = 0; i < ag->num_devices; i++) { + ab = ag->ab[i]; + if (!ab) + continue; + + ath12k_pci_power_down(ab, false); + } + + mutex_unlock(&ag->mutex); +} + 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, false); + ath12k_pci_hw_group_power_down(ab->ag); } static __maybe_unused int ath12k_pci_pm_suspend(struct device *dev) From patchwork Tue Apr 8 06:06:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Kumar Singh X-Patchwork-Id: 879330 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E415C262D38 for ; Tue, 8 Apr 2025 06:07:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092424; cv=none; b=c6wf6c0soe+r906yTXkYZHLIW/4AH9CoX6fBnMeftCn3C22BqNHLF0H1guJxUwYMGPxtDJAJ2jOeBwAl54TMeVY4RsyepZngE//N4xcmWpUnDtFRrK1hke+A3tofF/1Tn5+wONJ/J2ACoxIZH9vEwmsd3ztmAAzye0G00fqIvtk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092424; c=relaxed/simple; bh=zmz0c4mSLGFxJuRbfWzls38k0cxjuskWRE0Eq554GoA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BhbzmzdbCG2DPYbvn0sMB+AeiEr6531DlZvjZsYAlU2ISPf7bqe1b3vBCBMbFKu4O4Nmt8GxfxUBL6TvT8MzIfkRhNui5fHKsztjF5M3RjUiARUUANk2YRN79AVngHQ2It+b/Ir0pMhO1MywG/BVN91UIs7OBjqPWG/qMS8vbMo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=dUo57VaS; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="dUo57VaS" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5382GQob000962 for ; Tue, 8 Apr 2025 06:07:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= XilFwlxG3QLgFkotXu2wdZpmkObNvAbLqmHueg9pqb4=; b=dUo57VaSdG2Vu405 ibWQyYjVwgAmv0QCTKKLtwtisPg2OdvfgFzBvY9Ph8ao5lYhc/FZZ9mMloXDtAmr cUMV/EqGWg+/qSEIutKiuWDoQuijoj2WUYiUFwk8p+VtFq8725SbgD9LHE5ZxwxR sG4XWa/xGBwNJRF+twzv+BXksxTz5X64Ozh89JixDAU2R7NhH+XYXmEf0CAMxe/p xO6NORG3LqIZzxSb0QVv40mDEWeUAq4mVhzZYYrSycMjHx+OR67XwRF4C1u2PQM+ pn07XrG2W+9pRvpgpTM7+jTl3ZLm3V/MzugwdidZMA/ayAGWeOaBLqKfj3LxR62s Sk6cag== Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45twbe6q1h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 08 Apr 2025 06:07:01 +0000 (GMT) Received: by mail-pf1-f197.google.com with SMTP id d2e1a72fcca58-73917303082so3600376b3a.3 for ; Mon, 07 Apr 2025 23:07:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744092421; x=1744697221; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XilFwlxG3QLgFkotXu2wdZpmkObNvAbLqmHueg9pqb4=; b=Bazsvz4LbY1QLrBcx7tO/6e2fJt6hv0KvIbb/tH4JJlavMRF5ZvnCTM4HfL5OgJEAH 3pNkxtM9UfZd7w75Yo8SZRfxTFfkXAEU+5c+1ezaGYIfnuwoDZVMQw5WbUqWqW9RG5d4 Tvft9fn3oHK1XpsTQmfQeLu98T4YY/B0bWtGtTVpZ3f0x+7w1suw3h8b9bK2tkRaK3/J LeqQvXoct+ZJ1DFNNNFWDfhxtAMGmQPNzEJpD1ookdjv3O+v4gHqkpeuY0Y5T/6jVrnv 28Jj2JStxaSYaUxb2kVk7fol8TXA/WWDkSy4imhSUg/rsaPGnUkQm7GgF+LbiOzCRbaX cVOQ== X-Forwarded-Encrypted: i=1; AJvYcCXf5e9e4KGeas3fqnh4RD2gAs6h2iriQlQMLeJNNJ29j52saaQO+bBWALi5BrtogqpuolXkTpkz3+eA3z9wOA==@vger.kernel.org X-Gm-Message-State: AOJu0YxBrGgXYwdqLcHBflNlgx4f55NprDQtoTKkEhkSbQ8h1VqwqAyY 65VzkcNXrMFrJ81Yn73hyLh3na0RMokjLfcZ30a0VIVbwHvVDKbfI8vWd5XNXk+dnlNxS1LgYo9 MkG7w3cIlFnxkpY+NhzYgC98rATQqDECzuUHfJwL3qS+Ixw6T+z/LqbJmE/DcQwTQhA== X-Gm-Gg: ASbGncu1ThHxbgvnO0L24wFIpCGPMUbFwsFlXXwOeigyL0B3wTMPFz3JPCiDD4Muzj1 vgm99+fG4ItOC/4BXPnNdS91Tc7c8ZbhEYilU4Stv76XPNFzyXvYII97Jf/t1RnwpMCc9B+MIst 6SfjXnVpjrHBDdiEIfmyb47l4pIyywJMMan1vL34mPWr6IG9mAE3i15+Ieir3fo0xjeE5OWHtKu VstO99tE2M0s2Qb9+/1UtjAZ9i86+LcEVq1nNN6sXGEqyfKXkFptEEUkdzwpdRqTxoBFOXZEvGk 4em4R0M9CB0kB6BFGE6V/eSy7DfRyoIp+FQkiYKTufD27/juu339cpecEE2nOHQO7J0Tpiqly/6 UjhmvlJC4uvjeYd5e2IGssDIREjLgGwGNNSjt7Kla X-Received: by 2002:a05:6a00:2186:b0:736:54c9:df2c with SMTP id d2e1a72fcca58-739e4be8c14mr19886998b3a.15.1744092420831; Mon, 07 Apr 2025 23:07:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6V1K+A72p6ax1SQOI5iH5ofN/dK0np0CGIaKKMDNjVDYs3xGeXEuliC86DR471I1M0d0xYQ== X-Received: by 2002:a05:6a00:2186:b0:736:54c9:df2c with SMTP id d2e1a72fcca58-739e4be8c14mr19886980b3a.15.1744092420424; Mon, 07 Apr 2025 23:07:00 -0700 (PDT) Received: from hu-adisi-blr.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af9bc35079fsm6863981a12.41.2025.04.07.23.06.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Apr 2025 23:07:00 -0700 (PDT) From: Aditya Kumar Singh Date: Tue, 08 Apr 2025 11:36:34 +0530 Subject: [PATCH ath-next v4 6/9] wifi: ath12k: fix ath12k_core_pre_reconfigure_recovery() with grouping Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250408-fix_reboot_issues_with_hw_grouping-v4-6-95e7bf048595@oss.qualcomm.com> References: <20250408-fix_reboot_issues_with_hw_grouping-v4-0-95e7bf048595@oss.qualcomm.com> In-Reply-To: <20250408-fix_reboot_issues_with_hw_grouping-v4-0-95e7bf048595@oss.qualcomm.com> To: Johannes Berg , Jeff Johnson , Karthikeyan Periyasamy , Kalle Valo , Harshitha Prem Cc: Jeff Johnson , linux-wireless@vger.kernel.org, ath12k@lists.infradead.org, linux-kernel@vger.kernel.org, Aditya Kumar Singh X-Mailer: b4 0.14.2 X-Proofpoint-GUID: U8pDS7bWi3zmZFUtuHbyYCbzWDPhrfDn X-Authority-Analysis: v=2.4 cv=T7OMT+KQ c=1 sm=1 tr=0 ts=67f4bd05 cx=c_pps a=rEQLjTOiSrHUhVqRoksmgQ==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=IkcTkHD0fZMA:10 a=XR8D0OoHHMoA:10 a=EUspDBNiAAAA:8 a=d-GbLxaNKwXvygB75HgA:9 a=QEXdDO2ut3YA:10 a=2VI0MkxyNR6bbpdq8BZq:22 X-Proofpoint-ORIG-GUID: U8pDS7bWi3zmZFUtuHbyYCbzWDPhrfDn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-04-08_02,2025-04-07_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=999 lowpriorityscore=0 adultscore=0 phishscore=0 bulkscore=0 mlxscore=0 malwarescore=0 suspectscore=0 priorityscore=1501 spamscore=0 clxscore=1011 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2504080042 Currently, ath12k_core_pre_reconfigure_recovery() reconfigures all radios within the same group. During grouping and driver going for a recovery, this function is called as many times as there are devices in the group. Consequently, it performs the same reconfiguration multiple times, which is unnecessary. To prevent this, add a check to continue if the action has already been taken. To simplify the management of various flags, the reason for hardware queues being stopped is used as a check instead of introducing a new flag. While at it, also add missing wiphy locks. Wiphy lock is required since ath12k_mac_drain_tx() which is called by ath12k_core_pre_reconfigure_recovery() needs this lock to be held by the caller. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Aditya Kumar Singh --- drivers/net/wireless/ath/ath12k/core.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c index cb2a99d110d5c9ec2c092fe1a2b776b6265c4126..0fb3e57cd254ede767528e47e1d9d183257e5b71 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -1411,6 +1411,18 @@ static void ath12k_core_pre_reconfigure_recovery(struct ath12k_base *ab) ah->state == ATH12K_HW_STATE_TM) continue; + wiphy_lock(ah->hw->wiphy); + + /* If queue 0 is stopped, it is safe to assume that all + * other queues are stopped by driver via + * ieee80211_stop_queues() below. This means, there is + * no need to stop it again and hence continue + */ + if (ieee80211_queue_stopped(ah->hw, 0)) { + wiphy_unlock(ah->hw->wiphy); + continue; + } + ieee80211_stop_queues(ah->hw); for (j = 0; j < ah->num_radio; j++) { @@ -1439,6 +1451,8 @@ static void ath12k_core_pre_reconfigure_recovery(struct ath12k_base *ab) ar->monitor_vdev_created = false; ar->monitor_started = false; } + + wiphy_unlock(ah->hw->wiphy); } wake_up(&ab->wmi_ab.tx_credits_wq); From patchwork Tue Apr 8 06:06:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Kumar Singh X-Patchwork-Id: 879733 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BE72263C72 for ; Tue, 8 Apr 2025 06:07:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092428; cv=none; b=tzNdWKzV9oborGHiBSpdFKcxQrPFuz+ud5kSsWkKMMC7jigEb+HwmWtNtEX1nm4GBf1HlDHc93AywUwZJWVyVbizNmYFkH+Y3kKMJeLWARi3p2VxDpllczp6ynVahpxXfdwdS+Oo5OldCQ7oBKVYWe8lm04I/lP/ktpqVTeg2Xw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092428; c=relaxed/simple; bh=ilPjgkafgyzznZHuUen0W6iN7bRy3vMa4VsRmnlzJtA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=R0nVpBel/Y/MwcMxvWdHxepgtpYF8BBSvskFPmIl7oSZymtz9tCRNXFy8b7NZWsBXyjYkLdlzAc9nOylOmxoXaUOH57sod7pSApidpmJZ5cM8lR91WCBddHceMp/O+1Cwyw6zyfqdzamF+9XnHdG1ccWVmJekPoY5bJODYGVY94= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=fL38UVB7; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="fL38UVB7" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5382GOvO019568 for ; Tue, 8 Apr 2025 06:07:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 8QQxTRGzAWSkjPcsxs8V36ycVB81HcrD4UeC7M77KZM=; b=fL38UVB7bNHdaEQj Wc1QFOcTKceTSt3/ZbS+K6nF5hC8r9LKlPSpPblwk7C/6VOxLcPA6SagD/by5hqJ C1LgeC6qrI7POL7IGnmMJIVGZfRKnRPr4z2uR6rO7cOgeE6val6/4B0HqDLI8rYE fWtXBPcngG4dBKeWIc4UKCNcHOl7UWYFbUe5rYXjlVDFKNPutm1a/UvOUrpdAED3 dssyJ/VeB+oFs+kkdeWMvfRsy66TRslVuKf5pBt3Z1/1FbZSXlqa+QMSDDlwkWgW KIwFKxCly0Ewb8N5j8VSf/CZCO95KT4cVejRwS6OqfPG1qOt0QPwciyyxMRP4pzU SVOmaQ== Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45twg3emv6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 08 Apr 2025 06:07:05 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-af8e645a1d1so3116148a12.3 for ; Mon, 07 Apr 2025 23:07:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744092424; x=1744697224; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8QQxTRGzAWSkjPcsxs8V36ycVB81HcrD4UeC7M77KZM=; b=RtVC1+/S99L/ygcol9OwgsxWoLG79tStlU3CgdTniZsCQLy4yLm0dms3bO7H8AI7o+ k0nGDpvC8jGu6quSqLmi8gDmM9rORtV18C6moPNjAb3ClEyPRg+Us65SxNSNntn7iSQk I05XX6OedTwSdKieFwg+f7pTg2Nfhwdr6KGN571Jlp0IuNxpE8wftJ0RWjldXi7PrdgQ x3R8IM1WPH/h9CL7vT1SEGj40xfWHSj7y05XtbtKyCb62pZHZ0sFz8UAyzPSFCUpel9v UbbfoqgAVhnbpvd/YsrUXZDrLXPZ7LuuTParIt6Vg7oj2o5DMh3IWiBP3QX00LyBc1Q3 X9qw== X-Forwarded-Encrypted: i=1; AJvYcCVuMxsnC/MPo2/lRhR/pIsObzfpej/Ut4fVm/1ipeFi0tJuksed9bf8CU6xl5erINMLkK2zDAZwWBQ967Kifw==@vger.kernel.org X-Gm-Message-State: AOJu0YyDRrmTw4bPmfM632SkY9yoN8judhFJg27nCbcLvV6g+xlx5oQO 3t56mcihoq/Hm5toXzU5I0/6ieuCH7KeRQrPk7uncW0inFNH3U6qSK+if5byeCp1R/6PxuRYAtB PcGOR/UPIj4kSPdGgyquOaA2E8x1Udrq7AcioO0sRrDsmlWKniJWzhRzVGKK7jJSVTA== X-Gm-Gg: ASbGncsrPz9AnF8vr6abkXu//2apHgRQElgGKVqmEz3ceGB8Q2gBXT35x+7oaZ/Bx/S gx+dLLt+Jad3gtta1vvbXzV62gKyO3xGb3qZyx0xi3592qZArLG4eTIc3vbe2ldwLb8ro6JbSEY 6SRaN7PNBBxK4oUv0+sevrpL6b4SOmNbXecvsCfhbnWhFXAftNuFjhVsrHVqQIrSj7Xwly6fw/B Qwy5v5SoZvRbKV9Pmb6xMl31gOgjXfeBoOixYpS7pl8VJAQ5qeZAzXGsuRlfa4A/dM0KonCXLxh u2VPt9JHfEyUQGWRrxVz3xW/vXDSXJwlIMGsHHGtId8ZZY0Uv3M1VY3yBBs3kwt1V7taNfQUs1M EPxbkWmeyvV60vWElRra2GLRVKSFNYO1/rwUxFu31 X-Received: by 2002:a05:6a21:9106:b0:1f5:7873:304f with SMTP id adf61e73a8af0-201047308d3mr23586256637.37.1744092423917; Mon, 07 Apr 2025 23:07:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEGehgwvENWYFAh7L0VL6AOYJv5Q31lAnQj6VPBRBRWbyGqHgmJcLhq5+f5Nogv81PMUJMbnA== X-Received: by 2002:a05:6a21:9106:b0:1f5:7873:304f with SMTP id adf61e73a8af0-201047308d3mr23586228637.37.1744092423532; Mon, 07 Apr 2025 23:07:03 -0700 (PDT) Received: from hu-adisi-blr.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af9bc35079fsm6863981a12.41.2025.04.07.23.07.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Apr 2025 23:07:03 -0700 (PDT) From: Aditya Kumar Singh Date: Tue, 08 Apr 2025 11:36:35 +0530 Subject: [PATCH ath-next v4 7/9] wifi: ath12k: handle ath12k_core_restart() with hardware grouping Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250408-fix_reboot_issues_with_hw_grouping-v4-7-95e7bf048595@oss.qualcomm.com> References: <20250408-fix_reboot_issues_with_hw_grouping-v4-0-95e7bf048595@oss.qualcomm.com> In-Reply-To: <20250408-fix_reboot_issues_with_hw_grouping-v4-0-95e7bf048595@oss.qualcomm.com> To: Johannes Berg , Jeff Johnson , Karthikeyan Periyasamy , Kalle Valo , Harshitha Prem Cc: Jeff Johnson , linux-wireless@vger.kernel.org, ath12k@lists.infradead.org, linux-kernel@vger.kernel.org, Aditya Kumar Singh X-Mailer: b4 0.14.2 X-Proofpoint-GUID: 99uJ1CiX_-U4AN0EhalwMzPQLXY7EtO2 X-Proofpoint-ORIG-GUID: 99uJ1CiX_-U4AN0EhalwMzPQLXY7EtO2 X-Authority-Analysis: v=2.4 cv=I/9lRMgg c=1 sm=1 tr=0 ts=67f4bd09 cx=c_pps a=Qgeoaf8Lrialg5Z894R3/Q==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=IkcTkHD0fZMA:10 a=XR8D0OoHHMoA:10 a=EUspDBNiAAAA:8 a=J1AqtRd1v4e3_tdQaqEA:9 a=QEXdDO2ut3YA:10 a=x9snwWr2DeNwDh03kgHS:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-04-08_02,2025-04-07_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 spamscore=0 clxscore=1015 malwarescore=0 adultscore=0 priorityscore=1501 impostorscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2504080042 Currently, when ath12k_core_restart() is called and the ab->is_reset flag is set, it invokes ieee80211_restart_hw() for all hardware in the same group. However, other hardware might still be in the recovery process, making this call inappropriate with grouping into picture. To address this, add a condition to check if the group is ready. If the group is not ready, do not call ieee80211_restart_hw(). Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Aditya Kumar Singh --- drivers/net/wireless/ath/ath12k/core.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c index 0fb3e57cd254ede767528e47e1d9d183257e5b71..a1c9b8771e9c4c84548da2cb4054b0403aa8c759 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -1560,12 +1560,22 @@ static void ath12k_core_restart(struct work_struct *work) ath12k_dbg(ab, ATH12K_DBG_BOOT, "reset success\n"); } + mutex_lock(&ag->mutex); + + if (!ath12k_core_hw_group_start_ready(ag)) { + mutex_unlock(&ag->mutex); + goto exit_restart; + } + for (i = 0; i < ag->num_hw; i++) { - ah = ath12k_ag_to_ah(ab->ag, i); + ah = ath12k_ag_to_ah(ag, i); ieee80211_restart_hw(ah->hw); } + + mutex_unlock(&ag->mutex); } +exit_restart: complete(&ab->restart_completed); } From patchwork Tue Apr 8 06:06:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Kumar Singh X-Patchwork-Id: 879329 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 850F5263F3B for ; Tue, 8 Apr 2025 06:07:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092431; cv=none; b=l7/bvu7cKasPTt1xzve8q2/S9X35oBr4oH6nRPWRkkbLHu4IgAusnOAuFdLybwKoa28xRYBaM+idTPc+3w555IpbxN4VW9fZFRx3OB99AbblClpV+uMcHIPPkOEhoU6zFBU08OWIsODmSEMtm96rADIFwhvk6Sec6jbcOCcwimk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092431; c=relaxed/simple; bh=SD7Xq6PJnyE6Dco8m8zhabJvgDfWZfqJu+X+VlTeIp0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fl1pUu4wHsJq67HDo9jbMg0qmWtGncMm267ve2RI55O/k7wSzTi6ew6UVbPOTUCMaRO4z5pRCRlZxg8gC1qO7ko8UlZ6BKpn158SkIoVIQ4Pz46tK34agqVDEixJuYgAtX/WHhTtc4bOeLHzaUMhSqbEdM6tW3msm5HHpYeBRAg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=DsNBpDpH; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="DsNBpDpH" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5382GebR027883 for ; Tue, 8 Apr 2025 06:07:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= LIxkWENj/q2hTkMwvmODIhHwoW25U8wZdObE/3hO0NI=; b=DsNBpDpHYogO5ivX rtKEac5xXk9Q4qsqnusChpqD30EvEDslUg+/Xfb1Xo8TtB1MQZ8xXeOg0XhQVA8u 3rGPK+DB6tocg48AhuBwdc5O19gUWiNJU0D5c029Umlpp4+5GkJn7vfHWzSB1Ayj feHeWaBw3fH3St2SEjlcOR4tIZZf0SJo2YFML33HkV75yaR1oFqguNnOF2dXz2so JC116sOqU6fw+yVUmWHIuKk3VR+bOPl02RyvjIQllSVFpvE6YktMDF6ipfy1B6Uf jJm+NyUH2+7w0TZANZ2vMI6s/UazFLapkjFnYv/gea5YH+E9fIwzzL7XCtw0q+s4 E7a0RA== Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45twcyxp3f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 08 Apr 2025 06:07:08 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-b00aa1f50d1so618705a12.3 for ; Mon, 07 Apr 2025 23:07:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744092427; x=1744697227; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LIxkWENj/q2hTkMwvmODIhHwoW25U8wZdObE/3hO0NI=; b=Ck2Q6CTJjImuOgImJ9Y7nYlrUPO5rN0OBbJfh8fWNNewSE1ObA2G5doPzw4U6XMkCg Nnvbtc1I3jzseZjqXUXHFP5UmjSVRaM0DPnbQrkVfYSMMl00kmywt1w2Lfah/hqkXDxq yFOlXZmJ7LLu/1VWxri6DE39Xa7EZpYo71z0qyY7JSGKGXEH7ABHRvPGFR57DrnQpsdW AbMTLxZ/FQiP7k8ucYeSZ2yeBReKGAZf/crE/OnNzYyttP8KxnNadq+bPLfefq8CzYYa 7yqv0JAKxeYTxw4UtxSzF8X69kxuq5P0V8VrnmWLDFZjiPvmt7N2c8i2Q39CxfjNXyfn a/Pw== X-Forwarded-Encrypted: i=1; AJvYcCVNyJ6lblAxusVZQS7Zz3W014I4W2J5kgG5Ztr5J0aa9HfRRQfzpO+YVmuBIMOSEK4Hb5EtUGOgd+Xd3gLKvQ==@vger.kernel.org X-Gm-Message-State: AOJu0YzFOQzRj5L1AJpCVSo2+6/ciqcKjdWL3dpqnp4ixshsc+2UIWoC 5fMu5DF0JldWyTmVvMLMZULNgkQ2+DvkfyH8ODejGDOKzfQAKlyEQra12whYhYaZEyO5DddGhIl F7mFYHcKeCn71c/CoY04BsOVV4VOcadXRHYksm6yOjqzzPmafKifNrYgHne4j57yAxA== X-Gm-Gg: ASbGnctSd/TwI2mJLB0Mlpy4GVb0Hr7qRnxUGOX0unFLK4kH56JC+mkl4Onl2y1HuBe GZEUfS9mXeBPy9YkHU7RasctrLjELXnDwu/dUfevtaX0CbQ2vUSxgFrTT8hXpv43tCllTcXGZhp /YvDPu4lcyUy4M7FsilQ/ALJQUKrdq4jEsn7MBggYI8ih1SuR2B1TyXND265I8pFgWS2/YAGq0o v7wf+r/MS7ioGiUazEBQJHGz8T9XgI0yAHpopRGquL9ns+8YQjZhOmOKEMmRdnFSaMJmHyRoQCZ nuTDHE6QuJ+Iw7vz36ac/V5XQ1z6pHLkzIXAcNOcptJ1n1XC3b4U2NYFNPKIHi8Dskwj9A69tGC 1WeUjFY9FTKbfJMkTCSbOMagd68aEV+DyrkHLD2Mp X-Received: by 2002:a05:6a20:e615:b0:1f5:6e71:e45 with SMTP id adf61e73a8af0-2010472df50mr23137221637.27.1744092426944; Mon, 07 Apr 2025 23:07:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFUfZpNpImfeyNF3xfOncodEa1J6cUs6peESY7TuolTeZvZk3fkw9PWN6do2t15rjWkh0MPUA== X-Received: by 2002:a05:6a20:e615:b0:1f5:6e71:e45 with SMTP id adf61e73a8af0-2010472df50mr23137196637.27.1744092426609; Mon, 07 Apr 2025 23:07:06 -0700 (PDT) Received: from hu-adisi-blr.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af9bc35079fsm6863981a12.41.2025.04.07.23.07.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Apr 2025 23:07:06 -0700 (PDT) From: Aditya Kumar Singh Date: Tue, 08 Apr 2025 11:36:36 +0530 Subject: [PATCH ath-next v4 8/9] wifi: ath12k: handle ath12k_core_reset() with hardware grouping Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250408-fix_reboot_issues_with_hw_grouping-v4-8-95e7bf048595@oss.qualcomm.com> References: <20250408-fix_reboot_issues_with_hw_grouping-v4-0-95e7bf048595@oss.qualcomm.com> In-Reply-To: <20250408-fix_reboot_issues_with_hw_grouping-v4-0-95e7bf048595@oss.qualcomm.com> To: Johannes Berg , Jeff Johnson , Karthikeyan Periyasamy , Kalle Valo , Harshitha Prem Cc: Jeff Johnson , linux-wireless@vger.kernel.org, ath12k@lists.infradead.org, linux-kernel@vger.kernel.org, Aditya Kumar Singh X-Mailer: b4 0.14.2 X-Proofpoint-ORIG-GUID: 5lp8LYpYNCTYJA-RucVkT8ypOv5YNOOc X-Authority-Analysis: v=2.4 cv=Q4vS452a c=1 sm=1 tr=0 ts=67f4bd0c cx=c_pps a=Qgeoaf8Lrialg5Z894R3/Q==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=IkcTkHD0fZMA:10 a=XR8D0OoHHMoA:10 a=EUspDBNiAAAA:8 a=WsyaGQEz6myPfAgSfy8A:9 a=QEXdDO2ut3YA:10 a=x9snwWr2DeNwDh03kgHS:22 X-Proofpoint-GUID: 5lp8LYpYNCTYJA-RucVkT8ypOv5YNOOc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-04-08_02,2025-04-07_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 spamscore=0 clxscore=1015 phishscore=0 bulkscore=0 adultscore=0 malwarescore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2504080042 Currently, in ath12k_core_reset(), the device is powered up immediately after a power down. However, with hardware grouping, when one device asserts, all partner devices also asserts. If there is a delay in processing these asserts, by the time this device powers up, other devices might still be asserting, leading to an overall recovery failure. To prevent this issue, ensure all asserts for a group are processed before initiating the power-up sequence. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Aditya Kumar Singh --- drivers/net/wireless/ath/ath12k/core.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c index a1c9b8771e9c4c84548da2cb4054b0403aa8c759..55db189d82346438272c94f25b62dd0db8716efb 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -1582,7 +1582,8 @@ static void ath12k_core_restart(struct work_struct *work) static void ath12k_core_reset(struct work_struct *work) { struct ath12k_base *ab = container_of(work, struct ath12k_base, reset_work); - int reset_count, fail_cont_count; + struct ath12k_hw_group *ag = ab->ag; + int reset_count, fail_cont_count, i; long time_left; if (!(test_bit(ATH12K_FLAG_QMI_FW_READY_COMPLETE, &ab->dev_flags))) { @@ -1641,9 +1642,31 @@ static void ath12k_core_reset(struct work_struct *work) ath12k_hif_ce_irq_disable(ab); ath12k_hif_power_down(ab, false); - ath12k_hif_power_up(ab); - ath12k_dbg(ab, ATH12K_DBG_BOOT, "reset started\n"); + /* prepare for power up */ + ab->qmi.num_radios = U8_MAX; + + mutex_lock(&ag->mutex); + ath12k_core_to_group_ref_put(ab); + + if (ag->num_started > 0) { + ath12k_dbg(ab, ATH12K_DBG_BOOT, + "waiting for %d partner device(s) to reset\n", + ag->num_started); + mutex_unlock(&ag->mutex); + return; + } + + for (i = 0; i < ag->num_devices; i++) { + ab = ag->ab[i]; + if (!ab) + continue; + + ath12k_hif_power_up(ab); + ath12k_dbg(ab, ATH12K_DBG_BOOT, "reset started\n"); + } + + mutex_unlock(&ag->mutex); } int ath12k_core_pre_init(struct ath12k_base *ab) From patchwork Tue Apr 8 06:06:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Kumar Singh X-Patchwork-Id: 879732 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E8DAF25FA02 for ; Tue, 8 Apr 2025 06:07:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092433; cv=none; b=PA1EsDPUg60kNg73U9yRwSYdk3h315rEtOmynWTOF8nLzfKCU9eHsSzUJ+plbQCY1oJy0nVuoiNqSx8Ch++K3T6+Y2RtnKXsK/50+58q26p+IUED1sNs7311A2gDXna5K/lIB3l1/JT77QtkrInhUfp26fIfQN/DxydX30B92Iw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092433; c=relaxed/simple; bh=iFvBxuI8JXsz6HSNF+NVcvvqpqMG6oPrAR680qTQYXA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hy22FuZpd0QUzZ+Hw6nyswuQuw/HWAWXARO7RO+ZD+7DA8/8UNyFhG6z4zjfNW4XJtZKglRaPjIanvI0yuXNlAJiQfIihJWFmB+2950H368gGS9MYIqsKlo+0HTggSdJdqI0FYvW5wE8l8GS4lq8KIe+PaIcIy3DkwKv/xCJkmo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=if4O7gDJ; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="if4O7gDJ" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5382GaU1008216 for ; Tue, 8 Apr 2025 06:07:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= TBNsYFDvRWgIGDQos+hDO8AQ7SgvMSnwcorWv3miZ/Q=; b=if4O7gDJWETnX+vS JgacxQhsi06ndsmYzIVb1jfx4hT4IhXNoBS3tAiBigfUkTNMslPdzqA83/RzxhC2 NDw1Q2hN8M6vtKBwuD+2o/PHK/kygCKrpLvnmml3JuWVx0PvKfY/e3QGWVs57GPD VOA3OaJiYfKaZlcMQ/6ZfmAMZyiyofw8gLzM/pNsSCt+YdvFfqafHPD2z6wjAzwg WRNSyG3pKFJ2G6JMUjzJOv4jfQqO2dfXZh13Jg/q3A2zTf0JaHpLdnGA4l4xCj8V Ej0q8WV94zaA/hjb+zhn9bzaf4LVGXOllOZhdRgc1AgNMTiIrQTbMUDRDdt4CQt2 Um1tLQ== Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45twtaxq38-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 08 Apr 2025 06:07:10 +0000 (GMT) Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-b00aa1f50d1so618726a12.3 for ; Mon, 07 Apr 2025 23:07:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744092430; x=1744697230; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TBNsYFDvRWgIGDQos+hDO8AQ7SgvMSnwcorWv3miZ/Q=; b=RZg2uB+9107MdIOrChjpIy53znRSJdC8yG2ekmYzMuuAWpRdPylIPh/8smyXzoW4Y+ M2Q7bLfQWawYsHP377FpQhZNwOQfy175e+q78RQ7T6EkFMg35FI+piuUbCs5c8NbP2y8 uI9MEmCkKPHgUWox9f8KKNHL2hjXVn0y2FKPMTVf9R7HL0z8uKN2yvGFowXueNAJBPsD ASMacoOhAxb8CvFAF04IwwQsqGa8mLBbDn7qZYnnuTHEcTC9N6Wx/jO5mm+NDl5tVZbI 8Gf5txY/TO5I47pV0SYf+qJ4QGiEgV5ZJyc1Ff6sXIQ15M1KAYzYVIsyoWOdOzeogU8x mIYg== X-Forwarded-Encrypted: i=1; AJvYcCWC/SMZaLB2LWgGBU65g4PuefJonIB1IONO3kIEse8CDac47BZWgz7xd2cR1h0zjrVqI0bbvWptKZcg5sWEHg==@vger.kernel.org X-Gm-Message-State: AOJu0Yy0DKsC0ZqPa//lYcSqdnPUAm/VAnZdyowP34NJckp4PNvgDSEu 2e33Je3NByPH/FqQaJwCBnxTfS9c2InU4+e7aOGqQiHC/NPOWV+Osrzb//T3J6K8BYsEGDV0W68 wGX43boS7X+XwhS2bKSb9deQx0Lob8D2OY3WK0TQyI/D5AAnfbzMnTH4XKI6wcUVn1A== X-Gm-Gg: ASbGncuqq3wZJo3tlPBfEeNzgrtNyGGtpsWxafK677pnG9NmdjXTzwqlXbpHbbIUbSN O5oSyAwzfnIdmXGcQejKQbQHFEGiosbbRHgfEW1+FeRQhbOsaSW65+JGX5KwHuExpIpUjNx7meG /umVs+KoGLPVrB0ujFQ3sgcRQdY8NzMMAZnCu+D1YuVx3CcPnb6hzaISy9zjZBr1rLS3RDb7dpL q1AAfFGtNbEkiDYi8eO/i/TwWYxwJ/32nQQkA5eVqz1rcphi8DnaqZwPc8+hZwy3maGcYEgczPI Nozm8fyNwzgDbb+JTxDId7xQXK4rFVxR1dukSODZISMwbqrggC4r83NtYwuJdRLIwaGz86/ikGM r2ZCtVMqcnQPFutSu68k8sn/FFc8+EbdRZJsJ0RuL X-Received: by 2002:a05:6a21:398a:b0:1f3:3ca3:8216 with SMTP id adf61e73a8af0-2010447b49bmr22460066637.5.1744092430023; Mon, 07 Apr 2025 23:07:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFnZbvQpsmy69UjkGjJMMc2V92O5njwVfVcsI9+dfavomT4AnX/sa54dA8IjoGEF2kgN6ADhg== X-Received: by 2002:a05:6a21:398a:b0:1f3:3ca3:8216 with SMTP id adf61e73a8af0-2010447b49bmr22460036637.5.1744092429644; Mon, 07 Apr 2025 23:07:09 -0700 (PDT) Received: from hu-adisi-blr.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af9bc35079fsm6863981a12.41.2025.04.07.23.07.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Apr 2025 23:07:09 -0700 (PDT) From: Aditya Kumar Singh Date: Tue, 08 Apr 2025 11:36:37 +0530 Subject: [PATCH ath-next v4 9/9] wifi: ath12k: reset MLO global memory during recovery Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250408-fix_reboot_issues_with_hw_grouping-v4-9-95e7bf048595@oss.qualcomm.com> References: <20250408-fix_reboot_issues_with_hw_grouping-v4-0-95e7bf048595@oss.qualcomm.com> In-Reply-To: <20250408-fix_reboot_issues_with_hw_grouping-v4-0-95e7bf048595@oss.qualcomm.com> To: Johannes Berg , Jeff Johnson , Karthikeyan Periyasamy , Kalle Valo , Harshitha Prem Cc: Jeff Johnson , linux-wireless@vger.kernel.org, ath12k@lists.infradead.org, linux-kernel@vger.kernel.org, Aditya Kumar Singh X-Mailer: b4 0.14.2 X-Proofpoint-GUID: hUOnArBi9Ie3usKvsCdf8DpBHlahuIey X-Authority-Analysis: v=2.4 cv=LLlmQIW9 c=1 sm=1 tr=0 ts=67f4bd0e cx=c_pps a=rz3CxIlbcmazkYymdCej/Q==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=IkcTkHD0fZMA:10 a=XR8D0OoHHMoA:10 a=EUspDBNiAAAA:8 a=W2Wr2cnFbXLycozjVykA:9 a=QEXdDO2ut3YA:10 a=bFCP_H2QrGi7Okbo017w:22 X-Proofpoint-ORIG-GUID: hUOnArBi9Ie3usKvsCdf8DpBHlahuIey X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-04-08_02,2025-04-07_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 clxscore=1015 mlxlogscore=999 malwarescore=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 mlxscore=0 spamscore=0 adultscore=0 suspectscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2504080042 When operating with multiple devices grouped together, the firmware stores data related to the state machine of each partner device in the MLO global memory region. If the firmware crashes, it updates the state to 'crashed'. During recovery, this memory is shared with the firmware again, and upon detecting the 'crashed' state, it reasserts. This leads to a loop of firmware asserts and it never recovers. Hence to fix this issue, once all devices in the group have been asserted and powered down, reset the MLO global memory region. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Aditya Kumar Singh --- drivers/net/wireless/ath/ath12k/core.c | 3 +++ drivers/net/wireless/ath/ath12k/qmi.c | 22 ++++++++++++++++++++++ drivers/net/wireless/ath/ath12k/qmi.h | 2 ++ 3 files changed, 27 insertions(+) diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c index 55db189d82346438272c94f25b62dd0db8716efb..9b23329f1bf2a1a84f2b5dee1b67db469d3a8ce5 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -1657,6 +1657,9 @@ static void ath12k_core_reset(struct work_struct *work) return; } + /* Prepare MLO global memory region for power up */ + ath12k_qmi_reset_mlo_mem(ag); + for (i = 0; i < ag->num_devices; i++) { ab = ag->ab[i]; if (!ab) diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/ath/ath12k/qmi.c index 7df6c6eebed6855ab42519610962d2b21825d9ec..c867130f1ddc87ba3ea65d03a6fe99a06c6fe2ab 100644 --- a/drivers/net/wireless/ath/ath12k/qmi.c +++ b/drivers/net/wireless/ath/ath12k/qmi.c @@ -2439,6 +2439,28 @@ int ath12k_qmi_respond_fw_mem_request(struct ath12k_base *ab) return ret; } +void ath12k_qmi_reset_mlo_mem(struct ath12k_hw_group *ag) +{ + struct target_mem_chunk *mlo_chunk; + int i; + + lockdep_assert_held(&ag->mutex); + + if (!ag->mlo_mem.init_done || ag->num_started) + return; + + for (i = 0; i < ARRAY_SIZE(ag->mlo_mem.chunk); i++) { + mlo_chunk = &ag->mlo_mem.chunk[i]; + + if (mlo_chunk->v.addr) + /* TODO: Mode 0 recovery is the default mode hence resetting the + * whole memory region for now. Once Mode 1 support is added, this + * needs to be handled properly + */ + memset(mlo_chunk->v.addr, 0, mlo_chunk->size); + } +} + static void ath12k_qmi_free_mlo_mem_chunk(struct ath12k_base *ab, struct target_mem_chunk *chunk, int idx) diff --git a/drivers/net/wireless/ath/ath12k/qmi.h b/drivers/net/wireless/ath/ath12k/qmi.h index 7c44ced22c6f610fc32b1db9c073de73020d8e16..96e6c3daecfea48efc8fb65ccfddcd516ef2f3ce 100644 --- a/drivers/net/wireless/ath/ath12k/qmi.h +++ b/drivers/net/wireless/ath/ath12k/qmi.h @@ -42,6 +42,7 @@ #define ATH12K_BOARD_ID_DEFAULT 0xFF struct ath12k_base; +struct ath12k_hw_group; enum ath12k_qmi_file_type { ATH12K_QMI_FILE_TYPE_BDF_GOLDEN = 0, @@ -622,5 +623,6 @@ void ath12k_qmi_deinit_service(struct ath12k_base *ab); int ath12k_qmi_init_service(struct ath12k_base *ab); void ath12k_qmi_free_resource(struct ath12k_base *ab); void ath12k_qmi_trigger_host_cap(struct ath12k_base *ab); +void ath12k_qmi_reset_mlo_mem(struct ath12k_hw_group *ag); #endif