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

Re: [Xen-devel] [RFC PATCH v3 01/18] xen/arm: Add bitmap_find_next_zero_area helper function



Hi,

Please include all the relevant maintainers. See scripts/get_maintainers.pl.

On 22/06/15 13:01, vijay.kilari@xxxxxxxxx wrote:
> From: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>
> 
> bitmap_find_next_zero_area helper function will be used
> by physical ITS driver imported from linux
> 
> Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>
> ---
> v3: Moved changes to xen/common/bitmap.c and
>     xen/include/xen/bitmap.h
> ---
>  xen/common/bitmap.c      |   39 +++++++++++++++++++++++++++++++++++++++
>  xen/include/xen/bitmap.h |    5 +++++
>  2 files changed, 44 insertions(+)
> 
> diff --git a/xen/common/bitmap.c b/xen/common/bitmap.c
> index 61d1ea4..ba060b2 100644
> --- a/xen/common/bitmap.c
> +++ b/xen/common/bitmap.c
> @@ -489,6 +489,45 @@ int bitmap_allocate_region(unsigned long *bitmap, int 
> pos, int order)
>  }
>  EXPORT_SYMBOL(bitmap_allocate_region);
>  
> +/*
> + * bitmap_find_next_zero_area - find a contiguous aligned zero area
> + * @map: The address to base the search on
> + * @size: The bitmap size in bits
> + * @start: The bitnumber to start searching at
> + * @nr: The number of zeroed bits we're looking for
> + * @align_mask: Alignment mask for zero area
> + *
> + * The @align_mask should be one less than a power of 2; the effect is that
> + * the bit offset of all zero areas this function finds is multiples of that
> + * power of 2. A @align_mask of 0 means no alignment is required.
> + */
> +#define ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask))

This is not bitmap specific, I would move this macro in lib.h

> +unsigned long bitmap_find_next_zero_area(unsigned long *map,
> +                                         unsigned long size,
> +                                         unsigned long start,
> +                                         unsigned int nr,
> +                                         unsigned long align_mask)
> +{
> +        unsigned long index, end, i;
> +again:
> +        index = find_next_zero_bit(map, size, start);
> +
> +        /* Align allocation */
> +        index = ALIGN_MASK(index, align_mask);
> +
> +        end = index + nr;
> +        if (end > size)
> +                return end;
> +        i = find_next_bit(map, end, index);
> +        if (i < end) {
> +                start = i + 1;
> +                goto again;
> +        }
> +        return index;
> +}
> +EXPORT_SYMBOL(bitmap_find_next_zero_area);
> +

bitmap.c is using Linux coding style which include hard tabs. Please
retain them.

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