• Konrad Rzeszutek Wilk's avatar
    xen/pvh: Don't setup P2M tree. · 696fd7c5
    Konrad Rzeszutek Wilk authored
    P2M is not available for PVH. Fortunatly for us the
    P2M code already has mostly the support for auto-xlat guest thanks to
    commit 3d24bbd7
    "grant-table: call set_phys_to_machine after mapping grant refs"
    which: "
    introduces set_phys_to_machine calls for auto_translated guests
    (even on x86) in gnttab_map_refs and gnttab_unmap_refs.
    translated by swiotlb-xen... " so we don't need to muck much.
    
    with above mentioned "commit you'll get set_phys_to_machine calls
    from gnttab_map_refs and gnttab_unmap_refs but PVH guests won't do
    anything with them " (Stefano Stabellini) which is OK - we want
    them to be NOPs.
    
    This is because we assume that an "IOMMU is always present on the
    plaform and Xen is going to make the appropriate IOMMU pagetable
    changes in the hypercall implementation of GNTTABOP_map_grant_ref
    and GNTTABOP_unmap_grant_ref, then eveything should be transparent
    from PVH priviligied point of view and DMA transfers involving
    foreign pages keep working with no issues[sp]
    
    Otherwise we would need a P2M (and an M2P) for PVH priviligied to
    track these foreign pages .. (see arch/arm/xen/p2m.c)."
    (Stefano Stabellini).
    
    We still have to inhibit the building of the P2M tree.
    That had been done in the past by not calling
    xen_build_dynamic_phys_to_machine (which setups the P2M tree
    and gives us virtual address to access them). But we are missing
    a check for xen_build_mfn_list_list - which was continuing to setup
    the P2M tree and would blow up at trying to get the virtual
    address of p2m_missing (which would have been setup by
    xen_build_dynamic_phys_to_machine).
    
    Hence a check is needed to not call xen_build_mfn_list_list when
    running in auto-xlat mode.
    
    Instead of replicating the check for auto-xlat in enlighten.c
    do it in the p2m.c code. The reason is that the xen_build_mfn_list_list
    is called also in xen_arch_post_suspend without any checks for
    auto-xlat. So for PVH or PV with auto-xlat - we would needlessly
    allocate space for an P2M tree.
    Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Reviewed-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
    Acked-by: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>
    696fd7c5
p2m.c 35 KB