Commit c786a84e authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Staging: hv: coding style cleanups for HvSynicApi.h

Don't fix the typedef issues, that will come next.

Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f80b3d51
...@@ -21,433 +21,285 @@ ...@@ -21,433 +21,285 @@
* *
*/ */
#pragma once #ifndef __HVSYNICAPI_H
#define __HVSYNICAPI_H
/* Define the virtual APIC registers */ /* Define the virtual APIC registers */
#define HV_X64_MSR_EOI (0x40000070)
#define HV_X64_MSR_EOI (0x40000070) #define HV_X64_MSR_ICR (0x40000071)
#define HV_X64_MSR_ICR (0x40000071) #define HV_X64_MSR_TPR (0x40000072)
#define HV_X64_MSR_TPR (0x40000072) #define HV_X64_MSR_APIC_ASSIST_PAGE (0x40000073)
#define HV_X64_MSR_APIC_ASSIST_PAGE (0x40000073)
/* Define version of the synthetic interrupt controller. */ /* Define version of the synthetic interrupt controller. */
#define HV_SYNIC_VERSION (1)
#define HV_SYNIC_VERSION (1)
/* Define synthetic interrupt controller model specific registers. */ /* Define synthetic interrupt controller model specific registers. */
#define HV_X64_MSR_SCONTROL (0x40000080)
#define HV_X64_MSR_SVERSION (0x40000081)
#define HV_X64_MSR_SCONTROL (0x40000080) #define HV_X64_MSR_SIEFP (0x40000082)
#define HV_X64_MSR_SVERSION (0x40000081) #define HV_X64_MSR_SIMP (0x40000083)
#define HV_X64_MSR_SIEFP (0x40000082) #define HV_X64_MSR_EOM (0x40000084)
#define HV_X64_MSR_SIMP (0x40000083) #define HV_X64_MSR_SINT0 (0x40000090)
#define HV_X64_MSR_EOM (0x40000084) #define HV_X64_MSR_SINT1 (0x40000091)
#define HV_X64_MSR_SINT0 (0x40000090) #define HV_X64_MSR_SINT2 (0x40000092)
#define HV_X64_MSR_SINT1 (0x40000091) #define HV_X64_MSR_SINT3 (0x40000093)
#define HV_X64_MSR_SINT2 (0x40000092) #define HV_X64_MSR_SINT4 (0x40000094)
#define HV_X64_MSR_SINT3 (0x40000093) #define HV_X64_MSR_SINT5 (0x40000095)
#define HV_X64_MSR_SINT4 (0x40000094) #define HV_X64_MSR_SINT6 (0x40000096)
#define HV_X64_MSR_SINT5 (0x40000095) #define HV_X64_MSR_SINT7 (0x40000097)
#define HV_X64_MSR_SINT6 (0x40000096) #define HV_X64_MSR_SINT8 (0x40000098)
#define HV_X64_MSR_SINT7 (0x40000097) #define HV_X64_MSR_SINT9 (0x40000099)
#define HV_X64_MSR_SINT8 (0x40000098) #define HV_X64_MSR_SINT10 (0x4000009A)
#define HV_X64_MSR_SINT9 (0x40000099) #define HV_X64_MSR_SINT11 (0x4000009B)
#define HV_X64_MSR_SINT10 (0x4000009A) #define HV_X64_MSR_SINT12 (0x4000009C)
#define HV_X64_MSR_SINT11 (0x4000009B) #define HV_X64_MSR_SINT13 (0x4000009D)
#define HV_X64_MSR_SINT12 (0x4000009C) #define HV_X64_MSR_SINT14 (0x4000009E)
#define HV_X64_MSR_SINT13 (0x4000009D) #define HV_X64_MSR_SINT15 (0x4000009F)
#define HV_X64_MSR_SINT14 (0x4000009E)
#define HV_X64_MSR_SINT15 (0x4000009F)
/* Define the expected SynIC version. */ /* Define the expected SynIC version. */
#define HV_SYNIC_VERSION_1 (0x1)
#define HV_SYNIC_VERSION_1 (0x1)
/* Define synthetic interrupt controller message constants. */ /* Define synthetic interrupt controller message constants. */
#define HV_MESSAGE_SIZE (256)
#define HV_MESSAGE_PAYLOAD_BYTE_COUNT (240)
#define HV_MESSAGE_SIZE (256) #define HV_MESSAGE_PAYLOAD_QWORD_COUNT (30)
#define HV_MESSAGE_PAYLOAD_BYTE_COUNT (240) #define HV_ANY_VP (0xFFFFFFFF)
#define HV_MESSAGE_PAYLOAD_QWORD_COUNT (30)
#define HV_ANY_VP (0xFFFFFFFF)
/* Define synthetic interrupt controller flag constants. */ /* Define synthetic interrupt controller flag constants. */
#define HV_EVENT_FLAGS_COUNT (256 * 8)
#define HV_EVENT_FLAGS_BYTE_COUNT (256)
#define HV_EVENT_FLAGS_COUNT (256 * 8) #define HV_EVENT_FLAGS_DWORD_COUNT (256 / sizeof(u32))
#define HV_EVENT_FLAGS_BYTE_COUNT (256)
#define HV_EVENT_FLAGS_DWORD_COUNT (256 / sizeof(u32))
/* Define hypervisor message types. */ /* Define hypervisor message types. */
typedef enum _HV_MESSAGE_TYPE {
typedef enum _HV_MESSAGE_TYPE HvMessageTypeNone = 0x00000000,
{
HvMessageTypeNone = 0x00000000, /* Memory access messages. */
HvMessageTypeUnmappedGpa = 0x80000000,
HvMessageTypeGpaIntercept = 0x80000001,
/* Memory access messages. */
/* Timer notification messages. */
HvMessageTypeUnmappedGpa = 0x80000000, HvMessageTimerExpired = 0x80000010,
HvMessageTypeGpaIntercept = 0x80000001,
/* Error messages. */
HvMessageTypeInvalidVpRegisterValue = 0x80000020,
/* Timer notification messages. */ HvMessageTypeUnrecoverableException = 0x80000021,
HvMessageTypeUnsupportedFeature = 0x80000022,
HvMessageTimerExpired = 0x80000010,
/* Trace buffer complete messages. */
HvMessageTypeEventLogBufferComplete = 0x80000040,
/* Error messages. */
/* Platform-specific processor intercept messages. */
HvMessageTypeInvalidVpRegisterValue = 0x80000020, HvMessageTypeX64IoPortIntercept = 0x80010000,
HvMessageTypeUnrecoverableException = 0x80000021, HvMessageTypeX64MsrIntercept = 0x80010001,
HvMessageTypeUnsupportedFeature = 0x80000022, HvMessageTypeX64CpuidIntercept = 0x80010002,
HvMessageTypeX64ExceptionIntercept = 0x80010003,
HvMessageTypeX64ApicEoi = 0x80010004,
/* Trace buffer complete messages. */ HvMessageTypeX64LegacyFpError = 0x80010005
HvMessageTypeEventLogBufferComplete = 0x80000040,
/* Platform-specific processor intercept messages. */
HvMessageTypeX64IoPortIntercept = 0x80010000,
HvMessageTypeX64MsrIntercept = 0x80010001,
HvMessageTypeX64CpuidIntercept = 0x80010002,
HvMessageTypeX64ExceptionIntercept = 0x80010003,
HvMessageTypeX64ApicEoi = 0x80010004,
HvMessageTypeX64LegacyFpError = 0x80010005
} HV_MESSAGE_TYPE, *PHV_MESSAGE_TYPE; } HV_MESSAGE_TYPE, *PHV_MESSAGE_TYPE;
/* Define the number of synthetic interrupt sources. */ /* Define the number of synthetic interrupt sources. */
#define HV_SYNIC_SINT_COUNT (16)
#define HV_SYNIC_STIMER_COUNT (4)
#define HV_SYNIC_SINT_COUNT (16)
#define HV_SYNIC_STIMER_COUNT (4)
/* Define the synthetic interrupt source index type. */ /* Define the synthetic interrupt source index type. */
typedef u32 HV_SYNIC_SINT_INDEX, *PHV_SYNIC_SINT_INDEX; typedef u32 HV_SYNIC_SINT_INDEX, *PHV_SYNIC_SINT_INDEX;
/* Define partition identifier type. */ /* Define partition identifier type. */
typedef u64 HV_PARTITION_ID, *PHV_PARTITION_ID; typedef u64 HV_PARTITION_ID, *PHV_PARTITION_ID;
/* Define invalid partition identifier. */ /* Define invalid partition identifier. */
#define HV_PARTITION_ID_INVALID ((HV_PARTITION_ID) 0x0)
#define HV_PARTITION_ID_INVALID ((HV_PARTITION_ID) 0x0)
/* Define connection identifier type. */ /* Define connection identifier type. */
typedef union _HV_CONNECTION_ID {
u32 Asu32;
typedef union _HV_CONNECTION_ID struct {
{ u32 Id:24;
u32 Asu32; u32 Reserved:8;
} u;
struct
{
u32 Id:24;
u32 Reserved:8;
} u;
} HV_CONNECTION_ID, *PHV_CONNECTION_ID; } HV_CONNECTION_ID, *PHV_CONNECTION_ID;
/* Define port identifier type. */ /* Define port identifier type. */
typedef union _HV_PORT_ID {
u32 Asu32;
typedef union _HV_PORT_ID struct {
{ u32 Id:24;
u32 Asu32; u32 Reserved:8;
} u ;
struct
{
u32 Id:24;
u32 Reserved:8;
} u ;
} HV_PORT_ID, *PHV_PORT_ID; } HV_PORT_ID, *PHV_PORT_ID;
/* Define port type. */ /* Define port type. */
typedef enum _HV_PORT_TYPE {
HvPortTypeMessage = 1,
typedef enum _HV_PORT_TYPE HvPortTypeEvent = 2,
{ HvPortTypeMonitor = 3
HvPortTypeMessage = 1,
HvPortTypeEvent = 2,
HvPortTypeMonitor = 3
} HV_PORT_TYPE, *PHV_PORT_TYPE; } HV_PORT_TYPE, *PHV_PORT_TYPE;
/* Define port information structure. */ /* Define port information structure. */
typedef struct _HV_PORT_INFO {
HV_PORT_TYPE PortType;
typedef struct _HV_PORT_INFO u32 Padding;
{ union {
HV_PORT_TYPE PortType; struct {
u32 Padding; HV_SYNIC_SINT_INDEX TargetSint;
u32 TargetVp;
union u64 RsvdZ;
{ } MessagePortInfo;
struct struct {
{ HV_SYNIC_SINT_INDEX TargetSint;
HV_SYNIC_SINT_INDEX TargetSint; u32 TargetVp;
u32 TargetVp; u16 BaseFlagNumber;
u64 RsvdZ; u16 FlagCount;
} MessagePortInfo; u32 RsvdZ;
} EventPortInfo;
struct struct {
{ u64 MonitorAddress;
HV_SYNIC_SINT_INDEX TargetSint; u64 RsvdZ;
u32 TargetVp; } MonitorPortInfo;
u16 BaseFlagNumber; };
u16 FlagCount;
u32 RsvdZ;
} EventPortInfo;
struct
{
u64 MonitorAddress;
u64 RsvdZ;
} MonitorPortInfo;
};
} HV_PORT_INFO, *PHV_PORT_INFO; } HV_PORT_INFO, *PHV_PORT_INFO;
typedef const HV_PORT_INFO *PCHV_PORT_INFO; typedef const HV_PORT_INFO *PCHV_PORT_INFO;
typedef struct _HV_CONNECTION_INFO typedef struct _HV_CONNECTION_INFO {
{ HV_PORT_TYPE PortType;
HV_PORT_TYPE PortType; u32 Padding;
u32 Padding; union {
struct {
union u64 RsvdZ;
{ } MessageConnectionInfo;
struct struct {
{ u64 RsvdZ;
u64 RsvdZ; } EventConnectionInfo;
} MessageConnectionInfo; struct {
u64 MonitorAddress;
struct } MonitorConnectionInfo;
{ };
u64 RsvdZ;
} EventConnectionInfo;
struct
{
u64 MonitorAddress;
} MonitorConnectionInfo;
};
} HV_CONNECTION_INFO, *PHV_CONNECTION_INFO; } HV_CONNECTION_INFO, *PHV_CONNECTION_INFO;
typedef const HV_CONNECTION_INFO *PCHV_CONNECTION_INFO; typedef const HV_CONNECTION_INFO *PCHV_CONNECTION_INFO;
/* Define synthetic interrupt controller message flags. */ /* Define synthetic interrupt controller message flags. */
typedef union _HV_MESSAGE_FLAGS {
u8 Asu8;
typedef union _HV_MESSAGE_FLAGS struct {
{ u8 MessagePending:1;
u8 Asu8; u8 Reserved:7;
struct };
{
u8 MessagePending:1;
u8 Reserved:7;
};
} HV_MESSAGE_FLAGS, *PHV_MESSAGE_FLAGS; } HV_MESSAGE_FLAGS, *PHV_MESSAGE_FLAGS;
/* Define synthetic interrupt controller message header. */ /* Define synthetic interrupt controller message header. */
typedef struct _HV_MESSAGE_HEADER {
HV_MESSAGE_TYPE MessageType;
typedef struct _HV_MESSAGE_HEADER u8 PayloadSize;
{ HV_MESSAGE_FLAGS MessageFlags;
HV_MESSAGE_TYPE MessageType; u8 Reserved[2];
u8 PayloadSize; union {
HV_MESSAGE_FLAGS MessageFlags; HV_PARTITION_ID Sender;
u8 Reserved[2]; HV_PORT_ID Port;
union };
{
HV_PARTITION_ID Sender;
HV_PORT_ID Port;
};
} HV_MESSAGE_HEADER, *PHV_MESSAGE_HEADER; } HV_MESSAGE_HEADER, *PHV_MESSAGE_HEADER;
/* Define timer message payload structure. */ /* Define timer message payload structure. */
typedef struct _HV_TIMER_MESSAGE_PAYLOAD {
typedef struct _HV_TIMER_MESSAGE_PAYLOAD u32 TimerIndex;
{ u32 Reserved;
u32 TimerIndex; u64 ExpirationTime; /* When the timer expired */
u32 Reserved; u64 DeliveryTime; /* When the message was delivered */
u64 ExpirationTime; /* When the timer expired */
u64 DeliveryTime; /* When the message was delivered */
} HV_TIMER_MESSAGE_PAYLOAD, *PHV_TIMER_MESSAGE_PAYLOAD; } HV_TIMER_MESSAGE_PAYLOAD, *PHV_TIMER_MESSAGE_PAYLOAD;
/* Define synthetic interrupt controller message format. */ /* Define synthetic interrupt controller message format. */
typedef struct _HV_MESSAGE {
HV_MESSAGE_HEADER Header;
typedef struct _HV_MESSAGE union {
{ u64 Payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT];
HV_MESSAGE_HEADER Header; } u ;
union
{
u64 Payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT];
} u ;
} HV_MESSAGE, *PHV_MESSAGE; } HV_MESSAGE, *PHV_MESSAGE;
/* Define the number of message buffers associated with each port. */ /* Define the number of message buffers associated with each port. */
#define HV_PORT_MESSAGE_BUFFER_COUNT (16)
#define HV_PORT_MESSAGE_BUFFER_COUNT (16)
/* Define the synthetic interrupt message page layout. */ /* Define the synthetic interrupt message page layout. */
typedef struct _HV_MESSAGE_PAGE {
volatile HV_MESSAGE SintMessage[HV_SYNIC_SINT_COUNT];
typedef struct _HV_MESSAGE_PAGE
{
volatile HV_MESSAGE SintMessage[HV_SYNIC_SINT_COUNT];
} HV_MESSAGE_PAGE, *PHV_MESSAGE_PAGE; } HV_MESSAGE_PAGE, *PHV_MESSAGE_PAGE;
/* Define the synthetic interrupt controller event flags format. */ /* Define the synthetic interrupt controller event flags format. */
typedef union _HV_SYNIC_EVENT_FLAGS {
u8 Flags8[HV_EVENT_FLAGS_BYTE_COUNT];
typedef union _HV_SYNIC_EVENT_FLAGS u32 Flags32[HV_EVENT_FLAGS_DWORD_COUNT];
{
u8 Flags8[HV_EVENT_FLAGS_BYTE_COUNT];
u32 Flags32[HV_EVENT_FLAGS_DWORD_COUNT];
} HV_SYNIC_EVENT_FLAGS, *PHV_SYNIC_EVENT_FLAGS; } HV_SYNIC_EVENT_FLAGS, *PHV_SYNIC_EVENT_FLAGS;
/* Define the synthetic interrupt flags page layout. */ /* Define the synthetic interrupt flags page layout. */
typedef struct _HV_SYNIC_EVENT_FLAGS_PAGE {
volatile HV_SYNIC_EVENT_FLAGS SintEventFlags[HV_SYNIC_SINT_COUNT];
typedef struct _HV_SYNIC_EVENT_FLAGS_PAGE
{
volatile HV_SYNIC_EVENT_FLAGS SintEventFlags[HV_SYNIC_SINT_COUNT];
} HV_SYNIC_EVENT_FLAGS_PAGE, *PHV_SYNIC_EVENT_FLAGS_PAGE; } HV_SYNIC_EVENT_FLAGS_PAGE, *PHV_SYNIC_EVENT_FLAGS_PAGE;
/* Define SynIC control register. */ /* Define SynIC control register. */
typedef union _HV_SYNIC_SCONTROL {
typedef union _HV_SYNIC_SCONTROL u64 AsUINT64;
{ struct {
u64 AsUINT64; u64 Enable:1;
struct u64 Reserved:63;
{ };
u64 Enable:1;
u64 Reserved:63;
};
} HV_SYNIC_SCONTROL, *PHV_SYNIC_SCONTROL; } HV_SYNIC_SCONTROL, *PHV_SYNIC_SCONTROL;
/* Define synthetic interrupt source. */ /* Define synthetic interrupt source. */
typedef union _HV_SYNIC_SINT {
u64 AsUINT64;
typedef union _HV_SYNIC_SINT struct {
{ u64 Vector:8;
u64 AsUINT64; u64 Reserved1:8;
struct u64 Masked:1;
{ u64 AutoEoi:1;
u64 Vector :8; u64 Reserved2:46;
u64 Reserved1 :8; };
u64 Masked :1;
u64 AutoEoi :1;
u64 Reserved2 :46;
};
} HV_SYNIC_SINT, *PHV_SYNIC_SINT; } HV_SYNIC_SINT, *PHV_SYNIC_SINT;
/* Define the format of the SIMP register */ /* Define the format of the SIMP register */
typedef union _HV_SYNIC_SIMP {
u64 AsUINT64;
typedef union _HV_SYNIC_SIMP struct {
{ u64 SimpEnabled:1;
u64 AsUINT64; u64 Preserved:11;
struct u64 BaseSimpGpa:52;
{ };
u64 SimpEnabled : 1;
u64 Preserved : 11;
u64 BaseSimpGpa : 52;
};
} HV_SYNIC_SIMP, *PHV_SYNIC_SIMP; } HV_SYNIC_SIMP, *PHV_SYNIC_SIMP;
/* Define the format of the SIEFP register */ /* Define the format of the SIEFP register */
typedef union _HV_SYNIC_SIEFP {
u64 AsUINT64;
typedef union _HV_SYNIC_SIEFP struct {
{ u64 SiefpEnabled:1;
u64 AsUINT64; u64 Preserved:11;
struct u64 BaseSiefpGpa:52;
{ };
u64 SiefpEnabled : 1;
u64 Preserved : 11;
u64 BaseSiefpGpa : 52;
};
} HV_SYNIC_SIEFP, *PHV_SYNIC_SIEFP; } HV_SYNIC_SIEFP, *PHV_SYNIC_SIEFP;
/* Definitions for the monitored notification facility */ /* Definitions for the monitored notification facility */
typedef union _HV_MONITOR_TRIGGER_GROUP {
u64 AsUINT64;
typedef union _HV_MONITOR_TRIGGER_GROUP struct {
{ u32 Pending;
u64 AsUINT64; u32 Armed;
};
struct
{
u32 Pending;
u32 Armed;
};
} HV_MONITOR_TRIGGER_GROUP, *PHV_MONITOR_TRIGGER_GROUP; } HV_MONITOR_TRIGGER_GROUP, *PHV_MONITOR_TRIGGER_GROUP;
typedef struct _HV_MONITOR_PARAMETER typedef struct _HV_MONITOR_PARAMETER {
{ HV_CONNECTION_ID ConnectionId;
HV_CONNECTION_ID ConnectionId; u16 FlagNumber;
u16 FlagNumber; u16 RsvdZ;
u16 RsvdZ;
} HV_MONITOR_PARAMETER, *PHV_MONITOR_PARAMETER; } HV_MONITOR_PARAMETER, *PHV_MONITOR_PARAMETER;
typedef union _HV_MONITOR_TRIGGER_STATE typedef union _HV_MONITOR_TRIGGER_STATE {
{ u32 Asu32;
u32 Asu32;
struct
{
u32 GroupEnable : 4;
u32 RsvdZ : 28;
};
struct {
u32 GroupEnable:4;
u32 RsvdZ:28;
};
} HV_MONITOR_TRIGGER_STATE, *PHV_MONITOR_TRIGGER_STATE; } HV_MONITOR_TRIGGER_STATE, *PHV_MONITOR_TRIGGER_STATE;
/* HV_MONITOR_PAGE Layout */ /* HV_MONITOR_PAGE Layout */
/* ------------------------------------------------------ */ /* ------------------------------------------------------ */
/* | 0 | TriggerState (4 bytes) | Rsvd1 (4 bytes) | */ /* | 0 | TriggerState (4 bytes) | Rsvd1 (4 bytes) | */
...@@ -467,24 +319,22 @@ typedef union _HV_MONITOR_TRIGGER_STATE ...@@ -467,24 +319,22 @@ typedef union _HV_MONITOR_TRIGGER_STATE
/* | ... | */ /* | ... | */
/* | 840 | Rsvd4[0] | */ /* | 840 | Rsvd4[0] | */
/* ------------------------------------------------------ */ /* ------------------------------------------------------ */
typedef struct _HV_MONITOR_PAGE {
HV_MONITOR_TRIGGER_STATE TriggerState;
u32 RsvdZ1;
typedef struct _HV_MONITOR_PAGE HV_MONITOR_TRIGGER_GROUP TriggerGroup[4];
{ u64 RsvdZ2[3];
HV_MONITOR_TRIGGER_STATE TriggerState;
u32 RsvdZ1;
HV_MONITOR_TRIGGER_GROUP TriggerGroup[4];
u64 RsvdZ2[3];
s32 NextCheckTime[4][32]; s32 NextCheckTime[4][32];
u16 Latency[4][32]; u16 Latency[4][32];
u64 RsvdZ3[32]; u64 RsvdZ3[32];
HV_MONITOR_PARAMETER Parameter[4][32]; HV_MONITOR_PARAMETER Parameter[4][32];
u8 RsvdZ4[1984];
u8 RsvdZ4[1984];
} HV_MONITOR_PAGE, *PHV_MONITOR_PAGE; } HV_MONITOR_PAGE, *PHV_MONITOR_PAGE;
typedef volatile HV_MONITOR_PAGE* PVHV_MONITOR_PAGE; typedef volatile HV_MONITOR_PAGE* PVHV_MONITOR_PAGE;
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment