ia64/xen-unstable

view xen/include/xen/compiler.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 5369133d772c
children
line source
1 #ifndef __LINUX_COMPILER_H
2 #define __LINUX_COMPILER_H
4 #if !defined(__GNUC__) || (__GNUC__ < 3)
5 #error Sorry, your compiler is too old/not recognized.
6 #endif
8 #define barrier() __asm__ __volatile__("": : :"memory")
10 #define likely(x) __builtin_expect((x),1)
11 #define unlikely(x) __builtin_expect((x),0)
13 #define inline __inline__
14 #define always_inline __inline__ __attribute__ ((always_inline))
15 #define noinline __attribute__((noinline))
17 #define __attribute_pure__ __attribute__((pure))
18 #define __attribute_const__ __attribute__((__const__))
20 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
21 #define __attribute_used__ __attribute__((__used__))
22 #else
23 #define __attribute_used__ __attribute__((__unused__))
24 #endif
26 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
27 #define __must_check __attribute__((warn_unused_result))
28 #else
29 #define __must_check
30 #endif
32 #if __GNUC__ > 3
33 #define offsetof(a,b) __builtin_offsetof(a,b)
34 #else
35 #define offsetof(a,b) ((unsigned long)&(((a *)0)->b))
36 #endif
38 /* &a[0] degrades to a pointer: a different type from an array */
39 #define __must_be_array(a) \
40 BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
42 #ifdef GCC_HAS_VISIBILITY_ATTRIBUTE
43 /* Results in more efficient PIC code (no indirections through GOT or PLT). */
44 #pragma GCC visibility push(hidden)
45 #endif
47 /* This macro obfuscates arithmetic on a variable address so that gcc
48 shouldn't recognize the original var, and make assumptions about it */
49 /*
50 * Versions of the ppc64 compiler before 4.1 had a bug where use of
51 * RELOC_HIDE could trash r30. The bug can be worked around by changing
52 * the inline assembly constraint from =g to =r, in this particular
53 * case either is valid.
54 */
55 #define RELOC_HIDE(ptr, off) \
56 ({ unsigned long __ptr; \
57 __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \
58 (typeof(ptr)) (__ptr + (off)); })
60 /*
61 * A trick to suppress uninitialized variable warning without generating any
62 * code
63 */
64 #define uninitialized_var(x) x = x
66 #endif /* __LINUX_COMPILER_H */