linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mshv: hide x86-specific functions on arm64
@ 2025-12-16 21:36 Arnd Bergmann
  2025-12-16 22:21 ` Wei Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2025-12-16 21:36 UTC (permalink / raw)
  To: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li,
	Stansialv Kinsburskii, Nuno Das Neves, Praveen K Paladugu,
	Easwar Hariharan, Anatol Belski, Stanislav Kinsburskii
  Cc: Arnd Bergmann, Sean Christopherson, Naman Jain, linux-hyperv,
	linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

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")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/hv/mshv_common.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hv/mshv_common.c b/drivers/hv/mshv_common.c
index 58027b23c206..63f09bb5136e 100644
--- a/drivers/hv/mshv_common.c
+++ b/drivers/hv/mshv_common.c
@@ -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
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mshv: hide x86-specific functions on arm64
  2025-12-16 21:36 [PATCH] mshv: hide x86-specific functions on arm64 Arnd Bergmann
@ 2025-12-16 22:21 ` Wei Liu
  2025-12-17  0:45   ` Stanislav Kinsburskii
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Liu @ 2025-12-16 22:21 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li,
	Stansialv Kinsburskii, Nuno Das Neves, Praveen K Paladugu,
	Easwar Hariharan, Anatol Belski, Stanislav Kinsburskii,
	Arnd Bergmann, Sean Christopherson, Naman Jain, linux-hyperv,
	linux-kernel

On Tue, Dec 16, 2025 at 10:36:12PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

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

> ---
>  drivers/hv/mshv_common.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/hv/mshv_common.c b/drivers/hv/mshv_common.c
> index 58027b23c206..63f09bb5136e 100644
> --- a/drivers/hv/mshv_common.c
> +++ b/drivers/hv/mshv_common.c
> @@ -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
> -- 
> 2.39.5
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mshv: hide x86-specific functions on arm64
  2025-12-16 22:21 ` Wei Liu
@ 2025-12-17  0:45   ` Stanislav Kinsburskii
  2025-12-18 19:15     ` Wei Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Stanislav Kinsburskii @ 2025-12-17  0:45 UTC (permalink / raw)
  To: Wei Liu
  Cc: Arnd Bergmann, K. Y. Srinivasan, Haiyang Zhang, Dexuan Cui,
	Long Li, Stansialv Kinsburskii, Nuno Das Neves,
	Praveen K Paladugu, Easwar Hariharan, Anatol Belski,
	Arnd Bergmann, Sean Christopherson, Naman Jain, linux-hyperv,
	linux-kernel

On Tue, Dec 16, 2025 at 10:21:29PM +0000, Wei Liu wrote:
> On Tue, Dec 16, 2025 at 10:36:12PM +0100, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> > 
> > 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")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> 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

> Wei
> 
> > ---
> >  drivers/hv/mshv_common.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/hv/mshv_common.c b/drivers/hv/mshv_common.c
> > index 58027b23c206..63f09bb5136e 100644
> > --- a/drivers/hv/mshv_common.c
> > +++ b/drivers/hv/mshv_common.c
> > @@ -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
> > -- 
> > 2.39.5
> > 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mshv: hide x86-specific functions on arm64
  2025-12-17  0:45   ` Stanislav Kinsburskii
@ 2025-12-18 19:15     ` Wei Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Wei Liu @ 2025-12-18 19:15 UTC (permalink / raw)
  To: Stanislav Kinsburskii
  Cc: Wei Liu, Arnd Bergmann, K. Y. Srinivasan, Haiyang Zhang,
	Dexuan Cui, Long Li, Stansialv Kinsburskii, Nuno Das Neves,
	Praveen K Paladugu, Easwar Hariharan, Anatol Belski,
	Arnd Bergmann, Sean Christopherson, Naman Jain, linux-hyperv,
	linux-kernel

On Tue, Dec 16, 2025 at 04:45:12PM -0800, Stanislav Kinsburskii wrote:
> On Tue, Dec 16, 2025 at 10:21:29PM +0000, Wei Liu wrote:
> > On Tue, Dec 16, 2025 at 10:36:12PM +0100, Arnd Bergmann wrote:
> > > From: Arnd Bergmann <arnd@arndb.de>
> > > 
> > > 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")
> > > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > 
> > 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.

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-12-18 19:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-16 21:36 [PATCH] mshv: hide x86-specific functions on arm64 Arnd Bergmann
2025-12-16 22:21 ` Wei Liu
2025-12-17  0:45   ` Stanislav Kinsburskii
2025-12-18 19:15     ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).