]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
KVM: s390: Make KVM_HVA_ERR_BAD usable on s390
authorDominik Dingel <dingel@linux.vnet.ibm.com>
Fri, 26 Jul 2013 13:04:07 +0000 (15:04 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 29 Jul 2013 07:03:53 +0000 (09:03 +0200)
Current common code uses PAGE_OFFSET to indicate a bad host virtual address.
As this check won't work on architectures that don't map kernel and user memory
into the same address space (e.g. s390), such architectures can now provide
their own KVM_HVA_ERR_BAD defines.

Signed-off-by: Dominik Dingel <dingel@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/s390/include/asm/kvm_host.h
include/linux/kvm_host.h

index 3238d4004e8436aa1a7d1e5eb3d811fe065d0dcb..e87ecaa2c569860f0c9353fc3ed398a0eba034ad 100644 (file)
@@ -274,6 +274,14 @@ struct kvm_arch{
        int css_support;
 };
 
+#define KVM_HVA_ERR_BAD                (-1UL)
+#define KVM_HVA_ERR_RO_BAD     (-2UL)
+
+static inline bool kvm_is_error_hva(unsigned long addr)
+{
+       return IS_ERR_VALUE(addr);
+}
+
 extern int sie64a(struct kvm_s390_sie_block *, u64 *);
 extern char sie_exit;
 #endif
index c11c7686ae5fb404a23ab08387aa0c00660bac2b..ca645a01d37a79767baccfd12a8871b79af7b624 100644 (file)
@@ -85,6 +85,12 @@ static inline bool is_noslot_pfn(pfn_t pfn)
        return pfn == KVM_PFN_NOSLOT;
 }
 
+/*
+ * architectures with KVM_HVA_ERR_BAD other than PAGE_OFFSET (e.g. s390)
+ * provide own defines and kvm_is_error_hva
+ */
+#ifndef KVM_HVA_ERR_BAD
+
 #define KVM_HVA_ERR_BAD                (PAGE_OFFSET)
 #define KVM_HVA_ERR_RO_BAD     (PAGE_OFFSET + PAGE_SIZE)
 
@@ -93,6 +99,8 @@ static inline bool kvm_is_error_hva(unsigned long addr)
        return addr >= PAGE_OFFSET;
 }
 
+#endif
+
 #define KVM_ERR_PTR_BAD_PAGE   (ERR_PTR(-ENOENT))
 
 static inline bool is_error_page(struct page *page)