Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Copyrights for lock and memory checking
[palacios.git] / linux_module / iface-host-pci-hw.h
index 2a575b6..7254edc 100644 (file)
@@ -30,7 +30,7 @@ static int setup_hw_pci_dev(struct host_pci_device * host_dev) {
     host_dev->hw_dev.dev = dev;
 
     host_dev->hw_dev.intx_disabled = 1;
-    spin_lock_init(&(host_dev->hw_dev.intx_lock));
+    palacios_spinlock_init(&(host_dev->hw_dev.intx_lock));
 
     if (pci_enable_device(dev)) {
        printk("Could not enable Device\n");
@@ -153,10 +153,10 @@ static irqreturn_t host_pci_intx_irq_handler(int irq, void * priv_data) {
 
     //   printk("Host PCI IRQ handler (%d)\n", irq);
 
-    spin_lock(&(host_dev->hw_dev.intx_lock));
+    palacios_spinlock_lock(&(host_dev->hw_dev.intx_lock));
     disable_irq_nosync(irq);
     host_dev->hw_dev.intx_disabled = 1;
-    spin_unlock(&(host_dev->hw_dev.intx_lock));
+    palacios_spinlock_unlock(&(host_dev->hw_dev.intx_lock));
 
     V3_host_pci_raise_irq(&(host_dev->v3_dev), 0);
 
@@ -289,7 +289,7 @@ static int hw_pci_cmd(struct host_pci_device * host_dev, host_pci_cmd_t cmd, u64
            }
 
            host_dev->hw_dev.num_msix_vecs = 0;
-           kfree(host_dev->hw_dev.msix_entries);
+           palacios_free(host_dev->hw_dev.msix_entries);
 
            pci_disable_msix(dev);
 
@@ -311,11 +311,11 @@ static int hw_ack_irq(struct host_pci_device * host_dev, u32 vector) {
 
     //    printk("Acking IRQ vector %d\n", vector);
 
-    spin_lock_irqsave(&(host_dev->hw_dev.intx_lock), flags);
+    palacios_spinlock_lock_irqsave(&(host_dev->hw_dev.intx_lock), flags);
     //    printk("Enabling IRQ %d\n", dev->irq);
     enable_irq(dev->irq);
     host_dev->hw_dev.intx_disabled = 0;
-    spin_unlock_irqrestore(&(host_dev->hw_dev.intx_lock), flags);
+    palacios_spinlock_unlock_irqrestore(&(host_dev->hw_dev.intx_lock), flags);
     
     return 0;
 }
@@ -329,13 +329,13 @@ static int reserve_hw_pci_dev(struct host_pci_device * host_dev, void * v3_ctx)
     struct v3_host_pci_dev * v3_dev = &(host_dev->v3_dev);
     struct pci_dev * dev = host_dev->hw_dev.dev;
 
-    spin_lock_irqsave(&lock, flags);
+    palacios_spinlock_lock_irqsave(&lock, flags);
     if (host_dev->hw_dev.in_use == 0) {
        host_dev->hw_dev.in_use = 1;
     } else {
        ret = -1;
     }
-    spin_unlock_irqrestore(&lock, flags);
+    palacios_spinlock_unlock_irqrestore(&lock, flags);
 
 
     if (v3_dev->iface == IOMMU) {
@@ -451,3 +451,9 @@ static int read_hw_pci_config(struct host_pci_device * host_dev, u32 reg, void *
 
     return 0; 
 }
+
+
+//
+// Should be a matching teardown function here, otherwise we
+// are at least leaking the lock from the lockchecker's perspective
+// we would like to be able to do a palacios_spinlock_deinit() here...