Nested Virtualization: p2m infrastructure
PATCH 13/14 Nested Virtualization: p2m infrastructure
Signature · 6 lines
---to satisfy European Law for business letters: Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach b. Muenchen Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
# HG changeset patch
# User cegger
# Date 1281004724 -7200
Change p2m infrastructure to operate on per-p2m instead of per-domain. This allows us to use multiple p2m tables per-domain.
xen/arch/x86/debug.c +1 -1
@@ -61,7 +61,7 @@ dbg_hvm_va2mfn(dbgva_t vaddr, struct domreturn INVALID_MFN ; } - mfn =mfn_x (gfn_to_mfn (dp, gfn, &gfntype)); + mfn =mfn_x (gfn_to_mfn (p2m_get_hostp2m (dp), gfn, &gfntype));if (p2m_is_readonly (gfntype) && toaddr ) {DBGP2 ("kdb:p2m_is_readonly: gfntype:%x\n" , gfntype);
xen/arch/x86/domain.c +1 -1
@@ -151,7 +151,7 @@ void dump_pageframe_info(struct domain *if (is_hvm_domain (d) ) { -p2m_pod_dump_data (d); +p2m_pod_dump_data (p2m_get_hostp2m (d)); }spin_lock (&d->page_alloc_lock);
xen/arch/x86/domctl.c +2 -2
@@ -982,7 +982,7 @@ long arch_do_domctl( ret =iomem_permit_access (d, mfn, mfn + nr_mfns -1 );for ( i =0 ; i < nr_mfns; i++ ) -set_mmio_p2m_entry (d, gfn+i,_mfn (mfn+i)); +set_mmio_p2m_entry (p2m_get_hostp2m (d), gfn+i,_mfn (mfn+i)); }else {
@@ -991,7 +991,7 @@ long arch_do_domctl( gfn, mfn, nr_mfns);for ( i =0 ; i < nr_mfns; i++ ) -clear_mmio_p2m_entry (d, gfn+i); +clear_mmio_p2m_entry (p2m_get_hostp2m (d), gfn+i); ret =iomem_deny_access (d, mfn, mfn + nr_mfns -1 ); }
xen/arch/x86/hvm/emulate.c +6 -4
@@ -55,6 +55,7 @@ int hvmemul_do_io(paddr_t value = ram_gpa;int value_is_ptr = (p_data ==NULL );struct vcpu *curr = current; +struct p2m_domain *p2m =p2m_get_hostp2m (curr->domain);ioreq_t *p =get_ioreq (curr);unsigned long ram_gfn =paddr_to_pfn (ram_gpa);p2m_type_t p2mt;
@@ -62,10 +63,10 @@ int hvmemul_do_io(int rc;/* Check for paged out page */ - ram_mfn =gfn_to_mfn_unshare (current->domain, ram_gfn, &p2mt,0 ); + ram_mfn =gfn_to_mfn_unshare (p2m, ram_gfn, &p2mt,0 );if (p2m_is_paging (p2mt) ) { -p2m_mem_paging_populate (curr->domain, ram_gfn); +p2m_mem_paging_populate (p2m, ram_gfn);return X86EMUL_RETRY ; }if (p2m_is_shared (p2mt) )
@@ -638,6 +639,7 @@ static int hvmemul_rep_movs(unsigned long saddr, daddr, bytes;paddr_t sgpa, dgpa;uint32_t pfec = PFEC_page_present; +struct p2m_domain *p2m =p2m_get_hostp2m (current->domain);p2m_type_t p2mt;int rc, df = !!(ctxt->regs->eflags &X86_EFLAGS_DF );char *buf;
@@ -668,12 +670,12 @@ static int hvmemul_rep_movs(if ( rc !=X86EMUL_OKAY )return rc; - (void )gfn_to_mfn_current (sgpa >>PAGE_SHIFT , &p2mt); + (void )gfn_to_mfn (p2m, sgpa >>PAGE_SHIFT , &p2mt);if ( !p2m_is_ram (p2mt) && !p2m_is_grant (p2mt) )return hvmemul_do_mmio ( sgpa, reps, bytes_per_rep, dgpa,IOREQ_READ , df,NULL ); - (void )gfn_to_mfn_current (dgpa >>PAGE_SHIFT , &p2mt); + (void )gfn_to_mfn (p2m, dgpa >>PAGE_SHIFT , &p2mt);if ( !p2m_is_ram (p2mt) && !p2m_is_grant (p2mt) )return hvmemul_do_mmio ( dgpa, reps, bytes_per_rep, sgpa,IOREQ_WRITE , df,NULL );
xen/arch/x86/hvm/hvm.c +31 -19
175 lines not on this page · raw message
xen/arch/x86/hvm/mtrr.c +1 -1
@@ -399,7 +399,7 @@ uint32_t get_pat_flags(struct vcpu *v, {struct domain *d = v->domain;p2m_type_t p2mt; -gfn_to_mfn (d,paddr_to_pfn (gpaddr), &p2mt); +gfn_to_mfn (p2m_get_hostp2m (d),paddr_to_pfn (gpaddr), &p2mt);if (p2m_is_ram (p2mt))gdprintk (XENLOG_WARNING , "Conflict occurs for a given guest l1e flags:%x "
xen/arch/x86/hvm/stdvga.c +3 -2
@@ -469,6 +469,7 @@ static int mmio_move(struct hvm_hw_stdvgint i;int sign = p->df ?-1 :1 ;p2m_type_t p2mt; +struct p2m_domain *p2m =p2m_get_hostp2m (current->domain);if ( p->data_is_ptr ) {
@@ -481,7 +482,7 @@ static int mmio_move(struct hvm_hw_stdvgif (hvm_copy_to_guest_phys (data, &tmp, p->size) != HVMCOPY_okay ) { - (void )gfn_to_mfn_current (data >>PAGE_SHIFT , &p2mt); + (void )gfn_to_mfn (p2m, data >>PAGE_SHIFT , &p2mt);/* * The only case we handle is vga_mem <-> vga_mem. * Anything else disables caching and leaves it to qemu-dm.
@@ -503,7 +504,7 @@ static int mmio_move(struct hvm_hw_stdvgif (hvm_copy_from_guest_phys (&tmp, data, p->size) != HVMCOPY_okay ) { - (void )gfn_to_mfn_current (data >>PAGE_SHIFT , &p2mt); + (void )gfn_to_mfn (p2m, data >>PAGE_SHIFT , &p2mt);if ( (p2mt != p2m_mmio_dm) || (data <VGA_MEM_BASE ) || ((data + p->size) > (VGA_MEM_BASE +VGA_MEM_SIZE )) )return 0 ;
xen/arch/x86/hvm/svm/svm.c +6 -3
@@ -272,7 +272,7 @@ static int svm_vmcb_restore(struct vcpu {if ( c->cr0 &X86_CR0_PG ) { - mfn =mfn_x (gfn_to_mfn (v->domain, c->cr3 >>PAGE_SHIFT , &p2mt)); + mfn =mfn_x (gfn_to_mfn (p2m, c->cr3 >>PAGE_SHIFT , &p2mt));if ( !p2m_is_ram (p2mt) || !get_page (mfn_to_page (mfn), v->domain) ) { gdprintk(XENLOG_ERR, "Invalid CR3 value=0x%"PRIx64"\n",
@@ -1971,6 +1971,9 @@ static void svm_do_nested_pgfault(paddr_unsigned long gfn = gpa >>PAGE_SHIFT ;mfn_t mfn;p2m_type_t p2mt; +struct p2m_domain *p2m; + + p2m =p2m_get_hostp2m (current->domain);if ( tb_init_done ) {
@@ -1983,7 +1986,7 @@ static void svm_do_nested_pgfault(paddr_ _d.gpa = gpa; _d.qualification =0 ; - _d.mfn =mfn_x (gfn_to_mfn_query (current->domain, gfn, &_d.p2mt)); + _d.mfn =mfn_x (gfn_to_mfn_query (p2m, gfn, &_d.p2mt));__trace_var (TRC_HVM_NPF ,0 ,sizeof (_d), (unsigned char *)&_d); }
@@ -1992,7 +1995,7 @@ static void svm_do_nested_pgfault(paddr_return ;/* Everything else is an error. */ - mfn =gfn_to_mfn_type_current (gfn, &p2mt, p2m_guest); + mfn =gfn_to_mfn_guest (p2m, gfn, &p2mt);gdprintk (XENLOG_ERR ,"SVM violation gpa %#" PRIpaddr", mfn %#lx, type %i\n" , gpa,mfn_x (mfn), p2mt);domain_crash (current->domain);
xen/arch/x86/hvm/vmx/vmx.c +11 -7
@@ -486,7 +486,8 @@ static int vmx_restore_cr0_cr3( {if ( cr0 &X86_CR0_PG ) { - mfn =mfn_x (gfn_to_mfn (v->domain, cr3 >>PAGE_SHIFT , &p2mt)); + mfn =mfn_x (gfn_to_mfn (p2m_get_hostp2m (v->domain), + cr3 >>PAGE_SHIFT , &p2mt));if ( !p2m_is_ram (p2mt) || !get_page (mfn_to_page (mfn), v->domain) ) {gdprintk (XENLOG_ERR ,"Invalid CR3 value=0x%lx\n" , cr3);
@@ -1002,7 +1003,8 @@ static void vmx_load_pdptrs(struct vcpuif ( cr3 &0x1fUL ) goto crash; - mfn =mfn_x (gfn_to_mfn (v->domain, cr3 >>PAGE_SHIFT , &p2mt)); + mfn =mfn_x (gfn_to_mfn (p2m_get_hostp2m (v->domain), + cr3 >>PAGE_SHIFT , &p2mt));if ( !p2m_is_ram (p2mt) ) goto crash;
@@ -1221,7 +1223,7 @@ void ept_sync_domain(struct domain *d)return ;ASSERT (local_irq_is_enabled ()); -ASSERT (p2m_locked_by_me (d->arch.p2m)); +ASSERT (p2m_locked_by_me (p2m_get_hostp2m (d)));/* * Flush active cpus synchronously. Flush others the next time this domain
@@ -1340,7 +1342,7 @@ static void vmx_set_uc_mode(struct vcpu {if (paging_mode_hap (v->domain) )ept_change_entry_emt_with_range ( - v->domain,0 , v->domain->arch.p2m->max_mapped_pfn); + v->domain,0 ,p2m_get_hostp2m (v->domain)->max_mapped_pfn);hvm_asid_flush_vcpu (v); }
@@ -1893,7 +1895,8 @@ static int vmx_alloc_vlapic_mapping(strureturn -ENOMEM ;share_xen_page_with_guest (virt_to_page (apic_va), d, XENSHARE_writable);set_mmio_p2m_entry ( - d,paddr_to_pfn (APIC_DEFAULT_PHYS_BASE ),_mfn (virt_to_mfn (apic_va))); +p2m_get_hostp2m (d),paddr_to_pfn (APIC_DEFAULT_PHYS_BASE ), +_mfn (virt_to_mfn (apic_va))); d->arch.hvm_domain.vmx.apic_access_mfn =virt_to_mfn (apic_va);return 0 ;
@@ -2098,6 +2101,7 @@ static void ept_handle_violation(unsigneunsigned long gla, gfn = gpa >>PAGE_SHIFT ;mfn_t mfn;p2m_type_t p2mt; +struct p2m_domain *p2m =p2m_get_hostp2m (current->domain);if ( tb_init_done ) {
@@ -2110,7 +2114,7 @@ static void ept_handle_violation(unsigne _d.gpa = gpa; _d.qualification = qualification; - _d.mfn =mfn_x (gfn_to_mfn_query (current->domain, gfn, &_d.p2mt)); + _d.mfn =mfn_x (gfn_to_mfn_query (p2m, gfn, &_d.p2mt));__trace_var (TRC_HVM_NPF ,0 ,sizeof (_d), (unsigned char *)&_d); }
@@ -2120,7 +2124,7 @@ static void ept_handle_violation(unsignereturn ;/* Everything else is an error. */ - mfn =gfn_to_mfn_type_current (gfn, &p2mt, p2m_guest); + mfn =gfn_to_mfn_guest (p2m, gfn, &p2mt); gdprintk(XENLOG_ERR, "EPT violation %#lx (%c%c%c/%c%c%c), " "gpa %#"PRIpaddr", mfn %#lx, type %i.\n", qualification,
xen/arch/x86/mm.c +32 -25
170 lines not on this page · raw message
xen/arch/x86/mm/guest_walk.c +8 -7
@@ -86,17 +86,17 @@ static uint32_t set_ad_bits(void *guest_return 0 ; } -static inline void *map_domain_gfn (struct domain *d, +static inline void *map_domain_gfn (struct p2m_domain *p2m,gfn_t gfn,mfn_t *mfn,p2m_type_t *p2mt,uint32_t *rc) {/* Translate the gfn, unsharing if shared */ - *mfn =gfn_to_mfn_unshare (d,gfn_x (gfn), p2mt,0 ); + *mfn =gfn_to_mfn_unshare (p2m,gfn_x (gfn), p2mt,0 );if (p2m_is_paging (*p2mt) ) { -p2m_mem_paging_populate (d,gfn_x (gfn)); +p2m_mem_paging_populate (p2m,gfn_x (gfn)); *rc = _PAGE_PAGED;return NULL ;
@@ -119,7 +119,8 @@ static inline void *map_domain_gfn(struc/* Walk the guest pagetables, after the manner of a hardware walker. */ uint32_t -guest_walk_tables (struct vcpu *v,unsigned long va,walk_t *gw, +guest_walk_tables (struct vcpu *v,struct p2m_domain *p2m, +unsigned long va,walk_t *gw,uint32_t pfec,mfn_t top_mfn,void *top_map) {struct domain *d = v->domain;
@@ -154,7 +155,7 @@ guest_walk_tables(struct vcpu *v, unsignif ( rc & _PAGE_PRESENT ) goto out;/* Map the l3 table */ - l3p = map_domain_gfn(d, + l3p = map_domain_gfn(p2m, guest_l4e_get_gfn(gw->l4e), &gw->l3mfn, &p2mt,
@@ -181,7 +182,7 @@ guest_walk_tables(struct vcpu *v, unsign#endif /* PAE or 64... */ /* Map the l2 table */ - l2p = map_domain_gfn(d, + l2p = map_domain_gfn(p2m, guest_l3e_get_gfn(gw->l3e), &gw->l2mfn, &p2mt,
@@ -237,7 +238,7 @@ guest_walk_tables(struct vcpu *v, unsignelse {/* Not a superpage: carry on and find the l1e. */ - l1p = map_domain_gfn(d, + l1p = map_domain_gfn(p2m, guest_l2e_get_gfn(gw->l2e), &gw->l1mfn, &p2mt,
xen/arch/x86/mm/hap/guest_walk.c +6 -6
@@ -43,13 +43,14 @@ unsigned long hap_gva_to_gfn(GUEST_PAGINvoid *top_map;p2m_type_t p2mt;walk_t gw; +struct p2m_domain *p2m =p2m_get_hostp2m (v->domain);/* Get the top-level table's MFN */ cr3 = v->arch.hvm_vcpu.guest_cr[3 ]; - top_mfn =gfn_to_mfn_unshare (v->domain, cr3 >>PAGE_SHIFT , &p2mt,0 ); + top_mfn =gfn_to_mfn_unshare (p2m, cr3 >>PAGE_SHIFT , &p2mt,0 );if (p2m_is_paging (p2mt) ) { -p2m_mem_paging_populate (v->domain, cr3 >>PAGE_SHIFT ); +p2m_mem_paging_populate (p2m, cr3 >>PAGE_SHIFT ); pfec[0 ] = PFEC_page_paged;return INVALID_GFN ;
@@ -71,17 +72,17 @@ unsigned long hap_gva_to_gfn(GUEST_PAGIN#if GUEST_PAGING_LEVELS ==3 top_map += (cr3 & ~(PAGE_MASK |31 ));#endif - missing =guest_walk_tables (v, gva, &gw, pfec[0 ], top_mfn, top_map); + missing =guest_walk_tables (v, p2m, gva, &gw, pfec[0 ], top_mfn, top_map);unmap_domain_page (top_map);/* Interpret the answer */ if ( missing ==0 ) {gfn_t gfn =guest_l1e_get_gfn (gw.l1e); -gfn_to_mfn_unshare (v->domain,gfn_x (gfn), &p2mt,0 ); +gfn_to_mfn_unshare (p2m,gfn_x (gfn), &p2mt,0 );if (p2m_is_paging (p2mt) ) { -p2m_mem_paging_populate (v->domain,gfn_x (gfn)); +p2m_mem_paging_populate (p2m,gfn_x (gfn)); pfec[0 ] = PFEC_page_paged;return INVALID_GFN ;
@@ -130,4 +131,3 @@ unsigned long hap_gva_to_gfn(GUEST_PAGIN* indent-tabs-mode: nil * End: */ -
xen/arch/x86/mm/hap/hap.c +21 -14
@@ -40,6 +40,7 @@#include <asm/p2m.h> #include <asm/domain.h> #include <xen/numa.h> +#include <asm/hvm/nestedhvm.h> #include "private.h"
@@ -70,7 +71,7 @@ static int hap_enable_vram_tracking(stru/* set l1e entries of P2M table to be read-only. */ for (i = dirty_vram->begin_pfn; i < dirty_vram->end_pfn; i++) -p2m_change_type (d, i, p2m_ram_rw, p2m_ram_logdirty); +p2m_change_type (p2m_get_hostp2m (d), i, p2m_ram_rw, p2m_ram_logdirty);flush_tlb_mask (&d->domain_dirty_cpumask);return 0 ;
@@ -90,7 +91,7 @@ static int hap_disable_vram_tracking(str/* set l1e entries of P2M table with normal mode */ for (i = dirty_vram->begin_pfn; i < dirty_vram->end_pfn; i++) -p2m_change_type (d, i, p2m_ram_logdirty, p2m_ram_rw); +p2m_change_type (p2m_get_hostp2m (d), i, p2m_ram_logdirty, p2m_ram_rw);flush_tlb_mask (&d->domain_dirty_cpumask);return 0 ;
@@ -106,7 +107,7 @@ static void hap_clean_vram_tracking(stru/* set l1e entries of P2M table to be read-only. */ for (i = dirty_vram->begin_pfn; i < dirty_vram->end_pfn; i++) -p2m_change_type (d, i, p2m_ram_rw, p2m_ram_logdirty); +p2m_change_type (p2m_get_hostp2m (d), i, p2m_ram_rw, p2m_ram_logdirty);flush_tlb_mask (&d->domain_dirty_cpumask); }
@@ -200,7 +201,8 @@ static int hap_enable_log_dirty(struct dhap_unlock (d);/* set l1e entries of P2M table to be read-only. */ -p2m_change_entry_type_global (d, p2m_ram_rw, p2m_ram_logdirty); +p2m_change_entry_type_global (p2m_get_hostp2m (d), + p2m_ram_rw, p2m_ram_logdirty);flush_tlb_mask (&d->domain_dirty_cpumask);return 0 ; }
@@ -212,14 +214,16 @@ static int hap_disable_log_dirty(structhap_unlock (d);/* set l1e entries of P2M table with normal mode */ -p2m_change_entry_type_global (d, p2m_ram_logdirty, p2m_ram_rw); +p2m_change_entry_type_global (p2m_get_hostp2m (d), + p2m_ram_logdirty, p2m_ram_rw);return 0 ; }static void hap_clean_dirty_bitmap (struct domain *d) {/* set l1e entries of P2M table to be read-only. */ -p2m_change_entry_type_global (d, p2m_ram_rw, p2m_ram_logdirty); +p2m_change_entry_type_global (p2m_get_hostp2m (d), + p2m_ram_rw, p2m_ram_logdirty);flush_tlb_mask (&d->domain_dirty_cpumask); }
@@ -273,8 +277,9 @@ static void hap_free(struct domain *d, mpage_list_add_tail (pg, &d->arch.paging.hap.freelist); } -static struct page_info *hap_alloc_p2m_page (struct domain *d) +static struct page_info *hap_alloc_p2m_page (struct p2m_domain *p2m) { +struct domain *d = p2m->domain;struct page_info *pg;hap_lock (d);
@@ -312,8 +317,9 @@ static struct page_info *hap_alloc_p2m_preturn pg; } -static void hap_free_p2m_page (struct domain *d,struct page_info *pg) +static void hap_free_p2m_page (struct p2m_domain *p2m,struct page_info *pg) { +struct domain *d = p2m->domain;hap_lock (d);ASSERT (page_get_owner (pg) == d);/* Should have just the one ref we gave it in alloc_p2m_page() */
@@ -594,7 +600,8 @@ int hap_enable(struct domain *d, u32 mod/* allocate P2m table */ if ( mode & PG_translate ) { - rv =p2m_alloc_table (d, hap_alloc_p2m_page, hap_free_p2m_page); + rv =p2m_alloc_table (p2m_get_hostp2m (d), + hap_alloc_p2m_page, hap_free_p2m_page);if ( rv !=0 ) goto out; }
@@ -611,7 +618,7 @@ void hap_final_teardown(struct domain *dif ( d->arch.paging.hap.total_pages !=0 )hap_teardown (d); -p2m_teardown (d); +p2m_teardown (p2m_get_hostp2m (d));ASSERT (d->arch.paging.hap.p2m_pages ==0 ); }
@@ -711,9 +718,11 @@ void hap_vcpu_init(struct vcpu *v)static int hap_page_fault (struct vcpu *v,unsigned long va,struct cpu_user_regs *regs) { +struct domain *d = v->domain; +HAP_ERROR ("Intercepted a guest #PF (%u:%u) with HAP enabled.\n" , - v->domain->domain_id, v->vcpu_id); -domain_crash (v->domain); + d->domain_id, v->vcpu_id); +domain_crash (d);return 0 ; }
@@ -882,5 +891,3 @@ static const struct paging_mode hap_pagi* indent-tabs-mode: nil * End: */ - -
xen/arch/x86/mm/hap/p2m-ept.c +70 -60
408 lines not on this page · raw message
xen/arch/x86/mm/mem_event.c +2 -2
@@ -235,7 +235,7 @@ int mem_event_domctl(struct domain *d, x/* Get MFN of ring page */ guest_get_eff_l1e (v, ring_addr, &l1e); gfn =l1e_get_pfn (l1e); - ring_mfn =gfn_to_mfn (dom_mem_event, gfn, &p2mt); + ring_mfn =gfn_to_mfn (p2m_get_hostp2m (dom_mem_event), gfn, &p2mt); rc = -EINVAL ;if (unlikely (!mfn_valid (mfn_x (ring_mfn))) )
@@ -244,7 +244,7 @@ int mem_event_domctl(struct domain *d, x/* Get MFN of shared page */ guest_get_eff_l1e (v, shared_addr, &l1e); gfn =l1e_get_pfn (l1e); - shared_mfn =gfn_to_mfn (dom_mem_event, gfn, &p2mt); + shared_mfn =gfn_to_mfn (p2m_get_hostp2m (dom_mem_event), gfn, &p2mt); rc = -EINVAL ;if (unlikely (!mfn_valid (mfn_x (shared_mfn))) )
xen/arch/x86/mm/mem_paging.c +5 -4
@@ -29,33 +29,34 @@ int mem_paging_domctl(struct domain *d, XEN_GUEST_HANDLE(void) u_domctl) {int rc; +struct p2m_domain *p2m =p2m_get_hostp2m (d);switch ( mec->op ) {case XEN_DOMCTL_MEM_EVENT_OP_PAGING_NOMINATE : {unsigned long gfn = mec->gfn; - rc =p2m_mem_paging_nominate (d, gfn); + rc =p2m_mem_paging_nominate (p2m, gfn); }break ;case XEN_DOMCTL_MEM_EVENT_OP_PAGING_EVICT : {unsigned long gfn = mec->gfn; - rc =p2m_mem_paging_evict (d, gfn); + rc =p2m_mem_paging_evict (p2m, gfn); }break ;case XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP : {unsigned long gfn = mec->gfn; - rc =p2m_mem_paging_prep (d, gfn); + rc =p2m_mem_paging_prep (p2m, gfn); }break ;case XEN_DOMCTL_MEM_EVENT_OP_PAGING_RESUME : { -p2m_mem_paging_resume (d); +p2m_mem_paging_resume (p2m); rc =0 ; }break ;
xen/arch/x86/mm/mem_sharing.c +17 -12
@@ -251,6 +251,7 @@ static void mem_sharing_audit(void)list_for_each (le, &e->gfns) {struct domain *d; +struct p2m_domain *p2m;p2m_type_t t;mfn_t mfn;
@@ -262,7 +263,8 @@ static void mem_sharing_audit(void) g->domain, g->gfn, mfn_x(e->mfn));continue ; } - mfn =gfn_to_mfn (d, g->gfn, &t); + p2m =p2m_get_hostp2m (d); + mfn =gfn_to_mfn (p2m, g->gfn, &t);if (mfn_x (mfn) !=mfn_x (e->mfn)) MEM_SHARING_DEBUG("Incorrect P2M for d=%d, PFN=%lx." "Expecting MFN=%ld, got %ld\n",
@@ -377,7 +379,7 @@ int mem_sharing_debug_gfn(struct domainmfn_t mfn;struct page_info *page; - mfn =gfn_to_mfn (d, gfn, &p2mt); + mfn =gfn_to_mfn (p2m_get_hostp2m (d), gfn, &p2mt); page =mfn_to_page (mfn); printk("Debug for domain=%d, gfn=%lx, ",
@@ -487,7 +489,7 @@ int mem_sharing_debug_gref(struct domainreturn mem_sharing_debug_gfn (d, gfn); } -int mem_sharing_nominate_page (struct domain *d, +int mem_sharing_nominate_page (struct p2m_domain *p2m,unsigned long gfn,int expected_refcnt,shr_handle_t *phandle)
@@ -499,10 +501,11 @@ int mem_sharing_nominate_page(struct domshr_handle_t handle;shr_hash_entry_t *hash_entry;struct gfn_info *gfn_info; +struct domain *d = p2m->domain; *phandle =0UL ; - mfn =gfn_to_mfn (d, gfn, &p2mt); + mfn =gfn_to_mfn (p2m, gfn, &p2mt);/* Check if mfn is valid */ ret = -EINVAL ;
@@ -536,7 +539,7 @@ int mem_sharing_nominate_page(struct dom }/* Change the p2m type */ -if (p2m_change_type (d, gfn, p2mt, p2m_ram_shared) != p2mt) +if (p2m_change_type (p2m, gfn, p2mt, p2m_ram_shared) != p2mt) {/* This is unlikely, as the type must have changed since we've checked * it a few lines above.
@@ -599,7 +602,7 @@ int mem_sharing_share_pages(shr_handle_tlist_del (&gfn->list); d =get_domain_by_id (gfn->domain);BUG_ON (!d); -BUG_ON (set_shared_p2m_entry (d, gfn->gfn, se->mfn) ==0 ); +BUG_ON (set_shared_p2m_entry (p2m_get_hostp2m (d), gfn->gfn, se->mfn) ==0 );put_domain (d);list_add (&gfn->list, &se->gfns);put_page_and_type (cpage);
@@ -618,7 +621,7 @@ err_out:return ret; } -int mem_sharing_unshare_page (struct domain *d, +int mem_sharing_unshare_page (struct p2m_domain *p2m,unsigned long gfn,uint16_t flags) {
@@ -631,8 +634,9 @@ int mem_sharing_unshare_page(struct domastruct gfn_info *gfn_info =NULL ;shr_handle_t handle;struct list_head *le; +struct domain *d = p2m->domain; - mfn =gfn_to_mfn (d, gfn, &p2mt); + mfn =gfn_to_mfn (p2m, gfn, &p2mt); page =mfn_to_page (mfn); handle = page->shr_handle;
@@ -696,7 +700,7 @@ gfn_found:unmap_domain_page (s);unmap_domain_page (t); -ASSERT (set_shared_p2m_entry (d, gfn,page_to_mfn (page)) !=0 ); +ASSERT (set_shared_p2m_entry (p2m, gfn,page_to_mfn (page)) !=0 );put_page_and_type (old_page); private_page_found:
@@ -708,7 +712,7 @@ private_page_found:atomic_dec (&nr_saved_mfns);shr_unlock (); -if (p2m_change_type (d, gfn, p2m_ram_shared, p2m_ram_rw) != +if (p2m_change_type (p2m, gfn, p2m_ram_shared, p2m_ram_rw) != p2m_ram_shared) {printk ("Could not change p2m type.\n" );
@@ -740,7 +744,7 @@ int mem_sharing_domctl(struct domain *d,shr_handle_t handle;if (!mem_sharing_enabled (d))return -EINVAL ; - rc =mem_sharing_nominate_page (d, gfn,0 , &handle); + rc =mem_sharing_nominate_page (p2m_get_hostp2m (d), gfn,0 , &handle); mec->u.nominate.handle = handle;mem_sharing_audit (); }
@@ -756,7 +760,8 @@ int mem_sharing_domctl(struct domain *d,return -EINVAL ;if (mem_sharing_gref_to_gfn (d, gref, &gfn) <0 )return -EINVAL ; - rc =mem_sharing_nominate_page (d, gfn,3 , &handle); + rc =mem_sharing_nominate_page (p2m_get_hostp2m (d), + gfn,3 , &handle); mec->u.nominate.handle = handle;mem_sharing_audit (); }
xen/arch/x86/mm/p2m.c +351 -341
1,674 lines not on this page · raw message
xen/arch/x86/mm/shadow/multi.c +28 -21
49 lines not on this page · raw message
xen/include/asm-x86/p2m.h +67 -53
120 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Part of the diff is not shown here. View the raw message.
Quoted 2 lines · Christoph Egger
Signed-off-by Christoph Egger <[email protected]>
Signature · 3 lines
Tim Deegan <[email protected]> Principal Software Engineer, XenServer Engineering Citrix Systems UK Ltd. (Company #02937203, SL9 0BG)
Quoted 4 lines · On Monday 09 August 2010 14:58:07 Tim Deegan wrote:
Quoted 1 line · Christoph Egger
Signed-off-by Christoph Egger <[email protected]>Acked-by Tim Deegan <[email protected]>
Thank you very much.
Christoph
Signature · 6 lines
---to satisfy European Law for business letters: Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach b. Muenchen Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
Hi chris
We find this patch will cause SR-IOV fail. Guest will vf assigned cannot get ip and show " do_IRQ: 0.177 No irq handler for vector (irq -1)" in xm dmesg. Can you take a look at this patch and help to fixed the regression? Thanks :)
best regards
yang
Quoted 17 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Christoph Egger
Sent: Thursday, August 05, 2010 11:05 PM
To: [email protected]
Subject: [Xen-devel] [PATCH 13/14] Nested Virtualization: p2m infrastructureSigned-off-by Christoph Egger <[email protected]>--
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
Hi Yang,
we are about trying to reproduce this problem and will keep you up-to-date on our findings.
Can you also give us more detailed information, i.e. does this happen with hap only or also with shadow paging ?
The changeset
http://xenbits.xensource.com/staging/xen-unstable.hg/rev/e7afe98afd43
touches generic p2m code. The EPT code definitely needs an update in respect to get EPT-on-EPT with nested virtualization.
Until further analysis is done, I can not say, there is no bug in the p2m changes and I can say as well that you might need Eddies EPT update patch as this may contain the fix you need.
Christoph
Quoted 27 lines · Yang Z
Hi chris
We find this patch will cause SR-IOV fail. Guest will vf assigned cannot get ip and show "do_IRQ: 0.177 No irq handler for vector (irq -1)" in xm dmesg. Can you take a look at this patch and help to fixed the regression? Thanks :)best regards
yangQuoted 18 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Christoph Egger Sent: Thursday, August 05, 2010 11:05 PM
To: [email protected]
Subject: [Xen-devel] [PATCH 13/14] Nested Virtualization: p2m infrastructureSigned-off-by Christoph Egger <[email protected]>--
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
Signature · 6 lines
---to satisfy European Law for business letters: Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach b. Muenchen Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632