diff options
author | Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> | 2012-08-20 23:02:51 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-08-22 08:09:03 -0400 |
commit | 4d8b81abc47b83a1939e59df2fdb0e98dfe0eedd (patch) | |
tree | 47ea77cb4f77a2884a0478ecf84f62e32e5661ee /include/linux/kvm.h | |
parent | 7068d0971524dd47a38f44f6020ba133432871ca (diff) |
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.h | 6 |
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 { | |||
106 | * other bits are reserved for kvm internal use which are defined in | 106 | * other bits are reserved for kvm internal use which are defined in |
107 | * include/linux/kvm_host.h. | 107 | * include/linux/kvm_host.h. |
108 | */ | 108 | */ |
109 | #define KVM_MEM_LOG_DIRTY_PAGES 1UL | 109 | #define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0) |
110 | #define KVM_MEM_READONLY (1UL << 1) | ||
110 | 111 | ||
111 | /* for KVM_IRQ_LINE */ | 112 | /* for KVM_IRQ_LINE */ |
112 | struct kvm_irq_level { | 113 | struct kvm_irq_level { |
@@ -621,6 +622,9 @@ struct kvm_ppc_smmu_info { | |||
621 | #define KVM_CAP_PPC_GET_SMMU_INFO 78 | 622 | #define KVM_CAP_PPC_GET_SMMU_INFO 78 |
622 | #define KVM_CAP_S390_COW 79 | 623 | #define KVM_CAP_S390_COW 79 |
623 | #define KVM_CAP_PPC_ALLOC_HTAB 80 | 624 | #define KVM_CAP_PPC_ALLOC_HTAB 80 |
625 | #ifdef __KVM_HAVE_READONLY_MEM | ||
626 | #define KVM_CAP_READONLY_MEM 81 | ||
627 | #endif | ||
624 | 628 | ||
625 | #ifdef KVM_CAP_IRQ_ROUTING | 629 | #ifdef KVM_CAP_IRQ_ROUTING |
626 | 630 | ||