blob: a4b74fb1aa5741e5bf65c8e3be55b85c2772d03d [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Dong Jia Shi0a19e612017-03-17 04:17:32 +01002/*
3 * channel program interfaces
4 *
5 * Copyright IBM Corp. 2017
6 *
7 * Author(s): Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
8 * Xiao Feng Ren <renxiaof@linux.vnet.ibm.com>
9 */
10
11#ifndef _VFIO_CCW_CP_H_
12#define _VFIO_CCW_CP_H_
13
14#include <asm/cio.h>
15#include <asm/scsw.h>
16
17#include "orb.h"
18
19/**
20 * struct channel_program - manage information for channel program
21 * @ccwchain_list: list head of ccwchains
22 * @orb: orb for the currently processed ssch request
23 * @mdev: the mediated device to perform page pinning/unpinning
24 *
25 * @ccwchain_list is the head of a ccwchain list, that contents the
26 * translated result of the guest channel program that pointed out by
27 * the iova parameter when calling cp_init.
28 */
29struct channel_program {
30 struct list_head ccwchain_list;
31 union orb orb;
32 struct device *mdev;
33};
34
35extern int cp_init(struct channel_program *cp, struct device *mdev,
36 union orb *orb);
37extern void cp_free(struct channel_program *cp);
38extern int cp_prefetch(struct channel_program *cp);
39extern union orb *cp_get_orb(struct channel_program *cp, u32 intparm, u8 lpm);
40extern void cp_update_scsw(struct channel_program *cp, union scsw *scsw);
41extern bool cp_iova_pinned(struct channel_program *cp, u64 iova);
42
43#endif