[PATCH] DMA 4GB boundary protection

Segher Boessenkool segher at kernel.crashing.org
Fri Mar 23 09:52:02 EST 2007


> I would also like it to be the last page in the range, not the first
> (since otherwise you'll reserve even if the window is less than 4GB.
>
> Something like (untested):
>
> 	entries_per_4g = 0x100000000 >> IOMMU_PAGE_SHIFT;
>
> 	/* Mark the last bit before a 4GB boundary as used */
> 	start_index = tbl->it_offset | (entries_per_4g - 1);
> 	end_index = tbl->it_offset + tbl->it_size;
>
> 	for (index = start_index; index < end_index; index += entries_per_4g)
> 		__set_bit(index, tbl->it_map);

As a very minor optimisation, avoid reserving the last page
of the I/O window if it ends on a 4GB boundary?


Segher




More information about the Linuxppc-dev mailing list