From: Ben Widawsky <benjamin.widawsky@intel.com>
To: Intel GFX <intel-gfx@lists.freedesktop.org>
Cc: Ben Widawsky <ben@bwidawsk.net>,
Ben Widawsky <benjamin.widawsky@intel.com>
Subject: [PATCH] drm/i915: Paranoia - get zeroed page table pages
Date: Thu, 27 Feb 2014 10:30:02 -0800 [thread overview]
Message-ID: <1393525802-978-1-git-send-email-benjamin.widawsky@intel.com> (raw)
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.
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
drivers/gpu/drm/i915/i915_gem_gtt.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 0c27d8a..f94d39d 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -354,12 +354,13 @@ static struct page **__gen8_alloc_page_tables(void)
struct page **pt_pages;
int i;
- pt_pages = kcalloc(GEN8_PDES_PER_PAGE, sizeof(struct page *), GFP_KERNEL);
+ pt_pages = kcalloc(GEN8_PDES_PER_PAGE, sizeof(struct page *),
+ GFP_KERNEL | __GFP_ZERO);
if (!pt_pages)
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;
}
@@ -410,7 +411,7 @@ static int gen8_ppgtt_allocate_dma(struct i915_hw_ppgtt *ppgtt)
for (i = 0; i < ppgtt->num_pd_pages; i++) {
ppgtt->gen8_pt_dma_addr[i] = kcalloc(GEN8_PDES_PER_PAGE,
sizeof(dma_addr_t),
- GFP_KERNEL);
+ GFP_KERNEL | __GFP_ZERO);
if (!ppgtt->gen8_pt_dma_addr[i])
return -ENOMEM;
}
@@ -421,7 +422,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;
@@ -1015,13 +1017,13 @@ static int gen6_ppgtt_allocate_page_tables(struct i915_hw_ppgtt *ppgtt)
int i;
ppgtt->pt_pages = kcalloc(ppgtt->num_pd_entries, sizeof(struct page *),
- GFP_KERNEL);
+ GFP_KERNEL | __GFP_ZERO);
if (!ppgtt->pt_pages)
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;
@@ -1046,7 +1048,7 @@ static int gen6_ppgtt_alloc(struct i915_hw_ppgtt *ppgtt)
}
ppgtt->pt_dma_addr = kcalloc(ppgtt->num_pd_entries, sizeof(dma_addr_t),
- GFP_KERNEL);
+ GFP_KERNEL | __GFP_ZERO);
if (!ppgtt->pt_dma_addr) {
drm_mm_remove_node(&ppgtt->node);
gen6_ppgtt_free(ppgtt);
--
1.9.0
next reply other threads:[~2014-02-27 18:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-27 18:30 Ben Widawsky [this message]
2014-02-28 3:47 ` [PATCH] [v2] drm/i915: Paranoia - get zeroed page table pages Ben Widawsky
2014-03-05 16:32 ` Imre Deak
2014-03-05 16:46 ` Ben Widawsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1393525802-978-1-git-send-email-benjamin.widawsky@intel.com \
--to=benjamin.widawsky@intel.com \
--cc=ben@bwidawsk.net \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.