- Update Xen patches to 3.3-rc5 and c/s 1157.
[linux-flexiantxendom0-3.2.10.git] / include / xen / interface / mem_event.h
1 /******************************************************************************
2  * mem_event.h
3  *
4  * Memory event common structures.
5  *
6  * Copyright (c) 2009 by Citrix Systems, Inc. (Patrick Colp)
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a copy
9  * of this software and associated documentation files (the "Software"), to
10  * deal in the Software without restriction, including without limitation the
11  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12  * sell copies of the Software, and to permit persons to whom the Software is
13  * furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included in
16  * all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24  * DEALINGS IN THE SOFTWARE.
25  */
26
27 #ifndef _XEN_PUBLIC_MEM_EVENT_H
28 #define _XEN_PUBLIC_MEM_EVENT_H
29
30 #include "xen.h"
31 #include "io/ring.h"
32
33 /* Memory event type */
34 #define MEM_EVENT_TYPE_SHARED   0
35 #define MEM_EVENT_TYPE_PAGING   1
36 #define MEM_EVENT_TYPE_ACCESS   2
37
38 /* Memory event flags */
39 #define MEM_EVENT_FLAG_VCPU_PAUSED  (1 << 0)
40 #define MEM_EVENT_FLAG_DROP_PAGE    (1 << 1)
41 #define MEM_EVENT_FLAG_EVICT_FAIL   (1 << 2)
42 #define MEM_EVENT_FLAG_FOREIGN      (1 << 3)
43 #define MEM_EVENT_FLAG_DUMMY        (1 << 4)
44
45 /* Reasons for the memory event request */
46 #define MEM_EVENT_REASON_UNKNOWN     0    /* typical reason */
47 #define MEM_EVENT_REASON_VIOLATION   1    /* access violation, GFN is address */
48 #define MEM_EVENT_REASON_CR0         2    /* CR0 was hit: gfn is CR0 value */
49 #define MEM_EVENT_REASON_CR3         3    /* CR3 was hit: gfn is CR3 value */
50 #define MEM_EVENT_REASON_CR4         4    /* CR4 was hit: gfn is CR4 value */
51 #define MEM_EVENT_REASON_INT3        5    /* int3 was hit: gla/gfn are RIP */
52 #define MEM_EVENT_REASON_SINGLESTEP  6    /* single step was invoked: gla/gfn are RIP */
53
54 typedef struct mem_event_shared_page {
55     uint32_t port;
56 } mem_event_shared_page_t;
57
58 typedef struct mem_event_st {
59     uint16_t type;
60     uint16_t flags;
61     uint32_t vcpu_id;
62
63     uint64_t gfn;
64     uint64_t offset;
65     uint64_t gla; /* if gla_valid */
66
67     uint32_t p2mt;
68
69     uint16_t access_r:1;
70     uint16_t access_w:1;
71     uint16_t access_x:1;
72     uint16_t gla_valid:1;
73     uint16_t available:12;
74
75     uint16_t reason;
76 } mem_event_request_t, mem_event_response_t;
77
78 DEFINE_RING_TYPES(mem_event, mem_event_request_t, mem_event_response_t);
79
80 #endif
81
82 /*
83  * Local variables:
84  * mode: C
85  * c-set-style: "BSD"
86  * c-basic-offset: 4
87  * tab-width: 4
88  * indent-tabs-mode: nil
89  * End:
90  */