Commit 903816fa authored by Xiao Guangrong's avatar Xiao Guangrong Committed by Marcelo Tosatti

KVM: using get_fault_pfn to get the fault pfn

Using get_fault_pfn to cleanup the code
Signed-off-by: default avatarXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent 86fde74c
...@@ -2513,10 +2513,8 @@ static pfn_t pte_prefetch_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn, ...@@ -2513,10 +2513,8 @@ static pfn_t pte_prefetch_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn,
unsigned long hva; unsigned long hva;
slot = gfn_to_memslot_dirty_bitmap(vcpu, gfn, no_dirty_log); slot = gfn_to_memslot_dirty_bitmap(vcpu, gfn, no_dirty_log);
if (!slot) { if (!slot)
get_page(fault_page); return get_fault_pfn();
return page_to_pfn(fault_page);
}
hva = gfn_to_hva_memslot(slot, gfn); hva = gfn_to_hva_memslot(slot, gfn);
......
...@@ -383,15 +383,11 @@ id_to_memslot(struct kvm_memslots *slots, int id) ...@@ -383,15 +383,11 @@ id_to_memslot(struct kvm_memslots *slots, int id)
static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; } static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; }
extern struct page *bad_page; extern struct page *bad_page;
extern struct page *fault_page;
extern pfn_t bad_pfn; extern pfn_t bad_pfn;
extern pfn_t fault_pfn;
int is_error_page(struct page *page); int is_error_page(struct page *page);
int is_error_pfn(pfn_t pfn); int is_error_pfn(pfn_t pfn);
int is_hwpoison_pfn(pfn_t pfn); int is_hwpoison_pfn(pfn_t pfn);
int is_fault_pfn(pfn_t pfn);
int is_noslot_pfn(pfn_t pfn); int is_noslot_pfn(pfn_t pfn);
int is_invalid_pfn(pfn_t pfn); int is_invalid_pfn(pfn_t pfn);
int kvm_is_error_hva(unsigned long addr); int kvm_is_error_hva(unsigned long addr);
...@@ -441,6 +437,7 @@ void kvm_release_pfn_clean(pfn_t pfn); ...@@ -441,6 +437,7 @@ void kvm_release_pfn_clean(pfn_t pfn);
void kvm_set_pfn_dirty(pfn_t pfn); void kvm_set_pfn_dirty(pfn_t pfn);
void kvm_set_pfn_accessed(pfn_t pfn); void kvm_set_pfn_accessed(pfn_t pfn);
void kvm_get_pfn(pfn_t pfn); void kvm_get_pfn(pfn_t pfn);
pfn_t get_fault_pfn(void);
int kvm_read_guest_page(struct kvm *kvm, gfn_t gfn, void *data, int offset, int kvm_read_guest_page(struct kvm *kvm, gfn_t gfn, void *data, int offset,
int len); int len);
......
...@@ -103,8 +103,8 @@ static bool largepages_enabled = true; ...@@ -103,8 +103,8 @@ static bool largepages_enabled = true;
static struct page *hwpoison_page; static struct page *hwpoison_page;
static pfn_t hwpoison_pfn; static pfn_t hwpoison_pfn;
struct page *fault_page; static struct page *fault_page;
pfn_t fault_pfn; static pfn_t fault_pfn;
inline int kvm_is_mmio_pfn(pfn_t pfn) inline int kvm_is_mmio_pfn(pfn_t pfn)
{ {
...@@ -949,12 +949,6 @@ int is_hwpoison_pfn(pfn_t pfn) ...@@ -949,12 +949,6 @@ int is_hwpoison_pfn(pfn_t pfn)
} }
EXPORT_SYMBOL_GPL(is_hwpoison_pfn); EXPORT_SYMBOL_GPL(is_hwpoison_pfn);
int is_fault_pfn(pfn_t pfn)
{
return pfn == fault_pfn;
}
EXPORT_SYMBOL_GPL(is_fault_pfn);
int is_noslot_pfn(pfn_t pfn) int is_noslot_pfn(pfn_t pfn)
{ {
return pfn == bad_pfn; return pfn == bad_pfn;
...@@ -1038,11 +1032,12 @@ unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn) ...@@ -1038,11 +1032,12 @@ unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn)
} }
EXPORT_SYMBOL_GPL(gfn_to_hva); EXPORT_SYMBOL_GPL(gfn_to_hva);
static pfn_t get_fault_pfn(void) pfn_t get_fault_pfn(void)
{ {
get_page(fault_page); get_page(fault_page);
return fault_pfn; return fault_pfn;
} }
EXPORT_SYMBOL_GPL(get_fault_pfn);
int get_user_page_nowait(struct task_struct *tsk, struct mm_struct *mm, int get_user_page_nowait(struct task_struct *tsk, struct mm_struct *mm,
unsigned long start, int write, struct page **page) unsigned long start, int write, struct page **page)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment