diff options
author | Heiko Carstens <hca@linux.ibm.com> | 2023-09-11 21:40:04 +0200 |
---|---|---|
committer | Vasily Gorbik <gor@linux.ibm.com> | 2023-09-19 13:26:56 +0200 |
commit | 527618abb92793b9d4dba548d55822dcebd95317 (patch) | |
tree | a33943001b1f0134ffc09e4cf0ecf1d267e44779 /arch/s390/kernel | |
parent | ecc53818f60447177e24ea11b7f136c405150976 (diff) | |
download | linux-stable-527618abb92793b9d4dba548d55822dcebd95317.tar.gz linux-stable-527618abb92793b9d4dba548d55822dcebd95317.tar.bz2 linux-stable-527618abb92793b9d4dba548d55822dcebd95317.zip |
s390/ctlreg: add struct ctlreg
Add struct ctlreg to enforce strict type checking / usage for control
register functions.
Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Diffstat (limited to 'arch/s390/kernel')
-rw-r--r-- | arch/s390/kernel/ctlreg.c | 10 | ||||
-rw-r--r-- | arch/s390/kernel/kprobes.c | 14 | ||||
-rw-r--r-- | arch/s390/kernel/machine_kexec.c | 6 | ||||
-rw-r--r-- | arch/s390/kernel/nmi.c | 12 | ||||
-rw-r--r-- | arch/s390/kernel/ptrace.c | 38 | ||||
-rw-r--r-- | arch/s390/kernel/setup.c | 12 | ||||
-rw-r--r-- | arch/s390/kernel/smp.c | 8 |
7 files changed, 50 insertions, 50 deletions
diff --git a/arch/s390/kernel/ctlreg.c b/arch/s390/kernel/ctlreg.c index 1c9fee1ca4a3..14f715bc5f73 100644 --- a/arch/s390/kernel/ctlreg.c +++ b/arch/s390/kernel/ctlreg.c @@ -36,11 +36,11 @@ struct ctl_bit_parms { static void ctl_bit_callback(void *info) { struct ctl_bit_parms *pp = info; - unsigned long regs[16]; + struct ctlreg regs[16]; __local_ctl_store(0, 15, regs); - regs[pp->cr] &= pp->andval; - regs[pp->cr] |= pp->orval; + regs[pp->cr].val &= pp->andval; + regs[pp->cr].val |= pp->orval; __local_ctl_load(0, 15, regs); } @@ -53,8 +53,8 @@ void system_ctl_set_clear_bit(unsigned int cr, unsigned int bit, bool set) pp.andval = set ? -1UL : ~(1UL << bit); system_ctlreg_lock(); abs_lc = get_abs_lowcore(); - abs_lc->cregs_save_area[cr] &= pp.andval; - abs_lc->cregs_save_area[cr] |= pp.orval; + abs_lc->cregs_save_area[cr].val &= pp.andval; + abs_lc->cregs_save_area[cr].val |= pp.orval; put_abs_lowcore(abs_lc); on_each_cpu(ctl_bit_callback, &pp, 1); system_ctlreg_unlock(); diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c index d4c2ece4f839..f0cf20d4b3c5 100644 --- a/arch/s390/kernel/kprobes.c +++ b/arch/s390/kernel/kprobes.c @@ -225,18 +225,18 @@ static void enable_singlestep(struct kprobe_ctlblk *kcb, unsigned long ip) { union { - unsigned long regs[3]; + struct ctlreg regs[3]; struct { - unsigned long control; - unsigned long start; - unsigned long end; + struct ctlreg control; + struct ctlreg start; + struct ctlreg end; }; } per_kprobe; /* Set up the PER control registers %cr9-%cr11 */ - per_kprobe.control = PER_EVENT_IFETCH; - per_kprobe.start = ip; - per_kprobe.end = ip; + per_kprobe.control.val = PER_EVENT_IFETCH; + per_kprobe.start.val = ip; + per_kprobe.end.val = ip; /* Save control regs and psw mask */ __local_ctl_store(9, 11, kcb->kprobe_saved_ctl); diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c index fe9d65060fa4..bb0d4d68fcbe 100644 --- a/arch/s390/kernel/machine_kexec.c +++ b/arch/s390/kernel/machine_kexec.c @@ -94,12 +94,12 @@ static noinline void __machine_kdump(void *image) if (MACHINE_HAS_VX) save_vx_regs((__vector128 *) mcesa->vector_save_area); if (MACHINE_HAS_GS) { - local_ctl_store(2, &cr2_old.val); + local_ctl_store(2, &cr2_old.reg); cr2_new = cr2_old; cr2_new.gse = 1; - local_ctl_load(2, &cr2_new.val); + local_ctl_load(2, &cr2_new.reg); save_gs_cb((struct gs_cb *) mcesa->guarded_storage_save_area); - local_ctl_load(2, &cr2_old.val); + local_ctl_load(2, &cr2_old.reg); } /* * To create a good backchain for this CPU in the dump store_status diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c index 7880a42896a3..579cebc58d8c 100644 --- a/arch/s390/kernel/nmi.c +++ b/arch/s390/kernel/nmi.c @@ -131,10 +131,10 @@ static notrace void s390_handle_damage(void) * Disable low address protection and make machine check new PSW a * disabled wait PSW. Any additional machine check cannot be handled. */ - local_ctl_store(0, &cr0.val); + local_ctl_store(0, &cr0.reg); cr0_new = cr0; cr0_new.lap = 0; - local_ctl_load(0, &cr0_new.val); + local_ctl_load(0, &cr0_new.reg); psw_save = S390_lowcore.mcck_new_psw; psw_bits(S390_lowcore.mcck_new_psw).io = 0; psw_bits(S390_lowcore.mcck_new_psw).ext = 0; @@ -146,7 +146,7 @@ static notrace void s390_handle_damage(void) * values. This makes possible system dump analysis easier. */ S390_lowcore.mcck_new_psw = psw_save; - local_ctl_load(0, &cr0.val); + local_ctl_load(0, &cr0.reg); disabled_wait(); while (1); } @@ -269,9 +269,9 @@ static int notrace s390_validate_registers(union mci mci) */ if (!mci.vr && !test_cpu_flag(CIF_MCCK_GUEST)) kill_task = 1; - cr0.val = S390_lowcore.cregs_save_area[0]; + cr0.reg = S390_lowcore.cregs_save_area[0]; cr0.afp = cr0.vx = 1; - local_ctl_load(0, &cr0.val); + local_ctl_load(0, &cr0.reg); asm volatile( " la 1,%0\n" " VLM 0,15,0,1\n" @@ -290,7 +290,7 @@ static int notrace s390_validate_registers(union mci mci) if (!mci.ar) kill_task = 1; /* Validate guarded storage registers */ - cr2.val = S390_lowcore.cregs_save_area[2]; + cr2.reg = S390_lowcore.cregs_save_area[2]; if (cr2.gse) { if (!mci.gs) { /* diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index 1e1de907f24d..6a825351ff41 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c @@ -45,16 +45,16 @@ void update_cr_regs(struct task_struct *task) union ctlreg2 cr2_old, cr2_new; int cr0_changed, cr2_changed; union { - unsigned long regs[3]; + struct ctlreg regs[3]; struct { - unsigned long control; - unsigned long start; - unsigned long end; + struct ctlreg control; + struct ctlreg start; + struct ctlreg end; }; } old, new; - local_ctl_store(0, &cr0_old.val); - local_ctl_store(2, &cr2_old.val); + local_ctl_store(0, &cr0_old.reg); + local_ctl_store(2, &cr2_old.reg); cr0_new = cr0_old; cr2_new = cr2_old; /* Take care of the enable/disable of transactional execution. */ @@ -82,31 +82,31 @@ void update_cr_regs(struct task_struct *task) cr0_changed = cr0_new.val != cr0_old.val; cr2_changed = cr2_new.val != cr2_old.val; if (cr0_changed) - local_ctl_load(0, &cr0_new.val); + local_ctl_load(0, &cr0_new.reg); if (cr2_changed) - local_ctl_load(2, &cr2_new.val); + local_ctl_load(2, &cr2_new.reg); /* Copy user specified PER registers */ - new.control = thread->per_user.control; - new.start = thread->per_user.start; - new.end = thread->per_user.end; + new.control.val = thread->per_user.control; + new.start.val = thread->per_user.start; + new.end.val = thread->per_user.end; /* merge TIF_SINGLE_STEP into user specified PER registers. */ if (test_tsk_thread_flag(task, TIF_SINGLE_STEP) || test_tsk_thread_flag(task, TIF_UPROBE_SINGLESTEP)) { if (test_tsk_thread_flag(task, TIF_BLOCK_STEP)) - new.control |= PER_EVENT_BRANCH; + new.control.val |= PER_EVENT_BRANCH; else - new.control |= PER_EVENT_IFETCH; - new.control |= PER_CONTROL_SUSPENSION; - new.control |= PER_EVENT_TRANSACTION_END; + new.control.val |= PER_EVENT_IFETCH; + new.control.val |= PER_CONTROL_SUSPENSION; + new.control.val |= PER_EVENT_TRANSACTION_END; if (test_tsk_thread_flag(task, TIF_UPROBE_SINGLESTEP)) - new.control |= PER_EVENT_IFETCH; - new.start = 0; - new.end = -1UL; + new.control.val |= PER_EVENT_IFETCH; + new.start.val = 0; + new.end.val = -1UL; } /* Take care of the PER enablement bit in the PSW. */ - if (!(new.control & PER_EVENT_MASK)) { + if (!(new.control.val & PER_EVENT_MASK)) { regs->psw.mask &= ~PSW_MASK_PER; return; } diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 2c4bfe41d284..1c049a65c769 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c @@ -791,15 +791,15 @@ static void __init setup_cr(void) __ctl_duct[4] = (unsigned long)__ctl_duald; /* Update control registers CR2, CR5 and CR15 */ - local_ctl_store(2, &cr2.val); - local_ctl_store(5, &cr5.val); - local_ctl_store(15, &cr15.val); + local_ctl_store(2, &cr2.reg); + local_ctl_store(5, &cr5.reg); + local_ctl_store(15, &cr15.reg); cr2.ducto = (unsigned long)__ctl_duct >> 6; cr5.pasteo = (unsigned long)__ctl_duct >> 6; cr15.lsea = (unsigned long)__ctl_linkage_stack >> 3; - local_ctl_load(2, &cr2.val); - local_ctl_load(5, &cr5.val); - local_ctl_load(15, &cr15.val); + local_ctl_load(2, &cr2.reg); + local_ctl_load(5, &cr5.reg); + local_ctl_load(15, &cr15.reg); } /* diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 90d3502379aa..fbd2801c7061 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c @@ -910,7 +910,7 @@ early_param("possible_cpus", _setup_possible_cpus); int __cpu_disable(void) { - unsigned long cregs[16]; + struct ctlreg cregs[16]; int cpu; /* Handle possible pending IPIs */ @@ -923,9 +923,9 @@ int __cpu_disable(void) pfault_fini(); /* Disable interrupt sources via control register. */ __local_ctl_store(0, 15, cregs); - cregs[0] &= ~0x0000ee70UL; /* disable all external interrupts */ - cregs[6] &= ~0xff000000UL; /* disable all I/O interrupts */ - cregs[14] &= ~0x1f000000UL; /* disable most machine checks */ + cregs[0].val &= ~0x0000ee70UL; /* disable all external interrupts */ + cregs[6].val &= ~0xff000000UL; /* disable all I/O interrupts */ + cregs[14].val &= ~0x1f000000UL; /* disable most machine checks */ __local_ctl_load(0, 15, cregs); clear_cpu_flag(CIF_NOHZ_DELAY); return 0; |