1 // SPDX-License-Identifier: GPL-2.0
4 * Hyper-V nested virtualization code.
6 * Copyright (C) 2018, Microsoft, Inc.
8 * Author : Lan Tianyu <Tianyu.Lan@microsoft.com>
12 #include <linux/types.h>
13 #include <asm/hyperv-tlfs.h>
14 #include <asm/mshyperv.h>
15 #include <asm/tlbflush.h>
17 #include <asm/trace/hyperv.h>
19 int hyperv_flush_guest_mapping(u64 as
)
21 struct hv_guest_mapping_flush
**flush_pcpu
;
22 struct hv_guest_mapping_flush
*flush
;
30 local_irq_save(flags
);
32 flush_pcpu
= (struct hv_guest_mapping_flush
**)
33 this_cpu_ptr(hyperv_pcpu_input_arg
);
37 if (unlikely(!flush
)) {
38 local_irq_restore(flags
);
42 flush
->address_space
= as
;
45 status
= hv_do_hypercall(HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_SPACE
,
47 local_irq_restore(flags
);
49 if (!(status
& HV_HYPERCALL_RESULT_MASK
))
53 trace_hyperv_nested_flush_guest_mapping(as
, ret
);
56 EXPORT_SYMBOL_GPL(hyperv_flush_guest_mapping
);