Skip to contentSkip to conversation

drm/i915: properly restore the ppgtt page directory on resume

PATCH In review Daniel Vetter 3 participants 5 messages Mar 21, 2012 – Mar 28, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: properly restore the ppgtt page directory on resume

The ppgtt page directory lives in a snatched part of the gtt pte range. Which naturally gets cleared on hibernate when we pull the power. Suspend to ram (which is what I've tested) works because despite the fact that this is a mmio region, it is actually back by system ram.

Fix this by moving the page directory setup code to the ppgtt init code (which gets called on resume).

This fixes hibernate on my ivb and snb.

---
 drivers/gpu/drm/i915/i915_gem.c     |   22 +++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_gem_gtt.c |    9 ---------
 2 files changed, 21 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +21 -1
index 863e14a..6ab44be 100644
@@ -3766,12 +3766,32 @@ void i915_gem_init_ppgtt(struct drm_device *dev)
 	drm_i915_private_t *dev_priv = dev->dev_private;
 	uint32_t pd_offset;
 	struct intel_ring_buffer *ring;
+	struct i915_hw_ppgtt *ppgtt = dev_priv->mm.aliasing_ppgtt;
+	uint32_t __iomem *pd_addr;
+	uint32_t pd_entry;
 	int i;
 
 	if (!dev_priv->mm.aliasing_ppgtt)
 		return;
 
-	pd_offset = dev_priv->mm.aliasing_ppgtt->pd_offset;
+
+	pd_addr = dev_priv->mm.gtt->gtt + ppgtt->pd_offset/sizeof(uint32_t);
+	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]);
+
+		pd_entry = GEN6_PDE_ADDR_ENCODE(pt_addr);
+		pd_entry |= GEN6_PDE_VALID;
+
+		writel(pd_entry, pd_addr + i);
+	}
+	readl(pd_addr);
+
+	pd_offset = ppgtt->pd_offset;
 	pd_offset /= 64; /* in cachelines, */
 	pd_offset <<= 16;
 
drivers/gpu/drm/i915/i915_gem_gtt.c +0 -9
index 72be806..99b27ff 100644
@@ -65,9 +65,7 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct i915_hw_ppgtt *ppgtt;
-	uint32_t pd_entry;
 	unsigned first_pd_entry_in_global_pt;
-	uint32_t __iomem *pd_addr;
 	int i;
 	int ret = -ENOMEM;
 
@@ -100,7 +98,6 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
 			goto err_pt_alloc;
 	}
 
-	pd_addr = dev_priv->mm.gtt->gtt + first_pd_entry_in_global_pt;
 	for (i = 0; i < ppgtt->num_pd_entries; i++) {
 		dma_addr_t pt_addr;
 		if (dev_priv->mm.gtt->needs_dmar) {
@@ -117,13 +114,7 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
 			ppgtt->pt_dma_addr[i] = pt_addr;
 		} else
 			pt_addr = page_to_phys(ppgtt->pt_pages[i]);
-
-		pd_entry = GEN6_PDE_ADDR_ENCODE(pt_addr);
-		pd_entry |= GEN6_PDE_VALID;
-
-		writel(pd_entry, pd_addr + i);
 	}
-	readl(pd_addr);
 
 	ppgtt->scratch_page_dma_addr = dev_priv->mm.gtt->scratch_page_dma;
 
Signature · 1 line
1.7.9
#1 lore raw
Quoted 40 lines · On Thu, 22 Mar 2012 00:14:43 +0100 Daniel Vetter <[email protected]> wrote:

The ppgtt page directory lives in a snatched part of the gtt pte range. Which naturally gets cleared on hibernate when we pull the power. Suspend to ram (which is what I've tested) works because despite the fact that this is a mmio region, it is actually back by system ram.

Fix this by moving the page directory setup code to the ppgtt init code (which gets called on resume).

This fixes hibernate on my ivb and snb.

---
 drivers/gpu/drm/i915/i915_gem.c     |   22 +++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_gem_gtt.c |    9 ---------
 2 files changed, 21 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +9 -1
index 863e14a..6ab44be 100644
@@ -3766,12 +3766,32 @@ void i915_gem_init_ppgtt(struct drm_device *dev)
 	drm_i915_private_t *dev_priv = dev->dev_private;
 	uint32_t pd_offset;
 	struct intel_ring_buffer *ring;
+	struct i915_hw_ppgtt *ppgtt = dev_priv->mm.aliasing_ppgtt;
+	uint32_t __iomem *pd_addr;
+	uint32_t pd_entry;
 	int i;
 
 	if (!dev_priv->mm.aliasing_ppgtt)
 		return;
 
-	pd_offset = dev_priv->mm.aliasing_ppgtt->pd_offset;
+
+	pd_addr = dev_priv->mm.gtt->gtt + ppgtt->pd_offset/sizeof(uint32_t);
+	for (i = 0; i < ppgtt->num_pd_entries; i++) {
+		dma_addr_t pt_addr;
+
+		if (dev_priv->mm.gtt->needs_dmar)

drivers/gpu/drm/i915/i915_gem.c void i915_gem_init_ppgtt(struct drm_device *dev) · line 3792

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem.c +10 -0
+			pt_addr = ppgtt->pt_dma_addr[i];
+		else
+			pt_addr = page_to_phys(ppgtt->pt_pages[i]);
+
+		pd_entry = GEN6_PDE_ADDR_ENCODE(pt_addr);
+		pd_entry |= GEN6_PDE_VALID;
+
+		writel(pd_entry, pd_addr + i);
+	}
+	readl(pd_addr);

I know I reviewed the other usage of this before, but remind me why we need readl again (comment it, maybe?).

Quoted 31 lines
drivers/gpu/drm/i915/i915_gem.c +2 -0
+
+	pd_offset = ppgtt->pd_offset;
 	pd_offset /= 64; /* in cachelines, */
 	pd_offset <<= 16;
 
drivers/gpu/drm/i915/i915_gem_gtt.c +0 -3
index 72be806..99b27ff 100644
@@ -65,9 +65,7 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct i915_hw_ppgtt *ppgtt;
-	uint32_t pd_entry;
 	unsigned first_pd_entry_in_global_pt;
-	uint32_t __iomem *pd_addr;
 	int i;
 	int ret = -ENOMEM;
 
@@ -100,7 +98,6 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
 			goto err_pt_alloc;
 	}
 
-	pd_addr = dev_priv->mm.gtt->gtt + first_pd_entry_in_global_pt;
 	for (i = 0; i < ppgtt->num_pd_entries; i++) {
 		dma_addr_t pt_addr;
 		if (dev_priv->mm.gtt->needs_dmar) {
@@ -117,13 +114,7 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
 			ppgtt->pt_dma_addr[i] = pt_addr;
 		} else
 			pt_addr = page_to_phys(ppgtt->pt_pages[i]);

drivers/gpu/drm/i915/i915_gem_gtt.c int i915_gem_init_aliasing_ppgtt(struct drm_device *dev) · line 120

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +0 -6
-
-		pd_entry = GEN6_PDE_ADDR_ENCODE(pt_addr);
-		pd_entry |= GEN6_PDE_VALID;
-
-		writel(pd_entry, pd_addr + i);
 	}
-	readl(pd_addr);
 
 	ppgtt->scratch_page_dma_addr = dev_priv->mm.gtt->scratch_page_dma;
 

It's kind of hard for me to tell that the GPU won't access anything on resume that might kill things before hitting init_ppgtt. Do you think it makes sense to disable ppgtt before suspending?

#2 lore raw
Quoted 48 lines · Ben Widawsky
Quoted 45 lines · On Thu, 22 Mar 2012 00:14:43 +0100 Daniel Vetter <[email protected]> wrote:

The ppgtt page directory lives in a snatched part of the gtt pte range. Which naturally gets cleared on hibernate when we pull the power. Suspend to ram (which is what I've tested) works because despite the fact that this is a mmio region, it is actually back by system ram.

Fix this by moving the page directory setup code to the ppgtt init code (which gets called on resume).

This fixes hibernate on my ivb and snb.

---
 drivers/gpu/drm/i915/i915_gem.c     |   22 +++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_gem_gtt.c |    9 ---------
 2 files changed, 21 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +14 -1
index 863e14a..6ab44be 100644
@@ -3766,12 +3766,32 @@ void i915_gem_init_ppgtt(struct drm_device *dev)
 	drm_i915_private_t *dev_priv = dev->dev_private;
 	uint32_t pd_offset;
 	struct intel_ring_buffer *ring;
+	struct i915_hw_ppgtt *ppgtt = dev_priv->mm.aliasing_ppgtt;
+	uint32_t __iomem *pd_addr;
+	uint32_t pd_entry;
 	int i;
 
 	if (!dev_priv->mm.aliasing_ppgtt)
 		return;
 
-	pd_offset = dev_priv->mm.aliasing_ppgtt->pd_offset;
+
+	pd_addr = dev_priv->mm.gtt->gtt + ppgtt->pd_offset/sizeof(uint32_t);
+	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]);
+
+		pd_entry = GEN6_PDE_ADDR_ENCODE(pt_addr);
Quoted 8 lines

drivers/gpu/drm/i915/i915_gem.c void i915_gem_init_ppgtt(struct drm_device *dev) · line 3792

Quoted 5 lines
drivers/gpu/drm/i915/i915_gem.c +5 -0
+		pd_entry |= GEN6_PDE_VALID;
+
+		writel(pd_entry, pd_addr + i);
+	}
+	readl(pd_addr);

I know I reviewed the other usage of this before, but remind me why we need readl again (comment it, maybe?).

The hw intercepts these mmio writes before it forwards them to memory to shoot down any system agent tlbs (i.e. for cpu access). Before we can clain to have set up global gtt entries we need to read back (so that the hw can stall us until it has finished tlb flushing). Standard procedure to ensure the hw sees the mmio ordering we want it to see, no comment needed imo.

Quoted 39 lines
Quoted 39 lines
drivers/gpu/drm/i915/i915_gem.c +2 -0
+
+	pd_offset = ppgtt->pd_offset;
 	pd_offset /= 64; /* in cachelines, */
 	pd_offset <<= 16;
 
drivers/gpu/drm/i915/i915_gem_gtt.c +0 -9
index 72be806..99b27ff 100644
@@ -65,9 +65,7 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct i915_hw_ppgtt *ppgtt;
-	uint32_t pd_entry;
 	unsigned first_pd_entry_in_global_pt;
-	uint32_t __iomem *pd_addr;
 	int i;
 	int ret = -ENOMEM;
 
@@ -100,7 +98,6 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
 			goto err_pt_alloc;
 	}
 
-	pd_addr = dev_priv->mm.gtt->gtt + first_pd_entry_in_global_pt;
 	for (i = 0; i < ppgtt->num_pd_entries; i++) {
 		dma_addr_t pt_addr;
 		if (dev_priv->mm.gtt->needs_dmar) {
@@ -117,13 +114,7 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
 			ppgtt->pt_dma_addr[i] = pt_addr;
 		} else
 			pt_addr = page_to_phys(ppgtt->pt_pages[i]);
-
-		pd_entry = GEN6_PDE_ADDR_ENCODE(pt_addr);
-		pd_entry |= GEN6_PDE_VALID;
-
-		writel(pd_entry, pd_addr + i);
 	}
-	readl(pd_addr);
 
Quoted 6 lines

drivers/gpu/drm/i915/i915_gem_gtt.c int i915_gem_init_aliasing_ppgtt(struct drm_device *dev) · line 120

Quoted 2 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +0 -0
 	ppgtt->scratch_page_dma_addr = dev_priv->mm.gtt->scratch_page_dma;
 

It's kind of hard for me to tell that the GPU won't access anything on resume that might kill things before hitting init_ppgtt. Do you think it makes sense to disable ppgtt before suspending?

Afaik yanking the power does that for us - before I've re-enabled ppgtt on the resume path (the bit frobbing, not the page directory restoring) the hw just kept on using global gtt.
-Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
Reviewed-by
#3 lore raw
Quoted 60 lines · On Wed, 28 Mar 2012 09:05:52 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 50 lines · Ben Widawsky
Quoted 47 lines · On Thu, 22 Mar 2012 00:14:43 +0100 Daniel Vetter <[email protected]> wrote:

The ppgtt page directory lives in a snatched part of the gtt pte range. Which naturally gets cleared on hibernate when we pull the power. Suspend to ram (which is what I've tested) works because despite the fact that this is a mmio region, it is actually back by system ram.

Fix this by moving the page directory setup code to the ppgtt init code (which gets called on resume).

This fixes hibernate on my ivb and snb.

---
 drivers/gpu/drm/i915/i915_gem.c     |   22 +++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_gem_gtt.c |    9 ---------
 2 files changed, 21 insertions(+), 10 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/i915_gem.c index 863e14a..6ab44be 100644

drivers/gpu/drm/i915/i915_gem.c +12 -1
@@ -3766,12 +3766,32 @@ void i915_gem_init_ppgtt(struct
 drm_device *dev) drm_i915_private_t *dev_priv = dev->dev_private;
 	uint32_t pd_offset;
 	struct intel_ring_buffer *ring;
+	struct i915_hw_ppgtt *ppgtt =
 dev_priv->mm.aliasing_ppgtt;
+	uint32_t __iomem *pd_addr;
+	uint32_t pd_entry;
 	int i;
 
 	if (!dev_priv->mm.aliasing_ppgtt)
 		return;
 
-	pd_offset = dev_priv->mm.aliasing_ppgtt->pd_offset;
+
+	pd_addr = dev_priv->mm.gtt->gtt +
 ppgtt->pd_offset/sizeof(uint32_t);
+	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]); +

drivers/gpu/drm/i915/i915_gem.c +1 -0
+		pd_entry = GEN6_PDE_ADDR_ENCODE(pt_addr);
Quoted 8 lines

drivers/gpu/drm/i915/i915_gem.c void i915_gem_init_ppgtt(struct drm_device *dev) · line 3792

Quoted 5 lines
drivers/gpu/drm/i915/i915_gem.c +5 -0
+		pd_entry |= GEN6_PDE_VALID;
+
+		writel(pd_entry, pd_addr + i);
+	}
+	readl(pd_addr);

I know I reviewed the other usage of this before, but remind me why we need readl again (comment it, maybe?).

Quoted 6 lines

The hw intercepts these mmio writes before it forwards them to memory to shoot down any system agent tlbs (i.e. for cpu access). Before we can clain to have set up global gtt entries we need to read back (so that the hw can stall us until it has finished tlb flushing). Standard procedure to ensure the hw sees the mmio ordering we want it to see, no comment needed imo.

Since your patch is simply moving this logic around, I don't think it's worth debating this too much further...
I didn't understand your explanation. Are you saying you are using this as an I/O barrier? Any reason why wmb() is not sufficient?

Quoted 47 lines
Quoted 40 lines
Quoted 40 lines
drivers/gpu/drm/i915/i915_gem.c +2 -0
+
+	pd_offset = ppgtt->pd_offset;
 	pd_offset /= 64; /* in cachelines, */
 	pd_offset <<= 16;
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/i915_gem_gtt.c index 72be806..99b27ff 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c

