summaryrefslogtreecommitdiff
path: root/arch/riscv/kvm/tlb.S
blob: 899f75d60badc34754653f57a72c5359dd02faf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (C) 2019 Western Digital Corporation or its affiliates.
 *
 * Authors:
 *     Anup Patel <anup.patel@wdc.com>
 */

#include <linux/linkage.h>
#include <asm/asm.h>

	.text
	.altmacro
	.option norelax

	/*
	 * Instruction encoding of hfence.gvma is:
	 * HFENCE.GVMA rs1, rs2
	 * HFENCE.GVMA zero, rs2
	 * HFENCE.GVMA rs1
	 * HFENCE.GVMA
	 *
	 * rs1!=zero and rs2!=zero ==> HFENCE.GVMA rs1, rs2
	 * rs1==zero and rs2!=zero ==> HFENCE.GVMA zero, rs2
	 * rs1!=zero and rs2==zero ==> HFENCE.GVMA rs1
	 * rs1==zero and rs2==zero ==> HFENCE.GVMA
	 *
	 * Instruction encoding of HFENCE.GVMA is:
	 * 0110001 rs2(5) rs1(5) 000 00000 1110011
	 */

ENTRY(__kvm_riscv_hfence_gvma_vmid_gpa)
	/*
	 * rs1 = a0 (GPA >> 2)
	 * rs2 = a1 (VMID)
	 * HFENCE.GVMA a0, a1
	 * 0110001 01011 01010 000 00000 1110011
	 */
	.word 0x62b50073
	ret
ENDPROC(__kvm_riscv_hfence_gvma_vmid_gpa)

ENTRY(__kvm_riscv_hfence_gvma_vmid)
	/*
	 * rs1 = zero
	 * rs2 = a0 (VMID)
	 * HFENCE.GVMA zero, a0
	 * 0110001 01010 00000 000 00000 1110011
	 */
	.word 0x62a00073
	ret
ENDPROC(__kvm_riscv_hfence_gvma_vmid)

ENTRY(__kvm_riscv_hfence_gvma_gpa)
	/*
	 * rs1 = a0 (GPA >> 2)
	 * rs2 = zero
	 * HFENCE.GVMA a0
	 * 0110001 00000 01010 000 00000 1110011
	 */
	.word 0x62050073
	ret
ENDPROC(__kvm_riscv_hfence_gvma_gpa)

ENTRY(__kvm_riscv_hfence_gvma_all)
	/*
	 * rs1 = zero
	 * rs2 = zero
	 * HFENCE.GVMA
	 * 0110001 00000 00000 000 00000 1110011
	 */
	.word 0x62000073
	ret
ENDPROC(__kvm_riscv_hfence_gvma_all)