diff options
author | Steve French <sfrench@us.ibm.com> | 2008-04-28 00:01:34 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2008-04-28 00:01:34 -0400 |
commit | 1dbbb6077426f8ce63d6a59c5ac6613e1689cbde (patch) | |
tree | 6141d4d7a8eb7c557705bdfa764137d4fd2e4924 /include/linux | |
parent | d09e860cf07e7c9ee12920a09f5080e30a12a23a (diff) | |
parent | 064922a805ec7aadfafdd27aa6b4908d737c3c1d (diff) |
Merge branch 'master' of /pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/Kbuild | 1 | ||||
-rw-r--r-- | include/linux/bitops.h | 140 | ||||
-rw-r--r-- | include/linux/bsg.h | 14 | ||||
-rw-r--r-- | include/linux/compiler-gcc.h | 13 | ||||
-rw-r--r-- | include/linux/file.h | 3 | ||||
-rw-r--r-- | include/linux/fs.h | 5 | ||||
-rw-r--r-- | include/linux/hdsmart.h | 126 | ||||
-rw-r--r-- | include/linux/ide.h | 227 | ||||
-rw-r--r-- | include/linux/kvm.h | 130 | ||||
-rw-r--r-- | include/linux/kvm_host.h | 59 | ||||
-rw-r--r-- | include/linux/kvm_para.h | 11 | ||||
-rw-r--r-- | include/linux/kvm_types.h | 2 | ||||
-rw-r--r-- | include/linux/mlx4/device.h | 40 | ||||
-rw-r--r-- | include/linux/mlx4/qp.h | 4 | ||||
-rw-r--r-- | include/linux/mm.h | 1 | ||||
-rw-r--r-- | include/linux/sched.h | 2 | ||||
-rw-r--r-- | include/linux/sysfs.h | 4 |
17 files changed, 523 insertions, 259 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index cbb5ccb27de3..bda6f04791d4 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
@@ -210,7 +210,6 @@ unifdef-y += hayesesp.h | |||
210 | unifdef-y += hdlcdrv.h | 210 | unifdef-y += hdlcdrv.h |
211 | unifdef-y += hdlc.h | 211 | unifdef-y += hdlc.h |
212 | unifdef-y += hdreg.h | 212 | unifdef-y += hdreg.h |
213 | unifdef-y += hdsmart.h | ||
214 | unifdef-y += hid.h | 213 | unifdef-y += hid.h |
215 | unifdef-y += hiddev.h | 214 | unifdef-y += hiddev.h |
216 | unifdef-y += hidraw.h | 215 | unifdef-y += hidraw.h |
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 40d54731de7e..48bde600a2db 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
@@ -112,4 +112,144 @@ static inline unsigned fls_long(unsigned long l) | |||
112 | return fls64(l); | 112 | return fls64(l); |
113 | } | 113 | } |
114 | 114 | ||
115 | #ifdef __KERNEL__ | ||
116 | #ifdef CONFIG_GENERIC_FIND_FIRST_BIT | ||
117 | extern unsigned long __find_first_bit(const unsigned long *addr, | ||
118 | unsigned long size); | ||
119 | |||
120 | /** | ||
121 | * find_first_bit - find the first set bit in a memory region | ||
122 | * @addr: The address to start the search at | ||
123 | * @size: The maximum size to search | ||
124 | * | ||
125 | * Returns the bit number of the first set bit. | ||
126 | */ | ||
127 | static __always_inline unsigned long | ||
128 | find_first_bit(const unsigned long *addr, unsigned long size) | ||
129 | { | ||
130 | /* Avoid a function call if the bitmap size is a constant */ | ||
131 | /* and not bigger than BITS_PER_LONG. */ | ||
132 | |||
133 | /* insert a sentinel so that __ffs returns size if there */ | ||
134 | /* are no set bits in the bitmap */ | ||
135 | if (__builtin_constant_p(size) && (size < BITS_PER_LONG)) | ||
136 | return __ffs((*addr) | (1ul << size)); | ||
137 | |||
138 | /* the result of __ffs(0) is undefined, so it needs to be */ | ||
139 | /* handled separately */ | ||
140 | if (__builtin_constant_p(size) && (size == BITS_PER_LONG)) | ||
141 | return ((*addr) == 0) ? BITS_PER_LONG : __ffs(*addr); | ||
142 | |||
143 | /* size is not constant or too big */ | ||
144 | return __find_first_bit(addr, size); | ||
145 | } | ||
146 | |||
147 | extern unsigned long __find_first_zero_bit(const unsigned long *addr, | ||
148 | unsigned long size); | ||
149 | |||
150 | /** | ||
151 | * find_first_zero_bit - find the first cleared bit in a memory region | ||
152 | * @addr: The address to start the search at | ||
153 | * @size: The maximum size to search | ||
154 | * | ||
155 | * Returns the bit number of the first cleared bit. | ||
156 | */ | ||
157 | static __always_inline unsigned long | ||
158 | find_first_zero_bit(const unsigned long *addr, unsigned long size) | ||
159 | { | ||
160 | /* Avoid a function call if the bitmap size is a constant */ | ||
161 | /* and not bigger than BITS_PER_LONG. */ | ||
162 | |||
163 | /* insert a sentinel so that __ffs returns size if there */ | ||
164 | /* are no set bits in the bitmap */ | ||
165 | if (__builtin_constant_p(size) && (size < BITS_PER_LONG)) { | ||
166 | return __ffs(~(*addr) | (1ul << size)); | ||
167 | } | ||
168 | |||
169 | /* the result of __ffs(0) is undefined, so it needs to be */ | ||
170 | /* handled separately */ | ||
171 | if (__builtin_constant_p(size) && (size == BITS_PER_LONG)) | ||
172 | return (~(*addr) == 0) ? BITS_PER_LONG : __ffs(~(*addr)); | ||
173 | |||
174 | /* size is not constant or too big */ | ||
175 | return __find_first_zero_bit(addr, size); | ||
176 | } | ||
177 | #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ | ||
178 | |||
179 | #ifdef CONFIG_GENERIC_FIND_NEXT_BIT | ||
180 | extern unsigned long __find_next_bit(const unsigned long *addr, | ||
181 | unsigned long size, unsigned long offset); | ||
182 | |||
183 | /** | ||
184 | * find_next_bit - find the next set bit in a memory region | ||
185 | * @addr: The address to base the search on | ||
186 | * @offset: The bitnumber to start searching at | ||
187 | * @size: The bitmap size in bits | ||
188 | */ | ||
189 | static __always_inline unsigned long | ||
190 | find_next_bit(const unsigned long *addr, unsigned long size, | ||
191 | unsigned long offset) | ||
192 | { | ||
193 | unsigned long value; | ||
194 | |||
195 | /* Avoid a function call if the bitmap size is a constant */ | ||
196 | /* and not bigger than BITS_PER_LONG. */ | ||
197 | |||
198 | /* insert a sentinel so that __ffs returns size if there */ | ||
199 | /* are no set bits in the bitmap */ | ||
200 | if (__builtin_constant_p(size) && (size < BITS_PER_LONG)) { | ||
201 | value = (*addr) & ((~0ul) << offset); | ||
202 | value |= (1ul << size); | ||
203 | return __ffs(value); | ||
204 | } | ||
205 | |||
206 | /* the result of __ffs(0) is undefined, so it needs to be */ | ||
207 | /* handled separately */ | ||
208 | if (__builtin_constant_p(size) && (size == BITS_PER_LONG)) { | ||
209 | value = (*addr) & ((~0ul) << offset); | ||
210 | return (value == 0) ? BITS_PER_LONG : __ffs(value); | ||
211 | } | ||
212 | |||
213 | /* size is not constant or too big */ | ||
214 | return __find_next_bit(addr, size, offset); | ||
215 | } | ||
216 | |||
217 | extern unsigned long __find_next_zero_bit(const unsigned long *addr, | ||
218 | unsigned long size, unsigned long offset); | ||
219 | |||
220 | /** | ||
221 | * find_next_zero_bit - find the next cleared bit in a memory region | ||
222 | * @addr: The address to base the search on | ||
223 | * @offset: The bitnumber to start searching at | ||
224 | * @size: The bitmap size in bits | ||
225 | */ | ||
226 | static __always_inline unsigned long | ||
227 | find_next_zero_bit(const unsigned long *addr, unsigned long size, | ||
228 | unsigned long offset) | ||
229 | { | ||
230 | unsigned long value; | ||
231 | |||
232 | /* Avoid a function call if the bitmap size is a constant */ | ||
233 | /* and not bigger than BITS_PER_LONG. */ | ||
234 | |||
235 | /* insert a sentinel so that __ffs returns size if there */ | ||
236 | /* are no set bits in the bitmap */ | ||
237 | if (__builtin_constant_p(size) && (size < BITS_PER_LONG)) { | ||
238 | value = (~(*addr)) & ((~0ul) << offset); | ||
239 | value |= (1ul << size); | ||
240 | return __ffs(value); | ||
241 | } | ||
242 | |||
243 | /* the result of __ffs(0) is undefined, so it needs to be */ | ||
244 | /* handled separately */ | ||
245 | if (__builtin_constant_p(size) && (size == BITS_PER_LONG)) { | ||
246 | value = (~(*addr)) & ((~0ul) << offset); | ||
247 | return (value == 0) ? BITS_PER_LONG : __ffs(value); | ||
248 | } | ||
249 | |||
250 | /* size is not constant or too big */ | ||
251 | return __find_next_zero_bit(addr, size, offset); | ||
252 | } | ||
253 | #endif /* CONFIG_GENERIC_FIND_NEXT_BIT */ | ||
254 | #endif /* __KERNEL__ */ | ||
115 | #endif | 255 | #endif |
diff --git a/include/linux/bsg.h b/include/linux/bsg.h index e8406c55c6d3..cf0303a60611 100644 --- a/include/linux/bsg.h +++ b/include/linux/bsg.h | |||
@@ -56,19 +56,25 @@ struct sg_io_v4 { | |||
56 | #if defined(CONFIG_BLK_DEV_BSG) | 56 | #if defined(CONFIG_BLK_DEV_BSG) |
57 | struct bsg_class_device { | 57 | struct bsg_class_device { |
58 | struct device *class_dev; | 58 | struct device *class_dev; |
59 | struct device *dev; | 59 | struct device *parent; |
60 | int minor; | 60 | int minor; |
61 | struct request_queue *queue; | 61 | struct request_queue *queue; |
62 | struct kref ref; | ||
63 | void (*release)(struct device *); | ||
62 | }; | 64 | }; |
63 | 65 | ||
64 | extern int bsg_register_queue(struct request_queue *, struct device *, const char *); | 66 | extern int bsg_register_queue(struct request_queue *q, |
67 | struct device *parent, const char *name, | ||
68 | void (*release)(struct device *)); | ||
65 | extern void bsg_unregister_queue(struct request_queue *); | 69 | extern void bsg_unregister_queue(struct request_queue *); |
66 | #else | 70 | #else |
67 | static inline int bsg_register_queue(struct request_queue * rq, struct device *dev, const char *name) | 71 | static inline int bsg_register_queue(struct request_queue *q, |
72 | struct device *parent, const char *name, | ||
73 | void (*release)(struct device *)) | ||
68 | { | 74 | { |
69 | return 0; | 75 | return 0; |
70 | } | 76 | } |
71 | static inline void bsg_unregister_queue(struct request_queue *rq) | 77 | static inline void bsg_unregister_queue(struct request_queue *q) |
72 | { | 78 | { |
73 | } | 79 | } |
74 | #endif | 80 | #endif |
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index fe23792f05c1..b2fd7547b58d 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h | |||
@@ -28,9 +28,16 @@ | |||
28 | #define __must_be_array(a) \ | 28 | #define __must_be_array(a) \ |
29 | BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0]))) | 29 | BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0]))) |
30 | 30 | ||
31 | #define inline inline __attribute__((always_inline)) | 31 | /* |
32 | #define __inline__ __inline__ __attribute__((always_inline)) | 32 | * Force always-inline if the user requests it so via the .config: |
33 | #define __inline __inline __attribute__((always_inline)) | 33 | */ |
34 | #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ | ||
35 | !defined(CONFIG_OPTIMIZE_INLINING) && (__GNUC__ >= 4) | ||
36 | # define inline inline __attribute__((always_inline)) | ||
37 | # define __inline__ __inline__ __attribute__((always_inline)) | ||
38 | # define __inline __inline __attribute__((always_inline)) | ||
39 | #endif | ||
40 | |||
34 | #define __deprecated __attribute__((deprecated)) | 41 | #define __deprecated __attribute__((deprecated)) |
35 | #define __packed __attribute__((packed)) | 42 | #define __packed __attribute__((packed)) |
36 | #define __weak __attribute__((weak)) | 43 | #define __weak __attribute__((weak)) |
diff --git a/include/linux/file.h b/include/linux/file.h index 653477021e4c..69baf5a4f0a5 100644 --- a/include/linux/file.h +++ b/include/linux/file.h | |||
@@ -117,7 +117,8 @@ struct task_struct; | |||
117 | 117 | ||
118 | struct files_struct *get_files_struct(struct task_struct *); | 118 | struct files_struct *get_files_struct(struct task_struct *); |
119 | void put_files_struct(struct files_struct *fs); | 119 | void put_files_struct(struct files_struct *fs); |
120 | void reset_files_struct(struct task_struct *, struct files_struct *); | 120 | void reset_files_struct(struct files_struct *); |
121 | int unshare_files(struct files_struct **); | ||
121 | 122 | ||
122 | extern struct kmem_cache *files_cachep; | 123 | extern struct kmem_cache *files_cachep; |
123 | 124 | ||
diff --git a/include/linux/fs.h b/include/linux/fs.h index 6556f2f967e5..d6d7c52055c6 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1309,7 +1309,7 @@ struct super_operations { | |||
1309 | int (*statfs) (struct dentry *, struct kstatfs *); | 1309 | int (*statfs) (struct dentry *, struct kstatfs *); |
1310 | int (*remount_fs) (struct super_block *, int *, char *); | 1310 | int (*remount_fs) (struct super_block *, int *, char *); |
1311 | void (*clear_inode) (struct inode *); | 1311 | void (*clear_inode) (struct inode *); |
1312 | void (*umount_begin) (struct vfsmount *, int); | 1312 | void (*umount_begin) (struct super_block *); |
1313 | 1313 | ||
1314 | int (*show_options)(struct seq_file *, struct vfsmount *); | 1314 | int (*show_options)(struct seq_file *, struct vfsmount *); |
1315 | int (*show_stats)(struct seq_file *, struct vfsmount *); | 1315 | int (*show_stats)(struct seq_file *, struct vfsmount *); |
@@ -2034,9 +2034,6 @@ static inline ino_t parent_ino(struct dentry *dentry) | |||
2034 | return res; | 2034 | return res; |
2035 | } | 2035 | } |
2036 | 2036 | ||
2037 | /* kernel/fork.c */ | ||
2038 | extern int unshare_files(void); | ||
2039 | |||
2040 | /* Transaction based IO helpers */ | 2037 | /* Transaction based IO helpers */ |
2041 | 2038 | ||
2042 | /* | 2039 | /* |
diff --git a/include/linux/hdsmart.h b/include/linux/hdsmart.h deleted file mode 100644 index 4f4faf9d4238..000000000000 --- a/include/linux/hdsmart.h +++ /dev/null | |||
@@ -1,126 +0,0 @@ | |||
1 | /* | ||
2 | * linux/include/linux/hdsmart.h | ||
3 | * | ||
4 | * Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org> | ||
5 | * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2, or (at your option) | ||
10 | * any later version. | ||
11 | * | ||
12 | * You should have received a copy of the GNU General Public License | ||
13 | * (for example /usr/src/linux/COPYING); if not, write to the Free | ||
14 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
15 | */ | ||
16 | |||
17 | #ifndef _LINUX_HDSMART_H | ||
18 | #define _LINUX_HDSMART_H | ||
19 | |||
20 | #ifndef __KERNEL__ | ||
21 | #define OFFLINE_FULL_SCAN 0 | ||
22 | #define SHORT_SELF_TEST 1 | ||
23 | #define EXTEND_SELF_TEST 2 | ||
24 | #define SHORT_CAPTIVE_SELF_TEST 129 | ||
25 | #define EXTEND_CAPTIVE_SELF_TEST 130 | ||
26 | |||
27 | /* smart_attribute is the vendor specific in SFF-8035 spec */ | ||
28 | typedef struct ata_smart_attribute_s { | ||
29 | unsigned char id; | ||
30 | unsigned short status_flag; | ||
31 | unsigned char normalized; | ||
32 | unsigned char worse_normal; | ||
33 | unsigned char raw[6]; | ||
34 | unsigned char reserv; | ||
35 | } __attribute__ ((packed)) ata_smart_attribute_t; | ||
36 | |||
37 | /* smart_values is format of the read drive Atrribute command */ | ||
38 | typedef struct ata_smart_values_s { | ||
39 | unsigned short revnumber; | ||
40 | ata_smart_attribute_t vendor_attributes [30]; | ||
41 | unsigned char offline_data_collection_status; | ||
42 | unsigned char self_test_exec_status; | ||
43 | unsigned short total_time_to_complete_off_line; | ||
44 | unsigned char vendor_specific_366; | ||
45 | unsigned char offline_data_collection_capability; | ||
46 | unsigned short smart_capability; | ||
47 | unsigned char errorlog_capability; | ||
48 | unsigned char vendor_specific_371; | ||
49 | unsigned char short_test_completion_time; | ||
50 | unsigned char extend_test_completion_time; | ||
51 | unsigned char reserved_374_385 [12]; | ||
52 | unsigned char vendor_specific_386_509 [125]; | ||
53 | unsigned char chksum; | ||
54 | } __attribute__ ((packed)) ata_smart_values_t; | ||
55 | |||
56 | /* Smart Threshold data structures */ | ||
57 | /* Vendor attribute of SMART Threshold */ | ||
58 | typedef struct ata_smart_threshold_entry_s { | ||
59 | unsigned char id; | ||
60 | unsigned char normalized_threshold; | ||
61 | unsigned char reserved[10]; | ||
62 | } __attribute__ ((packed)) ata_smart_threshold_entry_t; | ||
63 | |||
64 | /* Format of Read SMART THreshold Command */ | ||
65 | typedef struct ata_smart_thresholds_s { | ||
66 | unsigned short revnumber; | ||
67 | ata_smart_threshold_entry_t thres_entries[30]; | ||
68 | unsigned char reserved[149]; | ||
69 | unsigned char chksum; | ||
70 | } __attribute__ ((packed)) ata_smart_thresholds_t; | ||
71 | |||
72 | typedef struct ata_smart_errorlog_command_struct_s { | ||
73 | unsigned char devicecontrolreg; | ||
74 | unsigned char featuresreg; | ||
75 | unsigned char sector_count; | ||
76 | unsigned char sector_number; | ||
77 | unsigned char cylinder_low; | ||
78 | unsigned char cylinder_high; | ||
79 | unsigned char drive_head; | ||
80 | unsigned char commandreg; | ||
81 | unsigned int timestamp; | ||
82 | } __attribute__ ((packed)) ata_smart_errorlog_command_struct_t; | ||
83 | |||
84 | typedef struct ata_smart_errorlog_error_struct_s { | ||
85 | unsigned char error_condition; | ||
86 | unsigned char extended_error[14]; | ||
87 | unsigned char state; | ||
88 | unsigned short timestamp; | ||
89 | } __attribute__ ((packed)) ata_smart_errorlog_error_struct_t; | ||
90 | |||
91 | typedef struct ata_smart_errorlog_struct_s { | ||
92 | ata_smart_errorlog_command_struct_t commands[6]; | ||
93 | ata_smart_errorlog_error_struct_t error_struct; | ||
94 | } __attribute__ ((packed)) ata_smart_errorlog_struct_t; | ||
95 | |||
96 | typedef struct ata_smart_errorlog_s { | ||
97 | unsigned char revnumber; | ||
98 | unsigned char error_log_pointer; | ||
99 | ata_smart_errorlog_struct_t errorlog_struct[5]; | ||
100 | unsigned short ata_error_count; | ||
101 | unsigned short non_fatal_count; | ||
102 | unsigned short drive_timeout_count; | ||
103 | unsigned char reserved[53]; | ||
104 | unsigned char chksum; | ||
105 | } __attribute__ ((packed)) ata_smart_errorlog_t; | ||
106 | |||
107 | typedef struct ata_smart_selftestlog_struct_s { | ||
108 | unsigned char selftestnumber; | ||
109 | unsigned char selfteststatus; | ||
110 | unsigned short timestamp; | ||
111 | unsigned char selftestfailurecheckpoint; | ||
112 | unsigned int lbafirstfailure; | ||
113 | unsigned char vendorspecific[15]; | ||
114 | } __attribute__ ((packed)) ata_smart_selftestlog_struct_t; | ||
115 | |||
116 | typedef struct ata_smart_selftestlog_s { | ||
117 | unsigned short revnumber; | ||
118 | ata_smart_selftestlog_struct_t selftest_struct[21]; | ||
119 | unsigned char vendorspecific[2]; | ||
120 | unsigned char mostrecenttest; | ||
121 | unsigned char resevered[2]; | ||
122 | unsigned char chksum; | ||
123 | } __attribute__ ((packed)) ata_smart_selftestlog_t; | ||
124 | #endif /* __KERNEL__ */ | ||
125 | |||
126 | #endif /* _LINUX_HDSMART_H */ | ||
diff --git a/include/linux/ide.h b/include/linux/ide.h index 5f3e82ae901a..32fd77bb4436 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -48,13 +48,6 @@ typedef unsigned char byte; /* used everywhere */ | |||
48 | #define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ | 48 | #define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ |
49 | 49 | ||
50 | /* | 50 | /* |
51 | * Tune flags | ||
52 | */ | ||
53 | #define IDE_TUNE_NOAUTO 2 | ||
54 | #define IDE_TUNE_AUTO 1 | ||
55 | #define IDE_TUNE_DEFAULT 0 | ||
56 | |||
57 | /* | ||
58 | * state flags | 51 | * state flags |
59 | */ | 52 | */ |
60 | 53 | ||
@@ -68,23 +61,30 @@ typedef unsigned char byte; /* used everywhere */ | |||
68 | */ | 61 | */ |
69 | #define IDE_NR_PORTS (10) | 62 | #define IDE_NR_PORTS (10) |
70 | 63 | ||
71 | #define IDE_DATA_OFFSET (0) | 64 | struct ide_io_ports { |
72 | #define IDE_ERROR_OFFSET (1) | 65 | unsigned long data_addr; |
73 | #define IDE_NSECTOR_OFFSET (2) | 66 | |
74 | #define IDE_SECTOR_OFFSET (3) | 67 | union { |
75 | #define IDE_LCYL_OFFSET (4) | 68 | unsigned long error_addr; /* read: error */ |
76 | #define IDE_HCYL_OFFSET (5) | 69 | unsigned long feature_addr; /* write: feature */ |
77 | #define IDE_SELECT_OFFSET (6) | 70 | }; |
78 | #define IDE_STATUS_OFFSET (7) | 71 | |
79 | #define IDE_CONTROL_OFFSET (8) | 72 | unsigned long nsect_addr; |
80 | #define IDE_IRQ_OFFSET (9) | 73 | unsigned long lbal_addr; |
81 | 74 | unsigned long lbam_addr; | |
82 | #define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET | 75 | unsigned long lbah_addr; |
83 | #define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET | 76 | |
84 | #define IDE_ALTSTATUS_OFFSET IDE_CONTROL_OFFSET | 77 | unsigned long device_addr; |
85 | #define IDE_IREASON_OFFSET IDE_NSECTOR_OFFSET | 78 | |
86 | #define IDE_BCOUNTL_OFFSET IDE_LCYL_OFFSET | 79 | union { |
87 | #define IDE_BCOUNTH_OFFSET IDE_HCYL_OFFSET | 80 | unsigned long status_addr; /*  read: status  */ |
81 | unsigned long command_addr; /* write: command */ | ||
82 | }; | ||
83 | |||
84 | unsigned long ctl_addr; | ||
85 | |||
86 | unsigned long irq_addr; | ||
87 | }; | ||
88 | 88 | ||
89 | #define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good)) | 89 | #define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good)) |
90 | #define BAD_R_STAT (BUSY_STAT | ERR_STAT) | 90 | #define BAD_R_STAT (BUSY_STAT | ERR_STAT) |
@@ -163,14 +163,17 @@ typedef u8 hwif_chipset_t; | |||
163 | * Structure to hold all information about the location of this port | 163 | * Structure to hold all information about the location of this port |
164 | */ | 164 | */ |
165 | typedef struct hw_regs_s { | 165 | typedef struct hw_regs_s { |
166 | unsigned long io_ports[IDE_NR_PORTS]; /* task file registers */ | 166 | union { |
167 | struct ide_io_ports io_ports; | ||
168 | unsigned long io_ports_array[IDE_NR_PORTS]; | ||
169 | }; | ||
170 | |||
167 | int irq; /* our irq number */ | 171 | int irq; /* our irq number */ |
168 | ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ | 172 | ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ |
169 | hwif_chipset_t chipset; | 173 | hwif_chipset_t chipset; |
170 | struct device *dev; | 174 | struct device *dev; |
171 | } hw_regs_t; | 175 | } hw_regs_t; |
172 | 176 | ||
173 | struct hwif_s * ide_find_port(unsigned long); | ||
174 | void ide_init_port_data(struct hwif_s *, unsigned int); | 177 | void ide_init_port_data(struct hwif_s *, unsigned int); |
175 | void ide_init_port_hw(struct hwif_s *, hw_regs_t *); | 178 | void ide_init_port_hw(struct hwif_s *, hw_regs_t *); |
176 | 179 | ||
@@ -180,10 +183,10 @@ static inline void ide_std_init_ports(hw_regs_t *hw, | |||
180 | { | 183 | { |
181 | unsigned int i; | 184 | unsigned int i; |
182 | 185 | ||
183 | for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) | 186 | for (i = 0; i <= 7; i++) |
184 | hw->io_ports[i] = io_addr++; | 187 | hw->io_ports_array[i] = io_addr++; |
185 | 188 | ||
186 | hw->io_ports[IDE_CONTROL_OFFSET] = ctl_addr; | 189 | hw->io_ports.ctl_addr = ctl_addr; |
187 | } | 190 | } |
188 | 191 | ||
189 | #include <asm/ide.h> | 192 | #include <asm/ide.h> |
@@ -329,7 +332,6 @@ typedef struct ide_drive_s { | |||
329 | unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */ | 332 | unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */ |
330 | unsigned doorlocking : 1; /* for removable only: door lock/unlock works */ | 333 | unsigned doorlocking : 1; /* for removable only: door lock/unlock works */ |
331 | unsigned nodma : 1; /* disallow DMA */ | 334 | unsigned nodma : 1; /* disallow DMA */ |
332 | unsigned autotune : 2; /* 0=default, 1=autotune, 2=noautotune */ | ||
333 | unsigned remap_0_to_1 : 1; /* 0=noremap, 1=remap 0->1 (for EZDrive) */ | 335 | unsigned remap_0_to_1 : 1; /* 0=noremap, 1=remap 0->1 (for EZDrive) */ |
334 | unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */ | 336 | unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */ |
335 | unsigned vdma : 1; /* 1=doing PIO over DMA 0=doing normal DMA */ | 337 | unsigned vdma : 1; /* 1=doing PIO over DMA 0=doing normal DMA */ |
@@ -388,6 +390,43 @@ typedef struct ide_drive_s { | |||
388 | 390 | ||
389 | struct ide_port_info; | 391 | struct ide_port_info; |
390 | 392 | ||
393 | struct ide_port_ops { | ||
394 | /* host specific initialization of devices on a port */ | ||
395 | void (*port_init_devs)(struct hwif_s *); | ||
396 | /* routine to program host for PIO mode */ | ||
397 | void (*set_pio_mode)(ide_drive_t *, const u8); | ||
398 | /* routine to program host for DMA mode */ | ||
399 | void (*set_dma_mode)(ide_drive_t *, const u8); | ||
400 | /* tweaks hardware to select drive */ | ||
401 | void (*selectproc)(ide_drive_t *); | ||
402 | /* chipset polling based on hba specifics */ | ||
403 | int (*reset_poll)(ide_drive_t *); | ||
404 | /* chipset specific changes to default for device-hba resets */ | ||
405 | void (*pre_reset)(ide_drive_t *); | ||
406 | /* routine to reset controller after a disk reset */ | ||
407 | void (*resetproc)(ide_drive_t *); | ||
408 | /* special host masking for drive selection */ | ||
409 | void (*maskproc)(ide_drive_t *, int); | ||
410 | /* check host's drive quirk list */ | ||
411 | void (*quirkproc)(ide_drive_t *); | ||
412 | |||
413 | u8 (*mdma_filter)(ide_drive_t *); | ||
414 | u8 (*udma_filter)(ide_drive_t *); | ||
415 | |||
416 | u8 (*cable_detect)(struct hwif_s *); | ||
417 | }; | ||
418 | |||
419 | struct ide_dma_ops { | ||
420 | void (*dma_host_set)(struct ide_drive_s *, int); | ||
421 | int (*dma_setup)(struct ide_drive_s *); | ||
422 | void (*dma_exec_cmd)(struct ide_drive_s *, u8); | ||
423 | void (*dma_start)(struct ide_drive_s *); | ||
424 | int (*dma_end)(struct ide_drive_s *); | ||
425 | int (*dma_test_irq)(struct ide_drive_s *); | ||
426 | void (*dma_lost_irq)(struct ide_drive_s *); | ||
427 | void (*dma_timeout)(struct ide_drive_s *); | ||
428 | }; | ||
429 | |||
391 | typedef struct hwif_s { | 430 | typedef struct hwif_s { |
392 | struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ | 431 | struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ |
393 | struct hwif_s *mate; /* other hwif from same PCI chip */ | 432 | struct hwif_s *mate; /* other hwif from same PCI chip */ |
@@ -396,8 +435,8 @@ typedef struct hwif_s { | |||
396 | 435 | ||
397 | char name[6]; /* name of interface, eg. "ide0" */ | 436 | char name[6]; /* name of interface, eg. "ide0" */ |
398 | 437 | ||
399 | /* task file registers for pata and sata */ | 438 | struct ide_io_ports io_ports; |
400 | unsigned long io_ports[IDE_NR_PORTS]; | 439 | |
401 | unsigned long sata_scr[SATA_NR_PORTS]; | 440 | unsigned long sata_scr[SATA_NR_PORTS]; |
402 | 441 | ||
403 | ide_drive_t drives[MAX_DRIVES]; /* drive info */ | 442 | ide_drive_t drives[MAX_DRIVES]; /* drive info */ |
@@ -421,38 +460,12 @@ typedef struct hwif_s { | |||
421 | 460 | ||
422 | struct device *dev; | 461 | struct device *dev; |
423 | 462 | ||
424 | const struct ide_port_info *cds; /* chipset device struct */ | ||
425 | |||
426 | ide_ack_intr_t *ack_intr; | 463 | ide_ack_intr_t *ack_intr; |
427 | 464 | ||
428 | void (*rw_disk)(ide_drive_t *, struct request *); | 465 | void (*rw_disk)(ide_drive_t *, struct request *); |
429 | 466 | ||
430 | #if 0 | 467 | const struct ide_port_ops *port_ops; |
431 | ide_hwif_ops_t *hwifops; | 468 | const struct ide_dma_ops *dma_ops; |
432 | #else | ||
433 | /* host specific initialization of devices on a port */ | ||
434 | void (*port_init_devs)(struct hwif_s *); | ||
435 | /* routine to program host for PIO mode */ | ||
436 | void (*set_pio_mode)(ide_drive_t *, const u8); | ||
437 | /* routine to program host for DMA mode */ | ||
438 | void (*set_dma_mode)(ide_drive_t *, const u8); | ||
439 | /* tweaks hardware to select drive */ | ||
440 | void (*selectproc)(ide_drive_t *); | ||
441 | /* chipset polling based on hba specifics */ | ||
442 | int (*reset_poll)(ide_drive_t *); | ||
443 | /* chipset specific changes to default for device-hba resets */ | ||
444 | void (*pre_reset)(ide_drive_t *); | ||
445 | /* routine to reset controller after a disk reset */ | ||
446 | void (*resetproc)(ide_drive_t *); | ||
447 | /* special host masking for drive selection */ | ||
448 | void (*maskproc)(ide_drive_t *, int); | ||
449 | /* check host's drive quirk list */ | ||
450 | void (*quirkproc)(ide_drive_t *); | ||
451 | #endif | ||
452 | u8 (*mdma_filter)(ide_drive_t *); | ||
453 | u8 (*udma_filter)(ide_drive_t *); | ||
454 | |||
455 | u8 (*cable_detect)(struct hwif_s *); | ||
456 | 469 | ||
457 | void (*ata_input_data)(ide_drive_t *, void *, u32); | 470 | void (*ata_input_data)(ide_drive_t *, void *, u32); |
458 | void (*ata_output_data)(ide_drive_t *, void *, u32); | 471 | void (*ata_output_data)(ide_drive_t *, void *, u32); |
@@ -460,15 +473,7 @@ typedef struct hwif_s { | |||
460 | void (*atapi_input_bytes)(ide_drive_t *, void *, u32); | 473 | void (*atapi_input_bytes)(ide_drive_t *, void *, u32); |
461 | void (*atapi_output_bytes)(ide_drive_t *, void *, u32); | 474 | void (*atapi_output_bytes)(ide_drive_t *, void *, u32); |
462 | 475 | ||
463 | void (*dma_host_set)(ide_drive_t *, int); | ||
464 | int (*dma_setup)(ide_drive_t *); | ||
465 | void (*dma_exec_cmd)(ide_drive_t *, u8); | ||
466 | void (*dma_start)(ide_drive_t *); | ||
467 | int (*ide_dma_end)(ide_drive_t *drive); | ||
468 | int (*ide_dma_test_irq)(ide_drive_t *drive); | ||
469 | void (*ide_dma_clear_irq)(ide_drive_t *drive); | 476 | void (*ide_dma_clear_irq)(ide_drive_t *drive); |
470 | void (*dma_lost_irq)(ide_drive_t *drive); | ||
471 | void (*dma_timeout)(ide_drive_t *drive); | ||
472 | 477 | ||
473 | void (*OUTB)(u8 addr, unsigned long port); | 478 | void (*OUTB)(u8 addr, unsigned long port); |
474 | void (*OUTBSYNC)(ide_drive_t *drive, u8 addr, unsigned long port); | 479 | void (*OUTBSYNC)(ide_drive_t *drive, u8 addr, unsigned long port); |
@@ -515,14 +520,11 @@ typedef struct hwif_s { | |||
515 | unsigned long extra_base; /* extra addr for dma ports */ | 520 | unsigned long extra_base; /* extra addr for dma ports */ |
516 | unsigned extra_ports; /* number of extra dma ports */ | 521 | unsigned extra_ports; /* number of extra dma ports */ |
517 | 522 | ||
518 | unsigned noprobe : 1; /* don't probe for this interface */ | ||
519 | unsigned present : 1; /* this interface exists */ | 523 | unsigned present : 1; /* this interface exists */ |
520 | unsigned serialized : 1; /* serialized all channel operation */ | 524 | unsigned serialized : 1; /* serialized all channel operation */ |
521 | unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ | 525 | unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ |
522 | unsigned reset : 1; /* reset after probe */ | ||
523 | unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ | 526 | unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ |
524 | unsigned mmio : 1; /* host uses MMIO */ | 527 | unsigned mmio : 1; /* host uses MMIO */ |
525 | unsigned straight8 : 1; /* Alan's straight 8 check */ | ||
526 | 528 | ||
527 | struct device gendev; | 529 | struct device gendev; |
528 | struct device *portdev; | 530 | struct device *portdev; |
@@ -703,10 +705,6 @@ void ide_add_generic_settings(ide_drive_t *); | |||
703 | read_proc_t proc_ide_read_capacity; | 705 | read_proc_t proc_ide_read_capacity; |
704 | read_proc_t proc_ide_read_geometry; | 706 | read_proc_t proc_ide_read_geometry; |
705 | 707 | ||
706 | #ifdef CONFIG_BLK_DEV_IDEPCI | ||
707 | void ide_pci_create_host_proc(const char *, get_info_t *); | ||
708 | #endif | ||
709 | |||
710 | /* | 708 | /* |
711 | * Standard exit stuff: | 709 | * Standard exit stuff: |
712 | */ | 710 | */ |
@@ -807,8 +805,21 @@ int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsig | |||
807 | #ifndef _IDE_C | 805 | #ifndef _IDE_C |
808 | extern ide_hwif_t ide_hwifs[]; /* master data repository */ | 806 | extern ide_hwif_t ide_hwifs[]; /* master data repository */ |
809 | #endif | 807 | #endif |
808 | extern int ide_noacpi; | ||
809 | extern int ide_acpigtf; | ||
810 | extern int ide_acpionboot; | ||
810 | extern int noautodma; | 811 | extern int noautodma; |
811 | 812 | ||
813 | extern int ide_vlb_clk; | ||
814 | extern int ide_pci_clk; | ||
815 | |||
816 | ide_hwif_t *ide_find_port_slot(const struct ide_port_info *); | ||
817 | |||
818 | static inline ide_hwif_t *ide_find_port(void) | ||
819 | { | ||
820 | return ide_find_port_slot(NULL); | ||
821 | } | ||
822 | |||
812 | extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); | 823 | extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs); |
813 | int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, | 824 | int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, |
814 | int uptodate, int nr_sectors); | 825 | int uptodate, int nr_sectors); |
@@ -1004,10 +1015,15 @@ void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8 | |||
1004 | void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); | 1015 | void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); |
1005 | 1016 | ||
1006 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | 1017 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI |
1007 | void ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *); | 1018 | int ide_pci_set_master(struct pci_dev *, const char *); |
1019 | unsigned long ide_pci_dma_base(ide_hwif_t *, const struct ide_port_info *); | ||
1020 | int ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *); | ||
1008 | #else | 1021 | #else |
1009 | static inline void ide_hwif_setup_dma(ide_hwif_t *hwif, | 1022 | static inline int ide_hwif_setup_dma(ide_hwif_t *hwif, |
1010 | const struct ide_port_info *d) { } | 1023 | const struct ide_port_info *d) |
1024 | { | ||
1025 | return -EINVAL; | ||
1026 | } | ||
1011 | #endif | 1027 | #endif |
1012 | 1028 | ||
1013 | extern void default_hwif_iops(ide_hwif_t *); | 1029 | extern void default_hwif_iops(ide_hwif_t *); |
@@ -1027,8 +1043,8 @@ enum { | |||
1027 | IDE_HFLAG_SINGLE = (1 << 1), | 1043 | IDE_HFLAG_SINGLE = (1 << 1), |
1028 | /* don't use legacy PIO blacklist */ | 1044 | /* don't use legacy PIO blacklist */ |
1029 | IDE_HFLAG_PIO_NO_BLACKLIST = (1 << 2), | 1045 | IDE_HFLAG_PIO_NO_BLACKLIST = (1 << 2), |
1030 | /* don't use conservative PIO "downgrade" */ | 1046 | /* set for the second port of QD65xx */ |
1031 | IDE_HFLAG_PIO_NO_DOWNGRADE = (1 << 3), | 1047 | IDE_HFLAG_QD_2ND_PORT = (1 << 3), |
1032 | /* use PIO8/9 for prefetch off/on */ | 1048 | /* use PIO8/9 for prefetch off/on */ |
1033 | IDE_HFLAG_ABUSE_PREFETCH = (1 << 4), | 1049 | IDE_HFLAG_ABUSE_PREFETCH = (1 << 4), |
1034 | /* use PIO6/7 for fast-devsel off/on */ | 1050 | /* use PIO6/7 for fast-devsel off/on */ |
@@ -1050,14 +1066,12 @@ enum { | |||
1050 | IDE_HFLAG_VDMA = (1 << 11), | 1066 | IDE_HFLAG_VDMA = (1 << 11), |
1051 | /* ATAPI DMA is unsupported */ | 1067 | /* ATAPI DMA is unsupported */ |
1052 | IDE_HFLAG_NO_ATAPI_DMA = (1 << 12), | 1068 | IDE_HFLAG_NO_ATAPI_DMA = (1 << 12), |
1053 | /* set if host is a "bootable" controller */ | 1069 | /* set if host is a "non-bootable" controller */ |
1054 | IDE_HFLAG_BOOTABLE = (1 << 13), | 1070 | IDE_HFLAG_NON_BOOTABLE = (1 << 13), |
1055 | /* host doesn't support DMA */ | 1071 | /* host doesn't support DMA */ |
1056 | IDE_HFLAG_NO_DMA = (1 << 14), | 1072 | IDE_HFLAG_NO_DMA = (1 << 14), |
1057 | /* check if host is PCI IDE device before allowing DMA */ | 1073 | /* check if host is PCI IDE device before allowing DMA */ |
1058 | IDE_HFLAG_NO_AUTODMA = (1 << 15), | 1074 | IDE_HFLAG_NO_AUTODMA = (1 << 15), |
1059 | /* don't autotune PIO */ | ||
1060 | IDE_HFLAG_NO_AUTOTUNE = (1 << 16), | ||
1061 | /* host is CS5510/CS5520 */ | 1075 | /* host is CS5510/CS5520 */ |
1062 | IDE_HFLAG_CS5520 = IDE_HFLAG_VDMA, | 1076 | IDE_HFLAG_CS5520 = IDE_HFLAG_VDMA, |
1063 | /* no LBA48 */ | 1077 | /* no LBA48 */ |
@@ -1079,8 +1093,8 @@ enum { | |||
1079 | /* unmask IRQs */ | 1093 | /* unmask IRQs */ |
1080 | IDE_HFLAG_UNMASK_IRQS = (1 << 25), | 1094 | IDE_HFLAG_UNMASK_IRQS = (1 << 25), |
1081 | IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26), | 1095 | IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26), |
1082 | /* host is CY82C693 */ | 1096 | /* serialize ports if DMA is possible (for sl82c105) */ |
1083 | IDE_HFLAG_CY82C693 = (1 << 27), | 1097 | IDE_HFLAG_SERIALIZE_DMA = (1 << 27), |
1084 | /* force host out of "simplex" mode */ | 1098 | /* force host out of "simplex" mode */ |
1085 | IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28), | 1099 | IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28), |
1086 | /* DSC overlap is unsupported */ | 1100 | /* DSC overlap is unsupported */ |
@@ -1092,9 +1106,9 @@ enum { | |||
1092 | }; | 1106 | }; |
1093 | 1107 | ||
1094 | #ifdef CONFIG_BLK_DEV_OFFBOARD | 1108 | #ifdef CONFIG_BLK_DEV_OFFBOARD |
1095 | # define IDE_HFLAG_OFF_BOARD IDE_HFLAG_BOOTABLE | ||
1096 | #else | ||
1097 | # define IDE_HFLAG_OFF_BOARD 0 | 1109 | # define IDE_HFLAG_OFF_BOARD 0 |
1110 | #else | ||
1111 | # define IDE_HFLAG_OFF_BOARD IDE_HFLAG_NON_BOOTABLE | ||
1098 | #endif | 1112 | #endif |
1099 | 1113 | ||
1100 | struct ide_port_info { | 1114 | struct ide_port_info { |
@@ -1102,10 +1116,14 @@ struct ide_port_info { | |||
1102 | unsigned int (*init_chipset)(struct pci_dev *, const char *); | 1116 | unsigned int (*init_chipset)(struct pci_dev *, const char *); |
1103 | void (*init_iops)(ide_hwif_t *); | 1117 | void (*init_iops)(ide_hwif_t *); |
1104 | void (*init_hwif)(ide_hwif_t *); | 1118 | void (*init_hwif)(ide_hwif_t *); |
1105 | void (*init_dma)(ide_hwif_t *, unsigned long); | 1119 | int (*init_dma)(ide_hwif_t *, |
1120 | const struct ide_port_info *); | ||
1121 | |||
1122 | const struct ide_port_ops *port_ops; | ||
1123 | const struct ide_dma_ops *dma_ops; | ||
1124 | |||
1106 | ide_pci_enablebit_t enablebits[2]; | 1125 | ide_pci_enablebit_t enablebits[2]; |
1107 | hwif_chipset_t chipset; | 1126 | hwif_chipset_t chipset; |
1108 | u8 extra; | ||
1109 | u32 host_flags; | 1127 | u32 host_flags; |
1110 | u8 pio_mask; | 1128 | u8 pio_mask; |
1111 | u8 swdma_mask; | 1129 | u8 swdma_mask; |
@@ -1152,13 +1170,16 @@ void ide_destroy_dmatable(ide_drive_t *); | |||
1152 | 1170 | ||
1153 | #ifdef CONFIG_BLK_DEV_IDEDMA_SFF | 1171 | #ifdef CONFIG_BLK_DEV_IDEDMA_SFF |
1154 | extern int ide_build_dmatable(ide_drive_t *, struct request *); | 1172 | extern int ide_build_dmatable(ide_drive_t *, struct request *); |
1155 | extern int ide_release_dma(ide_hwif_t *); | 1173 | int ide_allocate_dma_engine(ide_hwif_t *); |
1156 | extern void ide_setup_dma(ide_hwif_t *, unsigned long); | 1174 | void ide_release_dma_engine(ide_hwif_t *); |
1175 | void ide_setup_dma(ide_hwif_t *, unsigned long); | ||
1157 | 1176 | ||
1158 | void ide_dma_host_set(ide_drive_t *, int); | 1177 | void ide_dma_host_set(ide_drive_t *, int); |
1159 | extern int ide_dma_setup(ide_drive_t *); | 1178 | extern int ide_dma_setup(ide_drive_t *); |
1179 | void ide_dma_exec_cmd(ide_drive_t *, u8); | ||
1160 | extern void ide_dma_start(ide_drive_t *); | 1180 | extern void ide_dma_start(ide_drive_t *); |
1161 | extern int __ide_dma_end(ide_drive_t *); | 1181 | extern int __ide_dma_end(ide_drive_t *); |
1182 | int ide_dma_test_irq(ide_drive_t *); | ||
1162 | extern void ide_dma_lost_irq(ide_drive_t *); | 1183 | extern void ide_dma_lost_irq(ide_drive_t *); |
1163 | extern void ide_dma_timeout(ide_drive_t *); | 1184 | extern void ide_dma_timeout(ide_drive_t *); |
1164 | #endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ | 1185 | #endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ |
@@ -1176,7 +1197,7 @@ static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } | |||
1176 | #endif /* CONFIG_BLK_DEV_IDEDMA */ | 1197 | #endif /* CONFIG_BLK_DEV_IDEDMA */ |
1177 | 1198 | ||
1178 | #ifndef CONFIG_BLK_DEV_IDEDMA_SFF | 1199 | #ifndef CONFIG_BLK_DEV_IDEDMA_SFF |
1179 | static inline void ide_release_dma(ide_hwif_t *drive) {;} | 1200 | static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; } |
1180 | #endif | 1201 | #endif |
1181 | 1202 | ||
1182 | #ifdef CONFIG_BLK_DEV_IDEACPI | 1203 | #ifdef CONFIG_BLK_DEV_IDEACPI |
@@ -1196,17 +1217,18 @@ static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} | |||
1196 | #endif | 1217 | #endif |
1197 | 1218 | ||
1198 | void ide_remove_port_from_hwgroup(ide_hwif_t *); | 1219 | void ide_remove_port_from_hwgroup(ide_hwif_t *); |
1199 | extern int ide_hwif_request_regions(ide_hwif_t *hwif); | 1220 | void ide_unregister(ide_hwif_t *); |
1200 | extern void ide_hwif_release_regions(ide_hwif_t* hwif); | ||
1201 | void ide_unregister(unsigned int); | ||
1202 | 1221 | ||
1203 | void ide_register_region(struct gendisk *); | 1222 | void ide_register_region(struct gendisk *); |
1204 | void ide_unregister_region(struct gendisk *); | 1223 | void ide_unregister_region(struct gendisk *); |
1205 | 1224 | ||
1206 | void ide_undecoded_slave(ide_drive_t *); | 1225 | void ide_undecoded_slave(ide_drive_t *); |
1207 | 1226 | ||
1227 | void ide_port_apply_params(ide_hwif_t *); | ||
1228 | |||
1208 | int ide_device_add_all(u8 *idx, const struct ide_port_info *); | 1229 | int ide_device_add_all(u8 *idx, const struct ide_port_info *); |
1209 | int ide_device_add(u8 idx[4], const struct ide_port_info *); | 1230 | int ide_device_add(u8 idx[4], const struct ide_port_info *); |
1231 | int ide_legacy_device_add(const struct ide_port_info *, unsigned long); | ||
1210 | void ide_port_unregister_devices(ide_hwif_t *); | 1232 | void ide_port_unregister_devices(ide_hwif_t *); |
1211 | void ide_port_scan(ide_hwif_t *); | 1233 | void ide_port_scan(ide_hwif_t *); |
1212 | 1234 | ||
@@ -1315,29 +1337,28 @@ static inline void ide_set_irq(ide_drive_t *drive, int on) | |||
1315 | { | 1337 | { |
1316 | ide_hwif_t *hwif = drive->hwif; | 1338 | ide_hwif_t *hwif = drive->hwif; |
1317 | 1339 | ||
1318 | hwif->OUTB(drive->ctl | (on ? 0 : 2), | 1340 | hwif->OUTB(drive->ctl | (on ? 0 : 2), hwif->io_ports.ctl_addr); |
1319 | hwif->io_ports[IDE_CONTROL_OFFSET]); | ||
1320 | } | 1341 | } |
1321 | 1342 | ||
1322 | static inline u8 ide_read_status(ide_drive_t *drive) | 1343 | static inline u8 ide_read_status(ide_drive_t *drive) |
1323 | { | 1344 | { |
1324 | ide_hwif_t *hwif = drive->hwif; | 1345 | ide_hwif_t *hwif = drive->hwif; |
1325 | 1346 | ||
1326 | return hwif->INB(hwif->io_ports[IDE_STATUS_OFFSET]); | 1347 | return hwif->INB(hwif->io_ports.status_addr); |
1327 | } | 1348 | } |
1328 | 1349 | ||
1329 | static inline u8 ide_read_altstatus(ide_drive_t *drive) | 1350 | static inline u8 ide_read_altstatus(ide_drive_t *drive) |
1330 | { | 1351 | { |
1331 | ide_hwif_t *hwif = drive->hwif; | 1352 | ide_hwif_t *hwif = drive->hwif; |
1332 | 1353 | ||
1333 | return hwif->INB(hwif->io_ports[IDE_CONTROL_OFFSET]); | 1354 | return hwif->INB(hwif->io_ports.ctl_addr); |
1334 | } | 1355 | } |
1335 | 1356 | ||
1336 | static inline u8 ide_read_error(ide_drive_t *drive) | 1357 | static inline u8 ide_read_error(ide_drive_t *drive) |
1337 | { | 1358 | { |
1338 | ide_hwif_t *hwif = drive->hwif; | 1359 | ide_hwif_t *hwif = drive->hwif; |
1339 | 1360 | ||
1340 | return hwif->INB(hwif->io_ports[IDE_ERROR_OFFSET]); | 1361 | return hwif->INB(hwif->io_ports.error_addr); |
1341 | } | 1362 | } |
1342 | 1363 | ||
1343 | /* | 1364 | /* |
@@ -1350,7 +1371,7 @@ static inline void ide_atapi_discard_data(ide_drive_t *drive, unsigned bcount) | |||
1350 | 1371 | ||
1351 | /* FIXME: use ->atapi_input_bytes */ | 1372 | /* FIXME: use ->atapi_input_bytes */ |
1352 | while (bcount--) | 1373 | while (bcount--) |
1353 | (void)hwif->INB(hwif->io_ports[IDE_DATA_OFFSET]); | 1374 | (void)hwif->INB(hwif->io_ports.data_addr); |
1354 | } | 1375 | } |
1355 | 1376 | ||
1356 | static inline void ide_atapi_write_zeros(ide_drive_t *drive, unsigned bcount) | 1377 | static inline void ide_atapi_write_zeros(ide_drive_t *drive, unsigned bcount) |
@@ -1359,7 +1380,7 @@ static inline void ide_atapi_write_zeros(ide_drive_t *drive, unsigned bcount) | |||
1359 | 1380 | ||
1360 | /* FIXME: use ->atapi_output_bytes */ | 1381 | /* FIXME: use ->atapi_output_bytes */ |
1361 | while (bcount--) | 1382 | while (bcount--) |
1362 | hwif->OUTB(0, hwif->io_ports[IDE_DATA_OFFSET]); | 1383 | hwif->OUTB(0, hwif->io_ports.data_addr); |
1363 | } | 1384 | } |
1364 | 1385 | ||
1365 | #endif /* _IDE_H */ | 1386 | #endif /* _IDE_H */ |
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index c1ec04fd000d..a281afeddfbb 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
@@ -8,11 +8,18 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <asm/types.h> | 10 | #include <asm/types.h> |
11 | #include <linux/compiler.h> | ||
11 | #include <linux/ioctl.h> | 12 | #include <linux/ioctl.h> |
12 | #include <asm/kvm.h> | 13 | #include <asm/kvm.h> |
13 | 14 | ||
14 | #define KVM_API_VERSION 12 | 15 | #define KVM_API_VERSION 12 |
15 | 16 | ||
17 | /* for KVM_TRACE_ENABLE */ | ||
18 | struct kvm_user_trace_setup { | ||
19 | __u32 buf_size; /* sub_buffer size of each per-cpu */ | ||
20 | __u32 buf_nr; /* the number of sub_buffers of each per-cpu */ | ||
21 | }; | ||
22 | |||
16 | /* for KVM_CREATE_MEMORY_REGION */ | 23 | /* for KVM_CREATE_MEMORY_REGION */ |
17 | struct kvm_memory_region { | 24 | struct kvm_memory_region { |
18 | __u32 slot; | 25 | __u32 slot; |
@@ -73,6 +80,9 @@ struct kvm_irqchip { | |||
73 | #define KVM_EXIT_INTR 10 | 80 | #define KVM_EXIT_INTR 10 |
74 | #define KVM_EXIT_SET_TPR 11 | 81 | #define KVM_EXIT_SET_TPR 11 |
75 | #define KVM_EXIT_TPR_ACCESS 12 | 82 | #define KVM_EXIT_TPR_ACCESS 12 |
83 | #define KVM_EXIT_S390_SIEIC 13 | ||
84 | #define KVM_EXIT_S390_RESET 14 | ||
85 | #define KVM_EXIT_DCR 15 | ||
76 | 86 | ||
77 | /* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ | 87 | /* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ |
78 | struct kvm_run { | 88 | struct kvm_run { |
@@ -137,6 +147,27 @@ struct kvm_run { | |||
137 | __u32 is_write; | 147 | __u32 is_write; |
138 | __u32 pad; | 148 | __u32 pad; |
139 | } tpr_access; | 149 | } tpr_access; |
150 | /* KVM_EXIT_S390_SIEIC */ | ||
151 | struct { | ||
152 | __u8 icptcode; | ||
153 | __u64 mask; /* psw upper half */ | ||
154 | __u64 addr; /* psw lower half */ | ||
155 | __u16 ipa; | ||
156 | __u32 ipb; | ||
157 | } s390_sieic; | ||
158 | /* KVM_EXIT_S390_RESET */ | ||
159 | #define KVM_S390_RESET_POR 1 | ||
160 | #define KVM_S390_RESET_CLEAR 2 | ||
161 | #define KVM_S390_RESET_SUBSYSTEM 4 | ||
162 | #define KVM_S390_RESET_CPU_INIT 8 | ||
163 | #define KVM_S390_RESET_IPL 16 | ||
164 | __u64 s390_reset_flags; | ||
165 | /* KVM_EXIT_DCR */ | ||
166 | struct { | ||
167 | __u32 dcrn; | ||
168 | __u32 data; | ||
169 | __u8 is_write; | ||
170 | } dcr; | ||
140 | /* Fix the size of the union. */ | 171 | /* Fix the size of the union. */ |
141 | char padding[256]; | 172 | char padding[256]; |
142 | }; | 173 | }; |
@@ -204,6 +235,74 @@ struct kvm_vapic_addr { | |||
204 | __u64 vapic_addr; | 235 | __u64 vapic_addr; |
205 | }; | 236 | }; |
206 | 237 | ||
238 | /* for KVM_SET_MPSTATE */ | ||
239 | |||
240 | #define KVM_MP_STATE_RUNNABLE 0 | ||
241 | #define KVM_MP_STATE_UNINITIALIZED 1 | ||
242 | #define KVM_MP_STATE_INIT_RECEIVED 2 | ||
243 | #define KVM_MP_STATE_HALTED 3 | ||
244 | #define KVM_MP_STATE_SIPI_RECEIVED 4 | ||
245 | |||
246 | struct kvm_mp_state { | ||
247 | __u32 mp_state; | ||
248 | }; | ||
249 | |||
250 | struct kvm_s390_psw { | ||
251 | __u64 mask; | ||
252 | __u64 addr; | ||
253 | }; | ||
254 | |||
255 | /* valid values for type in kvm_s390_interrupt */ | ||
256 | #define KVM_S390_SIGP_STOP 0xfffe0000u | ||
257 | #define KVM_S390_PROGRAM_INT 0xfffe0001u | ||
258 | #define KVM_S390_SIGP_SET_PREFIX 0xfffe0002u | ||
259 | #define KVM_S390_RESTART 0xfffe0003u | ||
260 | #define KVM_S390_INT_VIRTIO 0xffff2603u | ||
261 | #define KVM_S390_INT_SERVICE 0xffff2401u | ||
262 | #define KVM_S390_INT_EMERGENCY 0xffff1201u | ||
263 | |||
264 | struct kvm_s390_interrupt { | ||
265 | __u32 type; | ||
266 | __u32 parm; | ||
267 | __u64 parm64; | ||
268 | }; | ||
269 | |||
270 | #define KVM_TRC_SHIFT 16 | ||
271 | /* | ||
272 | * kvm trace categories | ||
273 | */ | ||
274 | #define KVM_TRC_ENTRYEXIT (1 << KVM_TRC_SHIFT) | ||
275 | #define KVM_TRC_HANDLER (1 << (KVM_TRC_SHIFT + 1)) /* only 12 bits */ | ||
276 | |||
277 | /* | ||
278 | * kvm trace action | ||
279 | */ | ||
280 | #define KVM_TRC_VMENTRY (KVM_TRC_ENTRYEXIT + 0x01) | ||
281 | #define KVM_TRC_VMEXIT (KVM_TRC_ENTRYEXIT + 0x02) | ||
282 | #define KVM_TRC_PAGE_FAULT (KVM_TRC_HANDLER + 0x01) | ||
283 | |||
284 | #define KVM_TRC_HEAD_SIZE 12 | ||
285 | #define KVM_TRC_CYCLE_SIZE 8 | ||
286 | #define KVM_TRC_EXTRA_MAX 7 | ||
287 | |||
288 | /* This structure represents a single trace buffer record. */ | ||
289 | struct kvm_trace_rec { | ||
290 | __u32 event:28; | ||
291 | __u32 extra_u32:3; | ||
292 | __u32 cycle_in:1; | ||
293 | __u32 pid; | ||
294 | __u32 vcpu_id; | ||
295 | union { | ||
296 | struct { | ||
297 | __u32 cycle_lo, cycle_hi; | ||
298 | __u32 extra_u32[KVM_TRC_EXTRA_MAX]; | ||
299 | } cycle; | ||
300 | struct { | ||
301 | __u32 extra_u32[KVM_TRC_EXTRA_MAX]; | ||
302 | } nocycle; | ||
303 | } u; | ||
304 | }; | ||
305 | |||
207 | #define KVMIO 0xAE | 306 | #define KVMIO 0xAE |
208 | 307 | ||
209 | /* | 308 | /* |
@@ -212,6 +311,8 @@ struct kvm_vapic_addr { | |||
212 | #define KVM_GET_API_VERSION _IO(KVMIO, 0x00) | 311 | #define KVM_GET_API_VERSION _IO(KVMIO, 0x00) |
213 | #define KVM_CREATE_VM _IO(KVMIO, 0x01) /* returns a VM fd */ | 312 | #define KVM_CREATE_VM _IO(KVMIO, 0x01) /* returns a VM fd */ |
214 | #define KVM_GET_MSR_INDEX_LIST _IOWR(KVMIO, 0x02, struct kvm_msr_list) | 313 | #define KVM_GET_MSR_INDEX_LIST _IOWR(KVMIO, 0x02, struct kvm_msr_list) |
314 | |||
315 | #define KVM_S390_ENABLE_SIE _IO(KVMIO, 0x06) | ||
215 | /* | 316 | /* |
216 | * Check if a kvm extension is available. Argument is extension number, | 317 | * Check if a kvm extension is available. Argument is extension number, |
217 | * return is 1 (yes) or 0 (no, sorry). | 318 | * return is 1 (yes) or 0 (no, sorry). |
@@ -222,7 +323,12 @@ struct kvm_vapic_addr { | |||
222 | */ | 323 | */ |
223 | #define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04) /* in bytes */ | 324 | #define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04) /* in bytes */ |
224 | #define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2) | 325 | #define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2) |
225 | 326 | /* | |
327 | * ioctls for kvm trace | ||
328 | */ | ||
329 | #define KVM_TRACE_ENABLE _IOW(KVMIO, 0x06, struct kvm_user_trace_setup) | ||
330 | #define KVM_TRACE_PAUSE _IO(KVMIO, 0x07) | ||
331 | #define KVM_TRACE_DISABLE _IO(KVMIO, 0x08) | ||
226 | /* | 332 | /* |
227 | * Extension capability list. | 333 | * Extension capability list. |
228 | */ | 334 | */ |
@@ -233,6 +339,13 @@ struct kvm_vapic_addr { | |||
233 | #define KVM_CAP_SET_TSS_ADDR 4 | 339 | #define KVM_CAP_SET_TSS_ADDR 4 |
234 | #define KVM_CAP_VAPIC 6 | 340 | #define KVM_CAP_VAPIC 6 |
235 | #define KVM_CAP_EXT_CPUID 7 | 341 | #define KVM_CAP_EXT_CPUID 7 |
342 | #define KVM_CAP_CLOCKSOURCE 8 | ||
343 | #define KVM_CAP_NR_VCPUS 9 /* returns max vcpus per vm */ | ||
344 | #define KVM_CAP_NR_MEMSLOTS 10 /* returns max memory slots per vm */ | ||
345 | #define KVM_CAP_PIT 11 | ||
346 | #define KVM_CAP_NOP_IO_DELAY 12 | ||
347 | #define KVM_CAP_PV_MMU 13 | ||
348 | #define KVM_CAP_MP_STATE 14 | ||
236 | 349 | ||
237 | /* | 350 | /* |
238 | * ioctls for VM fds | 351 | * ioctls for VM fds |
@@ -255,6 +368,9 @@ struct kvm_vapic_addr { | |||
255 | #define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level) | 368 | #define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level) |
256 | #define KVM_GET_IRQCHIP _IOWR(KVMIO, 0x62, struct kvm_irqchip) | 369 | #define KVM_GET_IRQCHIP _IOWR(KVMIO, 0x62, struct kvm_irqchip) |
257 | #define KVM_SET_IRQCHIP _IOR(KVMIO, 0x63, struct kvm_irqchip) | 370 | #define KVM_SET_IRQCHIP _IOR(KVMIO, 0x63, struct kvm_irqchip) |
371 | #define KVM_CREATE_PIT _IO(KVMIO, 0x64) | ||
372 | #define KVM_GET_PIT _IOWR(KVMIO, 0x65, struct kvm_pit_state) | ||
373 | #define KVM_SET_PIT _IOR(KVMIO, 0x66, struct kvm_pit_state) | ||
258 | 374 | ||
259 | /* | 375 | /* |
260 | * ioctls for vcpu fds | 376 | * ioctls for vcpu fds |
@@ -281,5 +397,17 @@ struct kvm_vapic_addr { | |||
281 | #define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct kvm_tpr_access_ctl) | 397 | #define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct kvm_tpr_access_ctl) |
282 | /* Available with KVM_CAP_VAPIC */ | 398 | /* Available with KVM_CAP_VAPIC */ |
283 | #define KVM_SET_VAPIC_ADDR _IOW(KVMIO, 0x93, struct kvm_vapic_addr) | 399 | #define KVM_SET_VAPIC_ADDR _IOW(KVMIO, 0x93, struct kvm_vapic_addr) |
400 | /* valid for virtual machine (for floating interrupt)_and_ vcpu */ | ||
401 | #define KVM_S390_INTERRUPT _IOW(KVMIO, 0x94, struct kvm_s390_interrupt) | ||
402 | /* store status for s390 */ | ||
403 | #define KVM_S390_STORE_STATUS_NOADDR (-1ul) | ||
404 | #define KVM_S390_STORE_STATUS_PREFIXED (-2ul) | ||
405 | #define KVM_S390_STORE_STATUS _IOW(KVMIO, 0x95, unsigned long) | ||
406 | /* initial ipl psw for s390 */ | ||
407 | #define KVM_S390_SET_INITIAL_PSW _IOW(KVMIO, 0x96, struct kvm_s390_psw) | ||
408 | /* initial reset for s390 */ | ||
409 | #define KVM_S390_INITIAL_RESET _IO(KVMIO, 0x97) | ||
410 | #define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state) | ||
411 | #define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state) | ||
284 | 412 | ||
285 | #endif | 413 | #endif |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 928b0d59e9ba..398978972b7a 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
16 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
17 | #include <linux/preempt.h> | 17 | #include <linux/preempt.h> |
18 | #include <linux/marker.h> | ||
18 | #include <asm/signal.h> | 19 | #include <asm/signal.h> |
19 | 20 | ||
20 | #include <linux/kvm.h> | 21 | #include <linux/kvm.h> |
@@ -24,29 +25,18 @@ | |||
24 | 25 | ||
25 | #include <asm/kvm_host.h> | 26 | #include <asm/kvm_host.h> |
26 | 27 | ||
27 | #define KVM_MAX_VCPUS 4 | ||
28 | #define KVM_MEMORY_SLOTS 8 | ||
29 | /* memory slots that does not exposed to userspace */ | ||
30 | #define KVM_PRIVATE_MEM_SLOTS 4 | ||
31 | |||
32 | #define KVM_PIO_PAGE_OFFSET 1 | ||
33 | |||
34 | /* | 28 | /* |
35 | * vcpu->requests bit members | 29 | * vcpu->requests bit members |
36 | */ | 30 | */ |
37 | #define KVM_REQ_TLB_FLUSH 0 | 31 | #define KVM_REQ_TLB_FLUSH 0 |
38 | #define KVM_REQ_MIGRATE_TIMER 1 | 32 | #define KVM_REQ_MIGRATE_TIMER 1 |
39 | #define KVM_REQ_REPORT_TPR_ACCESS 2 | 33 | #define KVM_REQ_REPORT_TPR_ACCESS 2 |
34 | #define KVM_REQ_MMU_RELOAD 3 | ||
35 | #define KVM_REQ_TRIPLE_FAULT 4 | ||
40 | 36 | ||
41 | struct kvm_vcpu; | 37 | struct kvm_vcpu; |
42 | extern struct kmem_cache *kvm_vcpu_cache; | 38 | extern struct kmem_cache *kvm_vcpu_cache; |
43 | 39 | ||
44 | struct kvm_guest_debug { | ||
45 | int enabled; | ||
46 | unsigned long bp[4]; | ||
47 | int singlestep; | ||
48 | }; | ||
49 | |||
50 | /* | 40 | /* |
51 | * It would be nice to use something smarter than a linear search, TBD... | 41 | * It would be nice to use something smarter than a linear search, TBD... |
52 | * Thankfully we dont expect many devices to register (famous last words :), | 42 | * Thankfully we dont expect many devices to register (famous last words :), |
@@ -67,7 +57,9 @@ void kvm_io_bus_register_dev(struct kvm_io_bus *bus, | |||
67 | 57 | ||
68 | struct kvm_vcpu { | 58 | struct kvm_vcpu { |
69 | struct kvm *kvm; | 59 | struct kvm *kvm; |
60 | #ifdef CONFIG_PREEMPT_NOTIFIERS | ||
70 | struct preempt_notifier preempt_notifier; | 61 | struct preempt_notifier preempt_notifier; |
62 | #endif | ||
71 | int vcpu_id; | 63 | int vcpu_id; |
72 | struct mutex mutex; | 64 | struct mutex mutex; |
73 | int cpu; | 65 | int cpu; |
@@ -100,6 +92,10 @@ struct kvm_memory_slot { | |||
100 | unsigned long flags; | 92 | unsigned long flags; |
101 | unsigned long *rmap; | 93 | unsigned long *rmap; |
102 | unsigned long *dirty_bitmap; | 94 | unsigned long *dirty_bitmap; |
95 | struct { | ||
96 | unsigned long rmap_pde; | ||
97 | int write_count; | ||
98 | } *lpage_info; | ||
103 | unsigned long userspace_addr; | 99 | unsigned long userspace_addr; |
104 | int user_alloc; | 100 | int user_alloc; |
105 | }; | 101 | }; |
@@ -114,11 +110,11 @@ struct kvm { | |||
114 | KVM_PRIVATE_MEM_SLOTS]; | 110 | KVM_PRIVATE_MEM_SLOTS]; |
115 | struct kvm_vcpu *vcpus[KVM_MAX_VCPUS]; | 111 | struct kvm_vcpu *vcpus[KVM_MAX_VCPUS]; |
116 | struct list_head vm_list; | 112 | struct list_head vm_list; |
117 | struct file *filp; | ||
118 | struct kvm_io_bus mmio_bus; | 113 | struct kvm_io_bus mmio_bus; |
119 | struct kvm_io_bus pio_bus; | 114 | struct kvm_io_bus pio_bus; |
120 | struct kvm_vm_stat stat; | 115 | struct kvm_vm_stat stat; |
121 | struct kvm_arch arch; | 116 | struct kvm_arch arch; |
117 | atomic_t users_count; | ||
122 | }; | 118 | }; |
123 | 119 | ||
124 | /* The guest did something we don't support. */ | 120 | /* The guest did something we don't support. */ |
@@ -145,14 +141,19 @@ int kvm_init(void *opaque, unsigned int vcpu_size, | |||
145 | struct module *module); | 141 | struct module *module); |
146 | void kvm_exit(void); | 142 | void kvm_exit(void); |
147 | 143 | ||
144 | void kvm_get_kvm(struct kvm *kvm); | ||
145 | void kvm_put_kvm(struct kvm *kvm); | ||
146 | |||
148 | #define HPA_MSB ((sizeof(hpa_t) * 8) - 1) | 147 | #define HPA_MSB ((sizeof(hpa_t) * 8) - 1) |
149 | #define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB) | 148 | #define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB) |
150 | static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; } | 149 | static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; } |
151 | struct page *gva_to_page(struct kvm_vcpu *vcpu, gva_t gva); | 150 | struct page *gva_to_page(struct kvm_vcpu *vcpu, gva_t gva); |
152 | 151 | ||
153 | extern struct page *bad_page; | 152 | extern struct page *bad_page; |
153 | extern pfn_t bad_pfn; | ||
154 | 154 | ||
155 | int is_error_page(struct page *page); | 155 | int is_error_page(struct page *page); |
156 | int is_error_pfn(pfn_t pfn); | ||
156 | int kvm_is_error_hva(unsigned long addr); | 157 | int kvm_is_error_hva(unsigned long addr); |
157 | int kvm_set_memory_region(struct kvm *kvm, | 158 | int kvm_set_memory_region(struct kvm *kvm, |
158 | struct kvm_userspace_memory_region *mem, | 159 | struct kvm_userspace_memory_region *mem, |
@@ -166,8 +167,19 @@ int kvm_arch_set_memory_region(struct kvm *kvm, | |||
166 | int user_alloc); | 167 | int user_alloc); |
167 | gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn); | 168 | gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn); |
168 | struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); | 169 | struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); |
170 | unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn); | ||
169 | void kvm_release_page_clean(struct page *page); | 171 | void kvm_release_page_clean(struct page *page); |
170 | void kvm_release_page_dirty(struct page *page); | 172 | void kvm_release_page_dirty(struct page *page); |
173 | void kvm_set_page_dirty(struct page *page); | ||
174 | void kvm_set_page_accessed(struct page *page); | ||
175 | |||
176 | pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn); | ||
177 | void kvm_release_pfn_dirty(pfn_t); | ||
178 | void kvm_release_pfn_clean(pfn_t pfn); | ||
179 | void kvm_set_pfn_dirty(pfn_t pfn); | ||
180 | void kvm_set_pfn_accessed(pfn_t pfn); | ||
181 | void kvm_get_pfn(pfn_t pfn); | ||
182 | |||
171 | int kvm_read_guest_page(struct kvm *kvm, gfn_t gfn, void *data, int offset, | 183 | int kvm_read_guest_page(struct kvm *kvm, gfn_t gfn, void *data, int offset, |
172 | int len); | 184 | int len); |
173 | int kvm_read_guest_atomic(struct kvm *kvm, gpa_t gpa, void *data, | 185 | int kvm_read_guest_atomic(struct kvm *kvm, gpa_t gpa, void *data, |
@@ -188,6 +200,7 @@ void kvm_resched(struct kvm_vcpu *vcpu); | |||
188 | void kvm_load_guest_fpu(struct kvm_vcpu *vcpu); | 200 | void kvm_load_guest_fpu(struct kvm_vcpu *vcpu); |
189 | void kvm_put_guest_fpu(struct kvm_vcpu *vcpu); | 201 | void kvm_put_guest_fpu(struct kvm_vcpu *vcpu); |
190 | void kvm_flush_remote_tlbs(struct kvm *kvm); | 202 | void kvm_flush_remote_tlbs(struct kvm *kvm); |
203 | void kvm_reload_remote_mmus(struct kvm *kvm); | ||
191 | 204 | ||
192 | long kvm_arch_dev_ioctl(struct file *filp, | 205 | long kvm_arch_dev_ioctl(struct file *filp, |
193 | unsigned int ioctl, unsigned long arg); | 206 | unsigned int ioctl, unsigned long arg); |
@@ -223,6 +236,10 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu, | |||
223 | struct kvm_sregs *sregs); | 236 | struct kvm_sregs *sregs); |
224 | int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, | 237 | int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, |
225 | struct kvm_sregs *sregs); | 238 | struct kvm_sregs *sregs); |
239 | int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu, | ||
240 | struct kvm_mp_state *mp_state); | ||
241 | int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu, | ||
242 | struct kvm_mp_state *mp_state); | ||
226 | int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu, | 243 | int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu, |
227 | struct kvm_debug_guest *dbg); | 244 | struct kvm_debug_guest *dbg); |
228 | int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run); | 245 | int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run); |
@@ -255,6 +272,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm); | |||
255 | 272 | ||
256 | int kvm_cpu_get_interrupt(struct kvm_vcpu *v); | 273 | int kvm_cpu_get_interrupt(struct kvm_vcpu *v); |
257 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v); | 274 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v); |
275 | int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu); | ||
258 | void kvm_vcpu_kick(struct kvm_vcpu *vcpu); | 276 | void kvm_vcpu_kick(struct kvm_vcpu *vcpu); |
259 | 277 | ||
260 | static inline void kvm_guest_enter(void) | 278 | static inline void kvm_guest_enter(void) |
@@ -296,5 +314,18 @@ struct kvm_stats_debugfs_item { | |||
296 | struct dentry *dentry; | 314 | struct dentry *dentry; |
297 | }; | 315 | }; |
298 | extern struct kvm_stats_debugfs_item debugfs_entries[]; | 316 | extern struct kvm_stats_debugfs_item debugfs_entries[]; |
317 | extern struct dentry *kvm_debugfs_dir; | ||
318 | |||
319 | #ifdef CONFIG_KVM_TRACE | ||
320 | int kvm_trace_ioctl(unsigned int ioctl, unsigned long arg); | ||
321 | void kvm_trace_cleanup(void); | ||
322 | #else | ||
323 | static inline | ||
324 | int kvm_trace_ioctl(unsigned int ioctl, unsigned long arg) | ||
325 | { | ||
326 | return -EINVAL; | ||
327 | } | ||
328 | #define kvm_trace_cleanup() ((void)0) | ||
329 | #endif | ||
299 | 330 | ||
300 | #endif | 331 | #endif |
diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h index 5497aac0d2f8..3ddce03766ca 100644 --- a/include/linux/kvm_para.h +++ b/include/linux/kvm_para.h | |||
@@ -11,8 +11,11 @@ | |||
11 | 11 | ||
12 | /* Return values for hypercalls */ | 12 | /* Return values for hypercalls */ |
13 | #define KVM_ENOSYS 1000 | 13 | #define KVM_ENOSYS 1000 |
14 | #define KVM_EFAULT EFAULT | ||
15 | #define KVM_E2BIG E2BIG | ||
14 | 16 | ||
15 | #define KVM_HC_VAPIC_POLL_IRQ 1 | 17 | #define KVM_HC_VAPIC_POLL_IRQ 1 |
18 | #define KVM_HC_MMU_OP 2 | ||
16 | 19 | ||
17 | /* | 20 | /* |
18 | * hypercalls use architecture specific | 21 | * hypercalls use architecture specific |
@@ -20,6 +23,12 @@ | |||
20 | #include <asm/kvm_para.h> | 23 | #include <asm/kvm_para.h> |
21 | 24 | ||
22 | #ifdef __KERNEL__ | 25 | #ifdef __KERNEL__ |
26 | #ifdef CONFIG_KVM_GUEST | ||
27 | void __init kvm_guest_init(void); | ||
28 | #else | ||
29 | #define kvm_guest_init() do { } while (0) | ||
30 | #endif | ||
31 | |||
23 | static inline int kvm_para_has_feature(unsigned int feature) | 32 | static inline int kvm_para_has_feature(unsigned int feature) |
24 | { | 33 | { |
25 | if (kvm_arch_para_features() & (1UL << feature)) | 34 | if (kvm_arch_para_features() & (1UL << feature)) |
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h index 1c4e46decb22..9b6f395c9625 100644 --- a/include/linux/kvm_types.h +++ b/include/linux/kvm_types.h | |||
@@ -38,6 +38,8 @@ typedef unsigned long hva_t; | |||
38 | typedef u64 hpa_t; | 38 | typedef u64 hpa_t; |
39 | typedef unsigned long hfn_t; | 39 | typedef unsigned long hfn_t; |
40 | 40 | ||
41 | typedef hfn_t pfn_t; | ||
42 | |||
41 | struct kvm_pio_request { | 43 | struct kvm_pio_request { |
42 | unsigned long count; | 44 | unsigned long count; |
43 | int cur_count; | 45 | int cur_count; |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index ff7df1a2222f..9fa1a8002ce2 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
@@ -208,6 +208,38 @@ struct mlx4_mtt { | |||
208 | int page_shift; | 208 | int page_shift; |
209 | }; | 209 | }; |
210 | 210 | ||
211 | enum { | ||
212 | MLX4_DB_PER_PAGE = PAGE_SIZE / 4 | ||
213 | }; | ||
214 | |||
215 | struct mlx4_db_pgdir { | ||
216 | struct list_head list; | ||
217 | DECLARE_BITMAP(order0, MLX4_DB_PER_PAGE); | ||
218 | DECLARE_BITMAP(order1, MLX4_DB_PER_PAGE / 2); | ||
219 | unsigned long *bits[2]; | ||
220 | __be32 *db_page; | ||
221 | dma_addr_t db_dma; | ||
222 | }; | ||
223 | |||
224 | struct mlx4_ib_user_db_page; | ||
225 | |||
226 | struct mlx4_db { | ||
227 | __be32 *db; | ||
228 | union { | ||
229 | struct mlx4_db_pgdir *pgdir; | ||
230 | struct mlx4_ib_user_db_page *user_page; | ||
231 | } u; | ||
232 | dma_addr_t dma; | ||
233 | int index; | ||
234 | int order; | ||
235 | }; | ||
236 | |||
237 | struct mlx4_hwq_resources { | ||
238 | struct mlx4_db db; | ||
239 | struct mlx4_mtt mtt; | ||
240 | struct mlx4_buf buf; | ||
241 | }; | ||
242 | |||
211 | struct mlx4_mr { | 243 | struct mlx4_mr { |
212 | struct mlx4_mtt mtt; | 244 | struct mlx4_mtt mtt; |
213 | u64 iova; | 245 | u64 iova; |
@@ -341,6 +373,14 @@ int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, | |||
341 | int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, | 373 | int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, |
342 | struct mlx4_buf *buf); | 374 | struct mlx4_buf *buf); |
343 | 375 | ||
376 | int mlx4_db_alloc(struct mlx4_dev *dev, struct mlx4_db *db, int order); | ||
377 | void mlx4_db_free(struct mlx4_dev *dev, struct mlx4_db *db); | ||
378 | |||
379 | int mlx4_alloc_hwq_res(struct mlx4_dev *dev, struct mlx4_hwq_resources *wqres, | ||
380 | int size, int max_direct); | ||
381 | void mlx4_free_hwq_res(struct mlx4_dev *mdev, struct mlx4_hwq_resources *wqres, | ||
382 | int size); | ||
383 | |||
344 | int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt, | 384 | int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt, |
345 | struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq); | 385 | struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq); |
346 | void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); | 386 | void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); |
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h index a5e43febee4f..7f128b266faa 100644 --- a/include/linux/mlx4/qp.h +++ b/include/linux/mlx4/qp.h | |||
@@ -296,6 +296,10 @@ int mlx4_qp_modify(struct mlx4_dev *dev, struct mlx4_mtt *mtt, | |||
296 | int mlx4_qp_query(struct mlx4_dev *dev, struct mlx4_qp *qp, | 296 | int mlx4_qp_query(struct mlx4_dev *dev, struct mlx4_qp *qp, |
297 | struct mlx4_qp_context *context); | 297 | struct mlx4_qp_context *context); |
298 | 298 | ||
299 | int mlx4_qp_to_ready(struct mlx4_dev *dev, struct mlx4_mtt *mtt, | ||
300 | struct mlx4_qp_context *context, | ||
301 | struct mlx4_qp *qp, enum mlx4_qp_state *qp_state); | ||
302 | |||
299 | static inline struct mlx4_qp *__mlx4_qp_lookup(struct mlx4_dev *dev, u32 qpn) | 303 | static inline struct mlx4_qp *__mlx4_qp_lookup(struct mlx4_dev *dev, u32 qpn) |
300 | { | 304 | { |
301 | return radix_tree_lookup(&dev->qp_table_tree, qpn & (dev->caps.num_qps - 1)); | 305 | return radix_tree_lookup(&dev->qp_table_tree, qpn & (dev->caps.num_qps - 1)); |
diff --git a/include/linux/mm.h b/include/linux/mm.h index b695875d63e3..286d31521605 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -1229,6 +1229,7 @@ void vmemmap_verify(pte_t *, int, unsigned long, unsigned long); | |||
1229 | int vmemmap_populate_basepages(struct page *start_page, | 1229 | int vmemmap_populate_basepages(struct page *start_page, |
1230 | unsigned long pages, int node); | 1230 | unsigned long pages, int node); |
1231 | int vmemmap_populate(struct page *start_page, unsigned long pages, int node); | 1231 | int vmemmap_populate(struct page *start_page, unsigned long pages, int node); |
1232 | void vmemmap_populate_print_last(void); | ||
1232 | 1233 | ||
1233 | #endif /* __KERNEL__ */ | 1234 | #endif /* __KERNEL__ */ |
1234 | #endif /* _LINUX_MM_H */ | 1235 | #endif /* _LINUX_MM_H */ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index d0bd97044abd..9a4f3e63e3bf 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1798,6 +1798,8 @@ extern void mmput(struct mm_struct *); | |||
1798 | extern struct mm_struct *get_task_mm(struct task_struct *task); | 1798 | extern struct mm_struct *get_task_mm(struct task_struct *task); |
1799 | /* Remove the current tasks stale references to the old mm_struct */ | 1799 | /* Remove the current tasks stale references to the old mm_struct */ |
1800 | extern void mm_release(struct task_struct *, struct mm_struct *); | 1800 | extern void mm_release(struct task_struct *, struct mm_struct *); |
1801 | /* Allocate a new mm structure and copy contents from tsk->mm */ | ||
1802 | extern struct mm_struct *dup_mm(struct task_struct *tsk); | ||
1801 | 1803 | ||
1802 | extern int copy_thread(int, unsigned long, unsigned long, unsigned long, struct task_struct *, struct pt_regs *); | 1804 | extern int copy_thread(int, unsigned long, unsigned long, unsigned long, struct task_struct *, struct pt_regs *); |
1803 | extern void flush_thread(void); | 1805 | extern void flush_thread(void); |
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 03378e3515b3..add3c5a40827 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
@@ -32,7 +32,7 @@ struct attribute { | |||
32 | 32 | ||
33 | struct attribute_group { | 33 | struct attribute_group { |
34 | const char *name; | 34 | const char *name; |
35 | int (*is_visible)(struct kobject *, | 35 | mode_t (*is_visible)(struct kobject *, |
36 | struct attribute *, int); | 36 | struct attribute *, int); |
37 | struct attribute **attrs; | 37 | struct attribute **attrs; |
38 | }; | 38 | }; |
@@ -105,6 +105,8 @@ void sysfs_remove_link(struct kobject *kobj, const char *name); | |||
105 | 105 | ||
106 | int __must_check sysfs_create_group(struct kobject *kobj, | 106 | int __must_check sysfs_create_group(struct kobject *kobj, |
107 | const struct attribute_group *grp); | 107 | const struct attribute_group *grp); |
108 | int sysfs_update_group(struct kobject *kobj, | ||
109 | const struct attribute_group *grp); | ||
108 | void sysfs_remove_group(struct kobject *kobj, | 110 | void sysfs_remove_group(struct kobject *kobj, |
109 | const struct attribute_group *grp); | 111 | const struct attribute_group *grp); |
110 | int sysfs_add_file_to_group(struct kobject *kobj, | 112 | int sysfs_add_file_to_group(struct kobject *kobj, |