Commit 0d679782b0299bc6a0d01df20676fe56b2c31857 changed the use of is_mmio_pfn, so rebased this patch to latest kvm.git. Thanks Xiantao >From 485e503470ebaa7194d6878a6d0c5d149af0a501 Mon Sep 17 00:00:00 2001 From: Xiantao Zhang <xiantao.zhang@xxxxxxxxx> Date: Sat, 27 Sep 2008 10:55:40 +0800 Subject: [PATCH] kvm: Changing is_mmio_pfn to kvm_is_mmio_pfn, and make it common for all archs. Using kvm prefix to aovid polluting kernel's name space. Signed-off-by: Xiantao Zhang <xiantao.zhang@xxxxxxxxx> --- include/linux/kvm_host.h | 2 ++ virt/kvm/kvm_main.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 10c1146..b3b7598 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -288,6 +288,8 @@ int kvm_cpu_has_interrupt(struct kvm_vcpu *v); int kvm_cpu_has_pending_timer(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 hlist_node link; unsigned gsi; diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 485bcdc..cf0ab8e 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -316,7 +316,7 @@ static inline int valid_vcpu(int n) 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)) return PageReserved(pfn_to_page(pfn)); @@ -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; up_read(¤t->mm->mmap_sem); - BUG_ON(!is_mmio_pfn(pfn)); + BUG_ON(!kvm_is_mmio_pfn(pfn)); } else pfn = page_to_pfn(page[0]); @@ -1008,10 +1008,10 @@ struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn) pfn_t pfn; pfn = gfn_to_pfn(kvm, gfn); - if (!is_mmio_pfn(pfn)) + if (!kvm_is_mmio_pfn(pfn)) return pfn_to_page(pfn); - WARN_ON(is_mmio_pfn(pfn)); + WARN_ON(kvm_is_mmio_pfn(pfn)); get_page(bad_page); return bad_page; @@ -1027,7 +1027,7 @@ EXPORT_SYMBOL_GPL(kvm_release_page_clean); 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)); } EXPORT_SYMBOL_GPL(kvm_release_pfn_clean); @@ -1053,7 +1053,7 @@ EXPORT_SYMBOL_GPL(kvm_set_page_dirty); 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); if (!PageReserved(page)) SetPageDirty(page); @@ -1063,14 +1063,14 @@ EXPORT_SYMBOL_GPL(kvm_set_pfn_dirty); 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)); } EXPORT_SYMBOL_GPL(kvm_set_pfn_accessed); void kvm_get_pfn(pfn_t pfn) { - if (!is_mmio_pfn(pfn)) + if (!kvm_is_mmio_pfn(pfn)) get_page(pfn_to_page(pfn)); } EXPORT_SYMBOL_GPL(kvm_get_pfn); -- 1.5.1 Zhang, Xiantao wrote: > From 3211cc7a86ba050114733f847361478ab25619d7 Mon Sep 17 00:00:00 2001 > From: Xiantao Zhang <xiantao.zhang@xxxxxxxxx> > Date: Sat, 27 Sep 2008 10:55:40 +0800 > Subject: [PATCH] kvm: Changing is_mmio_pfn to kvm_is_mmio_pfn, and > make it common > > for all archs. > > Using kvm prefix to aovid polluting kernel's name space. > Signed-off-by: Xiantao Zhang <xiantao.zhang@xxxxxxxxx> > --- > include/asm-x86/kvm_host.h | 2 -- > include/linux/kvm_host.h | 2 ++ > virt/kvm/kvm_main.c | 16 ++++++++-------- > virt/kvm/vtd.c | 4 ++-- > 4 files changed, 12 insertions(+), 12 deletions(-) > > diff --git a/include/asm-x86/kvm_host.h b/include/asm-x86/kvm_host.h > index 1b114ca..b507b8f 100644 > --- a/include/asm-x86/kvm_host.h > +++ b/include/asm-x86/kvm_host.h > @@ -502,8 +502,6 @@ int emulator_write_phys(struct kvm_vcpu *vcpu, > gpa_t gpa, > int kvm_pv_mmu_op(struct kvm_vcpu *vcpu, unsigned long bytes, > gpa_t addr, unsigned long *ret); > > -int is_mmio_pfn(pfn_t pfn); > - > extern bool tdp_enabled; > > enum emulation_result { > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h > index 10c1146..b3b7598 100644 > --- a/include/linux/kvm_host.h > +++ b/include/linux/kvm_host.h > @@ -288,6 +288,8 @@ int kvm_cpu_has_interrupt(struct kvm_vcpu *v); > int kvm_cpu_has_pending_timer(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 hlist_node link; > unsigned gsi; > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index 59e08a4..cf0ab8e 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -316,7 +316,7 @@ static inline int valid_vcpu(int n) > return likely(n >= 0 && n < KVM_MAX_VCPUS); > } > > -inline int is_mmio_pfn(pfn_t pfn) > +inline int kvm_is_mmio_pfn(pfn_t pfn) > { > if (pfn_valid(pfn)) > return PageReserved(pfn_to_page(pfn)); > @@ -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; > up_read(¤t->mm->mmap_sem); > - BUG_ON(!is_mmio_pfn(pfn)); > + BUG_ON(!kvm_is_mmio_pfn(pfn)); > } else > pfn = page_to_pfn(page[0]); > > @@ -1008,10 +1008,10 @@ struct page *gfn_to_page(struct kvm *kvm, > gfn_t gfn) > pfn_t pfn; > > pfn = gfn_to_pfn(kvm, gfn); > - if (!is_mmio_pfn(pfn)) > + if (!kvm_is_mmio_pfn(pfn)) > return pfn_to_page(pfn); > > - WARN_ON(is_mmio_pfn(pfn)); > + WARN_ON(kvm_is_mmio_pfn(pfn)); > > get_page(bad_page); > return bad_page; > @@ -1027,7 +1027,7 @@ EXPORT_SYMBOL_GPL(kvm_release_page_clean); > > 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)); > } > EXPORT_SYMBOL_GPL(kvm_release_pfn_clean); > @@ -1053,7 +1053,7 @@ EXPORT_SYMBOL_GPL(kvm_set_page_dirty); > > 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); > if (!PageReserved(page)) > SetPageDirty(page); > @@ -1063,14 +1063,14 @@ EXPORT_SYMBOL_GPL(kvm_set_pfn_dirty); > > 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)); > } > EXPORT_SYMBOL_GPL(kvm_set_pfn_accessed); > > void kvm_get_pfn(pfn_t pfn) > { > - if (!is_mmio_pfn(pfn)) > + if (!kvm_is_mmio_pfn(pfn)) > get_page(pfn_to_page(pfn)); > } > EXPORT_SYMBOL_GPL(kvm_get_pfn); > diff --git a/virt/kvm/vtd.c b/virt/kvm/vtd.c > index 667bf3f..b3f4948 100644 > --- a/virt/kvm/vtd.c > +++ b/virt/kvm/vtd.c > @@ -48,11 +48,11 @@ int kvm_iommu_map_pages(struct kvm *kvm, > /* check if already mapped */ > pfn = (pfn_t)intel_iommu_iova_to_pfn(domain, > gfn_to_gpa(gfn)); > - if (pfn && !is_mmio_pfn(pfn)) > + if (pfn && !kvm_is_mmio_pfn(pfn)) > continue; > > pfn = gfn_to_pfn(kvm, gfn); > - if (!is_mmio_pfn(pfn)) { > + if (!kvm_is_mmio_pfn(pfn)) { > r = intel_iommu_page_mapping(domain, > gfn_to_gpa(gfn), > pfn_to_hpa(pfn),
Attachment:
0003-kvm-Changing-is_mmio_pfn-to-kvm_is_mmio_pfn-and-ma.patch
Description: 0003-kvm-Changing-is_mmio_pfn-to-kvm_is_mmio_pfn-and-ma.patch