aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorBen Widawsky <ben@bwidawsk.net>2013-01-18 15:30:33 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-01-20 07:11:12 -0500
commit8d2e630899165d413ae8a2adc36846ac0b71bada (patch)
treef2df0bedcdedca4a63ecb40402680d6099f40fa3 /drivers/char
parent9c61a32d31a55c8c6e590d83ae5645e14fde09f2 (diff)
drm/i915: Needs_dmar, not
The reasoning behind our code taking two paths depending upon whether or not we may have been configured for IOMMU isn't clear to me. It should always be safe to use the pci mapping functions as they are designed to abstract the decision we were handling in i915. Aside from simpler code, removing another member for the intel_gtt struct is a nice motivation. I ran this by Chris, and he wasn't concerned about the extra kzalloc, and memory references vs. page_to_phys calculation in the case without IOMMU. v2: Update commit message v3: Remove needs_dmar addition from Zhenyu upstream This reverts (and then other stuff) commit 20652097dadd9a7fb4d652f25466299974bc78f9 Author: Zhenyu Wang <zhenyuw@linux.intel.com> Date: Thu Dec 13 23:47:47 2012 +0800 drm/i915: Fix missed needs_dmar setting Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com> (v2) Cc: Zhenyu Wang <zhenyuw@linux.intel.com> Signed-off-by: Ben Widawsky <ben@bwidawsk.net> [danvet: Squash in follow-up fix to remove the bogus hunk which deleted the dma_mask configuration for gen6+.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/agp/intel-gtt.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index 7fcee5c2e986..b45241479a56 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -77,6 +77,8 @@ static struct _intel_private {
77 struct page *scratch_page; 77 struct page *scratch_page;
78 phys_addr_t scratch_page_dma; 78 phys_addr_t scratch_page_dma;
79 int refcount; 79 int refcount;
80 /* Whether i915 needs to use the dmar apis or not. */
81 unsigned int needs_dmar : 1;
80} intel_private; 82} intel_private;
81 83
82#define INTEL_GTT_GEN intel_private.driver->gen 84#define INTEL_GTT_GEN intel_private.driver->gen
@@ -292,7 +294,7 @@ static int intel_gtt_setup_scratch_page(void)
292 get_page(page); 294 get_page(page);
293 set_pages_uc(page, 1); 295 set_pages_uc(page, 1);
294 296
295 if (intel_private.base.needs_dmar) { 297 if (intel_private.needs_dmar) {
296 dma_addr = pci_map_page(intel_private.pcidev, page, 0, 298 dma_addr = pci_map_page(intel_private.pcidev, page, 0,
297 PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); 299 PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
298 if (pci_dma_mapping_error(intel_private.pcidev, dma_addr)) 300 if (pci_dma_mapping_error(intel_private.pcidev, dma_addr))
@@ -608,7 +610,7 @@ static int intel_gtt_init(void)
608 610
609 intel_private.base.stolen_size = intel_gtt_stolen_size(); 611 intel_private.base.stolen_size = intel_gtt_stolen_size();
610 612
611 intel_private.base.needs_dmar = USE_PCI_DMA_API && INTEL_GTT_GEN > 2; 613 intel_private.needs_dmar = USE_PCI_DMA_API && INTEL_GTT_GEN > 2;
612 614
613 ret = intel_gtt_setup_scratch_page(); 615 ret = intel_gtt_setup_scratch_page();
614 if (ret != 0) { 616 if (ret != 0) {
@@ -866,7 +868,7 @@ static int intel_fake_agp_insert_entries(struct agp_memory *mem,
866 if (!mem->is_flushed) 868 if (!mem->is_flushed)
867 global_cache_flush(); 869 global_cache_flush();
868 870
869 if (intel_private.base.needs_dmar) { 871 if (intel_private.needs_dmar) {
870 struct sg_table st; 872 struct sg_table st;
871 873
872 ret = intel_gtt_map_memory(mem->pages, mem->page_count, &st); 874 ret = intel_gtt_map_memory(mem->pages, mem->page_count, &st);
@@ -907,7 +909,7 @@ static int intel_fake_agp_remove_entries(struct agp_memory *mem,
907 909
908 intel_gtt_clear_range(pg_start, mem->page_count); 910 intel_gtt_clear_range(pg_start, mem->page_count);
909 911
910 if (intel_private.base.needs_dmar) { 912 if (intel_private.needs_dmar) {
911 intel_gtt_unmap_memory(mem->sg_list, mem->num_sg); 913 intel_gtt_unmap_memory(mem->sg_list, mem->num_sg);
912 mem->sg_list = NULL; 914 mem->sg_list = NULL;
913 mem->num_sg = 0; 915 mem->num_sg = 0;