Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Suchanek <msuchanek@suse.de>2018-10-31 12:36:54 +0100
committerMichal Suchanek <msuchanek@suse.de>2018-10-31 23:28:40 +0100
commit2e7f8155287ebd6b9d3e5b36e2bad85e6ba21ede (patch)
tree24c57850ca5c945073a67e6c8b007ccdd9e0f410
parent0a2887b4864200554bc06b29f5137c82d3e6dd33 (diff)
KVM: PPC: Book3S HV: Use a helper to unmap ptes in the radix
fault path (bsc#1061840).
-rw-r--r--patches.arch/KVM-PPC-Book3S-HV-Use-a-helper-to-unmap-ptes-in-the-.patch105
-rw-r--r--series.conf1
2 files changed, 106 insertions, 0 deletions
diff --git a/patches.arch/KVM-PPC-Book3S-HV-Use-a-helper-to-unmap-ptes-in-the-.patch b/patches.arch/KVM-PPC-Book3S-HV-Use-a-helper-to-unmap-ptes-in-the-.patch
new file mode 100644
index 0000000000..4aee673067
--- /dev/null
+++ b/patches.arch/KVM-PPC-Book3S-HV-Use-a-helper-to-unmap-ptes-in-the-.patch
@@ -0,0 +1,105 @@
+From a5fad1e959529eda20f38d1e02be65ab629de899 Mon Sep 17 00:00:00 2001
+From: Nicholas Piggin <npiggin@gmail.com>
+Date: Thu, 17 May 2018 17:06:26 +1000
+Subject: [PATCH] KVM: PPC: Book3S HV: Use a helper to unmap ptes in the radix
+ fault path
+
+References: bsc#1061840
+Patch-mainline: v4.18-rc1
+Git-commit: a5fad1e959529eda20f38d1e02be65ab629de899
+
+Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
+Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
+Acked-by: Michal Suchanek <msuchanek@suse.de>
+---
+ arch/powerpc/kvm/book3s_64_mmu_radix.c | 46 +++++++++++++++++-----------------
+ 1 file changed, 23 insertions(+), 23 deletions(-)
+
+diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c b/arch/powerpc/kvm/book3s_64_mmu_radix.c
+index 481da8f93fa4..2c49b31ec7fb 100644
+--- a/arch/powerpc/kvm/book3s_64_mmu_radix.c
++++ b/arch/powerpc/kvm/book3s_64_mmu_radix.c
+@@ -228,6 +228,25 @@ static void kvmppc_pmd_free(pmd_t *pmdp)
+ kmem_cache_free(kvm_pmd_cache, pmdp);
+ }
+
++static void kvmppc_unmap_pte(struct kvm *kvm, pte_t *pte,
++ unsigned long gpa, unsigned int shift)
++
++{
++ unsigned long page_size = 1ul << shift;
++ unsigned long old;
++
++ old = kvmppc_radix_update_pte(kvm, pte, ~0UL, 0, gpa, shift);
++ kvmppc_radix_tlbie_page(kvm, gpa, shift);
++ if (old & _PAGE_DIRTY) {
++ unsigned long gfn = gpa >> PAGE_SHIFT;
++ struct kvm_memory_slot *memslot;
++
++ memslot = gfn_to_memslot(kvm, gfn);
++ if (memslot && memslot->dirty_bitmap)
++ kvmppc_update_dirty_map(memslot, gfn, page_size);
++ }
++}
++
+ static int kvmppc_create_pte(struct kvm *kvm, pte_t pte, unsigned long gpa,
+ unsigned int level, unsigned long mmu_seq)
+ {
+@@ -235,7 +254,6 @@ static int kvmppc_create_pte(struct kvm *kvm, pte_t pte, unsigned long gpa,
+ pud_t *pud, *new_pud = NULL;
+ pmd_t *pmd, *new_pmd = NULL;
+ pte_t *ptep, *new_ptep = NULL;
+- unsigned long old;
+ int ret;
+
+ /* Traverse the guest's 2nd-level tree, allocate new levels needed */
+@@ -287,17 +305,7 @@ static int kvmppc_create_pte(struct kvm *kvm, pte_t pte, unsigned long gpa,
+ goto out_unlock;
+ }
+ /* Valid 1GB page here already, remove it */
+- old = kvmppc_radix_update_pte(kvm, (pte_t *)pud,
+- ~0UL, 0, hgpa, PUD_SHIFT);
+- kvmppc_radix_tlbie_page(kvm, hgpa, PUD_SHIFT);
+- if (old & _PAGE_DIRTY) {
+- unsigned long gfn = hgpa >> PAGE_SHIFT;
+- struct kvm_memory_slot *memslot;
+- memslot = gfn_to_memslot(kvm, gfn);
+- if (memslot && memslot->dirty_bitmap)
+- kvmppc_update_dirty_map(memslot,
+- gfn, PUD_SIZE);
+- }
++ kvmppc_unmap_pte(kvm, (pte_t *)pud, hgpa, PUD_SHIFT);
+ }
+ if (level == 2) {
+ if (!pud_none(*pud)) {
+@@ -338,17 +346,7 @@ static int kvmppc_create_pte(struct kvm *kvm, pte_t pte, unsigned long gpa,
+ goto out_unlock;
+ }
+ /* Valid 2MB page here already, remove it */
+- old = kvmppc_radix_update_pte(kvm, pmdp_ptep(pmd),
+- ~0UL, 0, lgpa, PMD_SHIFT);
+- kvmppc_radix_tlbie_page(kvm, lgpa, PMD_SHIFT);
+- if (old & _PAGE_DIRTY) {
+- unsigned long gfn = lgpa >> PAGE_SHIFT;
+- struct kvm_memory_slot *memslot;
+- memslot = gfn_to_memslot(kvm, gfn);
+- if (memslot && memslot->dirty_bitmap)
+- kvmppc_update_dirty_map(memslot,
+- gfn, PMD_SIZE);
+- }
++ kvmppc_unmap_pte(kvm, pmdp_ptep(pmd), lgpa, PMD_SHIFT);
+ }
+ if (level == 1) {
+ if (!pmd_none(*pmd)) {
+@@ -373,6 +371,8 @@ static int kvmppc_create_pte(struct kvm *kvm, pte_t pte, unsigned long gpa,
+ }
+ ptep = pte_offset_kernel(pmd, gpa);
+ if (pte_present(*ptep)) {
++ unsigned long old;
++
+ /* Check if someone else set the same thing */
+ if (pte_raw(*ptep) == pte_raw(pte)) {
+ ret = 0;
+--
+2.13.7
+
diff --git a/series.conf b/series.conf
index 54045a81f9..343f90eff8 100644
--- a/series.conf
+++ b/series.conf
@@ -16728,6 +16728,7 @@
patches.arch/KVM-PPC-Move-nip-ctr-lr-xer-registers-to-pt_regs-in-.patch
patches.arch/KVM-PPC-Fix-a-mmio_host_swabbed-uninitialized-usage-.patch
patches.arch/KVM-PPC-Book3S-HV-Lockless-tlbie-for-HPT-hcalls.patch
+ patches.arch/KVM-PPC-Book3S-HV-Use-a-helper-to-unmap-ptes-in-the-.patch
patches.suse/ipv6-allow-PMTU-exceptions-to-local-routes.patch
patches.suse/net-dsa-add-error-handling-for-pskb_trim_rcsum.patch
patches.drivers/ixgbe-Fix-setting-of-TC-configuration-for-macvlan-ca.patch