From patchwork Thu Aug 25 01:56:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1670028 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=BfD+YTLz; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MCmKj58Tmz1yg7 for ; Thu, 25 Aug 2022 11:56:41 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1oR26i-0007Nx-L4; Thu, 25 Aug 2022 01:56:32 +0000 Received: from mail-pj1-f43.google.com ([209.85.216.43]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1oR26d-0007J0-QA for kernel-team@lists.ubuntu.com; Thu, 25 Aug 2022 01:56:27 +0000 Received: by mail-pj1-f43.google.com with SMTP id s36-20020a17090a69a700b001faad0a7a34so3423256pjj.4 for ; Wed, 24 Aug 2022 18:56:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:from:to:cc; bh=Lw99HzqfNZGSdtXxuoaBKIP2g4bPU1me89oUb4Qnb9w=; b=BfD+YTLzkuPLjqftEbfyxlteylBK2uHIIGW5TlFrlx9un63qUbNi6dTWdD5HGGw1st bat9Wxk+8ZY2JNJxRnuP5vHHXnhOdD2eAZLCHt1ViVp8NOyggDHz90D7m5S/0yN95osG UkdyzBKN17iPKhbM7KvwiExcXRoSrWr9j7HX3xq+Tr/hqFAuy++kvZwhCY6PEJiBx0xF omvdVtu5CmOt63HaHNt2bX9VuzC6yCZL1/GKa8/GDL7RYWqnVuXz/Qy3mbbeUw1LZgJ7 ej5n/EnXvvjRak3yfCb6R01hl2ICov61Ai8tMJLxzoV+0EfXBj0YE9szUOLa2qpXJz3y ewPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc; bh=Lw99HzqfNZGSdtXxuoaBKIP2g4bPU1me89oUb4Qnb9w=; b=lEUiuNmKiEgieBFcq39tXOzUsrvjJeemAl0QU3U1lIiw1KeN++zWVqSwCFAjb/3hjS 6zzYOP3dA/aB2jJOEeiM7AVZT0tlwUa22+xIBkbYxFQHGm3Q7yltCGnbJF20C+LzrC7f zGYwA1QIP/X4U3EcHnrUZT+dP0Ao9K7DW5azxxzwO/Wdcqe7LCMCnVRJcR7fJt1y9DkU dpbH0vjsx9s/7oVuEdQVl/9iUmq1EmBCX2BZ8XMSQ6QyGs2wK3NrwnxfmlTpYIL30fF1 XFHFafuDzf/zS+gNumAKAKieTuEfANndF9ZjP8/pQkRaZb4nQwLcX2CjN81ALZOfT/3f PQoQ== X-Gm-Message-State: ACgBeo2FdjZKITrylYhjlvyfEmKLwGvnrMyFJtb7W7R6vZ2VokNqrR0/ M25ABXPufnCr7LVffKi2nVUI81IAI40= X-Google-Smtp-Source: AA6agR5Aob7i2hdpZiRPqZnMFw+JjhjXEm7Dt3xbGLKwhlO5gzWNH/mGgHyNVT/QT0lGm7ajjAaT1A== X-Received: by 2002:a17:903:31cc:b0:172:cad5:6b4 with SMTP id v12-20020a17090331cc00b00172cad506b4mr1624517ple.115.1661392585732; Wed, 24 Aug 2022 18:56:25 -0700 (PDT) Received: from localhost (220-135-95-34.hinet-ip.hinet.net. [220.135.95.34]) by smtp.gmail.com with ESMTPSA id n9-20020a170902e54900b00172f4835f53sm6285070plf.192.2022.08.24.18.56.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 18:56:25 -0700 (PDT) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH v2 2/2][SRU][K] UBUNTU: SAUCE: whitelist platforms that needs save/restore ASPM L1SS for suspend/resume Date: Thu, 25 Aug 2022 09:56:18 +0800 Message-Id: <20220825015618.39518-4-acelan.kao@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220825015618.39518-1-acelan.kao@canonical.com> References: <20220825015618.39518-1-acelan.kao@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.216.43; envelope-from=acelan@gmail.com; helo=mail-pj1-f43.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: "Chia-Lin Kao (AceLan)" BugLink: https://bugs.launchpad.net/bugs/1980829 Add a DMI quirk for the previous commit "PCI/ASPM: Save/restore L1SS Capability for suspend/resume" The DMI quirk lists the platforms that needs this patch, and also applied the concept of the below commit to not call pcie_aspm_pm_state_change() if the platform is listed in the whitelist https://patchwork.ozlabs.org/project/linux-pci/patch/20220509073639.2048236-1-kai.heng.feng@canonical.com/ v2. 1. added the missing null terminator at the end of the quirk 2. changed the DMI match for LENOVO to its DMI_BIOS_VERSION Signed-off-by: Chia-Lin Kao (AceLan) --- drivers/pci/pci.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index aca05880aaa3..4df9ce7ad950 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -166,6 +166,23 @@ __setup("pcie_port_pm=", pcie_port_pm_setup); /* Time to wait after a reset for device to become responsive */ #define PCIE_RESET_READY_POLL_MS 60000 +static const struct dmi_system_id aspm_fix_whitelist[] = { + { + .ident = "LENOVO Stealth Thinkstation", + .matches = { + DMI_MATCH(DMI_BIOS_VERSION, "S07K"), + }, + }, + { + .ident = "Dell Inc. Precision 7960 Tower", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Precision 7960 Tower"), + }, + }, + {} +}; + /** * pci_bus_max_busnr - returns maximum PCI bus number of given bus' children * @bus: pointer to PCI bus structure to search @@ -1293,7 +1310,7 @@ static int pci_set_full_power_state(struct pci_dev *dev) pci_restore_bars(dev); } - if (dev->bus->self) + if (dev->bus->self && !dmi_check_system(aspm_fix_whitelist)) pcie_aspm_pm_state_change(dev->bus->self); return 0; @@ -1667,7 +1684,8 @@ int pci_save_state(struct pci_dev *dev) return i; pci_save_ltr_state(dev); - pci_save_aspm_l1ss_state(dev); + if (dmi_check_system(aspm_fix_whitelist)) + pci_save_aspm_l1ss_state(dev); pci_save_dpc_state(dev); pci_save_aer_state(dev); pci_save_ptm_state(dev); @@ -1774,7 +1792,8 @@ void pci_restore_state(struct pci_dev *dev) * LTR itself (in the PCIe capability). */ pci_restore_ltr_state(dev); - pci_restore_aspm_l1ss_state(dev); + if (dmi_check_system(aspm_fix_whitelist)) + pci_restore_aspm_l1ss_state(dev); pci_restore_pcie_state(dev); pci_restore_pasid_state(dev); @@ -3491,10 +3510,12 @@ void pci_allocate_cap_save_buffers(struct pci_dev *dev) if (error) pci_err(dev, "unable to allocate suspend buffer for LTR\n"); - error = pci_add_ext_cap_save_buffer(dev, PCI_EXT_CAP_ID_L1SS, - 2 * sizeof(u32)); - if (error) - pci_err(dev, "unable to allocate suspend buffer for ASPM-L1SS\n"); + if (dmi_check_system(aspm_fix_whitelist)) { + error = pci_add_ext_cap_save_buffer(dev, PCI_EXT_CAP_ID_L1SS, + 2 * sizeof(u32)); + if (error) + pci_err(dev, "unable to allocate suspend buffer for ASPM-L1SS\n"); + } pci_allocate_vc_save_buffers(dev); }