* [Qemu-devel] [RFC, v1, 1/2] hw/vfio/platform: add hisilicon hnsvf device
@ 2016-10-21 1:22 Rick Song
2016-11-16 12:17 ` Auger Eric
0 siblings, 1 reply; 4+ messages in thread
From: Rick Song @ 2016-10-21 1:22 UTC (permalink / raw)
To: qemu-devel, alex.williamson
The platform device class has become abstract. This
patch introduces a hisilicon hnsvf device that derives
from it.
Signed-off-by: Rick Song <songwenjun@huawei.com>
---
hw/vfio/Makefile.objs | 1 +
hw/vfio/hisi-hnsvf.c | 56 +++++++++++++++++++++++++++++++++++++++
include/hw/vfio/vfio-hisi-hnsvf.h | 51 +++++++++++++++++++++++++++++++++++
3 files changed, 108 insertions(+)
create mode 100644 hw/vfio/hisi-hnsvf.c
create mode 100644 include/hw/vfio/vfio-hisi-hnsvf.h
diff --git a/hw/vfio/Makefile.objs b/hw/vfio/Makefile.objs
index c25e32b..d19dffc 100644
--- a/hw/vfio/Makefile.objs
+++ b/hw/vfio/Makefile.objs
@@ -4,5 +4,6 @@ obj-$(CONFIG_PCI) += pci.o pci-quirks.o
obj-$(CONFIG_SOFTMMU) += platform.o
obj-$(CONFIG_SOFTMMU) += calxeda-xgmac.o
obj-$(CONFIG_SOFTMMU) += amd-xgbe.o
+obj-$(CONFIG_SOFTMMU) += hisi-hnsvf.o
obj-$(CONFIG_SOFTMMU) += spapr.o
endif
diff --git a/hw/vfio/hisi-hnsvf.c b/hw/vfio/hisi-hnsvf.c
new file mode 100644
index 0000000..5b48e27
--- /dev/null
+++ b/hw/vfio/hisi-hnsvf.c
@@ -0,0 +1,56 @@
+/*
+ * Hisilicon HNS Virtual Function VFIO device
+ *
+ * Copyright Huawei Limited, 2016
+ *
+ * Authors:
+ * Rick Song <songwenjun@huawei.org>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#include "qemu/osdep.h"
+#include "hw/vfio/vfio-hisi-hnsvf.h"
+
+static void hisi_hnsvf_realize(DeviceState *dev, Error **errp)
+{
+ VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(dev);
+ VFIOHisiHnsvfDeviceClass *k = VFIO_HISI_HNSVF_DEVICE_GET_CLASS(dev);
+
+ vdev->compat = g_strdup("hisilicon,hnsvf-v2");
+
+ k->parent_realize(dev, errp);
+}
+
+static const VMStateDescription vfio_platform_hisi_hnsvf_vmstate = {
+ .name = TYPE_VFIO_HISI_HNSVF,
+ .unmigratable = 1,
+};
+
+static void vfio_hisi_hnsvf_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ VFIOHisiHnsvfDeviceClass *vcxc =
+ VFIO_HISI_HNSVF_DEVICE_CLASS(klass);
+ vcxc->parent_realize = dc->realize;
+ dc->realize = hisi_hnsvf_realize;
+ dc->desc = "VFIO HISI HNSVF";
+ dc->vmsd = &vfio_platform_hisi_hnsvf_vmstate;
+}
+
+static const TypeInfo vfio_hisi_hnsvf_dev_info = {
+ .name = TYPE_VFIO_HISI_HNSVF,
+ .parent = TYPE_VFIO_PLATFORM,
+ .instance_size = sizeof(VFIOHisiHnsvfDevice),
+ .class_init = vfio_hisi_hnsvf_class_init,
+ .class_size = sizeof(VFIOHisiHnsvfDeviceClass),
+};
+
+static void register_hisi_hnsvf_dev_type(void)
+{
+ type_register_static(&vfio_hisi_hnsvf_dev_info);
+}
+
+type_init(register_hisi_hnsvf_dev_type)
diff --git a/include/hw/vfio/vfio-hisi-hnsvf.h b/include/hw/vfio/vfio-hisi-hnsvf.h
new file mode 100644
index 0000000..9208656
--- /dev/null
+++ b/include/hw/vfio/vfio-hisi-hnsvf.h
@@ -0,0 +1,51 @@
+/*
+ * VFIO Hisilicon HNS Virtual Function device
+ *
+ * Copyright Hisilicon Limited, 2016
+ *
+ * Authors:
+ * Rick Song <songwenjun@huawei.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef HW_VFIO_VFIO_HISI_HNSVF_H
+#define HW_VFIO_VFIO_HISI_HNSVF_H
+
+#include "hw/vfio/vfio-platform.h"
+
+#define TYPE_VFIO_HISI_HNSVF "vfio-hisi-hnsvf"
+
+/**
+ * This device exposes:
+ * - 5 MMIO regions: MAC, PCS, SerDes Rx/Tx regs,
+ SerDes Integration Registers 1/2 & 2/2
+ * - 2 level sensitive IRQs and optional DMA channel IRQs
+ */
+struct VFIOHisiHnsvfDevice {
+ VFIOPlatformDevice vdev;
+};
+
+typedef struct VFIOHisiHnsvfDevice VFIOHisiHnsvfDevice;
+
+struct VFIOHisiHnsvfDeviceClass {
+ /*< private >*/
+ VFIOPlatformDeviceClass parent_class;
+ /*< public >*/
+ DeviceRealize parent_realize;
+};
+
+typedef struct VFIOHisiHnsvfDeviceClass VFIOHisiHnsvfDeviceClass;
+
+#define VFIO_HISI_HNSVF_DEVICE(obj) \
+ OBJECT_CHECK(VFIOHisiHnsvfDevice, (obj), TYPE_VFIO_HISI_HNSVF)
+#define VFIO_HISI_HNSVF_DEVICE_CLASS(klass) \
+ OBJECT_CLASS_CHECK(VFIOHisiHnsvfDeviceClass, (klass), \
+ TYPE_VFIO_HISI_HNSVF)
+#define VFIO_HISI_HNSVF_DEVICE_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(VFIOHisiHnsvfDeviceClass, (obj), \
+ TYPE_VFIO_HISI_HNSVF)
+
+#endif
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [RFC, v1, 1/2] hw/vfio/platform: add hisilicon hnsvf device
@ 2016-10-21 1:42 Rick Song
2016-10-21 1:42 ` [Qemu-devel] [RFC, v1, 2/2] hw/arm/sysbus-fdt: enable vfio-hisi-hnsvf dynamic instantiation Rick Song
0 siblings, 1 reply; 4+ messages in thread
From: Rick Song @ 2016-10-21 1:42 UTC (permalink / raw)
To: qemu-devel, alex.williamson
The platform device class has become abstract. This
patch introduces a hisilicon hnsvf device that derives
from it.
Signed-off-by: Rick Song <songwenjun@huawei.com>
---
hw/vfio/Makefile.objs | 1 +
hw/vfio/hisi-hnsvf.c | 56 +++++++++++++++++++++++++++++++++++++++
include/hw/vfio/vfio-hisi-hnsvf.h | 51 +++++++++++++++++++++++++++++++++++
3 files changed, 108 insertions(+)
create mode 100644 hw/vfio/hisi-hnsvf.c
create mode 100644 include/hw/vfio/vfio-hisi-hnsvf.h
diff --git a/hw/vfio/Makefile.objs b/hw/vfio/Makefile.objs
index c25e32b..d19dffc 100644
--- a/hw/vfio/Makefile.objs
+++ b/hw/vfio/Makefile.objs
@@ -4,5 +4,6 @@ obj-$(CONFIG_PCI) += pci.o pci-quirks.o
obj-$(CONFIG_SOFTMMU) += platform.o
obj-$(CONFIG_SOFTMMU) += calxeda-xgmac.o
obj-$(CONFIG_SOFTMMU) += amd-xgbe.o
+obj-$(CONFIG_SOFTMMU) += hisi-hnsvf.o
obj-$(CONFIG_SOFTMMU) += spapr.o
endif
diff --git a/hw/vfio/hisi-hnsvf.c b/hw/vfio/hisi-hnsvf.c
new file mode 100644
index 0000000..5b48e27
--- /dev/null
+++ b/hw/vfio/hisi-hnsvf.c
@@ -0,0 +1,56 @@
+/*
+ * Hisilicon HNS Virtual Function VFIO device
+ *
+ * Copyright Huawei Limited, 2016
+ *
+ * Authors:
+ * Rick Song <songwenjun@huawei.org>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#include "qemu/osdep.h"
+#include "hw/vfio/vfio-hisi-hnsvf.h"
+
+static void hisi_hnsvf_realize(DeviceState *dev, Error **errp)
+{
+ VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(dev);
+ VFIOHisiHnsvfDeviceClass *k = VFIO_HISI_HNSVF_DEVICE_GET_CLASS(dev);
+
+ vdev->compat = g_strdup("hisilicon,hnsvf-v2");
+
+ k->parent_realize(dev, errp);
+}
+
+static const VMStateDescription vfio_platform_hisi_hnsvf_vmstate = {
+ .name = TYPE_VFIO_HISI_HNSVF,
+ .unmigratable = 1,
+};
+
+static void vfio_hisi_hnsvf_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ VFIOHisiHnsvfDeviceClass *vcxc =
+ VFIO_HISI_HNSVF_DEVICE_CLASS(klass);
+ vcxc->parent_realize = dc->realize;
+ dc->realize = hisi_hnsvf_realize;
+ dc->desc = "VFIO HISI HNSVF";
+ dc->vmsd = &vfio_platform_hisi_hnsvf_vmstate;
+}
+
+static const TypeInfo vfio_hisi_hnsvf_dev_info = {
+ .name = TYPE_VFIO_HISI_HNSVF,
+ .parent = TYPE_VFIO_PLATFORM,
+ .instance_size = sizeof(VFIOHisiHnsvfDevice),
+ .class_init = vfio_hisi_hnsvf_class_init,
+ .class_size = sizeof(VFIOHisiHnsvfDeviceClass),
+};
+
+static void register_hisi_hnsvf_dev_type(void)
+{
+ type_register_static(&vfio_hisi_hnsvf_dev_info);
+}
+
+type_init(register_hisi_hnsvf_dev_type)
diff --git a/include/hw/vfio/vfio-hisi-hnsvf.h b/include/hw/vfio/vfio-hisi-hnsvf.h
new file mode 100644
index 0000000..9208656
--- /dev/null
+++ b/include/hw/vfio/vfio-hisi-hnsvf.h
@@ -0,0 +1,51 @@
+/*
+ * VFIO Hisilicon HNS Virtual Function device
+ *
+ * Copyright Hisilicon Limited, 2016
+ *
+ * Authors:
+ * Rick Song <songwenjun@huawei.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef HW_VFIO_VFIO_HISI_HNSVF_H
+#define HW_VFIO_VFIO_HISI_HNSVF_H
+
+#include "hw/vfio/vfio-platform.h"
+
+#define TYPE_VFIO_HISI_HNSVF "vfio-hisi-hnsvf"
+
+/**
+ * This device exposes:
+ * - 5 MMIO regions: MAC, PCS, SerDes Rx/Tx regs,
+ SerDes Integration Registers 1/2 & 2/2
+ * - 2 level sensitive IRQs and optional DMA channel IRQs
+ */
+struct VFIOHisiHnsvfDevice {
+ VFIOPlatformDevice vdev;
+};
+
+typedef struct VFIOHisiHnsvfDevice VFIOHisiHnsvfDevice;
+
+struct VFIOHisiHnsvfDeviceClass {
+ /*< private >*/
+ VFIOPlatformDeviceClass parent_class;
+ /*< public >*/
+ DeviceRealize parent_realize;
+};
+
+typedef struct VFIOHisiHnsvfDeviceClass VFIOHisiHnsvfDeviceClass;
+
+#define VFIO_HISI_HNSVF_DEVICE(obj) \
+ OBJECT_CHECK(VFIOHisiHnsvfDevice, (obj), TYPE_VFIO_HISI_HNSVF)
+#define VFIO_HISI_HNSVF_DEVICE_CLASS(klass) \
+ OBJECT_CLASS_CHECK(VFIOHisiHnsvfDeviceClass, (klass), \
+ TYPE_VFIO_HISI_HNSVF)
+#define VFIO_HISI_HNSVF_DEVICE_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(VFIOHisiHnsvfDeviceClass, (obj), \
+ TYPE_VFIO_HISI_HNSVF)
+
+#endif
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [RFC, v1, 2/2] hw/arm/sysbus-fdt: enable vfio-hisi-hnsvf dynamic instantiation
2016-10-21 1:42 [Qemu-devel] [RFC, v1, 1/2] hw/vfio/platform: add hisilicon hnsvf device Rick Song
@ 2016-10-21 1:42 ` Rick Song
0 siblings, 0 replies; 4+ messages in thread
From: Rick Song @ 2016-10-21 1:42 UTC (permalink / raw)
To: qemu-devel, alex.williamson
This patch allows the instantiation of the vfio-hisi-hnsvf device
from the QEMU command line (-device vfio-hisi-hnsvf,host="<device>").
A specialized device tree node is created for the guest, containing
compat, dma-coherent, reg and interrupts properties.
Signed-off-by: Rick Song <songwenjun@huawei.com>
---
hw/arm/sysbus-fdt.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 71 insertions(+)
diff --git a/hw/arm/sysbus-fdt.c b/hw/arm/sysbus-fdt.c
index d68e3dc..207586f 100644
--- a/hw/arm/sysbus-fdt.c
+++ b/hw/arm/sysbus-fdt.c
@@ -36,6 +36,7 @@
#include "hw/vfio/vfio-platform.h"
#include "hw/vfio/vfio-calxeda-xgmac.h"
#include "hw/vfio/vfio-amd-xgbe.h"
+#include "hw/vfio/vfio-hisi-hnsvf.h"
#include "hw/arm/fdt.h"
/*
@@ -413,6 +414,75 @@ static int add_amd_xgbe_fdt_node(SysBusDevice *sbdev, void *opaque)
return 0;
}
+/**
+ * add_hisi_hnsvf_fdt_node
+ *
+ * Generates a simple node with following properties:
+ * compatible string, regs, interrupts, dma-coherent
+ */
+static int add_hisi_hnsvf_fdt_node(SysBusDevice *sbdev, void *opaque)
+{
+ PlatformBusFDTData *data = opaque;
+ PlatformBusDevice *pbus = data->pbus;
+ void *fdt = data->fdt;
+ const char *parent_node = data->pbus_node_name;
+ int compat_str_len, i;
+ char *nodename;
+ uint32_t *irq_attr, *reg_attr;
+ uint64_t mmio_base, irq_number;
+ VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(sbdev);
+ VFIODevice *vbasedev = &vdev->vbasedev;
+ VFIOINTp *intp;
+
+ mmio_base = platform_bus_get_mmio_addr(pbus, sbdev, 0);
+ nodename = g_strdup_printf("%s/%s@%" PRIx64, parent_node,
+ vbasedev->name, mmio_base);
+ qemu_fdt_add_subnode(fdt, nodename);
+
+ compat_str_len = strlen(vdev->compat) + 1;
+ qemu_fdt_setprop(fdt, nodename, "compatible",
+ vdev->compat, compat_str_len);
+
+ qemu_fdt_setprop(fdt, nodename, "dma-coherent", "", 0);
+
+ reg_attr = g_new(uint32_t, vbasedev->num_regions * 2);
+ for (i = 0; i < vbasedev->num_regions; i++) {
+ mmio_base = platform_bus_get_mmio_addr(pbus, sbdev, i);
+ reg_attr[2 * i] = cpu_to_be32(mmio_base);
+ reg_attr[2 * i + 1] = cpu_to_be32(
+ memory_region_size(vdev->regions[i]->mem));
+ }
+ qemu_fdt_setprop(fdt, nodename, "reg", reg_attr,
+ vbasedev->num_regions * 2 * sizeof(uint32_t));
+
+ irq_attr = g_new(uint32_t, vbasedev->num_irqs * 3);
+ for (i = 0; i < vbasedev->num_irqs; i++) {
+ irq_number = platform_bus_get_irqn(pbus, sbdev , i)
+ + data->irq_start;
+ irq_attr[3 * i] = cpu_to_be32(GIC_FDT_IRQ_TYPE_SPI);
+ irq_attr[3 * i + 1] = cpu_to_be32(irq_number);
+
+ QLIST_FOREACH(intp, &vdev->intp_list, next) {
+ if (intp->pin == i) {
+ break;
+ }
+ }
+
+ if (intp->flags & VFIO_IRQ_INFO_AUTOMASKED) {
+ irq_attr[3 * i + 2] = cpu_to_be32(GIC_FDT_IRQ_FLAGS_LEVEL_HI);
+ } else {
+ irq_attr[3 * i + 2] = cpu_to_be32(GIC_FDT_IRQ_FLAGS_EDGE_LO_HI);
+ }
+ }
+ qemu_fdt_setprop(fdt, nodename, "interrupts",
+ irq_attr, vbasedev->num_irqs * 3 * sizeof(uint32_t));
+ g_free(irq_attr);
+ g_free(reg_attr);
+ g_free(nodename);
+ return 0;
+
+}
+
#endif /* CONFIG_LINUX */
/* list of supported dynamic sysbus devices */
@@ -420,6 +490,7 @@ static const NodeCreationPair add_fdt_node_functions[] = {
#ifdef CONFIG_LINUX
{TYPE_VFIO_CALXEDA_XGMAC, add_calxeda_midway_xgmac_fdt_node},
{TYPE_VFIO_AMD_XGBE, add_amd_xgbe_fdt_node},
+ {TYPE_VFIO_HISI_HNSVF, add_hisi_hnsvf_fdt_node},
#endif
{"", NULL}, /* last element */
};
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [RFC, v1, 1/2] hw/vfio/platform: add hisilicon hnsvf device
2016-10-21 1:22 [Qemu-devel] [RFC, v1, 1/2] hw/vfio/platform: add hisilicon hnsvf device Rick Song
@ 2016-11-16 12:17 ` Auger Eric
0 siblings, 0 replies; 4+ messages in thread
From: Auger Eric @ 2016-11-16 12:17 UTC (permalink / raw)
To: Rick Song, qemu-devel, alex.williamson
Hi Rick,
On 21/10/2016 03:22, Rick Song wrote:
> The platform device class has become abstract. This
> patch introduces a hisilicon hnsvf device that derives
> from it.
in https://lists.gnu.org/archive/html/qemu-devel/2016-08/msg03401.html
we discussed the relevance to get the platform device non abstract. No
change was submitted though. I can submit something next week except if
you want to submit a patch yourself.
The idea is we would instantiate the vfio platform device using such an
option:
-device vfio-platform-device,compat="hisilicon,hnsvf-v2"
Once such change is accepted, only your second patch will be requested.
Thanks
Eric
>
> Signed-off-by: Rick Song <songwenjun@huawei.com>
> ---
> hw/vfio/Makefile.objs | 1 +
> hw/vfio/hisi-hnsvf.c | 56 +++++++++++++++++++++++++++++++++++++++
> include/hw/vfio/vfio-hisi-hnsvf.h | 51 +++++++++++++++++++++++++++++++++++
> 3 files changed, 108 insertions(+)
> create mode 100644 hw/vfio/hisi-hnsvf.c
> create mode 100644 include/hw/vfio/vfio-hisi-hnsvf.h
>
> diff --git a/hw/vfio/Makefile.objs b/hw/vfio/Makefile.objs
> index c25e32b..d19dffc 100644
> --- a/hw/vfio/Makefile.objs
> +++ b/hw/vfio/Makefile.objs
> @@ -4,5 +4,6 @@ obj-$(CONFIG_PCI) += pci.o pci-quirks.o
> obj-$(CONFIG_SOFTMMU) += platform.o
> obj-$(CONFIG_SOFTMMU) += calxeda-xgmac.o
> obj-$(CONFIG_SOFTMMU) += amd-xgbe.o
> +obj-$(CONFIG_SOFTMMU) += hisi-hnsvf.o
> obj-$(CONFIG_SOFTMMU) += spapr.o
> endif
> diff --git a/hw/vfio/hisi-hnsvf.c b/hw/vfio/hisi-hnsvf.c
> new file mode 100644
> index 0000000..5b48e27
> --- /dev/null
> +++ b/hw/vfio/hisi-hnsvf.c
> @@ -0,0 +1,56 @@
> +/*
> + * Hisilicon HNS Virtual Function VFIO device
> + *
> + * Copyright Huawei Limited, 2016
> + *
> + * Authors:
> + * Rick Song <songwenjun@huawei.org>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2. See
> + * the COPYING file in the top-level directory.
> + *
> + */
> +
> +#include "qemu/osdep.h"
> +#include "hw/vfio/vfio-hisi-hnsvf.h"
> +
> +static void hisi_hnsvf_realize(DeviceState *dev, Error **errp)
> +{
> + VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(dev);
> + VFIOHisiHnsvfDeviceClass *k = VFIO_HISI_HNSVF_DEVICE_GET_CLASS(dev);
> +
> + vdev->compat = g_strdup("hisilicon,hnsvf-v2");
> +
> + k->parent_realize(dev, errp);
> +}
> +
> +static const VMStateDescription vfio_platform_hisi_hnsvf_vmstate = {
> + .name = TYPE_VFIO_HISI_HNSVF,
> + .unmigratable = 1,
> +};
> +
> +static void vfio_hisi_hnsvf_class_init(ObjectClass *klass, void *data)
> +{
> + DeviceClass *dc = DEVICE_CLASS(klass);
> + VFIOHisiHnsvfDeviceClass *vcxc =
> + VFIO_HISI_HNSVF_DEVICE_CLASS(klass);
> + vcxc->parent_realize = dc->realize;
> + dc->realize = hisi_hnsvf_realize;
> + dc->desc = "VFIO HISI HNSVF";
> + dc->vmsd = &vfio_platform_hisi_hnsvf_vmstate;
> +}
> +
> +static const TypeInfo vfio_hisi_hnsvf_dev_info = {
> + .name = TYPE_VFIO_HISI_HNSVF,
> + .parent = TYPE_VFIO_PLATFORM,
> + .instance_size = sizeof(VFIOHisiHnsvfDevice),
> + .class_init = vfio_hisi_hnsvf_class_init,
> + .class_size = sizeof(VFIOHisiHnsvfDeviceClass),
> +};
> +
> +static void register_hisi_hnsvf_dev_type(void)
> +{
> + type_register_static(&vfio_hisi_hnsvf_dev_info);
> +}
> +
> +type_init(register_hisi_hnsvf_dev_type)
> diff --git a/include/hw/vfio/vfio-hisi-hnsvf.h b/include/hw/vfio/vfio-hisi-hnsvf.h
> new file mode 100644
> index 0000000..9208656
> --- /dev/null
> +++ b/include/hw/vfio/vfio-hisi-hnsvf.h
> @@ -0,0 +1,51 @@
> +/*
> + * VFIO Hisilicon HNS Virtual Function device
> + *
> + * Copyright Hisilicon Limited, 2016
> + *
> + * Authors:
> + * Rick Song <songwenjun@huawei.com>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2. See
> + * the COPYING file in the top-level directory.
> + *
> + */
> +
> +#ifndef HW_VFIO_VFIO_HISI_HNSVF_H
> +#define HW_VFIO_VFIO_HISI_HNSVF_H
> +
> +#include "hw/vfio/vfio-platform.h"
> +
> +#define TYPE_VFIO_HISI_HNSVF "vfio-hisi-hnsvf"
> +
> +/**
> + * This device exposes:
> + * - 5 MMIO regions: MAC, PCS, SerDes Rx/Tx regs,
> + SerDes Integration Registers 1/2 & 2/2
> + * - 2 level sensitive IRQs and optional DMA channel IRQs
> + */
> +struct VFIOHisiHnsvfDevice {
> + VFIOPlatformDevice vdev;
> +};
> +
> +typedef struct VFIOHisiHnsvfDevice VFIOHisiHnsvfDevice;
> +
> +struct VFIOHisiHnsvfDeviceClass {
> + /*< private >*/
> + VFIOPlatformDeviceClass parent_class;
> + /*< public >*/
> + DeviceRealize parent_realize;
> +};
> +
> +typedef struct VFIOHisiHnsvfDeviceClass VFIOHisiHnsvfDeviceClass;
> +
> +#define VFIO_HISI_HNSVF_DEVICE(obj) \
> + OBJECT_CHECK(VFIOHisiHnsvfDevice, (obj), TYPE_VFIO_HISI_HNSVF)
> +#define VFIO_HISI_HNSVF_DEVICE_CLASS(klass) \
> + OBJECT_CLASS_CHECK(VFIOHisiHnsvfDeviceClass, (klass), \
> + TYPE_VFIO_HISI_HNSVF)
> +#define VFIO_HISI_HNSVF_DEVICE_GET_CLASS(obj) \
> + OBJECT_GET_CLASS(VFIOHisiHnsvfDeviceClass, (obj), \
> + TYPE_VFIO_HISI_HNSVF)
> +
> +#endif
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-11-16 12:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-21 1:42 [Qemu-devel] [RFC, v1, 1/2] hw/vfio/platform: add hisilicon hnsvf device Rick Song
2016-10-21 1:42 ` [Qemu-devel] [RFC, v1, 2/2] hw/arm/sysbus-fdt: enable vfio-hisi-hnsvf dynamic instantiation Rick Song
-- strict thread matches above, loose matches on Subject: below --
2016-10-21 1:22 [Qemu-devel] [RFC, v1, 1/2] hw/vfio/platform: add hisilicon hnsvf device Rick Song
2016-11-16 12:17 ` Auger Eric
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).