Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * channel program interfaces
0004  *
0005  * Copyright IBM Corp. 2017
0006  *
0007  * Author(s): Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
0008  *            Xiao Feng Ren <renxiaof@linux.vnet.ibm.com>
0009  */
0010 
0011 #ifndef _VFIO_CCW_CP_H_
0012 #define _VFIO_CCW_CP_H_
0013 
0014 #include <asm/cio.h>
0015 #include <asm/scsw.h>
0016 
0017 #include "orb.h"
0018 #include "vfio_ccw_trace.h"
0019 
0020 /*
0021  * Max length for ccw chain.
0022  * XXX: Limit to 256, need to check more?
0023  */
0024 #define CCWCHAIN_LEN_MAX    256
0025 
0026 /**
0027  * struct channel_program - manage information for channel program
0028  * @ccwchain_list: list head of ccwchains
0029  * @orb: orb for the currently processed ssch request
0030  * @mdev: the mediated device to perform page pinning/unpinning
0031  * @initialized: whether this instance is actually initialized
0032  *
0033  * @ccwchain_list is the head of a ccwchain list, that contents the
0034  * translated result of the guest channel program that pointed out by
0035  * the iova parameter when calling cp_init.
0036  */
0037 struct channel_program {
0038     struct list_head ccwchain_list;
0039     union orb orb;
0040     bool initialized;
0041     struct ccw1 *guest_cp;
0042 };
0043 
0044 int cp_init(struct channel_program *cp, union orb *orb);
0045 void cp_free(struct channel_program *cp);
0046 int cp_prefetch(struct channel_program *cp);
0047 union orb *cp_get_orb(struct channel_program *cp, u32 intparm, u8 lpm);
0048 void cp_update_scsw(struct channel_program *cp, union scsw *scsw);
0049 bool cp_iova_pinned(struct channel_program *cp, u64 iova, u64 length);
0050 
0051 #endif