All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tiejun Chen <tiejun.chen@intel.com>
To: mst@redhat.com, pbonzini@redhat.com, rth@twiddle.net,
	aliguori@amazon.com
Cc: xen-devel@lists.xensource.com, allen.m.kay@intel.com,
	qemu-devel@nongnu.org
Subject: [Qemu-devel] [RFC][PATCH 2/2] xen:i386:pc_piix: create isa bridge specific to IGD passthrough
Date: Wed,  5 Nov 2014 15:22:59 +0800	[thread overview]
Message-ID: <1415172179-7965-2-git-send-email-tiejun.chen@intel.com> (raw)
In-Reply-To: <1415172179-7965-1-git-send-email-tiejun.chen@intel.com>

Currently IGD drivers always need to access PCH by 1f.0, and
PCH vendor/device id is used to identify the card.

Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
---
 hw/i386/pc_piix.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index b559181..b19c7a9 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -50,7 +50,7 @@
 #include "cpu.h"
 #include "qemu/error-report.h"
 #ifdef CONFIG_XEN
-#  include <xen/hvm/hvm_info_table.h>
+#include <xen/hvm/hvm_info_table.h>
 #endif
 
 #define MAX_IDE_BUS 2
@@ -452,6 +452,31 @@ static void pc_init_isa(MachineState *machine)
 }
 
 #ifdef CONFIG_XEN
+static void xen_igd_passthrough_isa_bridge_create(PCIBus *bus)
+{
+    struct PCIDevice *dev;
+    Error *local_err = NULL;
+    uint16_t device_id = 0xffff;
+
+    /* Currently IGD drivers always need to access PCH by 1f.0. */
+    dev = pci_create_simple(bus, PCI_DEVFN(0x1f, 0),
+                            "xen-igd-passthrough-isa-bridge");
+
+    /* Identify PCH card with its own real vendor/device ids.
+     * Here that vendor id is always PCI_VENDOR_ID_INTEL.
+     */
+    if (dev) {
+        device_id = object_property_get_int(OBJECT(dev), "device-id",
+                                            &local_err);
+        if (!local_err && device_id != 0xffff) {
+            pci_config_set_device_id(dev->config, device_id);
+            return;
+        }
+    }
+
+    fprintf(stderr, "xen set xen-igd-passthrough-isa-bridge failed\n");
+}
+
 static void pc_xen_hvm_init(MachineState *machine)
 {
     PCIBus *bus;
@@ -461,6 +486,7 @@ static void pc_xen_hvm_init(MachineState *machine)
     bus = pci_find_primary_bus();
     if (bus != NULL) {
         pci_create_simple(bus, -1, "xen-platform");
+        xen_igd_passthrough_isa_bridge_create(bus);
     }
 }
 #endif
-- 
1.9.1

WARNING: multiple messages have this Message-ID (diff)
From: Tiejun Chen <tiejun.chen@intel.com>
To: mst@redhat.com, pbonzini@redhat.com, rth@twiddle.net,
	aliguori@amazon.com
Cc: xen-devel@lists.xensource.com, allen.m.kay@intel.com,
	qemu-devel@nongnu.org
Subject: [RFC][PATCH 2/2] xen:i386:pc_piix: create isa bridge specific to IGD passthrough
Date: Wed,  5 Nov 2014 15:22:59 +0800	[thread overview]
Message-ID: <1415172179-7965-2-git-send-email-tiejun.chen@intel.com> (raw)
In-Reply-To: <1415172179-7965-1-git-send-email-tiejun.chen@intel.com>

Currently IGD drivers always need to access PCH by 1f.0, and
PCH vendor/device id is used to identify the card.

Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
---
 hw/i386/pc_piix.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index b559181..b19c7a9 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -50,7 +50,7 @@
 #include "cpu.h"
 #include "qemu/error-report.h"
 #ifdef CONFIG_XEN
-#  include <xen/hvm/hvm_info_table.h>
+#include <xen/hvm/hvm_info_table.h>
 #endif
 
 #define MAX_IDE_BUS 2
@@ -452,6 +452,31 @@ static void pc_init_isa(MachineState *machine)
 }
 
 #ifdef CONFIG_XEN
+static void xen_igd_passthrough_isa_bridge_create(PCIBus *bus)
+{
+    struct PCIDevice *dev;
+    Error *local_err = NULL;
+    uint16_t device_id = 0xffff;
+
+    /* Currently IGD drivers always need to access PCH by 1f.0. */
+    dev = pci_create_simple(bus, PCI_DEVFN(0x1f, 0),
+                            "xen-igd-passthrough-isa-bridge");
+
+    /* Identify PCH card with its own real vendor/device ids.
+     * Here that vendor id is always PCI_VENDOR_ID_INTEL.
+     */
+    if (dev) {
+        device_id = object_property_get_int(OBJECT(dev), "device-id",
+                                            &local_err);
+        if (!local_err && device_id != 0xffff) {
+            pci_config_set_device_id(dev->config, device_id);
+            return;
+        }
+    }
+
+    fprintf(stderr, "xen set xen-igd-passthrough-isa-bridge failed\n");
+}
+
 static void pc_xen_hvm_init(MachineState *machine)
 {
     PCIBus *bus;
@@ -461,6 +486,7 @@ static void pc_xen_hvm_init(MachineState *machine)
     bus = pci_find_primary_bus();
     if (bus != NULL) {
         pci_create_simple(bus, -1, "xen-platform");
+        xen_igd_passthrough_isa_bridge_create(bus);
     }
 }
 #endif
-- 
1.9.1

  reply	other threads:[~2014-11-05  7:28 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-05  7:22 [Qemu-devel] [RFC][PATCH 1/2] hw:xen:xen_pt: register isa bridge specific to IGD passthrough Tiejun Chen
2014-11-05  7:22 ` Tiejun Chen
2014-11-05  7:22 ` Tiejun Chen [this message]
2014-11-05  7:22   ` [RFC][PATCH 2/2] xen:i386:pc_piix: create " Tiejun Chen
2014-11-05 14:09   ` [Qemu-devel] " Michael S. Tsirkin
2014-11-05 14:09     ` Michael S. Tsirkin
2014-11-17  2:47     ` [Qemu-devel] " Chen, Tiejun
2014-11-17  2:47       ` Chen, Tiejun
2014-11-17  6:10       ` [Qemu-devel] " Michael S. Tsirkin
2014-11-17  6:10         ` Michael S. Tsirkin
2014-11-17  8:48         ` [Qemu-devel] " Chen, Tiejun
2014-11-17  8:48           ` Chen, Tiejun
2014-11-17  9:25           ` [Qemu-devel] " Michael S. Tsirkin
2014-11-17  9:25             ` Michael S. Tsirkin
2014-11-17  9:42             ` [Qemu-devel] " Chen, Tiejun
2014-11-17  9:42               ` Chen, Tiejun
2014-11-17 10:13               ` [Qemu-devel] " Michael S. Tsirkin
2014-11-17 10:13                 ` Michael S. Tsirkin
2014-11-17 11:18                 ` [Qemu-devel] " Chen, Tiejun
2014-11-17 11:18                   ` Chen, Tiejun
2014-11-17 12:10                   ` [Qemu-devel] " Michael S. Tsirkin
2014-11-17 12:10                     ` Michael S. Tsirkin

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=1415172179-7965-2-git-send-email-tiejun.chen@intel.com \
    --to=tiejun.chen@intel.com \
    --cc=aliguori@amazon.com \
    --cc=allen.m.kay@intel.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --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 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.