qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-for-5.0 v3 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through
@ 2019-12-09  9:49 Philippe Mathieu-Daudé
  2019-12-09  9:49 ` [PATCH-for-5.0 v3 1/6] hw/pci-host/i440fx: Correct the header description Philippe Mathieu-Daudé
                   ` (7 more replies)
  0 siblings, 8 replies; 23+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-09  9:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Stefano Stabellini, Michael S. Tsirkin,
	Paul Durrant, Markus Armbruster, Alex Williamson, Paolo Bonzini,
	Anthony Perard, xen-devel, Philippe Mathieu-Daudé

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

This device is enabled by default on the Xen build.

v3:
- Make it Xen specific

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/xen_igd_pt.c     | 120 +++++++++++++++++++++++++++++++++++
 MAINTAINERS                  |   1 +
 hw/pci-host/Kconfig          |   5 ++
 hw/pci-host/Makefile.objs    |   1 +
 6 files changed, 145 insertions(+), 106 deletions(-)
 create mode 100644 hw/pci-host/xen_igd_pt.c

-- 
2.21.0



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

* [PATCH-for-5.0 v3 1/6] hw/pci-host/i440fx: Correct the header description
  2019-12-09  9:49 [PATCH-for-5.0 v3 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through Philippe Mathieu-Daudé
@ 2019-12-09  9:49 ` Philippe Mathieu-Daudé
  2019-12-09 10:02   ` Thomas Huth
  2019-12-09  9:49 ` [PATCH-for-5.0 v3 2/6] hw/pci-host/i440fx: Extract PCII440FXState to "hw/pci-host/i440fx.h" Philippe Mathieu-Daudé
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 23+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-09  9:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Stefano Stabellini, Michael S. Tsirkin,
	Paul Durrant, Markus Armbruster, Alex Williamson, Paolo Bonzini,
	Anthony Perard, xen-devel, 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] 23+ messages in thread

* [PATCH-for-5.0 v3 2/6] hw/pci-host/i440fx: Extract PCII440FXState to "hw/pci-host/i440fx.h"
  2019-12-09  9:49 [PATCH-for-5.0 v3 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through Philippe Mathieu-Daudé
  2019-12-09  9:49 ` [PATCH-for-5.0 v3 1/6] hw/pci-host/i440fx: Correct the header description Philippe Mathieu-Daudé
@ 2019-12-09  9:49 ` Philippe Mathieu-Daudé
  2019-12-09 10:03   ` Thomas Huth
  2019-12-09  9:49 ` [PATCH-for-5.0 v3 3/6] hw/pci-host/i440fx: Use size_t to iterate over ARRAY_SIZE() Philippe Mathieu-Daudé
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 23+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-09  9:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Stefano Stabellini, Michael S. Tsirkin,
	Paul Durrant, Markus Armbruster, Alex Williamson, Paolo Bonzini,
	Anthony Perard, xen-devel, 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] 23+ messages in thread

* [PATCH-for-5.0 v3 3/6] hw/pci-host/i440fx: Use size_t to iterate over ARRAY_SIZE()
  2019-12-09  9:49 [PATCH-for-5.0 v3 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through Philippe Mathieu-Daudé
  2019-12-09  9:49 ` [PATCH-for-5.0 v3 1/6] hw/pci-host/i440fx: Correct the header description Philippe Mathieu-Daudé
  2019-12-09  9:49 ` [PATCH-for-5.0 v3 2/6] hw/pci-host/i440fx: Extract PCII440FXState to "hw/pci-host/i440fx.h" Philippe Mathieu-Daudé
@ 2019-12-09  9:49 ` Philippe Mathieu-Daudé
  2019-12-09 10:05   ` Thomas Huth
  2019-12-09  9:50 ` [PATCH-for-5.0 v3 4/6] hw/pci-host/i440fx: Use definitions instead of magic values Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 23+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-09  9:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Stefano Stabellini, Michael S. Tsirkin,
	Paul Durrant, Markus Armbruster, Alex Williamson, Paolo Bonzini,
	Anthony Perard, xen-devel, 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] 23+ messages in thread

