summaryrefslogtreecommitdiff
path: root/include/linux/kvm.h
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>2012-08-21 11:02:51 +0800
committerAvi Kivity <avi@redhat.com>2012-08-22 15:09:03 +0300
commit4d8b81abc47b83a1939e59df2fdb0e98dfe0eedd (patch)
tree47ea77cb4f77a2884a0478ecf84f62e32e5661ee /include/linux/kvm.h
parent7068d0971524dd47a38f44f6020ba133432871ca (diff)
downloadlwn-4d8b81abc47b83a1939e59df2fdb0e98dfe0eedd.tar.gz
lwn-4d8b81abc47b83a1939e59df2fdb0e98dfe0eedd.zip
KVM: introduce readonly memslot
In current code, if we map a readonly memory space from host to guest and the page is not currently mapped in the host, we will get a fault pfn and async is not allowed, then the vm will crash We introduce readonly memory region to map ROM/ROMD to the guest, read access is happy for readonly memslot, write access on readonly memslot will cause KVM_EXIT_MMIO exit Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'include/linux/kvm.h')
-rw-r--r--include/linux/kvm.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 2de335d7f63e..d808694673f9 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -106,7 +106,8 @@ struct kvm_userspace_memory_region {
* other bits are reserved for kvm internal use which are defined in
* include/linux/kvm_host.h.
*/
-#define KVM_MEM_LOG_DIRTY_PAGES 1UL
+#define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0)
+#define KVM_MEM_READONLY (1UL << 1)
/* for KVM_IRQ_LINE */
struct kvm_irq_level {
@@ -621,6 +622,9 @@ struct kvm_ppc_smmu_info {
#define KVM_CAP_PPC_GET_SMMU_INFO 78
#define KVM_CAP_S390_COW 79
#define KVM_CAP_PPC_ALLOC_HTAB 80
+#ifdef __KVM_HAVE_READONLY_MEM
+#define KVM_CAP_READONLY_MEM 81
+#endif
#ifdef KVM_CAP_IRQ_ROUTING