* [PATCH] Moving unalias_gfn to x86.c
@ 2007-11-22 3:25 Zhang, Xiantao
[not found] ` <42DFA526FC41B1429CE7279EF83C6BDC9E733B-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Zhang, Xiantao @ 2007-11-22 3:25 UTC (permalink / raw)
To: Avi Kivity
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
carsteno-tA70FqPdS9bQT0dZR+AlfA, Hollis Blanchard
[-- Attachment #1: Type: text/plain, Size: 1963 bytes --]
From: Zhang Xiantao <xiantao.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Date: Thu, 22 Nov 2007 11:20:33 +0800
Subject: [PATCH] KVM Portability: moving unalias_gfn to arch.
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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
drivers/kvm/kvm_main.c | 14 --------------
drivers/kvm/x86.c | 14 ++++++++++++++
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 552321d..0ac1a5f 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -408,20 +408,6 @@ int kvm_is_error_hva(unsigned long addr)
}
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)
{
int i;
diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c
index 2460299..0873c95 100644
--- a/drivers/kvm/x86.c
+++ b/drivers/kvm/x86.c
@@ -1096,6 +1096,20 @@ static int kvm_vm_ioctl_get_nr_mmu_pages(struct
kvm *kvm)
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
* another portion. This is useful for memory windows, for example the
PC
--
1.5.1.2
[-- Attachment #2: 0001-KVM-Portability-moving-unalias_gfn-to-arch.patch --]
[-- Type: application/octet-stream, Size: 1906 bytes --]
From a5c33d21b9bb7e52bbb12c1391b0a32260bf0583 Mon Sep 17 00:00:00 2001
From: Zhang Xiantao <xiantao.zhang@intel.com>
Date: Thu, 22 Nov 2007 11:20:33 +0800
Subject: [PATCH] KVM Portability: moving unalias_gfn to arch.
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>
---
drivers/kvm/kvm_main.c | 14 --------------
drivers/kvm/x86.c | 14 ++++++++++++++
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 552321d..0ac1a5f 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -408,20 +408,6 @@ int kvm_is_error_hva(unsigned long addr)
}
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)
{
int i;
diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c
index 2460299..0873c95 100644
--- a/drivers/kvm/x86.c
+++ b/drivers/kvm/x86.c
@@ -1096,6 +1096,20 @@ static int kvm_vm_ioctl_get_nr_mmu_pages(struct kvm *kvm)
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
* another portion. This is useful for memory windows, for example the PC
--
1.5.1.2
[-- Attachment #3: Type: text/plain, Size: 228 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
[-- Attachment #4: Type: text/plain, Size: 186 bytes --]
_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread[parent not found: <42DFA526FC41B1429CE7279EF83C6BDC9E733B-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>]
* Re: [PATCH] Moving unalias_gfn to x86.c [not found] ` <42DFA526FC41B1429CE7279EF83C6BDC9E733B-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org> @ 2007-11-22 8:41 ` Izik Eidus [not found] ` <1195720902.3438.5.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org> 2007-11-22 9:10 ` Carsten Otte 2007-11-22 10:33 ` Avi Kivity 2 siblings, 1 reply; 6+ messages in thread From: Izik Eidus @ 2007-11-22 8:41 UTC (permalink / raw) To: Zhang, Xiantao Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, carsteno-tA70FqPdS9bQT0dZR+AlfA, Hollis Blanchard, Avi Kivity On Thu, 2007-11-22 at 11:25 +0800, Zhang, Xiantao wrote: > From: Zhang Xiantao <xiantao.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > Date: Thu, 22 Nov 2007 11:20:33 +0800 > Subject: [PATCH] KVM Portability: moving unalias_gfn to arch. > 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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > --- this is good, we probably want to change gfn_to_memslot() to have #ifdef kvm_x86 to call the unalias memory and gfn_to_hva on x86 still must to call unalias_gfn() so it will probably need a ifdef as well. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <1195720902.3438.5.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>]
* Re: [PATCH] Moving unalias_gfn to x86.c [not found] ` <1195720902.3438.5.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org> @ 2007-11-22 9:09 ` Zhang, Xiantao [not found] ` <42DFA526FC41B1429CE7279EF83C6BDC9E74BE-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Zhang, Xiantao @ 2007-11-22 9:09 UTC (permalink / raw) To: Izik Eidus Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, carsteno-tA70FqPdS9bQT0dZR+AlfA, Avi Kivity, Hollis Blanchard Izik Eidus wrote: > On Thu, 2007-11-22 at 11:25 +0800, Zhang, Xiantao wrote: >> From: Zhang Xiantao <xiantao.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> >> Date: Thu, 22 Nov 2007 11:20:33 +0800 >> Subject: [PATCH] KVM Portability: moving unalias_gfn to arch. >> 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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> --- > > this is good, > > we probably want to change > gfn_to_memslot() to have #ifdef kvm_x86 to call the unalias memory > and gfn_to_hva on x86 still must to call unalias_gfn() so it will > probably need a ifdef as well. Don't know #ifdef way is acceptable. If yes, sure to do that. Contrarily, other archs can define it , and just returen original gfn instead:) > ------------------------------------------------------------------------ - > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > kvm-devel mailing list > kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org > https://lists.sourceforge.net/lists/listinfo/kvm-devel ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <42DFA526FC41B1429CE7279EF83C6BDC9E74BE-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>]
* Re: [PATCH] Moving unalias_gfn to x86.c [not found] ` <42DFA526FC41B1429CE7279EF83C6BDC9E74BE-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org> @ 2007-11-22 9:03 ` Izik Eidus 0 siblings, 0 replies; 6+ messages in thread From: Izik Eidus @ 2007-11-22 9:03 UTC (permalink / raw) To: Zhang, Xiantao Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, carsteno-tA70FqPdS9bQT0dZR+AlfA, Avi Kivity, Hollis Blanchard On Thu, 2007-11-22 at 17:09 +0800, Zhang, Xiantao wrote: > Izik Eidus wrote: > > On Thu, 2007-11-22 at 11:25 +0800, Zhang, Xiantao wrote: > >> From: Zhang Xiantao <xiantao.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > >> Date: Thu, 22 Nov 2007 11:20:33 +0800 > >> Subject: [PATCH] KVM Portability: moving unalias_gfn to arch. > >> 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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> --- > > > > this is good, > > > > we probably want to change > > gfn_to_memslot() to have #ifdef kvm_x86 to call the unalias memory > > and gfn_to_hva on x86 still must to call unalias_gfn() so it will > > probably need a ifdef as well. > > Don't know #ifdef way is acceptable. If yes, sure to do that. > Contrarily, other archs > can define it , and just returen original gfn instead:) > ok so call to kvm_arch_gfn_to_memslot() or something like that can be done the same with kvm_arch_gva_to_hva() this both will call to kvm_gva_to_hva() that will share most of the code ... ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Moving unalias_gfn to x86.c [not found] ` <42DFA526FC41B1429CE7279EF83C6BDC9E733B-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org> 2007-11-22 8:41 ` Izik Eidus @ 2007-11-22 9:10 ` Carsten Otte 2007-11-22 10:33 ` Avi Kivity 2 siblings, 0 replies; 6+ messages in thread From: Carsten Otte @ 2007-11-22 9:10 UTC (permalink / raw) To: Zhang, Xiantao Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, carsteno-tA70FqPdS9bQT0dZR+AlfA, Hollis Blanchard, Avi Kivity Zhang, Xiantao wrote: > From: Zhang Xiantao <xiantao.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > Date: Thu, 22 Nov 2007 11:20:33 +0800 > Subject: [PATCH] KVM Portability: moving unalias_gfn to arch. > 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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> Acked-by: Carsten Otte <cotte-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org> ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Moving unalias_gfn to x86.c [not found] ` <42DFA526FC41B1429CE7279EF83C6BDC9E733B-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org> 2007-11-22 8:41 ` Izik Eidus 2007-11-22 9:10 ` Carsten Otte @ 2007-11-22 10:33 ` Avi Kivity 2 siblings, 0 replies; 6+ messages in thread From: Avi Kivity @ 2007-11-22 10:33 UTC (permalink / raw) To: Zhang, Xiantao Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, carsteno-tA70FqPdS9bQT0dZR+AlfA, Hollis Blanchard Zhang, Xiantao wrote: > From: Zhang Xiantao <xiantao.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > Date: Thu, 22 Nov 2007 11:20:33 +0800 > Subject: [PATCH] KVM Portability: moving unalias_gfn to arch. > Non-x86 archs don't need this mechanism. Move it to arch, and > keep its interface in common. > Applied, thanks. -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-11-22 10:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-22 3:25 [PATCH] Moving unalias_gfn to x86.c Zhang, Xiantao
[not found] ` <42DFA526FC41B1429CE7279EF83C6BDC9E733B-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-11-22 8:41 ` Izik Eidus
[not found] ` <1195720902.3438.5.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-11-22 9:09 ` Zhang, Xiantao
[not found] ` <42DFA526FC41B1429CE7279EF83C6BDC9E74BE-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-11-22 9:03 ` Izik Eidus
2007-11-22 9:10 ` Carsten Otte
2007-11-22 10:33 ` Avi Kivity
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox