x86/hyper-v: move synic/stimer control structures definitions to hyperv-tlfs.h
authorVitaly Kuznetsov <vkuznets@redhat.com>
Mon, 26 Nov 2018 15:47:29 +0000 (16:47 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 14 Dec 2018 16:59:56 +0000 (17:59 +0100)
We implement Hyper-V SynIC and synthetic timers in KVM too so there's some
room for code sharing.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/hyperv-tlfs.h
drivers/hv/hv.c
drivers/hv/hyperv_vmbus.h

index 098daf81d9e99da8fcf3a16da537ff3134ad7535..ce438d49a1928abfacfc1af417b4865dbc393915 100644 (file)
@@ -729,6 +729,75 @@ struct hv_enlightened_vmcs {
 #define HV_STIMER_AUTOENABLE           (1ULL << 3)
 #define HV_STIMER_SINT(config)         (__u8)(((config) >> 16) & 0x0F)
 
+/* Define synthetic interrupt controller flag constants. */
+#define HV_EVENT_FLAGS_COUNT           (256 * 8)
+#define HV_EVENT_FLAGS_LONG_COUNT      (256 / sizeof(unsigned long))
+
+/*
+ * Synthetic timer configuration.
+ */
+union hv_stimer_config {
+       u64 as_uint64;
+       struct {
+               u64 enable:1;
+               u64 periodic:1;
+               u64 lazy:1;
+               u64 auto_enable:1;
+               u64 apic_vector:8;
+               u64 direct_mode:1;
+               u64 reserved_z0:3;
+               u64 sintx:4;
+               u64 reserved_z1:44;
+       } __packed;
+};
+
+
+/* Define the synthetic interrupt controller event flags format. */
+union hv_synic_event_flags {
+       unsigned long flags[HV_EVENT_FLAGS_LONG_COUNT];
+};
+
+/* Define SynIC control register. */
+union hv_synic_scontrol {
+       u64 as_uint64;
+       struct {
+               u64 enable:1;
+               u64 reserved:63;
+       } __packed;
+};
+
+/* Define synthetic interrupt source. */
+union hv_synic_sint {
+       u64 as_uint64;
+       struct {
+               u64 vector:8;
+               u64 reserved1:8;
+               u64 masked:1;
+               u64 auto_eoi:1;
+               u64 reserved2:46;
+       } __packed;
+};
+
+/* Define the format of the SIMP register */
+union hv_synic_simp {
+       u64 as_uint64;
+       struct {
+               u64 simp_enabled:1;
+               u64 preserved:11;
+               u64 base_simp_gpa:52;
+       } __packed;
+};
+
+/* Define the format of the SIEFP register */
+union hv_synic_siefp {
+       u64 as_uint64;
+       struct {
+               u64 siefp_enabled:1;
+               u64 preserved:11;
+               u64 base_siefp_gpa:52;
+       } __packed;
+};
+
 struct hv_vpset {
        u64 format;
        u64 valid_bank_mask;
index 332d7c34be5ceb73adfc7be889354aaf4428613d..11273cd384d6dd75d135e2faea1b115dfdf19a4d 100644 (file)
@@ -143,7 +143,7 @@ static int hv_ce_shutdown(struct clock_event_device *evt)
 
 static int hv_ce_set_oneshot(struct clock_event_device *evt)
 {
-       union hv_timer_config timer_cfg;
+       union hv_stimer_config timer_cfg;
 
        timer_cfg.as_uint64 = 0;
        timer_cfg.enable = 1;
index 87d3d7da78f876198e0a160f3c39b60044fbcad4..ea201034b248add6a7b7d79055ac27ee865e4ac9 100644 (file)
  */
 #define HV_UTIL_NEGO_TIMEOUT 55
 
-/* Define synthetic interrupt controller flag constants. */
-#define HV_EVENT_FLAGS_COUNT           (256 * 8)
-#define HV_EVENT_FLAGS_LONG_COUNT      (256 / sizeof(unsigned long))
-
-/*
- * Timer configuration register.
- */
-union hv_timer_config {
-       u64 as_uint64;
-       struct {
-               u64 enable:1;
-               u64 periodic:1;
-               u64 lazy:1;
-               u64 auto_enable:1;
-               u64 apic_vector:8;
-               u64 direct_mode:1;
-               u64 reserved_z0:3;
-               u64 sintx:4;
-               u64 reserved_z1:44;
-       };
-};
-
-
-/* Define the synthetic interrupt controller event flags format. */
-union hv_synic_event_flags {
-       unsigned long flags[HV_EVENT_FLAGS_LONG_COUNT];
-};
-
-/* Define SynIC control register. */
-union hv_synic_scontrol {
-       u64 as_uint64;
-       struct {
-               u64 enable:1;
-               u64 reserved:63;
-       };
-};
-
-/* Define synthetic interrupt source. */
-union hv_synic_sint {
-       u64 as_uint64;
-       struct {
-               u64 vector:8;
-               u64 reserved1:8;
-               u64 masked:1;
-               u64 auto_eoi:1;
-               u64 reserved2:46;
-       };
-};
-
-/* Define the format of the SIMP register */
-union hv_synic_simp {
-       u64 as_uint64;
-       struct {
-               u64 simp_enabled:1;
-               u64 preserved:11;
-               u64 base_simp_gpa:52;
-       };
-};
-
-/* Define the format of the SIEFP register */
-union hv_synic_siefp {
-       u64 as_uint64;
-       struct {
-               u64 siefp_enabled:1;
-               u64 preserved:11;
-               u64 base_siefp_gpa:52;
-       };
-};
 
 /* Definitions for the monitored notification facility */
 union hv_monitor_trigger_group {