-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
x86/mm: Manage CSV3 guest's private memory by CMA
hygon inclusion category: feature CVE: NA --------------------------- The private memory of a CSV3 guest is isolated from VMM and has to be physically contiguous. CMA (Contiguous Memory Allocator) is a memory allocator within the kernel for contiguous physical memory. Use the CMA for the CSV3 private memory management. In order to support CSV3, select MMU and CMA when CONIFG_HYGON_CSV is configured. Signed-off-by: Xin Jiang <jiangxin@hygon.cn> Signed-off-by: hanliyang <hanliyang@hygon.cn>
- Loading branch information
1 parent
c26f93e
commit 207ab26
Showing
7 changed files
with
461 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-only */ | ||
/* | ||
* Hygon China Secure Virtualization (CSV) | ||
* | ||
* Copyright (C) Hygon Info Technologies Ltd. | ||
* | ||
* Author: Jiang Xin <jiangxin@hygon.cn> | ||
*/ | ||
|
||
#ifndef __ASM_X86_CSV_H__ | ||
#define __ASM_X86_CSV_H__ | ||
|
||
#ifndef __ASSEMBLY__ | ||
|
||
#ifdef CONFIG_HYGON_CSV | ||
|
||
struct csv_mem { | ||
uint64_t start; | ||
uint64_t size; | ||
}; | ||
|
||
#define CSV_MR_ALIGN_BITS (28) | ||
|
||
extern struct csv_mem *csv_smr; | ||
extern unsigned int csv_smr_num; | ||
|
||
void __init early_csv_reserve_mem(void); | ||
|
||
phys_addr_t csv_alloc_from_contiguous(size_t size, nodemask_t *nodes_allowed, | ||
unsigned int align); | ||
void csv_release_to_contiguous(phys_addr_t pa, size_t size); | ||
|
||
uint32_t csv_get_smr_entry_shift(void); | ||
|
||
#else /* !CONFIG_HYGON_CSV */ | ||
|
||
#define csv_smr NULL | ||
#define csv_smr_num 0U | ||
|
||
static inline void __init early_csv_reserve_mem(void) { } | ||
|
||
static inline phys_addr_t | ||
csv_alloc_from_contiguous(size_t size, nodemask_t *nodes_allowed, | ||
unsigned int align) { return 0; } | ||
static inline void csv_release_to_contiguous(phys_addr_t pa, size_t size) { } | ||
|
||
static inline uint32_t csv_get_smr_entry_shift(void) { return 0; } | ||
|
||
#endif /* CONFIG_HYGON_CSV */ | ||
|
||
#endif /* __ASSEMBLY__ */ | ||
|
||
#endif /* __ASM_X86_CSV_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.