diff options
author | Zhang Xiantao <xiantao.zhang@intel.com> | 2007-11-21 22:20:33 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-01-30 10:53:14 -0500 |
commit | e9f85cde99fa011db256f6683ba81d155e0d3f57 (patch) | |
tree | 778409f784f030687166c660c2dd9425d032ec1f /drivers/kvm/x86.c | |
parent | 83ff3b9d4a0ade8f8eb9757fd4b36c501ba161e4 (diff) |
KVM: Portability: Move unalias_gfn to arch dependent file
Non-x86 archs don't need this mechanism. Move it to arch, and
keep its interface in common.
Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
Acked-by: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/x86.c')
-rw-r--r-- | drivers/kvm/x86.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c index 7237cb25f77d..2be59364a49d 100644 --- a/drivers/kvm/x86.c +++ b/drivers/kvm/x86.c | |||
@@ -1119,6 +1119,20 @@ static int kvm_vm_ioctl_get_nr_mmu_pages(struct kvm *kvm) | |||
1119 | return kvm->n_alloc_mmu_pages; | 1119 | return kvm->n_alloc_mmu_pages; |
1120 | } | 1120 | } |
1121 | 1121 | ||
1122 | gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn) | ||
1123 | { | ||
1124 | int i; | ||
1125 | struct kvm_mem_alias *alias; | ||
1126 | |||
1127 | for (i = 0; i < kvm->naliases; ++i) { | ||
1128 | alias = &kvm->aliases[i]; | ||
1129 | if (gfn >= alias->base_gfn | ||
1130 | && gfn < alias->base_gfn + alias->npages) | ||
1131 | return alias->target_gfn + gfn - alias->base_gfn; | ||
1132 | } | ||
1133 | return gfn; | ||
1134 | } | ||
1135 | |||
1122 | /* | 1136 | /* |
1123 | * Set a new alias region. Aliases map a portion of physical memory into | 1137 | * Set a new alias region. Aliases map a portion of physical memory into |
1124 | * another portion. This is useful for memory windows, for example the PC | 1138 | * another portion. This is useful for memory windows, for example the PC |