diff mbox series

[kvm-unit-tests,v2,1/5] lib: s390x: sigp: Dirty CC before sigp execution

Message ID 20240131074427.70871-2-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 when sigp is
emulated.

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

Comments

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

> Dirtying the CC allows us to find missing CC changes when sigp is
> emulated.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
>  lib/s390x/asm/sigp.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/s390x/asm/sigp.h b/lib/s390x/asm/sigp.h
> index 61d2c625..4eae95d0 100644
> --- a/lib/s390x/asm/sigp.h
> +++ b/lib/s390x/asm/sigp.h
> @@ -49,13 +49,17 @@ static inline int sigp(uint16_t addr, uint8_t order, unsigned long parm,
>  		       uint32_t *status)
>  {
>  	register unsigned long reg1 asm ("1") = parm;
> +	uint64_t bogus_cc = SIGP_CC_NOT_OPERATIONAL;
>  	int cc;
>  
>  	asm volatile(
> +		"	tmll	%[bogus_cc],3\n"
>  		"	sigp	%1,%2,0(%3)\n"
>  		"	ipm	%0\n"
>  		"	srl	%0,28\n"
> -		: "=d" (cc), "+d" (reg1) : "d" (addr), "a" (order) : "cc");
> +		: "=d" (cc), "+d" (reg1)
> +		: "d" (addr), "a" (order), [bogus_cc] "d" (bogus_cc)
> +		: "cc");

since you are doing changes in this inline asm, could you put names for
all the parameters? that way it will be more consistent and readable.

also in all the other patches in the series (except patch 2)

>  	if (status)
>  		*status = reg1;
>  	return cc;
Janosch Frank Jan. 31, 2024, 2:16 p.m. UTC | #2
On 1/31/24 12:56, Claudio Imbrenda wrote:
> On Wed, 31 Jan 2024 07:44:23 +0000
> Janosch Frank <frankja@linux.ibm.com> wrote:
> 
>> Dirtying the CC allows us to find missing CC changes when sigp is
>> emulated.
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>> ---
>>   lib/s390x/asm/sigp.h | 6 +++++-
>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/s390x/asm/sigp.h b/lib/s390x/asm/sigp.h
>> index 61d2c625..4eae95d0 100644
>> --- a/lib/s390x/asm/sigp.h
>> +++ b/lib/s390x/asm/sigp.h
>> @@ -49,13 +49,17 @@ static inline int sigp(uint16_t addr, uint8_t order, unsigned long parm,
>>   		       uint32_t *status)
>>   {
>>   	register unsigned long reg1 asm ("1") = parm;
>> +	uint64_t bogus_cc = SIGP_CC_NOT_OPERATIONAL;
>>   	int cc;
>>   
>>   	asm volatile(
>> +		"	tmll	%[bogus_cc],3\n"
>>   		"	sigp	%1,%2,0(%3)\n"
>>   		"	ipm	%0\n"
>>   		"	srl	%0,28\n"
>> -		: "=d" (cc), "+d" (reg1) : "d" (addr), "a" (order) : "cc");
>> +		: "=d" (cc), "+d" (reg1)
>> +		: "d" (addr), "a" (order), [bogus_cc] "d" (bogus_cc)
>> +		: "cc");
> 
> since you are doing changes in this inline asm, could you put names for
> all the parameters? that way it will be more consistent and readable.
> 

NACK, not in this series.
diff mbox series

Patch

diff --git a/lib/s390x/asm/sigp.h b/lib/s390x/asm/sigp.h
index 61d2c625..4eae95d0 100644
--- a/lib/s390x/asm/sigp.h
+++ b/lib/s390x/asm/sigp.h
@@ -49,13 +49,17 @@  static inline int sigp(uint16_t addr, uint8_t order, unsigned long parm,
 		       uint32_t *status)
 {
 	register unsigned long reg1 asm ("1") = parm;
+	uint64_t bogus_cc = SIGP_CC_NOT_OPERATIONAL;
 	int cc;
 
 	asm volatile(
+		"	tmll	%[bogus_cc],3\n"
 		"	sigp	%1,%2,0(%3)\n"
 		"	ipm	%0\n"
 		"	srl	%0,28\n"
-		: "=d" (cc), "+d" (reg1) : "d" (addr), "a" (order) : "cc");
+		: "=d" (cc), "+d" (reg1)
+		: "d" (addr), "a" (order), [bogus_cc] "d" (bogus_cc)
+		: "cc");
 	if (status)
 		*status = reg1;
 	return cc;