*/
struct aperture_range {
+ spinlock_t bitmap_lock;
+
/* address allocation bitmap */
unsigned long *bitmap;
dma_dom->aperture[index]->offset = dma_dom->aperture_size;
+ spin_lock_init(&dma_dom->aperture[index]->bitmap_lock);
+
if (populate) {
unsigned long address = dma_dom->aperture_size;
int i, num_ptes = APERTURE_RANGE_PAGES / 512;
unsigned long boundary_size, mask;
unsigned long address = -1;
unsigned long limit;
+ unsigned long flags;
next_bit >>= PAGE_SHIFT;
limit = iommu_device_max_index(APERTURE_RANGE_PAGES, offset,
dma_mask >> PAGE_SHIFT);
+ spin_lock_irqsave(&dom->aperture[i]->bitmap_lock, flags);
address = iommu_area_alloc(dom->aperture[i]->bitmap,
limit, next_bit, pages, 0,
boundary_size, align_mask);
+ spin_unlock_irqrestore(&dom->aperture[i]->bitmap_lock, flags);
if (address != -1) {
address = dom->aperture[i]->offset +
(address << PAGE_SHIFT);
{
unsigned i = address >> APERTURE_RANGE_SHIFT;
struct aperture_range *range = dom->aperture[i];
+ unsigned long flags;
BUG_ON(i >= APERTURE_MAX_RANGES || range == NULL);
address = (address % APERTURE_RANGE_SIZE) >> PAGE_SHIFT;
+ spin_lock_irqsave(&range->bitmap_lock, flags);
bitmap_clear(range->bitmap, address, pages);
+ spin_unlock_irqrestore(&range->bitmap_lock, flags);
}