[PATCH 3/4] Avoid kmap_atomic_to_page in svm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



kmap_atomic_to_page was not exported before 2.6.32, and adding a compat
wrapper for it is impossible due to further missing exports. This breaks
x86-32 modules under CONFIG_HIGHMEM.

So avoid its use via a crude hack: nested_svm_map callers receive the
mapped page and have to pass it back to nested_svm_unmap.

Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
---

 sync |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/sync b/sync
index 4821b84..8868e6d 100755
--- a/sync
+++ b/sync
@@ -121,6 +121,18 @@ def __hack(data):
         line = sub(r'boot_cpu_data.x86_phys_bits', 'kvm_x86_phys_bits', line)
         if match(r'^static const struct vm_operations_struct kvm_'):
             line = sub(r' const ', ' ', line)
+        if line == 'static void *nested_svm_map(struct vcpu_svm *svm, u64 gpa, enum km_type idx)':
+            line = sub(r'\)', ', struct page **mapped_page)', line)
+        if line == '\treturn kmap_atomic(page, idx);':
+            line = '\t*mapped_page = page;\n' + line
+        if line == 'static void nested_svm_unmap(void *addr, enum km_type idx)':
+            line = sub(r'\)', ', struct page *mapped_page)', line)
+        if line == '\tpage = kmap_atomic_to_page(addr);':
+            line = '\tpage = mapped_page;'
+        if match(r'= nested_svm_map(.*);'):
+            line = '\t{ struct page *mapped_page;\n' + sub(r'\);', ', &mapped_page);', line)
+        if match('nested_svm_unmap(.*);'):
+            line = sub(r'\);', ', mapped_page); }', line)
         w(line)
         if match(r'\tkvm_init_debug'):
             w('\thrtimer_kallsyms_resolve();')

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux