Re: [PATCH 02/10] nEPT: MMU context for nested EPT

2011-12-08 Thread Nadav Har'El
On Mon, Nov 14, 2011, Avi Kivity wrote about Re: [PATCH 02/10] nEPT: MMU context for nested EPT: +#if PTTYPE == EPT +real_gfn = mmu-translate_gpa(vcpu, gfn_to_gpa(table_gfn), + EPT_WRITABLE_MASK); +#else

Re: [PATCH 02/10] nEPT: MMU context for nested EPT

2011-12-07 Thread Nadav Har'El
On Sun, Nov 13, 2011, Orit Wasserman wrote about Re: [PATCH 02/10] nEPT: MMU context for nested EPT: +++ b/arch/x86/kvm/mmu.h @@ -48,6 +48,11 @@ #define PFERR_RSVD_MASK (1U 3) #define PFERR_FETCH_MASK (1U 4) +#define EPT_WRITABLE_MASK 2 +#define EPT_EXEC_MASK 4 This is another

Re: [PATCH 02/10] nEPT: MMU context for nested EPT

2011-12-07 Thread Avi Kivity
On 12/07/2011 11:06 AM, Nadav Har'El wrote: On Sun, Nov 13, 2011, Orit Wasserman wrote about Re: [PATCH 02/10] nEPT: MMU context for nested EPT: +++ b/arch/x86/kvm/mmu.h @@ -48,6 +48,11 @@ #define PFERR_RSVD_MASK (1U 3) #define PFERR_FETCH_MASK (1U 4) +#define

Re: [PATCH 02/10] nEPT: MMU context for nested EPT

2011-12-06 Thread Nadav Har'El
On Sun, Nov 13, 2011, Avi Kivity wrote about Re: [PATCH 02/10] nEPT: MMU context for nested EPT: On 11/13/2011 01:30 PM, Orit Wasserman wrote: Maybe this patch can help, this is roughly what Avi wants (I hope) done very quickly. I'm sorry I don't have setup to run nested VMX at the moment

Re: [PATCH 02/10] nEPT: MMU context for nested EPT

2011-12-06 Thread Avi Kivity
On 12/06/2011 02:40 PM, Nadav Har'El wrote: On Sun, Nov 13, 2011, Avi Kivity wrote about Re: [PATCH 02/10] nEPT: MMU context for nested EPT: On 11/13/2011 01:30 PM, Orit Wasserman wrote: Maybe this patch can help, this is roughly what Avi wants (I hope) done very quickly. I'm sorry

Re: [PATCH 02/10] nEPT: MMU context for nested EPT

2011-11-24 Thread Avi Kivity
On 11/23/2011 05:44 PM, Nadav Har'El wrote: On Wed, Nov 23, 2011, Nadav Har'El wrote about Re: [PATCH 02/10] nEPT: MMU context for nested EPT: +static int nested_ept_init_mmu_context(struct kvm_vcpu *vcpu) +{ + int r = kvm_init_shadow_mmu(vcpu, vcpu-arch.mmu); + + vcpu

Re: [PATCH 02/10] nEPT: MMU context for nested EPT

2011-11-23 Thread Nadav Har'El
On Sun, Nov 13, 2011, Orit Wasserman wrote about Re: [PATCH 02/10] nEPT: MMU context for nested EPT: Maybe this patch can help, this is roughly what Avi wants (I hope) done very quickly. I'm sorry I don't have setup to run nested VMX at the moment so i can't test it. Hi Orit, thanks

Re: [PATCH 02/10] nEPT: MMU context for nested EPT

2011-11-23 Thread Nadav Har'El
On Wed, Nov 23, 2011, Nadav Har'El wrote about Re: [PATCH 02/10] nEPT: MMU context for nested EPT: +static int nested_ept_init_mmu_context(struct kvm_vcpu *vcpu) +{ + int r = kvm_init_shadow_mmu(vcpu, vcpu-arch.mmu); + + vcpu-arch.nested_mmu.gva_to_gpa = EPT_gva_to_gpa_nested

Re: [PATCH 02/10] nEPT: MMU context for nested EPT

2011-11-14 Thread Avi Kivity
On 11/13/2011 08:26 PM, Orit Wasserman wrote: int kvm_mmu_get_spte_hierarchy(struct kvm_vcpu *vcpu, u64 addr, u64 sptes[4]); void kvm_mmu_set_mmio_spte_mask(u64 mmio_mask); int handle_mmio_page_fault_common(struct kvm_vcpu *vcpu, u64 addr, bool direct); diff --git

Re: [PATCH 02/10] nEPT: MMU context for nested EPT

2011-11-13 Thread Avi Kivity
On 11/12/2011 11:37 PM, Nadav Har'El wrote: On Sat, Nov 12, 2011, Avi Kivity wrote about Re: [PATCH 02/10] nEPT: MMU context for nested EPT: host may write-protect a page. Second, the shadow and guest ptes may be in different formats (ept vs ia32). I'm afraid I've lost you here

Re: [PATCH 02/10] nEPT: MMU context for nested EPT

2011-11-13 Thread Orit Wasserman
On 11/12/2011 11:37 PM, Nadav Har'El wrote: On Sat, Nov 12, 2011, Avi Kivity wrote about Re: [PATCH 02/10] nEPT: MMU context for nested EPT: host may write-protect a page. Second, the shadow and guest ptes may be in different formats (ept vs ia32). I'm afraid I've lost you here

Re: [PATCH 02/10] nEPT: MMU context for nested EPT

2011-11-13 Thread Avi Kivity
On 11/13/2011 01:30 PM, Orit Wasserman wrote: Maybe this patch can help, this is roughly what Avi wants (I hope) done very quickly. I'm sorry I don't have setup to run nested VMX at the moment so i can't test it. Orit diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index

Re: [PATCH 02/10] nEPT: MMU context for nested EPT

2011-11-13 Thread Orit Wasserman
On 11/13/2011 04:32 PM, Avi Kivity wrote: On 11/13/2011 01:30 PM, Orit Wasserman wrote: Maybe this patch can help, this is roughly what Avi wants (I hope) done very quickly. I'm sorry I don't have setup to run nested VMX at the moment so i can't test it. Orit diff --git

Re: [PATCH 02/10] nEPT: MMU context for nested EPT

2011-11-12 Thread Avi Kivity
On 11/10/2011 10:05 PM, Nadav Har'El wrote: On Thu, Nov 10, 2011, Avi Kivity wrote about Re: [PATCH 02/10] nEPT: MMU context for nested EPT: This is all correct, but the code in question parses the EPT12 table using the ia32 page table format. They're sufficiently similar so

Re: [PATCH 02/10] nEPT: MMU context for nested EPT

2011-11-12 Thread Nadav Har'El
On Sat, Nov 12, 2011, Avi Kivity wrote about Re: [PATCH 02/10] nEPT: MMU context for nested EPT: host may write-protect a page. Second, the shadow and guest ptes may be in different formats (ept vs ia32). I'm afraid I've lost you here... The shadow table and the to-be-shadowed table are both

[PATCH 02/10] nEPT: MMU context for nested EPT

2011-11-10 Thread Nadav Har'El
KVM's existing shadow MMU code already supports nested TDP. To use it, we need to set up a new MMU context for nested EPT, and create a few callbacks for it (nested_ept_*()). We then need to switch back and forth between this nested context and the regular MMU context when switching between L1 and

Re: [PATCH 02/10] nEPT: MMU context for nested EPT

2011-11-10 Thread Avi Kivity
On 11/10/2011 11:58 AM, Nadav Har'El wrote: KVM's existing shadow MMU code already supports nested TDP. To use it, we need to set up a new MMU context for nested EPT, and create a few callbacks for it (nested_ept_*()). We then need to switch back and forth between this nested context and the

Re: [PATCH 02/10] nEPT: MMU context for nested EPT

2011-11-10 Thread Avi Kivity
On 11/10/2011 11:58 AM, Nadav Har'El wrote: KVM's existing shadow MMU code already supports nested TDP. To use it, we need to set up a new MMU context for nested EPT, and create a few callbacks for it (nested_ept_*()). We then need to switch back and forth between this nested context and the

Re: [PATCH 02/10] nEPT: MMU context for nested EPT

2011-11-10 Thread Nadav Har'El
On Thu, Nov 10, 2011, Avi Kivity wrote about Re: [PATCH 02/10] nEPT: MMU context for nested EPT: +static int nested_ept_init_mmu_context(struct kvm_vcpu *vcpu) +{ + int r = kvm_init_shadow_mmu(vcpu, vcpu-arch.mmu); ... + vcpu-arch.walk_mmu = vcpu-arch.nested_mmu

Re: [PATCH 02/10] nEPT: MMU context for nested EPT

2011-11-10 Thread Avi Kivity
On 11/10/2011 04:40 PM, Nadav Har'El wrote: On Thu, Nov 10, 2011, Avi Kivity wrote about Re: [PATCH 02/10] nEPT: MMU context for nested EPT: +static int nested_ept_init_mmu_context(struct kvm_vcpu *vcpu) +{ + int r = kvm_init_shadow_mmu(vcpu, vcpu-arch.mmu); ... + vcpu

Re: [PATCH 02/10] nEPT: MMU context for nested EPT

2011-11-10 Thread Nadav Har'El
On Thu, Nov 10, 2011, Avi Kivity wrote about Re: [PATCH 02/10] nEPT: MMU context for nested EPT: This is all correct, but the code in question parses the EPT12 table using the ia32 page table format. They're sufficiently similar so that it works, but it isn't correct. Bit 0: EPT readable