diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-14 12:58:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-14 12:58:24 -0500 |
commit | d0316554d3586cbea60592a41391b5def2553d6f (patch) | |
tree | 5e7418f0bacbc68cec5dfd1541e03eb56870aa02 /arch/x86/kvm/svm.c | |
parent | fb0bbb92d42d5bd0ab224605444efdfed06d6934 (diff) | |
parent | 51e99be00ce2713cbb841cedc997cafa6e26c7f4 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu: (34 commits)
m68k: rename global variable vmalloc_end to m68k_vmalloc_end
percpu: add missing per_cpu_ptr_to_phys() definition for UP
percpu: Fix kdump failure if booted with percpu_alloc=page
percpu: make misc percpu symbols unique
percpu: make percpu symbols in ia64 unique
percpu: make percpu symbols in powerpc unique
percpu: make percpu symbols in x86 unique
percpu: make percpu symbols in xen unique
percpu: make percpu symbols in cpufreq unique
percpu: make percpu symbols in oprofile unique
percpu: make percpu symbols in tracer unique
percpu: make percpu symbols under kernel/ and mm/ unique
percpu: remove some sparse warnings
percpu: make alloc_percpu() handle array types
vmalloc: fix use of non-existent percpu variable in put_cpu_var()
this_cpu: Use this_cpu_xx in trace_functions_graph.c
this_cpu: Use this_cpu_xx for ftrace
this_cpu: Use this_cpu_xx in nmi handling
this_cpu: Use this_cpu operations in RCU
this_cpu: Use this_cpu ops for VM statistics
...
Fix up trivial (famous last words) global per-cpu naming conflicts in
arch/x86/kvm/svm.c
mm/slab.c
Diffstat (limited to 'arch/x86/kvm/svm.c')
-rw-r--r-- | arch/x86/kvm/svm.c | 64 |
1 files changed, 31 insertions, 33 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 3de0b37ec038..1d9b33843c80 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -316,7 +316,7 @@ static void svm_hardware_disable(void *garbage) | |||
316 | static int svm_hardware_enable(void *garbage) | 316 | static int svm_hardware_enable(void *garbage) |
317 | { | 317 | { |
318 | 318 | ||
319 | struct svm_cpu_data *svm_data; | 319 | struct svm_cpu_data *sd; |
320 | uint64_t efer; | 320 | uint64_t efer; |
321 | struct descriptor_table gdt_descr; | 321 | struct descriptor_table gdt_descr; |
322 | struct desc_struct *gdt; | 322 | struct desc_struct *gdt; |
@@ -331,63 +331,61 @@ static int svm_hardware_enable(void *garbage) | |||
331 | me); | 331 | me); |
332 | return -EINVAL; | 332 | return -EINVAL; |
333 | } | 333 | } |
334 | svm_data = per_cpu(svm_data, me); | 334 | sd = per_cpu(svm_data, me); |
335 | 335 | ||
336 | if (!svm_data) { | 336 | if (!sd) { |
337 | printk(KERN_ERR "svm_hardware_enable: svm_data is NULL on %d\n", | 337 | printk(KERN_ERR "svm_hardware_enable: svm_data is NULL on %d\n", |
338 | me); | 338 | me); |
339 | return -EINVAL; | 339 | return -EINVAL; |
340 | } | 340 | } |
341 | 341 | ||
342 | svm_data->asid_generation = 1; | 342 | sd->asid_generation = 1; |
343 | svm_data->max_asid = cpuid_ebx(SVM_CPUID_FUNC) - 1; | 343 | sd->max_asid = cpuid_ebx(SVM_CPUID_FUNC) - 1; |
344 | svm_data->next_asid = svm_data->max_asid + 1; | 344 | sd->next_asid = sd->max_asid + 1; |
345 | 345 | ||
346 | kvm_get_gdt(&gdt_descr); | 346 | kvm_get_gdt(&gdt_descr); |
347 | gdt = (struct desc_struct *)gdt_descr.base; | 347 | gdt = (struct desc_struct *)gdt_descr.base; |
348 | svm_data->tss_desc = (struct kvm_ldttss_desc *)(gdt + GDT_ENTRY_TSS); | 348 | sd->tss_desc = (struct kvm_ldttss_desc *)(gdt + GDT_ENTRY_TSS); |
349 | 349 | ||
350 | wrmsrl(MSR_EFER, efer | EFER_SVME); | 350 | wrmsrl(MSR_EFER, efer | EFER_SVME); |
351 | 351 | ||
352 | wrmsrl(MSR_VM_HSAVE_PA, | 352 | wrmsrl(MSR_VM_HSAVE_PA, page_to_pfn(sd->save_area) << PAGE_SHIFT); |
353 | page_to_pfn(svm_data->save_area) << PAGE_SHIFT); | ||
354 | 353 | ||
355 | return 0; | 354 | return 0; |
356 | } | 355 | } |
357 | 356 | ||
358 | static void svm_cpu_uninit(int cpu) | 357 | static void svm_cpu_uninit(int cpu) |
359 | { | 358 | { |
360 | struct svm_cpu_data *svm_data | 359 | struct svm_cpu_data *sd = per_cpu(svm_data, raw_smp_processor_id()); |
361 | = per_cpu(svm_data, raw_smp_processor_id()); | ||
362 | 360 | ||
363 | if (!svm_data) | 361 | if (!sd) |
364 | return; | 362 | return; |
365 | 363 | ||
366 | per_cpu(svm_data, raw_smp_processor_id()) = NULL; | 364 | per_cpu(svm_data, raw_smp_processor_id()) = NULL; |
367 | __free_page(svm_data->save_area); | 365 | __free_page(sd->save_area); |
368 | kfree(svm_data); | 366 | kfree(sd); |
369 | } | 367 | } |
370 | 368 | ||
371 | static int svm_cpu_init(int cpu) | 369 | static int svm_cpu_init(int cpu) |
372 | { | 370 | { |
373 | struct svm_cpu_data *svm_data; | 371 | struct svm_cpu_data *sd; |
374 | int r; | 372 | int r; |
375 | 373 | ||
376 | svm_data = kzalloc(sizeof(struct svm_cpu_data), GFP_KERNEL); | 374 | sd = kzalloc(sizeof(struct svm_cpu_data), GFP_KERNEL); |
377 | if (!svm_data) | 375 | if (!sd) |
378 | return -ENOMEM; | 376 | return -ENOMEM; |
379 | svm_data->cpu = cpu; | 377 | sd->cpu = cpu; |
380 | svm_data->save_area = alloc_page(GFP_KERNEL); | 378 | sd->save_area = alloc_page(GFP_KERNEL); |
381 | r = -ENOMEM; | 379 | r = -ENOMEM; |
382 | if (!svm_data->save_area) | 380 | if (!sd->save_area) |
383 | goto err_1; | 381 | goto err_1; |
384 | 382 | ||
385 | per_cpu(svm_data, cpu) = svm_data; | 383 | per_cpu(svm_data, cpu) = sd; |
386 | 384 | ||
387 | return 0; | 385 | return 0; |
388 | 386 | ||
389 | err_1: | 387 | err_1: |
390 | kfree(svm_data); | 388 | kfree(sd); |
391 | return r; | 389 | return r; |
392 | 390 | ||
393 | } | 391 | } |
@@ -1092,16 +1090,16 @@ static void save_host_msrs(struct kvm_vcpu *vcpu) | |||
1092 | #endif | 1090 | #endif |
1093 | } | 1091 | } |
1094 | 1092 | ||
1095 | static void new_asid(struct vcpu_svm *svm, struct svm_cpu_data *svm_data) | 1093 | static void new_asid(struct vcpu_svm *svm, struct svm_cpu_data *sd) |
1096 | { | 1094 | { |
1097 | if (svm_data->next_asid > svm_data->max_asid) { | 1095 | if (sd->next_asid > sd->max_asid) { |
1098 | ++svm_data->asid_generation; | 1096 | ++sd->asid_generation; |
1099 | svm_data->next_asid = 1; | 1097 | sd->next_asid = 1; |
1100 | svm->vmcb->control.tlb_ctl = TLB_CONTROL_FLUSH_ALL_ASID; | 1098 | svm->vmcb->control.tlb_ctl = TLB_CONTROL_FLUSH_ALL_ASID; |
1101 | } | 1099 | } |
1102 | 1100 | ||
1103 | svm->asid_generation = svm_data->asid_generation; | 1101 | svm->asid_generation = sd->asid_generation; |
1104 | svm->vmcb->control.asid = svm_data->next_asid++; | 1102 | svm->vmcb->control.asid = sd->next_asid++; |
1105 | } | 1103 | } |
1106 | 1104 | ||
1107 | static unsigned long svm_get_dr(struct kvm_vcpu *vcpu, int dr) | 1105 | static unsigned long svm_get_dr(struct kvm_vcpu *vcpu, int dr) |
@@ -2429,8 +2427,8 @@ static void reload_tss(struct kvm_vcpu *vcpu) | |||
2429 | { | 2427 | { |
2430 | int cpu = raw_smp_processor_id(); | 2428 | int cpu = raw_smp_processor_id(); |
2431 | 2429 | ||
2432 | struct svm_cpu_data *svm_data = per_cpu(svm_data, cpu); | 2430 | struct svm_cpu_data *sd = per_cpu(svm_data, cpu); |
2433 | svm_data->tss_desc->type = 9; /* available 32/64-bit TSS */ | 2431 | sd->tss_desc->type = 9; /* available 32/64-bit TSS */ |
2434 | load_TR_desc(); | 2432 | load_TR_desc(); |
2435 | } | 2433 | } |
2436 | 2434 | ||
@@ -2438,12 +2436,12 @@ static void pre_svm_run(struct vcpu_svm *svm) | |||
2438 | { | 2436 | { |
2439 | int cpu = raw_smp_processor_id(); | 2437 | int cpu = raw_smp_processor_id(); |
2440 | 2438 | ||
2441 | struct svm_cpu_data *svm_data = per_cpu(svm_data, cpu); | 2439 | struct svm_cpu_data *sd = per_cpu(svm_data, cpu); |
2442 | 2440 | ||
2443 | svm->vmcb->control.tlb_ctl = TLB_CONTROL_DO_NOTHING; | 2441 | svm->vmcb->control.tlb_ctl = TLB_CONTROL_DO_NOTHING; |
2444 | /* FIXME: handle wraparound of asid_generation */ | 2442 | /* FIXME: handle wraparound of asid_generation */ |
2445 | if (svm->asid_generation != svm_data->asid_generation) | 2443 | if (svm->asid_generation != sd->asid_generation) |
2446 | new_asid(svm, svm_data); | 2444 | new_asid(svm, sd); |
2447 | } | 2445 | } |
2448 | 2446 | ||
2449 | static void svm_inject_nmi(struct kvm_vcpu *vcpu) | 2447 | static void svm_inject_nmi(struct kvm_vcpu *vcpu) |