All of lore.kernel.org
 help / color / mirror / Atom feed
From: "G.R." <firemeteor@users.sourceforge.net>
To: xen-devel <xen-devel@lists.xen.org>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH v2] qemu-xen:Correctly expose PCH ISA bridge for IGD passthrough
Date: Wed, 19 Dec 2012 21:06:09 +0800	[thread overview]
Message-ID: <CAKhsbWbezhvrAV=a=tvJmWosfeN0xsPb74sjqB6J9JViv2F7BQ@mail.gmail.com> (raw)

Fix IGD passthrough logic to properly expose PCH ISA bridge (instead
of exposing as pci-pci bridge). The i915 driver require this to
correctly detect the PCH version and enable version specific code
path.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Timothy Guo <firemeteor@users.sourceforge.net>

diff --git a/hw/pci.c b/hw/pci.c
index f051de1..d371bd7 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -871,11 +871,6 @@ void pci_unplug_netifs(void)
     }
 }

-typedef struct {
-    PCIDevice dev;
-    PCIBus *bus;
-} PCIBridge;
-
 void pci_bridge_write_config(
PCIDevice *d,
                              uint32_t address, uint32_t val, int len)
 {
diff --git a/hw/pci.h b/hw/pci.h
index edc58b6..c2acab9 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -222,6 +222,11 @@ struct PCIDevice {
     int irq_state[4];
 };

+typedef struct {
+    PCIDevice dev;
+    PCIBus *bus;
+} PCIBridge;
+
 extern char direct_pci_str[];
 extern int direct_pci_msitranslate;
 extern int direct_pci_power_mgmt;
diff --git a/hw/pt-graphics.c b/hw/pt-graphics.c
index c6f8869..de21f90 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,26 @@ 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) {
+        PCIBridge *s = (PCIBridge *)pci_register_device(bus, "intel_bridge_1f",
+                sizeof(PCIBridge), PCI_DEVFN(0x1f, 0), NULL,
pci_bridge_write_config);
+
+        pci_config_set_vendor_id(s->dev.config, vid);
+        pci_config_set_device_id(s->dev.config, did);
+
+        s->dev.config[PCI_COMMAND] = 0x06; // command = bus master, pci mem
+        s->dev.config[PCI_COMMAND + 1] = 0x00;
+        s->dev.config[PCI_STATUS] = 0xa0; // status = fast
back-to-back, 66MHz, no error
+        s->dev.config[PCI_STATUS + 1] = 0x00; // status = fast devsel
+        s->dev.config[PCI_REVISION] = rid;
+        s->dev.config[PCI_CLASS_PROG] = 0x00; // programming i/f
+        pci_config_set_class(s->dev.config, PCI_CLASS_BRIDGE_ISA);
+        s->dev.config[PCI_LATENCY_TIMER] = 0x10;
+        s->dev.config[PCI_HEADER_TYPE] = 0x80;
+        s->dev.config[PCI_SEC_STATUS] = 0xa0;
+
+        s->bus = pci_register_secondary_bus(&s->dev, pch_map_irq);
+    }
 }

 uint32_t igd_read_opregion(struct pt_dev *pci_dev)

         reply	other threads:[~2012-12-19 13:06 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-07 16:12 Patch series for IGD passthrough Rui Guo
2013-02-07 16:12 ` [PATCH 1/3] qemu-xen-trad/pt_msi_disable: do not clear all MSI flags Rui Guo
2013-02-07 16:12 ` [PATCH 2/3] qemu-xen-trad: Correctly expose PCH ISA bridge for IGD passthrough Rui Guo
2013-02-07 16:30   ` Jan Beulich
2013-02-07 17:43     ` G.R.
2013-02-08  7:51       ` Jan Beulich
2013-05-21 15:39         ` G.R.
2013-05-24  4:02           ` G.R.
2013-02-08 11:30       ` Stefano Stabellini
2013-02-08 11:36         ` Jan Beulich
2013-02-08 11:48           ` Stefano Stabellini
2013-05-21 15:52             ` G.R.
2013-05-21 15:57               ` Jan Beulich
2013-02-07 16:12 ` [PATCH 3/3] qemu-xen-trad: IGD passthrough: Expose vendor specific pci cap on host bridge Rui Guo
2013-02-07 16:40   ` Jan Beulich
2013-02-07 17:38     ` G.R.
2013-02-08  7:56       ` Jan Beulich
2013-06-19 10:37         ` G.R.
2013-06-21 18:03           ` Konrad Rzeszutek Wilk
2013-06-25 14:08             ` Ross Philipson
2013-06-25 14:54               ` Konrad Rzeszutek Wilk
2013-06-25 15:01                 ` Ross Philipson
2013-06-26  4:18                   ` G.R.
2013-06-26 12:53                     ` Konrad Rzeszutek Wilk
2013-06-26 17:26                       ` Ross Philipson
2013-06-27  7:27                       ` G.R.
2013-07-01 13:06                         ` Konrad Rzeszutek Wilk
2013-07-15 16:06                           ` Pasi Kärkkäinen
2013-07-15 17:47                             ` Ross Philipson
2013-07-15 22:55                               ` Pasi Kärkkäinen
2013-08-05 16:15                                 ` Pasi Kärkkäinen
2013-08-06  3:44                                   ` G.R.
2013-09-25 14:28                                     ` Pasi Kärkkäinen
2014-08-20 15:20                                     ` Pasi Kärkkäinen
2013-06-25 14:26             ` G.R.
2013-02-08 11:14 ` Patch series for IGD passthrough Stefano Stabellini
2013-03-20 17:17 ` Pasi Kärkkäinen
2013-04-15 20:48   ` Pasi Kärkkäinen
2013-04-16 10:56     ` George Dunlap
2013-04-16 15:59       ` Pasi Kärkkäinen
2013-04-18 11:48       ` Stefano Stabellini
2012-12-19 13:06         ` G.R. [this message]
2012-12-20 13:13           ` [PATCH v2] qemu-xen:Correctly expose PCH ISA bridge " Stefano Stabellini
2013-02-22 18:05           ` Ian Jackson
2013-02-25 10:10             ` Jan Beulich
2013-02-25 11:24               ` Ian Jackson
2013-02-25 11:29                 ` Jan Beulich
2013-02-25 12:49                   ` Stefano Stabellini
2013-05-07 17:12                     ` [PATCH v2] qemu-xen:Correctly expose PCH ISA bridge for IGD passthrough [and 2 more messages] Ian Jackson
2013-05-09 13:17                       ` Pasi Kärkkäinen
2013-05-10  9:12                         ` Jan Beulich
2013-05-10  9:40                           ` Pasi Kärkkäinen
2013-05-10 10:00                             ` Ian Campbell
2013-05-10 10:09                               ` George Dunlap
2013-05-10 10:33                                 ` Ian Campbell
2013-05-10 10:44                                   ` Pasi Kärkkäinen
2013-05-10 10:35                                 ` Jan Beulich
2013-02-25 16:46                   ` [PATCH v2] qemu-xen:Correctly expose PCH ISA bridge for IGD passthrough Ian Jackson
2013-04-18 11:47     ` Patch series " Stefano Stabellini
2013-05-03 15:14       ` Pasi Kärkkäinen

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='CAKhsbWbezhvrAV=a=tvJmWosfeN0xsPb74sjqB6J9JViv2F7BQ@mail.gmail.com' \
    --to=firemeteor@users.sourceforge.net \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.