s390: use control register bit defines
authorHeiko Carstens <hca@linux.ibm.com>
Mon, 11 Sep 2023 19:40:13 +0000 (21:40 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Tue, 19 Sep 2023 11:26:57 +0000 (13:26 +0200)
Use control register bit defines instead of plain numbers where
possible.

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>
16 files changed:
arch/s390/boot/startup.c
arch/s390/kernel/early.c
arch/s390/kernel/guarded_storage.c
arch/s390/kernel/ipl.c
arch/s390/kernel/nmi.c
arch/s390/kernel/perf_cpum_cf.c
arch/s390/kernel/perf_pai_crypto.c
arch/s390/kernel/perf_pai_ext.c
arch/s390/kernel/ptrace.c
arch/s390/kernel/time.c
arch/s390/kvm/kvm-s390.c
arch/s390/kvm/priv.c
arch/s390/mm/vmem.c
arch/s390/pci/pci.c
drivers/s390/cio/crw.c
net/iucv/iucv.c

index cf622479647f1f4501b6cc688c9f284767bd481c..8826c4f1864595c96a6073940f0371d4487b4945 100644 (file)
@@ -49,7 +49,7 @@ static void detect_facilities(void)
 {
        if (test_facility(8)) {
                machine.has_edat1 = 1;
-               local_ctl_set_bit(0, 23);
+               local_ctl_set_bit(0, CR0_EDAT_BIT);
        }
        if (test_facility(78))
                machine.has_edat2 = 1;
index 0beaa0ba58a864f1729fed808bb29d91781db7c0..ff1f02b54771cbe26a8c3c45b75def84a0e157f7 100644 (file)
@@ -216,7 +216,7 @@ static __init void detect_machine_facilities(void)
 {
        if (test_facility(8)) {
                S390_lowcore.machine_flags |= MACHINE_FLAG_EDAT1;
-               system_ctl_set_bit(0, 23);
+               system_ctl_set_bit(0, CR0_EDAT_BIT);
        }
        if (test_facility(78))
                S390_lowcore.machine_flags |= MACHINE_FLAG_EDAT2;
@@ -224,13 +224,13 @@ static __init void detect_machine_facilities(void)
                S390_lowcore.machine_flags |= MACHINE_FLAG_IDTE;
        if (test_facility(50) && test_facility(73)) {
                S390_lowcore.machine_flags |= MACHINE_FLAG_TE;
-               system_ctl_set_bit(0, 55);
+               system_ctl_set_bit(0, CR0_TRANSACTIONAL_EXECUTION_BIT);
        }
        if (test_facility(51))
                S390_lowcore.machine_flags |= MACHINE_FLAG_TLB_LC;
        if (test_facility(129)) {
                S390_lowcore.machine_flags |= MACHINE_FLAG_VX;
-               system_ctl_set_bit(0, 17);
+               system_ctl_set_bit(0, CR0_VECTOR_BIT);
        }
        if (test_facility(130))
                S390_lowcore.machine_flags |= MACHINE_FLAG_NX;
@@ -240,7 +240,7 @@ static __init void detect_machine_facilities(void)
                /* Enabled signed clock comparator comparisons */
                S390_lowcore.machine_flags |= MACHINE_FLAG_SCC;
                clock_comparator_max = -1ULL >> 1;
-               system_ctl_set_bit(0, 53);
+               system_ctl_set_bit(0, CR0_CLOCK_COMPARATOR_SIGN_BIT);
        }
        if (IS_ENABLED(CONFIG_PCI) && test_facility(153)) {
                S390_lowcore.machine_flags |= MACHINE_FLAG_PCI_MIO;
@@ -260,7 +260,7 @@ static inline void save_vector_registers(void)
 
 static inline void setup_low_address_protection(void)
 {
-       system_ctl_set_bit(0, 28);
+       system_ctl_set_bit(0, CR0_LOW_ADDRESS_PROTECTION_BIT);
 }
 
 static inline void setup_access_registers(void)
@@ -273,7 +273,7 @@ static inline void setup_access_registers(void)
 static int __init disable_vector_extension(char *str)
 {
        S390_lowcore.machine_flags &= ~MACHINE_FLAG_VX;
-       system_ctl_clear_bit(0, 17);
+       system_ctl_clear_bit(0, CR0_VECTOR_BIT);
        return 0;
 }
 early_param("novx", disable_vector_extension);
index 945acfc77ee4e03296ce10e754833576c6e0d69c..0b68168d956683212e48fa779e7430b2bd808e9a 100644 (file)
@@ -28,7 +28,7 @@ static int gs_enable(void)
                        return -ENOMEM;
                gs_cb->gsd = 25;
                preempt_disable();
-               local_ctl_set_bit(2, 4);
+               local_ctl_set_bit(2, CR2_GUARDED_STORAGE_BIT);
                load_gs_cb(gs_cb);
                current->thread.gs_cb = gs_cb;
                preempt_enable();
@@ -42,7 +42,7 @@ static int gs_disable(void)
                preempt_disable();
                kfree(current->thread.gs_cb);
                current->thread.gs_cb = NULL;
-               local_ctl_clear_bit(2, 4);
+               local_ctl_clear_bit(2, CR2_GUARDED_STORAGE_BIT);
                preempt_enable();
        }
        return 0;
@@ -84,7 +84,7 @@ void gs_load_bc_cb(struct pt_regs *regs)
        if (gs_cb) {
                kfree(current->thread.gs_cb);
                current->thread.gs_bc_cb = NULL;
-               local_ctl_set_bit(2, 4);
+               local_ctl_set_bit(2, CR2_GUARDED_STORAGE_BIT);
                load_gs_cb(gs_cb);
                current->thread.gs_cb = gs_cb;
        }
index 492dd8f371daa5f69d516e1541716ce0bdf3e003..cc364fce6aa96bb7deea8eed54694bb93419ecc2 100644 (file)
@@ -2381,7 +2381,7 @@ void s390_reset_system(void)
        set_prefix(0);
 
        /* Disable lowcore protection */
-       local_ctl_clear_bit(0, 28);
+       local_ctl_clear_bit(0, CR0_LOW_ADDRESS_PROTECTION_BIT);
        diag_amode31_ops.diag308_reset();
 }
 
index 579cebc58d8c67b8fc929fb3d99c56f1ef21b9b5..0daf0f1cdfc9360cad3cca894e5eeef65e55717f 100644 (file)
@@ -185,7 +185,7 @@ void s390_handle_mcck(void)
                static int mchchk_wng_posted = 0;
 
                /* Use single cpu clear, as we cannot handle smp here. */
-               local_ctl_clear_bit(14, 24);    /* Disable WARNING MCH */
+               local_ctl_clear_bit(14, CR14_WARNING_SUBMASK_BIT);
                if (xchg(&mchchk_wng_posted, 1) == 0)
                        kill_cad_pid(SIGPWR, 1);
        }
