Message ID | 20240222221521.32159-2-helgaas@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-77457-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp245278dyb; Thu, 22 Feb 2024 14:16:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWkWKfsI/57aMDMOBSIZFOwRfDRvNCHBz0M21sej6SmEGOUyCBrvygs1LJDKE1MqCA+zQDuzm1P80Amtb24F6POKqYllQ== X-Google-Smtp-Source: AGHT+IHJ0dxxmmlzHEU3VkbRGcbAKxrJGn+nz7GhTq0LrsMtApeTuGLr1VfFMCkUCZdBPeg+vU9/ X-Received: by 2002:a05:6214:5f03:b0:68f:b5b0:6202 with SMTP id lx3-20020a0562145f0300b0068fb5b06202mr7825535qvb.15.1708640168237; Thu, 22 Feb 2024 14:16:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708640168; cv=pass; d=google.com; s=arc-20160816; b=ME6Qhlhyk5hiAO6kirKG6NXBOkerFOtUZr52sEAO7H8dWCYHE9VMxWNTBAP+1ZTIjm 3kCcEBIbLIkWMsIaxSRy75d3EGt52D2yc3UsOXndYZAO/29sxsymx382/6m1PRwIpjJD Ah35l4PeeFwOyqE5xzPx24b6zS0ITSR9vTIKQN7pBMg2QNFcKRfAPg20wJyq7pw9e3lE T0+CGRVNgCIwk+nrJSVCnnlI4VXPoC1JeqRiKWV4Uegz8n9dVzMdJbxdUxf2DSCU6yiM 2ZmtTt2GVqw+G7cmOwSe8oy3CYyYRVyDS9p5Z7qSFyoJvdVHJOrAo4B9guHGEIJUV9ER RkBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=LhsiVH8WqSjkpg/lUmLLueFWsptWJWI+5zk2RxO7400=; fh=VqNV/H+NvTfRorL5u0gvqiaeUJYxz4RZ1JFzqqWkBPk=; b=w82PJcoQM4Vy2/buQDV432hIRb6z5QNVcz3FQ9VXgQv1CAOzW0f/wi8ZgNuAFaQGzY k2UMfLxbVGfH/veDkMNMI53ivFZEp2sQzBl8I9I12Rq3mGdW4Co7FKU8+nzw0RPXTry8 qpFjYsrrLpxa0/EhViyRS8ViNuPdxZEFjfg9rVrzb8nDZqzQ65i26J4t4FXLFv04kHS/ dOK73yZSgpjyy8Jllz4ZvbYeDy2IMOWUiX6P+TVo5RDSqIlJEPL64lGfKWMndQGvyanW bfnQY8Yl0cRmSW27joh5gr63K9bmhyda31BnknZZNICeVtQizeu9W03h68pOsTfLOsQM xHUA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BO0vpnTK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-77457-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77457-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id m12-20020a0562141bcc00b0068f305eed02si13767525qvc.67.2024.02.22.14.16.08 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 14:16:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77457-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BO0vpnTK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-77457-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77457-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0D26D1C21D17 for <ouuuleilei@gmail.com>; Thu, 22 Feb 2024 22:16:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8068813BACE; Thu, 22 Feb 2024 22:15:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BO0vpnTK" 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 E6BEC137919; Thu, 22 Feb 2024 22:15:36 +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=1708640137; cv=none; b=T5w/R/Z0xd5fPfUrbj2ouwz/me18GYbO7QZevjCylOqrbzsFMEmZdi5EFuDx7AimlfsU/2CeNebDFRwoGk4HH3vU/IDs20U9iqhX5/O8F/S3EAqA8mevXUzTrkhcKPO300zi6flIE8FWucYRdkAd3AkL1kWnmxzv/mu1m7Xdfok= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708640137; c=relaxed/simple; bh=+MPNAv4j9xziDIGU7n8YhnwXjcPBGJ3afHmStckr/LM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jeHsm1bR0zfrZTkipX1aIhYAAVgpFHY5pVqGv0LXXnpUQVZnYxZzbTw28dBvb4FVu7ywGH1ThcFvQxf+czIc/mBtVVhVoCTht3bCI3g5vuHGV2nhlKnrJ7DiHdWbw61qay42in6wNxMHqfjtgBlbEZbpDAkcLF1y+tuZAkvyt8s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BO0vpnTK; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F2F7C433F1; Thu, 22 Feb 2024 22:15:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708640136; bh=+MPNAv4j9xziDIGU7n8YhnwXjcPBGJ3afHmStckr/LM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BO0vpnTKrzJhRRACJU7/OJ5jHMKV5z75nlY+Rah3m83VgXiuVB9mkpOwxSFkvnS8o PRSKfTHqDsRTtVNMEtwz+H21sqTRKJxb/D9k4yyomoZbpJhezoGQFy0BE6Z3u5ZYXS wfkhlijVmz/HWdizhD3TJ11pdllQFvUwQl51bQUsPpC41tc813FwFp0/DXO1/F3Mce db/MJ+Rf1NqC8Mz7wcywry7tr3JMy5Ymc1Xe0kKEcOb4K+z/yg8o0KEpM6FYf8ecN0 wVQqPB8//tlLyzj/9x86EKYSOZBx1/LHfgnpjsNx3kyFgPSmp4L0nN6njos+xnHLtz S6qL/NTMWlNuw== From: Bjorn Helgaas <helgaas@kernel.org> To: linux-pci@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>, Matthew W Carlis <mattc@purestorage.com>, Keith Busch <kbusch@kernel.org>, Lukas Wunner <lukas@wunner.de>, Mika Westerberg <mika.westerberg@linux.intel.com>, Jesse Brandeburg <jesse.brandeburg@intel.com>, Bjorn Helgaas <bhelgaas@google.com>, stable@vger.kernel.org Subject: [PATCH v2 1/3] PCI/DPC: Request DPC only if also requesting AER Date: Thu, 22 Feb 2024 16:15:19 -0600 Message-Id: <20240222221521.32159-2-helgaas@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222221521.32159-1-helgaas@kernel.org> References: <20240222221521.32159-1-helgaas@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791639073206311917 X-GMAIL-MSGID: 1791639073206311917 |
Series |
PCI/DPC: Clean up DPC vs AER/EDR ownership and Kconfig
|
|
Commit Message
Bjorn Helgaas
Feb. 22, 2024, 10:15 p.m. UTC
From: Bjorn Helgaas <bhelgaas@google.com> When booting with "pci=noaer", we don't request control of AER, but we previously *did* request control of DPC, as in the dmesg log attached at the bugzilla below: Command line: ... pci=noaer acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3] acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug SHPCHotplug PME PCIeCapability LTR DPC] That's illegal per PCI Firmware Spec, r3.3, sec 4.5.1, table 4-5, which says: If the operating system sets this bit [OSC_PCI_EXPRESS_DPC_CONTROL], it must also set bit 7 of the Support field (indicating support for Error Disconnect Recover notifications) and bits 3 and 4 of the Control field (requesting control of PCI Express Advanced Error Reporting and the PCI Express Capability Structure). Request DPC control only if we have also requested AER control. Fixes: ac1c8e35a326 ("PCI/DPC: Add Error Disconnect Recover (EDR) support") Link: https://bugzilla.kernel.org/show_bug.cgi?id=218491#c12 Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Cc: <stable@vger.kernel.org> # v5.7+ Cc: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Cc: Matthew W Carlis <mattc@purestorage.com> Cc: Keith Busch <kbusch@kernel.org> Cc: Lukas Wunner <lukas@wunner.de> Cc: Mika Westerberg <mika.westerberg@linux.intel.com> Cc: Jesse Brandeburg <jesse.brandeburg@intel.com> --- drivers/acpi/pci_root.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
Comments
On 2/22/24 2:15 PM, Bjorn Helgaas wrote: > From: Bjorn Helgaas <bhelgaas@google.com> > > When booting with "pci=noaer", we don't request control of AER, but we > previously *did* request control of DPC, as in the dmesg log attached at > the bugzilla below: > > Command line: ... pci=noaer > acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3] > acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug SHPCHotplug PME PCIeCapability LTR DPC] > > That's illegal per PCI Firmware Spec, r3.3, sec 4.5.1, table 4-5, which > says: > > If the operating system sets this bit [OSC_PCI_EXPRESS_DPC_CONTROL], it > must also set bit 7 of the Support field (indicating support for Error > Disconnect Recover notifications) and bits 3 and 4 of the Control field > (requesting control of PCI Express Advanced Error Reporting and the PCI > Express Capability Structure). IIUC, this dependency is discussed in sec 4.5.2.4. "Dependencies Between _OSC Control Bits". Because handling of Downstream Port Containment has a dependency on Advanced Error Reporting, the operating system is required to request control over Advanced Error Reporting (bit 3 of the Control field) while requesting control over Downstream Port Containment Configuration (bit 7 of the Control field). If the operating system attempts to claim control of Downstream Port Containment Configuration without also claiming control over Advanced Error Reporting, firmware is required to refuse control of the feature being illegally claimed and mask the corresponding bit. Firmware is required to maintain ownership of Advanced Error Reporting if it retains ownership of Downstream Port Containment Configuration. If the operating system sets bit 7 of the Control field, it must set bit 7 of the Support field, indicating support for the Error Disconnect Recover event. > > Request DPC control only if we have also requested AER control. > > Fixes: ac1c8e35a326 ("PCI/DPC: Add Error Disconnect Recover (EDR) support") > Link: https://bugzilla.kernel.org/show_bug.cgi?id=218491#c12 > Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> > Cc: <stable@vger.kernel.org> # v5.7+ > Cc: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> > Cc: Matthew W Carlis <mattc@purestorage.com> > Cc: Keith Busch <kbusch@kernel.org> > Cc: Lukas Wunner <lukas@wunner.de> > Cc: Mika Westerberg <mika.westerberg@linux.intel.com> > Cc: Jesse Brandeburg <jesse.brandeburg@intel.com> > --- Code wise it looks fine to me. Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> > drivers/acpi/pci_root.c | 20 +++++++++++--------- > 1 file changed, 11 insertions(+), 9 deletions(-) > > diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c > index 58b89b8d950e..efc292b6214e 100644 > --- a/drivers/acpi/pci_root.c > +++ b/drivers/acpi/pci_root.c > @@ -518,17 +518,19 @@ static u32 calculate_control(void) > if (IS_ENABLED(CONFIG_HOTPLUG_PCI_SHPC)) > control |= OSC_PCI_SHPC_NATIVE_HP_CONTROL; > > - if (pci_aer_available()) > + if (pci_aer_available()) { > control |= OSC_PCI_EXPRESS_AER_CONTROL; > > - /* > - * Per the Downstream Port Containment Related Enhancements ECN to > - * the PCI Firmware Spec, r3.2, sec 4.5.1, table 4-5, > - * OSC_PCI_EXPRESS_DPC_CONTROL indicates the OS supports both DPC > - * and EDR. > - */ > - if (IS_ENABLED(CONFIG_PCIE_DPC) && IS_ENABLED(CONFIG_PCIE_EDR)) > - control |= OSC_PCI_EXPRESS_DPC_CONTROL; > + /* > + * Per PCI Firmware Spec, r3.3, sec 4.5.1, table 4-5, the > + * OS can request DPC control only if it has advertised > + * OSC_PCI_EDR_SUPPORT and requested both > + * OSC_PCI_EXPRESS_CAPABILITY_CONTROL and > + * OSC_PCI_EXPRESS_AER_CONTROL. > + */ > + if (IS_ENABLED(CONFIG_PCIE_DPC)) > + control |= OSC_PCI_EXPRESS_DPC_CONTROL; > + } > > return control; > }
On Sun, Feb 25, 2024 at 11:46:07AM -0800, Kuppuswamy Sathyanarayanan wrote: > > On 2/22/24 2:15 PM, Bjorn Helgaas wrote: > > From: Bjorn Helgaas <bhelgaas@google.com> > > > > When booting with "pci=noaer", we don't request control of AER, but we > > previously *did* request control of DPC, as in the dmesg log attached at > > the bugzilla below: > > > > Command line: ... pci=noaer > > acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3] > > acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug SHPCHotplug PME PCIeCapability LTR DPC] > > > > That's illegal per PCI Firmware Spec, r3.3, sec 4.5.1, table 4-5, which > > says: > > > > If the operating system sets this bit [OSC_PCI_EXPRESS_DPC_CONTROL], it > > must also set bit 7 of the Support field (indicating support for Error > > Disconnect Recover notifications) and bits 3 and 4 of the Control field > > (requesting control of PCI Express Advanced Error Reporting and the PCI > > Express Capability Structure). > > IIUC, this dependency is discussed in sec 4.5.2.4. "Dependencies > Between _OSC Control Bits". > > Because handling of Downstream Port Containment has a dependency on > Advanced Error Reporting, the operating system is required to > request control over Advanced Error Reporting (bit 3 of the Control > field) while requesting control over Downstream Port Containment > Configuration (bit 7 of the Control field). If the operating system > attempts to claim control of Downstream Port Containment > Configuration without also claiming control over Advanced Error > Reporting, firmware is required to refuse control of the feature > being illegally claimed and mask the corresponding bit. Firmware is > required to maintain ownership of Advanced Error Reporting if it > retains ownership of Downstream Port Containment Configuration. If > the operating system sets bit 7 of the Control field, it must set > bit 7 of the Support field, indicating support for the Error > Disconnect Recover event. So I guess you're suggesting that there are two defects here? 1) Linux requested DPC control without requesting AER control. 2) Platform granted DPC control when it shouldn't have. I do agree with that, but obviously we can only fix 1) in Linux. > > Request DPC control only if we have also requested AER control. > > > > Fixes: ac1c8e35a326 ("PCI/DPC: Add Error Disconnect Recover (EDR) support") > > Link: https://bugzilla.kernel.org/show_bug.cgi?id=218491#c12 > > Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> > > Cc: <stable@vger.kernel.org> # v5.7+ > > Cc: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> > > Cc: Matthew W Carlis <mattc@purestorage.com> > > Cc: Keith Busch <kbusch@kernel.org> > > Cc: Lukas Wunner <lukas@wunner.de> > > Cc: Mika Westerberg <mika.westerberg@linux.intel.com> > > Cc: Jesse Brandeburg <jesse.brandeburg@intel.com> > > --- > Code wise it looks fine to me. > > Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> > > drivers/acpi/pci_root.c | 20 +++++++++++--------- > > 1 file changed, 11 insertions(+), 9 deletions(-) > > > > diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c > > index 58b89b8d950e..efc292b6214e 100644 > > --- a/drivers/acpi/pci_root.c > > +++ b/drivers/acpi/pci_root.c > > @@ -518,17 +518,19 @@ static u32 calculate_control(void) > > if (IS_ENABLED(CONFIG_HOTPLUG_PCI_SHPC)) > > control |= OSC_PCI_SHPC_NATIVE_HP_CONTROL; > > > > - if (pci_aer_available()) > > + if (pci_aer_available()) { > > control |= OSC_PCI_EXPRESS_AER_CONTROL; > > > > - /* > > - * Per the Downstream Port Containment Related Enhancements ECN to > > - * the PCI Firmware Spec, r3.2, sec 4.5.1, table 4-5, > > - * OSC_PCI_EXPRESS_DPC_CONTROL indicates the OS supports both DPC > > - * and EDR. > > - */ > > - if (IS_ENABLED(CONFIG_PCIE_DPC) && IS_ENABLED(CONFIG_PCIE_EDR)) > > - control |= OSC_PCI_EXPRESS_DPC_CONTROL; > > + /* > > + * Per PCI Firmware Spec, r3.3, sec 4.5.1, table 4-5, the > > + * OS can request DPC control only if it has advertised > > + * OSC_PCI_EDR_SUPPORT and requested both > > + * OSC_PCI_EXPRESS_CAPABILITY_CONTROL and > > + * OSC_PCI_EXPRESS_AER_CONTROL. > > + */ > > + if (IS_ENABLED(CONFIG_PCIE_DPC)) > > + control |= OSC_PCI_EXPRESS_DPC_CONTROL; > > + } > > > > return control; > > } > > -- > Sathyanarayanan Kuppuswamy > Linux Kernel Developer >
On 2/26/24 7:18 AM, Bjorn Helgaas wrote: > On Sun, Feb 25, 2024 at 11:46:07AM -0800, Kuppuswamy Sathyanarayanan wrote: >> On 2/22/24 2:15 PM, Bjorn Helgaas wrote: >>> From: Bjorn Helgaas <bhelgaas@google.com> >>> >>> When booting with "pci=noaer", we don't request control of AER, but we >>> previously *did* request control of DPC, as in the dmesg log attached at >>> the bugzilla below: >>> >>> Command line: ... pci=noaer >>> acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3] >>> acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug SHPCHotplug PME PCIeCapability LTR DPC] >>> >>> That's illegal per PCI Firmware Spec, r3.3, sec 4.5.1, table 4-5, which >>> says: >>> >>> If the operating system sets this bit [OSC_PCI_EXPRESS_DPC_CONTROL], it >>> must also set bit 7 of the Support field (indicating support for Error >>> Disconnect Recover notifications) and bits 3 and 4 of the Control field >>> (requesting control of PCI Express Advanced Error Reporting and the PCI >>> Express Capability Structure). >> IIUC, this dependency is discussed in sec 4.5.2.4. "Dependencies >> Between _OSC Control Bits". >> >> Because handling of Downstream Port Containment has a dependency on >> Advanced Error Reporting, the operating system is required to >> request control over Advanced Error Reporting (bit 3 of the Control >> field) while requesting control over Downstream Port Containment >> Configuration (bit 7 of the Control field). If the operating system >> attempts to claim control of Downstream Port Containment >> Configuration without also claiming control over Advanced Error >> Reporting, firmware is required to refuse control of the feature >> being illegally claimed and mask the corresponding bit. Firmware is >> required to maintain ownership of Advanced Error Reporting if it >> retains ownership of Downstream Port Containment Configuration. If >> the operating system sets bit 7 of the Control field, it must set >> bit 7 of the Support field, indicating support for the Error >> Disconnect Recover event. > So I guess you're suggesting that there are two defects here? > > 1) Linux requested DPC control without requesting AER control. > > 2) Platform granted DPC control when it shouldn't have. > > I do agree with that, but obviously we can only fix 1) in Linux. Sorry, maybe my comment was not clear. I was just suggesting to change the spec reference from r3.3, sec 4.5.1, table 4-5 to r3.3, sec 4.5.2.4 "Dependencies Between _OSC Control Bits". I agree that we cannot do much if firmware misbehaves here. >>> Request DPC control only if we have also requested AER control. >>> >>> Fixes: ac1c8e35a326 ("PCI/DPC: Add Error Disconnect Recover (EDR) support") >>> Link: https://bugzilla.kernel.org/show_bug.cgi?id=218491#c12 >>> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> >>> Cc: <stable@vger.kernel.org> # v5.7+ >>> Cc: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> >>> Cc: Matthew W Carlis <mattc@purestorage.com> >>> Cc: Keith Busch <kbusch@kernel.org> >>> Cc: Lukas Wunner <lukas@wunner.de> >>> Cc: Mika Westerberg <mika.westerberg@linux.intel.com> >>> Cc: Jesse Brandeburg <jesse.brandeburg@intel.com> >>> --- >> Code wise it looks fine to me. >> >> Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> >>> drivers/acpi/pci_root.c | 20 +++++++++++--------- >>> 1 file changed, 11 insertions(+), 9 deletions(-) >>> >>> diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c >>> index 58b89b8d950e..efc292b6214e 100644 >>> --- a/drivers/acpi/pci_root.c >>> +++ b/drivers/acpi/pci_root.c >>> @@ -518,17 +518,19 @@ static u32 calculate_control(void) >>> if (IS_ENABLED(CONFIG_HOTPLUG_PCI_SHPC)) >>> control |= OSC_PCI_SHPC_NATIVE_HP_CONTROL; >>> >>> - if (pci_aer_available()) >>> + if (pci_aer_available()) { >>> control |= OSC_PCI_EXPRESS_AER_CONTROL; >>> >>> - /* >>> - * Per the Downstream Port Containment Related Enhancements ECN to >>> - * the PCI Firmware Spec, r3.2, sec 4.5.1, table 4-5, >>> - * OSC_PCI_EXPRESS_DPC_CONTROL indicates the OS supports both DPC >>> - * and EDR. >>> - */ >>> - if (IS_ENABLED(CONFIG_PCIE_DPC) && IS_ENABLED(CONFIG_PCIE_EDR)) >>> - control |= OSC_PCI_EXPRESS_DPC_CONTROL; >>> + /* >>> + * Per PCI Firmware Spec, r3.3, sec 4.5.1, table 4-5, the >>> + * OS can request DPC control only if it has advertised >>> + * OSC_PCI_EDR_SUPPORT and requested both >>> + * OSC_PCI_EXPRESS_CAPABILITY_CONTROL and >>> + * OSC_PCI_EXPRESS_AER_CONTROL. >>> + */ >>> + if (IS_ENABLED(CONFIG_PCIE_DPC)) >>> + control |= OSC_PCI_EXPRESS_DPC_CONTROL; >>> + } >>> >>> return control; >>> } >> -- >> Sathyanarayanan Kuppuswamy >> Linux Kernel Developer >>
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 58b89b8d950e..efc292b6214e 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -518,17 +518,19 @@ static u32 calculate_control(void) if (IS_ENABLED(CONFIG_HOTPLUG_PCI_SHPC)) control |= OSC_PCI_SHPC_NATIVE_HP_CONTROL; - if (pci_aer_available()) + if (pci_aer_available()) { control |= OSC_PCI_EXPRESS_AER_CONTROL; - /* - * Per the Downstream Port Containment Related Enhancements ECN to - * the PCI Firmware Spec, r3.2, sec 4.5.1, table 4-5, - * OSC_PCI_EXPRESS_DPC_CONTROL indicates the OS supports both DPC - * and EDR. - */ - if (IS_ENABLED(CONFIG_PCIE_DPC) && IS_ENABLED(CONFIG_PCIE_EDR)) - control |= OSC_PCI_EXPRESS_DPC_CONTROL; + /* + * Per PCI Firmware Spec, r3.3, sec 4.5.1, table 4-5, the + * OS can request DPC control only if it has advertised + * OSC_PCI_EDR_SUPPORT and requested both + * OSC_PCI_EXPRESS_CAPABILITY_CONTROL and + * OSC_PCI_EXPRESS_AER_CONTROL. + */ + if (IS_ENABLED(CONFIG_PCIE_DPC)) + control |= OSC_PCI_EXPRESS_DPC_CONTROL; + } return control; }