From patchwork Tue Jan 3 07:49:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 3481 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4491862wrt; Mon, 2 Jan 2023 23:53:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXtFiuVlDbP3eErvJd+snUQDa76MAptX/aPt/LLY/FAHmmCtV2cC/0m5f0FzgbkIa06bW/tO X-Received: by 2002:a05:6402:408:b0:482:74a:c3d9 with SMTP id q8-20020a056402040800b00482074ac3d9mr31257031edv.23.1672732391069; Mon, 02 Jan 2023 23:53:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672732391; cv=none; d=google.com; s=arc-20160816; b=rgEsGyiRwMKYYNxLcl+FaLopdTIZLHBS27Dg7wkxLCxZnvK6nQlweR2ipY+u39fLzA UYvHLONY0QdKy7gGZNyNoVNEnhSjrvAPO+OZW9VEQNNnElZRTcMJjt8jcAnFiVDaDgkp qIZyis2ypRfRFVwnP9UQJOMHGTXDmRwCko4KL6m7CloKlWMe6ghllHM/4JyX44k7B7uR etie2dZBKgG1bp6u86tO6Vycasma4R9yO//QndoBaw4X2AeA9ZwcRCToO/keJp7JCWIx JZyeg3V+tokXClKx+rNlP4Ub/myfcVbSYGuzwCSnOqDUosHEH4+iyx8q8XDJuXm00MMq um9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=2bQEpT5MvpfK5tRet1xVf2lC1kbc6OSmWkVz7dqkqMM=; b=ueFQDkZpc2RDhvsj3Gmv+a+F1hiw/YzRMveQXXpT4UfiB4pbkf4KxnyETvS6EBnV9A aNJB4UNV7XVUqxvqIYKeAevwIeJZVf9DZ+TSziAGVEFV5LDBqmHwD/kRE4R4Qh59pTEb o5cRL1Wt5VFD6CU1aDNcziKvi7YZWEd/qoE4GGlXcEw1NuYB0ocSh+0veUeIU1uP1mTJ QlnHquFNoDuBR7JtY9P0MoKU2R4EDhzTEzfWL4s3kuX7sBY/Z8N4hjU3tmK0RJp42vUS Vk1hiOKZe3jT0mIevlCIyxDWHKFRXeQ6rkzlXudtBqQbS/UyeqvHsfA//X3MENZTC8Lm iLwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K53cKFoe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s24-20020a056402015800b0048e855518f6si4067714edu.296.2023.01.02.23.52.47; Mon, 02 Jan 2023 23:53:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K53cKFoe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230389AbjACHte (ORCPT + 99 others); Tue, 3 Jan 2023 02:49:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230478AbjACHtd (ORCPT ); Tue, 3 Jan 2023 02:49:33 -0500 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC91FDEE2 for ; Mon, 2 Jan 2023 23:49:31 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id v13-20020a17090a6b0d00b00219c3be9830so30293115pjj.4 for ; Mon, 02 Jan 2023 23:49:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=2bQEpT5MvpfK5tRet1xVf2lC1kbc6OSmWkVz7dqkqMM=; b=K53cKFoe7bZhP1UOS8i3DRf/wKlU1n8Z5hEhsZdGhtiNetXRryOIvnersLNAqAGJLR W9qXHQTeW7PgVK/R2qgijHCrAHhj+hAFesxPJkKOrrG4jvOZy8v96l1SXkh6qdo5YAKP veEwg33O3vv/vRitpyQDgSqfvAeiK3olVvzRxu6roN8ZLFIM1AYbPT7Bx7SVutxTy2l8 B/DQIOubhXSmizOsMH1G98H9ipXr7oIIB5gFxIWRMHdsbxs4EWzLXYpr0dBexvyLeT/Z AwpKIKI5uPORbIe60HcBCA9uaIlo8SSxCaAKUPZ1ag4HYPMRlm7I/E2aoT5TtgYzWxcd bVtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2bQEpT5MvpfK5tRet1xVf2lC1kbc6OSmWkVz7dqkqMM=; b=qcDK1SlNfgrL5IxvEq8Nuvy9M4VFjl2uiqS49xdlr8opvj78yjhqqNjvbrSxy1zwuo YwdHEZs8/Vunt2sLvepd9wNxhV6wqwzIX1U6IfJnCHzU8IQ43rIpqRKHwArowXsMlgZ1 v9krjHfCAdU3gewD/orXABP6WztWfz4r/zkrUkbtfZCP2bD4T2rLXdwkvTPS5Dtg7DQ+ wNAItk5cqY2SFg2HRGxK3873NOSndb/lmfFken4urt+CsdZTER4i0lXNMeO2b4mbbRg6 UQm79OvwdfZXhlHsQrbvoeqyV17DKeLf61w4NwZfsL9oQkGjXtFvOam8sIxEIcKlOfU4 aM2g== X-Gm-Message-State: AFqh2kp0tE7srOsNUe7+j5D5aG25C8fi0JI6G+29ayoB2IKPcKNPmALS RCaGuP+1KUFLRuBiphQhEtmB X-Received: by 2002:a17:902:7048:b0:18f:438a:cfe1 with SMTP id h8-20020a170902704800b0018f438acfe1mr47197819plt.59.1672732171238; Mon, 02 Jan 2023 23:49:31 -0800 (PST) Received: from localhost.localdomain ([220.158.158.30]) by smtp.gmail.com with ESMTPSA id q15-20020a17090311cf00b00189f2fdc178sm21488305plh.177.2023.01.02.23.49.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Jan 2023 23:49:30 -0800 (PST) From: Manivannan Sadhasivam To: lpieralisi@kernel.org, robh@kernel.org Cc: andersson@kernel.org, konrad.dybcio@linaro.org, kw@linux.com, bhelgaas@google.com, linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, quic_krichai@quicinc.com, johan+linaro@kernel.org, steev@kali.org, Manivannan Sadhasivam Subject: [PATCH 0/1] PCI: qcom: Add support for system suspend and resume Date: Tue, 3 Jan 2023 13:19:06 +0530 Message-Id: <20230103074907.12784-1-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753987007799595606?= X-GMAIL-MSGID: =?utf-8?q?1753987039897904144?= Hello, This series (a single patch) adds the system suspend and resume support to the Qualcomm PCIe RC controller. Background ========== There were previous attempts [1][2] to add system suspend and resume support to this driver. In previous versions, the controller was put into low power mode by turning OFF the resources even if there were active PCIe devices connected. Thanks to Qualcomm's internal power topology, the link did not enter L2/L3 state and the devices were still powered ON. But during very late end of suspend cycle, kernel tried to disable MSIs of the PCIe devices. This caused access violations as the resources needed to access the PCIe devices config space were turned OFF. Series [1] worked around this issue by not accessing the PCIe config space if the link was down in dw_msi_{un}mask_irq() functions. But that approach was not accepted. Then, series [2] implemented the suspend and resume operations using the syscore framework that disabled the resources at the end of the suspend cycle. But that approach also did not get much acceptance. Proposal ======== So the proposal here is to just vote for minimal interconnect bandwidth and not turn OFF the resources if there are active PCIe devices connected to the controllers. This avoids the access violation issue during suspend and also saves some power due to the lower interconnect bandwidth used. Then if there are no active PCIe devices connected to the controller, the resources are turned OFF completely and brought back during resume. This also saves power if there are controllers in a system without any devices connected. Testing ======= This series has been tested on Lenovo Thinkpad X13s. Dependency ========== This series depends on the host_deinit() callback patch [3] submitted by Johan. Thanks, Mani [1] https://lore.kernel.org/linux-pci/1656055682-18817-1-git-send-email-quic_krichai@quicinc.com/ [2] https://lore.kernel.org/linux-pci/1663669347-29308-1-git-send-email-quic_krichai@quicinc.com/ [3] https://lore.kernel.org/linux-pci/20230102174313.GC16638@thinkpad/ Manivannan Sadhasivam (1): PCI: qcom: Add support for system suspend and resume drivers/pci/controller/dwc/pcie-qcom.c | 52 ++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)