From patchwork Fri Feb 23 20:58:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 20898 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp840357dyb; Fri, 23 Feb 2024 12:59:15 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUdaiD1Qyqj4ZetptYLXB2crgXfM/5DO1LusmNoIStIiVNXeGbXxVZzGr0KfuprQ1FBiOaInozKu28wkbHk0kom761X/Q== X-Google-Smtp-Source: AGHT+IGTKv30JMtOoBlnxxLTZWSZxKRZLIo/6cJAcRezEr/ObtKkyzVISnAXzHotKNjKXId/Wp4+ X-Received: by 2002:ac8:5b8b:0:b0:42e:6bae:e239 with SMTP id a11-20020ac85b8b000000b0042e6baee239mr333247qta.38.1708721955263; Fri, 23 Feb 2024 12:59:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708721955; cv=pass; d=google.com; s=arc-20160816; b=ge01Fvoa6Bgs3NYSST1WEHLAfIffj6S5n9oPF4e+tkCwsdobepy5+wnw1rZJ1qYvO4 JqF4f2CdxvT3LcdEtdsyJ33auABQ8376Bh6bkTE4/M8yX0l2TqYCDW1Ygb/+sNIntX9O 8kctyPIH8aYOrBVpmKqV3ilatEYe+4/qSACrymnxRKwwJddyDGfmN7mihxry6SQVrFYH karxjwE3aWS1ym3m9DPkFDt5WpjDILHga4k1IshSgiHXPYLy0P/5eRIyEYl1GVx4vENL IZLs/OwL5QvPUicxdnnWZFfdDumL1vc6w7gsOi2JDr0VwrYAf5Bgc3WzVrjB76Og1bM7 Dvng== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=mEfA30g+miqBBDyaTNTpyrnINadjyhMNPThrvCJiaOA=; fh=UOtCQvdtLRjYu4lpt5Tw8oOZkSAAXsqpAt775wBcPRQ=; b=pSbkj9L1Wv3iCf5Bs62rKoX4G2sL6VyRnMFxIloghh6Qdh5Yc28TKlZGKtLU/cthgv xOPge0riUp2KvlAXnCGIyDS3DWs0+PHq52QAA1hH4xRY6Tqz1M1XFwQyIfyWvQYMXHrq t8sm7+wcburuXROUG3aND7g2QuQov+xh7NRCEGd/3gop3Uraax5hyJ55xv3l4scyw4OE oFD/COSu5HsAVaw1XG3JV8GUdIPJQWtzZL4hmpe9+IX9eHO0Bxw6JaDiad9RQ0MIRhKF vFvZN3JKvATkQ3gCB6P+15VAoV3KzgEuUESbFCNkIElwXmwi04b7Sp6hFYpUBN5JKaMP zEcw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SKJO1XJA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-79152-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79152-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. [147.75.199.223]) by mx.google.com with ESMTPS id v21-20020ac873d5000000b0042e3ec6acdfsi642162qtp.163.2024.02.23.12.59.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 12:59:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79152-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SKJO1XJA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-79152-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79152-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 1454C1C243D4 for ; Fri, 23 Feb 2024 20:59:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EBC8C149389; Fri, 23 Feb 2024 20:58:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SKJO1XJA" 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 6A5EE12A16D; Fri, 23 Feb 2024 20:58:54 +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=1708721935; cv=none; b=qJI0VPNHy2CvIsu6fKiQwt9yW13t6uvvGJWLsPbAUcR2QsH8E6c1v3nTnE/1n3cHGxhkQ0ZirmYrBPLtpL0tRe2Aguu16vy6uCvgaG5D5Z+kjBZPYWQJSWK0WwPUfOXyma+hN4Cmn5FW/k2tDicaE5Dnj/u+s1inanuH49ARX6g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708721935; c=relaxed/simple; bh=ZnhJxh0/iM55/Ih9OWsBqkos+7Gz6O4NkpMi/NZLabM=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=LP2ZaF0YlpIwkFr++ni/9sSjqG5AOlJmwfQaIXBpCOlrKEfdTo2GyBKY2dEHL/haHJ5PLaqs3ADerMbQbQrMvY5Zigf+d7axPDuDsv4zDEhlCQyWsCZL1VWzJRXbqePtaSt503ygctliKBaBY6/1T6Rkwq2VQT+N+f+yx+TsPfg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SKJO1XJA; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAF24C433F1; Fri, 23 Feb 2024 20:58:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708721934; bh=ZnhJxh0/iM55/Ih9OWsBqkos+7Gz6O4NkpMi/NZLabM=; h=From:To:Cc:Subject:Date:From; b=SKJO1XJAV3byIfprXimylg/0/cOa72YkVcW2E/j5DAtRQ+zhgVF1vWvSv+xxbwVLB InNYbiDaV89suN0QAjcUd/UltBHwWQPunJ6Pi7N9gyIXrxIDx7jjP38ZSIqzEAuSZh ukS7vWy+ohfhN66QthEMg2EsyGGwdO5E9pB7V8dIC2WbgA8ydnzsNREJUg5Erj6SMG pkPw4aOoxy9KPhMm9oZ1DLkBAWm5jPo7r8d0bVPfRF5OJ2Rkdc50s+HcMYvnwYUeaX PJQ8eWqOHfHynQKi3beH5yNloYu1EdTJoJbgxDLD6mv7w2MuAkBzi/z4YLPPBSlTGZ f4AEkzlhgVazQ== 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 0/5] PCI/ASPM: Save/restore L1 PM Substates for suspend/resume Date: Fri, 23 Feb 2024 14:58:46 -0600 Message-Id: <20240223205851.114931-1-helgaas@kernel.org> X-Mailer: git-send-email 2.34.1 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: 1791724832849735990 X-GMAIL-MSGID: 1791724832849735990 From: Bjorn Helgaas This is some rework of David's series to preserve ASPM L1 substate configuration across suspend/resume. We've had several attempts to make this work: (unlabeled): https://lore.kernel.org/r/20240128233212.1139663-1-david.e.box@linux.intel.com v5: https://lore.kernel.org/r/20231221011250.191599-1-david.e.box@linux.intel.com v4: https://lore.kernel.org/all/20231002070044.2299644-1-mika.westerberg@linux.intel.com/ v3: https://lore.kernel.org/linux-pci/20230925074636.2893747-1-mika.westerberg@linux.intel.com/ v2: https://lore.kernel.org/linux-pci/20230911073352.3472918-1-mika.westerberg@linux.intel.com/ v1: https://lore.kernel.org/linux-pci/20230627062442.54008-1-mika.westerberg@linux.intel.com/ The most recent posting is the unlabeled one mentioned above, and I'm calling it v6 and this rework v7. Changes since the unlabeled v6: - Rename pci_save_aspm_state() to pci_save_aspm_l1ss_state() (this is the reason for opening this again, because Vidya's patch [1] had to do some incidental renaming). - Rename pcie_restore_aspm_l1ss() to pci_restore_aspm_l1ss_state() to match. - Move the PCI_EXP_LNKCTL_ASPMC from pci_restore_aspm_state() to pci_restore_pcie_state() so both writes are in the same place. - Rename pci_aspm_get_l1ss() to pci_configure_aspm_l1ss() and add the save_buffer there as well. - Split [1/5] into two patches: move pci_configure_ltr() and pci_bridge_reconfigure_ltr() to aspm.c, and build aspm.c unconditionally. - Squash [2/5] and [3/5] since [2/5] didn't add any functionality itself so they seem like a single logical change. [1] https://lore.kernel.org/r/20230125133830.20620-1-vidyas@nvidia.com David E. Box (5): PCI/ASPM: Move pci_configure_ltr() to aspm.c PCI/ASPM: Always build aspm.c PCI/ASPM: Move pci_save_ltr_state() to aspm.c PCI/ASPM: Save L1 PM Substates Capability for suspend/resume PCI/ASPM: Call pci_save_ltr_state() from pci_save_pcie_state() drivers/pci/pci.c | 89 ++++------------ drivers/pci/pci.h | 13 ++- drivers/pci/pcie/Makefile | 2 +- drivers/pci/pcie/aspm.c | 215 ++++++++++++++++++++++++++++++++++++++ drivers/pci/probe.c | 62 +---------- include/linux/pci.h | 2 +- 6 files changed, 252 insertions(+), 131 deletions(-)