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

Re: [Xen-devel] [PATCH v6 06/14] iommu: track reserved ranges using a rangeset



>>> On 23.08.18 at 11:47, <paul.durrant@xxxxxxxxxx> wrote:
> @@ -248,12 +252,16 @@ int iommu_construct(struct domain *d)
>  
>  void iommu_domain_destroy(struct domain *d)
>  {
> -    if ( !iommu_enabled || !dom_iommu(d)->platform_ops )
> +    const struct domain_iommu *hd = dom_iommu(d);
> +
> +    if ( !iommu_enabled || !hd->platform_ops )
>          return;
>  
>      iommu_teardown(d);
>  
>      arch_iommu_domain_destroy(d);
> +
> +    rangeset_destroy(hd->reserved_ranges);

For idempotency reasons perhaps better to store NULL after
the call?

> --- a/xen/drivers/passthrough/vtd/x86/vtd.c
> +++ b/xen/drivers/passthrough/vtd/x86/vtd.c
> @@ -154,8 +154,21 @@ void __hwdom_init vtd_set_hwdom_mapping(struct domain *d)
>  
>          rc = iommu_map_page(d, _bfn(pfn), _mfn(pfn),
>                           IOMMUF_readable | IOMMUF_writable);
> +
> +        /*
> +         * The only reason a reserved page would be mapped is that
> +         * iommu_inclusive_mapping is set, in which case it needs to be
> +         * marked as reserved in the IOMMU.
> +         */
> +        if ( !rc && page_is_ram_type(pfn, RAM_TYPE_RESERVED) )
> +        {
> +            ASSERT(iommu_inclusive_mapping);
> +
> +            rc = rangeset_add_singleton(dom_iommu(d)->reserved_ranges, pfn);
> +        }

Why would this be restricted to the E820 reserved type? I think this
should cover everything that gets mapped with iommu_inclusive_mapping
set, but not mapped with the flag clear.

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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