drivers/gpu/drm/i915/i915_gem_gtt.c +0 -3
@@ -65,9 +65,7 @@ int i915_gem_init_aliasing_ppgtt(struct
 drm_device *dev) {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct i915_hw_ppgtt *ppgtt;
-	uint32_t pd_entry;
 	unsigned first_pd_entry_in_global_pt;
-	uint32_t __iomem *pd_addr;
 	int i;
 	int ret = -ENOMEM;
 
@@ -100,7 +98,6 @@ int i915_gem_init_aliasing_ppgtt(struct
 drm_device *dev) goto err_pt_alloc;
 	}
 
-	pd_addr = dev_priv->mm.gtt->gtt +

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

drivers/gpu/drm/i915/i915_gem_gtt.c +0 -0
 		if (dev_priv->mm.gtt->needs_dmar) {
@@ -117,13 +114,7 @@ int i915_gem_init_aliasing_ppgtt(struct
 drm_device *dev) ppgtt->pt_dma_addr[i] = pt_addr;
 		} else
 			pt_addr =

page_to_phys(ppgtt->pt_pages[i]); -

drivers/gpu/drm/i915/i915_gem_gtt.c +0 -5
-		pd_entry = GEN6_PDE_ADDR_ENCODE(pt_addr);
-		pd_entry |= GEN6_PDE_VALID;
-
-		writel(pd_entry, pd_addr + i);
 	}
-	readl(pd_addr);
Quoted 6 lines
Quoted 2 lines

ppgtt->scratch_page_dma_addr =
dev_priv->mm.gtt->scratch_page_dma;

It's kind of hard for me to tell that the GPU won't access anything on resume that might kill things before hitting init_ppgtt. Do you think it makes sense to disable ppgtt before suspending?

Quoted 3 lines

Afaik yanking the power does that for us - before I've re-enabled ppgtt on the resume path (the bit frobbing, not the page directory restoring) the hw just kept on using global gtt.

Again since this is just moving code around, I don't think further discussion here is required.

Quoted 1 line

-Daniel

#4 lore raw

NVM, Jesse has corrected me on IRC.

Quoted 137 lines · On Wed, 28 Mar 2012 10:04:09 -0700 Ben Widawsky <[email protected]> wrote:
Quoted 60 lines · On Wed, 28 Mar 2012 09:05:52 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 50 lines · Ben Widawsky
Quoted 47 lines · On Thu, 22 Mar 2012 00:14:43 +0100 Daniel Vetter <[email protected]> wrote:

The ppgtt page directory lives in a snatched part of the gtt pte range. Which naturally gets cleared on hibernate when we pull the power. Suspend to ram (which is what I've tested) works because despite the fact that this is a mmio region, it is actually back by system ram.

Fix this by moving the page directory setup code to the ppgtt init code (which gets called on resume).

This fixes hibernate on my ivb and snb.

---
 drivers/gpu/drm/i915/i915_gem.c     |   22

+++++++++++++++++++++- drivers/gpu/drm/i915/i915_gem_gtt.c | 9 --------- 2 files changed, 21 insertions(+), 10 deletions(-)

(quoted diff) +0 -0

b/drivers/gpu/drm/i915/i915_gem.c index 863e14a..6ab44be 100644

drivers/gpu/drm/i915/i915_gem.c +0 -0
@@ -3766,12 +3766,32 @@ void i915_gem_init_ppgtt(struct

drm_device *dev) drm_i915_private_t *dev_priv =
dev->dev_private; uint32_t pd_offset;

drivers/gpu/drm/i915/i915_gem.c +1 -0
 	struct intel_ring_buffer *ring;
+	struct i915_hw_ppgtt *ppgtt =

dev_priv->mm.aliasing_ppgtt;

drivers/gpu/drm/i915/i915_gem.c +4 -1
+	uint32_t __iomem *pd_addr;
+	uint32_t pd_entry;
 	int i;
 
 	if (!dev_priv->mm.aliasing_ppgtt)
 		return;
 
-	pd_offset = dev_priv->mm.aliasing_ppgtt->pd_offset;
+
+	pd_addr = dev_priv->mm.gtt->gtt +

ppgtt->pd_offset/sizeof(uint32_t);

drivers/gpu/drm/i915/i915_gem.c +7 -0
+	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]); +

