Skip to content

Commit fcd3f62

Browse files
fishavoreKAGA-KOKO
authored andcommitted
x86/hyperv: Create and use Hyper-V page definitions
Define HV_HYP_PAGE_SHIFT, HV_HYP_PAGE_SIZE, and HV_HYP_PAGE_MASK because the Linux guest page size and hypervisor page size concepts are different, even though they happen to be the same value on x86. Also, replace PAGE_SIZE with HV_HYP_PAGE_SIZE. Signed-off-by: Maya Nakamura <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Michael Kelley <[email protected]> Reviewed-by: Vitaly Kuznetsov <[email protected]> Link: https://lkml.kernel.org/r/e95111629abf65d016e983f72494cbf110ce605f.1562916939.git.m.maya.nakamura@gmail.com
1 parent 5f9e832 commit fcd3f62

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

arch/x86/include/asm/hyperv-tlfs.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@
1212
#include <linux/types.h>
1313
#include <asm/page.h>
1414

15+
/*
16+
* While not explicitly listed in the TLFS, Hyper-V always runs with a page size
17+
* of 4096. These definitions are used when communicating with Hyper-V using
18+
* guest physical pages and guest physical page addresses, since the guest page
19+
* size may not be 4096 on all architectures.
20+
*/
21+
#define HV_HYP_PAGE_SHIFT 12
22+
#define HV_HYP_PAGE_SIZE BIT(HV_HYP_PAGE_SHIFT)
23+
#define HV_HYP_PAGE_MASK (~(HV_HYP_PAGE_SIZE - 1))
24+
1525
/*
1626
* The below CPUID leaves are present if VersionAndFeatures.HypervisorPresent
1727
* is set by CPUID(HvCpuIdFunctionVersionAndFeatures).
@@ -847,7 +857,7 @@ union hv_gpa_page_range {
847857
* count is equal with how many entries of union hv_gpa_page_range can
848858
* be populated into the input parameter page.
849859
*/
850-
#define HV_MAX_FLUSH_REP_COUNT ((PAGE_SIZE - 2 * sizeof(u64)) / \
860+
#define HV_MAX_FLUSH_REP_COUNT ((HV_HYP_PAGE_SIZE - 2 * sizeof(u64)) / \
851861
sizeof(union hv_gpa_page_range))
852862

853863
struct hv_guest_mapping_flush_list {

0 commit comments

Comments
 (0)