From patchwork Fri Sep 9 20:24:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 604736 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 151C3ECAAD3 for ; Fri, 9 Sep 2022 20:25:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229544AbiIIUZN (ORCPT ); Fri, 9 Sep 2022 16:25:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229792AbiIIUZM (ORCPT ); Fri, 9 Sep 2022 16:25:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E61EA96777; Fri, 9 Sep 2022 13:25:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7D400620BA; Fri, 9 Sep 2022 20:25:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D7C2C433D6; Fri, 9 Sep 2022 20:25:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662755109; bh=zXin2k6immi9tRPLVqcDbBOQa3ynjPMF/61sq6IxOfs=; h=From:To:Cc:Subject:Date:From; b=THWl6dZUIK4gf+Qcoy1C86uQh+oNBTxuoyebdvnf1ttaIdKiqlM3SJsz3qdoYfsjy 380DhO6arhGh5i0oIweM8c2dJuFoLlAydHYaa1louu9iUNC/50Q7Wp1kI3Su16YWT8 RSiZNFz6xV4/vqjqBLZhXbhBESqEn8mz21rW9YCLcSSiiyHU2sGh8p8P/OsOt13l7W IzX9enk3iqI13+Q4O+yRGjHH3bMhAIkjpcncf4Tm4MCb7ItXmqUyx5VBTDp7VVSPus Zd6R4JuVrwqR/aJC5VmFKSwPS/At/NyQgfF6tjDLEAbw3wleY3n9Ja7J7abOAkpfUL D+wfrbAKReo/A== From: Bjorn Helgaas To: Kai-Heng Feng , Rajvi Jingar , "Rafael J . Wysocki" Cc: Koba Ko , Mika Westerberg , "David E . Box" , Sathyanarayanan Kuppuswamy , linux-pci@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Helgaas Subject: [PATCH v4 0/9] PCI/PM: Always disable PTM for all devices during suspend Date: Fri, 9 Sep 2022 15:24:56 -0500 Message-Id: <20220909202505.314195-1-helgaas@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Bjorn Helgaas We currently disable PTM for Root Ports during suspend. Leaving PTM enabled for downstream devices causes UR errors if they send PTM Requests to upstream devices that have PTM disabled. The intent of this series is to: - Unconditionally disable PTM during suspend (even if the driver saves its own state) by moving the disable from pci_prepare_to_sleep() to pci_pm_suspend(). - Disable PTM for all devices by removing the Root Port condition and doing it early in the suspend paths. - Explicitly re-enable PTM during resume. Changes between v3 and v4: - Use u16 for ptm_cap - Add kernel-doc for pci_enable_ptm() and pci_disable_ptm() (exported functions) - Drop "Preserve PTM Root Select" (unnecessary since enabling PTM sets Root Select when needed) - Squash these three patches into one because they make more sense that way: PCI/PTM: Add suspend/resume PCI/PTM: Add pci_enable_ptm() wrapper PCI/PTM: Add pci_disable_ptm() wrapper - Add "PCI/PTM: Preserve RsvdP bits in PTM Control register" - Add "PCI/PTM: Consolidate PTM interface declarations" Bjorn Helgaas (9): PCI/PTM: Cache PTM Capability offset PCI/PTM: Add pci_upstream_ptm() helper PCI/PTM: Separate configuration and enable PCI/PTM: Add pci_suspend_ptm() and pci_resume_ptm() PCI/PTM: Move pci_ptm_info() body into its only caller PCI/PTM: Preserve RsvdP bits in PTM Control register PCI/PTM: Reorder functions in logical order PCI/PTM: Consolidate PTM interface declarations PCI/PM: Always disable PTM for all devices during suspend drivers/pci/pci-driver.c | 11 ++ drivers/pci/pci.c | 28 +-- drivers/pci/pci.h | 14 +- drivers/pci/pcie/ptm.c | 384 +++++++++++++++++++++------------------ include/linux/pci.h | 3 + 5 files changed, 234 insertions(+), 206 deletions(-) Reviewed-by: Mika Westerberg