diff mbox series

[kvm-unit-tests,v1,1/4] s390x: user ctl_set/clear_bit for low address protection

Message ID 20180824115059.1517-2-david@redhat.com (mailing list archive)
State New, archived
Headers show
Series s390x: simple DXC test | expand

Commit Message

David Hildenbrand Aug. 24, 2018, 11:50 a.m. UTC
User the provided helper functions now.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 lib/s390x/asm/interrupt.h | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

Comments

Thomas Huth Aug. 27, 2018, 8:19 a.m. UTC | #1
On 2018-08-24 13:50, David Hildenbrand wrote:
> User the provided helper functions now.
> 
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  lib/s390x/asm/interrupt.h | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/lib/s390x/asm/interrupt.h b/lib/s390x/asm/interrupt.h
> index b3abd63..013709f 100644
> --- a/lib/s390x/asm/interrupt.h
> +++ b/lib/s390x/asm/interrupt.h
> @@ -23,21 +23,13 @@ void check_pgm_int_code(uint16_t code);
>  /* Activate low-address protection */
>  static inline void low_prot_enable(void)
>  {
> -	uint64_t cr0;
> -
> -	asm volatile (" stctg %%c0,%%c0,%0 " : : "Q"(cr0) : "memory");
> -	cr0 |= 1ULL << (63-35);
> -	asm volatile (" lctlg %%c0,%%c0,%0 " : : "Q"(cr0));
> +	ctl_set_bit(0, 63 - 35);
>  }
>  
>  /* Disable low-address protection */
>  static inline void low_prot_disable(void)
>  {
> -	uint64_t cr0;
> -
> -	asm volatile (" stctg %%c0,%%c0,%0 " : : "Q"(cr0) : "memory");
> -	cr0 &= ~(1ULL << (63-35));
> -	asm volatile (" lctlg %%c0,%%c0,%0 " : : "Q"(cr0));
> +	ctl_clear_bit(0, 63 - 35);
>  }
>  
>  #endif

Reviewed-by: Thomas Huth <thuth@redhat.com>
Janosch Frank Aug. 27, 2018, 2:38 p.m. UTC | #2
On 24.08.2018 13:50, David Hildenbrand wrote:
> User the provided helper functions now.
> 
> Signed-off-by: David Hildenbrand <david@redhat.com>

s/User/Use/

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

> ---
>  lib/s390x/asm/interrupt.h | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/lib/s390x/asm/interrupt.h b/lib/s390x/asm/interrupt.h
> index b3abd63..013709f 100644
> --- a/lib/s390x/asm/interrupt.h
> +++ b/lib/s390x/asm/interrupt.h
> @@ -23,21 +23,13 @@ void check_pgm_int_code(uint16_t code);
>  /* Activate low-address protection */
>  static inline void low_prot_enable(void)
>  {
> -	uint64_t cr0;
> -
> -	asm volatile (" stctg %%c0,%%c0,%0 " : : "Q"(cr0) : "memory");
> -	cr0 |= 1ULL << (63-35);
> -	asm volatile (" lctlg %%c0,%%c0,%0 " : : "Q"(cr0));
> +	ctl_set_bit(0, 63 - 35);
>  }
>  
>  /* Disable low-address protection */
>  static inline void low_prot_disable(void)
>  {
> -	uint64_t cr0;
> -
> -	asm volatile (" stctg %%c0,%%c0,%0 " : : "Q"(cr0) : "memory");
> -	cr0 &= ~(1ULL << (63-35));
> -	asm volatile (" lctlg %%c0,%%c0,%0 " : : "Q"(cr0));
> +	ctl_clear_bit(0, 63 - 35);
>  }
>  
>  #endif
>
diff mbox series

Patch

diff --git a/lib/s390x/asm/interrupt.h b/lib/s390x/asm/interrupt.h
index b3abd63..013709f 100644
--- a/lib/s390x/asm/interrupt.h
+++ b/lib/s390x/asm/interrupt.h
@@ -23,21 +23,13 @@  void check_pgm_int_code(uint16_t code);
 /* Activate low-address protection */
 static inline void low_prot_enable(void)
 {
-	uint64_t cr0;
-
-	asm volatile (" stctg %%c0,%%c0,%0 " : : "Q"(cr0) : "memory");
-	cr0 |= 1ULL << (63-35);
-	asm volatile (" lctlg %%c0,%%c0,%0 " : : "Q"(cr0));
+	ctl_set_bit(0, 63 - 35);
 }
 
 /* Disable low-address protection */
 static inline void low_prot_disable(void)
 {
-	uint64_t cr0;
-
-	asm volatile (" stctg %%c0,%%c0,%0 " : : "Q"(cr0) : "memory");
-	cr0 &= ~(1ULL << (63-35));
-	asm volatile (" lctlg %%c0,%%c0,%0 " : : "Q"(cr0));
+	ctl_clear_bit(0, 63 - 35);
 }
 
 #endif