blob: f5f49c53be2856245eee4ba58fa1482eb752d242 [file] [log] [blame]
Marc Zyngierd4c76882016-02-01 19:56:31 +00001/*
2 * Copyright (C) 2016 - ARM Ltd
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include <linux/types.h>
19#include <asm/kvm_arm.h>
20#include <asm/kvm_asm.h>
21
22#include "hyp.h"
23
24void __hyp_text __init_stage2_translation(void)
25{
26 u64 val;
27
28 val = read_sysreg(VTCR) & ~VTCR_MASK;
29
30 val |= read_sysreg(HTCR) & VTCR_HTCR_SH;
31 val |= KVM_VTCR_SL0 | KVM_VTCR_T0SZ | KVM_VTCR_S;
32
33 write_sysreg(val, VTCR);
34}