kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH v1 1/1] s390x: fix inline asm on gcc10
@ 2020-07-27 10:26 Claudio Imbrenda
  2020-07-27 10:36 ` Thomas Huth
  2020-07-27 11:04 ` Janosch Frank
  0 siblings, 2 replies; 3+ messages in thread
From: Claudio Imbrenda @ 2020-07-27 10:26 UTC (permalink / raw)
  To: kvm, david; +Cc: frankja, thuth, borntraeger

Fix compilation issues on 390x with gcc 10.

Simply mark the inline functions that lead to a .insn with a variable
opcode as __always_inline, to make gcc 10 happy.

Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 lib/s390x/asm/cpacf.h |  5 +++--
 s390x/emulator.c      | 25 +++++++++++++------------
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/lib/s390x/asm/cpacf.h b/lib/s390x/asm/cpacf.h
index ae2ec53..2146a01 100644
--- a/lib/s390x/asm/cpacf.h
+++ b/lib/s390x/asm/cpacf.h
@@ -11,6 +11,7 @@
 #define _ASM_S390_CPACF_H
 
 #include <asm/facility.h>
+#include <linux/compiler.h>
 
 /*
  * Instruction opcodes for the CPACF instructions
@@ -145,7 +146,7 @@ typedef struct { unsigned char bytes[16]; } cpacf_mask_t;
  *
  * Returns 1 if @func is available for @opcode, 0 otherwise
  */
-static inline void __cpacf_query(unsigned int opcode, cpacf_mask_t *mask)
+static __always_inline void __cpacf_query(unsigned int opcode, cpacf_mask_t *mask)
 {
 	register unsigned long r0 asm("0") = 0;	/* query function */
 	register unsigned long r1 asm("1") = (unsigned long) mask;
@@ -183,7 +184,7 @@ static inline int __cpacf_check_opcode(unsigned int opcode)
 	}
 }
 