* [PATCH-for-5.0 v3 4/6] hw/pci-host/i440fx: Use definitions instead of magic values
  2019-12-09  9:49 [PATCH-for-5.0 v3 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2019-12-09  9:49 ` [PATCH-for-5.0 v3 3/6] hw/pci-host/i440fx: Use size_t to iterate over ARRAY_SIZE() Philippe Mathieu-Daudé
@ 2019-12-09  9:50 ` Philippe Mathieu-Daudé
  2019-12-09 10:08   ` Thomas Huth
  2019-12-09  9:50 ` [PATCH-for-5.0 v3 5/6] hw/pci-host/i440fx: Extract the IGD passthrough host bridge device Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 23+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-09  9:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Stefano Stabellini, Michael S. Tsirkin,
	Paul Durrant, Markus Armbruster, Alex Williamson, Paolo Bonzini,
	Anthony Perard, xen-devel, 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] 23+ messages in thread

* [PATCH-for-5.0 v3 5/6] hw/pci-host/i440fx: Extract the IGD passthrough host bridge device
  2019-12-09  9:49 [PATCH-for-5.0 v3 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2019-12-09  9:50 ` [PATCH-for-5.0 v3 4/6] hw/pci-host/i440fx: Use definitions instead of magic values Philippe Mathieu-Daudé
@ 2019-12-09  9:50 ` Philippe Mathieu-Daudé
  2019-12-09 10:08   ` [Xen-devel] " Durrant, Paul
  2019-12-09  9:50 ` [PATCH-for-5.0 v3 6/6] hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 23+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-09  9:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Stefano Stabellini, Michael S. Tsirkin,
	Paul Durrant, Markus Armbruster, Alex Williamson, Paolo Bonzini,
	Anthony Perard, xen-devel, 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>
---
v3:
- Rename as 'xen_igd_pt.c' (Alex Williamson)
- Add an entry in MAINTAINERS::Xen
---
 hw/pci-host/i440fx.c      |  84 --------------------------
 hw/pci-host/xen_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/xen_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/xen_igd_pt.c b/hw/pci-host/xen_igd_pt.c
new file mode 100644
index 0000000000..efcc9347ff
--- /dev/null
+++ b/hw/pci-host/xen_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..62bcf5e94e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -419,6 +419,7 @@ F: hw/block/dataplane/xen*
 F: hw/xen/
 F: hw/xenpv/
 F: hw/i386/xen/
+F: hw/pci-host/xen_igd_pt.c
 F: include/hw/block/dataplane/xen*
 F: include/hw/xen/
 F: include/sysemu/xen-mapcache.h
diff --git a/hw/pci-host/Makefile.objs b/hw/pci-host/Makefile.objs
index efd752b766..fa6d1556c0 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) += xen_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] 23+ messages in thread

* [PATCH-for-5.0 v3 6/6] hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge
  2019-12-09  9:49 [PATCH-for-5.0 v3 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2019-12-09  9:50 ` [PATCH-for-5.0 v3 5/6] hw/pci-host/i440fx: Extract the IGD passthrough host bridge device Philippe Mathieu-Daudé
@ 2019-12-09  9:50 ` Philippe Mathieu-Daudé
  2019-12-09 10:10   ` [Xen-devel] " Durrant, Paul
  2019-12-09 10:39   ` Paolo Bonzini
  2019-12-09 18:39 ` [PATCH-for-5.0 v3 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through no-reply
  2019-12-09 18:49 ` no-reply
  7 siblings, 2 replies; 23+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-09  9:50 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Stefano Stabellini, Michael S. Tsirkin,
	Paul Durrant, Markus Armbruster, Alex Williamson, Paolo Bonzini,
	Anthony Perard, xen-devel, Philippe Mathieu-Daudé

Add the XEN_IGD_PASSTHROUGH Kconfig option.

Xen build has that option selected by default. Non-Xen builds now
have to select this feature manually.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
v3: Only default with Xen (Alex Williamson)

I did not used 'depends on XEN' as suggested by Alex but
'default y if XEN', so one can build XEN without this feature
(for example, on other ARCH than X86).
---
 hw/pci-host/Kconfig       | 5 +++++
 hw/pci-host/Makefile.objs | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/hw/pci-host/Kconfig b/hw/pci-host/Kconfig
index b0aa8351c4..24ba8ea046 100644
--- a/hw/pci-host/Kconfig
+++ b/hw/pci-host/Kconfig
@@ -1,6 +1,11 @@
 config PAM
     bool
 
+config XEN_IGD_PASSTHROUGH
+    bool
+    default y if XEN
+    select PCI_I440FX
+
 config PREP_PCI
     bool
     select PCI
diff --git a/hw/pci-host/Makefile.objs b/hw/pci-host/Makefile.objs
index fa6d1556c0..9c466fab01 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) += xen_igd_pt.o
+common-obj-$(CONFIG_XEN_IGD_PASSTHROUGH) += xen_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] 23+ messages in thread

