Skip to contentSkip to conversation

pci: removed the is_express field since a uniform interface was inserted

PATCH Superseded Yoni Bettan 1 participant 3 messages Nov 28, 2017 Arm/Zynq architecture

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 pci: removed the is_express field since a uniform interface was inserted

* according to Eduardo Habkost's commit fd3b02c8896d597dd8b9e053dec579cf0386aee1

* since all PCIEs now implement INTERFACE_PCIE_DEVICE we don't need this field anymore

---
 hw/block/nvme.c                    | 1 -
 hw/net/e1000e.c                    | 1 -
 hw/pci-bridge/pcie_pci_bridge.c    | 1 -
 hw/pci-bridge/pcie_root_port.c     | 1 -
 hw/pci-bridge/xio3130_downstream.c | 1 -
 hw/pci-bridge/xio3130_upstream.c   | 1 -
 hw/pci-host/xilinx-pcie.c          | 1 -
 hw/pci/pci.c                       | 3 ++-
 hw/scsi/megasas.c                  | 1 -
 hw/usb/hcd-xhci.c                  | 1 -
 hw/vfio/pci.c                      | 1 -
 include/hw/pci/pci.h               | 3 ---
 12 files changed, 2 insertions(+), 14 deletions(-)
hw/block/nvme.c +0 -1
index 441e21ed1f..9325bc0911 100644
@@ -1087,7 +1087,6 @@ static void nvme_class_init(ObjectClass *oc, void *data)
     pc->vendor_id = PCI_VENDOR_ID_INTEL;
     pc->device_id = 0x5845;
     pc->revision = 2;
-    pc->is_express = 1;
 
     set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
     dc->desc = "Non-Volatile Memory Express";
hw/net/e1000e.c +0 -1
index f1af279e8d..c360f0d8c9 100644
@@ -675,7 +675,6 @@ static void e1000e_class_init(ObjectClass *class, void *data)
     c->revision = 0;
     c->romfile = "efi-e1000e.rom";
     c->class_id = PCI_CLASS_NETWORK_ETHERNET;
-    c->is_express = 1;
 
     dc->desc = "Intel 82574L GbE Controller";
     dc->reset = e1000e_qdev_reset;
hw/pci-bridge/pcie_pci_bridge.c +0 -1
index a4d827c99d..b7d9ebbec2 100644
@@ -169,7 +169,6 @@ static void pcie_pci_bridge_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
     HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
 
-    k->is_express = 1;
     k->is_bridge = 1;
     k->vendor_id = PCI_VENDOR_ID_REDHAT;
     k->device_id = PCI_DEVICE_ID_REDHAT_PCIE_BRIDGE;
hw/pci-bridge/pcie_root_port.c +0 -1
index 9b6e4ce512..45f9e8cd4a 100644
@@ -145,7 +145,6 @@ static void rp_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
-    k->is_express = 1;
     k->is_bridge = 1;
     k->config_write = rp_write_config;
     k->realize = rp_realize;
hw/pci-bridge/xio3130_downstream.c +0 -1
index 1e09d2afb7..613a0d6bb7 100644
@@ -177,7 +177,6 @@ static void xio3130_downstream_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
-    k->is_express = 1;
     k->is_bridge = 1;
     k->config_write = xio3130_downstream_write_config;
     k->realize = xio3130_downstream_realize;
hw/pci-bridge/xio3130_upstream.c +0 -1
index 227997ce46..d4645bddee 100644
@@ -148,7 +148,6 @@ static void xio3130_upstream_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
-    k->is_express = 1;
     k->is_bridge = 1;
     k->config_write = xio3130_upstream_write_config;
     k->realize = xio3130_upstream_realize;
hw/pci-host/xilinx-pcie.c +0 -1
index 7659253090..a4ca3ba30f 100644
@@ -298,7 +298,6 @@ static void xilinx_pcie_root_class_init(ObjectClass *klass, void *data)
     k->device_id = 0x7021;
     k->revision = 0;
     k->class_id = PCI_CLASS_BRIDGE_HOST;
-    k->is_express = true;
     k->is_bridge = true;
     k->init = xilinx_pcie_root_init;
     k->exit = pci_bridge_exitfn;
hw/pci/pci.c +2 -1
index b2d139bd9a..02f6f2f37a 100644
@@ -2014,12 +2014,13 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp)
 {
     PCIDevice *pci_dev = (PCIDevice *)qdev;
     PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev);
+    ObjectClass *klass = &(pc->parent_class.parent_class);
     Error *local_err = NULL;
     PCIBus *bus;
     bool is_default_rom;
 
     /* initialize cap_present for pci_is_express() and pci_config_size() */
