diff mbox

[RFC,20/25] accel: TYPE_X86_ACCEL interface

Message ID 1404943462-711-21-git-send-email-ehabkost@redhat.com
State New
Headers show

Commit Message

Eduardo Habkost July 9, 2014, 10:04 p.m. UTC
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/hw/i386/accel.h   | 35 +++++++++++++++++++++++++++++++++++
 target-i386/Makefile.objs |  1 +
 target-i386/accel.c       | 38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 74 insertions(+)
 create mode 100644 include/hw/i386/accel.h
 create mode 100644 target-i386/accel.c
diff mbox

Patch

diff --git a/include/hw/i386/accel.h b/include/hw/i386/accel.h
new file mode 100644
index 0000000..63d60c7
--- /dev/null
+++ b/include/hw/i386/accel.h
@@ -0,0 +1,35 @@ 
+/* TYPE_X86_ACCEL interface
+ */
+#ifndef HW_I386_ACCEL_H
+#define HW_I386_ACCEL_H
+
+#include "hw/accel.h"
+
+#define TYPE_X86_ACCEL "x86-accel"
+
+#define X86_ACCEL_CLASS(klass) \
+     OBJECT_CLASS_CHECK(X86AccelClass, (klass), TYPE_X86_ACCEL)
+#define X86_ACCEL_GET_CLASS(obj) \
+     OBJECT_GET_CLASS(X86AccelClass, (obj), TYPE_X86_ACCEL)
+#define X86_ACCEL(obj) \
+     INTERFACE_CHECK(X86Accel, (obj), TYPE_X86_ACCEL)
+
+
+typedef struct X86Accel {
+    /* <private> */
+    Object Parent;
+} X86Accel;
+
+/**
+ * HotplugDeviceClass:
+ *
+ * Interface that may be implemented by target-specific accelerator
+ * classes.
+ */
+typedef struct X86AccelClass {
+    /* <private> */
+    InterfaceClass parent;
+} X86AccelClass;
+
+
+#endif
diff --git a/target-i386/Makefile.objs b/target-i386/Makefile.objs
index 027b94e..0537185 100644
--- a/target-i386/Makefile.objs
+++ b/target-i386/Makefile.objs
@@ -2,6 +2,7 @@  obj-y += translate.o helper.o cpu.o
 obj-y += excp_helper.o fpu_helper.o cc_helper.o int_helper.o svm_helper.o
 obj-y += smm_helper.o misc_helper.o mem_helper.o seg_helper.o
 obj-y += gdbstub.o
+obj-y += accel.o
 obj-$(CONFIG_SOFTMMU) += machine.o arch_memory_mapping.o arch_dump.o
 obj-$(CONFIG_KVM) += kvm.o
 obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
diff --git a/target-i386/accel.c b/target-i386/accel.c
new file mode 100644
index 0000000..6ca1a48
--- /dev/null
+++ b/target-i386/accel.c
@@ -0,0 +1,38 @@ 
+/* TYPE_X86_ACCEL interface
+ *
+ * Copyright (c) 2014 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "qemu/module.h"
+#include "hw/i386/accel.h"
+
+static const TypeInfo x86_accel_type = {
+    .name = TYPE_X86_ACCEL,
+    .parent = TYPE_INTERFACE,
+    .class_size = sizeof(X86AccelClass),
+};
+
+static void x86_accel_type_init(void)
+{
+    type_register_static(&x86_accel_type);
+}
+
+type_init(x86_accel_type_init);