From: Jean Guyader <jean.guyader@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: Ian.Jackson@eu.citrix.com, allen.m.kay@intel.com,
Jean Guyader <jean.guyader@eu.citrix.com>
Subject: [PATCH] intel gpu passthrough: Expose vendor specific pci cap on host bridge.
Date: Mon, 16 Jan 2012 14:40:27 +0000 [thread overview]
Message-ID: <1326724827-25759-1-git-send-email-jean.guyader@eu.citrix.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 349 bytes --]
Some versions of the Windows Intel GPU driver expect the vendor
PCI capability to be there on the host bridge config space when
passing through a Intel GPU.
Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
---
hw/pt-graphics.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 46 insertions(+), 5 deletions(-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-intel-gpu-passthrough-Expose-vendor-specific-pci-cap.patch --]
[-- Type: text/x-patch; name="0001-intel-gpu-passthrough-Expose-vendor-specific-pci-cap.patch", Size: 2551 bytes --]
diff --git a/hw/pt-graphics.c b/hw/pt-graphics.c
index fec7390..1120639 100644
--- a/hw/pt-graphics.c
+++ b/hw/pt-graphics.c
@@ -60,6 +60,44 @@ void igd_pci_write(PCIDevice *pci_dev, uint32_t config_addr, uint32_t val, int l
}
}
+#define PCI_INTEL_VENDOR_CAP 0x34
+#define PCI_INTEL_VENDOR_CAP_TYPE 0x09
+static uint32_t igd_pci_read_vendor_cap(PCIDevice *pci_dev, uint32_t config_addr, int len,
+ uint32_t val)
+{
+ struct pci_dev *pci_dev_host_bridge = pt_pci_get_dev(0, 0, 0);
+ uint32_t vendor_cap = 0;
+ uint32_t cap_type = 0;
+ uint32_t cap_size = 0;
+
+ vendor_cap = pt_pci_host_read(pci_dev_host_bridge, PCI_INTEL_VENDOR_CAP, 1);
+ if (config_addr == PCI_INTEL_VENDOR_CAP)
+ {
+ /* Only do the following for vendor specific caps (0x09) */
+ if (cap_type != PCI_INTEL_VENDOR_CAP_TYPE)
+ return 0;
+
+ if (vendor_cap == 0)
+ return 0;
+ }
+
+ cap_type = pt_pci_host_read(pci_dev_host_bridge, vendor_cap, 1);
+ cap_size = pt_pci_host_read(pci_dev_host_bridge, vendor_cap + 2, 1);
+
+ /* Remove the next capability link */
+ if (config_addr == vendor_cap + 1)
+ return 0;
+
+ if (config_addr >= vendor_cap &&
+ config_addr + len < vendor_cap + cap_size)
+ {
+ return pt_pci_host_read(pci_dev_host_bridge, config_addr, len);
+ }
+
+ /* -1, this function doesn't deal with this config space offset */
+ return -1;
+}
+
uint32_t igd_pci_read(PCIDevice *pci_dev, uint32_t config_addr, int len)
{
struct pci_dev *pci_dev_host_bridge = pt_pci_get_dev(0, 0, 0);
@@ -82,14 +120,17 @@ uint32_t igd_pci_read(PCIDevice *pci_dev, uint32_t config_addr, int len)
case 0xa4: /* SNB: graphics base of stolen memory */
case 0xa8: /* SNB: base of GTT stolen memory */
val = pt_pci_host_read(pci_dev_host_bridge, config_addr, len);
-#ifdef PT_DEBUG_PCI_CONFIG_ACCESS
- PT_LOG_DEV(pci_dev, "addr=%x len=%x val=%x\n",
- config_addr, len, val);
-#endif
break;
default:
- val = pci_default_read_config(pci_dev, config_addr, len);
+ val = igd_pci_read_vendor_cap(pci_dev, config_addr, len, val);
+ if (val == -1)
+ val = pci_default_read_config(pci_dev, config_addr, len);
+
}
+#ifdef PT_DEBUG_PCI_CONFIG_ACCESS
+ PT_LOG_DEV(pci_dev, "addr=%x len=%x val=%x\n",
+ config_addr, len, val);
+#endif
return val;
}
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next reply other threads:[~2012-01-16 14:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-16 14:40 Jean Guyader [this message]
2012-01-16 15:04 ` [PATCH] intel gpu passthrough: Expose vendor specific pci cap on host bridge Jean Guyader
2012-01-16 15:11 ` Ross Philipson
2012-01-17 2:50 ` [PATCH] intel gpu passthrough: Expose vendor specificpci " djmagee
2012-01-17 13:50 ` Jean Guyader
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=1326724827-25759-1-git-send-email-jean.guyader@eu.citrix.com \
--to=jean.guyader@eu.citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=allen.m.kay@intel.com \
--cc=xen-devel@lists.xensource.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).