-    if (pc->is_express) {
+    if (object_class_dynamic_cast(klass, INTERFACE_PCIE_DEVICE)) {
         pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS;
     }
 
hw/scsi/megasas.c +0 -1
index d5eae6239a..987c064e4b 100644
@@ -2506,7 +2506,6 @@ static void megasas_class_init(ObjectClass *oc, void *data)
     pc->subsystem_vendor_id = PCI_VENDOR_ID_LSI_LOGIC;
     pc->subsystem_id = info->subsystem_id;
     pc->class_id = PCI_CLASS_STORAGE_RAID;
-    pc->is_express = info->is_express;
     e->mmio_bar = info->mmio_bar;
     e->ioport_bar = info->ioport_bar;
     e->osts = info->osts;
hw/usb/hcd-xhci.c +0 -1
index af3a9d88de..12e12f4f21 100644
@@ -3661,7 +3661,6 @@ static void xhci_class_init(ObjectClass *klass, void *data)
     k->realize      = usb_xhci_realize;
     k->exit         = usb_xhci_exit;
     k->class_id     = PCI_CLASS_SERIAL_USB;
-    k->is_express   = 1;
 }
 
 static const TypeInfo xhci_info = {
hw/vfio/pci.c +0 -1
index c977ee327f..d2c1d47148 100644
@@ -3026,7 +3026,6 @@ static void vfio_pci_dev_class_init(ObjectClass *klass, void *data)
     pdc->exit = vfio_exitfn;
     pdc->config_read = vfio_pci_read_config;
     pdc->config_write = vfio_pci_write_config;
-    pdc->is_express = 1; /* We might be */
 }
 
 static const TypeInfo vfio_pci_dev_info = {
include/hw/pci/pci.h +0 -3
index 8d02a0a383..a27be85111 100644
@@ -236,9 +236,6 @@ typedef struct PCIDeviceClass {
      */
     int is_bridge;
 
-    /* pcie stuff */
-    int is_express;   /* is this device pci express? */
-
     /* rom bar */
     const char *romfile;
 } PCIDeviceClass;
Signature · 1 line
2.13.6
#1 lore raw

PATCH 2/2 hw/pci/pci.c : changed the access to ObjectClass to use OBJECT_CLASS macro

---
 hw/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci/pci.c +1 -1
index 02f6f2f37a..d2bf749251 100644
@@ -2014,7 +2014,7 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp)
 {
     PCIDevice *pci_dev = (PCIDevice *)qdev;
     PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev);
-    ObjectClass *klass = &(pc->parent_class.parent_class);
+    ObjectClass *klass = OBJECT_CLASS(pc);
     Error *local_err = NULL;
     PCIBus *bus;
     bool is_default_rom;
Signature · 1 line
2.13.6
#2 lore raw
In reply to Yoni Bettan
Quoted 5 lines · Yoni Bettan

* according to Eduardo Habkost's commit fd3b02c8896d597dd8b9e053dec579cf0386aee1

* since all PCIEs now implement INTERFACE_PCIE_DEVICE we don't need this field anymore

Hi, please discard this series, i will send V2 soon

Quoted 169 lines
---
  hw/block/nvme.c                    | 1 -
  hw/net/e1000e.c                    | 1 -
  hw/pci-bridge/pcie_pci_bridge.c    | 1 -
  hw/pci-bridge/pcie_root_port.c     | 1 -
  hw/pci-bridge/xio3130_downstream.c | 1 -
  hw/pci-bridge/xio3130_upstream.c   | 1 -
  hw/pci-host/xilinx-pcie.c          | 1 -
  hw/pci/pci.c                       | 3 ++-
  hw/scsi/megasas.c                  | 1 -
  hw/usb/hcd-xhci.c                  | 1 -
  hw/vfio/pci.c                      | 1 -
  include/hw/pci/pci.h               | 3 ---
  12 files changed, 2 insertions(+), 14 deletions(-)
hw/block/nvme.c +0 -1
index 441e21ed1f..9325bc0911 100644
@@ -1087,7 +1087,6 @@ static void nvme_class_init(ObjectClass *oc, void *data)
      pc->vendor_id = PCI_VENDOR_ID_INTEL;
      pc->device_id = 0x5845;
      pc->revision = 2;
-    pc->is_express = 1;
 
      set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
      dc->desc = "Non-Volatile Memory Express";
hw/net/e1000e.c +0 -1
index f1af279e8d..c360f0d8c9 100644
@@ -675,7 +675,6 @@ static void e1000e_class_init(ObjectClass *class, void *data)
      c->revision = 0;
      c->romfile = "efi-e1000e.rom";
      c->class_id = PCI_CLASS_NETWORK_ETHERNET;
-    c->is_express = 1;
 
      dc->desc = "Intel 82574L GbE Controller";
      dc->reset = e1000e_qdev_reset;
