diff options
Diffstat (limited to 'arch/ia64/kvm/kvm-ia64.c')
-rw-r--r-- | arch/ia64/kvm/kvm-ia64.c | 56 |
1 files changed, 16 insertions, 40 deletions
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c index 21b701374f72..f56a6316e134 100644 --- a/arch/ia64/kvm/kvm-ia64.c +++ b/arch/ia64/kvm/kvm-ia64.c | |||
@@ -725,8 +725,6 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
725 | int r; | 725 | int r; |
726 | sigset_t sigsaved; | 726 | sigset_t sigsaved; |
727 | 727 | ||
728 | vcpu_load(vcpu); | ||
729 | |||
730 | if (vcpu->sigset_active) | 728 | if (vcpu->sigset_active) |
731 | sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); | 729 | sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); |
732 | 730 | ||
@@ -748,7 +746,6 @@ out: | |||
748 | if (vcpu->sigset_active) | 746 | if (vcpu->sigset_active) |
749 | sigprocmask(SIG_SETMASK, &sigsaved, NULL); | 747 | sigprocmask(SIG_SETMASK, &sigsaved, NULL); |
750 | 748 | ||
751 | vcpu_put(vcpu); | ||
752 | return r; | 749 | return r; |
753 | } | 750 | } |
754 | 751 | ||
@@ -883,8 +880,6 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) | |||
883 | struct vpd *vpd = to_host(vcpu->kvm, vcpu->arch.vpd); | 880 | struct vpd *vpd = to_host(vcpu->kvm, vcpu->arch.vpd); |
884 | int i; | 881 | int i; |
885 | 882 | ||
886 | vcpu_load(vcpu); | ||
887 | |||
888 | for (i = 0; i < 16; i++) { | 883 | for (i = 0; i < 16; i++) { |
889 | vpd->vgr[i] = regs->vpd.vgr[i]; | 884 | vpd->vgr[i] = regs->vpd.vgr[i]; |
890 | vpd->vbgr[i] = regs->vpd.vbgr[i]; | 885 | vpd->vbgr[i] = regs->vpd.vbgr[i]; |
@@ -931,8 +926,6 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) | |||
931 | vcpu->arch.itc_offset = regs->saved_itc - kvm_get_itc(vcpu); | 926 | vcpu->arch.itc_offset = regs->saved_itc - kvm_get_itc(vcpu); |
932 | set_bit(KVM_REQ_RESUME, &vcpu->requests); | 927 | set_bit(KVM_REQ_RESUME, &vcpu->requests); |
933 | 928 | ||
934 | vcpu_put(vcpu); | ||
935 | |||
936 | return 0; | 929 | return 0; |
937 | } | 930 | } |
938 | 931 | ||
@@ -1237,7 +1230,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | |||
1237 | p_ctx->cr[2] = (unsigned long)kvm_vmm_info->vmm_ivt; | 1230 | p_ctx->cr[2] = (unsigned long)kvm_vmm_info->vmm_ivt; |
1238 | p_ctx->cr[8] = 0x3c; | 1231 | p_ctx->cr[8] = 0x3c; |
1239 | 1232 | ||
1240 | /*Initilize region register*/ | 1233 | /*Initialize region register*/ |
1241 | p_ctx->rr[0] = 0x30; | 1234 | p_ctx->rr[0] = 0x30; |
1242 | p_ctx->rr[1] = 0x30; | 1235 | p_ctx->rr[1] = 0x30; |
1243 | p_ctx->rr[2] = 0x30; | 1236 | p_ctx->rr[2] = 0x30; |
@@ -1246,7 +1239,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | |||
1246 | p_ctx->rr[5] = 0x30; | 1239 | p_ctx->rr[5] = 0x30; |
1247 | p_ctx->rr[7] = 0x30; | 1240 | p_ctx->rr[7] = 0x30; |
1248 | 1241 | ||
1249 | /*Initilize branch register 0*/ | 1242 | /*Initialize branch register 0*/ |
1250 | p_ctx->br[0] = *(unsigned long *)kvm_vmm_info->vmm_entry; | 1243 | p_ctx->br[0] = *(unsigned long *)kvm_vmm_info->vmm_entry; |
1251 | 1244 | ||
1252 | vcpu->arch.vmm_rr = kvm->arch.vmm_init_rr; | 1245 | vcpu->arch.vmm_rr = kvm->arch.vmm_init_rr; |
@@ -1707,7 +1700,7 @@ static int kvm_relocate_vmm(struct kvm_vmm_info *vmm_info, | |||
1707 | BUG_ON(!module); | 1700 | BUG_ON(!module); |
1708 | 1701 | ||
1709 | if (!kvm_vmm_base) { | 1702 | if (!kvm_vmm_base) { |
1710 | printk("kvm: kvm area hasn't been initilized yet!!\n"); | 1703 | printk("kvm: kvm area hasn't been initialized yet!!\n"); |
1711 | return -EFAULT; | 1704 | return -EFAULT; |
1712 | } | 1705 | } |
1713 | 1706 | ||
@@ -1802,35 +1795,24 @@ void kvm_arch_exit(void) | |||
1802 | kvm_vmm_info = NULL; | 1795 | kvm_vmm_info = NULL; |
1803 | } | 1796 | } |
1804 | 1797 | ||
1805 | static int kvm_ia64_sync_dirty_log(struct kvm *kvm, | 1798 | static void kvm_ia64_sync_dirty_log(struct kvm *kvm, |
1806 | struct kvm_dirty_log *log) | 1799 | struct kvm_memory_slot *memslot) |
1807 | { | 1800 | { |
1808 | struct kvm_memory_slot *memslot; | 1801 | int i; |
1809 | int r, i; | ||
1810 | long base; | 1802 | long base; |
1811 | unsigned long n; | 1803 | unsigned long n; |
1812 | unsigned long *dirty_bitmap = (unsigned long *)(kvm->arch.vm_base + | 1804 | unsigned long *dirty_bitmap = (unsigned long *)(kvm->arch.vm_base + |
1813 | offsetof(struct kvm_vm_data, kvm_mem_dirty_log)); | 1805 | offsetof(struct kvm_vm_data, kvm_mem_dirty_log)); |
1814 | 1806 | ||
1815 | r = -EINVAL; | ||
1816 | if (log->slot >= KVM_MEMORY_SLOTS) | ||
1817 | goto out; | ||
1818 | |||
1819 | memslot = &kvm->memslots->memslots[log->slot]; | ||
1820 | r = -ENOENT; | ||
1821 | if (!memslot->dirty_bitmap) | ||
1822 | goto out; | ||
1823 | |||
1824 | n = kvm_dirty_bitmap_bytes(memslot); | 1807 | n = kvm_dirty_bitmap_bytes(memslot); |
1825 | base = memslot->base_gfn / BITS_PER_LONG; | 1808 | base = memslot->base_gfn / BITS_PER_LONG; |
1826 | 1809 | ||
1810 | spin_lock(&kvm->arch.dirty_log_lock); | ||
1827 | for (i = 0; i < n/sizeof(long); ++i) { | 1811 | for (i = 0; i < n/sizeof(long); ++i) { |
1828 | memslot->dirty_bitmap[i] = dirty_bitmap[base + i]; | 1812 | memslot->dirty_bitmap[i] = dirty_bitmap[base + i]; |
1829 | dirty_bitmap[base + i] = 0; | 1813 | dirty_bitmap[base + i] = 0; |
1830 | } | 1814 | } |
1831 | r = 0; | 1815 | spin_unlock(&kvm->arch.dirty_log_lock); |
1832 | out: | ||
1833 | return r; | ||
1834 | } | 1816 | } |
1835 | 1817 | ||
1836 | int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, | 1818 | int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, |
@@ -1842,12 +1824,17 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, | |||
1842 | int is_dirty = 0; | 1824 | int is_dirty = 0; |
1843 | 1825 | ||
1844 | mutex_lock(&kvm->slots_lock); | 1826 | mutex_lock(&kvm->slots_lock); |
1845 | spin_lock(&kvm->arch.dirty_log_lock); | ||
1846 | 1827 | ||
1847 | r = kvm_ia64_sync_dirty_log(kvm, log); | 1828 | r = -EINVAL; |
1848 | if (r) | 1829 | if (log->slot >= KVM_MEMORY_SLOTS) |
1830 | goto out; | ||
1831 | |||
1832 | memslot = &kvm->memslots->memslots[log->slot]; | ||
1833 | r = -ENOENT; | ||
1834 | if (!memslot->dirty_bitmap) | ||
1849 | goto out; | 1835 | goto out; |
1850 | 1836 | ||
1837 | kvm_ia64_sync_dirty_log(kvm, memslot); | ||
1851 | r = kvm_get_dirty_log(kvm, log, &is_dirty); | 1838 | r = kvm_get_dirty_log(kvm, log, &is_dirty); |
1852 | if (r) | 1839 | if (r) |
1853 | goto out; | 1840 | goto out; |
@@ -1855,14 +1842,12 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, | |||
1855 | /* If nothing is dirty, don't bother messing with page tables. */ | 1842 | /* If nothing is dirty, don't bother messing with page tables. */ |
1856 | if (is_dirty) { | 1843 | if (is_dirty) { |
1857 | kvm_flush_remote_tlbs(kvm); | 1844 | kvm_flush_remote_tlbs(kvm); |
1858 | memslot = &kvm->memslots->memslots[log->slot]; | ||
1859 | n = kvm_dirty_bitmap_bytes(memslot); | 1845 | n = kvm_dirty_bitmap_bytes(memslot); |
1860 | memset(memslot->dirty_bitmap, 0, n); | 1846 | memset(memslot->dirty_bitmap, 0, n); |
1861 | } | 1847 | } |
1862 | r = 0; | 1848 | r = 0; |
1863 | out: | 1849 | out: |
1864 | mutex_unlock(&kvm->slots_lock); | 1850 | mutex_unlock(&kvm->slots_lock); |
1865 | spin_unlock(&kvm->arch.dirty_log_lock); | ||
1866 | return r; | 1851 | return r; |
1867 | } | 1852 | } |
1868 | 1853 | ||
@@ -1953,11 +1938,6 @@ int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu) | |||
1953 | return vcpu->arch.timer_fired; | 1938 | return vcpu->arch.timer_fired; |
1954 | } | 1939 | } |
1955 | 1940 | ||
1956 | gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn) | ||
1957 | { | ||
1958 | return gfn; | ||
1959 | } | ||
1960 | |||
1961 | int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) | 1941 | int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) |
1962 | { | 1942 | { |
1963 | return (vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE) || | 1943 | return (vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE) || |
@@ -1967,9 +1947,7 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) | |||
1967 | int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu, | 1947 | int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu, |
1968 | struct kvm_mp_state *mp_state) | 1948 | struct kvm_mp_state *mp_state) |
1969 | { | 1949 | { |
1970 | vcpu_load(vcpu); | ||
1971 | mp_state->mp_state = vcpu->arch.mp_state; | 1950 | mp_state->mp_state = vcpu->arch.mp_state; |
1972 | vcpu_put(vcpu); | ||
1973 | return 0; | 1951 | return 0; |
1974 | } | 1952 | } |
1975 | 1953 | ||
@@ -2000,10 +1978,8 @@ int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu, | |||
2000 | { | 1978 | { |
2001 | int r = 0; | 1979 | int r = 0; |
2002 | 1980 | ||
2003 | vcpu_load(vcpu); | ||
2004 | vcpu->arch.mp_state = mp_state->mp_state; | 1981 | vcpu->arch.mp_state = mp_state->mp_state; |
2005 | if (vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED) | 1982 | if (vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED) |
2006 | r = vcpu_reset(vcpu); | 1983 | r = vcpu_reset(vcpu); |
2007 | vcpu_put(vcpu); | ||
2008 | return r; | 1984 | return r; |
2009 | } | 1985 | } |