diff options
author | Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> | 2011-07-11 15:28:54 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-07-24 04:50:34 -0400 |
commit | fce92dce79dbf5fff39c7ac2fb149729d79b7a39 (patch) | |
tree | 455461b843f5f94356786ea0e21132740458588a /virt | |
parent | c37079586f317d7e7f1a70d36f0e5177691c89c2 (diff) |
KVM: MMU: filter out the mmio pfn from the fault pfn
If the page fault is caused by mmio, the gfn can not be found in memslots, and
'bad_pfn' is returned on gfn_to_hva path, so we can use 'bad_pfn' to identify
the mmio page fault.
And, to clarify the meaning of mmio pfn, we return fault page instead of bad
page when the gfn is not allowd to prefetch
Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/kvm_main.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index d5ef9ebcaff7..56f3c704fd74 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -101,8 +101,8 @@ static bool largepages_enabled = true; | |||
101 | static struct page *hwpoison_page; | 101 | static struct page *hwpoison_page; |
102 | static pfn_t hwpoison_pfn; | 102 | static pfn_t hwpoison_pfn; |
103 | 103 | ||
104 | static struct page *fault_page; | 104 | struct page *fault_page; |
105 | static pfn_t fault_pfn; | 105 | pfn_t fault_pfn; |
106 | 106 | ||
107 | inline int kvm_is_mmio_pfn(pfn_t pfn) | 107 | inline int kvm_is_mmio_pfn(pfn_t pfn) |
108 | { | 108 | { |
@@ -931,6 +931,18 @@ int is_fault_pfn(pfn_t pfn) | |||
931 | } | 931 | } |
932 | EXPORT_SYMBOL_GPL(is_fault_pfn); | 932 | EXPORT_SYMBOL_GPL(is_fault_pfn); |
933 | 933 | ||
934 | int is_noslot_pfn(pfn_t pfn) | ||
935 | { | ||
936 | return pfn == bad_pfn; | ||
937 | } | ||
938 | EXPORT_SYMBOL_GPL(is_noslot_pfn); | ||
939 | |||
940 | int is_invalid_pfn(pfn_t pfn) | ||
941 | { | ||
942 | return pfn == hwpoison_pfn || pfn == fault_pfn; | ||
943 | } | ||
944 | EXPORT_SYMBOL_GPL(is_invalid_pfn); | ||
945 | |||
934 | static inline unsigned long bad_hva(void) | 946 | static inline unsigned long bad_hva(void) |
935 | { | 947 | { |
936 | return PAGE_OFFSET; | 948 | return PAGE_OFFSET; |