From: Baptiste Reynal <b.reynal@virtualopensystems.com>
To: kvmarm@lists.cs.columbia.edu, qemu-devel@nongnu.org,
eric.auger@linaro.org
Cc: a.motakis@virtualopensystems.com,
Alex Williamson <alex.williamson@redhat.com>,
tech@virtualopensystems.com,
Baptiste Reynal <b.reynal@virtualopensystems.com>,
Peter Maydell <peter.maydell@linaro.org>
Subject: [Qemu-devel] [RFC PATCH 3/3] hw/vfio: add pl330 device support
Date: Wed, 17 Dec 2014 11:09:41 +0100 [thread overview]
Message-ID: <1418810981-9193-4-git-send-email-b.reynal@virtualopensystems.com> (raw)
In-Reply-To: <1418810981-9193-1-git-send-email-b.reynal@virtualopensystems.com>
Create a meta-device for PL330 DMA.
Signed-off-by: Baptiste Reynal <b.reynal@virtualopensystems.com>
---
hw/arm/sysbus-fdt.c | 2 ++
hw/vfio/Makefile.objs | 1 +
hw/vfio/pl330.c | 41 +++++++++++++++++++++++++++++++++++++++++
include/hw/vfio/vfio-pl330.h | 26 ++++++++++++++++++++++++++
4 files changed, 70 insertions(+)
create mode 100644 hw/vfio/pl330.c
create mode 100644 include/hw/vfio/vfio-pl330.h
diff --git a/hw/arm/sysbus-fdt.c b/hw/arm/sysbus-fdt.c
index 41b4c87..1141185 100644
--- a/hw/arm/sysbus-fdt.c
+++ b/hw/arm/sysbus-fdt.c
@@ -28,6 +28,7 @@
#include "sysemu/sysemu.h"
#include "hw/vfio/vfio-platform.h"
#include "hw/vfio/vfio-calxeda-xgmac.h"
+#include "hw/vfio/vfio-pl330.h"
/*
* internal struct that contains the information to create dynamic
@@ -163,6 +164,7 @@ fail:
/* list of supported dynamic sysbus devices */
static const NodeCreationPair add_fdt_node_functions[] = {
{TYPE_VFIO_CALXEDA_XGMAC, add_generic_fdt_node},
+{TYPE_VFIO_PL330, add_generic_fdt_node},
{"", NULL}, /*last element*/
};
diff --git a/hw/vfio/Makefile.objs b/hw/vfio/Makefile.objs
index 913ab14..be3023b 100644
--- a/hw/vfio/Makefile.objs
+++ b/hw/vfio/Makefile.objs
@@ -3,4 +3,5 @@ obj-$(CONFIG_SOFTMMU) += common.o
obj-$(CONFIG_PCI) += pci.o
obj-$(CONFIG_SOFTMMU) += platform.o
obj-$(CONFIG_SOFTMMU) += calxeda_xgmac.o
+obj-$(CONFIG_SOFTMMU) += pl330.o
endif
diff --git a/hw/vfio/pl330.c b/hw/vfio/pl330.c
new file mode 100644
index 0000000..a409024
--- /dev/null
+++ b/hw/vfio/pl330.c
@@ -0,0 +1,41 @@
+#include "hw/vfio/vfio-pl330.h"
+
+static void pl330_realize(DeviceState *dev, Error **errp)
+{
+ VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(dev);
+ VFIOPl330DeviceClass *k = VFIO_PL330_DEVICE_GET_CLASS(dev);
+
+ vdev->compat = g_strdup("arm,pl330;arm,primecell");
+
+ k->parent_realize(dev, errp);
+}
+
+static const VMStateDescription vfio_platform_vmstate = {
+ .name = TYPE_VFIO_PL330,
+ .unmigratable = 1,
+};
+
+static void vfio_pl330_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ VFIOPl330DeviceClass *vpc =
+ VFIO_PL330_DEVICE_CLASS(klass);
+ vpc->parent_realize = dc->realize;
+ dc->realize = pl330_realize;
+ dc->desc = "VFIO PL330";
+}
+
+static const TypeInfo vfio_pl330_dev_info = {
+ .name = TYPE_VFIO_PL330,
+ .parent = TYPE_VFIO_PLATFORM,
+ .instance_size = sizeof(VFIOPl330Device),
+ .class_init = vfio_pl330_class_init,
+ .class_size = sizeof(VFIOPl330DeviceClass),
+};
+
+static void register_pl330_dev_type(void)
+{
+ type_register_static(&vfio_pl330_dev_info);
+}
+
+type_init(register_pl330_dev_type)
diff --git a/include/hw/vfio/vfio-pl330.h b/include/hw/vfio/vfio-pl330.h
new file mode 100644
index 0000000..1cdf039
--- /dev/null
+++ b/include/hw/vfio/vfio-pl330.h
@@ -0,0 +1,26 @@
+#ifndef HW_VFIO_VFIO_PL330
+#define HW_VFIO_VFIO_PL330
+
+#include "hw/vfio/vfio-platform.h"
+
+#define TYPE_VFIO_PL330 "vfio-pl330"
+
+typedef struct VFIOPl330Device {
+ VFIOPlatformDevice vdev;
+} VFIOPl330Device;
+
+typedef struct VFIOPl330DeviceClass {
+ VFIOPlatformDeviceClass parent_class;
+ DeviceRealize parent_realize;
+} VFIOPl330DeviceClass;
+
+#define VFIO_PL330_DEVICE(obj) \
+ OBJECT_CHECK(VFIOPl330Device, (obj), TYPE_VFIO_PL330)
+#define VFIO_PL330_DEVICE_CLASS(klass) \
+ OBJECT_CLASS_CHECK(VFIOPl330DeviceClass, (klass), \
+ TYPE_VFIO_PL330)
+#define VFIO_PL330_DEVICE_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(VFIOPl330DeviceClass, (obj), \
+ TYPE_VFIO_PL330)
+
+#endif
--
2.1.3
next prev parent reply other threads:[~2014-12-17 10:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-17 10:09 [Qemu-devel] [RFC PATCH 0/3] VFIO support for AMBA devices Baptiste Reynal
2014-12-17 10:09 ` [Qemu-devel] [RFC PATCH 1/3] hw/vfio/sysbus-fdt: generic add_generic_fdt_node Baptiste Reynal
2014-12-17 13:32 ` Eric Auger
2014-12-17 14:55 ` Baptiste Reynal
2014-12-17 17:15 ` Eric Auger
2014-12-17 10:09 ` [Qemu-devel] [RFC PATCH 2/3] hw/vfio: amba device support Baptiste Reynal
2014-12-17 13:57 ` Eric Auger
2014-12-17 10:09 ` Baptiste Reynal [this message]
2014-12-17 13:04 ` [Qemu-devel] [RFC PATCH 0/3] VFIO support for AMBA devices Eric Auger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1418810981-9193-4-git-send-email-b.reynal@virtualopensystems.com \
--to=b.reynal@virtualopensystems.com \
--cc=a.motakis@virtualopensystems.com \
--cc=alex.williamson@redhat.com \
--cc=eric.auger@linaro.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=tech@virtualopensystems.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).