Skip to contentSkip to conversation

drm/i915: Verify address field of PCBR register.

PATCH Superseded [email protected] 3 participants 4 messages Dec 8, 2013 – Dec 9, 2013

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 drm/i915: Verify address field of PCBR register.

From: Deepak S <[email protected]>

On VLV the PCBR register has other bits besides the pcbr address field. Verify only address field setup by BIOS to make sure we don't misinterpret the PCBR setup.

---
 drivers/gpu/drm/i915/intel_pm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +6 -1
index e6d98fe..2e1340f 100644
@@ -4036,7 +4036,12 @@ static void valleyview_setup_pctx(struct drm_device *dev)
 	int pctx_size = 24*1024;
 
 	pcbr = I915_READ(VLV_PCBR);
-	if (pcbr) {
+
+	/* PCBR Format: Bits 31:12 - Base address of Process Context
+	 * 		Bits 11:1 - Reserved
+	 * 		Bit 0 - PCBR Lock
+	 * Check only address field if already setup by BIOS */
+	if (pcbr >> 12) {
 		/* BIOS set it up already, grab the pre-alloc'd space */
 		int pcbr_offset;
 
Signature · 1 line
1.8.4.2
#1 lore raw
Quoted 16 lines · On Sun, Dec 08, 2013 at 01:52:35PM +0530, [email protected] wrote:

From: Deepak S <[email protected]>

On VLV the PCBR register has other bits besides the pcbr address field. Verify only address field setup by BIOS to make sure we don't misinterpret the PCBR setup.

---
 drivers/gpu/drm/i915/intel_pm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +0 -0
index e6d98fe..2e1340f 100644

drivers/gpu/drm/i915/intel_pm.c static void valleyview_setup_pctx(struct drm_device *dev) · line 4044

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +6 -1
@@ -4036,7 +4036,12 @@ static void valleyview_setup_pctx(struct drm_device *dev)
 	int pctx_size = 24*1024;
 
 	pcbr = I915_READ(VLV_PCBR);
-	if (pcbr) {
+
+	/* PCBR Format: Bits 31:12 - Base address of Process Context
+	 * 		Bits 11:1 - Reserved
+	 * 		Bit 0 - PCBR Lock
+	 * Check only address field if already setup by BIOS */
+	if (pcbr >> 12) {

I'd just add a VLV_PCBR_ADDR_MASK #define and & it. That's a bit more the idiom we usually use, and also allows us to ditcht the comment. You could even add a VLV_PCBR_LOCK #define if you want.
-Daniel

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +0 -0
 		/* BIOS set it up already, grab the pre-alloc'd space */
 		int pcbr_offset;
 
Signature · 6 lines
1.8.4.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#2 lore raw
In reply to [email protected]
Quoted 16 lines · On Sun, Dec 08, 2013 at 01:52:35PM +0530, [email protected] wrote:

From: Deepak S <[email protected]>

On VLV the PCBR register has other bits besides the pcbr address field. Verify only address field setup by BIOS to make sure we don't misinterpret the PCBR setup.

---
 drivers/gpu/drm/i915/intel_pm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +0 -0
index e6d98fe..2e1340f 100644

drivers/gpu/drm/i915/intel_pm.c static void valleyview_setup_pctx(struct drm_device *dev) · line 4040

Quoted 6 lines
drivers/gpu/drm/i915/intel_pm.c +2 -1
@@ -4036,7 +4036,12 @@ static void valleyview_setup_pctx(struct drm_device *dev)
 	int pctx_size = 24*1024;
 
 	pcbr = I915_READ(VLV_PCBR);
-	if (pcbr) {
+
+	/* PCBR Format: Bits 31:12 - Base address of Process Context

It's called power context, not process context.

drivers/gpu/drm/i915/intel_pm.c static void valleyview_setup_pctx(struct drm_device *dev) · line 4041

Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +1 -0
+	 * 		Bits 11:1 - Reserved

These are all 0

drivers/gpu/drm/i915/intel_pm.c static void valleyview_setup_pctx(struct drm_device *dev) · line 4042

Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +1 -0
+	 * 		Bit 0 - PCBR Lock

And if this is 1, then we can't change the address anyway, so I don't think this patch makes much sense.

Have you actually seen cases where the BIOS would be buggy enough to lock the power context addres at 0? If so, we should just scream and run away instead of blindly trying to write a new address to PCBR and pretending that things are fine after that.

Quoted 12 lines
drivers/gpu/drm/i915/intel_pm.c +2 -0
+	 * Check only address field if already setup by BIOS */
+	if (pcbr >> 12) {
 		/* BIOS set it up already, grab the pre-alloc'd space */
 		int pcbr_offset;
 
Signature · 6 lines
1.8.4.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC
author
#3 lore raw
Quoted 1 line

Have you actually seen cases where the BIOS would be buggy enough to lock the power context addres at 0? If so, we should just scream and run away instead of blindly trying to write a new address to PCBR and pretending that things are fine after that.

We had faced some issue doing the initial version of BIOS. I just verified it and it looks fine and we can ignore this patch.

I think the right fix would be to verify the pcbr lock bit and if it is set but still pcbr base address is zero then we should disable the rc6.

Thanks
Deepak

-----Original Message-----
From: Ville Syrjälä [mailto:[email protected]]
Sent: Monday, December 9, 2013 3:05 PM
To: S, Deepak
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH 1/3] drm/i915: Verify address field of PCBR register.

Quoted 16 lines · On Sun, Dec 08, 2013 at 01:52:35PM +0530, [email protected] wrote:

From: Deepak S <[email protected]>

On VLV the PCBR register has other bits besides the pcbr address field. Verify only address field setup by BIOS to make sure we don't misinterpret the PCBR setup.

---
 drivers/gpu/drm/i915/intel_pm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_pm.c index e6d98fe..2e1340f 100644

drivers/gpu/drm/i915/intel_pm.c static void valleyview_setup_pctx(struct drm_device *dev) · line 4040

Quoted 6 lines
drivers/gpu/drm/i915/intel_pm.c +2 -1
@@ -4036,7 +4036,12 @@ static void valleyview_setup_pctx(struct drm_device *dev)
 	int pctx_size = 24*1024;
 
 	pcbr = I915_READ(VLV_PCBR);
-	if (pcbr) {
+
+	/* PCBR Format: Bits 31:12 - Base address of Process Context

It's called power context, not process context.

drivers/gpu/drm/i915/intel_pm.c static void valleyview_setup_pctx(struct drm_device *dev) · line 4041

Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +1 -0
+	 * 		Bits 11:1 - Reserved

These are all 0

drivers/gpu/drm/i915/intel_pm.c static void valleyview_setup_pctx(struct drm_device *dev) · line 4042

Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +1 -0
+	 * 		Bit 0 - PCBR Lock

And if this is 1, then we can't change the address anyway, so I don't think this patch makes much sense.

Have you actually seen cases where the BIOS would be buggy enough to lock the power context addres at 0? If so, we should just scream and run away instead of blindly trying to write a new address to PCBR and pretending that things are fine after that.

Quoted 8 lines
drivers/gpu/drm/i915/intel_pm.c +2 -1
+	 * Check only address field if already setup by BIOS */
+	if (pcbr >> 12) {
 		/* BIOS set it up already, grab the pre-alloc'd space */
 		int pcbr_offset;
 
--

1.8.4.2

Quoted 4 lines

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

--
Ville Syrjälä
Intel OTC