Nishad Kamdar | af83114 | 2020-04-19 19:30:21 +0530 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2010 - 2015 UNISYS CORPORATION |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 4 | * All rights reserved. |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __CONTROLVMCHANNEL_H__ |
| 8 | #define __CONTROLVMCHANNEL_H__ |
| 9 | |
Benjamin Romer | 90addb0 | 2014-05-06 09:58:23 -0400 | [diff] [blame] | 10 | #include <linux/uuid.h> |
David Kershner | 93d3ad9 | 2017-12-07 12:11:07 -0500 | [diff] [blame] | 11 | #include <linux/visorbus.h> |
Benjamin Romer | af96e9c | 2014-08-02 22:03:40 -0400 | [diff] [blame] | 12 | |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 13 | /* {2B3C2D10-7EF5-4ad8-B966-3448B7386B3D} */ |
Andy Shevchenko | b32c5cb | 2017-08-22 13:26:54 -0400 | [diff] [blame] | 14 | #define VISOR_CONTROLVM_CHANNEL_GUID \ |
| 15 | GUID_INIT(0x2b3c2d10, 0x7ef5, 0x4ad8, \ |
| 16 | 0xb9, 0x66, 0x34, 0x48, 0xb7, 0x38, 0x6b, 0x3d) |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 17 | |
Erik Arfvidson | 7e5a1a7 | 2015-05-05 18:36:42 -0400 | [diff] [blame] | 18 | #define CONTROLVM_MESSAGE_MAX 64 |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 19 | |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 20 | /* |
| 21 | * Must increment this whenever you insert or delete fields within this channel |
| 22 | * struct. Also increment whenever you change the meaning of fields within this |
| 23 | * channel struct so as to break pre-existing software. Note that you can |
| 24 | * usually add fields to the END of the channel struct withOUT needing to |
| 25 | * increment this. |
Erik Arfvidson | 7e5a1a7 | 2015-05-05 18:36:42 -0400 | [diff] [blame] | 26 | */ |
Sameer Wadgaonkar | c5a2890 | 2017-05-19 16:17:48 -0400 | [diff] [blame] | 27 | #define VISOR_CONTROLVM_CHANNEL_VERSIONID 1 |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 28 | |
Erik Arfvidson | 7e5a1a7 | 2015-05-05 18:36:42 -0400 | [diff] [blame] | 29 | /* Defines for various channel queues */ |
Erik Arfvidson | b06f5d1 | 2017-07-17 16:16:47 -0400 | [diff] [blame] | 30 | #define CONTROLVM_QUEUE_REQUEST 0 |
| 31 | #define CONTROLVM_QUEUE_RESPONSE 1 |
| 32 | #define CONTROLVM_QUEUE_EVENT 2 |
| 33 | #define CONTROLVM_QUEUE_ACK 3 |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 34 | |
Erik Arfvidson | 7e5a1a7 | 2015-05-05 18:36:42 -0400 | [diff] [blame] | 35 | /* Max num of messages stored during IOVM creation to be reused after crash */ |
David Binder | 941affc | 2017-03-17 11:27:19 -0400 | [diff] [blame] | 36 | #define CONTROLVM_CRASHMSG_MAX 2 |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 37 | |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 38 | /* |
| 39 | * struct visor_segment_state |
| 40 | * @enabled: May enter other states. |
| 41 | * @active: Assigned to active partition. |
| 42 | * @alive: Configure message sent to service/server. |
| 43 | * @revoked: Similar to partition state ShuttingDown. |
| 44 | * @allocated: Memory (device/port number) has been selected by Command. |
| 45 | * @known: Has been introduced to the service/guest partition. |
| 46 | * @ready: Service/Guest partition has responded to introduction. |
| 47 | * @operating: Resource is configured and operating. |
| 48 | * @reserved: Natural alignment. |
| 49 | * |
| 50 | * Note: Don't use high bit unless we need to switch to ushort which is |
| 51 | * non-compliant. |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 52 | */ |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 53 | struct visor_segment_state { |
| 54 | u16 enabled:1; |
| 55 | u16 active:1; |
| 56 | u16 alive:1; |
| 57 | u16 revoked:1; |
| 58 | u16 allocated:1; |
| 59 | u16 known:1; |
| 60 | u16 ready:1; |
| 61 | u16 operating:1; |
| 62 | u16 reserved:8; |
Sameer Wadgaonkar | 2833399 | 2017-03-28 09:34:36 -0400 | [diff] [blame] | 63 | } __packed; |
David Kershner | 389f559 | 2015-05-13 13:22:03 -0400 | [diff] [blame] | 64 | |
Sameer Wadgaonkar | 545f091 | 2017-05-19 16:17:49 -0400 | [diff] [blame] | 65 | static const struct visor_segment_state segment_state_running = { |
David Kershner | 389f559 | 2015-05-13 13:22:03 -0400 | [diff] [blame] | 66 | 1, 1, 1, 0, 1, 1, 1, 1 |
| 67 | }; |
| 68 | |
Sameer Wadgaonkar | 545f091 | 2017-05-19 16:17:49 -0400 | [diff] [blame] | 69 | static const struct visor_segment_state segment_state_paused = { |
David Kershner | 389f559 | 2015-05-13 13:22:03 -0400 | [diff] [blame] | 70 | 1, 1, 1, 0, 1, 1, 1, 0 |
| 71 | }; |
| 72 | |
Sameer Wadgaonkar | 545f091 | 2017-05-19 16:17:49 -0400 | [diff] [blame] | 73 | static const struct visor_segment_state segment_state_standby = { |
David Kershner | 389f559 | 2015-05-13 13:22:03 -0400 | [diff] [blame] | 74 | 1, 1, 0, 0, 1, 1, 1, 0 |
| 75 | }; |
| 76 | |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 77 | /* |
| 78 | * enum controlvm_id |
| 79 | * @CONTROLVM_INVALID: |
| 80 | * @CONTROLVM_BUS_CREATE: CP --> SP, GP. |
| 81 | * @CONTROLVM_BUS_DESTROY: CP --> SP, GP. |
| 82 | * @CONTROLVM_BUS_CONFIGURE: CP --> SP. |
| 83 | * @CONTROLVM_BUS_CHANGESTATE: CP --> SP, GP. |
| 84 | * @CONTROLVM_BUS_CHANGESTATE_EVENT: SP, GP --> CP. |
| 85 | * @CONTROLVM_DEVICE_CREATE: CP --> SP, GP. |
| 86 | * @CONTROLVM_DEVICE_DESTROY: CP --> SP, GP. |
| 87 | * @CONTROLVM_DEVICE_CONFIGURE: CP --> SP. |
| 88 | * @CONTROLVM_DEVICE_CHANGESTATE: CP --> SP, GP. |
| 89 | * @CONTROLVM_DEVICE_CHANGESTATE_EVENT: SP, GP --> CP. |
| 90 | * @CONTROLVM_DEVICE_RECONFIGURE: CP --> Boot. |
| 91 | * @CONTROLVM_CHIPSET_INIT: CP --> SP, GP. |
| 92 | * @CONTROLVM_CHIPSET_STOP: CP --> SP, GP. |
| 93 | * @CONTROLVM_CHIPSET_READY: CP --> SP. |
| 94 | * @CONTROLVM_CHIPSET_SELFTEST: CP --> SP. |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 95 | * |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 96 | * Ids for commands that may appear in either queue of a ControlVm channel. |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 97 | * |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 98 | * Commands that are initiated by the command partition (CP), by an IO or |
| 99 | * console service partition (SP), or by a guest partition (GP) are: |
| 100 | * - issued on the RequestQueue queue (q #0) in the ControlVm channel |
| 101 | * - responded to on the ResponseQueue queue (q #1) in the ControlVm channel |
| 102 | * |
| 103 | * Events that are initiated by an IO or console service partition (SP) or |
| 104 | * by a guest partition (GP) are: |
| 105 | * - issued on the EventQueue queue (q #2) in the ControlVm channel |
| 106 | * - responded to on the EventAckQueue queue (q #3) in the ControlVm channel |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 107 | */ |
Benjamin Romer | 53bebb1 | 2014-10-23 14:30:17 -0400 | [diff] [blame] | 108 | enum controlvm_id { |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 109 | CONTROLVM_INVALID = 0, |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 110 | /* |
| 111 | * SWITCH commands required Parameter: SwitchNumber. |
| 112 | * BUS commands required Parameter: BusNumber |
| 113 | */ |
| 114 | CONTROLVM_BUS_CREATE = 0x101, |
| 115 | CONTROLVM_BUS_DESTROY = 0x102, |
| 116 | CONTROLVM_BUS_CONFIGURE = 0x104, |
| 117 | CONTROLVM_BUS_CHANGESTATE = 0x105, |
| 118 | CONTROLVM_BUS_CHANGESTATE_EVENT = 0x106, |
| 119 | /* DEVICE commands required Parameter: BusNumber, DeviceNumber */ |
| 120 | CONTROLVM_DEVICE_CREATE = 0x201, |
| 121 | CONTROLVM_DEVICE_DESTROY = 0x202, |
| 122 | CONTROLVM_DEVICE_CONFIGURE = 0x203, |
| 123 | CONTROLVM_DEVICE_CHANGESTATE = 0x204, |
| 124 | CONTROLVM_DEVICE_CHANGESTATE_EVENT = 0x205, |
| 125 | CONTROLVM_DEVICE_RECONFIGURE = 0x206, |
| 126 | /* CHIPSET commands */ |
| 127 | CONTROLVM_CHIPSET_INIT = 0x301, |
| 128 | CONTROLVM_CHIPSET_STOP = 0x302, |
| 129 | CONTROLVM_CHIPSET_READY = 0x304, |
| 130 | CONTROLVM_CHIPSET_SELFTEST = 0x305, |
Veronika Kabatova | d8ad8b0 | 2014-10-08 03:59:55 +0200 | [diff] [blame] | 131 | }; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 132 | |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 133 | /* |
| 134 | * struct irq_info |
| 135 | * @reserved1: Natural alignment purposes |
| 136 | * @recv_irq_handle: Specifies interrupt handle. It is used to retrieve the |
| 137 | * corresponding interrupt pin from Monitor; and the interrupt |
| 138 | * pin is used to connect to the corresponding interrupt. |
| 139 | * Used by IOPart-GP only. |
| 140 | * @recv_irq_vector: Specifies interrupt vector. It, interrupt pin, and shared |
| 141 | * are used to connect to the corresponding interrupt. |
| 142 | * Used by IOPart-GP only. |
| 143 | * @recv_irq_shared: Specifies if the recvInterrupt is shared. It, interrupt |
| 144 | * pin and vector are used to connect to 0 = not shared; |
| 145 | * 1 = shared the corresponding interrupt. |
| 146 | * Used by IOPart-GP only. |
| 147 | * @reserved: Natural alignment purposes |
| 148 | */ |
Benjamin Romer | 4eddbf1 | 2014-10-03 14:09:10 -0400 | [diff] [blame] | 149 | struct irq_info { |
Erik Arfvidson | 22a0350 | 2015-05-05 18:36:41 -0400 | [diff] [blame] | 150 | u64 reserved1; |
Benjamin Romer | af3286b | 2014-10-23 14:30:18 -0400 | [diff] [blame] | 151 | u64 recv_irq_handle; |
Benjamin Romer | af3286b | 2014-10-23 14:30:18 -0400 | [diff] [blame] | 152 | u32 recv_irq_vector; |
Benjamin Romer | af3286b | 2014-10-23 14:30:18 -0400 | [diff] [blame] | 153 | u8 recv_irq_shared; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 154 | u8 reserved[3]; |
Sameer Wadgaonkar | 2833399 | 2017-03-28 09:34:36 -0400 | [diff] [blame] | 155 | } __packed; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 156 | |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 157 | /* |
| 158 | * struct efi_visor_indication |
| 159 | * @boot_to_fw_ui: Stop in UEFI UI |
| 160 | * @clear_nvram: Clear NVRAM |
| 161 | * @clear_cmos: Clear CMOS |
| 162 | * @boot_to_tool: Run install tool |
| 163 | * @reserved: Natural alignment |
| 164 | */ |
Sameer Wadgaonkar | 545f091 | 2017-05-19 16:17:49 -0400 | [diff] [blame] | 165 | struct efi_visor_indication { |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 166 | u64 boot_to_fw_ui:1; |
| 167 | u64 clear_nvram:1; |
| 168 | u64 clear_cmos:1; |
| 169 | u64 boot_to_tool:1; |
| 170 | /* Remaining bits are available */ |
| 171 | u64 reserved:60; |
Sameer Wadgaonkar | 2833399 | 2017-03-28 09:34:36 -0400 | [diff] [blame] | 172 | } __packed; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 173 | |
Sameer Wadgaonkar | d3ad6e6 | 2017-05-19 16:17:50 -0400 | [diff] [blame] | 174 | enum visor_chipset_feature { |
| 175 | VISOR_CHIPSET_FEATURE_REPLY = 0x00000001, |
| 176 | VISOR_CHIPSET_FEATURE_PARA_HOTPLUG = 0x00000002, |
Benjamin Romer | b9b141e | 2014-10-23 14:30:24 -0400 | [diff] [blame] | 177 | }; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 178 | |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 179 | /* |
| 180 | * struct controlvm_message_header |
| 181 | * @id: See CONTROLVM_ID. |
| 182 | * @message_size: Includes size of this struct + size of message. |
| 183 | * @segment_index: Index of segment containing Vm message/information. |
| 184 | * @completion_status: Error status code or result of message completion. |
| 185 | * @struct flags: |
| 186 | * @failed: =1 in a response to signify failure. |
| 187 | * @response_expected: =1 in all messages that expect a response. |
| 188 | * @server: =1 in all bus & device-related messages where the |
| 189 | * message receiver is to act as the bus or device |
| 190 | * server. |
| 191 | * @test_message: =1 for testing use only (Control and Command |
| 192 | * ignore this). |
| 193 | * @partial_completion: =1 if there are forthcoming responses/acks |
| 194 | * associated with this message. |
| 195 | * @preserve: =1 this is to let us know to preserve channel |
| 196 | * contents. |
| 197 | * @writer_in_diag: =1 the DiagWriter is active in the Diagnostic |
| 198 | * Partition. |
| 199 | * @reserve: Natural alignment. |
| 200 | * @reserved: Natural alignment. |
| 201 | * @message_handle: Identifies the particular message instance. |
| 202 | * @payload_vm_offset: Offset of payload area from start of this instance. |
| 203 | * @payload_max_bytes: Maximum bytes allocated in payload area of ControlVm |
| 204 | * segment. |
| 205 | * @payload_bytes: Actual number of bytes of payload area to copy between |
| 206 | * IO/Command. If non-zero, there is a payload to copy. |
| 207 | * |
| 208 | * This is the common structure that is at the beginning of every |
| 209 | * ControlVm message (both commands and responses) in any ControlVm |
| 210 | * queue. Commands are easily distinguished from responses by |
| 211 | * looking at the flags.response field. |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 212 | */ |
Benjamin Romer | 98d7b59 | 2014-10-23 14:30:26 -0400 | [diff] [blame] | 213 | struct controlvm_message_header { |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 214 | u32 id; |
| 215 | /* |
| 216 | * For requests, indicates the message type. For responses, indicates |
| 217 | * the type of message we are responding to. |
| 218 | */ |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 219 | u32 message_size; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 220 | u32 segment_index; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 221 | u32 completion_status; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 222 | struct { |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 223 | u32 failed:1; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 224 | u32 response_expected:1; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 225 | u32 server:1; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 226 | u32 test_message:1; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 227 | u32 partial_completion:1; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 228 | u32 preserve:1; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 229 | u32 writer_in_diag:1; |
Sameer Wadgaonkar | 2833399 | 2017-03-28 09:34:36 -0400 | [diff] [blame] | 230 | u32 reserve:25; |
| 231 | } __packed flags; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 232 | u32 reserved; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 233 | u64 message_handle; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 234 | u64 payload_vm_offset; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 235 | u32 payload_max_bytes; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 236 | u32 payload_bytes; |
Sameer Wadgaonkar | 2833399 | 2017-03-28 09:34:36 -0400 | [diff] [blame] | 237 | } __packed; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 238 | |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 239 | /* |
| 240 | * struct controlvm_packet_device_create - For CONTROLVM_DEVICE_CREATE |
| 241 | * @bus_no: Bus # (0..n-1) from the msg receiver's end. |
| 242 | * @dev_no: Bus-relative (0..n-1) device number. |
| 243 | * @channel_addr: Guest physical address of the channel, which can be |
| 244 | * dereferenced by the receiver of this ControlVm command. |
| 245 | * @channel_bytes: Specifies size of the channel in bytes. |
| 246 | * @data_type_uuid: Specifies format of data in channel. |
| 247 | * @dev_inst_uuid: Instance guid for the device. |
| 248 | * @irq_info intr: Specifies interrupt information. |
| 249 | */ |
Benjamin Romer | f91b926 | 2014-10-23 14:30:27 -0400 | [diff] [blame] | 250 | struct controlvm_packet_device_create { |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 251 | u32 bus_no; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 252 | u32 dev_no; |
| 253 | u64 channel_addr; |
| 254 | u64 channel_bytes; |
Andy Shevchenko | b32c5cb | 2017-08-22 13:26:54 -0400 | [diff] [blame] | 255 | guid_t data_type_guid; |
| 256 | guid_t dev_inst_guid; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 257 | struct irq_info intr; |
| 258 | } __packed; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 259 | |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 260 | /* |
| 261 | * struct controlvm_packet_device_configure - For CONTROLVM_DEVICE_CONFIGURE |
| 262 | * @bus_no: Bus number (0..n-1) from the msg receiver's perspective. |
| 263 | * @dev_no: Bus-relative (0..n-1) device number. |
| 264 | */ |
| 265 | struct controlvm_packet_device_configure { |
| 266 | u32 bus_no; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 267 | u32 dev_no; |
| 268 | } __packed; |
| 269 | |
| 270 | /* Total 128 bytes */ |
Benjamin Romer | c36acb5 | 2014-10-23 14:30:29 -0400 | [diff] [blame] | 271 | struct controlvm_message_device_create { |
| 272 | struct controlvm_message_header header; |
| 273 | struct controlvm_packet_device_create packet; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 274 | } __packed; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 275 | |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 276 | /* Total 56 bytes */ |
Benjamin Romer | f676054 | 2014-10-23 14:30:30 -0400 | [diff] [blame] | 277 | struct controlvm_message_device_configure { |
| 278 | struct controlvm_message_header header; |
| 279 | struct controlvm_packet_device_configure packet; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 280 | } __packed; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 281 | |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 282 | /* |
| 283 | * struct controlvm_message_packet - This is the format for a message in any |
| 284 | * ControlVm queue. |
| 285 | * @struct create_bus: For CONTROLVM_BUS_CREATE. |
| 286 | * @bus_no: Bus # (0..n-1) from the msg receiver's perspective. |
| 287 | * @dev_count: Indicates the max number of devices on this bus. |
| 288 | * @channel_addr: Guest physical address of the channel, which can be |
| 289 | * dereferenced by the receiver of this ControlVM |
| 290 | * command. |
| 291 | * @channel_bytes: Size of the channel. |
| 292 | * @bus_data_type_uuid: Indicates format of data in bus channel. |
| 293 | * @bus_inst_uuid: Instance uuid for the bus. |
| 294 | * |
| 295 | * @struct destroy_bus: For CONTROLVM_BUS_DESTROY. |
| 296 | * @bus_no: Bus # (0..n-1) from the msg receiver's perspective. |
| 297 | * @reserved: Natural alignment purposes. |
| 298 | * |
| 299 | * @struct configure_bus: For CONTROLVM_BUS_CONFIGURE. |
| 300 | * @bus_no: Bus # (0..n-1) from the receiver's perspective. |
| 301 | * @reserved1: For alignment purposes. |
| 302 | * @guest_handle: This is used to convert guest physical address to |
| 303 | * physical address. |
| 304 | * @recv_bus_irq_handle: Specifies interrupt info. It is used by SP to |
| 305 | * register to receive interrupts from the CP. This |
| 306 | * interrupt is used for bus level notifications. |
| 307 | * The corresponding sendBusInterruptHandle is kept |
| 308 | * in CP. |
| 309 | * |
| 310 | * @struct create_device: For CONTROLVM_DEVICE_CREATE. |
| 311 | * |
| 312 | * @struct destroy_device: For CONTROLVM_DEVICE_DESTROY. |
| 313 | * @bus_no: Bus # (0..n-1) from the msg receiver's perspective. |
| 314 | * @dev_no: Bus-relative (0..n-1) device number. |
| 315 | * |
| 316 | * @struct configure_device: For CONTROLVM_DEVICE_CONFIGURE. |
| 317 | * |
| 318 | * @struct reconfigure_device: For CONTROLVM_DEVICE_RECONFIGURE. |
| 319 | * @bus_no: Bus # (0..n-1) from the msg receiver's perspective. |
| 320 | * @dev_no: Bus-relative (0..n-1) device number. |
| 321 | * |
| 322 | * @struct bus_change_state: For CONTROLVM_BUS_CHANGESTATE. |
| 323 | * @bus_no: |
| 324 | * @struct state: |
| 325 | * @reserved: Natural alignment purposes. |
| 326 | * |
| 327 | * @struct device_change_state: For CONTROLVM_DEVICE_CHANGESTATE. |
| 328 | * @bus_no: |
| 329 | * @dev_no: |
| 330 | * @struct state: |
| 331 | * @struct flags: |
| 332 | * @phys_device: =1 if message is for a physical device. |
| 333 | * @reserved: Natural alignment. |
| 334 | * @reserved1: Natural alignment. |
| 335 | * @reserved: Natural alignment purposes. |
| 336 | * |
| 337 | * @struct device_change_state_event: For CONTROLVM_DEVICE_CHANGESTATE_EVENT. |
| 338 | * @bus_no: |
| 339 | * @dev_no: |
| 340 | * @struct state: |
| 341 | * @reserved: Natural alignment purposes. |
| 342 | * |
| 343 | * @struct init_chipset: For CONTROLVM_CHIPSET_INIT. |
| 344 | * @bus_count: Indicates the max number of busses. |
| 345 | * @switch_count: Indicates the max number of switches. |
| 346 | * @enum features: |
| 347 | * @platform_number: |
| 348 | * |
| 349 | * @struct chipset_selftest: For CONTROLVM_CHIPSET_SELFTEST. |
| 350 | * @options: Reserved. |
| 351 | * @test: Bit 0 set to run embedded selftest. |
| 352 | * |
| 353 | * @addr: A physical address of something, that can be dereferenced by the |
| 354 | * receiver of this ControlVm command. |
| 355 | * |
| 356 | * @handle: A handle of something (depends on command id). |
| 357 | */ |
Benjamin Romer | 2ea5117 | 2014-10-23 14:30:25 -0400 | [diff] [blame] | 358 | struct controlvm_message_packet { |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 359 | union { |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 360 | struct { |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 361 | u32 bus_no; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 362 | u32 dev_count; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 363 | u64 channel_addr; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 364 | u64 channel_bytes; |
Andy Shevchenko | b32c5cb | 2017-08-22 13:26:54 -0400 | [diff] [blame] | 365 | guid_t bus_data_type_guid; |
| 366 | guid_t bus_inst_guid; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 367 | } __packed create_bus; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 368 | struct { |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 369 | u32 bus_no; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 370 | u32 reserved; |
| 371 | } __packed destroy_bus; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 372 | struct { |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 373 | u32 bus_no; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 374 | u32 reserved1; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 375 | u64 guest_handle; |
Benjamin Romer | 2ea5117 | 2014-10-23 14:30:25 -0400 | [diff] [blame] | 376 | u64 recv_bus_irq_handle; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 377 | } __packed configure_bus; |
Benjamin Romer | f91b926 | 2014-10-23 14:30:27 -0400 | [diff] [blame] | 378 | struct controlvm_packet_device_create create_device; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 379 | struct { |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 380 | u32 bus_no; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 381 | u32 dev_no; |
| 382 | } __packed destroy_device; |
Benjamin Romer | e6ad00b | 2014-10-23 14:30:28 -0400 | [diff] [blame] | 383 | struct controlvm_packet_device_configure configure_device; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 384 | struct { |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 385 | u32 bus_no; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 386 | u32 dev_no; |
Sameer Wadgaonkar | 2833399 | 2017-03-28 09:34:36 -0400 | [diff] [blame] | 387 | } __packed reconfigure_device; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 388 | struct { |
Benjamin Romer | 2ea5117 | 2014-10-23 14:30:25 -0400 | [diff] [blame] | 389 | u32 bus_no; |
Sameer Wadgaonkar | 545f091 | 2017-05-19 16:17:49 -0400 | [diff] [blame] | 390 | struct visor_segment_state state; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 391 | u8 reserved[2]; |
| 392 | } __packed bus_change_state; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 393 | struct { |
Benjamin Romer | 2ea5117 | 2014-10-23 14:30:25 -0400 | [diff] [blame] | 394 | u32 bus_no; |
| 395 | u32 dev_no; |
Sameer Wadgaonkar | 545f091 | 2017-05-19 16:17:49 -0400 | [diff] [blame] | 396 | struct visor_segment_state state; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 397 | struct { |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 398 | u32 phys_device:1; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 399 | u32 reserved:31; |
| 400 | u32 reserved1; |
Sameer Wadgaonkar | 2833399 | 2017-03-28 09:34:36 -0400 | [diff] [blame] | 401 | } __packed flags; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 402 | u8 reserved[2]; |
Sameer Wadgaonkar | 2833399 | 2017-03-28 09:34:36 -0400 | [diff] [blame] | 403 | } __packed device_change_state; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 404 | struct { |
Benjamin Romer | 2ea5117 | 2014-10-23 14:30:25 -0400 | [diff] [blame] | 405 | u32 bus_no; |
| 406 | u32 dev_no; |
Sameer Wadgaonkar | 545f091 | 2017-05-19 16:17:49 -0400 | [diff] [blame] | 407 | struct visor_segment_state state; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 408 | u8 reserved[6]; |
Sameer Wadgaonkar | 2833399 | 2017-03-28 09:34:36 -0400 | [diff] [blame] | 409 | } __packed device_change_state_event; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 410 | struct { |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 411 | u32 bus_count; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 412 | u32 switch_count; |
Sameer Wadgaonkar | d3ad6e6 | 2017-05-19 16:17:50 -0400 | [diff] [blame] | 413 | enum visor_chipset_feature features; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 414 | u32 platform_number; |
| 415 | } __packed init_chipset; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 416 | struct { |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 417 | u32 options; |
| 418 | u32 test; |
Sameer Wadgaonkar | 2833399 | 2017-03-28 09:34:36 -0400 | [diff] [blame] | 419 | } __packed chipset_selftest; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 420 | u64 addr; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 421 | u64 handle; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 422 | }; |
Sameer Wadgaonkar | 2833399 | 2017-03-28 09:34:36 -0400 | [diff] [blame] | 423 | } __packed; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 424 | |
| 425 | /* All messages in any ControlVm queue have this layout. */ |
Benjamin Romer | 3ab4770 | 2014-10-23 14:30:31 -0400 | [diff] [blame] | 426 | struct controlvm_message { |
Benjamin Romer | 98d7b59 | 2014-10-23 14:30:26 -0400 | [diff] [blame] | 427 | struct controlvm_message_header hdr; |
Benjamin Romer | 2ea5117 | 2014-10-23 14:30:25 -0400 | [diff] [blame] | 428 | struct controlvm_message_packet cmd; |
Sameer Wadgaonkar | 2833399 | 2017-03-28 09:34:36 -0400 | [diff] [blame] | 429 | } __packed; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 430 | |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 431 | /* |
| 432 | * struct visor_controlvm_channel |
| 433 | * @struct header: |
| 434 | * @gp_controlvm: Guest phys addr of this channel. |
| 435 | * @gp_partition_tables: Guest phys addr of partition tables. |
| 436 | * @gp_diag_guest: Guest phys addr of diagnostic channel. |
| 437 | * @gp_boot_romdisk: Guest phys addr of (read* only) Boot |
| 438 | * ROM disk. |
| 439 | * @gp_boot_ramdisk: Guest phys addr of writable Boot RAM |
| 440 | * disk. |
| 441 | * @gp_acpi_table: Guest phys addr of acpi table. |
| 442 | * @gp_control_channel: Guest phys addr of control channel. |
| 443 | * @gp_diag_romdisk: Guest phys addr of diagnostic ROM disk. |
| 444 | * @gp_nvram: Guest phys addr of NVRAM channel. |
| 445 | * @request_payload_offset: Offset to request payload area. |
| 446 | * @event_payload_offset: Offset to event payload area. |
| 447 | * @request_payload_bytes: Bytes available in request payload area. |
| 448 | * @event_payload_bytes: Bytes available in event payload area. |
| 449 | * @control_channel_bytes: |
| 450 | * @nvram_channel_bytes: Bytes in PartitionNvram segment. |
| 451 | * @message_bytes: sizeof(CONTROLVM_MESSAGE). |
| 452 | * @message_count: CONTROLVM_MESSAGE_MAX. |
| 453 | * @gp_smbios_table: Guest phys addr of SMBIOS tables. |
| 454 | * @gp_physical_smbios_table: Guest phys addr of SMBIOS table. |
| 455 | * @gp_reserved: VISOR_MAX_GUESTS_PER_SERVICE. |
| 456 | * @virtual_guest_firmware_image_base: Guest physical address of EFI firmware |
| 457 | * image base. |
| 458 | * @virtual_guest_firmware_entry_point: Guest physical address of EFI firmware |
| 459 | * entry point. |
| 460 | * @virtual_guest_firmware_image_size: Guest EFI firmware image size. |
| 461 | * @virtual_guest_firmware_boot_base: GPA = 1MB where EFI firmware image is |
| 462 | * copied to. |
| 463 | * @virtual_guest_image_base: |
| 464 | * @virtual_guest_image_size: |
| 465 | * @prototype_control_channel_offset: |
| 466 | * @virtual_guest_partition_handle: |
| 467 | * @restore_action: Restore Action field to restore the |
| 468 | * guest partition. |
| 469 | * @dump_action: For Windows guests it shows if the |
| 470 | * visordisk is in dump mode. |
| 471 | * @nvram_fail_count: |
| 472 | * @saved_crash_message_count: = CONTROLVM_CRASHMSG_MAX. |
| 473 | * @saved_crash_message_offset: Offset to request payload area needed |
| 474 | * for crash dump. |
| 475 | * @installation_error: Type of error encountered during |
| 476 | * installation. |
| 477 | * @installation_text_id: Id of string to display. |
| 478 | * @installation_remaining_steps: Number of remaining installation steps |
| 479 | * (for progress bars). |
| 480 | * @tool_action: VISOR_TOOL_ACTIONS Installation Action |
| 481 | * field. |
| 482 | * @reserved: Alignment. |
| 483 | * @struct efi_visor_ind: |
| 484 | * @sp_reserved: |
| 485 | * @reserved2: Force signals to begin on 128-byte |
| 486 | * cache line. |
| 487 | * @struct request_queue: Guest partition uses this queue to send |
| 488 | * requests to Control. |
| 489 | * @struct response_queue: Control uses this queue to respond to |
| 490 | * service or guest partition request. |
| 491 | * @struct event_queue: Control uses this queue to send events |
| 492 | * to guest partition. |
| 493 | * @struct event_ack_queue: Service or guest partition uses this |
| 494 | * queue to ack Control events. |
| 495 | * @struct request_msg: Request fixed-size message pool - |
| 496 | * does not include payload. |
| 497 | * @struct response_msg: Response fixed-size message pool - |
| 498 | * does not include payload. |
| 499 | * @struct event_msg: Event fixed-size message pool - |
| 500 | * does not include payload. |
| 501 | * @struct event_ack_msg: Ack fixed-size message pool - |
| 502 | * does not include payload. |
| 503 | * @struct saved_crash_msg: Message stored during IOVM creation to |
| 504 | * be reused after crash. |
| 505 | */ |
Sameer Wadgaonkar | 545f091 | 2017-05-19 16:17:49 -0400 | [diff] [blame] | 506 | struct visor_controlvm_channel { |
Erik Arfvidson | 7e5a1a7 | 2015-05-05 18:36:42 -0400 | [diff] [blame] | 507 | struct channel_header header; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 508 | u64 gp_controlvm; |
| 509 | u64 gp_partition_tables; |
| 510 | u64 gp_diag_guest; |
| 511 | u64 gp_boot_romdisk; |
| 512 | u64 gp_boot_ramdisk; |
| 513 | u64 gp_acpi_table; |
| 514 | u64 gp_control_channel; |
| 515 | u64 gp_diag_romdisk; |
| 516 | u64 gp_nvram; |
| 517 | u64 request_payload_offset; |
| 518 | u64 event_payload_offset; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 519 | u32 request_payload_bytes; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 520 | u32 event_payload_bytes; |
Erik Arfvidson | 7e5a1a7 | 2015-05-05 18:36:42 -0400 | [diff] [blame] | 521 | u32 control_channel_bytes; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 522 | u32 nvram_channel_bytes; |
| 523 | u32 message_bytes; |
| 524 | u32 message_count; |
| 525 | u64 gp_smbios_table; |
| 526 | u64 gp_physical_smbios_table; |
Erik Arfvidson | 680385e | 2015-05-05 18:36:43 -0400 | [diff] [blame] | 527 | char gp_reserved[2688]; |
Erik Arfvidson | 7e5a1a7 | 2015-05-05 18:36:42 -0400 | [diff] [blame] | 528 | u64 virtual_guest_firmware_image_base; |
Erik Arfvidson | 7e5a1a7 | 2015-05-05 18:36:42 -0400 | [diff] [blame] | 529 | u64 virtual_guest_firmware_entry_point; |
Erik Arfvidson | 7e5a1a7 | 2015-05-05 18:36:42 -0400 | [diff] [blame] | 530 | u64 virtual_guest_firmware_image_size; |
Erik Arfvidson | 7e5a1a7 | 2015-05-05 18:36:42 -0400 | [diff] [blame] | 531 | u64 virtual_guest_firmware_boot_base; |
| 532 | u64 virtual_guest_image_base; |
| 533 | u64 virtual_guest_image_size; |
| 534 | u64 prototype_control_channel_offset; |
| 535 | u64 virtual_guest_partition_handle; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 536 | u16 restore_action; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 537 | u16 dump_action; |
Benjamin Romer | d19642f | 2014-10-23 14:30:34 -0400 | [diff] [blame] | 538 | u16 nvram_fail_count; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 539 | u16 saved_crash_message_count; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 540 | u32 saved_crash_message_offset; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 541 | u32 installation_error; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 542 | u32 installation_text_id; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 543 | u16 installation_remaining_steps; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 544 | u8 tool_action; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 545 | u8 reserved; |
Sameer Wadgaonkar | 545f091 | 2017-05-19 16:17:49 -0400 | [diff] [blame] | 546 | struct efi_visor_indication efi_visor_ind; |
Benjamin Romer | d19642f | 2014-10-23 14:30:34 -0400 | [diff] [blame] | 547 | u32 sp_reserved; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 548 | u8 reserved2[28]; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 549 | struct signal_queue_header request_queue; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 550 | struct signal_queue_header response_queue; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 551 | struct signal_queue_header event_queue; |
Erik Arfvidson | 1e3ab52 | 2016-02-08 10:41:41 -0500 | [diff] [blame] | 552 | struct signal_queue_header event_ack_queue; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 553 | struct controlvm_message request_msg[CONTROLVM_MESSAGE_MAX]; |
| 554 | struct controlvm_message response_msg[CONTROLVM_MESSAGE_MAX]; |
| 555 | struct controlvm_message event_msg[CONTROLVM_MESSAGE_MAX]; |
| 556 | struct controlvm_message event_ack_msg[CONTROLVM_MESSAGE_MAX]; |
| 557 | struct controlvm_message saved_crash_msg[CONTROLVM_CRASHMSG_MAX]; |
Sameer Wadgaonkar | 2833399 | 2017-03-28 09:34:36 -0400 | [diff] [blame] | 558 | } __packed; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 559 | |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 560 | /* |
| 561 | * struct visor_controlvm_parameters_header |
| 562 | * |
| 563 | * The following header will be located at the beginning of PayloadVmOffset for |
Benjamin Romer | 6242089 | 2014-10-23 14:30:35 -0400 | [diff] [blame] | 564 | * various ControlVm commands. The receiver of a ControlVm command with a |
| 565 | * PayloadVmOffset will dereference this address and then use connection_offset, |
| 566 | * initiator_offset, and target_offset to get the location of UTF-8 formatted |
| 567 | * strings that can be parsed to obtain command-specific information. The value |
| 568 | * of total_length should equal PayloadBytes. The format of the strings at |
| 569 | * PayloadVmOffset will take different forms depending on the message. |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 570 | */ |
Sameer Wadgaonkar | 545f091 | 2017-05-19 16:17:49 -0400 | [diff] [blame] | 571 | struct visor_controlvm_parameters_header { |
Benjamin Romer | 6242089 | 2014-10-23 14:30:35 -0400 | [diff] [blame] | 572 | u32 total_length; |
| 573 | u32 header_length; |
| 574 | u32 connection_offset; |
| 575 | u32 connection_length; |
| 576 | u32 initiator_offset; |
| 577 | u32 initiator_length; |
| 578 | u32 target_offset; |
| 579 | u32 target_length; |
| 580 | u32 client_offset; |
| 581 | u32 client_length; |
| 582 | u32 name_offset; |
| 583 | u32 name_length; |
Andy Shevchenko | b32c5cb | 2017-08-22 13:26:54 -0400 | [diff] [blame] | 584 | guid_t id; |
Benjamin Romer | 6242089 | 2014-10-23 14:30:35 -0400 | [diff] [blame] | 585 | u32 revision; |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 586 | /* Natural alignment */ |
| 587 | u32 reserved; |
Sameer Wadgaonkar | 2833399 | 2017-03-28 09:34:36 -0400 | [diff] [blame] | 588 | } __packed; |
Ken Cox | 12e364b | 2014-03-04 07:58:07 -0600 | [diff] [blame] | 589 | |
David Kershner | 8a7a2fd | 2016-09-02 16:41:37 -0400 | [diff] [blame] | 590 | /* General Errors------------------------------------------------------[0-99] */ |
David Binder | 941affc | 2017-03-17 11:27:19 -0400 | [diff] [blame] | 591 | #define CONTROLVM_RESP_SUCCESS 0 |
| 592 | #define CONTROLVM_RESP_ALREADY_DONE 1 |
| 593 | #define CONTROLVM_RESP_IOREMAP_FAILED 2 |
| 594 | #define CONTROLVM_RESP_KMALLOC_FAILED 3 |
| 595 | #define CONTROLVM_RESP_ID_UNKNOWN 4 |
| 596 | #define CONTROLVM_RESP_ID_INVALID_FOR_CLIENT 5 |
David Kershner | 8a7a2fd | 2016-09-02 16:41:37 -0400 | [diff] [blame] | 597 | /* CONTROLVM_INIT_CHIPSET-------------------------------------------[100-199] */ |
David Binder | 941affc | 2017-03-17 11:27:19 -0400 | [diff] [blame] | 598 | #define CONTROLVM_RESP_CLIENT_SWITCHCOUNT_NONZERO 100 |
| 599 | #define CONTROLVM_RESP_EXPECTED_CHIPSET_INIT 101 |
David Kershner | 8a7a2fd | 2016-09-02 16:41:37 -0400 | [diff] [blame] | 600 | /* Maximum Limit----------------------------------------------------[200-299] */ |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 601 | /* BUS_CREATE */ |
| 602 | #define CONTROLVM_RESP_ERROR_MAX_BUSES 201 |
| 603 | /* DEVICE_CREATE */ |
| 604 | #define CONTROLVM_RESP_ERROR_MAX_DEVICES 202 |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 605 | /* Payload and Parameter Related------------------------------------[400-499] */ |
| 606 | /* SWITCH_ATTACHEXTPORT, DEVICE_CONFIGURE */ |
| 607 | #define CONTROLVM_RESP_PAYLOAD_INVALID 400 |
| 608 | /* Multiple */ |
| 609 | #define CONTROLVM_RESP_INITIATOR_PARAMETER_INVALID 401 |
| 610 | /* DEVICE_CONFIGURE */ |
| 611 | #define CONTROLVM_RESP_TARGET_PARAMETER_INVALID 402 |
| 612 | /* DEVICE_CONFIGURE */ |
| 613 | #define CONTROLVM_RESP_CLIENT_PARAMETER_INVALID 403 |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 614 | /* Specified[Packet Structure] Value--------------------------------[500-599] */ |
| 615 | /* SWITCH_ATTACHINTPORT */ |
| 616 | /* BUS_CONFIGURE, DEVICE_CREATE, DEVICE_CONFIG, DEVICE_DESTROY */ |
| 617 | #define CONTROLVM_RESP_BUS_INVALID 500 |
| 618 | /* SWITCH_ATTACHINTPORT*/ |
| 619 | /* DEVICE_CREATE, DEVICE_CONFIGURE, DEVICE_DESTROY */ |
| 620 | #define CONTROLVM_RESP_DEVICE_INVALID 501 |
| 621 | /* DEVICE_CREATE, DEVICE_CONFIGURE */ |
| 622 | #define CONTROLVM_RESP_CHANNEL_INVALID 502 |
| 623 | /* Partition Driver Callback Interface------------------------------[600-699] */ |
| 624 | /* BUS_CREATE, BUS_DESTROY, DEVICE_CREATE, DEVICE_DESTROY */ |
| 625 | #define CONTROLVM_RESP_VIRTPCI_DRIVER_FAILURE 604 |
| 626 | /* Unable to invoke VIRTPCI callback. VIRTPCI Callback returned error. */ |
| 627 | /* BUS_CREATE, BUS_DESTROY, DEVICE_CREATE, DEVICE_DESTROY */ |
| 628 | #define CONTROLVM_RESP_VIRTPCI_DRIVER_CALLBACK_ERROR 605 |
| 629 | /* Generic device callback returned error. */ |
| 630 | /* SWITCH_ATTACHEXTPORT, SWITCH_DETACHEXTPORT, DEVICE_CONFIGURE */ |
| 631 | #define CONTROLVM_RESP_GENERIC_DRIVER_CALLBACK_ERROR 606 |
David Kershner | 8a7a2fd | 2016-09-02 16:41:37 -0400 | [diff] [blame] | 632 | /* Bus Related------------------------------------------------------[700-799] */ |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 633 | /* BUS_DESTROY */ |
| 634 | #define CONTROLVM_RESP_ERROR_BUS_DEVICE_ATTACHED 700 |
David Kershner | 8a7a2fd | 2016-09-02 16:41:37 -0400 | [diff] [blame] | 635 | /* Channel Related--------------------------------------------------[800-899] */ |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 636 | /* GET_CHANNELINFO, DEVICE_DESTROY */ |
| 637 | #define CONTROLVM_RESP_CHANNEL_TYPE_UNKNOWN 800 |
| 638 | /* DEVICE_CREATE */ |
| 639 | #define CONTROLVM_RESP_CHANNEL_SIZE_TOO_SMALL 801 |
David Kershner | 8a7a2fd | 2016-09-02 16:41:37 -0400 | [diff] [blame] | 640 | /* Chipset Shutdown Related---------------------------------------[1000-1099] */ |
David Binder | 941affc | 2017-03-17 11:27:19 -0400 | [diff] [blame] | 641 | #define CONTROLVM_RESP_CHIPSET_SHUTDOWN_FAILED 1000 |
| 642 | #define CONTROLVM_RESP_CHIPSET_SHUTDOWN_ALREADY_ACTIVE 1001 |
David Kershner | 8a7a2fd | 2016-09-02 16:41:37 -0400 | [diff] [blame] | 643 | /* Chipset Stop Related-------------------------------------------[1100-1199] */ |
David Binder | 941affc | 2017-03-17 11:27:19 -0400 | [diff] [blame] | 644 | #define CONTROLVM_RESP_CHIPSET_STOP_FAILED_BUS 1100 |
| 645 | #define CONTROLVM_RESP_CHIPSET_STOP_FAILED_SWITCH 1101 |
David Kershner | 8a7a2fd | 2016-09-02 16:41:37 -0400 | [diff] [blame] | 646 | /* Device Related-------------------------------------------------[1400-1499] */ |
David Binder | 941affc | 2017-03-17 11:27:19 -0400 | [diff] [blame] | 647 | #define CONTROLVM_RESP_DEVICE_UDEV_TIMEOUT 1400 |
David Kershner | 8a7a2fd | 2016-09-02 16:41:37 -0400 | [diff] [blame] | 648 | |
Sameer Wadgaonkar | fd30748 | 2017-06-30 15:43:02 -0400 | [diff] [blame] | 649 | /* __CONTROLVMCHANNEL_H__ */ |
| 650 | #endif |