diff options
author | Maarten Maathuis <madman2003@gmail.com> | 2010-02-01 14:58:27 -0500 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2010-02-25 00:07:53 -0500 |
commit | ff9e5279b14dc024599cc705ee199dadb94e90a3 (patch) | |
tree | 4881498b0c5f0defdc14890783249b0514a8afde /drivers/gpu/drm/nouveau/nv40_fifo.c | |
parent | 6c42966768b0254f465a8f451333795283f53d22 (diff) |
drm/nouveau: protect channel create/destroy and irq handler with a spinlock
The nv50 pgraph handler (for example) could reenable pgraph fifo access
and that would be bad when pgraph context is being unloaded (we need the
guarantee a ctxprog isn't running).
Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv40_fifo.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nv40_fifo.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nv40_fifo.c b/drivers/gpu/drm/nouveau/nv40_fifo.c index b4f19ccb8b41..6b2ef4a9fce1 100644 --- a/drivers/gpu/drm/nouveau/nv40_fifo.c +++ b/drivers/gpu/drm/nouveau/nv40_fifo.c | |||
@@ -37,6 +37,7 @@ nv40_fifo_create_context(struct nouveau_channel *chan) | |||
37 | struct drm_device *dev = chan->dev; | 37 | struct drm_device *dev = chan->dev; |
38 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 38 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
39 | uint32_t fc = NV40_RAMFC(chan->id); | 39 | uint32_t fc = NV40_RAMFC(chan->id); |
40 | unsigned long flags; | ||
40 | int ret; | 41 | int ret; |
41 | 42 | ||
42 | ret = nouveau_gpuobj_new_fake(dev, NV40_RAMFC(chan->id), ~0, | 43 | ret = nouveau_gpuobj_new_fake(dev, NV40_RAMFC(chan->id), ~0, |
@@ -45,6 +46,8 @@ nv40_fifo_create_context(struct nouveau_channel *chan) | |||
45 | if (ret) | 46 | if (ret) |
46 | return ret; | 47 | return ret; |
47 | 48 | ||
49 | spin_lock_irqsave(&dev_priv->context_switch_lock, flags); | ||
50 | |||
48 | dev_priv->engine.instmem.prepare_access(dev, true); | 51 | dev_priv->engine.instmem.prepare_access(dev, true); |
49 | nv_wi32(dev, fc + 0, chan->pushbuf_base); | 52 | nv_wi32(dev, fc + 0, chan->pushbuf_base); |
50 | nv_wi32(dev, fc + 4, chan->pushbuf_base); | 53 | nv_wi32(dev, fc + 4, chan->pushbuf_base); |
@@ -63,6 +66,8 @@ nv40_fifo_create_context(struct nouveau_channel *chan) | |||
63 | /* enable the fifo dma operation */ | 66 | /* enable the fifo dma operation */ |
64 | nv_wr32(dev, NV04_PFIFO_MODE, | 67 | nv_wr32(dev, NV04_PFIFO_MODE, |
65 | nv_rd32(dev, NV04_PFIFO_MODE) | (1 << chan->id)); | 68 | nv_rd32(dev, NV04_PFIFO_MODE) | (1 << chan->id)); |
69 | |||
70 | spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags); | ||
66 | return 0; | 71 | return 0; |
67 | } | 72 | } |
68 | 73 | ||