ia64/xen-unstable

changeset 15945:a93ebecda83b

[HVM] iommu p2m ops: check guest is translated, and maintain m2p consistency
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Thu Sep 20 10:54:52 2007 +0100 (2007-09-20)
parents c2d651811741
children 01c329f425a8
files xen/arch/x86/mm/p2m.c
line diff
     1.1 --- a/xen/arch/x86/mm/p2m.c	Thu Sep 20 10:31:49 2007 +0100
     1.2 +++ b/xen/arch/x86/mm/p2m.c	Thu Sep 20 10:54:52 2007 +0100
     1.3 @@ -873,6 +873,18 @@ int
     1.4  set_mmio_p2m_entry(struct domain *d, unsigned long gfn, mfn_t mfn)
     1.5  {
     1.6      int rc = 0;
     1.7 +    p2m_type_t ot;
     1.8 +    mfn_t omfn;
     1.9 +
    1.10 +    if ( !paging_mode_translate(d) )
    1.11 +        return 0;
    1.12 +
    1.13 +    omfn = gfn_to_mfn(d, gfn, &ot);
    1.14 +    if ( p2m_is_ram(ot) )
    1.15 +    {
    1.16 +        ASSERT(mfn_valid(omfn));
    1.17 +        set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY);
    1.18 +    }
    1.19  
    1.20      rc = set_p2m_entry(d, gfn, mfn, p2m_mmio_direct);
    1.21      if ( 0 == rc )
    1.22 @@ -886,8 +898,11 @@ int
    1.23  clear_mmio_p2m_entry(struct domain *d, unsigned long gfn)
    1.24  {
    1.25      int rc = 0;
    1.26 +    unsigned long mfn;
    1.27  
    1.28 -    unsigned long mfn;
    1.29 +    if ( !paging_mode_translate(d) )
    1.30 +        return 0;
    1.31 +
    1.32      mfn = gmfn_to_mfn(d, gfn);
    1.33      if ( INVALID_MFN == mfn )
    1.34      {