Thread (11 messages) 11 messages, 5 authors, 2019-06-21

RE: [PATCH] ACPI: PM: Export the function acpi_sleep_state_supported()

From: Dexuan Cui <decui@microsoft.com>
Date: 2019-06-14 22:19:23
Also in: linux-acpi, lkml

-----Original Message-----
From: Michael Kelley <redacted>
Sent: Friday, June 14, 2019 1:48 PM
To: Dexuan Cui <decui@microsoft.com>; 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
[off-list ref]; Stephen Hemminger [off-list ref];
Haiyang Zhang [off-list ref]; Sasha Levin
[off-list ref]; olaf@aepfle.de; apw@canonical.com;
jasowang@redhat.com; vkuznets [off-list ref];
marcelo.cerri@canonical.com
Subject: RE: [PATCH] ACPI: PM: Export the function
acpi_sleep_state_supported()

From: Dexuan Cui <decui@microsoft.com>  Sent: Friday, June 14, 2019 11:19
AM
quoted
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 <decui@microsoft.com>
---
 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,
quoted
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?

Thanks,
-- Dexuan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help