diff mbox

[2/2] drm/i915: Add simulator's host bridge

Message ID 1342806210-4807-2-git-send-email-ben@bwidawsk.net (mailing list archive)
State Rejected
Headers show

Commit Message

Ben Widawsky July 20, 2012, 5:43 p.m. UTC
Add the host bridge ID used by the simulator. This was added in a
previous patch for the agp layer, but wasn't preserved here.  It also
gives us an opportunity to let the rest of the driver know we're running
as the simulator for various workarounds.

We must always do this early as it's the only way we have to detect the
simulator.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_drv.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Chris Wilson July 21, 2012, 9:42 a.m. UTC | #1
On Fri, 20 Jul 2012 10:43:30 -0700, Ben Widawsky <ben@bwidawsk.net> wrote:
> Add the host bridge ID used by the simulator. This was added in a
> previous patch for the agp layer, but wasn't preserved here.  It also
> gives us an opportunity to let the rest of the driver know we're running
> as the simulator for various workarounds.

I like how minimal this looks, though it does worry me that is a little
too easy... (Not least the question why the simulator doesn't work with
forcewake... Doesn't that strike you as odd that we have rc6 bugs and
the simulator dies... ;-)

I think I would rather see this as an intel_info so that it can be
expanded upon simply for future/past simulators.

However, the fundamental question is do we ever ship simulators? If we
try to avoid carrying pre-production w/a, shouldn't that mean that we
don't even contemplate pushing simulator interfaces.

Having said, carrying these patches centrally does mean that will be
reviewed and kept in mind for future iterations.
-Chris
Ben Widawsky July 21, 2012, 2:52 p.m. UTC | #2
On Sat, 21 Jul 2012 10:42:13 +0100
Chris Wilson <chris@chris-wilson.co.uk> wrote:

> On Fri, 20 Jul 2012 10:43:30 -0700, Ben Widawsky <ben@bwidawsk.net>
> wrote:
> > Add the host bridge ID used by the simulator. This was added in a
> > previous patch for the agp layer, but wasn't preserved here.  It
> > also gives us an opportunity to let the rest of the driver know
> > we're running as the simulator for various workarounds.
> 
> I like how minimal this looks, though it does worry me that is a
> little too easy... (Not least the question why the simulator doesn't
> work with forcewake... Doesn't that strike you as odd that we have
> rc6 bugs and the simulator dies... ;-)

At some point I should go through the simulator code... Actually it's a
bit complicated, but the forcewake handshake doesn't normally even make
it to the simulator. I'll follow up with you on irc if you care
further than that. An added bonus though is register accesses are quite
slow, and removing these is in itself quite beneficial (not measured).

> 
> I think I would rather see this as an intel_info so that it can be
> expanded upon simply for future/past simulators.

I tried to go this path. The immediate hack, and problem is I can't
detect the simulator until we probe the host bridge. All the INTEL_INFO
stuff is const. I tried INTEL_INFO(dev)->is_simulator=true. Now the
issue with setting up real structures for simulators... Instead I
propose we want to treat the simulator transparently as much as
possible. The only entirely unavoidable bit I've found so far is the
host bridge PCI id, and in fact it was the case at least until
forcewake on Haswell. I'd like to model the simulator as a quirky
platform instead of a quirky GPU. If we go the INTEL_INFO path we end
up with a simulator variant of each generation (analogous to
is_mobile/desktop) which I see as just superflous typing.

> 
> However, the fundamental question is do we ever ship simulators? If we
> try to avoid carrying pre-production w/a, shouldn't that mean that we
> don't even contemplate pushing simulator interfaces.

I am certain nobody would say we will *never* ship a simulator. We have
internal customers though that benefit from this.

> 
> Having said, carrying these patches centrally does mean that will be
> reviewed and kept in mind for future iterations.

Yes, more importantly, we can clone a repo, build it, and it will
just run.

> -Chris
> 

Thank you for reviewing.
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 72e86a7..ebaaea1 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -387,6 +387,7 @@  MODULE_DEVICE_TABLE(pci, pciidlist);
 #define INTEL_PCH_CPT_DEVICE_ID_TYPE	0x1c00
 #define INTEL_PCH_PPT_DEVICE_ID_TYPE	0x1e00
 #define INTEL_PCH_LPT_DEVICE_ID_TYPE	0x8c00
+#define INTEL_PCH_HAS_DEVICE_ID_TYPE	0x7000
 
 void intel_detect_pch(struct drm_device *dev)
 {
@@ -422,6 +423,12 @@  void intel_detect_pch(struct drm_device *dev)
 				dev_priv->pch_type = PCH_LPT;
 				dev_priv->num_pch_pll = 0;
 				DRM_DEBUG_KMS("Found LynxPoint PCH\n");
+			} else if (id == INTEL_PCH_HAS_DEVICE_ID_TYPE) {
+				/* XXX it is important to do this early */
+				dev_priv->is_simulator = true;
+				dev_priv->pch_type = PCH_CPT;
+				dev_priv->num_pch_pll = 2;
+				DRM_DEBUG_KMS("Found HAS PCH\n");
 			}
 			BUG_ON(dev_priv->num_pch_pll > I915_NUM_PLLS);
 		}