* [PATCH] KVM: fix gfn_to_hva() to use gfn_to_hva_memslot()
@ 2010-02-25 2:33 Takuya Yoshikawa
2010-02-25 10:34 ` Avi Kivity
0 siblings, 1 reply; 2+ messages in thread
From: Takuya Yoshikawa @ 2010-02-25 2:33 UTC (permalink / raw)
To: avi, mtosatti; +Cc: kvm
Marcelo introduced gfn_to_hva_memslot() when he implemented
gfn_to_pfn_memslot(). Let's use this for gfn_to_hva() too.
Note: also remove parentheses next to return as checkpatch said to do.
Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
---
virt/kvm/kvm_main.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 548f925..e758ef7 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -910,6 +910,11 @@ int memslot_id(struct kvm *kvm, gfn_t gfn)
return memslot - slots->memslots;
}
+static unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn)
+{
+ return slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE;
+}
+
unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn)
{
struct kvm_memory_slot *slot;
@@ -918,7 +923,7 @@ unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn)
slot = gfn_to_memslot_unaliased(kvm, gfn);
if (!slot || slot->flags & KVM_MEMSLOT_INVALID)
return bad_hva();
- return (slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE);
+ return gfn_to_hva_memslot(slot, gfn);
}
EXPORT_SYMBOL_GPL(gfn_to_hva);
@@ -968,11 +973,6 @@ pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn)
}
EXPORT_SYMBOL_GPL(gfn_to_pfn);
-static unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn)
-{
- return (slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE);
-}
-
pfn_t gfn_to_pfn_memslot(struct kvm *kvm,
struct kvm_memory_slot *slot, gfn_t gfn)
{
--
1.6.3.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] KVM: fix gfn_to_hva() to use gfn_to_hva_memslot()
2010-02-25 2:33 [PATCH] KVM: fix gfn_to_hva() to use gfn_to_hva_memslot() Takuya Yoshikawa
@ 2010-02-25 10:34 ` Avi Kivity
0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2010-02-25 10:34 UTC (permalink / raw)
To: Takuya Yoshikawa; +Cc: mtosatti, kvm
On 02/25/2010 04:33 AM, Takuya Yoshikawa wrote:
> Marcelo introduced gfn_to_hva_memslot() when he implemented
> gfn_to_pfn_memslot(). Let's use this for gfn_to_hva() too.
>
> Note: also remove parentheses next to return as checkpatch said to do.
>
Applied, thanks.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-02-25 10:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-25 2:33 [PATCH] KVM: fix gfn_to_hva() to use gfn_to_hva_memslot() Takuya Yoshikawa
2010-02-25 10:34 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox