From patchwork Mon Apr 3 15:49:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 669834 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 E3EADC761A6 for ; Mon, 3 Apr 2023 15:50:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232565AbjDCPuI (ORCPT ); Mon, 3 Apr 2023 11:50:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232572AbjDCPuG (ORCPT ); Mon, 3 Apr 2023 11:50:06 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3B99210E for ; Mon, 3 Apr 2023 08:49:36 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id mp3-20020a17090b190300b0023fcc8ce113so32995808pjb.4 for ; Mon, 03 Apr 2023 08:49:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680536969; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=sjdpEr1kbdCek7+Xx4AMcpWMybctv63LfhzPtH0NYpI=; b=Ffq+9Ao/yKeSVo9K+0CQxyz3aN64b8sLF8aki0lQyNqP3Rgvqt9paDWEKXq4gLoA8V fMVGj5THzkvpBXY4DRwYufLgtmUtpDtU9iIha2pb3Wo3TmV+eIQiCgMVs4AW1F1cDJcK D1pYHuFEnxhgSCTelEMYMQPBC3FGdEH1npol0woxbt/T9ry1dGMOb4/2h0zKbHTapFYE 2t8lFHKv7CUA6SqYfFMBKHwaKx3r84BAHtskBADkGyPBt5XWaJZ5uZs0c7kPT4tLyW9Z 5N6ezanrfYsWpNFrvPZjKFv8iGQWaZumMCnnChY7UNmbOkPqT6maiV5SMpldBD7U5gO0 UMHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680536969; 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=sjdpEr1kbdCek7+Xx4AMcpWMybctv63LfhzPtH0NYpI=; b=NHxMmg+7qccyMje2fN0mXIa9SROUQdYdi2zsW/C++T1K8k3H0YDWKIstgAeN11h+q2 kcV2Czhnr0mTveloLvVf+L3DFcfU9ZNgI4Q1GcusftWFAgmRmgkxAHvhWv++dhJnZ10c rIOPcHvYWUgadzr659y7iXqZkCXwwx1vx0xqKDosKn4R6ru71qqN1VY0GgJw1pUmhIP5 1O4xfYtzo6hgqtSa+UWzeogCluYv6mtFb2S9ahF5JSBDBNpudM9NyuVQdQYBbaiGUrTp jf9IJ6TZeFoFKBMQXLFsEe0eK0VcRiPVs45bQixQNPXd9FM/m0gtxaqmY+tt1SYX0ovi Z4Yg== X-Gm-Message-State: AAQBX9e6BSjn3X83RTWQz5dqHkK3spQR6sBnqkgptWV+D5TeDrFAGQmp goR92T7634Yu1HDVeNuVSo5V X-Google-Smtp-Source: AKy350bLVLkvH5+SJ7RuR133hSaDHPSe+UDoAzkm/zI1o2vRWweDiIcYX69H5D4GqOcdySwY0DDySQ== X-Received: by 2002:a17:90b:1b48:b0:23d:2532:ae34 with SMTP id nv8-20020a17090b1b4800b0023d2532ae34mr18497287pjb.2.1680536968965; Mon, 03 Apr 2023 08:49:28 -0700 (PDT) Received: from localhost.localdomain ([27.111.75.109]) by smtp.gmail.com with ESMTPSA id c10-20020a17090a020a00b0023af4eb597csm9621534pjc.52.2023.04.03.08.49.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Apr 2023 08:49:28 -0700 (PDT) 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 v4 0/1] PCI: qcom: Add support for system suspend and resume Date: Mon, 3 Apr 2023 21:19:21 +0530 Message-Id: <20230403154922.20704-1-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 to keep the interconnect path active 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 v4: * Used 1KiB interconnect bandwidth during suspend Changes in v3: * Limited comments to 80 column * Added error handling in resume_noirq() 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 | 62 ++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) Reviewed-by: Johan Hovold Tested-by: Johan Hovold