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

Re: [Xen-devel] [PATCH RFC 2/2] xen: arm: Enable physical address space compression (PDX) on arm64



Hi Ian,

On 07/31/2014 12:01 PM, Ian Campbell wrote:
> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
> index 446b4dc..dbd92bb 100644
> --- a/xen/arch/arm/setup.c
> +++ b/xen/arch/arm/setup.c
> @@ -423,6 +423,46 @@ static paddr_t __init get_xen_paddr(void)
>      return paddr;
>  }
>  
> +/* Sets all bits from the most-significant 1-bit down to the LSB */
> +static u64 __init fill_mask(u64 mask)
> +{
> +    while (mask & (mask + 1))

Coding style: Missing spaces

> +        mask |= mask + 1;
> +    return mask;
> +}
> +
> +static void init_pdx(void)
> +{
> +    u64 mask = fill_mask(bootinfo.mem.bank[0].start - 1);
> +    int bank;
> +
> +    for ( bank = 0 ; bank < bootinfo.mem.nr_banks; bank++ )
> +    {
> +        paddr_t bank_start = bootinfo.mem.bank[bank].start;
> +        paddr_t bank_size = bootinfo.mem.bank[bank].size;
> +        paddr_t bank_end = bank_start + bank_size;
> +
> +        set_pdx_range(paddr_to_pfn(bank_start),
> +                      paddr_to_pfn(bank_end));
> +
> +
> +        mask |= bank_start | fill_mask(bank_start ^ (bank_end - 1));
> +    }
> +
> +    for ( bank = 0 ; bank < bootinfo.mem.nr_banks; bank++ )
> +    {
> +        paddr_t bank_start = bootinfo.mem.bank[bank].start;
> +        paddr_t bank_size = bootinfo.mem.bank[bank].size;
> +        paddr_t bank_end = bank_start + bank_size;
> +
> +        if (~mask &
> +            fill_mask(bank_start ^ (bank_end - 1)))

Coding style.

I don't really understand what the function is achieving. Could you
explain a bit more?

Regards,

-- 
Julien Grall

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