All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH-for-5.0 v2 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through
@ 2019-12-06 17:25 Philippe Mathieu-Daudé
  2019-12-06 17:25 ` [PATCH-for-5.0 v2 1/6] hw/pci-host/i440fx: Correct the header description Philippe Mathieu-Daudé
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-06 17:25 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Michael S. Tsirkin, Markus Armbruster,
	Paolo Bonzini, Philippe Mathieu-Daudé

Introduce a kconfig selector to allow builds without Intel
Integrated Graphics Device GPU PCIe passthrough.

We keep the default as enabled.

v2:
- do not mix with vfio code (Alex)
- extract to different file to avoid #ifdef (Thomas)

Philippe Mathieu-Daudé (6):
  hw/pci-host/i440fx: Correct the header description
  hw/pci-host/i440fx: Extract PCII440FXState to "hw/pci-host/i440fx.h"
  hw/pci-host/i440fx: Use size_t to iterate over ARRAY_SIZE()
  hw/pci-host/i440fx: Use definitions instead of magic values
  hw/pci-host/i440fx: Extract the IGD Passthrough Host Bridge device
  hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge

 include/hw/pci-host/i440fx.h |  19 +++++-
 hw/pci-host/i440fx.c         | 105 +-----------------------------
 hw/pci-host/igd_pt.c         | 120 +++++++++++++++++++++++++++++++++++
 MAINTAINERS                  |   1 +
 hw/pci-host/Kconfig          |   4 ++
 hw/pci-host/Makefile.objs    |   1 +
 6 files changed, 144 insertions(+), 106 deletions(-)
 create mode 100644 hw/pci-host/igd_pt.c

-- 
2.21.0



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH-for-5.0 v2 1/6] hw/pci-host/i440fx: Correct the header description
  2019-12-06 17:25 [PATCH-for-5.0 v2 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through Philippe Mathieu-Daudé
@ 2019-12-06 17:25 ` Philippe Mathieu-Daudé
  2019-12-06 17:25 ` [PATCH-for-5.0 v2 2/6] hw/pci-host/i440fx: Extract PCII440FXState to "hw/pci-host/i440fx.h" Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-06 17:25 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Michael S. Tsirkin, Markus Armbruster,
	Paolo Bonzini, Philippe Mathieu-Daudé

Missed during the refactor in commits 14a026dd58 and 0f25d865a,
this file is now only about the i440FX chipset.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/pci-host/i440fx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c
index f27131102d..3fc94426ea 100644
--- a/hw/pci-host/i440fx.c
+++ b/hw/pci-host/i440fx.c
@@ -1,5 +1,5 @@
 /*
- * QEMU i440FX/PIIX3 PCI Bridge Emulation
+ * QEMU i440FX PCI Bridge Emulation
  *
  * Copyright (c) 2006 Fabrice Bellard
  *
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH-for-5.0 v2 2/6] hw/pci-host/i440fx: Extract PCII440FXState to "hw/pci-host/i440fx.h"
  2019-12-06 17:25 [PATCH-for-5.0 v2 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through Philippe Mathieu-Daudé
  2019-12-06 17:25 ` [PATCH-for-5.0 v2 1/6] hw/pci-host/i440fx: Correct the header description Philippe Mathieu-Daudé
@ 2019-12-06 17:25 ` Philippe Mathieu-Daudé
  2019-12-06 17:25 ` [PATCH-for-5.0 v2 3/6] hw/pci-host/i440fx: Use size_t to iterate over ARRAY_SIZE() Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-06 17:25 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Michael S. Tsirkin, Markus Armbruster,
	Paolo Bonzini, Philippe Mathieu-Daudé

Make the PCII440FXState structure public, so it can be used out of
this source file. This will allow us to extract the IGD Passthrough
Host Bridge, which is a children of the TYPE_I440FX_PCI_DEVICE.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 include/hw/pci-host/i440fx.h | 19 +++++++++++++++++--
 hw/pci-host/i440fx.c         | 18 ------------------
 2 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/include/hw/pci-host/i440fx.h b/include/hw/pci-host/i440fx.h
