2010-04-05 02:19:39

by FUJITA Tomonori

[permalink] [raw]
Subject: Re: [PATCH 4/5] swiotlb: Make swiotlb bookkeeping functions visible in the header file.

On Fri, 19 Mar 2010 11:04:21 -0400
Konrad Rzeszutek Wilk <[email protected]> wrote:

> We put the init, free, and functions dealing with the operations on the
> SWIOTLB buffer at the top of the header. Also we export some of the variables
> that are used by the dma_ops functions.
>
> Signed-off-by: Konrad Rzeszutek Wilk <[email protected]>
> ---
> include/linux/swiotlb.h | 33 +++++++++++++++++++++++++++++++++
> lib/swiotlb.c | 28 ++++++++++------------------
> 2 files changed, 43 insertions(+), 18 deletions(-)
>
> diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
> index febedcf..8550d6b 100644
> --- a/include/linux/swiotlb.h
> +++ b/include/linux/swiotlb.h
> @@ -24,6 +24,39 @@ extern int swiotlb_force;
>
> extern void swiotlb_init(int verbose);
>
> +/* Internal book-keeping functions. Must be linked against the library
> + * to take advantage of them.*/
> +#ifdef CONFIG_SWIOTLB
> +/*
> + * Enumeration for sync targets
> + */
> +enum dma_sync_target {
> + SYNC_FOR_CPU = 0,
> + SYNC_FOR_DEVICE = 1,
> +};
> +extern char *swiotlb_bk_start;
> +extern char *swiotlb_bk_end;
> +extern unsigned long swiotlb_bk_nslabs;

exporting swiotlb_bk_start and swiotlb_bk_nslabs aren't enough?


> +extern void *swiotlb_bk_overflow_buffer;
> +extern unsigned long swiotlb_bk_overflow;
> +extern int is_swiotlb_buffer(phys_addr_t paddr);
> +extern void *swiotlb_bk_map_single(struct device *hwdev, phys_addr_t phys,
> + unsigned long start_dma_addr, size_t size, int dir);

enum dma_data_direction is better for 'dir'.


2010-04-07 19:23:53

by Konrad Rzeszutek Wilk

[permalink] [raw]
Subject: Re: [PATCH 4/5] swiotlb: Make swiotlb bookkeeping functions visible in the header file.

> > +extern char *swiotlb_bk_start;
> > +extern char *swiotlb_bk_end;
> > +extern unsigned long swiotlb_bk_nslabs;
>
> exporting swiotlb_bk_start and swiotlb_bk_nslabs aren't enough?

It is.
>
>
> > +extern void *swiotlb_bk_overflow_buffer;
> > +extern unsigned long swiotlb_bk_overflow;

> > +extern int is_swiotlb_buffer(phys_addr_t paddr);
> > +extern void *swiotlb_bk_map_single(struct device *hwdev, phys_addr_t phys,
> > + unsigned long start_dma_addr, size_t size, int dir);
>
> enum dma_data_direction is better for 'dir'.

Done. I had to make a bigger change that would also change other
functions usage of 'int dir' -> 'enum ..' otherwise we had compiler
warnings.