Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1159131lqb; Thu, 30 May 2024 01:54:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWZeOQGAvej+l0ah1GJQvMy/h5Tvs3x+pDDrokiTBeKw16s53EAnn/XST3cxUEBP3JVeQNihi7g8avPTLflQerkOIOaPgqy41HDifWUNA== X-Google-Smtp-Source: AGHT+IFC0K5AEgkTnAbteTcNdjAU3sLtAtyvg7wg6QAkg3fcAbLWQRHnDnR67STQH0Uc6JoSy45l X-Received: by 2002:a17:90a:c20a:b0:2be:bd:36cc with SMTP id 98e67ed59e1d1-2c1abc126f5mr1433914a91.8.1717059280600; Thu, 30 May 2024 01:54:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717059280; cv=pass; d=google.com; s=arc-20160816; b=K0eHm9RUJoFYa9AA6e0WvDMnMp5BGlWd0OGRRkymBF3eX6rzjUowq7m5DSmZYpn8Ah dm9JQaoScJZAJOxUh3m6IkwOrTSpMmi0zyT1iqGROAaGnUVzB0HESr8R2Yq2l2GwTus2 sKIj9pa13TFsau79AMIO4Far6oPLZZLeLanOVfoe8prOyx0ZDJKvbOA7KPyRJoFDDGGO dLkRaNmhdbysplpSP7/ImtPjFz999K420GxmaaRmWQ6rpaHoWs57Xiz8VhyJ8ScLThl6 5IB7h3PX7UEvffWxckEHlgtHBnrNFDDCbHItIk9Foj2UVKB2psjzAcMtx/x0OM7Nhguq cJSw== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=Tpe+gbzS1kOJ94iIq6BFHuIaYZPa70nw/0E6K7KjDPE=; fh=cyRTCLi2jrhBQpd4YvrHMIdqtbGJEMIBXDxqKhwvmVM=; b=N1IVhI0CMn7JfH9RWSqdUHExtrxZTOpuSc8EwHslvg70G25TeTIoG/dp+CASQV40fo Hy+nnQCYBTMCcYHhStce3Oc1t1HEIwOY/XpKtlJdiSWe9vZIT3i4Bbf41BOzYNQLDTCk 5NY/rF3hnd7VEi8bxH4rNH0awbOIPKs8W/nE1T/8qy+YIMy9gtjuZb6vMEWgn0NT4Bld TgOZ76u2rRLmdS4XJmFNoTadZ7wP5tm6NKk0arIxoyygv2HxQhs9MJeRdPpi7bA1Ar28 YSy8o4vN2UX//2WwpDlirhRSDJtQZrCpyA+qBZz5V5+f1W4/aTYogk6+8jAaxh7MigL2 sFZA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=lHmUVFpd; arc=pass (i=1 spf=pass spfdomain=canonical.com dkim=pass dkdomain=canonical.com dmarc=pass fromdomain=canonical.com); spf=pass (google.com: domain of linux-kernel+bounces-195095-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195095-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c1a7764d5asi1253367a91.32.2024.05.30.01.54.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 01:54:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195095-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=lHmUVFpd; arc=pass (i=1 spf=pass spfdomain=canonical.com dkim=pass dkdomain=canonical.com dmarc=pass fromdomain=canonical.com); spf=pass (google.com: domain of linux-kernel+bounces-195095-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195095-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id EFE7AB23BBE for ; Thu, 30 May 2024 08:53:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7647F6F315; Thu, 30 May 2024 08:53:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=canonical.com header.i=@canonical.com header.b="lHmUVFpd" Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) (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 208816F2F1; Thu, 30 May 2024 08:52:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.125.188.120 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059182; cv=none; b=qBj0py0L8UGOe8t76Optf7590mCy1qn0ojmKOhAfUBRXQXMA1dmHwOdknUD5Md8u3y1S2RgtyZ9sN1GVqZ2XLUkRz89nkJW1j7VMmQnPrICOvof6ZFuq9DmPL/x8lpcC0pGLF1BXcqs9g+U/+iu4dLpCkQJOg0d/RYDGzgG5iQc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059182; c=relaxed/simple; bh=3owwtopJBW27l7XF9REOmZ/I2S3ZXl+g+EoVFffOiKg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Y7NbSZILfy78a8vmqSeP2Usn16YT0cJXUKJESwfC/WLK0bDRnosbzHNXLi4JRktdyYjH03zoRu35PMQb/vqMYE6ucKDmnrYSsNNjibXHquqG9CfD/MdHz7ifWuZbw0e++VJd1iuV0DcpOYbyqWWu7n5cfMq58uVKE0eY3V9yH4M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=canonical.com; spf=pass smtp.mailfrom=canonical.com; dkim=pass (2048-bit key) header.d=canonical.com header.i=@canonical.com header.b=lHmUVFpd; arc=none smtp.client-ip=185.125.188.120 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=canonical.com Received: from localhost.localdomain (1.general.khfeng.us.vpn [10.172.68.174]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 12EA83F2EC; Thu, 30 May 2024 08:52:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1717059177; bh=Tpe+gbzS1kOJ94iIq6BFHuIaYZPa70nw/0E6K7KjDPE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=lHmUVFpdxuGlwzSOUKDLcRdFurA+k4cyVgQiBhpd6mJaVhGTRBsco6Ldp0ks3lnJP qugM2VVpkx0Ki3JOuX0O5YhzfQMn9045eMH2gTY6cJDIlCu74YO5++OODW5g471lHD IlxI0+v8ATzoHs568WWR+av2sODkOOspilQPEZRQQ6PZCqdQwP2vl4khP+7hH8Pz+9 JbD9MPgOICwIRanxFrJ3IzBIGscIW+k72Wwvb9IqWJ4bLeafWQaNnk/KAdAv62BL8d Swh6Ci1utEpk1FZ8TvX9FFnrZNYRqQkv0wtpL+vrVg7UkPH+raqeEIuPWUTpOE+cdC sbntk1M5/G4EQ== From: Kai-Heng Feng To: bhelgaas@google.com Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, nirmal.patel@linux.intel.com, jonathan.derrick@linux.dev, ilpo.jarvinen@linux.intel.com, david.e.box@linux.intel.com, Kai-Heng Feng Subject: [PATCH 1/2] PCI: ASPM: Allow OS to configure ASPM where BIOS is incapable of Date: Thu, 30 May 2024 16:52:26 +0800 Message-ID: <20240530085227.91168-1-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Since commit f492edb40b54 ("PCI: vmd: Add quirk to configure PCIe ASPM and LTR"), ASPM is configured for NVMe devices enabled in VMD domain. However, that doesn't cover the case when FADT has ACPI_FADT_NO_ASPM set. So add a new attribute to bypass aspm_disabled so OS can configure ASPM. Fixes: f492edb40b54 ("PCI: vmd: Add quirk to configure PCIe ASPM and LTR") Link: https://lore.kernel.org/linux-pm/218aa81f-9c6-5929-578d-8dc15f83dd48@panix.com/ Signed-off-by: Kai-Heng Feng --- drivers/pci/pcie/aspm.c | 8 ++++++-- include/linux/pci.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index cee2365e54b8..e719605857b1 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -1416,8 +1416,12 @@ static int __pci_enable_link_state(struct pci_dev *pdev, int state, bool locked) * the _OSC method), we can't honor that request. */ if (aspm_disabled) { - pci_warn(pdev, "can't override BIOS ASPM; OS doesn't have ASPM control\n"); - return -EPERM; + if (aspm_support_enabled && pdev->aspm_os_control) + pci_info(pdev, "BIOS can't program ASPM, let OS control it\n"); + else { + pci_warn(pdev, "can't override BIOS ASPM; OS doesn't have ASPM control\n"); + return -EPERM; + } } if (!locked) diff --git a/include/linux/pci.h b/include/linux/pci.h index fb004fd4e889..58cbd4bea320 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -467,6 +467,7 @@ struct pci_dev { unsigned int no_command_memory:1; /* No PCI_COMMAND_MEMORY */ unsigned int rom_bar_overlap:1; /* ROM BAR disable broken */ unsigned int rom_attr_enabled:1; /* Display of ROM attribute enabled? */ + unsigned int aspm_os_control:1; /* Display of ROM attribute enabled? */ pci_dev_flags_t dev_flags; atomic_t enable_cnt; /* pci_enable_device has been called */ -- 2.43.0