Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3954345pxk; Tue, 29 Sep 2020 10:13:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPdHipaRyFrNb1wpkVloKeH49c8lnnai4cl+qKGzxAIIBX7ArbV5hIp7n5vxzAtWdbju3V X-Received: by 2002:a05:6402:292:: with SMTP id l18mr4555412edv.6.1601399611894; Tue, 29 Sep 2020 10:13:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601399611; cv=none; d=google.com; s=arc-20160816; b=LdzJBRHdUjCnRU+tgtlwi8TGTKaA3ljciBotiZH1Ys4ejv5t8ItC7pabckBdDDNapt feOFgPCMUapVW8KjOukTiNYmaeUfO7Q9KtRXOPMLm4FByvZGi7vR5OvQEBZgRvDWa9wz qLT5bR/9J1LkAg9Ay1kwoqaYXvTBlZicuSAw3QRM6Q7Z/OuD2yYksUHuGBe7lxT9PR0M k40LAlyGfSAjkC+9KuUsVtU4UJg4gfFJtnJ5vtYAy7bzG98Je8CIOxA+JUvyWzjMJeOM 6bQ8yeoo++WcuEb37quVxdXQHPfyN2WZnY8n7238rCIvtFkCuHqDxWPGKVc4XIsBd1dd 2RDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=WWgKkaKtD794IDBvEB5pO9RgWUvjRoMvePWHLh2fmOQ=; b=lgAeNM4+Vas0u6f7tyLBppmySQEe5UEvPWZF2dfAtE6VpUP2y7uYIgIVAh8Evvh00H JDBWiKBuRpK+iQpvYjojfkFNcmVhGOYK1F743eUBmZaeHPV5WOx3ZxLndWBRyLjvU3o7 Nxg95qHFV0NY6/HQHyqqQF6Ft0Qxhj5ASTz5Sa0GHXcUYVMQMWNm2k5+xoCYCJuTVzga Sx1VZ+EVUyZrM5d9SHvHPOW9C6Ff3JmhrhLO7y6y9A9Y999zUCItLu8r/PfrE2VHMwm+ 1DKwnmoSTtprEZs36s8a9CmSukOXiYe9pE+jzlIIFUrPTzt1WFuloeucO5XyS63eHF0H 43gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FNp0B+wM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c9si3418349edt.107.2020.09.29.10.13.08; Tue, 29 Sep 2020 10:13:31 -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; dkim=pass header.i=@kernel.org header.s=default header.b=FNp0B+wM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729506AbgI2RLV (ORCPT + 99 others); Tue, 29 Sep 2020 13:11:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:49208 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728205AbgI2RLV (ORCPT ); Tue, 29 Sep 2020 13:11:21 -0400 Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 07C13208B8; Tue, 29 Sep 2020 17:11:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601399480; bh=to32lW7loD1nn8GVffNKTEhG93PmsP85GRhOV6RUSBo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=FNp0B+wM7HIu0HujzPzM3i8EKZLVuSAO19nVvlNAcgvbFYjPoZgYBlSI6hlM5gt74 7PM0BH/CcPpMmruj2IEUFNuTnFeILXq8kbZLVqEIFd9+8Df9qNc9Gh3Oajl6e+15Fn zPzaDJ+Hvr1KbTzZaR/uPZEXvfJBcMHjG7kQTNJ4= Received: by mail-oi1-f180.google.com with SMTP id n2so6277223oij.1; Tue, 29 Sep 2020 10:11:19 -0700 (PDT) X-Gm-Message-State: AOAM532csvZAoT5Pq15cFDhITLqCb+3jwO9qP9PECidIgpuvnFlTzZy4 hG0P8XWkMCVCG5E6KJs++yjKi9tFbrGHq944Ew== X-Received: by 2002:a05:6808:10e:: with SMTP id b14mr3317499oie.152.1601399479143; Tue, 29 Sep 2020 10:11:19 -0700 (PDT) MIME-Version: 1.0 References: <20200916054130.8685-1-Zhiqiang.Hou@nxp.com> <20200928093911.GB12010@e121166-lin.cambridge.arm.com> In-Reply-To: From: Rob Herring Date: Tue, 29 Sep 2020 12:11:07 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops To: Gustavo Pimentel Cc: "Z.q. Hou" , Lorenzo Pieralisi , "linux-kernel@vger.kernel.org" , PCI , Bjorn Helgaas , Michael Walle , Ard Biesheuvel Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 29, 2020 at 10:24 AM Gustavo Pimentel wrote: > > On Tue, Sep 29, 2020 at 5:5:41, Z.q. Hou wrote: > > > Hi Lorenzo, > > > > Thanks a lot for your comments! > > > > > -----Original Message----- > > > From: Lorenzo Pieralisi > > > Sent: 2020=E5=B9=B49=E6=9C=8828=E6=97=A5 17:39 > > > 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 > > > > > > 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=E5=B9=B49=E6=9C=8818=E6=97=A5 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=E5=B9=B49=E6=9C=8817=E6=97=A5 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 configuratio= n > > > 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 P= CIe > > > > > > link after the PCIe enumeration and then rescan the PCIe bus, s= o I > > > > > > think it should not exit the probe of root port even if there i= s > > > > > > not link up > > > > > during enumeration. > > > > > > > > > > That's a good reason. I want to unify the behavior here as it var= ies > > > > > 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 t= o > > > > > > > say otherwise. Is it not possible to configure the response p= er 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, whic= h > > > > > > 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 SErro= r > > > > > > 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 n= eed > > > > > things page aligned anyways with an IOMMU and doing userspace acc= ess > > > > > 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 th= e > > > > > 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 0xfff= f > > > > when read non-existent function Vendor ID and won't forward error t= o > > > > AXI. 2. When no link partner (link down), it will forward the erro= r > > > > 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 f= rom > > > > design team. I'm thinking to disable this error forwarding just li= ke > > > > other platforms, since when these errors (UR, CA and CT) are detect= ed, > > > > 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 t= his correct ? > > > > The issue becomes complex: > > I reviewed the DWC PCIe databook of verion 4.40a which is used on Layer= scape platforms, and it said that " Your RC application should not generate= CFG requests until it has confirmed that the link is up by sampling the sm= lh_link_up and rmlh_link_up outputs". > > So, the link up checking should not be remove before each outbound CFG = access. > > Gustavo, can you share more details on the link up checking? Does it on= ly exist in the 4.40a? > > Hi Zhiqiang, > > According to the information that I got from the IP team you are correct, > the same requirement still exists on the newer IP versions. How is that possible in a race free way? Testing on meson and layerscape (with the forwarding of errors disabled) shows a link check is not needed. But then dra7xx seems to need one (or has some f/w setup). Rob