diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /arch/ia64/kvm | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'arch/ia64/kvm')
-rw-r--r-- | arch/ia64/kvm/Kconfig | 2 | ||||
-rw-r--r-- | arch/ia64/kvm/kvm-ia64.c | 117 | ||||
-rw-r--r-- | arch/ia64/kvm/vmm.c | 6 |
3 files changed, 58 insertions, 67 deletions
diff --git a/arch/ia64/kvm/Kconfig b/arch/ia64/kvm/Kconfig index e7947528aee..9806e55f91b 100644 --- a/arch/ia64/kvm/Kconfig +++ b/arch/ia64/kvm/Kconfig | |||
@@ -19,11 +19,9 @@ if VIRTUALIZATION | |||
19 | 19 | ||
20 | config KVM | 20 | config KVM |
21 | tristate "Kernel-based Virtual Machine (KVM) support" | 21 | tristate "Kernel-based Virtual Machine (KVM) support" |
22 | depends on BROKEN | ||
23 | depends on HAVE_KVM && MODULES && EXPERIMENTAL | 22 | depends on HAVE_KVM && MODULES && EXPERIMENTAL |
24 | # for device assignment: | 23 | # for device assignment: |
25 | depends on PCI | 24 | depends on PCI |
26 | depends on BROKEN | ||
27 | select PREEMPT_NOTIFIERS | 25 | select PREEMPT_NOTIFIERS |
28 | select ANON_INODES | 26 | select ANON_INODES |
29 | select HAVE_KVM_IRQCHIP | 27 | select HAVE_KVM_IRQCHIP |
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c index bd1c5155503..43f4c92816e 100644 --- a/arch/ia64/kvm/kvm-ia64.c +++ b/arch/ia64/kvm/kvm-ia64.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * kvm_ia64.c: Basic KVM support On Itanium series processors | 2 | * kvm_ia64.c: Basic KVM suppport On Itanium series processors |
3 | * | 3 | * |
4 | * | 4 | * |
5 | * Copyright (C) 2007, Intel Corporation. | 5 | * Copyright (C) 2007, Intel Corporation. |
@@ -232,12 +232,12 @@ static int handle_mmio(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
232 | if ((p->addr & PAGE_MASK) == IOAPIC_DEFAULT_BASE_ADDRESS) | 232 | if ((p->addr & PAGE_MASK) == IOAPIC_DEFAULT_BASE_ADDRESS) |
233 | goto mmio; | 233 | goto mmio; |
234 | vcpu->mmio_needed = 1; | 234 | vcpu->mmio_needed = 1; |
235 | vcpu->mmio_fragments[0].gpa = kvm_run->mmio.phys_addr = p->addr; | 235 | vcpu->mmio_phys_addr = kvm_run->mmio.phys_addr = p->addr; |
236 | vcpu->mmio_fragments[0].len = kvm_run->mmio.len = p->size; | 236 | vcpu->mmio_size = kvm_run->mmio.len = p->size; |
237 | vcpu->mmio_is_write = kvm_run->mmio.is_write = !p->dir; | 237 | vcpu->mmio_is_write = kvm_run->mmio.is_write = !p->dir; |
238 | 238 | ||
239 | if (vcpu->mmio_is_write) | 239 | if (vcpu->mmio_is_write) |
240 | memcpy(vcpu->arch.mmio_data, &p->data, p->size); | 240 | memcpy(vcpu->mmio_data, &p->data, p->size); |
241 | memcpy(kvm_run->mmio.data, &p->data, p->size); | 241 | memcpy(kvm_run->mmio.data, &p->data, p->size); |
242 | kvm_run->exit_reason = KVM_EXIT_MMIO; | 242 | kvm_run->exit_reason = KVM_EXIT_MMIO; |
243 | return 0; | 243 | return 0; |
@@ -719,7 +719,7 @@ static void kvm_set_mmio_data(struct kvm_vcpu *vcpu) | |||
719 | struct kvm_mmio_req *p = kvm_get_vcpu_ioreq(vcpu); | 719 | struct kvm_mmio_req *p = kvm_get_vcpu_ioreq(vcpu); |
720 | 720 | ||
721 | if (!vcpu->mmio_is_write) | 721 | if (!vcpu->mmio_is_write) |
722 | memcpy(&p->data, vcpu->arch.mmio_data, 8); | 722 | memcpy(&p->data, vcpu->mmio_data, 8); |
723 | p->state = STATE_IORESP_READY; | 723 | p->state = STATE_IORESP_READY; |
724 | } | 724 | } |
725 | 725 | ||
@@ -739,7 +739,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
739 | } | 739 | } |
740 | 740 | ||
741 | if (vcpu->mmio_needed) { | 741 | if (vcpu->mmio_needed) { |
742 | memcpy(vcpu->arch.mmio_data, kvm_run->mmio.data, 8); | 742 | memcpy(vcpu->mmio_data, kvm_run->mmio.data, 8); |
743 | kvm_set_mmio_data(vcpu); | 743 | kvm_set_mmio_data(vcpu); |
744 | vcpu->mmio_read_completed = 1; | 744 | vcpu->mmio_read_completed = 1; |
745 | vcpu->mmio_needed = 0; | 745 | vcpu->mmio_needed = 0; |
@@ -774,13 +774,13 @@ struct kvm *kvm_arch_alloc_vm(void) | |||
774 | return kvm; | 774 | return kvm; |
775 | } | 775 | } |
776 | 776 | ||
777 | struct kvm_ia64_io_range { | 777 | struct kvm_io_range { |
778 | unsigned long start; | 778 | unsigned long start; |
779 | unsigned long size; | 779 | unsigned long size; |
780 | unsigned long type; | 780 | unsigned long type; |
781 | }; | 781 | }; |
782 | 782 | ||
783 | static const struct kvm_ia64_io_range io_ranges[] = { | 783 | static const struct kvm_io_range io_ranges[] = { |
784 | {VGA_IO_START, VGA_IO_SIZE, GPFN_FRAME_BUFFER}, | 784 | {VGA_IO_START, VGA_IO_SIZE, GPFN_FRAME_BUFFER}, |
785 | {MMIO_START, MMIO_SIZE, GPFN_LOW_MMIO}, | 785 | {MMIO_START, MMIO_SIZE, GPFN_LOW_MMIO}, |
786 | {LEGACY_IO_START, LEGACY_IO_SIZE, GPFN_LEGACY_IO}, | 786 | {LEGACY_IO_START, LEGACY_IO_SIZE, GPFN_LEGACY_IO}, |
@@ -809,13 +809,10 @@ static void kvm_build_io_pmt(struct kvm *kvm) | |||
809 | #define GUEST_PHYSICAL_RR4 0x2739 | 809 | #define GUEST_PHYSICAL_RR4 0x2739 |
810 | #define VMM_INIT_RR 0x1660 | 810 | #define VMM_INIT_RR 0x1660 |
811 | 811 | ||
812 | int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) | 812 | int kvm_arch_init_vm(struct kvm *kvm) |
813 | { | 813 | { |
814 | BUG_ON(!kvm); | 814 | BUG_ON(!kvm); |
815 | 815 | ||
816 | if (type) | ||
817 | return -EINVAL; | ||
818 | |||
819 | kvm->arch.is_sn2 = ia64_platform_is("sn2"); | 816 | kvm->arch.is_sn2 = ia64_platform_is("sn2"); |
820 | 817 | ||
821 | kvm->arch.metaphysical_rr0 = GUEST_PHYSICAL_RR0; | 818 | kvm->arch.metaphysical_rr0 = GUEST_PHYSICAL_RR0; |
@@ -924,16 +921,6 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) | |||
924 | return 0; | 921 | return 0; |
925 | } | 922 | } |
926 | 923 | ||
927 | int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_event) | ||
928 | { | ||
929 | if (!irqchip_in_kernel(kvm)) | ||
930 | return -ENXIO; | ||
931 | |||
932 | irq_event->status = kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, | ||
933 | irq_event->irq, irq_event->level); | ||
934 | return 0; | ||
935 | } | ||
936 | |||
937 | long kvm_arch_vm_ioctl(struct file *filp, | 924 | long kvm_arch_vm_ioctl(struct file *filp, |
938 | unsigned int ioctl, unsigned long arg) | 925 | unsigned int ioctl, unsigned long arg) |
939 | { | 926 | { |
@@ -973,6 +960,29 @@ long kvm_arch_vm_ioctl(struct file *filp, | |||
973 | goto out; | 960 | goto out; |
974 | } | 961 | } |
975 | break; | 962 | break; |
963 | case KVM_IRQ_LINE_STATUS: | ||
964 | case KVM_IRQ_LINE: { | ||
965 | struct kvm_irq_level irq_event; | ||
966 | |||
967 | r = -EFAULT; | ||
968 | if (copy_from_user(&irq_event, argp, sizeof irq_event)) | ||
969 | goto out; | ||
970 | r = -ENXIO; | ||
971 | if (irqchip_in_kernel(kvm)) { | ||
972 | __s32 status; | ||
973 | status = kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, | ||
974 | irq_event.irq, irq_event.level); | ||
975 | if (ioctl == KVM_IRQ_LINE_STATUS) { | ||
976 | r = -EFAULT; | ||
977 | irq_event.status = status; | ||
978 | if (copy_to_user(argp, &irq_event, | ||
979 | sizeof irq_event)) | ||
980 | goto out; | ||
981 | } | ||
982 | r = 0; | ||
983 | } | ||
984 | break; | ||
985 | } | ||
976 | case KVM_GET_IRQCHIP: { | 986 | case KVM_GET_IRQCHIP: { |
977 | /* 0: PIC master, 1: PIC slave, 2: IOAPIC */ | 987 | /* 0: PIC master, 1: PIC slave, 2: IOAPIC */ |
978 | struct kvm_irqchip chip; | 988 | struct kvm_irqchip chip; |
@@ -1159,11 +1169,6 @@ out: | |||
1159 | 1169 | ||
1160 | #define PALE_RESET_ENTRY 0x80000000ffffffb0UL | 1170 | #define PALE_RESET_ENTRY 0x80000000ffffffb0UL |
1161 | 1171 | ||
1162 | bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu) | ||
1163 | { | ||
1164 | return irqchip_in_kernel(vcpu->kvm) == (vcpu->arch.apic != NULL); | ||
1165 | } | ||
1166 | |||
1167 | int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | 1172 | int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) |
1168 | { | 1173 | { |
1169 | struct kvm_vcpu *v; | 1174 | struct kvm_vcpu *v; |
@@ -1330,11 +1335,6 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) | |||
1330 | return 0; | 1335 | return 0; |
1331 | } | 1336 | } |
1332 | 1337 | ||
1333 | int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu) | ||
1334 | { | ||
1335 | return 0; | ||
1336 | } | ||
1337 | |||
1338 | int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) | 1338 | int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) |
1339 | { | 1339 | { |
1340 | return -EINVAL; | 1340 | return -EINVAL; |
@@ -1366,10 +1366,14 @@ static void kvm_release_vm_pages(struct kvm *kvm) | |||
1366 | { | 1366 | { |
1367 | struct kvm_memslots *slots; | 1367 | struct kvm_memslots *slots; |
1368 | struct kvm_memory_slot *memslot; | 1368 | struct kvm_memory_slot *memslot; |
1369 | int j; | 1369 | int i, j; |
1370 | unsigned long base_gfn; | ||
1370 | 1371 | ||
1371 | slots = kvm_memslots(kvm); | 1372 | slots = kvm_memslots(kvm); |
1372 | kvm_for_each_memslot(memslot, slots) { | 1373 | for (i = 0; i < slots->nmemslots; i++) { |
1374 | memslot = &slots->memslots[i]; | ||
1375 | base_gfn = memslot->base_gfn; | ||
1376 | |||
1373 | for (j = 0; j < memslot->npages; j++) { | 1377 | for (j = 0; j < memslot->npages; j++) { |
1374 | if (memslot->rmap[j]) | 1378 | if (memslot->rmap[j]) |
1375 | put_page((struct page *)memslot->rmap[j]); | 1379 | put_page((struct page *)memslot->rmap[j]); |
@@ -1561,21 +1565,6 @@ out: | |||
1561 | return r; | 1565 | return r; |
1562 | } | 1566 | } |
1563 | 1567 | ||
1564 | int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf) | ||
1565 | { | ||
1566 | return VM_FAULT_SIGBUS; | ||
1567 | } | ||
1568 | |||
1569 | void kvm_arch_free_memslot(struct kvm_memory_slot *free, | ||
1570 | struct kvm_memory_slot *dont) | ||
1571 | { | ||
1572 | } | ||
1573 | |||
1574 | int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) | ||
1575 | { | ||
1576 | return 0; | ||
1577 | } | ||
1578 | |||
1579 | int kvm_arch_prepare_memory_region(struct kvm *kvm, | 1568 | int kvm_arch_prepare_memory_region(struct kvm *kvm, |
1580 | struct kvm_memory_slot *memslot, | 1569 | struct kvm_memory_slot *memslot, |
1581 | struct kvm_memory_slot old, | 1570 | struct kvm_memory_slot old, |
@@ -1616,17 +1605,11 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, | |||
1616 | return; | 1605 | return; |
1617 | } | 1606 | } |
1618 | 1607 | ||
1619 | void kvm_arch_flush_shadow_all(struct kvm *kvm) | 1608 | void kvm_arch_flush_shadow(struct kvm *kvm) |
1620 | { | 1609 | { |
1621 | kvm_flush_remote_tlbs(kvm); | 1610 | kvm_flush_remote_tlbs(kvm); |
1622 | } | 1611 | } |
1623 | 1612 | ||
1624 | void kvm_arch_flush_shadow_memslot(struct kvm *kvm, | ||
1625 | struct kvm_memory_slot *slot) | ||
1626 | { | ||
1627 | kvm_arch_flush_shadow_all(); | ||
1628 | } | ||
1629 | |||
1630 | long kvm_arch_dev_ioctl(struct file *filp, | 1613 | long kvm_arch_dev_ioctl(struct file *filp, |
1631 | unsigned int ioctl, unsigned long arg) | 1614 | unsigned int ioctl, unsigned long arg) |
1632 | { | 1615 | { |
@@ -1837,7 +1820,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, | |||
1837 | if (log->slot >= KVM_MEMORY_SLOTS) | 1820 | if (log->slot >= KVM_MEMORY_SLOTS) |
1838 | goto out; | 1821 | goto out; |
1839 | 1822 | ||
1840 | memslot = id_to_memslot(kvm->memslots, log->slot); | 1823 | memslot = &kvm->memslots->memslots[log->slot]; |
1841 | r = -ENOENT; | 1824 | r = -ENOENT; |
1842 | if (!memslot->dirty_bitmap) | 1825 | if (!memslot->dirty_bitmap) |
1843 | goto out; | 1826 | goto out; |
@@ -1868,6 +1851,21 @@ void kvm_arch_hardware_unsetup(void) | |||
1868 | { | 1851 | { |
1869 | } | 1852 | } |
1870 | 1853 | ||
1854 | void kvm_vcpu_kick(struct kvm_vcpu *vcpu) | ||
1855 | { | ||
1856 | int me; | ||
1857 | int cpu = vcpu->cpu; | ||
1858 | |||
1859 | if (waitqueue_active(&vcpu->wq)) | ||
1860 | wake_up_interruptible(&vcpu->wq); | ||
1861 | |||
1862 | me = get_cpu(); | ||
1863 | if (cpu != me && (unsigned) cpu < nr_cpu_ids && cpu_online(cpu)) | ||
1864 | if (!test_and_set_bit(KVM_REQ_KICK, &vcpu->requests)) | ||
1865 | smp_send_reschedule(cpu); | ||
1866 | put_cpu(); | ||
1867 | } | ||
1868 | |||
1871 | int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq) | 1869 | int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq) |
1872 | { | 1870 | { |
1873 | return __apic_accept_irq(vcpu, irq->vector); | 1871 | return __apic_accept_irq(vcpu, irq->vector); |
@@ -1937,11 +1935,6 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) | |||
1937 | (kvm_highest_pending_irq(vcpu) != -1); | 1935 | (kvm_highest_pending_irq(vcpu) != -1); |
1938 | } | 1936 | } |
1939 | 1937 | ||
1940 | int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu) | ||
1941 | { | ||
1942 | return (!test_and_set_bit(KVM_REQ_KICK, &vcpu->requests)); | ||
1943 | } | ||
1944 | |||
1945 | int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu, | 1938 | int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu, |
1946 | struct kvm_mp_state *mp_state) | 1939 | struct kvm_mp_state *mp_state) |
1947 | { | 1940 | { |
diff --git a/arch/ia64/kvm/vmm.c b/arch/ia64/kvm/vmm.c index 176a12cd56d..f0b9cac8241 100644 --- a/arch/ia64/kvm/vmm.c +++ b/arch/ia64/kvm/vmm.c | |||
@@ -20,9 +20,9 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | 22 | ||
23 | #include <linux/kernel.h> | 23 | #include<linux/kernel.h> |
24 | #include <linux/module.h> | 24 | #include<linux/module.h> |
25 | #include <asm/fpswa.h> | 25 | #include<asm/fpswa.h> |
26 | 26 | ||
27 | #include "vcpu.h" | 27 | #include "vcpu.h" |
28 | 28 | ||