From patchwork Thu May 30 08:52:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai-Heng Feng X-Patchwork-Id: 13679937 X-Patchwork-Delegate: bhelgaas@google.com 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=canonical.com header.i=@canonical.com header.b="lHmUVFpd" 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-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 */ From patchwork Thu May 30 08:52:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai-Heng Feng X-Patchwork-Id: 13679938 X-Patchwork-Delegate: bhelgaas@google.com 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 A19AA6F30A; Thu, 30 May 2024 08:53:02 +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=1717059184; cv=none; b=NvnQaa48Wq7HmNSCVLiU8pM863oOxUj+wdRFksxmpIXFvL+UgCLkv7z46q5XfQI0AMulwicBm4sOIzhnYRDQRkww4csU6zthdl3B2Ti2RhjZYZSc0/hMoWWEDlo2ha0BFfLT71UNEepI5Ns4iahhp7pxXyf86XSxKUmPvIgRBo0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717059184; c=relaxed/simple; bh=zcF8ynwfqox6lFxPsAnNwptrPXvGztX8lAU2EObi2J8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dcKzY1yxF1ndTZS9uz4dpQxbsvucjKka+k7gep+mQxhBsEEdkj4kYKRqXPtAGTir20uwXuLV2b54VTpmqYrK5kFW294YWFo+WMS6kDzXXPI8Go3vETl64c1x+vw0MoyTBvyMXqDX/vxuoSAAZjFtvVfv8GA8MaIR4M9nO2ztbHk= 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=pEI9ecVH; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=canonical.com header.i=@canonical.com header.b="pEI9ecVH" 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 BE5F940F62; Thu, 30 May 2024 08:52:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1717059180; bh=4vdjuyTFJSa1yvWPwCMbJNz87HxC5Wp+l/buNmOANr4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pEI9ecVHNzV6y71mg4De+Vrswoxdj0S4+0ENDn0XxEDAVz80hj8K5CnUIjnkheY1D vjXOftX0sKOISXQ101kPgGL6w1kbw3kk+93JbU8AVUuQnj7Uxy1EbsPnb913iqJVrh bRirUCTT6g5rz+eftvlSDce0jK+1rZt802WbSlRTg18eeWVJ1XwTVtVBdv/DotwP1O xkvxUvsQp6E7+2pTBHi/Qmy7OCXurvzIOxDJrPiXRAisjz8VhfyFQiggqP16lM696R w9lSzo/klwhK+w/oOimobujvmWoVd6eJa2ZxkSLZ8dQn4Ckw5IXDF25DWeZx030YRI wgkLAgavYaFOw== 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 2/2] PCI: vmd: Let OS control ASPM for devices under VMD domain Date: Thu, 30 May 2024 16:52:27 +0800 Message-ID: <20240530085227.91168-2-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240530085227.91168-1-kai.heng.feng@canonical.com> References: <20240530085227.91168-1-kai.heng.feng@canonical.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Intel SoC cannot reach lower power states when mapped VMD PCIe bridges and NVMe devices don't have ASPM configured. So set aspm_os_control attribute to let OS really enable ASPM for those devices. 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/controller/vmd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c index 87b7856f375a..1dbc525c473f 100644 --- a/drivers/pci/controller/vmd.c +++ b/drivers/pci/controller/vmd.c @@ -751,6 +751,8 @@ static int vmd_pm_enable_quirk(struct pci_dev *pdev, void *userdata) if (!(features & VMD_FEAT_BIOS_PM_QUIRK)) return 0; + pdev->aspm_os_control = 1; + pci_enable_link_state_locked(pdev, PCIE_LINK_STATE_ALL); pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_LTR);