G.R.
2013-Jul-24  12:38 UTC
[PATCH 2/3] V5 qemu-xen-trad: Correctly expose PCH ISA bridge for IGD passthrough
The i915 driver probes chip version through PCH ISA bridge device / vendor ID.
Previously, the PCH ISA bridge is exposed as PCI-PCI bridge in qemu-xen-trad,
which breaks the assumption of the driver. This change fixes the issue by
correctly exposing the ISA bridge to domU.
Signed-off-by: Rui Guo <firemeteor@users.sourceforge.net>
Tested-by: Rui Guo <firemeteor@users.sourceforge.net>
Acked-by:  Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
           Jan Beulich <JBeulich@suse.com>
Xen-devel: http://marc.info/?l=xen-devel&m=135548433715750
Change since last version:
  The patch itself is identical. The only thing updated is the
sign-off / ack lines.
---
 hw/pci.c         |   10 ++++++++++
 hw/pci.h         |    3 +++
 hw/pt-graphics.c |    9 ++++++---
 3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c
index f051de1..c423285 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -938,6 +938,16 @@ PCIBus *pci_bridge_init(PCIBus *bus, int devfn,
uint16_t vid, uint16_t did,
     return s->bus;
 }
+PCIBus *pci_isa_bridge_init(PCIBus *bus, int devfn, uint16_t vid, uint16_t did,
+                            uint8_t rid, pci_map_irq_fn map_irq,
const char *name)
+{
+    PCIBus *s = pci_bridge_init(bus, devfn, vid, did, rid, map_irq, name);
+
+    pci_config_set_class(s->parent_dev->config, PCI_CLASS_BRIDGE_ISA);
+    s->parent_dev->config[PCI_HEADER_TYPE] = 0x80;
+    return s;
+}
+
 int pt_chk_bar_overlap(PCIBus *bus, int devfn, uint32_t addr,
                         uint32_t size, uint8_t type)
 {
diff --git a/hw/pci.h b/hw/pci.h
index edc58b6..cacbdd2 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -271,6 +271,9 @@ void pci_info(void);
 PCIBus *pci_bridge_init(PCIBus *bus, int devfn, uint16_t vid, uint16_t did,
                         uint8_t rid, pci_map_irq_fn map_irq, const char *name);
+PCIBus *pci_isa_bridge_init(PCIBus *bus, int devfn, uint16_t vid, uint16_t did,
+                            uint8_t rid, pci_map_irq_fn map_irq,
const char *name);
+
 #define NR_PCI_FUNC          8
 #define NR_PCI_DEV           32
 #define NR_PCI_DEVFN         (NR_PCI_FUNC * NR_PCI_DEV)
diff --git a/hw/pt-graphics.c b/hw/pt-graphics.c
index c6f8869..7302b25 100644
--- a/hw/pt-graphics.c
+++ b/hw/pt-graphics.c
@@ -3,6 +3,7 @@
  */
 #include "pass-through.h"
+#include "pci.h"
 #include "pci/header.h"
 #include "pci/pci.h"
@@ -40,9 +41,11 @@ void intel_pch_init(PCIBus *bus)
     did = pt_pci_host_read(pci_dev_1f, PCI_DEVICE_ID, 2);
     rid = pt_pci_host_read(pci_dev_1f, PCI_REVISION, 1);
-    if ( vid == PCI_VENDOR_ID_INTEL )
-        pci_bridge_init(bus, PCI_DEVFN(0x1f, 0), vid, did, rid,
-                        pch_map_irq, "intel_bridge_1f");
+    if (vid == PCI_VENDOR_ID_INTEL) {
+        pci_isa_bridge_init(bus, PCI_DEVFN(0x1f, 0), vid, did, rid,
+                            pch_map_irq, "intel_bridge_1f");
+
+    }
 }
 uint32_t igd_read_opregion(struct pt_dev *pci_dev)