* Re: [PATCH-for-5.0 v3 1/6] hw/pci-host/i440fx: Correct the header description
  2019-12-09  9:49 ` [PATCH-for-5.0 v3 1/6] hw/pci-host/i440fx: Correct the header description Philippe Mathieu-Daudé
@ 2019-12-09 10:02   ` Thomas Huth
  2019-12-18 11:57     ` Laurent Vivier
  0 siblings, 1 reply; 23+ messages in thread
From: Thomas Huth @ 2019-12-09 10:02 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Stefano Stabellini, Michael S. Tsirkin, QEMU Trivial,
	Paul Durrant, Markus Armbruster, Alex Williamson, Paolo Bonzini,
	Anthony Perard, xen-devel

On 09/12/2019 10.49, Philippe Mathieu-Daudé wrote:
> 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
>   *
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>



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

* Re: [PATCH-for-5.0 v3 2/6] hw/pci-host/i440fx: Extract PCII440FXState to "hw/pci-host/i440fx.h"
  2019-12-09  9:49 ` [PATCH-for-5.0 v3 2/6] hw/pci-host/i440fx: Extract PCII440FXState to "hw/pci-host/i440fx.h" Philippe Mathieu-Daudé
@ 2019-12-09 10:03   ` Thomas Huth
  0 siblings, 0 replies; 23+ messages in thread
From: Thomas Huth @ 2019-12-09 10:03 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Stefano Stabellini, Michael S. Tsirkin, Paul Durrant,
	Markus Armbruster, Alex Williamson, Paolo Bonzini,
	Anthony Perard, xen-devel

On 09/12/2019 10.49, Philippe Mathieu-Daudé wrote:
> 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(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>



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

* Re: [PATCH-for-5.0 v3 3/6] hw/pci-host/i440fx: Use size_t to iterate over ARRAY_SIZE()
  2019-12-09  9:49 ` [PATCH-for-5.0 v3 3/6] hw/pci-host/i440fx: Use size_t to iterate over ARRAY_SIZE() Philippe Mathieu-Daudé
@ 2019-12-09 10:05   ` Thomas Huth
  2019-12-18 11:57     ` Laurent Vivier
  0 siblings, 1 reply; 23+ messages in thread
From: Thomas Huth @ 2019-12-09 10:05 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Stefano Stabellini, Michael S. Tsirkin, QEMU Trivial,
	Paul Durrant, Markus Armbruster, Alex Williamson, Paolo Bonzini,
	Anthony Perard, xen-devel

On 09/12/2019 10.49, Philippe Mathieu-Daudé wrote:
> 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);
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>



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

* RE: [Xen-devel] [PATCH-for-5.0 v3 5/6] hw/pci-host/i440fx: Extract the IGD passthrough host bridge device
  2019-12-09  9:50 ` [PATCH-for-5.0 v3 5/6] hw/pci-host/i440fx: Extract the IGD passthrough host bridge device Philippe Mathieu-Daudé
@ 2019-12-09 10:08   ` Durrant, Paul
  0 siblings, 0 replies; 23+ messages in thread
From: Durrant, Paul @ 2019-12-09 10:08 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Thomas Huth, Stefano Stabellini, Michael S. Tsirkin,
	Paul Durrant, Markus Armbruster, Alex Williamson,
	Marcel Apfelbaum, Paolo Bonzini, Anthony Perard, xen-devel

> -----Original Message-----
> From: Xen-devel <xen-devel-bounces@lists.xenproject.org> On Behalf Of
> Philippe Mathieu-Daudé
> Sent: 09 December 2019 09:50
> To: qemu-devel@nongnu.org
> Cc: Thomas Huth <thuth@redhat.com>; Stefano Stabellini
> <sstabellini@kernel.org>; Michael S. Tsirkin <mst@redhat.com>; Paul
> Durrant <paul@xen.org>; Markus Armbruster <armbru@redhat.com>; Alex
> Williamson <alex.williamson@redhat.com>; Marcel Apfelbaum
> <marcel.apfelbaum@gmail.com>; Paolo Bonzini <pbonzini@redhat.com>; Anthony
> Perard <anthony.perard@citrix.com>; xen-devel@lists.xenproject.org;
> Philippe Mathieu-Daudé <philmd@redhat.com>
> Subject: [Xen-devel] [PATCH-for-5.0 v3 5/6] hw/pci-host/i440fx: Extract
> the IGD passthrough host bridge device
> 
> 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>

