Lines Matching +full:x +full:- +full:rc
1 // SPDX-License-Identifier: GPL-2.0
30 #include <asm/page-states.h>
53 int rc; in sclp_sync_request_timeout() local
57 return -ENOMEM; in sclp_sync_request_timeout()
59 request->queue_timeout = timeout; in sclp_sync_request_timeout()
60 request->command = cmd; in sclp_sync_request_timeout()
61 request->sccb = sccb; in sclp_sync_request_timeout()
62 request->status = SCLP_REQ_FILLED; in sclp_sync_request_timeout()
63 request->callback = sclp_sync_callback; in sclp_sync_request_timeout()
64 request->callback_data = &completion; in sclp_sync_request_timeout()
68 rc = sclp_add_request(request); in sclp_sync_request_timeout()
69 if (rc) in sclp_sync_request_timeout()
74 if (request->status != SCLP_REQ_DONE) { in sclp_sync_request_timeout()
75 pr_warn("sync request failed (cmd=0x%08x, status=0x%02x)\n", in sclp_sync_request_timeout()
76 cmd, request->status); in sclp_sync_request_timeout()
77 rc = -EIO; in sclp_sync_request_timeout()
81 return rc; in sclp_sync_request_timeout()
93 int rc; in _sclp_get_core_info() local
98 return -EOPNOTSUPP; in _sclp_get_core_info()
102 return -ENOMEM; in _sclp_get_core_info()
103 sccb->header.length = length; in _sclp_get_core_info()
104 sccb->header.control_mask[2] = 0x80; in _sclp_get_core_info()
105 rc = sclp_sync_request_timeout(SCLP_CMDW_READ_CPU_INFO, sccb, in _sclp_get_core_info()
107 if (rc) in _sclp_get_core_info()
109 if (sccb->header.response_code != 0x0010) { in _sclp_get_core_info()
110 pr_warn("readcpuinfo failed (response=0x%04x)\n", in _sclp_get_core_info()
111 sccb->header.response_code); in _sclp_get_core_info()
112 rc = -EIO; in _sclp_get_core_info()
118 return rc; in _sclp_get_core_info()
128 int rc; in do_core_configure() local
131 return -EOPNOTSUPP; in do_core_configure()
138 return -ENOMEM; in do_core_configure()
139 sccb->header.length = sizeof(*sccb); in do_core_configure()
140 rc = sclp_sync_request_timeout(cmd, sccb, SCLP_QUEUE_INTERVAL); in do_core_configure()
141 if (rc) in do_core_configure()
143 switch (sccb->header.response_code) { in do_core_configure()
148 pr_warn("configure cpu failed (cmd=0x%08x, response=0x%04x)\n", in do_core_configure()
149 cmd, sccb->header.response_code); in do_core_configure()
150 rc = -EIO; in do_core_configure()
155 return rc; in do_core_configure()
195 return (unsigned long long) (rn - 1) * sclp.rzm; in rn2addr()
201 int rc; in do_assign_storage() local
205 return -ENOMEM; in do_assign_storage()
206 sccb->header.length = PAGE_SIZE; in do_assign_storage()
207 sccb->rn = rn; in do_assign_storage()
208 rc = sclp_sync_request_timeout(cmd, sccb, SCLP_QUEUE_INTERVAL); in do_assign_storage()
209 if (rc) in do_assign_storage()
211 switch (sccb->header.response_code) { in do_assign_storage()
216 pr_warn("assign storage failed (cmd=0x%08x, response=0x%04x, rn=0x%04x)\n", in do_assign_storage()
217 cmd, sccb->header.response_code, rn); in do_assign_storage()
218 rc = -EIO; in do_assign_storage()
223 return rc; in do_assign_storage()
229 int rc; in sclp_assign_storage() local
231 rc = do_assign_storage(SCLP_CMDW_ASSIGN_STORAGE, rn); in sclp_assign_storage()
232 if (rc) in sclp_assign_storage()
233 return rc; in sclp_assign_storage()
255 int rc; in sclp_attach_storage() local
260 return -ENOMEM; in sclp_attach_storage()
261 sccb->header.length = PAGE_SIZE; in sclp_attach_storage()
262 sccb->header.function_code = 0x40; in sclp_attach_storage()
263 rc = sclp_sync_request_timeout(0x00080001 | id << 8, sccb, in sclp_attach_storage()
265 if (rc) in sclp_attach_storage()
267 switch (sccb->header.response_code) { in sclp_attach_storage()
270 for (i = 0; i < sccb->assigned; i++) { in sclp_attach_storage()
271 if (sccb->entries[i]) in sclp_attach_storage()
272 sclp_unassign_storage(sccb->entries[i] >> 16); in sclp_attach_storage()
276 rc = -EIO; in sclp_attach_storage()
281 return rc; in sclp_attach_storage()
289 int rc = 0; in sclp_mem_change_state() local
292 istart = rn2addr(incr->rn); in sclp_mem_change_state()
293 if (start + size - 1 < istart) in sclp_mem_change_state()
295 if (start > istart + sclp.rzm - 1) in sclp_mem_change_state()
298 rc |= sclp_assign_storage(incr->rn); in sclp_mem_change_state()
300 sclp_unassign_storage(incr->rn); in sclp_mem_change_state()
301 if (rc == 0) in sclp_mem_change_state()
302 incr->standby = online ? 0 : 1; in sclp_mem_change_state()
304 return rc ? -EIO : 0; in sclp_mem_change_state()
313 istart = rn2addr(incr->rn); in contains_standby_increment()
314 if (end - 1 < istart) in contains_standby_increment()
316 if (start > istart + sclp.rzm - 1) in contains_standby_increment()
318 if (incr->standby) in contains_standby_increment()
330 int rc = 0; in sclp_mem_notifier() local
333 start = arg->start_pfn << PAGE_SHIFT; in sclp_mem_notifier()
334 size = arg->nr_pages << PAGE_SHIFT; in sclp_mem_notifier()
346 rc = -EPERM; in sclp_mem_notifier()
357 if (arg->altmap_nr_pages) { in sclp_mem_notifier()
358 start = PFN_PHYS(arg->altmap_start_pfn); in sclp_mem_notifier()
359 size += PFN_PHYS(arg->altmap_nr_pages); in sclp_mem_notifier()
361 rc = sclp_mem_change_state(start, size, 1); in sclp_mem_notifier()
362 if (rc || !arg->altmap_nr_pages) in sclp_mem_notifier()
369 __arch_set_page_nodat((void *)__va(start), arg->altmap_nr_pages); in sclp_mem_notifier()
376 if (arg->altmap_nr_pages) { in sclp_mem_notifier()
377 start = PFN_PHYS(arg->altmap_start_pfn); in sclp_mem_notifier()
378 size += PFN_PHYS(arg->altmap_nr_pages); in sclp_mem_notifier()
386 return rc ? NOTIFY_BAD : NOTIFY_OK; in sclp_mem_notifier()
400 size_align = rounddown(*start + *size, alignment) - start_align; in align_to_block_size()
402 pr_info("Standby memory at 0x%llx (%lluM of %lluM usable)\n", in align_to_block_size()
424 size = ident_map_size - start; in add_memory_merged()
443 if (incr->standby) in sclp_add_standby_memory()
444 add_memory_merged(incr->rn); in sclp_add_standby_memory()
457 new_incr->rn = rn; in insert_increment()
458 new_incr->standby = standby; in insert_increment()
462 if (assigned && incr->rn > rn) in insert_increment()
464 if (!assigned && incr->rn - last_rn > 1) in insert_increment()
466 last_rn = incr->rn; in insert_increment()
467 prev = &incr->list; in insert_increment()
470 new_incr->rn = last_rn + 1; in insert_increment()
471 if (new_incr->rn > sclp.rnmax) { in insert_increment()
475 list_add(&new_incr->list, prev); in insert_increment()
481 int i, id, assigned, rc; in sclp_detect_standby_memory() local
487 rc = -ENOMEM; in sclp_detect_standby_memory()
494 sccb->header.length = PAGE_SIZE; in sclp_detect_standby_memory()
495 rc = sclp_sync_request(SCLP_CMDW_READ_STORAGE_INFO | id << 8, sccb); in sclp_detect_standby_memory()
496 if (rc) in sclp_detect_standby_memory()
498 switch (sccb->header.response_code) { in sclp_detect_standby_memory()
501 for (i = 0; i < sccb->assigned; i++) { in sclp_detect_standby_memory()
502 if (!sccb->entries[i]) in sclp_detect_standby_memory()
505 insert_increment(sccb->entries[i] >> 16, 0, 1); in sclp_detect_standby_memory()
511 for (i = 0; i < sccb->assigned; i++) { in sclp_detect_standby_memory()
512 if (!sccb->entries[i]) in sclp_detect_standby_memory()
515 insert_increment(sccb->entries[i] >> 16, 1, 1); in sclp_detect_standby_memory()
519 rc = -EIO; in sclp_detect_standby_memory()
522 if (!rc) in sclp_detect_standby_memory()
523 sclp_max_storage_id = sccb->max_id; in sclp_detect_standby_memory()
525 if (rc || list_empty(&sclp_mem_list)) in sclp_detect_standby_memory()
527 for (i = 1; i <= sclp.rnmax - assigned; i++) in sclp_detect_standby_memory()
529 rc = register_memory_notifier(&sclp_mem_nb); in sclp_detect_standby_memory()
530 if (rc) in sclp_detect_standby_memory()
535 return rc; in sclp_detect_standby_memory()
559 int rc; in do_chp_configure() local
562 return -EOPNOTSUPP; in do_chp_configure()
566 return -ENOMEM; in do_chp_configure()
567 sccb->header.length = sizeof(*sccb); in do_chp_configure()
568 rc = sclp_sync_request(cmd, sccb); in do_chp_configure()
569 if (rc) in do_chp_configure()
571 switch (sccb->header.response_code) { in do_chp_configure()
578 pr_warn("configure channel-path failed (cmd=0x%08x, response=0x%04x)\n", in do_chp_configure()
579 cmd, sccb->header.response_code); in do_chp_configure()
580 rc = -EIO; in do_chp_configure()
585 return rc; in do_chp_configure()
589 * sclp_chp_configure - perform configure channel-path sclp command
590 * @chpid: channel-path ID
592 * Perform configure channel-path command sclp command for specified chpid.
593 * Return 0 after command successfully finished, non-zero otherwise.
601 * sclp_chp_deconfigure - perform deconfigure channel-path sclp command
602 * @chpid: channel-path ID
604 * Perform deconfigure channel-path command sclp command for specified chpid
605 * and wait for completion. On success return 0. Return non-zero otherwise.
623 * sclp_chp_read_info - perform read channel-path information sclp command
624 * @info: resulting channel-path information data
626 * Perform read channel-path information sclp command and wait for completion.
627 * On success, store channel-path information in @info and return 0. Return
628 * non-zero otherwise.
633 int rc; in sclp_chp_read_info() local
636 return -EOPNOTSUPP; in sclp_chp_read_info()
640 return -ENOMEM; in sclp_chp_read_info()
641 sccb->header.length = sizeof(*sccb); in sclp_chp_read_info()
642 rc = sclp_sync_request(SCLP_CMDW_READ_CHPATH_INFORMATION, sccb); in sclp_chp_read_info()
643 if (rc) in sclp_chp_read_info()
645 if (sccb->header.response_code != 0x0010) { in sclp_chp_read_info()
646 pr_warn("read channel-path info failed (response=0x%04x)\n", in sclp_chp_read_info()
647 sccb->header.response_code); in sclp_chp_read_info()
648 rc = -EIO; in sclp_chp_read_info()
651 memcpy(info->recognized, sccb->recognized, SCLP_CHP_INFO_MASK_SIZE); in sclp_chp_read_info()
652 memcpy(info->standby, sccb->standby, SCLP_CHP_INFO_MASK_SIZE); in sclp_chp_read_info()
653 memcpy(info->configured, sccb->configured, SCLP_CHP_INFO_MASK_SIZE); in sclp_chp_read_info()
656 return rc; in sclp_chp_read_info()