From patchwork Thu Apr 11 01:32:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1922325 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=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (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 4VFMf63wJVz1yYL for ; Thu, 11 Apr 2024 11:33:18 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rujJP-0004zb-Nx; Thu, 11 Apr 2024 01:33:11 +0000 Received: from mail-ot1-f44.google.com ([209.85.210.44]) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rujJN-0004ql-EO for kernel-team@lists.ubuntu.com; Thu, 11 Apr 2024 01:33:09 +0000 Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-6ea2ef1c6b6so942913a34.1 for ; Wed, 10 Apr 2024 18:33:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712799187; x=1713403987; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=7wE3702lhl92lmBQBEpEp5XFmL48cj9YetrFLu9UlA0=; b=o7rmHJNBU+HKoKAozKeN4pAkoqmvOfMIPyypbPdqpnf/TpMl/28sxL/GrpOUccQKTL GZVJWiIEWFeij39a++J6qrXz8mk6VsMH+DnGTG7drVDAe0/+pXHCXAkGD0/sY1U8CQbT f9SLFi4NkuSVWMB5aO+vaGJuTKh7ZlPxcILngpTULEK+capSpm0bF5u6WaH5nEKHZFdm p+WdeJVkuz3U1bWNu7pWtv4amk4a/0CZ3+lWMb7sGGuJKxI7blgAn36aVurjUw/YIf+T 93SskmoY8C3/SwKCYfOxRLHWAP/QamBcK3PYDxX+IOw/GRCQDQ8djWMQKmNS0TOsqs4N zvOw== X-Gm-Message-State: AOJu0Yww2mqtk/aaaIFFI0WYVDu5gQqN2F2UVN21J7WJjGg6h9KLg8l7 TVPJb78kwK5rmr7UZ2003kgogor2jlByOKz9/FmZPzSVQwpMSY0+6XOzI4eX X-Google-Smtp-Source: AGHT+IH8eKozHc1e15Pb/XraG5LlS1+Gyr+O2wOJ1AfczniJrpIjUyHZuXCNdoV+WvBD0nkOVzdYNg== X-Received: by 2002:a05:6870:796:b0:22e:9792:97ed with SMTP id en22-20020a056870079600b0022e979297edmr4955874oab.38.1712799187428; Wed, 10 Apr 2024 18:33:07 -0700 (PDT) Received: from localhost (211-75-139-218.hinet-ip.hinet.net. [211.75.139.218]) by smtp.gmail.com with ESMTPSA id gk11-20020a056a00848b00b006ed045af796sm285189pfb.88.2024.04.10.18.33.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 18:33:07 -0700 (PDT) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH 5/7][Noble] PCI/ASPM: Call pci_save_ltr_state() from pci_save_pcie_state() Date: Thu, 11 Apr 2024 09:32:51 +0800 Message-Id: <20240411013253.184137-6-acelan.kao@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240411013253.184137-1-acelan.kao@canonical.com> References: <20240411013253.184137-1-acelan.kao@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.210.44; envelope-from=acelan@gmail.com; helo=mail-ot1-f44.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: "David E. Box" BugLink: https://bugs.launchpad.net/bugs/2042500 ASPM state is saved and restored from pci_save/restore_pcie_state(). Since the LTR Capability is linked with ASPM, move the LTR save and restore calls there as well. No functional change intended. Suggested-by: Bjorn Helgaas Link: https://lore.kernel.org/r/20240128233212.1139663-6-david.e.box@linux.intel.com Link: https://lore.kernel.org/r/20240223205851.114931-6-helgaas@kernel.org Signed-off-by: David E. Box Signed-off-by: Bjorn Helgaas (cherry picked from commit c198fafa0125e97728d16411aa653602900ab0bc) Signed-off-by: Chia-Lin Kao (AceLan) --- drivers/pci/pci.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 1d91498d8859..2e930ef0210d 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1650,6 +1650,7 @@ static int pci_save_pcie_state(struct pci_dev *dev) pcie_capability_read_word(dev, PCI_EXP_SLTCTL2, &cap[i++]); pci_save_aspm_l1ss_state(dev); + pci_save_ltr_state(dev); return 0; } @@ -1660,6 +1661,12 @@ static void pci_restore_pcie_state(struct pci_dev *dev) struct pci_cap_saved_state *save_state; u16 *cap, lnkctl; + /* + * Restore max latencies (in the LTR capability) before enabling + * LTR itself in PCI_EXP_DEVCTL2. + */ + pci_restore_ltr_state(dev); + save_state = pci_find_saved_cap(dev, PCI_CAP_ID_EXP); if (!save_state) return; @@ -1752,7 +1759,6 @@ int pci_save_state(struct pci_dev *dev) if (i != 0) return i; - pci_save_ltr_state(dev); pci_save_dpc_state(dev); pci_save_aer_state(dev); pci_save_ptm_state(dev); @@ -1853,12 +1859,6 @@ void pci_restore_state(struct pci_dev *dev) if (!dev->state_saved) return; - /* - * Restore max latencies (in the LTR capability) before enabling - * LTR itself (in the PCIe capability). - */ - pci_restore_ltr_state(dev); - pci_restore_pcie_state(dev); pci_restore_pasid_state(dev); pci_restore_pri_state(dev);