ia64/xen-unstable

view xen/include/asm-x86/shadow.h @ 19848:5839491bbf20

[IA64] replace MAX_VCPUS with d->max_vcpus where necessary.

don't use MAX_VCPUS, and use vcpu::max_vcpus.
The changeset of 2f9e1348aa98 introduced max_vcpus to allow more vcpus
per guest. This patch is ia64 counter part.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Isaku Yamahata <yamahata@valinux.co.jp>
date Mon Jun 29 11:26:05 2009 +0900 (2009-06-29)
parents c759a6cef79f
children
line source
1 /******************************************************************************
2 * include/asm-x86/shadow.h
3 *
4 * Parts of this code are Copyright (c) 2006 by XenSource Inc.
5 * Parts of this code are Copyright (c) 2006 by Michael A Fetterman
6 * Parts based on earlier work by Michael A Fetterman, Ian Pratt et al.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
23 #ifndef _XEN_SHADOW_H
24 #define _XEN_SHADOW_H
26 #include <public/domctl.h>
27 #include <xen/sched.h>
28 #include <xen/perfc.h>
29 #include <xen/domain_page.h>
30 #include <asm/flushtlb.h>
31 #include <asm/paging.h>
32 #include <asm/p2m.h>
34 /*****************************************************************************
35 * Macros to tell which shadow paging mode a domain is in*/
37 #define shadow_mode_enabled(_d) paging_mode_shadow(_d)
38 #define shadow_mode_refcounts(_d) (paging_mode_shadow(_d) && \
39 paging_mode_refcounts(_d))
40 #define shadow_mode_log_dirty(_d) (paging_mode_shadow(_d) && \
41 paging_mode_log_dirty(_d))
42 #define shadow_mode_translate(_d) (paging_mode_shadow(_d) && \
43 paging_mode_translate(_d))
44 #define shadow_mode_external(_d) (paging_mode_shadow(_d) && \
45 paging_mode_external(_d))
47 /* Xen traps & emulates all reads of all page table pages:
48 * not yet supported */
49 #define shadow_mode_trap_reads(_d) ({ (void)(_d); 0; })
51 /*****************************************************************************
52 * Entry points into the shadow code */
54 /* Set up the shadow-specific parts of a domain struct at start of day.
55 * Called from paging_domain_init(). */
56 void shadow_domain_init(struct domain *d);
58 /* Setup the shadow-specific parts of a vcpu struct. It is called by
59 * paging_vcpu_init() in paging.c */
60 void shadow_vcpu_init(struct vcpu *v);
62 /* Enable an arbitrary shadow mode. Call once at domain creation. */
63 int shadow_enable(struct domain *d, u32 mode);
65 /* Enable VRAM dirty bit tracking. */
66 int shadow_track_dirty_vram(struct domain *d,
67 unsigned long first_pfn,
68 unsigned long nr,
69 XEN_GUEST_HANDLE_64(uint8) dirty_bitmap);
71 /* Handler for shadow control ops: operations from user-space to enable
72 * and disable ephemeral shadow modes (test mode and log-dirty mode) and
73 * manipulate the log-dirty bitmap. */
74 int shadow_domctl(struct domain *d,
75 xen_domctl_shadow_op_t *sc,
76 XEN_GUEST_HANDLE(void) u_domctl);
78 /* Call when destroying a domain */
79 void shadow_teardown(struct domain *d);
81 /* Call once all of the references to the domain have gone away */
82 void shadow_final_teardown(struct domain *d);
84 /* shadow code to call when log dirty is enabled */
85 int shadow_enable_log_dirty(struct domain *d);
87 /* shadow code to call when log dirty is disabled */
88 int shadow_disable_log_dirty(struct domain *d);
90 /* shadow code to call when bitmap is being cleaned */
91 void shadow_clean_dirty_bitmap(struct domain *d);
93 /* Update all the things that are derived from the guest's CR0/CR3/CR4.
94 * Called to initialize paging structures if the paging mode
95 * has changed, and when bringing up a VCPU for the first time. */
96 void shadow_update_paging_modes(struct vcpu *v);
99 /* Remove all mappings of the guest page from the shadows.
100 * This is called from common code. It does not flush TLBs. */
101 int sh_remove_all_mappings(struct vcpu *v, mfn_t target_mfn);
102 static inline void
103 shadow_drop_references(struct domain *d, struct page_info *p)
104 {
105 if ( unlikely(shadow_mode_enabled(d)) )
106 /* See the comment about locking in sh_remove_all_mappings */
107 sh_remove_all_mappings(d->vcpu[0], _mfn(page_to_mfn(p)));
108 }
110 /* Remove all shadows of the guest mfn. */
111 void sh_remove_shadows(struct vcpu *v, mfn_t gmfn, int fast, int all);
112 static inline void shadow_remove_all_shadows(struct vcpu *v, mfn_t gmfn)
113 {
114 /* See the comment about locking in sh_remove_shadows */
115 sh_remove_shadows(v, gmfn, 0 /* Be thorough */, 1 /* Must succeed */);
116 }
118 #endif /* _XEN_SHADOW_H */
120 /*
121 * Local variables:
122 * mode: C
123 * c-set-style: "BSD"
124 * c-basic-offset: 4
125 * indent-tabs-mode: nil
126 * End:
127 */