hw/pci-bridge/pcie_pci_bridge.c +0 -1
index a4d827c99d..b7d9ebbec2 100644
@@ -169,7 +169,6 @@ static void pcie_pci_bridge_class_init(ObjectClass *klass, void *data)
      DeviceClass *dc = DEVICE_CLASS(klass);
      HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
 
-    k->is_express = 1;
      k->is_bridge = 1;
      k->vendor_id = PCI_VENDOR_ID_REDHAT;
      k->device_id = PCI_DEVICE_ID_REDHAT_PCIE_BRIDGE;
hw/pci-bridge/pcie_root_port.c +0 -1
index 9b6e4ce512..45f9e8cd4a 100644
@@ -145,7 +145,6 @@ static void rp_class_init(ObjectClass *klass, void *data)
      DeviceClass *dc = DEVICE_CLASS(klass);
      PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
-    k->is_express = 1;
      k->is_bridge = 1;
      k->config_write = rp_write_config;
      k->realize = rp_realize;
hw/pci-bridge/xio3130_downstream.c +0 -1
index 1e09d2afb7..613a0d6bb7 100644
@@ -177,7 +177,6 @@ static void xio3130_downstream_class_init(ObjectClass *klass, void *data)
      DeviceClass *dc = DEVICE_CLASS(klass);
      PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
-    k->is_express = 1;
      k->is_bridge = 1;
      k->config_write = xio3130_downstream_write_config;
      k->realize = xio3130_downstream_realize;
hw/pci-bridge/xio3130_upstream.c +0 -1
index 227997ce46..d4645bddee 100644
@@ -148,7 +148,6 @@ static void xio3130_upstream_class_init(ObjectClass *klass, void *data)
      DeviceClass *dc = DEVICE_CLASS(klass);
      PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
-    k->is_express = 1;
      k->is_bridge = 1;
      k->config_write = xio3130_upstream_write_config;
      k->realize = xio3130_upstream_realize;
hw/pci-host/xilinx-pcie.c +0 -1
index 7659253090..a4ca3ba30f 100644
@@ -298,7 +298,6 @@ static void xilinx_pcie_root_class_init(ObjectClass *klass, void *data)
      k->device_id = 0x7021;
      k->revision = 0;
      k->class_id = PCI_CLASS_BRIDGE_HOST;
-    k->is_express = true;
      k->is_bridge = true;
      k->init = xilinx_pcie_root_init;
      k->exit = pci_bridge_exitfn;
hw/pci/pci.c +2 -1
index b2d139bd9a..02f6f2f37a 100644
@@ -2014,12 +2014,13 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp)
  {
      PCIDevice *pci_dev = (PCIDevice *)qdev;
      PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev);
+    ObjectClass *klass = &(pc->parent_class.parent_class);
      Error *local_err = NULL;
      PCIBus *bus;
      bool is_default_rom;
 
      /* initialize cap_present for pci_is_express() and pci_config_size() */
-    if (pc->is_express) {
+    if (object_class_dynamic_cast(klass, INTERFACE_PCIE_DEVICE)) {
          pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS;
      }
 
hw/scsi/megasas.c +0 -1
index d5eae6239a..987c064e4b 100644
@@ -2506,7 +2506,6 @@ static void megasas_class_init(ObjectClass *oc, void *data)
      pc->subsystem_vendor_id = PCI_VENDOR_ID_LSI_LOGIC;
      pc->subsystem_id = info->subsystem_id;
      pc->class_id = PCI_CLASS_STORAGE_RAID;
-    pc->is_express = info->is_express;
      e->mmio_bar = info->mmio_bar;
      e->ioport_bar = info->ioport_bar;
      e->osts = info->osts;
hw/usb/hcd-xhci.c +0 -1
index af3a9d88de..12e12f4f21 100644
@@ -3661,7 +3661,6 @@ static void xhci_class_init(ObjectClass *klass, void *data)
      k->realize      = usb_xhci_realize;
      k->exit         = usb_xhci_exit;
      k->class_id     = PCI_CLASS_SERIAL_USB;
-    k->is_express   = 1;
  }
 
  static const TypeInfo xhci_info = {
hw/vfio/pci.c +0 -1
index c977ee327f..d2c1d47148 100644
@@ -3026,7 +3026,6 @@ static void vfio_pci_dev_class_init(ObjectClass *klass, void *data)
      pdc->exit = vfio_exitfn;
      pdc->config_read = vfio_pci_read_config;
      pdc->config_write = vfio_pci_write_config;
-    pdc->is_express = 1; /* We might be */
  }
 
  static const TypeInfo vfio_pci_dev_info = {
include/hw/pci/pci.h +0 -3
index 8d02a0a383..a27be85111 100644
@@ -236,9 +236,6 @@ typedef struct PCIDeviceClass {
       */
      int is_bridge;
 
-    /* pcie stuff */
-    int is_express;   /* is this device pci express? */
-
      /* rom bar */
      const char *romfile;
  } PCIDeviceClass;