Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp2529012rwo; Thu, 3 Aug 2023 10:39:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF7hyUHWrN9+z8h6rVz05nUa5Ct1W25Q3HfDdF7Sa9qxrrsMvVY4h30AET/Jsw03xCdmH/z X-Received: by 2002:a17:907:7883:b0:99c:7134:4f95 with SMTP id ku3-20020a170907788300b0099c71344f95mr1884426ejc.32.1691084340524; Thu, 03 Aug 2023 10:39:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691084340; cv=none; d=google.com; s=arc-20160816; b=xkBWn2dDXksHnXcivR5YNtDbCq+RL/kYM10wCRnGJFnbctSU6ssb7XTX3y5/AkxIdN EEzpl6T8Hz/9bM2kgQ8+h2JXKBcifj9dkyi3Iatz9YHGq1ldLbXi6uqn40AgRY9VeIBg dJBffhJmt3ArGF01TXYgjhmlhkgEHKJK5N6Vf1Bpb6KDidfPAzyA/e8IqE5QMJOfeVWU WlJzrTPWg3Z0dARqdLvTm3PfVRKI5LOLMuCmo59SLxhkGf8l0Yv3c1zT6tZgjhKDH2Xr PQLpG6mQzo/IZJ1k3EUv15DMJxcZpGL26/+KR8TmyU/1BMX0qem1area4jlAKEAORyTa jY/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=6WeceiBT+62w0bpe3ah2ZUYPVdg/njV3u+KqFCIMe6c=; fh=SqmNquurxR8nry4tSV8JvK5Ztys35jugocJrXNgOQRc=; b=qiaNx6Ch8qfsrCypWn492vq27JiC/T5KcJ/3G1J9ALbfYkuHKww3VKwUp5h1TojYzU YFaybfA6tYa2aLxuoM8MC1T3BJkUj5szVfIrVu23FVlA1FLEEKtfmW6PGiUupruQo94l XWOxfUvM91YE9HkuvLKJiBRdy/N5F86096bIBq4FNO5I2QC3dWj8IG57QtoLS4vpDM2B JmUb6ZO52tlc4nMcs9ETCZbs9cu2LemWEN8/Mzxs9JTM01RCNxXCkKyxGxF0KxDmK7kr GTWHW6V2aZuZOBthqCN9882L1C8lGUmCDNh///gJTFbjCU4xzJMXzXTcNrOgHcV4HEU5 T4hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="T/zevSXQ"; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s9-20020a170906354900b00992ae4dfc05si159379eja.1021.2023.08.03.10.38.36; Thu, 03 Aug 2023 10:39:00 -0700 (PDT) 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=@ti.com header.s=ti-com-17Q1 header.b="T/zevSXQ"; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236935AbjHCQBC (ORCPT + 99 others); Thu, 3 Aug 2023 12:01:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234899AbjHCQBB (ORCPT ); Thu, 3 Aug 2023 12:01:01 -0400 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BF45421E; Thu, 3 Aug 2023 09:00:39 -0700 (PDT) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 373G0DfD090675; Thu, 3 Aug 2023 11:00:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1691078413; bh=6WeceiBT+62w0bpe3ah2ZUYPVdg/njV3u+KqFCIMe6c=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=T/zevSXQSCHh5/juZBsI8HOPXwJTP66UM5YsSlAc1SrRMQkXNbv5kuAHjDdxq1FIn lrrWoTlF3byLcxOfuMWdk0ZdAdQYpTwfyqWQDn7bxCjcTk332ZO6DXtVeLtKbMRrTn l+JIXc2H0hgIeJLwNofqWgTDHw8e6OBYqh7oZP/Q= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 373G0Dhu113337 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 3 Aug 2023 11:00:13 -0500 Received: from DFLE101.ent.ti.com (10.64.6.22) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 3 Aug 2023 11:00:12 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Thu, 3 Aug 2023 11:00:12 -0500 Received: from [10.250.36.243] (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 373G0B1W012107; Thu, 3 Aug 2023 11:00:11 -0500 Message-ID: <8c330bd9-5f4e-8cd0-ed02-c3a696d7473a@ti.com> Date: Thu, 3 Aug 2023 11:00:11 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH V6 4/4] firmware: ti_sci: Introduce system suspend resume support Content-Language: en-US To: Dhruva Gole CC: Nishanth Menon , Tero Kristo , "Santosh Shilimkar" , , , , Viresh Kumar , Praneeth Bajjuri , Tony Lindgren , Dave Gerlach , Vibhore Vardhan , Georgi Vlaev References: <20230803064247.503036-1-d-gole@ti.com> <20230803064247.503036-5-d-gole@ti.com> <3882f0ac-b74c-6eb2-197c-34ca233cd7a3@ti.com> <20230803155541.nwsfwobfkbpefoyw@dhruva> From: Andrew Davis In-Reply-To: <20230803155541.nwsfwobfkbpefoyw@dhruva> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 On 8/3/23 10:55 AM, Dhruva Gole wrote: > On Aug 03, 2023 at 10:26:32 -0500, Andrew Davis wrote: >> On 8/3/23 1:42 AM, Dhruva Gole wrote: >>> Introduce system suspend resume calls that will allow the ti_sci >>> driver to support deep sleep low power mode when the user space issues a >>> suspend to mem. >>> >>> Also, write a ti_sci_prepare_system_suspend call to be used in the driver >>> suspend handler to allow the system to identify the low power mode being >>> entered and if necessary, send TISCI_MSG_PREPARE_SLEEP with information >>> about the mode is being entered and the address for allocated memory for >>> storing the context during Deep Sleep. >>> >>> We're using "pm_suspend_target_state" to map the kernel's target suspend >>> state to SysFW low power mode. Make sure this is available only when >>> CONFIG_SUSPEND is enabled. >>> >>> Co-developed-by: Dave Gerlach >>> Signed-off-by: Dave Gerlach >>> Signed-off-by: Vibhore Vardhan >>> Signed-off-by: Georgi Vlaev >>> Signed-off-by: Dhruva Gole >>> --- >>> drivers/firmware/ti_sci.c | 63 +++++++++++++++++++++++++++++++++++++++ >>> 1 file changed, 63 insertions(+) >>> > [..snip..] >>> +static int ti_sci_suspend(struct device *dev) >>> +{ >>> + struct ti_sci_info *info = dev_get_drvdata(dev); >>> + int ret; >>> + >>> + ret = ti_sci_cmd_set_io_isolation(&info->handle, TISCI_MSG_VALUE_IO_ENABLE); >> >> After this the will the IOs be in isolation? Or does the firmware wait >> until power down begins later? > > From what I understand, > IOs will be in isolation immediately > That is what I understand too, so then any device that may need to do some external communication for its suspend will not function, this must be the last driver _suspend() the system calls, how do you enforce that? Andrew >> >> Andrew >> >>> + if (ret) >>> + return ret; >>> + dev_dbg(dev, "%s: set I/O isolation: %d\n", __func__, ret); >>> + >>> + ret = ti_sci_prepare_system_suspend(info); >>> + if (ret) >>> + return ret; >>> + >>> + return 0; >>> +} >>> + >>> +static int ti_sci_resume(struct device *dev) >>> +{ >>> + struct ti_sci_info *info = dev_get_drvdata(dev); >>> + int ret; >>> + >>> + ret = ti_sci_cmd_set_io_isolation(&info->handle, TISCI_MSG_VALUE_IO_DISABLE); >>> + if (ret) >>> + return ret; >>> + dev_dbg(dev, "%s: disable I/O isolation: %d\n", __func__, ret); >>> + >>> + return 0; >>> +} >>> + >>> +static DEFINE_SIMPLE_DEV_PM_OPS(ti_sci_pm_ops, ti_sci_suspend, ti_sci_resume); >>> + >>> static int ti_sci_init_suspend(struct platform_device *pdev, >>> struct ti_sci_info *info) >>> { >>> @@ -3759,6 +3821,7 @@ static struct platform_driver ti_sci_driver = { >>> .driver = { >>> .name = "ti-sci", >>> .of_match_table = of_match_ptr(ti_sci_of_match), >>> + .pm = &ti_sci_pm_ops, >>> }, >>> }; >>> module_platform_driver(ti_sci_driver); >