diff mbox series

[kvm-unit-tests,v2,2/5] lib: s390x: uv: Dirty CC before uvc execution

Message ID 20240131074427.70871-3-frankja@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x: Dirty cc before executing tested instructions | expand

Commit Message

Janosch Frank Jan. 31, 2024, 7:44 a.m. UTC
Dirtying the CC allows us to find missing CC changes.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
 lib/s390x/asm/uv.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Claudio Imbrenda Jan. 31, 2024, 11:50 a.m. UTC | #1
On Wed, 31 Jan 2024 07:44:24 +0000
Janosch Frank <frankja@linux.ibm.com> wrote:

> Dirtying the CC allows us to find missing CC changes.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>

> ---
>  lib/s390x/asm/uv.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/s390x/asm/uv.h b/lib/s390x/asm/uv.h
> index e9fb19af..611dcd3f 100644
> --- a/lib/s390x/asm/uv.h
> +++ b/lib/s390x/asm/uv.h
> @@ -216,14 +216,16 @@ struct uv_cb_ssc {
>  
>  static inline int uv_call_once(unsigned long r1, unsigned long r2)
>  {
> +	uint64_t bogus_cc = 1;
>  	int cc;
>  
>  	asm volatile(
> +		"	tmll    %[bogus_cc],3\n"
>  		"0:	.insn rrf,0xB9A40000,%[r1],%[r2],0,0\n"
>  		"		ipm	%[cc]\n"
>  		"		srl	%[cc],28\n"
>  		: [cc] "=d" (cc)
> -		: [r1] "a" (r1), [r2] "a" (r2)
> +		: [r1] "a" (r1), [r2] "a" (r2), [bogus_cc] "d" (bogus_cc)
>  		: "memory", "cc");
>  
>  	if (UVC_ERR_DEBUG && cc == 1)
diff mbox series

Patch

diff --git a/lib/s390x/asm/uv.h b/lib/s390x/asm/uv.h
index e9fb19af..611dcd3f 100644
--- a/lib/s390x/asm/uv.h
+++ b/lib/s390x/asm/uv.h
@@ -216,14 +216,16 @@  struct uv_cb_ssc {
 
 static inline int uv_call_once(unsigned long r1, unsigned long r2)
 {
+	uint64_t bogus_cc = 1;
 	int cc;
 
 	asm volatile(
+		"	tmll    %[bogus_cc],3\n"
 		"0:	.insn rrf,0xB9A40000,%[r1],%[r2],0,0\n"
 		"		ipm	%[cc]\n"
 		"		srl	%[cc],28\n"
 		: [cc] "=d" (cc)
-		: [r1] "a" (r1), [r2] "a" (r2)
+		: [r1] "a" (r1), [r2] "a" (r2), [bogus_cc] "d" (bogus_cc)
 		: "memory", "cc");
 
 	if (UVC_ERR_DEBUG && cc == 1)