svn commit: r300988 - head/sys/dev/hyperv/vmbus

Sepherosa Ziehau sephe at FreeBSD.org
Mon May 30 08:42:36 UTC 2016


Author: sephe
Date: Mon May 30 08:42:35 2016
New Revision: 300988
URL: https://svnweb.freebsd.org/changeset/base/300988

Log:
  hyperv/vmbus: Move SINT settings to vmbus_var.h
  
  While I'm here remove the event timer's dependency on hv_vmbus_priv.h
  
  MFC after:	1 week
  Sponsored by:	Microsoft OSTC
  Differential Revision:	https://reviews.freebsd.org/D6574

Modified:
  head/sys/dev/hyperv/vmbus/hv_connection.c
  head/sys/dev/hyperv/vmbus/hv_et.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
  head/sys/dev/hyperv/vmbus/vmbus_var.h

Modified: head/sys/dev/hyperv/vmbus/hv_connection.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_connection.c	Mon May 30 08:25:09 2016	(r300987)
+++ head/sys/dev/hyperv/vmbus/hv_connection.c	Mon May 30 08:42:35 2016	(r300988)
@@ -337,7 +337,7 @@ vmbus_event_proc(struct vmbus_softc *sc,
 	 * On Host with Win8 or above, the event page can be checked directly
 	 * to get the id of the channel that has the pending interrupt.
 	 */
-	event = VMBUS_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT;
+	event = VMBUS_PCPU_GET(sc, event_flag, cpu) + VMBUS_SINT_MESSAGE;
 	vmbus_event_flags_proc(event->flagsul,
 	    VMBUS_PCPU_GET(sc, event_flag_cnt, cpu));
 }
