diff options
Diffstat (limited to 'arch')
38 files changed, 382 insertions, 207 deletions
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c index 32ca1b927307..6e943135f0e0 100644 --- a/arch/alpha/kernel/osf_sys.c +++ b/arch/alpha/kernel/osf_sys.c | |||
@@ -253,15 +253,15 @@ do_osf_statfs(struct dentry * dentry, struct osf_statfs __user *buffer, | |||
253 | } | 253 | } |
254 | 254 | ||
255 | asmlinkage int | 255 | asmlinkage int |
256 | osf_statfs(char __user *path, struct osf_statfs __user *buffer, unsigned long bufsiz) | 256 | osf_statfs(char __user *pathname, struct osf_statfs __user *buffer, unsigned long bufsiz) |
257 | { | 257 | { |
258 | struct nameidata nd; | 258 | struct path path; |
259 | int retval; | 259 | int retval; |
260 | 260 | ||
261 | retval = user_path_walk(path, &nd); | 261 | retval = user_path(pathname, &path); |
262 | if (!retval) { | 262 | if (!retval) { |
263 | retval = do_osf_statfs(nd.path.dentry, buffer, bufsiz); | 263 | retval = do_osf_statfs(path.dentry, buffer, bufsiz); |
264 | path_put(&nd.path); | 264 | path_put(&path); |
265 | } | 265 | } |
266 | return retval; | 266 | return retval; |
267 | } | 267 | } |
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c index 747b9dedab88..dc8b40783d94 100644 --- a/arch/arm/mach-at91/at91cap9_devices.c +++ b/arch/arm/mach-at91/at91cap9_devices.c | |||
@@ -377,7 +377,7 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} | |||
377 | * -------------------------------------------------------------------- */ | 377 | * -------------------------------------------------------------------- */ |
378 | 378 | ||
379 | #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) | 379 | #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) |
380 | static struct at91_nand_data nand_data; | 380 | static struct atmel_nand_data nand_data; |
381 | 381 | ||
382 | #define NAND_BASE AT91_CHIPSELECT_3 | 382 | #define NAND_BASE AT91_CHIPSELECT_3 |
383 | 383 | ||
@@ -395,7 +395,7 @@ static struct resource nand_resources[] = { | |||
395 | }; | 395 | }; |
396 | 396 | ||
397 | static struct platform_device at91cap9_nand_device = { | 397 | static struct platform_device at91cap9_nand_device = { |
398 | .name = "at91_nand", | 398 | .name = "atmel_nand", |
399 | .id = -1, | 399 | .id = -1, |
400 | .dev = { | 400 | .dev = { |
401 | .platform_data = &nand_data, | 401 | .platform_data = &nand_data, |
@@ -404,7 +404,7 @@ static struct platform_device at91cap9_nand_device = { | |||
404 | .num_resources = ARRAY_SIZE(nand_resources), | 404 | .num_resources = ARRAY_SIZE(nand_resources), |
405 | }; | 405 | }; |
406 | 406 | ||
407 | void __init at91_add_device_nand(struct at91_nand_data *data) | 407 | void __init at91_add_device_nand(struct atmel_nand_data *data) |
408 | { | 408 | { |
409 | unsigned long csa, mode; | 409 | unsigned long csa, mode; |
410 | 410 | ||
@@ -445,7 +445,7 @@ void __init at91_add_device_nand(struct at91_nand_data *data) | |||
445 | platform_device_register(&at91cap9_nand_device); | 445 | platform_device_register(&at91cap9_nand_device); |
446 | } | 446 | } |
447 | #else | 447 | #else |
448 | void __init at91_add_device_nand(struct at91_nand_data *data) {} | 448 | void __init at91_add_device_nand(struct atmel_nand_data *data) {} |
449 | #endif | 449 | #endif |
450 | 450 | ||
451 | 451 | ||
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c index de19bee83f75..8ced9bc82099 100644 --- a/arch/arm/mach-at91/at91rm9200_devices.c +++ b/arch/arm/mach-at91/at91rm9200_devices.c | |||
@@ -369,7 +369,7 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} | |||
369 | * -------------------------------------------------------------------- */ | 369 | * -------------------------------------------------------------------- */ |
370 | 370 | ||
371 | #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) | 371 | #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) |
372 | static struct at91_nand_data nand_data; | 372 | static struct atmel_nand_data nand_data; |
373 | 373 | ||
374 | #define NAND_BASE AT91_CHIPSELECT_3 | 374 | #define NAND_BASE AT91_CHIPSELECT_3 |
375 | 375 | ||
@@ -382,7 +382,7 @@ static struct resource nand_resources[] = { | |||
382 | }; | 382 | }; |
383 | 383 | ||
384 | static struct platform_device at91rm9200_nand_device = { | 384 | static struct platform_device at91rm9200_nand_device = { |
385 | .name = "at91_nand", | 385 | .name = "atmel_nand", |
386 | .id = -1, | 386 | .id = -1, |
387 | .dev = { | 387 | .dev = { |
388 | .platform_data = &nand_data, | 388 | .platform_data = &nand_data, |
@@ -391,7 +391,7 @@ static struct platform_device at91rm9200_nand_device = { | |||
391 | .num_resources = ARRAY_SIZE(nand_resources), | 391 | .num_resources = ARRAY_SIZE(nand_resources), |
392 | }; | 392 | }; |
393 | 393 | ||
394 | void __init at91_add_device_nand(struct at91_nand_data *data) | 394 | void __init at91_add_device_nand(struct atmel_nand_data *data) |
395 | { | 395 | { |
396 | unsigned int csa; | 396 | unsigned int csa; |
397 | 397 | ||
@@ -429,7 +429,7 @@ void __init at91_add_device_nand(struct at91_nand_data *data) | |||
429 | platform_device_register(&at91rm9200_nand_device); | 429 | platform_device_register(&at91rm9200_nand_device); |
430 | } | 430 | } |
431 | #else | 431 | #else |
432 | void __init at91_add_device_nand(struct at91_nand_data *data) {} | 432 | void __init at91_add_device_nand(struct atmel_nand_data *data) {} |
433 | #endif | 433 | #endif |
434 | 434 | ||
435 | 435 | ||
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index 86cba4ac29b1..cae5f52f1278 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c | |||
@@ -284,7 +284,7 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} | |||
284 | * -------------------------------------------------------------------- */ | 284 | * -------------------------------------------------------------------- */ |
285 | 285 | ||
286 | #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) | 286 | #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) |
287 | static struct at91_nand_data nand_data; | 287 | static struct atmel_nand_data nand_data; |
288 | 288 | ||
289 | #define NAND_BASE AT91_CHIPSELECT_3 | 289 | #define NAND_BASE AT91_CHIPSELECT_3 |
290 | 290 | ||
@@ -302,7 +302,7 @@ static struct resource nand_resources[] = { | |||
302 | }; | 302 | }; |
303 | 303 | ||
304 | static struct platform_device at91sam9260_nand_device = { | 304 | static struct platform_device at91sam9260_nand_device = { |
305 | .name = "at91_nand", | 305 | .name = "atmel_nand", |
306 | .id = -1, | 306 | .id = -1, |
307 | .dev = { | 307 | .dev = { |
308 | .platform_data = &nand_data, | 308 | .platform_data = &nand_data, |
@@ -311,7 +311,7 @@ static struct platform_device at91sam9260_nand_device = { | |||
311 | .num_resources = ARRAY_SIZE(nand_resources), | 311 | .num_resources = ARRAY_SIZE(nand_resources), |
312 | }; | 312 | }; |
313 | 313 | ||
314 | void __init at91_add_device_nand(struct at91_nand_data *data) | 314 | void __init at91_add_device_nand(struct atmel_nand_data *data) |
315 | { | 315 | { |
316 | unsigned long csa, mode; | 316 | unsigned long csa, mode; |
317 | 317 | ||
@@ -373,7 +373,7 @@ void __init at91_add_device_nand(struct at91_nand_data *data) | |||
373 | platform_device_register(&at91sam9260_nand_device); | 373 | platform_device_register(&at91sam9260_nand_device); |
374 | } | 374 | } |
375 | #else | 375 | #else |
376 | void __init at91_add_device_nand(struct at91_nand_data *data) {} | 376 | void __init at91_add_device_nand(struct atmel_nand_data *data) {} |
377 | #endif | 377 | #endif |
378 | 378 | ||
379 | 379 | ||
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c index ec1891375dfb..483d436af22d 100644 --- a/arch/arm/mach-at91/at91sam9261_devices.c +++ b/arch/arm/mach-at91/at91sam9261_devices.c | |||
@@ -199,7 +199,7 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} | |||
199 | * -------------------------------------------------------------------- */ | 199 | * -------------------------------------------------------------------- */ |
200 | 200 | ||
201 | #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) | 201 | #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) |
202 | static struct at91_nand_data nand_data; | 202 | static struct atmel_nand_data nand_data; |
203 | 203 | ||
204 | #define NAND_BASE AT91_CHIPSELECT_3 | 204 | #define NAND_BASE AT91_CHIPSELECT_3 |
205 | 205 | ||
@@ -211,8 +211,8 @@ static struct resource nand_resources[] = { | |||
211 | } | 211 | } |
212 | }; | 212 | }; |
213 | 213 | ||
214 | static struct platform_device at91_nand_device = { | 214 | static struct platform_device atmel_nand_device = { |
215 | .name = "at91_nand", | 215 | .name = "atmel_nand", |
216 | .id = -1, | 216 | .id = -1, |
217 | .dev = { | 217 | .dev = { |
218 | .platform_data = &nand_data, | 218 | .platform_data = &nand_data, |
@@ -221,7 +221,7 @@ static struct platform_device at91_nand_device = { | |||
221 | .num_resources = ARRAY_SIZE(nand_resources), | 221 | .num_resources = ARRAY_SIZE(nand_resources), |
222 | }; | 222 | }; |
223 | 223 | ||
224 | void __init at91_add_device_nand(struct at91_nand_data *data) | 224 | void __init at91_add_device_nand(struct atmel_nand_data *data) |
225 | { | 225 | { |
226 | unsigned long csa, mode; | 226 | unsigned long csa, mode; |
227 | 227 | ||
@@ -262,11 +262,11 @@ void __init at91_add_device_nand(struct at91_nand_data *data) | |||
262 | at91_set_A_periph(AT91_PIN_PC1, 0); /* NANDWE */ | 262 | at91_set_A_periph(AT91_PIN_PC1, 0); /* NANDWE */ |
263 | 263 | ||
264 | nand_data = *data; | 264 | nand_data = *data; |
265 | platform_device_register(&at91_nand_device); | 265 | platform_device_register(&atmel_nand_device); |
266 | } | 266 | } |
267 | 267 | ||
268 | #else | 268 | #else |
269 | void __init at91_add_device_nand(struct at91_nand_data *data) {} | 269 | void __init at91_add_device_nand(struct atmel_nand_data *data) {} |
270 | #endif | 270 | #endif |
271 | 271 | ||
272 | 272 | ||
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index 8a81f76f0200..9762b15f658a 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
@@ -353,7 +353,7 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} | |||
353 | * -------------------------------------------------------------------- */ | 353 | * -------------------------------------------------------------------- */ |
354 | 354 | ||
355 | #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) | 355 | #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) |
356 | static struct at91_nand_data nand_data; | 356 | static struct atmel_nand_data nand_data; |
357 | 357 | ||
358 | #define NAND_BASE AT91_CHIPSELECT_3 | 358 | #define NAND_BASE AT91_CHIPSELECT_3 |
359 | 359 | ||
@@ -371,7 +371,7 @@ static struct resource nand_resources[] = { | |||
371 | }; | 371 | }; |
372 | 372 | ||
373 | static struct platform_device at91sam9263_nand_device = { | 373 | static struct platform_device at91sam9263_nand_device = { |
374 | .name = "at91_nand", | 374 | .name = "atmel_nand", |
375 | .id = -1, | 375 | .id = -1, |
376 | .dev = { | 376 | .dev = { |
377 | .platform_data = &nand_data, | 377 | .platform_data = &nand_data, |
@@ -380,7 +380,7 @@ static struct platform_device at91sam9263_nand_device = { | |||
380 | .num_resources = ARRAY_SIZE(nand_resources), | 380 | .num_resources = ARRAY_SIZE(nand_resources), |
381 | }; | 381 | }; |
382 | 382 | ||
383 | void __init at91_add_device_nand(struct at91_nand_data *data) | 383 | void __init at91_add_device_nand(struct atmel_nand_data *data) |
384 | { | 384 | { |
385 | unsigned long csa, mode; | 385 | unsigned long csa, mode; |
386 | 386 | ||
@@ -421,7 +421,7 @@ void __init at91_add_device_nand(struct at91_nand_data *data) | |||
421 | platform_device_register(&at91sam9263_nand_device); | 421 | platform_device_register(&at91sam9263_nand_device); |
422 | } | 422 | } |
423 | #else | 423 | #else |
424 | void __init at91_add_device_nand(struct at91_nand_data *data) {} | 424 | void __init at91_add_device_nand(struct atmel_nand_data *data) {} |
425 | #endif | 425 | #endif |
426 | 426 | ||
427 | 427 | ||
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index ae28101e7542..5f3094870cad 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c | |||
@@ -195,7 +195,7 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} | |||
195 | * -------------------------------------------------------------------- */ | 195 | * -------------------------------------------------------------------- */ |
196 | 196 | ||
197 | #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) | 197 | #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) |
198 | static struct at91_nand_data nand_data; | 198 | static struct atmel_nand_data nand_data; |
199 | 199 | ||
200 | #define NAND_BASE AT91_CHIPSELECT_3 | 200 | #define NAND_BASE AT91_CHIPSELECT_3 |
201 | 201 | ||
@@ -212,8 +212,8 @@ static struct resource nand_resources[] = { | |||
212 | } | 212 | } |
213 | }; | 213 | }; |
214 | 214 | ||
215 | static struct platform_device at91_nand_device = { | 215 | static struct platform_device atmel_nand_device = { |
216 | .name = "at91_nand", | 216 | .name = "atmel_nand", |
217 | .id = -1, | 217 | .id = -1, |
218 | .dev = { | 218 | .dev = { |
219 | .platform_data = &nand_data, | 219 | .platform_data = &nand_data, |
@@ -222,7 +222,7 @@ static struct platform_device at91_nand_device = { | |||
222 | .num_resources = ARRAY_SIZE(nand_resources), | 222 | .num_resources = ARRAY_SIZE(nand_resources), |
223 | }; | 223 | }; |
224 | 224 | ||
225 | void __init at91_add_device_nand(struct at91_nand_data *data) | 225 | void __init at91_add_device_nand(struct atmel_nand_data *data) |
226 | { | 226 | { |
227 | unsigned long csa; | 227 | unsigned long csa; |
228 | 228 | ||
@@ -259,11 +259,11 @@ void __init at91_add_device_nand(struct at91_nand_data *data) | |||
259 | at91_set_A_periph(AT91_PIN_PB5, 0); /* NANDWE */ | 259 | at91_set_A_periph(AT91_PIN_PB5, 0); /* NANDWE */ |
260 | 260 | ||
261 | nand_data = *data; | 261 | nand_data = *data; |
262 | platform_device_register(&at91_nand_device); | 262 | platform_device_register(&atmel_nand_device); |
263 | } | 263 | } |
264 | 264 | ||
265 | #else | 265 | #else |
266 | void __init at91_add_device_nand(struct at91_nand_data *data) {} | 266 | void __init at91_add_device_nand(struct atmel_nand_data *data) {} |
267 | #endif | 267 | #endif |
268 | 268 | ||
269 | 269 | ||
diff --git a/arch/arm/mach-at91/board-cam60.c b/arch/arm/mach-at91/board-cam60.c index b22a1a004055..af2c33aff1a8 100644 --- a/arch/arm/mach-at91/board-cam60.c +++ b/arch/arm/mach-at91/board-cam60.c | |||
@@ -142,7 +142,7 @@ static struct mtd_partition * __init nand_partitions(int size, int *num_partitio | |||
142 | return cam60_nand_partition; | 142 | return cam60_nand_partition; |
143 | } | 143 | } |
144 | 144 | ||
145 | static struct at91_nand_data __initdata cam60_nand_data = { | 145 | static struct atmel_nand_data __initdata cam60_nand_data = { |
146 | .ale = 21, | 146 | .ale = 21, |
147 | .cle = 22, | 147 | .cle = 22, |
148 | // .det_pin = ... not there | 148 | // .det_pin = ... not there |
diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c index b4b67eb1cbcb..117cf6c9afce 100644 --- a/arch/arm/mach-at91/board-cap9adk.c +++ b/arch/arm/mach-at91/board-cap9adk.c | |||
@@ -181,7 +181,7 @@ static struct mtd_partition * __init nand_partitions(int size, int *num_partitio | |||
181 | return cap9adk_nand_partitions; | 181 | return cap9adk_nand_partitions; |
182 | } | 182 | } |
183 | 183 | ||
184 | static struct at91_nand_data __initdata cap9adk_nand_data = { | 184 | static struct atmel_nand_data __initdata cap9adk_nand_data = { |
185 | .ale = 21, | 185 | .ale = 21, |
186 | .cle = 22, | 186 | .cle = 22, |
187 | // .det_pin = ... not connected | 187 | // .det_pin = ... not connected |
diff --git a/arch/arm/mach-at91/board-dk.c b/arch/arm/mach-at91/board-dk.c index dab958d25926..02a70b2f355b 100644 --- a/arch/arm/mach-at91/board-dk.c +++ b/arch/arm/mach-at91/board-dk.c | |||
@@ -147,7 +147,7 @@ static struct mtd_partition * __init nand_partitions(int size, int *num_partitio | |||
147 | return dk_nand_partition; | 147 | return dk_nand_partition; |
148 | } | 148 | } |
149 | 149 | ||
150 | static struct at91_nand_data __initdata dk_nand_data = { | 150 | static struct atmel_nand_data __initdata dk_nand_data = { |
151 | .ale = 22, | 151 | .ale = 22, |
152 | .cle = 21, | 152 | .cle = 21, |
153 | .det_pin = AT91_PIN_PB1, | 153 | .det_pin = AT91_PIN_PB1, |
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c index cb065febd95e..082ed59365a4 100644 --- a/arch/arm/mach-at91/board-kb9202.c +++ b/arch/arm/mach-at91/board-kb9202.c | |||
@@ -105,7 +105,7 @@ static struct mtd_partition * __init nand_partitions(int size, int *num_partitio | |||
105 | return kb9202_nand_partition; | 105 | return kb9202_nand_partition; |
106 | } | 106 | } |
107 | 107 | ||
108 | static struct at91_nand_data __initdata kb9202_nand_data = { | 108 | static struct atmel_nand_data __initdata kb9202_nand_data = { |
109 | .ale = 22, | 109 | .ale = 22, |
110 | .cle = 21, | 110 | .cle = 21, |
111 | // .det_pin = ... not there | 111 | // .det_pin = ... not there |
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c index 8f76af5e219a..57a6221943ed 100644 --- a/arch/arm/mach-at91/board-sam9-l9260.c +++ b/arch/arm/mach-at91/board-sam9-l9260.c | |||
@@ -141,7 +141,7 @@ static struct mtd_partition * __init nand_partitions(int size, int *num_partitio | |||
141 | return ek_nand_partition; | 141 | return ek_nand_partition; |
142 | } | 142 | } |
143 | 143 | ||
144 | static struct at91_nand_data __initdata ek_nand_data = { | 144 | static struct atmel_nand_data __initdata ek_nand_data = { |
145 | .ale = 21, | 145 | .ale = 21, |
146 | .cle = 22, | 146 | .cle = 22, |
147 | // .det_pin = ... not connected | 147 | // .det_pin = ... not connected |
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c index 4d1d9c777084..6a680795c3c8 100644 --- a/arch/arm/mach-at91/board-sam9260ek.c +++ b/arch/arm/mach-at91/board-sam9260ek.c | |||
@@ -178,7 +178,7 @@ static struct mtd_partition * __init nand_partitions(int size, int *num_partitio | |||
178 | return ek_nand_partition; | 178 | return ek_nand_partition; |
179 | } | 179 | } |
180 | 180 | ||
181 | static struct at91_nand_data __initdata ek_nand_data = { | 181 | static struct atmel_nand_data __initdata ek_nand_data = { |
182 | .ale = 21, | 182 | .ale = 21, |
183 | .cle = 22, | 183 | .cle = 22, |
184 | // .det_pin = ... not connected | 184 | // .det_pin = ... not connected |
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c index 08382c0df221..43dfbd0d543a 100644 --- a/arch/arm/mach-at91/board-sam9261ek.c +++ b/arch/arm/mach-at91/board-sam9261ek.c | |||
@@ -183,7 +183,7 @@ static struct mtd_partition * __init nand_partitions(int size, int *num_partitio | |||
183 | return ek_nand_partition; | 183 | return ek_nand_partition; |
184 | } | 184 | } |
185 | 185 | ||
186 | static struct at91_nand_data __initdata ek_nand_data = { | 186 | static struct atmel_nand_data __initdata ek_nand_data = { |
187 | .ale = 22, | 187 | .ale = 22, |
188 | .cle = 21, | 188 | .cle = 21, |
189 | // .det_pin = ... not connected | 189 | // .det_pin = ... not connected |
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c index b4cd5d0ed597..6605a0980117 100644 --- a/arch/arm/mach-at91/board-sam9263ek.c +++ b/arch/arm/mach-at91/board-sam9263ek.c | |||
@@ -187,7 +187,7 @@ static struct mtd_partition * __init nand_partitions(int size, int *num_partitio | |||
187 | return ek_nand_partition; | 187 | return ek_nand_partition; |
188 | } | 188 | } |
189 | 189 | ||
190 | static struct at91_nand_data __initdata ek_nand_data = { | 190 | static struct atmel_nand_data __initdata ek_nand_data = { |
191 | .ale = 21, | 191 | .ale = 21, |
192 | .cle = 22, | 192 | .cle = 22, |
193 | // .det_pin = ... not connected | 193 | // .det_pin = ... not connected |
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c index b6a70fc735c3..66e77bb2e079 100644 --- a/arch/arm/mach-at91/board-sam9rlek.c +++ b/arch/arm/mach-at91/board-sam9rlek.c | |||
@@ -96,7 +96,7 @@ static struct mtd_partition * __init nand_partitions(int size, int *num_partitio | |||
96 | return ek_nand_partition; | 96 | return ek_nand_partition; |
97 | } | 97 | } |
98 | 98 | ||
99 | static struct at91_nand_data __initdata ek_nand_data = { | 99 | static struct atmel_nand_data __initdata ek_nand_data = { |
100 | .ale = 21, | 100 | .ale = 21, |
101 | .cle = 22, | 101 | .cle = 22, |
102 | // .det_pin = ... not connected | 102 | // .det_pin = ... not connected |
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c index 7079050ab88d..bbbfd06f5e0c 100644 --- a/arch/arm/mach-at91/board-yl-9200.c +++ b/arch/arm/mach-at91/board-yl-9200.c | |||
@@ -180,7 +180,7 @@ static struct mtd_partition * __init nand_partitions(int size, int *num_partitio | |||
180 | return yl9200_nand_partition; | 180 | return yl9200_nand_partition; |
181 | } | 181 | } |
182 | 182 | ||
183 | static struct at91_nand_data __initdata yl9200_nand_data = { | 183 | static struct atmel_nand_data __initdata yl9200_nand_data = { |
184 | .ale = 6, | 184 | .ale = 6, |
185 | .cle = 7, | 185 | .cle = 7, |
186 | // .det_pin = ... not connected | 186 | // .det_pin = ... not connected |
diff --git a/arch/avr32/boards/atstk1000/Kconfig b/arch/avr32/boards/atstk1000/Kconfig index af90b00100fd..8dc48214f0b7 100644 --- a/arch/avr32/boards/atstk1000/Kconfig +++ b/arch/avr32/boards/atstk1000/Kconfig | |||
@@ -18,6 +18,10 @@ config BOARD_ATSTK1004 | |||
18 | bool "ATSTK1004" | 18 | bool "ATSTK1004" |
19 | select CPU_AT32AP7002 | 19 | select CPU_AT32AP7002 |
20 | 20 | ||
21 | config BOARD_ATSTK1006 | ||
22 | bool "ATSTK1006" | ||
23 | select CPU_AT32AP7000 | ||
24 | |||
21 | endchoice | 25 | endchoice |
22 | 26 | ||
23 | 27 | ||
diff --git a/arch/avr32/boards/atstk1000/Makefile b/arch/avr32/boards/atstk1000/Makefile index beead86462e8..edecee03742d 100644 --- a/arch/avr32/boards/atstk1000/Makefile +++ b/arch/avr32/boards/atstk1000/Makefile | |||
@@ -2,3 +2,4 @@ obj-y += setup.o flash.o | |||
2 | obj-$(CONFIG_BOARD_ATSTK1002) += atstk1002.o | 2 | obj-$(CONFIG_BOARD_ATSTK1002) += atstk1002.o |
3 | obj-$(CONFIG_BOARD_ATSTK1003) += atstk1003.o | 3 | obj-$(CONFIG_BOARD_ATSTK1003) += atstk1003.o |
4 | obj-$(CONFIG_BOARD_ATSTK1004) += atstk1004.o | 4 | obj-$(CONFIG_BOARD_ATSTK1004) += atstk1004.o |
5 | obj-$(CONFIG_BOARD_ATSTK1006) += atstk1002.o | ||
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c index e11659b732fa..8538ba75ef92 100644 --- a/arch/avr32/boards/atstk1000/atstk1002.c +++ b/arch/avr32/boards/atstk1000/atstk1002.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * ATSTK1002 daughterboard-specific init code | 2 | * ATSTK1002/ATSTK1006 daughterboard-specific init code |
3 | * | 3 | * |
4 | * Copyright (C) 2005-2006 Atmel Corporation | 4 | * Copyright (C) 2005-2007 Atmel Corporation |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
@@ -21,6 +21,8 @@ | |||
21 | 21 | ||
22 | #include <asm/io.h> | 22 | #include <asm/io.h> |
23 | #include <asm/setup.h> | 23 | #include <asm/setup.h> |
24 | #include <asm/atmel-mci.h> | ||
25 | |||
24 | #include <asm/arch/at32ap700x.h> | 26 | #include <asm/arch/at32ap700x.h> |
25 | #include <asm/arch/board.h> | 27 | #include <asm/arch/board.h> |
26 | #include <asm/arch/init.h> | 28 | #include <asm/arch/init.h> |
@@ -35,6 +37,74 @@ unsigned long at32_board_osc_rates[3] = { | |||
35 | [2] = 12000000, /* 12 MHz on osc1 */ | 37 | [2] = 12000000, /* 12 MHz on osc1 */ |
36 | }; | 38 | }; |
37 | 39 | ||
40 | /* | ||
41 | * The ATSTK1006 daughterboard is very similar to the ATSTK1002. Both | ||
42 | * have the AT32AP7000 chip on board; the difference is that the | ||
43 | * STK1006 has 128 MB SDRAM (the STK1002 uses the 8 MB SDRAM chip on | ||
44 | * the STK1000 motherboard) and 256 MB NAND flash (the STK1002 has | ||
45 | * none.) | ||
46 | * | ||
47 | * The RAM difference is handled by the boot loader, so the only | ||
48 | * difference we end up handling here is the NAND flash. | ||
49 | */ | ||
50 | #ifdef CONFIG_BOARD_ATSTK1006 | ||
51 | #include <linux/mtd/partitions.h> | ||
52 | #include <asm/arch/smc.h> | ||
53 | |||
54 | static struct smc_timing nand_timing __initdata = { | ||
55 | .ncs_read_setup = 0, | ||
56 | .nrd_setup = 10, | ||
57 | .ncs_write_setup = 0, | ||
58 | .nwe_setup = 10, | ||
59 | |||
60 | .ncs_read_pulse = 30, | ||
61 | .nrd_pulse = 15, | ||
62 | .ncs_write_pulse = 30, | ||
63 | .nwe_pulse = 15, | ||
64 | |||
65 | .read_cycle = 30, | ||
66 | .write_cycle = 30, | ||
67 | |||
68 | .ncs_read_recover = 0, | ||
69 | .nrd_recover = 15, | ||
70 | .ncs_write_recover = 0, | ||
71 | /* WE# high -> RE# low min 60 ns */ | ||
72 | .nwe_recover = 50, | ||
73 | }; | ||
74 | |||
75 | static struct smc_config nand_config __initdata = { | ||
76 | .bus_width = 1, | ||
77 | .nrd_controlled = 1, | ||
78 | .nwe_controlled = 1, | ||
79 | .nwait_mode = 0, | ||
80 | .byte_write = 0, | ||
81 | .tdf_cycles = 2, | ||
82 | .tdf_mode = 0, | ||
83 | }; | ||
84 | |||
85 | static struct mtd_partition nand_partitions[] = { | ||
86 | { | ||
87 | .name = "main", | ||
88 | .offset = 0x00000000, | ||
89 | .size = MTDPART_SIZ_FULL, | ||
90 | }, | ||
91 | }; | ||
92 | |||
93 | static struct mtd_partition *nand_part_info(int size, int *num_partitions) | ||
94 | { | ||
95 | *num_partitions = ARRAY_SIZE(nand_partitions); | ||
96 | return nand_partitions; | ||
97 | } | ||
98 | |||
99 | struct atmel_nand_data atstk1006_nand_data __initdata = { | ||
100 | .cle = 21, | ||
101 | .ale = 22, | ||
102 | .rdy_pin = GPIO_PIN_PB(30), | ||
103 | .enable_pin = GPIO_PIN_PB(29), | ||
104 | .partition_info = nand_part_info, | ||
105 | }; | ||
106 | #endif | ||
107 | |||
38 | struct eth_addr { | 108 | struct eth_addr { |
39 | u8 addr[6]; | 109 | u8 addr[6]; |
40 | }; | 110 | }; |
@@ -192,6 +262,21 @@ void __init setup_board(void) | |||
192 | at32_setup_serial_console(0); | 262 | at32_setup_serial_console(0); |
193 | } | 263 | } |
194 | 264 | ||
265 | #ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM | ||
266 | |||
267 | /* MMC card detect requires MACB0 *NOT* be used */ | ||
268 | #ifdef CONFIG_BOARD_ATSTK1002_SW6_CUSTOM | ||
269 | static struct mci_platform_data __initdata mci0_data = { | ||
270 | .detect_pin = GPIO_PIN_PC(14), /* gpio30/sdcd */ | ||
271 | .wp_pin = GPIO_PIN_PC(15), /* gpio31/sdwp */ | ||
272 | }; | ||
273 | #define MCI_PDATA &mci0_data | ||
274 | #else | ||
275 | #define MCI_PDATA NULL | ||
276 | #endif /* SW6 for sd{cd,wp} routing */ | ||
277 | |||
278 | #endif /* SW2 for MMC signal routing */ | ||
279 | |||
195 | static int __init atstk1002_init(void) | 280 | static int __init atstk1002_init(void) |
196 | { | 281 | { |
197 | /* | 282 | /* |
@@ -218,6 +303,12 @@ static int __init atstk1002_init(void) | |||
218 | 303 | ||
219 | at32_add_system_devices(); | 304 | at32_add_system_devices(); |
220 | 305 | ||
306 | #ifdef CONFIG_BOARD_ATSTK1006 | ||
307 | smc_set_timing(&nand_config, &nand_timing); | ||
308 | smc_set_configuration(3, &nand_config); | ||
309 | at32_add_device_nand(0, &atstk1006_nand_data); | ||
310 | #endif | ||
311 | |||
221 | #ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM | 312 | #ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM |
222 | at32_add_device_usart(1); | 313 | at32_add_device_usart(1); |
223 | #else | 314 | #else |
@@ -235,7 +326,7 @@ static int __init atstk1002_init(void) | |||
235 | at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); | 326 | at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); |
236 | #endif | 327 | #endif |
237 | #ifndef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM | 328 | #ifndef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM |
238 | at32_add_device_mci(0, NULL); | 329 | at32_add_device_mci(0, MCI_PDATA); |
239 | #endif | 330 | #endif |
240 | #ifdef CONFIG_BOARD_ATSTK1002_SW5_CUSTOM | 331 | #ifdef CONFIG_BOARD_ATSTK1002_SW5_CUSTOM |
241 | set_hw_addr(at32_add_device_eth(1, ð_data[1])); | 332 | set_hw_addr(at32_add_device_eth(1, ð_data[1])); |
diff --git a/arch/avr32/boards/atstk1000/atstk1003.c b/arch/avr32/boards/atstk1000/atstk1003.c index ea109f435a83..591fc73b554a 100644 --- a/arch/avr32/boards/atstk1000/atstk1003.c +++ b/arch/avr32/boards/atstk1000/atstk1003.c | |||
@@ -154,7 +154,7 @@ static int __init atstk1003_init(void) | |||
154 | at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); | 154 | at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); |
155 | #endif | 155 | #endif |
156 | #ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM | 156 | #ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM |
157 | at32_add_device_mci(0); | 157 | at32_add_device_mci(0, NULL); |
158 | #endif | 158 | #endif |
159 | at32_add_device_usba(0, NULL); | 159 | at32_add_device_usba(0, NULL); |
160 | #ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM | 160 | #ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM |
diff --git a/arch/avr32/boards/atstk1000/atstk1004.c b/arch/avr32/boards/atstk1000/atstk1004.c index c7236df74d74..d9c5e0a21256 100644 --- a/arch/avr32/boards/atstk1000/atstk1004.c +++ b/arch/avr32/boards/atstk1000/atstk1004.c | |||
@@ -137,7 +137,7 @@ static int __init atstk1004_init(void) | |||
137 | at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); | 137 | at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); |
138 | #endif | 138 | #endif |
139 | #ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM | 139 | #ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM |
140 | at32_add_device_mci(0); | 140 | at32_add_device_mci(0, NULL); |
141 | #endif | 141 | #endif |
142 | at32_add_device_lcdc(0, &atstk1000_lcdc_data, | 142 | at32_add_device_lcdc(0, &atstk1000_lcdc_data, |
143 | fbmem_start, fbmem_size, 0); | 143 | fbmem_start, fbmem_size, 0); |
diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c index abd954fb7ba0..7e7f32771ae1 100644 --- a/arch/avr32/kernel/time.c +++ b/arch/avr32/kernel/time.c | |||
@@ -43,6 +43,9 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id) | |||
43 | { | 43 | { |
44 | struct clock_event_device *evdev = dev_id; | 44 | struct clock_event_device *evdev = dev_id; |
45 | 45 | ||
46 | if (unlikely(!(intc_get_pending(0) & 1))) | ||
47 | return IRQ_NONE; | ||
48 | |||
46 | /* | 49 | /* |
47 | * Disable the interrupt until the clockevent subsystem | 50 | * Disable the interrupt until the clockevent subsystem |
48 | * reprograms it. | 51 | * reprograms it. |
@@ -55,7 +58,8 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id) | |||
55 | 58 | ||
56 | static struct irqaction timer_irqaction = { | 59 | static struct irqaction timer_irqaction = { |
57 | .handler = timer_interrupt, | 60 | .handler = timer_interrupt, |
58 | .flags = IRQF_TIMER | IRQF_DISABLED, | 61 | /* Oprofile uses the same irq as the timer, so allow it to be shared */ |
62 | .flags = IRQF_TIMER | IRQF_DISABLED | IRQF_SHARED, | ||
59 | .name = "avr32_comparator", | 63 | .name = "avr32_comparator", |
60 | }; | 64 | }; |
61 | 65 | ||
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c index 604f44f5dd16..1617048c86c5 100644 --- a/arch/avr32/mach-at32ap/at32ap700x.c +++ b/arch/avr32/mach-at32ap/at32ap700x.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/dma-mapping.h> | 14 | #include <linux/dma-mapping.h> |
15 | #include <linux/gpio.h> | ||
15 | #include <linux/spi/spi.h> | 16 | #include <linux/spi/spi.h> |
16 | #include <linux/usb/atmel_usba_udc.h> | 17 | #include <linux/usb/atmel_usba_udc.h> |
17 | 18 | ||
@@ -1285,7 +1286,6 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data) | |||
1285 | { | 1286 | { |
1286 | struct mci_platform_data _data; | 1287 | struct mci_platform_data _data; |
1287 | struct platform_device *pdev; | 1288 | struct platform_device *pdev; |
1288 | struct dw_dma_slave *dws; | ||
1289 | 1289 | ||
1290 | if (id != 0) | 1290 | if (id != 0) |
1291 | return NULL; | 1291 | return NULL; |
@@ -1300,7 +1300,9 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data) | |||
1300 | 1300 | ||
1301 | if (!data) { | 1301 | if (!data) { |
1302 | data = &_data; | 1302 | data = &_data; |
1303 | memset(data, 0, sizeof(struct mci_platform_data)); | 1303 | memset(data, -1, sizeof(struct mci_platform_data)); |
1304 | data->detect_pin = GPIO_PIN_NONE; | ||
1305 | data->wp_pin = GPIO_PIN_NONE; | ||
1304 | } | 1306 | } |
1305 | 1307 | ||
1306 | if (platform_device_add_data(pdev, data, | 1308 | if (platform_device_add_data(pdev, data, |
@@ -1314,12 +1316,10 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data) | |||
1314 | select_peripheral(PA(14), PERIPH_A, 0); /* DATA2 */ | 1316 | select_peripheral(PA(14), PERIPH_A, 0); /* DATA2 */ |
1315 | select_peripheral(PA(15), PERIPH_A, 0); /* DATA3 */ | 1317 | select_peripheral(PA(15), PERIPH_A, 0); /* DATA3 */ |
1316 | 1318 | ||
1317 | if (data) { | 1319 | if (gpio_is_valid(data->detect_pin)) |
1318 | if (data->detect_pin != GPIO_PIN_NONE) | 1320 | at32_select_gpio(data->detect_pin, 0); |
1319 | at32_select_gpio(data->detect_pin, 0); | 1321 | if (gpio_is_valid(data->wp_pin)) |
1320 | if (data->wp_pin != GPIO_PIN_NONE) | 1322 | at32_select_gpio(data->wp_pin, 0); |
1321 | at32_select_gpio(data->wp_pin, 0); | ||
1322 | } | ||
1323 | 1323 | ||
1324 | atmel_mci0_pclk.dev = &pdev->dev; | 1324 | atmel_mci0_pclk.dev = &pdev->dev; |
1325 | 1325 | ||
@@ -1853,11 +1853,11 @@ at32_add_device_cf(unsigned int id, unsigned int extint, | |||
1853 | if (at32_init_ide_or_cf(pdev, data->cs, extint)) | 1853 | if (at32_init_ide_or_cf(pdev, data->cs, extint)) |
1854 | goto fail; | 1854 | goto fail; |
1855 | 1855 | ||
1856 | if (data->detect_pin != GPIO_PIN_NONE) | 1856 | if (gpio_is_valid(data->detect_pin)) |
1857 | at32_select_gpio(data->detect_pin, AT32_GPIOF_DEGLITCH); | 1857 | at32_select_gpio(data->detect_pin, AT32_GPIOF_DEGLITCH); |
1858 | if (data->reset_pin != GPIO_PIN_NONE) | 1858 | if (gpio_is_valid(data->reset_pin)) |
1859 | at32_select_gpio(data->reset_pin, 0); | 1859 | at32_select_gpio(data->reset_pin, 0); |
1860 | if (data->vcc_pin != GPIO_PIN_NONE) | 1860 | if (gpio_is_valid(data->vcc_pin)) |
1861 | at32_select_gpio(data->vcc_pin, 0); | 1861 | at32_select_gpio(data->vcc_pin, 0); |
1862 | /* READY is used as extint, so we can't select it as gpio */ | 1862 | /* READY is used as extint, so we can't select it as gpio */ |
1863 | 1863 | ||
@@ -1871,6 +1871,58 @@ fail: | |||
1871 | #endif | 1871 | #endif |
1872 | 1872 | ||
1873 | /* -------------------------------------------------------------------- | 1873 | /* -------------------------------------------------------------------- |
1874 | * NAND Flash / SmartMedia | ||
1875 | * -------------------------------------------------------------------- */ | ||
1876 | static struct resource smc_cs3_resource[] __initdata = { | ||
1877 | { | ||
1878 | .start = 0x0c000000, | ||
1879 | .end = 0x0fffffff, | ||
1880 | .flags = IORESOURCE_MEM, | ||
1881 | }, { | ||
1882 | .start = 0xfff03c00, | ||
1883 | .end = 0xfff03fff, | ||
1884 | .flags = IORESOURCE_MEM, | ||
1885 | }, | ||
1886 | }; | ||
1887 | |||
1888 | struct platform_device *__init | ||
1889 | at32_add_device_nand(unsigned int id, struct atmel_nand_data *data) | ||
1890 | { | ||
1891 | struct platform_device *pdev; | ||
1892 | |||
1893 | if (id != 0 || !data) | ||
1894 | return NULL; | ||
1895 | |||
1896 | pdev = platform_device_alloc("atmel_nand", id); | ||
1897 | if (!pdev) | ||
1898 | goto fail; | ||
1899 | |||
1900 | if (platform_device_add_resources(pdev, smc_cs3_resource, | ||
1901 | ARRAY_SIZE(smc_cs3_resource))) | ||
1902 | goto fail; | ||
1903 | |||
1904 | if (platform_device_add_data(pdev, data, | ||
1905 | sizeof(struct atmel_nand_data))) | ||
1906 | goto fail; | ||
1907 | |||
1908 | set_ebi_sfr_bits(HMATRIX_BIT(CS3A)); | ||
1909 | if (data->enable_pin) | ||
1910 | at32_select_gpio(data->enable_pin, | ||
1911 | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); | ||
1912 | if (data->rdy_pin) | ||
1913 | at32_select_gpio(data->rdy_pin, 0); | ||
1914 | if (data->det_pin) | ||
1915 | at32_select_gpio(data->det_pin, 0); | ||
1916 | |||
1917 | platform_device_add(pdev); | ||
1918 | return pdev; | ||
1919 | |||
1920 | fail: | ||
1921 | platform_device_put(pdev); | ||
1922 | return NULL; | ||
1923 | } | ||
1924 | |||
1925 | /* -------------------------------------------------------------------- | ||
1874 | * AC97C | 1926 | * AC97C |
1875 | * -------------------------------------------------------------------- */ | 1927 | * -------------------------------------------------------------------- */ |
1876 | static struct resource atmel_ac97c0_resource[] __initdata = { | 1928 | static struct resource atmel_ac97c0_resource[] __initdata = { |
@@ -1885,9 +1937,11 @@ static struct clk atmel_ac97c0_pclk = { | |||
1885 | .index = 10, | 1937 | .index = 10, |
1886 | }; | 1938 | }; |
1887 | 1939 | ||
1888 | struct platform_device *__init at32_add_device_ac97c(unsigned int id) | 1940 | struct platform_device *__init |
1941 | at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data) | ||
1889 | { | 1942 | { |
1890 | struct platform_device *pdev; | 1943 | struct platform_device *pdev; |
1944 | struct ac97c_platform_data _data; | ||
1891 | 1945 | ||
1892 | if (id != 0) | 1946 | if (id != 0) |
1893 | return NULL; | 1947 | return NULL; |
@@ -1898,19 +1952,37 @@ struct platform_device *__init at32_add_device_ac97c(unsigned int id) | |||
1898 | 1952 | ||
1899 | if (platform_device_add_resources(pdev, atmel_ac97c0_resource, | 1953 | if (platform_device_add_resources(pdev, atmel_ac97c0_resource, |
1900 | ARRAY_SIZE(atmel_ac97c0_resource))) | 1954 | ARRAY_SIZE(atmel_ac97c0_resource))) |
1901 | goto err_add_resources; | 1955 | goto fail; |
1902 | 1956 | ||
1903 | select_peripheral(PB(20), PERIPH_B, 0); /* SYNC */ | 1957 | if (!data) { |
1904 | select_peripheral(PB(21), PERIPH_B, 0); /* SDO */ | 1958 | data = &_data; |
1905 | select_peripheral(PB(22), PERIPH_B, 0); /* SDI */ | 1959 | memset(data, 0, sizeof(struct ac97c_platform_data)); |
1906 | select_peripheral(PB(23), PERIPH_B, 0); /* SCLK */ | 1960 | data->reset_pin = GPIO_PIN_NONE; |
1961 | } | ||
1962 | |||
1963 | data->dma_rx_periph_id = 3; | ||
1964 | data->dma_tx_periph_id = 4; | ||
1965 | data->dma_controller_id = 0; | ||
1966 | |||
1967 | if (platform_device_add_data(pdev, data, | ||
1968 | sizeof(struct ac97c_platform_data))) | ||
1969 | goto fail; | ||
1970 | |||
1971 | select_peripheral(PB(20), PERIPH_B, 0); /* SDO */ | ||
1972 | select_peripheral(PB(21), PERIPH_B, 0); /* SYNC */ | ||
1973 | select_peripheral(PB(22), PERIPH_B, 0); /* SCLK */ | ||
1974 | select_peripheral(PB(23), PERIPH_B, 0); /* SDI */ | ||
1975 | |||
1976 | /* TODO: gpio_is_valid(data->reset_pin) with kernel 2.6.26. */ | ||
1977 | if (data->reset_pin != GPIO_PIN_NONE) | ||
1978 | at32_select_gpio(data->reset_pin, 0); | ||
1907 | 1979 | ||
1908 | atmel_ac97c0_pclk.dev = &pdev->dev; | 1980 | atmel_ac97c0_pclk.dev = &pdev->dev; |
1909 | 1981 | ||
1910 | platform_device_add(pdev); | 1982 | platform_device_add(pdev); |
1911 | return pdev; | 1983 | return pdev; |
1912 | 1984 | ||
1913 | err_add_resources: | 1985 | fail: |
1914 | platform_device_put(pdev); | 1986 | platform_device_put(pdev); |
1915 | return NULL; | 1987 | return NULL; |
1916 | } | 1988 | } |
diff --git a/arch/avr32/mach-at32ap/hsmc.c b/arch/avr32/mach-at32ap/hsmc.c index fa427ed42787..b2d9bc61a35c 100644 --- a/arch/avr32/mach-at32ap/hsmc.c +++ b/arch/avr32/mach-at32ap/hsmc.c | |||
@@ -278,4 +278,4 @@ static int __init hsmc_init(void) | |||
278 | { | 278 | { |
279 | return platform_driver_register(&hsmc_driver); | 279 | return platform_driver_register(&hsmc_driver); |
280 | } | 280 | } |
281 | arch_initcall(hsmc_init); | 281 | core_initcall(hsmc_init); |
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c index 2672f4d278ac..7a37d06376be 100644 --- a/arch/ia64/kvm/kvm-ia64.c +++ b/arch/ia64/kvm/kvm-ia64.c | |||
@@ -125,9 +125,9 @@ void kvm_arch_hardware_enable(void *garbage) | |||
125 | PAGE_KERNEL)); | 125 | PAGE_KERNEL)); |
126 | local_irq_save(saved_psr); | 126 | local_irq_save(saved_psr); |
127 | slot = ia64_itr_entry(0x3, KVM_VMM_BASE, pte, KVM_VMM_SHIFT); | 127 | slot = ia64_itr_entry(0x3, KVM_VMM_BASE, pte, KVM_VMM_SHIFT); |
128 | local_irq_restore(saved_psr); | ||
128 | if (slot < 0) | 129 | if (slot < 0) |
129 | return; | 130 | return; |
130 | local_irq_restore(saved_psr); | ||
131 | 131 | ||
132 | spin_lock(&vp_lock); | 132 | spin_lock(&vp_lock); |
133 | status = ia64_pal_vp_init_env(kvm_vsa_base ? | 133 | status = ia64_pal_vp_init_env(kvm_vsa_base ? |
@@ -160,9 +160,9 @@ void kvm_arch_hardware_disable(void *garbage) | |||
160 | 160 | ||
161 | local_irq_save(saved_psr); | 161 | local_irq_save(saved_psr); |
162 | slot = ia64_itr_entry(0x3, KVM_VMM_BASE, pte, KVM_VMM_SHIFT); | 162 | slot = ia64_itr_entry(0x3, KVM_VMM_BASE, pte, KVM_VMM_SHIFT); |
163 | local_irq_restore(saved_psr); | ||
163 | if (slot < 0) | 164 | if (slot < 0) |
164 | return; | 165 | return; |
165 | local_irq_restore(saved_psr); | ||
166 | 166 | ||
167 | status = ia64_pal_vp_exit_env(host_iva); | 167 | status = ia64_pal_vp_exit_env(host_iva); |
168 | if (status) | 168 | if (status) |
@@ -1253,6 +1253,7 @@ static int vti_vcpu_setup(struct kvm_vcpu *vcpu, int id) | |||
1253 | uninit: | 1253 | uninit: |
1254 | kvm_vcpu_uninit(vcpu); | 1254 | kvm_vcpu_uninit(vcpu); |
1255 | fail: | 1255 | fail: |
1256 | local_irq_restore(psr); | ||
1256 | return r; | 1257 | return r; |
1257 | } | 1258 | } |
1258 | 1259 | ||
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c index be255ebb609c..18072e03a019 100644 --- a/arch/parisc/hpux/sys_hpux.c +++ b/arch/parisc/hpux/sys_hpux.c | |||
@@ -210,19 +210,19 @@ static int vfs_statfs_hpux(struct dentry *dentry, struct hpux_statfs *buf) | |||
210 | } | 210 | } |
211 | 211 | ||
212 | /* hpux statfs */ | 212 | /* hpux statfs */ |
213 | asmlinkage long hpux_statfs(const char __user *path, | 213 | asmlinkage long hpux_statfs(const char __user *pathname, |
214 | struct hpux_statfs __user *buf) | 214 | struct hpux_statfs __user *buf) |
215 | { | 215 | { |
216 | struct nameidata nd; | 216 | struct path path; |
217 | int error; | 217 | int error; |
218 | 218 | ||
219 | error = user_path_walk(path, &nd); | 219 | error = user_path(pathname, &path); |
220 | if (!error) { | 220 | if (!error) { |
221 | struct hpux_statfs tmp; | 221 | struct hpux_statfs tmp; |
222 | error = vfs_statfs_hpux(nd.path.dentry, &tmp); | 222 | error = vfs_statfs_hpux(path.dentry, &tmp); |
223 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) | 223 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) |
224 | error = -EFAULT; | 224 | error = -EFAULT; |
225 | path_put(&nd.path); | 225 | path_put(&path); |
226 | } | 226 | } |
227 | return error; | 227 | return error; |
228 | } | 228 | } |
diff --git a/arch/powerpc/kvm/44x_tlb.c b/arch/powerpc/kvm/44x_tlb.c index 75dff7cfa814..5a5602da5091 100644 --- a/arch/powerpc/kvm/44x_tlb.c +++ b/arch/powerpc/kvm/44x_tlb.c | |||
@@ -177,7 +177,8 @@ void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gfn_t gfn, u64 asid, | |||
177 | vcpu->arch.msr & MSR_PR); | 177 | vcpu->arch.msr & MSR_PR); |
178 | } | 178 | } |
179 | 179 | ||
180 | void kvmppc_mmu_invalidate(struct kvm_vcpu *vcpu, u64 eaddr, u64 asid) | 180 | void kvmppc_mmu_invalidate(struct kvm_vcpu *vcpu, gva_t eaddr, |
181 | gva_t eend, u32 asid) | ||
181 | { | 182 | { |
182 | unsigned int pid = asid & 0xff; | 183 | unsigned int pid = asid & 0xff; |
183 | int i; | 184 | int i; |
@@ -191,7 +192,7 @@ void kvmppc_mmu_invalidate(struct kvm_vcpu *vcpu, u64 eaddr, u64 asid) | |||
191 | if (!get_tlb_v(stlbe)) | 192 | if (!get_tlb_v(stlbe)) |
192 | continue; | 193 | continue; |
193 | 194 | ||
194 | if (eaddr < get_tlb_eaddr(stlbe)) | 195 | if (eend < get_tlb_eaddr(stlbe)) |
195 | continue; | 196 | continue; |
196 | 197 | ||
197 | if (eaddr > get_tlb_end(stlbe)) | 198 | if (eaddr > get_tlb_end(stlbe)) |
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c index 000097461283..8c605d0a5488 100644 --- a/arch/powerpc/kvm/emulate.c +++ b/arch/powerpc/kvm/emulate.c | |||
@@ -137,7 +137,7 @@ static int kvmppc_emul_tlbwe(struct kvm_vcpu *vcpu, u32 inst) | |||
137 | if (tlbe->word0 & PPC44x_TLB_VALID) { | 137 | if (tlbe->word0 & PPC44x_TLB_VALID) { |
138 | eaddr = get_tlb_eaddr(tlbe); | 138 | eaddr = get_tlb_eaddr(tlbe); |
139 | asid = (tlbe->word0 & PPC44x_TLB_TS) | tlbe->tid; | 139 | asid = (tlbe->word0 & PPC44x_TLB_TS) | tlbe->tid; |
140 | kvmppc_mmu_invalidate(vcpu, eaddr, asid); | 140 | kvmppc_mmu_invalidate(vcpu, eaddr, get_tlb_end(tlbe), asid); |
141 | } | 141 | } |
142 | 142 | ||
143 | switch (ws) { | 143 | switch (ws) { |
diff --git a/arch/s390/kvm/gaccess.h b/arch/s390/kvm/gaccess.h index 4e0633c413f3..ed60f3a74a85 100644 --- a/arch/s390/kvm/gaccess.h +++ b/arch/s390/kvm/gaccess.h | |||
@@ -18,11 +18,11 @@ | |||
18 | #include <asm/uaccess.h> | 18 | #include <asm/uaccess.h> |
19 | 19 | ||
20 | static inline void __user *__guestaddr_to_user(struct kvm_vcpu *vcpu, | 20 | static inline void __user *__guestaddr_to_user(struct kvm_vcpu *vcpu, |
21 | u64 guestaddr) | 21 | unsigned long guestaddr) |
22 | { | 22 | { |
23 | u64 prefix = vcpu->arch.sie_block->prefix; | 23 | unsigned long prefix = vcpu->arch.sie_block->prefix; |
24 | u64 origin = vcpu->kvm->arch.guest_origin; | 24 | unsigned long origin = vcpu->kvm->arch.guest_origin; |
25 | u64 memsize = vcpu->kvm->arch.guest_memsize; | 25 | unsigned long memsize = vcpu->kvm->arch.guest_memsize; |
26 | 26 | ||
27 | if (guestaddr < 2 * PAGE_SIZE) | 27 | if (guestaddr < 2 * PAGE_SIZE) |
28 | guestaddr += prefix; | 28 | guestaddr += prefix; |
@@ -37,7 +37,7 @@ static inline void __user *__guestaddr_to_user(struct kvm_vcpu *vcpu, | |||
37 | return (void __user *) guestaddr; | 37 | return (void __user *) guestaddr; |
38 | } | 38 | } |
39 | 39 | ||
40 | static inline int get_guest_u64(struct kvm_vcpu *vcpu, u64 guestaddr, | 40 | static inline int get_guest_u64(struct kvm_vcpu *vcpu, unsigned long guestaddr, |
41 | u64 *result) | 41 | u64 *result) |
42 | { | 42 | { |
43 | void __user *uptr = __guestaddr_to_user(vcpu, guestaddr); | 43 | void __user *uptr = __guestaddr_to_user(vcpu, guestaddr); |
@@ -47,10 +47,10 @@ static inline int get_guest_u64(struct kvm_vcpu *vcpu, u64 guestaddr, | |||
47 | if (IS_ERR((void __force *) uptr)) | 47 | if (IS_ERR((void __force *) uptr)) |
48 | return PTR_ERR((void __force *) uptr); | 48 | return PTR_ERR((void __force *) uptr); |
49 | 49 | ||
50 | return get_user(*result, (u64 __user *) uptr); | 50 | return get_user(*result, (unsigned long __user *) uptr); |
51 | } | 51 | } |
52 | 52 | ||
53 | static inline int get_guest_u32(struct kvm_vcpu *vcpu, u64 guestaddr, | 53 | static inline int get_guest_u32(struct kvm_vcpu *vcpu, unsigned long guestaddr, |
54 | u32 *result) | 54 | u32 *result) |
55 | { | 55 | { |
56 | void __user *uptr = __guestaddr_to_user(vcpu, guestaddr); | 56 | void __user *uptr = __guestaddr_to_user(vcpu, guestaddr); |
@@ -63,7 +63,7 @@ static inline int get_guest_u32(struct kvm_vcpu *vcpu, u64 guestaddr, | |||
63 | return get_user(*result, (u32 __user *) uptr); | 63 | return get_user(*result, (u32 __user *) uptr); |
64 | } | 64 | } |
65 | 65 | ||
66 | static inline int get_guest_u16(struct kvm_vcpu *vcpu, u64 guestaddr, | 66 | static inline int get_guest_u16(struct kvm_vcpu *vcpu, unsigned long guestaddr, |
67 | u16 *result) | 67 | u16 *result) |
68 | { | 68 | { |
69 | void __user *uptr = __guestaddr_to_user(vcpu, guestaddr); | 69 | void __user *uptr = __guestaddr_to_user(vcpu, guestaddr); |
@@ -76,7 +76,7 @@ static inline int get_guest_u16(struct kvm_vcpu *vcpu, u64 guestaddr, | |||
76 | return get_user(*result, (u16 __user *) uptr); | 76 | return get_user(*result, (u16 __user *) uptr); |
77 | } | 77 | } |
78 | 78 | ||
79 | static inline int get_guest_u8(struct kvm_vcpu *vcpu, u64 guestaddr, | 79 | static inline int get_guest_u8(struct kvm_vcpu *vcpu, unsigned long guestaddr, |
80 | u8 *result) | 80 | u8 *result) |
81 | { | 81 | { |
82 | void __user *uptr = __guestaddr_to_user(vcpu, guestaddr); | 82 | void __user *uptr = __guestaddr_to_user(vcpu, guestaddr); |
@@ -87,7 +87,7 @@ static inline int get_guest_u8(struct kvm_vcpu *vcpu, u64 guestaddr, | |||
87 | return get_user(*result, (u8 __user *) uptr); | 87 | return get_user(*result, (u8 __user *) uptr); |
88 | } | 88 | } |
89 | 89 | ||
90 | static inline int put_guest_u64(struct kvm_vcpu *vcpu, u64 guestaddr, | 90 | static inline int put_guest_u64(struct kvm_vcpu *vcpu, unsigned long guestaddr, |
91 | u64 value) | 91 | u64 value) |
92 | { | 92 | { |
93 | void __user *uptr = __guestaddr_to_user(vcpu, guestaddr); | 93 | void __user *uptr = __guestaddr_to_user(vcpu, guestaddr); |
@@ -100,7 +100,7 @@ static inline int put_guest_u64(struct kvm_vcpu *vcpu, u64 guestaddr, | |||
100 | return put_user(value, (u64 __user *) uptr); | 100 | return put_user(value, (u64 __user *) uptr); |
101 | } | 101 | } |
102 | 102 | ||
103 | static inline int put_guest_u32(struct kvm_vcpu *vcpu, u64 guestaddr, | 103 | static inline int put_guest_u32(struct kvm_vcpu *vcpu, unsigned long guestaddr, |
104 | u32 value) | 104 | u32 value) |
105 | { | 105 | { |
106 | void __user *uptr = __guestaddr_to_user(vcpu, guestaddr); | 106 | void __user *uptr = __guestaddr_to_user(vcpu, guestaddr); |
@@ -113,7 +113,7 @@ static inline int put_guest_u32(struct kvm_vcpu *vcpu, u64 guestaddr, | |||
113 | return put_user(value, (u32 __user *) uptr); | 113 | return put_user(value, (u32 __user *) uptr); |
114 | } | 114 | } |
115 | 115 | ||
116 | static inline int put_guest_u16(struct kvm_vcpu *vcpu, u64 guestaddr, | 116 | static inline int put_guest_u16(struct kvm_vcpu *vcpu, unsigned long guestaddr, |
117 | u16 value) | 117 | u16 value) |
118 | { | 118 | { |
119 | void __user *uptr = __guestaddr_to_user(vcpu, guestaddr); | 119 | void __user *uptr = __guestaddr_to_user(vcpu, guestaddr); |
@@ -126,7 +126,7 @@ static inline int put_guest_u16(struct kvm_vcpu *vcpu, u64 guestaddr, | |||
126 | return put_user(value, (u16 __user *) uptr); | 126 | return put_user(value, (u16 __user *) uptr); |
127 | } | 127 | } |
128 | 128 | ||
129 | static inline int put_guest_u8(struct kvm_vcpu *vcpu, u64 guestaddr, | 129 | static inline int put_guest_u8(struct kvm_vcpu *vcpu, unsigned long guestaddr, |
130 | u8 value) | 130 | u8 value) |
131 | { | 131 | { |
132 | void __user *uptr = __guestaddr_to_user(vcpu, guestaddr); | 132 | void __user *uptr = __guestaddr_to_user(vcpu, guestaddr); |
@@ -138,7 +138,8 @@ static inline int put_guest_u8(struct kvm_vcpu *vcpu, u64 guestaddr, | |||
138 | } | 138 | } |
139 | 139 | ||
140 | 140 | ||
141 | static inline int __copy_to_guest_slow(struct kvm_vcpu *vcpu, u64 guestdest, | 141 | static inline int __copy_to_guest_slow(struct kvm_vcpu *vcpu, |
142 | unsigned long guestdest, | ||
142 | const void *from, unsigned long n) | 143 | const void *from, unsigned long n) |
143 | { | 144 | { |
144 | int rc; | 145 | int rc; |
@@ -153,12 +154,12 @@ static inline int __copy_to_guest_slow(struct kvm_vcpu *vcpu, u64 guestdest, | |||
153 | return 0; | 154 | return 0; |
154 | } | 155 | } |
155 | 156 | ||
156 | static inline int copy_to_guest(struct kvm_vcpu *vcpu, u64 guestdest, | 157 | static inline int copy_to_guest(struct kvm_vcpu *vcpu, unsigned long guestdest, |
157 | const void *from, unsigned long n) | 158 | const void *from, unsigned long n) |
158 | { | 159 | { |
159 | u64 prefix = vcpu->arch.sie_block->prefix; | 160 | unsigned long prefix = vcpu->arch.sie_block->prefix; |
160 | u64 origin = vcpu->kvm->arch.guest_origin; | 161 | unsigned long origin = vcpu->kvm->arch.guest_origin; |
161 | u64 memsize = vcpu->kvm->arch.guest_memsize; | 162 | unsigned long memsize = vcpu->kvm->arch.guest_memsize; |
162 | 163 | ||
163 | if ((guestdest < 2 * PAGE_SIZE) && (guestdest + n > 2 * PAGE_SIZE)) | 164 | if ((guestdest < 2 * PAGE_SIZE) && (guestdest + n > 2 * PAGE_SIZE)) |
164 | goto slowpath; | 165 | goto slowpath; |
@@ -189,7 +190,8 @@ slowpath: | |||
189 | } | 190 | } |
190 | 191 | ||
191 | static inline int __copy_from_guest_slow(struct kvm_vcpu *vcpu, void *to, | 192 | static inline int __copy_from_guest_slow(struct kvm_vcpu *vcpu, void *to, |
192 | u64 guestsrc, unsigned long n) | 193 | unsigned long guestsrc, |
194 | unsigned long n) | ||
193 | { | 195 | { |
194 | int rc; | 196 | int rc; |
195 | unsigned long i; | 197 | unsigned long i; |
@@ -204,11 +206,11 @@ static inline int __copy_from_guest_slow(struct kvm_vcpu *vcpu, void *to, | |||
204 | } | 206 | } |
205 | 207 | ||
206 | static inline int copy_from_guest(struct kvm_vcpu *vcpu, void *to, | 208 | static inline int copy_from_guest(struct kvm_vcpu *vcpu, void *to, |
207 | u64 guestsrc, unsigned long n) | 209 | unsigned long guestsrc, unsigned long n) |
208 | { | 210 | { |
209 | u64 prefix = vcpu->arch.sie_block->prefix; | 211 | unsigned long prefix = vcpu->arch.sie_block->prefix; |
210 | u64 origin = vcpu->kvm->arch.guest_origin; | 212 | unsigned long origin = vcpu->kvm->arch.guest_origin; |
211 | u64 memsize = vcpu->kvm->arch.guest_memsize; | 213 | unsigned long memsize = vcpu->kvm->arch.guest_memsize; |
212 | 214 | ||
213 | if ((guestsrc < 2 * PAGE_SIZE) && (guestsrc + n > 2 * PAGE_SIZE)) | 215 | if ((guestsrc < 2 * PAGE_SIZE) && (guestsrc + n > 2 * PAGE_SIZE)) |
214 | goto slowpath; | 216 | goto slowpath; |
@@ -238,11 +240,12 @@ slowpath: | |||
238 | return __copy_from_guest_slow(vcpu, to, guestsrc, n); | 240 | return __copy_from_guest_slow(vcpu, to, guestsrc, n); |
239 | } | 241 | } |
240 | 242 | ||
241 | static inline int copy_to_guest_absolute(struct kvm_vcpu *vcpu, u64 guestdest, | 243 | static inline int copy_to_guest_absolute(struct kvm_vcpu *vcpu, |
244 | unsigned long guestdest, | ||
242 | const void *from, unsigned long n) | 245 | const void *from, unsigned long n) |
243 | { | 246 | { |
244 | u64 origin = vcpu->kvm->arch.guest_origin; | 247 | unsigned long origin = vcpu->kvm->arch.guest_origin; |
245 | u64 memsize = vcpu->kvm->arch.guest_memsize; | 248 | unsigned long memsize = vcpu->kvm->arch.guest_memsize; |
246 | 249 | ||
247 | if (guestdest + n > memsize) | 250 | if (guestdest + n > memsize) |
248 | return -EFAULT; | 251 | return -EFAULT; |
@@ -256,10 +259,11 @@ static inline int copy_to_guest_absolute(struct kvm_vcpu *vcpu, u64 guestdest, | |||
256 | } | 259 | } |
257 | 260 | ||
258 | static inline int copy_from_guest_absolute(struct kvm_vcpu *vcpu, void *to, | 261 | static inline int copy_from_guest_absolute(struct kvm_vcpu *vcpu, void *to, |
259 | u64 guestsrc, unsigned long n) | 262 | unsigned long guestsrc, |
263 | unsigned long n) | ||
260 | { | 264 | { |
261 | u64 origin = vcpu->kvm->arch.guest_origin; | 265 | unsigned long origin = vcpu->kvm->arch.guest_origin; |
262 | u64 memsize = vcpu->kvm->arch.guest_memsize; | 266 | unsigned long memsize = vcpu->kvm->arch.guest_memsize; |
263 | 267 | ||
264 | if (guestsrc + n > memsize) | 268 | if (guestsrc + n > memsize) |
265 | return -EFAULT; | 269 | return -EFAULT; |
diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c index 47a0b642174c..61236102203e 100644 --- a/arch/s390/kvm/intercept.c +++ b/arch/s390/kvm/intercept.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include "kvm-s390.h" | 20 | #include "kvm-s390.h" |
21 | #include "gaccess.h" | 21 | #include "gaccess.h" |
22 | 22 | ||
23 | static int handle_lctg(struct kvm_vcpu *vcpu) | 23 | static int handle_lctlg(struct kvm_vcpu *vcpu) |
24 | { | 24 | { |
25 | int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4; | 25 | int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4; |
26 | int reg3 = vcpu->arch.sie_block->ipa & 0x000f; | 26 | int reg3 = vcpu->arch.sie_block->ipa & 0x000f; |
@@ -30,7 +30,7 @@ static int handle_lctg(struct kvm_vcpu *vcpu) | |||
30 | u64 useraddr; | 30 | u64 useraddr; |
31 | int reg, rc; | 31 | int reg, rc; |
32 | 32 | ||
33 | vcpu->stat.instruction_lctg++; | 33 | vcpu->stat.instruction_lctlg++; |
34 | if ((vcpu->arch.sie_block->ipb & 0xff) != 0x2f) | 34 | if ((vcpu->arch.sie_block->ipb & 0xff) != 0x2f) |
35 | return -ENOTSUPP; | 35 | return -ENOTSUPP; |
36 | 36 | ||
@@ -38,9 +38,12 @@ static int handle_lctg(struct kvm_vcpu *vcpu) | |||
38 | if (base2) | 38 | if (base2) |
39 | useraddr += vcpu->arch.guest_gprs[base2]; | 39 | useraddr += vcpu->arch.guest_gprs[base2]; |
40 | 40 | ||
41 | if (useraddr & 7) | ||
42 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); | ||
43 | |||
41 | reg = reg1; | 44 | reg = reg1; |
42 | 45 | ||
43 | VCPU_EVENT(vcpu, 5, "lctg r1:%x, r3:%x,b2:%x,d2:%x", reg1, reg3, base2, | 46 | VCPU_EVENT(vcpu, 5, "lctlg r1:%x, r3:%x,b2:%x,d2:%x", reg1, reg3, base2, |
44 | disp2); | 47 | disp2); |
45 | 48 | ||
46 | do { | 49 | do { |
@@ -74,6 +77,9 @@ static int handle_lctl(struct kvm_vcpu *vcpu) | |||
74 | if (base2) | 77 | if (base2) |
75 | useraddr += vcpu->arch.guest_gprs[base2]; | 78 | useraddr += vcpu->arch.guest_gprs[base2]; |
76 | 79 | ||
80 | if (useraddr & 3) | ||
81 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); | ||
82 | |||
77 | VCPU_EVENT(vcpu, 5, "lctl r1:%x, r3:%x,b2:%x,d2:%x", reg1, reg3, base2, | 83 | VCPU_EVENT(vcpu, 5, "lctl r1:%x, r3:%x,b2:%x,d2:%x", reg1, reg3, base2, |
78 | disp2); | 84 | disp2); |
79 | 85 | ||
@@ -99,7 +105,7 @@ static intercept_handler_t instruction_handlers[256] = { | |||
99 | [0xae] = kvm_s390_handle_sigp, | 105 | [0xae] = kvm_s390_handle_sigp, |
100 | [0xb2] = kvm_s390_handle_priv, | 106 | [0xb2] = kvm_s390_handle_priv, |
101 | [0xb7] = handle_lctl, | 107 | [0xb7] = handle_lctl, |
102 | [0xeb] = handle_lctg, | 108 | [0xeb] = handle_lctlg, |
103 | }; | 109 | }; |
104 | 110 | ||
105 | static int handle_noop(struct kvm_vcpu *vcpu) | 111 | static int handle_noop(struct kvm_vcpu *vcpu) |
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c index 11230b0db957..2960702b4824 100644 --- a/arch/s390/kvm/interrupt.c +++ b/arch/s390/kvm/interrupt.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <asm/lowcore.h> | 13 | #include <asm/lowcore.h> |
14 | #include <asm/uaccess.h> | 14 | #include <asm/uaccess.h> |
15 | #include <linux/kvm_host.h> | 15 | #include <linux/kvm_host.h> |
16 | #include <linux/signal.h> | ||
16 | #include "kvm-s390.h" | 17 | #include "kvm-s390.h" |
17 | #include "gaccess.h" | 18 | #include "gaccess.h" |
18 | 19 | ||
@@ -246,15 +247,10 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu, | |||
246 | default: | 247 | default: |
247 | BUG(); | 248 | BUG(); |
248 | } | 249 | } |
249 | |||
250 | if (exception) { | 250 | if (exception) { |
251 | VCPU_EVENT(vcpu, 1, "%s", "program exception while delivering" | 251 | printk("kvm: The guest lowcore is not mapped during interrupt " |
252 | " interrupt"); | 252 | "delivery, killing userspace\n"); |
253 | kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); | 253 | do_exit(SIGKILL); |
254 | if (inti->type == KVM_S390_PROGRAM_INT) { | ||
255 | printk(KERN_WARNING "kvm: recursive program check\n"); | ||
256 | BUG(); | ||
257 | } | ||
258 | } | 254 | } |
259 | } | 255 | } |
260 | 256 | ||
@@ -277,14 +273,11 @@ static int __try_deliver_ckc_interrupt(struct kvm_vcpu *vcpu) | |||
277 | __LC_EXT_NEW_PSW, sizeof(psw_t)); | 273 | __LC_EXT_NEW_PSW, sizeof(psw_t)); |
278 | if (rc == -EFAULT) | 274 | if (rc == -EFAULT) |
279 | exception = 1; | 275 | exception = 1; |
280 | |||
281 | if (exception) { | 276 | if (exception) { |
282 | VCPU_EVENT(vcpu, 1, "%s", "program exception while delivering" \ | 277 | printk("kvm: The guest lowcore is not mapped during interrupt " |
283 | " ckc interrupt"); | 278 | "delivery, killing userspace\n"); |
284 | kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); | 279 | do_exit(SIGKILL); |
285 | return 0; | ||
286 | } | 280 | } |
287 | |||
288 | return 1; | 281 | return 1; |
289 | } | 282 | } |
290 | 283 | ||
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 1782cbcd2829..8b00eb2ddf57 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -39,7 +39,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { | |||
39 | { "exit_instruction", VCPU_STAT(exit_instruction) }, | 39 | { "exit_instruction", VCPU_STAT(exit_instruction) }, |
40 | { "exit_program_interruption", VCPU_STAT(exit_program_interruption) }, | 40 | { "exit_program_interruption", VCPU_STAT(exit_program_interruption) }, |
41 | { "exit_instr_and_program_int", VCPU_STAT(exit_instr_and_program) }, | 41 | { "exit_instr_and_program_int", VCPU_STAT(exit_instr_and_program) }, |
42 | { "instruction_lctg", VCPU_STAT(instruction_lctg) }, | 42 | { "instruction_lctlg", VCPU_STAT(instruction_lctlg) }, |
43 | { "instruction_lctl", VCPU_STAT(instruction_lctl) }, | 43 | { "instruction_lctl", VCPU_STAT(instruction_lctl) }, |
44 | { "deliver_emergency_signal", VCPU_STAT(deliver_emergency_signal) }, | 44 | { "deliver_emergency_signal", VCPU_STAT(deliver_emergency_signal) }, |
45 | { "deliver_service_signal", VCPU_STAT(deliver_service_signal) }, | 45 | { "deliver_service_signal", VCPU_STAT(deliver_service_signal) }, |
@@ -112,7 +112,12 @@ long kvm_arch_dev_ioctl(struct file *filp, | |||
112 | 112 | ||
113 | int kvm_dev_ioctl_check_extension(long ext) | 113 | int kvm_dev_ioctl_check_extension(long ext) |
114 | { | 114 | { |
115 | return 0; | 115 | switch (ext) { |
116 | case KVM_CAP_USER_MEMORY: | ||
117 | return 1; | ||
118 | default: | ||
119 | return 0; | ||
120 | } | ||
116 | } | 121 | } |
117 | 122 | ||
118 | /* Section: vm related */ | 123 | /* Section: vm related */ |
diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c index 5a556114eaa5..170392687ce0 100644 --- a/arch/s390/kvm/sigp.c +++ b/arch/s390/kvm/sigp.c | |||
@@ -43,7 +43,8 @@ | |||
43 | #define SIGP_STAT_RECEIVER_CHECK 0x00000001UL | 43 | #define SIGP_STAT_RECEIVER_CHECK 0x00000001UL |
44 | 44 | ||
45 | 45 | ||
46 | static int __sigp_sense(struct kvm_vcpu *vcpu, u16 cpu_addr, u64 *reg) | 46 | static int __sigp_sense(struct kvm_vcpu *vcpu, u16 cpu_addr, |
47 | unsigned long *reg) | ||
47 | { | 48 | { |
48 | struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int; | 49 | struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int; |
49 | int rc; | 50 | int rc; |
@@ -167,7 +168,7 @@ static int __sigp_set_arch(struct kvm_vcpu *vcpu, u32 parameter) | |||
167 | } | 168 | } |
168 | 169 | ||
169 | static int __sigp_set_prefix(struct kvm_vcpu *vcpu, u16 cpu_addr, u32 address, | 170 | static int __sigp_set_prefix(struct kvm_vcpu *vcpu, u16 cpu_addr, u32 address, |
170 | u64 *reg) | 171 | unsigned long *reg) |
171 | { | 172 | { |
172 | struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int; | 173 | struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int; |
173 | struct kvm_s390_local_interrupt *li; | 174 | struct kvm_s390_local_interrupt *li; |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index b0e4ddca6c18..2fa231923cf7 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -1814,6 +1814,7 @@ int kvm_mmu_unprotect_page_virt(struct kvm_vcpu *vcpu, gva_t gva) | |||
1814 | spin_unlock(&vcpu->kvm->mmu_lock); | 1814 | spin_unlock(&vcpu->kvm->mmu_lock); |
1815 | return r; | 1815 | return r; |
1816 | } | 1816 | } |
1817 | EXPORT_SYMBOL_GPL(kvm_mmu_unprotect_page_virt); | ||
1817 | 1818 | ||
1818 | void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu) | 1819 | void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu) |
1819 | { | 1820 | { |
@@ -1870,6 +1871,12 @@ void kvm_enable_tdp(void) | |||
1870 | } | 1871 | } |
1871 | EXPORT_SYMBOL_GPL(kvm_enable_tdp); | 1872 | EXPORT_SYMBOL_GPL(kvm_enable_tdp); |
1872 | 1873 | ||
1874 | void kvm_disable_tdp(void) | ||
1875 | { | ||
1876 | tdp_enabled = false; | ||
1877 | } | ||
1878 | EXPORT_SYMBOL_GPL(kvm_disable_tdp); | ||
1879 | |||
1873 | static void free_mmu_pages(struct kvm_vcpu *vcpu) | 1880 | static void free_mmu_pages(struct kvm_vcpu *vcpu) |
1874 | { | 1881 | { |
1875 | struct kvm_mmu_page *sp; | 1882 | struct kvm_mmu_page *sp; |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index b756e876dce3..e2ee264740c7 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -453,7 +453,8 @@ static __init int svm_hardware_setup(void) | |||
453 | if (npt_enabled) { | 453 | if (npt_enabled) { |
454 | printk(KERN_INFO "kvm: Nested Paging enabled\n"); | 454 | printk(KERN_INFO "kvm: Nested Paging enabled\n"); |
455 | kvm_enable_tdp(); | 455 | kvm_enable_tdp(); |
456 | } | 456 | } else |
457 | kvm_disable_tdp(); | ||
457 | 458 | ||
458 | return 0; | 459 | return 0; |
459 | 460 | ||
@@ -1007,10 +1008,13 @@ static int pf_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run) | |||
1007 | struct kvm *kvm = svm->vcpu.kvm; | 1008 | struct kvm *kvm = svm->vcpu.kvm; |
1008 | u64 fault_address; | 1009 | u64 fault_address; |
1009 | u32 error_code; | 1010 | u32 error_code; |
1011 | bool event_injection = false; | ||
1010 | 1012 | ||
1011 | if (!irqchip_in_kernel(kvm) && | 1013 | if (!irqchip_in_kernel(kvm) && |
1012 | is_external_interrupt(exit_int_info)) | 1014 | is_external_interrupt(exit_int_info)) { |
1015 | event_injection = true; | ||
1013 | push_irq(&svm->vcpu, exit_int_info & SVM_EVTINJ_VEC_MASK); | 1016 | push_irq(&svm->vcpu, exit_int_info & SVM_EVTINJ_VEC_MASK); |
1017 | } | ||
1014 | 1018 | ||
1015 | fault_address = svm->vmcb->control.exit_info_2; | 1019 | fault_address = svm->vmcb->control.exit_info_2; |
1016 | error_code = svm->vmcb->control.exit_info_1; | 1020 | error_code = svm->vmcb->control.exit_info_1; |
@@ -1024,6 +1028,8 @@ static int pf_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run) | |||
1024 | (u32)fault_address, (u32)(fault_address >> 32), | 1028 | (u32)fault_address, (u32)(fault_address >> 32), |
1025 | handler); | 1029 | handler); |
1026 | 1030 | ||
1031 | if (event_injection) | ||
1032 | kvm_mmu_unprotect_page_virt(&svm->vcpu, fault_address); | ||
1027 | return kvm_mmu_page_fault(&svm->vcpu, fault_address, error_code); | 1033 | return kvm_mmu_page_fault(&svm->vcpu, fault_address, error_code); |
1028 | } | 1034 | } |
1029 | 1035 | ||
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 0cac63701719..2a69773e3b26 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -2298,6 +2298,8 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
2298 | cr2 = vmcs_readl(EXIT_QUALIFICATION); | 2298 | cr2 = vmcs_readl(EXIT_QUALIFICATION); |
2299 | KVMTRACE_3D(PAGE_FAULT, vcpu, error_code, (u32)cr2, | 2299 | KVMTRACE_3D(PAGE_FAULT, vcpu, error_code, (u32)cr2, |
2300 | (u32)((u64)cr2 >> 32), handler); | 2300 | (u32)((u64)cr2 >> 32), handler); |
2301 | if (vect_info & VECTORING_INFO_VALID_MASK) | ||
2302 | kvm_mmu_unprotect_page_virt(vcpu, cr2); | ||
2301 | return kvm_mmu_page_fault(vcpu, cr2, error_code); | 2303 | return kvm_mmu_page_fault(vcpu, cr2, error_code); |
2302 | } | 2304 | } |
2303 | 2305 | ||
@@ -3116,15 +3118,6 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id) | |||
3116 | return ERR_PTR(-ENOMEM); | 3118 | return ERR_PTR(-ENOMEM); |
3117 | 3119 | ||
3118 | allocate_vpid(vmx); | 3120 | allocate_vpid(vmx); |
3119 | if (id == 0 && vm_need_ept()) { | ||
3120 | kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK | | ||
3121 | VMX_EPT_WRITABLE_MASK | | ||
3122 | VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT); | ||
3123 | kvm_mmu_set_mask_ptes(0ull, VMX_EPT_FAKE_ACCESSED_MASK, | ||
3124 | VMX_EPT_FAKE_DIRTY_MASK, 0ull, | ||
3125 | VMX_EPT_EXECUTABLE_MASK); | ||
3126 | kvm_enable_tdp(); | ||
3127 | } | ||
3128 | 3121 | ||
3129 | err = kvm_vcpu_init(&vmx->vcpu, kvm, id); | 3122 | err = kvm_vcpu_init(&vmx->vcpu, kvm, id); |
3130 | if (err) | 3123 | if (err) |
@@ -3303,8 +3296,17 @@ static int __init vmx_init(void) | |||
3303 | vmx_disable_intercept_for_msr(vmx_msr_bitmap, MSR_IA32_SYSENTER_ESP); | 3296 | vmx_disable_intercept_for_msr(vmx_msr_bitmap, MSR_IA32_SYSENTER_ESP); |
3304 | vmx_disable_intercept_for_msr(vmx_msr_bitmap, MSR_IA32_SYSENTER_EIP); | 3297 | vmx_disable_intercept_for_msr(vmx_msr_bitmap, MSR_IA32_SYSENTER_EIP); |
3305 | 3298 | ||
3306 | if (cpu_has_vmx_ept()) | 3299 | if (vm_need_ept()) { |
3307 | bypass_guest_pf = 0; | 3300 | bypass_guest_pf = 0; |
3301 | kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK | | ||
3302 | VMX_EPT_WRITABLE_MASK | | ||
3303 | VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT); | ||
3304 | kvm_mmu_set_mask_ptes(0ull, VMX_EPT_FAKE_ACCESSED_MASK, | ||
3305 | VMX_EPT_FAKE_DIRTY_MASK, 0ull, | ||
3306 | VMX_EPT_EXECUTABLE_MASK); | ||
3307 | kvm_enable_tdp(); | ||
3308 | } else | ||
3309 | kvm_disable_tdp(); | ||
3308 | 3310 | ||
3309 | if (bypass_guest_pf) | 3311 | if (bypass_guest_pf) |
3310 | kvm_mmu_set_nonpresent_ptes(~0xffeull, 0ull); | 3312 | kvm_mmu_set_nonpresent_ptes(~0xffeull, 0ull); |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 9f1cdb011cff..5916191420c7 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -3184,6 +3184,10 @@ static void seg_desct_to_kvm_desct(struct desc_struct *seg_desc, u16 selector, | |||
3184 | kvm_desct->base |= seg_desc->base2 << 24; | 3184 | kvm_desct->base |= seg_desc->base2 << 24; |
3185 | kvm_desct->limit = seg_desc->limit0; | 3185 | kvm_desct->limit = seg_desc->limit0; |
3186 | kvm_desct->limit |= seg_desc->limit << 16; | 3186 | kvm_desct->limit |= seg_desc->limit << 16; |
3187 | if (seg_desc->g) { | ||
3188 | kvm_desct->limit <<= 12; | ||
3189 | kvm_desct->limit |= 0xfff; | ||
3190 | } | ||
3187 | kvm_desct->selector = selector; | 3191 | kvm_desct->selector = selector; |
3188 | kvm_desct->type = seg_desc->type; | 3192 | kvm_desct->type = seg_desc->type; |
3189 | kvm_desct->present = seg_desc->p; | 3193 | kvm_desct->present = seg_desc->p; |
@@ -3223,6 +3227,7 @@ static void get_segment_descritptor_dtable(struct kvm_vcpu *vcpu, | |||
3223 | static int load_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, | 3227 | static int load_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, |
3224 | struct desc_struct *seg_desc) | 3228 | struct desc_struct *seg_desc) |
3225 | { | 3229 | { |
3230 | gpa_t gpa; | ||
3226 | struct descriptor_table dtable; | 3231 | struct descriptor_table dtable; |
3227 | u16 index = selector >> 3; | 3232 | u16 index = selector >> 3; |
3228 | 3233 | ||
@@ -3232,13 +3237,16 @@ static int load_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, | |||
3232 | kvm_queue_exception_e(vcpu, GP_VECTOR, selector & 0xfffc); | 3237 | kvm_queue_exception_e(vcpu, GP_VECTOR, selector & 0xfffc); |
3233 | return 1; | 3238 | return 1; |
3234 | } | 3239 | } |
3235 | return kvm_read_guest(vcpu->kvm, dtable.base + index * 8, seg_desc, 8); | 3240 | gpa = vcpu->arch.mmu.gva_to_gpa(vcpu, dtable.base); |
3241 | gpa += index * 8; | ||
3242 | return kvm_read_guest(vcpu->kvm, gpa, seg_desc, 8); | ||
3236 | } | 3243 | } |
3237 | 3244 | ||
3238 | /* allowed just for 8 bytes segments */ | 3245 | /* allowed just for 8 bytes segments */ |
3239 | static int save_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, | 3246 | static int save_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, |
3240 | struct desc_struct *seg_desc) | 3247 | struct desc_struct *seg_desc) |
3241 | { | 3248 | { |
3249 | gpa_t gpa; | ||
3242 | struct descriptor_table dtable; | 3250 | struct descriptor_table dtable; |
3243 | u16 index = selector >> 3; | 3251 | u16 index = selector >> 3; |
3244 | 3252 | ||
@@ -3246,7 +3254,9 @@ static int save_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, | |||
3246 | 3254 | ||
3247 | if (dtable.limit < index * 8 + 7) | 3255 | if (dtable.limit < index * 8 + 7) |
3248 | return 1; | 3256 | return 1; |
3249 | return kvm_write_guest(vcpu->kvm, dtable.base + index * 8, seg_desc, 8); | 3257 | gpa = vcpu->arch.mmu.gva_to_gpa(vcpu, dtable.base); |
3258 | gpa += index * 8; | ||
3259 | return kvm_write_guest(vcpu->kvm, gpa, seg_desc, 8); | ||
3250 | } | 3260 | } |
3251 | 3261 | ||
3252 | static u32 get_tss_base_addr(struct kvm_vcpu *vcpu, | 3262 | static u32 get_tss_base_addr(struct kvm_vcpu *vcpu, |
@@ -3258,55 +3268,7 @@ static u32 get_tss_base_addr(struct kvm_vcpu *vcpu, | |||
3258 | base_addr |= (seg_desc->base1 << 16); | 3268 | base_addr |= (seg_desc->base1 << 16); |
3259 | base_addr |= (seg_desc->base2 << 24); | 3269 | base_addr |= (seg_desc->base2 << 24); |
3260 | 3270 | ||
3261 | return base_addr; | 3271 | return vcpu->arch.mmu.gva_to_gpa(vcpu, base_addr); |
3262 | } | ||
3263 | |||
3264 | static int load_tss_segment32(struct kvm_vcpu *vcpu, | ||
3265 | struct desc_struct *seg_desc, | ||
3266 | struct tss_segment_32 *tss) | ||
3267 | { | ||
3268 | u32 base_addr; | ||
3269 | |||
3270 | base_addr = get_tss_base_addr(vcpu, seg_desc); | ||
3271 | |||
3272 | return kvm_read_guest(vcpu->kvm, base_addr, tss, | ||
3273 | sizeof(struct tss_segment_32)); | ||
3274 | } | ||
3275 | |||
3276 | static int save_tss_segment32(struct kvm_vcpu *vcpu, | ||
3277 | struct desc_struct *seg_desc, | ||
3278 | struct tss_segment_32 *tss) | ||
3279 | { | ||
3280 | u32 base_addr; | ||
3281 | |||
3282 | base_addr = get_tss_base_addr(vcpu, seg_desc); | ||
3283 | |||
3284 | return kvm_write_guest(vcpu->kvm, base_addr, tss, | ||
3285 | sizeof(struct tss_segment_32)); | ||
3286 | } | ||
3287 | |||
3288 | static int load_tss_segment16(struct kvm_vcpu *vcpu, | ||
3289 | struct desc_struct *seg_desc, | ||
3290 | struct tss_segment_16 *tss) | ||
3291 | { | ||
3292 | u32 base_addr; | ||
3293 | |||
3294 | base_addr = get_tss_base_addr(vcpu, seg_desc); | ||
3295 | |||
3296 | return kvm_read_guest(vcpu->kvm, base_addr, tss, | ||
3297 | sizeof(struct tss_segment_16)); | ||
3298 | } | ||
3299 | |||
3300 | static int save_tss_segment16(struct kvm_vcpu *vcpu, | ||
3301 | struct desc_struct *seg_desc, | ||
3302 | struct tss_segment_16 *tss) | ||
3303 | { | ||
3304 | u32 base_addr; | ||
3305 | |||
3306 | base_addr = get_tss_base_addr(vcpu, seg_desc); | ||
3307 | |||
3308 | return kvm_write_guest(vcpu->kvm, base_addr, tss, | ||
3309 | sizeof(struct tss_segment_16)); | ||
3310 | } | 3272 | } |
3311 | 3273 | ||
3312 | static u16 get_segment_selector(struct kvm_vcpu *vcpu, int seg) | 3274 | static u16 get_segment_selector(struct kvm_vcpu *vcpu, int seg) |
@@ -3466,20 +3428,26 @@ static int load_state_from_tss16(struct kvm_vcpu *vcpu, | |||
3466 | } | 3428 | } |
3467 | 3429 | ||
3468 | static int kvm_task_switch_16(struct kvm_vcpu *vcpu, u16 tss_selector, | 3430 | static int kvm_task_switch_16(struct kvm_vcpu *vcpu, u16 tss_selector, |
3469 | struct desc_struct *cseg_desc, | 3431 | u32 old_tss_base, |
3470 | struct desc_struct *nseg_desc) | 3432 | struct desc_struct *nseg_desc) |
3471 | { | 3433 | { |
3472 | struct tss_segment_16 tss_segment_16; | 3434 | struct tss_segment_16 tss_segment_16; |
3473 | int ret = 0; | 3435 | int ret = 0; |
3474 | 3436 | ||
3475 | if (load_tss_segment16(vcpu, cseg_desc, &tss_segment_16)) | 3437 | if (kvm_read_guest(vcpu->kvm, old_tss_base, &tss_segment_16, |
3438 | sizeof tss_segment_16)) | ||
3476 | goto out; | 3439 | goto out; |
3477 | 3440 | ||
3478 | save_state_to_tss16(vcpu, &tss_segment_16); | 3441 | save_state_to_tss16(vcpu, &tss_segment_16); |
3479 | save_tss_segment16(vcpu, cseg_desc, &tss_segment_16); | ||
3480 | 3442 | ||
3481 | if (load_tss_segment16(vcpu, nseg_desc, &tss_segment_16)) | 3443 | if (kvm_write_guest(vcpu->kvm, old_tss_base, &tss_segment_16, |
3444 | sizeof tss_segment_16)) | ||
3482 | goto out; | 3445 | goto out; |
3446 | |||
3447 | if (kvm_read_guest(vcpu->kvm, get_tss_base_addr(vcpu, nseg_desc), | ||
3448 | &tss_segment_16, sizeof tss_segment_16)) | ||
3449 | goto out; | ||
3450 | |||
3483 | if (load_state_from_tss16(vcpu, &tss_segment_16)) | 3451 | if (load_state_from_tss16(vcpu, &tss_segment_16)) |
3484 | goto out; | 3452 | goto out; |
3485 | 3453 | ||
@@ -3489,20 +3457,26 @@ out: | |||
3489 | } | 3457 | } |
3490 | 3458 | ||
3491 | static int kvm_task_switch_32(struct kvm_vcpu *vcpu, u16 tss_selector, | 3459 | static int kvm_task_switch_32(struct kvm_vcpu *vcpu, u16 tss_selector, |
3492 | struct desc_struct *cseg_desc, | 3460 | u32 old_tss_base, |
3493 | struct desc_struct *nseg_desc) | 3461 | struct desc_struct *nseg_desc) |
3494 | { | 3462 | { |
3495 | struct tss_segment_32 tss_segment_32; | 3463 | struct tss_segment_32 tss_segment_32; |
3496 | int ret = 0; | 3464 | int ret = 0; |
3497 | 3465 | ||
3498 | if (load_tss_segment32(vcpu, cseg_desc, &tss_segment_32)) | 3466 | if (kvm_read_guest(vcpu->kvm, old_tss_base, &tss_segment_32, |
3467 | sizeof tss_segment_32)) | ||
3499 | goto out; | 3468 | goto out; |
3500 | 3469 | ||
3501 | save_state_to_tss32(vcpu, &tss_segment_32); | 3470 | save_state_to_tss32(vcpu, &tss_segment_32); |
3502 | save_tss_segment32(vcpu, cseg_desc, &tss_segment_32); | ||
3503 | 3471 | ||
3504 | if (load_tss_segment32(vcpu, nseg_desc, &tss_segment_32)) | 3472 | if (kvm_write_guest(vcpu->kvm, old_tss_base, &tss_segment_32, |
3473 | sizeof tss_segment_32)) | ||
3474 | goto out; | ||
3475 | |||
3476 | if (kvm_read_guest(vcpu->kvm, get_tss_base_addr(vcpu, nseg_desc), | ||
3477 | &tss_segment_32, sizeof tss_segment_32)) | ||
3505 | goto out; | 3478 | goto out; |
3479 | |||
3506 | if (load_state_from_tss32(vcpu, &tss_segment_32)) | 3480 | if (load_state_from_tss32(vcpu, &tss_segment_32)) |
3507 | goto out; | 3481 | goto out; |
3508 | 3482 | ||
@@ -3517,16 +3491,20 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason) | |||
3517 | struct desc_struct cseg_desc; | 3491 | struct desc_struct cseg_desc; |
3518 | struct desc_struct nseg_desc; | 3492 | struct desc_struct nseg_desc; |
3519 | int ret = 0; | 3493 | int ret = 0; |
3494 | u32 old_tss_base = get_segment_base(vcpu, VCPU_SREG_TR); | ||
3495 | u16 old_tss_sel = get_segment_selector(vcpu, VCPU_SREG_TR); | ||
3520 | 3496 | ||
3521 | kvm_get_segment(vcpu, &tr_seg, VCPU_SREG_TR); | 3497 | old_tss_base = vcpu->arch.mmu.gva_to_gpa(vcpu, old_tss_base); |
3522 | 3498 | ||
3499 | /* FIXME: Handle errors. Failure to read either TSS or their | ||
3500 | * descriptors should generate a pagefault. | ||
3501 | */ | ||
3523 | if (load_guest_segment_descriptor(vcpu, tss_selector, &nseg_desc)) | 3502 | if (load_guest_segment_descriptor(vcpu, tss_selector, &nseg_desc)) |
3524 | goto out; | 3503 | goto out; |
3525 | 3504 | ||
3526 | if (load_guest_segment_descriptor(vcpu, tr_seg.selector, &cseg_desc)) | 3505 | if (load_guest_segment_descriptor(vcpu, old_tss_sel, &cseg_desc)) |
3527 | goto out; | 3506 | goto out; |
3528 | 3507 | ||
3529 | |||
3530 | if (reason != TASK_SWITCH_IRET) { | 3508 | if (reason != TASK_SWITCH_IRET) { |
3531 | int cpl; | 3509 | int cpl; |
3532 | 3510 | ||
@@ -3544,8 +3522,7 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason) | |||
3544 | 3522 | ||
3545 | if (reason == TASK_SWITCH_IRET || reason == TASK_SWITCH_JMP) { | 3523 | if (reason == TASK_SWITCH_IRET || reason == TASK_SWITCH_JMP) { |
3546 | cseg_desc.type &= ~(1 << 1); //clear the B flag | 3524 | cseg_desc.type &= ~(1 << 1); //clear the B flag |
3547 | save_guest_segment_descriptor(vcpu, tr_seg.selector, | 3525 | save_guest_segment_descriptor(vcpu, old_tss_sel, &cseg_desc); |
3548 | &cseg_desc); | ||
3549 | } | 3526 | } |
3550 | 3527 | ||
3551 | if (reason == TASK_SWITCH_IRET) { | 3528 | if (reason == TASK_SWITCH_IRET) { |
@@ -3557,10 +3534,10 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason) | |||
3557 | kvm_x86_ops->cache_regs(vcpu); | 3534 | kvm_x86_ops->cache_regs(vcpu); |
3558 | 3535 | ||
3559 | if (nseg_desc.type & 8) | 3536 | if (nseg_desc.type & 8) |
3560 | ret = kvm_task_switch_32(vcpu, tss_selector, &cseg_desc, | 3537 | ret = kvm_task_switch_32(vcpu, tss_selector, old_tss_base, |
3561 | &nseg_desc); | 3538 | &nseg_desc); |
3562 | else | 3539 | else |
3563 | ret = kvm_task_switch_16(vcpu, tss_selector, &cseg_desc, | 3540 | ret = kvm_task_switch_16(vcpu, tss_selector, old_tss_base, |
3564 | &nseg_desc); | 3541 | &nseg_desc); |
3565 | 3542 | ||
3566 | if (reason == TASK_SWITCH_CALL || reason == TASK_SWITCH_GATE) { | 3543 | if (reason == TASK_SWITCH_CALL || reason == TASK_SWITCH_GATE) { |