From patchwork Thu Aug 25 01:56:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1670027 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=bvVwwqM6; 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 4MCmKd5C8qz1yhC for ; Thu, 25 Aug 2022 11:56:37 +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 1oR26d-0007JB-CS; Thu, 25 Aug 2022 01:56:27 +0000 Received: from mail-pg1-f172.google.com ([209.85.215.172]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1oR26c-0007I1-3R for kernel-team@lists.ubuntu.com; Thu, 25 Aug 2022 01:56:26 +0000 Received: by mail-pg1-f172.google.com with SMTP id bh13so16608635pgb.4 for ; Wed, 24 Aug 2022 18:56:25 -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=PB1scu7damQdfN54YPGl0DbMQ7c0ReiqoRAp89qzmFM=; b=bvVwwqM6Kxk3OO3EOn7JCZWyR3gBXzgAGgsLw06t/2YyDZtw8AVtqNzEn+zJBcBgGK 3ZeflihErhFavVw6l/AC4WGEMPWr2ESqn/6VlskELKXTZohA7iglU70rvgW+mkE4Dl7E 5cSxp2VQOt+UjWJY+QIYahutlhuZrjf/KFC1zurIPyb2r6TDJzgyAPd6VTyUPg6lao+K EQI40TD/a2M+7svFeH+lHuoI+AOJa+n4ZIMhdwh12kHpUlvXGFlrTgvWwoIeXIJT/yQU YBec+KgvZM2ajbYIFRoqoIxK5hhJRNBmJ2cn7U8QzKiw/olyj8AnP9/A07xxDCXOI4fm XFAQ== 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=PB1scu7damQdfN54YPGl0DbMQ7c0ReiqoRAp89qzmFM=; b=1BWKG7xhYfrbW6J+Y+vcEYcfyQLTRiScS/ZNXjM9LCOYQ1cncKQ0ETGyjtmDBX03jJ zs6gdoLYSZeTKZTKeHkjUHfPi28pctSgFMPXZqHjIO1nZFtZX4Ekobvz7W1noiQKS3qb SSfhD9n5eu/3yMPDi9umUSn2Cj9inorQ3ULoqdRkqqTpWxl4eQCQ+m0AMLaHCQh4M+11 UQ2ZybIunhpzkuUITKMae7Nsqe8dBzwQBVRc97V6keLdxXI/MG6uqryKjQ/usVly0lS0 josY8RuOp3na5YbTzVitzH3NBNKH69U/stNJatVR+OSMR73f19UgogvJmJUuOK+7b1mJ CJ4w== X-Gm-Message-State: ACgBeo3ak6zLmxw5MkzLJgy5bUb7kf2/dCW3MOWujAXpvn3AERIEZD0A 6lIMvVUw0wY/rb0O56nzHLC4Z1GG9jc= X-Google-Smtp-Source: AA6agR5QK8kxAfoOoGqFq8QijXOX4n9EPplb7R15pFIxlnQ3gxD9vMOM+aV6KlLbtQG7Gw+Mfh495Q== X-Received: by 2002:a65:520c:0:b0:42b:31fd:b2c6 with SMTP id o12-20020a65520c000000b0042b31fdb2c6mr1347102pgp.562.1661392583959; Wed, 24 Aug 2022 18:56:23 -0700 (PDT) Received: from localhost (220-135-95-34.hinet-ip.hinet.net. [220.135.95.34]) by smtp.gmail.com with ESMTPSA id e187-20020a621ec4000000b00536b2483aedsm6924718pfe.199.2022.08.24.18.56.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 18:56:23 -0700 (PDT) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH v2 2/2][SRU][J] UBUNTU: SAUCE: whitelist platforms that needs save/restore ASPM L1SS for suspend/resume Date: Thu, 25 Aug 2022 09:56:17 +0800 Message-Id: <20220825015618.39518-3-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.215.172; envelope-from=acelan@gmail.com; helo=mail-pg1-f172.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 5c7ef86db60b..d8b71a7b8cd0 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 @@ -1143,7 +1160,7 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state) if (need_restore) 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; @@ -1623,7 +1640,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); @@ -1730,7 +1748,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); @@ -3437,10 +3456,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); }