Lines Matching +full:x +full:- +full:rc

1 // SPDX-License-Identifier: GPL-2.0
31 #include <asm/page-states.h>
54 int rc; in sclp_sync_request_timeout() local
58 return -ENOMEM; in sclp_sync_request_timeout()
60 request->queue_timeout = timeout; in sclp_sync_request_timeout()
61 request->command = cmd; in sclp_sync_request_timeout()
62 request->sccb = sccb; in sclp_sync_request_timeout()
63 request->status = SCLP_REQ_FILLED; in sclp_sync_request_timeout()
64 request->callback = sclp_sync_callback; in sclp_sync_request_timeout()
65 request->callback_data = &completion; in sclp_sync_request_timeout()
69 rc = sclp_add_request(request); in sclp_sync_request_timeout()
70 if (rc) in sclp_sync_request_timeout()
75 if (request->status != SCLP_REQ_DONE) { in sclp_sync_request_timeout()
76 pr_warn("sync request failed (cmd=0x%08x, status=0x%02x)\n", in sclp_sync_request_timeout()
77 cmd, request->status); in sclp_sync_request_timeout()
78 rc = -EIO; in sclp_sync_request_timeout()
82 return rc; in sclp_sync_request_timeout()
94 int rc; in _sclp_get_core_info() local
99 return -EOPNOTSUPP; in _sclp_get_core_info()
103 return -ENOMEM; in _sclp_get_core_info()
104 sccb->header.length = length; in _sclp_get_core_info()
105 sccb->header.control_mask[2] = 0x80; in _sclp_get_core_info()
106 rc = sclp_sync_request_timeout(SCLP_CMDW_READ_CPU_INFO, sccb, in _sclp_get_core_info()
108 if (rc) in _sclp_get_core_info()
110 if (sccb->header.response_code != 0x0010) { in _sclp_get_core_info()
111 pr_warn("readcpuinfo failed (response=0x%04x)\n", in _sclp_get_core_info()
112 sccb->header.response_code); in _sclp_get_core_info()
113 rc = -EIO; in _sclp_get_core_info()
119 return rc; in _sclp_get_core_info()
129 int rc; in do_core_configure() local
132 return -EOPNOTSUPP; in do_core_configure()
139 return -ENOMEM; in do_core_configure()
140 sccb->header.length = sizeof(*sccb); in do_core_configure()
141 rc = sclp_sync_request_timeout(cmd, sccb, SCLP_QUEUE_INTERVAL); in do_core_configure()
142 if (rc) in do_core_configure()
144 switch (sccb->header.response_code) { in do_core_configure()
149 pr_warn("configure cpu failed (cmd=0x%08x, response=0x%04x)\n", in do_core_configure()
150 cmd, sccb->header.response_code); in do_core_configure()
151 rc = -EIO; in do_core_configure()
156 return rc; in do_core_configure()
196 return (unsigned long long) (rn - 1) * sclp.rzm; in rn2addr()
202 int rc; in do_assign_storage() local
206 return -ENOMEM; in do_assign_storage()
207 sccb->header.length = PAGE_SIZE; in do_assign_storage()
208 sccb->rn = rn; in do_assign_storage()
209 rc = sclp_sync_request_timeout(cmd, sccb, SCLP_QUEUE_INTERVAL); in do_assign_storage()
210 if (rc) in do_assign_storage()
212 switch (sccb->header.response_code) { in do_assign_storage()
217 pr_warn("assign storage failed (cmd=0x%08x, response=0x%04x, rn=0x%04x)\n", in do_assign_storage()
218 cmd, sccb->header.response_code, rn); in do_assign_storage()
219 rc = -EIO; in do_assign_storage()
224 return rc; in do_assign_storage()
230 int rc; in sclp_assign_storage() local
232 rc = do_assign_storage(SCLP_CMDW_ASSIGN_STORAGE, rn); in sclp_assign_storage()
233 if (rc) in sclp_assign_storage()
234 return rc; in sclp_assign_storage()
256 int rc; in sclp_attach_storage() local
261 return -ENOMEM; in sclp_attach_storage()
262 sccb->header.length = PAGE_SIZE; in sclp_attach_storage()
263 sccb->header.function_code = 0x40; in sclp_attach_storage()
264 rc = sclp_sync_request_timeout(0x00080001 | id << 8, sccb, in sclp_attach_storage()
266 if (rc) in sclp_attach_storage()
268 switch (sccb->header.response_code) { in sclp_attach_storage()
271 for (i = 0; i < sccb->assigned; i++) { in sclp_attach_storage()
272 if (sccb->entries[i]) in sclp_attach_storage()
273 sclp_unassign_storage(sccb->entries[i] >> 16); in sclp_attach_storage()
277 rc = -EIO; in sclp_attach_storage()
282 return rc; in sclp_attach_storage()
290 int rc = 0; in sclp_mem_change_state() local
293 istart = rn2addr(incr->rn); in sclp_mem_change_state()
294 if (start + size - 1 < istart) in sclp_mem_change_state()
296 if (start > istart + sclp.rzm - 1) in sclp_mem_change_state()
299 rc |= sclp_assign_storage(incr->rn); in sclp_mem_change_state()
301 sclp_unassign_storage(incr->rn); in sclp_mem_change_state()
302 if (rc == 0) in sclp_mem_change_state()
303 incr->standby = online ? 0 : 1; in sclp_mem_change_state()
305 return rc ? -EIO : 0; in sclp_mem_change_state()
314 istart = rn2addr(incr->rn); in contains_standby_increment()
315 if (end - 1 < istart) in contains_standby_increment()
317 if (start > istart + sclp.rzm - 1) in contains_standby_increment()
319 if (incr->standby) in contains_standby_increment()
331 int rc = 0; in sclp_mem_notifier() local
334 start = arg->start_pfn << PAGE_SHIFT; in sclp_mem_notifier()
335 size = arg->nr_pages << PAGE_SHIFT; in sclp_mem_notifier()
347 rc = -EPERM; in sclp_mem_notifier()
358 if (arg->altmap_nr_pages) { in sclp_mem_notifier()
359 start = PFN_PHYS(arg->altmap_start_pfn); in sclp_mem_notifier()
360 size += PFN_PHYS(arg->altmap_nr_pages); in sclp_mem_notifier()
362 rc = sclp_mem_change_state(start, size, 1); in sclp_mem_notifier()
363 if (rc || !arg->altmap_nr_pages) in sclp_mem_notifier()
370 __arch_set_page_nodat((void *)__va(start), arg->altmap_nr_pages); in sclp_mem_notifier()
377 if (arg->altmap_nr_pages) { in sclp_mem_notifier()
378 start = PFN_PHYS(arg->altmap_start_pfn); in sclp_mem_notifier()
379 size += PFN_PHYS(arg->altmap_nr_pages); in sclp_mem_notifier()
387 return rc ? NOTIFY_BAD : NOTIFY_OK; in sclp_mem_notifier()
401 size_align = rounddown(*start + *size, alignment) - start_align; in align_to_block_size()
403 pr_info("Standby memory at 0x%llx (%lluM of %lluM usable)\n", in align_to_block_size()
425 size = ident_map_size - start; in add_memory_merged()
444 if (incr->standby) in sclp_add_standby_memory()
445 add_memory_merged(incr->rn); in sclp_add_standby_memory()
458 new_incr->rn = rn; in insert_increment()
459 new_incr->standby = standby; in insert_increment()
463 if (assigned && incr->rn > rn) in insert_increment()
465 if (!assigned && incr->rn - last_rn > 1) in insert_increment()
467 last_rn = incr->rn; in insert_increment()
468 prev = &incr->list; in insert_increment()
471 new_incr->rn = last_rn + 1; in insert_increment()
472 if (new_incr->rn > sclp.rnmax) { in insert_increment()
476 list_add(&new_incr->list, prev); in insert_increment()
482 int i, id, assigned, rc; in sclp_detect_standby_memory() local
488 rc = -ENOMEM; in sclp_detect_standby_memory()
495 sccb->header.length = PAGE_SIZE; in sclp_detect_standby_memory()
496 rc = sclp_sync_request(SCLP_CMDW_READ_STORAGE_INFO | id << 8, sccb); in sclp_detect_standby_memory()
497 if (rc) in sclp_detect_standby_memory()
499 switch (sccb->header.response_code) { in sclp_detect_standby_memory()
502 for (i = 0; i < sccb->assigned; i++) { in sclp_detect_standby_memory()
503 if (!sccb->entries[i]) in sclp_detect_standby_memory()
506 insert_increment(sccb->entries[i] >> 16, 0, 1); in sclp_detect_standby_memory()
512 for (i = 0; i < sccb->assigned; i++) { in sclp_detect_standby_memory()
513 if (!sccb->entries[i]) in sclp_detect_standby_memory()
516 insert_increment(sccb->entries[i] >> 16, 1, 1); in sclp_detect_standby_memory()
520 rc = -EIO; in sclp_detect_standby_memory()
523 if (!rc) in sclp_detect_standby_memory()
524 sclp_max_storage_id = sccb->max_id; in sclp_detect_standby_memory()
526 if (rc || list_empty(&sclp_mem_list)) in sclp_detect_standby_memory()
528 for (i = 1; i <= sclp.rnmax - assigned; i++) in sclp_detect_standby_memory()
530 rc = register_memory_notifier(&sclp_mem_nb); in sclp_detect_standby_memory()
531 if (rc) in sclp_detect_standby_memory()
536 return rc; in sclp_detect_standby_memory()
560 int rc; in do_chp_configure() local
563 return -EOPNOTSUPP; in do_chp_configure()
567 return -ENOMEM; in do_chp_configure()
568 sccb->header.length = sizeof(*sccb); in do_chp_configure()
569 rc = sclp_sync_request(cmd, sccb); in do_chp_configure()
570 if (rc) in do_chp_configure()
572 switch (sccb->header.response_code) { in do_chp_configure()
579 pr_warn("configure channel-path failed (cmd=0x%08x, response=0x%04x)\n", in do_chp_configure()
580 cmd, sccb->header.response_code); in do_chp_configure()
581 rc = -EIO; in do_chp_configure()
586 return rc; in do_chp_configure()
590 * sclp_chp_configure - perform configure channel-path sclp command
591 * @chpid: channel-path ID
593 * Perform configure channel-path command sclp command for specified chpid.
594 * Return 0 after command successfully finished, non-zero otherwise.
602 * sclp_chp_deconfigure - perform deconfigure channel-path sclp command
603 * @chpid: channel-path ID
605 * Perform deconfigure channel-path command sclp command for specified chpid
606 * and wait for completion. On success return 0. Return non-zero otherwise.
624 * sclp_chp_read_info - perform read channel-path information sclp command
625 * @info: resulting channel-path information data
627 * Perform read channel-path information sclp command and wait for completion.
628 * On success, store channel-path information in @info and return 0. Return
629 * non-zero otherwise.
634 int rc; in sclp_chp_read_info() local
637 return -EOPNOTSUPP; in sclp_chp_read_info()
641 return -ENOMEM; in sclp_chp_read_info()
642 sccb->header.length = sizeof(*sccb); in sclp_chp_read_info()
643 rc = sclp_sync_request(SCLP_CMDW_READ_CHPATH_INFORMATION, sccb); in sclp_chp_read_info()
644 if (rc) in sclp_chp_read_info()
646 if (sccb->header.response_code != 0x0010) { in sclp_chp_read_info()
647 pr_warn("read channel-path info failed (response=0x%04x)\n", in sclp_chp_read_info()
648 sccb->header.response_code); in sclp_chp_read_info()
649 rc = -EIO; in sclp_chp_read_info()
652 memcpy(info->recognized, sccb->recognized, SCLP_CHP_INFO_MASK_SIZE); in sclp_chp_read_info()
653 memcpy(info->standby, sccb->standby, SCLP_CHP_INFO_MASK_SIZE); in sclp_chp_read_info()
654 memcpy(info->configured, sccb->configured, SCLP_CHP_INFO_MASK_SIZE); in sclp_chp_read_info()
657 return rc; in sclp_chp_read_info()