From patchwork Fri Feb 23 20:58:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 205677 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp841216dyb; Fri, 23 Feb 2024 13:00:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVCvStvlgfGGqd05tJfNHVpVSOTLc7RpXggqbs83Oo1V6+DN78EVdTU6FizMYTfKL0zvYc4kX0NwJdAzK6cVHry4BVaVA== X-Google-Smtp-Source: AGHT+IHszyDY6ujEIHVou5y/g2dyQFuOGX5HHGderjlotaBBXZA3MXT8zUY6Lmm/NgcmLsaYRzm3 X-Received: by 2002:a05:6871:5220:b0:21e:b695:dff7 with SMTP id ht32-20020a056871522000b0021eb695dff7mr1037118oac.32.1708722047836; Fri, 23 Feb 2024 13:00:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708722047; cv=pass; d=google.com; s=arc-20160816; b=GqtwQAGIVGgKIu09OEPGdqKcmCv//md9j7aMQgEsDcHkR69d14tvdW4SHVOCG0pE8u Tc1oWLj32l39HM/vYALAYFZ00vD+Btndcg45MrsjJIx2J1HOdQ/u3ZPW62OG7ZZg8fx1 5t0OGY9rIrnJOuWZ4lK5d/g05zsX+izM6ngLDf+GcR43X7/81XFgL7XnrUW1J5StHkTF xwS62IGy3ELGN3v/hne962m4E3pAm1BkACsTc8mwG3sLdDBbvbePW0sKNxjyWhLjTcBJ uDMOmNX2CHuuX1HOWc1duP92MdsCXGR2v70y+j40Z20sNXLZVU7sACcxAE09LY3g/LvD /urA== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=JLs2FUfoKUOY8qleSDWIlenwNmJhC61jwzTRF/9aL7A=; fh=UOtCQvdtLRjYu4lpt5Tw8oOZkSAAXsqpAt775wBcPRQ=; b=mIHZ7Msy1L1RALuMrN/sGV7qtxLAyZUGaMFUf3BNwhiflnW7Saiyg/c6/4yi8dEfVT nTvXzpeGe5L8P4uTbgmrC1oaNUFwRIhtBZ2YblYC9N91CYejn9h7glD6wJSlO1PfnZYH WuoUbgBpOYk3xZHzu6cmARkCRvYAXFcnmfntKEBNF5FrK/ceEJNDGtxcd8Xw/5eYSV0B gTmgcrORK7rUrDeq+MJ3vph8FbF8em/9dBbpl2gI9ChA5EfZtcpmP0L/vfRsfa1uE4wE tJHLAIlJUTFroWij4mWwvxUvwmWsN87rfC9BK58tbt3ltVAVuUHWSE6IaDKOEAKNLmM9 YQVQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=H9Bwwffo; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-79157-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79157-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id w14-20020a05620a444e00b00787bed7b3dfsi246719qkp.266.2024.02.23.13.00.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 13:00:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79157-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=H9Bwwffo; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-79157-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79157-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 164901C2085B for ; Fri, 23 Feb 2024 21:00:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D493314DFD1; Fri, 23 Feb 2024 20:59:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="H9Bwwffo" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 505D9146E93; Fri, 23 Feb 2024 20:59:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708721944; cv=none; b=ZxkPK1xRMa08eBfCGLpj9B3Y/fKZsuvfaXvG+0NnE6GLxWkqIGDJDIagRJ1TKehIaMNGQz/Hjv3yUFRiLKS+12bPZS7t1O+3oyBMcm6jKdFwxlQIsJYRS4VVvLh9fNLF15Fu1koEmLKt2v+KvPjnKbojjxAC0jId9fsZYwfQQwQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708721944; c=relaxed/simple; bh=edfl9Qyi1j5BIY4+eq7G/coY2cxhe7prrDOpLepU/Gc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=b4FFaGST6nowmUcelnFLewqAqr9FRytW5lQhm1Vxpo6Pz9Vrq5y3kQXUwo4gVUD4E8hBNxoZJjED79joxrMcZdwQ/W2f/6CpR8vL4ovw6anh8EmR0iO+OocnGVzL1o+jjiqGOx65maqDBEsGdlyDlWqabAEevbEglOYkJCzAuL4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=H9Bwwffo; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DD5AC433F1; Fri, 23 Feb 2024 20:59:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708721943; bh=edfl9Qyi1j5BIY4+eq7G/coY2cxhe7prrDOpLepU/Gc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H9BwwffoTSjhsPYDQ27tETDYUNRORa092Hi0lrS0GK2AQ4fPwZc4yjjpLDR0h5pxj 1HEhjHR676WDULoG70M4YdPrupwn0L+u7f0cCDfKk3gfHfGovrlQ/tH0FfPDu5v19s JFDIb3HTNJVSew7BBpI8ax7IhEzoD8m+FEMyxCV+tQk/smk2HUHXD/WIJq2oLW/wGA 8QwYBQIdUClTMwt+3qUjGSMmjfkx8kS/Tja9/obW9fDtXWeUhQQ5bMNNpDNX0gS3DK qfaLOmrQIPnCeX60xWnafWeu9zLg5Zuf9AhHzYbl8k8PWIeFua85zpfedahqUHR7h4 wJk6tczGAoX5A== From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Mika Westerberg , "David E . Box" , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Rafael J . Wysocki" , Tasev Nikola , Mark Enriquez , Thomas Witt , Werner Sembach , Vidya Sagar , Kai-Heng Feng , Kuppuswamy Sathyanarayanan , Ricky Wu , Mario Limonciello , Bjorn Helgaas Subject: [PATCH v7 5/5] PCI/ASPM: Call pci_save_ltr_state() from pci_save_pcie_state() Date: Fri, 23 Feb 2024 14:58:51 -0600 Message-Id: <20240223205851.114931-6-helgaas@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240223205851.114931-1-helgaas@kernel.org> References: <20240223205851.114931-1-helgaas@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791724929789401428 X-GMAIL-MSGID: 1791724929789401428 From: "David E. Box" 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 Signed-off-by: David E. Box Signed-off-by: Bjorn Helgaas --- 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 ca6673588bc0..4ea98665172d 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1624,6 +1624,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; } @@ -1634,6 +1635,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; @@ -1726,7 +1733,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); @@ -1827,12 +1833,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);