staging: unisys: visorbus: controlvmchannel.h: fixed comment formatting issues

Removed comments from the right side of lines and fixed spacing in
comments.

Added kernel-doc like comments and cleaned up the inline comments in the
structures.

Signed-off-by: Sameer Wadgaonkar <sameer.wadgaonkar@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Sameer Wadgaonkar 2017-06-30 15:43:02 -04:00 committed by Greg Kroah-Hartman
parent 0805a0c0e0
commit fd3074867f
1 changed files with 428 additions and 288 deletions

View File

@ -1,4 +1,5 @@
/* Copyright (C) 2010 - 2015 UNISYS CORPORATION /*
* Copyright (C) 2010 - 2015 UNISYS CORPORATION
* All rights reserved. * All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@ -26,11 +27,12 @@
#define VISOR_CONTROLVM_CHANNEL_SIGNATURE VISOR_CHANNEL_SIGNATURE #define VISOR_CONTROLVM_CHANNEL_SIGNATURE VISOR_CHANNEL_SIGNATURE
#define CONTROLVM_MESSAGE_MAX 64 #define CONTROLVM_MESSAGE_MAX 64
/* Must increment this whenever you insert or delete fields within /*
* this channel struct. Also increment whenever you change the meaning * Must increment this whenever you insert or delete fields within this channel
* of fields within this channel struct so as to break pre-existing * struct. Also increment whenever you change the meaning of fields within this
* software. Note that you can usually add fields to the END of the * channel struct so as to break pre-existing software. Note that you can
* channel struct withOUT needing to increment this. * usually add fields to the END of the channel struct withOUT needing to
* increment this.
*/ */
#define VISOR_CONTROLVM_CHANNEL_VERSIONID 1 #define VISOR_CONTROLVM_CHANNEL_VERSIONID 1
@ -51,28 +53,31 @@
/* Max num of messages stored during IOVM creation to be reused after crash */ /* Max num of messages stored during IOVM creation to be reused after crash */
#define CONTROLVM_CRASHMSG_MAX 2 #define CONTROLVM_CRASHMSG_MAX 2
struct visor_segment_state { /*
/* Bit 0: May enter other states */ * struct visor_segment_state
u16 enabled:1; * @enabled: May enter other states.
/* Bit 1: Assigned to active partition */ * @active: Assigned to active partition.
u16 active:1; * @alive: Configure message sent to service/server.
/* Bit 2: Configure message sent to service/server */ * @revoked: Similar to partition state ShuttingDown.
u16 alive:1; * @allocated: Memory (device/port number) has been selected by Command.
/* Bit 3: similar to partition state ShuttingDown */ * @known: Has been introduced to the service/guest partition.
u16 revoked:1; * @ready: Service/Guest partition has responded to introduction.
/* Bit 4: memory (device/port number) has been selected by Command */ * @operating: Resource is configured and operating.
u16 allocated:1; * @reserved: Natural alignment.
/* Bit 5: has been introduced to the service/guest partition */ *
u16 known:1; * Note: Don't use high bit unless we need to switch to ushort which is
/* Bit 6: service/Guest partition has responded to introduction */ * non-compliant.
u16 ready:1;
/* Bit 7: resource is configured and operating */
u16 operating:1;
/* Natural alignment*/
u16 reserved:8;
/* Note: don't use high bit unless we need to switch to ushort
* which is non-compliant
*/ */
struct visor_segment_state {
u16 enabled:1;
u16 active:1;
u16 alive:1;
u16 revoked:1;
u16 allocated:1;
u16 known:1;
u16 ready:1;
u16 operating:1;
u16 reserved:8;
} __packed; } __packed;
static const struct visor_segment_state segment_state_running = { static const struct visor_segment_state segment_state_running = {
@ -87,74 +92,101 @@ static const struct visor_segment_state segment_state_standby = {
1, 1, 0, 0, 1, 1, 1, 0 1, 1, 0, 0, 1, 1, 1, 0
}; };
/* Ids for commands that may appear in either queue of a ControlVm channel. /*
* enum controlvm_id
* @CONTROLVM_INVALID:
* @CONTROLVM_BUS_CREATE: CP --> SP, GP.
* @CONTROLVM_BUS_DESTROY: CP --> SP, GP.
* @CONTROLVM_BUS_CONFIGURE: CP --> SP.
* @CONTROLVM_BUS_CHANGESTATE: CP --> SP, GP.
* @CONTROLVM_BUS_CHANGESTATE_EVENT: SP, GP --> CP.
* @CONTROLVM_DEVICE_CREATE: CP --> SP, GP.
* @CONTROLVM_DEVICE_DESTROY: CP --> SP, GP.
* @CONTROLVM_DEVICE_CONFIGURE: CP --> SP.
* @CONTROLVM_DEVICE_CHANGESTATE: CP --> SP, GP.
* @CONTROLVM_DEVICE_CHANGESTATE_EVENT: SP, GP --> CP.
* @CONTROLVM_DEVICE_RECONFIGURE: CP --> Boot.
* @CONTROLVM_CHIPSET_INIT: CP --> SP, GP.
* @CONTROLVM_CHIPSET_STOP: CP --> SP, GP.
* @CONTROLVM_CHIPSET_READY: CP --> SP.
* @CONTROLVM_CHIPSET_SELFTEST: CP --> SP.
* *
* Commands that are initiated by the command partition (CP), by an IO or * Ids for commands that may appear in either queue of a ControlVm channel.
* console service partition (SP), or by a guest partition (GP)are:
* - issued on the RequestQueue queue (q #0) in the ControlVm channel
* - responded to on the ResponseQueue queue (q #1) in the ControlVm channel
* *
* Events that are initiated by an IO or console service partition (SP) or * Commands that are initiated by the command partition (CP), by an IO or
* by a guest partition (GP) are: * console service partition (SP), or by a guest partition (GP) are:
* - issued on the EventQueue queue (q #2) in the ControlVm channel * - issued on the RequestQueue queue (q #0) in the ControlVm channel
* - responded to on the EventAckQueue queue (q #3) in the ControlVm channel * - responded to on the ResponseQueue queue (q #1) in the ControlVm channel
*
* Events that are initiated by an IO or console service partition (SP) or
* by a guest partition (GP) are:
* - issued on the EventQueue queue (q #2) in the ControlVm channel
* - responded to on the EventAckQueue queue (q #3) in the ControlVm channel
*/ */
enum controlvm_id { enum controlvm_id {
CONTROLVM_INVALID = 0, CONTROLVM_INVALID = 0,
/* SWITCH commands required Parameter: SwitchNumber */ /*
/* BUS commands required Parameter: BusNumber */ * SWITCH commands required Parameter: SwitchNumber.
CONTROLVM_BUS_CREATE = 0x101, /* CP --> SP, GP */ * BUS commands required Parameter: BusNumber
CONTROLVM_BUS_DESTROY = 0x102, /* CP --> SP, GP */ */
CONTROLVM_BUS_CONFIGURE = 0x104, /* CP --> SP */ CONTROLVM_BUS_CREATE = 0x101,
CONTROLVM_BUS_CHANGESTATE = 0x105, /* CP --> SP, GP */ CONTROLVM_BUS_DESTROY = 0x102,
CONTROLVM_BUS_CHANGESTATE_EVENT = 0x106, /* SP, GP --> CP */ CONTROLVM_BUS_CONFIGURE = 0x104,
/* DEVICE commands required Parameter: BusNumber, DeviceNumber */ CONTROLVM_BUS_CHANGESTATE = 0x105,
CONTROLVM_BUS_CHANGESTATE_EVENT = 0x106,
CONTROLVM_DEVICE_CREATE = 0x201, /* CP --> SP, GP */ /* DEVICE commands required Parameter: BusNumber, DeviceNumber */
CONTROLVM_DEVICE_DESTROY = 0x202, /* CP --> SP, GP */ CONTROLVM_DEVICE_CREATE = 0x201,
CONTROLVM_DEVICE_CONFIGURE = 0x203, /* CP --> SP */ CONTROLVM_DEVICE_DESTROY = 0x202,
CONTROLVM_DEVICE_CHANGESTATE = 0x204, /* CP --> SP, GP */ CONTROLVM_DEVICE_CONFIGURE = 0x203,
CONTROLVM_DEVICE_CHANGESTATE_EVENT = 0x205, /* SP, GP --> CP */ CONTROLVM_DEVICE_CHANGESTATE = 0x204,
CONTROLVM_DEVICE_RECONFIGURE = 0x206, /* CP --> Boot */ CONTROLVM_DEVICE_CHANGESTATE_EVENT = 0x205,
/* CHIPSET commands */ CONTROLVM_DEVICE_RECONFIGURE = 0x206,
CONTROLVM_CHIPSET_INIT = 0x301, /* CP --> SP, GP */ /* CHIPSET commands */
CONTROLVM_CHIPSET_STOP = 0x302, /* CP --> SP, GP */ CONTROLVM_CHIPSET_INIT = 0x301,
CONTROLVM_CHIPSET_READY = 0x304, /* CP --> SP */ CONTROLVM_CHIPSET_STOP = 0x302,
CONTROLVM_CHIPSET_SELFTEST = 0x305, /* CP --> SP */ CONTROLVM_CHIPSET_READY = 0x304,
CONTROLVM_CHIPSET_SELFTEST = 0x305,
}; };
/*
* struct irq_info
* @reserved1: Natural alignment purposes
* @recv_irq_handle: Specifies interrupt handle. It is used to retrieve the
* corresponding interrupt pin from Monitor; and the interrupt
* pin is used to connect to the corresponding interrupt.
* Used by IOPart-GP only.
* @recv_irq_vector: Specifies interrupt vector. It, interrupt pin, and shared
* are used to connect to the corresponding interrupt.
* Used by IOPart-GP only.
* @recv_irq_shared: Specifies if the recvInterrupt is shared. It, interrupt
* pin and vector are used to connect to 0 = not shared;
* 1 = shared the corresponding interrupt.
* Used by IOPart-GP only.
* @reserved: Natural alignment purposes
*/
struct irq_info { struct irq_info {
u64 reserved1; u64 reserved1;
/* specifies interrupt handle. It is used to retrieve the
* corresponding interrupt pin from Monitor; and the
* interrupt pin is used to connect to the corresponding
* interrupt. Used by IOPart-GP only.
*/
u64 recv_irq_handle; u64 recv_irq_handle;
/* specifies interrupt vector. It, interrupt pin, and shared are
* used to connect to the corresponding interrupt. Used by
* IOPart-GP only.
*/
u32 recv_irq_vector; u32 recv_irq_vector;
/* specifies if the recvInterrupt is shared. It, interrupt pin
* and vector are used to connect to 0 = not shared; 1 = shared.
* the corresponding interrupt. Used by IOPart-GP only.
*/
u8 recv_irq_shared; u8 recv_irq_shared;
u8 reserved[3]; /* Natural alignment purposes */ u8 reserved[3];
} __packed; } __packed;
/*
* struct efi_visor_indication
* @boot_to_fw_ui: Stop in UEFI UI
* @clear_nvram: Clear NVRAM
* @clear_cmos: Clear CMOS
* @boot_to_tool: Run install tool
* @reserved: Natural alignment
*/
struct efi_visor_indication { struct efi_visor_indication {
u64 boot_to_fw_ui:1; /* Bit 0: Stop in uefi ui */ u64 boot_to_fw_ui:1;
u64 clear_nvram:1; /* Bit 1: Clear NVRAM */ u64 clear_nvram:1;
u64 clear_cmos:1; /* Bit 2: Clear CMOS */ u64 clear_cmos:1;
u64 boot_to_tool:1; /* Bit 3: Run install tool */ u64 boot_to_tool:1;
/* remaining bits are available */ /* Remaining bits are available */
u64 reserved:60; /* Natural alignment */ u64 reserved:60;
} __packed; } __packed;
enum visor_chipset_feature { enum visor_chipset_feature {
@ -162,182 +194,249 @@ enum visor_chipset_feature {
VISOR_CHIPSET_FEATURE_PARA_HOTPLUG = 0x00000002, VISOR_CHIPSET_FEATURE_PARA_HOTPLUG = 0x00000002,
}; };
/* This is the common structure that is at the beginning of every /*
* ControlVm message (both commands and responses) in any ControlVm * struct controlvm_message_header
* queue. Commands are easily distinguished from responses by * @id: See CONTROLVM_ID.
* looking at the flags.response field. * @message_size: Includes size of this struct + size of message.
* @segment_index: Index of segment containing Vm message/information.
* @completion_status: Error status code or result of message completion.
* @struct flags:
* @failed: =1 in a response to signify failure.
* @response_expected: =1 in all messages that expect a response.
* @server: =1 in all bus & device-related messages where the
* message receiver is to act as the bus or device
* server.
* @test_message: =1 for testing use only (Control and Command
* ignore this).
* @partial_completion: =1 if there are forthcoming responses/acks
* associated with this message.
* @preserve: =1 this is to let us know to preserve channel
* contents.
* @writer_in_diag: =1 the DiagWriter is active in the Diagnostic
* Partition.
* @reserve: Natural alignment.
* @reserved: Natural alignment.
* @message_handle: Identifies the particular message instance.
* @payload_vm_offset: Offset of payload area from start of this instance.
* @payload_max_bytes: Maximum bytes allocated in payload area of ControlVm
* segment.
* @payload_bytes: Actual number of bytes of payload area to copy between
* IO/Command. If non-zero, there is a payload to copy.
*
* This is the common structure that is at the beginning of every
* ControlVm message (both commands and responses) in any ControlVm
* queue. Commands are easily distinguished from responses by
* looking at the flags.response field.
*/ */
struct controlvm_message_header { struct controlvm_message_header {
u32 id; /* See CONTROLVM_ID. */ u32 id;
/* For requests, indicates the message type. */ /*
/* For responses, indicates the type of message we are responding to. */ * For requests, indicates the message type. For responses, indicates
* the type of message we are responding to.
/* Includes size of this struct + size of message */ */
u32 message_size; u32 message_size;
/* Index of segment containing Vm message/information */
u32 segment_index; u32 segment_index;
/* Error status code or result of message completion */
u32 completion_status; u32 completion_status;
struct { struct {
/* =1 in a response to signify failure */
u32 failed:1; u32 failed:1;
/* =1 in all messages that expect a response */
u32 response_expected:1; u32 response_expected:1;
/* =1 in all bus & device-related messages where the message
* receiver is to act as the bus or device server
*/
u32 server:1; u32 server:1;
/* =1 for testing use only (Control and Command ignore this */
u32 test_message:1; u32 test_message:1;
/* =1 if there are forthcoming responses/acks associated
* with this message
*/
u32 partial_completion:1; u32 partial_completion:1;
/* =1 this is to let us know to preserve channel contents */
u32 preserve:1; u32 preserve:1;
/* =1 the DiagWriter is active in the Diagnostic Partition */
u32 writer_in_diag:1; u32 writer_in_diag:1;
/* Natural alignment */
u32 reserve:25; u32 reserve:25;
} __packed flags; } __packed flags;
/* Natural alignment */
u32 reserved; u32 reserved;
/* Identifies the particular message instance */
u64 message_handle; u64 message_handle;
/* request instances with the corresponding response instance. */
/* Offset of payload area from start of this instance */
u64 payload_vm_offset; u64 payload_vm_offset;
/* Maximum bytes allocated in payload area of ControlVm segment */
u32 payload_max_bytes; u32 payload_max_bytes;
/* Actual number of bytes of payload area to copy between IO/Command */
u32 payload_bytes; u32 payload_bytes;
/* if non-zero, there is a payload to copy. */
} __packed; } __packed;
/*
* struct controlvm_packet_device_create - For CONTROLVM_DEVICE_CREATE
* @bus_no: Bus # (0..n-1) from the msg receiver's end.
* @dev_no: Bus-relative (0..n-1) device number.
* @channel_addr: Guest physical address of the channel, which can be
* dereferenced by the receiver of this ControlVm command.
* @channel_bytes: Specifies size of the channel in bytes.
* @data_type_uuid: Specifies format of data in channel.
* @dev_inst_uuid: Instance guid for the device.
* @irq_info intr: Specifies interrupt information.
*/
struct controlvm_packet_device_create { struct controlvm_packet_device_create {
u32 bus_no; /* bus # (0..n-1) from the msg receiver's end */
u32 dev_no; /* bus-relative (0..n-1) device number */
/* Guest physical address of the channel, which can be dereferenced by
* the receiver of this ControlVm command
*/
u64 channel_addr;
u64 channel_bytes; /* specifies size of the channel in bytes */
uuid_le data_type_uuid; /* specifies format of data in channel */
uuid_le dev_inst_uuid; /* instance guid for the device */
struct irq_info intr; /* specifies interrupt information */
} __packed; /* for CONTROLVM_DEVICE_CREATE */
struct controlvm_packet_device_configure {
/* bus # (0..n-1) from the msg receiver's perspective */
u32 bus_no; u32 bus_no;
/* Control uses header SegmentIndex field to access bus number... */ u32 dev_no;
u32 dev_no; /* bus-relative (0..n-1) device number */ u64 channel_addr;
} __packed; /* for CONTROLVM_DEVICE_CONFIGURE */ u64 channel_bytes;
uuid_le data_type_uuid;
uuid_le dev_inst_uuid;
struct irq_info intr;
} __packed;
/*
* struct controlvm_packet_device_configure - For CONTROLVM_DEVICE_CONFIGURE
* @bus_no: Bus number (0..n-1) from the msg receiver's perspective.
* @dev_no: Bus-relative (0..n-1) device number.
*/
struct controlvm_packet_device_configure {
u32 bus_no;
/* Control uses header SegmentIndex field to access bus number. */
u32 dev_no;
} __packed;
/* Total 128 bytes */
struct controlvm_message_device_create { struct controlvm_message_device_create {
struct controlvm_message_header header; struct controlvm_message_header header;
struct controlvm_packet_device_create packet; struct controlvm_packet_device_create packet;
} __packed; /* total 128 bytes */ } __packed;
/* Total 56 bytes */
struct controlvm_message_device_configure { struct controlvm_message_device_configure {
struct controlvm_message_header header; struct controlvm_message_header header;
struct controlvm_packet_device_configure packet; struct controlvm_packet_device_configure packet;
} __packed; /* total 56 bytes */ } __packed;
/* This is the format for a message in any ControlVm queue. */ /*
* struct controlvm_message_packet - This is the format for a message in any
* ControlVm queue.
* @struct create_bus: For CONTROLVM_BUS_CREATE.
* @bus_no: Bus # (0..n-1) from the msg receiver's perspective.
* @dev_count: Indicates the max number of devices on this bus.
* @channel_addr: Guest physical address of the channel, which can be
* dereferenced by the receiver of this ControlVM
* command.
* @channel_bytes: Size of the channel.
* @bus_data_type_uuid: Indicates format of data in bus channel.
* @bus_inst_uuid: Instance uuid for the bus.
*
* @struct destroy_bus: For CONTROLVM_BUS_DESTROY.
* @bus_no: Bus # (0..n-1) from the msg receiver's perspective.
* @reserved: Natural alignment purposes.
*
* @struct configure_bus: For CONTROLVM_BUS_CONFIGURE.
* @bus_no: Bus # (0..n-1) from the receiver's perspective.
* @reserved1: For alignment purposes.
* @guest_handle: This is used to convert guest physical address to
* physical address.
* @recv_bus_irq_handle: Specifies interrupt info. It is used by SP to
* register to receive interrupts from the CP. This
* interrupt is used for bus level notifications.
* The corresponding sendBusInterruptHandle is kept
* in CP.
*
* @struct create_device: For CONTROLVM_DEVICE_CREATE.
*
* @struct destroy_device: For CONTROLVM_DEVICE_DESTROY.
* @bus_no: Bus # (0..n-1) from the msg receiver's perspective.
* @dev_no: Bus-relative (0..n-1) device number.
*
* @struct configure_device: For CONTROLVM_DEVICE_CONFIGURE.
*
* @struct reconfigure_device: For CONTROLVM_DEVICE_RECONFIGURE.
* @bus_no: Bus # (0..n-1) from the msg receiver's perspective.
* @dev_no: Bus-relative (0..n-1) device number.
*
* @struct bus_change_state: For CONTROLVM_BUS_CHANGESTATE.
* @bus_no:
* @struct state:
* @reserved: Natural alignment purposes.
*
* @struct device_change_state: For CONTROLVM_DEVICE_CHANGESTATE.
* @bus_no:
* @dev_no:
* @struct state:
* @struct flags:
* @phys_device: =1 if message is for a physical device.
* @reserved: Natural alignment.
* @reserved1: Natural alignment.
* @reserved: Natural alignment purposes.
*
* @struct device_change_state_event: For CONTROLVM_DEVICE_CHANGESTATE_EVENT.
* @bus_no:
* @dev_no:
* @struct state:
* @reserved: Natural alignment purposes.
*
* @struct init_chipset: For CONTROLVM_CHIPSET_INIT.
* @bus_count: Indicates the max number of busses.
* @switch_count: Indicates the max number of switches.
* @enum features:
* @platform_number:
*
* @struct chipset_selftest: For CONTROLVM_CHIPSET_SELFTEST.
* @options: Reserved.
* @test: Bit 0 set to run embedded selftest.
*
* @addr: A physical address of something, that can be dereferenced by the
* receiver of this ControlVm command.
*
* @handle: A handle of something (depends on command id).
*/
struct controlvm_message_packet { struct controlvm_message_packet {
union { union {
struct { struct {
/* bus # (0..n-1) from the msg receiver's perspective */
u32 bus_no; u32 bus_no;
/* indicates the max number of devices on this bus */
u32 dev_count; u32 dev_count;
/* Guest physical address of the channel, which can be
* dereferenced by the receiver of this ControlVm command
*/
u64 channel_addr; u64 channel_addr;
u64 channel_bytes; /* size of the channel */ u64 channel_bytes;
/* indicates format of data in bus channel*/
uuid_le bus_data_type_uuid; uuid_le bus_data_type_uuid;
uuid_le bus_inst_uuid; /* instance uuid for the bus */ uuid_le bus_inst_uuid;
} __packed create_bus; /* for CONTROLVM_BUS_CREATE */ } __packed create_bus;
struct { struct {
/* bus # (0..n-1) from the msg receiver's perspective */
u32 bus_no; u32 bus_no;
u32 reserved; /* Natural alignment purposes */ u32 reserved;
} __packed destroy_bus; /* for CONTROLVM_BUS_DESTROY */ } __packed destroy_bus;
struct { struct {
/* bus # (0..n-1) from the receiver's perspective */
u32 bus_no; u32 bus_no;
u32 reserved1; /* for alignment purposes */ u32 reserved1;
/* This is used to convert guest physical address to physical address */
u64 guest_handle; u64 guest_handle;
u64 recv_bus_irq_handle; u64 recv_bus_irq_handle;
/* specifies interrupt info. It is used by SP } __packed configure_bus;
* to register to receive interrupts from the
* CP. This interrupt is used for bus level
* notifications. The corresponding
* sendBusInterruptHandle is kept in CP.
*/
} __packed configure_bus; /* for CONTROLVM_BUS_CONFIGURE */
/* for CONTROLVM_DEVICE_CREATE */
struct controlvm_packet_device_create create_device; struct controlvm_packet_device_create create_device;
struct { struct {
/* bus # (0..n-1) from the msg receiver's perspective */
u32 bus_no; u32 bus_no;
u32 dev_no; /* bus-relative (0..n-1) device # */ u32 dev_no;
} __packed destroy_device; /* for CONTROLVM_DEVICE_DESTROY */ } __packed destroy_device;
/* for CONTROLVM_DEVICE_CONFIGURE */
struct controlvm_packet_device_configure configure_device; struct controlvm_packet_device_configure configure_device;
struct { struct {
/* bus # (0..n-1) from the msg receiver's perspective */
u32 bus_no; u32 bus_no;
u32 dev_no; /* bus-relative (0..n-1) device # */ u32 dev_no;
} __packed reconfigure_device; } __packed reconfigure_device;
/* for CONTROLVM_DEVICE_RECONFIGURE */
struct { struct {
u32 bus_no; u32 bus_no;
struct visor_segment_state state; struct visor_segment_state state;
u8 reserved[2]; /* Natural alignment purposes */ u8 reserved[2];
} __packed bus_change_state; /* for CONTROLVM_BUS_CHANGESTATE */ } __packed bus_change_state;
struct { struct {
u32 bus_no; u32 bus_no;
u32 dev_no; u32 dev_no;
struct visor_segment_state state; struct visor_segment_state state;
struct { struct {
/* =1 if message is for a physical device */
u32 phys_device:1; u32 phys_device:1;
u32 reserved:31; /* Natural alignment */ u32 reserved:31;
u32 reserved1; /* Natural alignment */ u32 reserved1;
} __packed flags; } __packed flags;
u8 reserved[2]; /* Natural alignment purposes */ u8 reserved[2];
} __packed device_change_state; } __packed device_change_state;
/* for CONTROLVM_DEVICE_CHANGESTATE */
struct { struct {
u32 bus_no; u32 bus_no;
u32 dev_no; u32 dev_no;
struct visor_segment_state state; struct visor_segment_state state;
u8 reserved[6]; /* Natural alignment purposes */ u8 reserved[6];
} __packed device_change_state_event; } __packed device_change_state_event;
/* for CONTROLVM_DEVICE_CHANGESTATE_EVENT */
struct { struct {
/* indicates the max number of busses */
u32 bus_count; u32 bus_count;
/* indicates the max number of switches */
u32 switch_count; u32 switch_count;
enum visor_chipset_feature features; enum visor_chipset_feature features;
u32 platform_number; /* Platform Number */ u32 platform_number;
} __packed init_chipset; /* for CONTROLVM_CHIPSET_INIT */ } __packed init_chipset;
struct { struct {
u32 options; /* reserved */ u32 options;
u32 test; /* bit 0 set to run embedded selftest */ u32 test;
} __packed chipset_selftest; } __packed chipset_selftest;
/* for CONTROLVM_CHIPSET_SELFTEST */
/* a physical address of something, that can be dereferenced
* by the receiver of this ControlVm command
*/
u64 addr; u64 addr;
/* a handle of something (depends on command id) */
u64 handle; u64 handle;
}; };
} __packed; } __packed;
@ -348,93 +447,139 @@ struct controlvm_message {
struct controlvm_message_packet cmd; struct controlvm_message_packet cmd;
} __packed; } __packed;
/*
* struct visor_controlvm_channel
* @struct header:
* @gp_controlvm: Guest phys addr of this channel.
* @gp_partition_tables: Guest phys addr of partition tables.
* @gp_diag_guest: Guest phys addr of diagnostic channel.
* @gp_boot_romdisk: Guest phys addr of (read* only) Boot
* ROM disk.
* @gp_boot_ramdisk: Guest phys addr of writable Boot RAM
* disk.
* @gp_acpi_table: Guest phys addr of acpi table.
* @gp_control_channel: Guest phys addr of control channel.
* @gp_diag_romdisk: Guest phys addr of diagnostic ROM disk.
* @gp_nvram: Guest phys addr of NVRAM channel.
* @request_payload_offset: Offset to request payload area.
* @event_payload_offset: Offset to event payload area.
* @request_payload_bytes: Bytes available in request payload area.
* @event_payload_bytes: Bytes available in event payload area.
* @control_channel_bytes:
* @nvram_channel_bytes: Bytes in PartitionNvram segment.
* @message_bytes: sizeof(CONTROLVM_MESSAGE).
* @message_count: CONTROLVM_MESSAGE_MAX.
* @gp_smbios_table: Guest phys addr of SMBIOS tables.
* @gp_physical_smbios_table: Guest phys addr of SMBIOS table.
* @gp_reserved: VISOR_MAX_GUESTS_PER_SERVICE.
* @virtual_guest_firmware_image_base: Guest physical address of EFI firmware
* image base.
* @virtual_guest_firmware_entry_point: Guest physical address of EFI firmware
* entry point.
* @virtual_guest_firmware_image_size: Guest EFI firmware image size.
* @virtual_guest_firmware_boot_base: GPA = 1MB where EFI firmware image is
* copied to.
* @virtual_guest_image_base:
* @virtual_guest_image_size:
* @prototype_control_channel_offset:
* @virtual_guest_partition_handle:
* @restore_action: Restore Action field to restore the
* guest partition.
* @dump_action: For Windows guests it shows if the
* visordisk is in dump mode.
* @nvram_fail_count:
* @saved_crash_message_count: = CONTROLVM_CRASHMSG_MAX.
* @saved_crash_message_offset: Offset to request payload area needed
* for crash dump.
* @installation_error: Type of error encountered during
* installation.
* @installation_text_id: Id of string to display.
* @installation_remaining_steps: Number of remaining installation steps
* (for progress bars).
* @tool_action: VISOR_TOOL_ACTIONS Installation Action
* field.
* @reserved: Alignment.
* @struct efi_visor_ind:
* @sp_reserved:
* @reserved2: Force signals to begin on 128-byte
* cache line.
* @struct request_queue: Guest partition uses this queue to send
* requests to Control.
* @struct response_queue: Control uses this queue to respond to
* service or guest partition request.
* @struct event_queue: Control uses this queue to send events
* to guest partition.
* @struct event_ack_queue: Service or guest partition uses this
* queue to ack Control events.
* @struct request_msg: Request fixed-size message pool -
* does not include payload.
* @struct response_msg: Response fixed-size message pool -
* does not include payload.
* @struct event_msg: Event fixed-size message pool -
* does not include payload.
* @struct event_ack_msg: Ack fixed-size message pool -
* does not include payload.
* @struct saved_crash_msg: Message stored during IOVM creation to
* be reused after crash.
*/
struct visor_controlvm_channel { struct visor_controlvm_channel {
struct channel_header header; struct channel_header header;
u64 gp_controlvm; /* guest phys addr of this channel */ u64 gp_controlvm;
u64 gp_partition_tables;/* guest phys addr of partition tables */ u64 gp_partition_tables;
u64 gp_diag_guest; /* guest phys addr of diagnostic channel */ u64 gp_diag_guest;
u64 gp_boot_romdisk;/* guest phys addr of (read* only) Boot ROM disk */ u64 gp_boot_romdisk;
u64 gp_boot_ramdisk;/* guest phys addr of writable Boot RAM disk */ u64 gp_boot_ramdisk;
u64 gp_acpi_table; /* guest phys addr of acpi table */ u64 gp_acpi_table;
u64 gp_control_channel;/* guest phys addr of control channel */ u64 gp_control_channel;
u64 gp_diag_romdisk;/* guest phys addr of diagnostic ROM disk */ u64 gp_diag_romdisk;
u64 gp_nvram; /* guest phys addr of NVRAM channel */ u64 gp_nvram;
u64 request_payload_offset; /* Offset to request payload area */ u64 request_payload_offset;
u64 event_payload_offset; /* Offset to event payload area */ u64 event_payload_offset;
/* Bytes available in request payload area */
u32 request_payload_bytes; u32 request_payload_bytes;
u32 event_payload_bytes;/* Bytes available in event payload area */ u32 event_payload_bytes;
u32 control_channel_bytes; u32 control_channel_bytes;
u32 nvram_channel_bytes; /* Bytes in PartitionNvram segment */ u32 nvram_channel_bytes;
u32 message_bytes; /* sizeof(CONTROLVM_MESSAGE) */ u32 message_bytes;
u32 message_count; /* CONTROLVM_MESSAGE_MAX */ u32 message_count;
u64 gp_smbios_table; /* guest phys addr of SMBIOS tables */ u64 gp_smbios_table;
u64 gp_physical_smbios_table; /* guest phys addr of SMBIOS table */ u64 gp_physical_smbios_table;
/* VISOR_MAX_GUESTS_PER_SERVICE */
char gp_reserved[2688]; char gp_reserved[2688];
/* guest physical address of EFI firmware image base */
u64 virtual_guest_firmware_image_base; u64 virtual_guest_firmware_image_base;
/* guest physical address of EFI firmware entry point */
u64 virtual_guest_firmware_entry_point; u64 virtual_guest_firmware_entry_point;
/* guest EFI firmware image size */
u64 virtual_guest_firmware_image_size; u64 virtual_guest_firmware_image_size;
/* GPA = 1MB where EFI firmware image is copied to */
u64 virtual_guest_firmware_boot_base; u64 virtual_guest_firmware_boot_base;
u64 virtual_guest_image_base; u64 virtual_guest_image_base;
u64 virtual_guest_image_size; u64 virtual_guest_image_size;
u64 prototype_control_channel_offset; u64 prototype_control_channel_offset;
u64 virtual_guest_partition_handle; u64 virtual_guest_partition_handle;
/* Restore Action field to restore the guest partition */
u16 restore_action; u16 restore_action;
/* For Windows guests it shows if the visordisk is in dump mode */
u16 dump_action; u16 dump_action;
u16 nvram_fail_count; u16 nvram_fail_count;
u16 saved_crash_message_count; /* = CONTROLVM_CRASHMSG_MAX */ u16 saved_crash_message_count;
/* Offset to request payload area needed for crash dump */
u32 saved_crash_message_offset; u32 saved_crash_message_offset;
/* Type of error encountered during installation */
u32 installation_error; u32 installation_error;
u32 installation_text_id; /* Id of string to display */ u32 installation_text_id;
/* Number of remaining installation steps (for progress bars) */
u16 installation_remaining_steps; u16 installation_remaining_steps;
/* VISOR_TOOL_ACTIONS Installation Action field */
u8 tool_action; u8 tool_action;
u8 reserved; /* alignment */ u8 reserved;
struct efi_visor_indication efi_visor_ind; struct efi_visor_indication efi_visor_ind;
u32 sp_reserved; u32 sp_reserved;
/* Force signals to begin on 128-byte cache line */
u8 reserved2[28]; u8 reserved2[28];
/* guest partition uses this queue to send requests to Control */
struct signal_queue_header request_queue; struct signal_queue_header request_queue;
/* Control uses this queue to respond to service or guest
* partition requests
*/
struct signal_queue_header response_queue; struct signal_queue_header response_queue;
/* Control uses this queue to send events to guest partition */
struct signal_queue_header event_queue; struct signal_queue_header event_queue;
/* Service or guest partition uses this queue to ack Control events */
struct signal_queue_header event_ack_queue; struct signal_queue_header event_ack_queue;
/* Request fixed-size message pool - does not include payload */ struct controlvm_message request_msg[CONTROLVM_MESSAGE_MAX];
struct controlvm_message request_msg[CONTROLVM_MESSAGE_MAX]; struct controlvm_message response_msg[CONTROLVM_MESSAGE_MAX];
struct controlvm_message event_msg[CONTROLVM_MESSAGE_MAX];
/* Response fixed-size message pool - does not include payload */ struct controlvm_message event_ack_msg[CONTROLVM_MESSAGE_MAX];
struct controlvm_message response_msg[CONTROLVM_MESSAGE_MAX]; struct controlvm_message saved_crash_msg[CONTROLVM_CRASHMSG_MAX];
/* Event fixed-size message pool - does not include payload */
struct controlvm_message event_msg[CONTROLVM_MESSAGE_MAX];
/* Ack fixed-size message pool - does not include payload */
struct controlvm_message event_ack_msg[CONTROLVM_MESSAGE_MAX];
/* Message stored during IOVM creation to be reused after crash */
struct controlvm_message saved_crash_msg[CONTROLVM_CRASHMSG_MAX];
} __packed; } __packed;
/* The following header will be located at the beginning of PayloadVmOffset for /*
* struct visor_controlvm_parameters_header
*
* The following header will be located at the beginning of PayloadVmOffset for
* various ControlVm commands. The receiver of a ControlVm command with a * various ControlVm commands. The receiver of a ControlVm command with a
* PayloadVmOffset will dereference this address and then use connection_offset, * PayloadVmOffset will dereference this address and then use connection_offset,
* initiator_offset, and target_offset to get the location of UTF-8 formatted * initiator_offset, and target_offset to get the location of UTF-8 formatted
@ -457,7 +602,8 @@ struct visor_controlvm_parameters_header {
u32 name_length; u32 name_length;
uuid_le id; uuid_le id;
u32 revision; u32 revision;
u32 reserved; /* Natural alignment */ /* Natural alignment */
u32 reserved;
} __packed; } __packed;
/* General Errors------------------------------------------------------[0-99] */ /* General Errors------------------------------------------------------[0-99] */
@ -473,57 +619,50 @@ struct visor_controlvm_parameters_header {
#define CONTROLVM_RESP_EXPECTED_CHIPSET_INIT 101 #define CONTROLVM_RESP_EXPECTED_CHIPSET_INIT 101
/* Maximum Limit----------------------------------------------------[200-299] */ /* Maximum Limit----------------------------------------------------[200-299] */
#define CONTROLVM_RESP_ERROR_MAX_BUSES 201 /* BUS_CREATE */ /* BUS_CREATE */
#define CONTROLVM_RESP_ERROR_MAX_DEVICES 202 /* DEVICE_CREATE */ #define CONTROLVM_RESP_ERROR_MAX_BUSES 201
/* Payload and Parameter Related------------------------------------[400-499] */ /* DEVICE_CREATE */
#define CONTROLVM_RESP_PAYLOAD_INVALID 400 /* SWITCH_ATTACHEXTPORT, #define CONTROLVM_RESP_ERROR_MAX_DEVICES 202
* DEVICE_CONFIGURE
*/ /* Payload and Parameter Related------------------------------------[400-499] */
#define CONTROLVM_RESP_INITIATOR_PARAMETER_INVALID 401 /* Multiple */ /* SWITCH_ATTACHEXTPORT, DEVICE_CONFIGURE */
#define CONTROLVM_RESP_TARGET_PARAMETER_INVALID 402 /* DEVICE_CONFIGURE */ #define CONTROLVM_RESP_PAYLOAD_INVALID 400
#define CONTROLVM_RESP_CLIENT_PARAMETER_INVALID 403 /* DEVICE_CONFIGURE */ /* Multiple */
/* Specified[Packet Structure] Value-------------------------------[500-599] */ #define CONTROLVM_RESP_INITIATOR_PARAMETER_INVALID 401
#define CONTROLVM_RESP_BUS_INVALID 500 /* SWITCH_ATTACHINTPORT, /* DEVICE_CONFIGURE */
* BUS_CONFIGURE, #define CONTROLVM_RESP_TARGET_PARAMETER_INVALID 402
* DEVICE_CREATE, /* DEVICE_CONFIGURE */
* DEVICE_CONFIG #define CONTROLVM_RESP_CLIENT_PARAMETER_INVALID 403
* DEVICE_DESTROY
*/ /* Specified[Packet Structure] Value--------------------------------[500-599] */
#define CONTROLVM_RESP_DEVICE_INVALID 501 /* SWITCH_ATTACHINTPORT*/ /* SWITCH_ATTACHINTPORT */
/* DEVICE_CREATE, /* BUS_CONFIGURE, DEVICE_CREATE, DEVICE_CONFIG, DEVICE_DESTROY */
* DEVICE_CONFIGURE, #define CONTROLVM_RESP_BUS_INVALID 500
* DEVICE_DESTROY /* SWITCH_ATTACHINTPORT*/
*/ /* DEVICE_CREATE, DEVICE_CONFIGURE, DEVICE_DESTROY */
#define CONTROLVM_RESP_CHANNEL_INVALID 502 /* DEVICE_CREATE, #define CONTROLVM_RESP_DEVICE_INVALID 501
* DEVICE_CONFIGURE /* DEVICE_CREATE, DEVICE_CONFIGURE */
*/ #define CONTROLVM_RESP_CHANNEL_INVALID 502
/* Partition Driver Callback Interface----------------------[600-699] */ /* Partition Driver Callback Interface------------------------------[600-699] */
#define CONTROLVM_RESP_VIRTPCI_DRIVER_FAILURE 604 /* BUS_CREATE, /* BUS_CREATE, BUS_DESTROY, DEVICE_CREATE, DEVICE_DESTROY */
* BUS_DESTROY, #define CONTROLVM_RESP_VIRTPCI_DRIVER_FAILURE 604
* DEVICE_CREATE, /* Unable to invoke VIRTPCI callback. VIRTPCI Callback returned error. */
* DEVICE_DESTROY /* BUS_CREATE, BUS_DESTROY, DEVICE_CREATE, DEVICE_DESTROY */
*/ #define CONTROLVM_RESP_VIRTPCI_DRIVER_CALLBACK_ERROR 605
/* Unable to invoke VIRTPCI callback */ /* Generic device callback returned error. */
#define CONTROLVM_RESP_VIRTPCI_DRIVER_CALLBACK_ERROR 605 /* BUS_CREATE, /* SWITCH_ATTACHEXTPORT, SWITCH_DETACHEXTPORT, DEVICE_CONFIGURE */
* BUS_DESTROY, #define CONTROLVM_RESP_GENERIC_DRIVER_CALLBACK_ERROR 606
* DEVICE_CREATE,
* DEVICE_DESTROY
*/
/* VIRTPCI Callback returned error */
#define CONTROLVM_RESP_GENERIC_DRIVER_CALLBACK_ERROR 606
/* SWITCH_ATTACHEXTPORT,
* SWITCH_DETACHEXTPORT
* DEVICE_CONFIGURE
*/
/* generic device callback returned error */
/* Bus Related------------------------------------------------------[700-799] */ /* Bus Related------------------------------------------------------[700-799] */
#define CONTROLVM_RESP_ERROR_BUS_DEVICE_ATTACHED 700 /* BUS_DESTROY */ /* BUS_DESTROY */
#define CONTROLVM_RESP_ERROR_BUS_DEVICE_ATTACHED 700
/* Channel Related--------------------------------------------------[800-899] */ /* Channel Related--------------------------------------------------[800-899] */
#define CONTROLVM_RESP_CHANNEL_TYPE_UNKNOWN 800 /* GET_CHANNELINFO, /* GET_CHANNELINFO, DEVICE_DESTROY */
* DEVICE_DESTROY #define CONTROLVM_RESP_CHANNEL_TYPE_UNKNOWN 800
*/ /* DEVICE_CREATE */
#define CONTROLVM_RESP_CHANNEL_SIZE_TOO_SMALL 801 /* DEVICE_CREATE */ #define CONTROLVM_RESP_CHANNEL_SIZE_TOO_SMALL 801
/* Chipset Shutdown Related---------------------------------------[1000-1099] */ /* Chipset Shutdown Related---------------------------------------[1000-1099] */
#define CONTROLVM_RESP_CHIPSET_SHUTDOWN_FAILED 1000 #define CONTROLVM_RESP_CHIPSET_SHUTDOWN_FAILED 1000
#define CONTROLVM_RESP_CHIPSET_SHUTDOWN_ALREADY_ACTIVE 1001 #define CONTROLVM_RESP_CHIPSET_SHUTDOWN_ALREADY_ACTIVE 1001
@ -535,4 +674,5 @@ struct visor_controlvm_parameters_header {
/* Device Related-------------------------------------------------[1400-1499] */ /* Device Related-------------------------------------------------[1400-1499] */
#define CONTROLVM_RESP_DEVICE_UDEV_TIMEOUT 1400 #define CONTROLVM_RESP_DEVICE_UDEV_TIMEOUT 1400
#endif /* __CONTROLVMCHANNEL_H__ */ /* __CONTROLVMCHANNEL_H__ */
#endif