Acked-by: Paul Durrant <paul@xen.org>

> ---
> v3:
> - Rename as 'xen_igd_pt.c' (Alex Williamson)
> - Add an entry in MAINTAINERS::Xen
> ---
>  hw/pci-host/i440fx.c      |  84 --------------------------
>  hw/pci-host/xen_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/xen_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/xen_igd_pt.c b/hw/pci-host/xen_igd_pt.c
> new file mode 100644
> index 0000000000..efcc9347ff
> --- /dev/null
> +++ b/hw/pci-host/xen_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..62bcf5e94e 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -419,6 +419,7 @@ F: hw/block/dataplane/xen*
>  F: hw/xen/
>  F: hw/xenpv/
>  F: hw/i386/xen/
> +F: hw/pci-host/xen_igd_pt.c
>  F: include/hw/block/dataplane/xen*
>  F: include/hw/xen/
>  F: include/sysemu/xen-mapcache.h
> diff --git a/hw/pci-host/Makefile.objs b/hw/pci-host/Makefile.objs
> index efd752b766..fa6d1556c0 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) += xen_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
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xenproject.org
> https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH-for-5.0 v3 4/6] hw/pci-host/i440fx: Use definitions instead of magic values
  2019-12-09  9:50 ` [PATCH-for-5.0 v3 4/6] hw/pci-host/i440fx: Use definitions instead of magic values Philippe Mathieu-Daudé
@ 2019-12-09 10:08   ` Thomas Huth
  0 siblings, 0 replies; 23+ messages in thread
From: Thomas Huth @ 2019-12-09 10:08 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Stefano Stabellini, Michael S. Tsirkin, Paul Durrant,
	Markus Armbruster, Alex Williamson, Paolo Bonzini,
	Anthony Perard, xen-devel

On 09/12/2019 10.50, Philippe Mathieu-Daudé wrote:
> 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)
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>



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

* RE: [Xen-devel] [PATCH-for-5.0 v3 6/6] hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge
  2019-12-09  9:50 ` [PATCH-for-5.0 v3 6/6] hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge Philippe Mathieu-Daudé
@ 2019-12-09 10:10   ` Durrant, Paul
  2019-12-09 10:42     ` Paolo Bonzini
  2019-12-09 10:39   ` Paolo Bonzini
  1 sibling, 1 reply; 23+ messages in thread
From: Durrant, Paul @ 2019-12-09 10:10 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Thomas Huth, Stefano Stabellini, Michael S. Tsirkin,
	Paul Durrant, Markus Armbruster, Alex Williamson,
	Marcel Apfelbaum, Paolo Bonzini, Anthony Perard, xen-devel

> -----Original Message-----
> From: Xen-devel <xen-devel-bounces@lists.xenproject.org> On Behalf Of
> Philippe Mathieu-Daudé
> Sent: 09 December 2019 09:50
> To: qemu-devel@nongnu.org
> Cc: Thomas Huth <thuth@redhat.com>; Stefano Stabellini
> <sstabellini@kernel.org>; Michael S. Tsirkin <mst@redhat.com>; Paul
> Durrant <paul@xen.org>; Markus Armbruster <armbru@redhat.com>; Alex
> Williamson <alex.williamson@redhat.com>; Marcel Apfelbaum
> <marcel.apfelbaum@gmail.com>; Paolo Bonzini <pbonzini@redhat.com>; Anthony
> Perard <anthony.perard@citrix.com>; xen-devel@lists.xenproject.org;
> Philippe Mathieu-Daudé <philmd@redhat.com>
> Subject: [Xen-devel] [PATCH-for-5.0 v3 6/6] hw/pci-host: Add Kconfig entry
> to select the IGD Passthrough Host Bridge
> 
> Add the XEN_IGD_PASSTHROUGH Kconfig option.
> 
> Xen build has that option selected by default. Non-Xen builds now
> have to select this feature manually.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> v3: Only default with Xen (Alex Williamson)
> 
> I did not used 'depends on XEN' as suggested by Alex but
> 'default y if XEN', so one can build XEN without this feature
> (for example, on other ARCH than X86).

Allowing it to be compiled out for Xen builds is quite reasonable IMO. I don't believe it is widely used.

Acked-by: Paul Durrant <paul@xen.org>

