Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354990
b: refs/heads/master
c: 917ea42
h: refs/heads/master
v: v3
  • Loading branch information
K. Y. Srinivasan authored and Greg Kroah-Hartman committed Jan 17, 2013
1 parent 2ceb223 commit b92b538
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3be77774017fc3c7dd0b434265dfa417aac23545
refs/heads/master: 917ea427c78670958488f7f304e4629c325969a4
11 changes: 11 additions & 0 deletions trunk/drivers/hv/hv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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:
Expand Down
10 changes: 10 additions & 0 deletions trunk/drivers/hv/hyperv_vmbus.h
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,16 @@ struct hv_context {

void *synic_message_page[NR_CPUS];
void *synic_event_page[NR_CPUS];
/*
* Hypervisor's notion of virtual processor ID is different from
* Linux' notion of CPU ID. This information can only be retrieved
* in the context of the calling CPU. Setup a map for easy access
* to this information:
*
* vp_index[a] is the Hyper-V's processor ID corresponding to
* Linux cpuid 'a'.
*/
u32 vp_index[NR_CPUS];
};

extern struct hv_context hv_context;
Expand Down

0 comments on commit b92b538

Please sign in to comment.