Re: [PATCH] gurantee DMA area for alloc_bootmem_low()

From: Yasunori Goto <y-goto_at_jp.fujitsu.com>
Date: 2005-07-13 16:34:48
> On Tue, Jul 12, 2005 at 03:50:09PM +0900, Yasunori Goto wrote:
> > Index: allocbootmem/mm/bootmem.c
> > ===================================================================
> > --- allocbootmem.orig/mm/bootmem.c	2005-06-30 11:57:13.000000000 +0900
> > +++ allocbootmem/mm/bootmem.c	2005-07-08 20:46:56.209040741 +0900
> > @@ -387,10 +387,16 @@
> >  	pg_data_t *pgdat = pgdat_list;
> >  	void *ptr;
> >  
> > -	for_each_pgdat(pgdat)
> > +	for_each_pgdat(pgdat){
> > +
> > +		if (goal < __pa(MAX_DMA_ADDRESS) &&
> > +		    pgdat->bdata->node_boot_start >= __pa(MAX_DMA_ADDRESS))
> > +			continue; /* Skip No DMA node */
> > +
> >  		if ((ptr = __alloc_bootmem_core(pgdat->bdata, size,
> >  						align, goal)))
> >  			return(ptr);
> > +	}
> >  
> >  	/*
> >  	 * Whoops, we cannot satisfy the allocation request.
> 
> Need to be careful about the use of MAX_DMA_ADDRESS.  It is not always
> the case that archs define MAX_DMA_ADDRESS as a real address.  In some
> cases, MAX_DMA_ADDRESS is defined as something like -1 to indicate that
> all addresses are available for DMA.  I'm not sure that the above code
> will always work as desired in such cases.

Hmm... Thanks for your advise.

If MAX_DMA_ADDRESS is like -1, then all of memory can be DMA'ble, 
right?  How is like this? One more comparison is added.

	if (MAX_DMA_ADDRESS != ~0UL  &&
		goal < __pa(MAX_DMA_ADDRESS) &&
		pgdat->bdata->node_boot_start >= 
		__pa(MAX_DMA_ADDRESS))

Thanks.

-- 
Yasunori Goto 

-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Jul 13 02:38:06 2005

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:40 EST