-static inline int cpacf_query(unsigned int opcode, cpacf_mask_t *mask)
+static __always_inline int cpacf_query(unsigned int opcode, cpacf_mask_t *mask)
 {
 	if (__cpacf_check_opcode(opcode)) {
 		__cpacf_query(opcode, mask);
diff --git a/s390x/emulator.c b/s390x/emulator.c
index 1ee0df5..70ef51a 100644
--- a/s390x/emulator.c
+++ b/s390x/emulator.c
@@ -14,6 +14,7 @@
 #include <asm/cpacf.h>
 #include <asm/interrupt.h>
 #include <asm/float.h>
+#include <linux/compiler.h>
 
 struct lowcore *lc = NULL;
 
@@ -46,7 +47,7 @@ static void test_spm_ipm(void)
 	__test_spm_ipm(0, 0);
 }
 
-static inline void __test_cpacf(unsigned int opcode, unsigned long func,
+static __always_inline void __test_cpacf(unsigned int opcode, unsigned long func,
 				unsigned int r1, unsigned int r2,
 				unsigned int r3)
 {
@@ -59,7 +60,7 @@ static inline void __test_cpacf(unsigned int opcode, unsigned long func,
 		         [r1] "i" (r1), [r2] "i" (r2), [r3] "i" (r3));
 }
 
-static inline void __test_cpacf_r1_odd(unsigned int opcode)
+static __always_inline void __test_cpacf_r1_odd(unsigned int opcode)
 {
 	report_prefix_push("r1 odd");
 	expect_pgm_int();
@@ -68,7 +69,7 @@ static inline void __test_cpacf_r1_odd(unsigned int opcode)
 	report_prefix_pop();
 }
 
-static inline void __test_cpacf_r1_null(unsigned int opcode)
+static __always_inline void __test_cpacf_r1_null(unsigned int opcode)
 {
 	report_prefix_push("r1 null");
 	expect_pgm_int();
@@ -77,7 +78,7 @@ static inline void __test_cpacf_r1_null(unsigned int opcode)
 	report_prefix_pop();
 }
 
-static inline void __test_cpacf_r2_odd(unsigned int opcode)
+static __always_inline void __test_cpacf_r2_odd(unsigned int opcode)
 {
 	report_prefix_push("r2 odd");
 	expect_pgm_int();
@@ -86,7 +87,7 @@ static inline void __test_cpacf_r2_odd(unsigned int opcode)
 	report_prefix_pop();
 }
 
-static inline void __test_cpacf_r2_null(unsigned int opcode)
+static __always_inline void __test_cpacf_r2_null(unsigned int opcode)
 {
 	report_prefix_push("r2 null");
 	expect_pgm_int();
@@ -95,7 +96,7 @@ static inline void __test_cpacf_r2_null(unsigned int opcode)
 	report_prefix_pop();
 }
 
-static inline void __test_cpacf_r3_odd(unsigned int opcode)
+static __always_inline void __test_cpacf_r3_odd(unsigned int opcode)
 {
 	report_prefix_push("r3 odd");
 	expect_pgm_int();
@@ -104,7 +105,7 @@ static inline void __test_cpacf_r3_odd(unsigned int opcode)
 	report_prefix_pop();
 }
 
-static inline void __test_cpacf_r3_null(unsigned int opcode)
+static __always_inline void __test_cpacf_r3_null(unsigned int opcode)
 {
 	report_prefix_push("r3 null");
 	expect_pgm_int();
@@ -113,7 +114,7 @@ static inline void __test_cpacf_r3_null(unsigned int opcode)
 	report_prefix_pop();
 }
 
-static inline void __test_cpacf_mod_bit(unsigned int opcode)
+static __always_inline void __test_cpacf_mod_bit(unsigned int opcode)
 {
 	report_prefix_push("mod bit");
 	expect_pgm_int();
@@ -122,7 +123,7 @@ static inline void __test_cpacf_mod_bit(unsigned int opcode)
 	report_prefix_pop();
 }
 
-static inline void __test_cpacf_invalid_func(unsigned int opcode)
+static __always_inline void __test_cpacf_invalid_func(unsigned int opcode)
 {
 	report_prefix_push("invalid subfunction");
 	expect_pgm_int();
@@ -137,7 +138,7 @@ static inline void __test_cpacf_invalid_func(unsigned int opcode)
 	report_prefix_pop();
 }
 
-static inline void __test_cpacf_invalid_parm(unsigned int opcode)
+static __always_inline void __test_cpacf_invalid_parm(unsigned int opcode)
 {
 	report_prefix_push("invalid parm address");
 	expect_pgm_int();
@@ -146,7 +147,7 @@ static inline void __test_cpacf_invalid_parm(unsigned int opcode)
 	report_prefix_pop();
 }
 
-static inline void __test_cpacf_protected_parm(unsigned int opcode)
+static __always_inline void __test_cpacf_protected_parm(unsigned int opcode)
 {
 	report_prefix_push("protected parm address");
 	expect_pgm_int();
@@ -157,7 +158,7 @@ static inline void __test_cpacf_protected_parm(unsigned int opcode)
 	report_prefix_pop();
 }
 
-static inline void __test_basic_cpacf_opcode(unsigned int opcode)
+static __always_inline void __test_basic_cpacf_opcode(unsigned int opcode)
 {
 	bool mod_bit_allowed = false;
 
-- 
2.26.2


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

* Re: [kvm-unit-tests PATCH v1 1/1] s390x: fix inline asm on gcc10
  2020-07-27 10:26 [kvm-unit-tests PATCH v1 1/1] s390x: fix inline asm on gcc10 Claudio Imbrenda
@ 2020-07-27 10:36 ` Thomas Huth
  2020-07-27 11:04 ` Janosch Frank
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Huth @ 2020-07-27 10:36 UTC (permalink / raw)
  To: Claudio Imbrenda, kvm, david; +Cc: frankja, borntraeger

On 27/07/2020 12.26, Claudio Imbrenda wrote:
> Fix compilation issues on 390x with gcc 10.
> 
> Simply mark the inline functions that lead to a .insn with a variable
> opcode as __always_inline, to make gcc 10 happy.
> 
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
>  lib/s390x/asm/cpacf.h |  5 +++--
>  s390x/emulator.c      | 25 +++++++++++++------------
>  2 files changed, 16 insertions(+), 14 deletions(-)

I wonder why they change the behavior there ... but ok, we're using "i"
as constraint here, so I guess that's only fair that inlining has to be
enforced here.

Reviewed-by: Thomas Huth <thuth@redhat.com>


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

* Re: [kvm-unit-tests PATCH v1 1/1] s390x: fix inline asm on gcc10
  2020-07-27 10:26 [kvm-unit-tests PATCH v1 1/1] s390x: fix inline asm on gcc10 Claudio Imbrenda
  2020-07-27 10:36 ` Thomas Huth
@ 2020-07-27 11:04 ` Janosch Frank
  1 sibling, 0 replies; 3+ messages in thread
From: Janosch Frank @ 2020-07-27 11:04 UTC (permalink / raw)
  To: Claudio Imbrenda, kvm, david; +Cc: thuth, borntraeger


[-- Attachment #1.1: Type: text/plain, Size: 5996 bytes --]

On 7/27/20 12:26 PM, Claudio Imbrenda wrote:
> Fix compilation issues on 390x with gcc 10.
> 
> Simply mark the inline functions that lead to a .insn with a variable
> opcode as __always_inline, to make gcc 10 happy.

Thanks, picked

Reviewed-by: Janosch Frank <frankja@linux.ibm.com>

> 
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
>  lib/s390x/asm/cpacf.h |  5 +++--
>  s390x/emulator.c      | 25 +++++++++++++------------
>  2 files changed, 16 insertions(+), 14 deletions(-)
> 
> diff --git a/lib/s390x/asm/cpacf.h b/lib/s390x/asm/cpacf.h
> index ae2ec53..2146a01 100644
> --- a/lib/s390x/asm/cpacf.h
> +++ b/lib/s390x/asm/cpacf.h
> @@ -11,6 +11,7 @@
>  #define _ASM_S390_CPACF_H
>  
>  #include <asm/facility.h>
> +#include <linux/compiler.h>
>  
>  /*
>   * Instruction opcodes for the CPACF instructions
> @@ -145,7 +146,7 @@ typedef struct { unsigned char bytes[16]; } cpacf_mask_t;
>   *
>   * Returns 1 if @func is available for @opcode, 0 otherwise
>   */
> -static inline void __cpacf_query(unsigned int opcode, cpacf_mask_t *mask)
> +static __always_inline void __cpacf_query(unsigned int opcode, cpacf_mask_t *mask)
>  {
>  	register unsigned long r0 asm("0") = 0;	/* query function */
>  	register unsigned long r1 asm("1") = (unsigned long) mask;
> @@ -183,7 +184,7 @@ static inline int __cpacf_check_opcode(unsigned int opcode)
>  	}
>  }
>  
> -static inline int cpacf_query(unsigned int opcode, cpacf_mask_t *mask)
> +static __always_inline int cpacf_query(unsigned int opcode, cpacf_mask_t *mask)
>  {
>  	if (__cpacf_check_opcode(opcode)) {
>  		__cpacf_query(opcode, mask);
> diff --git a/s390x/emulator.c b/s390x/emulator.c
> index 1ee0df5..70ef51a 100644
> --- a/s390x/emulator.c
> +++ b/s390x/emulator.c
> @@ -14,6 +14,7 @@
>  #include <asm/cpacf.h>
>  #include <asm/interrupt.h>
>  #include <asm/float.h>
> +#include <linux/compiler.h>
>  
>  struct lowcore *lc = NULL;
>  
> @@ -46,7 +47,7 @@ static void test_spm_ipm(void)
>  	__test_spm_ipm(0, 0);
>  }
>  
> -static inline void __test_cpacf(unsigned int opcode, unsigned long func,
> +static __always_inline void __test_cpacf(unsigned int opcode, unsigned long func,
>  				unsigned int r1, unsigned int r2,
>  				unsigned int r3)
>  {
> @@ -59,7 +60,7 @@ static inline void __test_cpacf(unsigned int opcode, unsigned long func,
>  		         [r1] "i" (r1), [r2] "i" (r2), [r3] "i" (r3));
>  }
>  
> -static inline void __test_cpacf_r1_odd(unsigned int opcode)
> +static __always_inline void __test_cpacf_r1_odd(unsigned int opcode)
>  {
>  	report_prefix_push("r1 odd");
>  	expect_pgm_int();
> @@ -68,7 +69,7 @@ static inline void __test_cpacf_r1_odd(unsigned int opcode)
>  	report_prefix_pop();
>  }
>  
> -static inline void __test_cpacf_r1_null(unsigned int opcode)
> +static __always_inline void __test_cpacf_r1_null(unsigned int opcode)
>  {
>  	report_prefix_push("r1 null");
>  	expect_pgm_int();
> @@ -77,7 +78,7 @@ static inline void __test_cpacf_r1_null(unsigned int opcode)
>  	report_prefix_pop();
>  }
>  
> -static inline void __test_cpacf_r2_odd(unsigned int opcode)
> +static __always_inline void __test_cpacf_r2_odd(unsigned int opcode)
>  {
>  	report_prefix_push("r2 odd");
>  	expect_pgm_int();
> @@ -86,7 +87,7 @@ static inline void __test_cpacf_r2_odd(unsigned int opcode)
>  	report_prefix_pop();
>  }
>  
> -static inline void __test_cpacf_r2_null(unsigned int opcode)
> +static __always_inline void __test_cpacf_r2_null(unsigned int opcode)
>  {
>  	report_prefix_push("r2 null");
>  	expect_pgm_int();
> @@ -95,7 +96,7 @@ static inline void __test_cpacf_r2_null(unsigned int opcode)
>  	report_prefix_pop();
>  }
>  
> -static inline void __test_cpacf_r3_odd(unsigned int opcode)
> +static __always_inline void __test_cpacf_r3_odd(unsigned int opcode)
>  {
>  	report_prefix_push("r3 odd");
>  	expect_pgm_int();
> @@ -104,7 +105,7 @@ static inline void __test_cpacf_r3_odd(unsigned int opcode)
>  	report_prefix_pop();
>  }
>  
> -static inline void __test_cpacf_r3_null(unsigned int opcode)
> +static __always_inline void __test_cpacf_r3_null(unsigned int opcode)
>  {
>  	report_prefix_push("r3 null");
>  	expect_pgm_int();
> @@ -113,7 +114,7 @@ static inline void __test_cpacf_r3_null(unsigned int opcode)
>  	report_prefix_pop();
>  }
>  
> -static inline void __test_cpacf_mod_bit(unsigned int opcode)
> +static __always_inline void __test_cpacf_mod_bit(unsigned int opcode)
>  {
>  	report_prefix_push("mod bit");
>  	expect_pgm_int();
> @@ -122,7 +123,7 @@ static inline void __test_cpacf_mod_bit(unsigned int opcode)
>  	report_prefix_pop();
>  }
>  
> -static inline void __test_cpacf_invalid_func(unsigned int opcode)
> +static __always_inline void __test_cpacf_invalid_func(unsigned int opcode)
>  {
>  	report_prefix_push("invalid subfunction");
>  	expect_pgm_int();
> @@ -137,7 +138,7 @@ static inline void __test_cpacf_invalid_func(unsigned int opcode)
>  	report_prefix_pop();
>  }
>  
> -static inline void __test_cpacf_invalid_parm(unsigned int opcode)
> +static __always_inline void __test_cpacf_invalid_parm(unsigned int opcode)
>  {
>  	report_prefix_push("invalid parm address");
>  	expect_pgm_int();
> @@ -146,7 +147,7 @@ static inline void __test_cpacf_invalid_parm(unsigned int opcode)
>  	report_prefix_pop();
>  }
>  
> -static inline void __test_cpacf_protected_parm(unsigned int opcode)
> +static __always_inline void __test_cpacf_protected_parm(unsigned int opcode)
>  {
>  	report_prefix_push("protected parm address");
>  	expect_pgm_int();
> @@ -157,7 +158,7 @@ static inline void __test_cpacf_protected_parm(unsigned int opcode)
>  	report_prefix_pop();
>  }
>  
> -static inline void __test_basic_cpacf_opcode(unsigned int opcode)
> +static __always_inline void __test_basic_cpacf_opcode(unsigned int opcode)
>  {
>  	bool mod_bit_allowed = false;
>  
> 



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

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

end of thread, other threads:[~2020-07-27 11:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-27 10:26 [kvm-unit-tests PATCH v1 1/1] s390x: fix inline asm on gcc10 Claudio Imbrenda
2020-07-27 10:36 ` Thomas Huth
2020-07-27 11:04 ` Janosch Frank

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).