aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kvm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/kvm')
-rw-r--r--arch/arm/kvm/Kconfig12
-rw-r--r--arch/arm/kvm/arm.c4
-rw-r--r--arch/arm/kvm/interrupts_head.S6
-rw-r--r--arch/arm/kvm/mmu.c6
-rw-r--r--arch/arm/kvm/psci.c12
5 files changed, 19 insertions, 21 deletions
diff --git a/arch/arm/kvm/Kconfig b/arch/arm/kvm/Kconfig
index bfb915d05665..356970f3b25e 100644
--- a/arch/arm/kvm/Kconfig
+++ b/arch/arm/kvm/Kconfig
@@ -21,6 +21,7 @@ config KVM
21 depends on MMU && OF 21 depends on MMU && OF
22 select PREEMPT_NOTIFIERS 22 select PREEMPT_NOTIFIERS
23 select ANON_INODES 23 select ANON_INODES
24 select ARM_GIC
24 select HAVE_KVM_CPU_RELAX_INTERCEPT 25 select HAVE_KVM_CPU_RELAX_INTERCEPT
25 select HAVE_KVM_ARCH_TLB_FLUSH_ALL 26 select HAVE_KVM_ARCH_TLB_FLUSH_ALL
26 select KVM_MMIO 27 select KVM_MMIO
@@ -45,15 +46,4 @@ config KVM_ARM_HOST
45 ---help--- 46 ---help---
46 Provides host support for ARM processors. 47 Provides host support for ARM processors.
47 48
48config KVM_ARM_MAX_VCPUS
49 int "Number maximum supported virtual CPUs per VM"
50 depends on KVM_ARM_HOST
51 default 4
52 help
53 Static number of max supported virtual CPUs per VM.
54
55 If you choose a high number, the vcpu structures will be quite
56 large, so only choose a reasonable number that you expect to
57 actually use.
58
59endif # VIRTUALIZATION 49endif # VIRTUALIZATION
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index ce404a5c3062..78b286994577 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -446,7 +446,7 @@ static int kvm_vcpu_first_run_init(struct kvm_vcpu *vcpu)
446 * Map the VGIC hardware resources before running a vcpu the first 446 * Map the VGIC hardware resources before running a vcpu the first
447 * time on this VM. 447 * time on this VM.
448 */ 448 */
449 if (unlikely(!vgic_ready(kvm))) { 449 if (unlikely(irqchip_in_kernel(kvm) && !vgic_ready(kvm))) {
450 ret = kvm_vgic_map_resources(kvm); 450 ret = kvm_vgic_map_resources(kvm);
451 if (ret) 451 if (ret)
452 return ret; 452 return ret;
@@ -1080,7 +1080,7 @@ static int init_hyp_mode(void)
1080 */ 1080 */
1081 err = kvm_timer_hyp_init(); 1081 err = kvm_timer_hyp_init();
1082 if (err) 1082 if (err)
1083 goto out_free_mappings; 1083 goto out_free_context;
1084 1084
1085#ifndef CONFIG_HOTPLUG_CPU 1085#ifndef CONFIG_HOTPLUG_CPU
1086 free_boot_hyp_pgd(); 1086 free_boot_hyp_pgd();
diff --git a/arch/arm/kvm/interrupts_head.S b/arch/arm/kvm/interrupts_head.S
index 702740d37465..51a59504bef4 100644
--- a/arch/arm/kvm/interrupts_head.S
+++ b/arch/arm/kvm/interrupts_head.S
@@ -515,8 +515,7 @@ ARM_BE8(rev r6, r6 )
515 515
516 mrc p15, 0, r2, c14, c3, 1 @ CNTV_CTL 516 mrc p15, 0, r2, c14, c3, 1 @ CNTV_CTL
517 str r2, [vcpu, #VCPU_TIMER_CNTV_CTL] 517 str r2, [vcpu, #VCPU_TIMER_CNTV_CTL]
518 bic r2, #1 @ Clear ENABLE 518
519 mcr p15, 0, r2, c14, c3, 1 @ CNTV_CTL
520 isb 519 isb
521 520
522 mrrc p15, 3, rr_lo_hi(r2, r3), c14 @ CNTV_CVAL 521 mrrc p15, 3, rr_lo_hi(r2, r3), c14 @ CNTV_CVAL
@@ -529,6 +528,9 @@ ARM_BE8(rev r6, r6 )
529 mcrr p15, 4, r2, r2, c14 @ CNTVOFF 528 mcrr p15, 4, r2, r2, c14 @ CNTVOFF
530 529
5311: 5301:
531 mov r2, #0 @ Clear ENABLE
532 mcr p15, 0, r2, c14, c3, 1 @ CNTV_CTL
533
532 @ Allow physical timer/counter access for the host 534 @ Allow physical timer/counter access for the host
533 mrc p15, 4, r2, c14, c1, 0 @ CNTHCTL 535 mrc p15, 4, r2, c14, c1, 0 @ CNTHCTL
534 orr r2, r2, #(CNTHCTL_PL1PCEN | CNTHCTL_PL1PCTEN) 536 orr r2, r2, #(CNTHCTL_PL1PCEN | CNTHCTL_PL1PCTEN)
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index 7b4201294187..6984342da13d 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -1792,8 +1792,10 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
1792 if (vma->vm_flags & VM_PFNMAP) { 1792 if (vma->vm_flags & VM_PFNMAP) {
1793 gpa_t gpa = mem->guest_phys_addr + 1793 gpa_t gpa = mem->guest_phys_addr +
1794 (vm_start - mem->userspace_addr); 1794 (vm_start - mem->userspace_addr);
1795 phys_addr_t pa = (vma->vm_pgoff << PAGE_SHIFT) + 1795 phys_addr_t pa;
1796 vm_start - vma->vm_start; 1796
1797 pa = (phys_addr_t)vma->vm_pgoff << PAGE_SHIFT;
1798 pa += vm_start - vma->vm_start;
1797 1799
1798 /* IO region dirty page logging not allowed */ 1800 /* IO region dirty page logging not allowed */
1799 if (memslot->flags & KVM_MEM_LOG_DIRTY_PAGES) 1801 if (memslot->flags & KVM_MEM_LOG_DIRTY_PAGES)
diff --git a/arch/arm/kvm/psci.c b/arch/arm/kvm/psci.c
index 4b94b513168d..ad6f6424f1d1 100644
--- a/arch/arm/kvm/psci.c
+++ b/arch/arm/kvm/psci.c
@@ -126,7 +126,7 @@ static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu)
126 126
127static unsigned long kvm_psci_vcpu_affinity_info(struct kvm_vcpu *vcpu) 127static unsigned long kvm_psci_vcpu_affinity_info(struct kvm_vcpu *vcpu)
128{ 128{
129 int i; 129 int i, matching_cpus = 0;
130 unsigned long mpidr; 130 unsigned long mpidr;
131 unsigned long target_affinity; 131 unsigned long target_affinity;
132 unsigned long target_affinity_mask; 132 unsigned long target_affinity_mask;
@@ -151,12 +151,16 @@ static unsigned long kvm_psci_vcpu_affinity_info(struct kvm_vcpu *vcpu)
151 */ 151 */
152 kvm_for_each_vcpu(i, tmp, kvm) { 152 kvm_for_each_vcpu(i, tmp, kvm) {
153 mpidr = kvm_vcpu_get_mpidr_aff(tmp); 153 mpidr = kvm_vcpu_get_mpidr_aff(tmp);
154 if (((mpidr & target_affinity_mask) == target_affinity) && 154 if ((mpidr & target_affinity_mask) == target_affinity) {
155 !tmp->arch.pause) { 155 matching_cpus++;
156 return PSCI_0_2_AFFINITY_LEVEL_ON; 156 if (!tmp->arch.pause)
157 return PSCI_0_2_AFFINITY_LEVEL_ON;
157 } 158 }
158 } 159 }
159 160
161 if (!matching_cpus)
162 return PSCI_RET_INVALID_PARAMS;
163
160 return PSCI_0_2_AFFINITY_LEVEL_OFF; 164 return PSCI_0_2_AFFINITY_LEVEL_OFF;
161} 165}
162 166