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

Re: [Xen-devel] [PATCH v5 5/8] x86/iommu: switch the hwdom mapping function to use page_get_type



>>> On 14.08.18 at 15:43, <roger.pau@xxxxxxxxxx> wrote:
> --- a/xen/drivers/passthrough/x86/iommu.c
> +++ b/xen/drivers/passthrough/x86/iommu.c
> @@ -134,6 +134,37 @@ void arch_iommu_domain_destroy(struct domain *d)
>  {
>  }
>  
> +static bool __hwdom_init hwdom_iommu_map(const struct domain *d,
> +                                         unsigned long pfn,
> +                                         unsigned long max_pfn)
> +{
> +    /*
> +     * Set up 1:1 mapping for dom0. Default to include only conventional RAM
> +     * areas and let RMRRs include needed reserved regions. When set, the
> +     * inclusive mapping additionally maps in every pfn up to 4GB except 
> those
> +     * that fall in unusable ranges.
> +     */
> +    if ( (pfn > max_pfn && !mfn_valid(_mfn(pfn))) || xen_in_range(pfn) )
> +        return false;
> +
> +    switch ( page_get_type(pfn) )
> +    {
> +    case RAM_TYPE_UNUSABLE:
> +        return false;
> +
> +    case RAM_TYPE_CONVENTIONAL:
> +        if ( iommu_hwdom_strict )
> +            return false;
> +        break;
> +
> +    default:
> +        if ( !iommu_hwdom_inclusive || pfn > max_pfn )
> +            return false;
> +    }

Ah, in patch 8 it becomes clear why you want execution to fall out
of the switch() in the "true" case. Please disregard the respective
earlier comments then.

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®.