diff options
Diffstat (limited to 'arch/ia64/kvm')
-rw-r--r-- | arch/ia64/kvm/Makefile | 4 | ||||
-rw-r--r-- | arch/ia64/kvm/kvm-ia64.c | 32 | ||||
-rw-r--r-- | arch/ia64/kvm/lapic.h | 1 | ||||
-rw-r--r-- | arch/ia64/kvm/mmio.c | 2 | ||||
-rw-r--r-- | arch/ia64/kvm/process.c | 2 | ||||
-rw-r--r-- | arch/ia64/kvm/vti.h | 26 |
6 files changed, 29 insertions, 38 deletions
diff --git a/arch/ia64/kvm/Makefile b/arch/ia64/kvm/Makefile index 1089b3e918ac..db3d7c5d1071 100644 --- a/arch/ia64/kvm/Makefile +++ b/arch/ia64/kvm/Makefile | |||
@@ -45,8 +45,8 @@ FORCE : $(obj)/$(offsets-file) | |||
45 | # Makefile for Kernel-based Virtual Machine module | 45 | # Makefile for Kernel-based Virtual Machine module |
46 | # | 46 | # |
47 | 47 | ||
48 | EXTRA_CFLAGS += -Ivirt/kvm -Iarch/ia64/kvm/ | 48 | ccflags-y := -Ivirt/kvm -Iarch/ia64/kvm/ |
49 | EXTRA_AFLAGS += -Ivirt/kvm -Iarch/ia64/kvm/ | 49 | asflags-y := -Ivirt/kvm -Iarch/ia64/kvm/ |
50 | 50 | ||
51 | common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o \ | 51 | common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o \ |
52 | coalesced_mmio.o irq_comm.o assigned-dev.o) | 52 | coalesced_mmio.o irq_comm.o assigned-dev.o) |
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c index f56a6316e134..8213efe1998c 100644 --- a/arch/ia64/kvm/kvm-ia64.c +++ b/arch/ia64/kvm/kvm-ia64.c | |||
@@ -662,6 +662,7 @@ again: | |||
662 | goto vcpu_run_fail; | 662 | goto vcpu_run_fail; |
663 | 663 | ||
664 | srcu_read_unlock(&vcpu->kvm->srcu, idx); | 664 | srcu_read_unlock(&vcpu->kvm->srcu, idx); |
665 | vcpu->mode = IN_GUEST_MODE; | ||
665 | kvm_guest_enter(); | 666 | kvm_guest_enter(); |
666 | 667 | ||
667 | /* | 668 | /* |
@@ -683,6 +684,7 @@ again: | |||
683 | */ | 684 | */ |
684 | barrier(); | 685 | barrier(); |
685 | kvm_guest_exit(); | 686 | kvm_guest_exit(); |
687 | vcpu->mode = OUTSIDE_GUEST_MODE; | ||
686 | preempt_enable(); | 688 | preempt_enable(); |
687 | 689 | ||
688 | idx = srcu_read_lock(&vcpu->kvm->srcu); | 690 | idx = srcu_read_lock(&vcpu->kvm->srcu); |
@@ -749,7 +751,7 @@ out: | |||
749 | return r; | 751 | return r; |
750 | } | 752 | } |
751 | 753 | ||
752 | static struct kvm *kvm_alloc_kvm(void) | 754 | struct kvm *kvm_arch_alloc_vm(void) |
753 | { | 755 | { |
754 | 756 | ||
755 | struct kvm *kvm; | 757 | struct kvm *kvm; |
@@ -760,7 +762,7 @@ static struct kvm *kvm_alloc_kvm(void) | |||
760 | vm_base = __get_free_pages(GFP_KERNEL, get_order(KVM_VM_DATA_SIZE)); | 762 | vm_base = __get_free_pages(GFP_KERNEL, get_order(KVM_VM_DATA_SIZE)); |
761 | 763 | ||
762 | if (!vm_base) | 764 | if (!vm_base) |
763 | return ERR_PTR(-ENOMEM); | 765 | return NULL; |
764 | 766 | ||
765 | memset((void *)vm_base, 0, KVM_VM_DATA_SIZE); | 767 | memset((void *)vm_base, 0, KVM_VM_DATA_SIZE); |
766 | kvm = (struct kvm *)(vm_base + | 768 | kvm = (struct kvm *)(vm_base + |
@@ -806,10 +808,12 @@ static void kvm_build_io_pmt(struct kvm *kvm) | |||
806 | #define GUEST_PHYSICAL_RR4 0x2739 | 808 | #define GUEST_PHYSICAL_RR4 0x2739 |
807 | #define VMM_INIT_RR 0x1660 | 809 | #define VMM_INIT_RR 0x1660 |
808 | 810 | ||
809 | static void kvm_init_vm(struct kvm *kvm) | 811 | int kvm_arch_init_vm(struct kvm *kvm) |
810 | { | 812 | { |
811 | BUG_ON(!kvm); | 813 | BUG_ON(!kvm); |
812 | 814 | ||
815 | kvm->arch.is_sn2 = ia64_platform_is("sn2"); | ||
816 | |||
813 | kvm->arch.metaphysical_rr0 = GUEST_PHYSICAL_RR0; | 817 | kvm->arch.metaphysical_rr0 = GUEST_PHYSICAL_RR0; |
814 | kvm->arch.metaphysical_rr4 = GUEST_PHYSICAL_RR4; | 818 | kvm->arch.metaphysical_rr4 = GUEST_PHYSICAL_RR4; |
815 | kvm->arch.vmm_init_rr = VMM_INIT_RR; | 819 | kvm->arch.vmm_init_rr = VMM_INIT_RR; |
@@ -823,21 +827,8 @@ static void kvm_init_vm(struct kvm *kvm) | |||
823 | 827 | ||
824 | /* Reserve bit 0 of irq_sources_bitmap for userspace irq source */ | 828 | /* Reserve bit 0 of irq_sources_bitmap for userspace irq source */ |
825 | set_bit(KVM_USERSPACE_IRQ_SOURCE_ID, &kvm->arch.irq_sources_bitmap); | 829 | set_bit(KVM_USERSPACE_IRQ_SOURCE_ID, &kvm->arch.irq_sources_bitmap); |
826 | } | ||
827 | |||
828 | struct kvm *kvm_arch_create_vm(void) | ||
829 | { | ||
830 | struct kvm *kvm = kvm_alloc_kvm(); | ||
831 | |||
832 | if (IS_ERR(kvm)) | ||
833 | return ERR_PTR(-ENOMEM); | ||
834 | |||
835 | kvm->arch.is_sn2 = ia64_platform_is("sn2"); | ||
836 | |||
837 | kvm_init_vm(kvm); | ||
838 | |||
839 | return kvm; | ||
840 | 830 | ||
831 | return 0; | ||
841 | } | 832 | } |
842 | 833 | ||
843 | static int kvm_vm_ioctl_get_irqchip(struct kvm *kvm, | 834 | static int kvm_vm_ioctl_get_irqchip(struct kvm *kvm, |
@@ -962,7 +953,9 @@ long kvm_arch_vm_ioctl(struct file *filp, | |||
962 | goto out; | 953 | goto out; |
963 | r = kvm_setup_default_irq_routing(kvm); | 954 | r = kvm_setup_default_irq_routing(kvm); |
964 | if (r) { | 955 | if (r) { |
956 | mutex_lock(&kvm->slots_lock); | ||
965 | kvm_ioapic_destroy(kvm); | 957 | kvm_ioapic_destroy(kvm); |
958 | mutex_unlock(&kvm->slots_lock); | ||
966 | goto out; | 959 | goto out; |
967 | } | 960 | } |
968 | break; | 961 | break; |
@@ -1357,7 +1350,7 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu, | |||
1357 | return -EINVAL; | 1350 | return -EINVAL; |
1358 | } | 1351 | } |
1359 | 1352 | ||
1360 | static void free_kvm(struct kvm *kvm) | 1353 | void kvm_arch_free_vm(struct kvm *kvm) |
1361 | { | 1354 | { |
1362 | unsigned long vm_base = kvm->arch.vm_base; | 1355 | unsigned long vm_base = kvm->arch.vm_base; |
1363 | 1356 | ||
@@ -1399,9 +1392,6 @@ void kvm_arch_destroy_vm(struct kvm *kvm) | |||
1399 | #endif | 1392 | #endif |
1400 | kfree(kvm->arch.vioapic); | 1393 | kfree(kvm->arch.vioapic); |
1401 | kvm_release_vm_pages(kvm); | 1394 | kvm_release_vm_pages(kvm); |
1402 | kvm_free_physmem(kvm); | ||
1403 | cleanup_srcu_struct(&kvm->srcu); | ||
1404 | free_kvm(kvm); | ||
1405 | } | 1395 | } |
1406 | 1396 | ||
1407 | void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) | 1397 | void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) |
diff --git a/arch/ia64/kvm/lapic.h b/arch/ia64/kvm/lapic.h index ee541cebcd78..c5f92a926a9a 100644 --- a/arch/ia64/kvm/lapic.h +++ b/arch/ia64/kvm/lapic.h | |||
@@ -25,5 +25,6 @@ int kvm_apic_match_dest(struct kvm_vcpu *vcpu, struct kvm_lapic *source, | |||
25 | int kvm_apic_compare_prio(struct kvm_vcpu *vcpu1, struct kvm_vcpu *vcpu2); | 25 | int kvm_apic_compare_prio(struct kvm_vcpu *vcpu1, struct kvm_vcpu *vcpu2); |
26 | int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq); | 26 | int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq); |
27 | #define kvm_apic_present(x) (true) | 27 | #define kvm_apic_present(x) (true) |
28 | #define kvm_lapic_enabled(x) (true) | ||
28 | 29 | ||
29 | #endif | 30 | #endif |
diff --git a/arch/ia64/kvm/mmio.c b/arch/ia64/kvm/mmio.c index fb8f9f59a1ed..f1e17d3d6cd9 100644 --- a/arch/ia64/kvm/mmio.c +++ b/arch/ia64/kvm/mmio.c | |||
@@ -130,7 +130,7 @@ static void mmio_access(struct kvm_vcpu *vcpu, u64 src_pa, u64 *dest, | |||
130 | 130 | ||
131 | local_irq_save(psr); | 131 | local_irq_save(psr); |
132 | 132 | ||
133 | /*Intercept the acces for PIB range*/ | 133 | /*Intercept the access for PIB range*/ |
134 | if (iot == GPFN_PIB) { | 134 | if (iot == GPFN_PIB) { |
135 | if (!dir) | 135 | if (!dir) |
136 | lsapic_write(vcpu, src_pa, s, *dest); | 136 | lsapic_write(vcpu, src_pa, s, *dest); |
diff --git a/arch/ia64/kvm/process.c b/arch/ia64/kvm/process.c index bb862fb224f2..b0398740b48d 100644 --- a/arch/ia64/kvm/process.c +++ b/arch/ia64/kvm/process.c | |||
@@ -987,7 +987,7 @@ static void vmm_sanity_check(struct kvm_vcpu *vcpu) | |||
987 | 987 | ||
988 | static void kvm_do_resume_op(struct kvm_vcpu *vcpu) | 988 | static void kvm_do_resume_op(struct kvm_vcpu *vcpu) |
989 | { | 989 | { |
990 | vmm_sanity_check(vcpu); /*Guarantee vcpu runing on healthy vmm!*/ | 990 | vmm_sanity_check(vcpu); /*Guarantee vcpu running on healthy vmm!*/ |
991 | 991 | ||
992 | if (test_and_clear_bit(KVM_REQ_RESUME, &vcpu->requests)) { | 992 | if (test_and_clear_bit(KVM_REQ_RESUME, &vcpu->requests)) { |
993 | vcpu_do_resume(vcpu); | 993 | vcpu_do_resume(vcpu); |
diff --git a/arch/ia64/kvm/vti.h b/arch/ia64/kvm/vti.h index f6c5617e16af..b214b5b0432d 100644 --- a/arch/ia64/kvm/vti.h +++ b/arch/ia64/kvm/vti.h | |||
@@ -83,13 +83,13 @@ | |||
83 | union vac { | 83 | union vac { |
84 | unsigned long value; | 84 | unsigned long value; |
85 | struct { | 85 | struct { |
86 | int a_int:1; | 86 | unsigned int a_int:1; |
87 | int a_from_int_cr:1; | 87 | unsigned int a_from_int_cr:1; |
88 | int a_to_int_cr:1; | 88 | unsigned int a_to_int_cr:1; |
89 | int a_from_psr:1; | 89 | unsigned int a_from_psr:1; |
90 | int a_from_cpuid:1; | 90 | unsigned int a_from_cpuid:1; |
91 | int a_cover:1; | 91 | unsigned int a_cover:1; |
92 | int a_bsw:1; | 92 | unsigned int a_bsw:1; |
93 | long reserved:57; | 93 | long reserved:57; |
94 | }; | 94 | }; |
95 | }; | 95 | }; |
@@ -97,12 +97,12 @@ union vac { | |||
97 | union vdc { | 97 | union vdc { |
98 | unsigned long value; | 98 | unsigned long value; |
99 | struct { | 99 | struct { |
100 | int d_vmsw:1; | 100 | unsigned int d_vmsw:1; |
101 | int d_extint:1; | 101 | unsigned int d_extint:1; |
102 | int d_ibr_dbr:1; | 102 | unsigned int d_ibr_dbr:1; |
103 | int d_pmc:1; | 103 | unsigned int d_pmc:1; |
104 | int d_to_pmd:1; | 104 | unsigned int d_to_pmd:1; |
105 | int d_itm:1; | 105 | unsigned int d_itm:1; |
106 | long reserved:58; | 106 | long reserved:58; |
107 | }; | 107 | }; |
108 | }; | 108 | }; |