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

Re: [Xen-devel] [PATCH v2 1/2] VT-d: re-phrase logic in vtd_set_hwdom_mapping() for clarity



>>> On 12.06.18 at 15:47, <paul.durrant@xxxxxxxxxx> wrote:
> --- a/xen/drivers/passthrough/vtd/x86/vtd.c
> +++ b/xen/drivers/passthrough/vtd/x86/vtd.c
> @@ -114,26 +114,29 @@ void __hwdom_init vtd_set_hwdom_mapping(struct domain 
> *d)
>  
>      BUG_ON(!is_hardware_domain(d));
>  
> -    top = max(max_pdx, pfn_to_pdx(0xffffffffUL >> PAGE_SHIFT) + 1);
> +    top = max(max_pdx, pfn_to_pdx(GB(4) >> PAGE_SHIFT));

At certain boundaries

pfn_to_pdx(x + 1) != pfn_to_pdx(x) + 1

i.e. there was a reason for the way this was phrased before.

>      for ( i = 0; i < top; i++ )
>      {
> +        unsigned long pfn = pdx_to_pfn(i);
> +        bool map;
>          int rc = 0;
>  
> +        if ( pfn >= (GB(4) >> PAGE_SHIFT) && !mfn_valid(_mfn(pfn)) )
> +            continue;

Why ahead of the comment ...

>          /*
> -         * Set up 1:1 mapping for dom0. Default to use only conventional RAM
> -         * areas and let RMRRs include needed reserved regions. When set, the
> -         * inclusive mapping maps in everything below 4GB except unusable
> -         * ranges.
> +         * 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 maps in every pfn up
> +         * to 4GB except those that fall in unusable ranges.
>           */

... explaining it, when the other parts that get explained follow after it?

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