> ---
>  hw/pci-host/Kconfig       | 5 +++++
>  hw/pci-host/Makefile.objs | 2 +-
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/pci-host/Kconfig b/hw/pci-host/Kconfig
> index b0aa8351c4..24ba8ea046 100644
> --- a/hw/pci-host/Kconfig
> +++ b/hw/pci-host/Kconfig
> @@ -1,6 +1,11 @@
>  config PAM
>      bool
> 
> +config XEN_IGD_PASSTHROUGH
> +    bool
> +    default y if XEN
> +    select PCI_I440FX
> +
>  config PREP_PCI
>      bool
>      select PCI
> diff --git a/hw/pci-host/Makefile.objs b/hw/pci-host/Makefile.objs
> index fa6d1556c0..9c466fab01 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) += xen_igd_pt.o
> +common-obj-$(CONFIG_XEN_IGD_PASSTHROUGH) += xen_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
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xenproject.org
> https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH-for-5.0 v3 6/6] hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge
  2019-12-09  9:50 ` [PATCH-for-5.0 v3 6/6] hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge Philippe Mathieu-Daudé
  2019-12-09 10:10   ` [Xen-devel] " Durrant, Paul
@ 2019-12-09 10:39   ` Paolo Bonzini
  1 sibling, 0 replies; 23+ messages in thread
From: Paolo Bonzini @ 2019-12-09 10:39 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Thomas Huth, Stefano Stabellini, Michael S. Tsirkin,
	Paul Durrant, Markus Armbruster, Alex Williamson, Anthony Perard,
	xen-devel

On 09/12/19 10:50, Philippe Mathieu-Daudé wrote:
> Add the XEN_IGD_PASSTHROUGH Kconfig option.
> 
> Xen build has that option selected by default. Non-Xen builds now
> have to select this feature manually.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> v3: Only default with Xen (Alex Williamson)
> 
> I did not used 'depends on XEN' as suggested by Alex but
> 'default y if XEN', so one can build XEN without this feature
> (for example, on other ARCH than X86).
> ---
>  hw/pci-host/Kconfig       | 5 +++++
>  hw/pci-host/Makefile.objs | 2 +-
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/pci-host/Kconfig b/hw/pci-host/Kconfig
> index b0aa8351c4..24ba8ea046 100644
> --- a/hw/pci-host/Kconfig
> +++ b/hw/pci-host/Kconfig
> @@ -1,6 +1,11 @@
>  config PAM
>      bool
>  
> +config XEN_IGD_PASSTHROUGH
> +    bool
> +    default y if XEN
> +    select PCI_I440FX

Maybe "depends on PCI_I440FX" (so if somebody builds a Xen+KVM, q35-only
machine they don't get IGD passthrough).  I can do this when applying.

Paolo

> +
>  config PREP_PCI
>      bool
>      select PCI
> diff --git a/hw/pci-host/Makefile.objs b/hw/pci-host/Makefile.objs
> index fa6d1556c0..9c466fab01 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) += xen_igd_pt.o
> +common-obj-$(CONFIG_XEN_IGD_PASSTHROUGH) += xen_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] 23+ messages in thread

* Re: [Xen-devel] [PATCH-for-5.0 v3 6/6] hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge
  2019-12-09 10:10   ` [Xen-devel] " Durrant, Paul
@ 2019-12-09 10:42     ` Paolo Bonzini
  2019-12-09 10:56       ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 23+ messages in thread
From: Paolo Bonzini @ 2019-12-09 10:42 UTC (permalink / raw)
  To: Durrant, Paul, Philippe Mathieu-Daudé, qemu-devel
  Cc: Thomas Huth, Stefano Stabellini, Paul Durrant,
	Michael S. Tsirkin, Markus Armbruster, Alex Williamson,
	Anthony Perard, xen-devel

On 09/12/19 11:10, Durrant, Paul wrote:
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>> v3: Only default with Xen (Alex Williamson)
>>
>> I did not used 'depends on XEN' as suggested by Alex but
>> 'default y if XEN', so one can build XEN without this feature
>> (for example, on other ARCH than X86).

I think what you want is achieved by

	default y
	depends on XEN && PC_I440FX

?



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

* Re: [Xen-devel] [PATCH-for-5.0 v3 6/6] hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge
  2019-12-09 10:42     ` Paolo Bonzini