--
1.7.10.4
G.R.
2013-Jul-24  12:42 UTC
Fwd: [PATCH 2/3] V5 qemu-xen-trad: Correctly expose PCH ISA bridge for IGD passthrough
The i915 driver probes chip version through PCH ISA bridge device / vendor ID.
Previously, the PCH ISA bridge is exposed as PCI-PCI bridge in qemu-xen-trad,
which breaks the assumption of the driver. This change fixes the issue by
correctly exposing the ISA bridge to domU.
Signed-off-by: Rui Guo <firemeteor@users.sourceforge.net>
Tested-by: Rui Guo <firemeteor@users.sourceforge.net>
Acked-by:  Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
                  Jan Beulich <JBeulich@suse.com>
Xen-devel: http://marc.info/?l=xen-devel&m=135548433715750
Change since last version:
  The patch itself is identical. The only thing updated is the
sign-off / ack lines.
---
 hw/pci.c         |   10 ++++++++++
 hw/pci.h         |    3 +++
 hw/pt-graphics.c |    9 ++++++---
 3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c
index f051de1..c423285 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -938,6 +938,16 @@ PCIBus *pci_bridge_init(PCIBus *bus, int devfn,
uint16_t vid, uint16_t did,
     return s->bus;
 }
+PCIBus *pci_isa_bridge_init(PCIBus *bus, int devfn, uint16_t vid, uint16_t did,
+                            uint8_t rid, pci_map_irq_fn map_irq,
const char *name)
+{
+    PCIBus *s = pci_bridge_init(bus, devfn, vid, did, rid, map_irq, name);
+
+    pci_config_set_class(s->parent_dev->config, PCI_CLASS_BRIDGE_ISA);
+    s->parent_dev->config[PCI_HEADER_TYPE] = 0x80;
+    return s;
+}
+
 int pt_chk_bar_overlap(PCIBus *bus, int devfn, uint32_t addr,
                         uint32_t size, uint8_t type)
 {
diff --git a/hw/pci.h b/hw/pci.h
index edc58b6..cacbdd2 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -271,6 +271,9 @@ void pci_info(void);
 PCIBus *pci_bridge_init(PCIBus *bus, int devfn, uint16_t vid, uint16_t did,
                         uint8_t rid, pci_map_irq_fn map_irq, const char *name);
+PCIBus *pci_isa_bridge_init(PCIBus *bus, int devfn, uint16_t vid, uint16_t did,
+                            uint8_t rid, pci_map_irq_fn map_irq,
const char *name);
+
 #define NR_PCI_FUNC          8
 #define NR_PCI_DEV           32
 #define NR_PCI_DEVFN         (NR_PCI_FUNC * NR_PCI_DEV)
diff --git a/hw/pt-graphics.c b/hw/pt-graphics.c
index c6f8869..7302b25 100644
--- a/hw/pt-graphics.c
+++ b/hw/pt-graphics.c
@@ -3,6 +3,7 @@
  */
 #include "pass-through.h"
+#include "pci.h"
 #include "pci/header.h"
 #include "pci/pci.h"
@@ -40,9 +41,11 @@ void intel_pch_init(PCIBus *bus)
     did = pt_pci_host_read(pci_dev_1f, PCI_DEVICE_ID, 2);
     rid = pt_pci_host_read(pci_dev_1f, PCI_REVISION, 1);
-    if ( vid == PCI_VENDOR_ID_INTEL )
-        pci_bridge_init(bus, PCI_DEVFN(0x1f, 0), vid, did, rid,
-                        pch_map_irq, "intel_bridge_1f");
+    if (vid == PCI_VENDOR_ID_INTEL) {
+        pci_isa_bridge_init(bus, PCI_DEVFN(0x1f, 0), vid, did, rid,
+                            pch_map_irq, "intel_bridge_1f");
+
+    }
 }
 uint32_t igd_read_opregion(struct pt_dev *pci_dev)
