[PATCH 2/4] PF: Move architecture specifics to the backends
From: Dominik Dingel
Date: Mon Jun 10 2013 - 08:04:51 EST
Current common code use PAGE_OFFSET to indicate a bad host virtual address.
This works for x86 but not necessarily on other architectures. So the check
is moved into architecture specific code.
Todo:
- apply to other architectures when applicable
Signed-off-by: Dominik Dingel <dingel@xxxxxxxxxxxxxxxxxx>
---
arch/s390/include/asm/kvm_host.h | 12 ++++++++++++
arch/x86/include/asm/kvm_host.h | 8 ++++++++
include/linux/kvm_host.h | 8 --------
3 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index deb1990..e014bba 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -277,6 +277,18 @@ struct kvm_arch{
int css_support;
};
+#define KVM_HVA_ERR_BAD (-1UL)
+#define KVM_HVA_ERR_RO_BAD (-1UL)
+
+static inline bool kvm_is_error_hva(unsigned long addr)
+{
+ /*
+ * on s390, this check is not needed as kernel and user memory
+ * is not mapped into the same address space
+ */
+ return false;
+}
+
extern int sie64a(struct kvm_s390_sie_block *, u64 *);
extern unsigned long sie_exit_addr;
#endif
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 4979778..5ed7c83 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -94,6 +94,14 @@
#define ASYNC_PF_PER_VCPU 64
+#define KVM_HVA_ERR_BAD (PAGE_OFFSET)
+#define KVM_HVA_ERR_RO_BAD (PAGE_OFFSET + PAGE_SIZE)
+
+static inline bool kvm_is_error_hva(unsigned long addr)
+{
+ return addr >= PAGE_OFFSET;
+}
+
extern raw_spinlock_t kvm_lock;
extern struct list_head vm_list;
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index c139582..9bd29ef 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -84,14 +84,6 @@ static inline bool is_noslot_pfn(pfn_t pfn)
return pfn == KVM_PFN_NOSLOT;
}
-#define KVM_HVA_ERR_BAD (PAGE_OFFSET)
-#define KVM_HVA_ERR_RO_BAD (PAGE_OFFSET + PAGE_SIZE)
-
-static inline bool kvm_is_error_hva(unsigned long addr)
-{
- return addr >= PAGE_OFFSET;
-}
-
#define KVM_ERR_PTR_BAD_PAGE (ERR_PTR(-ENOENT))
static inline bool is_error_page(struct page *page)
--
1.8.1.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/