Commit 960e3e42 authored by Daniel Vetter's avatar Daniel Vetter

drm/i915: pte_encode is gen6+

All the other gen6+ hw code has the gen6_ prefix, so be consistent
about it.
Reviewed-by: default avatarDamien Lespiau <damien.lespiau@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent def886c3
...@@ -44,9 +44,9 @@ typedef uint32_t gtt_pte_t; ...@@ -44,9 +44,9 @@ typedef uint32_t gtt_pte_t;
#define GEN6_PTE_CACHE_LLC_MLC (3 << 1) #define GEN6_PTE_CACHE_LLC_MLC (3 << 1)
#define GEN6_PTE_ADDR_ENCODE(addr) GEN6_GTT_ADDR_ENCODE(addr) #define GEN6_PTE_ADDR_ENCODE(addr) GEN6_GTT_ADDR_ENCODE(addr)
static inline gtt_pte_t pte_encode(struct drm_device *dev, static inline gtt_pte_t gen6_pte_encode(struct drm_device *dev,
dma_addr_t addr, dma_addr_t addr,
enum i915_cache_level level) enum i915_cache_level level)
{ {
gtt_pte_t pte = GEN6_PTE_VALID; gtt_pte_t pte = GEN6_PTE_VALID;
pte |= GEN6_PTE_ADDR_ENCODE(addr); pte |= GEN6_PTE_ADDR_ENCODE(addr);
...@@ -87,8 +87,9 @@ static void gen6_ppgtt_clear_range(struct i915_hw_ppgtt *ppgtt, ...@@ -87,8 +87,9 @@ static void gen6_ppgtt_clear_range(struct i915_hw_ppgtt *ppgtt,
unsigned first_pte = first_entry % I915_PPGTT_PT_ENTRIES; unsigned first_pte = first_entry % I915_PPGTT_PT_ENTRIES;
unsigned last_pte, i; unsigned last_pte, i;
scratch_pte = pte_encode(ppgtt->dev, ppgtt->scratch_page_dma_addr, scratch_pte = gen6_pte_encode(ppgtt->dev,
I915_CACHE_LLC); ppgtt->scratch_page_dma_addr,
I915_CACHE_LLC);
while (num_entries) { while (num_entries) {
last_pte = first_pte + num_entries; last_pte = first_pte + num_entries;
...@@ -131,8 +132,8 @@ static void gen6_ppgtt_insert_entries(struct i915_hw_ppgtt *ppgtt, ...@@ -131,8 +132,8 @@ static void gen6_ppgtt_insert_entries(struct i915_hw_ppgtt *ppgtt,
for (j = first_pte; j < I915_PPGTT_PT_ENTRIES; j++) { for (j = first_pte; j < I915_PPGTT_PT_ENTRIES; j++) {
page_addr = sg_dma_address(sg) + (m << PAGE_SHIFT); page_addr = sg_dma_address(sg) + (m << PAGE_SHIFT);
pt_vaddr[j] = pte_encode(ppgtt->dev, page_addr, pt_vaddr[j] = gen6_pte_encode(ppgtt->dev, page_addr,
cache_level); cache_level);
/* grab the next page */ /* grab the next page */
if (++m == segment_len) { if (++m == segment_len) {
...@@ -421,7 +422,8 @@ static void gen6_ggtt_insert_entries(struct drm_device *dev, ...@@ -421,7 +422,8 @@ static void gen6_ggtt_insert_entries(struct drm_device *dev,
len = sg_dma_len(sg) >> PAGE_SHIFT; len = sg_dma_len(sg) >> PAGE_SHIFT;
for (m = 0; m < len; m++) { for (m = 0; m < len; m++) {
addr = sg_dma_address(sg) + (m << PAGE_SHIFT); addr = sg_dma_address(sg) + (m << PAGE_SHIFT);
iowrite32(pte_encode(dev, addr, level), &gtt_entries[i]); iowrite32(gen6_pte_encode(dev, addr, level),
&gtt_entries[i]);
i++; i++;
} }
} }
...@@ -433,7 +435,8 @@ static void gen6_ggtt_insert_entries(struct drm_device *dev, ...@@ -433,7 +435,8 @@ static void gen6_ggtt_insert_entries(struct drm_device *dev,
* hardware should work, we must keep this posting read for paranoia. * hardware should work, we must keep this posting read for paranoia.
*/ */
if (i != 0) if (i != 0)
WARN_ON(readl(&gtt_entries[i-1]) != pte_encode(dev, addr, level)); WARN_ON(readl(&gtt_entries[i-1])
!= gen6_pte_encode(dev, addr, level));
/* This next bit makes the above posting read even more important. We /* This next bit makes the above posting read even more important. We
* want to flush the TLBs only after we're certain all the PTE updates * want to flush the TLBs only after we're certain all the PTE updates
...@@ -458,7 +461,8 @@ static void gen6_ggtt_clear_range(struct drm_device *dev, ...@@ -458,7 +461,8 @@ static void gen6_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->gtt.scratch_page_dma, I915_CACHE_LLC); scratch_pte = gen6_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);
......
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