Merge remote-tracking branch 'xen-tip/linux-next'
[deliverable/linux.git] / arch / arm64 / kvm / sys_regs_generic_v8.c
CommitLineData
b990a9d3
MZ
1/*
2 * Copyright (C) 2012,2013 - ARM Ltd
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
4 *
5 * Based on arch/arm/kvm/coproc_a15.c:
6 * Copyright (C) 2012 - Virtual Open Systems and Columbia University
7 * Authors: Rusty Russell <rusty@rustcorp.au>
8 * Christoffer Dall <c.dall@virtualopensystems.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License, version 2, as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22#include <linux/kvm_host.h>
23#include <asm/cputype.h>
24#include <asm/kvm_arm.h>
25#include <asm/kvm_asm.h>
26#include <asm/kvm_host.h>
27#include <asm/kvm_emulate.h>
28#include <asm/kvm_coproc.h>
1f3d8699 29#include <asm/sysreg.h>
b990a9d3
MZ
30#include <linux/init.h>
31
32#include "sys_regs.h"
33
34static bool access_actlr(struct kvm_vcpu *vcpu,
3fec037d 35 struct sys_reg_params *p,
b990a9d3
MZ
36 const struct sys_reg_desc *r)
37{
38 if (p->is_write)
39 return ignore_write(vcpu, p);
40
2ec5be3d 41 p->regval = vcpu_sys_reg(vcpu, ACTLR_EL1);
b990a9d3
MZ
42 return true;
43}
44
45static void reset_actlr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r)
46{
1f3d8699 47 vcpu_sys_reg(vcpu, ACTLR_EL1) = read_sysreg(actlr_el1);
b990a9d3
MZ
48}
49
50/*
51 * Implementation specific sys-reg registers.
52 * Important: Must be sorted ascending by Op0, Op1, CRn, CRm, Op2
53 */
54static const struct sys_reg_desc genericv8_sys_regs[] = {
55 /* ACTLR_EL1 */
56 { Op0(0b11), Op1(0b000), CRn(0b0001), CRm(0b0000), Op2(0b001),
57 access_actlr, reset_actlr, ACTLR_EL1 },
58};
59
06c7654d
MZ
60static const struct sys_reg_desc genericv8_cp15_regs[] = {
61 /* ACTLR */
62 { Op1(0b000), CRn(0b0001), CRm(0b0000), Op2(0b001),
63 access_actlr },
64};
65
b990a9d3
MZ
66static struct kvm_sys_reg_target_table genericv8_target_table = {
67 .table64 = {
68 .table = genericv8_sys_regs,
69 .num = ARRAY_SIZE(genericv8_sys_regs),
70 },
06c7654d
MZ
71 .table32 = {
72 .table = genericv8_cp15_regs,
73 .num = ARRAY_SIZE(genericv8_cp15_regs),
74 },
b990a9d3
MZ
75};
76
77static int __init sys_reg_genericv8_init(void)
78{
79 unsigned int i;
80
81 for (i = 1; i < ARRAY_SIZE(genericv8_sys_regs); i++)
82 BUG_ON(cmp_sys_reg(&genericv8_sys_regs[i-1],
83 &genericv8_sys_regs[i]) >= 0);
84
85 kvm_register_target_sys_reg_table(KVM_ARM_TARGET_AEM_V8,
86 &genericv8_target_table);
87 kvm_register_target_sys_reg_table(KVM_ARM_TARGET_FOUNDATION_V8,
88 &genericv8_target_table);
1252b331
MZ
89 kvm_register_target_sys_reg_table(KVM_ARM_TARGET_CORTEX_A53,
90 &genericv8_target_table);
b990a9d3
MZ
91 kvm_register_target_sys_reg_table(KVM_ARM_TARGET_CORTEX_A57,
92 &genericv8_target_table);
e28100bd
AP
93 kvm_register_target_sys_reg_table(KVM_ARM_TARGET_XGENE_POTENZA,
94 &genericv8_target_table);
bca556ac
SP
95 kvm_register_target_sys_reg_table(KVM_ARM_TARGET_GENERIC_V8,
96 &genericv8_target_table);
e28100bd 97
b990a9d3
MZ
98 return 0;
99}
100late_initcall(sys_reg_genericv8_init);
This page took 0.249469 seconds and 5 git commands to generate.