Skip to content

Commit 5e4e6dd

Browse files
kelleymhliuw
authored andcommitted
x86/hyper-v: Move hv_message_type to architecture neutral module
The definition of enum hv_message_type includes arch neutral and x86/x64-specific values. Ideally there would be a way to put the arch neutral values in an arch neutral module, and the arch specific values in an arch specific module. But C doesn't provide a way to extend enum types. As a compromise, move the entire definition into an arch neutral module, to avoid duplicating the arch neutral values for x86/x64 and for ARM64. No functional change. Signed-off-by: Michael Kelley <mikelley@microsoft.com> Reviewed-by: Boqun Feng <boqun.feng@gmail.com> Link: https://lore.kernel.org/r/1614721102-2241-3-git-send-email-mikelley@microsoft.com Signed-off-by: Wei Liu <wei.liu@kernel.org>
1 parent ca48739 commit 5e4e6dd

2 files changed

Lines changed: 35 additions & 29 deletions

File tree

‎arch/x86/include/asm/hyperv-tlfs.h‎

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -288,35 +288,6 @@ struct hv_tsc_emulation_status {
288288
#define HV_X64_MSR_TSC_REFERENCE_ENABLE 0x00000001
289289
#define HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT 12
290290

291-
292-
/* Define hypervisor message types. */
293-
enum hv_message_type {
294-
HVMSG_NONE = 0x00000000,
295-
296-
/* Memory access messages. */
297-
HVMSG_UNMAPPED_GPA = 0x80000000,
298-
HVMSG_GPA_INTERCEPT = 0x80000001,
299-
300-
/* Timer notification messages. */
301-
HVMSG_TIMER_EXPIRED = 0x80000010,
302-
303-
/* Error messages. */
304-
HVMSG_INVALID_VP_REGISTER_VALUE = 0x80000020,
305-
HVMSG_UNRECOVERABLE_EXCEPTION = 0x80000021,
306-
HVMSG_UNSUPPORTED_FEATURE = 0x80000022,
307-
308-
/* Trace buffer complete messages. */
309-
HVMSG_EVENTLOG_BUFFERCOMPLETE = 0x80000040,
310-
311-
/* Platform-specific processor intercept messages. */
312-
HVMSG_X64_IOPORT_INTERCEPT = 0x80010000,
313-
HVMSG_X64_MSR_INTERCEPT = 0x80010001,
314-
HVMSG_X64_CPUID_INTERCEPT = 0x80010002,
315-
HVMSG_X64_EXCEPTION_INTERCEPT = 0x80010003,
316-
HVMSG_X64_APIC_EOI = 0x80010004,
317-
HVMSG_X64_LEGACY_FP_ERROR = 0x80010005
318-
};
319-
320291
struct hv_nested_enlightenments_control {
321292
struct {
322293
__u32 directhypercall:1;

‎include/asm-generic/hyperv-tlfs.h‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,41 @@ enum HV_GENERIC_SET_FORMAT {
220220
#define HV_MESSAGE_PAYLOAD_BYTE_COUNT (240)
221221
#define HV_MESSAGE_PAYLOAD_QWORD_COUNT (30)
222222

223+
/*
224+
* Define hypervisor message types. Some of the message types
225+
* are x86/x64 specific, but there's no good way to separate
226+
* them out into the arch-specific version of hyperv-tlfs.h
227+
* because C doesn't provide a way to extend enum types.
228+
* Keeping them all in the arch neutral hyperv-tlfs.h seems
229+
* the least messy compromise.
230+
*/
231+
enum hv_message_type {
232+
HVMSG_NONE = 0x00000000,
233+
234+
/* Memory access messages. */
235+
HVMSG_UNMAPPED_GPA = 0x80000000,
236+
HVMSG_GPA_INTERCEPT = 0x80000001,
237+
238+
/* Timer notification messages. */
239+
HVMSG_TIMER_EXPIRED = 0x80000010,
240+
241+
/* Error messages. */
242+
HVMSG_INVALID_VP_REGISTER_VALUE = 0x80000020,
243+
HVMSG_UNRECOVERABLE_EXCEPTION = 0x80000021,
244+
HVMSG_UNSUPPORTED_FEATURE = 0x80000022,
245+
246+
/* Trace buffer complete messages. */
247+
HVMSG_EVENTLOG_BUFFERCOMPLETE = 0x80000040,
248+
249+
/* Platform-specific processor intercept messages. */
250+
HVMSG_X64_IOPORT_INTERCEPT = 0x80010000,
251+
HVMSG_X64_MSR_INTERCEPT = 0x80010001,
252+
HVMSG_X64_CPUID_INTERCEPT = 0x80010002,
253+
HVMSG_X64_EXCEPTION_INTERCEPT = 0x80010003,
254+
HVMSG_X64_APIC_EOI = 0x80010004,
255+
HVMSG_X64_LEGACY_FP_ERROR = 0x80010005
256+
};
257+
223258
/* Define synthetic interrupt controller message flags. */
224259
union hv_message_flags {
225260
__u8 asu8;

0 commit comments

Comments
 (0)