Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / drivers / staging / unisys / common-spar / include / vmcallinterface.h
1 /* Copyright (C) 2010 - 2013 UNISYS CORPORATION
2  * All rights reserved.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or (at
7  * your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
12  * NON INFRINGEMENT.  See the GNU General Public License for more
13  * details.
14  */
15
16 #ifndef __IOMONINTF_H__
17 #define __IOMONINTF_H__
18
19 /*
20 * This file contains all structures needed to support the VMCALLs for IO
21 * Virtualization.  The VMCALLs are provided by Monitor and used by IO code
22 * running on IO Partitions.
23 */
24
25 #ifdef __GNUC__
26 #include "iovmcall_gnuc.h"
27 #endif  /*  */
28 #include "diagchannel.h"
29
30 #ifdef VMCALL_IO_CONTROLVM_ADDR
31 #undef VMCALL_IO_CONTROLVM_ADDR
32 #endif  /*  */
33
34 /* define subsystem number for AppOS, used in uislib driver  */
35 #define MDS_APPOS 0x4000000000000000L   /* subsystem = 62 - AppOS */
36 enum vmcall_monitor_interface_method_tuple { /* VMCALL identification tuples  */
37             /* Note: when a new VMCALL is added:
38              * - the 1st 2 hex digits correspond to one of the
39              *   VMCALL_MONITOR_INTERFACE types and
40              * - the next 2 hex digits are the nth relative instance of within a
41              *   type
42              * E.G. for VMCALL_VIRTPART_RECYCLE_PART,
43              * - the 0x02 identifies it as a VMCALL_VIRTPART type and
44              * - the 0x01 identifies it as the 1st instance of a VMCALL_VIRTPART
45              *   type of VMCALL
46              */
47
48         VMCALL_IO_CONTROLVM_ADDR = 0x0501,      /* used by all Guests, not just
49                                                  * IO */
50         VMCALL_IO_DIAG_ADDR = 0x0508,
51         VMCALL_IO_VISORSERIAL_ADDR = 0x0509,
52         VMCALL_QUERY_GUEST_VIRTUAL_TIME_OFFSET = 0x0708, /* Allow caller to
53                                                           * query virtual time
54                                                           * offset */
55         VMCALL_CHANNEL_VERSION_MISMATCH = 0x0709,
56         VMCALL_POST_CODE_LOGEVENT = 0x070B,     /* LOGEVENT Post Code (RDX) with
57                                                  * specified subsystem mask (RCX
58                                                  * - monitor_subsystems.h) and
59                                                  * severity (RDX) */
60         VMCALL_GENERIC_SURRENDER_QUANTUM_FOREVER = 0x0802, /* Yield the
61                                                             * remainder & all
62                                                             * future quantums of
63                                                             * the caller */
64         VMCALL_MEASUREMENT_DO_NOTHING = 0x0901,
65         VMCALL_UPDATE_PHYSICAL_TIME = 0x0a02    /* Allow
66                                                  * ULTRA_SERVICE_CAPABILITY_TIME
67                                                  * capable guest to make
68                                                  * VMCALL */
69 };
70
71 #define VMCALL_SUCCESS 0
72 #define VMCALL_SUCCESSFUL(result)       (result == 0)
73
74 #ifdef __GNUC__
75 #define unisys_vmcall(tuple, reg_ebx, reg_ecx) \
76         __unisys_vmcall_gnuc(tuple, reg_ebx, reg_ecx)
77 #define unisys_extended_vmcall(tuple, reg_ebx, reg_ecx, reg_edx) \
78         __unisys_extended_vmcall_gnuc(tuple, reg_ebx, reg_ecx, reg_edx)
79 #define ISSUE_IO_VMCALL(method, param, result) \
80         (result = unisys_vmcall(method, (param) & 0xFFFFFFFF,   \
81                                 (param) >> 32))
82 #define ISSUE_IO_EXTENDED_VMCALL(method, param1, param2, param3) \
83         unisys_extended_vmcall(method, param1, param2, param3)
84
85     /* The following uses VMCALL_POST_CODE_LOGEVENT interface but is currently
86      * not used much */
87 #define ISSUE_IO_VMCALL_POSTCODE_SEVERITY(postcode, severity)           \
88 do {                                                                    \
89         ISSUE_IO_EXTENDED_VMCALL(VMCALL_POST_CODE_LOGEVENT, severity,   \
90                                  MDS_APPOS, postcode);                  \
91 } while (0)
92 #endif
93
94 /* Structures for IO VMCALLs */
95
96 /* ///////////// BEGIN PRAGMA PACK PUSH 1 ///////////////////////// */
97 /* ///////////// ONLY STRUCT TYPE SHOULD BE BELOW */
98 #pragma pack(push, 1)
99 struct phys_info {
100         u64 pi_pfn;
101         u16 pi_off;
102         u16 pi_len;
103 };
104
105 #pragma pack(pop)
106 /* ///////////// END PRAGMA PACK PUSH 1 /////////////////////////// */
107
108 /* ///////////// BEGIN PRAGMA PACK PUSH 1 ///////////////////////// */
109 /* ///////////// ONLY STRUCT TYPE SHOULD BE BELOW */
110 #pragma pack(push, 1)
111 /* Parameters to VMCALL_IO_CONTROLVM_ADDR interface */
112 struct vmcall_io_controlvm_addr_params {
113             /* The Guest-relative physical address of the ControlVm channel.
114             * This VMCall fills this in with the appropriate address. */
115         u64 address;    /* contents provided by this VMCALL (OUT) */
116             /* the size of the ControlVm channel in bytes This VMCall fills this
117             * in with the appropriate address. */
118         u32 channel_bytes;      /* contents provided by this VMCALL (OUT) */
119         u8 unused[4];           /* Unused Bytes in the 64-Bit Aligned Struct */
120 };
121
122 #pragma pack(pop)
123 /* ///////////// END PRAGMA PACK PUSH 1 /////////////////////////// */
124
125 /* ///////////// BEGIN PRAGMA PACK PUSH 1 ///////////////////////// */
126 /* ///////////// ONLY STRUCT TYPE SHOULD BE BELOW */
127 #pragma pack(push, 1)
128 /* Parameters to VMCALL_IO_DIAG_ADDR interface */
129 struct vmcall_io_diag_addr_params {
130             /* The Guest-relative physical address of the diagnostic channel.
131             * This VMCall fills this in with the appropriate address. */
132         u64 address;    /* contents provided by this VMCALL (OUT) */
133 };
134
135 #pragma pack(pop)
136 /* ///////////// END PRAGMA PACK PUSH 1 /////////////////////////// */
137
138 /* ///////////// BEGIN PRAGMA PACK PUSH 1 ///////////////////////// */
139 /* ///////////// ONLY STRUCT TYPE SHOULD BE BELOW */
140 #pragma pack(push, 1)
141 /* Parameters to VMCALL_IO_VISORSERIAL_ADDR interface */
142 struct vmcall_io_visorserial_addr_params {
143             /* The Guest-relative physical address of the serial console
144             * channel.  This VMCall fills this in with the appropriate
145             * address. */
146         u64 address;    /* contents provided by this VMCALL (OUT) */
147 };
148
149 #pragma pack(pop)
150 /* ///////////// END PRAGMA PACK PUSH 1 /////////////////////////// */
151
152 /* Parameters to VMCALL_CHANNEL_MISMATCH interface */
153 struct vmcall_channel_version_mismatch_params {
154         u8 chname[32];  /* Null terminated string giving name of channel
155                                  * (IN) */
156         u8 item_name[32];       /* Null terminated string giving name of
157                                  * mismatched item (IN) */
158         u32 line_no;            /* line# where invoked. (IN) */
159         u8 file_name[36];       /* source code where invoked - Null terminated
160                                  * string (IN) */
161 };
162
163 #endif /* __IOMONINTF_H__ */