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 AA382334C05 for ; Thu, 18 Dec 2025 12:56:19 +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=1766062581; cv=none; b=mv57hu4/8YwAyjCA6ZwOwm21qMmfL3n+G+xTIEa2KDuRdTlF7QiTVJsfvK3fjdhM8D8cP9nCr07zrgkCoiFJt2sKBy1X46A2ekKEfC8O9Ef3j4C1RQEhiOF4Vl9F5NXdXlfZvjcPN3WJp0muDgkP8rCRFJ5tJEeI9svC0zgg01s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766062581; c=relaxed/simple; bh=/Ryx2XaukYApRR+V3xOMVWTe4klYiYbCt48ci7hYs+s=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=pyIIm5UkTuXRzAHjJnW+bODWsXqnlHPLYB+a+Lx57MpoGkVB2UBoKyzQjIu6mJBO31UZWXeN6Sbl8OnroHeP7WNTZI/JnlpqgR7LxwS54USeDvCGXXHyHSquG645h7P3jTD1XxQ9mCM+J9o7699bMDOu6+872UsLmyUTj+F3PJI= 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=o3Ol76ap; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=CUYBRZcv; 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="o3Ol76ap"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="CUYBRZcv" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BI9FZqY4189397 for ; Thu, 18 Dec 2025 12:56:19 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= yShMG4kNQpdUj2h+GMzF3YTiuPcIUJL02zFHHKl4jrM=; b=o3Ol76ap8dWAa5dy IqOmJ4PXk3rcoVFFgTnGNdk7nm2+Jvy72XlVA5O2Ya+ilCxYWPMmiNBciLbaPeDP FVuVvxlPL7D24vvvCd/XKjjXVOYtrW3uTtI0SpFlYHPxBPLgiJ5qgSb02JGBs5SD fCz5vh7oXmfklQPEd1/BTTGKomqJX45ica5jwF0SV0Hv97FUaEKzc9SCGStnHDw9 sz+9r+xYydUfkWB2Qe5UFvej08eV6IptuYWLv8DRi1lo4Vy7EYl+0bVG1IoGckgj 5IBi7as+rfOufJw0nI/NmRnumWpjBXKuXdr+3G6CShGUqosxZ1kVE8xqQ71mm7pl 8ODsAQ== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4b47pkj0qy-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 18 Dec 2025 12:56:18 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2a0c495fc7aso8750595ad.3 for ; Thu, 18 Dec 2025 04:56:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1766062578; x=1766667378; 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=yShMG4kNQpdUj2h+GMzF3YTiuPcIUJL02zFHHKl4jrM=; b=CUYBRZcvfPU14M4gjExQ/IYE+T4d1PA7Mswl3DubbeUaUR4nD80XdwecwDoVOfOq5o 2GwF74TPz6o7xhBYTS4ztZaTaL9M69cXR3Txg+DnlshbgFfra3NI8p87SEKYbO5G6yic KPgOMAXGQIA2ZKtcfLhijWN7RWdt40CFvBTblvkZvPICq8aNzWN/9Q9tbNa4ewbA+mTC 6n2aPBeLNwKhE4fnBi4x08FXKarwkmeE6jXXQhBmGghopiYBr/5doIRd08O6YlJZetB9 dtv/6IGPr2Vh8csbxVLwqlvynucZq/k8AVTUcElyZpQan0xif0/AcY8g1wy57CFd3NXV zrxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766062578; x=1766667378; 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=yShMG4kNQpdUj2h+GMzF3YTiuPcIUJL02zFHHKl4jrM=; b=f1tg6u3ZafUhblOT/5YZCu5qk7tlxI3BicCafZEPsvDCMpbL6IC13VA0PvbMjRnXi4 GrEZ/DU61ROgzP2v/QkGvgmUpwbTX9ixdowROvzLspafRwbEr1bieW6r5StwT/Ho3PJy aO2vZfrqD/O/j2JKg9ynpfHi88/KTRR0c40+SN+GcdGVTj/OCD2OFk2bPKLqrj9bwZZn c62aLNNqBRNQOV7We8lTBhItM6FlsRosX5bwWzgER1NHEAoAuJ2sMBCMOGF9msgG31NO LyA8Qid7HR4lgjGzmI/mmz/Q1KrvYA17rJpkGEbTZVsxjTeFCWNCKjQxEUaAs+Rwivi9 w9Yw== X-Forwarded-Encrypted: i=1; AJvYcCWh83vmzfpjJ5qZu6f2qreXVhaDlUqiWqscKV25amGQm+d9wXg02RedFyUmrpI/lUIphfeh9gqZi+Y6vyU=@vger.kernel.org X-Gm-Message-State: AOJu0YxxsN3I3qSyJ7Vw/XXdnRUivQ6WT3+uVbM++7uVGPU7mGgSnAo1 24whBbuXSIp1cr8SgqTHrewhiJWqJDmfQruVOSqWGTe2YSel09iEeNZT9h+rrozt75joBbVlPfG 7H5iO40cWXbClJ9omcFeOr2alCQUdh6MeXNN0Kv+VKQzbcffHvydZoiKqfe3s9gsKgGc= X-Gm-Gg: AY/fxX4RnAoIW+QJT0mBf3nZ6YgF4bFvCWLdej/QHmHoBMS3wfubdm4Fw26aKG1DGLN I4hdm/vj7VXAifmuFoy74BSv6eVMeP8kDeYu4o1ZbBxb8XbV7qe+MPbitH/H+UNIinaVTzdFT8x cpQWJ9pe4Us1FlWZJZiPErAlgdCtYmH6M0l5pGgEkG9maGoGJe/65Vtt7wYoykbZbA2Dz8JfeB4 ntSjy5B9gbqQPezlxpTPotknyQmH842t8FD8I0olhiKgOxZxTJpN9+VFcmvUsvf7TfpCiA0KZXT AIWVjKPVdlTDr2gIgew+6UksZHlLHp+boZAYFFFfrtYPbiV1twtBYNJy4fYv75kuCbsZ2NQt5wn acKC+s868LOphjA6v+fE84xUGmkLlxx7UQMQ31hudlA== X-Received: by 2002:a17:903:40c5:b0:2a0:9fc8:a98b with SMTP id d9443c01a7336-2a09fc8b009mr164840325ad.40.1766062578085; Thu, 18 Dec 2025 04:56:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IErm9mdtpsuYiQTso3NZAs3/Pbqu4BC0S5q3wlv+e8BBn0piG8M7lD78hdzUQUWcz37eUdmkQ== X-Received: by 2002:a17:903:40c5:b0:2a0:9fc8:a98b with SMTP id d9443c01a7336-2a09fc8b009mr164839955ad.40.1766062577539; Thu, 18 Dec 2025 04:56:17 -0800 (PST) Received: from [10.218.35.45] ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a2d1927169sm25025855ad.85.2025.12.18.04.56.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Dec 2025 04:56:17 -0800 (PST) Message-ID: Date: Thu, 18 Dec 2025 18:26:12 +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 Cc: manivannan.sadhasivam@oss.qualcomm.com, Jingoo Han , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , 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> <237606b2-783a-4e11-854b-fed787e2903d@oss.qualcomm.com> Content-Language: en-US From: Krishna Chaitanya Chundru In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-ORIG-GUID: BYAuWWkzhH1fK6XQrsBb7f3ZJ43KtPll X-Authority-Analysis: v=2.4 cv=Md9hep/f c=1 sm=1 tr=0 ts=6943f9f2 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=1m2I05raOZ1oqLzephcA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjE4MDEwNyBTYWx0ZWRfX1OirDIcWwvSe 8VeTBzUceIwXzjwh1j4kbBFjg4puG9LVlMHZOl0RBU6cMipuISIJ//elcSooiJ1GWFGUCXdNF7c +zmO3ZufY4NjsR7E10ucoB78Puzjqh6H45HwlI/68Jg4GZwBJKMb0dnpEkP7A1cG9fGP9Gg14jz t2G/bNbCzxqApFS2s5EHA1kSPiCs3spdTvnf/rqxdwLXEJ6iLJPM0AGc+BXT7yfTHLiwF2Qp/Zh IxeCQbTn10ke3iBSW/MJO5y4e40BBbh5ZNs2MXWEtPtFipLRPSDd2ypheWxpapaEKnWqEAruDTd 5/hGrW/S0B1+OMxgsVWDkLYzpq8g3bHugWEhFF+dAEW7NLefv87Y+PXbHsDBjP/jfb0N99fP074 KUX0Te2dY7J8G5pj3x4JbafjconBIQ== X-Proofpoint-GUID: BYAuWWkzhH1fK6XQrsBb7f3ZJ43KtPll 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 malwarescore=0 clxscore=1015 adultscore=0 spamscore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 phishscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512180107 On 12/18/2025 6:16 PM, Manivannan Sadhasivam wrote: > On Thu, Dec 18, 2025 at 05:57:30PM +0530, Krishna Chaitanya Chundru wrote: >> >> 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. >> > If the device is not connected to the bus, what information does this log > provide to the user? Not every user is aware that device is not connected, at-least this log will give info that there is no device connected. - Krishna Chaitanya. > - Mani >