xref: /openbmc/linux/arch/arm64/include/asm/trans_pgd.h (revision caa80275)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 
3 /*
4  * Copyright (c) 2020, Microsoft Corporation.
5  * Pavel 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_map_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_map_page(struct trans_pgd_info *info, pgd_t *trans_pgd,
34 		       void *page, unsigned long dst_addr, pgprot_t pgprot);
35 
36 int trans_pgd_idmap_page(struct trans_pgd_info *info, phys_addr_t *trans_ttbr0,
37 			 unsigned long *t0sz, void *page);
38 
39 #endif /* _ASM_TRANS_TABLE_H */
40