From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794234595; b=P/Q+eII+4JRrVwSlQwMeQy0u0Ex02q/Mc+gIhWvxz7KmfNEWR/UNyBlSrJ2Kk7Q8ziGp avxwytj/ZVSllH/5GbutNnFljEs14HlXT/HQaxIoNm4zDByiEDxGQwyLID2hu22AvTw6y a04Gy16khv1QfxMJ+TNRvhFXnWVr/UpJ0fzrD/h9jmNOgcSOk6UTKOZbQHZ26LIxjQiOg iEKwaUCCgg1HhPX7mvtgSuIoflceUHt4fu+IYKDCBH8r5WjHsZ51bOYXeTuHVCDUeCZD6 uhjbkRFtG2ciJauC611G70g6ylm8SR0R0WL8qnpOFr1sVR+NKDJi8cpqhQOXRqYA98w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794234595; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:X-Received:Received:Message-ID: Date:MIME-Version:User-Agent:Subject:To:Cc:References: Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:X-Proofpoint-Spam-Details-Enc: X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID:X-Proofpoint-Spam-Info: X-Authority-Analysis:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=S7KDZcKU/Io5XgxBPImwgDSYRzpyHFK91x9pGyphsAM=; b=PTZnra6U3N01SvA5hI4LBsf6IJUfEpzaqY0PyNNSCKeI+WhrNvz45GfPfXYUQEqGoR2m MPjeQkpqImMU6cdR/lpoXqVs44nyVm8jT2GjNWhKF3yXMvbJhJzF8/HujVgIO0CqGBBmr nQNhG9ZbL3yXaIbTc53k7mAdRB5g8BZhJy6soHw/xfUjvVMtbPl8zGOrPET0DCF+NAv6S G7fNeAz8ftCWfiqVidIBSTMJBdc0/5XZ04ErfIESyP5cxvcz1k48wG+JFoCNynmiWy/B0 RRvnIvg3czESvqWixPbMIIbeHBmXQSPwHGJ4w0w5ikeOVMiEhPa7nKMgq5lsvIrWJCg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=hsUSmamq; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=KaRuyotC; arc=none smtp.remote-ip=205.220.168.131 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5D8F606A31C for ; Mon, 9 Nov 2026 14:29:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A5D8F606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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.a=rsa-sha256 header.s=qcppdkim1 header.b=hsUSmamq; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=KaRuyotC Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6A9DFESA4025867 for ; Mon, 9 Nov 2026 14:29: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= S7KDZcKU/Io5XgxBPImwgDSYRzpyHFK91x9pGyphsAM=; b=hsUSmamqp+4mG1SE KUW3SAIjEc099jEXwvCQNZqDxsS3vQvHCjIM+5B3BoN7z7sqS7O7QrgeV88ZoJTh mjt+RbmGUPGbyQGVrx+LoWEJuhY+eDxW8H7C3p4T+C55dPaQH0Z6d7ZimAalRx3q BOF0MZB6HkO8jSfTK0Ra40Z6nvrkckSC9pa3mIFiYUS79qzRsS+2gqDcdYk80C07 /qLRjX7YjRhwcuTFP7yTF33rjKenqqsila2AURcFh0f2/poJv+Efmqvznmu9YSdj v3MwHvujMgKbY0uKlOEDvlQCWK5VOPUg9Jje2gA6hpT4usmLQWJruPJXdSVohW1r 7fQ3og== Received: from mail-vs1-f70.google.com (mail-vs1-f70.google.com [209.85.217.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4hua589bwy-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 09 Nov 2026 14:29:53 +0000 (GMT) Received: by mail-vs1-f70.google.com with SMTP id ada2fe7eead31-7d2c5352d1eso30767137.3 for ; Mon, 09 Nov 2026 06:29:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1794234592; x=1794839392; darn=vger.kernel.org; h=content-transfer-encoding:content-type: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 :content-type; bh=S7KDZcKU/Io5XgxBPImwgDSYRzpyHFK91x9pGyphsAM=; b=KaRuyotCuCFrcyvYNPhSecTPgRBE5ZluStDX2v4stdKM1N/NEX9M0Bx0+rl5JZX7Lt wV/aYv7XQbP7zkO0CE43aUt3OVYofm+Sy980jRRM1ydR/v4nahyVZakqlkFgzso4VS7P 0MaYjjruIP43L/mMGJFeh0qC5z4d6gz2ZmWl5SAqOcj6hWtTOGBVL6PW3yW3J2UONFuw SvDEa+TxHOyzO+MtsN1wIBM+9y12bZHXcczljC6mHXurGG0E2vu2uWx+tAY1rubvvBLN QPf5gXvNME/pa7VbH2B4z1BlfWAImbBOp3Wg2HgT3Zlk+s6ufT2D4VAopFTB98eVlHDj rlpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794234592; x=1794839392; h=content-transfer-encoding:content-type: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:content-type; bh=S7KDZcKU/Io5XgxBPImwgDSYRzpyHFK91x9pGyphsAM=; b=02dVsUOFzsNS+VAbo/ih+oRRDsBbr62R1uqz+PqJ/nDf/ilQaVro1IhUevlAFXC/vC ENzQrhv4HwbzCW4rxGwkj/XJ7giOeBv9vjRUEUFCJz7PNl2cb7drNrPohrAAZwylOUKy NGKAabGlQr7fktMsytJfgDQqtJMVzuhXeQux4+WZeJ146fSn5Xa14jtyNCJRLXOSEfBR 8X7i+jbtQkU8oJ9HbKtjOO8gthz5ZE2emoVqJwSei7exnBmfZVMsTo8js79s5p90Eaf/ OQMqSIwZpdMiTrW871s1viX5aY+VSMzTCpaMRo5Udt/QOBzOPQQW3Lby3XWajNzz9emf p9eQ== X-Forwarded-Encrypted: i=1; AL+hErGnvxYWRVs94NP82/YcffDaj5RfCFLWauqrfSqF72VR8Z493o1q/MZJKXC267hKNdD0E2+Pt4eg/By5r1c=@vger.kernel.org X-Gm-Message-State: APuU4Z/NeBn9X2SppMnRVGrAQ7caH1e9OI3mgQ9ECq867QrwgYH5iqtN ieIxCc3WsKUBGJc4NFaaoVpDHM2c23m0prWOGDj4guCbAPzHYpa7fu+RXBmDfAnfalVTHF8VLf3 T/IOwAnn/QI4DHyS9q9KmIQBNfL+tSx9noJCbH2W/sCAuMBQcxGLSEgrr2H/KciVDr0VMNAoF8K o= X-Gm-Gg: AYBFou3FTO2uU3IjC+y3N4MnUKE+vFjTrYo500bdmmZ96S3nsFoGHBMmbHOk14tS47y H85fNd5byMqC9nCGwpURzsHvRf9pD9cOOcTwBnn0o+jv2rI33yqm2vDdMF2o9EdYJ5Ebvte4bvS E9aT44hHEUKk++HlowWzJwUMWg/cN2a3MySiIgNO7Wc0guamxbL3E24/2SkJ65QZYPOixEhzcde VOwqcOhTRBDvyUwZfXv1T2cIqPbl+Hqqp20aJpNH7IV4WhrjJGPd1KS2ds1yIc6f5WL+YPz98mG RgV8Dc7wq5OACPBHcas5irXPVuVP4sTVWDhFMckVu0n3gzCfTdzTr8UGc3um84NEK1D5+HKMpek p5XfhaeTDw+/U7FpGrJfm3n4ejarbhYwBGuPdbPDp/Z8GYRL+Y2I4be8kh6dFyIo3qhO+lQ== X-Received: by 2002:a05:6122:360d:b0:5e0:2ba:5a06 with SMTP id 71dfb90a1353d-5ece737a062mr963301e0c.4.1794234583912; Mon, 09 Nov 2026 06:29:43 -0800 (PST) X-Received: by 2002:a05:6122:360d:b0:5e0:2ba:5a06 with SMTP id 71dfb90a1353d-5ece737a062mr963286e0c.4.1794234583423; Mon, 09 Nov 2026 06:29:43 -0800 (PST) Received: from [192.168.226.72] ([178.235.128.140]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c4d6a47515dsm173047166b.44.2026.11.09.06.29.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Nov 2026 06:29:42 -0800 (PST) Message-ID: Date: Mon, 9 Nov 2026 15:29:40 +0100 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v8 4/4] PCI: qcom: Implement shutdown() callback To: Krishna Chaitanya Chundru , 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, linux-arm-msm@vger.kernel.org References: <20261107-shutdown-v8-0-bf607c6429b0@oss.qualcomm.com> <20261107-shutdown-v8-4-bf607c6429b0@oss.qualcomm.com> Content-Language: en-US From: Konrad Dybcio In-Reply-To: <20261107-shutdown-v8-4-bf607c6429b0@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTA5MDA1NyBTYWx0ZWRfXw9mSm1q4SnlN dwD/I2BdUY97bmq7rBiR1CQqzhaAm9LpKfpmdGJ8k3zYD5Uilnrw7+UZoNmLIUIZVJ19MnE9JH4 eWT198RHqTZ2xy1qSp21+0xWQHQ+OoaCD3wTrxYwlX4J1edSSqdPHLM0+JyqzUmEFay1dK/iFZ4 rjxCiqANw+80M4YziZUuWqWhdrBjXMmce//Aigj3tVboOWqw089bPmeU2GpqJaVjXL86L6oRJg5 PHsG5uD8uEsLHdRiwJMMmrc9/sltA+xLBQaG/bOxt5qUyrppw7iGUTyPLeBEg7Sg6iuWRgDSvmy 3+0mLPqVl3HdxN51gskqNudEjhqz3TaDQx+TNDixa52uR7MD1jSz1SKNG+KZ3GPo/aZXc3WLAdM pRvXjuUrc8lGMun9WWY8887h9Tzr0fNYkkBqNDVRhPxeWUYjo76bYv3fwU181mievPwduI3+RRg SYmbzicZdhKVQlzgW8g== X-Proofpoint-ORIG-GUID: vv2O6GU-SToNflKc3AoKRF-Q3HK-id8i X-Proofpoint-GUID: vv2O6GU-SToNflKc3AoKRF-Q3HK-id8i X-Proofpoint-Spam-Info: AW1haW4tMjYxMTA5MDA1NyBTYWx0ZWRfX/TKWg11bu36a QFo00dYHAD/s4wREsx6Grj18Iouhsv5VkO8ExgzPwDZBDUsFxbFr1LgLRqQxCGOzCTJt763vHS7 rM2wGZqiLDZZsX5XGqK3+d9c4RozOeE= X-Authority-Analysis: v=2.4 cv=C9V8WgP+ c=1 sm=1 tr=0 ts=6af1d8e1 cx=c_pps a=N1BjEkVkxJi3uNfLdpvX3g==:117 a=PRfkaYvzSr8QmIIGAkY2Sg==:17 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=VwQbUJbxAAAA:8 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=mifKogskm1HCQoUnOUEA:9 a=QEXdDO2ut3YA:10 a=crWF4MFLhNY0qMRaF8an:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-09_05,2026-11-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 bulkscore=0 suspectscore=0 adultscore=0 malwarescore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611090057 On 11/7/26 2:45 AM, Krishna Chaitanya Chundru wrote: > From: Manivannan Sadhasivam > > PCIe host controllers should bring the link down cleanly before system > shutdown/reboot proceeds to remove power/clocks from the controller. > Without this, the link may still be up and endpoints still have > transactions in flight when power/clocks are cut, which can trip SMMU > translation faults or NoC protocol errors. > > Reuse dw_pcie_suspend_noirq() in the shutdown path to force the link > into L2, putting it into D3cold. > > device_shutdown() runs with interrupts enabled, unlike suspend_noirq(). > Mask the chained MSI IRQ(s) and the Global IRQ before tearing down the > link and clocks/PHY, since a late/spurious interrupt could otherwise > reach a handler that touches now-unclocked PARF/DBI registers. Use > dw_pcie_mask_msi() rather than dw_pcie_free_msi() so the MSI IRQ domain > and the MSI mappings held by downstream devices (which device_shutdown() > does not remove) are left intact. > > Signed-off-by: Manivannan Sadhasivam > Signed-off-by: Krishna Chaitanya Chundru > --- > drivers/pci/controller/dwc/pcie-qcom.c | 41 ++++++++++++++++++++++++++++++++++ > 1 file changed, 41 insertions(+) > > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c > index d39753f0e724..c5b06db3b92a 100644 > --- a/drivers/pci/controller/dwc/pcie-qcom.c > +++ b/drivers/pci/controller/dwc/pcie-qcom.c > @@ -2046,6 +2046,9 @@ static int qcom_pcie_ecam_host_init(struct pci_config_window *cfg) > > dw_pcie_msi_init(pp); > > + /* Stash pci so qcom_pcie_shutdown() can mask the MSI IRQ(s) later */ > + platform_set_drvdata(to_platform_device(dev), pci); > + > return devm_add_action_or_reset(dev, qcom_pci_free_msi, pp); > } > > @@ -2466,6 +2469,43 @@ static int qcom_pcie_probe(struct platform_device *pdev) > return ret; > } > > +static void qcom_pcie_shutdown(struct platform_device *pdev) > +{ > + const struct qcom_pcie_cfg *pcie_cfg = of_device_get_match_data(&pdev->dev); > + struct qcom_pcie *pcie = NULL; > + struct dw_pcie *pci; > + > + if (pcie_cfg && pcie_cfg->firmware_managed) { > + /* > + * Firmware owns the link teardown and clock/PHY shutdown in > + * this mode; Linux only owns the chained MSI IRQ(s), which > + * still need to be masked off before shutdown proceeds. > + */ > + pci = platform_get_drvdata(pdev); Revisiting my older comment, we can still stash `pci` in drvdata regardless of the flavor and do `struct qcom_pcie *pcie = to_qcom_pcie(pci);` in places where we need it Konrad > + } else { > + pcie = platform_get_drvdata(pdev); > + pci = pcie->pci; > + > + if (pcie->global_irq) > + disable_irq(pcie->global_irq); > + } > + > + if (pci->pp.use_imsi_rx) > + dw_pcie_mask_msi(&pci->pp); > + > + /* > + * In firmware-managed mode 'pcie' stays NULL and firmware owns the > + * link/clock teardown. Otherwise, skip if the controller is already > + * suspended (e.g. a prior resume failed), since dw_pcie_suspend_noirq() > + * would touch DBI registers with clocks/interconnects already off. > + */ > + if (pcie && !pcie->pci->suspended) > + dw_pcie_suspend_noirq(pcie->pci, true); > + > + pm_runtime_put_sync(&pdev->dev); > + pm_runtime_disable(&pdev->dev); > +} > + > static int qcom_pcie_suspend_noirq(struct device *dev) > { > struct qcom_pcie *pcie; > @@ -2657,5 +2697,6 @@ static struct platform_driver qcom_pcie_driver = { > .pm = &qcom_pcie_pm_ops, > .probe_type = PROBE_PREFER_ASYNCHRONOUS, > }, > + .shutdown = qcom_pcie_shutdown, > }; > builtin_platform_driver(qcom_pcie_driver); >