Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1387673rbb; Mon, 26 Feb 2024 07:47:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWde+y5Ymw984q5nJHhzHU2KIE2F8VLAbX+XIzATtLQGMgiwAXJtsmnlgO/ZbpE0Vh5jXlsAFfMor+7HTio8FNsxw9/EmF89C74I1VN8w== X-Google-Smtp-Source: AGHT+IGmCsk6VOQ1nNh+dYjeGUKCnbytACrEGV2WEvOmdFFxcUKcdGAnDZxlGTQ3ZJ2LSvmaFiBh X-Received: by 2002:a17:906:695:b0:a43:3634:ba02 with SMTP id u21-20020a170906069500b00a433634ba02mr2470613ejb.33.1708962437037; Mon, 26 Feb 2024 07:47:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708962437; cv=pass; d=google.com; s=arc-20160816; b=r4FB8wjZK91MknERm+P2/xvdUw1rrQ+rrfFwmg+U3umXuP72XS+TtJUu1zOQI1itxP GGa1XI3fYxhSBw5NUQ1aScqGLGWmCoSprONIzWwWS7PDVJqPW/AcKY2RX4IYKPAg/V6F CWwFSCdAL8WzoHIXkRxeWnuGuTObDGkhMN3ZmtAwDieho632V+OoSOjtBwSag+ayT8YZ N8p4UHjheADKr5Pxi26e1JhjqLEcf5RKaUV/tLblAGVIUdqLM0o8V/S/nOzDa3Z5IZTg R8TCvydu185NgVKsnpS6Gkh6F9ePBD2IriHCAPK2l0VDi/3c5VzIVr1NMiHlbrqpWDqu wvWg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=vNqzpfqm9AfxIi5Q1BhkB4uImWB0doJd4IDnB+uzxv4=; fh=ZTyXSrrx9BvFzOiG3HuY1kgtY1POmpdNXWC/BabaYAE=; b=0S6CFkpVYpPUmSnpB1YgcS3izjsFbsKs1Cey3+oF/DHxJ1eoc4NO8UP3iEPGOkRTIp waSzy/HUu6W6XQu9Ed9d5TIYVarml8/jCCj8Z+aB5Lxho/wAZC/j5th4GQA30jxUdKhY 6KJ9Q2Q6/DhY3BrxjiQ3HPuPc57W7vo+pxb3WO42VfDdDz4c74e343me8cGZVOZKtEBp zV0OM7Cmn40hrOigOqH+S/JBYEx5dfP6qnBma4rChmE8oKCseUh7GX+fPKcixo+KTvq6 Xb/u3/bj99dnWV4MzpJIeoxuWBmDeZS5foivut2hNKYwEkx9x0lYn24NZmUMDvwKj2t+ RwVw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Rt1Spkys; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-81837-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81837-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id gq13-20020a170906e24d00b00a3e95d8559csi2216604ejb.392.2024.02.26.07.47.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 07:47:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81837-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Rt1Spkys; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-81837-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81837-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 0138A1F25F30 for ; Mon, 26 Feb 2024 15:46:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 68B9B12C557; Mon, 26 Feb 2024 15:46:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Rt1Spkys" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (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 844431BDDC; Mon, 26 Feb 2024 15:46:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708962369; cv=none; b=JYqr8yW+unY3TWueUJwKR4fNg+qeCfVBcTwiFif8g+Qz+EcgA2zBfcv2WTYtUTkvo6BDpu64Aw6EC8GV5yAWr57jmPDfVVxq77fHH17pR3lIXVsZAJtSujKA6Mr+Bg+ZOFIp78rt6BuxW5flVtIm2tgC4882SBVia4y+XCREHs0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708962369; c=relaxed/simple; bh=UsqyRMSqElQb29ybk/PYbZx8lzm8g++czw/Vi6K81ck=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=RdeMxjMH9oaLsSVZ4lmDjiCBSjJIWpz9eRz4UNXL3C0++K7Gaq1a4JwILz07aXSYGE6o3HMWs3wxqG7dRFMcbrWopOcGx/2j39RgE0xW8Yn9gcYhSX00J5C3Gsxo8Dfb3CqBTkBpJqlrKlQTVrNXk/qpOM57SPIJmXNsSry2WAU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Rt1Spkys; arc=none smtp.client-ip=192.198.163.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708962368; x=1740498368; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=UsqyRMSqElQb29ybk/PYbZx8lzm8g++czw/Vi6K81ck=; b=Rt1SpkysvqHPaquNJcmn9Bzgh4WHgKNV571QfjhngHfmlWwuqzZlYAfN peB0WtoeFTc48XE3Z9lZ2Rz2Zt9xfXHpqslaXsrSrGTr5gXML8K4zdlwK M25x2qmfjNYoL9jUpLc+q3I7fOEyOMmLaCcbF2n3o+D5yBTyVrPicf1Yr 0au3IVAwKIfRqo8DOUH8qJTvR0zAqD4ZZE/MS3NSL+hYYssfQt57TDAI2 1KhnMTIJTIUufJMjdX/MHFdVspEMryHCizuj783q2u9BUMlLtkhk1EW1/ 8yLwjV6MoVsCr1TCVC+gHsMv+nwJBvtxs3lnZcXOtubxPKGAcLbs/9ASN w==; X-IronPort-AV: E=McAfee;i="6600,9927,10996"; a="6200753" X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="6200753" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 07:46:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="6695740" Received: from tvereenx-mobl.amr.corp.intel.com (HELO [10.251.5.170]) ([10.251.5.170]) by orviesa010-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 07:46:06 -0800 Message-ID: Date: Mon, 26 Feb 2024 07:46:05 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/3] PCI/DPC: Request DPC only if also requesting AER Content-Language: en-US To: Bjorn Helgaas 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 References: <20240226151805.GA200026@bhelgaas> From: Kuppuswamy Sathyanarayanan In-Reply-To: <20240226151805.GA200026@bhelgaas> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 >>> >>> 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 >>> 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 >> -- Sathyanarayanan Kuppuswamy Linux Kernel Developer