diff options
author | kib <kib@FreeBSD.org> | 2007-07-12 09:02:31 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2007-07-12 09:02:31 +0000 |
commit | 7d726d3c98d2a4f21ba0561188a21bcd0b2b59df (patch) | |
tree | af2d1208cfe28255e701a73c2dee80220bbe419d /sys/dev/drm/i915_dma.c | |
parent | b4a663c82ad0a4c227971f6662fb4715b6acecdb (diff) | |
download | FreeBSD-src-7d726d3c98d2a4f21ba0561188a21bcd0b2b59df.zip FreeBSD-src-7d726d3c98d2a4f21ba0561188a21bcd0b2b59df.tar.gz |
bus_dma_tag_create() and bus_dma_mem_alloc() shall not be called with a
non-sleepable lock held. drm_pci_alloc() calls them, thus drm mutex shall
not be held during the call.
Move the drm_pci_alloc() to the start of the i915_initialize() and drop the
the drm mutex around it.
Reported by: Ganbold <ganbold micom mng net>
Reviewed by: anholt
Approved by: re (hrs)
MFC after: 1 week
Diffstat (limited to 'sys/dev/drm/i915_dma.c')
-rw-r--r-- | sys/dev/drm/i915_dma.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/sys/dev/drm/i915_dma.c b/sys/dev/drm/i915_dma.c index 3bd1c31..3e72769 100644 --- a/sys/dev/drm/i915_dma.c +++ b/sys/dev/drm/i915_dma.c @@ -122,7 +122,22 @@ static int i915_initialize(drm_device_t * dev, drm_i915_private_t * dev_priv, drm_i915_init_t * init) { + drm_dma_handle_t *dmah; + + DRM_UNLOCK(); + dmah = drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, + 0xffffffff); + if (!dmah) { + dev->dev_private = (void *)dev_priv; + i915_dma_cleanup(dev); + DRM_ERROR("Can not allocate hardware status page\n"); + DRM_LOCK(); + return DRM_ERR(ENOMEM); + } + DRM_LOCK(); + memset(dev_priv, 0, sizeof(drm_i915_private_t)); + dev_priv->status_page_dmah = dmah; DRM_GETSAREA(); if (!dev_priv->sarea) { @@ -181,15 +196,6 @@ static int i915_initialize(drm_device_t * dev, dev_priv->allow_batchbuffer = 1; /* Program Hardware Status Page */ - dev_priv->status_page_dmah = drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, - 0xffffffff); - - if (!dev_priv->status_page_dmah) { - dev->dev_private = (void *)dev_priv; - i915_dma_cleanup(dev); - DRM_ERROR("Can not allocate hardware status page\n"); - return DRM_ERR(ENOMEM); - } dev_priv->hw_status_page = dev_priv->status_page_dmah->vaddr; dev_priv->dma_status_page = dev_priv->status_page_dmah->busaddr; |