From owner-svn-src-head@freebsd.org Wed May 25 05:06:17 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 2987BB48B12; Wed, 25 May 2016 05:06:17 +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 E691213E6; Wed, 25 May 2016 05:06:16 +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 u4P56GVK081739; Wed, 25 May 2016 05:06:16 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P56FNL081735; Wed, 25 May 2016 05:06:15 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201605250506.u4P56FNL081735@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 25 May 2016 05:06:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300647 - 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: Wed, 25 May 2016 05:06:17 -0000 Author: sephe Date: Wed May 25 05:06:15 2016 New Revision: 300647 URL: https://svnweb.freebsd.org/changeset/base/300647 Log: hyperv/vmbus: Move vcpuid into vmbus softc per-cpu data MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6521 Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.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_channel_mgmt.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed May 25 04:59:20 2016 (r300646) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed May 25 05:06:15 2016 (r300647) @@ -32,7 +32,8 @@ #include #include -#include "hv_vmbus_priv.h" +#include +#include /* * Internal functions @@ -301,7 +302,7 @@ vmbus_channel_cpu_set(struct hv_vmbus_ch KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpu %d", cpu)); chan->target_cpu = cpu; - chan->target_vcpu = hv_vmbus_g_context.hv_vcpu_index[cpu]; + chan->target_vcpu = VMBUS_PCPU_GET(vmbus_get_softc(), vcpuid, cpu); if (bootverbose) { printf("vmbus_chan%u: assigned to cpu%u [vcpu%u]\n", @@ -744,7 +745,7 @@ vmbus_select_outgoing_channel(struct hv_ return outgoing_channel; } - cur_vcpu = hv_vmbus_g_context.hv_vcpu_index[smp_pro_id]; + cur_vcpu = VMBUS_PCPU_GET(vmbus_get_softc(), vcpuid, smp_pro_id); TAILQ_FOREACH(new_channel, &primary->sc_list_anchor, sc_list_entry) { if (new_channel->state != HV_CHANNEL_OPENED_STATE){ Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed May 25 04:59:20 2016 (r300646) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Wed May 25 05:06:15 2016 (r300647) @@ -213,7 +213,6 @@ vmbus_synic_setup(void *arg __unused) { struct vmbus_softc *sc = vmbus_get_softc(); int cpu; - uint64_t hv_vcpu_index; hv_vmbus_synic_simp simp; hv_vmbus_synic_siefp siefp; hv_vmbus_synic_scontrol sctrl; @@ -271,8 +270,7 @@ vmbus_synic_setup(void *arg __unused) * Set up the cpuid mapping from Hyper-V to FreeBSD. * The array is indexed using FreeBSD cpuid. */ - hv_vcpu_index = rdmsr(HV_X64_MSR_VP_INDEX); - hv_vmbus_g_context.hv_vcpu_index[cpu] = (uint32_t)hv_vcpu_index; + VMBUS_PCPU_GET(sc, vcpuid, cpu) = rdmsr(HV_X64_MSR_VP_INDEX); } static void Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Wed May 25 04:59:20 2016 (r300646) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Wed May 25 05:06:15 2016 (r300647) @@ -202,11 +202,6 @@ union vmbus_event_flags; typedef struct { hv_bool_uint8_t syn_ic_initialized; - - /* - * For FreeBSD cpuid to Hyper-V vcpuid mapping. - */ - uint32_t hv_vcpu_index[MAXCPU]; } hv_vmbus_context; /* Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Wed May 25 04:59:20 2016 (r300646) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Wed May 25 05:06:15 2016 (r300647) @@ -36,6 +36,7 @@ struct vmbus_pcpu_data { u_long *intr_cnt; /* Hyper-V interrupt counter */ struct vmbus_message *message; /* shared messages */ + uint32_t vcpuid; /* virtual cpuid */ int event_flag_cnt; /* # of event flags */ union vmbus_event_flags *event_flag; /* shared event flags */