From nobody Fri May 8 01:45:23 2026 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 B921BC433F5 for ; Fri, 13 May 2022 11:01:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379679AbiEMLBF (ORCPT ); Fri, 13 May 2022 07:01:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379660AbiEMLA5 (ORCPT ); Fri, 13 May 2022 07:00:57 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D38C1C91F for ; Fri, 13 May 2022 04:00:55 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id c11so7566986plg.13 for ; Fri, 13 May 2022 04:00:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uGswQ0aP97Suern/pqvhLGTEOIpF5J5h2MoXW5LuuBU=; b=ZF7r2l+HwxQm5PA8mve2cF+rBwKjnM+0fSfGGdoNA3T0LJdycXkCGWLrykpa8sL/oD 08lIP8dZt0wAe2tK+75oTRz1risNDIOCOSiRaW+GZokpCuhe+9MrL2YynteMMnYHDR3H ItIDcdINQ82V0AG+st+raJapxxBHOih2yAPagaFk64puhsJ/iztuWI2Rf4eKJ19ZFuSX YL/pLIatMsl2o8QBgjy0eNGResBVvt2NP3Y80kDYZiv7AA+gsRPYm0wGgSd7CPa4mYRN F4q7pPFCxNNeVHCsbD+3J+hjPwmsRQyClY9uud0L4zXlaFzZ+hz0uXVv3kgKtKaDXw60 Pa+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uGswQ0aP97Suern/pqvhLGTEOIpF5J5h2MoXW5LuuBU=; b=a2Jj7r5JP+SJVfibAd6VN2gZmMlw0Vuj1LH1KeYOOQC/eT/7cwjH04g3udrrqXCeOP bM3QXBLl4w7URMdcwlADGymxhnrolsXTIOVDzPkxTsIuHrj4tbcLC4opGnXrULm1fDST sbOpJrahp/u0xuTxLqt5MvuahklCcuyxYJ9Cn456M9OW/cmqi2wAKaM3praU4FOhUpGA 7+aJd9q/mF5myxdHWswjPPdv2pz8/CW//nwY47W8TZZpSfYxC98t3nX8feDIk0qDmsSD iBq2GWjr0p4gbIJBHn1PVCmZ7dSfJgOKc2j1/0knWwF5uoUqCtN5izjady8EwD8KPUL2 I8SQ== X-Gm-Message-State: AOAM530dCwA653JWkvHHYJ5Cc+8ZsmPpXEmbEaESXKR4ZP1pwWNBxunK /HJ3g3knpaRFN+DyCB3vjFgh X-Google-Smtp-Source: ABdhPJyTPQtQvf4t/ey8cvG54O7pCIiYbK85D35VbK5tYExzPBijKVc7qymid6BgehggfTgPgOcVnw== X-Received: by 2002:a17:902:7586:b0:15e:c2fe:bad0 with SMTP id j6-20020a170902758600b0015ec2febad0mr3948667pll.72.1652439654573; Fri, 13 May 2022 04:00:54 -0700 (PDT) Received: from localhost.localdomain ([117.202.184.202]) by smtp.gmail.com with ESMTPSA id u36-20020a631424000000b003db0f2d135esm1322120pgl.49.2022.05.13.04.00.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 04:00:54 -0700 (PDT) From: Manivannan Sadhasivam To: bhelgaas@google.com, lorenzo.pieralisi@arm.com, kbusch@kernel.org, hch@lst.de Cc: linux-nvme@lists.infradead.org, linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, svarbanov@mm-sol.com, bjorn.andersson@linaro.org, axboe@fb.com, quic_vbadigan@quicinc.com, quic_krichai@quicinc.com, quic_nitirawa@quicinc.com, vidyas@nvidia.com, sagi@grimberg.me, Manivannan Sadhasivam Subject: [PATCH 1/3] PCI: Add a flag to notify PCI drivers about powerdown during suspend Date: Fri, 13 May 2022 16:30:25 +0530 Message-Id: <20220513110027.31015-2-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220513110027.31015-1-manivannan.sadhasivam@linaro.org> References: <20220513110027.31015-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" On some systems like Chromebooks based on Qcom chipsets, the OS may powerdown all PCIe devices during system suspend for aggressive powersaving. In that case, the PCI host controller drivers need to notify the PCI device drivers that the power will be taken off during system suspend so that the drivers can prepare the devices accordingly. One prime example is the PCI NVMe driver. This flag can be used by the driver to shutdown the NVMe device during suspend and recover it during resume. Signed-off-by: Manivannan Sadhasivam Acked-by: Christoph Hellwig --- include/linux/pci.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/pci.h b/include/linux/pci.h index 60adf42460ab..069caf1fe88d 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -578,6 +578,7 @@ struct pci_host_bridge { unsigned int preserve_config:1; /* Preserve FW resource setup */ unsigned int size_windows:1; /* Enable root bus sizing */ unsigned int msi_domain:1; /* Bridge wants MSI domain */ + unsigned int suspend_poweroff:1; /* OS may poweroff devices during system= suspend */ =20 /* Resource alignment requirements */ resource_size_t (*align_resource)(struct pci_dev *dev, --=20 2.25.1 From nobody Fri May 8 01:45:23 2026 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 1C797C433F5 for ; Fri, 13 May 2022 11:01:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379688AbiEMLBL (ORCPT ); Fri, 13 May 2022 07:01:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379674AbiEMLBF (ORCPT ); Fri, 13 May 2022 07:01:05 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F097F29C90 for ; Fri, 13 May 2022 04:01:02 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id x52so7351431pfu.11 for ; Fri, 13 May 2022 04:01:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZsD7LJRkuECyYX1jGlfTiXHU1Ijh0jPTLQ2k9fUhrL4=; b=QiA79YYEX5J9Cz/ubTy3uRnX00TKZfSieKIylSPlqoMh6cybvG0v6NWiRbpuIbSfd4 Sg6gFMhz4XRhjovPrMvP4JHa9cpy1RtHVD3W8ZH5nonlK8GBPfG8TZM1Oigbjd8ktjPu I5ajvo1NSSx0d6NQj58DvBg+rOuoKgiDFSFGVMJLmenRCGPLdU/EjXWFZJlTcNUvWUK/ 4nvf5UFYfVAZPPDC1sApcVOtsIfEl16Wn32QPMG9AxzU3sBwVPoi6wTjYWscLKHSqWCF GJjkosFZBfUJYOhl5VXrovgcrSniLe7jdBcmGv4ChD7xvrbSJSnxKcsgLoV67XeoRTD/ 4gTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZsD7LJRkuECyYX1jGlfTiXHU1Ijh0jPTLQ2k9fUhrL4=; b=sYPMTPPSh79nUS5z9ct/AE74kbRlMqgsf+750rt0p1posrrwQclhPyD9eP6GoimQP0 8Y+8TaEhTIznEDoBsrfFbvrtpmF+CTWIuDmx+GLYYKBOdWGQqksjNQ5UdqRPgbSI9mif nBvd2XPFmdlVlgxjtDY+ieoyyx1lqBEMX6BsyozZmCb88RtKhtLXu9mC9DR7u3OKvx1X RM3u5J9xJO3ihGPKnamEDUfEGyU0cjwxttfVqQEKTwT2gGSDur9T+G2LIc7aCnVZfTQq nfXIJ5WJLj92Je6XFxK2m4ZFoH3M5P/7Y7jBigmcuMwCas28RXusiUvHbPtT2uD/FSTh ja3w== X-Gm-Message-State: AOAM533BDgPO0McolH+hL6rlUhTyizOrO5Fu35P9T0V0+l1fru9NY9d9 UqbLwFB1t5JhH7IlU3c8UyCi X-Google-Smtp-Source: ABdhPJy6supPwd4jHaESPrjZJsyad5J2wl3TDO2EQ8PzZO62JGRs3jBDxNtnqMckk0JHMD7+cNctsA== X-Received: by 2002:a63:8143:0:b0:3da:eb5e:2833 with SMTP id t64-20020a638143000000b003daeb5e2833mr3514458pgd.426.1652439661640; Fri, 13 May 2022 04:01:01 -0700 (PDT) Received: from localhost.localdomain ([117.202.184.202]) by smtp.gmail.com with ESMTPSA id u36-20020a631424000000b003db0f2d135esm1322120pgl.49.2022.05.13.04.00.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 04:01:01 -0700 (PDT) From: Manivannan Sadhasivam To: bhelgaas@google.com, lorenzo.pieralisi@arm.com, kbusch@kernel.org, hch@lst.de Cc: linux-nvme@lists.infradead.org, linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, svarbanov@mm-sol.com, bjorn.andersson@linaro.org, axboe@fb.com, quic_vbadigan@quicinc.com, quic_krichai@quicinc.com, quic_nitirawa@quicinc.com, vidyas@nvidia.com, sagi@grimberg.me, Manivannan Sadhasivam Subject: [PATCH 2/3] PCI: dwc: qcom: Set suspend_poweroff flag for SC7280 Date: Fri, 13 May 2022 16:30:26 +0530 Message-Id: <20220513110027.31015-3-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220513110027.31015-1-manivannan.sadhasivam@linaro.org> References: <20220513110027.31015-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" For aggressive power saving on SC7280 SoCs, the power for the PCI devices will be taken off during system suspend. Hence, notify the same to the PCI device drivers using "suspend_poweroff" flag so that the drivers can prepare the PCI devices to handle the poweroff and recover them during resume. Signed-off-by: Manivannan Sadhasivam Acked-by: Christoph Hellwig --- drivers/pci/controller/dwc/pcie-qcom.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controlle= r/dwc/pcie-qcom.c index 6ab90891801d..4b0ad2827f8f 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -199,6 +199,7 @@ struct qcom_pcie_cfg { unsigned int has_ddrss_sf_tbu_clk:1; unsigned int has_aggre0_clk:1; unsigned int has_aggre1_clk:1; + unsigned int suspend_poweroff:1; }; =20 struct qcom_pcie { @@ -1220,6 +1221,10 @@ static int qcom_pcie_init_2_7_0(struct qcom_pcie *pc= ie) if (pcie->cfg->pipe_clk_need_muxing) clk_set_parent(res->pipe_clk_src, res->ref_clk_src); =20 + /* Indicate PCI device drivers that the power will be taken off during sy= stem suspend */ + if (pcie->cfg->suspend_poweroff) + pci->pp.bridge->suspend_poweroff =3D true; + ret =3D clk_bulk_prepare_enable(res->num_clks, res->clks); if (ret < 0) goto err_disable_regulators; @@ -1548,6 +1553,7 @@ static const struct qcom_pcie_cfg sc7280_cfg =3D { .ops =3D &ops_1_9_0, .has_tbu_clk =3D true, .pipe_clk_need_muxing =3D true, + .suspend_poweroff =3D true, }; =20 static const struct dw_pcie_ops dw_pcie_ops =3D { --=20 2.25.1 From nobody Fri May 8 01:45:23 2026 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 66C3EC433EF for ; Fri, 13 May 2022 11:01:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379695AbiEMLBS (ORCPT ); Fri, 13 May 2022 07:01:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379691AbiEMLBN (ORCPT ); Fri, 13 May 2022 07:01:13 -0400 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 493EA2CE1E for ; Fri, 13 May 2022 04:01:09 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id s14so7595434plk.8 for ; Fri, 13 May 2022 04:01:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rZc+ZqV9Fkq91rBB6JPn5eaAWDfpttSNOSYA1C21ZVY=; b=pPqBmjnZOoOPlVo0vS3Kq5A1Li96cT/0G84V1o8+RlSNVv7m0HEuPeYvCLSi1nkYoC gwTrsOZWLoI+dCHJyxAVf1jg/Hd4WNlFvDvYxmSNF6G6A6m1W3OpWNA5nH8SwZDn0ZGB WkTWI60LUZ6oZUKzdcUm0jJIUhayWiBdAR8zv2fsdYbsyNVpkbOowyf/peNBHj3ShshC hzONZ0Y92wEv13CmZ1vpoL2VdNLp7mf+h8rkZPXzOK2F5NY/bNIjJqQPbmUtg6RrFI+W ClCWj6S5Md5mPvHMMsA9g5485z2ewbeXK1NmqZCNpto4oV04yglFWSJVHnqziIA+yV0A spqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rZc+ZqV9Fkq91rBB6JPn5eaAWDfpttSNOSYA1C21ZVY=; b=Q9MaPaBySVVoP66llT0MWUvCN7q0Doic6xgQsh+NXzOqoK9wcYi5Riu15D6gadrFlU ec6bFVPHS7S0kFn8H2420lAViyIlA4SjNhBX69YDWa03E9CgC6RO6pJguO2RdlSNSf+N u68mEeMhMncLn/OBTRieUYBX6qbYa8a8f0w7MI7BVug5o3s9b68A7Jmc+xjCvevVyegf lB6r8TCkiQKA6e4cOLAmtfrl4mQRvis/V/XEVwDO3KYalepe9eaS7Sh8IJOt9y25jouH 960/UB2TpfSTs2jh/0MfIZoJlN21y5qAJMp0+hKVVRMIX1cb3AoCgCRUWiUrONA596g3 gSMQ== X-Gm-Message-State: AOAM533Y6hjbwd/evhk0s8vcKLuB6oxxR9MX74cRMbdBaW0Z6MU8J4xY +60e+e1BVtSSbNKmtNVLIIQk X-Google-Smtp-Source: ABdhPJwD0Z+7FM+VHC2wrC77McNhcou7ndf9igJr4nAQPy42aOvFNAEgKU/2wJsekaBdW4P9tQhvCQ== X-Received: by 2002:a17:90b:1bc2:b0:1de:dac7:6124 with SMTP id oa2-20020a17090b1bc200b001dedac76124mr8423475pjb.162.1652439668454; Fri, 13 May 2022 04:01:08 -0700 (PDT) Received: from localhost.localdomain ([117.202.184.202]) by smtp.gmail.com with ESMTPSA id u36-20020a631424000000b003db0f2d135esm1322120pgl.49.2022.05.13.04.01.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 04:01:08 -0700 (PDT) From: Manivannan Sadhasivam To: bhelgaas@google.com, lorenzo.pieralisi@arm.com, kbusch@kernel.org, hch@lst.de Cc: linux-nvme@lists.infradead.org, linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, svarbanov@mm-sol.com, bjorn.andersson@linaro.org, axboe@fb.com, quic_vbadigan@quicinc.com, quic_krichai@quicinc.com, quic_nitirawa@quicinc.com, vidyas@nvidia.com, sagi@grimberg.me, Manivannan Sadhasivam Subject: [PATCH 3/3] nvme-pci: Make use of "suspend_poweroff" flag during system suspend Date: Fri, 13 May 2022 16:30:27 +0530 Message-Id: <20220513110027.31015-4-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220513110027.31015-1-manivannan.sadhasivam@linaro.org> References: <20220513110027.31015-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" On some platforms, the power to the PCI devices will be taken off during system suspend. For these platforms, the PCI RC will set the "system_poweroff" flag to notify the PCI device drivers of the poweroff scenario. Hence, make use of the flag in the system suspend path and if set, properly shutdown the device. Signed-off-by: Manivannan Sadhasivam Acked-by: Christoph Hellwig --- drivers/nvme/host/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index d817ca17463e..381bf0c7cf8d 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -3238,6 +3238,7 @@ static int nvme_suspend(struct device *dev) { struct pci_dev *pdev =3D to_pci_dev(dev); struct nvme_dev *ndev =3D pci_get_drvdata(pdev); + struct pci_host_bridge *bridge =3D pci_find_host_bridge(pdev->bus); struct nvme_ctrl *ctrl =3D &ndev->ctrl; int ret =3D -EBUSY; =20 @@ -3257,7 +3258,7 @@ static int nvme_suspend(struct device *dev) * state (which may not be possible if the link is up). */ if (pm_suspend_via_firmware() || !ctrl->npss || - !pcie_aspm_enabled(pdev) || + !pcie_aspm_enabled(pdev) || bridge->suspend_poweroff || (ndev->ctrl.quirks & NVME_QUIRK_SIMPLE_SUSPEND)) return nvme_disable_prepare_reset(ndev, true); =20 --=20 2.25.1