[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 5/5] pci: Validate interfaces on base_class_i
From: |
David Gibson |
Subject: |
Re: [Qemu-devel] [PATCH v2 5/5] pci: Validate interfaces on base_class_init |
Date: |
Thu, 28 Sep 2017 14:13:08 +1000 |
User-agent: |
Mutt/1.9.0 (2017-09-02) |
On Wed, Sep 27, 2017 at 04:56:35PM -0300, Eduardo Habkost wrote:
> Make sure we don't forget to add the Conventional PCI or PCI
> Express interface names on PCI device classes in the future.
>
> Signed-off-by: Eduardo Habkost <address@hidden>
Revieed-by: David Gibson <address@hidden>
> ---
> Changes v1 -> v2:
> * s/legacy/conventional/
> * Suggested-by: Alex Williamson <address@hidden>
> ---
> hw/pci/pci.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index 1b08e18205..5ed3c8dca4 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -2547,6 +2547,17 @@ static void pci_device_class_init(ObjectClass *klass,
> void *data)
> pc->realize = pci_default_realize;
> }
>
> +static void pci_device_class_base_init(ObjectClass *klass, void *data)
> +{
> + if (!object_class_is_abstract(klass)) {
> + ObjectClass *conventional =
> + object_class_dynamic_cast(klass,
> INTERFACE_CONVENTIONAL_PCI_DEVICE);
> + ObjectClass *pcie =
> + object_class_dynamic_cast(klass, INTERFACE_PCIE_DEVICE);
> + assert(conventional || pcie);
> + }
> +}
> +
> AddressSpace *pci_device_iommu_address_space(PCIDevice *dev)
> {
> PCIBus *bus = PCI_BUS(dev->bus);
> @@ -2671,6 +2682,7 @@ static const TypeInfo pci_device_type_info = {
> .abstract = true,
> .class_size = sizeof(PCIDeviceClass),
> .class_init = pci_device_class_init,
> + .class_base_init = pci_device_class_base_init,
> };
>
> static void pci_register_types(void)
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature
- Re: [Qemu-devel] [PATCH v2 1/5] pci: conventional-pci-device and pci-express-device interfaces, (continued)
- [Qemu-devel] [PATCH v2 2/5] pci: Add interface names to hybrid PCI devices, Eduardo Habkost, 2017/09/27
- [Qemu-devel] [PATCH v2 3/5] pci: Add INTERFACE_PCIE_DEVICE to all PCIe devices, Eduardo Habkost, 2017/09/27
- [Qemu-devel] [PATCH v2 5/5] pci: Validate interfaces on base_class_init, Eduardo Habkost, 2017/09/27
- [Qemu-devel] [PATCH v2 4/5] pci: Add INTERFACE_CONVENTIONAL_PCI_DEVICE to Conventional PCI devices, Eduardo Habkost, 2017/09/27
- Re: [Qemu-devel] [PATCH v2 0/5] Mark conventional/PCIe/hybrid PCI devices using interface names, Marcel Apfelbaum, 2017/09/28