@@ -505,9 +505,9 @@ NOKPROBE_SYMBOL(s390_do_machine_check);
 
 static int __init machine_check_init(void)
 {
-       system_ctl_set_bit(14, 25);     /* enable external damage MCH */
-       system_ctl_set_bit(14, 27);     /* enable system recovery MCH */
-       system_ctl_set_bit(14, 24);     /* enable warning MCH */
+       system_ctl_set_bit(14, CR14_EXTERNAL_DAMAGE_SUBMASK_BIT);
+       system_ctl_set_bit(14, CR14_RECOVERY_SUBMASK_BIT);
+       system_ctl_set_bit(14, CR14_WARNING_SUBMASK_BIT);
        return 0;
 }
 early_initcall(machine_check_init);
index 4e05c0cb1648f3d10b2cc2d650553d0c121b73c9..41ed6e0f0a2a927858bede1732af81493fc23086 100644 (file)
@@ -1193,7 +1193,7 @@ static int __init cpumf_pmu_init(void)
         * Clear bit 15 of cr0 to unauthorize problem-state to
         * extract measurement counters
         */
-       system_ctl_clear_bit(0, 48);
+       system_ctl_clear_bit(0, CR0_CPUMF_EXTRACTION_AUTH_BIT);
 
        /* register handler for measurement-alert interruptions */
        rc = register_external_irq(EXT_IRQ_MEASURE_ALERT,
index 6612fd13e95b375be42fe3378f0304d1cf5df3d6..db470243966f49bc4f4f837af6caa86f189b3d1c 100644 (file)
@@ -265,7 +265,7 @@ static int paicrypt_add(struct perf_event *event, int flags)
        if (++cpump->active_events == 1) {
                ccd = virt_to_phys(cpump->page) | PAI_CRYPTO_KERNEL_OFFSET;
                WRITE_ONCE(S390_lowcore.ccd, ccd);
-               local_ctl_set_bit(0, 50);
+               local_ctl_set_bit(0, CR0_CRYPTOGRAPHY_COUNTER_BIT);
        }
        cpump->event = event;
        if (flags & PERF_EF_START && !event->attr.sample_period) {
@@ -294,7 +294,7 @@ static void paicrypt_del(struct perf_event *event, int flags)
                /* Only counting needs to read counter */
                paicrypt_stop(event, PERF_EF_UPDATE);
        if (--cpump->active_events == 0) {
-               local_ctl_clear_bit(0, 50);
+               local_ctl_clear_bit(0, CR0_CRYPTOGRAPHY_COUNTER_BIT);
                WRITE_ONCE(S390_lowcore.ccd, 0);
        }
 }
index 9f724ae44fc772f65d417ab0d04eec944e08c002..e91c77155f08428f59281d20191224d00b4d7217 100644 (file)
@@ -339,7 +339,7 @@ static int paiext_add(struct perf_event *event, int flags)
                S390_lowcore.aicd = virt_to_phys(cpump->paiext_cb);
                pcb->acc = virt_to_phys(cpump->area) | 0x1;
                /* Enable CPU instruction lookup for PAIE1 control block */
-               local_ctl_set_bit(0, 49);
+               local_ctl_set_bit(0, CR0_PAI_EXTENSION_BIT);
                debug_sprintf_event(paiext_dbg, 4, "%s 1508 %llx acc %llx\n",
                                    __func__, S390_lowcore.aicd, pcb->acc);
        }
