diff options
author | David Hildenbrand <dahi@linux.vnet.ibm.com> | 2015-05-06 07:18:59 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2015-05-13 03:58:17 -0400 |
commit | 37c5f6c86cf5cda66c71c3bb1672e3b09d81c6da (patch) | |
tree | 4926bbcc67eb0b74f22634c63866040d1699e63d | |
parent | 9747bc47b340228a007efcc262c0bc4d2e94116d (diff) |
s390/sclp: unify basic sclp access by exposing "struct sclp"
Let's unify basic access to sclp fields by storing the data in an external
struct in asm/sclp.h.
The values can now directly be accessed by other components, so there is
no need for most accessor functions and external variables anymore.
The mtid, mtid_max and facility part will be cleaned up separately.
Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | arch/s390/hypfs/hypfs_sprp.c | 4 | ||||
-rw-r--r-- | arch/s390/include/asm/sclp.h | 31 | ||||
-rw-r--r-- | arch/s390/kernel/crash_dump.c | 8 | ||||
-rw-r--r-- | arch/s390/kernel/setup.c | 10 | ||||
-rw-r--r-- | arch/s390/kernel/smp.c | 4 | ||||
-rw-r--r-- | arch/s390/kvm/interrupt.c | 4 | ||||
-rw-r--r-- | arch/s390/kvm/kvm-s390.c | 8 | ||||
-rw-r--r-- | arch/s390/mm/init.c | 2 | ||||
-rw-r--r-- | arch/s390/mm/mem_detect.c | 4 | ||||
-rw-r--r-- | drivers/s390/char/sclp.h | 3 | ||||
-rw-r--r-- | drivers/s390/char/sclp_cmd.c | 25 | ||||
-rw-r--r-- | drivers/s390/char/sclp_early.c | 105 | ||||
-rw-r--r-- | drivers/s390/char/zcore.c | 10 | ||||
-rw-r--r-- | drivers/s390/kvm/kvm_virtio.c | 4 |
14 files changed, 79 insertions, 143 deletions
diff --git a/arch/s390/hypfs/hypfs_sprp.c b/arch/s390/hypfs/hypfs_sprp.c index f043c3c7e73c..dd42a26d049d 100644 --- a/arch/s390/hypfs/hypfs_sprp.c +++ b/arch/s390/hypfs/hypfs_sprp.c | |||
@@ -128,14 +128,14 @@ static struct hypfs_dbfs_file hypfs_sprp_file = { | |||
128 | 128 | ||
129 | int hypfs_sprp_init(void) | 129 | int hypfs_sprp_init(void) |
130 | { | 130 | { |
131 | if (!sclp_has_sprp()) | 131 | if (!sclp.has_sprp) |
132 | return 0; | 132 | return 0; |
133 | return hypfs_dbfs_create_file(&hypfs_sprp_file); | 133 | return hypfs_dbfs_create_file(&hypfs_sprp_file); |
134 | } | 134 | } |
135 | 135 | ||
136 | void hypfs_sprp_exit(void) | 136 | void hypfs_sprp_exit(void) |
137 | { | 137 | { |
138 | if (!sclp_has_sprp()) | 138 | if (!sclp.has_sprp) |
139 | return; | 139 | return; |
140 | hypfs_dbfs_remove_file(&hypfs_sprp_file); | 140 | hypfs_dbfs_remove_file(&hypfs_sprp_file); |
141 | } | 141 | } |
diff --git a/arch/s390/include/asm/sclp.h b/arch/s390/include/asm/sclp.h index f1096bab5199..74ba690064f5 100644 --- a/arch/s390/include/asm/sclp.h +++ b/arch/s390/include/asm/sclp.h | |||
@@ -46,33 +46,40 @@ struct sclp_cpu_info { | |||
46 | struct sclp_cpu_entry cpu[MAX_CPU_ADDRESS + 1]; | 46 | struct sclp_cpu_entry cpu[MAX_CPU_ADDRESS + 1]; |
47 | }; | 47 | }; |
48 | 48 | ||
49 | struct sclp_info { | ||
50 | unsigned char has_linemode : 1; | ||
51 | unsigned char has_vt220 : 1; | ||
52 | unsigned char has_siif : 1; | ||
53 | unsigned char has_sigpif : 1; | ||
54 | unsigned char has_cpu_type : 1; | ||
55 | unsigned char has_sprp : 1; | ||
56 | unsigned int ibc; | ||
57 | unsigned int mtid; | ||
58 | unsigned int mtid_cp; | ||
59 | unsigned int mtid_prev; | ||
60 | unsigned long long rzm; | ||
61 | unsigned long long rnmax; | ||
62 | unsigned long long hamax; | ||
63 | unsigned int max_cpu; | ||
64 | unsigned long hsa_size; | ||
65 | }; | ||
66 | extern struct sclp_info sclp; | ||
67 | |||
49 | int sclp_get_cpu_info(struct sclp_cpu_info *info); | 68 | int sclp_get_cpu_info(struct sclp_cpu_info *info); |
50 | int sclp_cpu_configure(u8 cpu); | 69 | int sclp_cpu_configure(u8 cpu); |
51 | int sclp_cpu_deconfigure(u8 cpu); | 70 | int sclp_cpu_deconfigure(u8 cpu); |
52 | unsigned long long sclp_get_rnmax(void); | ||
53 | unsigned long long sclp_get_rzm(void); | ||
54 | unsigned int sclp_get_max_cpu(void); | ||
55 | unsigned int sclp_get_mtid(u8 cpu_type); | 71 | unsigned int sclp_get_mtid(u8 cpu_type); |
56 | unsigned int sclp_get_mtid_max(void); | 72 | unsigned int sclp_get_mtid_max(void); |
57 | unsigned int sclp_get_mtid_prev(void); | ||
58 | int sclp_sdias_blk_count(void); | 73 | int sclp_sdias_blk_count(void); |
59 | int sclp_sdias_copy(void *dest, int blk_num, int nr_blks); | 74 | int sclp_sdias_copy(void *dest, int blk_num, int nr_blks); |
60 | int sclp_chp_configure(struct chp_id chpid); | 75 | int sclp_chp_configure(struct chp_id chpid); |
61 | int sclp_chp_deconfigure(struct chp_id chpid); | 76 | int sclp_chp_deconfigure(struct chp_id chpid); |
62 | int sclp_chp_read_info(struct sclp_chp_info *info); | 77 | int sclp_chp_read_info(struct sclp_chp_info *info); |
63 | void sclp_get_ipl_info(struct sclp_ipl_info *info); | 78 | void sclp_get_ipl_info(struct sclp_ipl_info *info); |
64 | bool __init sclp_has_linemode(void); | ||
65 | bool __init sclp_has_vt220(void); | ||
66 | bool sclp_has_sprp(void); | ||
67 | int sclp_pci_configure(u32 fid); | 79 | int sclp_pci_configure(u32 fid); |
68 | int sclp_pci_deconfigure(u32 fid); | 80 | int sclp_pci_deconfigure(u32 fid); |
69 | int memcpy_hsa(void *dest, unsigned long src, size_t count, int mode); | 81 | int memcpy_hsa(void *dest, unsigned long src, size_t count, int mode); |
70 | unsigned long sclp_get_hsa_size(void); | ||
71 | void sclp_early_detect(void); | 82 | void sclp_early_detect(void); |
72 | int sclp_has_siif(void); | ||
73 | int sclp_has_sigpif(void); | ||
74 | unsigned int sclp_get_ibc(void); | ||
75 | |||
76 | long _sclp_print_early(const char *); | 83 | long _sclp_print_early(const char *); |
77 | 84 | ||
78 | #endif /* _ASM_S390_SCLP_H */ | 85 | #endif /* _ASM_S390_SCLP_H */ |
diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c index 9f73c8059022..d9f0dcfcae5e 100644 --- a/arch/s390/kernel/crash_dump.c +++ b/arch/s390/kernel/crash_dump.c | |||
@@ -122,7 +122,7 @@ static ssize_t copy_oldmem_page_zfcpdump(char *buf, size_t csize, | |||
122 | { | 122 | { |
123 | int rc; | 123 | int rc; |
124 | 124 | ||
125 | if (src < sclp_get_hsa_size()) { | 125 | if (src < sclp.hsa_size) { |
126 | rc = memcpy_hsa(buf, src, csize, userbuf); | 126 | rc = memcpy_hsa(buf, src, csize, userbuf); |
127 | } else { | 127 | } else { |
128 | if (userbuf) | 128 | if (userbuf) |
@@ -215,7 +215,7 @@ static int remap_oldmem_pfn_range_zfcpdump(struct vm_area_struct *vma, | |||
215 | unsigned long pfn, | 215 | unsigned long pfn, |
216 | unsigned long size, pgprot_t prot) | 216 | unsigned long size, pgprot_t prot) |
217 | { | 217 | { |
218 | unsigned long hsa_end = sclp_get_hsa_size(); | 218 | unsigned long hsa_end = sclp.hsa_size; |
219 | unsigned long size_hsa; | 219 | unsigned long size_hsa; |
220 | 220 | ||
221 | if (pfn < hsa_end >> PAGE_SHIFT) { | 221 | if (pfn < hsa_end >> PAGE_SHIFT) { |
@@ -258,7 +258,7 @@ int copy_from_oldmem(void *dest, void *src, size_t count) | |||
258 | return rc; | 258 | return rc; |
259 | } | 259 | } |
260 | } else { | 260 | } else { |
261 | unsigned long hsa_end = sclp_get_hsa_size(); | 261 | unsigned long hsa_end = sclp.hsa_size; |
262 | if ((unsigned long) src < hsa_end) { | 262 | if ((unsigned long) src < hsa_end) { |
263 | copied = min(count, hsa_end - (unsigned long) src); | 263 | copied = min(count, hsa_end - (unsigned long) src); |
264 | rc = memcpy_hsa(dest, (unsigned long) src, copied, 0); | 264 | rc = memcpy_hsa(dest, (unsigned long) src, copied, 0); |
@@ -609,7 +609,7 @@ int elfcorehdr_alloc(unsigned long long *addr, unsigned long long *size) | |||
609 | if (elfcorehdr_addr != ELFCORE_ADDR_MAX) | 609 | if (elfcorehdr_addr != ELFCORE_ADDR_MAX) |
610 | return 0; | 610 | return 0; |
611 | /* If we cannot get HSA size for zfcpdump return error */ | 611 | /* If we cannot get HSA size for zfcpdump return error */ |
612 | if (ipl_info.type == IPL_TYPE_FCP_DUMP && !sclp_get_hsa_size()) | 612 | if (ipl_info.type == IPL_TYPE_FCP_DUMP && !sclp.hsa_size) |
613 | return -ENODEV; | 613 | return -ENODEV; |
614 | 614 | ||
615 | /* For kdump, exclude previous crashkernel memory */ | 615 | /* For kdump, exclude previous crashkernel memory */ |
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 7262fe438c99..bdde603ee0ac 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -128,9 +128,9 @@ __setup("condev=", condev_setup); | |||
128 | static void __init set_preferred_console(void) | 128 | static void __init set_preferred_console(void) |
129 | { | 129 | { |
130 | if (MACHINE_IS_KVM) { | 130 | if (MACHINE_IS_KVM) { |
131 | if (sclp_has_vt220()) | 131 | if (sclp.has_vt220) |
132 | add_preferred_console("ttyS", 1, NULL); | 132 | add_preferred_console("ttyS", 1, NULL); |
133 | else if (sclp_has_linemode()) | 133 | else if (sclp.has_linemode) |
134 | add_preferred_console("ttyS", 0, NULL); | 134 | add_preferred_console("ttyS", 0, NULL); |
135 | else | 135 | else |
136 | add_preferred_console("hvc", 0, NULL); | 136 | add_preferred_console("hvc", 0, NULL); |
@@ -510,8 +510,8 @@ static void reserve_memory_end(void) | |||
510 | { | 510 | { |
511 | #ifdef CONFIG_CRASH_DUMP | 511 | #ifdef CONFIG_CRASH_DUMP |
512 | if (ipl_info.type == IPL_TYPE_FCP_DUMP && | 512 | if (ipl_info.type == IPL_TYPE_FCP_DUMP && |
513 | !OLDMEM_BASE && sclp_get_hsa_size()) { | 513 | !OLDMEM_BASE && sclp.hsa_size) { |
514 | memory_end = sclp_get_hsa_size(); | 514 | memory_end = sclp.hsa_size; |
515 | memory_end &= PAGE_MASK; | 515 | memory_end &= PAGE_MASK; |
516 | memory_end_set = 1; | 516 | memory_end_set = 1; |
517 | } | 517 | } |
@@ -576,7 +576,7 @@ static void __init reserve_crashkernel(void) | |||
576 | crash_base = low; | 576 | crash_base = low; |
577 | } else { | 577 | } else { |
578 | /* Find suitable area in free memory */ | 578 | /* Find suitable area in free memory */ |
579 | low = max_t(unsigned long, crash_size, sclp_get_hsa_size()); | 579 | low = max_t(unsigned long, crash_size, sclp.hsa_size); |
580 | high = crash_base ? crash_base + crash_size : ULONG_MAX; | 580 | high = crash_base ? crash_base + crash_size : ULONG_MAX; |
581 | 581 | ||
582 | if (crash_base && crash_base < low) { | 582 | if (crash_base && crash_base < low) { |
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index a5321d5a0236..ac7dda556a7d 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
@@ -601,7 +601,7 @@ static void __init smp_store_cpu_states(struct sclp_cpu_info *info) | |||
601 | /* No previous system present, normal boot. */ | 601 | /* No previous system present, normal boot. */ |
602 | return; | 602 | return; |
603 | /* Set multi-threading state to the previous system. */ | 603 | /* Set multi-threading state to the previous system. */ |
604 | pcpu_set_smt(sclp_get_mtid_prev()); | 604 | pcpu_set_smt(sclp.mtid_prev); |
605 | /* Collect CPU states. */ | 605 | /* Collect CPU states. */ |
606 | cpu = 0; | 606 | cpu = 0; |
607 | for (i = 0; i < info->configured; i++) { | 607 | for (i = 0; i < info->configured; i++) { |
@@ -883,7 +883,7 @@ void __init smp_fill_possible_mask(void) | |||
883 | unsigned int possible, sclp_max, cpu; | 883 | unsigned int possible, sclp_max, cpu; |
884 | 884 | ||
885 | sclp_max = min(smp_max_threads, sclp_get_mtid_max() + 1); | 885 | sclp_max = min(smp_max_threads, sclp_get_mtid_max() + 1); |
886 | sclp_max = sclp_get_max_cpu() * sclp_max ?: nr_cpu_ids; | 886 | sclp_max = sclp.max_cpu * sclp_max ?: nr_cpu_ids; |
887 | possible = setup_possible_cpus ?: nr_cpu_ids; | 887 | possible = setup_possible_cpus ?: nr_cpu_ids; |
888 | possible = min(possible, sclp_max); | 888 | possible = min(possible, sclp_max); |
889 | for (cpu = 0; cpu < possible && cpu < nr_cpu_ids; cpu++) | 889 | for (cpu = 0; cpu < possible && cpu < nr_cpu_ids; cpu++) |
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c index 9de47265ef73..0d3deef6edff 100644 --- a/arch/s390/kvm/interrupt.c +++ b/arch/s390/kvm/interrupt.c | |||
@@ -799,7 +799,7 @@ int kvm_s390_ext_call_pending(struct kvm_vcpu *vcpu) | |||
799 | struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int; | 799 | struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int; |
800 | uint8_t sigp_ctrl = vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sigp_ctrl; | 800 | uint8_t sigp_ctrl = vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sigp_ctrl; |
801 | 801 | ||
802 | if (!sclp_has_sigpif()) | 802 | if (!sclp.has_sigpif) |
803 | return test_bit(IRQ_PEND_EXT_EXTERNAL, &li->pending_irqs); | 803 | return test_bit(IRQ_PEND_EXT_EXTERNAL, &li->pending_irqs); |
804 | 804 | ||
805 | return (sigp_ctrl & SIGP_CTRL_C) && | 805 | return (sigp_ctrl & SIGP_CTRL_C) && |
@@ -1058,7 +1058,7 @@ static int __inject_extcall(struct kvm_vcpu *vcpu, struct kvm_s390_irq *irq) | |||
1058 | kvm_get_vcpu(vcpu->kvm, src_id) == NULL) | 1058 | kvm_get_vcpu(vcpu->kvm, src_id) == NULL) |
1059 | return -EINVAL; | 1059 | return -EINVAL; |
1060 | 1060 | ||
1061 | if (sclp_has_sigpif()) | 1061 | if (sclp.has_sigpif) |
1062 | return __inject_extcall_sigpif(vcpu, src_id); | 1062 | return __inject_extcall_sigpif(vcpu, src_id); |
1063 | 1063 | ||
1064 | if (!test_and_set_bit(IRQ_PEND_EXT_EXTERNAL, &li->pending_irqs)) | 1064 | if (!test_and_set_bit(IRQ_PEND_EXT_EXTERNAL, &li->pending_irqs)) |
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 8cd8e7b288c5..c4e81b26c1b0 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -604,7 +604,7 @@ static int kvm_s390_get_machine(struct kvm *kvm, struct kvm_device_attr *attr) | |||
604 | goto out; | 604 | goto out; |
605 | } | 605 | } |
606 | get_cpu_id((struct cpuid *) &mach->cpuid); | 606 | get_cpu_id((struct cpuid *) &mach->cpuid); |
607 | mach->ibc = sclp_get_ibc(); | 607 | mach->ibc = sclp.ibc; |
608 | memcpy(&mach->fac_mask, kvm->arch.model.fac->mask, | 608 | memcpy(&mach->fac_mask, kvm->arch.model.fac->mask, |
609 | S390_ARCH_FAC_LIST_SIZE_BYTE); | 609 | S390_ARCH_FAC_LIST_SIZE_BYTE); |
610 | memcpy((unsigned long *)&mach->fac_list, S390_lowcore.stfle_fac_list, | 610 | memcpy((unsigned long *)&mach->fac_list, S390_lowcore.stfle_fac_list, |
@@ -1068,7 +1068,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) | |||
1068 | S390_ARCH_FAC_LIST_SIZE_BYTE); | 1068 | S390_ARCH_FAC_LIST_SIZE_BYTE); |
1069 | 1069 | ||
1070 | kvm_s390_get_cpu_id(&kvm->arch.model.cpu_id); | 1070 | kvm_s390_get_cpu_id(&kvm->arch.model.cpu_id); |
1071 | kvm->arch.model.ibc = sclp_get_ibc() & 0x0fff; | 1071 | kvm->arch.model.ibc = sclp.ibc & 0x0fff; |
1072 | 1072 | ||
1073 | if (kvm_s390_crypto_init(kvm) < 0) | 1073 | if (kvm_s390_crypto_init(kvm) < 0) |
1074 | goto out_err; | 1074 | goto out_err; |
@@ -1321,9 +1321,9 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) | |||
1321 | 1321 | ||
1322 | vcpu->arch.sie_block->ecb2 = 8; | 1322 | vcpu->arch.sie_block->ecb2 = 8; |
1323 | vcpu->arch.sie_block->eca = 0xC1002000U; | 1323 | vcpu->arch.sie_block->eca = 0xC1002000U; |
1324 | if (sclp_has_siif()) | 1324 | if (sclp.has_siif) |
1325 | vcpu->arch.sie_block->eca |= 1; | 1325 | vcpu->arch.sie_block->eca |= 1; |
1326 | if (sclp_has_sigpif()) | 1326 | if (sclp.has_sigpif) |
1327 | vcpu->arch.sie_block->eca |= 0x10000000U; | 1327 | vcpu->arch.sie_block->eca |= 0x10000000U; |
1328 | if (test_kvm_facility(vcpu->kvm, 129)) { | 1328 | if (test_kvm_facility(vcpu->kvm, 129)) { |
1329 | vcpu->arch.sie_block->eca |= 0x00020000; | 1329 | vcpu->arch.sie_block->eca |= 0x00020000; |
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c index 80875c43a4a4..76e873748b56 100644 --- a/arch/s390/mm/init.c +++ b/arch/s390/mm/init.c | |||
@@ -213,7 +213,7 @@ unsigned long memory_block_size_bytes(void) | |||
213 | * Make sure the memory block size is always greater | 213 | * Make sure the memory block size is always greater |
214 | * or equal than the memory increment size. | 214 | * or equal than the memory increment size. |
215 | */ | 215 | */ |
216 | return max_t(unsigned long, MIN_MEMORY_BLOCK_SIZE, sclp_get_rzm()); | 216 | return max_t(unsigned long, MIN_MEMORY_BLOCK_SIZE, sclp.rzm); |
217 | } | 217 | } |
218 | 218 | ||
219 | #ifdef CONFIG_MEMORY_HOTREMOVE | 219 | #ifdef CONFIG_MEMORY_HOTREMOVE |
diff --git a/arch/s390/mm/mem_detect.c b/arch/s390/mm/mem_detect.c index 0f3604395805..e00f0d5d296d 100644 --- a/arch/s390/mm/mem_detect.c +++ b/arch/s390/mm/mem_detect.c | |||
@@ -31,8 +31,8 @@ void __init detect_memory_memblock(void) | |||
31 | unsigned long addr, size; | 31 | unsigned long addr, size; |
32 | int type; | 32 | int type; |
33 | 33 | ||
34 | rzm = sclp_get_rzm(); | 34 | rzm = sclp.rzm; |
35 | rnmax = sclp_get_rnmax(); | 35 | rnmax = sclp.rnmax; |
36 | memsize = rzm * rnmax; | 36 | memsize = rzm * rnmax; |
37 | if (!rzm) | 37 | if (!rzm) |
38 | rzm = 1ULL << 17; | 38 | rzm = 1ULL << 17; |
diff --git a/drivers/s390/char/sclp.h b/drivers/s390/char/sclp.h index a88069f8c677..852f20649f33 100644 --- a/drivers/s390/char/sclp.h +++ b/drivers/s390/char/sclp.h | |||
@@ -191,9 +191,6 @@ void sclp_sdias_exit(void); | |||
191 | extern int sclp_console_pages; | 191 | extern int sclp_console_pages; |
192 | extern int sclp_console_drop; | 192 | extern int sclp_console_drop; |
193 | extern unsigned long sclp_console_full; | 193 | extern unsigned long sclp_console_full; |
194 | extern u8 sclp_fac84; | ||
195 | extern unsigned long long sclp_rzm; | ||
196 | extern unsigned long long sclp_rnmax; | ||
197 | 194 | ||
198 | /* useful inlines */ | 195 | /* useful inlines */ |
199 | 196 | ||
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c index 7be782116dab..215e7950fd29 100644 --- a/drivers/s390/char/sclp_cmd.c +++ b/drivers/s390/char/sclp_cmd.c | |||
@@ -101,7 +101,7 @@ static void sclp_fill_cpu_info(struct sclp_cpu_info *info, | |||
101 | info->configured = sccb->nr_configured; | 101 | info->configured = sccb->nr_configured; |
102 | info->standby = sccb->nr_standby; | 102 | info->standby = sccb->nr_standby; |
103 | info->combined = sccb->nr_configured + sccb->nr_standby; | 103 | info->combined = sccb->nr_configured + sccb->nr_standby; |
104 | info->has_cpu_type = sclp_fac84 & 0x1; | 104 | info->has_cpu_type = sclp.has_cpu_type; |
105 | memcpy(&info->cpu, page + sccb->offset_configured, | 105 | memcpy(&info->cpu, page + sccb->offset_configured, |
106 | info->combined * sizeof(struct sclp_cpu_entry)); | 106 | info->combined * sizeof(struct sclp_cpu_entry)); |
107 | } | 107 | } |
@@ -202,14 +202,14 @@ struct assign_storage_sccb { | |||
202 | 202 | ||
203 | int arch_get_memory_phys_device(unsigned long start_pfn) | 203 | int arch_get_memory_phys_device(unsigned long start_pfn) |
204 | { | 204 | { |
205 | if (!sclp_rzm) | 205 | if (!sclp.rzm) |
206 | return 0; | 206 | return 0; |
207 | return PFN_PHYS(start_pfn) >> ilog2(sclp_rzm); | 207 | return PFN_PHYS(start_pfn) >> ilog2(sclp.rzm); |
208 | } | 208 | } |
209 | 209 | ||
210 | static unsigned long long rn2addr(u16 rn) | 210 | static unsigned long long rn2addr(u16 rn) |
211 | { | 211 | { |
212 | return (unsigned long long) (rn - 1) * sclp_rzm; | 212 | return (unsigned long long) (rn - 1) * sclp.rzm; |
213 | } | 213 | } |
214 | 214 | ||
215 | static int do_assign_storage(sclp_cmdw_t cmd, u16 rn) | 215 | static int do_assign_storage(sclp_cmdw_t cmd, u16 rn) |
@@ -250,7 +250,7 @@ static int sclp_assign_storage(u16 rn) | |||
250 | if (rc) | 250 | if (rc) |
251 | return rc; | 251 | return rc; |
252 | start = rn2addr(rn); | 252 | start = rn2addr(rn); |
253 | storage_key_init_range(start, start + sclp_rzm); | 253 | storage_key_init_range(start, start + sclp.rzm); |
254 | return 0; | 254 | return 0; |
255 | } | 255 | } |
256 | 256 | ||
@@ -309,7 +309,7 @@ static int sclp_mem_change_state(unsigned long start, unsigned long size, | |||
309 | istart = rn2addr(incr->rn); | 309 | istart = rn2addr(incr->rn); |
310 | if (start + size - 1 < istart) | 310 | if (start + size - 1 < istart) |
311 | break; | 311 | break; |
312 | if (start > istart + sclp_rzm - 1) | 312 | if (start > istart + sclp.rzm - 1) |
313 | continue; | 313 | continue; |
314 | if (online) | 314 | if (online) |
315 | rc |= sclp_assign_storage(incr->rn); | 315 | rc |= sclp_assign_storage(incr->rn); |
@@ -330,7 +330,7 @@ static bool contains_standby_increment(unsigned long start, unsigned long end) | |||
330 | istart = rn2addr(incr->rn); | 330 | istart = rn2addr(incr->rn); |
331 | if (end - 1 < istart) | 331 | if (end - 1 < istart) |
332 | continue; | 332 | continue; |
333 | if (start > istart + sclp_rzm - 1) | 333 | if (start > istart + sclp.rzm - 1) |
334 | continue; | 334 | continue; |
335 | if (incr->standby) | 335 | if (incr->standby) |
336 | return true; | 336 | return true; |
@@ -415,7 +415,7 @@ static void __init add_memory_merged(u16 rn) | |||
415 | if (!first_rn) | 415 | if (!first_rn) |
416 | goto skip_add; | 416 | goto skip_add; |
417 | start = rn2addr(first_rn); | 417 | start = rn2addr(first_rn); |
418 | size = (unsigned long long) num * sclp_rzm; | 418 | size = (unsigned long long) num * sclp.rzm; |
419 | if (start >= VMEM_MAX_PHYS) | 419 | if (start >= VMEM_MAX_PHYS) |
420 | goto skip_add; | 420 | goto skip_add; |
421 | if (start + size > VMEM_MAX_PHYS) | 421 | if (start + size > VMEM_MAX_PHYS) |
@@ -465,7 +465,7 @@ static void __init insert_increment(u16 rn, int standby, int assigned) | |||
465 | } | 465 | } |
466 | if (!assigned) | 466 | if (!assigned) |
467 | new_incr->rn = last_rn + 1; | 467 | new_incr->rn = last_rn + 1; |
468 | if (new_incr->rn > sclp_rnmax) { | 468 | if (new_incr->rn > sclp.rnmax) { |
469 | kfree(new_incr); | 469 | kfree(new_incr); |
470 | return; | 470 | return; |
471 | } | 471 | } |
@@ -550,7 +550,7 @@ static int __init sclp_detect_standby_memory(void) | |||
550 | } | 550 | } |
551 | if (rc || list_empty(&sclp_mem_list)) | 551 | if (rc || list_empty(&sclp_mem_list)) |
552 | goto out; | 552 | goto out; |
553 | for (i = 1; i <= sclp_rnmax - assigned; i++) | 553 | for (i = 1; i <= sclp.rnmax - assigned; i++) |
554 | insert_increment(0, 1, 0); | 554 | insert_increment(0, 1, 0); |
555 | rc = register_memory_notifier(&sclp_mem_nb); | 555 | rc = register_memory_notifier(&sclp_mem_nb); |
556 | if (rc) | 556 | if (rc) |
@@ -753,8 +753,3 @@ out: | |||
753 | free_page((unsigned long) sccb); | 753 | free_page((unsigned long) sccb); |
754 | return rc; | 754 | return rc; |
755 | } | 755 | } |
756 | |||
757 | bool sclp_has_sprp(void) | ||
758 | { | ||
759 | return !!(sclp_fac84 & 0x2); | ||
760 | } | ||
diff --git a/drivers/s390/char/sclp_early.c b/drivers/s390/char/sclp_early.c index 1efa4fdb7fe2..4f6525d5e987 100644 --- a/drivers/s390/char/sclp_early.c +++ b/drivers/s390/char/sclp_early.c | |||
@@ -48,23 +48,12 @@ struct read_info_sccb { | |||
48 | } __packed __aligned(PAGE_SIZE); | 48 | } __packed __aligned(PAGE_SIZE); |
49 | 49 | ||
50 | static char sccb_early[PAGE_SIZE] __aligned(PAGE_SIZE) __initdata; | 50 | static char sccb_early[PAGE_SIZE] __aligned(PAGE_SIZE) __initdata; |
51 | static unsigned int sclp_con_has_vt220 __initdata; | ||
52 | static unsigned int sclp_con_has_linemode __initdata; | ||
53 | static unsigned long sclp_hsa_size; | ||
54 | static unsigned int sclp_max_cpu; | ||
55 | static struct sclp_ipl_info sclp_ipl_info; | 51 | static struct sclp_ipl_info sclp_ipl_info; |
56 | static unsigned char sclp_siif; | ||
57 | static unsigned char sclp_sigpif; | ||
58 | static u32 sclp_ibc; | ||
59 | static unsigned int sclp_mtid; | ||
60 | static unsigned int sclp_mtid_cp; | ||
61 | static unsigned int sclp_mtid_max; | 52 | static unsigned int sclp_mtid_max; |
62 | static unsigned int sclp_mtid_prev; | ||
63 | 53 | ||
54 | struct sclp_info sclp; | ||
55 | EXPORT_SYMBOL(sclp); | ||
64 | u64 sclp_facilities; | 56 | u64 sclp_facilities; |
65 | u8 sclp_fac84; | ||
66 | unsigned long long sclp_rzm; | ||
67 | unsigned long long sclp_rnmax; | ||
68 | 57 | ||
69 | static int __init sclp_cmd_sync_early(sclp_cmdw_t cmd, void *sccb) | 58 | static int __init sclp_cmd_sync_early(sclp_cmdw_t cmd, void *sccb) |
70 | { | 59 | { |
@@ -118,21 +107,22 @@ static void __init sclp_facilities_detect(struct read_info_sccb *sccb) | |||
118 | return; | 107 | return; |
119 | 108 | ||
120 | sclp_facilities = sccb->facilities; | 109 | sclp_facilities = sccb->facilities; |
121 | sclp_fac84 = sccb->fac84; | 110 | sclp.has_sprp = !!(sccb->fac84 & 0x02); |
111 | sclp.has_cpu_type = !!(sccb->fac84 & 0x01); | ||
122 | if (sccb->fac85 & 0x02) | 112 | if (sccb->fac85 & 0x02) |
123 | S390_lowcore.machine_flags |= MACHINE_FLAG_ESOP; | 113 | S390_lowcore.machine_flags |= MACHINE_FLAG_ESOP; |
124 | sclp_rnmax = sccb->rnmax ? sccb->rnmax : sccb->rnmax2; | 114 | sclp.rnmax = sccb->rnmax ? sccb->rnmax : sccb->rnmax2; |
125 | sclp_rzm = sccb->rnsize ? sccb->rnsize : sccb->rnsize2; | 115 | sclp.rzm = sccb->rnsize ? sccb->rnsize : sccb->rnsize2; |
126 | sclp_rzm <<= 20; | 116 | sclp.rzm <<= 20; |
127 | sclp_ibc = sccb->ibc; | 117 | sclp.ibc = sccb->ibc; |
128 | 118 | ||
129 | if (!sccb->hcpua) { | 119 | if (!sccb->hcpua) { |
130 | if (MACHINE_IS_VM) | 120 | if (MACHINE_IS_VM) |
131 | sclp_max_cpu = 64; | 121 | sclp.max_cpu = 64; |
132 | else | 122 | else |
133 | sclp_max_cpu = sccb->ncpurl; | 123 | sclp.max_cpu = sccb->ncpurl; |
134 | } else { | 124 | } else { |
135 | sclp_max_cpu = sccb->hcpua + 1; | 125 | sclp.max_cpu = sccb->hcpua + 1; |
136 | } | 126 | } |
137 | 127 | ||
138 | boot_cpu_address = stap(); | 128 | boot_cpu_address = stap(); |
@@ -140,8 +130,8 @@ static void __init sclp_facilities_detect(struct read_info_sccb *sccb) | |||
140 | for (cpu = 0; cpu < sccb->ncpurl; cpue++, cpu++) { | 130 | for (cpu = 0; cpu < sccb->ncpurl; cpue++, cpu++) { |
141 | if (boot_cpu_address != cpue->core_id) | 131 | if (boot_cpu_address != cpue->core_id) |
142 | continue; | 132 | continue; |
143 | sclp_siif = cpue->siif; | 133 | sclp.has_siif = cpue->siif; |
144 | sclp_sigpif = cpue->sigpif; | 134 | sclp.has_sigpif = cpue->sigpif; |
145 | break; | 135 | break; |
146 | } | 136 | } |
147 | 137 | ||
@@ -151,58 +141,15 @@ static void __init sclp_facilities_detect(struct read_info_sccb *sccb) | |||
151 | sclp_ipl_info.has_dump = 1; | 141 | sclp_ipl_info.has_dump = 1; |
152 | memcpy(&sclp_ipl_info.loadparm, &sccb->loadparm, LOADPARM_LEN); | 142 | memcpy(&sclp_ipl_info.loadparm, &sccb->loadparm, LOADPARM_LEN); |
153 | 143 | ||
154 | sclp_mtid = (sccb->fac42 & 0x80) ? (sccb->fac42 & 31) : 0; | 144 | sclp.mtid = (sccb->fac42 & 0x80) ? (sccb->fac42 & 31) : 0; |
155 | sclp_mtid_cp = (sccb->fac42 & 0x80) ? (sccb->fac43 & 31) : 0; | 145 | sclp.mtid_cp = (sccb->fac42 & 0x80) ? (sccb->fac43 & 31) : 0; |
156 | sclp_mtid_max = max(sclp_mtid, sclp_mtid_cp); | 146 | sclp_mtid_max = max(sclp.mtid, sclp.mtid_cp); |
157 | sclp_mtid_prev = (sccb->fac42 & 0x80) ? (sccb->fac66 & 31) : 0; | 147 | sclp.mtid_prev = (sccb->fac42 & 0x80) ? (sccb->fac66 & 31) : 0; |
158 | } | 148 | } |
159 | 149 | ||
160 | bool __init sclp_has_linemode(void) | ||
161 | { | ||
162 | return !!sclp_con_has_linemode; | ||
163 | } | ||
164 | |||
165 | bool __init sclp_has_vt220(void) | ||
166 | { | ||
167 | return !!sclp_con_has_vt220; | ||
168 | } | ||
169 | |||
170 | unsigned long long sclp_get_rnmax(void) | ||
171 | { | ||
172 | return sclp_rnmax; | ||
173 | } | ||
174 | |||
175 | unsigned long long sclp_get_rzm(void) | ||
176 | { | ||
177 | return sclp_rzm; | ||
178 | } | ||
179 | |||
180 | unsigned int sclp_get_max_cpu(void) | ||
181 | { | ||
182 | return sclp_max_cpu; | ||
183 | } | ||
184 | |||
185 | int sclp_has_siif(void) | ||
186 | { | ||
187 | return sclp_siif; | ||
188 | } | ||
189 | EXPORT_SYMBOL(sclp_has_siif); | ||
190 | |||
191 | int sclp_has_sigpif(void) | ||
192 | { | ||
193 | return sclp_sigpif; | ||
194 | } | ||
195 | EXPORT_SYMBOL(sclp_has_sigpif); | ||
196 | |||
197 | unsigned int sclp_get_ibc(void) | ||
198 | { | ||
199 | return sclp_ibc; | ||
200 | } | ||
201 | EXPORT_SYMBOL(sclp_get_ibc); | ||
202 | |||
203 | unsigned int sclp_get_mtid(u8 cpu_type) | 150 | unsigned int sclp_get_mtid(u8 cpu_type) |
204 | { | 151 | { |
205 | return cpu_type ? sclp_mtid : sclp_mtid_cp; | 152 | return cpu_type ? sclp.mtid : sclp.mtid_cp; |
206 | } | 153 | } |
207 | 154 | ||
208 | unsigned int sclp_get_mtid_max(void) | 155 | unsigned int sclp_get_mtid_max(void) |
@@ -210,11 +157,6 @@ unsigned int sclp_get_mtid_max(void) | |||
210 | return sclp_mtid_max; | 157 | return sclp_mtid_max; |
211 | } | 158 | } |
212 | 159 | ||
213 | unsigned int sclp_get_mtid_prev(void) | ||
214 | { | ||
215 | return sclp_mtid_prev; | ||
216 | } | ||
217 | |||
218 | /* | 160 | /* |
219 | * This function will be called after sclp_facilities_detect(), which gets | 161 | * This function will be called after sclp_facilities_detect(), which gets |
220 | * called from early.c code. The sclp_facilities_detect() function retrieves | 162 | * called from early.c code. The sclp_facilities_detect() function retrieves |
@@ -286,11 +228,6 @@ static long __init sclp_hsa_copy_wait(struct sccb_header *sccb) | |||
286 | return (((struct sdias_sccb *) sccb)->evbuf.blk_cnt - 1) * PAGE_SIZE; | 228 | return (((struct sdias_sccb *) sccb)->evbuf.blk_cnt - 1) * PAGE_SIZE; |
287 | } | 229 | } |
288 | 230 | ||
289 | unsigned long sclp_get_hsa_size(void) | ||
290 | { | ||
291 | return sclp_hsa_size; | ||
292 | } | ||
293 | |||
294 | static void __init sclp_hsa_size_detect(void *sccb) | 231 | static void __init sclp_hsa_size_detect(void *sccb) |
295 | { | 232 | { |
296 | long size; | 233 | long size; |
@@ -313,7 +250,7 @@ static void __init sclp_hsa_size_detect(void *sccb) | |||
313 | if (size < 0) | 250 | if (size < 0) |
314 | return; | 251 | return; |
315 | out: | 252 | out: |
316 | sclp_hsa_size = size; | 253 | sclp.hsa_size = size; |
317 | } | 254 | } |
318 | 255 | ||
319 | static unsigned int __init sclp_con_check_linemode(struct init_sccb *sccb) | 256 | static unsigned int __init sclp_con_check_linemode(struct init_sccb *sccb) |
@@ -331,10 +268,10 @@ static void __init sclp_console_detect(struct init_sccb *sccb) | |||
331 | return; | 268 | return; |
332 | 269 | ||
333 | if (sccb->sclp_send_mask & EVTYP_VT220MSG_MASK) | 270 | if (sccb->sclp_send_mask & EVTYP_VT220MSG_MASK) |
334 | sclp_con_has_vt220 = 1; | 271 | sclp.has_vt220 = 1; |
335 | 272 | ||
336 | if (sclp_con_check_linemode(sccb)) | 273 | if (sclp_con_check_linemode(sccb)) |
337 | sclp_con_has_linemode = 1; | 274 | sclp.has_linemode = 1; |
338 | } | 275 | } |
339 | 276 | ||
340 | void __init sclp_early_detect(void) | 277 | void __init sclp_early_detect(void) |
diff --git a/drivers/s390/char/zcore.c b/drivers/s390/char/zcore.c index a68fcfd1d48c..9a3dd95029cc 100644 --- a/drivers/s390/char/zcore.c +++ b/drivers/s390/char/zcore.c | |||
@@ -330,9 +330,9 @@ static ssize_t zcore_read(struct file *file, char __user *buf, size_t count, | |||
330 | mem_offs = 0; | 330 | mem_offs = 0; |
331 | 331 | ||
332 | /* Copy from HSA data */ | 332 | /* Copy from HSA data */ |
333 | if (*ppos < sclp_get_hsa_size() + HEADER_SIZE) { | 333 | if (*ppos < sclp.hsa_size + HEADER_SIZE) { |
334 | size = min((count - hdr_count), | 334 | size = min((count - hdr_count), |
335 | (size_t) (sclp_get_hsa_size() - mem_start)); | 335 | (size_t) (sclp.hsa_size - mem_start)); |
336 | rc = memcpy_hsa_user(buf + hdr_count, mem_start, size); | 336 | rc = memcpy_hsa_user(buf + hdr_count, mem_start, size); |
337 | if (rc) | 337 | if (rc) |
338 | goto fail; | 338 | goto fail; |
@@ -483,7 +483,7 @@ static ssize_t zcore_hsa_read(struct file *filp, char __user *buf, | |||
483 | static char str[18]; | 483 | static char str[18]; |
484 | 484 | ||
485 | if (hsa_available) | 485 | if (hsa_available) |
486 | snprintf(str, sizeof(str), "%lx\n", sclp_get_hsa_size()); | 486 | snprintf(str, sizeof(str), "%lx\n", sclp.hsa_size); |
487 | else | 487 | else |
488 | snprintf(str, sizeof(str), "0\n"); | 488 | snprintf(str, sizeof(str), "0\n"); |
489 | return simple_read_from_buffer(buf, count, ppos, str, strlen(str)); | 489 | return simple_read_from_buffer(buf, count, ppos, str, strlen(str)); |
@@ -558,7 +558,7 @@ static int __init sys_info_init(enum arch_id arch, unsigned long mem_end) | |||
558 | 558 | ||
559 | static int __init check_sdias(void) | 559 | static int __init check_sdias(void) |
560 | { | 560 | { |
561 | if (!sclp_get_hsa_size()) { | 561 | if (!sclp.hsa_size) { |
562 | TRACE("Could not determine HSA size\n"); | 562 | TRACE("Could not determine HSA size\n"); |
563 | return -ENODEV; | 563 | return -ENODEV; |
564 | } | 564 | } |
@@ -619,7 +619,7 @@ static int __init zcore_reipl_init(void) | |||
619 | ipl_block = (void *) __get_free_page(GFP_KERNEL); | 619 | ipl_block = (void *) __get_free_page(GFP_KERNEL); |
620 | if (!ipl_block) | 620 | if (!ipl_block) |
621 | return -ENOMEM; | 621 | return -ENOMEM; |
622 | if (ipib_info.ipib < sclp_get_hsa_size()) | 622 | if (ipib_info.ipib < sclp.hsa_size) |
623 | rc = memcpy_hsa_kernel(ipl_block, ipib_info.ipib, PAGE_SIZE); | 623 | rc = memcpy_hsa_kernel(ipl_block, ipib_info.ipib, PAGE_SIZE); |
624 | else | 624 | else |
625 | rc = memcpy_real(ipl_block, (void *) ipib_info.ipib, PAGE_SIZE); | 625 | rc = memcpy_real(ipl_block, (void *) ipib_info.ipib, PAGE_SIZE); |
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c index dd65c8b4c7fe..53fb975c404b 100644 --- a/drivers/s390/kvm/kvm_virtio.c +++ b/drivers/s390/kvm/kvm_virtio.c | |||
@@ -450,7 +450,7 @@ static int __init test_devices_support(unsigned long addr) | |||
450 | static int __init kvm_devices_init(void) | 450 | static int __init kvm_devices_init(void) |
451 | { | 451 | { |
452 | int rc; | 452 | int rc; |
453 | unsigned long total_memory_size = sclp_get_rzm() * sclp_get_rnmax(); | 453 | unsigned long total_memory_size = sclp.rzm * sclp.rnmax; |
454 | 454 | ||
455 | if (!MACHINE_IS_KVM) | 455 | if (!MACHINE_IS_KVM) |
456 | return -ENODEV; | 456 | return -ENODEV; |
@@ -497,7 +497,7 @@ static __init int early_put_chars(u32 vtermno, const char *buf, int count) | |||
497 | 497 | ||
498 | static int __init s390_virtio_console_init(void) | 498 | static int __init s390_virtio_console_init(void) |
499 | { | 499 | { |
500 | if (sclp_has_vt220() || sclp_has_linemode()) | 500 | if (sclp.has_vt220 || sclp.has_linemode) |
501 | return -ENODEV; | 501 | return -ENODEV; |
502 | return virtio_cons_early_init(early_put_chars); | 502 | return virtio_cons_early_init(early_put_chars); |
503 | } | 503 | } |