1 /* SPDX-License-Identifier: GPL-2.0 */
3 * channel program interfaces
5 * Copyright IBM Corp. 2017
11 #ifndef _VFIO_CCW_CP_H_
12 #define _VFIO_CCW_CP_H_
18 #include "vfio_ccw_trace.h"
21 * Max length for ccw chain.
22 * XXX: Limit to 256, need to check more?
24 #define CCWCHAIN_LEN_MAX 256
27 * struct channel_program - manage information for channel program
28 * @ccwchain_list: list head of ccwchains
29 * @orb: orb for the currently processed ssch request
30 * @initialized: whether this instance is actually initialized
32 * @ccwchain_list is the head of a ccwchain list, that contents the
33 * translated result of the guest channel program that pointed out by
34 * the iova parameter when calling cp_init.
36 struct channel_program {
37 struct list_head ccwchain_list;
40 struct ccw1 *guest_cp;
43 int cp_init(struct channel_program *cp, union orb *orb);
44 void cp_free(struct channel_program *cp);
45 int cp_prefetch(struct channel_program *cp);
46 union orb *cp_get_orb(struct channel_program *cp, struct subchannel *sch);
47 void cp_update_scsw(struct channel_program *cp, union scsw *scsw);
48 bool cp_iova_pinned(struct channel_program *cp, u64 iova, u64 length);