Kernel KVM-PPC virtualization development
 help / color / mirror / Atom feed
* [RFC PATCH 12/32] powerpc: Provide dummy versions of plpar_hcall functions when !CONFIG_PPC_PSERIES
@ 2018-09-21 10:01 Paul Mackerras
  2018-09-26  3:30 ` [RFC PATCH 12/32] powerpc: Provide dummy versions of plpar_hcall functions when !CONFIG_PPC_PSER David Gibson
  2018-09-26 11:21 ` Paul Mackerras
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Mackerras @ 2018-09-21 10:01 UTC (permalink / raw)
  To: kvm-ppc

This will reduce the number of instances where we require ifdefs in
code which needs to call a hypercall on a pseries platform or do
something different on a powernv platform.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
---
 arch/powerpc/include/asm/hvcall.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
index a0b17f9..cc9fe87 100644
--- a/arch/powerpc/include/asm/hvcall.h
+++ b/arch/powerpc/include/asm/hvcall.h
@@ -362,6 +362,7 @@
 #ifndef __ASSEMBLY__
 #include <linux/types.h>
 
+#ifdef CONFIG_PPC_PSERIES
 /**
  * plpar_hcall_norets: - Make a pseries hypervisor call with no return arguments
  * @opcode: The hypervisor call to make.
@@ -411,6 +412,27 @@ long plpar_hcall_raw(unsigned long opcode, unsigned long *retbuf, ...);
 long plpar_hcall9(unsigned long opcode, unsigned long *retbuf, ...);
 long plpar_hcall9_raw(unsigned long opcode, unsigned long *retbuf, ...);
 
+#else /* CONFIG_PPC_PSERIES */
+static inline long plpar_hcall_norets(unsigned long opcode, ...)
+{ return H_FUNCTION; }
+
+#define PLPAR_HCALL_BUFSIZE 4
+static inline long plpar_hcall(unsigned long opcode, unsigned long *retbuf, ...)
+{ return H_FUNCTION; }
+
+static inline long plpar_hcall_raw(unsigned long opcode,
+				   unsigned long *retbuf, ...)
+{ return H_FUNCTION; }
+
+#define PLPAR_HCALL9_BUFSIZE 9
+static inline long plpar_hcall9(unsigned long opcode,
+				unsigned long *retbuf, ...)
+{ return H_FUNCTION; }
+static inline long plpar_hcall9_raw(unsigned long opcode,
+				    unsigned long *retbuf, ...)
+{ return H_FUNCTION; }
+#endif /* CONFIG_PPC_PSERIES */
+
 struct hvcall_mpp_data {
 	unsigned long entitled_mem;
 	unsigned long mapped_mem;
-- 
2.7.4

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

* Re: [RFC PATCH 12/32] powerpc: Provide dummy versions of plpar_hcall functions when !CONFIG_PPC_PSER
  2018-09-21 10:01 [RFC PATCH 12/32] powerpc: Provide dummy versions of plpar_hcall functions when !CONFIG_PPC_PSERIES Paul Mackerras
@ 2018-09-26  3:30 ` David Gibson
  2018-09-26 11:21 ` Paul Mackerras
  1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2018-09-26  3:30 UTC (permalink / raw)
  To: kvm-ppc

[-- Attachment #1: Type: text/plain, Size: 2349 bytes --]

On Fri, Sep 21, 2018 at 08:01:43PM +1000, Paul Mackerras wrote:
> This will reduce the number of instances where we require ifdefs in
> code which needs to call a hypercall on a pseries platform or do
> something different on a powernv platform.
> 
> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>

Wouldn't it make more sense for these to BUG_ON() or at least
WARN_ON() before returning H_FUNCTION, since calling a hypercall on a
non pseries platform is definitely a kernel bug?

> ---
>  arch/powerpc/include/asm/hvcall.h | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
> index a0b17f9..cc9fe87 100644
> --- a/arch/powerpc/include/asm/hvcall.h
> +++ b/arch/powerpc/include/asm/hvcall.h
> @@ -362,6 +362,7 @@
>  #ifndef __ASSEMBLY__
>  #include <linux/types.h>
>  
> +#ifdef CONFIG_PPC_PSERIES
>  /**
>   * plpar_hcall_norets: - Make a pseries hypervisor call with no return arguments
>   * @opcode: The hypervisor call to make.
> @@ -411,6 +412,27 @@ long plpar_hcall_raw(unsigned long opcode, unsigned long *retbuf, ...);
>  long plpar_hcall9(unsigned long opcode, unsigned long *retbuf, ...);
>  long plpar_hcall9_raw(unsigned long opcode, unsigned long *retbuf, ...);
>  
> +#else /* CONFIG_PPC_PSERIES */
> +static inline long plpar_hcall_norets(unsigned long opcode, ...)
> +{ return H_FUNCTION; }
> +
> +#define PLPAR_HCALL_BUFSIZE 4
> +static inline long plpar_hcall(unsigned long opcode, unsigned long *retbuf, ...)
> +{ return H_FUNCTION; }
> +
> +static inline long plpar_hcall_raw(unsigned long opcode,
> +				   unsigned long *retbuf, ...)
> +{ return H_FUNCTION; }
> +
> +#define PLPAR_HCALL9_BUFSIZE 9
> +static inline long plpar_hcall9(unsigned long opcode,
> +				unsigned long *retbuf, ...)
> +{ return H_FUNCTION; }
> +static inline long plpar_hcall9_raw(unsigned long opcode,
> +				    unsigned long *retbuf, ...)
> +{ return H_FUNCTION; }
> +#endif /* CONFIG_PPC_PSERIES */
> +
>  struct hvcall_mpp_data {
>  	unsigned long entitled_mem;
>  	unsigned long mapped_mem;

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [RFC PATCH 12/32] powerpc: Provide dummy versions of plpar_hcall functions when !CONFIG_PPC_PSER
  2018-09-21 10:01 [RFC PATCH 12/32] powerpc: Provide dummy versions of plpar_hcall functions when !CONFIG_PPC_PSERIES Paul Mackerras
  2018-09-26  3:30 ` [RFC PATCH 12/32] powerpc: Provide dummy versions of plpar_hcall functions when !CONFIG_PPC_PSER David Gibson
@ 2018-09-26 11:21 ` Paul Mackerras
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Mackerras @ 2018-09-26 11:21 UTC (permalink / raw)
  To: kvm-ppc

On Wed, Sep 26, 2018 at 01:30:40PM +1000, David Gibson wrote:
> On Fri, Sep 21, 2018 at 08:01:43PM +1000, Paul Mackerras wrote:
> > This will reduce the number of instances where we require ifdefs in
> > code which needs to call a hypercall on a pseries platform or do
> > something different on a powernv platform.
> > 
> > Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
> 
> Wouldn't it make more sense for these to BUG_ON() or at least
> WARN_ON() before returning H_FUNCTION, since calling a hypercall on a
> non pseries platform is definitely a kernel bug?

Not BUG_ON, since at this level we have no indication that the kernel
can't continue executing without whatever it was that it expected the
hcall to do.  I could come at a WARN_ON (or WARN_ON_ONCE) -- I'll talk
to mpe and see what he thinks.

Paul.

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

end of thread, other threads:[~2018-09-26 11:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-21 10:01 [RFC PATCH 12/32] powerpc: Provide dummy versions of plpar_hcall functions when !CONFIG_PPC_PSERIES Paul Mackerras
2018-09-26  3:30 ` [RFC PATCH 12/32] powerpc: Provide dummy versions of plpar_hcall functions when !CONFIG_PPC_PSER David Gibson
2018-09-26 11:21 ` Paul Mackerras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox