Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 264453
b: refs/heads/master
c: b1766b6
h: refs/heads/master
i:
  264451: 86b94dd
v: v3
  • Loading branch information
Konrad Rzeszutek Wilk committed Sep 21, 2011
1 parent 22be589 commit 382ccfa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 402c5e15b44070461dcc2f41536c16d0cfbca9c3
refs/heads/master: b1766b62890e3bba1a778a20ef8bf9348d6096c2
2 changes: 1 addition & 1 deletion trunk/drivers/xen/xen-pciback/pciback.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct pci_dev_entry {

struct xen_pcibk_device {
void *pci_dev_data;
spinlock_t dev_lock;
struct mutex dev_lock;
struct xenbus_device *xdev;
struct xenbus_watch be_watch;
u8 be_watching;
Expand Down
22 changes: 9 additions & 13 deletions trunk/drivers/xen/xen-pciback/xenbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static struct xen_pcibk_device *alloc_pdev(struct xenbus_device *xdev)
pdev->xdev = xdev;
dev_set_drvdata(&xdev->dev, pdev);

spin_lock_init(&pdev->dev_lock);
mutex_init(&pdev->dev_lock);

pdev->sh_info = NULL;
pdev->evtchn_irq = INVALID_EVTCHN_IRQ;
Expand All @@ -61,28 +61,24 @@ static struct xen_pcibk_device *alloc_pdev(struct xenbus_device *xdev)

static void xen_pcibk_disconnect(struct xen_pcibk_device *pdev)
{
spin_lock(&pdev->dev_lock);

mutex_lock(&pdev->dev_lock);
/* Ensure the guest can't trigger our handler before removing devices */
if (pdev->evtchn_irq != INVALID_EVTCHN_IRQ) {
unbind_from_irqhandler(pdev->evtchn_irq, pdev);
pdev->evtchn_irq = INVALID_EVTCHN_IRQ;
}
spin_unlock(&pdev->dev_lock);

/* If the driver domain started an op, make sure we complete it
* before releasing the shared memory */

/* Note, the workqueue does not use spinlocks at all.*/
flush_workqueue(xen_pcibk_wq);

spin_lock(&pdev->dev_lock);
if (pdev->sh_info != NULL) {
xenbus_unmap_ring_vfree(pdev->xdev, pdev->sh_info);
pdev->sh_info = NULL;
}
spin_unlock(&pdev->dev_lock);

mutex_unlock(&pdev->dev_lock);
}

static void free_pdev(struct xen_pcibk_device *pdev)
Expand Down Expand Up @@ -119,9 +115,7 @@ static int xen_pcibk_do_attach(struct xen_pcibk_device *pdev, int gnt_ref,
goto out;
}

spin_lock(&pdev->dev_lock);
pdev->sh_info = vaddr;
spin_unlock(&pdev->dev_lock);

err = bind_interdomain_evtchn_to_irqhandler(
pdev->xdev->otherend_id, remote_evtchn, xen_pcibk_handle_event,
Expand All @@ -131,10 +125,7 @@ static int xen_pcibk_do_attach(struct xen_pcibk_device *pdev, int gnt_ref,
"Error binding event channel to IRQ");
goto out;
}

spin_lock(&pdev->dev_lock);
pdev->evtchn_irq = err;
spin_unlock(&pdev->dev_lock);
err = 0;

dev_dbg(&pdev->xdev->dev, "Attached!\n");
Expand All @@ -149,6 +140,7 @@ static int xen_pcibk_attach(struct xen_pcibk_device *pdev)
char *magic = NULL;


mutex_lock(&pdev->dev_lock);
/* Make sure we only do this setup once */
if (xenbus_read_driver_state(pdev->xdev->nodename) !=
XenbusStateInitialised)
Expand Down Expand Up @@ -193,6 +185,7 @@ static int xen_pcibk_attach(struct xen_pcibk_device *pdev)

dev_dbg(&pdev->xdev->dev, "Connected? %d\n", err);
out:
mutex_unlock(&pdev->dev_lock);

kfree(magic);

Expand Down Expand Up @@ -368,6 +361,7 @@ static int xen_pcibk_reconfigure(struct xen_pcibk_device *pdev)

dev_dbg(&pdev->xdev->dev, "Reconfiguring device ...\n");

mutex_lock(&pdev->dev_lock);
/* Make sure we only reconfigure once */
if (xenbus_read_driver_state(pdev->xdev->nodename) !=
XenbusStateReconfiguring)
Expand Down Expand Up @@ -505,6 +499,7 @@ static int xen_pcibk_reconfigure(struct xen_pcibk_device *pdev)
}

out:
mutex_unlock(&pdev->dev_lock);
return 0;
}

Expand Down Expand Up @@ -561,6 +556,7 @@ static int xen_pcibk_setup_backend(struct xen_pcibk_device *pdev)
char dev_str[64];
char state_str[64];

mutex_lock(&pdev->dev_lock);
/* It's possible we could get the call to setup twice, so make sure
* we're not already connected.
*/
Expand Down Expand Up @@ -641,10 +637,10 @@ static int xen_pcibk_setup_backend(struct xen_pcibk_device *pdev)
"Error switching to initialised state!");

out:
mutex_unlock(&pdev->dev_lock);
if (!err)
/* see if pcifront is already configured (if not, we'll wait) */
xen_pcibk_attach(pdev);

return err;
}

Expand Down

0 comments on commit 382ccfa

Please sign in to comment.