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 /Documentation/virtual | |
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 'Documentation/virtual')
-rw-r--r-- | Documentation/virtual/kvm/api.txt | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index bf33aaa4c59f..b91bfd43f007 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt | |||
@@ -857,7 +857,8 @@ struct kvm_userspace_memory_region { | |||
857 | }; | 857 | }; |
858 | 858 | ||
859 | /* for kvm_memory_region::flags */ | 859 | /* for kvm_memory_region::flags */ |
860 | #define KVM_MEM_LOG_DIRTY_PAGES 1UL | 860 | #define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0) |
861 | #define KVM_MEM_READONLY (1UL << 1) | ||
861 | 862 | ||
862 | This ioctl allows the user to create or modify a guest physical memory | 863 | This ioctl allows the user to create or modify a guest physical memory |
863 | slot. When changing an existing slot, it may be moved in the guest | 864 | slot. When changing an existing slot, it may be moved in the guest |
@@ -873,9 +874,12 @@ It is recommended that the lower 21 bits of guest_phys_addr and userspace_addr | |||
873 | be identical. This allows large pages in the guest to be backed by large | 874 | be identical. This allows large pages in the guest to be backed by large |
874 | pages in the host. | 875 | pages in the host. |
875 | 876 | ||
876 | The flags field supports just one flag, KVM_MEM_LOG_DIRTY_PAGES, which | 877 | The flags field supports two flag, KVM_MEM_LOG_DIRTY_PAGES, which |
877 | instructs kvm to keep track of writes to memory within the slot. See | 878 | instructs kvm to keep track of writes to memory within the slot. See |
878 | the KVM_GET_DIRTY_LOG ioctl. | 879 | the KVM_GET_DIRTY_LOG ioctl. Another flag is KVM_MEM_READONLY when the |
880 | KVM_CAP_READONLY_MEM capability, it indicates the guest memory is read-only, | ||
881 | that means, guest is only allowed to read it. Writes will be posted to | ||
882 | userspace as KVM_EXIT_MMIO exits. | ||
879 | 883 | ||
880 | When the KVM_CAP_SYNC_MMU capability, changes in the backing of the memory | 884 | When the KVM_CAP_SYNC_MMU capability, changes in the backing of the memory |
881 | region are automatically reflected into the guest. For example, an mmap() | 885 | region are automatically reflected into the guest. For example, an mmap() |