public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joerg.roedel@amd.com>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 13/22] KVM: X86: Add kvm_read_guest_page_tdp function
Date: Tue, 27 Apr 2010 15:10:48 +0200	[thread overview]
Message-ID: <20100427131047.GG11097@amd.com> (raw)
In-Reply-To: <4BD6DBB3.7050908@redhat.com>

On Tue, Apr 27, 2010 at 03:42:27PM +0300, Avi Kivity wrote:
> On 04/27/2010 01:38 PM, Joerg Roedel wrote:
> >This patch adds a function which can read from the guests
> >physical memory or from the guest's guest physical memory.
> >This will be used in the two-dimensional page table walker.
> >
> >Signed-off-by: Joerg Roedel<joerg.roedel@amd.com>
> >---
> >  arch/x86/include/asm/kvm_host.h |    3 +++
> >  arch/x86/kvm/x86.c              |   24 ++++++++++++++++++++++++
> >  2 files changed, 27 insertions(+), 0 deletions(-)
> >
> >diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> >index 3cbfb51..7851bbc 100644
> >--- a/arch/x86/include/asm/kvm_host.h
> >+++ b/arch/x86/include/asm/kvm_host.h
> >@@ -635,6 +635,9 @@ void kvm_requeue_exception(struct kvm_vcpu *vcpu, unsigned nr);
> >  void kvm_requeue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code);
> >  void kvm_inject_page_fault(struct kvm_vcpu *vcpu, unsigned long cr2,
> >  			   u32 error_code);
> >+int kvm_read_guest_page_tdp(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu,
> >+			    gfn_t gfn, void *data, int offset, int len,
> >+			    u32 *error);
> >  bool kvm_require_cpl(struct kvm_vcpu *vcpu, int required_cpl);
> >
> >  int kvm_pic_set_irq(void *opaque, int irq, int level);
> >diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> >index 6b2ce1d..558d995 100644
> >--- a/arch/x86/kvm/x86.c
> >+++ b/arch/x86/kvm/x86.c
> >@@ -356,6 +356,30 @@ bool kvm_require_cpl(struct kvm_vcpu *vcpu, int required_cpl)
> >  EXPORT_SYMBOL_GPL(kvm_require_cpl);
> >
> >  /*
> >+ * This function will be used to read from the physical memory of the currently
> >+ * running guest. The difference to kvm_read_guest_page ist that this function
> >+ * can read from guest physical or from the guest's guest physical memory.
> >+ */
> 
> s/ist/is/

This is a common typo error I make ;) I'll fix it.