drivers/gpu/drm/i915/i915_gem.c +1 -0
+		pd_entry = GEN6_PDE_ADDR_ENCODE(pt_addr);
Quoted 8 lines

drivers/gpu/drm/i915/i915_gem.c void i915_gem_init_ppgtt(struct drm_device *dev) · line 3792

Quoted 5 lines
drivers/gpu/drm/i915/i915_gem.c +5 -0
+		pd_entry |= GEN6_PDE_VALID;
+
+		writel(pd_entry, pd_addr + i);
+	}
+	readl(pd_addr);

I know I reviewed the other usage of this before, but remind me why we need readl again (comment it, maybe?).

Quoted 6 lines

The hw intercepts these mmio writes before it forwards them to memory to shoot down any system agent tlbs (i.e. for cpu access). Before we can clain to have set up global gtt entries we need to read back (so that the hw can stall us until it has finished tlb flushing). Standard procedure to ensure the hw sees the mmio ordering we want it to see, no comment needed imo.

Since your patch is simply moving this logic around, I don't think it's worth debating this too much further...
I didn't understand your explanation. Are you saying you are using this as an I/O barrier? Any reason why wmb() is not sufficient?

Quoted 48 lines
Quoted 40 lines
Quoted 40 lines
drivers/gpu/drm/i915/i915_gem.c +2 -0
+
+	pd_offset = ppgtt->pd_offset;
 	pd_offset /= 64; /* in cachelines, */
 	pd_offset <<= 16;
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/i915_gem_gtt.c index 72be806..99b27ff 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c

drivers/gpu/drm/i915/i915_gem_gtt.c +0 -3
@@ -65,9 +65,7 @@ int i915_gem_init_aliasing_ppgtt(struct
 drm_device *dev) {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct i915_hw_ppgtt *ppgtt;
-	uint32_t pd_entry;
 	unsigned first_pd_entry_in_global_pt;
-	uint32_t __iomem *pd_addr;
 	int i;
 	int ret = -ENOMEM;
 
@@ -100,7 +98,6 @@ int i915_gem_init_aliasing_ppgtt(struct
 drm_device *dev) goto err_pt_alloc;
 	}
 
-	pd_addr = dev_priv->mm.gtt->gtt +

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

drivers/gpu/drm/i915/i915_gem_gtt.c +0 -0
 		if (dev_priv->mm.gtt->needs_dmar) {
@@ -117,13 +114,7 @@ int i915_gem_init_aliasing_ppgtt(struct
 drm_device *dev) ppgtt->pt_dma_addr[i] = pt_addr;
 		} else
 			pt_addr =

page_to_phys(ppgtt->pt_pages[i]); -

drivers/gpu/drm/i915/i915_gem_gtt.c +0 -5
-		pd_entry = GEN6_PDE_ADDR_ENCODE(pt_addr);
-		pd_entry |= GEN6_PDE_VALID;
-
-		writel(pd_entry, pd_addr + i);
 	}
-	readl(pd_addr);
Quoted 7 lines
Quoted 2 lines

ppgtt->scratch_page_dma_addr =
dev_priv->mm.gtt->scratch_page_dma;

It's kind of hard for me to tell that the GPU won't access anything on resume that might kill things before hitting init_ppgtt. Do you think it makes sense to disable ppgtt before suspending?

Quoted 3 lines

Afaik yanking the power does that for us - before I've re-enabled ppgtt on the resume path (the bit frobbing, not the page directory restoring) the hw just kept on using global gtt.

Again since this is just moving code around, I don't think further discussion here is required.

Quoted 1 line

-Daniel

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx