]> Git Repo - J-linux.git/commitdiff
Merge commit 'v2.6.30-rc5' into core/iommu
authorIngo Molnar <[email protected]>
Mon, 11 May 2009 12:44:27 +0000 (14:44 +0200)
committerIngo Molnar <[email protected]>
Mon, 11 May 2009 12:44:31 +0000 (14:44 +0200)
Merge reason: core/iommu was on an .30-rc1 base,
              update it to .30-rc5 to refresh.

Signed-off-by: Ingo Molnar <[email protected]>
1  2 
arch/x86/kernel/pci-swiotlb.c
lib/dma-debug.c

index 887388a1c57d65ceea64b94ea4a786135b6dc28e,221a3853e2684b111c36669ee688f62ba51cdb10..a1712f2b50f1b974a1a346bd4d8db1ec21f02068
@@@ -28,7 -28,7 +28,7 @@@ dma_addr_t swiotlb_phys_to_bus(struct d
        return paddr;
  }
  
 -phys_addr_t swiotlb_bus_to_phys(dma_addr_t baddr)
 +phys_addr_t swiotlb_bus_to_phys(struct device *hwdev, dma_addr_t baddr)
  {
        return baddr;
  }
@@@ -50,7 -50,7 +50,7 @@@ static void *x86_swiotlb_alloc_coherent
        return swiotlb_alloc_coherent(hwdev, size, dma_handle, flags);
  }
  
- struct dma_map_ops swiotlb_dma_ops = {
+ static struct dma_map_ops swiotlb_dma_ops = {
        .mapping_error = swiotlb_dma_mapping_error,
        .alloc_coherent = x86_swiotlb_alloc_coherent,
        .free_coherent = swiotlb_free_coherent,
diff --combined lib/dma-debug.c
index 5d61019330cd8c331e9d97be4cbd4f907547b245,69da09a085a1943ea6a70f4871fd2df1683110fb..cdd205d6bf7c6bab0afa0679c26f04acce3955dd
@@@ -85,7 -85,6 +85,7 @@@ static u32 show_num_errors = 1
  
  static u32 num_free_entries;
  static u32 min_free_entries;
 +static u32 nr_total_entries;
  
  /* number of preallocated entries requested by kernel cmdline */
  static u32 req_entries;
@@@ -258,21 -257,6 +258,21 @@@ static void add_dma_entry(struct dma_de
        put_hash_bucket(bucket, &flags);
  }
  
 +static struct dma_debug_entry *__dma_entry_alloc(void)
 +{
 +      struct dma_debug_entry *entry;
 +
 +      entry = list_entry(free_entries.next, struct dma_debug_entry, list);
 +      list_del(&entry->list);
 +      memset(entry, 0, sizeof(*entry));
 +
 +      num_free_entries -= 1;
 +      if (num_free_entries < min_free_entries)
 +              min_free_entries = num_free_entries;
 +
 +      return entry;
 +}
 +
  /* struct dma_entry allocator
   *
   * The next two functions implement the allocator for
@@@ -292,7 -276,9 +292,7 @@@ static struct dma_debug_entry *dma_entr
                goto out;
        }
  
 -      entry = list_entry(free_entries.next, struct dma_debug_entry, list);
 -      list_del(&entry->list);
 -      memset(entry, 0, sizeof(*entry));
 +      entry = __dma_entry_alloc();
  
  #ifdef CONFIG_STACKTRACE
        entry->stacktrace.max_entries = DMA_DEBUG_STACKTRACE_ENTRIES;
        entry->stacktrace.skip = 2;
        save_stack_trace(&entry->stacktrace);
  #endif
 -      num_free_entries -= 1;
 -      if (num_free_entries < min_free_entries)
 -              min_free_entries = num_free_entries;
  
  out:
        spin_unlock_irqrestore(&free_entries_lock, flags);
@@@ -321,53 -310,6 +321,53 @@@ static void dma_entry_free(struct dma_d
        spin_unlock_irqrestore(&free_entries_lock, flags);
  }
  
 +int dma_debug_resize_entries(u32 num_entries)
 +{
 +      int i, delta, ret = 0;
 +      unsigned long flags;
 +      struct dma_debug_entry *entry;
 +      LIST_HEAD(tmp);
 +
 +      spin_lock_irqsave(&free_entries_lock, flags);
 +
 +      if (nr_total_entries < num_entries) {
 +              delta = num_entries - nr_total_entries;
 +
 +              spin_unlock_irqrestore(&free_entries_lock, flags);
 +
 +              for (i = 0; i < delta; i++) {
 +                      entry = kzalloc(sizeof(*entry), GFP_KERNEL);
 +                      if (!entry)
 +                              break;
 +
 +                      list_add_tail(&entry->list, &tmp);
 +              }
 +
 +              spin_lock_irqsave(&free_entries_lock, flags);
 +
 +              list_splice(&tmp, &free_entries);
 +              nr_total_entries += i;
 +              num_free_entries += i;
 +      } else {
 +              delta = nr_total_entries - num_entries;
 +
 +              for (i = 0; i < delta && !list_empty(&free_entries); i++) {
 +                      entry = __dma_entry_alloc();
 +                      kfree(entry);
 +              }
 +
 +              nr_total_entries -= i;
 +      }
 +
 +      if (nr_total_entries != num_entries)
 +              ret = 1;
 +
 +      spin_unlock_irqrestore(&free_entries_lock, flags);
 +
 +      return ret;
 +}
 +EXPORT_SYMBOL(dma_debug_resize_entries);
 +
  /*
   * DMA-API debugging init code
   *
@@@ -458,60 -400,9 +458,9 @@@ out_err
        return -ENOMEM;
  }
  
- static int device_dma_allocations(struct device *dev)
- {
-       struct dma_debug_entry *entry;
-       unsigned long flags;
-       int count = 0, i;
-       for (i = 0; i < HASH_SIZE; ++i) {
-               spin_lock_irqsave(&dma_entry_hash[i].lock, flags);
-               list_for_each_entry(entry, &dma_entry_hash[i].list, list) {
-                       if (entry->dev == dev)
-                               count += 1;
-               }
-               spin_unlock_irqrestore(&dma_entry_hash[i].lock, flags);
-       }
-       return count;
- }
- static int dma_debug_device_change(struct notifier_block *nb,
-                                   unsigned long action, void *data)
- {
-       struct device *dev = data;
-       int count;
-       switch (action) {
-       case BUS_NOTIFY_UNBIND_DRIVER:
-               count = device_dma_allocations(dev);
-               if (count == 0)
-                       break;
-               err_printk(dev, NULL, "DMA-API: device driver has pending "
-                               "DMA allocations while released from device "
-                               "[count=%d]\n", count);
-               break;
-       default:
-               break;
-       }
-       return 0;
- }
  void dma_debug_add_bus(struct bus_type *bus)
  {
-       struct notifier_block *nb;
-       nb = kzalloc(sizeof(struct notifier_block), GFP_KERNEL);
-       if (nb == NULL) {
-               printk(KERN_ERR "dma_debug_add_bus: out of memory\n");
-               return;
-       }
-       nb->notifier_call = dma_debug_device_change;
-       bus_register_notifier(bus, nb);
+       /* FIXME: register notifier */
  }
  
  /*
@@@ -548,8 -439,6 +497,8 @@@ void dma_debug_init(u32 num_entries
                return;
        }
  
 +      nr_total_entries = num_free_entries;
 +
        printk(KERN_INFO "DMA-API: debugging enabled by kernel config\n");
  }
  
This page took 0.058505 seconds and 4 git commands to generate.