mmu.c (f8bade6c9a6213c2c5ba6e5bf32415ecab6e41e5) mmu.c (753ed9c95c37d058e50e7d42bbe296ee0bf6670d)
1#define pr_fmt(fmt) "Hyper-V: " fmt
2
3#include <linux/hyperv.h>
4#include <linux/log2.h>
5#include <linux/slab.h>
6#include <linux/types.h>
7
8#include <asm/fpu/api.h>

--- 44 unchanged lines hidden (view full) ---

53}
54
55static void hyperv_flush_tlb_others(const struct cpumask *cpus,
56 const struct flush_tlb_info *info)
57{
58 int cpu, vcpu, gva_n, max_gvas;
59 struct hv_tlb_flush **flush_pcpu;
60 struct hv_tlb_flush *flush;
1#define pr_fmt(fmt) "Hyper-V: " fmt
2
3#include <linux/hyperv.h>
4#include <linux/log2.h>
5#include <linux/slab.h>
6#include <linux/types.h>
7
8#include <asm/fpu/api.h>

--- 44 unchanged lines hidden (view full) ---

53}
54
55static void hyperv_flush_tlb_others(const struct cpumask *cpus,
56 const struct flush_tlb_info *info)
57{
58 int cpu, vcpu, gva_n, max_gvas;
59 struct hv_tlb_flush **flush_pcpu;
60 struct hv_tlb_flush *flush;
61 u64 status = U64_MAX;
61 u64 status;
62 unsigned long flags;
63
64 trace_hyperv_mmu_flush_tlb_others(cpus, info);
65
66 if (!hv_hypercall_pg)
67 goto do_native;
68
69 local_irq_save(flags);

--- 86 unchanged lines hidden (view full) ---

156 goto check_status;
157
158do_ex_hypercall:
159 status = hyperv_flush_tlb_others_ex(cpus, info);
160
161check_status:
162 local_irq_restore(flags);
163
62 unsigned long flags;
63
64 trace_hyperv_mmu_flush_tlb_others(cpus, info);
65
66 if (!hv_hypercall_pg)
67 goto do_native;
68
69 local_irq_save(flags);

--- 86 unchanged lines hidden (view full) ---

156 goto check_status;
157
158do_ex_hypercall:
159 status = hyperv_flush_tlb_others_ex(cpus, info);
160
161check_status:
162 local_irq_restore(flags);
163
164 if (!(status & HV_HYPERCALL_RESULT_MASK))
164 if (hv_result_success(status))
165 return;
166do_native:
167 native_flush_tlb_others(cpus, info);
168}
169
170static u64 hyperv_flush_tlb_others_ex(const struct cpumask *cpus,
171 const struct flush_tlb_info *info)
172{
173 int nr_bank = 0, max_gvas, gva_n;
174 struct hv_tlb_flush_ex **flush_pcpu;
175 struct hv_tlb_flush_ex *flush;
176 u64 status;
177
178 if (!(ms_hyperv.hints & HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED))
165 return;
166do_native:
167 native_flush_tlb_others(cpus, info);
168}
169
170static u64 hyperv_flush_tlb_others_ex(const struct cpumask *cpus,
171 const struct flush_tlb_info *info)
172{
173 int nr_bank = 0, max_gvas, gva_n;
174 struct hv_tlb_flush_ex **flush_pcpu;
175 struct hv_tlb_flush_ex *flush;
176 u64 status;
177
178 if (!(ms_hyperv.hints & HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED))
179 return U64_MAX;
179 return HV_STATUS_INVALID_PARAMETER;
180
181 flush_pcpu = (struct hv_tlb_flush_ex **)
182 this_cpu_ptr(hyperv_pcpu_input_arg);
183
184 flush = *flush_pcpu;
185
186 if (info->mm) {
187 /*

--- 8 unchanged lines hidden (view full) ---

196 flush->flags = HV_FLUSH_ALL_VIRTUAL_ADDRESS_SPACES;
197 }
198
199 flush->hv_vp_set.valid_bank_mask = 0;
200
201 flush->hv_vp_set.format = HV_GENERIC_SET_SPARSE_4K;
202 nr_bank = cpumask_to_vpset(&(flush->hv_vp_set), cpus);
203 if (nr_bank < 0)
180
181 flush_pcpu = (struct hv_tlb_flush_ex **)
182 this_cpu_ptr(hyperv_pcpu_input_arg);
183
184 flush = *flush_pcpu;
185
186 if (info->mm) {
187 /*

--- 8 unchanged lines hidden (view full) ---

196 flush->flags = HV_FLUSH_ALL_VIRTUAL_ADDRESS_SPACES;
197 }
198
199 flush->hv_vp_set.valid_bank_mask = 0;
200
201 flush->hv_vp_set.format = HV_GENERIC_SET_SPARSE_4K;
202 nr_bank = cpumask_to_vpset(&(flush->hv_vp_set), cpus);
203 if (nr_bank < 0)
204 return U64_MAX;
204 return HV_STATUS_INVALID_PARAMETER;
205
206 /*
207 * We can flush not more than max_gvas with one hypercall. Flush the
208 * whole address space if we were asked to do more.
209 */
210 max_gvas =
211 (PAGE_SIZE - sizeof(*flush) - nr_bank *
212 sizeof(flush->hv_vp_set.bank_contents[0])) /

--- 32 unchanged lines hidden ---
205
206 /*
207 * We can flush not more than max_gvas with one hypercall. Flush the
208 * whole address space if we were asked to do more.
209 */
210 max_gvas =
211 (PAGE_SIZE - sizeof(*flush) - nr_bank *
212 sizeof(flush->hv_vp_set.bank_contents[0])) /

--- 32 unchanged lines hidden ---