From mboxrd@z Thu Jan 1 00:00:00 1970 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 23B12296BCF for ; Mon, 27 Jul 2026 14:02:49 +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=1785160970; cv=none; b=EG0gBZNDv3jUrh1xXPW92zbBoYsrP0UFjBe0NMZqlUC9SDcmLRKfRwsTxqQhkMucX/gj9ubRYxaGvSr2flBm0JpEBcHPxFPMeJZLAAvl5U4bpiihy4mdp9SL4xNF4xUY34WD0+aL2liyRXmtmeef/PrphwkqW4ghXJwWgrcGtcM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785160970; c=relaxed/simple; bh=5kN/cRMAAFpyxM5YEI12/i1t4RGTZoCvjXWtffoPOCQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QUnwVk+tEYbFNnAuesE6Kc6ZRDuGN/y23lNJldrLzKl745qXQ49YJ0e/0W+Leg7UHEPm6VMG2ZJaW1zAaxz//SnPwjb6AJqHqpB/tTUqtnOSUYyyYWISdetNKOMDNvmQzuvbRj8KeM+KNRezxc10DbokFj76ZtALv9NBjqMdK44= 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=dVlECa0X; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Fu5Zc/Ie; 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="dVlECa0X"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Fu5Zc/Ie" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66RDlaPV3414034 for ; Mon, 27 Jul 2026 14:02:48 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= 27qbWhE1JX4wnfcS0SKlSz8jUlC1ot/dXb0VTxIWKwU=; b=dVlECa0XB1O56tab WeRsguDjWyKMyWdPX9CAWOn+3rQbHqiI5NYE7dn3aXEBqU+Prw1Ne/jiwcXvjhF5 fENVzBNX4HscW5xYz4/d4c6/dET+0rZth9etKiq6j3fmdKPZ+U/9uJ59OoK1pfNU Dqc+XKO9FxO8HAji7oo76b+AyCUaL19GMTG5oWgGzt0KK45Lg7xWOjT8GivKnk+Z kEausv7pKJxvv0N5awZbyEGIbZMPmTw6jdIIWA5xIfGJo2ng2NcsWk8Yf9fhCQPs G7abd3IbmClANQ/MbOgjEbK/IpLU4dW8VGVqJpX547KljRidGKzirNdag1Vb2l0R vMwKMA== 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 4fp4v68y88-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 27 Jul 2026 14:02:48 +0000 (GMT) Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-cb711c88f2eso1697436a12.2 for ; Mon, 27 Jul 2026 07:02:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785160968; x=1785765768; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=27qbWhE1JX4wnfcS0SKlSz8jUlC1ot/dXb0VTxIWKwU=; b=Fu5Zc/IeYUEzo9x3vOYJWJ0WjcmTqFZOt6UrJzOOuvtMPc5beBleADcq1Dz4Xcmhrp KqophKV6CopIoDevYxrYzCcw4j8ZBgBoHmwNVbNHjmFSigtWIPh7PJd4HVuAQTV88tzc vicKww19InIyR0jwJi79DB7XIwuhAtOWcOdcM6qDgilCVGP/P8Za9vy3+Q1nU+OZTMSI LPArpAwqCRfrL1BHuUftWQ90Prv/qL3lYyQLksJrcqwixJ2X+7YnCuPo18Sa/dUGtvSU IwfWwJgRmvfuEfd4+LUIk2AlhDSXF/5DoLdUsVKEX4Q/L3Cqbmt4jugyD+2rKAew88Na UoWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785160968; x=1785765768; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=27qbWhE1JX4wnfcS0SKlSz8jUlC1ot/dXb0VTxIWKwU=; b=KdFl5d69vaZUGgxr/E2uONUEn0uvnvlFzAXJiRj/xQpHMMBIU2WQ66U8rkefu6CO9b mHPIgjWw4AJStWWHMt5zZTWrRGZQm7mpNGyl2lG9F8K57D/bTMbRqTsSKuWGhX0Ht16t +/ZUUK1N4vyaQSwu63PgKsJKTHGlqTq1iEu/1IgU3tIZWKPjyUXWOORSvh2dcWHMuz3g 6UyZdIEri7R5J0Fw7idgYZPyxGU8w+EnLfjGIgsxBRbrZRjK/PIfWjJCMOw/4JkbLTmR M+p4Yox673tYY2xyTzTTI70CVWNNyN3pNW0z5VBRiyxkaBcNjj1Lb9jWlETybggMAd7T evRg== X-Forwarded-Encrypted: i=1; AHgh+RofqX9Sfk2ak7D1wh19Y1LG/NYoNnC2gtX3as3Y198BoSFduNnerT7075T6Hk4hOCa/oiwiZXK02F/+EWI=@vger.kernel.org X-Gm-Message-State: AOJu0YwlMJHnBzrXSXMciEol3ZxwsQk0g/Zm95i+J4zRegtqoDNl1r63 2CTfTBw4DGRTmn1SIed6ar4jXQKVGeaLptMyI5Xqe7USMAt+HP5BnpKa1u+S6Xa/OtQXnd+1hYQ ZKta133jXWAPvVbQDVMPTcgb8tbjfvHYqL7SDAoX8AeLDS0mNtl105+T8voetn1o4nxE= X-Gm-Gg: AR+sD1170U5FWzZzBCv2DX7nm26nvPYL29DSm+Sigk7/mgcq2/u/9cXa4McNhcGYuk8 0G+dtByi99ZtJiDth0TSRB4vnXqZtMMY0idb6SBZbMhiYy5aZ2UHm7Kr9BVArV1bHxvCW3w0++k yVG81ArZKu1Vcv85Hx2BR4oM6p+CKI26eMM0SJ+0CiGuIuL2OsTjS7iA4uiPQxonSgKjPecmPt9 uA3oQSf2L6stnygQG4O4LIvDoC6U9N8mmTkTzx+/+0tov5fUgtxCAE+W54AfLx4Ydr2jJV9qUCK DvhCrto0LfdFn+TcX3e03taOCHGICFpwJQPJO36RtnAfqvT/bhqQqWhA9jh7PsU3JgY/9Ha8Vme hclYu2CkOJkmWO40DaUZ+IIgpqe5nqfC4mQg= X-Received: by 2002:a05:6a20:d4c:b0:3b2:924c:566e with SMTP id adf61e73a8af0-3c67ddeb79emr7772658637.36.1785160967471; Mon, 27 Jul 2026 07:02:47 -0700 (PDT) X-Received: by 2002:a05:6a20:d4c:b0:3b2:924c:566e with SMTP id adf61e73a8af0-3c67ddeb79emr7772592637.36.1785160966728; Mon, 27 Jul 2026 07:02:46 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13e6054598asm13789423c88.1.2026.07.27.07.02.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2026 07:02:46 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Mon, 27 Jul 2026 19:32:36 +0530 Subject: [PATCH v6 1/3] PCI/ASPM: Use pcie_capability_clear_and_set_word() for ASPM disable/restore 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: 7bit Message-Id: <20260727-aspm-v6-1-2ebb3ee7ef71@oss.qualcomm.com> References: <20260727-aspm-v6-0-2ebb3ee7ef71@oss.qualcomm.com> In-Reply-To: <20260727-aspm-v6-0-2ebb3ee7ef71@oss.qualcomm.com> To: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, mani@kernel.org, Krishna Chaitanya Chundru X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785160961; l=2676; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=5kN/cRMAAFpyxM5YEI12/i1t4RGTZoCvjXWtffoPOCQ=; b=4GOCWJbQHpYIId+8VEYwA7FBmNIjW/+fervHcg2C40d0V35DVp8HOGQ2pC/h06BK3TGcBYHWQ oyZbqhrv2YGBrv6KZMDPEtZVIP0IQTUPXMLxAkAVxAgNGdJZDhrxWgj X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-Spam-Info: AW1haW4tMjYwNzI3MDEzNCBTYWx0ZWRfX13iNMLur4t1h Njs6kHIqFlLQCY7HFQJ9/gs53oXrFI/cmzKuFXFzlFo5J7E3IFPeWpRddAOpz6Iqq3bqlR7R0GG XxHE+2xKbTVBPrJPVBPB3oduNbnbgJo= X-Proofpoint-GUID: KtR6h7L4--T9zHCgz3frrGW94obxM10r X-Authority-Analysis: v=2.4 cv=ev3vCIpX c=1 sm=1 tr=0 ts=6a676508 cx=c_pps a=rz3CxIlbcmazkYymdCej/Q==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=EUspDBNiAAAA:8 a=wuQQqu7ThqwHlQwkt1oA:9 a=QEXdDO2ut3YA:10 a=bFCP_H2QrGi7Okbo017w:22 X-Proofpoint-ORIG-GUID: KtR6h7L4--T9zHCgz3frrGW94obxM10r X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzI3MDEzNCBTYWx0ZWRfX0wfItxKHQ6Zb fPxcmYOLxoDkTyhT9Kq/2YrSw096d/xTYVful9H6sBnVXK9EvbscwBl8olAzeTOhCvpeFGaysG+ YsjHD/lJKJn2u18he/q+NEykSwTB1XwgyMXAy7ViQ+Vwm14AVgyKiDNhgk8N7vdl3u40xNEKKu0 V2CkPEKYsxHZP3D+a9YjXEiSSxXLYMdV8abvr3KTqQHrm03AmTKJy3TXcUlObQu3jqpoDNrE4vZ vX4L/+3cfeeJ4ZYzkIPrTgEWYmWh8V2wDRFmkr+dzASdjMXFpsLFFVo4wmULRnI4sg3vZ7lmNrQ gpdJ7qrew4n0RFwaip+NjoO6IZAhHBmhM1gAiTpn2W7pVhFZv2CKWzZ8ti2VoCpuDDeirY566h1 myF7cl+aC2mW1fklCEJg2Y0GMbt6N7lKFxr4KB2VaCPRpc2M8oEIWKAbA+sbcDyhA5UGh1Qs4Se gCmEKRNWQ5psxY9sqCQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-27_04,2026-07-24_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 impostorscore=0 bulkscore=0 malwarescore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607270134 pcie_aspm_cap_init() disables ASPM L0s/L1 on both ends of the Link before touching L1SS config, then later restores the LNKCTL state that was in effect beforehand. Both steps use raw pcie_capability_write_word() calls: the disable step computes the new value by hand from a snapshot taken earlier in the function, and the restore step writes that same snapshot straight back. Switch both steps to pcie_capability_clear_and_set_word(), masked to PCI_EXP_LNKCTL_ASPMC, matching the accessor pcie_config_aspm_dev() already uses elsewhere in this file for the exact same register. This does a live read-modify-write of just the ASPM Control bits instead of relying on a stale snapshot for the rest of the word, and is consistent with how the rest of the file already touches this register. No functional change. Fixes: 7447990137bf ("PCI/ASPM: Disable L1 before disabling L1 PM Substates") Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/pcie/aspm.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 172783e7f519..3f9c0f9a1cc7 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -894,10 +894,10 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist) /* Disable L0s/L1 before updating L1SS config */ if (FIELD_GET(PCI_EXP_LNKCTL_ASPMC, child_lnkctl) || FIELD_GET(PCI_EXP_LNKCTL_ASPMC, parent_lnkctl)) { - pcie_capability_write_word(child, PCI_EXP_LNKCTL, - child_lnkctl & ~PCI_EXP_LNKCTL_ASPMC); - pcie_capability_write_word(parent, PCI_EXP_LNKCTL, - parent_lnkctl & ~PCI_EXP_LNKCTL_ASPMC); + pcie_capability_clear_and_set_word(child, PCI_EXP_LNKCTL, + PCI_EXP_LNKCTL_ASPMC, 0); + pcie_capability_clear_and_set_word(parent, PCI_EXP_LNKCTL, + PCI_EXP_LNKCTL_ASPMC, 0); } /* @@ -927,8 +927,12 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist) /* Restore L0s/L1 if they were enabled */ if (FIELD_GET(PCI_EXP_LNKCTL_ASPMC, child_lnkctl) || FIELD_GET(PCI_EXP_LNKCTL_ASPMC, parent_lnkctl)) { - pcie_capability_write_word(parent, PCI_EXP_LNKCTL, parent_lnkctl); - pcie_capability_write_word(child, PCI_EXP_LNKCTL, child_lnkctl); + pcie_capability_clear_and_set_word(parent, PCI_EXP_LNKCTL, + PCI_EXP_LNKCTL_ASPMC, + parent_lnkctl & PCI_EXP_LNKCTL_ASPMC); + pcie_capability_clear_and_set_word(child, PCI_EXP_LNKCTL, + PCI_EXP_LNKCTL_ASPMC, + child_lnkctl & PCI_EXP_LNKCTL_ASPMC); } /* Save default state */ -- 2.34.1