diff options
Diffstat (limited to 'drivers/s390/char/sclp_cmd.c')
| -rw-r--r-- | drivers/s390/char/sclp_cmd.c | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c index 7be782116dab..e9485fbbb373 100644 --- a/drivers/s390/char/sclp_cmd.c +++ b/drivers/s390/char/sclp_cmd.c | |||
| @@ -92,8 +92,8 @@ struct read_cpu_info_sccb { | |||
| 92 | u8 reserved[4096 - 16]; | 92 | u8 reserved[4096 - 16]; |
| 93 | } __attribute__((packed, aligned(PAGE_SIZE))); | 93 | } __attribute__((packed, aligned(PAGE_SIZE))); |
| 94 | 94 | ||
| 95 | static void sclp_fill_cpu_info(struct sclp_cpu_info *info, | 95 | static void sclp_fill_core_info(struct sclp_core_info *info, |
| 96 | struct read_cpu_info_sccb *sccb) | 96 | struct read_cpu_info_sccb *sccb) |
| 97 | { | 97 | { |
| 98 | char *page = (char *) sccb; | 98 | char *page = (char *) sccb; |
| 99 | 99 | ||
| @@ -101,12 +101,11 @@ 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 | memcpy(&info->core, page + sccb->offset_configured, |
| 105 | memcpy(&info->cpu, page + sccb->offset_configured, | 105 | info->combined * sizeof(struct sclp_core_entry)); |
| 106 | info->combined * sizeof(struct sclp_cpu_entry)); | ||
| 107 | } | 106 | } |
| 108 | 107 | ||
| 109 | int sclp_get_cpu_info(struct sclp_cpu_info *info) | 108 | int sclp_get_core_info(struct sclp_core_info *info) |
| 110 | { | 109 | { |
| 111 | int rc; | 110 | int rc; |
| 112 | struct read_cpu_info_sccb *sccb; | 111 | struct read_cpu_info_sccb *sccb; |
| @@ -127,7 +126,7 @@ int sclp_get_cpu_info(struct sclp_cpu_info *info) | |||
| 127 | rc = -EIO; | 126 | rc = -EIO; |
| 128 | goto out; | 127 | goto out; |
| 129 | } | 128 | } |
| 130 | sclp_fill_cpu_info(info, sccb); | 129 | sclp_fill_core_info(info, sccb); |
| 131 | out: | 130 | out: |
| 132 | free_page((unsigned long) sccb); | 131 | free_page((unsigned long) sccb); |
| 133 | return rc; | 132 | return rc; |
| @@ -137,7 +136,7 @@ struct cpu_configure_sccb { | |||
| 137 | struct sccb_header header; | 136 | struct sccb_header header; |
| 138 | } __attribute__((packed, aligned(8))); | 137 | } __attribute__((packed, aligned(8))); |
| 139 | 138 | ||
| 140 | static int do_cpu_configure(sclp_cmdw_t cmd) | 139 | static int do_core_configure(sclp_cmdw_t cmd) |
| 141 | { | 140 | { |
| 142 | struct cpu_configure_sccb *sccb; | 141 | struct cpu_configure_sccb *sccb; |
| 143 | int rc; | 142 | int rc; |
| @@ -171,14 +170,14 @@ out: | |||
| 171 | return rc; | 170 | return rc; |
| 172 | } | 171 | } |
| 173 | 172 | ||
| 174 | int sclp_cpu_configure(u8 cpu) | 173 | int sclp_core_configure(u8 core) |
| 175 | { | 174 | { |
| 176 | return do_cpu_configure(SCLP_CMDW_CONFIGURE_CPU | cpu << 8); | 175 | return do_core_configure(SCLP_CMDW_CONFIGURE_CPU | core << 8); |
| 177 | } | 176 | } |
| 178 | 177 | ||
| 179 | int sclp_cpu_deconfigure(u8 cpu) | 178 | int sclp_core_deconfigure(u8 core) |
| 180 | { | 179 | { |
| 181 | return do_cpu_configure(SCLP_CMDW_DECONFIGURE_CPU | cpu << 8); | 180 | return do_core_configure(SCLP_CMDW_DECONFIGURE_CPU | core << 8); |
| 182 | } | 181 | } |
| 183 | 182 | ||
| 184 | #ifdef CONFIG_MEMORY_HOTPLUG | 183 | #ifdef CONFIG_MEMORY_HOTPLUG |
| @@ -186,7 +185,7 @@ int sclp_cpu_deconfigure(u8 cpu) | |||
| 186 | static DEFINE_MUTEX(sclp_mem_mutex); | 185 | static DEFINE_MUTEX(sclp_mem_mutex); |
| 187 | static LIST_HEAD(sclp_mem_list); | 186 | static LIST_HEAD(sclp_mem_list); |
| 188 | static u8 sclp_max_storage_id; | 187 | static u8 sclp_max_storage_id; |
| 189 | static unsigned long sclp_storage_ids[256 / BITS_PER_LONG]; | 188 | static DECLARE_BITMAP(sclp_storage_ids, 256); |
| 190 | static int sclp_mem_state_changed; | 189 | static int sclp_mem_state_changed; |
| 191 | 190 | ||
| 192 | struct memory_increment { | 191 | struct memory_increment { |
| @@ -202,14 +201,14 @@ struct assign_storage_sccb { | |||
| 202 | 201 | ||
| 203 | int arch_get_memory_phys_device(unsigned long start_pfn) | 202 | int arch_get_memory_phys_device(unsigned long start_pfn) |
| 204 | { | 203 | { |
| 205 | if (!sclp_rzm) | 204 | if (!sclp.rzm) |
| 206 | return 0; | 205 | return 0; |
| 207 | return PFN_PHYS(start_pfn) >> ilog2(sclp_rzm); | 206 | return PFN_PHYS(start_pfn) >> ilog2(sclp.rzm); |
| 208 | } | 207 | } |
| 209 | 208 | ||
| 210 | static unsigned long long rn2addr(u16 rn) | 209 | static unsigned long long rn2addr(u16 rn) |
| 211 | { | 210 | { |
| 212 | return (unsigned long long) (rn - 1) * sclp_rzm; | 211 | return (unsigned long long) (rn - 1) * sclp.rzm; |
| 213 | } | 212 | } |
| 214 | 213 | ||
| 215 | static int do_assign_storage(sclp_cmdw_t cmd, u16 rn) | 214 | static int do_assign_storage(sclp_cmdw_t cmd, u16 rn) |
| @@ -250,7 +249,7 @@ static int sclp_assign_storage(u16 rn) | |||
| 250 | if (rc) | 249 | if (rc) |
| 251 | return rc; | 250 | return rc; |
| 252 | start = rn2addr(rn); | 251 | start = rn2addr(rn); |
| 253 | storage_key_init_range(start, start + sclp_rzm); | 252 | storage_key_init_range(start, start + sclp.rzm); |
| 254 | return 0; | 253 | return 0; |
| 255 | } | 254 | } |
| 256 | 255 | ||
| @@ -309,7 +308,7 @@ static int sclp_mem_change_state(unsigned long start, unsigned long size, | |||
| 309 | istart = rn2addr(incr->rn); | 308 | istart = rn2addr(incr->rn); |
| 310 | if (start + size - 1 < istart) | 309 | if (start + size - 1 < istart) |
| 311 | break; | 310 | break; |
| 312 | if (start > istart + sclp_rzm - 1) | 311 | if (start > istart + sclp.rzm - 1) |
| 313 | continue; | 312 | continue; |
| 314 | if (online) | 313 | if (online) |
| 315 | rc |= sclp_assign_storage(incr->rn); | 314 | rc |= sclp_assign_storage(incr->rn); |
| @@ -330,7 +329,7 @@ static bool contains_standby_increment(unsigned long start, unsigned long end) | |||
| 330 | istart = rn2addr(incr->rn); | 329 | istart = rn2addr(incr->rn); |
| 331 | if (end - 1 < istart) | 330 | if (end - 1 < istart) |
| 332 | continue; | 331 | continue; |
| 333 | if (start > istart + sclp_rzm - 1) | 332 | if (start > istart + sclp.rzm - 1) |
| 334 | continue; | 333 | continue; |
| 335 | if (incr->standby) | 334 | if (incr->standby) |
| 336 | return true; | 335 | return true; |
| @@ -415,7 +414,7 @@ static void __init add_memory_merged(u16 rn) | |||
| 415 | if (!first_rn) | 414 | if (!first_rn) |
| 416 | goto skip_add; | 415 | goto skip_add; |
| 417 | start = rn2addr(first_rn); | 416 | start = rn2addr(first_rn); |
| 418 | size = (unsigned long long) num * sclp_rzm; | 417 | size = (unsigned long long) num * sclp.rzm; |
| 419 | if (start >= VMEM_MAX_PHYS) | 418 | if (start >= VMEM_MAX_PHYS) |
| 420 | goto skip_add; | 419 | goto skip_add; |
| 421 | if (start + size > VMEM_MAX_PHYS) | 420 | if (start + size > VMEM_MAX_PHYS) |
| @@ -465,7 +464,7 @@ static void __init insert_increment(u16 rn, int standby, int assigned) | |||
| 465 | } | 464 | } |
| 466 | if (!assigned) | 465 | if (!assigned) |
| 467 | new_incr->rn = last_rn + 1; | 466 | new_incr->rn = last_rn + 1; |
| 468 | if (new_incr->rn > sclp_rnmax) { | 467 | if (new_incr->rn > sclp.rnmax) { |
| 469 | kfree(new_incr); | 468 | kfree(new_incr); |
| 470 | return; | 469 | return; |
| 471 | } | 470 | } |
| @@ -508,7 +507,7 @@ static int __init sclp_detect_standby_memory(void) | |||
| 508 | 507 | ||
| 509 | if (OLDMEM_BASE) /* No standby memory in kdump mode */ | 508 | if (OLDMEM_BASE) /* No standby memory in kdump mode */ |
| 510 | return 0; | 509 | return 0; |
| 511 | if ((sclp_facilities & 0xe00000000000ULL) != 0xe00000000000ULL) | 510 | if ((sclp.facilities & 0xe00000000000ULL) != 0xe00000000000ULL) |
| 512 | return 0; | 511 | return 0; |
| 513 | rc = -ENOMEM; | 512 | rc = -ENOMEM; |
| 514 | sccb = (void *) __get_free_page(GFP_KERNEL | GFP_DMA); | 513 | sccb = (void *) __get_free_page(GFP_KERNEL | GFP_DMA); |
| @@ -550,7 +549,7 @@ static int __init sclp_detect_standby_memory(void) | |||
| 550 | } | 549 | } |
| 551 | if (rc || list_empty(&sclp_mem_list)) | 550 | if (rc || list_empty(&sclp_mem_list)) |
| 552 | goto out; | 551 | goto out; |
| 553 | for (i = 1; i <= sclp_rnmax - assigned; i++) | 552 | for (i = 1; i <= sclp.rnmax - assigned; i++) |
| 554 | insert_increment(0, 1, 0); | 553 | insert_increment(0, 1, 0); |
| 555 | rc = register_memory_notifier(&sclp_mem_nb); | 554 | rc = register_memory_notifier(&sclp_mem_nb); |
| 556 | if (rc) | 555 | if (rc) |
| @@ -753,8 +752,3 @@ out: | |||
| 753 | free_page((unsigned long) sccb); | 752 | free_page((unsigned long) sccb); |
| 754 | return rc; | 753 | return rc; |
| 755 | } | 754 | } |
| 756 | |||
| 757 | bool sclp_has_sprp(void) | ||
| 758 | { | ||
| 759 | return !!(sclp_fac84 & 0x2); | ||
| 760 | } | ||
