ia64/xen-unstable

view xen/xsm/dummy.c @ 17062:0769835cf50f

x86 shadow: Reduce scope of shadow lock.

emulate_map_dest doesn't require holding lock, since
only shadow related operation possibly involved is to
remove shadow which is less frequent and can acquire
lock inside. Rest are either guest table walk or
per-vcpu monitor table manipulation

Signed-off-by Kevin Tian <kevin.tian@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Feb 14 10:33:12 2008 +0000 (2008-02-14)
parents 453f87d6e7f0
children f40c310dca31
line source
1 /*
2 * This work is based on the LSM implementation in Linux 2.6.13.4.
3 *
4 * Author: George Coker, <gscoker@alpha.ncsc.mil>
5 *
6 * Contributors: Michael LeMay, <mdlemay@epoch.ncsc.mil>
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 version 2,
10 * as published by the Free Software Foundation.
11 */
13 #include <xen/sched.h>
14 #include <xsm/xsm.h>
16 static void dummy_security_domaininfo(struct domain *d,
17 struct xen_domctl_getdomaininfo *info)
18 {
19 return;
20 }
22 static int dummy_setvcpucontext(struct domain *d)
23 {
24 return 0;
25 }
27 static int dummy_pausedomain (struct domain *d)
28 {
29 return 0;
30 }
32 static int dummy_unpausedomain (struct domain *d)
33 {
34 return 0;
35 }
37 static int dummy_resumedomain (struct domain *d)
38 {
39 return 0;
40 }
42 static int dummy_domain_create(struct domain *d, u32 ssidref)
43 {
44 return 0;
45 }
47 static int dummy_max_vcpus(struct domain *d)
48 {
49 return 0;
50 }
52 static int dummy_destroydomain (struct domain *d)
53 {
54 return 0;
55 }
57 static int dummy_vcpuaffinity (int cmd, struct domain *d)
58 {
59 return 0;
60 }
62 static int dummy_scheduler (struct domain *d)
63 {
64 return 0;
65 }
67 static int dummy_getdomaininfo (struct domain *d)
68 {
69 return 0;
70 }
72 static int dummy_getvcpucontext (struct domain *d)
73 {
74 return 0;
75 }
77 static int dummy_getvcpuinfo (struct domain *d)
78 {
79 return 0;
80 }
82 static int dummy_domain_settime (struct domain *d)
83 {
84 return 0;
85 }
87 static int dummy_tbufcontrol (void)
88 {
89 return 0;
90 }
92 static int dummy_readconsole (uint32_t clear)
93 {
94 return 0;
95 }
97 static int dummy_sched_id (void)
98 {
99 return 0;
100 }
102 static int dummy_setdomainmaxmem (struct domain *d)
103 {
104 return 0;
105 }
107 static int dummy_setdomainhandle (struct domain *d)
108 {
109 return 0;
110 }
112 static int dummy_setdebugging (struct domain *d)
113 {
114 return 0;
115 }
117 static int dummy_irq_permission (struct domain *d, uint8_t pirq, uint8_t access)
118 {
119 return 0;
120 }
122 static int dummy_iomem_permission (struct domain *d, unsigned long mfn,
123 uint8_t access)
124 {
125 return 0;
126 }
128 static int dummy_perfcontrol (void)
129 {
130 return 0;
131 }
133 static int dummy_alloc_security_domain (struct domain *d)
134 {
135 return 0;
136 }
138 static void dummy_free_security_domain (struct domain *d)
139 {
140 return;
141 }
143 static int dummy_grant_mapref (struct domain *d1, struct domain *d2,
144 uint32_t flags)
145 {
146 return 0;
147 }
149 static int dummy_grant_unmapref (struct domain *d1, struct domain *d2)
150 {
151 return 0;
152 }
154 static int dummy_grant_setup (struct domain *d1, struct domain *d2)
155 {
156 return 0;
157 }
159 static int dummy_grant_transfer (struct domain *d1, struct domain *d2)
160 {
161 return 0;
162 }
164 static int dummy_grant_copy (struct domain *d1, struct domain *d2)
165 {
166 return 0;
167 }
169 static int dummy_grant_query_size (struct domain *d1, struct domain *d2)
170 {
171 return 0;
172 }
174 static int dummy_translate_gpfn_list (struct domain *d, unsigned long mfn)
175 {
176 return 0;
177 }
179 static int dummy_memory_adjust_reservation (struct domain *d1,
180 struct domain *d2)
181 {
182 return 0;
183 }
185 static int dummy_memory_stat_reservation (struct domain *d1, struct domain *d2)
186 {
187 return 0;
188 }
190 static int dummy_console_io (struct domain *d, int cmd)
191 {
192 return 0;
193 }
195 static int dummy_profile (struct domain *d, int op)
196 {
197 return 0;
198 }
200 static int dummy_kexec (void)
201 {
202 return 0;
203 }
205 static int dummy_schedop_shutdown (struct domain *d1, struct domain *d2)
206 {
207 return 0;
208 }
210 static int dummy_memory_pin_page(struct domain *d, struct page_info *page)
211 {
212 return 0;
213 }
215 static int dummy_evtchn_unbound (struct domain *d, struct evtchn *chn,
216 domid_t id2)
217 {
218 return 0;
219 }
221 static int dummy_evtchn_interdomain (struct domain *d1, struct evtchn
222 *chan1, struct domain *d2, struct evtchn *chan2)
223 {
224 return 0;
225 }
227 static void dummy_evtchn_close_post (struct evtchn *chn)
228 {
229 return;
230 }
232 static int dummy_evtchn_send (struct domain *d, struct evtchn *chn)
233 {
234 return 0;
235 }
237 static int dummy_evtchn_status (struct domain *d, struct evtchn *chn)
238 {
239 return 0;
240 }
242 static int dummy_evtchn_reset (struct domain *d1, struct domain *d2)
243 {
244 return 0;
245 }
247 static int dummy_alloc_security_evtchn (struct evtchn *chn)
248 {
249 return 0;
250 }
252 static void dummy_free_security_evtchn (struct evtchn *chn)
253 {
254 return;
255 }
257 static void dummy_complete_init (struct domain *d)
258 {
259 return;
260 }
262 static long dummy___do_xsm_op(XEN_GUEST_HANDLE(xsm_op_t) op)
263 {
264 return -ENOSYS;
265 }
267 #ifdef CONFIG_X86
268 static int dummy_shadow_control (struct domain *d, uint32_t op)
269 {
270 return 0;
271 }
273 static int dummy_ioport_permission (struct domain *d, uint32_t ioport,
274 uint8_t access)
275 {
276 return 0;
277 }
279 static int dummy_getpageframeinfo (struct page_info *page)
280 {
281 return 0;
282 }
284 static int dummy_getmemlist (struct domain *d)
285 {
286 return 0;
287 }
289 static int dummy_hypercall_init (struct domain *d)
290 {
291 return 0;
292 }
294 static int dummy_hvmcontext (struct domain *d, uint32_t cmd)
295 {
296 return 0;
297 }
299 static int dummy_address_size (struct domain *d, uint32_t cmd)
300 {
301 return 0;
302 }
304 static int dummy_hvm_param (struct domain *d, unsigned long op)
305 {
306 return 0;
307 }
309 static int dummy_hvm_set_pci_intx_level (struct domain *d)
310 {
311 return 0;
312 }
314 static int dummy_hvm_set_isa_irq_level (struct domain *d)
315 {
316 return 0;
317 }
319 static int dummy_hvm_set_pci_link_route (struct domain *d)
320 {
321 return 0;
322 }
324 static int dummy_apic (struct domain *d, int cmd)
325 {
326 return 0;
327 }
329 static int dummy_assign_vector (struct domain *d, uint32_t pirq)
330 {
331 return 0;
332 }
334 static int dummy_xen_settime (void)
335 {
336 return 0;
337 }
339 static int dummy_memtype (uint32_t access)
340 {
341 return 0;
342 }
344 static int dummy_microcode (void)
345 {
346 return 0;
347 }
349 static int dummy_physinfo (void)
350 {
351 return 0;
352 }
354 static int dummy_platform_quirk (uint32_t quirk)
355 {
356 return 0;
357 }
359 static int dummy_machine_memory_map (void)
360 {
361 return 0;
362 }
364 static int dummy_domain_memory_map (struct domain *d)
365 {
366 return 0;
367 }
369 static int dummy_mmu_normal_update (struct domain *d, intpte_t fpte)
370 {
371 return 0;
372 }
374 static int dummy_mmu_machphys_update (struct domain *d, unsigned long mfn)
375 {
376 return 0;
377 }
379 static int dummy_update_va_mapping (struct domain *d, l1_pgentry_t pte)
380 {
381 return 0;
382 }
384 static int dummy_add_to_physmap (struct domain *d1, struct domain *d2)
385 {
386 return 0;
387 }
388 #endif
390 struct xsm_operations dummy_xsm_ops;
392 #define set_to_dummy_if_null(ops, function) \
393 do { \
394 if ( !ops->function ) \
395 { \
396 ops->function = dummy_##function; \
397 dprintk(XENLOG_DEBUG, "Had to override the " #function \
398 " security operation with the dummy one.\n"); \
399 } \
400 } while (0)
402 void xsm_fixup_ops (struct xsm_operations *ops)
403 {
404 set_to_dummy_if_null(ops, security_domaininfo);
405 set_to_dummy_if_null(ops, setvcpucontext);
406 set_to_dummy_if_null(ops, pausedomain);
407 set_to_dummy_if_null(ops, unpausedomain);
408 set_to_dummy_if_null(ops, resumedomain);
409 set_to_dummy_if_null(ops, domain_create);
410 set_to_dummy_if_null(ops, max_vcpus);
411 set_to_dummy_if_null(ops, destroydomain);
412 set_to_dummy_if_null(ops, vcpuaffinity);
413 set_to_dummy_if_null(ops, scheduler);
414 set_to_dummy_if_null(ops, getdomaininfo);
415 set_to_dummy_if_null(ops, getvcpucontext);
416 set_to_dummy_if_null(ops, getvcpuinfo);
417 set_to_dummy_if_null(ops, domain_settime);
418 set_to_dummy_if_null(ops, tbufcontrol);
419 set_to_dummy_if_null(ops, readconsole);
420 set_to_dummy_if_null(ops, sched_id);
421 set_to_dummy_if_null(ops, setdomainmaxmem);
422 set_to_dummy_if_null(ops, setdomainhandle);
423 set_to_dummy_if_null(ops, setdebugging);
424 set_to_dummy_if_null(ops, irq_permission);
425 set_to_dummy_if_null(ops, iomem_permission);
426 set_to_dummy_if_null(ops, perfcontrol);
428 set_to_dummy_if_null(ops, evtchn_unbound);
429 set_to_dummy_if_null(ops, evtchn_interdomain);
430 set_to_dummy_if_null(ops, evtchn_close_post);
431 set_to_dummy_if_null(ops, evtchn_send);
432 set_to_dummy_if_null(ops, evtchn_status);
433 set_to_dummy_if_null(ops, evtchn_reset);
435 set_to_dummy_if_null(ops, grant_mapref);
436 set_to_dummy_if_null(ops, grant_unmapref);
437 set_to_dummy_if_null(ops, grant_setup);
438 set_to_dummy_if_null(ops, grant_transfer);
439 set_to_dummy_if_null(ops, grant_copy);
440 set_to_dummy_if_null(ops, grant_query_size);
442 set_to_dummy_if_null(ops, alloc_security_domain);
443 set_to_dummy_if_null(ops, free_security_domain);
444 set_to_dummy_if_null(ops, alloc_security_evtchn);
445 set_to_dummy_if_null(ops, free_security_evtchn);
447 set_to_dummy_if_null(ops, translate_gpfn_list);
448 set_to_dummy_if_null(ops, memory_adjust_reservation);
449 set_to_dummy_if_null(ops, memory_stat_reservation);
450 set_to_dummy_if_null(ops, memory_pin_page);
452 set_to_dummy_if_null(ops, console_io);
454 set_to_dummy_if_null(ops, profile);
456 set_to_dummy_if_null(ops, kexec);
457 set_to_dummy_if_null(ops, schedop_shutdown);
459 set_to_dummy_if_null(ops, __do_xsm_op);
460 set_to_dummy_if_null(ops, complete_init);
462 #ifdef CONFIG_X86
463 set_to_dummy_if_null(ops, shadow_control);
464 set_to_dummy_if_null(ops, ioport_permission);
465 set_to_dummy_if_null(ops, getpageframeinfo);
466 set_to_dummy_if_null(ops, getmemlist);
467 set_to_dummy_if_null(ops, hypercall_init);
468 set_to_dummy_if_null(ops, hvmcontext);
469 set_to_dummy_if_null(ops, address_size);
470 set_to_dummy_if_null(ops, hvm_param);
471 set_to_dummy_if_null(ops, hvm_set_pci_intx_level);
472 set_to_dummy_if_null(ops, hvm_set_isa_irq_level);
473 set_to_dummy_if_null(ops, hvm_set_pci_link_route);
474 set_to_dummy_if_null(ops, apic);
475 set_to_dummy_if_null(ops, assign_vector);
476 set_to_dummy_if_null(ops, xen_settime);
477 set_to_dummy_if_null(ops, memtype);
478 set_to_dummy_if_null(ops, microcode);
479 set_to_dummy_if_null(ops, physinfo);
480 set_to_dummy_if_null(ops, platform_quirk);
481 set_to_dummy_if_null(ops, machine_memory_map);
482 set_to_dummy_if_null(ops, domain_memory_map);
483 set_to_dummy_if_null(ops, mmu_normal_update);
484 set_to_dummy_if_null(ops, mmu_machphys_update);
485 set_to_dummy_if_null(ops, update_va_mapping);
486 set_to_dummy_if_null(ops, add_to_physmap);
487 #endif
488 }