Lines Matching defs:ccw
261 static inline int ccw_does_data_transfer(struct ccw1 *ccw)
264 if (ccw->count == 0)
268 if (ccw_is_noop(ccw))
272 if (!ccw_is_skip(ccw))
280 if (ccw_is_read(ccw) || ccw_is_read_backward(ccw))
283 if (ccw_is_sense(ccw))
309 static inline int is_tic_within_range(struct ccw1 *ccw, u32 head, int len)
311 if (!ccw_is_tic(ccw))
314 return is_cpa_within_range(ccw->cda, head, len);
351 /* Free resource for a ccw that allocated memory for its cda. */
354 struct ccw1 *ccw = &chain->ch_ccw[idx];
356 if (ccw_is_tic(ccw))
359 kfree(phys_to_virt(ccw->cda));
363 * ccwchain_calc_length - calculate the length of the ccw chain.
364 * @iova: guest physical address of the target ccw chain
373 * Returns: the length of the ccw chain or -errno.
377 struct ccw1 *ccw = cp->guest_cp;
391 if (!ccw_is_chain(ccw) && !is_tic_within_range(ccw, iova, cnt))
394 ccw++;
486 static int ccwchain_fetch_tic(struct ccw1 *ccw,
494 if (is_cpa_within_range(ccw->cda, ccw_head, iter->ch_len)) {
495 ccw->cda = (__u32) (addr_t) (((char *)iter->ch_ccw) +
496 (ccw->cda - ccw_head));
504 static unsigned long *get_guest_idal(struct ccw1 *ccw,
521 if (ccw_is_idal(ccw)) {
523 ret = vfio_dma_rw(vdev, ccw->cda, idaws, idal_len, false);
531 idaws[0] = ccw->cda;
536 idaws_f1[0] = ccw->cda;
549 * @ccw: The Channel Command Word being translated
559 static int ccw_count_idaws(struct ccw1 *ccw,
569 if (ccw->count)
570 bytes = ccw->count;
572 if (ccw_is_idal(ccw)) {
575 ret = vfio_dma_rw(vdev, ccw->cda, &iova, size, false);
586 iova = ccw->cda;
601 static int ccwchain_fetch_ccw(struct ccw1 *ccw,
614 idaw_nr = ccw_count_idaws(ccw, cp);
619 idaws = get_guest_idal(ccw, cp, idaw_nr);
647 if (ccw_does_data_transfer(ccw)) {
655 ccw->cda = (__u32) virt_to_phys(idaws);
656 ccw->flags |= CCW_FLAG_IDA;
668 ccw->cda = 0;
673 * Fetch one ccw.
678 static int ccwchain_fetch_one(struct ccw1 *ccw,
683 if (ccw_is_tic(ccw))
684 return ccwchain_fetch_tic(ccw, cp);
686 return ccwchain_fetch_ccw(ccw, pa, cp);
698 * 1. Supports idal(c64) ccw chaining.
784 * as helpers to do ccw chain translation inside the kernel. Basically
801 * We support direct ccw chaining by translating them to idal ccws.
809 struct ccw1 *ccw;
820 ccw = &chain->ch_ccw[idx];
823 ret = ccwchain_fetch_one(ccw, pa, cp);
864 * Everything built by vfio-ccw is a Format-2 IDAL.
920 * physical ccw to its chain head.
921 * Adding this value to the guest physical ccw chain
933 * cp_iova_pinned() - check if an iova is pinned for a ccw chain.
938 * If the @iova is currently pinned for the ccw chain, return true;