Skip to content

Commit 1a6ed31

Browse files
kelleymhtyhicks
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> (cherry picked from commit 5e4e6dd) Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
1 parent e13aaf2 commit 1a6ed31

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
@@ -256,35 +256,6 @@ struct hv_tsc_emulation_status {
256256
#define HV_X64_MSR_TSC_REFERENCE_ENABLE 0x00000001
257257
#define HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT 12
258258

259-
260-
/* Define hypervisor message types. */
261-
enum hv_message_type {
262-
HVMSG_NONE = 0x00000000,
263-
264-
/* Memory access messages. */
265-
HVMSG_UNMAPPED_GPA = 0x80000000,
266-
HVMSG_GPA_INTERCEPT = 0x80000001,
267-
268-
/* Timer notification messages. */
269-
HVMSG_TIMER_EXPIRED = 0x80000010,
270-
271-
/* Error messages. */
272-
HVMSG_INVALID_VP_REGISTER_VALUE = 0x80000020,
273-
HVMSG_UNRECOVERABLE_EXCEPTION = 0x80000021,
274-
HVMSG_UNSUPPORTED_FEATURE = 0x80000022,
275-
276-
/* Trace buffer complete messages. */
277-
HVMSG_EVENTLOG_BUFFERCOMPLETE = 0x80000040,
278-
279-
/* Platform-specific processor intercept messages. */
280-
HVMSG_X64_IOPORT_INTERCEPT = 0x80010000,
281-
HVMSG_X64_MSR_INTERCEPT = 0x80010001,
282-
HVMSG_X64_CPUID_INTERCEPT = 0x80010002,
283-
HVMSG_X64_EXCEPTION_INTERCEPT = 0x80010003,
284-
HVMSG_X64_APIC_EOI = 0x80010004,
285-
HVMSG_X64_LEGACY_FP_ERROR = 0x80010005
286-
};
287-
288259
struct hv_nested_enlightenments_control {
289260
struct {
290261
__u32 directhypercall:1;

include/asm-generic/hyperv-tlfs.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,41 @@ enum HV_GENERIC_SET_FORMAT {
213213
#define HV_MESSAGE_PAYLOAD_BYTE_COUNT (240)
214214
#define HV_MESSAGE_PAYLOAD_QWORD_COUNT (30)
215215

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

0 commit comments

Comments
 (0)