public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Janosch Frank <frankja@linux.ibm.com>
To: Claudio Imbrenda <imbrenda@linux.ibm.com>, kvm@vger.kernel.org
Cc: linux-s390@vger.kernel.org, david@redhat.com, thuth@redhat.com,
	cohuck@redhat.com, pmorel@linux.ibm.com
Subject: Re: [kvm-unit-tests PATCH v3 1/7] s390x: lib: add and use macros for control register bits
Date: Mon, 12 Apr 2021 14:38:59 +0200	[thread overview]
Message-ID: <20ad1009-60c0-c59e-1db1-27670a51418e@linux.ibm.com> (raw)
In-Reply-To: <20210407124209.828540-2-imbrenda@linux.ibm.com>

On 4/7/21 2:42 PM, Claudio Imbrenda wrote:
> Add CTL0_* and CTL2_* macros for specific control register bits.
> 
> Replace all hardcoded values in the library and in the existing testcases so
> that they use the new macros.
> 
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>

Finally :-)

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

> ---
>  lib/s390x/asm/arch_def.h  | 12 ++++++++++++
>  lib/s390x/asm/float.h     |  4 ++--
>  lib/s390x/asm/interrupt.h |  4 ++--
>  lib/s390x/sclp.c          |  4 ++--
>  s390x/diag288.c           |  2 +-
>  s390x/gs.c                |  2 +-
>  s390x/iep.c               |  4 ++--
>  s390x/skrf.c              |  2 +-
>  s390x/smp.c               |  8 ++++----
>  s390x/vector.c            |  2 +-
>  10 files changed, 28 insertions(+), 16 deletions(-)
> 
> diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
> index 7e2c5e62..c3568ab9 100644
> --- a/lib/s390x/asm/arch_def.h
> +++ b/lib/s390x/asm/arch_def.h
> @@ -229,6 +229,18 @@ static inline uint64_t stctg(int cr)
>  	return value;
>  }
>  
> +#define CTL0_LOW_ADDR_PROT	(63 - 35)
> +#define CTL0_EDAT		(63 - 40)
> +#define CTL0_IEP		(63 - 43)
> +#define CTL0_AFP		(63 - 45)
> +#define CTL0_VECTOR		(63 - 46)
> +#define CTL0_EMERGENCY_SIGNAL	(63 - 49)
> +#define CTL0_EXTERNAL_CALL	(63 - 50)
> +#define CTL0_CLOCK_COMPARATOR	(63 - 52)
> +#define CTL0_SERVICE_SIGNAL	(63 - 54)
> +
> +#define CTL2_GUARDED_STORAGE	(63 - 59)
> +
>  static inline void ctl_set_bit(int cr, unsigned int bit)
>  {
>          uint64_t reg;
> diff --git a/lib/s390x/asm/float.h b/lib/s390x/asm/float.h
> index 13679447..98829918 100644
> --- a/lib/s390x/asm/float.h
> +++ b/lib/s390x/asm/float.h
> @@ -38,12 +38,12 @@ static inline void set_fpc_dxc(uint8_t dxc)
>  
>  static inline void afp_enable(void)
>  {
> -	ctl_set_bit(0, 63 - 45);
> +	ctl_set_bit(0, CTL0_AFP);
>  }
>  
>  static inline void afp_disable(void)
>  {
> -	ctl_clear_bit(0, 63 - 45);
> +	ctl_clear_bit(0, CTL0_AFP);
>  }
>  
>  #endif
> diff --git a/lib/s390x/asm/interrupt.h b/lib/s390x/asm/interrupt.h
> index 31e4766d..bf0eb40d 100644
> --- a/lib/s390x/asm/interrupt.h
> +++ b/lib/s390x/asm/interrupt.h
> @@ -27,13 +27,13 @@ void check_pgm_int_code(uint16_t code);
>  /* Activate low-address protection */
>  static inline void low_prot_enable(void)
>  {
> -	ctl_set_bit(0, 63 - 35);
> +	ctl_set_bit(0, CTL0_LOW_ADDR_PROT);
>  }
>  
>  /* Disable low-address protection */
>  static inline void low_prot_disable(void)
>  {
> -	ctl_clear_bit(0, 63 - 35);
> +	ctl_clear_bit(0, CTL0_LOW_ADDR_PROT);
>  }
>  
>  #endif
> diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
> index 7a9b2c52..0d0b3d6a 100644
> --- a/lib/s390x/sclp.c
> +++ b/lib/s390x/sclp.c
> @@ -50,7 +50,7 @@ void sclp_setup_int(void)
>  {
>  	uint64_t mask;
>  
> -	ctl_set_bit(0, 9);
> +	ctl_set_bit(0, CTL0_SERVICE_SIGNAL);
>  
>  	mask = extract_psw_mask();
>  	mask |= PSW_MASK_EXT;
> @@ -59,7 +59,7 @@ void sclp_setup_int(void)
>  
>  void sclp_handle_ext(void)
>  {
> -	ctl_clear_bit(0, 9);
> +	ctl_clear_bit(0, CTL0_SERVICE_SIGNAL);
>  	spin_lock(&sclp_lock);
>  	sclp_busy = false;
>  	spin_unlock(&sclp_lock);
> diff --git a/s390x/diag288.c b/s390x/diag288.c
> index e132ff04..82b6ec17 100644
> --- a/s390x/diag288.c
> +++ b/s390x/diag288.c
> @@ -86,7 +86,7 @@ static void test_bite(void)
>  	asm volatile("stck %0" : "=Q" (time) : : "cc");
>  	time += (uint64_t)(16000 * 1000) << 12;
>  	asm volatile("sckc %0" : : "Q" (time));
> -	ctl_set_bit(0, 11);
> +	ctl_set_bit(0, CTL0_CLOCK_COMPARATOR);
>  	mask = extract_psw_mask();
>  	mask |= PSW_MASK_EXT;
>  	load_psw_mask(mask);
> diff --git a/s390x/gs.c b/s390x/gs.c
> index 1376d0e6..a017a97d 100644
> --- a/s390x/gs.c
> +++ b/s390x/gs.c
> @@ -145,7 +145,7 @@ static void test_special(void)
>  static void init(void)
>  {
>  	/* Enable control bit for gs */
> -	ctl_set_bit(2, 4);
> +	ctl_set_bit(2, CTL2_GUARDED_STORAGE);
>  
>  	/* Setup gs registers to guard the gs_area */
>  	gs_cb.gsd = gs_area | 25;
> diff --git a/s390x/iep.c b/s390x/iep.c
> index fe167ef0..906c77b3 100644
> --- a/s390x/iep.c
> +++ b/s390x/iep.c
> @@ -22,7 +22,7 @@ static void test_iep(void)
>  	void (*fn)(void);
>  
>  	/* Enable IEP */
> -	ctl_set_bit(0, 20);
> +	ctl_set_bit(0, CTL0_IEP);
>  
>  	/* Get and protect a page with the IEP bit */
>  	iepbuf = alloc_page();
> @@ -40,7 +40,7 @@ static void test_iep(void)
>  	check_pgm_int_code(PGM_INT_CODE_PROTECTION);
>  	report_prefix_pop();
>  	unprotect_page(iepbuf, PAGE_ENTRY_IEP);
> -	ctl_clear_bit(0, 20);
> +	ctl_clear_bit(0, CTL0_IEP);
>  	free_page(iepbuf);
>  }
>  
> diff --git a/s390x/skrf.c b/s390x/skrf.c
> index 57524ba8..94e906a6 100644
> --- a/s390x/skrf.c
> +++ b/s390x/skrf.c
> @@ -150,7 +150,7 @@ static void ecall_setup(void)
>  	/* Put a skey into the ext new psw */
>  	lc->ext_new_psw.mask = 0x00F0000180000000UL;
>  	/* Open up ext masks */
> -	ctl_set_bit(0, 13);
> +	ctl_set_bit(0, CTL0_EXTERNAL_CALL);
>  	mask = extract_psw_mask();
>  	mask |= PSW_MASK_EXT;
>  	load_psw_mask(mask);
> diff --git a/s390x/smp.c b/s390x/smp.c
> index b0ece491..f25ec769 100644
> --- a/s390x/smp.c
> +++ b/s390x/smp.c
> @@ -154,7 +154,7 @@ static void ecall(void)
>  	struct lowcore *lc = (void *)0x0;
>  
>  	expect_ext_int();
> -	ctl_set_bit(0, 13);
> +	ctl_set_bit(0, CTL0_EXTERNAL_CALL);
>  	mask = extract_psw_mask();
>  	mask |= PSW_MASK_EXT;
>  	load_psw_mask(mask);
> @@ -188,7 +188,7 @@ static void emcall(void)
>  	struct lowcore *lc = (void *)0x0;
>  
>  	expect_ext_int();
> -	ctl_set_bit(0, 14);
> +	ctl_set_bit(0, CTL0_EMERGENCY_SIGNAL);
>  	mask = extract_psw_mask();
>  	mask |= PSW_MASK_EXT;
>  	load_psw_mask(mask);
> @@ -283,8 +283,8 @@ static void test_local_ints(void)
>  	unsigned long mask;
>  
>  	/* Open masks for ecall and emcall */
> -	ctl_set_bit(0, 13);
> -	ctl_set_bit(0, 14);
> +	ctl_set_bit(0, CTL0_EXTERNAL_CALL);
> +	ctl_set_bit(0, CTL0_EMERGENCY_SIGNAL);
>  	mask = extract_psw_mask();
>  	mask |= PSW_MASK_EXT;
>  	load_psw_mask(mask);
> diff --git a/s390x/vector.c b/s390x/vector.c
> index d1b6a571..f642ef67 100644
> --- a/s390x/vector.c
> +++ b/s390x/vector.c
> @@ -106,7 +106,7 @@ static void test_bcd_add(void)
>  static void init(void)
>  {
>  	/* Enable vector instructions */
> -	ctl_set_bit(0, 17);
> +	ctl_set_bit(0, CTL0_VECTOR);
>  
>  	/* Preset vector registers to 0xff */
>  	memset(pagebuf, 0xff, PAGE_SIZE);
> 


  reply	other threads:[~2021-04-12 12:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07 12:42 [kvm-unit-tests PATCH v3 0/7] s390: Add support for large pages Claudio Imbrenda
2021-04-07 12:42 ` [kvm-unit-tests PATCH v3 1/7] s390x: lib: add and use macros for control register bits Claudio Imbrenda
2021-04-12 12:38   ` Janosch Frank [this message]
2021-04-07 12:42 ` [kvm-unit-tests PATCH v3 2/7] libcflat: add SZ_1M and SZ_2G Claudio Imbrenda
2021-04-07 12:42 ` [kvm-unit-tests PATCH v3 3/7] s390x: lib: fix pgtable.h Claudio Imbrenda
2021-04-07 12:42 ` [kvm-unit-tests PATCH v3 4/7] s390x: lib: Add idte and other huge pages functions/macros Claudio Imbrenda
2021-04-07 12:42 ` [kvm-unit-tests PATCH v3 5/7] s390x: lib: add PGM_TEID_* macros Claudio Imbrenda
2021-04-12 13:49   ` Janosch Frank
2021-04-07 12:42 ` [kvm-unit-tests PATCH v3 6/7] s390x: mmu: add support for large pages Claudio Imbrenda
2021-04-07 12:42 ` [kvm-unit-tests PATCH v3 7/7] s390x: edat test Claudio Imbrenda
2021-04-12 13:52   ` Janosch Frank

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20ad1009-60c0-c59e-1db1-27670a51418e@linux.ibm.com \
    --to=frankja@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pmorel@linux.ibm.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox