Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp972301imu; Thu, 20 Dec 2018 08:08:55 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wu/h/Oa7LGEWqJ1PYZgRNKq/QOAxfN2kZ3FIlcIZP17Ly/u3/G9/Zh22232GLGEiHKiPrJ X-Received: by 2002:a17:902:b60a:: with SMTP id b10mr23022760pls.303.1545322135221; Thu, 20 Dec 2018 08:08:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545322135; cv=none; d=google.com; s=arc-20160816; b=lvBXHO3CzBwzssfrOVZm+oy3uvsjlJIdeESS5bEVDk2ezu0l8sqYy6qjGUxO4mAXws 69srbLL00bEXoqBmZalURaoapcNlMIl8dmqannJ0vY0Q+GJstqY6C3Vw8NIlQVQiw2KA QzoASpKazBGmFu19gLTYFvvf7/m8XEC1w/2ospsbYP54llkiOc0QWuaDdwCxfNyNPcSQ iXLX4pBLJx6AlhKu9p98x4l5IkF1gwOEiAZnXueUTKC4woQ3tBJYQjYPXrDjyKzWFQv1 tKyhO9/y7jfOI1m8toYln9803VkH6bwh8eVAVhSYiIKqbX9ckmdVad0obo6ejXGwVdpt pnhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=ig7wGYUNzjsLT7kF425ff0qq/YN+nkbjFy7aNFOFU58=; b=ajI4lv/wRutxhBe6+LgjNOCCBqlWGF9PxjcdNuJKJHWen7DpfZM3bzvXkncNwM5eRF OSXisfYuDwIhHpGLhYZCc+cMD8Q3XENnbwUYpitEbAJzO803Iqm9BlZWH6hgB3WLBsJH 5FnZOJbcuhsrsyTja8UA1qg5WbOlPxY2F53pe7BS7L6HqL139MQXTqfoWyMElAAt3uyP 0nd/rgTELQfQWnN3TtMAKuZ6r7ySKXTYu0AJLWDHCMet/9PZzv5ogAGw8a3A+gW/eZgL FCryLxD7czoSSCSAOLONAqTXgaCTLjV2yqaZ7mmNadcmHvWEnaMiTCo/LuOVAji6GZcF 0mHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J8oGAKky; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 9si18757508pgm.112.2018.12.20.08.08.37; Thu, 20 Dec 2018 08:08:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J8oGAKky; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732337AbeLTNLG (ORCPT + 99 others); Thu, 20 Dec 2018 08:11:06 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:56160 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731948AbeLTNLF (ORCPT ); Thu, 20 Dec 2018 08:11:05 -0500 Received: by mail-wm1-f67.google.com with SMTP id y139so1954781wmc.5 for ; Thu, 20 Dec 2018 05:11:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ig7wGYUNzjsLT7kF425ff0qq/YN+nkbjFy7aNFOFU58=; b=J8oGAKkyLJWDIDvWEzlXaHy4TtAUTdn3ZbncMuoLL6UkSUjL90GyQ3NapOVpJtUDSL cXFiaUtzJeB1sRz9fbh3cnv6YvzDOV8QUvI44pWOk6TqNvcsOK3q2gwobD0OAYEKNzZ5 meJVNQLiL9az6wIDMvMak6mch4w/0htRu2Zr0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ig7wGYUNzjsLT7kF425ff0qq/YN+nkbjFy7aNFOFU58=; b=aLP/CaqT1v7ybErjnM0nR6O2btXiIGaMg5ykdvm5U2thx3ybpTFDlpKoMK2tjKyqSa DAe/cM+wZ9pchF41NRLNvgMi/PUFPVWtyYomwKK7wzROq5qn7xA6L3Qik9ANkEjo9n4a I0+oHkatNvqdOPaGotmyP+fSIhFNQzBA3u1dAn6SQ9zI2CzSd+5e30DEY39EIzfRNSxw cKxIUmUTWaxA2ox9zYB2erCRnQF+AolvS82xXBTp97BBUMSdubCJKpYsASIDPqxsHu9Z x8XuxzLgOqwyJyJerwhxuBp1kV2eyi4oIkIJhaLQe+1QCW7giBuSu9zBGgWgGKPsykvA 5/kA== X-Gm-Message-State: AA+aEWbMjKpiaihNlRLNHQjo2+MEJU82WrGgv/uBzb2p7pNl8HwEQGdq H9LiKS2kKAoRhSysQu2qVRHoGtj8Sdo= X-Received: by 2002:a1c:70b:: with SMTP id 11mr11924728wmh.74.1545311463087; Thu, 20 Dec 2018 05:11:03 -0800 (PST) Received: from [192.168.0.40] (55.183.88.92.rev.sfr.net. [92.88.183.55]) by smtp.googlemail.com with ESMTPSA id y8sm9874493wmg.13.2018.12.20.05.11.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Dec 2018 05:11:02 -0800 (PST) Subject: Re: [PATCH v10 15/27] drivers: firmware: psci: Announce support for OS initiated suspend mode To: Ulf Hansson , "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , linux-pm@vger.kernel.org Cc: "Raju P . L . S . S . S . N" , Stephen Boyd , Tony Lindgren , Kevin Hilman , Lina Iyer , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20181129174700.16585-1-ulf.hansson@linaro.org> <20181129174700.16585-16-ulf.hansson@linaro.org> From: Daniel Lezcano Message-ID: Date: Thu, 20 Dec 2018 14:11:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181129174700.16585-16-ulf.hansson@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/11/2018 18:46, Ulf Hansson wrote: > PSCI firmware v1.0+, supports two different modes for CPU_SUSPEND. The > Platform Coordinated mode, which is the default and mandatory mode, while > support for the OS initiated mode is optional. > > This change introduces initial support for the OS initiated mode, in way > that it adds the related PSCI bits from the spec and prints a message in > the log to inform whether the mode is supported by the PSCI FW. > > Cc: Lina Iyer > Co-developed-by: Lina Iyer > Signed-off-by: Ulf Hansson Reviewed-by: Daniel Lezcano > --- > > Changes in v10: > - None. > > --- > drivers/firmware/psci/psci.c | 21 ++++++++++++++++++++- > include/uapi/linux/psci.h | 5 +++++ > 2 files changed, 25 insertions(+), 1 deletion(-) > > diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c > index 6bfa47cbd174..4f0cbc95e41b 100644 > --- a/drivers/firmware/psci/psci.c > +++ b/drivers/firmware/psci/psci.c > @@ -95,6 +95,11 @@ static inline bool psci_has_ext_power_state(void) > PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK; > } > > +static inline bool psci_has_osi_support(void) > +{ > + return psci_cpu_suspend_feature & PSCI_1_0_OS_INITIATED; > +} > + > static inline bool psci_power_state_loses_context(u32 state) > { > const u32 mask = psci_has_ext_power_state() ? > @@ -659,10 +664,24 @@ static int __init psci_0_1_init(struct device_node *np) > return 0; > } > > +static int __init psci_1_0_init(struct device_node *np) > +{ > + int err; > + > + err = psci_0_2_init(np); > + if (err) > + return err; > + > + if (psci_has_osi_support()) > + pr_info("OSI mode supported.\n"); > + > + return 0; > +} > + > static const struct of_device_id psci_of_match[] __initconst = { > { .compatible = "arm,psci", .data = psci_0_1_init}, > { .compatible = "arm,psci-0.2", .data = psci_0_2_init}, > - { .compatible = "arm,psci-1.0", .data = psci_0_2_init}, > + { .compatible = "arm,psci-1.0", .data = psci_1_0_init}, > {}, > }; > > diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h > index b3bcabe380da..581f72085c33 100644 > --- a/include/uapi/linux/psci.h > +++ b/include/uapi/linux/psci.h > @@ -49,6 +49,7 @@ > > #define PSCI_1_0_FN_PSCI_FEATURES PSCI_0_2_FN(10) > #define PSCI_1_0_FN_SYSTEM_SUSPEND PSCI_0_2_FN(14) > +#define PSCI_1_0_FN_SET_SUSPEND_MODE PSCI_0_2_FN(15) > > #define PSCI_1_0_FN64_SYSTEM_SUSPEND PSCI_0_2_FN64(14) > > @@ -97,6 +98,10 @@ > #define PSCI_1_0_FEATURES_CPU_SUSPEND_PF_MASK \ > (0x1 << PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT) > > +#define PSCI_1_0_OS_INITIATED BIT(0) > +#define PSCI_1_0_SUSPEND_MODE_PC 0 > +#define PSCI_1_0_SUSPEND_MODE_OSI 1 > + > /* PSCI return values (inclusive of all PSCI versions) */ > #define PSCI_RET_SUCCESS 0 > #define PSCI_RET_NOT_SUPPORTED -1 > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog