aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hv
diff options
context:
space:
mode:
authorK. Y. Srinivasan <kys@microsoft.com>2012-12-01 09:46:47 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-17 14:34:37 -0500
commit917ea427c78670958488f7f304e4629c325969a4 (patch)
tree06784d2cd61f6505b2222d2fdfbfeec2b3fb066a /drivers/hv
parent3be77774017fc3c7dd0b434265dfa417aac23545 (diff)
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')
-rw-r--r--drivers/hv/hv.c11
-rw-r--r--drivers/hv/hyperv_vmbus.h10
2 files changed, 21 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)
137 memset(hv_context.synic_event_page, 0, sizeof(void *) * NR_CPUS); 137 memset(hv_context.synic_event_page, 0, sizeof(void *) * NR_CPUS);
138 memset(hv_context.synic_message_page, 0, 138 memset(hv_context.synic_message_page, 0,
139 sizeof(void *) * NR_CPUS); 139 sizeof(void *) * NR_CPUS);
140 memset(hv_context.vp_index, 0,
141 sizeof(int) * NR_CPUS);
140 142
141 max_leaf = query_hypervisor_info(); 143 max_leaf = query_hypervisor_info();
142 144
@@ -296,6 +298,7 @@ void hv_synic_init(void *irqarg)
296 union hv_synic_siefp siefp; 298 union hv_synic_siefp siefp;
297 union hv_synic_sint shared_sint; 299 union hv_synic_sint shared_sint;
298 union hv_synic_scontrol sctrl; 300 union hv_synic_scontrol sctrl;
301 u64 vp_index;
299 302
300 u32 irq_vector = *((u32 *)(irqarg)); 303 u32 irq_vector = *((u32 *)(irqarg));
301 int cpu = smp_processor_id(); 304 int cpu = smp_processor_id();
@@ -355,6 +358,14 @@ void hv_synic_init(void *irqarg)
355 wrmsrl(HV_X64_MSR_SCONTROL, sctrl.as_uint64); 358 wrmsrl(HV_X64_MSR_SCONTROL, sctrl.as_uint64);
356 359
357 hv_context.synic_initialized = true; 360 hv_context.synic_initialized = true;
361
362 /*
363 * Setup the mapping between Hyper-V's notion
364 * of cpuid and Linux' notion of cpuid.
365 * This array will be indexed using Linux cpuid.
366 */
367 rdmsrl(HV_X64_MSR_VP_INDEX, vp_index);
368 hv_context.vp_index[cpu] = (u32)vp_index;
358 return; 369 return;
359 370
360cleanup: 371cleanup:
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index 1bc7500fb84c..6bbc197cbdfa 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -502,6 +502,16 @@ struct hv_context {
502 502
503 void *synic_message_page[NR_CPUS]; 503 void *synic_message_page[NR_CPUS];
504 void *synic_event_page[NR_CPUS]; 504 void *synic_event_page[NR_CPUS];
505 /*
506 * Hypervisor's notion of virtual processor ID is different from
507 * Linux' notion of CPU ID. This information can only be retrieved
508 * in the context of the calling CPU. Setup a map for easy access
509 * to this information:
510 *
511 * vp_index[a] is the Hyper-V's processor ID corresponding to
512 * Linux cpuid 'a'.
513 */
514 u32 vp_index[NR_CPUS];
505}; 515};
506 516
507extern struct hv_context hv_context; 517extern struct hv_context hv_context;