intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix intel_detect_pch() to work in xen environment.
@ 2012-12-18 16:49 G.R.
  2012-12-18 16:53 ` Jesse Barnes
  2012-12-18 17:21 ` Ben Widawsky
  0 siblings, 2 replies; 16+ messages in thread
From: G.R. @ 2012-12-18 16:49 UTC (permalink / raw)
  To: intel-gfx; +Cc: Stefano Stabellini, Dong, Eddie, Xu, Dongxiao, Zhang, Xiantao

Hi guys,

In XEN HVM guest, there is always an emulated PIIX3 ISA bridge on slot 01.0.
This shadows the PCH ISA bridge on 1f.0 with the current
intel_detect_pch() implementation.
The issue can be easily solved by looping through all the ISA bridges
until the first match is found, instead of just check against the
first one.

Here I attach the patch I used locally. It's created on Torvalds's git.
Looking forward to your comments.

Thanks,
Timothy

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 530db83..3f7e5fb 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -408,9 +408,11 @@ void intel_detect_pch(struct drm_device *dev)
         * underneath. This is a requirement from virtualization team.
         */
        pch = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL);
-       if (pch) {
+       while (pch) {
+               struct pci_dev * curr = pch;
                if (pch->vendor == PCI_VENDOR_ID_INTEL) {
                        unsigned short id;
+                       unsigned found = 1;
                        id = pch->device & INTEL_PCH_DEVICE_ID_MASK;
                        dev_priv->pch_id = id;

@@ -440,10 +442,20 @@ void intel_detect_pch(struct drm_device *dev)
                                dev_priv->num_pch_pll = 0;
                                DRM_DEBUG_KMS("Found LynxPoint LP PCH\n");
                                WARN_ON(!IS_HASWELL(dev));
+                       } else {
+                               found = 0;
+                       }
+                       if (found) {
+                               BUG_ON(dev_priv->num_pch_pll > I915_NUM_PLLS);
+                               pci_dev_put(pch);
+                               break;
                        }
-                       BUG_ON(dev_priv->num_pch_pll > I915_NUM_PLLS);
                }
-               pci_dev_put(pch);
+               pch = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, curr);
+               pci_dev_put(curr);
+       }
+       if (!pch) {
+               DRM_DEBUG_KMS("No PCH found?\n");
        }
 }

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-06-20 12:01 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-18 16:49 [PATCH] Fix intel_detect_pch() to work in xen environment G.R.
2012-12-18 16:53 ` Jesse Barnes
2012-12-18 17:43   ` G.R.
2012-12-18 18:20     ` Jesse Barnes
2012-12-19  3:40       ` G.R.
2012-12-20  4:04       ` G.R.
2012-12-20 16:13         ` Jesse Barnes
2012-12-23  6:51           ` G.R.
2013-06-18 12:54             ` G.R.
2013-06-19  6:01               ` Daniel Vetter
2013-06-19 13:10                 ` [PATCH] Fix PCH detect with multiple ISA bridges in VM Rui Guo
2013-06-19 15:29                 ` [PATCH] Fix intel_detect_pch() to work in xen environment G.R.
2013-06-20 12:01                   ` Daniel Vetter
2013-06-19  7:57               ` Ville Syrjälä
2012-12-18 17:21 ` Ben Widawsky
2012-12-19  4:01   ` G.R.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).