From owner-svn-src-all@freebsd.org Mon May 23 07:32:36 2016 Return-Path: Delivered-To: svn-src-all@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 79017B463AA; Mon, 23 May 2016 07:32: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 37DCE1E01; Mon, 23 May 2016 07:32: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 u4N7WZvn028805; Mon, 23 May 2016 07:32:35 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4N7WZRG028801; Mon, 23 May 2016 07:32:35 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605230732.u4N7WZRG028801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 23 May 2016 07:32:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300487 - 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-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 07:32:36 -0000 Author: sephe Date: Mon May 23 07:32:34 2016 New Revision: 300487 URL: https://svnweb.freebsd.org/changeset/base/300487 Log: hyperv/vmbus: Move IDT vector to vmbus_softc Prepare to get rid of the hv_setup_arg. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6449 Modified: head/sys/dev/hyperv/vmbus/hv_hv.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_hv.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_hv.c Mon May 23 07:23:19 2016 (r300486) +++ head/sys/dev/hyperv/vmbus/hv_hv.c Mon May 23 07:32:34 2016 (r300487) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define HV_NANOSECONDS_PER_SEC 1000000000L @@ -220,8 +221,8 @@ hv_vmbus_signal_event(void *con_id) */ void hv_vmbus_synic_init(void *arg) - { + struct vmbus_softc *sc = vmbus_get_softc(); int cpu; uint64_t hv_vcpu_index; hv_vmbus_synic_simp simp; @@ -266,7 +267,7 @@ hv_vmbus_synic_init(void *arg) /*HV_SHARED_SINT_IDT_VECTOR + 0x20; */ shared_sint.as_uint64_t = 0; - shared_sint.u.vector = setup_args->vector; + shared_sint.u.vector = sc->vmbus_idtvec; shared_sint.u.masked = FALSE; shared_sint.u.auto_eoi = TRUE; Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Mon May 23 07:23:19 2016 (r300486) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Mon May 23 07:32:34 2016 (r300487) @@ -385,25 +385,18 @@ vmbus_bus_init(void) sc = vmbus_get_softc(); /* - * Find a free IDT slot for vmbus callback. + * Find a free IDT vector for vmbus messages/events. */ - hv_vmbus_g_context.hv_cb_vector = lapic_ipi_alloc(IDTVEC(hv_vmbus_callback)); - if (hv_vmbus_g_context.hv_cb_vector < 0) { - if(bootverbose) - printf("Error VMBUS: Cannot find free IDT slot for " - "vmbus callback!\n"); + sc->vmbus_idtvec = lapic_ipi_alloc(IDTVEC(hv_vmbus_callback)); + if (sc->vmbus_idtvec < 0) { + device_printf(sc->vmbus_dev, "cannot find free IDT vector\n"); ret = ENXIO; goto cleanup; } - - if(bootverbose) - printf("VMBUS: vmbus callback vector %d\n", - hv_vmbus_g_context.hv_cb_vector); - - /* - * Notify the hypervisor of our vector. - */ - setup_args.vector = hv_vmbus_g_context.hv_cb_vector; + if(bootverbose) { + device_printf(sc->vmbus_dev, "vmbus IDT vector %d\n", + sc->vmbus_idtvec); + } CPU_FOREACH(j) { snprintf(buf, sizeof(buf), "cpu%d:hyperv", j); @@ -493,7 +486,7 @@ vmbus_bus_init(void) } } - lapic_ipi_free(hv_vmbus_g_context.hv_cb_vector); + lapic_ipi_free(sc->vmbus_idtvec); cleanup: return (ret); @@ -553,6 +546,7 @@ vmbus_sysinit(void *arg __unused) static int vmbus_detach(device_t dev) { + struct vmbus_softc *sc = device_get_softc(dev); int i; hv_vmbus_release_unattached_channels(); @@ -573,7 +567,7 @@ vmbus_detach(device_t dev) } } - lapic_ipi_free(hv_vmbus_g_context.hv_cb_vector); + lapic_ipi_free(sc->vmbus_idtvec); return (0); } Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon May 23 07:23:19 2016 (r300486) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Mon May 23 07:32:34 2016 (r300487) @@ -216,11 +216,6 @@ typedef struct { struct taskqueue *hv_event_queue[MAXCPU]; struct taskqueue *hv_msg_tq[MAXCPU]; struct task hv_msg_task[MAXCPU]; - /* - * Host use this vector to interrupt guest for vmbus channel - * event and msg. - */ - int hv_cb_vector; } hv_vmbus_context; /* @@ -763,7 +758,6 @@ void hv_et_intr(struct trapframe*); void vmbus_scan(void); typedef struct { - unsigned int vector; void *page_buffers[2 * MAXCPU]; } hv_setup_args; Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Mon May 23 07:23:19 2016 (r300486) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Mon May 23 07:32:34 2016 (r300487) @@ -39,6 +39,7 @@ struct vmbus_softc { void (*vmbus_event_proc)(struct vmbus_softc *, int); struct vmbus_pcpu_data vmbus_pcpu[MAXCPU]; device_t vmbus_dev; + int vmbus_idtvec; }; extern struct vmbus_softc *vmbus_sc;