@ 2019-12-09 10:56       ` Philippe Mathieu-Daudé
  2019-12-09 11:12         ` Paolo Bonzini
  0 siblings, 1 reply; 23+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-09 10:56 UTC (permalink / raw)
  To: Paolo Bonzini, Durrant, Paul, qemu-devel
  Cc: Thomas Huth, Stefano Stabellini, Paul Durrant,
	Michael S. Tsirkin, Markus Armbruster, Alex Williamson,
	Anthony Perard, xen-devel

On 12/9/19 11:42 AM, Paolo Bonzini wrote:
> On 09/12/19 11:10, Durrant, Paul wrote:
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>> ---
>>> v3: Only default with Xen (Alex Williamson)
>>>
>>> I did not used 'depends on XEN' as suggested by Alex but
>>> 'default y if XEN', so one can build XEN without this feature
>>> (for example, on other ARCH than X86).
> 
> I think what you want is achieved by
> 
> 	default y
> 	depends on XEN && PC_I440FX

I think so, but with PC_I440FX -> PCI_I440FX ;)

It would be cleaner to pass the CONFIG_XEN_PCI_PASSTHROUGH variable to 
Kconfig and use it (use 'depends on XEN_PCI_PASSTHROUGH').

This can be another step, so if this series looks OK to you so far, do 
you mind fixing this and the comment in the previous patch noticed by 
Thomas:

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

Thanks!

Phil.



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

* Re: [Xen-devel] [PATCH-for-5.0 v3 6/6] hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge
  2019-12-09 10:56       ` Philippe Mathieu-Daudé
@ 2019-12-09 11:12         ` Paolo Bonzini
  0 siblings, 0 replies; 23+ messages in thread
From: Paolo Bonzini @ 2019-12-09 11:12 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Durrant, Paul, qemu-devel
  Cc: Thomas Huth, Stefano Stabellini, Paul Durrant,
	Michael S. Tsirkin, Markus Armbruster, Alex Williamson,
	Anthony Perard, xen-devel

On 09/12/19 11:56, Philippe Mathieu-Daudé wrote:
> 
> I think so, but with PC_I440FX -> PCI_I440FX ;)
> 
> It would be cleaner to pass the CONFIG_XEN_PCI_PASSTHROUGH variable to
> Kconfig and use it (use 'depends on XEN_PCI_PASSTHROUGH').
> 
> This can be another step, so if this series looks OK to you so far, do
> you mind fixing this and the comment in the previous patch noticed by
> Thomas:
> 
> - Extract it into a new file, 'hw/pci-host/igd_pt.c'.
> + Extract it into a new file, 'hw/pci-host/xen_igd_pt.c'.

Sure.

Paolo



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

