Re: [kvm-unit-tests PATCH v4 2/9] s390x: Use PSW bits definitions in cstart

Janosch Frank
2019-12-12T09:31:50Z

[-- Attachment #1.1: Type: text/plain, Size: 3088 bytes --]

On 12/11/19 4:46 PM, Pierre Morel wrote:
> This patch defines the PSW bits EA/BA used to initialize the PSW masks
> for exceptions.
>
> Since some PSW mask definitions exist already in arch_def.h we add these
> definitions there.
> We move all PSW definitions together and protect assembler code against
> C syntax.
>
> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> ---
> lib/s390x/asm/arch_def.h | 16 ++++++++++++----
> s390x/cstart64.S | 15 ++++++++-------
> 2 files changed, 20 insertions(+), 11 deletions(-)
>
> diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
> index cf6e1ca..b6bb8c1 100644
> --- a/lib/s390x/asm/arch_def.h
> +++ b/lib/s390x/asm/arch_def.h
> @@ -10,15 +10,22 @@
> #ifndef _ASM_S390X_ARCH_DEF_H_
> #define _ASM_S390X_ARCH_DEF_H_
>
> +#define PSW_MASK_IO 0x0200000000000000UL

That's new and not used in this patch, please move it to the patch where
it's needed.

> +#define PSW_MASK_EXT 0x0100000000000000UL
> +#define PSW_MASK_DAT 0x0400000000000000UL
> +#define PSW_MASK_PSTATE 0x0001000000000000UL
> +#define PSW_MASK_BA 0x0000000080000000UL
> +#define PSW_MASK_EA 0x0000000100000000UL
> +
> +
> +#define PSW_EXCEPTION_MASK (PSW_MASK_EA|PSW_MASK_BA)
> +
> +#ifndef __ASSEMBLER__

\n

> struct psw {
> uint64_t mask;
> uint64_t addr;
> };
>
> -#define PSW_MASK_EXT 0x0100000000000000UL
> -#define PSW_MASK_DAT 0x0400000000000000UL
> -#define PSW_MASK_PSTATE 0x0001000000000000UL
> -
> #define CR0_EXTM_SCLP 0X0000000000000200UL
> #define CR0_EXTM_EXTC 0X0000000000002000UL
> #define CR0_EXTM_EMGC 0X0000000000004000UL
> @@ -272,3 +279,4 @@ static inline int stsi(void *addr, int fc, int sel1, int sel2)
> }
>
> #endif
> +#endif

Please add a comment to which ifdef this endif belongs.

> diff --git a/s390x/cstart64.S b/s390x/cstart64.S
> index ff05f9b..56a2045 100644
> --- a/s390x/cstart64.S
> +++ b/s390x/cstart64.S
> @@ -12,6 +12,7 @@
> */
> #include <asm/asm-offsets.h>
> #include <asm/sigp.h>
> +#include <asm/arch_def.h>
>
> .section .init
>
> @@ -214,19 +215,19 @@ svc_int:
>
> .align 8
> reset_psw:
> - .quad 0x0008000180000000
> + .quad PSW_EXCEPTION_MASK
> initial_psw:
> - .quad 0x0000000180000000, clear_bss_start
> + .quad PSW_EXCEPTION_MASK, clear_bss_start
> pgm_int_psw:
> - .quad 0x0000000180000000, pgm_int
> + .quad PSW_EXCEPTION_MASK, pgm_int
> ext_int_psw:
> - .quad 0x0000000180000000, ext_int
> + .quad PSW_EXCEPTION_MASK, ext_int
> mcck_int_psw:
> - .quad 0x0000000180000000, mcck_int
> + .quad PSW_EXCEPTION_MASK, mcck_int
> io_int_psw:
> - .quad 0x0000000180000000, io_int
> + .quad PSW_EXCEPTION_MASK, io_int
> svc_int_psw:
> - .quad 0x0000000180000000, svc_int
> + .quad PSW_EXCEPTION_MASK, svc_int

> initial_cr0:
> /* enable AFP-register control, so FP regs (+BFP instr) can be used */
> .quad 0x0000000000040000

Could you maybe also fix that up in a separate patch and use the same
constant in lib/s390x/smp.c

>

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]