diff mbox series

[v2,1/5] pci: conventional-pci-device and pci-express-device interfaces

Message ID 20170927195635.16014-2-ehabkost@redhat.com
State New
Headers show
Series Mark conventional/PCIe/hybrid PCI devices using interface names | expand

Commit Message

Eduardo Habkost Sept. 27, 2017, 7:56 p.m. UTC
Those two interfaces will be used to indicate which device types
support Conventional PCI or PCI Express buses.  Management
software will be able to use the qom-list-types QMP command to
query that information.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Changes v1 -> v2:
* s/legacy/conventional/
  * Suggested-by: Alex Williamson <alex.williamson@redhat.com>
---
 include/hw/pci/pci.h |  6 ++++++
 hw/pci/pci.c         | 12 ++++++++++++
 2 files changed, 18 insertions(+)

Comments

David Gibson Sept. 28, 2017, 4:04 a.m. UTC | #1
On Wed, Sep 27, 2017 at 04:56:31PM -0300, Eduardo Habkost wrote:
> Those two interfaces will be used to indicate which device types
> support Conventional PCI or PCI Express buses.  Management
> software will be able to use the qom-list-types QMP command to
> query that information.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
> Changes v1 -> v2:
> * s/legacy/conventional/
>   * Suggested-by: Alex Williamson <alex.williamson@redhat.com>
> ---
>  include/hw/pci/pci.h |  6 ++++++
>  hw/pci/pci.c         | 12 ++++++++++++
>  2 files changed, 18 insertions(+)
> 
> diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
> index aa7ef9cf69..8d02a0a383 100644
> --- a/include/hw/pci/pci.h
> +++ b/include/hw/pci/pci.h
> @@ -198,6 +198,12 @@ enum {
>  #define PCI_DEVICE_GET_CLASS(obj) \
>       OBJECT_GET_CLASS(PCIDeviceClass, (obj), TYPE_PCI_DEVICE)
>  
> +/* Implemented by devices that can be plugged on PCI Express buses */
> +#define INTERFACE_PCIE_DEVICE "pci-express-device"
> +
> +/* Implemented by devices that can be plugged on Conventional PCI buses */
> +#define INTERFACE_CONVENTIONAL_PCI_DEVICE "conventional-pci-device"
> +
>  typedef struct PCIINTxRoute {
>      enum {
>          PCI_INTX_ENABLED,
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index 1e6fb88eba..1b08e18205 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -170,6 +170,16 @@ static const TypeInfo pci_bus_info = {
>      .class_init = pci_bus_class_init,
>  };
>  
> +static const TypeInfo pcie_interface_info = {
> +    .name          = INTERFACE_PCIE_DEVICE,
> +    .parent        = TYPE_INTERFACE,
> +};
> +
> +static const TypeInfo conventional_pci_interface_info = {
> +    .name          = INTERFACE_CONVENTIONAL_PCI_DEVICE,
> +    .parent        = TYPE_INTERFACE,
> +};
> +
>  static const TypeInfo pcie_bus_info = {
>      .name = TYPE_PCIE_BUS,
>      .parent = TYPE_PCI_BUS,
> @@ -2667,6 +2677,8 @@ static void pci_register_types(void)
>  {
>      type_register_static(&pci_bus_info);
>      type_register_static(&pcie_bus_info);
> +    type_register_static(&conventional_pci_interface_info);
> +    type_register_static(&pcie_interface_info);
>      type_register_static(&pci_device_type_info);
>  }
>
Marcel Apfelbaum Sept. 28, 2017, 9:08 a.m. UTC | #2
On 27/09/2017 22:56, Eduardo Habkost wrote:
> Those two interfaces will be used to indicate which device types
> support Conventional PCI or PCI Express buses.  Management
> software will be able to use the qom-list-types QMP command to
> query that information.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Changes v1 -> v2:
> * s/legacy/conventional/
>    * Suggested-by: Alex Williamson <alex.williamson@redhat.com>
> ---
>   include/hw/pci/pci.h |  6 ++++++
>   hw/pci/pci.c         | 12 ++++++++++++
>   2 files changed, 18 insertions(+)
> 
> diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
> index aa7ef9cf69..8d02a0a383 100644
> --- a/include/hw/pci/pci.h
> +++ b/include/hw/pci/pci.h
> @@ -198,6 +198,12 @@ enum {
>   #define PCI_DEVICE_GET_CLASS(obj) \
>        OBJECT_GET_CLASS(PCIDeviceClass, (obj), TYPE_PCI_DEVICE)
>   
> +/* Implemented by devices that can be plugged on PCI Express buses */
> +#define INTERFACE_PCIE_DEVICE "pci-express-device"
> +
> +/* Implemented by devices that can be plugged on Conventional PCI buses */
> +#define INTERFACE_CONVENTIONAL_PCI_DEVICE "conventional-pci-device"
> +
>   typedef struct PCIINTxRoute {
>       enum {
>           PCI_INTX_ENABLED,
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index 1e6fb88eba..1b08e18205 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -170,6 +170,16 @@ static const TypeInfo pci_bus_info = {
>       .class_init = pci_bus_class_init,
>   };
>   
> +static const TypeInfo pcie_interface_info = {
> +    .name          = INTERFACE_PCIE_DEVICE,
> +    .parent        = TYPE_INTERFACE,
> +};
> +
> +static const TypeInfo conventional_pci_interface_info = {
> +    .name          = INTERFACE_CONVENTIONAL_PCI_DEVICE,
> +    .parent        = TYPE_INTERFACE,
> +};
> +
>   static const TypeInfo pcie_bus_info = {
>       .name = TYPE_PCIE_BUS,
>       .parent = TYPE_PCI_BUS,
> @@ -2667,6 +2677,8 @@ static void pci_register_types(void)
>   {
>       type_register_static(&pci_bus_info);
>       type_register_static(&pcie_bus_info);
> +    type_register_static(&conventional_pci_interface_info);
> +    type_register_static(&pcie_interface_info);
>       type_register_static(&pci_device_type_info);
>   }
>   
> 


Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>

Thanks,
Marcel
diff mbox series

Patch

diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index aa7ef9cf69..8d02a0a383 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -198,6 +198,12 @@  enum {
 #define PCI_DEVICE_GET_CLASS(obj) \
      OBJECT_GET_CLASS(PCIDeviceClass, (obj), TYPE_PCI_DEVICE)
 
+/* Implemented by devices that can be plugged on PCI Express buses */
+#define INTERFACE_PCIE_DEVICE "pci-express-device"
+
+/* Implemented by devices that can be plugged on Conventional PCI buses */
+#define INTERFACE_CONVENTIONAL_PCI_DEVICE "conventional-pci-device"
+
 typedef struct PCIINTxRoute {
     enum {
         PCI_INTX_ENABLED,
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 1e6fb88eba..1b08e18205 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -170,6 +170,16 @@  static const TypeInfo pci_bus_info = {
     .class_init = pci_bus_class_init,
 };
 
+static const TypeInfo pcie_interface_info = {
+    .name          = INTERFACE_PCIE_DEVICE,
+    .parent        = TYPE_INTERFACE,
+};
+
+static const TypeInfo conventional_pci_interface_info = {
+    .name          = INTERFACE_CONVENTIONAL_PCI_DEVICE,
+    .parent        = TYPE_INTERFACE,
+};
+
 static const TypeInfo pcie_bus_info = {
     .name = TYPE_PCIE_BUS,
     .parent = TYPE_PCI_BUS,
@@ -2667,6 +2677,8 @@  static void pci_register_types(void)
 {
     type_register_static(&pci_bus_info);
     type_register_static(&pcie_bus_info);
+    type_register_static(&conventional_pci_interface_info);
+    type_register_static(&pcie_interface_info);
     type_register_static(&pci_device_type_info);
 }