Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1381773rbb; Mon, 26 Feb 2024 07:36:14 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXWMXp6OT0Uk6UXr+cAVkuJn4Pd+kx5UxoNol6RbTZ0kR1E8KZ1mpxRcmZCJIYECyqZ4G8kXKOT6LcxPG1B0GstEfcdf3I5Oe1AQ89oWA== X-Google-Smtp-Source: AGHT+IF3/xNpiDLAXtdaIsttmin087J5D5I4picM2wv9CCmC9cxxuKutqInjncJtVAshjaTmspJU X-Received: by 2002:a17:902:f645:b0:1db:d66e:cd15 with SMTP id m5-20020a170902f64500b001dbd66ecd15mr9252671plg.59.1708961773892; Mon, 26 Feb 2024 07:36:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708961773; cv=pass; d=google.com; s=arc-20160816; b=X41PSFNCyrASSXJexGN0+VjyUfegeFYH3cSBqgNuVRwEn8AdnaD3DMJb4gZ2LMzt/W 7cbSfebV++O4oOwXkLKEV5PStK/Q3UaWbC8ACXtQKn34mVQEbhSiuJeEiwJLv0JIlrib 3RoBiDGI5l6bdBDt2IVTiJrDkVI7DUksCZEEPZ48OUqHMfS0OKOx9Imk2a7g4SuBmayY MxV0sHBi8fjPZ6pVstk9X+zijEv7HGGzvXwDd4nO4j3F7jsQjqC6jjeBvAUdpKRAtM01 LnHnKxjf04PZXEPpDUmYiuJmwd8LQn8tUVtfFrL4y8gHvxPIHB6X0T9PhKtMBecRCWjv l0+g== 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=/22PRKRbM5I/IBeFVh8CqWzsyyKxEugOKZPuHQ3OkPk=; fh=TSiuyWcLZCrLR6UPJ08cZs3sz/kVHCm4w6COOE/670E=; b=uNZBeTJK4tSKv6RqeEiNwBuLhqWD9sSA1LNAaTcCzh9NPVkS/w4XRIIASSsvR/fowc MtZo/2rcRK484tNcxMAAsciXXP5v+DAc9YdVEefP2gMqrZVIWruyyTBQeTeoV5RzHq9d G0LrZrAppuDZha5Z/9lfyeIFAdh8kx+LA3uPpH1suhgpPpxVelQ62mG4uGtSwTbE6VFI D0T1/ea7imbh3a0NoQmDUrcymdRwt8IpTEFMRpRtrzrXmrYemPWNycAzfUiHNM351BXo oZOtvyd51YtT928QQlq1Bg4sTdlOLsOM0tuuEoR1sTpYdB5bh37tfZ5vrLqiRYUfLSqe 98aA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fRY2JMo4; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-81780-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81780-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 t1-20020a170902e84100b001d958b8d593si3909542plg.399.2024.02.26.07.36.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 07:36:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81780-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=fRY2JMo4; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-81780-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81780-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 410212A2EB5 for ; Mon, 26 Feb 2024 15:22:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7635B12C551; Mon, 26 Feb 2024 15:18:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fRY2JMo4" 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 8704D12BF26; Mon, 26 Feb 2024 15:18:07 +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=1708960687; cv=none; b=u5RwZYaCTM1aL2zgMs2hKi4a93Jmdbj/w9Iydeu7o1ICXOn8YXH23GrdgFp4Hz9aa7TBEd4+5JmKhDIl90BpWS9hZAveT+IgN2128meovH44vgn3Q2FEMes73CBcMGtHCuzTmhj7WnJwPancMkenqiwd4pBTU7q+zOsepkvluFI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708960687; c=relaxed/simple; bh=5sVKV4wkvq1eGCuONcZKC2B80eRfgAbNH78OsTHsM+A=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=dU1Z+xFkkyxfbU13TToT0eVa2i8lRBKoUtvOYzXcPxPDwhfcMLa/E7/nul5mjfwYCxcEWZa6xZkeuzw6ZvzQycNhVFY3cFa7hzrfseidEmW1eYSidFJyNPSLsifPH6Sl08lIGW8FlMK6+ANBRRol6b7sD0401fL3uxmXEbovf8E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fRY2JMo4; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AE44C43390; Mon, 26 Feb 2024 15:18:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708960687; bh=5sVKV4wkvq1eGCuONcZKC2B80eRfgAbNH78OsTHsM+A=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=fRY2JMo4qfNiJsuDSmCv1Xqji49KsYLvcrbU9dBMWugRAEaKLPrt3G2fAivRpO/CL bZ6UTV0OudWVu5uYwSDRF1i+QaBlqZJXf1IniWw1XiFBZihcmFlfNhNW5A3rR/+zjo J665+ru3DIwxBVTYfx7U1aLTiXsdLasNYzaUZRio2Roswn784CGebrqm7y6N8sjb1B mx0CcuNcgKxoiTaeI/unc/PL3aCASf+zgX0QBY6COHXLXkZxnrkAbzxwZdR0g39jh8 KrBWvVUiBQ6S5wBP1h4gA+oI66B/6y5w/PCIUQNUSgRGe+J5lPcGklxG9U5mklktKt 4RIXy3QcXJeKA== Date: Mon, 26 Feb 2024 09:18:05 -0600 From: Bjorn Helgaas To: Kuppuswamy Sathyanarayanan Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Matthew W Carlis , Keith Busch , Lukas Wunner , Mika Westerberg , Jesse Brandeburg , Bjorn Helgaas , stable@vger.kernel.org Subject: Re: [PATCH v2 1/3] PCI/DPC: Request DPC only if also requesting AER Message-ID: <20240226151805.GA200026@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: 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 > > > > 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 > > Cc: # v5.7+ > > Cc: Kuppuswamy Sathyanarayanan > > Cc: Matthew W Carlis > > Cc: Keith Busch > > Cc: Lukas Wunner > > Cc: Mika Westerberg > > Cc: Jesse Brandeburg > > --- > Code wise it looks fine to me. > > Reviewed-by: Kuppuswamy Sathyanarayanan > > 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 >