@@ -375,7 +375,7 @@ static void paiext_del(struct perf_event *event, int flags)
        }
        if (--cpump->active_events == 0) {
                /* Disable CPU instruction lookup for PAIE1 control block */
-               local_ctl_clear_bit(0, 49);
+               local_ctl_clear_bit(0, CR0_PAI_EXTENSION_BIT);
                pcb->acc = 0;
                S390_lowcore.aicd = 0;
                debug_sprintf_event(paiext_dbg, 4, "%s 1508 %llx acc %llx\n",
index 6a825351ff41041e7dcdc7d63dc72243933d1271..046403471c5d7d25fbb7b6341c977666268b5b4a 100644 (file)
@@ -1114,7 +1114,7 @@ static int s390_gs_cb_set(struct task_struct *target,
                target->thread.gs_cb = data;
        *target->thread.gs_cb = gs_cb;
        if (target == current) {
-               local_ctl_set_bit(2, 4);
+               local_ctl_set_bit(2, CR2_GUARDED_STORAGE_BIT);
                restore_gs_cb(target->thread.gs_cb);
        }
        preempt_enable();
index 34c4fbf4e55575195173acda71c1fc1a1b57fa0b..14abad953c0252e63fc34ce5dbc3c3a6c7d6e390 100644 (file)
@@ -173,10 +173,10 @@ void init_cpu_timer(void)
        clockevents_register_device(cd);
 
        /* Enable clock comparator timer interrupt. */
-       local_ctl_set_bit(0, 11);
+       local_ctl_set_bit(0, CR0_CLOCK_COMPARATOR_SUBMASK_BIT);
 
        /* Always allow the timing alert external interrupt. */
-       local_ctl_set_bit(0, 4);
+       local_ctl_set_bit(0, CR0_ETR_SUBMASK_BIT);
 }
 
 static void clock_comparator_interrupt(struct ext_code ext_code,
index 92bd15fe769a6daca21d0849359fdff09b48b7db..e44e83f004ce1bc180daab5d881e2883160dbd25 100644 (file)
@@ -4918,7 +4918,7 @@ static void sync_regs_fmt2(struct kvm_vcpu *vcpu)
        }
        if (MACHINE_HAS_GS) {
                preempt_disable();
-               local_ctl_set_bit(2, 4);
+               local_ctl_set_bit(2, CR2_GUARDED_STORAGE_BIT);
                if (current->thread.gs_cb) {
                        vcpu->arch.host_gscb = current->thread.gs_cb;
                        save_gs_cb(vcpu->arch.host_gscb);
@@ -4995,13 +4995,13 @@ static void store_regs_fmt2(struct kvm_vcpu *vcpu)
        kvm_run->s.regs.diag318 = vcpu->arch.diag318_info.val;
        if (MACHINE_HAS_GS) {
                preempt_disable();
-               local_ctl_set_bit(2, 4);
+               local_ctl_set_bit(2, CR2_GUARDED_STORAGE_BIT);
                if (vcpu->arch.gs_enabled)
                        save_gs_cb(current->thread.gs_cb);
                current->thread.gs_cb = vcpu->arch.host_gscb;
                restore_gs_cb(vcpu->arch.host_gscb);
                if (!vcpu->arch.host_gscb)
-                       local_ctl_clear_bit(2, 4);
+                       local_ctl_clear_bit(2, CR2_GUARDED_STORAGE_BIT);
                vcpu->arch.host_gscb = NULL;
                preempt_enable();
        }
index c199e4b5e5ce0698875083fa26b3cebba17a98c2..621a17fd1a1bb52fd7875a134a1acac25f004209 100644 (file)
@@ -57,7 +57,7 @@ static int handle_gs(struct kvm_vcpu *vcpu)
        if (test_kvm_facility(vcpu->kvm, 133)) {
                VCPU_EVENT(vcpu, 3, "%s", "ENABLE: GS (lazy)");
                preempt_disable();
-               local_ctl_set_bit(2, 4);
+               local_ctl_set_bit(2, CR2_GUARDED_STORAGE_BIT);
                current->thread.gs_cb = (struct gs_cb *)&vcpu->run->s.regs.gscb;
                restore_gs_cb(current->thread.gs_cb);
                preempt_enable();
index 95f04a502e62066ba9e53078d61912a694a9fd93..5ed2e92546497efed3c5f0fd571d2048da2ffd05 100644 (file)
@@ -660,7 +660,7 @@ void __init vmem_map_init(void)
                __set_memory_4k(__va(0), RELOC_HIDE(__va(0), ident_map_size));
        }
        if (MACHINE_HAS_NX)
-               system_ctl_set_bit(0, 20);
+               system_ctl_set_bit(0, CR0_INSTRUCTION_EXEC_PROTECTION_BIT);
        pr_info("Write protected kernel read-only data: %luk\n",
                (unsigned long)(__end_rodata - _stext) >> 10);
 }
index a0aecc94e2847a79ea34d9bd5f42e45ae592b89f..6fab5c085565109d509e59372982ecc79d3168e0 100644 (file)
@@ -1094,7 +1094,7 @@ static int __init pci_base_init(void)
 
        if (MACHINE_HAS_PCI_MIO) {
                static_branch_enable(&have_mio);
-               system_ctl_set_bit(2, 5);
+               system_ctl_set_bit(2, CR2_MIO_ADDRESSING_BIT);
        }
 
        rc = zpci_debug_init();
index 872b1f2855cb4ab1706596b2ede49f1ff946d77a..4916dd0a7eb116c39732c9eec0d9c7538e08fcfb 100644 (file)
@@ -156,7 +156,7 @@ static int __init crw_machine_check_init(void)
        task = kthread_run(crw_collect_info, NULL, "kmcheck");
        if (IS_ERR(task))
                return PTR_ERR(task);
-       system_ctl_set_bit(14, 28);     /* enable channel report MCH */
+       system_ctl_set_bit(14, CR14_CHANNEL_REPORT_SUBMASK_BIT);
        return 0;
 }
 device_initcall(crw_machine_check_init);
index b5cee8dad9263d1ab8a0467ebd75f9144d9a407b..0ed6e34d6edd1edf5f40a99c3b0f7a0ca2c2d1b5 100644 (file)
@@ -1823,7 +1823,7 @@ static int __init iucv_init(void)
                rc = -EPROTONOSUPPORT;
                goto out;
        }
-       system_ctl_set_bit(0, 1);
+       system_ctl_set_bit(0, CR0_IUCV_BIT);
        rc = iucv_query_maxconn();
        if (rc)
                goto out_ctl;