Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1696111lqg; Mon, 4 Mar 2024 00:17:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWtXLYR1lLcAGZrfoJZr2oRlY5r+1Fq0cwiTxXtTOml1HIB6G/KBF7+QvQPMSrGvMeFB5uwLu3kBQ7adJciAo9sYCAYpwpgEQU4v11FXQ== X-Google-Smtp-Source: AGHT+IEP3OUdM5UtiJR5AMfvUfCBJAT6BCJFp18QdZJZ5xupIJoElRJQbCyo2ECo3ba7izA8vpdO X-Received: by 2002:a05:620a:2489:b0:788:cf7:63ad with SMTP id i9-20020a05620a248900b007880cf763admr10909039qkn.78.1709540262442; Mon, 04 Mar 2024 00:17:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709540262; cv=pass; d=google.com; s=arc-20160816; b=GvxfIqLCG9i9JJurTpGbCgj76BYDR+eST/xfAO13JNEAYi57X9sKPm3a0/u2w9PlOk t9BIYzqAKcG+IA73GuNQtxrxO5hxEW51Lfp7w0SFNK96rCpmZ1phBlJIXVs8ZK3Z8JVV x8jPIu3Z72r8inB3nIFbD4DkTjx30RgDw/jbpBBzzrwXEEFW/ItixPfGRtVwubB5I4Vy 413Jf/K1kMc+/Yj0Kq3TXTx+9M2vpGT7D8R3yB1K9dBNk46ytj/v4SXmKYPZRmwHqGaU uBfKs4BsVercXo9+9+4SaR/jfN7eb8t450adF7FsIbS0WpYuiBJjccG3ohS4l92i6q5+ bNQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hmWR/dQ/IEMHbjZi2RajMkmXPdKPqp6IFe8boeN75aE=; fh=7YP5cMWkAdJHSAYQBa7Ge+mz1EQtMjWe2h3ynaC02Bs=; b=flSWoy/VmsKVygRcsujtuBKMS6VY0GMJYpgDUKNQJe7/zdXQFS5HBxxPvPnf3sSh71 wKOrPHHCwWersjiXvyx2hVxoAPRv9xjkmEYs04y90tVsW3++d6J0vzZ+DJXFBQQ/qioW sFJObb9VZbK0uFzs6t2nfeMBGEeLaPQ97dg/FmCLLaLa9R8qVe1Ir8ty8dG/E/1hYJ+g 78CNe/H+6002Jg/WnYH5u8EmHP52rHx+PlajkNGWS3Wg8Wh5Y2eVV+CyRkmmUhwDMsHl LexLNZzWwC6rbKZD8KL8B5VbhV3T9XvR7Sr6wj9gGKNAIWqwy1MFtIspxeYJ3Ahrc0wm l+uQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qLBmXvOF; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-90187-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90187-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id pe19-20020a05620a851300b00787ec1797cdsi9058068qkn.104.2024.03.04.00.17.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 00:17:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90187-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qLBmXvOF; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-90187-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90187-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0ABA51C21B48 for ; Mon, 4 Mar 2024 08:17:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 474FC1799D; Mon, 4 Mar 2024 08:17:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="qLBmXvOF" Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91BDA171CD for ; Mon, 4 Mar 2024 08:17:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709540253; cv=none; b=dBkmp3EHouaMy352u6omg2ASdbzIYh6fkqxI53u6GAFeunJxavI68MBLrJzAABBa7oHlSPLI0V+pb5uRcTBVkSYWyvhpZsrkLWYQ6BPDie+CKDb5eE4Yn0B7NPxcsVFPnnZ18W3gCb/4y8Or1EvuDJMm161/3ixM49hdv6pglVI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709540253; c=relaxed/simple; bh=AD9VdZnv6tpH2MGwDtAtMpimMoKxyHcy4Zu3b2xEwqo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=doMihgBYqis03O/u5FK/85FRh5xHjNl3G2dRIjr+3bW7goXzbXPOkutRMSWNB3nGrfESqJcC8kAxwnG3ez5z0HSW9Km+bARaFNmds+xUgHA23YzF3fQmfkrqX8qQagct6vzFy/49z6Mr/jshRJbx/Zar5XVNArE5qYGdnjnDypY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=qLBmXvOF; arc=none smtp.client-ip=209.85.222.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-qk1-f176.google.com with SMTP id af79cd13be357-7810827e54eso323647785a.2 for ; Mon, 04 Mar 2024 00:17:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709540248; x=1710145048; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=hmWR/dQ/IEMHbjZi2RajMkmXPdKPqp6IFe8boeN75aE=; b=qLBmXvOFtcsx+rnJDCob3E2rOLnBI9AHapK8Dtm+Rr0QUw0xTMdXs5+xl8zCLLe6Wk 4C0UQRqwzo/e+bpVnUe5IEBdARgbSoe1YKekPfBbgodS9Oxr/KXR9Ok8Fox2ccxVZeeo IekStR2qwSUACWCj/Vhafm2bPKC4KCUC3hAO2cPa9zVsiuo0wpp6SANzq1kgdw5JecWN n24mVnoGUqHpn4oMM7trC3Bm6l9GwFW3Wr3tR3NB8etQ57+oQdEpLLa1zseKHaoBPcsw FDOFm3k8CA9v0YmDrk9fDKQA46FOViUkCzPNLLSjX42QG9r5JT6adkpbocbPOG28rV7K LswA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709540248; x=1710145048; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hmWR/dQ/IEMHbjZi2RajMkmXPdKPqp6IFe8boeN75aE=; b=JHLkscD5duX1yvuNbBUFVwlO9LezOsjyAOoIwg26SUCqvHMaaG8l7wnqD4IRtPZzCP ENwGksp+AiHZhFTqgOegCtJbB7kqv2ecwx0xuKvizrswke6KA6k4VAiVpOtgULFbWR0F d24HV82XrwVaA+ot2Gvb5nyeI5ynItXcgXRPdXkc4adsMfeh6vQUvjGpgoCbvoWAbsvS +gEBiWFBrtB/qRdAcVqdYdvOv879eiWGx/sZk9ShMnqRfQkhvMm26LwAu0U7cXNRSrAQ 1R7XKU1fnWBUcftOZOJifXFZ1GFq7GnD3NUX9ddVMbPDKEnOsyZXSgWQHNQTX5FgG4ru u0ig== X-Forwarded-Encrypted: i=1; AJvYcCVDNFCoS1Ok2fiQF9vBa/8g0BR0p+dQz51NRViwckvo3y/mXrbUORe1rekXzz52GlWYMLX3o0Sb7fAvf7CxlKF0TpWoXuBCAZbLpDeM X-Gm-Message-State: AOJu0Yzs4Z8xNCjwFYfoehLPPzaSc8aGpZRY/mY79uo1dgr+CC8wCQ7g MK5UNOlBNLxWnl0IiVJ9wH0FQJazw7OHsdXFtf1etRb8OsPuFmHCGF/de8rVUg== X-Received: by 2002:a05:620a:110d:b0:788:22c4:c95f with SMTP id o13-20020a05620a110d00b0078822c4c95fmr3901107qkk.21.1709540248532; Mon, 04 Mar 2024 00:17:28 -0800 (PST) Received: from thinkpad ([117.202.187.165]) by smtp.gmail.com with ESMTPSA id t20-20020a05620a0b1400b007881ed0f87dsm1737718qkg.65.2024.03.04.00.17.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 00:17:28 -0800 (PST) Date: Mon, 4 Mar 2024 13:47:13 +0530 From: Manivannan Sadhasivam To: Niklas Cassel Cc: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Marek Vasut , Yoshihiro Shimoda , Thierry Reding , Jonathan Hunter , Kishon Vijay Abraham I , Vidya Sagar , Vignesh Raghavendra , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Minghuan Lian , Mingkai Hu , Roy Zang , Kunihiko Hayashi , Masami Hiramatsu , Kishon Vijay Abraham I , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v8 03/10] PCI: dwc: ep: Introduce dw_pcie_ep_cleanup() API for drivers supporting PERST# Message-ID: <20240304081713.GH2647@thinkpad> References: <20240224-pci-dbi-rework-v8-0-64c7fd0cfe64@linaro.org> <20240224-pci-dbi-rework-v8-3-64c7fd0cfe64@linaro.org> 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Thu, Feb 29, 2024 at 01:40:29PM +0100, Niklas Cassel wrote: > On Sat, Feb 24, 2024 at 12:24:09PM +0530, Manivannan Sadhasivam wrote: > > For DWC glue drivers supporting PERST# (currently Qcom and Tegra194), some > > of the DWC resources like eDMA should be cleaned up during the PERST# > > assert time. > > > > So let's introduce a dw_pcie_ep_cleanup() API that could be called by these > > drivers to cleanup the DWC specific resources. Currently, it just removes > > eDMA. > > > > Reported-by: Niklas Cassel > > Closes: https://lore.kernel.org/linux-pci/ZWYmX8Y%2F7Q9WMxES@x1-carbon > > Signed-off-by: Manivannan Sadhasivam > > --- > > drivers/pci/controller/dwc/pcie-designware-ep.c | 11 +++++++++-- > > drivers/pci/controller/dwc/pcie-designware.h | 5 +++++ > > drivers/pci/controller/dwc/pcie-qcom-ep.c | 1 + > > drivers/pci/controller/dwc/pcie-tegra194.c | 2 ++ > > 4 files changed, 17 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c > > index 2b11290aab4c..1205bfba8310 100644 > > --- a/drivers/pci/controller/dwc/pcie-designware-ep.c > > +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c > > @@ -564,12 +564,19 @@ int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no, > > return 0; > > } > > > > -void dw_pcie_ep_deinit(struct dw_pcie_ep *ep) > > +void dw_pcie_ep_cleanup(struct dw_pcie_ep *ep) > > { > > struct dw_pcie *pci = to_dw_pcie_from_ep(ep); > > - struct pci_epc *epc = ep->epc; > > > > dw_pcie_edma_remove(pci); > > Hello Mani, > > In this message: > https://lore.kernel.org/linux-pci/20240130062938.GB32821@thinkpad/ > > You mentioned that you were going to clean up the BARs. Yes, I did and it is still in my queue. > (Like I wrote in that thread, I really think that we should merge a fix for > the broken "do we have a saved value from find_first_zero_bit() in the array", > by using a "if (!saved_value[bar])", when find_first_zero_bit() returns zero.) > Hmm, yeah that logic is flawed. Let me take another look. > However, regardless of that, I do not see that this series (neither > dw_pcie_ep_cleanup(), nor dw_pcie_ep_linkdown()), calls any function which > will clean up the BARs. > > Since e.g. qcom-ep.c does a reset_control_assert() during perst > assert/deassert, which should clear sticky registers, I think that > you should let dw_pcie_ep_cleanup() clean up the BARs using > dw_pcie_ep_clear_bar(). > As I mentioned earlier, it is the job of the EPF drivers to clear the BARs since they allocate them. I'm trying to reduce the implicit resetting wherever we could. The proper fix is to add the LINK_DOWN callback to EPF drivers and do cleanup. I'm planning to submit a series for that after this one. - Mani -- மணிவண்ணன் சதாசிவம்