[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [RFC][PATCH 06/13] xen:vtd: create RMRR mapping



Hi,

At 17:21 +0800 on 10 Apr (1428686517), Tiejun Chen wrote:
> RMRR reserved regions must be setup in the pfn space with an identity
> mapping to reported mfn. However existing code has problem to setup
> correct mapping when VT-d shares EPT page table, so lead to problem
> when assigning devices (e.g GPU) with RMRR reported. This patch
> aims to setup identity mapping in p2m layer, regardless of whether EPT
> is shared or not.

This leaves the IOMMU mapping in place even if the p2m mapping
fails.

I think it would be better to keep the p2m as the
canonical mapping and make the iommu tables match the p2m.
So, this function should not call intel_iommu_map_page() itself;
rather, set_identity_p2m_entry() should call intel_iommu_map_page() if
it adds the p2m entry.

Likewise for the unmap code just above this: we should be calling a
p2m function here (guest_physmap_remove_page(), I think), which will
then call iommu_unmap_page() for us.

Cheers,

Tim.

> Signed-off-by: Tiejun Chen <tiejun.chen@xxxxxxxxx>
> ---
>  xen/drivers/passthrough/vtd/iommu.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/xen/drivers/passthrough/vtd/iommu.c 
> b/xen/drivers/passthrough/vtd/iommu.c
> index 4e789d1..f8fc6c3 100644
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -1847,6 +1847,12 @@ static int rmrr_identity_mapping(struct domain *d, 
> bool_t map,
>  
>          if ( err )
>              return err;
> +
> +        if ( !is_hardware_domain(d) )
> +        {
> +            if ( (err = set_identity_p2m_entry(d, base_pfn, p2m_access_rw)) )
> +                return err;
> +        }
>          base_pfn++;
>      }
>  
> -- 
> 1.9.1
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.