direct-io.hg

changeset 10227:7ae164a41569

[IA64] preparation for vga acceleration of VTI domain

This patch fixes several minor issues, as a prepare step to support VGA
acceleration for VTI domain:

- shared vram buffer needs to be mapped as WB in both sides, because
the shared vram is the true WB memory though VTI domain is told as UC
- Introduced a new pte_mem to indicate p2m entry containing valid mfn
when replace p2m entry. Pte_none doesn't work for VTI case, since IO
type is encoded into p2m entry which however doesn't contain valid mfn.

After above change, guest_physmap_add/remove_page is available to
be used by qemu to setup linear buffer for VTI domain.

Signed-off-by Kevin Tian <kevin.tian@intel.com>
author awilliam@xenbuild.aw
date Wed May 31 11:27:50 2006 -0600 (2006-05-31)
parents fca97f3ab031
children e3d2411fb486
files xen/arch/ia64/vmx/vmmu.c xen/arch/ia64/xen/domain.c xen/include/asm-ia64/linux-xen/asm/pgtable.h xen/include/asm-ia64/shadow.h
line diff
     1.1 --- a/xen/arch/ia64/vmx/vmmu.c	Tue May 30 10:32:42 2006 -0600
     1.2 +++ b/xen/arch/ia64/vmx/vmmu.c	Wed May 31 11:27:50 2006 -0600
     1.3 @@ -356,6 +356,7 @@ IA64FAULT vmx_vcpu_itc_i(VCPU *vcpu, UIN
     1.4  
     1.5  IA64FAULT vmx_vcpu_itc_d(VCPU *vcpu, UINT64 pte, UINT64 itir, UINT64 ifa)
     1.6  {
     1.7 +    u64 gpfn;
     1.8  #ifdef VTLB_DEBUG    
     1.9      int slot;
    1.10      u64 ps, va;
    1.11 @@ -368,6 +369,17 @@ IA64FAULT vmx_vcpu_itc_d(VCPU *vcpu, UIN
    1.12          return IA64_FAULT;
    1.13      }
    1.14  #endif //VTLB_DEBUG
    1.15 +    gpfn = (pte & _PAGE_PPN_MASK)>> PAGE_SHIFT;
    1.16 +    if (VMX_DOMAIN(vcpu)) {
    1.17 +        if (__gpfn_is_io(vcpu->domain, gpfn))
    1.18 +            pte |= VTLB_PTE_IO;
    1.19 +        else
    1.20 +            /* Ensure WB attribute if pte is related to a normal mem page,
    1.21 +             * which is required by vga acceleration since qemu maps shared
    1.22 +             * vram buffer with WB.
    1.23 +             */
    1.24 +            pte &= ~_PAGE_MA_MASK;
    1.25 +    }
    1.26      thash_purge_and_insert(vcpu, pte, itir, ifa);
    1.27      return IA64_NO_FAULT;
    1.28  
     2.1 --- a/xen/arch/ia64/xen/domain.c	Tue May 30 10:32:42 2006 -0600
     2.2 +++ b/xen/arch/ia64/xen/domain.c	Wed May 31 11:27:50 2006 -0600
     2.3 @@ -1181,7 +1181,7 @@ assign_domain_page_replace(struct domain
     2.4      // update pte
     2.5      npte = pfn_pte(mfn, __pgprot(__DIRTY_BITS | _PAGE_PL_2 | arflags));
     2.6      old_pte = ptep_xchg(mm, mpaddr, pte, npte);
     2.7 -    if (!pte_none(old_pte)) {
     2.8 +    if (pte_mem(old_pte)) {
     2.9          unsigned long old_mfn;
    2.10          struct page_info* old_page;
    2.11  
     3.1 --- a/xen/include/asm-ia64/linux-xen/asm/pgtable.h	Tue May 30 10:32:42 2006 -0600
     3.2 +++ b/xen/include/asm-ia64/linux-xen/asm/pgtable.h	Wed May 31 11:27:50 2006 -0600
     3.3 @@ -277,6 +277,10 @@ ia64_phys_addr_valid (unsigned long addr
     3.4  #define pte_dirty(pte)		((pte_val(pte) & _PAGE_D) != 0)
     3.5  #define pte_young(pte)		((pte_val(pte) & _PAGE_A) != 0)
     3.6  #define pte_file(pte)		((pte_val(pte) & _PAGE_FILE) != 0)
     3.7 +#ifdef XEN
     3.8 +#define pte_mem(pte) \
     3.9 +	(!(pte_val(pte) & (GPFN_IO_MASK | GPFN_INV_MASK)) && !pte_none(pte))
    3.10 +#endif
    3.11  /*
    3.12   * Note: we convert AR_RWX to AR_RX and AR_RW to AR_R by clearing the 2nd bit in the
    3.13   * access rights:
     4.1 --- a/xen/include/asm-ia64/shadow.h	Tue May 30 10:32:42 2006 -0600
     4.2 +++ b/xen/include/asm-ia64/shadow.h	Wed May 31 11:27:50 2006 -0600
     4.3 @@ -37,9 +37,11 @@
     4.4  
     4.5  #define shadow_mode_translate(d)              (1)
     4.6  
     4.7 -// for granttab transfer. XENMEM_populate_physmap
     4.8 +/*
     4.9 + * Utilities to change relationship of gpfn->mfn for designated domain,
    4.10 + * which is required by gnttab transfer, balloon, device model and etc.
    4.11 + */
    4.12  void guest_physmap_add_page(struct domain *d, unsigned long gpfn, unsigned long mfn);
    4.13 -// for balloon driver. XENMEM_decrease_reservation
    4.14  void guest_physmap_remove_page(struct domain *d, unsigned long gpfn, unsigned long mfn);
    4.15  #endif
    4.16