summaryrefslogtreecommitdiff
path: root/drivers/hv/hv.c
diff options
context:
space:
mode:
authorK. Y. Srinivasan <kys@microsoft.com>2012-12-01 18:46:47 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-17 23:34:37 +0400
commit917ea427c78670958488f7f304e4629c325969a4 (patch)
tree06784d2cd61f6505b2222d2fdfbfeec2b3fb066a /drivers/hv/hv.c
parent3be77774017fc3c7dd0b434265dfa417aac23545 (diff)
downloadlinux-917ea427c78670958488f7f304e4629c325969a4.tar.xz
Drivers: hv: Setup a mapping for Hyper-V's notion cpu ID
On win8 (ws2012), incoming vmbus interrupt load can be spread across all available VCPUs in the guest. On a per-channel basis, the interrupts can be bound to specific CPUs. The Linux notion of cpu ID may be different from that of the hypervisor's. Setup a mapping structure. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hv/hv.c')
-rw-r--r--drivers/hv/hv.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index dd0af8940657..76304a622140 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -137,6 +137,8 @@ int hv_init(void)
memset(hv_context.synic_event_page, 0, sizeof(void *) * NR_CPUS);
memset(hv_context.synic_message_page, 0,
sizeof(void *) * NR_CPUS);
+ memset(hv_context.vp_index, 0,
+ sizeof(int) * NR_CPUS);
max_leaf = query_hypervisor_info();
@@ -296,6 +298,7 @@ void hv_synic_init(void *irqarg)
union hv_synic_siefp siefp;
union hv_synic_sint shared_sint;
union hv_synic_scontrol sctrl;
+ u64 vp_index;
u32 irq_vector = *((u32 *)(irqarg));
int cpu = smp_processor_id();
@@ -355,6 +358,14 @@ void hv_synic_init(void *irqarg)
wrmsrl(HV_X64_MSR_SCONTROL, sctrl.as_uint64);
hv_context.synic_initialized = true;
+
+ /*
+ * Setup the mapping between Hyper-V's notion
+ * of cpuid and Linux' notion of cpuid.
+ * This array will be indexed using Linux cpuid.
+ */
+ rdmsrl(HV_X64_MSR_VP_INDEX, vp_index);
+ hv_context.vp_index[cpu] = (u32)vp_index;
return;
cleanup: