From owner-svn-src-head@freebsd.org Mon May 30 08:42:36 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7236B533B3; Mon, 30 May 2016 08:42:36 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 73E7F182A; Mon, 30 May 2016 08:42:36 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4U8gZuO089348; Mon, 30 May 2016 08:42:35 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4U8gZgE089343; Mon, 30 May 2016 08:42:35 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605300842.u4U8gZgE089343@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 30 May 2016 08:42:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300988 - head/sys/dev/hyperv/vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2016 08:42:36 -0000 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 #include -#include #include #include +#include #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 #include +#include + #include +/* + * 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_ */