Lines Matching refs:cp

317 static struct ccwchain *ccwchain_alloc(struct channel_program *cp, int len)  in ccwchain_alloc()  argument
333 list_add_tail(&chain->next, &cp->ccwchain_list); in ccwchain_alloc()
375 static int ccwchain_calc_length(u64 iova, struct channel_program *cp) in ccwchain_calc_length() argument
377 struct ccw1 *ccw = cp->guest_cp; in ccwchain_calc_length()
403 static int tic_target_chain_exists(struct ccw1 *tic, struct channel_program *cp) in tic_target_chain_exists() argument
408 list_for_each_entry(chain, &cp->ccwchain_list, next) { in tic_target_chain_exists()
418 struct channel_program *cp);
420 static int ccwchain_handle_ccw(u32 cda, struct channel_program *cp) in ccwchain_handle_ccw() argument
423 &container_of(cp, struct vfio_ccw_private, cp)->vdev; in ccwchain_handle_ccw()
428 ret = vfio_dma_rw(vdev, cda, cp->guest_cp, CCWCHAIN_LEN_MAX * sizeof(struct ccw1), false); in ccwchain_handle_ccw()
433 if (!cp->orb.cmd.fmt) in ccwchain_handle_ccw()
434 convert_ccw0_to_ccw1(cp->guest_cp, CCWCHAIN_LEN_MAX); in ccwchain_handle_ccw()
437 len = ccwchain_calc_length(cda, cp); in ccwchain_handle_ccw()
442 chain = ccwchain_alloc(cp, len); in ccwchain_handle_ccw()
450 memcpy(chain->ch_ccw, cp->guest_cp, len * sizeof(struct ccw1)); in ccwchain_handle_ccw()
453 ret = ccwchain_loop_tic(chain, cp); in ccwchain_handle_ccw()
462 static int ccwchain_loop_tic(struct ccwchain *chain, struct channel_program *cp) in ccwchain_loop_tic() argument
474 if (tic_target_chain_exists(tic, cp)) in ccwchain_loop_tic()
478 ret = ccwchain_handle_ccw(tic->cda, cp); in ccwchain_loop_tic()
487 struct channel_program *cp) in ccwchain_fetch_tic() argument
492 list_for_each_entry(iter, &cp->ccwchain_list, next) { in ccwchain_fetch_tic()
505 struct channel_program *cp, in get_guest_idal() argument
509 &container_of(cp, struct vfio_ccw_private, cp)->vdev; in get_guest_idal()
513 int idaw_size = idal_is_2k(cp) ? PAGE_SIZE / 2 : PAGE_SIZE; in get_guest_idal()
530 if (cp->orb.cmd.c64) { in get_guest_idal()
560 struct channel_program *cp) in ccw_count_idaws() argument
563 &container_of(cp, struct vfio_ccw_private, cp)->vdev; in ccw_count_idaws()
565 int size = cp->orb.cmd.c64 ? sizeof(u64) : sizeof(u32); in ccw_count_idaws()
583 if (!cp->orb.cmd.c64) in ccw_count_idaws()
590 if (!cp->orb.cmd.c64) in ccw_count_idaws()
594 if (cp->orb.cmd.i2k) in ccw_count_idaws()
603 struct channel_program *cp) in ccwchain_fetch_ccw() argument
606 &container_of(cp, struct vfio_ccw_private, cp)->vdev; in ccwchain_fetch_ccw()
614 idaw_nr = ccw_count_idaws(ccw, cp); in ccwchain_fetch_ccw()
619 idaws = get_guest_idal(ccw, cp, idaw_nr); in ccwchain_fetch_ccw()
641 if (cp->orb.cmd.c64) in ccwchain_fetch_ccw()
648 ret = page_array_pin(pa, vdev, idal_is_2k(cp)); in ccwchain_fetch_ccw()
664 page_array_unpin_free(pa, vdev, idal_is_2k(cp)); in ccwchain_fetch_ccw()
680 struct channel_program *cp) in ccwchain_fetch_one() argument
684 return ccwchain_fetch_tic(ccw, cp); in ccwchain_fetch_one()
686 return ccwchain_fetch_ccw(ccw, pa, cp); in ccwchain_fetch_one()
704 int cp_init(struct channel_program *cp, union orb *orb) in cp_init() argument
707 &container_of(cp, struct vfio_ccw_private, cp)->vdev; in cp_init()
713 if (cp->initialized) in cp_init()
728 INIT_LIST_HEAD(&cp->ccwchain_list); in cp_init()
729 memcpy(&cp->orb, orb, sizeof(*orb)); in cp_init()
732 ret = ccwchain_handle_ccw(orb->cmd.cpa, cp); in cp_init()
735 cp->initialized = true; in cp_init()
749 void cp_free(struct channel_program *cp) in cp_free() argument
752 &container_of(cp, struct vfio_ccw_private, cp)->vdev; in cp_free()
756 if (!cp->initialized) in cp_free()
759 cp->initialized = false; in cp_free()
760 list_for_each_entry_safe(chain, temp, &cp->ccwchain_list, next) { in cp_free()
762 page_array_unpin_free(&chain->ch_pa[i], vdev, idal_is_2k(cp)); in cp_free()
806 int cp_prefetch(struct channel_program *cp) in cp_prefetch() argument
814 if (!cp->initialized) in cp_prefetch()
817 list_for_each_entry(chain, &cp->ccwchain_list, next) { in cp_prefetch()
823 ret = ccwchain_fetch_one(ccw, pa, cp); in cp_prefetch()
833 list_for_each_entry_continue(chain, &cp->ccwchain_list, next) { in cp_prefetch()
848 union orb *cp_get_orb(struct channel_program *cp, struct subchannel *sch) in cp_get_orb() argument
855 if (!cp->initialized) in cp_get_orb()
858 orb = &cp->orb; in cp_get_orb()
875 chain = list_first_entry(&cp->ccwchain_list, struct ccwchain, next); in cp_get_orb()
896 void cp_update_scsw(struct channel_program *cp, union scsw *scsw) in cp_update_scsw() argument
902 if (!cp->initialized) in cp_update_scsw()
911 list_for_each_entry(chain, &cp->ccwchain_list, next) { in cp_update_scsw()
941 bool cp_iova_pinned(struct channel_program *cp, u64 iova, u64 length) in cp_iova_pinned() argument
946 if (!cp->initialized) in cp_iova_pinned()
949 list_for_each_entry(chain, &cp->ccwchain_list, next) { in cp_iova_pinned()