Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp50428lqd; Tue, 23 Apr 2024 14:19:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUXtMJyp8YEK0TXbCKRXbUAgQ3j5dt5A10M0AfABMmNBbDYm3Nuat12WPckFGH0euI7AQVU0g8XyHcWaxYt7f9OXC9PXqAkKbp3vJDAgw== X-Google-Smtp-Source: AGHT+IEpLAKlAqok2UoOYC5U/4bMZA8i1yXsHCLNWqo9v9c2nU51P/6zfplxv8H8iPpIGtcJ0yOy X-Received: by 2002:a17:902:ec84:b0:1e0:9964:76f4 with SMTP id x4-20020a170902ec8400b001e0996476f4mr897093plg.14.1713907143755; Tue, 23 Apr 2024 14:19:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713907143; cv=pass; d=google.com; s=arc-20160816; b=Ew3Y3RrxAZ8wrp0niCxAy1ILIK2Kqfiv90BFAtTpnrcoE2i0W/3Seg0aoqyKSYTqDg 7Tvtff6xUC9dflF0PESn1wM8E+GaCJR7tUskkh/DnvcPthI7lwpAutg2SZmBGcCKcbLB daR5xyX6zByyqT66F5Vs8QTkcSiqOgdyEgV8XEcL0C8+x0FIgukbZYZQwj6FWKWhqiTJ sLEDzzUML/Uv3wFzvIYNOcH1jbS9banDo7a7S9m4k72JJXsbVpmtQqMCIFMwtVywwoH/ APqPQ3x7A3bd9uI1mUNNNEkGEMSvkEFSDvRM+zgx9VJf+67e+WNMS4BSmaZHFL84/E6S 4riQ== 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:message-id:subject:cc:to:from :date:dkim-signature; bh=PLvnlRl2ATHwEKT501VCLwYR8O/0m2HZ2hh2smjhpQ8=; fh=wLbxXZwcVhddDl8ei+ay4UEh5CUxYykHGJULUcQIgmI=; b=F3hSxqGvJCZiUlqrtkLr2r+V+OVTFz//bFxwayYSV52qGo3JU4w19OCetTdpv+uX1R qrQ+Q3WHEUSFiRmHhQ8Zw9FoXb/YOiCDKl0jFv71zw2VXm0MGy7r9KJSV1EapeT/eEcn 1nqZqerf6FMgYNqcrMaGoADsI+lzsZGhiXXxWtPB+UXtKTAPZ69B9gNzA439AGQJ1dHR XZSxVqUEZ8YqqNgNMC7yufD4cbHUR7SbLC9OIPg8cKReAjOgMt4lbQ5nJymOySuOmGAN Agg5+66SDYvpxtLSRnx/43saiaCLVUxoDonc1wlDy1q3A70zjLN5zUNdZs8Br3+xlSIe 6rng==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=W25NFkYB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-155907-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155907-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id iz13-20020a170902ef8d00b001e276acdafdsi10022057plb.330.2024.04.23.14.19.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 14:19:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-155907-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=W25NFkYB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-155907-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155907-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 46CDC28FE34 for ; Tue, 23 Apr 2024 21:10:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5CB22143886; Tue, 23 Apr 2024 21:09:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="W25NFkYB" 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 78C72142E85; Tue, 23 Apr 2024 21:09:56 +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=1713906596; cv=none; b=Z9hHoRLpr5Ak6KkSXvi3vMixaTLhUwjeR4kf4TKuOIo4psLOHQ8bT79ecGL4V4qoNZTYCKeX6DKLHVp3kl+qBqtq4VCToK3Uoqz+ZO9IO8DXBhPvt1+XckCDqUSz9KkmIKYRoFjkc26AFOhPQTGbmft0ur1/jS+TlZdapEUAsKQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713906596; c=relaxed/simple; bh=FIZLwnCJ46nQbu1Ba72yWKSGnIGxieYcIGj7+JomHgU=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=DgbSB1r2sFgXC/Mns9NujlX+yhhZ4pGmev/74HaPJf/oIZ+eyyIM2aqzgywg1TKcSukkUjTAlgCPrj6XyElNJdgyJFOjB4Y6aJ8w0sVh+kuwmNpiLlVIggU9cVYKD/vrE++L5SIwejmKqmtIGcqrC2gx8zotZfYofgm9MtG0DAE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=W25NFkYB; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFCCCC116B1; Tue, 23 Apr 2024 21:09:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713906596; bh=FIZLwnCJ46nQbu1Ba72yWKSGnIGxieYcIGj7+JomHgU=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=W25NFkYBxeqYwzD6bWFyCiPs+/hDKJ5tM9c7gw7IddM2ObyMGQliK7AubkPy1bRNk AacBYM457pzUWBi+TxeNgSqierSERtATQ09RfBVv/wU9KOh417QI02SAqndawIasGg VFT3e5VBEqtejXS6KzchJcnzyuhMOvziWcurziITzpPs3lBh/Cqyi1eiwuGi/ZnjAM xjXm5koQN0rjh+NCQ5tuH60x3b8w4Gly0YgMHGUdyP+pCn0VakdL4OYaevq5XdzcKv jjs6eXn+StBMxt1YsqIHBmq4oczpBFd38T++5OYs5QoZhmwhe76AxPNihTCumo8cIu Rqz+0rsXieylA== Date: Tue, 23 Apr 2024 16:09:54 -0500 From: Bjorn Helgaas To: Vidya Sagar Cc: bhelgaas@google.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, treding@nvidia.com, jonathanh@nvidia.com, kthota@nvidia.com, mmaddireddy@nvidia.com, sagar.tv@gmail.com Subject: Re: [PATCH V2] PCI: Clear errors logged in Secondary Status Register Message-ID: <20240423210954.GA467443@bhelgaas> 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: <20240116143258.483235-1-vidyas@nvidia.com> On Tue, Jan 16, 2024 at 08:02:58PM +0530, Vidya Sagar wrote: > The enumeration process leaves the 'Received Master Abort' bit set in > the Secondary Status Register of the downstream port in the following > scenarios. > > (1) The device connected to the downstream port has ARI capability > and that makes the kernel set the 'ARI Forwarding Enable' bit in > the Device Control 2 Register of the downstream port. This > effectively makes the downstream port forward the configuration > requests targeting the devices downstream of it, even though they > don't exist in reality. It causes the downstream devices return > completions with UR set in the status in turn causing 'Received > Master Abort' bit set. > > In contrast, if the downstream device doesn't have ARI capability, > the 'ARI Forwarding Enable' bit in the downstream port is not set > and any configuration requests targeting the downstream devices > that don't exist are terminated (section 6.13 of PCI Express Base > 6.0 spec) in the downstream port itself resulting in no change of > the 'Received Master Abort' bit. > > (2) A PCIe switch is connected to the downstream port and when the > enumeration flow tries to explore the presence of devices that > don't really exist downstream of the switch, the downstream > port receives the completions with UR set causing the 'Received > Master Abort' bit set. > > Clear 'Received Master Abort' bit to keep the bridge device in a clean > state post enumeration. > > Signed-off-by: Vidya Sagar Applied to pci/enumeration for v6.10, thanks! I shortened the commit log because I think this happens all the time, not just in the specific cases you mentioned above: PCI: Clear Secondary Status errors after enumeration We enumerate devices by attempting config reads to the Vendor ID of each possible device. On conventional PCI, if no device responds, the read terminates with a Master Abort (PCI r3.0, sec 6.1). On PCIe, the config read is terminated as an Unsupported Request (PCIe r6.0, sec 2.3.2, 7.5.1.3.7). In either case, if the read addressed a device below a bridge, it is logged by setting "Received Master Abort" in the bridge Secondary Status register. Clear any errors logged in the Secondary Status register after enumeration. > --- > V2: > * Changed commit message based on Bjorn's feedback > > drivers/pci/probe.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c > index 795534589b98..640d2871b061 100644 > --- a/drivers/pci/probe.c > +++ b/drivers/pci/probe.c > @@ -1470,6 +1470,9 @@ static int pci_scan_bridge_extend(struct pci_bus *bus, struct pci_dev *dev, > } > > out: > + /* Clear errors in the Secondary Status Register */ > + pci_write_config_word(dev, PCI_SEC_STATUS, 0xffff); > + > pci_write_config_word(dev, PCI_BRIDGE_CONTROL, bctl); > > pm_runtime_put(&dev->dev); > -- > 2.25.1 >