From patchwork Thu Mar 2 08:36:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 6018 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4118744wrd; Thu, 2 Mar 2023 00:39:11 -0800 (PST) X-Google-Smtp-Source: AK7set8RE6c0TTsF3WIHRAL5dSmWJiivFBGO+x39lZABP6YDlix7BEMfGmpU+p0M0QL/7jALQ9oR X-Received: by 2002:a17:906:688a:b0:8b1:7e1f:91c5 with SMTP id n10-20020a170906688a00b008b17e1f91c5mr9075332ejr.35.1677746351777; Thu, 02 Mar 2023 00:39:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677746351; cv=none; d=google.com; s=arc-20160816; b=yBML+da9exjP474Jwc6O/H7e6rKQwg5Cz1E6LseJguAaj3yZ4/OyxGTHdf1Sx0Y6cE YR6pjHExmsMYeJJAxOv1wnPOJV2v2G5Xnu6S7ykKYTxFpblEbXfa5bqeU6O0V2Olj9PY wYERpCu/35NLmywf28nd1Lh/HVZRt1mBALjLiVVTyxu3JTL/Xmm/iJTF58r+pKEK4V0m kSc5/vchJB3eaKY+W3YKAaV7b0rDT5PSVesu84qZqiBzckFy/l/BveveCB4rhw17L0LJ hCyCkb2vIk+4KZqhTs1plaP5b3bLcHmosofvdn1+g5ZzapUF0mwC0yUJgoS7+hy1eWfS ROpg== 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=lzrqYLYLaVpd0UyrhZ0yR0aqCz0cuXCviR24aa0kuPw=; b=0KOzl7H5QBp3Nw95nK6dfOIKUxHVgebpcBZVWsmwyM18BaLggfq5NBmgz11jSlMdpD zKjfijnOZwFx8OqxoO/xvB+nGwajR7sZ6E8+/xogkNG+AsrI7Y5WwmuyrW+RP0zV5qYI XijI/w2uA4pcbmFfgRDcdoq/2lWoTltrhsveCGea4lW6waLg5MIwXf/8XD7pkm5VA0vm F2sk6cWYLtgwcu9GG07KHSqYSzT6zIdX/l/C7Q5Tjnn/bPVryArpxkqC58zXkThr3hw6 mBRtSBkpbyvcqZIyYEloZDSBHDEE0WewfSleYQNSEk75UGbtYmzpeTWPqemqx+zeN7Fh 0UNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D43eGydr; 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 vp11-20020a170907a48b00b008d6e551e1b9si6210864ejc.26.2023.03.02.00.38.48; Thu, 02 Mar 2023 00:39: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=D43eGydr; 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 S229691AbjCBIgn (ORCPT + 99 others); Thu, 2 Mar 2023 03:36:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229744AbjCBIgk (ORCPT ); Thu, 2 Mar 2023 03:36:40 -0500 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4113B199CC for ; Thu, 2 Mar 2023 00:36:35 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id v11so13260896plz.8 for ; Thu, 02 Mar 2023 00:36:35 -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=lzrqYLYLaVpd0UyrhZ0yR0aqCz0cuXCviR24aa0kuPw=; b=D43eGydreZR1VKVNvxdCLXaLMjZQGQzTS38Jo088r8l4Eepbu5JxDDCNecIGPi38Su Je57YvFacOR6isjgT/KYGTV+qijaz6DVD9kcCtAbbfJORvRabkcBs28mgi/cbR9t24rr RIz8+acB3dX6x8c03CjeFen3gCE3t4dHY20BH+LY3KybsYfa4XJ0lVTsDDKt2oSOf1sG HSx5utpv50HwHOGOnPimcYmU1oo7gPSrkwHHvukr4cc34DxI3Umw+1bjFkSx7UKZJymE jDHZ23+4P0UHnUZEthOHPNPHWh7bBsi71sZSBsI7MOqVgGz3yKIZoTloQV0i6X8MoFSn BvjQ== 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=lzrqYLYLaVpd0UyrhZ0yR0aqCz0cuXCviR24aa0kuPw=; b=p+BdF5o01KgCWBIg1sF/1aEvq8bcPiRu9H1IAcgLegnmBw7p+WOGfjWQ+9WMVx/5Fu FVwIYyuP0k6TrsYOwOOk3VlcKD15az/AmDToQgPmXVx52SX+PonpRaQzlax50U3ZOvAS 98LNRPPItZOmIcDioK9nkJdphnc8FM24dqhmDiIWvrFa64YESDuldWw6+MgIIsL+8Saj eSmIMrdkWU/Z5RDKgupDcwSfw8pnYX0oVdzaq8RhlPwRoi0SzEk/ar2LoxUsEs9WyFqa vJs866zy7xhfDT1s1qRgIWLiT78hDGCo94Oe7C6XDhdwJJXKWDHxUHQsQUgkf6qULCZP HumQ== X-Gm-Message-State: AO0yUKU9WcQbFrbkj+HxZ/kHK/m35mUx9iSESe7KW5HGLLGwp/msVkab 1FpaabO+GKAbfIesHSXXSY2C X-Received: by 2002:a17:902:8603:b0:19e:711b:83c with SMTP id f3-20020a170902860300b0019e711b083cmr878146plo.39.1677746194689; Thu, 02 Mar 2023 00:36:34 -0800 (PST) Received: from localhost.localdomain ([59.97.53.52]) by smtp.gmail.com with ESMTPSA id p7-20020a1709028a8700b00198ef93d556sm9791912plo.147.2023.03.02.00.36.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 00:36:34 -0800 (PST) From: Manivannan Sadhasivam To: lpieralisi@kernel.org, kw@linux.com, robh@kernel.org Cc: andersson@kernel.org, konrad.dybcio@linaro.org, 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, mka@chromium.org, Manivannan Sadhasivam Subject: [PATCH v2 0/1] PCI: qcom: Add support for system suspend and resume Date: Thu, 2 Mar 2023 14:06:24 +0530 Message-Id: <20230302083625.188482-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?1759244558923001577?= X-GMAIL-MSGID: =?utf-8?q?1759244558923001577?= 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. 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/ Changes in v2: * Used minimum icc vote to keep data path functional during suspend * Collected Ack Manivannan Sadhasivam (1): PCI: qcom: Add support for system suspend and resume drivers/pci/controller/dwc/pcie-qcom.c | 53 ++++++++++++++++++++++++++ 1 file changed, 53 insertions(+)