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 4970432D0D1 for ; Thu, 18 Dec 2025 12:27:38 +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=1766060860; cv=none; b=GKgusBpnQ6n/orV5feyWYwpHx9e5TpqXN2AMCk96gsBI3MMiXr83CotHHQ5qbrcFvTeCccvKqgjUWK5Ye4/WcAat04wePpI5/2P4zO912dVXzGjP62iskDRqN4Pz3/xgsn8Ql6A7ZnHfWfxgSj6ZNmAjNy6x9evPMUJc+0Td//E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766060860; c=relaxed/simple; bh=gxqd/Cknq4GHduWkmglMeRYPbQ1CBWMJnYnU8qrYblQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=qxKg/vyqGaE2zJ+GEh736DLxO5WOq1Ww5SDhnuAn2el3oSH9nqzpdlP+3L43Z4cBSp+Hw6zeJ0eTZBJL3CpKRn86CuNV7CeThEwBBIlITSImaXfRtQwbY1TnKxldR45B4rwwowo8XwTMGbhHVyuo0cbfhqX6BXkuFANNfvzU6Co= 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=asepEsiO; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=eSmo4YHi; 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="asepEsiO"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="eSmo4YHi" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BI9KrsT4148044 for ; Thu, 18 Dec 2025 12:27:37 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= Nke1jB7g3bqerrkvuvpBT7m/sV5Z4bOM9LsLmXYBlLY=; b=asepEsiOAE4jHLcc pJPw6zZDe67DdPR6s1em4pVsLkS7yCaZ5lpsvoBCGWPIQ0y9ZiMIG5I4VeHRgEpz sW2EVX6o6agZfCtj/isgJRmIImcGPThTZKnPK/lfaFlOiCdmDHLP9peDZ1iQUK4y QRo3M1ips/k+lqejIyEzIKK8+4HXGCsvgsLJXUCqEOFux6uQE1hdgLdHzOTBZFk3 GZmoESWAiLd+W0qO2xYJU+2lygpFYas/EToAE2ErRzZ0HH/puWrHym+C4lAENEec klf7AbmVCuv+HbRhPQa7t+EcBSOGc5zVgTSrQlRXccJnCCs6PzSTiMvuq4ih0pbZ ODzRlw== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4b40u7b3y9-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 18 Dec 2025 12:27:37 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2a0a8c465c1so12177335ad.1 for ; Thu, 18 Dec 2025 04:27:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1766060857; x=1766665657; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Nke1jB7g3bqerrkvuvpBT7m/sV5Z4bOM9LsLmXYBlLY=; b=eSmo4YHiL9CDeTEKyC1Wcv0mgKe5h4FOiw1vCAR0Jjpl9dIWy4Z3I0Q82cBp0XFG0X 4+k8BWk1l2zwc9m4JBIK1IiqfKAbrHrsG8YctrRBnAZAwBp66OxClmFemLGriPInHrP6 hAqbxELo05+TAu2dZaqDm7xLVY6tp3mls0gr96lAi5XnwQ+2bOt+Ia1yq2dN97P1caZe GTAki1UecQHprGRQlWWLSkPCzgJVOL1uuWClOvZEjFgmfce/wWjBKi6G+hvWPoq+7IZa TOu1/P8Ul3TIaEeHPSbauARDbH+3Ab1Z2YhmJwOrgKM3pnnQbiiIPy9TTaPF4H6PyI5O 8lpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766060857; x=1766665657; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Nke1jB7g3bqerrkvuvpBT7m/sV5Z4bOM9LsLmXYBlLY=; b=uo4OGsZnqcJtu/jwEgo5i3QVhmvi1ghFMFCDbH++HK33VXFgFud0vp8ojVEOEu3t5M +mLbHFd00Xsz3cEzT5G2+AZLseFtQyKSAuyhxUuYqC7u4CLz+B42bx71+E4ldPFeQOOg 9b0GY5OqwWq86QNcswPjIr8Z95aOfpkHpGp/nPuDvwKAWDAeTkWDX4eiolnzUj1Ppy2H 6SNoCcXDGsW9uVEkx1ekhvMuA5xenskwx79dB3L6JMSDemjqHe3XF0K1CCzNxyBne53N 4LZC7+dEj2KeghpSNS99bIyOOa1053pOcBIH+YpNuLCqvm22K/mSS0dsXFFhLUmTQu+h PbGQ== X-Forwarded-Encrypted: i=1; AJvYcCU92ynLRFgkxV6uaqydbRfoGY4lbidkQIzia3t71QZAiVm53r6PrglqXJ2IGWTtbfTp+a9sfbG7GphswNE=@vger.kernel.org X-Gm-Message-State: AOJu0YwsGMFhyrK9pV2KilQdSWlYSYq62/VZAiYMuMmEs3r63ecZUojO T4YMG5ojQPjMDBRCm9kpVhRJRhpEpKzdLT1PTUn8ucmqqjF7g3uOPNOVG4fG7joYkTM35VqGP6f /OwC36mOefvlmG3YgbR0pHiiFY0fK2NaeZy8KcpzK4ISJP2jGsyX/QkaByzBne1Mr5o0= X-Gm-Gg: AY/fxX6YSYVg+q6QK7A2Td3VsijVioGnSc+Wt5BZH9bCbZC5p38es/XJtOHL4dL6aTH aL84siSG17mrXwJmWDmnUXFMhT+sdYANoUHMzwdhP1rqC9+GFmwVEKSD3XsjFlEd+z1t6d/WHmP aN/y58lZS2ZpV4AyfsApDXGeaxyQGIpzOa8C6jrLAEd+io0CgCYFCBVDEAZiFuOM2l+dKrjlucN uf087TU6CgQcS8+Zcd+8K3y37yZZHwOfsKS2nvW7qf59s6Lo2/+4z90Ad8MTxq/xRWVvfCyp1zv wHq1jNgzC9gkOc+EeawjMVAiHxQ1nwezt0j0MEtbUZWQAh1E7rXRpl/H9mvIOFc2ip6AuVNPpbU JcQkx05hd0d9vJZGt7EzFJ3IWVhbsmQhGQyGhS+Wt9w== X-Received: by 2002:a17:902:c951:b0:295:28a4:f0c6 with SMTP id d9443c01a7336-2a2ca902bc7mr29120745ad.0.1766060856538; Thu, 18 Dec 2025 04:27:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IGxsZ5KKM/k1jJXpL4x+24gnjXHUZaN/U/5zUK34RnmcvN9TYgvj0/WoDy6lfsmiEbMOC/o+A== X-Received: by 2002:a17:902:c951:b0:295:28a4:f0c6 with SMTP id d9443c01a7336-2a2ca902bc7mr29120415ad.0.1766060856013; Thu, 18 Dec 2025 04:27:36 -0800 (PST) Received: from [10.218.35.45] ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a2d1926ca3sm24148385ad.83.2025.12.18.04.27.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Dec 2025 04:27:35 -0800 (PST) Message-ID: <237606b2-783a-4e11-854b-fed787e2903d@oss.qualcomm.com> Date: Thu, 18 Dec 2025 17:57:30 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/2] PCI: dwc: Do not return failure if link is in Detect.Quiet/Active states To: manivannan.sadhasivam@oss.qualcomm.com, Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, vincent.guittot@linaro.org, zhangsenchuan@eswincomputing.com References: <20251218-pci-dwc-suspend-rework-v2-0-5a7778c6094a@oss.qualcomm.com> <20251218-pci-dwc-suspend-rework-v2-2-5a7778c6094a@oss.qualcomm.com> Content-Language: en-US From: Krishna Chaitanya Chundru In-Reply-To: <20251218-pci-dwc-suspend-rework-v2-2-5a7778c6094a@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-GUID: jxgkwj-hg9pF8mNfDVlm9lsxd9kx9o7U X-Authority-Analysis: v=2.4 cv=Z8Th3XRA c=1 sm=1 tr=0 ts=6943f339 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=W4O9Uj2zEgxfpYwkYKQA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-ORIG-GUID: jxgkwj-hg9pF8mNfDVlm9lsxd9kx9o7U X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjE4MDEwMyBTYWx0ZWRfXwbgJFTd3q518 56Iazo2aRVtASL2hNYFM2CMcVovZ57SAlRR7zj0aPR0zzTVybZu0zv4R3J94NfCquRtwX62ikD4 ZYgTax/sy3fmSLm1DePFdukE8pTBIf/Ik5L9D6vC4kzA3LAYxfYkfA5rOF92qgS5LcFG3XM6B82 Eotwi+4rrjsBcHub+9BRHlPgeiaFpEaK5h31ZoR2MDYCXMbMR+peYnGwgICtUsxqO04P4uhvaBS AGapFIiiN7P6gc47IUlMl8wo4rN7UWblQJYOWK1sbltZcfHruS55iUqsIAIw6c200GN1yzrZzeS 0MqgzoH8/3dSoF+n7xdJY+pofL7ADAl+53unROxDaisl5iBj6MIScuOdYjY4BKJynHvI/TD2SH+ ZHmlp8Z6tIaV1SZv5FkBv5M/Qbxl1w== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-18_01,2025-12-17_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 bulkscore=0 malwarescore=0 suspectscore=0 impostorscore=0 lowpriorityscore=0 clxscore=1015 phishscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512180103 On 12/18/2025 5:34 PM, Manivannan Sadhasivam via B4 Relay wrote: > From: Manivannan Sadhasivam > > dw_pcie_wait_for_link() API waits for the link to be up and returns failure > if the link is not up within the 1 second interval. But if there was no > device connected to the bus, then the link up failure would be expected. > In that case, the callers might want to skip the failure in a hope that the > link will be up later when a device gets connected. > > One of the callers, dw_pcie_host_init() is currently skipping the failure > irrespective of the link state, in an assumption that the link may come up > later. But this assumption is wrong, since LTSSM states other than > Detect.Quiet and Detect.Active during link training phase are considered to > be fatal and the link needs to be retrained. > > So to avoid callers making wrong assumptions, skip returning failure from > dw_pcie_wait_for_link() only if the link is in Detect.Quiet or > Detect.Active states after timeout and also check the return value of the > API in dw_pcie_host_init(). > > Signed-off-by: Manivannan Sadhasivam > --- > drivers/pci/controller/dwc/pcie-designware-host.c | 8 +++++--- > drivers/pci/controller/dwc/pcie-designware.c | 12 +++++++++++- > 2 files changed, 16 insertions(+), 4 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c > index 43d091128ef7..ef6d9ae6eddb 100644 > --- a/drivers/pci/controller/dwc/pcie-designware-host.c > +++ b/drivers/pci/controller/dwc/pcie-designware-host.c > @@ -670,9 +670,11 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) > * If there is no Link Up IRQ, we should not bypass the delay > * because that would require users to manually rescan for devices. > */ > - if (!pp->use_linkup_irq) > - /* Ignore errors, the link may come up later */ > - dw_pcie_wait_for_link(pci); > + if (!pp->use_linkup_irq) { > + ret = dw_pcie_wait_for_link(pci); > + if (ret) > + goto err_stop_link; > + } > > ret = pci_host_probe(bridge); > if (ret) > diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c > index 75fc8b767fcc..b58baf26ce58 100644 > --- a/drivers/pci/controller/dwc/pcie-designware.c > +++ b/drivers/pci/controller/dwc/pcie-designware.c > @@ -641,7 +641,7 @@ void dw_pcie_disable_atu(struct dw_pcie *pci, u32 dir, int index) > > int dw_pcie_wait_for_link(struct dw_pcie *pci) > { > - u32 offset, val; > + u32 offset, val, ltssm; > int retries; > > /* Check if the link is up or not */ > @@ -653,6 +653,16 @@ int dw_pcie_wait_for_link(struct dw_pcie *pci) > } > > if (retries >= PCIE_LINK_WAIT_MAX_RETRIES) { > + /* > + * If the link is in Detect.Quiet or Detect.Active state, it > + * indicates that no device is detected. So return success to > + * allow the device to show up later. > + */ > + ltssm = dw_pcie_get_ltssm(pci); > + if (ltssm == DW_PCIE_LTSSM_DETECT_QUIET || > + ltssm == DW_PCIE_LTSSM_DETECT_ACT) > + return 0; > + > dev_info(pci->dev, "Phy link never came up\n"); Can you move this print above, as this print is useful for the user to know that, link is not up yet. - Krishna Chaitanya. > return -ETIMEDOUT; > } >