Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 358007
b: refs/heads/master
c: 8d2e630
h: refs/heads/master
i:
  358005: c8cdca5
  358003: f409db5
  357999: 2a892aa
v: v3
  • Loading branch information
Ben Widawsky authored and Daniel Vetter committed Jan 20, 2013
1 parent 9cd6d9f commit 0f49061
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 36 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9c61a32d31a55c8c6e590d83ae5645e14fde09f2
refs/heads/master: 8d2e630899165d413ae8a2adc36846ac0b71bada
10 changes: 6 additions & 4 deletions trunk/drivers/char/agp/intel-gtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ static struct _intel_private {
struct page *scratch_page;
phys_addr_t scratch_page_dma;
int refcount;
/* Whether i915 needs to use the dmar apis or not. */
unsigned int needs_dmar : 1;
} intel_private;

#define INTEL_GTT_GEN intel_private.driver->gen
Expand Down Expand Up @@ -292,7 +294,7 @@ static int intel_gtt_setup_scratch_page(void)
get_page(page);
set_pages_uc(page, 1);

if (intel_private.base.needs_dmar) {
if (intel_private.needs_dmar) {
dma_addr = pci_map_page(intel_private.pcidev, page, 0,
PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
if (pci_dma_mapping_error(intel_private.pcidev, dma_addr))
Expand Down Expand Up @@ -608,7 +610,7 @@ static int intel_gtt_init(void)

intel_private.base.stolen_size = intel_gtt_stolen_size();

intel_private.base.needs_dmar = USE_PCI_DMA_API && INTEL_GTT_GEN > 2;
intel_private.needs_dmar = USE_PCI_DMA_API && INTEL_GTT_GEN > 2;

ret = intel_gtt_setup_scratch_page();
if (ret != 0) {
Expand Down Expand Up @@ -866,7 +868,7 @@ static int intel_fake_agp_insert_entries(struct agp_memory *mem,
if (!mem->is_flushed)
global_cache_flush();

if (intel_private.base.needs_dmar) {
if (intel_private.needs_dmar) {
struct sg_table st;

ret = intel_gtt_map_memory(mem->pages, mem->page_count, &st);
Expand Down Expand Up @@ -907,7 +909,7 @@ static int intel_fake_agp_remove_entries(struct agp_memory *mem,

intel_gtt_clear_range(pg_start, mem->page_count);

if (intel_private.base.needs_dmar) {
if (intel_private.needs_dmar) {
intel_gtt_unmap_memory(mem->sg_list, mem->num_sg);
mem->sg_list = NULL;
mem->num_sg = 0;
Expand Down
45 changes: 16 additions & 29 deletions trunk/drivers/gpu/drm/i915/i915_gem_gtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,28 +138,23 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
goto err_pt_alloc;
}

if (dev_priv->mm.gtt->needs_dmar) {
ppgtt->pt_dma_addr = kzalloc(sizeof(dma_addr_t)
*ppgtt->num_pd_entries,
GFP_KERNEL);
if (!ppgtt->pt_dma_addr)
goto err_pt_alloc;
ppgtt->pt_dma_addr = kzalloc(sizeof(dma_addr_t) *ppgtt->num_pd_entries,
GFP_KERNEL);
if (!ppgtt->pt_dma_addr)
goto err_pt_alloc;

for (i = 0; i < ppgtt->num_pd_entries; i++) {
dma_addr_t pt_addr;
for (i = 0; i < ppgtt->num_pd_entries; i++) {
dma_addr_t pt_addr;

pt_addr = pci_map_page(dev->pdev, ppgtt->pt_pages[i],
0, 4096,
PCI_DMA_BIDIRECTIONAL);
pt_addr = pci_map_page(dev->pdev, ppgtt->pt_pages[i], 0, 4096,
PCI_DMA_BIDIRECTIONAL);

if (pci_dma_mapping_error(dev->pdev,
pt_addr)) {
ret = -EIO;
goto err_pd_pin;
if (pci_dma_mapping_error(dev->pdev, pt_addr)) {
ret = -EIO;
goto err_pd_pin;

}
ppgtt->pt_dma_addr[i] = pt_addr;
}
ppgtt->pt_dma_addr[i] = pt_addr;
}

ppgtt->scratch_page_dma_addr = dev_priv->gtt.scratch_page_dma;
Expand Down Expand Up @@ -294,11 +289,7 @@ void i915_gem_init_ppgtt(struct drm_device *dev)
for (i = 0; i < ppgtt->num_pd_entries; i++) {
dma_addr_t pt_addr;

if (dev_priv->mm.gtt->needs_dmar)
pt_addr = ppgtt->pt_dma_addr[i];
else
pt_addr = page_to_phys(ppgtt->pt_pages[i]);

pt_addr = ppgtt->pt_dma_addr[i];
pd_entry = GEN6_PDE_ADDR_ENCODE(pt_addr);
pd_entry |= GEN6_PDE_VALID;

Expand Down Expand Up @@ -730,16 +721,12 @@ int i915_gem_gtt_init(struct drm_device *dev)
return 0;
}

dev_priv->mm.gtt = kzalloc(sizeof(*dev_priv->mm.gtt), GFP_KERNEL);
if (!dev_priv->mm.gtt)
return -ENOMEM;

if (!pci_set_dma_mask(dev->pdev, DMA_BIT_MASK(40)))
pci_set_consistent_dma_mask(dev->pdev, DMA_BIT_MASK(40));

#ifdef CONFIG_INTEL_IOMMU
dev_priv->mm.gtt->needs_dmar = 1;
#endif
dev_priv->mm.gtt = kzalloc(sizeof(*dev_priv->mm.gtt), GFP_KERNEL);
if (!dev_priv->mm.gtt)
return -ENOMEM;

/* For GEN6+ the PTEs for the ggtt live at 2MB + BAR0 */
gtt_bus_addr = pci_resource_start(dev->pdev, 0) + (2<<20);
Expand Down
2 changes: 0 additions & 2 deletions trunk/include/drm/intel-gtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ struct intel_gtt {
/* Part of the gtt that is mappable by the cpu, for those chips where
* this is not the full gtt. */
unsigned int gtt_mappable_entries;
/* Whether i915 needs to use the dmar apis or not. */
unsigned int needs_dmar : 1;
/* needed for ioremap in drm/i915 */
phys_addr_t gma_bus_addr;
} *intel_gtt_get(void);
Expand Down

0 comments on commit 0f49061

Please sign in to comment.