From owner-svn-src-stable@freebsd.org Mon Dec 26 06:59:24 2016 Return-Path: Delivered-To: svn-src-stable@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 4D0DEC91665; Mon, 26 Dec 2016 06:59:24 +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 00FFE86B; Mon, 26 Dec 2016 06:59:23 +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 uBQ6xN8J054594; Mon, 26 Dec 2016 06:59:23 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBQ6xNM7054592; Mon, 26 Dec 2016 06:59:23 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201612260659.uBQ6xNM7054592@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 26 Dec 2016 06:59:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r310573 - stable/11/sys/dev/hyperv/vmbus X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2016 06:59:24 -0000 Author: sephe Date: Mon Dec 26 06:59:22 2016 New Revision: 310573 URL: https://svnweb.freebsd.org/changeset/base/310573 Log: r310348 hyperv: Unbreak EARLY_AP_STARUP Hyper-V bootstrap by using intrhook Properly working pause and friends are required. Sponsored by: Microsoft Modified: stable/11/sys/dev/hyperv/vmbus/vmbus.c stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus.c Mon Dec 26 06:33:43 2016 (r310572) +++ stable/11/sys/dev/hyperv/vmbus/vmbus.c Mon Dec 26 06:59:22 2016 (r310573) @@ -97,6 +97,9 @@ static int vmbus_probe_guid_method(dev const struct hyperv_guid *); static uint32_t vmbus_get_vcpu_id_method(device_t bus, device_t dev, int cpu); +#ifdef EARLY_AP_STARTUP +static void vmbus_intrhook(void *); +#endif static int vmbus_init(struct vmbus_softc *); static int vmbus_connect(struct vmbus_softc *, uint32_t); @@ -1369,6 +1372,21 @@ vmbus_event_proc_dummy(struct vmbus_soft { } +#ifdef EARLY_AP_STARTUP + +static void +vmbus_intrhook(void *xsc) +{ + struct vmbus_softc *sc = xsc; + + if (bootverbose) + device_printf(sc->vmbus_dev, "intrhook\n"); + vmbus_doattach(sc); + config_intrhook_disestablish(&sc->vmbus_intrhook); +} + +#endif /* EARLY_AP_STARTUP */ + static int vmbus_attach(device_t dev) { @@ -1383,7 +1401,14 @@ vmbus_attach(device_t dev) */ vmbus_sc->vmbus_event_proc = vmbus_event_proc_dummy; -#ifndef EARLY_AP_STARTUP +#ifdef EARLY_AP_STARTUP + /* + * Defer the real attach until the pause(9) works as expected. + */ + vmbus_sc->vmbus_intrhook.ich_func = vmbus_intrhook; + vmbus_sc->vmbus_intrhook.ich_arg = vmbus_sc; + config_intrhook_establish(&vmbus_sc->vmbus_intrhook); +#else /* !EARLY_AP_STARTUP */ /* * If the system has already booted and thread * scheduling is possible indicated by the global @@ -1391,8 +1416,8 @@ vmbus_attach(device_t dev) * initialization directly. */ if (!cold) -#endif vmbus_doattach(vmbus_sc); +#endif /* EARLY_AP_STARTUP */ return (0); } Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Mon Dec 26 06:33:43 2016 (r310572) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Mon Dec 26 06:59:22 2016 (r310573) @@ -30,6 +30,7 @@ #define _VMBUS_VAR_H_ #include +#include #include #include @@ -128,6 +129,8 @@ struct vmbus_softc { struct mtx vmbus_chan_lock; TAILQ_HEAD(, vmbus_channel) vmbus_chans; + struct intr_config_hook vmbus_intrhook; + #ifdef NEW_PCIB /* The list of usable MMIO ranges for PCIe pass-through */ struct pcib_host_resources vmbus_mmio_res;