Adding CPU encoder/decoder for AArch64. Signed-off-by: Anup Patel <anup.patel@xxxxxxxxxx> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@xxxxxxxxxx> --- src/Makefile.am | 1 + src/cpu/cpu.c | 2 ++ src/cpu/cpu_aarch64.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++ src/cpu/cpu_aarch64.h | 31 +++++++++++++++++++ 4 files changed, 113 insertions(+) create mode 100644 src/cpu/cpu_aarch64.c create mode 100644 src/cpu/cpu_aarch64.h diff --git a/src/Makefile.am b/src/Makefile.am index 201c268..d5e62d8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 31de857..e611452 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -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 index 0000000..8c78eca --- /dev/null +++ b/src/cpu/cpu_aarch64.c @@ -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@xxxxxxxxxx> + * Pranavkumar Sawargaonkar <pranavkumar@xxxxxxxxxx> + */ + +#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 virCPUDataPtr 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 index 0000000..8e48368 --- /dev/null +++ b/src/cpu/cpu_aarch64.h @@ -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@xxxxxxxxxx> + * Pravakumar Sawargaonkar <pranavkumar@xxxxxxxxxx> + */ + +#ifndef __VIR_CPU_AARCH64_H__ +# define __VIR_CPU_AARCH64_H__ + +# include "cpu.h" + +extern struct cpuArchDriver cpuDriverAARCH64; + +#endif /* __VIR_CPU_AARCH64_H__ */ -- 1.7.9.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list