aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/arm/arch_timer.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-05-19 14:27:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-19 14:27:09 -0400
commit7beaa24ba49717419e24d1f6321e8b3c265a719c (patch)
treea5c5433d3c7bfc4c23e67174463ccf519c8406f0 /virt/kvm/arm/arch_timer.c
parent07b75260ebc2c789724c594d7eaf0194fa47b3be (diff)
parent9842df62004f366b9fed2423e24df10542ee0dc5 (diff)
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull KVM updates from Paolo Bonzini: "Small release overall. x86: - miscellaneous fixes - AVIC support (local APIC virtualization, AMD version) s390: - polling for interrupts after a VCPU goes to halted state is now enabled for s390 - use hardware provided information about facility bits that do not need any hypervisor activity, and other fixes for cpu models and facilities - improve perf output - floating interrupt controller improvements. MIPS: - miscellaneous fixes PPC: - bugfixes only ARM: - 16K page size support - generic firmware probing layer for timer and GIC Christoffer Dall (KVM-ARM maintainer) says: "There are a few changes in this pull request touching things outside KVM, but they should all carry the necessary acks and it made the merge process much easier to do it this way." though actually the irqchip maintainers' acks didn't make it into the patches. Marc Zyngier, who is both irqchip and KVM-ARM maintainer, later acked at http://mid.gmane.org/573351D1.4060303@arm.com ('more formally and for documentation purposes')" * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (82 commits) KVM: MTRR: remove MSR 0x2f8 KVM: x86: make hwapic_isr_update and hwapic_irr_update look the same svm: Manage vcpu load/unload when enable AVIC svm: Do not intercept CR8 when enable AVIC svm: Do not expose x2APIC when enable AVIC KVM: x86: Introducing kvm_x86_ops.apicv_post_state_restore svm: Add VMEXIT handlers for AVIC svm: Add interrupt injection via AVIC KVM: x86: Detect and Initialize AVIC support svm: Introduce new AVIC VMCB registers KVM: split kvm_vcpu_wake_up from kvm_vcpu_kick KVM: x86: Introducing kvm_x86_ops VCPU blocking/unblocking hooks KVM: x86: Introducing kvm_x86_ops VM init/destroy hooks KVM: x86: Rename kvm_apic_get_reg to kvm_lapic_get_reg KVM: x86: Misc LAPIC changes to expose helper functions KVM: shrink halt polling even more for invalid wakeups KVM: s390: set halt polling to 80 microseconds KVM: halt_polling: provide a way to qualify wakeups during poll KVM: PPC: Book3S HV: Re-enable XICS fast path for irqfd-generated interrupts kvm: Conditionally register IRQ bypass consumer ...
Diffstat (limited to 'virt/kvm/arm/arch_timer.c')
-rw-r--r--virt/kvm/arm/arch_timer.c40
1 files changed, 11 insertions, 29 deletions
diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c
index 9aaa35dd9144..409db3304471 100644
--- a/virt/kvm/arm/arch_timer.c
+++ b/virt/kvm/arm/arch_timer.c
@@ -17,7 +17,6 @@
17 */ 17 */
18 18
19#include <linux/cpu.h> 19#include <linux/cpu.h>
20#include <linux/of_irq.h>
21#include <linux/kvm.h> 20#include <linux/kvm.h>
22#include <linux/kvm_host.h> 21#include <linux/kvm_host.h>
23#include <linux/interrupt.h> 22#include <linux/interrupt.h>
@@ -438,45 +437,29 @@ static struct notifier_block kvm_timer_cpu_nb = {
438 .notifier_call = kvm_timer_cpu_notify, 437 .notifier_call = kvm_timer_cpu_notify,
439}; 438};
440 439
441static const struct of_device_id arch_timer_of_match[] = {
442 { .compatible = "arm,armv7-timer", },
443 { .compatible = "arm,armv8-timer", },
444 {},
445};
446
447int kvm_timer_hyp_init(void) 440int kvm_timer_hyp_init(void)
448{ 441{
449 struct device_node *np; 442 struct arch_timer_kvm_info *info;
450 unsigned int ppi;
451 int err; 443 int err;
452 444
453 timecounter = arch_timer_get_timecounter(); 445 info = arch_timer_get_kvm_info();
454 if (!timecounter) 446 timecounter = &info->timecounter;
455 return -ENODEV;
456 447
457 np = of_find_matching_node(NULL, arch_timer_of_match); 448 if (info->virtual_irq <= 0) {
458 if (!np) { 449 kvm_err("kvm_arch_timer: invalid virtual timer IRQ: %d\n",
459 kvm_err("kvm_arch_timer: can't find DT node\n"); 450 info->virtual_irq);
460 return -ENODEV; 451 return -ENODEV;
461 } 452 }
453 host_vtimer_irq = info->virtual_irq;
462 454
463 ppi = irq_of_parse_and_map(np, 2); 455 err = request_percpu_irq(host_vtimer_irq, kvm_arch_timer_handler,
464 if (!ppi) {
465 kvm_err("kvm_arch_timer: no virtual timer interrupt\n");
466 err = -EINVAL;
467 goto out;
468 }
469
470 err = request_percpu_irq(ppi, kvm_arch_timer_handler,
471 "kvm guest timer", kvm_get_running_vcpus()); 456 "kvm guest timer", kvm_get_running_vcpus());
472 if (err) { 457 if (err) {
473 kvm_err("kvm_arch_timer: can't request interrupt %d (%d)\n", 458 kvm_err("kvm_arch_timer: can't request interrupt %d (%d)\n",
474 ppi, err); 459 host_vtimer_irq, err);
475 goto out; 460 goto out;
476 } 461 }
477 462
478 host_vtimer_irq = ppi;
479
480 err = __register_cpu_notifier(&kvm_timer_cpu_nb); 463 err = __register_cpu_notifier(&kvm_timer_cpu_nb);
481 if (err) { 464 if (err) {
482 kvm_err("Cannot register timer CPU notifier\n"); 465 kvm_err("Cannot register timer CPU notifier\n");
@@ -489,14 +472,13 @@ int kvm_timer_hyp_init(void)
489 goto out_free; 472 goto out_free;
490 } 473 }
491 474
492 kvm_info("%s IRQ%d\n", np->name, ppi); 475 kvm_info("virtual timer IRQ%d\n", host_vtimer_irq);
493 on_each_cpu(kvm_timer_init_interrupt, NULL, 1); 476 on_each_cpu(kvm_timer_init_interrupt, NULL, 1);
494 477
495 goto out; 478 goto out;
496out_free: 479out_free:
497 free_percpu_irq(ppi, kvm_get_running_vcpus()); 480 free_percpu_irq(host_vtimer_irq, kvm_get_running_vcpus());
498out: 481out:
499 of_node_put(np);
500 return err; 482 return err;
501} 483}
502 484