xref: /openbmc/linux/arch/arm64/include/asm/trans_pgd.h (revision 405db98b)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 
3 /*
4  * Copyright (c) 2021, Microsoft Corporation.
5  * Pasha Tatashin <pasha.tatashin@soleen.com>
6  */
7 
8 #ifndef _ASM_TRANS_TABLE_H
9 #define _ASM_TRANS_TABLE_H
10 
11 #include <linux/bits.h>
12 #include <linux/types.h>
13 #include <asm/pgtable-types.h>
14 
15 /*
16  * trans_alloc_page
17  *	- Allocator that should return exactly one zeroed page, if this
18  *	  allocator fails, trans_pgd_create_copy() and trans_pgd_idmap_page()
19  *	  return -ENOMEM error.
20  *
21  * trans_alloc_arg
22  *	- Passed to trans_alloc_page as an argument
23  */
24 
25 struct trans_pgd_info {
26 	void * (*trans_alloc_page)(void *arg);
27 	void *trans_alloc_arg;
28 };
29 
30 int trans_pgd_create_copy(struct trans_pgd_info *info, pgd_t **trans_pgd,
31 			  unsigned long start, unsigned long end);
32 
33 int trans_pgd_idmap_page(struct trans_pgd_info *info, phys_addr_t *trans_ttbr0,
34 			 unsigned long *t0sz, void *page);
35 
36 int trans_pgd_copy_el2_vectors(struct trans_pgd_info *info,
37 			       phys_addr_t *el2_vectors);
38 
39 extern char trans_pgd_stub_vectors[];
40 
41 #endif /* _ASM_TRANS_TABLE_H */
42