@@ -347,7 +347,7 @@ vmbus_event_proc_compat(struct vmbus_sof
 {
 	hv_vmbus_synic_event_flags *event;
 
-	event = VMBUS_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT;
+	event = VMBUS_PCPU_GET(sc, event_flag, cpu) + VMBUS_SINT_MESSAGE;
 	if (atomic_testandclear_int(&event->flags32[0], 0)) {
 		vmbus_event_flags_proc(
 		    hv_vmbus_g_connection.recv_interrupt_page,

Modified: head/sys/dev/hyperv/vmbus/hv_et.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_et.c	Mon May 30 08:25:09 2016	(r300987)
+++ head/sys/dev/hyperv/vmbus/hv_et.c	Mon May 30 08:42:35 2016	(r300988)
@@ -37,16 +37,16 @@ __FBSDID("$FreeBSD$");
 #include <sys/time.h>
 #include <sys/timeet.h>
 
-#include <dev/hyperv/vmbus/hv_vmbus_priv.h>
 #include <dev/hyperv/vmbus/hyperv_reg.h>
 #include <dev/hyperv/vmbus/hyperv_var.h>
+#include <dev/hyperv/vmbus/vmbus_var.h>
 
 #define HV_TIMER_FREQUENCY		(10 * 1000 * 1000LL) /* 100ns period */
 #define HV_MAX_DELTA_TICKS		0xffffffffLL
 #define HV_MIN_DELTA_TICKS		1LL
 
 #define MSR_HV_STIMER0_CFG_SINT		\
-	((((uint64_t)HV_VMBUS_TIMER_SINT) << MSR_HV_STIMER_CFG_SINT_SHIFT) & \
+	((((uint64_t)VMBUS_SINT_TIMER) << MSR_HV_STIMER_CFG_SINT_SHIFT) & \
 	 MSR_HV_STIMER_CFG_SINT_MASK)
 
 /*
@@ -83,7 +83,7 @@ hv_et_start(struct eventtimer *et, sbint
 }
 
 void
-hv_et_intr(struct trapframe *frame)
+vmbus_et_intr(struct trapframe *frame)
 {
 	struct trapframe *oldframe;
 	struct thread *td;

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c	Mon May 30 08:25:09 2016	(r300987)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c	Mon May 30 08:42:35 2016	(r300988)
@@ -80,7 +80,7 @@ vmbus_msg_task(void *xsc, int pending __
 	struct vmbus_softc *sc = xsc;
 	hv_vmbus_message *msg;
 
-	msg = VMBUS_PCPU_GET(sc, message, curcpu) + HV_VMBUS_MESSAGE_SINT;
+	msg = VMBUS_PCPU_GET(sc, message, curcpu) + VMBUS_SINT_MESSAGE;
 	for (;;) {
 		const hv_vmbus_channel_msg_table_entry *entry;
 		hv_vmbus_channel_msg_header *hdr;
@@ -144,14 +144,14 @@ hv_vmbus_isr(struct vmbus_softc *sc, str
 
 	/* Check if there are actual msgs to be process */
 	msg_base = VMBUS_PCPU_GET(sc, message, cpu);
-	msg = msg_base + HV_VMBUS_TIMER_SINT;
 
 	/* we call eventtimer process the message */
+	msg = msg_base + VMBUS_SINT_TIMER;
 	if (msg->header.message_type == HV_MESSAGE_TIMER_EXPIRED) {
 		msg->header.message_type = HV_MESSAGE_TYPE_NONE;
 
 		/* call intrrupt handler of event timer */
-		hv_et_intr(frame);
+		vmbus_et_intr(frame);
 
 		/*
 		 * Make sure the write to message_type (ie set to
@@ -175,7 +175,7 @@ hv_vmbus_isr(struct vmbus_softc *sc, str
 		}
 	}
 
-	msg = msg_base + HV_VMBUS_MESSAGE_SINT;
+	msg = msg_base + VMBUS_SINT_MESSAGE;
 	if (msg->header.message_type != HV_MESSAGE_TYPE_NONE) {
 		taskqueue_enqueue(VMBUS_PCPU_GET(sc, message_tq, cpu),
 		    VMBUS_PCPU_PTR(sc, message_task, cpu));
@@ -254,7 +254,7 @@ vmbus_synic_setup(void *xsc)
 	/*
 	 * Configure and unmask SINT for message and event flags.
 	 */
-	sint = MSR_HV_SINT0 + HV_VMBUS_MESSAGE_SINT;
+	sint = MSR_HV_SINT0 + VMBUS_SINT_MESSAGE;
 	orig = rdmsr(sint);
 	val = sc->vmbus_idtvec | MSR_HV_SINT_AUTOEOI |
 	    (orig & MSR_HV_SINT_RSVD_MASK);
@@ -263,7 +263,7 @@ vmbus_synic_setup(void *xsc)
 	/*
 	 * Configure and unmask SINT for timer.
 	 */
-	sint = MSR_HV_SINT0 + HV_VMBUS_TIMER_SINT;
+	sint = MSR_HV_SINT0 + VMBUS_SINT_TIMER;
 	orig = rdmsr(sint);
 	val = sc->vmbus_idtvec | MSR_HV_SINT_AUTOEOI |
 	    (orig & MSR_HV_SINT_RSVD_MASK);
@@ -292,14 +292,14 @@ vmbus_synic_teardown(void *arg)
 	/*
 	 * Mask message and event flags SINT.
 	 */
-	sint = MSR_HV_SINT0 + HV_VMBUS_MESSAGE_SINT;
+	sint = MSR_HV_SINT0 + VMBUS_SINT_MESSAGE;
 	orig = rdmsr(sint);
 	wrmsr(sint, orig | MSR_HV_SINT_MASKED);
 
 	/*
 	 * Mask timer SINT.
 	 */
-	sint = MSR_HV_SINT0 + HV_VMBUS_TIMER_SINT;
+	sint = MSR_HV_SINT0 + VMBUS_SINT_TIMER;
 	orig = rdmsr(sint);
 	wrmsr(sint, orig | MSR_HV_SINT_MASKED);
 

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h	Mon May 30 08:25:09 2016	(r300987)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h	Mon May 30 08:42:35 2016	(r300988)
@@ -189,8 +189,6 @@ enum {
 	HV_VMBUS_EVENT_PORT_ID		= 2,
 	HV_VMBUS_MONITOR_CONNECTION_ID	= 3,
 	HV_VMBUS_MONITOR_PORT_ID	= 3,
-	HV_VMBUS_MESSAGE_SINT		= 2,
-	HV_VMBUS_TIMER_SINT		= 4,
 };
 
 #define HV_PRESENT_BIT		0x80000000
@@ -542,12 +540,6 @@ int			hv_vmbus_disconnect(void);
 int			hv_vmbus_post_message(void *buffer, size_t buf_size);
 int			hv_vmbus_set_event(hv_vmbus_channel *channel);
 
-/**
- * Event Timer interfaces
- */
-void			hv_et_init(void);
-void			hv_et_intr(struct trapframe*);
-
 /* Wait for device creation */
 void			vmbus_scan(void);
 

Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h
==============================================================================
--- head/sys/dev/hyperv/vmbus/vmbus_var.h	Mon May 30 08:25:09 2016	(r300987)
+++ head/sys/dev/hyperv/vmbus/vmbus_var.h	Mon May 30 08:42:35 2016	(r300988)
@@ -31,8 +31,21 @@
 
 #include <sys/param.h>
 #include <sys/bus_dma.h>
+#include <sys/taskqueue.h>
+
 #include <dev/hyperv/include/hyperv_busdma.h>
 
+/*
+ * NOTE: DO NOT CHANGE THIS.
+ */
+#define VMBUS_SINT_MESSAGE	2
+/*
+ * NOTE:
+ * - DO NOT set it to the same value as VMBUS_SINT_MESSAGE.
+ * - DO NOT set it to 0.
+ */
+#define VMBUS_SINT_TIMER	4
+
 struct vmbus_pcpu_data {
 	u_long			*intr_cnt;	/* Hyper-V interrupt counter */
 	struct vmbus_message	*message;	/* shared messages */
@@ -78,8 +91,13 @@ vmbus_get_device(void)
 #define VMBUS_PCPU_GET(sc, field, cpu)	(sc)->vmbus_pcpu[(cpu)].field
 #define VMBUS_PCPU_PTR(sc, field, cpu)	&(sc)->vmbus_pcpu[(cpu)].field
 
+struct hv_vmbus_channel;
+struct trapframe;
+
 void	vmbus_on_channel_open(const struct hv_vmbus_channel *);
 void	vmbus_event_proc(struct vmbus_softc *, int);
 void	vmbus_event_proc_compat(struct vmbus_softc *, int);
 
+void	vmbus_et_intr(struct trapframe *);
+
 #endif	/* !_VMBUS_VAR_H_ */


More information about the svn-src-all mailing list