Contributors: 5
Author Tokens Token Proportion Commits Commit Proportion
Dong Jia Shi 106 76.81% 1 11.11%
Eric Farman 25 18.12% 5 55.56%
Halil Pasic 3 2.17% 1 11.11%
Cornelia Huck 3 2.17% 1 11.11%
Greg Kroah-Hartman 1 0.72% 1 11.11%
Total 138 9


/* SPDX-License-Identifier: GPL-2.0 */
/*
 * channel program interfaces
 *
 * Copyright IBM Corp. 2017
 *
 * Author(s): Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
 *            Xiao Feng Ren <renxiaof@linux.vnet.ibm.com>
 */

#ifndef _VFIO_CCW_CP_H_
#define _VFIO_CCW_CP_H_

#include <asm/cio.h>
#include <asm/scsw.h>

#include "orb.h"
#include "vfio_ccw_trace.h"

/*
 * Max length for ccw chain.
 * XXX: Limit to 256, need to check more?
 */
#define CCWCHAIN_LEN_MAX	256

/*
 * Maximum number of chains
 */
#define CCWCHAIN_COUNT_MAX	16

/**
 * struct channel_program - manage information for channel program
 * @ccwchain_list: list head of ccwchains
 * @orb: orb for the currently processed ssch request
 * @initialized: whether this instance is actually initialized
 * @guest_cp: copy of guest channel program
 * @ccwchain_count: number of channel program segments (linked by TIC)
 * @guest_iova: first data address of a guest channel program
 *
 * @ccwchain_list is the head of a ccwchain list, that contents the
 * translated result of the guest channel program that pointed out by
 * the iova parameter when calling cp_init.
 */
struct channel_program {
	struct list_head ccwchain_list;
	union orb orb;
	bool initialized;
	struct ccw1 *guest_cp;
	unsigned int ccwchain_count;
	u64 guest_iova;
};

int cp_init(struct channel_program *cp, union orb *orb);
void cp_free(struct channel_program *cp);
int cp_prefetch(struct channel_program *cp);
union orb *cp_get_orb(struct channel_program *cp, struct subchannel *sch);
void cp_update_scsw(struct channel_program *cp, union scsw *scsw);
bool cp_iova_pinned(struct channel_program *cp, u64 iova, u64 length);

#endif