Received: by 2002:a05:7208:70d5:b0:7f:5597:fa5c with SMTP id q21csp1280179rba; Fri, 22 Mar 2024 09:11:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVsXh98bIjZ1Rhq+13NMNtE2/W9ruRy0NQWkcgo0Iuo7of1GobzFORuvIbWNojAyBDxuNXvs7SzPw2VHaLe8G8F8+69DG6cCljo5jMHmA== X-Google-Smtp-Source: AGHT+IFwhAYpEKyHHjr5AX3zlXPUZp872e1teE2YSm2Kpo6/pdKSpSylVL5fTXuKSDQp2JHrpA8X X-Received: by 2002:a2e:9e56:0:b0:2d6:90e4:1ced with SMTP id g22-20020a2e9e56000000b002d690e41cedmr2208832ljk.22.1711123889451; Fri, 22 Mar 2024 09:11:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711123889; cv=pass; d=google.com; s=arc-20160816; b=LokuRt2nFMBUkA7jhyRyS8wkDTCt2UkzsXJnsQnXhCmGdi56+nQG+SNqDJt7xFr9PW 7e3XVymkU96nRIip9y7i/v8qGmaylxUYh0iFFG+0wPyu/33wbzVPATpc7c7gWP246KV9 6mKiJZM638mv2t3paHuucF9DbyIE5+MDUjFF+jHv9Ivf+u6queP32ktnU7VNknQLLQUW Yn5JNOnzftk+WXZAKpxzpXLtCA3XKszwB/ptCbnoyQy8edSxizD/E2T/3V0rP1HPNKF8 QnlcbD687L+6xen4bc3wiSH3fEwS0xx0veuP4EEU3tf//x7o/W6NMlXckoV1pzQXPfCZ ZwTw== 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=y12UYZxRP8ZA1YAR+vSeUY/ds0Q9tyFDjQA82CS/6kM=; fh=0tIhEViLo7PUpyJI/8YvAfn7aU9qwVOIrJ6jkc06K5o=; b=eCmq0PiBTnVwE2LxxyKJHzi5zWCUXcD9jvAlz818+2DE7ARzZ4e4p7qhxw4slRmTcY mwDvbC6Desz+j7ulBbkkKOu6IzFOsSNPTAfANQ/G/uzKgzaJZGHyb5SpGUSgRhPMxKTV NEp3DIPjC+OC63fcqMm+mWfWedXZpVxBRMcU2bMdYJ+0ZAiwlCm20gYj9s2SwxPG+AUN V3Li8qdBrW5LH4KBuGnnJ7Fx0U+jfAvJgSMG4ZWXy6+DP6jRt506f+0c4p4N/W1TnSbV d6VoPmoUeoZ49FXiSQ7S5I6lsZf0ZVdtxL205ZIJHnLVsW9qzkTHWMk0L37O9LN6QG2/ RPFg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=srrNW3NJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-111759-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111759-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id d11-20020a50ea8b000000b00567e266a464si1017168edo.605.2024.03.22.09.11.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 09:11:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111759-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=srrNW3NJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-111759-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111759-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 3536F1F22995 for ; Fri, 22 Mar 2024 16:11:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E40235A11D; Fri, 22 Mar 2024 16:10:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="srrNW3NJ" 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 097A25820C; Fri, 22 Mar 2024 16:10:38 +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=1711123838; cv=none; b=dWBNRNGFXuIDkASoSFX/XVTVAcnqfkLJ84X27LbbF2q48fFJ3KCd9q8Dh0yyi0eY0BvbrrapdYCucXoa6LzIIvghbFTosGOgfp3RhJ14q6D9B/ZLUpGGATUkhA33sTqzbcrcddiE4z94k8+bX5r5zjJxxxJNcmv2Gr+4n/GbRlI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711123838; c=relaxed/simple; bh=JoSFEolLXCBXv+vKZOe9Vw6+myyFGlxuio2JgUbS600=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=e29wUfHqTSqg+na5FRUjmejx/IK4lNntL1HPrytGiK3n0/OmVxIjBDOYrcouj4RNFpO2+lupFv2pUEHsWLJpznn1EAsqT154k8RyVnQhN3dfm5G7S0Q0zU5zYPGM8DbdoAFm4t35V6luLANUDE+9kzD8aB73gtohhSqnbCoQVNk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=srrNW3NJ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0E2FC433F1; Fri, 22 Mar 2024 16:10:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711123837; bh=JoSFEolLXCBXv+vKZOe9Vw6+myyFGlxuio2JgUbS600=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=srrNW3NJI//G7KulUkxk0eLjgKOaFMqQadxF9OcYUI49g93tqIwy92qZX9ZuUyZcP an8LdGNd6X+G/VkxpfuUSpPPFmxI587PJi9WTRZj/IR+79DJWefS3dia6SXKmR4zIg Peh9OkcOj4gDJ2MbWgUhMl/3T/3fvsrz2h9Y2O7OHTLa0yHIL3GfeeZnB+2EsXTY4A O+hg1qIKNnkeZekhJR477jqjHNFwdn1rRvCQnCPMpQNIPFi6WP9b66RmbHW+TghiD0 qsJLB3RjlG3DyU/N+7peK4xPuU1Yyqd8IRLlfvcStUgy/9YyiJb30RkUU+3E75Pvcv DRssZEse9TVNw== Date: Fri, 22 Mar 2024 17:10:31 +0100 From: Niklas Cassel To: Manivannan Sadhasivam Cc: Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Kishon Vijay Abraham I , Thierry Reding , Jonathan Hunter , Jingoo Han , Gustavo Pimentel , linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, mhi@lists.linux.dev, linux-tegra@vger.kernel.org Subject: Re: [PATCH 07/11] PCI: dwc: ep: Add a generic dw_pcie_ep_linkdown() API to handle Link Down event Message-ID: References: <20240314-pci-epf-rework-v1-0-6134e6c1d491@linaro.org> <20240314-pci-epf-rework-v1-7-6134e6c1d491@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: <20240314-pci-epf-rework-v1-7-6134e6c1d491@linaro.org> On Thu, Mar 14, 2024 at 08:53:46PM +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(). > > Signed-off-by: Manivannan Sadhasivam > --- Reviewed-by: Niklas Cassel