Skip to contentSkip to conversation

mshv: hide x86-specific functions on arm64

PATCH In review Arnd Bergmann 3 participants 4 messages Dec 16, 2025 – Dec 18, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mshv: hide x86-specific functions on arm64

From: Arnd Bergmann <[email protected]>

The hv_sleep_notifiers_register() and hv_machine_power_off() functions are only called and declared on x86, but cause a warning on arm64:

drivers/hv/mshv_common.c:210:6: error: no previous prototype for 'hv_sleep_notifiers_register' [-Werror=missing-prototypes]
210 | void hv_sleep_notifiers_register(void)

      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hv/mshv_common.c:224:6: error: no previous prototype for 'hv_machine_power_off' [-Werror=missing-prototypes]
  224 | void hv_machine_power_off(void)
      |      ^~~~~~~~~~~~~~~~~~~~

Hide both inside of an #ifdef block.

Fixes f0be2600ac55 ("mshv: Use reboot notifier to configure sleep state")
Fixes 615a6e7d83f9 ("mshv: Cleanly shutdown root partition with MSHV")
---
 drivers/hv/mshv_common.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/hv/mshv_common.c +2 -0
index 58027b23c206..63f09bb5136e 100644
@@ -142,6 +142,7 @@ int hv_call_get_partition_property(u64 partition_id,
 }
 EXPORT_SYMBOL_GPL(hv_call_get_partition_property);
 
+#ifdef CONFIG_X86
 /*
  * Corresponding sleep states have to be initialized in order for a subsequent
  * HVCALL_ENTER_SLEEP_STATE call to succeed. Currently only S5 state as per
@@ -237,3 +238,4 @@ void hv_machine_power_off(void)
 	BUG();
 
 }
+#endif
Signature · 1 line
2.39.5
maintainer
#1 lore raw
Quoted 12 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The hv_sleep_notifiers_register() and hv_machine_power_off() functions are only called and declared on x86, but cause a warning on arm64:

drivers/hv/mshv_common.c:210:6: error: no previous prototype for 'hv_sleep_notifiers_register' [-Werror=missing-prototypes]
210 | void hv_sleep_notifiers_register(void)

      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hv/mshv_common.c:224:6: error: no previous prototype for 'hv_machine_power_off' [-Werror=missing-prototypes]
  224 | void hv_machine_power_off(void)
      |      ^~~~~~~~~~~~~~~~~~~~
Quoted 5 lines

Hide both inside of an #ifdef block.

Fixes f0be2600ac55 ("mshv: Use reboot notifier to configure sleep state")
Fixes 615a6e7d83f9 ("mshv: Cleanly shutdown root partition with MSHV")

Thanks Arnd. I have a queued up a patch which make available the declarations to arm64. Let me think about whether to use your patch instead.

Anyway, this issue will be fixed one way or the other once I send a PR to Linus.

Wei

Quoted 24 lines
---
 drivers/hv/mshv_common.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/hv/mshv_common.c +2 -0
index 58027b23c206..63f09bb5136e 100644
@@ -142,6 +142,7 @@ int hv_call_get_partition_property(u64 partition_id,
 }
 EXPORT_SYMBOL_GPL(hv_call_get_partition_property);
 
+#ifdef CONFIG_X86
 /*
  * Corresponding sleep states have to be initialized in order for a subsequent
  * HVCALL_ENTER_SLEEP_STATE call to succeed. Currently only S5 state as per
@@ -237,3 +238,4 @@ void hv_machine_power_off(void)
 	BUG();
 
 }
+#endif
Signature · 1 line
2.39.5
#2 lore raw
Quoted 19 lines · Wei Liu
Quoted 12 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The hv_sleep_notifiers_register() and hv_machine_power_off() functions are only called and declared on x86, but cause a warning on arm64:

drivers/hv/mshv_common.c:210:6: error: no previous prototype for 'hv_sleep_notifiers_register' [-Werror=missing-prototypes]
210 | void hv_sleep_notifiers_register(void)

      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hv/mshv_common.c:224:6: error: no previous prototype for 'hv_machine_power_off' [-Werror=missing-prototypes]
  224 | void hv_machine_power_off(void)
      |      ^~~~~~~~~~~~~~~~~~~~
Quoted 5 lines

Hide both inside of an #ifdef block.

Fixes f0be2600ac55 ("mshv: Use reboot notifier to configure sleep state")
Fixes 615a6e7d83f9 ("mshv: Cleanly shutdown root partition with MSHV")
Quoted 7 lines

Thanks Arnd. I have a queued up a patch which make available the declarations to arm64. Let me think about whether to use your patch instead.

Anyway, this issue will be fixed one way or the other once I send a PR to Linus.

The whole idea of mshv_common.c is to have common code for all archs. It would be nice to keep this file as it is.

Thanks,
Stanislav

Quoted 26 lines

Wei

Quoted 24 lines
---
 drivers/hv/mshv_common.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/hv/mshv_common.c +2 -0
index 58027b23c206..63f09bb5136e 100644
@@ -142,6 +142,7 @@ int hv_call_get_partition_property(u64 partition_id,
 }
 EXPORT_SYMBOL_GPL(hv_call_get_partition_property);
 
+#ifdef CONFIG_X86
 /*
  * Corresponding sleep states have to be initialized in order for a subsequent
  * HVCALL_ENTER_SLEEP_STATE call to succeed. Currently only S5 state as per
@@ -237,3 +238,4 @@ void hv_machine_power_off(void)
 	BUG();
 
 }
+#endif
Signature · 1 line
2.39.5
maintainer
#3 lore raw
Quoted 24 lines · Stanislav Kinsburskii
Quoted 23 lines · Wei Liu
Quoted 12 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The hv_sleep_notifiers_register() and hv_machine_power_off() functions are only called and declared on x86, but cause a warning on arm64:

drivers/hv/mshv_common.c:210:6: error: no previous prototype for 'hv_sleep_notifiers_register' [-Werror=missing-prototypes]
210 | void hv_sleep_notifiers_register(void)

      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/hv/mshv_common.c:224:6: error: no previous prototype for 'hv_machine_power_off' [-Werror=missing-prototypes]
  224 | void hv_machine_power_off(void)
      |      ^~~~~~~~~~~~~~~~~~~~
Quoted 5 lines

Hide both inside of an #ifdef block.

Fixes f0be2600ac55 ("mshv: Use reboot notifier to configure sleep state")
Fixes 615a6e7d83f9 ("mshv: Cleanly shutdown root partition with MSHV")

Thanks Arnd. I have a queued up a patch which make available the declarations to arm64. Let me think about whether to use your patch instead.

Quoted 6 lines
Quoted 3 lines

Anyway, this issue will be fixed one way or the other once I send a PR to Linus.

The whole idea of mshv_common.c is to have common code for all archs. It would be nice to keep this file as it is.

The path forward is either to move these functions to an x86-specific file or to make arm64 work the same way. I'm not too sure about the latter yet given the port is yet to be done. For the time being, I am going to drop my own patch and take Arnd's patch. We can figure out which of the two approaches to take later.

Wei