Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp910317lqt; Fri, 7 Jun 2024 02:22:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX1jNE4kJevVlK74+sFV2wqt2/PQnVvFBfZYNRgZy1MUJPcNI0u0Ka5PXlqjgvxvDwtNYIKJ0Ic+s8MaQSAnEduFeCMBhcZ6HHTTIh2yw== X-Google-Smtp-Source: AGHT+IEtoEsRFJJRlqC7Sl4018rcfS8iFrtv5RCJddFNrxK6gl8I3L7pt1+ZgrhlpRtCxVzoYzpG X-Received: by 2002:a05:620a:29cb:b0:794:afb0:6bcb with SMTP id af79cd13be357-7953c4602b3mr231513785a.42.1717752127142; Fri, 07 Jun 2024 02:22:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717752127; cv=pass; d=google.com; s=arc-20160816; b=PxD/TVl+Rhzf2AZqDKJvT7ZPMcvXq+P6DNoGJBo+9NwG4wCTkIq6nVgyqITSi5du80 mhuDf+xmnLhNRunypkGzK/aFrNB6GZgjHf30QfpYDm1fNPcChx+otXc7hwN1ozqtKZA8 3cKTp86NUgN96tSJF8ug8m6zGhHef4lqXI6Jvy2APAjxoA+pND31EwtHA6Pr0nuZDaMy wMSRVNfqt9E8mjDZYpTsuBLCRruNv1mCaJE8e8Qjit1xW+dcoyURV4CX7wSdqqmDApAL FWQHutcQHxGRaMlatobxgKRYoBfsaMrkJPL7+6mvP9fZCPNNF4RyviWI9I0TdcGP892E 7izw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=GDH5enR9cfYYvcxS4qvxogH/3Mw+HJpw2+4UuSkoKos=; fh=2PYGzCB71ImiHgFMBJIcQ3BPzjGHbP70iPnzJetQSaA=; b=BKZaeY9ypLgxqIQjR3RaVCwiLTLTUjundTrnS2j+3LB4lT6PwdOptgc9A8ffCbWr0D Xw8n7rYAr48NBlZPZ88qNcmk35cs2SE+iHDPruH+JdcP1YNTXLhLaqSm9LPVQ59LSu22 U7qBqG4pfvyGtB9z6l5gN6p+Kxyul7iQlckPnPZVe2qumCbTGaZAoKEOLlDboyUw8/2I DCmeB8Izgbiy9bBG/4q59V6Gee6zha+FawKSctQ1NKZi9iUniLZDPc4jHZ72IWYDcC1n y7acva+XiOPD4Zgmw/dYEY/UAg/ETmxjgBxiYZdOqW2NsE5lz+SBP1L6zMuZ/CHLbpB8 RKkg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Vq/ngASC"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-205709-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205709-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-7953337f4f2si121500285a.678.2024.06.07.02.22.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 02:22:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205709-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Vq/ngASC"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-205709-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205709-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 D59361C22961 for ; Fri, 7 Jun 2024 09:22:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BC4EF15B987; Fri, 7 Jun 2024 09:21:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Vq/ngASC" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C81762209D; Fri, 7 Jun 2024 09:21:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717752116; cv=none; b=jJGPig/3PsP1rc6GX0tDxuyWelKrMmJctH34hCMivSVlAbcmce8volXMg8r7Ok1+liHAutZfkHq7j1skwywNAmvaCFkZpM7dgZ5gF/QBWx1beAMrkGFSXhv+YoWlrdUdl6VIz5zOkeTye0MYaPJt2MvqlU6rhwGu3WjN+D+LbAc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717752116; c=relaxed/simple; bh=mkI9Zleemp+5fJfBU0GcUZWrMN2oLrp/WKztAvoJ3vY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FUF/f1Vjerl5QHQjYb6cUDNFvq8mlrmgJYnbUbhwAJKgc6HLsnZIzLUM2/jJStYX5Ze96pJ/vb2C3XDpKSwFJjZWhGjghwWhw3ZuATdbrlhEVJQAVMEUxsMzLUYOc/+Wpsn3B6zzNHRTalvxxf/Joxh4jFCZhjlzXV3VwQjNItw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Vq/ngASC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA625C2BBFC; Fri, 7 Jun 2024 09:21:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717752115; bh=mkI9Zleemp+5fJfBU0GcUZWrMN2oLrp/WKztAvoJ3vY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Vq/ngASCb2PCKhRAbva5iVV9N8kqnIlkHsohtzvANVFjV1DDyAL0TN2UQAPoldLNW v3sAUcxfKxJTN15EKoiI4H9hbsB5XBUN8xvf8LvEyHWVv0YLhDtQnttgClP7zcf9bB 9+cimC+7UIPVxS6hSHqNafOxRvskvteDvcNu5W9bFgN+IJuB+xYSA3VRh8HeJ3ciF5 245pY+YWiCo1jQGVdSXp/8it4oYatSXX2GsENiVxQ63kTkCousJoMMY88chQs2Nvz9 Qkviu3aYYBDgpM2AWvu7CUwyLcQCTh/XN/iBZspUoxv3tH5+pIE3JeS5oP2rY6oq/l GEEiy0iiT1ZFA== Date: Fri, 7 Jun 2024 11:21:44 +0200 From: Niklas Cassel To: Manivannan Sadhasivam Cc: Vignesh Raghavendra , Siddharth Vadapalli , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Minghuan Lian , Mingkai Hu , Roy Zang , Jesper Nilsson , Jingoo Han , Srikanth Thokala , Marek Vasut , Yoshihiro Shimoda , Thierry Reding , Jonathan Hunter , Kunihiko Hayashi , Masami Hiramatsu , Kishon Vijay Abraham I , linux-omap@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@axis.com, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-tegra@vger.kernel.org, mhi@lists.linux.dev Subject: Re: [PATCH 3/5] PCI: dwc: ep: Add a generic dw_pcie_ep_linkdown() API to handle Link Down event Message-ID: References: <20240606-pci-deinit-v1-0-4395534520dc@linaro.org> <20240606-pci-deinit-v1-3-4395534520dc@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=us-ascii Content-Disposition: inline In-Reply-To: <20240606-pci-deinit-v1-3-4395534520dc@linaro.org> On Thu, Jun 06, 2024 at 12:56:36PM +0530, Manivannan Sadhasivam wrote: > As per the PCIe base spec r5.0, section 5.2, Link Down event can happen > under any of the following circumstances: > > 1. Fundamental/Hot reset > 2. Link disable transmission by upstream component > 3. Moving from L2/L3 to L0 > > In those cases, Link Down causes some non-sticky DWC registers to loose the > state (like REBAR, etc...). So the drivers need to reinitialize them to > function properly once the link comes back again. > > This is not a problem for drivers supporting PERST# IRQ, since they can > reinitialize the registers in the PERST# IRQ callback. But for the drivers > not supporting PERST#, there is no way they can reinitialize the registers > other than relying on Link Down IRQ received when the link goes down. So > let's add a DWC generic API dw_pcie_ep_linkdown() that reinitializes the > non-sticky registers and also notifies the EPF drivers about link going > down. > > This API can also be used by the drivers supporting PERST# to handle the > scenario (2) mentioned above. > > NOTE: For the sake of code organization, move the dw_pcie_ep_linkup() > definition just above dw_pcie_ep_linkdown(). > > Reviewed-by: Niklas Cassel > Signed-off-by: Manivannan Sadhasivam > --- Like Siddharth reported, this patch is already in pci/next.