* Re: [PATCH-for-5.0 v3 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through
  2019-12-09  9:49 [PATCH-for-5.0 v3 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through Philippe Mathieu-Daudé
                   ` (5 preceding siblings ...)
  2019-12-09  9:50 ` [PATCH-for-5.0 v3 6/6] hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge Philippe Mathieu-Daudé
@ 2019-12-09 18:39 ` no-reply
  2019-12-09 18:49 ` no-reply
  7 siblings, 0 replies; 23+ messages in thread
From: no-reply @ 2019-12-09 18:39 UTC (permalink / raw)
  To: philmd
  Cc: thuth, sstabellini, paul, mst, armbru, qemu-devel,
	alex.williamson, xen-devel, anthony.perard, pbonzini, philmd

Patchew URL: https://patchew.org/QEMU/20191209095002.32194-1-philmd@redhat.com/



Hi,

This series failed the docker-quick@centos7 build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
make docker-image-centos7 V=1 NETWORK=1
time make docker-test-quick@centos7 SHOW_ENV=1 J=14 NETWORK=1
=== TEST SCRIPT END ===

Submodule 'dtc' (https://git.qemu.org/git/dtc.git) registered for path 'dtc'
Cloning into 'dtc'...
remote: Counting objects: 5280, done.        
error: RPC failed; result=18, HTTP code = 200
fatal: The remote end hung up unexpectedly
fatal: protocol error: bad pack header
Clone of 'https://git.qemu.org/git/dtc.git' into submodule path 'dtc' failed
failed to update submodule dtc
Submodule 'dtc' (https://git.qemu.org/git/dtc.git) unregistered for path 'dtc'
make[1]: *** [/var/tmp/patchew-tester-tmp-2t3gdqmo/src/docker-src.2019-12-09-13.30.01.10260] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-2t3gdqmo/src'
make: *** [docker-run-test-quick@centos7] Error 2

real    9m11.026s
user    0m2.757s


The full log is available at
http://patchew.org/logs/20191209095002.32194-1-philmd@redhat.com/testing.docker-quick@centos7/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

* Re: [PATCH-for-5.0 v3 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through
  2019-12-09  9:49 [PATCH-for-5.0 v3 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through Philippe Mathieu-Daudé
                   ` (6 preceding siblings ...)
  2019-12-09 18:39 ` [PATCH-for-5.0 v3 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through no-reply
@ 2019-12-09 18:49 ` no-reply
  7 siblings, 0 replies; 23+ messages in thread
From: no-reply @ 2019-12-09 18:49 UTC (permalink / raw)
  To: philmd
  Cc: thuth, sstabellini, paul, mst, armbru, qemu-devel,
	alex.williamson, xen-devel, anthony.perard, pbonzini, philmd

Patchew URL: https://patchew.org/QEMU/20191209095002.32194-1-philmd@redhat.com/



Hi,

This series failed the docker-mingw@fedora build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#! /bin/bash
export ARCH=x86_64
make docker-image-fedora V=1 NETWORK=1
time make docker-test-mingw@fedora J=14 NETWORK=1
=== TEST SCRIPT END ===

Submodule 'dtc' (https://git.qemu.org/git/dtc.git) registered for path 'dtc'
Cloning into 'dtc'...
remote: Counting objects: 5280, done.        
error: RPC failed; result=18, HTTP code = 200
fatal: The remote end hung up unexpectedly
fatal: protocol error: bad pack header
Clone of 'https://git.qemu.org/git/dtc.git' into submodule path 'dtc' failed
failed to update submodule dtc
Submodule 'dtc' (https://git.qemu.org/git/dtc.git) unregistered for path 'dtc'
make[1]: *** [/var/tmp/patchew-tester-tmp-w4w8li1u/src/docker-src.2019-12-09-13.44.32.11934] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-w4w8li1u/src'
make: *** [docker-run-test-mingw@fedora] Error 2

real    5m17.813s
user    0m2.470s


The full log is available at
http://patchew.org/logs/20191209095002.32194-1-philmd@redhat.com/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

* Re: [PATCH-for-5.0 v3 1/6] hw/pci-host/i440fx: Correct the header description
  2019-12-09 10:02   ` Thomas Huth
@ 2019-12-18 11:57     ` Laurent Vivier
  0 siblings, 0 replies; 23+ messages in thread
From: Laurent Vivier @ 2019-12-18 11:57 UTC (permalink / raw)
  To: Thomas Huth, Philippe Mathieu-Daudé, qemu-devel
  Cc: Stefano Stabellini, Paul Durrant, QEMU Trivial,
	Michael S. Tsirkin, Markus Armbruster, Alex Williamson,
	xen-devel, Anthony Perard, Paolo Bonzini

Le 09/12/2019 à 11:02, Thomas Huth a écrit :
> On 09/12/2019 10.49, Philippe Mathieu-Daudé wrote:
>> 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
>>   *
>>
> 
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> 
> 

Applied to my trivial-patches branch.

Thanks,
Laurent


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

* Re: [PATCH-for-5.0 v3 3/6] hw/pci-host/i440fx: Use size_t to iterate over ARRAY_SIZE()
  2019-12-09 10:05   ` Thomas Huth
@ 2019-12-18 11:57     ` Laurent Vivier
  2019-12-18 12:01       ` Paolo Bonzini
  0 siblings, 1 reply; 23+ messages in thread
From: Laurent Vivier @ 2019-12-18 11:57 UTC (permalink / raw)
  To: Thomas Huth, Philippe Mathieu-Daudé, qemu-devel
  Cc: Stefano Stabellini, Paul Durrant, QEMU Trivial,
	Michael S. Tsirkin, Markus Armbruster, Alex Williamson,
	xen-devel, Anthony Perard, Paolo Bonzini

Le 09/12/2019 à 11:05, Thomas Huth a écrit :
> On 09/12/2019 10.49, Philippe Mathieu-Daudé wrote:
>> 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);
>>
> 
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> 
> 

Applied to my trivial-patches branch.

Thanks,
Laurent



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

* Re: [PATCH-for-5.0 v3 3/6] hw/pci-host/i440fx: Use size_t to iterate over ARRAY_SIZE()
  2019-12-18 11:57     ` Laurent Vivier
@ 2019-12-18 12:01       ` Paolo Bonzini
  2019-12-18 12:31         ` Laurent Vivier
  0 siblings, 1 reply; 23+ messages in thread
From: Paolo Bonzini @ 2019-12-18 12:01 UTC (permalink / raw)
  To: Laurent Vivier, Thomas Huth, Philippe Mathieu-Daudé, qemu-devel
  Cc: Stefano Stabellini, Paul Durrant, QEMU Trivial,
	Michael S. Tsirkin, Markus Armbruster, Alex Williamson,
	Anthony Perard, xen-devel

On 18/12/19 12:57, Laurent Vivier wrote:
> Le 09/12/2019 à 11:05, Thomas Huth a écrit :
>> On 09/12/2019 10.49, Philippe Mathieu-Daudé wrote:
>>> 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);
>>>
>>
>> Reviewed-by: Thomas Huth <thuth@redhat.com>
>>
>>
> 
> Applied to my trivial-patches branch.

No need to, I've already queued the whole series.

Paolo



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

* Re: [PATCH-for-5.0 v3 3/6] hw/pci-host/i440fx: Use size_t to iterate over ARRAY_SIZE()
  2019-12-18 12:01       ` Paolo Bonzini
@ 2019-12-18 12:31         ` Laurent Vivier
  0 siblings, 0 replies; 23+ messages in thread
From: Laurent Vivier @ 2019-12-18 12:31 UTC (permalink / raw)
  To: Paolo Bonzini, Thomas Huth, Philippe Mathieu-Daudé, qemu-devel
  Cc: Stefano Stabellini, Michael S. Tsirkin, QEMU Trivial,
	Paul Durrant, Markus Armbruster, Alex Williamson, Anthony Perard,
	xen-devel

Le 18/12/2019 à 13:01, Paolo Bonzini a écrit :
> On 18/12/19 12:57, Laurent Vivier wrote:
>> Le 09/12/2019 à 11:05, Thomas Huth a écrit :
>>> On 09/12/2019 10.49, Philippe Mathieu-Daudé wrote:
>>>> 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);
>>>>
>>>
>>> Reviewed-by: Thomas Huth <thuth@redhat.com>
>>>
>>>
>>
>> Applied to my trivial-patches branch.
> 
> No need to, I've already queued the whole series.
> 

ok, I've removed them from my queue.

Thanks,
Laurent



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

end of thread, other threads:[~2019-12-18 12:51 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-09  9:49 [PATCH-for-5.0 v3 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through Philippe Mathieu-Daudé
2019-12-09  9:49 ` [PATCH-for-5.0 v3 1/6] hw/pci-host/i440fx: Correct the header description Philippe Mathieu-Daudé
2019-12-09 10:02   ` Thomas Huth
2019-12-18 11:57     ` Laurent Vivier
2019-12-09  9:49 ` [PATCH-for-5.0 v3 2/6] hw/pci-host/i440fx: Extract PCII440FXState to "hw/pci-host/i440fx.h" Philippe Mathieu-Daudé
2019-12-09 10:03   ` Thomas Huth
2019-12-09  9:49 ` [PATCH-for-5.0 v3 3/6] hw/pci-host/i440fx: Use size_t to iterate over ARRAY_SIZE() Philippe Mathieu-Daudé
2019-12-09 10:05   ` Thomas Huth
2019-12-18 11:57     ` Laurent Vivier
2019-12-18 12:01       ` Paolo Bonzini
2019-12-18 12:31         ` Laurent Vivier
2019-12-09  9:50 ` [PATCH-for-5.0 v3 4/6] hw/pci-host/i440fx: Use definitions instead of magic values Philippe Mathieu-Daudé
2019-12-09 10:08   ` Thomas Huth
2019-12-09  9:50 ` [PATCH-for-5.0 v3 5/6] hw/pci-host/i440fx: Extract the IGD passthrough host bridge device Philippe Mathieu-Daudé
2019-12-09 10:08   ` [Xen-devel] " Durrant, Paul
2019-12-09  9:50 ` [PATCH-for-5.0 v3 6/6] hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge Philippe Mathieu-Daudé
2019-12-09 10:10   ` [Xen-devel] " Durrant, Paul
2019-12-09 10:42     ` Paolo Bonzini
2019-12-09 10:56       ` Philippe Mathieu-Daudé
2019-12-09 11:12         ` Paolo Bonzini
2019-12-09 10:39   ` Paolo Bonzini
2019-12-09 18:39 ` [PATCH-for-5.0 v3 0/6] hw/pci-host: Add Kconfig selector for IGD PCIe pass-through no-reply
2019-12-09 18:49 ` no-reply

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).