From nobody Mon Feb 9 15:58:47 2026 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 78ED625F96D 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 (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5382GLMh000832 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 45twbe6q08-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-73917303082so3600142b3a.3 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=1744092405; x=1744697205; 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=bXtla8rzPV9n7z/CUEVXNlmT5tCUJKIWWZw8bXg0OIBlAPh8JLsuxSrjNIkw1RaLiX DEc/0s6L5RBAj4kQzACxdiHzapIMM5ITYr5CWXtbYSnSM5SNjU+TV6ypMUKMpcw4Lkg8 B7gnvBCQa9Vk+gzOT/ogidenSc1qVzTeqVNnXuyujl+dJBBoAzE8rae3CdAobAeHPehY gRVy0a4t2VdojjBTJm+PSWkVHdHjwMwCqeqA2CaMr2Ws3CSVZhgkwdNEj3XuLNnsUmvy VkNDYpy1pQd68oh840hsgH3lW6NKxMdCNltCg9OH67Rmcv7zY6hi1rpQt5US0dPy/H7I gr2Q== X-Forwarded-Encrypted: i=1; AJvYcCWuHAwS/TwAK48lvIxYAuYubF9WyBCm/lVxouRZ46wrIXLEkyaBDeQa+WHniEheK/Q4E6LdTEL4zaircQ4=@vger.kernel.org X-Gm-Message-State: AOJu0YzklPFZVTypM/QwPoa7OAkKihoi4KawAGA1nCipBKxD/o3KaVzA EXhfmlFMl/s6dBsbaacTNTHGOCHY6duaKoChQbMRi6PAdcg9xEr1z8/0Ub38xjWFzlMLgsxBk3Y SpvyhdF3VX777JpP8eadLCHRd/oVZ1eEN5d4smI8TOCfnF8sYp3K9rIX1Yivp+wMNhZzJQGY= X-Gm-Gg: ASbGnctNjeuR4weS0L2HZUg4Z1aYIWQc2Bo2mxH+R3B5btmrVpuCn7g6q5mqTC5bNEv NVnfXaA6VJhur6nBnPbUdaHjRPD8af342obyt3kK0PlioOg/+gABKTel6l9dt56gp/UHRKvvF5W +RQetKu5KWuhWmf8EZJQ4vALcURtZN/Y+kg1FvM83NgvQL9i+pbp2YoxjyCkSFy0ER7bxBriZgY 5LCN3IB3etWInUqJnl4Uxz50z0LxMJ9t45pp7k3JLRIjez9n+lR8z4xba6j7465pplKiDlEkxpk sGhfeq59HujMkisHIkSulW4mI5F5QsZjiYdwdyeyGhB7FB+PLuwx6KXJIf6zu5P48Z9Ii7WKRBa q8FdZNqvy6b3BP4ckUdG/YULHHkjhYuoGahgsda5y X-Received: by 2002:a05:6a20:430e:b0:1f5:9aac:64dc with SMTP id adf61e73a8af0-201046669b7mr21491134637.20.1744092405511; 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: HSWGkyn0VJrgQ6nAEaioYD-QpSNDjkCB X-Authority-Analysis: v=2.4 cv=T7OMT+KQ 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-ORIG-GUID: HSWGkyn0VJrgQ6nAEaioYD-QpSNDjkCB 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=787 lowpriorityscore=8 adultscore=0 phishscore=0 bulkscore=8 mlxscore=0 malwarescore=0 suspectscore=0 priorityscore=1501 spamscore=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 During rmmod of ath12k module with SLUB debug enabled, following print is seen - =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D BUG kmalloc-1k (Not tainted): Object already free Reviewed-by: Vasanthakumar Thiagarajan ---------------------------------------------------------------------------= -- Allocated in ath12k_reg_build_regd+0x94/0xa20 [ath12k] age=3D10470 cpu=3D0 = pid=3D0 __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=3D136 cpu=3D2 pid=3D166 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=3D10 used=3D6 fp=3D0xffff000000cdcc00 flags= =3D0x3fffe0000000240(workingset|head|node=3D0|zone=3D0|lastcpupid=3D0x1ffff) Object 0xffff000000cdcc00 @offset=3D19456 fp=3D0xffff000000cde400 [...] 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_SIL= ICONZ-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/a= th/ath12k/reg.c index 893650f76fb2d9f24177d524c5a979693b543657..3260df2ad60059117d5340c27a3= b82fdcfabd02b 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; =20 + mutex_lock(&ab->core_lock); for (i =3D 0; i < ab->hw_params->max_radios; i++) { kfree(ab->default_regd[i]); kfree(ab->new_regd[i]); + ab->default_regd[i] =3D NULL; + ab->new_regd[i] =3D NULL; } + mutex_unlock(&ab->core_lock); } --=20 2.34.1 From nobody Mon Feb 9 15:58:47 2026 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 9FF2125FA0D 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 (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5382GeHc008231 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-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45twtaxq1d-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-f198.google.com with SMTP id d2e1a72fcca58-7394792f83cso3888514b3a.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=DMBR7tiWLQxn4bgE6TcfLqkW7oJV9rPmabTYLtLdy2qc0K6EHAx+hfF7wfijJnceke +0sn56UPAospdyc0O0Tn7J2Eb0yTJxP81SF/z+/zphWP0LKXVUg4K0iyQR0Pd/aYrFSM GxfY2vma2VDHV1F0x+8A+zc014zJ/q2vTZ1rS0Mg+kMgxV4qhqPX9TrfLnr5WnH4K8uK Ylwep4MjH1IxXr8hL932Ybrru2m6hDaz78+wAPCNqCjYAb2NNioCnCSMyRahslKKZMyX 79DB1glVdz14xoe6g8YaFWjDmNvfBVw2hm5oQn1TbJbLcFC6KfaQIA8fxcvTGw8j00Xi WFuA== X-Forwarded-Encrypted: i=1; AJvYcCWhsCMsiSXmOAh7d2mW54CTWg8m2oHlqFGvl1jkoD3dzJODHtz9vXOKrMU3ppgbYsnt/6/CDqvzo9t1dVE=@vger.kernel.org X-Gm-Message-State: AOJu0YyK9yKh8kn8kYizcNRacpZMCY7qJvwxBm0P7BgtHaSo+UuRwijQ ZatgJpuT/gAIHs+aGeABAQBq2GriD62qx8eD/hmGPeHO4VLER1fQia+OaaVRX6dBM2A3y+G0PLa 5GfG/OvlfI4MPQiVwLQXYXP9Rasfsmjm4t5MiZCCiAh/Z/XlSVt8j+EGjldaJ89c= X-Gm-Gg: ASbGncvK+yzC+v4DLBmQ7E7n40tdXsA0PWAhncuh1I3srF/FPw2G9b1b5kiBSdNnnKx 6spn0GPr4qI9dpdmdrIbYmqRpLOtESOFFedv+fDgmkFFeyOpbw4ZlewGSNNNZrt8En6HRyfv6XX +bWaSB5aPqmSp85Bsr2+SLGsWwri2Lm0zd51FLHj1JoIE52LHMpavBK5xRkGOqS7x1n5o6JYu7I FGgANt9FbJ6hwsCWQipptJ90m2i1ujOz1e+LJCOnlgex3Tgr8f4riZrS8ryKcjDcMoMeSb5qvNX xGiBU73fpBpiDxEgCaUKgosKYoGPHcd4/2UD5HTmip5I1bE4VcMohiIUIERFM8CHhlw2Gvd1Fry oRcVl2dhzaNJP6olW0rnQ91qAcNCfsuTeibRz5n6h X-Received: by 2002:a05:6a20:9f8e:b0:1f5:8c05:e8f8 with SMTP id adf61e73a8af0-20113c73e57mr17364074637.25.1744092408632; 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: 6jYcQsg4YglP33maru2Gi_7mk22R0Sgg X-Authority-Analysis: v=2.4 cv=LLlmQIW9 c=1 sm=1 tr=0 ts=67f4bcf9 cx=c_pps a=m5Vt/hrsBiPMCU0y4gIsQw==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=IkcTkHD0fZMA:10 a=XR8D0OoHHMoA:10 a=EUspDBNiAAAA:8 a=PROE_fPfuV2Hua9vZMcA:9 a=QEXdDO2ut3YA:10 a=IoOABgeZipijB_acs4fv:22 X-Proofpoint-ORIG-GUID: 6jYcQsg4YglP33maru2Gi_7mk22R0Sgg 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 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_SIL= ICONZ-3 Signed-off-by: Aditya Kumar Singh Reviewed-by: Vasanthakumar Thiagarajan --- 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..8a571a615313d2f1190fe9afae0= 2dfd385ede7a3 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(stru= ct ath12k_base *ab, return rmem; } =20 +static inline +void ath12k_core_to_group_ref_get(struct ath12k_base *ab) +{ + struct ath12k_hw_group *ag =3D 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 =3D 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 =3D 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 =3D false; + ag->num_started--; + + ath12k_dbg(ab, ATH12K_DBG_BOOT, "core de-attached from group %d, num_star= ted %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); =20 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) =20 ath12k_acpi_set_dsm_func(ab); =20 - 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); =20 return 0; =20 diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/= ath/ath12k/core.h index e8d2a0c859f6260d48c4c636793cf3a24c1c61b6..75fb4a99af9442e3c3f042602cc= 5b26842aa5231 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; =20 /* must be last */ u8 drv_priv[] __aligned(sizeof(void *)); @@ -1375,20 +1376,6 @@ static inline struct ath12k_hw_group *ath12k_ab_to_a= g(struct ath12k_base *ab) return ab->ag; } =20 -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) { --=20 2.34.1 From nobody Mon Feb 9 15:58:47 2026 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 AF05A261377 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 5382GNbM006296 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-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45twftekp2-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-f200.google.com with SMTP id d2e1a72fcca58-73009f59215so6176228b3a.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=Adp0nrFi/IRglOGjjvcwsyvPlvDEOjjWsh9f4IGu6p6vzjjlRNFuoMR5WSUamDSBrs 5uGioDvHVnxeXjFBhOuhtcYZCb9pOm8HrEykLxS0G4GDJhZn8kWitPmzoRruFugSYJxS q9BYaBro7UMSwdnEihAGY7EnHJplBuoBubMK+kvul51DeB2MJGVjmhvQjgis7E8zw4u4 8kpo24BIUkPk5UL/M03auFeyPKn6LzzL37oxzSlWMgjZ5H4vehOw7n1z0eZBFNsFdFTb 0ZaHUVllG16aQMTLGC2REm4zFJDPmUt/TWJSzUhLLPjhv9w8ibSfg4FBjqdKiTCjqdrt DMNQ== X-Forwarded-Encrypted: i=1; AJvYcCX1NWw+x6Lr4dDVWHcn487FVKqa0zxkqAXqL4Q9WrN/H0V6RLtuYolc/3cYATtf1OfIjNkCweF/8+dfR4k=@vger.kernel.org X-Gm-Message-State: AOJu0YygUP0AjyhikGyq5nvBICq2mp+ua+NoS9bkQA8pHyqSbQB9jYO9 ETeNz2Kjkfi0wBAjwqiUZFaXi18SzOsKY4jUKOjI4SnPQ9l0jSdM8uNMy3Sd6O7QpwEgoHcoGcQ izp0S81q5cqLWFz45GVdQyhjav+5JURdWc5RR38Oykbr6xq2DD6lm/oIUiA/N2uc= X-Gm-Gg: ASbGncuRtoqLeYpvBRBD5zcpJlsOr0vDRYtZv/pWRgimn2l588Y6qkLAscoRQs9gPxG o1xwJBIXZC9sZ1dgbUkz6VnjWxz/dLY9zzBodGsHygeHEnJWgcJeea/uAPgFIkvU2z9l9wYhtHe +PEIg6lDMGazFcpPrtuTIvnB7LP4xZmGN5uJJPrrAqdw05x/QudBOqqPao3kmSAxV5TvLjXBqDA cjQNVS+7oFTapNBSEFhWzY2s9SEfSO5Xj89b+BU0euDVMaBrOtSvjDCdqFw3/rb81QbNUmBBsLj 383NY+a1+sBvUASoaZ7o02WlcljLTLYpz9zlA+/JaHY9/sb9alAb9tf96s8hsfNyaRVuyw6lemq CY//6rixfnmhOBCww+skS4x3PPrPc76I9GqOmPv1K X-Received: by 2002:a05:6a20:2d06:b0:1f5:5ed0:4d75 with SMTP id adf61e73a8af0-20108139fbamr29100398637.31.1744092411772; 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=mDZGXZTwRPZaeRUbqKGCBw==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=IkcTkHD0fZMA:10 a=XR8D0OoHHMoA:10 a=EUspDBNiAAAA:8 a=zZIk_WvpsQkbQcpLs4gA:9 a=QEXdDO2ut3YA:10 a=zc0IvFSfCIW2DFIPzwfm:22 X-Proofpoint-GUID: re9c8IhqpeJVbdf5puosxc75q1_sfcMn X-Proofpoint-ORIG-GUID: re9c8IhqpeJVbdf5puosxc75q1_sfcMn 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 mh= i 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 s= tate (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 mh= i 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 s= tate (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 mh= i 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_SIL= ICONZ-3 Signed-off-by: Aditya Kumar Singh Reviewed-by: Vasanthakumar Thiagarajan --- 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/a= th/ath12k/pci.c index 7f1bb150f326b317157f6721d990d61a27f38d6a..aae1989c686bda37c12544e7233= 8bbfbc5f75042 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, bo= ol is_suspend) { struct ath12k_pci *ab_pci =3D ath12k_pci_priv(ab); =20 + 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); =20 --=20 2.34.1 From nobody Mon Feb 9 15:58:47 2026 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 D95BE26157D for ; Tue, 8 Apr 2025 06:06:56 +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=1744092418; cv=none; b=th6zCUn7oS7qvHMjcnN9ok2SqzGcNMN4uh8L8dtLgvyQjfMwtHbQLgJgrz+r6YCHqXC0J+OR+rgv08uo6VxRbVn6udD+1Itz50BNW2ceF57he2uozxneY7lWb8kRKygf4zzQx1KeddL6QHEQtpRbV1cyZwryVyrysobh6fXKGcU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092418; c=relaxed/simple; bh=370njgXLQlbYRp5dbJwp/vCqAvoxCiM7iy2NC3LtsHs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Sdij9M4RZEZlFlpbzT4hZZfnKyl+rUENX4GUqM083j4rQ0EKotBofbGi2t+HLvjrtmzYm+rDqtkLqDXPhTxGgP8dTIY3ZtQ+x3anj72k1PtcvTvNMDAOjEWCW7U7/KEbTfC0s8H7orE72/dszze7j37VC6UC1BkLBqLr6ADRR94= 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.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="DbmQXOy0" 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 5382GLT0008072 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 45twtaxq1y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 08 Apr 2025 06:06:55 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-af5156fbe79so5797385a12.1 for ; Mon, 07 Apr 2025 23:06:55 -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=d9ond4cMq/bvukd2fo+88or/HwnKtHrg2iOtjdEAKIPSoc7lvY/r44CzKrP7Sv64Ze L47zgv/0B0gLwXqV7y8pC61iWOGHZGhHUzHzeXeC0IC2OOWN7kbvx7mLIBEQNlV249m7 /3bHaLoPtXilc/2+purpVHJqwI9ExtrIJD2EhRnRPdZHnj/V0zR832WmWPeinoWub9zS ERJ+oiByArohNfrXuvfDb1PoT3Y31d5kWtOMMozHGJGiqBDqXbN6H9Y8QlVp5PLMjtgX WJX/MH1chBuMh5aQM3qWwNZxeT/2Bqk2XcE56Z6YdbK+LF+fAMJL3wuCOywiK7Qq7m2y 426g== X-Forwarded-Encrypted: i=1; AJvYcCWKFJBtVLP4CiFztdwiIaBs2yULglFadD/x0OBGScMfmVvgBCXDlkVer+QYZzeeWDGCemV2bm9boT2J0mY=@vger.kernel.org X-Gm-Message-State: AOJu0YxXjs6Hb5itP6znWJ/Hnhdm0lfVglsmnq3I3WH+Efl0yH3dE5G9 1yFzxWWXxSv9Hx1lQcWVNHLLhUBTDab/JJcfXlhwsRxJq2oGp9ONElEPCrh4J556PA5KHN5o06s n8wVFIy0WXmMMVcoX/O1PUtza9ASiLvL4L13rvhb6CnhgrKC1jm/wT4dlRGvZ6w8= X-Gm-Gg: ASbGncsXVYp9VzCk1jaCpiDPxbE3RAd5KzoRFHntMbcfmAptMH+qQnXBCDCc1weORVA FXeQEhyikaH9DWnLrGt0sXGKRcXHqwvfsm4zGGOvIuxPlrjC/yFuWMTk8yTA59vKxO9nTspcUxT cokk0QnHN8zIgDiP5u/d7I/qhf3Z2e7/4OgXErFhQ32XWUplB6I1s8tBPjifiSnVZZ80mLsxpY3 B+5IsOKMXgHTlhkYNGAz1zmKObHC5J9yoVpI+3S32wuhPDbIhePOykzqml/0rrTTwF4W6Fr4xRL EKTv9Dkn0PaO2wiN/gkhb1WH6e74JD99vaSHlQuWEZNtKbwZonPvBBMjGiVVPHG84aiCk2XqliL hwPv7to0y9aHn3ZutKwcTNgLjTaDsDa25T6zQbtNs X-Received: by 2002:a05:6a20:2d14:b0:1f5:709d:e0c6 with SMTP id adf61e73a8af0-201047a3028mr20649705637.42.1744092414741; 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: IxYhSDbJN5rPxh1h8dBlavQ6BFH9XyI9 X-Authority-Analysis: v=2.4 cv=LLlmQIW9 c=1 sm=1 tr=0 ts=67f4bcff 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-ORIG-GUID: IxYhSDbJN5rPxh1h8dBlavQ6BFH9XyI9 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 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_SIL= ICONZ-3 Fixes: a5686ae820fa ("wifi: ath12k: move ATH12K_FLAG_REGISTERED handling to= ath12k_mac_register()") Signed-off-by: Aditya Kumar Singh Reviewed-by: Vasanthakumar Thiagarajan --- 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..cb2a99d110d5c9ec2c092fe1a2b= 776b6265c4126 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 =3D ag->ab[i]; if (!ab) continue; + + clear_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags); + ath12k_core_device_cleanup(ab); } =20 @@ -1093,6 +1096,8 @@ static int ath12k_core_hw_group_start(struct ath12k_h= w_group *ag) =20 mutex_lock(&ab->core_lock); =20 + set_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags); + ret =3D 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/a= th/ath12k/mac.c index 2b6bdc3d2b11a8a5f5733352826c724c671fd49a..5c3c9267e937484cc5f5a7d8032= fb3911b4e921c 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) =20 int ath12k_mac_register(struct ath12k_hw_group *ag) { - struct ath12k_base *ab =3D 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; } =20 - set_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags); - return 0; =20 err: @@ -11804,12 +11801,9 @@ int ath12k_mac_register(struct ath12k_hw_group *ag) =20 void ath12k_mac_unregister(struct ath12k_hw_group *ag) { - struct ath12k_base *ab =3D ag->ab[0]; struct ath12k_hw *ah; int i; =20 - clear_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags); - for (i =3D ag->num_hw - 1; i >=3D 0; i--) { ah =3D ath12k_ag_to_ah(ag, i); if (!ah) --=20 2.34.1 From nobody Mon Feb 9 15:58:47 2026 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 D5AD82627E9 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=1744092421; cv=none; b=UuUdQ2mXiqqcvASFnxJqklvfZtVdsUvdroff4FjjFDSGwQHxP1XjBp2ElvvW/BLN1OLqTL/AuM6MzNyI9CjT7Ova099nrGjg8uPzKJhWJf2STQWWoyOhtTf9TENpttn+42ReU4baDRx8U0VJD5qvsZZ358BDIR0LhgmtMOAJQ9Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092421; c=relaxed/simple; bh=IS9JUQNEXbcjFsJwqQld8Af4tR93LGAzSpGELVi0uxI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hozLhgXQ9ZSNcTd/wKObBGmuFurhhoQAf3WT6VY2A/JYMTYK20OO5dYYueTKo0yaBYG0pjbEVAzMCKDoYCGemi3U6PNvCugY+z1ql+GSY33K7adx1GKr/eyDeHuVxkLrxOPM0pSxZPHWpOe2ZveHepv1mBRK8xMslcpyxfzez94= 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 (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5382GVqP015072 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 45twbuepdy-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-736bf7eb149so3824690b3a.0 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=EvnxqNro43XhFfUyHmngKel5lb/PkcLqnHW3CYj1zlSkTGhLf7ZK0TGgdZTdZAr4rn x4pPL/iVDNLcQGC2PZBEtcI0EYPkMaza5KG27nFbO8MakuqKmdCbuUCjGjJNQUtC0t5A dbPFu//avlXg6JkEDBzDNTkwuPBo78Vv9aOotoGNby70o+tYxtvUMdYbAXdgImKxMfM9 1wr2eN56IRnbdPy7Rsn1nCxDbVr4OvNVg7NWlQ4cLQOMYYbldWbCxJ8baECPGLT75781 DleqAm6nf4ET7uoHmSF20mCpK4uMirPb0b9RAIxLO4i1H4MiZvJfFYBVlfpzZTMMqokw 7Evw== X-Forwarded-Encrypted: i=1; AJvYcCUlQpheA98oIurN7CDHjINkhEhZU6Bz5FiMUxOT4xHYjgroNK8cUKYPSh+e4XW8R+qjUA12rejnaMy9ciY=@vger.kernel.org X-Gm-Message-State: AOJu0YzGdKeW1zzNH+iHkP4WYzGj+hibzRqGNR07A92utFxRGmpLD6I8 Mm2AHGMzFlXvItINweHNQEe2cg/yNRx4PN0lnsY45jq2aeT3lcpdWZ38ecDqsR/y/DfsUfHh6PN I9WBQvHuCnmtor+D+U8HGbegpd0vaZYTnNeajihZz7dqYGe9caPM5gGFWaOe7VE0= X-Gm-Gg: ASbGncskkSoySt91IIE1yV2XgT6bXSkF/ygJ6Tx9Vw5zfje993Tv8bpwtadS9PLf5Ds h9tzZIP4TP03tp9Q1wQiHePb0OeAoXZITHa3pMHDkZWQEdvPPZo5aFcnpQLIOJqbKOH0FUvgrcE cQ7q3ipbLQedrao6D/mAMWBUlKCYCuEwrolEilDCDWxP4P4D95sYzwlauB9UTrKT6kruXVgdls9 MPQ0G6hCJSNDe7lDLeYxWkHASLVws8MSGASyZOE62oNUEtZv9PVW69fK/IhrRe0MXkPloMX+sX6 KCCaZDJ/xC6tzNGm7kf5N1Bt/6WetV3u1S9lg2RIzE9CIM/osg1H2UyK3YEX0kezk5Zs9WDBNvq ja1a2OcTWdeun5k4RayBhTMw1oxMiYScQpg7RoPeE X-Received: by 2002:a05:6a00:2410:b0:730:7600:aeab with SMTP id d2e1a72fcca58-73b6aa78298mr13548272b3a.13.1744092417869; 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-Proofpoint-GUID: oIX5HvtPtn4eDI7lOT1oIUNLLurby7ig X-Proofpoint-ORIG-GUID: oIX5HvtPtn4eDI7lOT1oIUNLLurby7ig X-Authority-Analysis: v=2.4 cv=dbeA3WXe 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-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=999 phishscore=0 mlxscore=0 spamscore=0 malwarescore=0 clxscore=1015 adultscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=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 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_SIL= ICONZ-3 Signed-off-by: Aditya Kumar Singh Reviewed-by: Vasanthakumar Thiagarajan --- 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/a= th/ath12k/pci.c index aae1989c686bda37c12544e72338bbfbc5f75042..8ee532dcc2652ef4b92bc4c4346= af47b783a6708 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); } =20 +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 =3D 0; i < ag->num_devices; i++) { + ab =3D 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 =3D pci_get_drvdata(pdev); struct ath12k_pci *ab_pci =3D ath12k_pci_priv(ab); =20 ath12k_pci_set_irq_affinity_hint(ab_pci, NULL); - ath12k_pci_power_down(ab, false); + ath12k_pci_hw_group_power_down(ab->ag); } =20 static __maybe_unused int ath12k_pci_pm_suspend(struct device *dev) --=20 2.34.1 From nobody Mon Feb 9 15:58:47 2026 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 8B0BC2627F7 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=1744092423; cv=none; b=tZn7LFtQxKUkLWgPujFXSfk4Vqo3YBbdSPc2NrrFiGfzyAJmhkRRChv4t0SdJ1rQiooebc2xVN6v/q6oEKt5UlGZ8a/faEvA1kX6REyq3nbY0mwH095dHPX4+VGgFTqYprwrYtwGEj9Grs68g1Dva3wXcbSpdLpv440THQY93oo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092423; c=relaxed/simple; bh=zmz0c4mSLGFxJuRbfWzls38k0cxjuskWRE0Eq554GoA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=K9HWL0SHLTrOoxGCZy9gYryZ562X9Ms9Xqot54Fz5f30rf4nE5/huRtoLjuHjoHy2g1WzwI/Rxtf/oecjabkdMpJ8sULN8h5bVcHSUqTYYI7E86m/i5kpZye75yFjBHg4ZT/7hQh3p1LIYj7ycmrPr1B6Nh9gD0zjspIdLziMCE= 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 (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5382GZcv020241 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-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45twd2ppa0-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-f198.google.com with SMTP id d2e1a72fcca58-73917303082so3600377b3a.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=QTaI0bu8H+CnRn6g9XqzCBxqlFKwUfDZOWu7W5YXmpqWGxNh92Wo4oe5wOaUAxrdLj bXuY/BFeAV+HpoAAZR7ZteS27lpATdw4jEl9c1PoJ5WHWuWkY7Ji471qIAlRMXdCA4Ge d6yneCM2nLopDPbtq52SZrpZSLiRqm/ApfKBB5HDDKHy7R+qWd0E+M8HOWa/+U1AsI46 mfKfRoAwBr50NuNCWYyZZUvNn+NCgF60KVEhjZp3bl8qLtuZQcOkT5iRn5LvYHOwuiIL Fyth720cbhngPwuH0xUiyDI8WikWS3fUkgMVl9OiOqYbtuw3pNKBBp60kuCnNkCTYeI9 E+Qg== X-Forwarded-Encrypted: i=1; AJvYcCXe0ryPvb9I/6CHGqL9CgrQ7ffTwtfSJldBiUcYfDN93fnSVRObd6xzhC5wmKrZ7xA3zelxBwJHPHs5oK4=@vger.kernel.org X-Gm-Message-State: AOJu0YzAIsyGlQxvG+Jrn7CTNW/yrrcZDII7HWvBIQXR6rssWSq4T1Fc gaBJKLM17dRMmPE2b75kCKC2wRGZJKyxt/+Gt+KmuVhIyEusucbAMEo+C/XBKtKCUim1sbIXlLA VxNaVy1znXM39XkkB/CMVb8EUyRyqyDDhIsYWSEOJ7eEz2pM+8c9zeQchOnppqkU= X-Gm-Gg: ASbGncuKq0wy1OcKe4grGwc9LoHPg5dEY4f1bcAlLjJLJZMbm0kfFStyILoqirDw5K5 +FZ2dF4gS+41pvVsjSXC0Dui/jjLaH6iKVvsy1GjVyPCFm/29q2JhwtZXT8sQ4+nufjn0CnQ16h /D1S1F8nYSi1qNNS8np6Z/NxLT67uvALgdyG9cMzbnm84QpSnyCJOpCzPL2W5kjg1UZRbAuGfgw fUatSl0aEl5g8xUjtOkpFXE9atwIpiqAy2KGkGlLmUI3tCN3FdxXouIa9yerUceOaHTIJZGSrJX okzXXLmH5h9wQ0/6cVW6AfTKzOxi282mCfOeVWWcxUAX4gvOkx8i6mm9MAD84gESEcqAddMgnBO 5BZlxWtWodAhSMASmDEC8mftl9muF4UJse0ly91MU X-Received: by 2002:a05:6a00:2186:b0:736:54c9:df2c with SMTP id d2e1a72fcca58-739e4be8c14mr19887000b3a.15.1744092420836; 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-ORIG-GUID: qDYijtNt0xAQDoZpQgpj1pExuo0-jFi_ X-Proofpoint-GUID: qDYijtNt0xAQDoZpQgpj1pExuo0-jFi_ X-Authority-Analysis: v=2.4 cv=NaLm13D4 c=1 sm=1 tr=0 ts=67f4bd05 cx=c_pps a=m5Vt/hrsBiPMCU0y4gIsQw==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=IkcTkHD0fZMA:10 a=XR8D0OoHHMoA:10 a=EUspDBNiAAAA:8 a=d-GbLxaNKwXvygB75HgA: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 mlxscore=0 impostorscore=0 priorityscore=1501 adultscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 bulkscore=0 mlxlogscore=999 clxscore=1015 phishscore=0 spamscore=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, 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_SIL= ICONZ-3 Signed-off-by: Aditya Kumar Singh Reviewed-by: Vasanthakumar Thiagarajan --- 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..0fb3e57cd254ede767528e47e1d= 9d183257e5b71 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(str= uct ath12k_base *ab) ah->state =3D=3D ATH12K_HW_STATE_TM) continue; =20 + 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); =20 for (j =3D 0; j < ah->num_radio; j++) { @@ -1439,6 +1451,8 @@ static void ath12k_core_pre_reconfigure_recovery(stru= ct ath12k_base *ab) ar->monitor_vdev_created =3D false; ar->monitor_started =3D false; } + + wiphy_unlock(ah->hw->wiphy); } =20 wake_up(&ab->wmi_ab.tx_credits_wq); --=20 2.34.1 From nobody Mon Feb 9 15:58:47 2026 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 A89E1263C71 for ; Tue, 8 Apr 2025 06:07:05 +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=1744092427; cv=none; b=WnHGa2+KIIo76qiHnkFoGs/emeHOKzyAbVyxL265h76My87iRgqoLbQr7ShbMrlPBU1aj/cXkHSD8cQdAdtNVMTMi4nl4Hxl0Tz8oSTMjpCePtBlcnKkNn59UaIAU7lQ47WwZLWdA3OZ/P8Q4ujyq5/JjaFjO+So0hTBKO1qdeQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092427; c=relaxed/simple; bh=ilPjgkafgyzznZHuUen0W6iN7bRy3vMa4VsRmnlzJtA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=W7K+X0PIiT74p7+YhBvvapctZhvy98+qJbIJO4o+06Pa4Y6UweON7gO/slUeOLwk6E9idVTeYkhMrbAuVW1kaLgD7l4Y06Pk65iCLK3w2DtKIXYNRi/ANYkZiHoaJPs6h/cNmtPZzmr6yY+BmpvTu7ugWJd/V7kTD1Ys4Jbdstg= 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.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="fL38UVB7" 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 5382GcvL015096 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-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45twbuepek-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-pf1-f200.google.com with SMTP id d2e1a72fcca58-736d64c5e16so4542795b3a.3 for ; Mon, 07 Apr 2025 23:07:04 -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=LfBp3WRI8RfjvrtFQbpmfC0p3oS38QfPZMC7WJ70HAT79wCGaPmueq4Nc5eESvikD+ X3yvRiZE0Uhl09JbgD5GQRns0Gk9DJ1yLiS2POJf9v02WrBDEI0hYJdoRyaotoY3lVuF A5mx8PGUMJqwIjkdrOtl6rO/g4P8sa5DmFSWH45H6/WEdLymKVGrmrJ6TsSzLTjFpBcj XtewOo+uLlT3DKYHLAFyyRDyEwe4iY8LU0jHSX/vil1UNtdqf00DPWF40S2+YdkGuJcc GAgyUlNrdh0RSYeTh4KdVo66O25sEgqoYpRt58DaXLl012FSzcVjqYM2zlB07aM1ccvJ 2LKQ== X-Forwarded-Encrypted: i=1; AJvYcCUfE2nyaSkNRyyCVaAKTjyUkJl8fnk5a1VHgZ3zmv0FvYtVouzlV+Y5e7jRzxp579s6ak9xCjQNJ7/hMQk=@vger.kernel.org X-Gm-Message-State: AOJu0YyCd/CmXpVuPasR2Spzpga+fTlb2iOP4lj7cALLgvTRYKUfxrws aSMQpUUUKl8es3K8Hln9v83TQWzux7DeN6e3lxOSsXWJWMD0IqOh3jXuM5qDndzL1IlDFNjb+Vl kdDDZlPosUiTyQSsOl3pUd9smVW2Otf5PzD182fe/6PvBspErrF7JQbo6mqa66Zb4ch5HXv0= X-Gm-Gg: ASbGncuOFbWfgsF4mza8+lpuJWy8QKY+SIg1af/yLUYeLAcvamxQ2dcyGFCOG2kGepq AqEl9KMErTaUx9MVss3BHOdHvJSYvkM8bY/2Az6k7R7NDxWt6b5B26u4EN2nuYhNjrY+DxwPYvH 3sUKWl7zvJNDVJD+g5cBmrbcK4XXTShvNgG6u0wc3CBJ3MziJKvKTXk1jVEZ8kAvlqn33DzkOCs mIAyfXpM1L9yI8u0x3YcfAnVgbznQOjWloEn6m93SxQRz9kzqqXS9eB7TODevRCPK0yIAYUJkNW ot3D0ZltCkkDJqeMFx4ULViQJOz34w4hdLewTkRLWnpmhMxTh9qBe4XHyUw+QXqLUTIHgdMVlOu TnSqhIZOQ3S44F9XQsPqqc7PfDAYlG3i2YbX3W2C9 X-Received: by 2002:a05:6a21:9106:b0:1f5:7873:304f with SMTP id adf61e73a8af0-201047308d3mr23586260637.37.1744092423921; 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: -DkdOnemTxpjH4eF6PgErgkn6HkIAUsB X-Proofpoint-ORIG-GUID: -DkdOnemTxpjH4eF6PgErgkn6HkIAUsB X-Authority-Analysis: v=2.4 cv=dbeA3WXe c=1 sm=1 tr=0 ts=67f4bd09 cx=c_pps a=mDZGXZTwRPZaeRUbqKGCBw==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=IkcTkHD0fZMA:10 a=XR8D0OoHHMoA:10 a=EUspDBNiAAAA:8 a=J1AqtRd1v4e3_tdQaqEA:9 a=QEXdDO2ut3YA:10 a=zc0IvFSfCIW2DFIPzwfm: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=999 phishscore=0 mlxscore=0 spamscore=0 malwarescore=0 clxscore=1015 adultscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=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_SIL= ICONZ-3 Signed-off-by: Aditya Kumar Singh Reviewed-by: Vasanthakumar Thiagarajan --- 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..a1c9b8771e9c4c84548da2cb405= 4b0403aa8c759 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"); } =20 + mutex_lock(&ag->mutex); + + if (!ath12k_core_hw_group_start_ready(ag)) { + mutex_unlock(&ag->mutex); + goto exit_restart; + } + for (i =3D 0; i < ag->num_hw; i++) { - ah =3D ath12k_ag_to_ah(ab->ag, i); + ah =3D ath12k_ag_to_ah(ag, i); ieee80211_restart_hw(ah->hw); } + + mutex_unlock(&ag->mutex); } =20 +exit_restart: complete(&ab->restart_completed); } =20 --=20 2.34.1 From nobody Mon Feb 9 15:58:47 2026 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 972CB263F46 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=1744092432; cv=none; b=CBWfbfrmaIlOZlREgS9EvWw2KhkfhutJV6moCG250LBI1eKXdeeJjR0D0UCOdvc+e3EnqC7nUJTz2F6A9ibdIU4Sj6uDuHpvVau+LLO9lrBFgigTuZ/f+3Dtzc30g4zRVKpK/YiBR6MBlFECxRKkhw/r8dqpEqgPqRhHWY5jQiQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744092432; c=relaxed/simple; bh=SD7Xq6PJnyE6Dco8m8zhabJvgDfWZfqJu+X+VlTeIp0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LIwUMG8dsDRcUHWh2OhMjiLWzuvLwUIbKyU57rD8yRE801ISQ8nIMnN0KvjDqwYueJX/3eh9zqUlYNT6qnUXv5qVtq1sz9m0t8ZG4gYQWKpZSx7Ovczzj8tf/YHJ+xcKyvfOjhxtMecvcP3MIuTP3YBv9PI0QWu3kixmrIu7n0E= 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 (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5382GP1W019664 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-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45twg3emvd-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-f197.google.com with SMTP id 41be03b00d2f7-af5310c1ac1so3327766a12.2 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=Mp8eLs63mG7Js8Dd5d4otSPiaDaLUOnz+nOBx0wmo1d7zJSXJ9OTwbZEkd+77WCewg 3P30JNTWdAI+hmDLKEPeqRWBpxK9fQxcYi+HB9EO2RBxQS1DS34nTqJBBwADXbQugEZ2 Yg4P85XEgtvmprsjsn4cfYnOQI8YAlTW3D/Ey/N5yGxP8QlOPkIcZpYO3kHEf/OCGLG5 ItH66LO8dAyjdgx6LDUMsnT45TrSiJlBZeXqs+eB3qOJdJ7oaW6bFXyrNCkYtBVRKZVJ IPXrkwr/L48+S2jPvvCs6uZSkEsl44JC9Jha4cRPaj3SLv+BUf0AKu7puWCOrrqH69Vn weiQ== X-Forwarded-Encrypted: i=1; AJvYcCWGpXySHst2T66+zzIpw2OUUHpdCmsiP7MKdgkcD9geME+yRY3WEhizjQSFazBKjtfp6azcJ5Y7CyoHp1w=@vger.kernel.org X-Gm-Message-State: AOJu0YyZzztJ9mWzWwuoJgYyLCGELht/vlS1eHiTX4wrpLuAnlJFyyhK j3Uly8X8x9U04ool5+P08Plo7S3ydY+iQvzKh2vqdobvEN+vY+2SAMQohroK0euMbZfuFeAzQG5 qanq/BAfDY+RkRtmk9Li3aUp/LShcSjxrFFER5Agrxpg3JV4UyBTnmvLkybwMPag= X-Gm-Gg: ASbGncuLaurKUK0XGSDsOGgk5ZbuH/eLc4Si3tlQnJEP0Pmp9gEWptEI4eeJF9ObrBS 8kxJieNt0KJhScZ+E+1/NsqR4fin++sk9NHOdtV/8pk7ShEtNBLax1hEwa7zZEF/rZRVis/53kw jWIwmjl3p/4Y76P+LTGcb4pf1wnyYvrZfqo/j5PfvK3FQX+Nnbx74v1+igd4Af3GY9IBH4I8vHS yG7Ykqtd2LThAo+5s5gUuYRLpgHurrYhs5b7x/zz2aCJZ6drUM9iGGQseyHUu/zBWCXzCmgiMSV 65MRPB7nDrp+X9rowdwrQL7riiTlU8Q3/jI1QlV2BFgrjLlS0roK/Y2BS9EACX8PlkXDtEfEX0B j+tWWQ8BVkbc69ePe6VPrGePdQRqvHAkz2+FCN2XX X-Received: by 2002:a05:6a20:e615:b0:1f5:6e71:e45 with SMTP id adf61e73a8af0-2010472df50mr23137227637.27.1744092426947; 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-GUID: 8Iqz7m84U0H2SfIcai_nZs_pXOoTzyBy X-Proofpoint-ORIG-GUID: 8Iqz7m84U0H2SfIcai_nZs_pXOoTzyBy X-Authority-Analysis: v=2.4 cv=I/9lRMgg c=1 sm=1 tr=0 ts=67f4bd0c cx=c_pps a=rz3CxIlbcmazkYymdCej/Q==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=IkcTkHD0fZMA:10 a=XR8D0OoHHMoA:10 a=EUspDBNiAAAA:8 a=WsyaGQEz6myPfAgSfy8A:9 a=QEXdDO2ut3YA:10 a=bFCP_H2QrGi7Okbo017w: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, 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_SIL= ICONZ-3 Signed-off-by: Aditya Kumar Singh Reviewed-by: Vasanthakumar Thiagarajan --- 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..55db189d82346438272c94f25b6= 2dd0db8716efb 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 *w= ork) static void ath12k_core_reset(struct work_struct *work) { struct ath12k_base *ab =3D container_of(work, struct ath12k_base, reset_w= ork); - int reset_count, fail_cont_count; + struct ath12k_hw_group *ag =3D ab->ag; + int reset_count, fail_cont_count, i; long time_left; =20 if (!(test_bit(ATH12K_FLAG_QMI_FW_READY_COMPLETE, &ab->dev_flags))) { @@ -1641,9 +1642,31 @@ static void ath12k_core_reset(struct work_struct *wo= rk) ath12k_hif_ce_irq_disable(ab); =20 ath12k_hif_power_down(ab, false); - ath12k_hif_power_up(ab); =20 - ath12k_dbg(ab, ATH12K_DBG_BOOT, "reset started\n"); + /* prepare for power up */ + ab->qmi.num_radios =3D 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 =3D 0; i < ag->num_devices; i++) { + ab =3D ag->ab[i]; + if (!ab) + continue; + + ath12k_hif_power_up(ab); + ath12k_dbg(ab, ATH12K_DBG_BOOT, "reset started\n"); + } + + mutex_unlock(&ag->mutex); } =20 int ath12k_core_pre_init(struct ath12k_base *ab) --=20 2.34.1 From nobody Mon Feb 9 15:58:47 2026 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 146D8263F4C 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 (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5382GZcx020241 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-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45twd2ppam-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-pf1-f199.google.com with SMTP id d2e1a72fcca58-736b431ee0dso4179407b3a.0 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=r+E68bjbZiJYXXWyIUiVLVtuFu65wGr3nOMUs/J+aCvo/ucDKSq90Q3SN1VT3+7ufX HrgjMwNScvJBiKYNKzd0ct6+xhhN51UIE8Q3yQDIiWINIQGBa1Kp9zHc0xabMGrwhVq+ re1WFxvViIOJc2jwY7080RYxH8E+sKuEjesmDaAPs/sVfrcovRUbt6m14ZTlAxi0s6p5 4PNsKQSTDi+JIcT988DmmJwETgjgZ4EWXvjnEXQRlsMSvrtXUfav+GvylUrJMgbEPJKZ oxDhc42Vf1HKexkcjoWeu2yvbTHLxzlvyS4VwRrIGmC5qjlNCTkjGvXyJa412NWC9p+S DDJQ== X-Forwarded-Encrypted: i=1; AJvYcCUW87hAYMT3TtTgKMFhFBbFhNhoqPq9LyEVuq2l5bKCS+zPJKwKB9wPL5tAH+M6GgoUek53g3I78AYAQrk=@vger.kernel.org X-Gm-Message-State: AOJu0YzCHIBpKlztbXxfUMgG//6vlN3onbVSYrZHsL5axK2zvmRq6uwZ AXNnpPSBCF5YjodnXePPxdSSEIyWAMOZl0yp20tV7oKdxi4u+jYwbeQYKM0j6gtH/V2Bv0NRH5+ Gk7mie/3hdP8vRIa8XKj2gyKFihmtylHDITPQYdmFgRr6Qwl73+f7wyMCT5LKXQY= X-Gm-Gg: ASbGncvyXDKZZyGIT50PLZetWUYTrV0UiZzwvD4ugSjoquAKMOftxB/G+tWTxt2gR37 a0/Qxfp+cDvtEikyZS+x38A3CecOq9EJjkPqyXiQpkch8oulUiYMiC1JPZrzUfyCRXNoIKzTuVO CNSpRC9FCo/x8Bv9eoCGtsvHqFEQpRJ5mIYp/NrfGVeUn+I0YNOZmp8FUlYzwXy2f8FzT3QHUEI L7GJ96DGvO/rspT+5uDfQYkputOK3fJqaki86SyM51K+3RXDmTyeIDqy85+cMo2dZ8lfEhonOsl CZxNgYibK0KHoUbS5wIe6aWlnwW7OOyz/J3VhVs6iwAj3/mljpv51YmxV8YmGSFHk1uC3B7mVv+ xuK07BEFX9i9Jcu3jHALJcfpJ0xHJqXDjErfWGiWE X-Received: by 2002:a05:6a21:398a:b0:1f3:3ca3:8216 with SMTP id adf61e73a8af0-2010447b49bmr22460073637.5.1744092430029; 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-ORIG-GUID: MAunEVlwbi15ZNvyWQCEl6P3sjb0gKqM X-Proofpoint-GUID: MAunEVlwbi15ZNvyWQCEl6P3sjb0gKqM X-Authority-Analysis: v=2.4 cv=NaLm13D4 c=1 sm=1 tr=0 ts=67f4bd0f cx=c_pps a=WW5sKcV1LcKqjgzy2JUPuA==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=IkcTkHD0fZMA:10 a=XR8D0OoHHMoA:10 a=EUspDBNiAAAA:8 a=W2Wr2cnFbXLycozjVykA:9 a=QEXdDO2ut3YA:10 a=OpyuDcXvxspvyRM73sMx: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 mlxscore=0 impostorscore=0 priorityscore=1501 adultscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 bulkscore=0 mlxlogscore=999 clxscore=1015 phishscore=0 spamscore=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_SIL= ICONZ-3 Signed-off-by: Aditya Kumar Singh Reviewed-by: Vasanthakumar Thiagarajan --- 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..9b23329f1bf2a1a84f2b5dee1b6= 7db469d3a8ce5 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 *wor= k) return; } =20 + /* Prepare MLO global memory region for power up */ + ath12k_qmi_reset_mlo_mem(ag); + for (i =3D 0; i < ag->num_devices; i++) { ab =3D ag->ab[i]; if (!ab) diff --git a/drivers/net/wireless/ath/ath12k/qmi.c b/drivers/net/wireless/a= th/ath12k/qmi.c index 7df6c6eebed6855ab42519610962d2b21825d9ec..c867130f1ddc87ba3ea65d03a6f= e99a06c6fe2ab 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; } =20 +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 =3D 0; i < ARRAY_SIZE(ag->mlo_mem.chunk); i++) { + mlo_chunk =3D &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/a= th/ath12k/qmi.h index 7c44ced22c6f610fc32b1db9c073de73020d8e16..96e6c3daecfea48efc8fb65ccfd= dcd516ef2f3ce 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 =20 struct ath12k_base; +struct ath12k_hw_group; =20 enum ath12k_qmi_file_type { ATH12K_QMI_FILE_TYPE_BDF_GOLDEN =3D 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); =20 #endif --=20 2.34.1