Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 May 2016 05:06:15 +0000 (UTC)
From:      Sepherosa Ziehau <sephe@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r300647 - head/sys/dev/hyperv/vmbus
Message-ID:  <201605250506.u4P56FNL081735@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <sys/mbuf.h>
 #include <sys/mutex.h>
 
-#include "hv_vmbus_priv.h"
+#include <dev/hyperv/vmbus/hv_vmbus_priv.h>
+#include <dev/hyperv/vmbus/vmbus_var.h>
 
 /*
  * 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 */
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605250506.u4P56FNL081735>