Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp140015rdb; Mon, 22 Jan 2024 15:01:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IGokIiVWxHeJW3d1rOklAn2rvW0petOpY8JylgbOjgpJ03Dke4tuc0hMjiuu40mpIYBpAI8 X-Received: by 2002:a17:90b:604:b0:290:199e:9735 with SMTP id gb4-20020a17090b060400b00290199e9735mr2657428pjb.58.1705964515547; Mon, 22 Jan 2024 15:01:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705964515; cv=pass; d=google.com; s=arc-20160816; b=GYL8cnLOkn+Mqv43hU2TCq/0xtROJOglKbKwTlJLJ2hQMTOI9On7LAktsLjstbLTBQ 10xGD88g3K0zDi855N6swamHx6yeZwWg7MWia09+ysLJfUelJlUpZFya0CxicIIg9ZEj dbpc5ZOVfgbmsPUtMKbyY7burQdMZSQfOndYzkjx4IUagCC1TFX7beA6oiFi6p/8muMk bRNwevNNJc2cfxFaGiGY5eIuY0PUq6uIFN2z9Tlnyr3+bEg9nk7qykBSKAN0Jfe+uJqg 8H5qx7/P1EdR+o5vyXrMXLDIyRJE5n2IKhbnw6VfPmONk1TOttSdrStJq3F+swog7eaM AQZQ== 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=nX6ZChlhQcm1CARNAydDS7uLIJnaeFiEgwE5IlK6ljg=; fh=wLbxXZwcVhddDl8ei+ay4UEh5CUxYykHGJULUcQIgmI=; b=IQcPxkByL3mbV4XVFdWhfYQYuESS6jRlIdORDAhuGwNRMRre1ybcfjXjLThtBAXVl6 eK8Fkye7/U9qGpn3s0iNVwVSGQwSKQ5zlN4a45P+JQe6kbg3EesPeX/VKnDB9NVdO72T yWttwHeW2DQUp0jTz4Ehj9oqJgJxzI6GG3TExr+Zq4RCa1C1DO5l87BHVpa7e2VnpcO+ Mh8bayrbffLmwVoc/x98e7MCvsb9EG8GPv52BShhIpxG6+jMW9TZAJwGqQRma+uWs0zY aQtKaRmVnjoez5gDhpBWjvpozfQ8S3NHk5a+LLoHXbXoJMIYYmzplFTDAio9dcXrDHxd Z2SA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gRB+oBBx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-34276-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34276-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 u20-20020a17090ae01400b0028ff56f1cd9si8690184pjy.51.2024.01.22.15.01.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 15:01:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34276-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=gRB+oBBx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-34276-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34276-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 42BD4289688 for ; Mon, 22 Jan 2024 23:01:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F2424107B3; Mon, 22 Jan 2024 23:00:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gRB+oBBx" 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 1E07136B0C; Mon, 22 Jan 2024 23:00:28 +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=1705964429; cv=none; b=RRD5So1mhtsvSlJJVQx2zU4Km7gFy/k8jOWP+MiUHR/qDqDyDC+Lv63YihR1Me5MjyweE5html1lGmM6K46Szt0HTTIPjn70rhRWszk6yoSTQ/WzKqen8tM9zApym/HHfxp3ANZyN4lvdToSRGPQx+a+Rdi3lH9fueehVKUFgZo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705964429; c=relaxed/simple; bh=zSGD4Ci6DJ0vZvzDYCjqP9tLlzmLMqoKbD5SnqjHrqs=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=Z0DI7MHcdFw5gQbXbhUL9E5S/utvSDsMJ8Vt2HjZ7X7OppypKq40t+O4hXw/t1ZPc7msaTGDtQBFq3T99+jczIVTBfiV7Yt3UOSjAtKH4+S6n88oVPvOK+2wUxdbVDOLgSifMpVkNmR0Mio0cgQycqwopwB0kvxbyjvy2ChQia4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gRB+oBBx; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57EF4C433B2; Mon, 22 Jan 2024 23:00:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705964428; bh=zSGD4Ci6DJ0vZvzDYCjqP9tLlzmLMqoKbD5SnqjHrqs=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=gRB+oBBxCsHW4pSCQmACISlVPmO4dMDjO4Cn9S3dF5ck4Z+5JA2wTVILKH8FgrVcx l7/QUAceIbSWIy+0kT0yfljPPAPyc060ppSh7gWfgYXJkneSPdba+05IFNidF4N/Di QDmhO7bj3z2SGCHZArOWD7zJqdhnPK7LQmIPwAqSUVWx5O0JAPIItxym31M/Rroga8 SVsRX3svYuUggxsRUjsoisORJ/9g3J1Vj59UplZr5C7cyDkI7/ArTW5cYv/ggu0pYS ZLuzY1TxFGRkmnibjxs9rDoo9P6+AkDkLkFrLf62HIv/jLWnBFDNk123yXf4SjTcBw RU5aYDugc+Bbw== Date: Mon, 22 Jan 2024 17:00:26 -0600 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: <20240122230026.GA290856@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. Are these the only possible ways this error is logged? I expected them to be logged when we enumerate below a Root Port that has nothing attached, for example. Does clearing them in pci_scan_bridge_extend() cover all ways this error might be logged during enumeration? I can't remember whether all enumeration goes through this path. > Clear 'Received Master Abort' bit to keep the bridge device in a clean > state post enumeration. > > Signed-off-by: Vidya Sagar > --- > 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 >