From nobody Mon Sep 28 12:34:02 2026 Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 246D7495051 for ; Fri, 21 Aug 2026 13:46:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787320016; cv=none; b=ec6esZs4I/LK41W8uUO0zZEBLke658tTwIzDPhu6CDPEMpe+pnImBUpuMxp5lbu9v7kfXXRSJl0B6hPhrNR63noMxaw4PHX3PfLUWxKgb9ff+/AytrU64Es8/fSGSR1ZZdj2V/A8EgAfycrLhr11eakV6Ou6NgTY7NVoJI95yog= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787320016; c=relaxed/simple; bh=4GRZrykve3DYCt54SQMhbFYoS+0wHD0ES1uEWUPPGeY=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=o9BUXf/H6u7vNb0q5VkVi4d+1TrFScsUSzp/UgHMCRXEUHP6fk8Oeaa3rdISC7/YsNJE1hmOle7EjWI38pMQzCGkmI/oKogE1ChM6nJF9i/FfCC/AeVuOTEgaugCkIhd5fqXLh/B6OXQilNeH+4/OT6ZPGQhV5bjKsR0bFlkqd0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aniketmaurya.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=W4VDARST; arc=none smtp.client-ip=209.85.214.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aniketmaurya.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="W4VDARST" Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2cc5faecf01so21822255ad.1 for ; Fri, 21 Aug 2026 06:46:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1787320012; x=1787924812; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:mime-version:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=3j6lgpgnueDnnXaUVeKFBE+wmpz2Lu0oRIsQW+ixGBM=; b=W4VDARSTbgpiCzIHcnzGtsXoT5+LWDxvzXo+HB+Cdlr9AOdf306QllTULF5tb+LDua xltYVYLdtLMg7gko0Cum5iarKdw/4AJUY+j1fgle0I362BreTXWbCGN+q8feqWPnqspD HM61VjKFWZIsVi87X5l+v3tkga/ZG/DuNrAGYow+yscdbZIJrlZzNrZpLibCpI8GVoTD 8HQgktw9/LxTlDFh/VGVI0/mTqnM3PN0CkmJyBaA7Zi+DQxHs+QwokUCMLb1KDNdGEOv kSWHYpfV7JxJZgRNVRW1t4pSj6+eEnhYkc4UbmuWdBtiQmkU05TdJ0szKDdzbXlOlvyw wccA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787320012; x=1787924812; h=content-type:cc:to:from:subject:message-id:mime-version:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=3j6lgpgnueDnnXaUVeKFBE+wmpz2Lu0oRIsQW+ixGBM=; b=ZY3nRXy0SsTL7J7pS/ON1TJUvNnESUaJi1dpnAUoYGPpU+wGttL0CEeP+w20qAzcu9 zulYGhxPlZQVV0Zqsixmf/PNr7hWnlqnT4zka8BjqVRHNcebkL7kHeTILpHmPqy91S8M WB4s4rHeG5osmqJB5B9A6IPQyfoByHNWoQ7+Yv2ErsPc4PbNG/m0mqfzyOxnqp7qgREd F1tF52D5JnJLULXlUdxQRnhu4wfcnMNWqB+GapRs5oVOg0OLkBPVVYrKLGa5t1R6yJF5 3GEr6ZapHd3GMFcQdxN3bB0lLUD+G1jXiDfIl9b0zF21UHhh33makt4p/UE2bN5HT5w4 NP2A== X-Forwarded-Encrypted: i=1; AHgh+RpNB00+OKSz5ycIKwoAOfwTXUxbwygn9Ol9HP03MH0sksm/lerxdj/gyAjvLmKYKaMUrNV3KYeJX2aDRNM=@vger.kernel.org X-Gm-Message-State: AFuF++n2GgOfPGplqJyFNJlurSIZ7k71jpjKZk7+vuKGm+rbpqCIJ4XR WFASZ1rMcSJiSF/k94ht6Jvwsbc/lDH4JfX6f1Xy0FYCb9qRL711bsZtpukoFO5uMeve9zp5Q37 wPFODRlVChpk4Cz4vSQJl12z5+TNXxQ== X-Received: from plbbh3.prod.google.com ([2002:a17:902:a983:b0:2d3:a560:c1f7]) (user=aniketmaurya job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:2c0c:b0:2cf:8131:75f4 with SMTP id d9443c01a7336-2d64b036898mr132058755ad.11.1787320012023; Fri, 21 Aug 2026 06:46:52 -0700 (PDT) Date: Fri, 21 Aug 2026 13:45:21 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.55.0.766.g2966f0265a-goog Message-ID: <20260821134521.2211943-1-aniketmaurya@google.com> Subject: [PATCH v2] PCI/ASPM: Clear L1SS capability when L1 latency is unacceptable From: Aniket To: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Lukas Wunner , "=?UTF-8?q?Ilpo=20J=C3=A4rvinen?=" , Manivannan Sadhasivam , Krishna Chaitanya Chundru , Manu Gautam , Ajay Agarwal , Aniket Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" pcie_aspm_cap_init() initializes link->aspm_capable from link->aspm_support, which includes PCIE_LINK_STATE_L1SS (L1.1, L1.2, etc.) if supported by both ends of the link. pcie_aspm_check_latency() then evaluates whether the exit latency of the link exceeds the acceptable L1 latency advertised by downstream endpoints. If the latency is unacceptable, it clears PCIE_LINK_STATE_L1 from link->aspm_capable. However, it does not clear PCIE_LINK_STATE_L1SS. L1 PM Substates are substates of L1 and require L1 to be supported and enabled. If L1 is not capable due to unacceptable exit latency, L1 PM Substates cannot be supported either. Leaving PCIE_LINK_STATE_L1SS set in link->aspm_capable causes aspm_ctrl_attrs_are_visible() to expose L1SS sysfs control files (e.g., l1_1_aspm, l1_2_aspm) even though the link cannot use L1/L1SS. Clear PCIE_LINK_STATE_L1SS along with PCIE_LINK_STATE_L1 from link->aspm_capable when L1 exit latency is unacceptable. In addition, update pcie_config_aspm_link() to check link->aspm_support instead of link->aspm_capable before invoking pcie_config_aspm_l1ss(). This ensures that pcie_config_aspm_l1ss() is called to properly clear L1 PM Substates in the hardware configuration registers if the BIOS left them enabled, even when link->aspm_capable no longer contains PCIE_LINK_STATE_L1SS. Signed-off-by: Aniket --- drivers/pci/pcie/aspm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 172783e7f519..b2660892972a 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -666,7 +666,8 @@ static void pcie_aspm_check_latency(struct pci_dev *end= point) latency =3D max_t(u32, latency_up_l1, latency_dw_l1); if ((link->aspm_capable & PCIE_LINK_STATE_L1) && (latency + l1_switch_latency > acceptable_l1)) - link->aspm_capable &=3D ~PCIE_LINK_STATE_L1; + link->aspm_capable &=3D ~(PCIE_LINK_STATE_L1 | + PCIE_LINK_STATE_L1SS); l1_switch_latency +=3D NSEC_PER_USEC; =20 link =3D link->parent; @@ -1041,7 +1042,7 @@ static void pcie_config_aspm_link(struct pcie_link_st= ate *link, u32 state) pcie_config_aspm_dev(child, 0); pcie_config_aspm_dev(parent, 0); =20 - if (link->aspm_capable & PCIE_LINK_STATE_L1SS) + if (link->aspm_support & PCIE_LINK_STATE_L1SS) pcie_config_aspm_l1ss(link, state); =20 pcie_config_aspm_dev(parent, upstream); --=20 2.55.0.766.g2966f0265a-goog