diff options
author | Himadri Pandya <himadrispandya@gmail.com> | 2019-07-30 11:49:43 +0200 |
---|---|---|
committer | Sasha Levin <sashal@kernel.org> | 2019-11-22 02:10:45 +0100 |
commit | fa36dcdf8b200f4c175d0a00a8c99439ee0df95d (patch) | |
tree | 088bc92d51b2fc65f434b2c9b6cab3257b573d66 /arch/x86/hyperv | |
parent | Drivers: hv: util: Specify ring buffer size using Hyper-V page size (diff) | |
download | linux-fa36dcdf8b200f4c175d0a00a8c99439ee0df95d.tar.xz linux-fa36dcdf8b200f4c175d0a00a8c99439ee0df95d.zip |
x86: hv: Add function to allocate zeroed page for Hyper-V
Hyper-V assumes page size to be 4K. While this assumption holds true on
x86 architecture, it might not be true for ARM64 architecture. Hence
define hyper-v specific function to allocate a zeroed page which can
have a different implementation on ARM64 architecture to handle the
conflict between hyper-v's assumed page size and actual guest page size.
Signed-off-by: Himadri Pandya <himadri18.07@gmail.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch/x86/hyperv')
-rw-r--r-- | arch/x86/hyperv/hv_init.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c index 2db3972c0e0f..b2daf0ebdb19 100644 --- a/arch/x86/hyperv/hv_init.c +++ b/arch/x86/hyperv/hv_init.c @@ -45,6 +45,14 @@ void *hv_alloc_hyperv_page(void) } EXPORT_SYMBOL_GPL(hv_alloc_hyperv_page); +void *hv_alloc_hyperv_zeroed_page(void) +{ + BUILD_BUG_ON(PAGE_SIZE != HV_HYP_PAGE_SIZE); + + return (void *)__get_free_page(GFP_KERNEL | __GFP_ZERO); +} +EXPORT_SYMBOL_GPL(hv_alloc_hyperv_zeroed_page); + void hv_free_hyperv_page(unsigned long addr) { free_page(addr); |