fw_cfg: Refactor extra pci roots addition
[qemu/ar7.git] / include / hw / hyperv / hyperv-proto.h
blob21dc28aee9df0704eba4ec49758c65f17aeec120
1 /*
2 * Definitions for Hyper-V guest/hypervisor interaction
4 * Copyright (c) 2017-2018 Virtuozzo International GmbH.
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
8 */
10 #ifndef HW_HYPERV_HYPERV_PROTO_H
11 #define HW_HYPERV_HYPERV_PROTO_H
13 #include "qemu/bitmap.h"
16 * Hypercall status code
18 #define HV_STATUS_SUCCESS 0
19 #define HV_STATUS_INVALID_HYPERCALL_CODE 2
20 #define HV_STATUS_INVALID_HYPERCALL_INPUT 3
21 #define HV_STATUS_INVALID_ALIGNMENT 4
22 #define HV_STATUS_INVALID_PARAMETER 5
23 #define HV_STATUS_INSUFFICIENT_MEMORY 11
24 #define HV_STATUS_INVALID_PORT_ID 17
25 #define HV_STATUS_INVALID_CONNECTION_ID 18
26 #define HV_STATUS_INSUFFICIENT_BUFFERS 19
29 * Hypercall numbers
31 #define HV_POST_MESSAGE 0x005c
32 #define HV_SIGNAL_EVENT 0x005d
33 #define HV_HYPERCALL_FAST (1u << 16)
36 * Message size
38 #define HV_MESSAGE_PAYLOAD_SIZE 240
41 * Message types
43 #define HV_MESSAGE_NONE 0x00000000
44 #define HV_MESSAGE_VMBUS 0x00000001
45 #define HV_MESSAGE_UNMAPPED_GPA 0x80000000
46 #define HV_MESSAGE_GPA_INTERCEPT 0x80000001
47 #define HV_MESSAGE_TIMER_EXPIRED 0x80000010
48 #define HV_MESSAGE_INVALID_VP_REGISTER_VALUE 0x80000020
49 #define HV_MESSAGE_UNRECOVERABLE_EXCEPTION 0x80000021
50 #define HV_MESSAGE_UNSUPPORTED_FEATURE 0x80000022
51 #define HV_MESSAGE_EVENTLOG_BUFFERCOMPLETE 0x80000040
52 #define HV_MESSAGE_X64_IOPORT_INTERCEPT 0x80010000
53 #define HV_MESSAGE_X64_MSR_INTERCEPT 0x80010001
54 #define HV_MESSAGE_X64_CPUID_INTERCEPT 0x80010002
55 #define HV_MESSAGE_X64_EXCEPTION_INTERCEPT 0x80010003
56 #define HV_MESSAGE_X64_APIC_EOI 0x80010004
57 #define HV_MESSAGE_X64_LEGACY_FP_ERROR 0x80010005
60 * Message flags
62 #define HV_MESSAGE_FLAG_PENDING 0x1
65 * Number of synthetic interrupts
67 #define HV_SINT_COUNT 16
70 * Event flags number per SINT
72 #define HV_EVENT_FLAGS_COUNT (256 * 8)
75 * Connection id valid bits
77 #define HV_CONNECTION_ID_MASK 0x00ffffff
80 * Input structure for POST_MESSAGE hypercall
82 struct hyperv_post_message_input {
83 uint32_t connection_id;
84 uint32_t _reserved;
85 uint32_t message_type;
86 uint32_t payload_size;
87 uint8_t payload[HV_MESSAGE_PAYLOAD_SIZE];
91 * Input structure for SIGNAL_EVENT hypercall
93 struct hyperv_signal_event_input {
94 uint32_t connection_id;
95 uint16_t flag_number;
96 uint16_t _reserved_zero;
100 * SynIC message structures
102 struct hyperv_message_header {
103 uint32_t message_type;
104 uint8_t payload_size;
105 uint8_t message_flags; /* HV_MESSAGE_FLAG_XX */
106 uint8_t _reserved[2];
107 uint64_t sender;
110 struct hyperv_message {
111 struct hyperv_message_header header;
112 uint8_t payload[HV_MESSAGE_PAYLOAD_SIZE];
115 struct hyperv_message_page {
116 struct hyperv_message slot[HV_SINT_COUNT];
120 * SynIC event flags structures
122 struct hyperv_event_flags {
123 DECLARE_BITMAP(flags, HV_EVENT_FLAGS_COUNT);
126 struct hyperv_event_flags_page {
127 struct hyperv_event_flags slot[HV_SINT_COUNT];
130 #endif