> >+int kvm_read_guest_page_tdp(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu,
> >+			    gfn_t gfn, void *data, int offset, int len,
> >+			    u32 *error)
> 
> Naming: I see 'tdp' as a host property, and this is valid whether
> tdp is enabled or not.  Suggest calling it
> kvm_read_nested_guest_page().
> 
> Following mmu.txt, the parameter would be ngfn, not gfn.
> 
> >+{
> >+	gfn_t real_gfn;
> >+	gpa_t gpa;
> >+
> >+	*error   = 0;
> >+	gpa      = gfn<<  PAGE_SHIFT;
> >+	real_gfn = mmu->translate_gpa(vcpu, gpa, error);
> 
> Overflow: sizeof(gpa) > sizeof(gfn).
> 
> >+	if (real_gfn == UNMAPPED_GVA)
> >+		return -EFAULT;
> >+
> >+	real_gfn>>= PAGE_SHIFT;
> 
> gpa_to_gfn().

I'll fix the overflow errors and send an updated patch.

Thanks,
	Joerg


  reply	other threads:[~2010-04-27 13:11 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-27 10:38 [PATCH 0/22] Nested Paging support for Nested SVM v2 Joerg Roedel
2010-04-27 10:38 ` [PATCH 01/22] KVM: MMU: Check for root_level instead of long mode Joerg Roedel
2010-04-27 10:38 ` [PATCH 02/22] KVM: MMU: Make tdp_enabled a mmu-context parameter Joerg Roedel
2010-04-27 12:06   ` Avi Kivity
2010-04-27 10:38 ` [PATCH 03/22] KVM: MMU: Make set_cr3 a function pointer in kvm_mmu Joerg Roedel
2010-04-27 10:38 ` [PATCH 04/22] KVM: X86: Introduce a tdp_set_cr3 function Joerg Roedel
2010-04-27 10:38 ` [PATCH 05/22] KVM: MMU: Introduce get_cr3 function pointer Joerg Roedel
2010-04-27 10:38 ` [PATCH 06/22] KVM: MMU: Introduce inject_page_fault " Joerg Roedel
2010-04-27 10:38 ` [PATCH 07/22] KVM: SVM: Implement MMU helper functions for Nested Nested Paging Joerg Roedel
2010-04-27 10:38 ` [PATCH 08/22] KVM: MMU: Change init_kvm_softmmu to take a context as parameter Joerg Roedel
2010-04-27 10:38 ` [PATCH 09/22] KVM: MMU: Let is_rsvd_bits_set take mmu context instead of vcpu Joerg Roedel
2010-04-27 10:38 ` [PATCH 10/22] KVM: MMU: Introduce generic walk_addr function Joerg Roedel
2010-04-27 10:38 ` [PATCH 11/22] KVM: MMU: Add infrastructure for two-level page walker Joerg Roedel
2010-04-27 12:34   ` Avi Kivity
2010-04-28 10:52     ` Joerg Roedel
2010-04-28 11:24       ` Avi Kivity
2010-04-28 11:03     ` Joerg Roedel
2010-04-28 11:09       ` Avi Kivity
2010-04-27 10:38 ` [PATCH 12/22] KVM: MMU: Implement nested gva_to_gpa functions Joerg Roedel
2010-04-27 12:37   ` Avi Kivity
2010-04-28 14:20     ` Joerg Roedel
2010-04-27 10:38 ` [PATCH 13/22] KVM: X86: Add kvm_read_guest_page_tdp function Joerg Roedel
2010-04-27 12:42   ` Avi Kivity
2010-04-27 13:10     ` Joerg Roedel [this message]
2010-04-27 13:40     ` Avi Kivity
2010-04-27 10:38 ` [PATCH 14/22] KVM: MMU: Make walk_addr_generic capable for two-level walking Joerg Roedel
2010-04-27 10:38 ` [PATCH 15/22] KVM: MMU: Introduce kvm_read_guest_page_x86() Joerg Roedel
2010-04-27 12:52   ` Avi Kivity
2010-04-27 13:20     ` Joerg Roedel
2010-04-27 13:35       ` Avi Kivity
2010-04-27 15:40         ` Joerg Roedel
2010-04-27 16:09           ` Avi Kivity
2010-04-27 16:27             ` Joerg Roedel
2010-04-28 15:31         ` Joerg Roedel
2010-04-27 10:38 ` [PATCH 16/22] KVM: MMU: Track page fault data in struct vcpu Joerg Roedel
2010-04-27 12:58   ` Avi Kivity
2010-04-27 13:28     ` Joerg Roedel
2010-04-27 13:37       ` Avi Kivity
2010-04-27 13:57         ` Joerg Roedel
2010-04-27 16:02           ` Avi Kivity
2010-05-03 16:32     ` Joerg Roedel
2010-05-04  7:53       ` Avi Kivity
2010-05-04  9:11         ` Roedel, Joerg
2010-05-04  9:20           ` Avi Kivity
2010-05-04  9:37             ` Roedel, Joerg
2010-05-04  9:45               ` Avi Kivity
2010-05-04  9:50                 ` Avi Kivity
2010-05-04 12:00                   ` Roedel, Joerg
2010-05-04 12:04                     ` Avi Kivity
2010-04-27 10:38 ` [PATCH 17/22] KVM: MMU: Propagate the right fault back to the guest after gva_to_gpa Joerg Roedel
2010-04-27 10:38 ` [PATCH 18/22] KVM: X86: Propagate fetch faults Joerg Roedel
2010-04-27 10:38 ` [PATCH 19/22] KVM: MMU: Introduce init_kvm_nested_mmu() Joerg Roedel
2010-04-27 10:38 ` [PATCH 20/22] KVM: SVM: Initialize Nested Nested MMU context on VMRUN Joerg Roedel
2010-04-27 13:01   ` Avi Kivity
2010-04-27 10:38 ` [PATCH 21/22] KVM: SVM: Report Nested Paging support to userspace Joerg Roedel
2010-04-27 10:38 ` [PATCH 22/22] KVM: SVM: Expect two more candiates for exit_int_info Joerg Roedel
2010-04-27 13:03 ` [PATCH 0/22] Nested Paging support for Nested SVM v2 Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100427131047.GG11097@amd.com \
    --to=joerg.roedel@amd.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox