Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2706288ybi; Mon, 17 Jun 2019 09:15:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqz2obeOe3w2/Xs1QxyOywvO8QlhENaIOpvAPzKayJXl4Hcjr6WpdoCFCNh9yMolUv9b8caM X-Received: by 2002:a17:90a:628a:: with SMTP id d10mr26694652pjj.7.1560788124537; Mon, 17 Jun 2019 09:15:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560788124; cv=none; d=google.com; s=arc-20160816; b=gOox1gkFwQqygqkKCUyIRlNIRihozv6zFJQ4tAN4w2MsiNGmaQNeKHGPob9VT95CXj bJA8/DqH4WSysqSCw9LmIlpG/qj31eg5MfALQF3NPG6+BQci9V9xruAqU58HqPwPBYj+ //EEoPFJfRLdmviy04rcHC6IvOo1i2oaWpZ7lAymyBnpaUunyrcWpKJ6mcMuHjqbxNHb QfpPY7PU9O8KVKy54zAi+fjoicln8gox/ufZSUMdg2rI0+9CnzXH6xYNvuF9qHiLl+Me q0k1crovAMcLlOOr2DX/rvZ7uK8pm/5EmLLgpEh6WevArwlOtxMCV7Q9DeJYPnneF4ZA 0MwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=qwxfzKwQUefb5gM941GWNdX5bLaQ17UiVlqmeneCnj4=; b=B6vrQeG5n/SrLCQORBLVOK+R6bIhWtqFm3FKLwlD9nKj2AZKwK5hloh0miVi6lMpE2 SFCpU6Fuw1/b3JkoZlU8l1kFH6+TK7qCtlrlarxM8pqgtmP/PFN/eIbYyXc7teREBlc9 V3hG5ifo2UQGop6yszsOvJdcqVfWeDNA4BEUFMYy4Xr8XZjSIKvBX/vy3+nBvXV/evmD 75/reXZ499BRWaj9wv3D9P7X+ryZ43XMzlUtTc/XSuh/5QcOsAPR8xqIii+tMy2KqLB+ avMgPe2WdOhP4l0qsH/qC3Olyn4YGAY19COBYJM1x4blopDmFra2qJgO6asGP6uUohGs CwwQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w12si11400410pgl.310.2019.06.17.09.15.09; Mon, 17 Jun 2019 09:15:24 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726974AbfFQQPA (ORCPT + 99 others); Mon, 17 Jun 2019 12:15:00 -0400 Received: from foss.arm.com ([217.140.110.172]:55192 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726091AbfFQQPA (ORCPT ); Mon, 17 Jun 2019 12:15:00 -0400 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 92C4B28; Mon, 17 Jun 2019 09:14:59 -0700 (PDT) Received: from e121166-lin.cambridge.arm.com (unknown [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E2F353F718; Mon, 17 Jun 2019 09:14:56 -0700 (PDT) Date: Mon, 17 Jun 2019 17:14:54 +0100 From: Lorenzo Pieralisi To: Dexuan Cui Cc: Michael Kelley , "linux-acpi@vger.kernel.org" , "rjw@rjwysocki.net" , "lenb@kernel.org" , "robert.moore@intel.com" , "erik.schmauss@intel.com" , Russell King , Russ Dill , Sebastian Capella , Pavel Machek , "linux-hyperv@vger.kernel.org" , "linux-kernel@vger.kernel.org" , KY Srinivasan , Stephen Hemminger , Haiyang Zhang , Sasha Levin , "olaf@aepfle.de" , "apw@canonical.com" , "jasowang@redhat.com" , vkuznets , "marcelo.cerri@canonical.com" Subject: Re: [PATCH] ACPI: PM: Export the function acpi_sleep_state_supported() Message-ID: <20190617161454.GB27113@e121166-lin.cambridge.arm.com> References: <1560536224-35338-1-git-send-email-decui@microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 14, 2019 at 10:19:02PM +0000, Dexuan Cui wrote: > > -----Original Message----- > > From: Michael Kelley > > Sent: Friday, June 14, 2019 1:48 PM > > To: Dexuan Cui ; linux-acpi@vger.kernel.org; > > rjw@rjwysocki.net; lenb@kernel.org; robert.moore@intel.com; > > erik.schmauss@intel.com > > Cc: linux-hyperv@vger.kernel.org; linux-kernel@vger.kernel.org; KY Srinivasan > > ; Stephen Hemminger ; > > Haiyang Zhang ; Sasha Levin > > ; olaf@aepfle.de; apw@canonical.com; > > jasowang@redhat.com; vkuznets ; > > marcelo.cerri@canonical.com > > Subject: RE: [PATCH] ACPI: PM: Export the function > > acpi_sleep_state_supported() > > > > From: Dexuan Cui Sent: Friday, June 14, 2019 11:19 > > AM > > > > > > In a Linux VM running on Hyper-V, when ACPI S4 is enabled, the balloon > > > driver (drivers/hv/hv_balloon.c) needs to ask the host not to do memory > > > hot-add/remove. > > > > > > So let's export acpi_sleep_state_supported() for the hv_balloon driver. > > > This might also be useful to the other drivers in the future. > > > > > > Signed-off-by: Dexuan Cui > > > --- > > > drivers/acpi/sleep.c | 3 ++- > > > include/acpi/acpi_bus.h | 2 ++ > > > 2 files changed, 4 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c > > > index a34deccd7317..69755411e008 100644 > > > --- a/drivers/acpi/sleep.c > > > +++ b/drivers/acpi/sleep.c > > > @@ -79,7 +79,7 @@ static int acpi_sleep_prepare(u32 acpi_state) > > > return 0; > > > } > > > > > > -static bool acpi_sleep_state_supported(u8 sleep_state) > > > +bool acpi_sleep_state_supported(u8 sleep_state) > > > { > > > acpi_status status; > > > u8 type_a, type_b; > > > @@ -89,6 +89,7 @@ static bool acpi_sleep_state_supported(u8 sleep_state) > > > || (acpi_gbl_FADT.sleep_control.address > > > && acpi_gbl_FADT.sleep_status.address)); > > > } > > > +EXPORT_SYMBOL_GPL(acpi_sleep_state_supported); > > > > > > #ifdef CONFIG_ACPI_SLEEP > > > static u32 acpi_target_sleep_state = ACPI_STATE_S0; > > > diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h > > > index 31b6c87d6240..5b102e7bbf25 100644 > > > --- a/include/acpi/acpi_bus.h > > > +++ b/include/acpi/acpi_bus.h > > > @@ -651,6 +651,8 @@ static inline int acpi_pm_set_bridge_wakeup(struct > > device *dev, > > > bool enable) > > > } > > > #endif > > > > > > +bool acpi_sleep_state_supported(u8 sleep_state); > > > + > > > #ifdef CONFIG_ACPI_SLEEP > > > u32 acpi_target_system_state(void); > > > #else > > > -- > > > 2.19.1 > > > > It seems that sleep.c isn't built when on the ARM64 architecture. Using > > acpi_sleep_state_supported() directly in hv_balloon.c will be problematic > > since hv_balloon.c needs to be architecture independent when the > > Hyper-V ARM64 support is added. If that doesn't change, a per-architecture > > wrapper will be needed to give hv_balloon.c the correct information. This > > may affect whether acpi_sleep_state_supported() needs to be exported vs. > > just removing the "static". I'm not sure what the best approach is. > > > > Michael > > + some ARM experts who worked on arch/arm/kernel/hibernate.c. > > drivers/acpi/sleep.c is only built if ACPI_SYSTEM_POWER_STATES_SUPPORT > is defined, but it looks this option is not defined on ARM. > > It looks ARM does not support the ACPI S4 state, then how do we know > if an ARM host supports hibernation or not? Maybe we should start from understanding why you need to know whether Hibernate is possible to answer your question ? On ARM64 platforms system states are entered through PSCI firmware interface that works for ACPI and device tree alike. Lorenzo