diff mbox series

[kvm-unit-tests,v5,3/4] s390x: lib: add SPX and STPX instruction wrapper

Message ID 20200108161317.268928-4-imbrenda@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x: SCLP Unit test | expand

Commit Message

Claudio Imbrenda Jan. 8, 2020, 4:13 p.m. UTC
Add a wrapper for the SET PREFIX and STORE PREFIX instructions, and
use it instead of using inline assembly everywhere.

Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 lib/s390x/asm/arch_def.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Thomas Huth Jan. 8, 2020, 6:58 p.m. UTC | #1
On 08/01/2020 17.13, Claudio Imbrenda wrote:
> Add a wrapper for the SET PREFIX and STORE PREFIX instructions, and
> use it instead of using inline assembly everywhere.

Either some hunks are missing in this patch, or you should update the
patch description and remove the second part of the sentence ? ... at
least I did not spot the changes where you "use it instead of using
inline assembly everywhere".

 Thomas


> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
>  lib/s390x/asm/arch_def.h | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
> index 1a5e3c6..38c9dfa 100644
> --- a/lib/s390x/asm/arch_def.h
> +++ b/lib/s390x/asm/arch_def.h
> @@ -284,4 +284,17 @@ static inline int servc(uint32_t command, unsigned long sccb)
>  	return cc;
>  }
>  
> +static inline void spx(uint32_t new_prefix)
> +{
> +	asm volatile("spx %0" : : "Q" (new_prefix) : "memory");
> +}
> +
> +static inline uint32_t stpx(void)
> +{
> +	uint32_t prefix;
> +
> +	asm volatile("stpx %0" : "=Q" (prefix));
> +	return prefix;
> +}
> +
>  #endif
>
Claudio Imbrenda Jan. 9, 2020, 11:36 a.m. UTC | #2
On Wed, 8 Jan 2020 19:58:27 +0100
Thomas Huth <thuth@redhat.com> wrote:

> On 08/01/2020 17.13, Claudio Imbrenda wrote:
> > Add a wrapper for the SET PREFIX and STORE PREFIX instructions, and
> > use it instead of using inline assembly everywhere.  
> 
> Either some hunks are missing in this patch, or you should update the
> patch description and remove the second part of the sentence ? ... at
> least I did not spot the changes where you "use it instead of using
> inline assembly everywhere".


oops sorry, the description is a little misleading. I meant
everywhere in the specific unit test, not everywhere in the whole
source tree. 

I should either change the description or actually patch the remaining
users of inline assembly to use the wrappers instead. (any preference?)
Thomas Huth Jan. 9, 2020, 12:55 p.m. UTC | #3
On 09/01/2020 12.36, Claudio Imbrenda wrote:
> On Wed, 8 Jan 2020 19:58:27 +0100
> Thomas Huth <thuth@redhat.com> wrote:
> 
>> On 08/01/2020 17.13, Claudio Imbrenda wrote:
>>> Add a wrapper for the SET PREFIX and STORE PREFIX instructions, and
>>> use it instead of using inline assembly everywhere.  
>>
>> Either some hunks are missing in this patch, or you should update the
>> patch description and remove the second part of the sentence ? ... at
>> least I did not spot the changes where you "use it instead of using
>> inline assembly everywhere".
> 
> 
> oops sorry, the description is a little misleading. I meant
> everywhere in the specific unit test, not everywhere in the whole
> source tree. 
> 
> I should either change the description or actually patch the remaining
> users of inline assembly to use the wrappers instead. (any preference?)

No preferences from my side. If you don't want/have to respin, the patch
description could be fixed when picking up the patch, otherwise simply
do whatever you prefer in v6.

 Thomas
diff mbox series

Patch

diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
index 1a5e3c6..38c9dfa 100644
--- a/lib/s390x/asm/arch_def.h
+++ b/lib/s390x/asm/arch_def.h
@@ -284,4 +284,17 @@  static inline int servc(uint32_t command, unsigned long sccb)
 	return cc;
 }
 
+static inline void spx(uint32_t new_prefix)
+{
+	asm volatile("spx %0" : : "Q" (new_prefix) : "memory");
+}
+
+static inline uint32_t stpx(void)
+{
+	uint32_t prefix;
+
+	asm volatile("stpx %0" : "=Q" (prefix));
+	return prefix;
+}
+
 #endif