diff options
author | Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> | 2012-08-20 22:59:12 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-08-22 08:08:52 -0400 |
commit | 037d92dc5d4691ae7cf44699c55ca83b1b441992 (patch) | |
tree | e3ec9d29b4312a11087c008551ea1ba54bdd7c13 | |
parent | 67b29204c8c9ecb4b2799a06ab646eeb363a0fe6 (diff) |
KVM: introduce gfn_to_pfn_memslot_atomic
It can instead of hva_to_pfn_atomic
Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | arch/x86/kvm/mmu.c | 5 | ||||
-rw-r--r-- | include/linux/kvm_host.h | 3 | ||||
-rw-r--r-- | virt/kvm/kvm_main.c | 14 |
3 files changed, 11 insertions, 11 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 9651c2cd0005..5548971ae80d 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -2510,15 +2510,12 @@ static pfn_t pte_prefetch_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn, | |||
2510 | bool no_dirty_log) | 2510 | bool no_dirty_log) |
2511 | { | 2511 | { |
2512 | struct kvm_memory_slot *slot; | 2512 | struct kvm_memory_slot *slot; |
2513 | unsigned long hva; | ||
2514 | 2513 | ||
2515 | slot = gfn_to_memslot_dirty_bitmap(vcpu, gfn, no_dirty_log); | 2514 | slot = gfn_to_memslot_dirty_bitmap(vcpu, gfn, no_dirty_log); |
2516 | if (!slot) | 2515 | if (!slot) |
2517 | return KVM_PFN_ERR_FAULT; | 2516 | return KVM_PFN_ERR_FAULT; |
2518 | 2517 | ||
2519 | hva = gfn_to_hva_memslot(slot, gfn); | 2518 | return gfn_to_pfn_memslot_atomic(slot, gfn); |
2520 | |||
2521 | return hva_to_pfn_atomic(hva); | ||
2522 | } | 2519 | } |
2523 | 2520 | ||
2524 | static int direct_pte_prefetch_many(struct kvm_vcpu *vcpu, | 2521 | static int direct_pte_prefetch_many(struct kvm_vcpu *vcpu, |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index d4bd4d41e355..52c86e4f6d8c 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -462,7 +462,6 @@ void kvm_release_page_dirty(struct page *page); | |||
462 | void kvm_set_page_dirty(struct page *page); | 462 | void kvm_set_page_dirty(struct page *page); |
463 | void kvm_set_page_accessed(struct page *page); | 463 | void kvm_set_page_accessed(struct page *page); |
464 | 464 | ||
465 | pfn_t hva_to_pfn_atomic(unsigned long addr); | ||
466 | pfn_t gfn_to_pfn_atomic(struct kvm *kvm, gfn_t gfn); | 465 | pfn_t gfn_to_pfn_atomic(struct kvm *kvm, gfn_t gfn); |
467 | pfn_t gfn_to_pfn_async(struct kvm *kvm, gfn_t gfn, bool *async, | 466 | pfn_t gfn_to_pfn_async(struct kvm *kvm, gfn_t gfn, bool *async, |
468 | bool write_fault, bool *writable); | 467 | bool write_fault, bool *writable); |
@@ -470,6 +469,8 @@ pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn); | |||
470 | pfn_t gfn_to_pfn_prot(struct kvm *kvm, gfn_t gfn, bool write_fault, | 469 | pfn_t gfn_to_pfn_prot(struct kvm *kvm, gfn_t gfn, bool write_fault, |
471 | bool *writable); | 470 | bool *writable); |
472 | pfn_t gfn_to_pfn_memslot(struct kvm_memory_slot *slot, gfn_t gfn); | 471 | pfn_t gfn_to_pfn_memslot(struct kvm_memory_slot *slot, gfn_t gfn); |
472 | pfn_t gfn_to_pfn_memslot_atomic(struct kvm_memory_slot *slot, gfn_t gfn); | ||
473 | |||
473 | void kvm_release_pfn_dirty(pfn_t pfn); | 474 | void kvm_release_pfn_dirty(pfn_t pfn); |
474 | void kvm_release_pfn_clean(pfn_t pfn); | 475 | void kvm_release_pfn_clean(pfn_t pfn); |
475 | void kvm_set_pfn_dirty(pfn_t pfn); | 476 | void kvm_set_pfn_dirty(pfn_t pfn); |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 7b94d70a323f..543f9b7e5aa2 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -1102,12 +1102,6 @@ static pfn_t hva_to_pfn(unsigned long addr, bool atomic, bool *async, | |||
1102 | return pfn; | 1102 | return pfn; |
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | pfn_t hva_to_pfn_atomic(unsigned long addr) | ||
1106 | { | ||
1107 | return hva_to_pfn(addr, true, NULL, true, NULL); | ||
1108 | } | ||
1109 | EXPORT_SYMBOL_GPL(hva_to_pfn_atomic); | ||
1110 | |||
1111 | static pfn_t __gfn_to_pfn(struct kvm *kvm, gfn_t gfn, bool atomic, bool *async, | 1105 | static pfn_t __gfn_to_pfn(struct kvm *kvm, gfn_t gfn, bool atomic, bool *async, |
1112 | bool write_fault, bool *writable) | 1106 | bool write_fault, bool *writable) |
1113 | { | 1107 | { |
@@ -1155,6 +1149,14 @@ pfn_t gfn_to_pfn_memslot(struct kvm_memory_slot *slot, gfn_t gfn) | |||
1155 | return hva_to_pfn(addr, false, NULL, true, NULL); | 1149 | return hva_to_pfn(addr, false, NULL, true, NULL); |
1156 | } | 1150 | } |
1157 | 1151 | ||
1152 | pfn_t gfn_to_pfn_memslot_atomic(struct kvm_memory_slot *slot, gfn_t gfn) | ||
1153 | { | ||
1154 | unsigned long addr = gfn_to_hva_memslot(slot, gfn); | ||
1155 | |||
1156 | return hva_to_pfn(addr, true, NULL, true, NULL); | ||
1157 | } | ||
1158 | EXPORT_SYMBOL_GPL(gfn_to_pfn_memslot_atomic); | ||
1159 | |||
1158 | int gfn_to_page_many_atomic(struct kvm *kvm, gfn_t gfn, struct page **pages, | 1160 | int gfn_to_page_many_atomic(struct kvm *kvm, gfn_t gfn, struct page **pages, |
1159 | int nr_pages) | 1161 | int nr_pages) |
1160 | { | 1162 | { |