Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp3510457rwb; Mon, 7 Aug 2023 15:03:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFtAJ23uknk5ul6nEcdjGdCqc15ZSZgidXhEJA2u2QsiTCQhUhxEkxH0XpJSf6dl8t7szuw X-Received: by 2002:a17:90a:128d:b0:268:a691:412f with SMTP id g13-20020a17090a128d00b00268a691412fmr8375801pja.39.1691445794888; Mon, 07 Aug 2023 15:03:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691445794; cv=none; d=google.com; s=arc-20160816; b=BlVfV8tHUHsn9GLH6kClnMe5GulKxCFdu51jTFC740XD2KYHa8TtNxVWi/T0QeWlh1 0+jzxgD4Y1GpfCNvb96XJ4nYABa9SAZ+mfeOsKbK7erhhtCtUsvpklaUDlvFD6/k/mjc EfnAru6q/2gmc6Dqki3TMpgOSX6VMxPtuH3AGcFG/H2df3+LiWWD8EOOAoCaYJ9U9RMX YWO+AB23AVzzyJx4bRsRHDhgV5JzrUS5V0rYpaLoEqfTpeExfDxe32A38l02eaQ0Q2iB 5eu5mFfpxYP7z8eOnI0+RqMX9NvuRvoL+q+X2X54MIh5ZbqnzuN3Ub46Gi/DCQZD5mhW UjbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=WvIEaTGboMwJuS/k2b6YBv94pmgX2U83ceP6WGTpdkM=; fh=KlrEk42B44R1F6pRd1EQssGl7yUfvRArVcvpk+h5QMk=; b=S0QDn7cuAvIHSCGkuviuFX1JqmKLF65ZELdO2hVQq+aUVoQ5taBGaCdGtOkcHN/5lv nncbMWvuoiSBXuHTu17Jt00bJ7IqmbFTW+AhZDF/APKJzbdT51oXyCHJcUhevaz3RSxD FbIXwk+VkTLb1zz5F5JrJq064CweSLHog7o64FOzOZ3OMteA4Sf93ewCgk2me+yzSE1Z 9UZj7XAxHSl+gpxYBZzcEZ4Zf15BXNSo+T+LFkVJXdAEt9rd3k6KqOChHYCCp99F43xW Hr750tXvX9M3UbuVPIPW7/qsvSJ3coT6ULFbJo6nfLX6XFWUSpiM5Huatk3jeXrGNYt8 KjNQ== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lt14-20020a17090b354e00b0026811da0fafsi6310886pjb.65.2023.08.07.15.03.02; Mon, 07 Aug 2023 15:03:14 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229827AbjHGV5K (ORCPT + 99 others); Mon, 7 Aug 2023 17:57:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229590AbjHGV5I (ORCPT ); Mon, 7 Aug 2023 17:57:08 -0400 Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 925F094 for ; Mon, 7 Aug 2023 14:57:07 -0700 (PDT) Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-564af0ac494so2490089a12.0 for ; Mon, 07 Aug 2023 14:57:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691445427; x=1692050227; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WvIEaTGboMwJuS/k2b6YBv94pmgX2U83ceP6WGTpdkM=; b=CxEA1DnrJufBvFMJe9iCWLnY+6V4ZlMdCbvcdwWO8SQlAdAbPEZ7aaUY4yU7itBeqj stf2HYOTPVdGhvfQ7woSK4XHHbiCAkwLPIJ9hyJlFMb+7+hqOetmtSPli3eozooAtLH3 mx1KPRN37znObMXlgzXgkjlI1feFjpyZeJTZuja0VtaNGa733fEJxzzH1e8A/JatNOH4 kaVLQ8Z2ngCVAeRuci9IabJgIbYp5/9kGdkx1o/wembUMFT8+kBTXPWzQQJSics2ifD7 igf2UNhyrwzd9RzH5yhcR50lKV3BEgltUnCquvRW/kBL8tg0Q2ofhZzxhhkeWGsufFLA ZkeQ== X-Gm-Message-State: AOJu0YyFkiInuOa1wf0bkPNnd1ghgA1HKOJsZ0slNwlzmc3p0JQKtHS5 JA0I1NrzYV5W/EDom68BoqyNdA== X-Received: by 2002:a17:90b:38c3:b0:262:f09c:e73d with SMTP id nn3-20020a17090b38c300b00262f09ce73dmr8289917pjb.34.1691445426934; Mon, 07 Aug 2023 14:57:06 -0700 (PDT) Received: from localhost ([75.172.135.98]) by smtp.gmail.com with ESMTPSA id u19-20020a17090a891300b00267fbd521dbsm9237293pjn.5.2023.08.07.14.57.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 14:57:06 -0700 (PDT) From: Kevin Hilman To: Dhruva Gole , Andrew Davis Cc: Nishanth Menon , Tero Kristo , Santosh Shilimkar , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Viresh Kumar , Praneeth Bajjuri , Tony Lindgren , Dave Gerlach , Vibhore Vardhan , Georgi Vlaev Subject: Re: [PATCH V6 4/4] firmware: ti_sci: Introduce system suspend resume support In-Reply-To: <20230803160815.yfpkdfssv75d4inf@dhruva> 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> <8c330bd9-5f4e-8cd0-ed02-c3a696d7473a@ti.com> <20230803160815.yfpkdfssv75d4inf@dhruva> Date: Mon, 07 Aug 2023 14:57:05 -0700 Message-ID: <7ho7jifrda.fsf@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Dhruva Gole writes: > On Aug 03, 2023 at 11:00:11 -0500, Andrew Davis wrote: >> 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? > > I will make use of .suspend_noirq callbacks in that case. Does that > sound better, or is there anything else I may not be aware of? Using _noirq just moves the problem. What if other drivers are also using _noirq callbacks and run after the SCI driver? You still cannot guarantee ordering. It seems to me that the IO isolation stuff is a system-wide operation, and should probably be handled at the platform suspend_ops level (e.g. suspend_ops->prepare_late()). This would ensure that it runs *after* all the driver hooks (even driver _noirq hooks.) and right before the full suspend (or s2idle.) Now, all that being said, I noticed that in v7, you didn't move this to _noirq, but instead suggested that this be handled by TF-A. I suppose that's an option also, but my suggestion above should work also. Kevin