162306a36Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0 OR CDDL-1.0) */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Virtual Device for Guest <-> VMM/Host communication interface
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2006-2016 Oracle Corporation
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef __VBOX_VMMDEV_H__
962306a36Sopenharmony_ci#define __VBOX_VMMDEV_H__
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include <asm/bitsperlong.h>
1262306a36Sopenharmony_ci#include <linux/sizes.h>
1362306a36Sopenharmony_ci#include <linux/types.h>
1462306a36Sopenharmony_ci#include <linux/vbox_vmmdev_types.h>
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci/* Port for generic request interface (relative offset). */
1762306a36Sopenharmony_ci#define VMMDEV_PORT_OFF_REQUEST                             0
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci/** Layout of VMMDEV RAM region that contains information for guest. */
2062306a36Sopenharmony_cistruct vmmdev_memory {
2162306a36Sopenharmony_ci	/** The size of this structure. */
2262306a36Sopenharmony_ci	u32 size;
2362306a36Sopenharmony_ci	/** The structure version. (VMMDEV_MEMORY_VERSION) */
2462306a36Sopenharmony_ci	u32 version;
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci	union {
2762306a36Sopenharmony_ci		struct {
2862306a36Sopenharmony_ci			/** Flag telling that VMMDev has events pending. */
2962306a36Sopenharmony_ci			u8 have_events;
3062306a36Sopenharmony_ci			/** Explicit padding, MBZ. */
3162306a36Sopenharmony_ci			u8 padding[3];
3262306a36Sopenharmony_ci		} V1_04;
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci		struct {
3562306a36Sopenharmony_ci			/** Pending events flags, set by host. */
3662306a36Sopenharmony_ci			u32 host_events;
3762306a36Sopenharmony_ci			/** Mask of events the guest wants, set by guest. */
3862306a36Sopenharmony_ci			u32 guest_event_mask;
3962306a36Sopenharmony_ci		} V1_03;
4062306a36Sopenharmony_ci	} V;
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci	/* struct vbva_memory, not used */
4362306a36Sopenharmony_ci};
4462306a36Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_memory, 8 + 8);
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci/** Version of vmmdev_memory structure (vmmdev_memory::version). */
4762306a36Sopenharmony_ci#define VMMDEV_MEMORY_VERSION   (1)
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci/* Host mouse capabilities has been changed. */
5062306a36Sopenharmony_ci#define VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED             BIT(0)
5162306a36Sopenharmony_ci/* HGCM event. */
5262306a36Sopenharmony_ci#define VMMDEV_EVENT_HGCM                                   BIT(1)
5362306a36Sopenharmony_ci/* A display change request has been issued. */
5462306a36Sopenharmony_ci#define VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST                 BIT(2)
5562306a36Sopenharmony_ci/* Credentials are available for judgement. */
5662306a36Sopenharmony_ci#define VMMDEV_EVENT_JUDGE_CREDENTIALS                      BIT(3)
5762306a36Sopenharmony_ci/* The guest has been restored. */
5862306a36Sopenharmony_ci#define VMMDEV_EVENT_RESTORED                               BIT(4)
5962306a36Sopenharmony_ci/* Seamless mode state changed. */
6062306a36Sopenharmony_ci#define VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST           BIT(5)
6162306a36Sopenharmony_ci/* Memory balloon size changed. */
6262306a36Sopenharmony_ci#define VMMDEV_EVENT_BALLOON_CHANGE_REQUEST                 BIT(6)
6362306a36Sopenharmony_ci/* Statistics interval changed. */
6462306a36Sopenharmony_ci#define VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST     BIT(7)
6562306a36Sopenharmony_ci/* VRDP status changed. */
6662306a36Sopenharmony_ci#define VMMDEV_EVENT_VRDP                                   BIT(8)
6762306a36Sopenharmony_ci/* New mouse position data available. */
6862306a36Sopenharmony_ci#define VMMDEV_EVENT_MOUSE_POSITION_CHANGED                 BIT(9)
6962306a36Sopenharmony_ci/* CPU hotplug event occurred. */
7062306a36Sopenharmony_ci#define VMMDEV_EVENT_CPU_HOTPLUG                            BIT(10)
7162306a36Sopenharmony_ci/* The mask of valid events, for sanity checking. */
7262306a36Sopenharmony_ci#define VMMDEV_EVENT_VALID_EVENT_MASK                       0x000007ffU
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci/*
7562306a36Sopenharmony_ci * Additions are allowed to work only if additions_major == vmmdev_current &&
7662306a36Sopenharmony_ci * additions_minor <= vmmdev_current. Additions version is reported to host
7762306a36Sopenharmony_ci * (VMMDev) by VMMDEVREQ_REPORT_GUEST_INFO.
7862306a36Sopenharmony_ci */
7962306a36Sopenharmony_ci#define VMMDEV_VERSION                      0x00010004
8062306a36Sopenharmony_ci#define VMMDEV_VERSION_MAJOR                (VMMDEV_VERSION >> 16)
8162306a36Sopenharmony_ci#define VMMDEV_VERSION_MINOR                (VMMDEV_VERSION & 0xffff)
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci/* Maximum request packet size. */
8462306a36Sopenharmony_ci#define VMMDEV_MAX_VMMDEVREQ_SIZE           1048576
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci/* Version of vmmdev_request_header structure. */
8762306a36Sopenharmony_ci#define VMMDEV_REQUEST_HEADER_VERSION       0x10001
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci/** struct vmmdev_request_header - Generic VMMDev request header. */
9062306a36Sopenharmony_cistruct vmmdev_request_header {
9162306a36Sopenharmony_ci	/** IN: Size of the structure in bytes (including body). */
9262306a36Sopenharmony_ci	u32 size;
9362306a36Sopenharmony_ci	/** IN: Version of the structure.  */
9462306a36Sopenharmony_ci	u32 version;
9562306a36Sopenharmony_ci	/** IN: Type of the request. */
9662306a36Sopenharmony_ci	enum vmmdev_request_type request_type;
9762306a36Sopenharmony_ci	/** OUT: Return code. */
9862306a36Sopenharmony_ci	s32 rc;
9962306a36Sopenharmony_ci	/** Reserved field no.1. MBZ. */
10062306a36Sopenharmony_ci	u32 reserved1;
10162306a36Sopenharmony_ci	/** IN: Requestor information (VMMDEV_REQUESTOR_*) */
10262306a36Sopenharmony_ci	u32 requestor;
10362306a36Sopenharmony_ci};
10462306a36Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_request_header, 24);
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci/**
10762306a36Sopenharmony_ci * struct vmmdev_mouse_status - Mouse status request structure.
10862306a36Sopenharmony_ci *
10962306a36Sopenharmony_ci * Used by VMMDEVREQ_GET_MOUSE_STATUS and VMMDEVREQ_SET_MOUSE_STATUS.
11062306a36Sopenharmony_ci */
11162306a36Sopenharmony_cistruct vmmdev_mouse_status {
11262306a36Sopenharmony_ci	/** header */
11362306a36Sopenharmony_ci	struct vmmdev_request_header header;
11462306a36Sopenharmony_ci	/** Mouse feature mask. See VMMDEV_MOUSE_*. */
11562306a36Sopenharmony_ci	u32 mouse_features;
11662306a36Sopenharmony_ci	/** Mouse x position. */
11762306a36Sopenharmony_ci	s32 pointer_pos_x;
11862306a36Sopenharmony_ci	/** Mouse y position. */
11962306a36Sopenharmony_ci	s32 pointer_pos_y;
12062306a36Sopenharmony_ci};
12162306a36Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_mouse_status, 24 + 12);
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci/* The guest can (== wants to) handle absolute coordinates.  */
12462306a36Sopenharmony_ci#define VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE                     BIT(0)
12562306a36Sopenharmony_ci/*
12662306a36Sopenharmony_ci * The host can (== wants to) send absolute coordinates.
12762306a36Sopenharmony_ci * (Input not captured.)
12862306a36Sopenharmony_ci */
12962306a36Sopenharmony_ci#define VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE                    BIT(1)
13062306a36Sopenharmony_ci/*
13162306a36Sopenharmony_ci * The guest can *NOT* switch to software cursor and therefore depends on the
13262306a36Sopenharmony_ci * host cursor.
13362306a36Sopenharmony_ci *
13462306a36Sopenharmony_ci * When guest additions are installed and the host has promised to display the
13562306a36Sopenharmony_ci * cursor itself, the guest installs a hardware mouse driver. Don't ask the
13662306a36Sopenharmony_ci * guest to switch to a software cursor then.
13762306a36Sopenharmony_ci */
13862306a36Sopenharmony_ci#define VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR                BIT(2)
13962306a36Sopenharmony_ci/* The host does NOT provide support for drawing the cursor itself. */
14062306a36Sopenharmony_ci#define VMMDEV_MOUSE_HOST_CANNOT_HWPOINTER                  BIT(3)
14162306a36Sopenharmony_ci/* The guest can read VMMDev events to find out about pointer movement */
14262306a36Sopenharmony_ci#define VMMDEV_MOUSE_NEW_PROTOCOL                           BIT(4)
14362306a36Sopenharmony_ci/*
14462306a36Sopenharmony_ci * If the guest changes the status of the VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR
14562306a36Sopenharmony_ci * bit, the host will honour this.
14662306a36Sopenharmony_ci */
14762306a36Sopenharmony_ci#define VMMDEV_MOUSE_HOST_RECHECKS_NEEDS_HOST_CURSOR        BIT(5)
14862306a36Sopenharmony_ci/*
14962306a36Sopenharmony_ci * The host supplies an absolute pointing device.  The Guest Additions may
15062306a36Sopenharmony_ci * wish to use this to decide whether to install their own driver.
15162306a36Sopenharmony_ci */
15262306a36Sopenharmony_ci#define VMMDEV_MOUSE_HOST_HAS_ABS_DEV                       BIT(6)
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ci/* The minimum value our pointing device can return. */
15562306a36Sopenharmony_ci#define VMMDEV_MOUSE_RANGE_MIN 0
15662306a36Sopenharmony_ci/* The maximum value our pointing device can return. */
15762306a36Sopenharmony_ci#define VMMDEV_MOUSE_RANGE_MAX 0xFFFF
15862306a36Sopenharmony_ci
15962306a36Sopenharmony_ci/**
16062306a36Sopenharmony_ci * struct vmmdev_host_version - VirtualBox host version request structure.
16162306a36Sopenharmony_ci *
16262306a36Sopenharmony_ci * VBG uses this to detect the precense of new features in the interface.
16362306a36Sopenharmony_ci */
16462306a36Sopenharmony_cistruct vmmdev_host_version {
16562306a36Sopenharmony_ci	/** Header. */
16662306a36Sopenharmony_ci	struct vmmdev_request_header header;
16762306a36Sopenharmony_ci	/** Major version. */
16862306a36Sopenharmony_ci	u16 major;
16962306a36Sopenharmony_ci	/** Minor version. */
17062306a36Sopenharmony_ci	u16 minor;
17162306a36Sopenharmony_ci	/** Build number. */
17262306a36Sopenharmony_ci	u32 build;
17362306a36Sopenharmony_ci	/** SVN revision. */
17462306a36Sopenharmony_ci	u32 revision;
17562306a36Sopenharmony_ci	/** Feature mask. */
17662306a36Sopenharmony_ci	u32 features;
17762306a36Sopenharmony_ci};
17862306a36Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_host_version, 24 + 16);
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci/* Physical page lists are supported by HGCM. */
18162306a36Sopenharmony_ci#define VMMDEV_HVF_HGCM_PHYS_PAGE_LIST  BIT(0)
18262306a36Sopenharmony_ci
18362306a36Sopenharmony_ci/**
18462306a36Sopenharmony_ci * struct vmmdev_mask - Structure to set / clear bits in a mask used for
18562306a36Sopenharmony_ci * VMMDEVREQ_SET_GUEST_CAPABILITIES and VMMDEVREQ_CTL_GUEST_FILTER_MASK.
18662306a36Sopenharmony_ci */
18762306a36Sopenharmony_cistruct vmmdev_mask {
18862306a36Sopenharmony_ci	/** Header. */
18962306a36Sopenharmony_ci	struct vmmdev_request_header header;
19062306a36Sopenharmony_ci	/** Mask of bits to be set. */
19162306a36Sopenharmony_ci	u32 or_mask;
19262306a36Sopenharmony_ci	/** Mask of bits to be cleared. */
19362306a36Sopenharmony_ci	u32 not_mask;
19462306a36Sopenharmony_ci};
19562306a36Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_mask, 24 + 8);
19662306a36Sopenharmony_ci
19762306a36Sopenharmony_ci/* The guest supports seamless display rendering. */
19862306a36Sopenharmony_ci#define VMMDEV_GUEST_SUPPORTS_SEAMLESS                      BIT(0)
19962306a36Sopenharmony_ci/* The guest supports mapping guest to host windows. */
20062306a36Sopenharmony_ci#define VMMDEV_GUEST_SUPPORTS_GUEST_HOST_WINDOW_MAPPING     BIT(1)
20162306a36Sopenharmony_ci/*
20262306a36Sopenharmony_ci * The guest graphical additions are active.
20362306a36Sopenharmony_ci * Used for fast activation and deactivation of certain graphical operations
20462306a36Sopenharmony_ci * (e.g. resizing & seamless). The legacy VMMDEVREQ_REPORT_GUEST_CAPABILITIES
20562306a36Sopenharmony_ci * request sets this automatically, but VMMDEVREQ_SET_GUEST_CAPABILITIES does
20662306a36Sopenharmony_ci * not.
20762306a36Sopenharmony_ci */
20862306a36Sopenharmony_ci#define VMMDEV_GUEST_SUPPORTS_GRAPHICS                      BIT(2)
20962306a36Sopenharmony_ci/* The mask of valid capabilities, for sanity checking. */
21062306a36Sopenharmony_ci#define VMMDEV_GUEST_CAPABILITIES_MASK                      0x00000007U
21162306a36Sopenharmony_ci
21262306a36Sopenharmony_ci/** struct vmmdev_hypervisorinfo - Hypervisor info structure. */
21362306a36Sopenharmony_cistruct vmmdev_hypervisorinfo {
21462306a36Sopenharmony_ci	/** Header. */
21562306a36Sopenharmony_ci	struct vmmdev_request_header header;
21662306a36Sopenharmony_ci	/**
21762306a36Sopenharmony_ci	 * Guest virtual address of proposed hypervisor start.
21862306a36Sopenharmony_ci	 * Not used by VMMDEVREQ_GET_HYPERVISOR_INFO.
21962306a36Sopenharmony_ci	 */
22062306a36Sopenharmony_ci	u32 hypervisor_start;
22162306a36Sopenharmony_ci	/** Hypervisor size in bytes. */
22262306a36Sopenharmony_ci	u32 hypervisor_size;
22362306a36Sopenharmony_ci};
22462306a36Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_hypervisorinfo, 24 + 8);
22562306a36Sopenharmony_ci
22662306a36Sopenharmony_ci/** struct vmmdev_events - Pending events structure. */
22762306a36Sopenharmony_cistruct vmmdev_events {
22862306a36Sopenharmony_ci	/** Header. */
22962306a36Sopenharmony_ci	struct vmmdev_request_header header;
23062306a36Sopenharmony_ci	/** OUT: Pending event mask. */
23162306a36Sopenharmony_ci	u32 events;
23262306a36Sopenharmony_ci};
23362306a36Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_events, 24 + 4);
23462306a36Sopenharmony_ci
23562306a36Sopenharmony_ci#define VMMDEV_OSTYPE_LINUX26		0x53000
23662306a36Sopenharmony_ci#define VMMDEV_OSTYPE_X64		BIT(8)
23762306a36Sopenharmony_ci
23862306a36Sopenharmony_ci/** struct vmmdev_guestinfo - Guest information report. */
23962306a36Sopenharmony_cistruct vmmdev_guest_info {
24062306a36Sopenharmony_ci	/** Header. */
24162306a36Sopenharmony_ci	struct vmmdev_request_header header;
24262306a36Sopenharmony_ci	/**
24362306a36Sopenharmony_ci	 * The VMMDev interface version expected by additions.
24462306a36Sopenharmony_ci	 * *Deprecated*, do not use anymore! Will be removed.
24562306a36Sopenharmony_ci	 */
24662306a36Sopenharmony_ci	u32 interface_version;
24762306a36Sopenharmony_ci	/** Guest OS type. */
24862306a36Sopenharmony_ci	u32 os_type;
24962306a36Sopenharmony_ci};
25062306a36Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_guest_info, 24 + 8);
25162306a36Sopenharmony_ci
25262306a36Sopenharmony_ci#define VMMDEV_GUEST_INFO2_ADDITIONS_FEATURES_REQUESTOR_INFO	BIT(0)
25362306a36Sopenharmony_ci
25462306a36Sopenharmony_ci/** struct vmmdev_guestinfo2 - Guest information report, version 2. */
25562306a36Sopenharmony_cistruct vmmdev_guest_info2 {
25662306a36Sopenharmony_ci	/** Header. */
25762306a36Sopenharmony_ci	struct vmmdev_request_header header;
25862306a36Sopenharmony_ci	/** Major version. */
25962306a36Sopenharmony_ci	u16 additions_major;
26062306a36Sopenharmony_ci	/** Minor version. */
26162306a36Sopenharmony_ci	u16 additions_minor;
26262306a36Sopenharmony_ci	/** Build number. */
26362306a36Sopenharmony_ci	u32 additions_build;
26462306a36Sopenharmony_ci	/** SVN revision. */
26562306a36Sopenharmony_ci	u32 additions_revision;
26662306a36Sopenharmony_ci	/** Feature mask. */
26762306a36Sopenharmony_ci	u32 additions_features;
26862306a36Sopenharmony_ci	/**
26962306a36Sopenharmony_ci	 * The intentional meaning of this field was:
27062306a36Sopenharmony_ci	 * Some additional information, for example 'Beta 1' or something like
27162306a36Sopenharmony_ci	 * that.
27262306a36Sopenharmony_ci	 *
27362306a36Sopenharmony_ci	 * The way it was implemented was implemented: VBG_VERSION_STRING.
27462306a36Sopenharmony_ci	 *
27562306a36Sopenharmony_ci	 * This means the first three members are duplicated in this field (if
27662306a36Sopenharmony_ci	 * the guest build config is sane). So, the user must check this and
27762306a36Sopenharmony_ci	 * chop it off before usage. There is, because of the Main code's blind
27862306a36Sopenharmony_ci	 * trust in the field's content, no way back.
27962306a36Sopenharmony_ci	 */
28062306a36Sopenharmony_ci	char name[128];
28162306a36Sopenharmony_ci};
28262306a36Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_guest_info2, 24 + 144);
28362306a36Sopenharmony_ci
28462306a36Sopenharmony_cienum vmmdev_guest_facility_type {
28562306a36Sopenharmony_ci	VBOXGUEST_FACILITY_TYPE_UNKNOWN          = 0,
28662306a36Sopenharmony_ci	VBOXGUEST_FACILITY_TYPE_VBOXGUEST_DRIVER = 20,
28762306a36Sopenharmony_ci	/* VBoxGINA / VBoxCredProv / pam_vbox. */
28862306a36Sopenharmony_ci	VBOXGUEST_FACILITY_TYPE_AUTO_LOGON       = 90,
28962306a36Sopenharmony_ci	VBOXGUEST_FACILITY_TYPE_VBOX_SERVICE     = 100,
29062306a36Sopenharmony_ci	/* VBoxTray (Windows), VBoxClient (Linux, Unix). */
29162306a36Sopenharmony_ci	VBOXGUEST_FACILITY_TYPE_VBOX_TRAY_CLIENT = 101,
29262306a36Sopenharmony_ci	VBOXGUEST_FACILITY_TYPE_SEAMLESS         = 1000,
29362306a36Sopenharmony_ci	VBOXGUEST_FACILITY_TYPE_GRAPHICS         = 1100,
29462306a36Sopenharmony_ci	VBOXGUEST_FACILITY_TYPE_ALL              = 0x7ffffffe,
29562306a36Sopenharmony_ci	/* Ensure the enum is a 32 bit data-type */
29662306a36Sopenharmony_ci	VBOXGUEST_FACILITY_TYPE_SIZEHACK         = 0x7fffffff
29762306a36Sopenharmony_ci};
29862306a36Sopenharmony_ci
29962306a36Sopenharmony_cienum vmmdev_guest_facility_status {
30062306a36Sopenharmony_ci	VBOXGUEST_FACILITY_STATUS_INACTIVE    = 0,
30162306a36Sopenharmony_ci	VBOXGUEST_FACILITY_STATUS_PAUSED      = 1,
30262306a36Sopenharmony_ci	VBOXGUEST_FACILITY_STATUS_PRE_INIT    = 20,
30362306a36Sopenharmony_ci	VBOXGUEST_FACILITY_STATUS_INIT        = 30,
30462306a36Sopenharmony_ci	VBOXGUEST_FACILITY_STATUS_ACTIVE      = 50,
30562306a36Sopenharmony_ci	VBOXGUEST_FACILITY_STATUS_TERMINATING = 100,
30662306a36Sopenharmony_ci	VBOXGUEST_FACILITY_STATUS_TERMINATED  = 101,
30762306a36Sopenharmony_ci	VBOXGUEST_FACILITY_STATUS_FAILED      = 800,
30862306a36Sopenharmony_ci	VBOXGUEST_FACILITY_STATUS_UNKNOWN     = 999,
30962306a36Sopenharmony_ci	/* Ensure the enum is a 32 bit data-type */
31062306a36Sopenharmony_ci	VBOXGUEST_FACILITY_STATUS_SIZEHACK    = 0x7fffffff
31162306a36Sopenharmony_ci};
31262306a36Sopenharmony_ci
31362306a36Sopenharmony_ci/** struct vmmdev_guest_status - Guest Additions status structure. */
31462306a36Sopenharmony_cistruct vmmdev_guest_status {
31562306a36Sopenharmony_ci	/** Header. */
31662306a36Sopenharmony_ci	struct vmmdev_request_header header;
31762306a36Sopenharmony_ci	/** Facility the status is indicated for. */
31862306a36Sopenharmony_ci	enum vmmdev_guest_facility_type facility;
31962306a36Sopenharmony_ci	/** Current guest status. */
32062306a36Sopenharmony_ci	enum vmmdev_guest_facility_status status;
32162306a36Sopenharmony_ci	/** Flags, not used at the moment. */
32262306a36Sopenharmony_ci	u32 flags;
32362306a36Sopenharmony_ci};
32462306a36Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_guest_status, 24 + 12);
32562306a36Sopenharmony_ci
32662306a36Sopenharmony_ci#define VMMDEV_MEMORY_BALLOON_CHUNK_SIZE             (1048576)
32762306a36Sopenharmony_ci#define VMMDEV_MEMORY_BALLOON_CHUNK_PAGES            (1048576 / 4096)
32862306a36Sopenharmony_ci
32962306a36Sopenharmony_ci/** struct vmmdev_memballoon_info - Memory-balloon info structure. */
33062306a36Sopenharmony_cistruct vmmdev_memballoon_info {
33162306a36Sopenharmony_ci	/** Header. */
33262306a36Sopenharmony_ci	struct vmmdev_request_header header;
33362306a36Sopenharmony_ci	/** Balloon size in megabytes. */
33462306a36Sopenharmony_ci	u32 balloon_chunks;
33562306a36Sopenharmony_ci	/** Guest ram size in megabytes. */
33662306a36Sopenharmony_ci	u32 phys_mem_chunks;
33762306a36Sopenharmony_ci	/**
33862306a36Sopenharmony_ci	 * Setting this to VMMDEV_EVENT_BALLOON_CHANGE_REQUEST indicates that
33962306a36Sopenharmony_ci	 * the request is a response to that event.
34062306a36Sopenharmony_ci	 * (Don't confuse this with VMMDEVREQ_ACKNOWLEDGE_EVENTS.)
34162306a36Sopenharmony_ci	 */
34262306a36Sopenharmony_ci	u32 event_ack;
34362306a36Sopenharmony_ci};
34462306a36Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_memballoon_info, 24 + 12);
34562306a36Sopenharmony_ci
34662306a36Sopenharmony_ci/** struct vmmdev_memballoon_change - Change the size of the balloon. */
34762306a36Sopenharmony_cistruct vmmdev_memballoon_change {
34862306a36Sopenharmony_ci	/** Header. */
34962306a36Sopenharmony_ci	struct vmmdev_request_header header;
35062306a36Sopenharmony_ci	/** The number of pages in the array. */
35162306a36Sopenharmony_ci	u32 pages;
35262306a36Sopenharmony_ci	/** true = inflate, false = deflate.  */
35362306a36Sopenharmony_ci	u32 inflate;
35462306a36Sopenharmony_ci	/** Physical address (u64) of each page. */
35562306a36Sopenharmony_ci	u64 phys_page[VMMDEV_MEMORY_BALLOON_CHUNK_PAGES];
35662306a36Sopenharmony_ci};
35762306a36Sopenharmony_ci
35862306a36Sopenharmony_ci/** struct vmmdev_write_core_dump - Write Core Dump request data. */
35962306a36Sopenharmony_cistruct vmmdev_write_core_dump {
36062306a36Sopenharmony_ci	/** Header. */
36162306a36Sopenharmony_ci	struct vmmdev_request_header header;
36262306a36Sopenharmony_ci	/** Flags (reserved, MBZ). */
36362306a36Sopenharmony_ci	u32 flags;
36462306a36Sopenharmony_ci};
36562306a36Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_write_core_dump, 24 + 4);
36662306a36Sopenharmony_ci
36762306a36Sopenharmony_ci/** struct vmmdev_heartbeat - Heart beat check state structure. */
36862306a36Sopenharmony_cistruct vmmdev_heartbeat {
36962306a36Sopenharmony_ci	/** Header. */
37062306a36Sopenharmony_ci	struct vmmdev_request_header header;
37162306a36Sopenharmony_ci	/** OUT: Guest heartbeat interval in nanosec. */
37262306a36Sopenharmony_ci	u64 interval_ns;
37362306a36Sopenharmony_ci	/** Heartbeat check flag. */
37462306a36Sopenharmony_ci	u8 enabled;
37562306a36Sopenharmony_ci	/** Explicit padding, MBZ. */
37662306a36Sopenharmony_ci	u8 padding[3];
37762306a36Sopenharmony_ci} __packed;
37862306a36Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_heartbeat, 24 + 12);
37962306a36Sopenharmony_ci
38062306a36Sopenharmony_ci#define VMMDEV_HGCM_REQ_DONE      BIT(0)
38162306a36Sopenharmony_ci#define VMMDEV_HGCM_REQ_CANCELLED BIT(1)
38262306a36Sopenharmony_ci
38362306a36Sopenharmony_ci/** struct vmmdev_hgcmreq_header - vmmdev HGCM requests header. */
38462306a36Sopenharmony_cistruct vmmdev_hgcmreq_header {
38562306a36Sopenharmony_ci	/** Request header. */
38662306a36Sopenharmony_ci	struct vmmdev_request_header header;
38762306a36Sopenharmony_ci
38862306a36Sopenharmony_ci	/** HGCM flags. */
38962306a36Sopenharmony_ci	u32 flags;
39062306a36Sopenharmony_ci
39162306a36Sopenharmony_ci	/** Result code. */
39262306a36Sopenharmony_ci	s32 result;
39362306a36Sopenharmony_ci};
39462306a36Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_hgcmreq_header, 24 + 8);
39562306a36Sopenharmony_ci
39662306a36Sopenharmony_ci/** struct vmmdev_hgcm_connect - HGCM connect request structure. */
39762306a36Sopenharmony_cistruct vmmdev_hgcm_connect {
39862306a36Sopenharmony_ci	/** HGCM request header. */
39962306a36Sopenharmony_ci	struct vmmdev_hgcmreq_header header;
40062306a36Sopenharmony_ci
40162306a36Sopenharmony_ci	/** IN: Description of service to connect to. */
40262306a36Sopenharmony_ci	struct vmmdev_hgcm_service_location loc;
40362306a36Sopenharmony_ci
40462306a36Sopenharmony_ci	/** OUT: Client identifier assigned by local instance of HGCM. */
40562306a36Sopenharmony_ci	u32 client_id;
40662306a36Sopenharmony_ci};
40762306a36Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_hgcm_connect, 32 + 132 + 4);
40862306a36Sopenharmony_ci
40962306a36Sopenharmony_ci/** struct vmmdev_hgcm_disconnect - HGCM disconnect request structure. */
41062306a36Sopenharmony_cistruct vmmdev_hgcm_disconnect {
41162306a36Sopenharmony_ci	/** HGCM request header. */
41262306a36Sopenharmony_ci	struct vmmdev_hgcmreq_header header;
41362306a36Sopenharmony_ci
41462306a36Sopenharmony_ci	/** IN: Client identifier. */
41562306a36Sopenharmony_ci	u32 client_id;
41662306a36Sopenharmony_ci};
41762306a36Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_hgcm_disconnect, 32 + 4);
41862306a36Sopenharmony_ci
41962306a36Sopenharmony_ci#define VMMDEV_HGCM_MAX_PARMS 32
42062306a36Sopenharmony_ci
42162306a36Sopenharmony_ci/** struct vmmdev_hgcm_call - HGCM call request structure. */
42262306a36Sopenharmony_cistruct vmmdev_hgcm_call {
42362306a36Sopenharmony_ci	/* request header */
42462306a36Sopenharmony_ci	struct vmmdev_hgcmreq_header header;
42562306a36Sopenharmony_ci
42662306a36Sopenharmony_ci	/** IN: Client identifier. */
42762306a36Sopenharmony_ci	u32 client_id;
42862306a36Sopenharmony_ci	/** IN: Service function number. */
42962306a36Sopenharmony_ci	u32 function;
43062306a36Sopenharmony_ci	/** IN: Number of parameters. */
43162306a36Sopenharmony_ci	u32 parm_count;
43262306a36Sopenharmony_ci	/** Parameters follow in form: HGCMFunctionParameter32|64 parms[X]; */
43362306a36Sopenharmony_ci};
43462306a36Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_hgcm_call, 32 + 12);
43562306a36Sopenharmony_ci
43662306a36Sopenharmony_ci/**
43762306a36Sopenharmony_ci * struct vmmdev_hgcm_cancel2 - HGCM cancel request structure, version 2.
43862306a36Sopenharmony_ci *
43962306a36Sopenharmony_ci * After the request header.rc will be:
44062306a36Sopenharmony_ci *
44162306a36Sopenharmony_ci * VINF_SUCCESS when cancelled.
44262306a36Sopenharmony_ci * VERR_NOT_FOUND if the specified request cannot be found.
44362306a36Sopenharmony_ci * VERR_INVALID_PARAMETER if the address is invalid valid.
44462306a36Sopenharmony_ci */
44562306a36Sopenharmony_cistruct vmmdev_hgcm_cancel2 {
44662306a36Sopenharmony_ci	/** Header. */
44762306a36Sopenharmony_ci	struct vmmdev_request_header header;
44862306a36Sopenharmony_ci	/** The physical address of the request to cancel. */
44962306a36Sopenharmony_ci	u32 phys_req_to_cancel;
45062306a36Sopenharmony_ci};
45162306a36Sopenharmony_ciVMMDEV_ASSERT_SIZE(vmmdev_hgcm_cancel2, 24 + 4);
45262306a36Sopenharmony_ci
45362306a36Sopenharmony_ci#endif
454