From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: "G.R." <firemeteor@users.sourceforge.net>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
intel-gfx@lists.freedesktop.org, "Dong,
Eddie" <eddie.dong@intel.com>,
"Xu, Dongxiao" <dongxiao.xu@intel.com>,
"Zhang, Xiantao" <xiantao.zhang@intel.com>
Subject: Re: [PATCH] Fix intel_detect_pch() to work in xen environment.
Date: Tue, 18 Dec 2012 10:20:12 -0800 [thread overview]
Message-ID: <20121218102012.1866ea85@jbarnes-desktop> (raw)
In-Reply-To: <CAKhsbWZOgtEF1JWzAFk57exc4Phk06sSG0g1g6W9xse0tCijig@mail.gmail.com>
On Wed, 19 Dec 2012 01:43:22 +0800
"G.R." <firemeteor@users.sourceforge.net> wrote:
> On Wed, Dec 19, 2012 at 12:53 AM, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> > On Wed, 19 Dec 2012 00:49:28 +0800
> > "G.R." <firemeteor@users.sourceforge.net> wrote:
> >
> >> 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");
> >> }
> >> }
> >>
> >
> > I'd like to see a comment about this being for Xen in here, and I
> > wonder if there are other places where we might have to worry about the
> > Xen implementation. In that case, setting a flag in dev_priv when we
> > don't find the PCH where we expect would be a good idea too.
> >
>
> I can add a comment here if the overall idea is acceptable to you.
> But there is already a comment mentioning that the ISA bridge check is
> for virtualization:
>
> 404 /*
> 405 * The reason to probe ISA bridge instead of Dev31:Fun0 is to
> 406 * make graphics device passthrough work easy for VMM, that only
> 407 * need to expose ISA bridge to let driver know the real hardware
> 408 * underneath. This is a requirement from virtualization team.
> 409 */
>
> > Ack on the general idea though; I'd like us to be able to run under Xen
> > without modification.
> >
>
> Stefano may be able to comment if it's feasible to achieve zero
> modification in this case.
> I believe this has something to do with getting rid of the PIIX3
> device provided by qemu.
>
> But generally I think it's very hard to achieve perfect emulation.
> You can't always foresee what assumption a guest driver would make.
> Maybe we need some compromise.
I meant that I'd like to see any other patches required for Xen get
merged, that way people won't have to patch their kernels for i915
under Xen.
--
Jesse Barnes, Intel Open Source Technology Center
next prev parent reply other threads:[~2012-12-18 18:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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.
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=20121218102012.1866ea85@jbarnes-desktop \
--to=jbarnes@virtuousgeek.org \
--cc=dongxiao.xu@intel.com \
--cc=eddie.dong@intel.com \
--cc=firemeteor@users.sourceforge.net \
--cc=intel-gfx@lists.freedesktop.org \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xiantao.zhang@intel.com \
/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 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).