Commit c77fb9dc authored by Xiantao Zhang's avatar Xiantao Zhang Committed by Avi Kivity

KVM: Change is_mmio_pfn to kvm_is_mmio_pfn, and make it common for all archs

Add a kvm_ prefix to avoid polluting kernel's name space.
Signed-off-by: default avatarXiantao Zhang <xiantao.zhang@intel.com>
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
parent 8a98f664
...@@ -288,6 +288,8 @@ int kvm_cpu_has_interrupt(struct kvm_vcpu *v); ...@@ -288,6 +288,8 @@ int kvm_cpu_has_interrupt(struct kvm_vcpu *v);
int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu); int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu);
void kvm_vcpu_kick(struct kvm_vcpu *vcpu); void kvm_vcpu_kick(struct kvm_vcpu *vcpu);
int kvm_is_mmio_pfn(pfn_t pfn);
struct kvm_irq_ack_notifier { struct kvm_irq_ack_notifier {
struct hlist_node link; struct hlist_node link;
unsigned gsi; unsigned gsi;
......
...@@ -316,7 +316,7 @@ static inline int valid_vcpu(int n) ...@@ -316,7 +316,7 @@ static inline int valid_vcpu(int n)
return likely(n >= 0 && n < KVM_MAX_VCPUS); return likely(n >= 0 && n < KVM_MAX_VCPUS);
} }
static inline int is_mmio_pfn(pfn_t pfn) inline int kvm_is_mmio_pfn(pfn_t pfn)
{ {
if (pfn_valid(pfn)) if (pfn_valid(pfn))
return PageReserved(pfn_to_page(pfn)); return PageReserved(pfn_to_page(pfn));
...@@ -994,7 +994,7 @@ pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn) ...@@ -994,7 +994,7 @@ pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn)
pfn = ((addr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; pfn = ((addr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
up_read(&current->mm->mmap_sem); up_read(&current->mm->mmap_sem);
BUG_ON(!is_mmio_pfn(pfn)); BUG_ON(!kvm_is_mmio_pfn(pfn));
} else } else
pfn = page_to_pfn(page[0]); pfn = page_to_pfn(page[0]);
...@@ -1008,10 +1008,10 @@ struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn) ...@@ -1008,10 +1008,10 @@ struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn)
pfn_t pfn; pfn_t pfn;
pfn = gfn_to_pfn(kvm, gfn); pfn = gfn_to_pfn(kvm, gfn);
if (!is_mmio_pfn(pfn)) if (!kvm_is_mmio_pfn(pfn))
return pfn_to_page(pfn); return pfn_to_page(pfn);
WARN_ON(is_mmio_pfn(pfn)); WARN_ON(kvm_is_mmio_pfn(pfn));
get_page(bad_page); get_page(bad_page);
return bad_page; return bad_page;
...@@ -1027,7 +1027,7 @@ EXPORT_SYMBOL_GPL(kvm_release_page_clean); ...@@ -1027,7 +1027,7 @@ EXPORT_SYMBOL_GPL(kvm_release_page_clean);
void kvm_release_pfn_clean(pfn_t pfn) void kvm_release_pfn_clean(pfn_t pfn)
{ {
if (!is_mmio_pfn(pfn)) if (!kvm_is_mmio_pfn(pfn))
put_page(pfn_to_page(pfn)); put_page(pfn_to_page(pfn));
} }
EXPORT_SYMBOL_GPL(kvm_release_pfn_clean); EXPORT_SYMBOL_GPL(kvm_release_pfn_clean);
...@@ -1053,7 +1053,7 @@ EXPORT_SYMBOL_GPL(kvm_set_page_dirty); ...@@ -1053,7 +1053,7 @@ EXPORT_SYMBOL_GPL(kvm_set_page_dirty);
void kvm_set_pfn_dirty(pfn_t pfn) void kvm_set_pfn_dirty(pfn_t pfn)
{ {
if (!is_mmio_pfn(pfn)) { if (!kvm_is_mmio_pfn(pfn)) {
struct page *page = pfn_to_page(pfn); struct page *page = pfn_to_page(pfn);
if (!PageReserved(page)) if (!PageReserved(page))
SetPageDirty(page); SetPageDirty(page);
...@@ -1063,14 +1063,14 @@ EXPORT_SYMBOL_GPL(kvm_set_pfn_dirty); ...@@ -1063,14 +1063,14 @@ EXPORT_SYMBOL_GPL(kvm_set_pfn_dirty);
void kvm_set_pfn_accessed(pfn_t pfn) void kvm_set_pfn_accessed(pfn_t pfn)
{ {
if (!is_mmio_pfn(pfn)) if (!kvm_is_mmio_pfn(pfn))
mark_page_accessed(pfn_to_page(pfn)); mark_page_accessed(pfn_to_page(pfn));
} }
EXPORT_SYMBOL_GPL(kvm_set_pfn_accessed); EXPORT_SYMBOL_GPL(kvm_set_pfn_accessed);
void kvm_get_pfn(pfn_t pfn) void kvm_get_pfn(pfn_t pfn)
{ {
if (!is_mmio_pfn(pfn)) if (!kvm_is_mmio_pfn(pfn))
get_page(pfn_to_page(pfn)); get_page(pfn_to_page(pfn));
} }
EXPORT_SYMBOL_GPL(kvm_get_pfn); EXPORT_SYMBOL_GPL(kvm_get_pfn);
......
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