Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1858138rdb; Mon, 8 Jan 2024 12:35:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IFiewcYgpJAivGP9cVbi3yX7FX2hIWWIcg0EAHiodlz1160Th3yXnG+hFBcrB8KMkR1u7O3 X-Received: by 2002:a05:6808:2e9a:b0:3bc:30d4:5945 with SMTP id gt26-20020a0568082e9a00b003bc30d45945mr6649863oib.106.1704746111135; Mon, 08 Jan 2024 12:35:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704746111; cv=none; d=google.com; s=arc-20160816; b=KM/1nukfePvpYtqc+ZM5T+t4IwzKHZl+pcGSRWmwmystZhpd/5FZfxO+EZdN9cnznI VzDkRyqzcA543Zq85MJaqdtHRgNG2vMHb4yp4OlAfnV7M8ykUf17fDpAaP0qiWjKrLfL Fmxsc13r4IF3+EUB6qUvx9/hW0W1N0vP6KQksbF9lz4ce6X2uW6u7mY9l2PJwzCvknFO /LUk3D2OqCpYCGNsJuPFDWcNdi32MAsswcxLrmGOEdUZc30VZ9AW2buaUNJ9oQ61PrTw LPAnvxF1VAdMUMvv2DPfEAfyDEZZlhBcDD6hc1xFlLBeXrr8U7ZmzjOYkOqOy99Eo3Yj 9Wng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=yYh3djo7Ru4Z5ZtykqLjpOarsfqN3DpjQBqbeSDNQis=; fh=8kTVWJ9beT81TW58AW79JP696pzeBmR4WW8tZP1cmrk=; b=LVhUEwVQytjLDg0c9nzQ0QtkOKo1/ZJAu561pDBIu1nQdxeGb7cMVkHbFAiNbOgA9J 4bmWxTCZ8nxcHO3ZDyqADQRrPKpyid5P+ZLdY1de4uLQEc+l2fVexazdC9ZaCoHQkxJY F/U1rfvr5ZH+qk7br+3LqQ690Qw8d06ypzakk4u9y27jkHgL079Hu42UO6vbHNRgaYhd GXYOrLY4wEbLfNCE8Kb27zDEf8k4BNEPCZk1w97wkufedyVwqxmwJdidjpOviE2xoz7W fOHMn10rXVvJveI5K/zcv2+Vps0gOIXqao2aCyzNkmAGc1YiG/1s71Z82/1zaJTw8+Oc QCLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-20093-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20093-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id r1-20020a0c8d01000000b0068066068c16si663362qvb.474.2024.01.08.12.35.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 12:35:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20093-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-20093-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20093-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6BA211C2318B for ; Mon, 8 Jan 2024 20:35:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C5B2155E58; Mon, 8 Jan 2024 20:35:01 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1803D55E43 for ; Mon, 8 Jan 2024 20:34:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 13052C15; Mon, 8 Jan 2024 12:35:44 -0800 (PST) Received: from bogus (unknown [10.57.74.54]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0F4A43F73F; Mon, 8 Jan 2024 12:34:56 -0800 (PST) Date: Mon, 8 Jan 2024 20:31:50 +0000 From: Sudeep Holla To: Konrad Dybcio Cc: Mark Rutland , Sudeep Holla , Lorenzo Pieralisi , Marijn Suijten , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bjorn Andersson Subject: Re: [PATCH 2/2] firmware/psci: Set pm_set_resume/suspend_via_firmware() on qcom Message-ID: <20240108203150.cx2kswpfcfmouv76@bogus> References: <20231227-topic-psci_fw_sus-v1-0-6910add70bf3@linaro.org> <20231227-topic-psci_fw_sus-v1-2-6910add70bf3@linaro.org> <20231228102801.fzaubcjq5thfwgxg@bogus> <20231228115053.zlypgc5uxxvghi4a@bogus> <376d3040-b9ed-4574-90d7-fb864d694e3c@linaro.org> <20231228124348.mmtceqeuean7ly6y@bogus> <7e31d489-de96-42f0-a72a-a581859e7131@linaro.org> <20240103094442.mlh2pf3odof3ze3s@bogus> <5499a078-a4de-47fb-ad2c-aa478699eb77@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5499a078-a4de-47fb-ad2c-aa478699eb77@kernel.org> On Mon, Jan 08, 2024 at 04:47:05PM +0100, Konrad Dybcio wrote: > On 3.01.2024 10:44, Sudeep Holla wrote: > > > > But I don't like the Qualcomm specific changes. > > Is that because of the matching table, or due to the slightly more > convoluted way of suspending the platform through CPU_SUSPEND? > I would say both. I don't like this to be Qualcomm platform specific feature. Also advertising absence of system suspend on those platforms as presence of some special system suspend. It simply is not system suspend. The sysfs hides/abstracts and provides s2idle even when user request s2r on such platforms. We should advertise it as s2idle. I would do something like below patch, just a rough idea, not compiled or tested. This avoids any misleading or confusion IMO. However I am interested in knowing which are these drivers that rely on the pm_suspend_global_flags ? The reason I ask the x86 ACPI doesn't set the flags for s2idle. Also the core code explicitly calls pm_set_suspend_no_platform() in suspend_devices_and_enter(). What you want conflicts with both the above observations. I would like to involve Rafael and check what is the correct/expected way to use those flags. Regards, Sudeep --->8 diff --git i/drivers/firmware/psci/psci.c w/drivers/firmware/psci/psci.c index 0e622aa5ad58..b2559ae7668a 100644 --- i/drivers/firmware/psci/psci.c +++ w/drivers/firmware/psci/psci.c @@ -505,26 +505,42 @@ static int psci_system_suspend(unsigned long unused) return psci_to_linux_errno(err); } -static int psci_system_suspend_enter(suspend_state_t state) +static int psci_system_idle_prepare_late(void) { pm_set_resume_via_firmware(); + return 0; +} +#define psci_system_system_prepare_late psci_system_idle_prepare_late + +static int psci_system_suspend_enter(suspend_state_t state) +{ + psci_system_system_prepare_late(); return cpu_suspend(0, psci_system_suspend); } -static int psci_system_suspend_begin(suspend_state_t state) +static int psci_system_idle_begin(void) { pm_set_suspend_via_firmware(); - return 0; } +static int psci_system_suspend_begin(suspend_state_t state) +{ + return psci_system_idle_begin(); +} + static const struct platform_suspend_ops psci_suspend_ops = { .valid = suspend_valid_only_mem, .enter = psci_system_suspend_enter, .begin = psci_system_suspend_begin, }; +static const struct platform_s2idle_ops psci_s2idle_ops = { + .begin = psci_system_idle_begin, + .prepare_late = psci_system_idle_prepare_late, +}; + static void __init psci_init_system_reset2(void) { int ret; @@ -546,6 +562,8 @@ static void __init psci_init_system_suspend(void) if (ret != PSCI_RET_NOT_SUPPORTED) suspend_set_ops(&psci_suspend_ops); + + s2idle_set_ops(&psci_s2idle_ops); } static void __init psci_init_cpu_suspend(void)