Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2883272pxk; Mon, 28 Sep 2020 02:40:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvTGG87q23aZqjxGMVGrzciZU68J2LQGYZ8v55mNJs0lvvS9iaj757a+kHLRDTTUbx3tnK X-Received: by 2002:aa7:d043:: with SMTP id n3mr658647edo.243.1601286032922; Mon, 28 Sep 2020 02:40:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601286032; cv=none; d=google.com; s=arc-20160816; b=eZGdOJ6Cyya9SFQ2D2Tqjbb54e7Hv4U7IV0J81YIOrOTjEqrvXykN8SW2+Ef321ist zXSgUh3hTA+pxAFBe+l0P66RPqjjp6CmQL7YRiyzpluY4tXwLQvviAhsBrbfoRC37P0r dlwIynGYYD7Rxf0uNzBsJjIkF59asyh6yxCPTjXVih1KCSCUvZDFX3puHivypFFFOzwK fCiZR8IoKwyVDbWekcn8QgDUxnFJV2AhOF5Sh0Ov+jxrP2N5GF31QHqQ+cwrA4kJ1WJE rN8t7N9d28uU53fx4msGUEZBqpO2+tjEcjgnIFbu011wzMQEiYvDbyEpqVcFpdU8VaL4 JSWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=hFmDQGPjHq5k4riGnALKMYr3jyw3Vo5tcJDSfGTNQEE=; b=a0vWeHHVW8ZRfGxarV0uONURI339FUk5D8r7tmY0Q1Ilng63Mp8HaqH3wKG1wkecTF EvdlE0hksTOg31453m6XY9Lqrh2YJ1jgGM9tk17aX3jNh82POHq6h5de+MPsDRcLYNDq xucQGm8h7WEpNC0Wh5WQW14nhM0VeVPrge6YBN6IoThSRgxtMatd/8CD33/4B4siTH2i v6rL4bKEvgDayhp0/ZeJL4z61WesKvNL9IFqzpIqoet3T5nEPMbrP3Gaj4XS3g3MQmcZ 9AcMgtUUkljRJEPR8b7ieCH08RJXYKBnhweY3ingSM8du1F1gu1MbPUfKgmEwL0QTJLO 43mA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q5si251379eji.118.2020.09.28.02.40.10; Mon, 28 Sep 2020 02:40:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726552AbgI1JjQ (ORCPT + 99 others); Mon, 28 Sep 2020 05:39:16 -0400 Received: from foss.arm.com ([217.140.110.172]:48302 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726504AbgI1JjP (ORCPT ); Mon, 28 Sep 2020 05:39:15 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E1AE01063; Mon, 28 Sep 2020 02:39:14 -0700 (PDT) Received: from e121166-lin.cambridge.arm.com (e121166-lin.cambridge.arm.com [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C703F3F73B; Mon, 28 Sep 2020 02:39:13 -0700 (PDT) Date: Mon, 28 Sep 2020 10:39:11 +0100 From: Lorenzo Pieralisi To: "Z.q. Hou" Cc: Rob Herring , "linux-kernel@vger.kernel.org" , PCI , Bjorn Helgaas , Gustavo Pimentel , Michael Walle , Ard Biesheuvel Subject: Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops Message-ID: <20200928093911.GB12010@e121166-lin.cambridge.arm.com> References: <20200916054130.8685-1-Zhiqiang.Hou@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 24, 2020 at 04:24:47AM +0000, Z.q. Hou wrote: > Hi Rob, > > Thanks a lot for your comments! > > > -----Original Message----- > > From: Rob Herring > > Sent: 2020年9月18日 23:28 > > To: Z.q. Hou > > Cc: linux-kernel@vger.kernel.org; PCI ; Lorenzo > > Pieralisi ; Bjorn Helgaas > > ; Gustavo Pimentel > > ; Michael Walle ; > > Ard Biesheuvel > > Subject: Re: [PATCH] PCI: dwc: Added link up check in map_bus of > > dw_child_pcie_ops > > > > On Fri, Sep 18, 2020 at 5:02 AM Z.q. Hou wrote: > > > > > > Hi Rob, > > > > > > Thanks a lot for your comments! > > > > > > > -----Original Message----- > > > > From: Rob Herring > > > > Sent: 2020年9月17日 4:29 > > > > To: Z.q. Hou > > > > Cc: linux-kernel@vger.kernel.org; PCI ; > > > > Lorenzo Pieralisi ; Bjorn Helgaas > > > > ; Gustavo Pimentel > > > > ; Michael Walle > > ; > > > > Ard Biesheuvel > > > > Subject: Re: [PATCH] PCI: dwc: Added link up check in map_bus of > > > > dw_child_pcie_ops > > > > > > > > On Tue, Sep 15, 2020 at 11:49 PM Zhiqiang Hou > > > > > > wrote: > > > > > > > > > > From: Hou Zhiqiang > > > > > > > > > > On NXP Layerscape platforms, it results in SError in the > > > > > enumeration of the PCIe controller, which is not connecting with > > > > > an Endpoint device. And it doesn't make sense to enumerate the > > > > > Endpoints when the PCIe link is down. So this patch added the link > > > > > up check to avoid to fire configuration transactions on link down bus. > > > > > > > > Michael reported the same issue as well. > > > > > > > > What happens if the link goes down between the check and the access? > > > > > > This patch cannot cover this case, and will get the SError. > > > But I think it makes sense to avoid firing transactions on link down bus. > > > > That's impossible to do without a race even in h/w. > > Agree. > > > > > > > It's a racy check. I'd like to find an alternative solution. It's > > > > even worse if Layerscape is used in ECAM mode. I looked at the EDK2 > > > > setup for layerscape[1] and it looks like root ports are just skipped if link > > is down. > > > > Maybe a link down just never happens once up, but if so, then we > > > > only need to check it once and fail probe. > > > > > > Many customers connect the FPGA Endpoint, which may establish PCIe > > > link after the PCIe enumeration and then rescan the PCIe bus, so I > > > think it should not exit the probe of root port even if there is not link up > > during enumeration. > > > > That's a good reason. I want to unify the behavior here as it varies per > > platform currently and wasn't sure which way to go. > > > > > > > > I've dug into this a bit more and am curious about the PCIE_ABSERR > > > > register setting which is set to: > > > > > > > > #define PCIE_ABSERR_SETTING 0x9401 /* Forward error of non-posted > > > > request */ > > > > > > > > It seems to me this is not what we want at least for config > > > > accesses, but commit 84d897d6993 where this was added seems to say > > > > otherwise. Is it not possible to configure the response per access type? > > > > > > Thanks a lot for your investigation! > > > The story is like this: Some customers worry about these silent error > > > (DWC PCIe IP won't forward the error of outbound non-post request by > > > default), so we were pushed to enable the error forwarding to AXI in > > > the commit > > > 84d897d6993 as you saw. But it cannot differentiate the config > > > transactions from the MEM_rd, except the Vendor ID access, which is > > > controlled by a separate bit and it was set to not forward error of access > > of Vendor ID. > > > So we think it's okay to enable the error forwarding, the SError > > > should not occur, because after the enumeration it won't access the > > non-existent functions. > > > > We've rejected upstream support for platforms aborting on config > > accesses[1]. I think there's clear consensus that aborting is the wrong > > behavior. > > > > Do MEM_wr errors get forwarded? Seems like that would be enough. Also, > > wouldn't page faults catch most OOB accesses anyways? You need things > > page aligned anyways with an IOMMU and doing userspace access or guest > > assignment. > > Yes, errors of MEM_wr can be forwarded. > > > > > Here's another idea, how about only enabling forwarding errors if the link is > > up? If really would need to be configured any time the link state changes > > rather than just at probe. I'm not sure if you have a way to disable it on link > > down though. > > Dug deeper into this issue and found the setting of not forwarding > error of non-existent Vender ID access counts on the link partner: 1. > When there is a link partner (namely link up), it will return 0xffff > when read non-existent function Vendor ID and won't forward error to > AXI. 2. When no link partner (link down), it will forward the error > of reading non-existent function Vendor ID to AXI and result in > SError. > > I think this is a DWC PCIe IP specific issue but not get feedback from > design team. I'm thinking to disable this error forwarding just like > other platforms, since when these errors (UR, CA and CT) are detected, > AER driver can also report the error and try to recover. I take this as you shall send a patch to fix this issue shortly, is this correct ? Thanks, Lorenzo