From patchwork Sun Jan 28 23:32:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "David E. Box" X-Patchwork-Id: 19562 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp313973dyb; Sun, 28 Jan 2024 18:01:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IHLwNCmAf/kMfY5WUn/J3w9Aa503gfmQvpjrUTSmaYw6Ov77LkT48lTpJPzTdBLS8AwLsEM X-Received: by 2002:ac8:5d49:0:b0:42a:67ed:21c4 with SMTP id g9-20020ac85d49000000b0042a67ed21c4mr5217608qtx.31.1706493662175; Sun, 28 Jan 2024 18:01:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706493662; cv=pass; d=google.com; s=arc-20160816; b=JQeDw0eco7zyAVmAUIDbxTlfGt23uLZ9Ld6Rr85fum9fVkzjvXxZdZS/oANj98gVs1 +19DVKJJELy+GRQCPjCOLFvhxOokl1T0EzoVV64+EBy+Kfl/8iQzVJ/jqh5PCyK/AR83 gjorU8crrblNBwzp8svEv4lNrv9EeFNJyfmaecupcIg8pz6uh3mSMeNXbnjGaJPATnSE B39rXkpRBMvOyGtC46ZzgbYJi5tj6zXE6EttmwxSZxCg2dYQ2XhVgFg9JwU/LGPwwKNP uz75q3b/NKWgU5mK2zzrIWMbTTx/J985WTx4VLRNmaq+5dUy99JRn1iPtkRioSl3Az1K U78g== 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=MO8x0/YHNbJnEqY8Xc49gnLLxR9mHAVUEw6swXOOg/k=; fh=4cLLCZOZ1uAixzSG12P6cLh/7sn/90zAnCRwDJZB7tA=; b=URL0rCsLRU4MOXRp7N48s0dFQTQ0mxSn/WV2EGYZV1rZ9dKTAtycKXkGNathVwrqw8 S7t5BPnYyOBLgCWVBPF2vnkdmHNkL/y+69atBP3vMa7DCiqOrbbAsGjqLWCUampo0NST gex0++aYyzzuwlV753TbjgO6gL2xX2k467wy/vDF6AOBd3Zp3nKA5um/Tr8pnkOBza5i 3Sn9jW6K8azCCsQTiz2Dc1JAuFK9oITZFv3Au0EaW5fEpK/TU/HtbF1pBt4RLKlHdv8O 2/1lmucBVvuLEGzbdd+dIZvBvGDx/3dOQJO1eJbSCuCgsBWzgmqcEBxnw5hz9B8CrJLq yQlA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Tydek15V; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-42010-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42010-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 16-20020ac85910000000b0042a9afbd98bsi2656675qty.675.2024.01.28.18.01.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 18:01:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42010-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=@intel.com header.s=Intel header.b=Tydek15V; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-42010-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42010-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 3DC5F1C2207B for ; Sun, 28 Jan 2024 23:32:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 541554C637; Sun, 28 Jan 2024 23:32:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Tydek15V" Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) (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 5EC7C446CA; Sun, 28 Jan 2024 23:32:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=134.134.136.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706484736; cv=none; b=re+yVJ+rZWA1znFpRVnoPEtFC2Z7eSN4kq2zpToQJeWt9zLU3i0gdt+gYpoPI7qQlV3st7di9EgBuo08WzxbGy8puN+tBKeu7DiERFReciGH1tphLSYAr/fpmCj26XBOFZlr7lfg2ZnSwH+blR7OVQ3OxWj9/PpL80I6MqvmPug= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706484736; c=relaxed/simple; bh=O2DJ6Mu5KMdLzbxSBZdon80LtAPdKg3vJDjBKzmyAyc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=LEBx3eMWI8Ty0o8B1BIZAepnkdT9oP/gx8SIYyu/CS8VGwWsXEcxVQSEOce21ogF6VOWoUTE6ZEGY+aBQswX5lKWQHAqL1BhR5Po38gczGyiygtpVibNYkkvBpW9nbi1cKyOrImlj0lX+I3DtE2qOE3VcnWJ98DdCQAcK1zeBVE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Tydek15V; arc=none smtp.client-ip=134.134.136.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706484734; x=1738020734; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=O2DJ6Mu5KMdLzbxSBZdon80LtAPdKg3vJDjBKzmyAyc=; b=Tydek15VmtoZGZ1Up8DsMfwV4JI1u5TO0m2NcFfmPqFnBkKj6oOp9Pt4 pB6sEDVNcSAhPfB5WAeQRMvPndDp3QqynQG+P7VHNP2v1qM/gALvBKq/q dkNJLWoBe0h9D05hr5PVAYvS7Pcd5EhJuHQkZzTY4topUFXzjBJ3PrFI7 DaCBCypa2grnWGXa2KeVXe7X4ud6CRM1mmhi4wHZjCyL6FCFGD99LAAv+ E05E6J9h2wXmArPf+kN6g9E399k2m/8zV5OZxpTMuVlns7sE/71DdexKL hdtJhXTEDLwns1K6/0tQ0yCdZIeo5o5QFLZNsxB4twaY+6q49zqfCcOU8 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10967"; a="406535984" X-IronPort-AV: E=Sophos;i="6.05,226,1701158400"; d="scan'208";a="406535984" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jan 2024 15:32:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10967"; a="857921252" X-IronPort-AV: E=Sophos;i="6.05,226,1701158400"; d="scan'208";a="857921252" Received: from linux.intel.com ([10.54.29.200]) by fmsmga004.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jan 2024 15:32:12 -0800 Received: from debox1-desk4.intel.com (sdutta-mobl2.amr.corp.intel.com [10.209.55.52]) by linux.intel.com (Postfix) with ESMTP id 3036D580D78; Sun, 28 Jan 2024 15:32:12 -0800 (PST) From: "David E. Box" To: mika.westerberg@linux.intel.com, david.e.box@linux.intel.com, ilpo.jarvinen@linux.intel.com, bhelgaas@google.com, rjw@rjwysocki.net Cc: tasev.stefanoska@skynet.be, enriquezmark36@gmail.com, kernel@witt.link, wse@tuxedocomputers.com, vidyas@nvidia.com, kai.heng.feng@canonical.com, sathyanarayanan.kuppuswamy@linux.intel.com, ricky_wu@realtek.com, mario.limonciello@amd.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/5] Always build aspm.c Date: Sun, 28 Jan 2024 15:32:07 -0800 Message-Id: <20240128233212.1139663-1-david.e.box@linux.intel.com> 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: 1789388298012344624 X-GMAIL-MSGID: 1789388298012344624 Here is the series to always build aspm.c, add back L1SS save/restore, and consolidate all ASPM related code in aspm.c. Patch 1 - Moves all PCI core functions running under CONFIG_PCIEASPM into aspm.c and changes they Makefile to always build it. No functional changes. Patch 2 - Creates a separate function to save the L1SS offset and places it outside of CONFIG_PCIEASPM in aspm.c so that the offset is available for later use by the L1SS save/restore code which needs to run when CONFIG_PCIEASPM=n. Patch 3 - Updated L1 Substate save/restore patch from previous V5 [1]. Patch 4 - Moves the LTR save/restore state functions into aspm.c outside of CONFIG_PCIEASPM. Patch 5 - Moves the LTR save/restore state calls into pci_save/restore_pcie_state(). The series does not continue any of the ASPM robustness changes proposed by Ilpo [2]. But if we think it's worth combining with this series I can add it and help continue the work. [1] https://lore.kernel.org/linux-pci/20231221011250.191599-1-david.e.box@linux.intel.com/ [2] https://lore.kernel.org/linux-pci/20230918131103.24119-1-ilpo.jarvinen@linux.intel.com/ David E. Box (5): PCI: Always build aspm.c PCI: Create function to save L1SS offset PCI/ASPM: Add back L1 PM Substate save and restore PCI: Move pci_save/restore_ltr_state() to aspm.c PCI: Call LTR save/restore state from PCIe save/restore drivers/pci/pci.c | 91 ++++---------- drivers/pci/pci.h | 10 +- drivers/pci/pcie/Makefile | 2 +- drivers/pci/pcie/aspm.c | 257 ++++++++++++++++++++++++++++++++++++-- drivers/pci/probe.c | 62 +-------- include/linux/pci.h | 4 +- 6 files changed, 283 insertions(+), 143 deletions(-) base-commit: 0dd3ee31125508cd67f7e7172247f05b7fd1753a