File tree Expand file tree Collapse file tree 4 files changed +33
-6
lines changed Expand file tree Collapse file tree 4 files changed +33
-6
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,20 @@ EXPORT_SYMBOL_GPL(hyperv_pcpu_input_arg);
37
37
u32 hv_max_vp_index ;
38
38
EXPORT_SYMBOL_GPL (hv_max_vp_index );
39
39
40
+ void * hv_alloc_hyperv_page (void )
41
+ {
42
+ BUILD_BUG_ON (PAGE_SIZE != HV_HYP_PAGE_SIZE );
43
+
44
+ return (void * )__get_free_page (GFP_KERNEL );
45
+ }
46
+ EXPORT_SYMBOL_GPL (hv_alloc_hyperv_page );
47
+
48
+ void hv_free_hyperv_page (unsigned long addr )
49
+ {
50
+ free_page (addr );
51
+ }
52
+ EXPORT_SYMBOL_GPL (hv_free_hyperv_page );
53
+
40
54
static int hv_cpu_init (unsigned int cpu )
41
55
{
42
56
u64 msr_vp_index ;
Original file line number Diff line number Diff line change 12
12
#include <linux/types.h>
13
13
#include <asm/page.h>
14
14
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
+
15
25
/*
16
26
* The below CPUID leaves are present if VersionAndFeatures.HypervisorPresent
17
27
* is set by CPUID(HvCpuIdFunctionVersionAndFeatures).
@@ -847,7 +857,7 @@ union hv_gpa_page_range {
847
857
* count is equal with how many entries of union hv_gpa_page_range can
848
858
* be populated into the input parameter page.
849
859
*/
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)) / \
851
861
sizeof(union hv_gpa_page_range))
852
862
853
863
struct hv_guest_mapping_flush_list {
Original file line number Diff line number Diff line change @@ -218,7 +218,8 @@ static inline struct hv_vp_assist_page *hv_get_vp_assist_page(unsigned int cpu)
218
218
219
219
void __init hyperv_init (void );
220
220
void hyperv_setup_mmu_ops (void );
221
-
221
+ void * hv_alloc_hyperv_page (void );
222
+ void hv_free_hyperv_page (unsigned long addr );
222
223
void hyperv_reenlightenment_intr (struct pt_regs * regs );
223
224
void set_hv_tscchange_cb (void (* cb )(void ));
224
225
void clear_hv_tscchange_cb (void );
@@ -241,6 +242,8 @@ static inline void hv_apic_init(void) {}
241
242
#else /* CONFIG_HYPERV */
242
243
static inline void hyperv_init (void ) {}
243
244
static inline void hyperv_setup_mmu_ops (void ) {}
245
+ static inline void * hv_alloc_hyperv_page (void ) { return NULL ; }
246
+ static inline void hv_free_hyperv_page (unsigned long addr ) {}
244
247
static inline void set_hv_tscchange_cb (void (* cb )(void )) {}
245
248
static inline void clear_hv_tscchange_cb (void ) {}
246
249
static inline void hyperv_stop_tsc_emulation (void ) {};
Original file line number Diff line number Diff line change @@ -190,11 +190,11 @@ int hv_ringbuffer_read(struct vmbus_channel *channel,
190
190
u64 * requestid , bool raw );
191
191
192
192
/*
193
- * Maximum channels is determined by the size of the interrupt page
194
- * which is PAGE_SIZE . 1/2 of PAGE_SIZE is for send endpoint interrupt
195
- * and the other is receive endpoint interrupt
193
+ * The Maximum number of channels (16348) is determined by the size of the
194
+ * interrupt page, which is HV_HYP_PAGE_SIZE . 1/2 of HV_HYP_PAGE_SIZE is to
195
+ * send endpoint interrupts, and the other is to receive endpoint interrupts.
196
196
*/
197
- #define MAX_NUM_CHANNELS ((PAGE_SIZE >> 1) << 3) /* 16348 channels */
197
+ #define MAX_NUM_CHANNELS ((HV_HYP_PAGE_SIZE >> 1) << 3)
198
198
199
199
/* The value here must be in multiple of 32 */
200
200
/* TODO: Need to make this configurable */
You can’t perform that action at this time.
0 commit comments