[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 13/22] virtio: split rng bits from virtio-pci
From: |
Thomas Huth |
Subject: |
Re: [Qemu-devel] [PATCH v2 13/22] virtio: split rng bits from virtio-pci |
Date: |
Thu, 9 Aug 2018 08:22:44 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 |
On 08/08/2018 01:48 PM, Juan Quintela wrote:
> Signed-off-by: Juan Quintela <address@hidden>
> ---
> hw/virtio/Makefile.objs | 1 +
> hw/virtio/virtio-pci.c | 52 -------------------------
> hw/virtio/virtio-rng-pci.c | 77 ++++++++++++++++++++++++++++++++++++++
> tests/Makefile.include | 4 +-
> 4 files changed, 80 insertions(+), 54 deletions(-)
> create mode 100644 hw/virtio/virtio-rng-pci.c
>
> diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs
> index 6819ed4e14..2efa544a2d 100644
> --- a/hw/virtio/Makefile.objs
> +++ b/hw/virtio/Makefile.objs
> @@ -13,6 +13,7 @@ obj-$(CONFIG_LINUX) += vhost.o vhost-backend.o vhost-user.o
> obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock.o vhost-vsock-pci.o
> obj-$(CONFIG_VIRTIO_INPUT_HOST) += virtio-input-host-pci.o
> obj-$(CONFIG_VIRTIO_INPUT) += virtio-input-pci.o
> +obj-$(CONFIG_VIRTIO_RNG) += virtio-rng-pci.o
> endif
>
> common-obj-$(call lnot,$(call land,$(CONFIG_VIRTIO),$(CONFIG_LINUX))) +=
> vhost-stub.o
> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> index 992d3bc3b4..309fb20fef 100644
> --- a/hw/virtio/virtio-pci.c
> +++ b/hw/virtio/virtio-pci.c
> @@ -2409,57 +2409,6 @@ static const TypeInfo virtio_net_pci_info = {
> .class_init = virtio_net_pci_class_init,
> };
>
> -/* virtio-rng-pci */
> -
> -static void virtio_rng_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
> -{
> - VirtIORngPCI *vrng = VIRTIO_RNG_PCI(vpci_dev);
> - DeviceState *vdev = DEVICE(&vrng->vdev);
> - Error *err = NULL;
> -
> - qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
> - object_property_set_bool(OBJECT(vdev), true, "realized", &err);
> - if (err) {
> - error_propagate(errp, err);
> - return;
> - }
> -
> - object_property_set_link(OBJECT(vrng),
> - OBJECT(vrng->vdev.conf.rng), "rng",
> - NULL);
> -}
> -
> -static void virtio_rng_pci_class_init(ObjectClass *klass, void *data)
> -{
> - DeviceClass *dc = DEVICE_CLASS(klass);
> - VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
> - PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
> -
> - k->realize = virtio_rng_pci_realize;
> - set_bit(DEVICE_CATEGORY_MISC, dc->categories);
> -
> - pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
> - pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_RNG;
> - pcidev_k->revision = VIRTIO_PCI_ABI_VERSION;
> - pcidev_k->class_id = PCI_CLASS_OTHERS;
> -}
> -
> -static void virtio_rng_initfn(Object *obj)
> -{
> - VirtIORngPCI *dev = VIRTIO_RNG_PCI(obj);
> -
> - virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
> - TYPE_VIRTIO_RNG);
> -}
> -
> -static const TypeInfo virtio_rng_pci_info = {
> - .name = TYPE_VIRTIO_RNG_PCI,
> - .parent = TYPE_VIRTIO_PCI,
> - .instance_size = sizeof(VirtIORngPCI),
> - .instance_init = virtio_rng_initfn,
> - .class_init = virtio_rng_pci_class_init,
> -};
> -
> /* virtio-pci-bus */
>
> static void virtio_pci_bus_new(VirtioBusState *bus, size_t bus_size,
> @@ -2507,7 +2456,6 @@ static const TypeInfo virtio_pci_bus_info = {
>
> static void virtio_pci_register_types(void)
> {
> - type_register_static(&virtio_rng_pci_info);
> type_register_static(&virtio_pci_bus_info);
> type_register_static(&virtio_pci_info);
> #ifdef CONFIG_VIRTFS
> diff --git a/hw/virtio/virtio-rng-pci.c b/hw/virtio/virtio-rng-pci.c
> new file mode 100644
> index 0000000000..b7651c8b66
> --- /dev/null
> +++ b/hw/virtio/virtio-rng-pci.c
> @@ -0,0 +1,77 @@
> +/*
> + * Virtio rng PCI Bindings
> + *
> + * Copyright IBM, Corp. 2007
> + * Copyright (c) 2009 CodeSourcery
> + *
> + * Authors:
> + * Anthony Liguori <address@hidden>
> + * Paul Brook <address@hidden>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2. See
> + * the COPYING file in the top-level directory.
> + *
> + * Contributions after 2012-01-13 are licensed under the terms of the
> + * GNU GPL, version 2 or (at your option) any later version.
> + */
virtio-rng has been added by Amit in June 2012 (see commit 16c915ba42b4)
so you can use GPLv2+ text only here, too.
Thomas
(Sorry for being picky here, but these "contributions after ...." texts
really look cumbersome to me - we should use this occasion of your
rework to clean them up if possible)
- Re: [Qemu-devel] [PATCH v2 11/22] virtio: split host bits from virtio-pci, (continued)
- [Qemu-devel] [PATCH v2 08/22] check: Only test tpm devices when they are compiled in, Juan Quintela, 2018/08/08
- [Qemu-devel] [PATCH v2 14/22] virtio: split balloon bits from virtio-pci, Juan Quintela, 2018/08/08
- [Qemu-devel] [PATCH v2 12/22] virtio: split input bits from virtio-pci, Juan Quintela, 2018/08/08
- [Qemu-devel] [PATCH v2 13/22] virtio: split rng bits from virtio-pci, Juan Quintela, 2018/08/08
- Re: [Qemu-devel] [PATCH v2 13/22] virtio: split rng bits from virtio-pci,
Thomas Huth <=
- [Qemu-devel] [PATCH v2 15/22] virtio: split 9p bits from virtio-pci, Juan Quintela, 2018/08/08
- [Qemu-devel] [PATCH v2 16/22] virtio: split vhost-user-blk bits from virtio-pci, Juan Quintela, 2018/08/08
- [Qemu-devel] [PATCH v2 18/22] virtio: split vhost-scsi bits from virtio-pci, Juan Quintela, 2018/08/08
- [Qemu-devel] [PATCH v2 17/22] virtio: split vhost-user-scsi bits from virtio-pci, Juan Quintela, 2018/08/08
- [Qemu-devel] [PATCH v2 19/22] virtio: split virtio-scsi bits from virtio-pci, Juan Quintela, 2018/08/08