These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / hv / hyperv_vmbus.h
index 887287a..3782636 100644 (file)
@@ -63,9 +63,6 @@ enum hv_cpuid_function {
 /* Define version of the synthetic interrupt controller. */
 #define HV_SYNIC_VERSION               (1)
 
-/* Define the expected SynIC version. */
-#define HV_SYNIC_VERSION_1             (0x1)
-
 /* Define synthetic interrupt controller message constants. */
 #define HV_MESSAGE_SIZE                        (256)
 #define HV_MESSAGE_PAYLOAD_BYTE_COUNT  (240)
@@ -105,8 +102,6 @@ enum hv_message_type {
        HVMSG_X64_LEGACY_FP_ERROR               = 0x80010005
 };
 
-/* Define the number of synthetic interrupt sources. */
-#define HV_SYNIC_SINT_COUNT            (16)
 #define HV_SYNIC_STIMER_COUNT          (4)
 
 /* Define invalid partition identifier. */
@@ -141,7 +136,7 @@ struct hv_port_info {
                struct {
                        u32 target_sint;
                        u32 target_vp;
-                       u16 base_flag_bumber;
+                       u16 base_flag_number;
                        u16 flag_count;
                        u32 rsvdz;
                } event_port_info;
@@ -517,6 +512,7 @@ struct hv_context {
        u64 guestid;
 
        void *hypercall_page;
+       void *tsc_page;
 
        bool synic_initialized;
 
@@ -551,10 +547,23 @@ struct hv_context {
         * Support PV clockevent device.
         */
        struct clock_event_device *clk_evt[NR_CPUS];
+       /*
+        * To manage allocations in a NUMA node.
+        * Array indexed by numa node ID.
+        */
+       struct cpumask *hv_numa_map;
 };
 
 extern struct hv_context hv_context;
 
+struct ms_hyperv_tsc_page {
+       volatile u32 tsc_sequence;
+       u32 reserved1;
+       volatile u64 tsc_scale;
+       volatile s64 tsc_offset;
+       u64 reserved2[509];
+};
+
 struct hv_ring_buffer_debug_info {
        u32 current_interrupt_mask;
        u32 current_read_index;
@@ -647,6 +656,7 @@ struct vmbus_connection {
 
        atomic_t next_gpadl_handle;
 
+       struct completion  unload_event;
        /*
         * Represents channel interrupts. Each bit position represents a
         * channel.  When a channel sends an interrupt via VMBUS, it finds its
@@ -730,9 +740,39 @@ int vmbus_set_event(struct vmbus_channel *channel);
 
 void vmbus_on_event(unsigned long data);
 
+int hv_kvp_init(struct hv_util_service *);
+void hv_kvp_deinit(void);
+void hv_kvp_onchannelcallback(void *);
+
+int hv_vss_init(struct hv_util_service *);
+void hv_vss_deinit(void);
+void hv_vss_onchannelcallback(void *);
+
 int hv_fcopy_init(struct hv_util_service *);
 void hv_fcopy_deinit(void);
 void hv_fcopy_onchannelcallback(void *);
+void vmbus_initiate_unload(void);
 
+static inline void hv_poll_channel(struct vmbus_channel *channel,
+                                  void (*cb)(void *))
+{
+       if (!channel)
+               return;
+
+       if (channel->target_cpu != smp_processor_id())
+               smp_call_function_single(channel->target_cpu,
+                                        cb, channel, true);
+       else
+               cb(channel);
+}
+
+enum hvutil_device_state {
+       HVUTIL_DEVICE_INIT = 0,  /* driver is loaded, waiting for userspace */
+       HVUTIL_READY,            /* userspace is registered */
+       HVUTIL_HOSTMSG_RECEIVED, /* message from the host was received */
+       HVUTIL_USERSPACE_REQ,    /* request to userspace was sent */
+       HVUTIL_USERSPACE_RECV,   /* reply from userspace was received */
+       HVUTIL_DEVICE_DYING,     /* driver unload is in progress */
+};
 
 #endif /* _HYPERV_VMBUS_H */