From owner-svn-src-all@freebsd.org Mon May 30 08:50:35 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 3454EB53501; Mon, 30 May 2016 08:50:35 +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 E787C1B3A; Mon, 30 May 2016 08:50:34 +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 u4U8oYQD089710; Mon, 30 May 2016 08:50:34 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4U8oYOp089709; Mon, 30 May 2016 08:50:34 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605300850.u4U8oYOp089709@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:50:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300989 - 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, 30 May 2016 08:50:35 -0000 Author: sephe Date: Mon May 30 08:50:33 2016 New Revision: 300989 URL: https://svnweb.freebsd.org/changeset/base/300989 Log: hyperv/et: Make sure only one event timer will be registered This nullifies the need to use softc. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6591 Modified: head/sys/dev/hyperv/vmbus/hv_et.c Modified: head/sys/dev/hyperv/vmbus/hv_et.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_et.c Mon May 30 08:42:35 2016 (r300988) +++ head/sys/dev/hyperv/vmbus/hv_et.c Mon May 30 08:50:33 2016 (r300989) @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$"); CPUID_HV_MSR_SYNIC | \ CPUID_HV_MSR_SYNTIMER) -static struct eventtimer *et; +static struct eventtimer vmbus_et; static __inline uint64_t sbintime2tick(sbintime_t time) @@ -88,12 +88,12 @@ vmbus_et_intr(struct trapframe *frame) struct trapframe *oldframe; struct thread *td; - if (et->et_active) { + if (vmbus_et.et_active) { td = curthread; td->td_intr_nesting_level++; oldframe = td->td_intr_frame; td->td_intr_frame = frame; - et->et_event_cb(et, et->et_arg); + vmbus_et.et_event_cb(&vmbus_et, vmbus_et.et_arg); td->td_intr_frame = oldframe; td->td_intr_nesting_level--; } @@ -102,7 +102,8 @@ vmbus_et_intr(struct trapframe *frame) static void hv_et_identify(driver_t *driver, device_t parent) { - if (device_find_child(parent, "hv_et", -1) != NULL || + if (device_get_unit(parent) != 0 || + device_find_child(parent, "hv_et", -1) != NULL || (hyperv_features & CPUID_HV_ET_MASK) != CPUID_HV_ET_MASK) return; @@ -145,17 +146,17 @@ vmbus_et_config(void *arg __unused) static int hv_et_attach(device_t dev) { - /* XXX: need allocate SINT and remove global et */ - et = device_get_softc(dev); + /* TODO: use independent IDT vector */ - et->et_name = "Hyper-V"; - et->et_flags = ET_FLAGS_ONESHOT | ET_FLAGS_PERCPU; - et->et_quality = 1000; - et->et_frequency = HV_TIMER_FREQUENCY; - et->et_min_period = HV_MIN_DELTA_TICKS * ((1LL << 32) / HV_TIMER_FREQUENCY); - et->et_max_period = HV_MAX_DELTA_TICKS * ((1LL << 32) / HV_TIMER_FREQUENCY); - et->et_start = hv_et_start; - et->et_priv = dev; + vmbus_et.et_name = "Hyper-V"; + vmbus_et.et_flags = ET_FLAGS_ONESHOT | ET_FLAGS_PERCPU; + vmbus_et.et_quality = 1000; + vmbus_et.et_frequency = HV_TIMER_FREQUENCY; + vmbus_et.et_min_period = + HV_MIN_DELTA_TICKS * ((1LL << 32) / HV_TIMER_FREQUENCY); + vmbus_et.et_max_period = + HV_MAX_DELTA_TICKS * ((1LL << 32) / HV_TIMER_FREQUENCY); + vmbus_et.et_start = hv_et_start; /* * Delay a bit to make sure that MSR_HV_TIME_REF_COUNT will @@ -165,13 +166,13 @@ hv_et_attach(device_t dev) DELAY(100); smp_rendezvous(NULL, vmbus_et_config, NULL, NULL); - return (et_register(et)); + return (et_register(&vmbus_et)); } static int hv_et_detach(device_t dev) { - return (et_deregister(et)); + return (et_deregister(&vmbus_et)); } static device_method_t hv_et_methods[] = { @@ -186,7 +187,7 @@ static device_method_t hv_et_methods[] = static driver_t hv_et_driver = { "hv_et", hv_et_methods, - sizeof(struct eventtimer) + 0 }; static devclass_t hv_et_devclass;