index f54e6466e4..cc58d82ed4 100644
--- a/include/hw/pci-host/i440fx.h
+++ b/include/hw/pci-host/i440fx.h
@@ -13,12 +13,27 @@
 
 #include "hw/hw.h"
 #include "hw/pci/pci_bus.h"
-
-typedef struct PCII440FXState PCII440FXState;
+#include "hw/pci-host/pam.h"
 
 #define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost"
 #define TYPE_I440FX_PCI_DEVICE "i440FX"
 
+#define I440FX_PCI_DEVICE(obj) \
+    OBJECT_CHECK(PCII440FXState, (obj), TYPE_I440FX_PCI_DEVICE)
+
+typedef struct PCII440FXState {
+    /*< private >*/
+    PCIDevice parent_obj;
+    /*< public >*/
+
+    MemoryRegion *system_memory;
+    MemoryRegion *pci_address_space;
+    MemoryRegion *ram_memory;
+    PAMMemoryRegion pam_regions[13];
+    MemoryRegion smram_region;
+    MemoryRegion smram, low_smram;
+} PCII440FXState;
+
 #define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX"
 
 PCIBus *i440fx_init(const char *host_type, const char *pci_type,
diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c
index 3fc94426ea..fbdc563599 100644
--- a/hw/pci-host/i440fx.c
+++ b/hw/pci-host/i440fx.c
@@ -31,7 +31,6 @@
 #include "hw/sysbus.h"
 #include "qapi/error.h"
 #include "migration/vmstate.h"
-#include "hw/pci-host/pam.h"
 #include "qapi/visitor.h"
 #include "qemu/error-report.h"
 
@@ -51,23 +50,6 @@ typedef struct I440FXState {
     uint32_t short_root_bus;
 } I440FXState;
 
-#define I440FX_PCI_DEVICE(obj) \
-    OBJECT_CHECK(PCII440FXState, (obj), TYPE_I440FX_PCI_DEVICE)
-
-struct PCII440FXState {
-    /*< private >*/
-    PCIDevice parent_obj;
-    /*< public >*/
-
-    MemoryRegion *system_memory;
-    MemoryRegion *pci_address_space;
-    MemoryRegion *ram_memory;
-    PAMMemoryRegion pam_regions[13];
-    MemoryRegion smram_region;
-    MemoryRegion smram, low_smram;
-};
-
-
 #define I440FX_PAM      0x59
 #define I440FX_PAM_SIZE 7
 #define I440FX_SMRAM    0x72
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH-for-5.0 v2 3/6] hw/pci-host/i440fx: Use size_t to iterate over ARRAY_SIZE()
  2019-12-06 17:25 [PATCH-for-5.0 v2 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through Philippe Mathieu-Daudé
  2019-12-06 17:25 ` [PATCH-for-5.0 v2 1/6] hw/pci-host/i440fx: Correct the header description Philippe Mathieu-Daudé
  2019-12-06 17:25 ` [PATCH-for-5.0 v2 2/6] hw/pci-host/i440fx: Extract PCII440FXState to "hw/pci-host/i440fx.h" Philippe Mathieu-Daudé
@ 2019-12-06 17:25 ` Philippe Mathieu-Daudé
  2019-12-06 17:25 ` [PATCH-for-5.0 v2 4/6] hw/pci-host/i440fx: Use existing definitions instead of magic values Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-06 17:25 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Michael S. Tsirkin, Markus Armbruster,
	Paolo Bonzini, Philippe Mathieu-Daudé

We don't enforce the -Wsign-conversion CPPFLAG, but it doesn't hurt
to avoid this warning:

  warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/pci-host/i440fx.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c
index fbdc563599..0cc80b276d 100644
--- a/hw/pci-host/i440fx.c
+++ b/hw/pci-host/i440fx.c
@@ -419,12 +419,11 @@ out:
 static void igd_pt_i440fx_realize(PCIDevice *pci_dev, Error **errp)
 {
     uint32_t val = 0;
-    int i, num;
+    size_t i;
     int pos, len;
     Error *local_err = NULL;
 
-    num = ARRAY_SIZE(igd_host_bridge_infos);
-    for (i = 0; i < num; i++) {
+    for (i = 0; i < ARRAY_SIZE(igd_host_bridge_infos); i++) {
         pos = igd_host_bridge_infos[i].offset;
         len = igd_host_bridge_infos[i].len;
         host_pci_config_read(pos, len, &val, &local_err);
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH-for-5.0 v2 4/6] hw/pci-host/i440fx: Use existing definitions instead of magic values
  2019-12-06 17:25 [PATCH-for-5.0 v2 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2019-12-06 17:25 ` [PATCH-for-5.0 v2 3/6] hw/pci-host/i440fx: Use size_t to iterate over ARRAY_SIZE() Philippe Mathieu-Daudé
@ 2019-12-06 17:25 ` Philippe Mathieu-Daudé
  2019-12-06 17:25 ` [PATCH-for-5.0 v2 5/6] hw/pci-host/i440fx: Extract the IGD Passthrough Host Bridge device Philippe Mathieu-Daudé
  2019-12-06 17:25 ` [PATCH-for-5.0 v2 6/6] hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge Philippe Mathieu-Daudé
  5 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-06 17:25 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Michael S. Tsirkin, Markus Armbruster,
	Paolo Bonzini, Philippe Mathieu-Daudé

Use definitions from "hw/pci/pci_regs.h".
This also helps when using git-grep.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/pci-host/i440fx.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c
index 0cc80b276d..414138595b 100644
--- a/hw/pci-host/i440fx.c
+++ b/hw/pci-host/i440fx.c
@@ -376,13 +376,13 @@ typedef struct {
 
 /* Here we just expose minimal host bridge offset subset. */
 static const IGDHostInfo igd_host_bridge_infos[] = {
-    {0x08, 2},  /* revision id */
-    {0x2c, 2},  /* sybsystem vendor id */
-    {0x2e, 2},  /* sybsystem id */
-    {0x50, 2},  /* SNB: processor graphics control register */
-    {0x52, 2},  /* processor graphics control register */
-    {0xa4, 4},  /* SNB: graphics base of stolen memory */
-    {0xa8, 4},  /* SNB: base of GTT stolen memory */
+    {PCI_REVISION_ID,         2},
+    {PCI_SUBSYSTEM_VENDOR_ID, 2},
+    {PCI_SUBSYSTEM_ID,        2},
+    {0x50,                    2}, /* SNB: processor graphics control register */
+    {0x52,                    2}, /* processor graphics control register */
+    {0xa4,                    4}, /* SNB: graphics base of stolen memory */
+    {0xa8,                    4}, /* SNB: base of GTT stolen memory */
 };
 
 static void host_pci_config_read(int pos, int len, uint32_t *val, Error **errp)
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH-for-5.0 v2 5/6] hw/pci-host/i440fx: Extract the IGD Passthrough Host Bridge device
  2019-12-06 17:25 [PATCH-for-5.0 v2 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2019-12-06 17:25 ` [PATCH-for-5.0 v2 4/6] hw/pci-host/i440fx: Use existing definitions instead of magic values Philippe Mathieu-Daudé
@ 2019-12-06 17:25 ` Philippe Mathieu-Daudé
  2019-12-06 17:25 ` [PATCH-for-5.0 v2 6/6] hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge Philippe Mathieu-Daudé
  5 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-06 17:25 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Michael S. Tsirkin, Markus Armbruster,
	Paolo Bonzini, Philippe Mathieu-Daudé

We can use a i440FX without the IGD passthrough host bridge.

Extract it into a new file, 'hw/pci-host/igd_pt.c'.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/pci-host/i440fx.c      |  84 --------------------------
 hw/pci-host/igd_pt.c      | 120 ++++++++++++++++++++++++++++++++++++++
 MAINTAINERS               |   1 +
 hw/pci-host/Makefile.objs |   1 +
 4 files changed, 122 insertions(+), 84 deletions(-)
 create mode 100644 hw/pci-host/igd_pt.c

diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c
index 414138595b..bae7b42327 100644
--- a/hw/pci-host/i440fx.c
+++ b/hw/pci-host/i440fx.c
@@ -368,89 +368,6 @@ static const TypeInfo i440fx_info = {
     },
 };
 
-/* IGD Passthrough Host Bridge. */
-typedef struct {
-    uint8_t offset;
-    uint8_t len;
-} IGDHostInfo;
-
-/* Here we just expose minimal host bridge offset subset. */
-static const IGDHostInfo igd_host_bridge_infos[] = {
-    {PCI_REVISION_ID,         2},
-    {PCI_SUBSYSTEM_VENDOR_ID, 2},
-    {PCI_SUBSYSTEM_ID,        2},
-    {0x50,                    2}, /* SNB: processor graphics control register */
-    {0x52,                    2}, /* processor graphics control register */
-    {0xa4,                    4}, /* SNB: graphics base of stolen memory */
-    {0xa8,                    4}, /* SNB: base of GTT stolen memory */
-};
-
-static void host_pci_config_read(int pos, int len, uint32_t *val, Error **errp)
-{
-    int rc, config_fd;
-    /* Access real host bridge. */
-    char *path = g_strdup_printf("/sys/bus/pci/devices/%04x:%02x:%02x.%d/%s",
-                                 0, 0, 0, 0, "config");
-
-    config_fd = open(path, O_RDWR);
-    if (config_fd < 0) {
-        error_setg_errno(errp, errno, "Failed to open: %s", path);
-        goto out;
-    }
-
-    if (lseek(config_fd, pos, SEEK_SET) != pos) {
-        error_setg_errno(errp, errno, "Failed to seek: %s", path);
-        goto out_close_fd;
-    }
-
-    do {
-        rc = read(config_fd, (uint8_t *)val, len);
-    } while (rc < 0 && (errno == EINTR || errno == EAGAIN));
-    if (rc != len) {
-        error_setg_errno(errp, errno, "Failed to read: %s", path);
-    }
-
-out_close_fd:
-    close(config_fd);
-out:
-    g_free(path);
-}
-
-static void igd_pt_i440fx_realize(PCIDevice *pci_dev, Error **errp)
-{
-    uint32_t val = 0;
-    size_t i;
-    int pos, len;
-    Error *local_err = NULL;
-
-    for (i = 0; i < ARRAY_SIZE(igd_host_bridge_infos); i++) {
-        pos = igd_host_bridge_infos[i].offset;
-        len = igd_host_bridge_infos[i].len;
-        host_pci_config_read(pos, len, &val, &local_err);
-        if (local_err) {
-            error_propagate(errp, local_err);
-            return;
-        }
-        pci_default_write_config(pci_dev, pos, val, len);
-    }
-}
-
-static void igd_passthrough_i440fx_class_init(ObjectClass *klass, void *data)
-{
-    DeviceClass *dc = DEVICE_CLASS(klass);
-    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
-
-    k->realize = igd_pt_i440fx_realize;
-    dc->desc = "IGD Passthrough Host bridge";
-}
-
-static const TypeInfo igd_passthrough_i440fx_info = {
-    .name          = TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE,
-    .parent        = TYPE_I440FX_PCI_DEVICE,
-    .instance_size = sizeof(PCII440FXState),
-    .class_init    = igd_passthrough_i440fx_class_init,
-};
-
 static const char *i440fx_pcihost_root_bus_path(PCIHostState *host_bridge,
                                                 PCIBus *rootbus)
 {
@@ -495,7 +412,6 @@ static const TypeInfo i440fx_pcihost_info = {
 static void i440fx_register_types(void)
 {
     type_register_static(&i440fx_info);
-    type_register_static(&igd_passthrough_i440fx_info);
     type_register_static(&i440fx_pcihost_info);
 }
 
diff --git a/hw/pci-host/igd_pt.c b/hw/pci-host/igd_pt.c
new file mode 100644
index 0000000000..efcc9347ff
--- /dev/null
+++ b/hw/pci-host/igd_pt.c
@@ -0,0 +1,120 @@
+/*
+ * QEMU Intel IGD Passthrough Host Bridge Emulation
+ *
+ * Copyright (c) 2006 Fabrice Bellard
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "qemu/osdep.h"
+#include "hw/pci/pci.h"
+#include "hw/pci/pci_host.h"
+#include "hw/pci-host/i440fx.h"
+#include "qapi/error.h"
+
+typedef struct {
+    uint8_t offset;
+    uint8_t len;
+} IGDHostInfo;
+
+/* Here we just expose minimal host bridge offset subset. */
+static const IGDHostInfo igd_host_bridge_infos[] = {
+    {PCI_REVISION_ID,         2},
+    {PCI_SUBSYSTEM_VENDOR_ID, 2},
+    {PCI_SUBSYSTEM_ID,        2},
+    {0x50,                    2}, /* SNB: processor graphics control register */
+    {0x52,                    2}, /* processor graphics control register */
+    {0xa4,                    4}, /* SNB: graphics base of stolen memory */
+    {0xa8,                    4}, /* SNB: base of GTT stolen memory */
+};
+
+static void host_pci_config_read(int pos, int len, uint32_t *val, Error **errp)
+{
+    int rc, config_fd;
+    /* Access real host bridge. */
+    char *path = g_strdup_printf("/sys/bus/pci/devices/%04x:%02x:%02x.%d/%s",
+                                 0, 0, 0, 0, "config");
+
+    config_fd = open(path, O_RDWR);
+    if (config_fd < 0) {
+        error_setg_errno(errp, errno, "Failed to open: %s", path);
+        goto out;
+    }
+
+    if (lseek(config_fd, pos, SEEK_SET) != pos) {
+        error_setg_errno(errp, errno, "Failed to seek: %s", path);
+        goto out_close_fd;
+    }
+
+    do {
+        rc = read(config_fd, (uint8_t *)val, len);
+    } while (rc < 0 && (errno == EINTR || errno == EAGAIN));
+    if (rc != len) {
+        error_setg_errno(errp, errno, "Failed to read: %s", path);
+    }
+
+ out_close_fd:
+    close(config_fd);
+ out:
+    g_free(path);
+}
+
+static void igd_pt_i440fx_realize(PCIDevice *pci_dev, Error **errp)
+{
+    uint32_t val = 0;
+    size_t i;
+    int pos, len;
+    Error *local_err = NULL;
+
+    for (i = 0; i < ARRAY_SIZE(igd_host_bridge_infos); i++) {
+        pos = igd_host_bridge_infos[i].offset;
+        len = igd_host_bridge_infos[i].len;
+        host_pci_config_read(pos, len, &val, &local_err);
+        if (local_err) {
+            error_propagate(errp, local_err);
+            return;
+        }
+        pci_default_write_config(pci_dev, pos, val, len);
+    }
+}
+
+static void igd_passthrough_i440fx_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+
+    k->realize = igd_pt_i440fx_realize;
+    dc->desc = "IGD Passthrough Host bridge";
+}
+
+static const TypeInfo igd_passthrough_i440fx_info = {
+    .name          = TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE,
+    .parent        = TYPE_I440FX_PCI_DEVICE,
+    .instance_size = sizeof(PCII440FXState),
+    .class_init    = igd_passthrough_i440fx_class_init,
+};
+
+static void igd_pt_i440fx_register_types(void)
+{
+    type_register_static(&igd_passthrough_i440fx_info);
+}
+
+type_init(igd_pt_i440fx_register_types)
diff --git a/MAINTAINERS b/MAINTAINERS
index 5e5e3e52d6..2822e68bfe 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1242,6 +1242,7 @@ S: Supported
 F: include/hw/i386/
 F: hw/i386/
 F: hw/pci-host/i440fx.c
+F: hw/pci-host/igd_pt.c
 F: hw/pci-host/q35.c
 F: hw/pci-host/pam.c
 F: include/hw/pci-host/i440fx.h
diff --git a/hw/pci-host/Makefile.objs b/hw/pci-host/Makefile.objs
index efd752b766..5affd21899 100644
--- a/hw/pci-host/Makefile.objs
+++ b/hw/pci-host/Makefile.objs
@@ -14,6 +14,7 @@ common-obj-$(CONFIG_VERSATILE_PCI) += versatile.o
 common-obj-$(CONFIG_PCI_SABRE) += sabre.o
 common-obj-$(CONFIG_FULONG) += bonito.o
 common-obj-$(CONFIG_PCI_I440FX) += i440fx.o
+common-obj-$(CONFIG_PCI_I440FX) += igd_pt.o
 common-obj-$(CONFIG_PCI_EXPRESS_Q35) += q35.o
 common-obj-$(CONFIG_PCI_EXPRESS_GENERIC_BRIDGE) += gpex.o
 common-obj-$(CONFIG_PCI_EXPRESS_XILINX) += xilinx-pcie.o
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH-for-5.0 v2 6/6] hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge
  2019-12-06 17:25 [PATCH-for-5.0 v2 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2019-12-06 17:25 ` [PATCH-for-5.0 v2 5/6] hw/pci-host/i440fx: Extract the IGD Passthrough Host Bridge device Philippe Mathieu-Daudé
@ 2019-12-06 17:25 ` Philippe Mathieu-Daudé
  2019-12-06 21:38   ` Alex Williamson
  5 siblings, 1 reply; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-06 17:25 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Michael S. Tsirkin, Markus Armbruster,
	Paolo Bonzini, Philippe Mathieu-Daudé

Add the INTEL_IGD_PASSTHROUGH Kconfig option.

Since it is implied by the PCI_I440FX option, this does not change
the default selection. However users are now able to deselelect it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/pci-host/Kconfig       | 4 ++++
 hw/pci-host/Makefile.objs | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/hw/pci-host/Kconfig b/hw/pci-host/Kconfig
index b0aa8351c4..8c88a7b9dd 100644
--- a/hw/pci-host/Kconfig
+++ b/hw/pci-host/Kconfig
@@ -1,6 +1,9 @@
 config PAM
     bool
 
+config INTEL_IGD_PASSTHROUGH
+    bool
+
 config PREP_PCI
     bool
     select PCI
@@ -32,6 +35,7 @@ config PCI_I440FX
     bool
     select PCI
     select PAM
+    imply INTEL_IGD_PASSTHROUGH
 
 config PCI_EXPRESS_Q35
     bool
diff --git a/hw/pci-host/Makefile.objs b/hw/pci-host/Makefile.objs
index 5affd21899..9dbd0f9042 100644
--- a/hw/pci-host/Makefile.objs
+++ b/hw/pci-host/Makefile.objs
@@ -14,7 +14,7 @@ common-obj-$(CONFIG_VERSATILE_PCI) += versatile.o
 common-obj-$(CONFIG_PCI_SABRE) += sabre.o
 common-obj-$(CONFIG_FULONG) += bonito.o
 common-obj-$(CONFIG_PCI_I440FX) += i440fx.o
-common-obj-$(CONFIG_PCI_I440FX) += igd_pt.o
+common-obj-$(CONFIG_INTEL_IGD_PASSTHROUGH) += igd_pt.o
 common-obj-$(CONFIG_PCI_EXPRESS_Q35) += q35.o
 common-obj-$(CONFIG_PCI_EXPRESS_GENERIC_BRIDGE) += gpex.o
 common-obj-$(CONFIG_PCI_EXPRESS_XILINX) += xilinx-pcie.o
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH-for-5.0 v2 6/6] hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge
  2019-12-06 17:25 ` [PATCH-for-5.0 v2 6/6] hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge Philippe Mathieu-Daudé
@ 2019-12-06 21:38   ` Alex Williamson
  0 siblings, 0 replies; 8+ messages in thread
From: Alex Williamson @ 2019-12-06 21:38 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Markus Armbruster, Thomas Huth, Paolo Bonzini, qemu-devel,
	Michael S. Tsirkin

On Fri,  6 Dec 2019 18:25:14 +0100
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:

> Add the INTEL_IGD_PASSTHROUGH Kconfig option.
> 
> Since it is implied by the PCI_I440FX option, this does not change
> the default selection. However users are now able to deselelect it.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/pci-host/Kconfig       | 4 ++++
>  hw/pci-host/Makefile.objs | 2 +-
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/pci-host/Kconfig b/hw/pci-host/Kconfig
> index b0aa8351c4..8c88a7b9dd 100644
> --- a/hw/pci-host/Kconfig
> +++ b/hw/pci-host/Kconfig
> @@ -1,6 +1,9 @@
>  config PAM
>      bool
>  
> +config INTEL_IGD_PASSTHROUGH
> +    bool

I'd be tempted to suggest a 'depends on XEN' here and maybe use XEN in
the config name and perhaps the file name in patch 5/6 as well.
There's already confusion as to the extent that this is used
generically between both Xen and vfio assignment (it's not), so might as
well take this opportunity.  Thanks,

Alex

> +
>  config PREP_PCI
>      bool
>      select PCI
> @@ -32,6 +35,7 @@ config PCI_I440FX
>      bool
>      select PCI
>      select PAM
> +    imply INTEL_IGD_PASSTHROUGH
>  
>  config PCI_EXPRESS_Q35
>      bool
> diff --git a/hw/pci-host/Makefile.objs b/hw/pci-host/Makefile.objs
> index 5affd21899..9dbd0f9042 100644
> --- a/hw/pci-host/Makefile.objs
> +++ b/hw/pci-host/Makefile.objs
> @@ -14,7 +14,7 @@ common-obj-$(CONFIG_VERSATILE_PCI) += versatile.o
>  common-obj-$(CONFIG_PCI_SABRE) += sabre.o
>  common-obj-$(CONFIG_FULONG) += bonito.o
>  common-obj-$(CONFIG_PCI_I440FX) += i440fx.o
> -common-obj-$(CONFIG_PCI_I440FX) += igd_pt.o
> +common-obj-$(CONFIG_INTEL_IGD_PASSTHROUGH) += igd_pt.o
>  common-obj-$(CONFIG_PCI_EXPRESS_Q35) += q35.o
>  common-obj-$(CONFIG_PCI_EXPRESS_GENERIC_BRIDGE) += gpex.o
>  common-obj-$(CONFIG_PCI_EXPRESS_XILINX) += xilinx-pcie.o



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-12-06 21:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-06 17:25 [PATCH-for-5.0 v2 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through Philippe Mathieu-Daudé
2019-12-06 17:25 ` [PATCH-for-5.0 v2 1/6] hw/pci-host/i440fx: Correct the header description Philippe Mathieu-Daudé
2019-12-06 17:25 ` [PATCH-for-5.0 v2 2/6] hw/pci-host/i440fx: Extract PCII440FXState to "hw/pci-host/i440fx.h" Philippe Mathieu-Daudé
2019-12-06 17:25 ` [PATCH-for-5.0 v2 3/6] hw/pci-host/i440fx: Use size_t to iterate over ARRAY_SIZE() Philippe Mathieu-Daudé
2019-12-06 17:25 ` [PATCH-for-5.0 v2 4/6] hw/pci-host/i440fx: Use existing definitions instead of magic values Philippe Mathieu-Daudé
2019-12-06 17:25 ` [PATCH-for-5.0 v2 5/6] hw/pci-host/i440fx: Extract the IGD Passthrough Host Bridge device Philippe Mathieu-Daudé
2019-12-06 17:25 ` [PATCH-for-5.0 v2 6/6] hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge Philippe Mathieu-Daudé
2019-12-06 21:38   ` Alex Williamson

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.