]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
AArch64: CPU Support for AArch64 (ARMv8 64bit).
authorPranavkumar Sawargaonkar <pranavkumar@linaro.org>
Tue, 8 Oct 2013 13:49:07 +0000 (19:19 +0530)
committerCole Robinson <crobinso@redhat.com>
Tue, 15 Oct 2013 20:59:26 +0000 (16:59 -0400)
Adding CPU encoder/decoder for AArch64.

Signed-off-by: Anup Patel <anup.patel@linaro.org>
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
(crobinso: fix for recent libvirt Ptr refactoring)

src/Makefile.am
src/cpu/cpu.c
src/cpu/cpu_aarch64.c [new file with mode: 0644]
src/cpu/cpu_aarch64.h [new file with mode: 0644]

index e58d4086c80ca357e21db1caecf51fba0d808dda..a9b6d587a49f7743a897be6f3f1fc1df38648920 100644 (file)
@@ -900,6 +900,7 @@ CPU_SOURCES =                                                       \
                cpu/cpu_x86.h cpu/cpu_x86.c cpu/cpu_x86_data.h  \
                cpu/cpu_s390.h cpu/cpu_s390.c                   \
                cpu/cpu_arm.h cpu/cpu_arm.c                     \
+               cpu/cpu_aarch64.h cpu/cpu_aarch64.c             \
                cpu/cpu_map.h cpu/cpu_map.c cpu/cpu_powerpc.h   \
                cpu/cpu_powerpc.c cpu/cpu_ppc_data.h
 
index 548edc79cb83190591aae12af7ebb4d9e23e0b45..677bb088fbe1749a1cb2e4db87d582b6d9f8cc0e 100644 (file)
@@ -32,6 +32,7 @@
 #include "cpu_powerpc.h"
 #include "cpu_s390.h"
 #include "cpu_arm.h"
+#include "cpu_aarch64.h"
 #include "cpu_generic.h"
 #include "util/virstring.h"
 
@@ -44,6 +45,7 @@ static struct cpuArchDriver *drivers[] = {
     &cpuDriverPowerPC,
     &cpuDriverS390,
     &cpuDriverArm,
+    &cpuDriverAARCH64,
     /* generic driver must always be the last one */
     &cpuDriverGeneric
 };
diff --git a/src/cpu/cpu_aarch64.c b/src/cpu/cpu_aarch64.c
new file mode 100644 (file)
index 0000000..3959deb
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * cpu_aarch64.c: CPU driver for AArch64 CPUs
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *      Anup Patel <anup.patel@linaro.org>
+ *      Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
+ */
+
+#include <config.h>
+
+#include "viralloc.h"
+#include "cpu.h"
+
+#define VIR_FROM_THIS VIR_FROM_CPU
+
+static const virArch archs[] = { VIR_ARCH_AARCH64 };
+
+static virCPUDataPtr
+AArch64NodeData(virArch arch)
+{
+    virCPUDataPtr data;
+
+    if (VIR_ALLOC(data) < 0)
+        return NULL;
+
+    data->arch = arch;
+
+    return data;
+}
+
+static int
+AArch64Decode(virCPUDefPtr cpu ATTRIBUTE_UNUSED,
+          const virCPUData *data ATTRIBUTE_UNUSED,
+          const char **models ATTRIBUTE_UNUSED,
+          unsigned int nmodels ATTRIBUTE_UNUSED,
+          const char *preferred ATTRIBUTE_UNUSED,
+          unsigned int flags)
+{
+
+    virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, -1);
+
+    return 0;
+}
+
+static void
+AArch64DataFree(virCPUDataPtr data)
+{
+    VIR_FREE(data);
+}
+
+struct cpuArchDriver cpuDriverAARCH64 = {
+    .name = "aarch64",
+    .arch = archs,
+    .narch = ARRAY_CARDINALITY(archs),
+    .compare = NULL,
+    .decode = AArch64Decode,
+    .encode = NULL,
+    .free = AArch64DataFree,
+    .nodeData = AArch64NodeData,
+    .guestData = NULL,
+    .baseline = NULL,
+    .update = NULL,
+    .hasFeature = NULL,
+};
diff --git a/src/cpu/cpu_aarch64.h b/src/cpu/cpu_aarch64.h
new file mode 100644 (file)
index 0000000..8e48368
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * cpu_aarch64.h: CPU driver for AArch64 CPUs
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ *      Anup Patel <anup.patel@linaro.org>
+ *      Pravakumar Sawargaonkar <pranavkumar@linaro.org>
+ */
+
+#ifndef __VIR_CPU_AARCH64_H__
+# define __VIR_CPU_AARCH64_H__
+
+# include "cpu.h"
+
+extern struct cpuArchDriver cpuDriverAARCH64;
+
+#endif /* __VIR_CPU_AARCH64_H__ */