···23272327Capability: basic23282328Architectures: arm, arm6423292329Type: vcpu ioctl23302330-Parameters: struct struct kvm_vcpu_init (in)23302330+Parameters: struct kvm_vcpu_init (in)23312331Returns: 0 on success; -1 on error23322332Errors:23332333 EINVAL: the target is unknown, or the combination of features is invalid.
···489489 return ret;490490 }491491492492- /*493493- * Handle the "start in power-off" case by calling into the494494- * PSCI code.495495- */496496- if (test_and_clear_bit(KVM_ARM_VCPU_POWER_OFF, vcpu->arch.features)) {497497- *vcpu_reg(vcpu, 0) = KVM_PSCI_FN_CPU_OFF;498498- kvm_psci_call(vcpu);499499- }500500-501492 return 0;502493}503494···702711 return -EINVAL;703712}704713714714+static int kvm_arch_vcpu_ioctl_vcpu_init(struct kvm_vcpu *vcpu,715715+ struct kvm_vcpu_init *init)716716+{717717+ int ret;718718+719719+ ret = kvm_vcpu_set_target(vcpu, init);720720+ if (ret)721721+ return ret;722722+723723+ /*724724+ * Handle the "start in power-off" case by marking the VCPU as paused.725725+ */726726+ if (__test_and_clear_bit(KVM_ARM_VCPU_POWER_OFF, vcpu->arch.features))727727+ vcpu->arch.pause = true;728728+729729+ return 0;730730+}731731+705732long kvm_arch_vcpu_ioctl(struct file *filp,706733 unsigned int ioctl, unsigned long arg)707734{···733724 if (copy_from_user(&init, argp, sizeof(init)))734725 return -EFAULT;735726736736- return kvm_vcpu_set_target(vcpu, &init);737737-727727+ return kvm_arch_vcpu_ioctl_vcpu_init(vcpu, &init);738728 }739729 case KVM_SET_ONE_REG:740730 case KVM_GET_ONE_REG: {
-2
arch/arm/kvm/handle_exit.c
···26262727#include "trace.h"28282929-#include "trace.h"3030-3129typedef int (*exit_handle_fn)(struct kvm_vcpu *, struct kvm_run *);32303331static int handle_svc_hyp(struct kvm_vcpu *vcpu, struct kvm_run *run)
+13-11
arch/arm/kvm/mmu.c
···667667 gfn = (fault_ipa & PMD_MASK) >> PAGE_SHIFT;668668 } else {669669 /*670670- * Pages belonging to VMAs not aligned to the PMD mapping671671- * granularity cannot be mapped using block descriptors even672672- * if the pages belong to a THP for the process, because the673673- * stage-2 block descriptor will cover more than a single THP674674- * and we loose atomicity for unmapping, updates, and splits675675- * of the THP or other pages in the stage-2 block range.670670+ * Pages belonging to memslots that don't have the same671671+ * alignment for userspace and IPA cannot be mapped using672672+ * block descriptors even if the pages belong to a THP for673673+ * the process, because the stage-2 block descriptor will674674+ * cover more than a single THP and we loose atomicity for675675+ * unmapping, updates, and splits of the THP or other pages676676+ * in the stage-2 block range.676677 */677677- if (vma->vm_start & ~PMD_MASK)678678+ if ((memslot->userspace_addr & ~PMD_MASK) !=679679+ ((memslot->base_gfn << PAGE_SHIFT) & ~PMD_MASK))678680 force_pte = true;679681 }680682 up_read(¤t->mm->mmap_sem);···918916{919917 int err;920918921921- hyp_idmap_start = virt_to_phys(__hyp_idmap_text_start);922922- hyp_idmap_end = virt_to_phys(__hyp_idmap_text_end);923923- hyp_idmap_vector = virt_to_phys(__kvm_hyp_init);919919+ hyp_idmap_start = kvm_virt_to_phys(__hyp_idmap_text_start);920920+ hyp_idmap_end = kvm_virt_to_phys(__hyp_idmap_text_end);921921+ hyp_idmap_vector = kvm_virt_to_phys(__kvm_hyp_init);924922925923 if ((hyp_idmap_start ^ hyp_idmap_end) & PAGE_MASK) {926924 /*···947945 */948946 kvm_flush_dcache_to_poc(init_bounce_page, len);949947950950- phys_base = virt_to_phys(init_bounce_page);948948+ phys_base = kvm_virt_to_phys(init_bounce_page);951949 hyp_idmap_vector += phys_base - hyp_idmap_start;952950 hyp_idmap_start = phys_base;953951 hyp_idmap_end = phys_base + len;
+6-5
arch/arm/kvm/psci.c
···5454 }5555 }56565757- if (!vcpu)5757+ /*5858+ * Make sure the caller requested a valid CPU and that the CPU is5959+ * turned off.6060+ */6161+ if (!vcpu || !vcpu->arch.pause)5862 return KVM_PSCI_RET_INVAL;59636064 target_pc = *vcpu_reg(source_vcpu, 2);6161-6262- wq = kvm_arch_vcpu_wq(vcpu);6363- if (!waitqueue_active(wq))6464- return KVM_PSCI_RET_INVAL;65656666 kvm_reset_vcpu(vcpu);6767···7979 vcpu->arch.pause = false;8080 smp_mb(); /* Make sure the above is visible */81818282+ wq = kvm_arch_vcpu_wq(vcpu);8283 wake_up_interruptible(wq);83848485 return KVM_PSCI_RET_SUCCESS;