Commit 9f5ac8ed authored by Daniel Vetter's avatar Daniel Vetter

agp/intel-gtt: Don't leak the scratch page

Recently discovered by enabling CONFIG_DMA_API_DEBUG in our CI. By the
looks of it broken since forever.

v2: Don't forget to set the scratch page back to wb (Chris). Reuse
intel_gtt_teardown_scratch_page for that (and fix it up to treat
needs_dmar y/n correctly).

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93793Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1453901881-26425-1-git-send-email-daniel.vetter@ffwll.ch
parent 06e6ff8f
...@@ -555,8 +555,10 @@ static unsigned int intel_gtt_mappable_entries(void) ...@@ -555,8 +555,10 @@ static unsigned int intel_gtt_mappable_entries(void)
static void intel_gtt_teardown_scratch_page(void) static void intel_gtt_teardown_scratch_page(void)
{ {
set_pages_wb(intel_private.scratch_page, 1); set_pages_wb(intel_private.scratch_page, 1);
pci_unmap_page(intel_private.pcidev, intel_private.scratch_page_dma, if (intel_private.needs_dmar)
PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); pci_unmap_page(intel_private.pcidev,
intel_private.scratch_page_dma,
PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
__free_page(intel_private.scratch_page); __free_page(intel_private.scratch_page);
} }
...@@ -1430,6 +1432,8 @@ void intel_gmch_remove(void) ...@@ -1430,6 +1432,8 @@ void intel_gmch_remove(void)
if (--intel_private.refcount) if (--intel_private.refcount)
return; return;
if (intel_private.scratch_page)
intel_gtt_teardown_scratch_page();
if (intel_private.pcidev) if (intel_private.pcidev)
pci_dev_put(intel_private.pcidev); pci_dev_put(intel_private.pcidev);
if (intel_private.bridge_dev) if (intel_private.bridge_dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment