intel gpu passthrough: Expose vendor specific pci cap on host bridge.
PATCH 1/1 intel gpu passthrough: Expose vendor specific pci cap on host bridge.
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.
--- hw/pt-graphics.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 46 insertions(+), 5 deletions(-)
hw/pt-graphics.c +46 -5
@@ -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; }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 6 lines · Jean Guyader
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 <[email protected]>
From: Ross Philipson <[email protected]>
Jean
Ross Philipson
Acked-byQuoted 12 lines
-----Original Message-----
From: Jean Guyader [mailto:[email protected]]
Sent: Monday, January 16, 2012 10:05 AM
To: [email protected]
Cc: [email protected]; Ian Jackson; Jean Guyader; Ross Philipson
Subject: Re: [PATCH] intel gpu passthrough: Expose vendor specific pci cap on host bridge.Quoted 1 line · Jean Guyader
Quoted 8 lines
Quoted 5 lines
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 <[email protected]>From: Ross Philipson <[email protected]>
Jean
Re: [PATCH] intel gpu passthrough: Expose vendor specificpci cap on host bridge.
In reply to Jean GuyaderThis always fails because it checks cap_type before it's set. Moving the pt_pci_host_read call before the check gets rid of these messages in qemu log:
pcilib: sysfs_read: read failed: Invalid argument
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Jean Guyader
Sent: Monday, January 16, 2012 9:40 AM
To: [email protected]
Cc: [email protected]; [email protected]; Jean Guyader
Subject: [Xen-devel] [PATCH] intel gpu passthrough: Expose vendor specificpci cap on host bridge.
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.
--- hw/pt-graphics.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 46 insertions(+), 5 deletions(-)
Re: [PATCH] intel gpu passthrough: Expose vendor specificpci cap on host bridge.
Quoted 4 lines · On 17/01 02:50, [email protected] wrote:
This always fails because it checks
cap_typebefore it's set. Moving thept_pci_host_readcall before the check gets rid of these messages in qemu log:pcilib:
sysfs_read: read failed: Invalid argument
This error is due to a missing patch that should be applied before this one. I'll resend the patch within a serie that will include the extra patch.
Thanks for your review.
Jean