ia64/xen-unstable

view xen/include/xen/shared.h @ 19800:78962f85c562

IOMMU: Add two generic functions to vendor neutral interface

Add 2 generic functions into the vendor neutral iommu interface, The
reason is that from changeset 19732, there is only one global flag
"iommu_enabled" that controls iommu enablement for both vtd and amd
systems, so we need different code paths for vtd and amd iommu systems
if this flag has been turned on. Also, the early checking of
"iommu_enabled" in iommu_setup() is removed to prevent iommu
functionalities from been disabled on amd systems.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jun 19 08:41:50 2009 +0100 (2009-06-19)
parents 2f9e1348aa98
children
line source
1 #ifndef __XEN_SHARED_H__
2 #define __XEN_SHARED_H__
4 #include <xen/config.h>
6 #ifdef CONFIG_COMPAT
8 #include <compat/xen.h>
10 typedef union {
11 struct shared_info native;
12 struct compat_shared_info compat;
13 } shared_info_t;
15 /*
16 * Compat field is never larger than native field, so cast to that as it
17 * is the largest memory range it is safe for the caller to modify without
18 * further discrimination between compat and native cases.
19 */
20 #define __shared_info(d, s, field) \
21 (*(!has_32bit_shinfo(d) ? \
22 (typeof(&(s)->compat.field))&(s)->native.field : \
23 (typeof(&(s)->compat.field))&(s)->compat.field))
25 typedef union {
26 struct vcpu_info native;
27 struct compat_vcpu_info compat;
28 } vcpu_info_t;
30 /* As above, cast to compat field type. */
31 #define __vcpu_info(v, i, field) \
32 (*(!has_32bit_shinfo((v)->domain) ? \
33 (typeof(&(i)->compat.field))&(i)->native.field : \
34 (typeof(&(i)->compat.field))&(i)->compat.field))
36 #else
38 typedef struct shared_info shared_info_t;
39 #define __shared_info(d, s, field) ((s)->field)
41 typedef struct vcpu_info vcpu_info_t;
42 #define __vcpu_info(v, i, field) ((i)->field)
44 #endif
46 #define shared_info(d, field) __shared_info(d, (d)->shared_info, field)
47 #define vcpu_info(v, field) __vcpu_info(v, (v)->vcpu_info, field)
49 #endif /* __XEN_SHARED_H__ */