kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kvm: x86: fix comment about {mmu,nested_mmu}.gva_to_gpa
@ 2015-12-30 16:26 David Matlack
  2016-01-07 10:04 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: David Matlack @ 2015-12-30 16:26 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, David Matlack

The comment had the meaning of mmu.gva_to_gpa and nested_mmu.gva_to_gpa
swapped. Fix that, and also add some details describing how each translation
works.

Signed-off-by: David Matlack <dmatlack@google.com>
---
 arch/x86/kvm/mmu.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index e7c2c14..098a9c2 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -4058,10 +4058,12 @@ static void init_kvm_nested_mmu(struct kvm_vcpu *vcpu)
 	g_context->inject_page_fault = kvm_inject_page_fault;
 
 	/*
-	 * Note that arch.mmu.gva_to_gpa translates l2_gva to l1_gpa. The
-	 * translation of l2_gpa to l1_gpa addresses is done using the
-	 * arch.nested_mmu.gva_to_gpa function. Basically the gva_to_gpa
-	 * functions between mmu and nested_mmu are swapped.
+	 * Note that arch.mmu.gva_to_gpa translates l2_gpa to l1_gpa using
+	 * L1's nested page tables (e.g. EPT12). The nested translation
+	 * of l2_gva to l1_gpa is done by arch.nested_mmu.gva_to_gpa using
+	 * L2's page tables as the first level of translation and L1's
+	 * nested page tables as the second level of translation. Basically
+	 * the gva_to_gpa functions between mmu and nested_mmu are swapped.
 	 */
 	if (!is_paging(vcpu)) {
 		g_context->nx = false;
-- 
2.6.0.rc2.230.g3dd15c0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kvm: x86: fix comment about {mmu,nested_mmu}.gva_to_gpa
  2015-12-30 16:26 [PATCH] kvm: x86: fix comment about {mmu,nested_mmu}.gva_to_gpa David Matlack
@ 2016-01-07 10:04 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2016-01-07 10:04 UTC (permalink / raw)
  To: David Matlack, kvm



On 30/12/2015 17:26, David Matlack wrote:
> The comment had the meaning of mmu.gva_to_gpa and nested_mmu.gva_to_gpa
> swapped. Fix that, and also add some details describing how each translation
> works.
> 
> Signed-off-by: David Matlack <dmatlack@google.com>
> ---
>  arch/x86/kvm/mmu.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index e7c2c14..098a9c2 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -4058,10 +4058,12 @@ static void init_kvm_nested_mmu(struct kvm_vcpu *vcpu)
>  	g_context->inject_page_fault = kvm_inject_page_fault;
>  
>  	/*
> -	 * Note that arch.mmu.gva_to_gpa translates l2_gva to l1_gpa. The
> -	 * translation of l2_gpa to l1_gpa addresses is done using the
> -	 * arch.nested_mmu.gva_to_gpa function. Basically the gva_to_gpa
> -	 * functions between mmu and nested_mmu are swapped.
> +	 * Note that arch.mmu.gva_to_gpa translates l2_gpa to l1_gpa using
> +	 * L1's nested page tables (e.g. EPT12). The nested translation
> +	 * of l2_gva to l1_gpa is done by arch.nested_mmu.gva_to_gpa using
> +	 * L2's page tables as the first level of translation and L1's
> +	 * nested page tables as the second level of translation. Basically
> +	 * the gva_to_gpa functions between mmu and nested_mmu are swapped.
>  	 */
>  	if (!is_paging(vcpu)) {
>  		g_context->nx = false;
> 

Applied, thanks.

Paolo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-07 10:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-30 16:26 [PATCH] kvm: x86: fix comment about {mmu,nested_mmu}.gva_to_gpa David Matlack
2016-01-07 10:04 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).