diff options
| author | Ben Widawsky <benjamin.widawsky@intel.com> | 2014-02-27 19:47:38 -0800 |
|---|---|---|
| committer | Ben Widawsky <benjamin.widawsky@intel.com> | 2014-05-08 11:03:48 -0700 |
| commit | 77fda78b8944029e1bb60e1fd5dbe2cc792c6ad1 (patch) | |
| tree | 6e955cacc9d3651bf0b43bebc62277100ef5612b | |
| parent | a281a104056dc61bc9ae2d3bc4e39e8b095abfe1 (diff) | |
drm/i915: Paranoia - get zeroed page table pages
We normally clear the page tables as one of the first things during
initialization. They are however wired up (and potentially valid) before
we clear them.
To prevent the GPU from doing anything we might later regret, simply get
zeroed pages, which always mean invalid on all GENs.
NOTE: that a similar paranoia could be applied to GGTT via making sure
all entries are invalid ASAP. I think the extra work required to fix
such a BIOS bug is unwarranted until proven necessary.
v2: Remove useless GFP_ZERO in the kcallocs
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
| -rw-r--r-- | drivers/gpu/drm/i915/i915_gem_gtt.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 72b1bf8f7dce..33610fe953e9 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c @@ -412,7 +412,7 @@ static struct page **__gen8_alloc_page_tables(void) return ERR_PTR(-ENOMEM); for (i = 0; i < GEN8_PDES_PER_PAGE; i++) { - pt_pages[i] = alloc_page(GFP_KERNEL); + pt_pages[i] = alloc_page(GFP_KERNEL | __GFP_ZERO); if (!pt_pages[i]) goto bail; } @@ -474,7 +474,8 @@ static int gen8_ppgtt_allocate_dma(struct i915_hw_ppgtt *ppgtt) static int gen8_ppgtt_allocate_page_directories(struct i915_hw_ppgtt *ppgtt, const int max_pdp) { - ppgtt->pd_pages = alloc_pages(GFP_KERNEL, get_order(max_pdp << PAGE_SHIFT)); + ppgtt->pd_pages = alloc_pages(GFP_KERNEL | __GFP_ZERO, + get_order(max_pdp << PAGE_SHIFT)); if (!ppgtt->pd_pages) return -ENOMEM; @@ -1075,7 +1076,7 @@ static int gen6_ppgtt_allocate_page_tables(struct i915_hw_ppgtt *ppgtt) return -ENOMEM; for (i = 0; i < ppgtt->num_pd_entries; i++) { - ppgtt->pt_pages[i] = alloc_page(GFP_KERNEL); + ppgtt->pt_pages[i] = alloc_page(GFP_KERNEL | __GFP_ZERO); if (!ppgtt->pt_pages[i]) { gen6_ppgtt_free(ppgtt); return -ENOMEM; |