--
1.7.10.4
Ian Jackson
2013-Aug-05  15:53 UTC
Re: [PATCH 2/3] V5 qemu-xen-trad: Correctly expose PCH ISA bridge for IGD passthrough
G.R. writes ("[Xen-devel] [PATCH 2/3] V5 qemu-xen-trad: Correctly expose
PCH ISA bridge for IGD passthrough"):> The i915 driver probes chip version through PCH ISA bridge device / vendor
ID.
> Previously, the PCH ISA bridge is exposed as PCI-PCI bridge in
qemu-xen-trad,
> which breaks the assumption of the driver. This change fixes the issue by
> correctly exposing the ISA bridge to domU.
I have applied this patch.  Sorry for the delay.
It had been corrupted by your mailer.  I had to fix it up (which I
think I have done correctly).  Please can you fix it not to linewrap
patches and not to remove trailing whitespace.  (Alternatively, if you
can''t do that, you can include a second copy of the patch as an
attachment.)
Thanks,
Ian.
G.R.
2013-Aug-06  03:39 UTC
Re: [PATCH 2/3] V5 qemu-xen-trad: Correctly expose PCH ISA bridge for IGD passthrough
On Mon, Aug 5, 2013 at 11:53 PM, Ian Jackson <Ian.Jackson@eu.citrix.com> wrote:> G.R. writes ("[Xen-devel] [PATCH 2/3] V5 qemu-xen-trad: Correctly expose PCH ISA bridge for IGD passthrough"): >> The i915 driver probes chip version through PCH ISA bridge device / vendor ID. >> Previously, the PCH ISA bridge is exposed as PCI-PCI bridge in qemu-xen-trad, >> which breaks the assumption of the driver. This change fixes the issue by >> correctly exposing the ISA bridge to domU. > > I have applied this patch. Sorry for the delay. > > It had been corrupted by your mailer. I had to fix it up (which I > think I have done correctly). Please can you fix it not to linewrap > patches and not to remove trailing whitespace. (Alternatively, if you > can''t do that, you can include a second copy of the patch as an > attachment.) >Sorry for the inconvenience I caused. Currently I''m sending this directly through Gmail. I''ll try out if there are knobs to control the wrapping. Otherwise, I''ll need to switch to a different mailer. Thanks, Timothy> Thanks, > Ian.
George Dunlap
2013-Aug-06  10:16 UTC
Re: [PATCH 2/3] V5 qemu-xen-trad: Correctly expose PCH ISA bridge for IGD passthrough
On Tue, Aug 6, 2013 at 4:39 AM, G.R. <firemeteor.guo@gmail.com> wrote:> On Mon, Aug 5, 2013 at 11:53 PM, Ian Jackson <Ian.Jackson@eu.citrix.com> wrote: >> G.R. writes ("[Xen-devel] [PATCH 2/3] V5 qemu-xen-trad: Correctly expose PCH ISA bridge for IGD passthrough"): >>> The i915 driver probes chip version through PCH ISA bridge device / vendor ID. >>> Previously, the PCH ISA bridge is exposed as PCI-PCI bridge in qemu-xen-trad, >>> which breaks the assumption of the driver. This change fixes the issue by >>> correctly exposing the ISA bridge to domU. >> >> I have applied this patch. Sorry for the delay. >> >> It had been corrupted by your mailer. I had to fix it up (which I >> think I have done correctly). Please can you fix it not to linewrap >> patches and not to remove trailing whitespace. (Alternatively, if you >> can''t do that, you can include a second copy of the patch as an >> attachment.) >> > Sorry for the inconvenience I caused. > Currently I''m sending this directly through Gmail. > I''ll try out if there are knobs to control the wrapping. > Otherwise, I''ll need to switch to a different mailer.The easiest thing we''ve found is to use git send-email (or hg email). If that''s not suitable for some reason, you can both cut-and-paste the patch (to allow for review and discussion) and add it as an attachment (for easy application). There''s some pointers to setting up git send-email here: http://wiki.xen.org/wiki/Submitting_Xen_Patches -George