]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 27 Jun 2015 01:07:41 +0000 (18:07 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 27 Jun 2015 01:07:41 +0000 (18:07 -0700)
added patches:
arm-arm64-kvm-fix-and-refactor-unmap_range.patch
arm-kvm-unmap-ipa-on-memslot-delete-move.patch
arm-kvm-user_mem_abort-support-stage-2-mmio-page-mapping.patch
arm-virt-fix-wrong-hsctlr.ee-bit-setting.patch
arm64-kvm-export-demux-regids-as-kvm_reg_arm64.patch
arm64-kvm-store-kvm_vcpu_fault_info-est_el2-as-word.patch
kvm-arm-arm64-avoid-returning-negative-error-code-as-bool.patch
kvm-arm-arm64-fix-broken-__percpu-annotation.patch
kvm-arm-arm64-fix-non-const-declaration-of-function-returning-const.patch
kvm-vgic-return-int-instead-of-bool-when-checking-i-o-ranges.patch

queue-3.14/arm-arm64-kvm-fix-and-refactor-unmap_range.patch [new file with mode: 0644]
queue-3.14/arm-kvm-unmap-ipa-on-memslot-delete-move.patch [new file with mode: 0644]
queue-3.14/arm-kvm-user_mem_abort-support-stage-2-mmio-page-mapping.patch [new file with mode: 0644]
queue-3.14/arm-virt-fix-wrong-hsctlr.ee-bit-setting.patch [new file with mode: 0644]
queue-3.14/arm64-kvm-export-demux-regids-as-kvm_reg_arm64.patch [new file with mode: 0644]
queue-3.14/arm64-kvm-store-kvm_vcpu_fault_info-est_el2-as-word.patch [new file with mode: 0644]
queue-3.14/kvm-arm-arm64-avoid-returning-negative-error-code-as-bool.patch [new file with mode: 0644]
queue-3.14/kvm-arm-arm64-fix-broken-__percpu-annotation.patch [new file with mode: 0644]
queue-3.14/kvm-arm-arm64-fix-non-const-declaration-of-function-returning-const.patch [new file with mode: 0644]
queue-3.14/kvm-vgic-return-int-instead-of-bool-when-checking-i-o-ranges.patch [new file with mode: 0644]
queue-3.14/series

diff --git a/queue-3.14/arm-arm64-kvm-fix-and-refactor-unmap_range.patch b/queue-3.14/arm-arm64-kvm-fix-and-refactor-unmap_range.patch
new file mode 100644 (file)
index 0000000..feb001c
--- /dev/null
@@ -0,0 +1,264 @@
+From 4f853a714bf16338ff5261128e6c7ae2569e9505 Mon Sep 17 00:00:00 2001
+From: Christoffer Dall <christoffer.dall@linaro.org>
+Date: Fri, 9 May 2014 23:31:31 +0200
+Subject: arm/arm64: KVM: Fix and refactor unmap_range
+
+From: Christoffer Dall <christoffer.dall@linaro.org>
+
+commit 4f853a714bf16338ff5261128e6c7ae2569e9505 upstream.
+
+unmap_range() was utterly broken, to quote Marc, and broke in all sorts
+of situations.  It was also quite complicated to follow and didn't
+follow the usual scheme of having a separate iterating function for each
+level of page tables.
+
+Address this by refactoring the code and introduce a pgd_clear()
+function.
+
+Reviewed-by: Jungseok Lee <jays.lee@samsung.com>
+Reviewed-by: Mario Smarduch <m.smarduch@samsung.com>
+Acked-by: Marc Zyngier <marc.zyngier@arm.com>
+Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
+Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/arm/include/asm/kvm_mmu.h   |   12 +++
+ arch/arm/kvm/mmu.c               |  156 +++++++++++++++++++++------------------
+ arch/arm64/include/asm/kvm_mmu.h |   15 +++
+ 3 files changed, 111 insertions(+), 72 deletions(-)
+
+--- a/arch/arm/include/asm/kvm_mmu.h
++++ b/arch/arm/include/asm/kvm_mmu.h
+@@ -127,6 +127,18 @@ static inline void kvm_set_s2pmd_writabl
+       (__boundary - 1 < (end) - 1)? __boundary: (end);                \
+ })
++static inline bool kvm_page_empty(void *ptr)
++{
++      struct page *ptr_page = virt_to_page(ptr);
++      return page_count(ptr_page) == 1;
++}
++
++
++#define kvm_pte_table_empty(ptep) kvm_page_empty(ptep)
++#define kvm_pmd_table_empty(pmdp) kvm_page_empty(pmdp)
++#define kvm_pud_table_empty(pudp) (0)
++
++
+ struct kvm;
+ #define kvm_flush_dcache_to_poc(a,l)  __cpuc_flush_dcache_area((a), (l))
+--- a/arch/arm/kvm/mmu.c
++++ b/arch/arm/kvm/mmu.c
+@@ -90,103 +90,115 @@ static void *mmu_memory_cache_alloc(stru
+       return p;
+ }
+-static bool page_empty(void *ptr)
++static void clear_pgd_entry(struct kvm *kvm, pgd_t *pgd, phys_addr_t addr)
+ {
+-      struct page *ptr_page = virt_to_page(ptr);
+-      return page_count(ptr_page) == 1;
++      pud_t *pud_table __maybe_unused = pud_offset(pgd, 0);
++      pgd_clear(pgd);
++      kvm_tlb_flush_vmid_ipa(kvm, addr);
++      pud_free(NULL, pud_table);
++      put_page(virt_to_page(pgd));
+ }
+ static void clear_pud_entry(struct kvm *kvm, pud_t *pud, phys_addr_t addr)
+ {
+-      if (pud_huge(*pud)) {
+-              pud_clear(pud);
+-              kvm_tlb_flush_vmid_ipa(kvm, addr);
+-      } else {
+-              pmd_t *pmd_table = pmd_offset(pud, 0);
+-              pud_clear(pud);
+-              kvm_tlb_flush_vmid_ipa(kvm, addr);
+-              pmd_free(NULL, pmd_table);
+-      }
++      pmd_t *pmd_table = pmd_offset(pud, 0);
++      VM_BUG_ON(pud_huge(*pud));
++      pud_clear(pud);
++      kvm_tlb_flush_vmid_ipa(kvm, addr);
++      pmd_free(NULL, pmd_table);
+       put_page(virt_to_page(pud));
+ }
+ static void clear_pmd_entry(struct kvm *kvm, pmd_t *pmd, phys_addr_t addr)
+ {
+-      if (kvm_pmd_huge(*pmd)) {
+-              pmd_clear(pmd);
+-              kvm_tlb_flush_vmid_ipa(kvm, addr);
+-      } else {
+-              pte_t *pte_table = pte_offset_kernel(pmd, 0);
+-              pmd_clear(pmd);
+-              kvm_tlb_flush_vmid_ipa(kvm, addr);
+-              pte_free_kernel(NULL, pte_table);
+-      }
++      pte_t *pte_table = pte_offset_kernel(pmd, 0);
++      VM_BUG_ON(kvm_pmd_huge(*pmd));
++      pmd_clear(pmd);
++      kvm_tlb_flush_vmid_ipa(kvm, addr);
++      pte_free_kernel(NULL, pte_table);
+       put_page(virt_to_page(pmd));
+ }
+-static void clear_pte_entry(struct kvm *kvm, pte_t *pte, phys_addr_t addr)
++static void unmap_ptes(struct kvm *kvm, pmd_t *pmd,
++                    phys_addr_t addr, phys_addr_t end)
+ {
+-      if (pte_present(*pte)) {
+-              kvm_set_pte(pte, __pte(0));
+-              put_page(virt_to_page(pte));
+-              kvm_tlb_flush_vmid_ipa(kvm, addr);
++      phys_addr_t start_addr = addr;
++      pte_t *pte, *start_pte;
++
++      start_pte = pte = pte_offset_kernel(pmd, addr);
++      do {
++              if (!pte_none(*pte)) {
++                      kvm_set_pte(pte, __pte(0));
++                      put_page(virt_to_page(pte));
++                      kvm_tlb_flush_vmid_ipa(kvm, addr);
++              }
++      } while (pte++, addr += PAGE_SIZE, addr != end);
++
++      if (kvm_pte_table_empty(start_pte))
++              clear_pmd_entry(kvm, pmd, start_addr);
+       }
+-}
+-static void unmap_range(struct kvm *kvm, pgd_t *pgdp,
+-                      unsigned long long start, u64 size)
++static void unmap_pmds(struct kvm *kvm, pud_t *pud,
++                    phys_addr_t addr, phys_addr_t end)
+ {
+-      pgd_t *pgd;
+-      pud_t *pud;
+-      pmd_t *pmd;
+-      pte_t *pte;
+-      unsigned long long addr = start, end = start + size;
+-      u64 next;
+-
+-      while (addr < end) {
+-              pgd = pgdp + pgd_index(addr);
+-              pud = pud_offset(pgd, addr);
+-              if (pud_none(*pud)) {
+-                      addr = kvm_pud_addr_end(addr, end);
+-                      continue;
+-              }
++      phys_addr_t next, start_addr = addr;
++      pmd_t *pmd, *start_pmd;
+-              if (pud_huge(*pud)) {
+-                      /*
+-                       * If we are dealing with a huge pud, just clear it and
+-                       * move on.
+-                       */
+-                      clear_pud_entry(kvm, pud, addr);
+-                      addr = kvm_pud_addr_end(addr, end);
+-                      continue;
++      start_pmd = pmd = pmd_offset(pud, addr);
++      do {
++              next = kvm_pmd_addr_end(addr, end);
++              if (!pmd_none(*pmd)) {
++                      if (kvm_pmd_huge(*pmd)) {
++                              pmd_clear(pmd);
++                              kvm_tlb_flush_vmid_ipa(kvm, addr);
++                              put_page(virt_to_page(pmd));
++                      } else {
++                              unmap_ptes(kvm, pmd, addr, next);
++                      }
+               }
++      } while (pmd++, addr = next, addr != end);
+-              pmd = pmd_offset(pud, addr);
+-              if (pmd_none(*pmd)) {
+-                      addr = kvm_pmd_addr_end(addr, end);
+-                      continue;
+-              }
++      if (kvm_pmd_table_empty(start_pmd))
++              clear_pud_entry(kvm, pud, start_addr);
++}
+-              if (!kvm_pmd_huge(*pmd)) {
+-                      pte = pte_offset_kernel(pmd, addr);
+-                      clear_pte_entry(kvm, pte, addr);
+-                      next = addr + PAGE_SIZE;
+-              }
++static void unmap_puds(struct kvm *kvm, pgd_t *pgd,
++                    phys_addr_t addr, phys_addr_t end)
++{
++      phys_addr_t next, start_addr = addr;
++      pud_t *pud, *start_pud;
+-              /*
+-               * If the pmd entry is to be cleared, walk back up the ladder
+-               */
+-              if (kvm_pmd_huge(*pmd) || page_empty(pte)) {
+-                      clear_pmd_entry(kvm, pmd, addr);
+-                      next = kvm_pmd_addr_end(addr, end);
+-                      if (page_empty(pmd) && !page_empty(pud)) {
+-                              clear_pud_entry(kvm, pud, addr);
+-                              next = kvm_pud_addr_end(addr, end);
++      start_pud = pud = pud_offset(pgd, addr);
++      do {
++              next = kvm_pud_addr_end(addr, end);
++              if (!pud_none(*pud)) {
++                      if (pud_huge(*pud)) {
++                              pud_clear(pud);
++                              kvm_tlb_flush_vmid_ipa(kvm, addr);
++                              put_page(virt_to_page(pud));
++                      } else {
++                              unmap_pmds(kvm, pud, addr, next);
+                       }
+               }
++      } while (pud++, addr = next, addr != end);
+-              addr = next;
+-      }
++      if (kvm_pud_table_empty(start_pud))
++              clear_pgd_entry(kvm, pgd, start_addr);
++}
++
++
++static void unmap_range(struct kvm *kvm, pgd_t *pgdp,
++                     phys_addr_t start, u64 size)
++{
++      pgd_t *pgd;
++      phys_addr_t addr = start, end = start + size;
++      phys_addr_t next;
++
++      pgd = pgdp + pgd_index(addr);
++      do {
++              next = kvm_pgd_addr_end(addr, end);
++              unmap_puds(kvm, pgd, addr, next);
++      } while (pgd++, addr = next, addr != end);
+ }
+ static void stage2_flush_ptes(struct kvm *kvm, pmd_t *pmd,
+--- a/arch/arm64/include/asm/kvm_mmu.h
++++ b/arch/arm64/include/asm/kvm_mmu.h
+@@ -125,6 +125,21 @@ static inline void kvm_set_s2pmd_writabl
+ #define kvm_pud_addr_end(addr, end)   pud_addr_end(addr, end)
+ #define kvm_pmd_addr_end(addr, end)   pmd_addr_end(addr, end)
++static inline bool kvm_page_empty(void *ptr)
++{
++      struct page *ptr_page = virt_to_page(ptr);
++      return page_count(ptr_page) == 1;
++}
++
++#define kvm_pte_table_empty(ptep) kvm_page_empty(ptep)
++#ifndef CONFIG_ARM64_64K_PAGES
++#define kvm_pmd_table_empty(pmdp) kvm_page_empty(pmdp)
++#else
++#define kvm_pmd_table_empty(pmdp) (0)
++#endif
++#define kvm_pud_table_empty(pudp) (0)
++
++
+ struct kvm;
+ #define kvm_flush_dcache_to_poc(a,l)  __flush_dcache_area((a), (l))
diff --git a/queue-3.14/arm-kvm-unmap-ipa-on-memslot-delete-move.patch b/queue-3.14/arm-kvm-unmap-ipa-on-memslot-delete-move.patch
new file mode 100644 (file)
index 0000000..25992f8
--- /dev/null
@@ -0,0 +1,131 @@
+From df6ce24f2ee485c4f9a5cb610063a5eb60da8267 Mon Sep 17 00:00:00 2001
+From: Eric Auger <eric.auger@linaro.org>
+Date: Fri, 6 Jun 2014 11:10:23 +0200
+Subject: ARM: KVM: Unmap IPA on memslot delete/move
+
+From: Eric Auger <eric.auger@linaro.org>
+
+commit df6ce24f2ee485c4f9a5cb610063a5eb60da8267 upstream.
+
+Currently when a KVM region is deleted or moved after
+KVM_SET_USER_MEMORY_REGION ioctl, the corresponding
+intermediate physical memory is not unmapped.
+
+This patch corrects this and unmaps the region's IPA range
+in kvm_arch_commit_memory_region using unmap_stage2_range.
+
+Signed-off-by: Eric Auger <eric.auger@linaro.org>
+Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
+Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/kvm/arm.c |   37 -------------------------------------
+ arch/arm/kvm/mmu.c |   46 ++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 46 insertions(+), 37 deletions(-)
+
+--- a/arch/arm/kvm/arm.c
++++ b/arch/arm/kvm/arm.c
+@@ -155,16 +155,6 @@ int kvm_arch_vcpu_fault(struct kvm_vcpu
+       return VM_FAULT_SIGBUS;
+ }
+-void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
+-                         struct kvm_memory_slot *dont)
+-{
+-}
+-
+-int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
+-                          unsigned long npages)
+-{
+-      return 0;
+-}
+ /**
+  * kvm_arch_destroy_vm - destroy the VM data structure
+@@ -224,33 +214,6 @@ long kvm_arch_dev_ioctl(struct file *fil
+       return -EINVAL;
+ }
+-void kvm_arch_memslots_updated(struct kvm *kvm)
+-{
+-}
+-
+-int kvm_arch_prepare_memory_region(struct kvm *kvm,
+-                                 struct kvm_memory_slot *memslot,
+-                                 struct kvm_userspace_memory_region *mem,
+-                                 enum kvm_mr_change change)
+-{
+-      return 0;
+-}
+-
+-void kvm_arch_commit_memory_region(struct kvm *kvm,
+-                                 struct kvm_userspace_memory_region *mem,
+-                                 const struct kvm_memory_slot *old,
+-                                 enum kvm_mr_change change)
+-{
+-}
+-
+-void kvm_arch_flush_shadow_all(struct kvm *kvm)
+-{
+-}
+-
+-void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
+-                                 struct kvm_memory_slot *slot)
+-{
+-}
+ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
+ {
+--- a/arch/arm/kvm/mmu.c
++++ b/arch/arm/kvm/mmu.c
+@@ -1111,3 +1111,49 @@ out:
+       free_hyp_pgds();
+       return err;
+ }
++
++void kvm_arch_commit_memory_region(struct kvm *kvm,
++                                 struct kvm_userspace_memory_region *mem,
++                                 const struct kvm_memory_slot *old,
++                                 enum kvm_mr_change change)
++{
++      gpa_t gpa = old->base_gfn << PAGE_SHIFT;
++      phys_addr_t size = old->npages << PAGE_SHIFT;
++      if (change == KVM_MR_DELETE || change == KVM_MR_MOVE) {
++              spin_lock(&kvm->mmu_lock);
++              unmap_stage2_range(kvm, gpa, size);
++              spin_unlock(&kvm->mmu_lock);
++      }
++}
++
++int kvm_arch_prepare_memory_region(struct kvm *kvm,
++                                 struct kvm_memory_slot *memslot,
++                                 struct kvm_userspace_memory_region *mem,
++                                 enum kvm_mr_change change)
++{
++      return 0;
++}
++
++void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
++                         struct kvm_memory_slot *dont)
++{
++}
++
++int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
++                          unsigned long npages)
++{
++      return 0;
++}
++
++void kvm_arch_memslots_updated(struct kvm *kvm)
++{
++}
++
++void kvm_arch_flush_shadow_all(struct kvm *kvm)
++{
++}
++
++void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
++                                 struct kvm_memory_slot *slot)
++{
++}
diff --git a/queue-3.14/arm-kvm-user_mem_abort-support-stage-2-mmio-page-mapping.patch b/queue-3.14/arm-kvm-user_mem_abort-support-stage-2-mmio-page-mapping.patch
new file mode 100644 (file)
index 0000000..84c3a99
--- /dev/null
@@ -0,0 +1,73 @@
+From b88657674d39fc2127d62d0de9ca142e166443c8 Mon Sep 17 00:00:00 2001
+From: Kim Phillips <kim.phillips@linaro.org>
+Date: Thu, 26 Jun 2014 01:45:51 +0100
+Subject: ARM: KVM: user_mem_abort: support stage 2 MMIO page mapping
+
+From: Kim Phillips <kim.phillips@linaro.org>
+
+commit b88657674d39fc2127d62d0de9ca142e166443c8 upstream.
+
+A userspace process can map device MMIO memory via VFIO or /dev/mem,
+e.g., for platform device passthrough support in QEMU.
+
+During early development, we found the PAGE_S2 memory type being used
+for MMIO mappings.  This patch corrects that by using the more strongly
+ordered memory type for device MMIO mappings: PAGE_S2_DEVICE.
+
+Signed-off-by: Kim Phillips <kim.phillips@linaro.org>
+Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
+Acked-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
+Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/kvm/mmu.c |   11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+--- a/arch/arm/kvm/mmu.c
++++ b/arch/arm/kvm/mmu.c
+@@ -759,6 +759,7 @@ static int user_mem_abort(struct kvm_vcp
+       struct kvm_mmu_memory_cache *memcache = &vcpu->arch.mmu_page_cache;
+       struct vm_area_struct *vma;
+       pfn_t pfn;
++      pgprot_t mem_type = PAGE_S2;
+       write_fault = kvm_is_write_fault(kvm_vcpu_get_hsr(vcpu));
+       if (fault_status == FSC_PERM && !write_fault) {
+@@ -809,6 +810,9 @@ static int user_mem_abort(struct kvm_vcp
+       if (is_error_pfn(pfn))
+               return -EFAULT;
++      if (kvm_is_mmio_pfn(pfn))
++              mem_type = PAGE_S2_DEVICE;
++
+       spin_lock(&kvm->mmu_lock);
+       if (mmu_notifier_retry(kvm, mmu_seq))
+               goto out_unlock;
+@@ -816,7 +820,7 @@ static int user_mem_abort(struct kvm_vcp
+               hugetlb = transparent_hugepage_adjust(&pfn, &fault_ipa);
+       if (hugetlb) {
+-              pmd_t new_pmd = pfn_pmd(pfn, PAGE_S2);
++              pmd_t new_pmd = pfn_pmd(pfn, mem_type);
+               new_pmd = pmd_mkhuge(new_pmd);
+               if (writable) {
+                       kvm_set_s2pmd_writable(&new_pmd);
+@@ -825,13 +829,14 @@ static int user_mem_abort(struct kvm_vcp
+               coherent_cache_guest_page(vcpu, hva & PMD_MASK, PMD_SIZE);
+               ret = stage2_set_pmd_huge(kvm, memcache, fault_ipa, &new_pmd);
+       } else {
+-              pte_t new_pte = pfn_pte(pfn, PAGE_S2);
++              pte_t new_pte = pfn_pte(pfn, mem_type);
+               if (writable) {
+                       kvm_set_s2pte_writable(&new_pte);
+                       kvm_set_pfn_dirty(pfn);
+               }
+               coherent_cache_guest_page(vcpu, hva, PAGE_SIZE);
+-              ret = stage2_set_pte(kvm, memcache, fault_ipa, &new_pte, false);
++              ret = stage2_set_pte(kvm, memcache, fault_ipa, &new_pte,
++                                   mem_type == PAGE_S2_DEVICE);
+       }
diff --git a/queue-3.14/arm-virt-fix-wrong-hsctlr.ee-bit-setting.patch b/queue-3.14/arm-virt-fix-wrong-hsctlr.ee-bit-setting.patch
new file mode 100644 (file)
index 0000000..2201655
--- /dev/null
@@ -0,0 +1,35 @@
+From af92394efc8be73edd2301fc15f9b57fd430cd18 Mon Sep 17 00:00:00 2001
+From: Li Liu <john.liuli@huawei.com>
+Date: Tue, 1 Jul 2014 18:01:50 +0800
+Subject: ARM: virt: fix wrong HSCTLR.EE bit setting
+
+From: Li Liu <john.liuli@huawei.com>
+
+commit af92394efc8be73edd2301fc15f9b57fd430cd18 upstream.
+
+HSCTLR.EE is defined as bit[25] referring to arm manual
+DDI0606C.b(p1590).
+
+Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
+Signed-off-by: Li Liu <john.liuli@huawei.com>
+Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
+Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/kernel/hyp-stub.S |    4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+--- a/arch/arm/kernel/hyp-stub.S
++++ b/arch/arm/kernel/hyp-stub.S
+@@ -134,9 +134,7 @@ ENTRY(__hyp_stub_install_secondary)
+       mcr     p15, 4, r7, c1, c1, 3   @ HSTR
+ THUMB(        orr     r7, #(1 << 30)  )       @ HSCTLR.TE
+-#ifdef CONFIG_CPU_BIG_ENDIAN
+-      orr     r7, #(1 << 9)           @ HSCTLR.EE
+-#endif
++ARM_BE8(orr   r7, r7, #(1 << 25))     @ HSCTLR.EE
+       mcr     p15, 4, r7, c1, c0, 0   @ HSCTLR
+       mrc     p15, 4, r7, c1, c1, 1   @ HDCR
diff --git a/queue-3.14/arm64-kvm-export-demux-regids-as-kvm_reg_arm64.patch b/queue-3.14/arm64-kvm-export-demux-regids-as-kvm_reg_arm64.patch
new file mode 100644 (file)
index 0000000..0be21c2
--- /dev/null
@@ -0,0 +1,41 @@
+From efd48ceacea78e4d4656aa0a6bf4c5b92ed22130 Mon Sep 17 00:00:00 2001
+From: Alex Bennée <alex.bennee@linaro.org>
+Date: Tue, 1 Jul 2014 16:53:13 +0100
+Subject: arm64: KVM: export demux regids as KVM_REG_ARM64
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Alex Bennée <alex.bennee@linaro.org>
+
+commit efd48ceacea78e4d4656aa0a6bf4c5b92ed22130 upstream.
+
+I suspect this is a -ECUTPASTE fault from the initial implementation. If
+we don't declare the register ID to be KVM_REG_ARM64 the KVM_GET_ONE_REG
+implementation kvm_arm_get_reg() returns -EINVAL and hilarity ensues.
+
+The kvm/api.txt document describes all arm64 registers as starting with
+0x60xx... (i.e KVM_REG_ARM64).
+
+Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
+Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
+Acked-by: Marc Zyngier <marc.zyngier@arm.com>
+Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
+Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm64/kvm/sys_regs.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/arm64/kvm/sys_regs.c
++++ b/arch/arm64/kvm/sys_regs.c
+@@ -962,7 +962,7 @@ static unsigned int num_demux_regs(void)
+ static int write_demux_regids(u64 __user *uindices)
+ {
+-      u64 val = KVM_REG_ARM | KVM_REG_SIZE_U32 | KVM_REG_ARM_DEMUX;
++      u64 val = KVM_REG_ARM64 | KVM_REG_SIZE_U32 | KVM_REG_ARM_DEMUX;
+       unsigned int i;
+       val |= KVM_REG_ARM_DEMUX_ID_CCSIDR;
diff --git a/queue-3.14/arm64-kvm-store-kvm_vcpu_fault_info-est_el2-as-word.patch b/queue-3.14/arm64-kvm-store-kvm_vcpu_fault_info-est_el2-as-word.patch
new file mode 100644 (file)
index 0000000..5256cac
--- /dev/null
@@ -0,0 +1,38 @@
+From ba083d20d8cfa9e999043cd89c4ebc964ccf8927 Mon Sep 17 00:00:00 2001
+From: Victor Kamensky <victor.kamensky@linaro.org>
+Date: Thu, 12 Jun 2014 09:30:09 -0700
+Subject: ARM64: KVM: store kvm_vcpu_fault_info est_el2 as word
+
+From: Victor Kamensky <victor.kamensky@linaro.org>
+
+commit ba083d20d8cfa9e999043cd89c4ebc964ccf8927 upstream.
+
+esr_el2 field of struct kvm_vcpu_fault_info has u32 type.
+It should be stored as word. Current code works in LE case
+because existing puts least significant word of x1 into
+esr_el2, and it puts most significant work of x1 into next
+field, which accidentally is OK because it is updated again
+by next instruction. But existing code breaks in BE case.
+
+Signed-off-by: Victor Kamensky <victor.kamensky@linaro.org>
+Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
+Acked-by: Marc Zyngier <marc.zyngier@arm.com>
+Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
+Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm64/kvm/hyp.S |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/arm64/kvm/hyp.S
++++ b/arch/arm64/kvm/hyp.S
+@@ -830,7 +830,7 @@ el1_trap:
+       mrs     x2, far_el2
+ 2:    mrs     x0, tpidr_el2
+-      str     x1, [x0, #VCPU_ESR_EL2]
++      str     w1, [x0, #VCPU_ESR_EL2]
+       str     x2, [x0, #VCPU_FAR_EL2]
+       str     x3, [x0, #VCPU_HPFAR_EL2]
diff --git a/queue-3.14/kvm-arm-arm64-avoid-returning-negative-error-code-as-bool.patch b/queue-3.14/kvm-arm-arm64-avoid-returning-negative-error-code-as-bool.patch
new file mode 100644 (file)
index 0000000..b587fbc
--- /dev/null
@@ -0,0 +1,49 @@
+From 18d457661fb9fa69352822ab98d39331c3d0e571 Mon Sep 17 00:00:00 2001
+From: Will Deacon <will.deacon@arm.com>
+Date: Tue, 26 Aug 2014 15:13:22 +0100
+Subject: KVM: ARM/arm64: avoid returning negative error code as bool
+
+From: Will Deacon <will.deacon@arm.com>
+
+commit 18d457661fb9fa69352822ab98d39331c3d0e571 upstream.
+
+is_valid_cache returns true if the specified cache is valid.
+Unfortunately, if the parameter passed it out of range, we return
+-ENOENT, which ends up as true leading to potential hilarity.
+
+This patch returns false on the failure path instead.
+
+Cc: Christoffer Dall <christoffer.dall@linaro.org>
+Cc: Marc Zyngier <marc.zyngier@arm.com>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
+Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/kvm/coproc.c     |    2 +-
+ arch/arm64/kvm/sys_regs.c |    2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/arm/kvm/coproc.c
++++ b/arch/arm/kvm/coproc.c
+@@ -742,7 +742,7 @@ static bool is_valid_cache(u32 val)
+       u32 level, ctype;
+       if (val >= CSSELR_MAX)
+-              return -ENOENT;
++              return false;
+       /* Bottom bit is Instruction or Data bit.  Next 3 bits are level. */
+         level = (val >> 1);
+--- a/arch/arm64/kvm/sys_regs.c
++++ b/arch/arm64/kvm/sys_regs.c
+@@ -836,7 +836,7 @@ static bool is_valid_cache(u32 val)
+       u32 level, ctype;
+       if (val >= CSSELR_MAX)
+-              return -ENOENT;
++              return false;
+       /* Bottom bit is Instruction or Data bit.  Next 3 bits are level. */
+       level = (val >> 1);
diff --git a/queue-3.14/kvm-arm-arm64-fix-broken-__percpu-annotation.patch b/queue-3.14/kvm-arm-arm64-fix-broken-__percpu-annotation.patch
new file mode 100644 (file)
index 0000000..c749d4d
--- /dev/null
@@ -0,0 +1,50 @@
+From 4000be423cb01a8d09de878bb8184511c49d4238 Mon Sep 17 00:00:00 2001
+From: Will Deacon <will.deacon@arm.com>
+Date: Tue, 26 Aug 2014 15:13:21 +0100
+Subject: KVM: ARM/arm64: fix broken __percpu annotation
+
+From: Will Deacon <will.deacon@arm.com>
+
+commit 4000be423cb01a8d09de878bb8184511c49d4238 upstream.
+
+Running sparse results in a bunch of noisy address space mismatches
+thanks to the broken __percpu annotation on kvm_get_running_vcpus.
+
+This function returns a pcpu pointer to a pointer, not a pointer to a
+pcpu pointer. This patch fixes the annotation, which kills the warnings
+from sparse.
+
+Cc: Christoffer Dall <christoffer.dall@linaro.org>
+Cc: Marc Zyngier <marc.zyngier@arm.com>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
+Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/kvm/arm.c                |    2 +-
+ arch/arm64/include/asm/kvm_host.h |    2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/arm/kvm/arm.c
++++ b/arch/arm/kvm/arm.c
+@@ -82,7 +82,7 @@ struct kvm_vcpu *kvm_arm_get_running_vcp
+ /**
+  * kvm_arm_get_running_vcpus - get the per-CPU array of currently running vcpus.
+  */
+-struct kvm_vcpu __percpu **kvm_get_running_vcpus(void)
++struct kvm_vcpu * __percpu *kvm_get_running_vcpus(void)
+ {
+       return &kvm_arm_running_vcpu;
+ }
+--- a/arch/arm64/include/asm/kvm_host.h
++++ b/arch/arm64/include/asm/kvm_host.h
+@@ -177,7 +177,7 @@ static inline int kvm_test_age_hva(struc
+ }
+ struct kvm_vcpu *kvm_arm_get_running_vcpu(void);
+-struct kvm_vcpu __percpu **kvm_get_running_vcpus(void);
++struct kvm_vcpu * __percpu *kvm_get_running_vcpus(void);
+ u64 kvm_call_hyp(void *hypfn, ...);
diff --git a/queue-3.14/kvm-arm-arm64-fix-non-const-declaration-of-function-returning-const.patch b/queue-3.14/kvm-arm-arm64-fix-non-const-declaration-of-function-returning-const.patch
new file mode 100644 (file)
index 0000000..3810d94
--- /dev/null
@@ -0,0 +1,50 @@
+From 6951e48bff0b55d2a8e825a953fc1f8e3a34bf1c Mon Sep 17 00:00:00 2001
+From: Will Deacon <will.deacon@arm.com>
+Date: Tue, 26 Aug 2014 15:13:20 +0100
+Subject: KVM: ARM/arm64: fix non-const declaration of function returning const
+
+From: Will Deacon <will.deacon@arm.com>
+
+commit 6951e48bff0b55d2a8e825a953fc1f8e3a34bf1c upstream.
+
+Sparse kicks up about a type mismatch for kvm_target_cpu:
+
+arch/arm64/kvm/guest.c:271:25: error: symbol 'kvm_target_cpu' redeclared with different type (originally declared at ./arch/arm64/include/asm/kvm_host.h:45) - different modifiers
+
+so fix this by adding the missing const attribute to the function
+declaration.
+
+Cc: Christoffer Dall <christoffer.dall@linaro.org>
+Cc: Marc Zyngier <marc.zyngier@arm.com>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
+Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/include/asm/kvm_host.h   |    2 +-
+ arch/arm64/include/asm/kvm_host.h |    2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/arm/include/asm/kvm_host.h
++++ b/arch/arm/include/asm/kvm_host.h
+@@ -42,7 +42,7 @@
+ struct kvm_vcpu;
+ u32 *kvm_vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num, u32 mode);
+-int kvm_target_cpu(void);
++int __attribute_const__ kvm_target_cpu(void);
+ int kvm_reset_vcpu(struct kvm_vcpu *vcpu);
+ void kvm_reset_coprocs(struct kvm_vcpu *vcpu);
+--- a/arch/arm64/include/asm/kvm_host.h
++++ b/arch/arm64/include/asm/kvm_host.h
+@@ -42,7 +42,7 @@
+ #define KVM_VCPU_MAX_FEATURES 2
+ struct kvm_vcpu;
+-int kvm_target_cpu(void);
++int __attribute_const__ kvm_target_cpu(void);
+ int kvm_reset_vcpu(struct kvm_vcpu *vcpu);
+ int kvm_arch_dev_ioctl_check_extension(long ext);
diff --git a/queue-3.14/kvm-vgic-return-int-instead-of-bool-when-checking-i-o-ranges.patch b/queue-3.14/kvm-vgic-return-int-instead-of-bool-when-checking-i-o-ranges.patch
new file mode 100644 (file)
index 0000000..dcfd9ee
--- /dev/null
@@ -0,0 +1,34 @@
+From 1fa451bcc67fa921a04c5fac8dbcde7844d54512 Mon Sep 17 00:00:00 2001
+From: Will Deacon <will.deacon@arm.com>
+Date: Tue, 26 Aug 2014 15:13:24 +0100
+Subject: KVM: vgic: return int instead of bool when checking I/O ranges
+
+From: Will Deacon <will.deacon@arm.com>
+
+commit 1fa451bcc67fa921a04c5fac8dbcde7844d54512 upstream.
+
+vgic_ioaddr_overlap claims to return a bool, but in reality it returns
+an int. Shut sparse up by fixing the type signature.
+
+Cc: Christoffer Dall <christoffer.dall@linaro.org>
+Cc: Marc Zyngier <marc.zyngier@arm.com>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
+Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ virt/kvm/arm/vgic.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/virt/kvm/arm/vgic.c
++++ b/virt/kvm/arm/vgic.c
+@@ -1654,7 +1654,7 @@ out:
+       return ret;
+ }
+-static bool vgic_ioaddr_overlap(struct kvm *kvm)
++static int vgic_ioaddr_overlap(struct kvm *kvm)
+ {
+       phys_addr_t dist = kvm->arch.vgic.vgic_dist_base;
+       phys_addr_t cpu = kvm->arch.vgic.vgic_cpu_base;
index 977c000e99345e26a6c7e613ff10c7311a9f8271..dddd1d0a718a857e1d055ba42c22e037be4b65d5 100644 (file)
@@ -5,3 +5,13 @@ ath3k-add-support-of-0489-e076-ar3012-device.patch
 ath3k-add-support-of-13d3-3474-ar3012-device.patch
 pipe-iovec-fix-memory-corruption-when-retrying-atomi-3.14.patch
 lpfc-add-iotag-memory-barrier.patch
+arm-arm64-kvm-fix-and-refactor-unmap_range.patch
+arm-kvm-unmap-ipa-on-memslot-delete-move.patch
+arm-kvm-user_mem_abort-support-stage-2-mmio-page-mapping.patch
+arm64-kvm-export-demux-regids-as-kvm_reg_arm64.patch
+arm-virt-fix-wrong-hsctlr.ee-bit-setting.patch
+arm64-kvm-store-kvm_vcpu_fault_info-est_el2-as-word.patch
+kvm-arm-arm64-fix-non-const-declaration-of-function-returning-const.patch
+kvm-arm-arm64-fix-broken-__percpu-annotation.patch
+kvm-arm-arm64-avoid-returning-negative-error-code-as-bool.patch
+kvm-vgic-return-int-instead-of-bool-when-checking-i-o-ranges.patch