Skip to content

Commit 6204004

Browse files
YananWang-hubMarc Zyngier
authored andcommitted
KVM: arm64: Introduce two cache maintenance callbacks
To prepare for performing CMOs for guest stage-2 in the fault handlers in pgtable.c, here introduce two cache maintenance callbacks in struct kvm_pgtable_mm_ops. We also adjust the comment alignment for the existing part but make no real content change at all. Reviewed-by: Fuad Tabba <tabba@google.com> Signed-off-by: Yanan Wang <wangyanan55@huawei.com> [maz: fixed up comments and renamed callbacks] Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20210617105824.31752-2-wangyanan55@huawei.com
1 parent 8124c8a commit 6204004

1 file changed

Lines changed: 25 additions & 17 deletions

File tree

arch/arm64/include/asm/kvm_pgtable.h

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,29 @@ typedef u64 kvm_pte_t;
2727

2828
/**
2929
* struct kvm_pgtable_mm_ops - Memory management callbacks.
30-
* @zalloc_page: Allocate a single zeroed memory page. The @arg parameter
31-
* can be used by the walker to pass a memcache. The
32-
* initial refcount of the page is 1.
33-
* @zalloc_pages_exact: Allocate an exact number of zeroed memory pages. The
34-
* @size parameter is in bytes, and is rounded-up to the
35-
* next page boundary. The resulting allocation is
36-
* physically contiguous.
37-
* @free_pages_exact: Free an exact number of memory pages previously
38-
* allocated by zalloc_pages_exact.
39-
* @get_page: Increment the refcount on a page.
40-
* @put_page: Decrement the refcount on a page. When the refcount
41-
* reaches 0 the page is automatically freed.
42-
* @page_count: Return the refcount of a page.
43-
* @phys_to_virt: Convert a physical address into a virtual address mapped
44-
* in the current context.
45-
* @virt_to_phys: Convert a virtual address mapped in the current context
46-
* into a physical address.
30+
* @zalloc_page: Allocate a single zeroed memory page.
31+
* The @arg parameter can be used by the walker
32+
* to pass a memcache. The initial refcount of
33+
* the page is 1.
34+
* @zalloc_pages_exact: Allocate an exact number of zeroed memory pages.
35+
* The @size parameter is in bytes, and is rounded
36+
* up to the next page boundary. The resulting
37+
* allocation is physically contiguous.
38+
* @free_pages_exact: Free an exact number of memory pages previously
39+
* allocated by zalloc_pages_exact.
40+
* @get_page: Increment the refcount on a page.
41+
* @put_page: Decrement the refcount on a page. When the
42+
* refcount reaches 0 the page is automatically
43+
* freed.
44+
* @page_count: Return the refcount of a page.
45+
* @phys_to_virt: Convert a physical address into a virtual
46+
* address mapped in the current context.
47+
* @virt_to_phys: Convert a virtual address mapped in the current
48+
* context into a physical address.
49+
* @dcache_clean_inval_poc: Clean and invalidate the data cache to the PoC
50+
* for the specified memory address range.
51+
* @icache_inval_pou: Invalidate the instruction cache to the PoU
52+
* for the specified memory address range.
4753
*/
4854
struct kvm_pgtable_mm_ops {
4955
void* (*zalloc_page)(void *arg);
@@ -54,6 +60,8 @@ struct kvm_pgtable_mm_ops {
5460
int (*page_count)(void *addr);
5561
void* (*phys_to_virt)(phys_addr_t phys);
5662
phys_addr_t (*virt_to_phys)(void *addr);
63+
void (*dcache_clean_inval_poc)(void *addr, size_t size);
64+
void (*icache_inval_pou)(void *addr, size_t size);
5765
};
5866

5967
/**

0 commit comments

Comments
 (0)