summaryrefslogtreecommitdiff
path: root/arch/arm/kvm/hyp/s2-setup.c
blob: 5dfbea5adf65195e0ee8c32f1d3baa3d975fa24a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2016 - ARM Ltd
 * Author: Marc Zyngier <marc.zyngier@arm.com>
 */

#include <linux/types.h>
#include <asm/kvm_arm.h>
#include <asm/kvm_asm.h>
#include <asm/kvm_hyp.h>

void __hyp_text __init_stage2_translation(void)
{
	u64 val;

	val = read_sysreg(VTCR) & ~VTCR_MASK;

	val |= read_sysreg(HTCR) & VTCR_HTCR_SH;
	val |= KVM_VTCR_SL0 | KVM_VTCR_T0SZ | KVM_VTCR_S;

	write_sysreg(val, VTCR);
}