diff options
author | rnoland <rnoland@FreeBSD.org> | 2008-09-09 02:05:03 +0000 |
---|---|---|
committer | rnoland <rnoland@FreeBSD.org> | 2008-09-09 02:05:03 +0000 |
commit | 016be156e0964094bf2d383d94aef409a35dc78c (patch) | |
tree | b049bd3bd13dc9dbf8c993171dae2fd568b69bed /sys/dev/drm/i915_dma.c | |
parent | 1af31f868a04970e4e460e2e08c563289e42b042 (diff) | |
download | FreeBSD-src-016be156e0964094bf2d383d94aef409a35dc78c.zip FreeBSD-src-016be156e0964094bf2d383d94aef409a35dc78c.tar.gz |
We should never call drm_pci_alloc() while holding locks, due the the
calls to bus_dma. There were multiple paths that held different locks or
no locks at all. This patch ensures that all of the calling paths drop
their lock(s) before calling drm_pci_alloc().
Reviewed by: kib
Diffstat (limited to 'sys/dev/drm/i915_dma.c')
-rw-r--r-- | sys/dev/drm/i915_dma.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/dev/drm/i915_dma.c b/sys/dev/drm/i915_dma.c index 8cfdfb0..79e687e 100644 --- a/sys/dev/drm/i915_dma.c +++ b/sys/dev/drm/i915_dma.c @@ -250,16 +250,22 @@ static int i915_initialize(struct drm_device * dev, /* Program Hardware Status Page */ if (!I915_NEED_GFX_HWS(dev)) { - dev_priv->status_page_dmah = - drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 0xffffffff); - - if (!dev_priv->status_page_dmah) { + drm_dma_handle_t *dmah; +#ifdef __FreeBSD__ + DRM_UNLOCK(); +#endif + dmah = drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 0xffffffff); +#ifdef __FreeBSD__ + DRM_LOCK(); +#endif + if (!dmah) { i915_dma_cleanup(dev); DRM_ERROR("Can not allocate hardware status page\n"); return -ENOMEM; } - dev_priv->hw_status_page = dev_priv->status_page_dmah->vaddr; - dev_priv->dma_status_page = dev_priv->status_page_dmah->busaddr; + dev_priv->status_page_dmah = dmah; + dev_priv->hw_status_page = dmah->vaddr; + dev_priv->dma_status_page = dmah->busaddr; memset(dev_priv->hw_status_page, 0, PAGE_SIZE); |