Lines Matching refs:ccw
261 static inline int ccw_does_data_transfer(struct ccw1 *ccw) in ccw_does_data_transfer() argument
264 if (ccw->count == 0) in ccw_does_data_transfer()
268 if (ccw_is_noop(ccw)) in ccw_does_data_transfer()
272 if (!ccw_is_skip(ccw)) in ccw_does_data_transfer()
280 if (ccw_is_read(ccw) || ccw_is_read_backward(ccw)) in ccw_does_data_transfer()
283 if (ccw_is_sense(ccw)) in ccw_does_data_transfer()
310 static inline int is_tic_within_range(struct ccw1 *ccw, u32 head, int len) in is_tic_within_range() argument
312 if (!ccw_is_tic(ccw)) in is_tic_within_range()
315 return is_cpa_within_range(ccw->cda, head, len); in is_tic_within_range()
355 struct ccw1 *ccw = &chain->ch_ccw[idx]; in ccwchain_cda_free() local
357 if (ccw_is_tic(ccw)) in ccwchain_cda_free()
360 kfree(dma32_to_virt(ccw->cda)); in ccwchain_cda_free()
378 struct ccw1 *ccw = cp->guest_cp; in ccwchain_calc_length() local
392 if (!ccw_is_chain(ccw) && !is_tic_within_range(ccw, iova, cnt)) in ccwchain_calc_length()
395 ccw++; in ccwchain_calc_length()
489 static int ccwchain_fetch_tic(struct ccw1 *ccw, in ccwchain_fetch_tic() argument
497 if (is_cpa_within_range(ccw->cda, ccw_head, iter->ch_len)) { in ccwchain_fetch_tic()
499 offset = dma32_to_u32(ccw->cda) - ccw_head; in ccwchain_fetch_tic()
500 ccw->cda = virt_to_dma32((void *)iter->ch_ccw + offset); in ccwchain_fetch_tic()
508 static dma64_t *get_guest_idal(struct ccw1 *ccw, struct channel_program *cp, int idaw_nr) in get_guest_idal() argument
523 if (ccw_is_idal(ccw)) { in get_guest_idal()
525 ret = vfio_dma_rw(vdev, dma32_to_u32(ccw->cda), idaws, idal_len, false); in get_guest_idal()
533 idaws[0] = u64_to_dma64(dma32_to_u32(ccw->cda)); in get_guest_idal()
540 idaws_f1[0] = ccw->cda; in get_guest_idal()
565 static int ccw_count_idaws(struct ccw1 *ccw, in ccw_count_idaws() argument
575 if (ccw->count) in ccw_count_idaws()
576 bytes = ccw->count; in ccw_count_idaws()
578 if (ccw_is_idal(ccw)) { in ccw_count_idaws()
581 ret = vfio_dma_rw(vdev, dma32_to_u32(ccw->cda), &iova, size, false); in ccw_count_idaws()
592 iova = dma32_to_u32(ccw->cda); in ccw_count_idaws()
607 static int ccwchain_fetch_ccw(struct ccw1 *ccw, in ccwchain_fetch_ccw() argument
620 idaw_nr = ccw_count_idaws(ccw, cp); in ccwchain_fetch_ccw()
625 idaws = get_guest_idal(ccw, cp, idaw_nr); in ccwchain_fetch_ccw()
653 if (ccw_does_data_transfer(ccw)) { in ccwchain_fetch_ccw()
661 ccw->cda = virt_to_dma32(idaws); in ccwchain_fetch_ccw()
662 ccw->flags |= CCW_FLAG_IDA; in ccwchain_fetch_ccw()
674 ccw->cda = 0; in ccwchain_fetch_ccw()
684 static int ccwchain_fetch_one(struct ccw1 *ccw, in ccwchain_fetch_one() argument
689 if (ccw_is_tic(ccw)) in ccwchain_fetch_one()
690 return ccwchain_fetch_tic(ccw, cp); in ccwchain_fetch_one()
692 return ccwchain_fetch_ccw(ccw, pa, cp); in ccwchain_fetch_one()
815 struct ccw1 *ccw; in cp_prefetch() local
826 ccw = &chain->ch_ccw[idx]; in cp_prefetch()
829 ret = ccwchain_fetch_one(ccw, pa, cp); in cp_prefetch()