Commit 9c61a32d authored by Ben Widawsky's avatar Ben Widawsky Committed by Daniel Vetter

drm/i915: Remove scratch page from shared

We already had a mapping in both (minus the phys_addr in AGP).
Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: default avatarBen Widawsky <ben@bwidawsk.net>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent a81cc00c
...@@ -75,6 +75,7 @@ static struct _intel_private { ...@@ -75,6 +75,7 @@ static struct _intel_private {
struct resource ifp_resource; struct resource ifp_resource;
int resource_valid; int resource_valid;
struct page *scratch_page; struct page *scratch_page;
phys_addr_t scratch_page_dma;
int refcount; int refcount;
} intel_private; } intel_private;
...@@ -297,9 +298,9 @@ static int intel_gtt_setup_scratch_page(void) ...@@ -297,9 +298,9 @@ static int intel_gtt_setup_scratch_page(void)
if (pci_dma_mapping_error(intel_private.pcidev, dma_addr)) if (pci_dma_mapping_error(intel_private.pcidev, dma_addr))
return -EINVAL; return -EINVAL;
intel_private.base.scratch_page_dma = dma_addr; intel_private.scratch_page_dma = dma_addr;
} else } else
intel_private.base.scratch_page_dma = page_to_phys(page); intel_private.scratch_page_dma = page_to_phys(page);
intel_private.scratch_page = page; intel_private.scratch_page = page;
...@@ -546,7 +547,7 @@ static unsigned int intel_gtt_mappable_entries(void) ...@@ -546,7 +547,7 @@ 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.base.scratch_page_dma, pci_unmap_page(intel_private.pcidev, intel_private.scratch_page_dma,
PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
put_page(intel_private.scratch_page); put_page(intel_private.scratch_page);
__free_page(intel_private.scratch_page); __free_page(intel_private.scratch_page);
...@@ -891,7 +892,7 @@ void intel_gtt_clear_range(unsigned int first_entry, unsigned int num_entries) ...@@ -891,7 +892,7 @@ void intel_gtt_clear_range(unsigned int first_entry, unsigned int num_entries)
unsigned int i; unsigned int i;
for (i = first_entry; i < (first_entry + num_entries); i++) { for (i = first_entry; i < (first_entry + num_entries); i++) {
intel_private.driver->write_entry(intel_private.base.scratch_page_dma, intel_private.driver->write_entry(intel_private.scratch_page_dma,
i, 0); i, 0);
} }
readl(intel_private.gtt+i-1); readl(intel_private.gtt+i-1);
......
...@@ -383,6 +383,8 @@ struct i915_gtt { ...@@ -383,6 +383,8 @@ struct i915_gtt {
void __iomem *gsm; void __iomem *gsm;
bool do_idle_maps; bool do_idle_maps;
dma_addr_t scratch_page_dma;
struct page *scratch_page;
}; };
#define I915_PPGTT_PD_ENTRIES 512 #define I915_PPGTT_PD_ENTRIES 512
......
...@@ -162,7 +162,7 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev) ...@@ -162,7 +162,7 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
} }
} }
ppgtt->scratch_page_dma_addr = dev_priv->mm.gtt->scratch_page_dma; ppgtt->scratch_page_dma_addr = dev_priv->gtt.scratch_page_dma;
i915_ppgtt_clear_range(ppgtt, 0, i915_ppgtt_clear_range(ppgtt, 0,
ppgtt->num_pd_entries*I915_PPGTT_PT_ENTRIES); ppgtt->num_pd_entries*I915_PPGTT_PT_ENTRIES);
...@@ -396,7 +396,7 @@ static void i915_ggtt_clear_range(struct drm_device *dev, ...@@ -396,7 +396,7 @@ static void i915_ggtt_clear_range(struct drm_device *dev,
first_entry, num_entries, max_entries)) first_entry, num_entries, max_entries))
num_entries = max_entries; num_entries = max_entries;
scratch_pte = pte_encode(dev, dev_priv->mm.gtt->scratch_page_dma, I915_CACHE_LLC); scratch_pte = pte_encode(dev, dev_priv->gtt.scratch_page_dma, I915_CACHE_LLC);
for (i = 0; i < num_entries; i++) for (i = 0; i < num_entries; i++)
iowrite32(scratch_pte, &gtt_base[i]); iowrite32(scratch_pte, &gtt_base[i]);
readl(gtt_base); readl(gtt_base);
...@@ -659,8 +659,8 @@ static int setup_scratch_page(struct drm_device *dev) ...@@ -659,8 +659,8 @@ static int setup_scratch_page(struct drm_device *dev)
#else #else
dma_addr = page_to_phys(page); dma_addr = page_to_phys(page);
#endif #endif
dev_priv->mm.gtt->scratch_page = page; dev_priv->gtt.scratch_page = page;
dev_priv->mm.gtt->scratch_page_dma = dma_addr; dev_priv->gtt.scratch_page_dma = dma_addr;
return 0; return 0;
} }
...@@ -668,11 +668,11 @@ static int setup_scratch_page(struct drm_device *dev) ...@@ -668,11 +668,11 @@ static int setup_scratch_page(struct drm_device *dev)
static void teardown_scratch_page(struct drm_device *dev) static void teardown_scratch_page(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
set_pages_wb(dev_priv->mm.gtt->scratch_page, 1); set_pages_wb(dev_priv->gtt.scratch_page, 1);
pci_unmap_page(dev->pdev, dev_priv->mm.gtt->scratch_page_dma, pci_unmap_page(dev->pdev, dev_priv->gtt.scratch_page_dma,
PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
put_page(dev_priv->mm.gtt->scratch_page); put_page(dev_priv->gtt.scratch_page);
__free_page(dev_priv->mm.gtt->scratch_page); __free_page(dev_priv->gtt.scratch_page);
} }
static inline unsigned int gen6_get_total_gtt_size(u16 snb_gmch_ctl) static inline unsigned int gen6_get_total_gtt_size(u16 snb_gmch_ctl)
......
...@@ -13,9 +13,6 @@ struct intel_gtt { ...@@ -13,9 +13,6 @@ struct intel_gtt {
unsigned int gtt_mappable_entries; unsigned int gtt_mappable_entries;
/* Whether i915 needs to use the dmar apis or not. */ /* Whether i915 needs to use the dmar apis or not. */
unsigned int needs_dmar : 1; unsigned int needs_dmar : 1;
/* Share the scratch page dma with ppgtts. */
dma_addr_t scratch_page_dma;
struct page *scratch_page;
/* needed for ioremap in drm/i915 */ /* needed for ioremap in drm/i915 */
phys_addr_t gma_bus_addr; phys_addr_t gma_bus_addr;
} *intel_gtt_get(void); } *intel_gtt_get(void);
......
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