mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
AArch64: CPU Support for AArch64 (ARMv8 64bit).
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)
This commit is contained in:
parent
670c08afd4
commit
5cb6816715
@ -900,6 +900,7 @@ CPU_SOURCES = \
|
|||||||
cpu/cpu_x86.h cpu/cpu_x86.c cpu/cpu_x86_data.h \
|
cpu/cpu_x86.h cpu/cpu_x86.c cpu/cpu_x86_data.h \
|
||||||
cpu/cpu_s390.h cpu/cpu_s390.c \
|
cpu/cpu_s390.h cpu/cpu_s390.c \
|
||||||
cpu/cpu_arm.h cpu/cpu_arm.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_map.h cpu/cpu_map.c cpu/cpu_powerpc.h \
|
||||||
cpu/cpu_powerpc.c cpu/cpu_ppc_data.h
|
cpu/cpu_powerpc.c cpu/cpu_ppc_data.h
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "cpu_powerpc.h"
|
#include "cpu_powerpc.h"
|
||||||
#include "cpu_s390.h"
|
#include "cpu_s390.h"
|
||||||
#include "cpu_arm.h"
|
#include "cpu_arm.h"
|
||||||
|
#include "cpu_aarch64.h"
|
||||||
#include "cpu_generic.h"
|
#include "cpu_generic.h"
|
||||||
#include "util/virstring.h"
|
#include "util/virstring.h"
|
||||||
|
|
||||||
@ -44,6 +45,7 @@ static struct cpuArchDriver *drivers[] = {
|
|||||||
&cpuDriverPowerPC,
|
&cpuDriverPowerPC,
|
||||||
&cpuDriverS390,
|
&cpuDriverS390,
|
||||||
&cpuDriverArm,
|
&cpuDriverArm,
|
||||||
|
&cpuDriverAARCH64,
|
||||||
/* generic driver must always be the last one */
|
/* generic driver must always be the last one */
|
||||||
&cpuDriverGeneric
|
&cpuDriverGeneric
|
||||||
};
|
};
|
||||||
|
79
src/cpu/cpu_aarch64.c
Normal file
79
src/cpu/cpu_aarch64.c
Normal file
@ -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,
|
||||||
|
};
|
31
src/cpu/cpu_aarch64.h
Normal file
31
src/cpu/cpu_aarch64.h
Normal file
@ -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__ */
|
Loading…
x
Reference in New Issue
Block a user