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

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: default avatarZhang Xiantao <xiantao.zhang@intel.com>
Acked-by: default avatarCarsten Otte <cotte@de.ibm.com>
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
parent 83ff3b9d
...@@ -408,20 +408,6 @@ int kvm_is_error_hva(unsigned long addr) ...@@ -408,20 +408,6 @@ int kvm_is_error_hva(unsigned long addr)
} }
EXPORT_SYMBOL_GPL(kvm_is_error_hva); EXPORT_SYMBOL_GPL(kvm_is_error_hva);
gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn)
{
int i;
struct kvm_mem_alias *alias;
for (i = 0; i < kvm->naliases; ++i) {
alias = &kvm->aliases[i];
if (gfn >= alias->base_gfn
&& gfn < alias->base_gfn + alias->npages)
return alias->target_gfn + gfn - alias->base_gfn;
}
return gfn;
}
static struct kvm_memory_slot *__gfn_to_memslot(struct kvm *kvm, gfn_t gfn) static struct kvm_memory_slot *__gfn_to_memslot(struct kvm *kvm, gfn_t gfn)
{ {
int i; int i;
......
...@@ -1119,6 +1119,20 @@ static int kvm_vm_ioctl_get_nr_mmu_pages(struct kvm *kvm) ...@@ -1119,6 +1119,20 @@ static int kvm_vm_ioctl_get_nr_mmu_pages(struct kvm *kvm)
return kvm->n_alloc_mmu_pages; return kvm->n_alloc_mmu_pages;
} }
gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn)
{
int i;
struct kvm_mem_alias *alias;
for (i = 0; i < kvm->naliases; ++i) {
alias = &kvm->aliases[i];
if (gfn >= alias->base_gfn
&& gfn < alias->base_gfn + alias->npages)
return alias->target_gfn + gfn - alias->base_gfn;
}
return gfn;
}
/* /*
* Set a new alias region. Aliases map a portion of physical memory into * Set a new alias region. Aliases map a portion of physical memory into
* another portion. This is useful for memory windows, for example the PC * another portion. This is useful for memory windows, for example the PC
......
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