1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /******************************************************************************
3  * include/asm-x86/mem_access.h
4  *
5  * Memory access support.
6  *
7  * Copyright (c) 2011 GridCentric Inc. (Andres Lagar-Cavilla)
8  * Copyright (c) 2007 Advanced Micro Devices (Wei Huang)
9  * Parts of this code are Copyright (c) 2006-2007 by XenSource Inc.
10  * Parts of this code are Copyright (c) 2006 by Michael A Fetterman
11  * Parts based on earlier work by Michael A Fetterman, Ian Pratt et al.
12  */
13 
14 #ifndef __ASM_X86_MEM_ACCESS_H__
15 #define __ASM_X86_MEM_ACCESS_H__
16 
17 /*
18  * Setup vm_event request based on the access (gla is -1ull if not available).
19  * Handles the rw2rx conversion. Boolean return value indicates if event type
20  * is syncronous (aka. requires vCPU pause). If the req_ptr has been populated,
21  * then the caller should use monitor_traps to send the event on the MONITOR
22  * ring. Once having released get_gfn* locks caller must also xfree the
23  * request.
24  */
25 bool p2m_mem_access_check(paddr_t gpa, unsigned long gla,
26                           struct npfec npfec,
27                           struct vm_event_st **req_ptr);
28 
29 /* Check for emulation and mark vcpu for skipping one instruction
30  * upon rescheduling if required. */
31 bool p2m_mem_access_emulate_check(struct vcpu *v,
32                                   const struct vm_event_st *rsp);
33 
34 /* Sanity check for mem_access hardware support */
35 bool p2m_mem_access_sanity_check(const struct domain *d);
36 
37 int p2m_set_suppress_ve(struct domain *d, gfn_t gfn, bool suppress_ve,
38                         unsigned int altp2m_idx);
39 
40 struct xen_hvm_altp2m_suppress_ve_multi;
41 int p2m_set_suppress_ve_multi(struct domain *d,
42                               struct xen_hvm_altp2m_suppress_ve_multi *sve);
43 
44 int p2m_get_suppress_ve(struct domain *d, gfn_t gfn, bool *suppress_ve,
45                         unsigned int altp2m_idx);
46 
47 #endif /*__ASM_X86_MEM_ACCESS_H__ */
48 
49 /*
50  * Local variables:
51  * mode: C
52  * c-file-style: "BSD"
53  * c-basic-offset: 4
54  * indent-tabs-mode: nil
55  * End:
56  */
57