aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-07-15 18:29:07 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-15 18:29:07 -0400
commit82638844d9a8581bbf33201cc209a14876eca167 (patch)
tree961d7f9360194421a71aa644a9d0c176a960ce49 /include/linux
parent9982fbface82893e77d211fbabfbd229da6bdde6 (diff)
parent63cf13b77ab785e87c867defa8545e6d4a989774 (diff)
Merge branch 'linus' into cpus4096
Conflicts: arch/x86/xen/smp.c kernel/sched_rt.c net/iucv/iucv.c Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/acpi.h6
-rw-r--r--include/linux/bio.h130
-rw-r--r--include/linux/blkdev.h164
-rw-r--r--include/linux/blktrace_api.h1
-rw-r--r--include/linux/bootmem.h2
-rw-r--r--include/linux/console.h2
-rw-r--r--include/linux/crypto.h48
-rw-r--r--include/linux/dcache.h1
-rw-r--r--include/linux/delay.h1
-rw-r--r--include/linux/efi.h4
-rw-r--r--include/linux/firmware-map.h74
-rw-r--r--include/linux/firmware.h23
-rw-r--r--include/linux/fs.h5
-rw-r--r--include/linux/ftrace.h144
-rw-r--r--include/linux/genhd.h12
-rw-r--r--include/linux/i2c-algo-pcf.h8
-rw-r--r--include/linux/i2c-id.h3
-rw-r--r--include/linux/i2c.h46
-rw-r--r--include/linux/i2c/at24.h28
-rw-r--r--include/linux/ide.h70
-rw-r--r--include/linux/ihex.h74
-rw-r--r--include/linux/interrupt.h8
-rw-r--r--include/linux/iocontext.h18
-rw-r--r--include/linux/irq.h9
-rw-r--r--include/linux/irqflags.h13
-rw-r--r--include/linux/jbd2.h73
-rw-r--r--include/linux/kernel.h8
-rw-r--r--include/linux/kernel_stat.h2
-rw-r--r--include/linux/kprobes.h4
-rw-r--r--include/linux/libata.h55
-rw-r--r--include/linux/linkage.h6
-rw-r--r--include/linux/list.h367
-rw-r--r--include/linux/lm_interface.h6
-rw-r--r--include/linux/lockdep.h11
-rw-r--r--include/linux/marker.h40
-rw-r--r--include/linux/mlx4/device.h3
-rw-r--r--include/linux/mm.h7
-rw-r--r--include/linux/mmiotrace.h85
-rw-r--r--include/linux/mod_devicetable.h9
-rw-r--r--include/linux/mpage.h10
-rw-r--r--include/linux/page-flags.h1
-rw-r--r--include/linux/pageblock-flags.h8
-rw-r--r--include/linux/percpu_counter.h12
-rw-r--r--include/linux/preempt.h34
-rw-r--r--include/linux/ptrace.h8
-rw-r--r--include/linux/pwm.h31
-rw-r--r--include/linux/pwm_backlight.h17
-rw-r--r--include/linux/rcuclassic.h3
-rw-r--r--include/linux/rculist.h369
-rw-r--r--include/linux/rcupdate.h26
-rw-r--r--include/linux/rcupreempt.h42
-rw-r--r--include/linux/resume-trace.h2
-rw-r--r--include/linux/sched.h77
-rw-r--r--include/linux/security.h49
-rw-r--r--include/linux/smp.h46
-rw-r--r--include/linux/smp_lock.h13
-rw-r--r--include/linux/topology.h13
-rw-r--r--include/linux/writeback.h3
-rw-r--r--include/linux/xfrm.h1
59 files changed, 1720 insertions, 615 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 41f7ce7edd7a..0601075d09a1 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -82,6 +82,7 @@ char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
82int early_acpi_boot_init(void); 82int early_acpi_boot_init(void);
83int acpi_boot_init (void); 83int acpi_boot_init (void);
84int acpi_boot_table_init (void); 84int acpi_boot_table_init (void);
85int acpi_mps_check (void);
85int acpi_numa_init (void); 86int acpi_numa_init (void);
86 87
87int acpi_table_init (void); 88int acpi_table_init (void);
@@ -250,6 +251,11 @@ static inline int acpi_boot_table_init(void)
250 return 0; 251 return 0;
251} 252}
252 253
254static inline int acpi_mps_check(void)
255{
256 return 0;
257}
258
253static inline int acpi_check_resource_conflict(struct resource *res) 259static inline int acpi_check_resource_conflict(struct resource *res)
254{ 260{
255 return 0; 261 return 0;
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 61c15eaf3fb3..0933a14e6414 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -64,6 +64,7 @@ struct bio_vec {
64 64
65struct bio_set; 65struct bio_set;
66struct bio; 66struct bio;
67struct bio_integrity_payload;
67typedef void (bio_end_io_t) (struct bio *, int); 68typedef void (bio_end_io_t) (struct bio *, int);
68typedef void (bio_destructor_t) (struct bio *); 69typedef void (bio_destructor_t) (struct bio *);
69 70
@@ -112,6 +113,9 @@ struct bio {
112 atomic_t bi_cnt; /* pin count */ 113 atomic_t bi_cnt; /* pin count */
113 114
114 void *bi_private; 115 void *bi_private;
116#if defined(CONFIG_BLK_DEV_INTEGRITY)
117 struct bio_integrity_payload *bi_integrity; /* data integrity */
118#endif
115 119
116 bio_destructor_t *bi_destructor; /* destructor */ 120 bio_destructor_t *bi_destructor; /* destructor */
117}; 121};
@@ -271,6 +275,29 @@ static inline void *bio_data(struct bio *bio)
271 */ 275 */
272#define bio_get(bio) atomic_inc(&(bio)->bi_cnt) 276#define bio_get(bio) atomic_inc(&(bio)->bi_cnt)
273 277
278#if defined(CONFIG_BLK_DEV_INTEGRITY)
279/*
280 * bio integrity payload
281 */
282struct bio_integrity_payload {
283 struct bio *bip_bio; /* parent bio */
284 struct bio_vec *bip_vec; /* integrity data vector */
285
286 sector_t bip_sector; /* virtual start sector */
287
288 void *bip_buf; /* generated integrity data */
289 bio_end_io_t *bip_end_io; /* saved I/O completion fn */
290
291 int bip_error; /* saved I/O error */
292 unsigned int bip_size;
293
294 unsigned short bip_pool; /* pool the ivec came from */
295 unsigned short bip_vcnt; /* # of integrity bio_vecs */
296 unsigned short bip_idx; /* current bip_vec index */
297
298 struct work_struct bip_work; /* I/O completion */
299};
300#endif /* CONFIG_BLK_DEV_INTEGRITY */
274 301
275/* 302/*
276 * A bio_pair is used when we need to split a bio. 303 * A bio_pair is used when we need to split a bio.
@@ -283,10 +310,14 @@ static inline void *bio_data(struct bio *bio)
283 * in bio2.bi_private 310 * in bio2.bi_private
284 */ 311 */
285struct bio_pair { 312struct bio_pair {
286 struct bio bio1, bio2; 313 struct bio bio1, bio2;
287 struct bio_vec bv1, bv2; 314 struct bio_vec bv1, bv2;
288 atomic_t cnt; 315#if defined(CONFIG_BLK_DEV_INTEGRITY)
289 int error; 316 struct bio_integrity_payload bip1, bip2;
317 struct bio_vec iv1, iv2;
318#endif
319 atomic_t cnt;
320 int error;
290}; 321};
291extern struct bio_pair *bio_split(struct bio *bi, mempool_t *pool, 322extern struct bio_pair *bio_split(struct bio *bi, mempool_t *pool,
292 int first_sectors); 323 int first_sectors);
@@ -333,6 +364,39 @@ extern struct bio *bio_copy_user_iov(struct request_queue *, struct sg_iovec *,
333 int, int); 364 int, int);
334extern int bio_uncopy_user(struct bio *); 365extern int bio_uncopy_user(struct bio *);
335void zero_fill_bio(struct bio *bio); 366void zero_fill_bio(struct bio *bio);
367extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set *);
368extern unsigned int bvec_nr_vecs(unsigned short idx);
369
370/*
371 * bio_set is used to allow other portions of the IO system to
372 * allocate their own private memory pools for bio and iovec structures.
373 * These memory pools in turn all allocate from the bio_slab
374 * and the bvec_slabs[].
375 */
376#define BIO_POOL_SIZE 2
377#define BIOVEC_NR_POOLS 6
378
379struct bio_set {
380 mempool_t *bio_pool;
381#if defined(CONFIG_BLK_DEV_INTEGRITY)
382 mempool_t *bio_integrity_pool;
383#endif
384 mempool_t *bvec_pools[BIOVEC_NR_POOLS];
385};
386
387struct biovec_slab {
388 int nr_vecs;
389 char *name;
390 struct kmem_cache *slab;
391};
392
393extern struct bio_set *fs_bio_set;
394
395/*
396 * a small number of entries is fine, not going to be performance critical.
397 * basically we just need to survive
398 */
399#define BIO_SPLIT_ENTRIES 2
336 400
337#ifdef CONFIG_HIGHMEM 401#ifdef CONFIG_HIGHMEM
338/* 402/*
@@ -381,5 +445,63 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
381 __bio_kmap_irq((bio), (bio)->bi_idx, (flags)) 445 __bio_kmap_irq((bio), (bio)->bi_idx, (flags))
382#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) 446#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags)
383 447
448#if defined(CONFIG_BLK_DEV_INTEGRITY)
449
450#define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)]))
451#define bip_vec(bip) bip_vec_idx(bip, 0)
452
453#define __bip_for_each_vec(bvl, bip, i, start_idx) \
454 for (bvl = bip_vec_idx((bip), (start_idx)), i = (start_idx); \
455 i < (bip)->bip_vcnt; \
456 bvl++, i++)
457
458#define bip_for_each_vec(bvl, bip, i) \
459 __bip_for_each_vec(bvl, bip, i, (bip)->bip_idx)
460
461static inline int bio_integrity(struct bio *bio)
462{
463#if defined(CONFIG_BLK_DEV_INTEGRITY)
464 return bio->bi_integrity != NULL;
465#else
466 return 0;
467#endif
468}
469
470extern struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *, gfp_t, unsigned int, struct bio_set *);
471extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int);
472extern void bio_integrity_free(struct bio *, struct bio_set *);
473extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int);
474extern int bio_integrity_enabled(struct bio *bio);
475extern int bio_integrity_set_tag(struct bio *, void *, unsigned int);
476extern int bio_integrity_get_tag(struct bio *, void *, unsigned int);
477extern int bio_integrity_prep(struct bio *);
478extern void bio_integrity_endio(struct bio *, int);
479extern void bio_integrity_advance(struct bio *, unsigned int);
480extern void bio_integrity_trim(struct bio *, unsigned int, unsigned int);
481extern void bio_integrity_split(struct bio *, struct bio_pair *, int);
482extern int bio_integrity_clone(struct bio *, struct bio *, struct bio_set *);
483extern int bioset_integrity_create(struct bio_set *, int);
484extern void bioset_integrity_free(struct bio_set *);
485extern void bio_integrity_init_slab(void);
486
487#else /* CONFIG_BLK_DEV_INTEGRITY */
488
489#define bio_integrity(a) (0)
490#define bioset_integrity_create(a, b) (0)
491#define bio_integrity_prep(a) (0)
492#define bio_integrity_enabled(a) (0)
493#define bio_integrity_clone(a, b, c) (0)
494#define bioset_integrity_free(a) do { } while (0)
495#define bio_integrity_free(a, b) do { } while (0)
496#define bio_integrity_endio(a, b) do { } while (0)
497#define bio_integrity_advance(a, b) do { } while (0)
498#define bio_integrity_trim(a, b, c) do { } while (0)
499#define bio_integrity_split(a, b, c) do { } while (0)
500#define bio_integrity_set_tag(a, b, c) do { } while (0)
501#define bio_integrity_get_tag(a, b, c) do { } while (0)
502#define bio_integrity_init_slab(a) do { } while (0)
503
504#endif /* CONFIG_BLK_DEV_INTEGRITY */
505
384#endif /* CONFIG_BLOCK */ 506#endif /* CONFIG_BLOCK */
385#endif /* __LINUX_BIO_H */ 507#endif /* __LINUX_BIO_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index d2a1b71e93c3..32a441b05fd5 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -23,7 +23,6 @@
23struct scsi_ioctl_command; 23struct scsi_ioctl_command;
24 24
25struct request_queue; 25struct request_queue;
26typedef struct request_queue request_queue_t __deprecated;
27struct elevator_queue; 26struct elevator_queue;
28typedef struct elevator_queue elevator_t; 27typedef struct elevator_queue elevator_t;
29struct request_pm_state; 28struct request_pm_state;
@@ -34,12 +33,6 @@ struct sg_io_hdr;
34#define BLKDEV_MIN_RQ 4 33#define BLKDEV_MIN_RQ 4
35#define BLKDEV_MAX_RQ 128 /* Default maximum */ 34#define BLKDEV_MAX_RQ 128 /* Default maximum */
36 35
37int put_io_context(struct io_context *ioc);
38void exit_io_context(void);
39struct io_context *get_io_context(gfp_t gfp_flags, int node);
40struct io_context *alloc_io_context(gfp_t gfp_flags, int node);
41void copy_io_context(struct io_context **pdst, struct io_context **psrc);
42
43struct request; 36struct request;
44typedef void (rq_end_io_fn)(struct request *, int); 37typedef void (rq_end_io_fn)(struct request *, int);
45 38
@@ -113,6 +106,7 @@ enum rq_flag_bits {
113 __REQ_ALLOCED, /* request came from our alloc pool */ 106 __REQ_ALLOCED, /* request came from our alloc pool */
114 __REQ_RW_META, /* metadata io request */ 107 __REQ_RW_META, /* metadata io request */
115 __REQ_COPY_USER, /* contains copies of user pages */ 108 __REQ_COPY_USER, /* contains copies of user pages */
109 __REQ_INTEGRITY, /* integrity metadata has been remapped */
116 __REQ_NR_BITS, /* stops here */ 110 __REQ_NR_BITS, /* stops here */
117}; 111};
118 112
@@ -135,6 +129,7 @@ enum rq_flag_bits {
135#define REQ_ALLOCED (1 << __REQ_ALLOCED) 129#define REQ_ALLOCED (1 << __REQ_ALLOCED)
136#define REQ_RW_META (1 << __REQ_RW_META) 130#define REQ_RW_META (1 << __REQ_RW_META)
137#define REQ_COPY_USER (1 << __REQ_COPY_USER) 131#define REQ_COPY_USER (1 << __REQ_COPY_USER)
132#define REQ_INTEGRITY (1 << __REQ_INTEGRITY)
138 133
139#define BLK_MAX_CDB 16 134#define BLK_MAX_CDB 16
140 135
@@ -259,7 +254,14 @@ typedef int (prep_rq_fn) (struct request_queue *, struct request *);
259typedef void (unplug_fn) (struct request_queue *); 254typedef void (unplug_fn) (struct request_queue *);
260 255
261struct bio_vec; 256struct bio_vec;
262typedef int (merge_bvec_fn) (struct request_queue *, struct bio *, struct bio_vec *); 257struct bvec_merge_data {
258 struct block_device *bi_bdev;
259 sector_t bi_sector;
260 unsigned bi_size;
261 unsigned long bi_rw;
262};
263typedef int (merge_bvec_fn) (struct request_queue *, struct bvec_merge_data *,
264 struct bio_vec *);
263typedef void (prepare_flush_fn) (struct request_queue *, struct request *); 265typedef void (prepare_flush_fn) (struct request_queue *, struct request *);
264typedef void (softirq_done_fn)(struct request *); 266typedef void (softirq_done_fn)(struct request *);
265typedef int (dma_drain_needed_fn)(struct request *); 267typedef int (dma_drain_needed_fn)(struct request *);
@@ -426,6 +428,32 @@ static inline void queue_flag_set_unlocked(unsigned int flag,
426 __set_bit(flag, &q->queue_flags); 428 __set_bit(flag, &q->queue_flags);
427} 429}
428 430
431static inline int queue_flag_test_and_clear(unsigned int flag,
432 struct request_queue *q)
433{
434 WARN_ON_ONCE(!queue_is_locked(q));
435
436 if (test_bit(flag, &q->queue_flags)) {
437 __clear_bit(flag, &q->queue_flags);
438 return 1;
439 }
440
441 return 0;
442}
443
444static inline int queue_flag_test_and_set(unsigned int flag,
445 struct request_queue *q)
446{
447 WARN_ON_ONCE(!queue_is_locked(q));
448
449 if (!test_bit(flag, &q->queue_flags)) {
450 __set_bit(flag, &q->queue_flags);
451 return 0;
452 }
453
454 return 1;
455}
456
429static inline void queue_flag_set(unsigned int flag, struct request_queue *q) 457static inline void queue_flag_set(unsigned int flag, struct request_queue *q)
430{ 458{
431 WARN_ON_ONCE(!queue_is_locked(q)); 459 WARN_ON_ONCE(!queue_is_locked(q));
@@ -623,7 +651,6 @@ extern void generic_make_request(struct bio *bio);
623extern void blk_rq_init(struct request_queue *q, struct request *rq); 651extern void blk_rq_init(struct request_queue *q, struct request *rq);
624extern void blk_put_request(struct request *); 652extern void blk_put_request(struct request *);
625extern void __blk_put_request(struct request_queue *, struct request *); 653extern void __blk_put_request(struct request_queue *, struct request *);
626extern void blk_end_sync_rq(struct request *rq, int error);
627extern struct request *blk_get_request(struct request_queue *, int, gfp_t); 654extern struct request *blk_get_request(struct request_queue *, int, gfp_t);
628extern void blk_insert_request(struct request_queue *, struct request *, int, void *); 655extern void blk_insert_request(struct request_queue *, struct request *, int, void *);
629extern void blk_requeue_request(struct request_queue *, struct request *); 656extern void blk_requeue_request(struct request_queue *, struct request *);
@@ -676,7 +703,6 @@ extern int blk_execute_rq(struct request_queue *, struct gendisk *,
676 struct request *, int); 703 struct request *, int);
677extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, 704extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
678 struct request *, int, rq_end_io_fn *); 705 struct request *, int, rq_end_io_fn *);
679extern int blk_verify_command(unsigned char *, int);
680extern void blk_unplug(struct request_queue *q); 706extern void blk_unplug(struct request_queue *q);
681 707
682static inline struct request_queue *bdev_get_queue(struct block_device *bdev) 708static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
@@ -749,6 +775,7 @@ extern void blk_queue_max_segment_size(struct request_queue *, unsigned int);
749extern void blk_queue_hardsect_size(struct request_queue *, unsigned short); 775extern void blk_queue_hardsect_size(struct request_queue *, unsigned short);
750extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); 776extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b);
751extern void blk_queue_dma_pad(struct request_queue *, unsigned int); 777extern void blk_queue_dma_pad(struct request_queue *, unsigned int);
778extern void blk_queue_update_dma_pad(struct request_queue *, unsigned int);
752extern int blk_queue_dma_drain(struct request_queue *q, 779extern int blk_queue_dma_drain(struct request_queue *q,
753 dma_drain_needed_fn *dma_drain_needed, 780 dma_drain_needed_fn *dma_drain_needed,
754 void *buf, unsigned int size); 781 void *buf, unsigned int size);
@@ -802,6 +829,15 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
802 829
803extern int blkdev_issue_flush(struct block_device *, sector_t *); 830extern int blkdev_issue_flush(struct block_device *, sector_t *);
804 831
832/*
833* command filter functions
834*/
835extern int blk_verify_command(struct file *file, unsigned char *cmd);
836extern int blk_cmd_filter_verify_command(struct blk_scsi_cmd_filter *filter,
837 unsigned char *cmd, mode_t *f_mode);
838extern int blk_register_filter(struct gendisk *disk);
839extern void blk_unregister_filter(struct gendisk *disk);
840
805#define MAX_PHYS_SEGMENTS 128 841#define MAX_PHYS_SEGMENTS 128
806#define MAX_HW_SEGMENTS 128 842#define MAX_HW_SEGMENTS 128
807#define SAFE_MAX_SECTORS 255 843#define SAFE_MAX_SECTORS 255
@@ -865,28 +901,116 @@ void kblockd_flush_work(struct work_struct *work);
865#define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \ 901#define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \
866 MODULE_ALIAS("block-major-" __stringify(major) "-*") 902 MODULE_ALIAS("block-major-" __stringify(major) "-*")
867 903
904#if defined(CONFIG_BLK_DEV_INTEGRITY)
868 905
869#else /* CONFIG_BLOCK */ 906#define INTEGRITY_FLAG_READ 2 /* verify data integrity on read */
870/* 907#define INTEGRITY_FLAG_WRITE 4 /* generate data integrity on write */
871 * stubs for when the block layer is configured out
872 */
873#define buffer_heads_over_limit 0
874 908
875static inline long nr_blockdev_pages(void) 909struct blk_integrity_exchg {
910 void *prot_buf;
911 void *data_buf;
912 sector_t sector;
913 unsigned int data_size;
914 unsigned short sector_size;
915 const char *disk_name;
916};
917
918typedef void (integrity_gen_fn) (struct blk_integrity_exchg *);
919typedef int (integrity_vrfy_fn) (struct blk_integrity_exchg *);
920typedef void (integrity_set_tag_fn) (void *, void *, unsigned int);
921typedef void (integrity_get_tag_fn) (void *, void *, unsigned int);
922
923struct blk_integrity {
924 integrity_gen_fn *generate_fn;
925 integrity_vrfy_fn *verify_fn;
926 integrity_set_tag_fn *set_tag_fn;
927 integrity_get_tag_fn *get_tag_fn;
928
929 unsigned short flags;
930 unsigned short tuple_size;
931 unsigned short sector_size;
932 unsigned short tag_size;
933
934 const char *name;
935
936 struct kobject kobj;
937};
938
939extern int blk_integrity_register(struct gendisk *, struct blk_integrity *);
940extern void blk_integrity_unregister(struct gendisk *);
941extern int blk_integrity_compare(struct block_device *, struct block_device *);
942extern int blk_rq_map_integrity_sg(struct request *, struct scatterlist *);
943extern int blk_rq_count_integrity_sg(struct request *);
944
945static inline unsigned short blk_integrity_tuple_size(struct blk_integrity *bi)
876{ 946{
947 if (bi)
948 return bi->tuple_size;
949
877 return 0; 950 return 0;
878} 951}
879 952
880static inline void exit_io_context(void) 953static inline struct blk_integrity *bdev_get_integrity(struct block_device *bdev)
881{ 954{
955 return bdev->bd_disk->integrity;
882} 956}
883 957
884struct io_context; 958static inline unsigned int bdev_get_tag_size(struct block_device *bdev)
885static inline int put_io_context(struct io_context *ioc)
886{ 959{
887 return 1; 960 struct blk_integrity *bi = bdev_get_integrity(bdev);
961
962 if (bi)
963 return bi->tag_size;
964
965 return 0;
966}
967
968static inline int bdev_integrity_enabled(struct block_device *bdev, int rw)
969{
970 struct blk_integrity *bi = bdev_get_integrity(bdev);
971
972 if (bi == NULL)
973 return 0;
974
975 if (rw == READ && bi->verify_fn != NULL &&
976 (bi->flags & INTEGRITY_FLAG_READ))
977 return 1;
978
979 if (rw == WRITE && bi->generate_fn != NULL &&
980 (bi->flags & INTEGRITY_FLAG_WRITE))
981 return 1;
982
983 return 0;
888} 984}
889 985
986static inline int blk_integrity_rq(struct request *rq)
987{
988 return bio_integrity(rq->bio);
989}
990
991#else /* CONFIG_BLK_DEV_INTEGRITY */
992
993#define blk_integrity_rq(rq) (0)
994#define blk_rq_count_integrity_sg(a) (0)
995#define blk_rq_map_integrity_sg(a, b) (0)
996#define bdev_get_integrity(a) (0)
997#define bdev_get_tag_size(a) (0)
998#define blk_integrity_compare(a, b) (0)
999#define blk_integrity_register(a, b) (0)
1000#define blk_integrity_unregister(a) do { } while (0);
1001
1002#endif /* CONFIG_BLK_DEV_INTEGRITY */
1003
1004#else /* CONFIG_BLOCK */
1005/*
1006 * stubs for when the block layer is configured out
1007 */
1008#define buffer_heads_over_limit 0
1009
1010static inline long nr_blockdev_pages(void)
1011{
1012 return 0;
1013}
890 1014
891#endif /* CONFIG_BLOCK */ 1015#endif /* CONFIG_BLOCK */
892 1016
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index e3ef903aae88..d084b8d227a5 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -129,6 +129,7 @@ struct blk_trace {
129 u32 dev; 129 u32 dev;
130 struct dentry *dir; 130 struct dentry *dir;
131 struct dentry *dropped_file; 131 struct dentry *dropped_file;
132 struct dentry *msg_file;
132 atomic_t dropped; 133 atomic_t dropped;
133}; 134};
134 135
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 686895bacd9d..a1d9b79078ea 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -84,6 +84,8 @@ extern int reserve_bootmem(unsigned long addr, unsigned long size, int flags);
84 __alloc_bootmem_low(x, PAGE_SIZE, 0) 84 __alloc_bootmem_low(x, PAGE_SIZE, 0)
85#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ 85#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
86 86
87extern int reserve_bootmem_generic(unsigned long addr, unsigned long size,
88 int flags);
87extern unsigned long free_all_bootmem(void); 89extern unsigned long free_all_bootmem(void);
88extern unsigned long free_all_bootmem_node(pg_data_t *pgdat); 90extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
89extern void *__alloc_bootmem_node(pg_data_t *pgdat, 91extern void *__alloc_bootmem_node(pg_data_t *pgdat,
diff --git a/include/linux/console.h b/include/linux/console.h
index a4f27fbdf549..248e6e3b9b73 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -108,6 +108,8 @@ struct console {
108 struct console *next; 108 struct console *next;
109}; 109};
110 110
111extern int console_set_on_cmdline;
112
111extern int add_preferred_console(char *name, int idx, char *options); 113extern int add_preferred_console(char *name, int idx, char *options);
112extern int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, char *options); 114extern int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, char *options);
113extern void register_console(struct console *); 115extern void register_console(struct console *);
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 425824bd49f3..c43dc47fdf75 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -30,15 +30,17 @@
30 */ 30 */
31#define CRYPTO_ALG_TYPE_MASK 0x0000000f 31#define CRYPTO_ALG_TYPE_MASK 0x0000000f
32#define CRYPTO_ALG_TYPE_CIPHER 0x00000001 32#define CRYPTO_ALG_TYPE_CIPHER 0x00000001
33#define CRYPTO_ALG_TYPE_DIGEST 0x00000002 33#define CRYPTO_ALG_TYPE_COMPRESS 0x00000002
34#define CRYPTO_ALG_TYPE_HASH 0x00000003 34#define CRYPTO_ALG_TYPE_AEAD 0x00000003
35#define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004 35#define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004
36#define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005 36#define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005
37#define CRYPTO_ALG_TYPE_GIVCIPHER 0x00000006 37#define CRYPTO_ALG_TYPE_GIVCIPHER 0x00000006
38#define CRYPTO_ALG_TYPE_COMPRESS 0x00000008 38#define CRYPTO_ALG_TYPE_DIGEST 0x00000008
39#define CRYPTO_ALG_TYPE_AEAD 0x00000009 39#define CRYPTO_ALG_TYPE_HASH 0x00000009
40#define CRYPTO_ALG_TYPE_AHASH 0x0000000a
40 41
41#define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e 42#define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e
43#define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000c
42#define CRYPTO_ALG_TYPE_BLKCIPHER_MASK 0x0000000c 44#define CRYPTO_ALG_TYPE_BLKCIPHER_MASK 0x0000000c
43 45
44#define CRYPTO_ALG_LARVAL 0x00000010 46#define CRYPTO_ALG_LARVAL 0x00000010
@@ -102,6 +104,7 @@ struct crypto_async_request;
102struct crypto_aead; 104struct crypto_aead;
103struct crypto_blkcipher; 105struct crypto_blkcipher;
104struct crypto_hash; 106struct crypto_hash;
107struct crypto_ahash;
105struct crypto_tfm; 108struct crypto_tfm;
106struct crypto_type; 109struct crypto_type;
107struct aead_givcrypt_request; 110struct aead_givcrypt_request;
@@ -131,6 +134,16 @@ struct ablkcipher_request {
131 void *__ctx[] CRYPTO_MINALIGN_ATTR; 134 void *__ctx[] CRYPTO_MINALIGN_ATTR;
132}; 135};
133 136
137struct ahash_request {
138 struct crypto_async_request base;
139
140 unsigned int nbytes;
141 struct scatterlist *src;
142 u8 *result;
143
144 void *__ctx[] CRYPTO_MINALIGN_ATTR;
145};
146
134/** 147/**
135 * struct aead_request - AEAD request 148 * struct aead_request - AEAD request
136 * @base: Common attributes for async crypto requests 149 * @base: Common attributes for async crypto requests
@@ -195,6 +208,17 @@ struct ablkcipher_alg {
195 unsigned int ivsize; 208 unsigned int ivsize;
196}; 209};
197 210
211struct ahash_alg {
212 int (*init)(struct ahash_request *req);
213 int (*update)(struct ahash_request *req);
214 int (*final)(struct ahash_request *req);
215 int (*digest)(struct ahash_request *req);
216 int (*setkey)(struct crypto_ahash *tfm, const u8 *key,
217 unsigned int keylen);
218
219 unsigned int digestsize;
220};
221
198struct aead_alg { 222struct aead_alg {
199 int (*setkey)(struct crypto_aead *tfm, const u8 *key, 223 int (*setkey)(struct crypto_aead *tfm, const u8 *key,
200 unsigned int keylen); 224 unsigned int keylen);
@@ -272,6 +296,7 @@ struct compress_alg {
272#define cra_cipher cra_u.cipher 296#define cra_cipher cra_u.cipher
273#define cra_digest cra_u.digest 297#define cra_digest cra_u.digest
274#define cra_hash cra_u.hash 298#define cra_hash cra_u.hash
299#define cra_ahash cra_u.ahash
275#define cra_compress cra_u.compress 300#define cra_compress cra_u.compress
276 301
277struct crypto_alg { 302struct crypto_alg {
@@ -298,6 +323,7 @@ struct crypto_alg {
298 struct cipher_alg cipher; 323 struct cipher_alg cipher;
299 struct digest_alg digest; 324 struct digest_alg digest;
300 struct hash_alg hash; 325 struct hash_alg hash;
326 struct ahash_alg ahash;
301 struct compress_alg compress; 327 struct compress_alg compress;
302 } cra_u; 328 } cra_u;
303 329
@@ -383,6 +409,18 @@ struct hash_tfm {
383 unsigned int digestsize; 409 unsigned int digestsize;
384}; 410};
385 411
412struct ahash_tfm {
413 int (*init)(struct ahash_request *req);
414 int (*update)(struct ahash_request *req);
415 int (*final)(struct ahash_request *req);
416 int (*digest)(struct ahash_request *req);
417 int (*setkey)(struct crypto_ahash *tfm, const u8 *key,
418 unsigned int keylen);
419
420 unsigned int digestsize;
421 unsigned int reqsize;
422};
423
386struct compress_tfm { 424struct compress_tfm {
387 int (*cot_compress)(struct crypto_tfm *tfm, 425 int (*cot_compress)(struct crypto_tfm *tfm,
388 const u8 *src, unsigned int slen, 426 const u8 *src, unsigned int slen,
@@ -397,6 +435,7 @@ struct compress_tfm {
397#define crt_blkcipher crt_u.blkcipher 435#define crt_blkcipher crt_u.blkcipher
398#define crt_cipher crt_u.cipher 436#define crt_cipher crt_u.cipher
399#define crt_hash crt_u.hash 437#define crt_hash crt_u.hash
438#define crt_ahash crt_u.ahash
400#define crt_compress crt_u.compress 439#define crt_compress crt_u.compress
401 440
402struct crypto_tfm { 441struct crypto_tfm {
@@ -409,6 +448,7 @@ struct crypto_tfm {
409 struct blkcipher_tfm blkcipher; 448 struct blkcipher_tfm blkcipher;
410 struct cipher_tfm cipher; 449 struct cipher_tfm cipher;
411 struct hash_tfm hash; 450 struct hash_tfm hash;
451 struct ahash_tfm ahash;
412 struct compress_tfm compress; 452 struct compress_tfm compress;
413 } crt_u; 453 } crt_u;
414 454
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index d982eb89c77d..98202c672fde 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -3,6 +3,7 @@
3 3
4#include <asm/atomic.h> 4#include <asm/atomic.h>
5#include <linux/list.h> 5#include <linux/list.h>
6#include <linux/rculist.h>
6#include <linux/spinlock.h> 7#include <linux/spinlock.h>
7#include <linux/cache.h> 8#include <linux/cache.h>
8#include <linux/rcupdate.h> 9#include <linux/rcupdate.h>
diff --git a/include/linux/delay.h b/include/linux/delay.h
index 54552d21296e..fd832c6d419e 100644
--- a/include/linux/delay.h
+++ b/include/linux/delay.h
@@ -41,6 +41,7 @@ static inline void ndelay(unsigned long x)
41#define ndelay(x) ndelay(x) 41#define ndelay(x) ndelay(x)
42#endif 42#endif
43 43
44extern unsigned long lpj_fine;
44void calibrate_delay(void); 45void calibrate_delay(void);
45void msleep(unsigned int msecs); 46void msleep(unsigned int msecs);
46unsigned long msleep_interruptible(unsigned int msecs); 47unsigned long msleep_interruptible(unsigned int msecs);
diff --git a/include/linux/efi.h b/include/linux/efi.h
index a5f359a7ad0e..807373d467f7 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -287,7 +287,6 @@ efi_guid_unparse(efi_guid_t *guid, char *out)
287extern void efi_init (void); 287extern void efi_init (void);
288extern void *efi_get_pal_addr (void); 288extern void *efi_get_pal_addr (void);
289extern void efi_map_pal_code (void); 289extern void efi_map_pal_code (void);
290extern void efi_map_memmap(void);
291extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg); 290extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg);
292extern void efi_gettimeofday (struct timespec *ts); 291extern void efi_gettimeofday (struct timespec *ts);
293extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if possible */ 292extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if possible */
@@ -295,14 +294,11 @@ extern u64 efi_get_iobase (void);
295extern u32 efi_mem_type (unsigned long phys_addr); 294extern u32 efi_mem_type (unsigned long phys_addr);
296extern u64 efi_mem_attributes (unsigned long phys_addr); 295extern u64 efi_mem_attributes (unsigned long phys_addr);
297extern u64 efi_mem_attribute (unsigned long phys_addr, unsigned long size); 296extern u64 efi_mem_attribute (unsigned long phys_addr, unsigned long size);
298extern int efi_mem_attribute_range (unsigned long phys_addr, unsigned long size,
299 u64 attr);
300extern int __init efi_uart_console_only (void); 297extern int __init efi_uart_console_only (void);
301extern void efi_initialize_iomem_resources(struct resource *code_resource, 298extern void efi_initialize_iomem_resources(struct resource *code_resource,
302 struct resource *data_resource, struct resource *bss_resource); 299 struct resource *data_resource, struct resource *bss_resource);
303extern unsigned long efi_get_time(void); 300extern unsigned long efi_get_time(void);
304extern int efi_set_rtc_mmss(unsigned long nowtime); 301extern int efi_set_rtc_mmss(unsigned long nowtime);
305extern int is_available_memory(efi_memory_desc_t * md);
306extern struct efi_memory_map memmap; 302extern struct efi_memory_map memmap;
307 303
308/** 304/**
diff --git a/include/linux/firmware-map.h b/include/linux/firmware-map.h
new file mode 100644
index 000000000000..acbdbcc16051
--- /dev/null
+++ b/include/linux/firmware-map.h
@@ -0,0 +1,74 @@
1/*
2 * include/linux/firmware-map.h:
3 * Copyright (C) 2008 SUSE LINUX Products GmbH
4 * by Bernhard Walle <bwalle@suse.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License v2.0 as published by
8 * the Free Software Foundation
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16#ifndef _LINUX_FIRMWARE_MAP_H
17#define _LINUX_FIRMWARE_MAP_H
18
19#include <linux/list.h>
20#include <linux/kobject.h>
21
22/*
23 * provide a dummy interface if CONFIG_FIRMWARE_MEMMAP is disabled
24 */
25#ifdef CONFIG_FIRMWARE_MEMMAP
26
27/**
28 * Adds a firmware mapping entry. This function uses kmalloc() for memory
29 * allocation. Use firmware_map_add_early() if you want to use the bootmem
30 * allocator.
31 *
32 * That function must be called before late_initcall.
33 *
34 * @start: Start of the memory range.
35 * @end: End of the memory range (inclusive).
36 * @type: Type of the memory range.
37 *
38 * Returns 0 on success, or -ENOMEM if no memory could be allocated.
39 */
40int firmware_map_add(resource_size_t start, resource_size_t end,
41 const char *type);
42
43/**
44 * Adds a firmware mapping entry. This function uses the bootmem allocator
45 * for memory allocation. Use firmware_map_add() if you want to use kmalloc().
46 *
47 * That function must be called before late_initcall.
48 *
49 * @start: Start of the memory range.
50 * @end: End of the memory range (inclusive).
51 * @type: Type of the memory range.
52 *
53 * Returns 0 on success, or -ENOMEM if no memory could be allocated.
54 */
55int firmware_map_add_early(resource_size_t start, resource_size_t end,
56 const char *type);
57
58#else /* CONFIG_FIRMWARE_MEMMAP */
59
60static inline int firmware_map_add(resource_size_t start, resource_size_t end,
61 const char *type)
62{
63 return 0;
64}
65
66static inline int firmware_map_add_early(resource_size_t start,
67 resource_size_t end, const char *type)
68{
69 return 0;
70}
71
72#endif /* CONFIG_FIRMWARE_MEMMAP */
73
74#endif /* _LINUX_FIRMWARE_MAP_H */
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index 6c7eff2ebada..c8ecf5b2a207 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -1,18 +1,39 @@
1#ifndef _LINUX_FIRMWARE_H 1#ifndef _LINUX_FIRMWARE_H
2#define _LINUX_FIRMWARE_H 2#define _LINUX_FIRMWARE_H
3
3#include <linux/module.h> 4#include <linux/module.h>
4#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/compiler.h>
7
5#define FIRMWARE_NAME_MAX 30 8#define FIRMWARE_NAME_MAX 30
6#define FW_ACTION_NOHOTPLUG 0 9#define FW_ACTION_NOHOTPLUG 0
7#define FW_ACTION_HOTPLUG 1 10#define FW_ACTION_HOTPLUG 1
8 11
9struct firmware { 12struct firmware {
10 size_t size; 13 size_t size;
11 u8 *data; 14 const u8 *data;
12}; 15};
13 16
14struct device; 17struct device;
15 18
19struct builtin_fw {
20 char *name;
21 void *data;
22 unsigned long size;
23};
24
25/* We have to play tricks here much like stringify() to get the
26 __COUNTER__ macro to be expanded as we want it */
27#define __fw_concat1(x, y) x##y
28#define __fw_concat(x, y) __fw_concat1(x, y)
29
30#define DECLARE_BUILTIN_FIRMWARE(name, blob) \
31 DECLARE_BUILTIN_FIRMWARE_SIZE(name, &(blob), sizeof(blob))
32
33#define DECLARE_BUILTIN_FIRMWARE_SIZE(name, blob, size) \
34 static const struct builtin_fw __fw_concat(__builtin_fw,__COUNTER__) \
35 __used __section(.builtin_fw) = { name, blob, size }
36
16#if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE)) 37#if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE))
17int request_firmware(const struct firmware **fw, const char *name, 38int request_firmware(const struct firmware **fw, const char *name,
18 struct device *device); 39 struct device *device);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index d8e2762ed14d..52e510a0aec2 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1740,6 +1740,8 @@ extern int wait_on_page_writeback_range(struct address_space *mapping,
1740 pgoff_t start, pgoff_t end); 1740 pgoff_t start, pgoff_t end);
1741extern int __filemap_fdatawrite_range(struct address_space *mapping, 1741extern int __filemap_fdatawrite_range(struct address_space *mapping,
1742 loff_t start, loff_t end, int sync_mode); 1742 loff_t start, loff_t end, int sync_mode);
1743extern int filemap_fdatawrite_range(struct address_space *mapping,
1744 loff_t start, loff_t end);
1743 1745
1744extern long do_fsync(struct file *file, int datasync); 1746extern long do_fsync(struct file *file, int datasync);
1745extern void sync_supers(void); 1747extern void sync_supers(void);
@@ -1870,7 +1872,8 @@ extern void
1870file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); 1872file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
1871extern loff_t no_llseek(struct file *file, loff_t offset, int origin); 1873extern loff_t no_llseek(struct file *file, loff_t offset, int origin);
1872extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin); 1874extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin);
1873extern loff_t remote_llseek(struct file *file, loff_t offset, int origin); 1875extern loff_t generic_file_llseek_unlocked(struct file *file, loff_t offset,
1876 int origin);
1874extern int generic_file_open(struct inode * inode, struct file * filp); 1877extern int generic_file_open(struct inode * inode, struct file * filp);
1875extern int nonseekable_open(struct inode * inode, struct file * filp); 1878extern int nonseekable_open(struct inode * inode, struct file * filp);
1876 1879
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
new file mode 100644
index 000000000000..f368d041e02d
--- /dev/null
+++ b/include/linux/ftrace.h
@@ -0,0 +1,144 @@
1#ifndef _LINUX_FTRACE_H
2#define _LINUX_FTRACE_H
3
4#ifdef CONFIG_FTRACE
5
6#include <linux/linkage.h>
7#include <linux/fs.h>
8
9extern int ftrace_enabled;
10extern int
11ftrace_enable_sysctl(struct ctl_table *table, int write,
12 struct file *filp, void __user *buffer, size_t *lenp,
13 loff_t *ppos);
14
15typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip);
16
17struct ftrace_ops {
18 ftrace_func_t func;
19 struct ftrace_ops *next;
20};
21
22/*
23 * The ftrace_ops must be a static and should also
24 * be read_mostly. These functions do modify read_mostly variables
25 * so use them sparely. Never free an ftrace_op or modify the
26 * next pointer after it has been registered. Even after unregistering
27 * it, the next pointer may still be used internally.
28 */
29int register_ftrace_function(struct ftrace_ops *ops);
30int unregister_ftrace_function(struct ftrace_ops *ops);
31void clear_ftrace_function(void);
32
33extern void ftrace_stub(unsigned long a0, unsigned long a1);
34
35#else /* !CONFIG_FTRACE */
36# define register_ftrace_function(ops) do { } while (0)
37# define unregister_ftrace_function(ops) do { } while (0)
38# define clear_ftrace_function(ops) do { } while (0)
39#endif /* CONFIG_FTRACE */
40
41#ifdef CONFIG_DYNAMIC_FTRACE
42# define FTRACE_HASHBITS 10
43# define FTRACE_HASHSIZE (1<<FTRACE_HASHBITS)
44
45enum {
46 FTRACE_FL_FREE = (1 << 0),
47 FTRACE_FL_FAILED = (1 << 1),
48 FTRACE_FL_FILTER = (1 << 2),
49 FTRACE_FL_ENABLED = (1 << 3),
50 FTRACE_FL_NOTRACE = (1 << 4),
51 FTRACE_FL_CONVERTED = (1 << 5),
52 FTRACE_FL_FROZEN = (1 << 6),
53};
54
55struct dyn_ftrace {
56 struct hlist_node node;
57 unsigned long ip; /* address of mcount call-site */
58 unsigned long flags;
59};
60
61int ftrace_force_update(void);
62void ftrace_set_filter(unsigned char *buf, int len, int reset);
63
64/* defined in arch */
65extern int ftrace_ip_converted(unsigned long ip);
66extern unsigned char *ftrace_nop_replace(void);
67extern unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr);
68extern int ftrace_dyn_arch_init(void *data);
69extern int ftrace_mcount_set(unsigned long *data);
70extern int ftrace_modify_code(unsigned long ip, unsigned char *old_code,
71 unsigned char *new_code);
72extern int ftrace_update_ftrace_func(ftrace_func_t func);
73extern void ftrace_caller(void);
74extern void ftrace_call(void);
75extern void mcount_call(void);
76
77extern int skip_trace(unsigned long ip);
78
79void ftrace_disable_daemon(void);
80void ftrace_enable_daemon(void);
81
82#else
83# define skip_trace(ip) ({ 0; })
84# define ftrace_force_update() ({ 0; })
85# define ftrace_set_filter(buf, len, reset) do { } while (0)
86# define ftrace_disable_daemon() do { } while (0)
87# define ftrace_enable_daemon() do { } while (0)
88#endif /* CONFIG_DYNAMIC_FTRACE */
89
90/* totally disable ftrace - can not re-enable after this */
91void ftrace_kill(void);
92void ftrace_kill_atomic(void);
93
94static inline void tracer_disable(void)
95{
96#ifdef CONFIG_FTRACE
97 ftrace_enabled = 0;
98#endif
99}
100
101#ifdef CONFIG_FRAME_POINTER
102/* TODO: need to fix this for ARM */
103# define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
104# define CALLER_ADDR1 ((unsigned long)__builtin_return_address(1))
105# define CALLER_ADDR2 ((unsigned long)__builtin_return_address(2))
106# define CALLER_ADDR3 ((unsigned long)__builtin_return_address(3))
107# define CALLER_ADDR4 ((unsigned long)__builtin_return_address(4))
108# define CALLER_ADDR5 ((unsigned long)__builtin_return_address(5))
109# define CALLER_ADDR6 ((unsigned long)__builtin_return_address(6))
110#else
111# define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
112# define CALLER_ADDR1 0UL
113# define CALLER_ADDR2 0UL
114# define CALLER_ADDR3 0UL
115# define CALLER_ADDR4 0UL
116# define CALLER_ADDR5 0UL
117# define CALLER_ADDR6 0UL
118#endif
119
120#ifdef CONFIG_IRQSOFF_TRACER
121 extern void time_hardirqs_on(unsigned long a0, unsigned long a1);
122 extern void time_hardirqs_off(unsigned long a0, unsigned long a1);
123#else
124# define time_hardirqs_on(a0, a1) do { } while (0)
125# define time_hardirqs_off(a0, a1) do { } while (0)
126#endif
127
128#ifdef CONFIG_PREEMPT_TRACER
129 extern void trace_preempt_on(unsigned long a0, unsigned long a1);
130 extern void trace_preempt_off(unsigned long a0, unsigned long a1);
131#else
132# define trace_preempt_on(a0, a1) do { } while (0)
133# define trace_preempt_off(a0, a1) do { } while (0)
134#endif
135
136#ifdef CONFIG_TRACING
137extern void
138ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);
139#else
140static inline void
141ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { }
142#endif
143
144#endif /* _LINUX_FTRACE_H */
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index ae7aec3cabee..e8787417f65a 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -110,6 +110,14 @@ struct hd_struct {
110#define GENHD_FL_SUPPRESS_PARTITION_INFO 32 110#define GENHD_FL_SUPPRESS_PARTITION_INFO 32
111#define GENHD_FL_FAIL 64 111#define GENHD_FL_FAIL 64
112 112
113#define BLK_SCSI_MAX_CMDS (256)
114#define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8))
115
116struct blk_scsi_cmd_filter {
117 unsigned long read_ok[BLK_SCSI_CMD_PER_LONG];
118 unsigned long write_ok[BLK_SCSI_CMD_PER_LONG];
119 struct kobject kobj;
120};
113 121
114struct gendisk { 122struct gendisk {
115 int major; /* major number of driver */ 123 int major; /* major number of driver */
@@ -120,6 +128,7 @@ struct gendisk {
120 struct hd_struct **part; /* [indexed by minor] */ 128 struct hd_struct **part; /* [indexed by minor] */
121 struct block_device_operations *fops; 129 struct block_device_operations *fops;
122 struct request_queue *queue; 130 struct request_queue *queue;
131 struct blk_scsi_cmd_filter cmd_filter;
123 void *private_data; 132 void *private_data;
124 sector_t capacity; 133 sector_t capacity;
125 134
@@ -141,6 +150,9 @@ struct gendisk {
141 struct disk_stats dkstats; 150 struct disk_stats dkstats;
142#endif 151#endif
143 struct work_struct async_notify; 152 struct work_struct async_notify;
153#ifdef CONFIG_BLK_DEV_INTEGRITY
154 struct blk_integrity *integrity;
155#endif
144}; 156};
145 157
146/* 158/*
diff --git a/include/linux/i2c-algo-pcf.h b/include/linux/i2c-algo-pcf.h
index 77afbb60fd11..0177d280f733 100644
--- a/include/linux/i2c-algo-pcf.h
+++ b/include/linux/i2c-algo-pcf.h
@@ -33,9 +33,11 @@ struct i2c_algo_pcf_data {
33 int (*getclock) (void *data); 33 int (*getclock) (void *data);
34 void (*waitforpin) (void); 34 void (*waitforpin) (void);
35 35
36 /* local settings */ 36 /* Multi-master lost arbitration back-off delay (msecs)
37 int udelay; 37 * This should be set by the bus adapter or knowledgable client
38 int timeout; 38 * if bus is multi-mastered, else zero
39 */
40 unsigned long lab_mdelay;
39}; 41};
40 42
41int i2c_pcf_add_bus(struct i2c_adapter *); 43int i2c_pcf_add_bus(struct i2c_adapter *);
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index 580acc93903e..ef13b7c66df3 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -91,8 +91,6 @@
91#define I2C_DRIVERID_M52790 95 /* Mitsubishi M52790SP/FP AV switch */ 91#define I2C_DRIVERID_M52790 95 /* Mitsubishi M52790SP/FP AV switch */
92#define I2C_DRIVERID_CS5345 96 /* cs5345 audio processor */ 92#define I2C_DRIVERID_CS5345 96 /* cs5345 audio processor */
93 93
94#define I2C_DRIVERID_I2CDEV 900
95
96#define I2C_DRIVERID_OV7670 1048 /* Omnivision 7670 camera */ 94#define I2C_DRIVERID_OV7670 1048 /* Omnivision 7670 camera */
97 95
98/* 96/*
@@ -111,7 +109,6 @@
111#define I2C_HW_B_RIVA 0x010010 /* Riva based graphics cards */ 109#define I2C_HW_B_RIVA 0x010010 /* Riva based graphics cards */
112#define I2C_HW_B_IOC 0x010011 /* IOC bit-wiggling */ 110#define I2C_HW_B_IOC 0x010011 /* IOC bit-wiggling */
113#define I2C_HW_B_IXP2000 0x010016 /* GPIO on IXP2000 systems */ 111#define I2C_HW_B_IXP2000 0x010016 /* GPIO on IXP2000 systems */
114#define I2C_HW_B_S3VIA 0x010018 /* S3Via ProSavage adapter */
115#define I2C_HW_B_ZR36067 0x010019 /* Zoran-36057/36067 based boards */ 112#define I2C_HW_B_ZR36067 0x010019 /* Zoran-36057/36067 based boards */
116#define I2C_HW_B_PCILYNX 0x01001a /* TI PCILynx I2C adapter */ 113#define I2C_HW_B_PCILYNX 0x01001a /* TI PCILynx I2C adapter */
117#define I2C_HW_B_CX2388x 0x01001b /* connexant 2388x based tv cards */ 114#define I2C_HW_B_CX2388x 0x01001b /* connexant 2388x based tv cards */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 8dc730132192..08be0d21864c 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -35,6 +35,8 @@
35#include <linux/sched.h> /* for completion */ 35#include <linux/sched.h> /* for completion */
36#include <linux/mutex.h> 36#include <linux/mutex.h>
37 37
38extern struct bus_type i2c_bus_type;
39
38/* --- General options ------------------------------------------------ */ 40/* --- General options ------------------------------------------------ */
39 41
40struct i2c_msg; 42struct i2c_msg;
@@ -43,6 +45,7 @@ struct i2c_adapter;
43struct i2c_client; 45struct i2c_client;
44struct i2c_driver; 46struct i2c_driver;
45union i2c_smbus_data; 47union i2c_smbus_data;
48struct i2c_board_info;
46 49
47/* 50/*
48 * The master routines are the ones normally used to transmit data to devices 51 * The master routines are the ones normally used to transmit data to devices
@@ -69,9 +72,8 @@ extern s32 i2c_smbus_xfer (struct i2c_adapter * adapter, u16 addr,
69 union i2c_smbus_data * data); 72 union i2c_smbus_data * data);
70 73
71/* Now follow the 'nice' access routines. These also document the calling 74/* Now follow the 'nice' access routines. These also document the calling
72 conventions of smbus_access. */ 75 conventions of i2c_smbus_xfer. */
73 76
74extern s32 i2c_smbus_write_quick(struct i2c_client * client, u8 value);
75extern s32 i2c_smbus_read_byte(struct i2c_client * client); 77extern s32 i2c_smbus_read_byte(struct i2c_client * client);
76extern s32 i2c_smbus_write_byte(struct i2c_client * client, u8 value); 78extern s32 i2c_smbus_write_byte(struct i2c_client * client, u8 value);
77extern s32 i2c_smbus_read_byte_data(struct i2c_client * client, u8 command); 79extern s32 i2c_smbus_read_byte_data(struct i2c_client * client, u8 command);
@@ -93,15 +95,33 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client,
93 u8 command, u8 length, 95 u8 command, u8 length,
94 const u8 *values); 96 const u8 *values);
95 97
96/* 98/**
97 * A driver is capable of handling one or more physical devices present on 99 * struct i2c_driver - represent an I2C device driver
98 * I2C adapters. This information is used to inform the driver of adapter 100 * @class: What kind of i2c device we instantiate (for detect)
99 * events. 101 * @detect: Callback for device detection
102 * @address_data: The I2C addresses to probe, ignore or force (for detect)
103 * @clients: List of detected clients we created (for i2c-core use only)
100 * 104 *
101 * The driver.owner field should be set to the module owner of this driver. 105 * The driver.owner field should be set to the module owner of this driver.
102 * The driver.name field should be set to the name of this driver. 106 * The driver.name field should be set to the name of this driver.
107 *
108 * For automatic device detection, both @detect and @address_data must
109 * be defined. @class should also be set, otherwise only devices forced
110 * with module parameters will be created. The detect function must
111 * fill at least the name field of the i2c_board_info structure it is
112 * handed upon successful detection, and possibly also the flags field.
113 *
114 * If @detect is missing, the driver will still work fine for enumerated
115 * devices. Detected devices simply won't be supported. This is expected
116 * for the many I2C/SMBus devices which can't be detected reliably, and
117 * the ones which can always be enumerated in practice.
118 *
119 * The i2c_client structure which is handed to the @detect callback is
120 * not a real i2c_client. It is initialized just enough so that you can
121 * call i2c_smbus_read_byte_data and friends on it. Don't do anything
122 * else with it. In particular, calling dev_dbg and friends on it is
123 * not allowed.
103 */ 124 */
104
105struct i2c_driver { 125struct i2c_driver {
106 int id; 126 int id;
107 unsigned int class; 127 unsigned int class;
@@ -141,6 +161,11 @@ struct i2c_driver {
141 161
142 struct device_driver driver; 162 struct device_driver driver;
143 const struct i2c_device_id *id_table; 163 const struct i2c_device_id *id_table;
164
165 /* Device detection callback for automatic device creation */
166 int (*detect)(struct i2c_client *, int kind, struct i2c_board_info *);
167 const struct i2c_client_address_data *address_data;
168 struct list_head clients;
144}; 169};
145#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) 170#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
146 171
@@ -156,6 +181,7 @@ struct i2c_driver {
156 * @dev: Driver model device node for the slave. 181 * @dev: Driver model device node for the slave.
157 * @irq: indicates the IRQ generated by this device (if any) 182 * @irq: indicates the IRQ generated by this device (if any)
158 * @list: list of active/busy clients (DEPRECATED) 183 * @list: list of active/busy clients (DEPRECATED)
184 * @detected: member of an i2c_driver.clients list
159 * @released: used to synchronize client releases & detaches and references 185 * @released: used to synchronize client releases & detaches and references
160 * 186 *
161 * An i2c_client identifies a single device (i.e. chip) connected to an 187 * An i2c_client identifies a single device (i.e. chip) connected to an
@@ -173,6 +199,7 @@ struct i2c_client {
173 struct device dev; /* the device structure */ 199 struct device dev; /* the device structure */
174 int irq; /* irq issued by device */ 200 int irq; /* irq issued by device */
175 struct list_head list; /* DEPRECATED */ 201 struct list_head list; /* DEPRECATED */
202 struct list_head detected;
176 struct completion released; 203 struct completion released;
177}; 204};
178#define to_i2c_client(d) container_of(d, struct i2c_client, dev) 205#define to_i2c_client(d) container_of(d, struct i2c_client, dev)
@@ -350,10 +377,11 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data)
350#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ 377#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */
351#define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */ 378#define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */
352#define I2C_CLASS_TV_DIGITAL (1<<2) /* dvb cards */ 379#define I2C_CLASS_TV_DIGITAL (1<<2) /* dvb cards */
353#define I2C_CLASS_DDC (1<<3) /* i2c-matroxfb ? */ 380#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */
354#define I2C_CLASS_CAM_ANALOG (1<<4) /* camera with analog CCD */ 381#define I2C_CLASS_CAM_ANALOG (1<<4) /* camera with analog CCD */
355#define I2C_CLASS_CAM_DIGITAL (1<<5) /* most webcams */ 382#define I2C_CLASS_CAM_DIGITAL (1<<5) /* most webcams */
356#define I2C_CLASS_SOUND (1<<6) /* sound devices */ 383#define I2C_CLASS_SOUND (1<<6) /* sound devices */
384#define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */
357#define I2C_CLASS_ALL (UINT_MAX) /* all of the above */ 385#define I2C_CLASS_ALL (UINT_MAX) /* all of the above */
358 386
359/* i2c_client_address_data is the struct for holding default client 387/* i2c_client_address_data is the struct for holding default client
@@ -537,7 +565,7 @@ union i2c_smbus_data {
537 /* and one more for user-space compatibility */ 565 /* and one more for user-space compatibility */
538}; 566};
539 567
540/* smbus_access read or write markers */ 568/* i2c_smbus_xfer read or write markers */
541#define I2C_SMBUS_READ 1 569#define I2C_SMBUS_READ 1
542#define I2C_SMBUS_WRITE 0 570#define I2C_SMBUS_WRITE 0
543 571
diff --git a/include/linux/i2c/at24.h b/include/linux/i2c/at24.h
new file mode 100644
index 000000000000..f6edd522a929
--- /dev/null
+++ b/include/linux/i2c/at24.h
@@ -0,0 +1,28 @@
1#ifndef _LINUX_AT24_H
2#define _LINUX_AT24_H
3
4#include <linux/types.h>
5
6/*
7 * As seen through Linux I2C, differences between the most common types of I2C
8 * memory include:
9 * - How much memory is available (usually specified in bit)?
10 * - What write page size does it support?
11 * - Special flags (16 bit addresses, read_only, world readable...)?
12 *
13 * If you set up a custom eeprom type, please double-check the parameters.
14 * Especially page_size needs extra care, as you risk data loss if your value
15 * is bigger than what the chip actually supports!
16 */
17
18struct at24_platform_data {
19 u32 byte_len; /* size (sum of all addr) */
20 u16 page_size; /* for writes */
21 u8 flags;
22#define AT24_FLAG_ADDR16 0x80 /* address pointer is 16 bit */
23#define AT24_FLAG_READONLY 0x40 /* sysfs-entry will be read-only */
24#define AT24_FLAG_IRUGO 0x20 /* sysfs-entry will be world-readable */
25#define AT24_FLAG_TAKE8ADDR 0x10 /* take always 8 addresses (24c00) */
26};
27
28#endif /* _LINUX_AT24_H */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 9918772bf274..ac4eeb2932ef 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -189,6 +189,21 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
189 hw->io_ports.ctl_addr = ctl_addr; 189 hw->io_ports.ctl_addr = ctl_addr;
190} 190}
191 191
192/* for IDE PCI controllers in legacy mode, temporary */
193static inline int __ide_default_irq(unsigned long base)
194{
195 switch (base) {
196#ifdef CONFIG_IA64
197 case 0x1f0: return isa_irq_to_vector(14);
198 case 0x170: return isa_irq_to_vector(15);
199#else
200 case 0x1f0: return 14;
201 case 0x170: return 15;
202#endif
203 }
204 return 0;
205}
206
192#include <asm/ide.h> 207#include <asm/ide.h>
193 208
194#if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED) 209#if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED)
@@ -349,7 +364,6 @@ typedef struct ide_drive_s {
349 u8 wcache; /* status of write cache */ 364 u8 wcache; /* status of write cache */
350 u8 acoustic; /* acoustic management */ 365 u8 acoustic; /* acoustic management */
351 u8 media; /* disk, cdrom, tape, floppy, ... */ 366 u8 media; /* disk, cdrom, tape, floppy, ... */
352 u8 ctl; /* "normal" value for Control register */
353 u8 ready_stat; /* min status value for drive ready */ 367 u8 ready_stat; /* min status value for drive ready */
354 u8 mult_count; /* current multiple sector setting */ 368 u8 mult_count; /* current multiple sector setting */
355 u8 mult_req; /* requested multiple sector setting */ 369 u8 mult_req; /* requested multiple sector setting */
@@ -478,7 +492,7 @@ typedef struct hwif_s {
478 void (*ide_dma_clear_irq)(ide_drive_t *drive); 492 void (*ide_dma_clear_irq)(ide_drive_t *drive);
479 493
480 void (*OUTB)(u8 addr, unsigned long port); 494 void (*OUTB)(u8 addr, unsigned long port);
481 void (*OUTBSYNC)(ide_drive_t *drive, u8 addr, unsigned long port); 495 void (*OUTBSYNC)(struct hwif_s *hwif, u8 addr, unsigned long port);
482 496
483 u8 (*INB)(unsigned long port); 497 u8 (*INB)(unsigned long port);
484 498
@@ -517,7 +531,6 @@ typedef struct hwif_s {
517 unsigned serialized : 1; /* serialized all channel operation */ 531 unsigned serialized : 1; /* serialized all channel operation */
518 unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ 532 unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */
519 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ 533 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */
520 unsigned mmio : 1; /* host uses MMIO */
521 534
522 struct device gendev; 535 struct device gendev;
523 struct device *portdev; 536 struct device *portdev;
@@ -589,12 +602,13 @@ enum {
589 PC_FLAG_SUPPRESS_ERROR = (1 << 1), 602 PC_FLAG_SUPPRESS_ERROR = (1 << 1),
590 PC_FLAG_WAIT_FOR_DSC = (1 << 2), 603 PC_FLAG_WAIT_FOR_DSC = (1 << 2),
591 PC_FLAG_DMA_OK = (1 << 3), 604 PC_FLAG_DMA_OK = (1 << 3),
592 PC_FLAG_DMA_RECOMMENDED = (1 << 4), 605 PC_FLAG_DMA_IN_PROGRESS = (1 << 4),
593 PC_FLAG_DMA_IN_PROGRESS = (1 << 5), 606 PC_FLAG_DMA_ERROR = (1 << 5),
594 PC_FLAG_DMA_ERROR = (1 << 6), 607 PC_FLAG_WRITING = (1 << 6),
595 PC_FLAG_WRITING = (1 << 7),
596 /* command timed out */ 608 /* command timed out */
597 PC_FLAG_TIMEDOUT = (1 << 8), 609 PC_FLAG_TIMEDOUT = (1 << 7),
610 PC_FLAG_ZIP_DRIVE = (1 << 8),
611 PC_FLAG_DRQ_INTERRUPT = (1 << 9),
598}; 612};
599 613
600struct ide_atapi_pc { 614struct ide_atapi_pc {
@@ -627,8 +641,8 @@ struct ide_atapi_pc {
627 * to change/removal later. 641 * to change/removal later.
628 */ 642 */
629 u8 pc_buf[256]; 643 u8 pc_buf[256];
630 void (*idefloppy_callback) (ide_drive_t *); 644
631 ide_startstop_t (*idetape_callback) (ide_drive_t *); 645 void (*callback)(ide_drive_t *);
632 646
633 /* idetape only */ 647 /* idetape only */
634 struct idetape_bh *bh; 648 struct idetape_bh *bh;
@@ -798,10 +812,6 @@ int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsig
798#ifndef _IDE_C 812#ifndef _IDE_C
799extern ide_hwif_t ide_hwifs[]; /* master data repository */ 813extern ide_hwif_t ide_hwifs[]; /* master data repository */
800#endif 814#endif
801extern int ide_noacpi;
802extern int ide_acpigtf;
803extern int ide_acpionboot;
804extern int noautodma;
805 815
806extern int ide_vlb_clk; 816extern int ide_vlb_clk;
807extern int ide_pci_clk; 817extern int ide_pci_clk;
@@ -842,25 +852,12 @@ int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);
842 852
843extern ide_startstop_t ide_do_reset (ide_drive_t *); 853extern ide_startstop_t ide_do_reset (ide_drive_t *);
844 854
845extern void ide_init_drive_cmd (struct request *rq); 855extern void ide_do_drive_cmd(ide_drive_t *, struct request *);
846
847/*
848 * "action" parameter type for ide_do_drive_cmd() below.
849 */
850typedef enum {
851 ide_wait, /* insert rq at end of list, and wait for it */
852 ide_preempt, /* insert rq in front of current request */
853 ide_head_wait, /* insert rq in front of current request and wait for it */
854 ide_end /* insert rq at end of list, but don't wait for it */
855} ide_action_t;
856
857extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t);
858 856
859extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); 857extern void ide_end_drive_cmd(ide_drive_t *, u8, u8);
860 858
861enum { 859enum {
862 IDE_TFLAG_LBA48 = (1 << 0), 860 IDE_TFLAG_LBA48 = (1 << 0),
863 IDE_TFLAG_NO_SELECT_MASK = (1 << 1),
864 IDE_TFLAG_FLAGGED = (1 << 2), 861 IDE_TFLAG_FLAGGED = (1 << 2),
865 IDE_TFLAG_OUT_DATA = (1 << 3), 862 IDE_TFLAG_OUT_DATA = (1 << 3),
866 IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4), 863 IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4),
@@ -965,11 +962,23 @@ typedef struct ide_task_s {
965void ide_tf_dump(const char *, struct ide_taskfile *); 962void ide_tf_dump(const char *, struct ide_taskfile *);
966 963
967extern void SELECT_DRIVE(ide_drive_t *); 964extern void SELECT_DRIVE(ide_drive_t *);
965void SELECT_MASK(ide_drive_t *, int);
968 966
969extern int drive_is_ready(ide_drive_t *); 967extern int drive_is_ready(ide_drive_t *);
970 968
971void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8); 969void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8);
972 970
971ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
972 ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry,
973 void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *),
974 void (*retry_pc)(ide_drive_t *), void (*dsc_handle)(ide_drive_t *),
975 void (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned int,
976 int));
977ide_startstop_t ide_transfer_pc(ide_drive_t *, struct ide_atapi_pc *,
978 ide_handler_t *, unsigned int, ide_expiry_t *);
979ide_startstop_t ide_issue_pc(ide_drive_t *, struct ide_atapi_pc *,
980 ide_handler_t *, unsigned int, ide_expiry_t *);
981
973ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); 982ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *);
974 983
975void task_end_request(ide_drive_t *, struct request *, u8); 984void task_end_request(ide_drive_t *, struct request *, u8);
@@ -981,8 +990,6 @@ int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long);
981int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long); 990int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long);
982int ide_task_ioctl(ide_drive_t *, unsigned int, unsigned long); 991int ide_task_ioctl(ide_drive_t *, unsigned int, unsigned long);
983 992
984extern int system_bus_clock(void);
985
986extern int ide_driveid_update(ide_drive_t *); 993extern int ide_driveid_update(ide_drive_t *);
987extern int ide_config_drive_speed(ide_drive_t *, u8); 994extern int ide_config_drive_speed(ide_drive_t *, u8);
988extern u8 eighty_ninty_three (ide_drive_t *); 995extern u8 eighty_ninty_three (ide_drive_t *);
@@ -1334,7 +1341,8 @@ static inline void ide_set_irq(ide_drive_t *drive, int on)
1334{ 1341{
1335 ide_hwif_t *hwif = drive->hwif; 1342 ide_hwif_t *hwif = drive->hwif;
1336 1343
1337 hwif->OUTB(drive->ctl | (on ? 0 : 2), hwif->io_ports.ctl_addr); 1344 hwif->OUTBSYNC(hwif, ATA_DEVCTL_OBS | (on ? 0 : 2),
1345 hwif->io_ports.ctl_addr);
1338} 1346}
1339 1347
1340static inline u8 ide_read_status(ide_drive_t *drive) 1348static inline u8 ide_read_status(ide_drive_t *drive)
diff --git a/include/linux/ihex.h b/include/linux/ihex.h
new file mode 100644
index 000000000000..2baace2788a7
--- /dev/null
+++ b/include/linux/ihex.h
@@ -0,0 +1,74 @@
1/*
2 * Compact binary representation of ihex records. Some devices need their
3 * firmware loaded in strange orders rather than a single big blob, but
4 * actually parsing ihex-as-text within the kernel seems silly. Thus,...
5 */
6
7#ifndef __LINUX_IHEX_H__
8#define __LINUX_IHEX_H__
9
10#include <linux/types.h>
11#include <linux/firmware.h>
12#include <linux/device.h>
13
14/* Intel HEX files actually limit the length to 256 bytes, but we have
15 drivers which would benefit from using separate records which are
16 longer than that, so we extend to 16 bits of length */
17struct ihex_binrec {
18 __be32 addr;
19 __be16 len;
20 uint8_t data[0];
21} __attribute__((aligned(4)));
22
23/* Find the next record, taking into account the 4-byte alignment */
24static inline const struct ihex_binrec *
25ihex_next_binrec(const struct ihex_binrec *rec)
26{
27 int next = ((be16_to_cpu(rec->len) + 5) & ~3) - 2;
28 rec = (void *)&rec->data[next];
29
30 return be16_to_cpu(rec->len) ? rec : NULL;
31}
32
33/* Check that ihex_next_binrec() won't take us off the end of the image... */
34static inline int ihex_validate_fw(const struct firmware *fw)
35{
36 const struct ihex_binrec *rec;
37 size_t ofs = 0;
38
39 while (ofs <= fw->size - sizeof(*rec)) {
40 rec = (void *)&fw->data[ofs];
41
42 /* Zero length marks end of records */
43 if (!be16_to_cpu(rec->len))
44 return 0;
45
46 /* Point to next record... */
47 ofs += (sizeof(*rec) + be16_to_cpu(rec->len) + 3) & ~3;
48 }
49 return -EINVAL;
50}
51
52/* Request firmware and validate it so that we can trust we won't
53 * run off the end while reading records... */
54static inline int request_ihex_firmware(const struct firmware **fw,
55 const char *fw_name,
56 struct device *dev)
57{
58 const struct firmware *lfw;
59 int ret;
60
61 ret = request_firmware(&lfw, fw_name, dev);
62 if (ret)
63 return ret;
64 ret = ihex_validate_fw(lfw);
65 if (ret) {
66 dev_err(dev, "Firmware \"%s\" not valid IHEX records\n",
67 fw_name);
68 release_firmware(lfw);
69 return ret;
70 }
71 *fw = lfw;
72 return 0;
73}
74#endif /* __LINUX_IHEX_H__ */
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index f1fc7470d26c..62aa4f895abe 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -104,8 +104,11 @@ extern void enable_irq(unsigned int irq);
104 104
105#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS) 105#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
106 106
107extern cpumask_t irq_default_affinity;
108
107extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask); 109extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask);
108extern int irq_can_set_affinity(unsigned int irq); 110extern int irq_can_set_affinity(unsigned int irq);
111extern int irq_select_affinity(unsigned int irq);
109 112
110#else /* CONFIG_SMP */ 113#else /* CONFIG_SMP */
111 114
@@ -119,6 +122,8 @@ static inline int irq_can_set_affinity(unsigned int irq)
119 return 0; 122 return 0;
120} 123}
121 124
125static inline int irq_select_affinity(unsigned int irq) { return 0; }
126
122#endif /* CONFIG_SMP && CONFIG_GENERIC_HARDIRQS */ 127#endif /* CONFIG_SMP && CONFIG_GENERIC_HARDIRQS */
123 128
124#ifdef CONFIG_GENERIC_HARDIRQS 129#ifdef CONFIG_GENERIC_HARDIRQS
@@ -285,12 +290,11 @@ enum
285struct softirq_action 290struct softirq_action
286{ 291{
287 void (*action)(struct softirq_action *); 292 void (*action)(struct softirq_action *);
288 void *data;
289}; 293};
290 294
291asmlinkage void do_softirq(void); 295asmlinkage void do_softirq(void);
292asmlinkage void __do_softirq(void); 296asmlinkage void __do_softirq(void);
293extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data); 297extern void open_softirq(int nr, void (*action)(struct softirq_action *));
294extern void softirq_init(void); 298extern void softirq_init(void);
295#define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0) 299#define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0)
296extern void raise_softirq_irqoff(unsigned int nr); 300extern void raise_softirq_irqoff(unsigned int nr);
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index 2b7a1187cb29..08b987bccf89 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -99,4 +99,22 @@ static inline struct io_context *ioc_task_link(struct io_context *ioc)
99 return NULL; 99 return NULL;
100} 100}
101 101
102#ifdef CONFIG_BLOCK
103int put_io_context(struct io_context *ioc);
104void exit_io_context(void);
105struct io_context *get_io_context(gfp_t gfp_flags, int node);
106struct io_context *alloc_io_context(gfp_t gfp_flags, int node);
107void copy_io_context(struct io_context **pdst, struct io_context **psrc);
108#else
109static inline void exit_io_context(void)
110{
111}
112
113struct io_context;
114static inline int put_io_context(struct io_context *ioc)
115{
116 return 1;
117}
118#endif
119
102#endif 120#endif
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 552e0ec269c9..8ccb462ea42c 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -244,15 +244,6 @@ static inline void set_balance_irq_affinity(unsigned int irq, cpumask_t mask)
244} 244}
245#endif 245#endif
246 246
247#ifdef CONFIG_AUTO_IRQ_AFFINITY
248extern int select_smp_affinity(unsigned int irq);
249#else
250static inline int select_smp_affinity(unsigned int irq)
251{
252 return 1;
253}
254#endif
255
256extern int no_irq_affinity; 247extern int no_irq_affinity;
257 248
258static inline int irq_balancing_disabled(unsigned int irq) 249static inline int irq_balancing_disabled(unsigned int irq)
diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h
index e600c4e9b8c5..2b1c2e58566e 100644
--- a/include/linux/irqflags.h
+++ b/include/linux/irqflags.h
@@ -12,10 +12,10 @@
12#define _LINUX_TRACE_IRQFLAGS_H 12#define _LINUX_TRACE_IRQFLAGS_H
13 13
14#ifdef CONFIG_TRACE_IRQFLAGS 14#ifdef CONFIG_TRACE_IRQFLAGS
15 extern void trace_hardirqs_on(void);
16 extern void trace_hardirqs_off(void);
17 extern void trace_softirqs_on(unsigned long ip); 15 extern void trace_softirqs_on(unsigned long ip);
18 extern void trace_softirqs_off(unsigned long ip); 16 extern void trace_softirqs_off(unsigned long ip);
17 extern void trace_hardirqs_on(void);
18 extern void trace_hardirqs_off(void);
19# define trace_hardirq_context(p) ((p)->hardirq_context) 19# define trace_hardirq_context(p) ((p)->hardirq_context)
20# define trace_softirq_context(p) ((p)->softirq_context) 20# define trace_softirq_context(p) ((p)->softirq_context)
21# define trace_hardirqs_enabled(p) ((p)->hardirqs_enabled) 21# define trace_hardirqs_enabled(p) ((p)->hardirqs_enabled)
@@ -41,6 +41,15 @@
41# define INIT_TRACE_IRQFLAGS 41# define INIT_TRACE_IRQFLAGS
42#endif 42#endif
43 43
44#if defined(CONFIG_IRQSOFF_TRACER) || \
45 defined(CONFIG_PREEMPT_TRACER)
46 extern void stop_critical_timings(void);
47 extern void start_critical_timings(void);
48#else
49# define stop_critical_timings() do { } while (0)
50# define start_critical_timings() do { } while (0)
51#endif
52
44#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT 53#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
45 54
46#include <asm/irqflags.h> 55#include <asm/irqflags.h>
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index d147f0f90360..3dd209007098 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -168,6 +168,8 @@ struct commit_header {
168 unsigned char h_chksum_size; 168 unsigned char h_chksum_size;
169 unsigned char h_padding[2]; 169 unsigned char h_padding[2];
170 __be32 h_chksum[JBD2_CHECKSUM_BYTES]; 170 __be32 h_chksum[JBD2_CHECKSUM_BYTES];
171 __be64 h_commit_sec;
172 __be32 h_commit_nsec;
171}; 173};
172 174
173/* 175/*
@@ -379,6 +381,38 @@ static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh)
379 bit_spin_unlock(BH_JournalHead, &bh->b_state); 381 bit_spin_unlock(BH_JournalHead, &bh->b_state);
380} 382}
381 383
384/* Flags in jbd_inode->i_flags */
385#define __JI_COMMIT_RUNNING 0
386/* Commit of the inode data in progress. We use this flag to protect us from
387 * concurrent deletion of inode. We cannot use reference to inode for this
388 * since we cannot afford doing last iput() on behalf of kjournald
389 */
390#define JI_COMMIT_RUNNING (1 << __JI_COMMIT_RUNNING)
391
392/**
393 * struct jbd_inode is the structure linking inodes in ordered mode
394 * present in a transaction so that we can sync them during commit.
395 */
396struct jbd2_inode {
397 /* Which transaction does this inode belong to? Either the running
398 * transaction or the committing one. [j_list_lock] */
399 transaction_t *i_transaction;
400
401 /* Pointer to the running transaction modifying inode's data in case
402 * there is already a committing transaction touching it. [j_list_lock] */
403 transaction_t *i_next_transaction;
404
405 /* List of inodes in the i_transaction [j_list_lock] */
406 struct list_head i_list;
407
408 /* VFS inode this inode belongs to [constant during the lifetime
409 * of the structure] */
410 struct inode *i_vfs_inode;
411
412 /* Flags of inode [j_list_lock] */
413 unsigned int i_flags;
414};
415
382struct jbd2_revoke_table_s; 416struct jbd2_revoke_table_s;
383 417
384/** 418/**
@@ -509,24 +543,12 @@ struct transaction_s
509 struct journal_head *t_reserved_list; 543 struct journal_head *t_reserved_list;
510 544
511 /* 545 /*
512 * Doubly-linked circular list of all buffers under writeout during
513 * commit [j_list_lock]
514 */
515 struct journal_head *t_locked_list;
516
517 /*
518 * Doubly-linked circular list of all metadata buffers owned by this 546 * Doubly-linked circular list of all metadata buffers owned by this
519 * transaction [j_list_lock] 547 * transaction [j_list_lock]
520 */ 548 */
521 struct journal_head *t_buffers; 549 struct journal_head *t_buffers;
522 550
523 /* 551 /*
524 * Doubly-linked circular list of all data buffers still to be
525 * flushed before this transaction can be committed [j_list_lock]
526 */
527 struct journal_head *t_sync_datalist;
528
529 /*
530 * Doubly-linked circular list of all forget buffers (superseded 552 * Doubly-linked circular list of all forget buffers (superseded
531 * buffers which we can un-checkpoint once this transaction commits) 553 * buffers which we can un-checkpoint once this transaction commits)
532 * [j_list_lock] 554 * [j_list_lock]
@@ -565,6 +587,12 @@ struct transaction_s
565 struct journal_head *t_log_list; 587 struct journal_head *t_log_list;
566 588
567 /* 589 /*
590 * List of inodes whose data we've modified in data=ordered mode.
591 * [j_list_lock]
592 */
593 struct list_head t_inode_list;
594
595 /*
568 * Protects info related to handles 596 * Protects info related to handles
569 */ 597 */
570 spinlock_t t_handle_lock; 598 spinlock_t t_handle_lock;
@@ -1004,7 +1032,6 @@ extern int jbd2_journal_extend (handle_t *, int nblocks);
1004extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *); 1032extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *);
1005extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *); 1033extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *);
1006extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *); 1034extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *);
1007extern int jbd2_journal_dirty_data (handle_t *, struct buffer_head *);
1008extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); 1035extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *);
1009extern void jbd2_journal_release_buffer (handle_t *, struct buffer_head *); 1036extern void jbd2_journal_release_buffer (handle_t *, struct buffer_head *);
1010extern int jbd2_journal_forget (handle_t *, struct buffer_head *); 1037extern int jbd2_journal_forget (handle_t *, struct buffer_head *);
@@ -1044,6 +1071,10 @@ extern void jbd2_journal_ack_err (journal_t *);
1044extern int jbd2_journal_clear_err (journal_t *); 1071extern int jbd2_journal_clear_err (journal_t *);
1045extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *); 1072extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *);
1046extern int jbd2_journal_force_commit(journal_t *); 1073extern int jbd2_journal_force_commit(journal_t *);
1074extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode);
1075extern int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode, loff_t new_size);
1076extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode);
1077extern void jbd2_journal_release_jbd_inode(journal_t *journal, struct jbd2_inode *jinode);
1047 1078
1048/* 1079/*
1049 * journal_head management 1080 * journal_head management
@@ -1179,15 +1210,13 @@ static inline int jbd_space_needed(journal_t *journal)
1179 1210
1180/* journaling buffer types */ 1211/* journaling buffer types */
1181#define BJ_None 0 /* Not journaled */ 1212#define BJ_None 0 /* Not journaled */
1182#define BJ_SyncData 1 /* Normal data: flush before commit */ 1213#define BJ_Metadata 1 /* Normal journaled metadata */
1183#define BJ_Metadata 2 /* Normal journaled metadata */ 1214#define BJ_Forget 2 /* Buffer superseded by this transaction */
1184#define BJ_Forget 3 /* Buffer superseded by this transaction */ 1215#define BJ_IO 3 /* Buffer is for temporary IO use */
1185#define BJ_IO 4 /* Buffer is for temporary IO use */ 1216#define BJ_Shadow 4 /* Buffer contents being shadowed to the log */
1186#define BJ_Shadow 5 /* Buffer contents being shadowed to the log */ 1217#define BJ_LogCtl 5 /* Buffer contains log descriptors */
1187#define BJ_LogCtl 6 /* Buffer contains log descriptors */ 1218#define BJ_Reserved 6 /* Buffer is reserved for access by journal */
1188#define BJ_Reserved 7 /* Buffer is reserved for access by journal */ 1219#define BJ_Types 7
1189#define BJ_Locked 8 /* Locked for I/O during commit */
1190#define BJ_Types 9
1191 1220
1192extern int jbd_blocks_per_page(struct inode *inode); 1221extern int jbd_blocks_per_page(struct inode *inode);
1193 1222
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 2e70006c7fa8..f9cd7a513f9c 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -187,9 +187,6 @@ asmlinkage int vprintk(const char *fmt, va_list args)
187 __attribute__ ((format (printf, 1, 0))); 187 __attribute__ ((format (printf, 1, 0)));
188asmlinkage int printk(const char * fmt, ...) 188asmlinkage int printk(const char * fmt, ...)
189 __attribute__ ((format (printf, 1, 2))) __cold; 189 __attribute__ ((format (printf, 1, 2))) __cold;
190extern int log_buf_get_len(void);
191extern int log_buf_read(int idx);
192extern int log_buf_copy(char *dest, int idx, int len);
193 190
194extern int printk_ratelimit_jiffies; 191extern int printk_ratelimit_jiffies;
195extern int printk_ratelimit_burst; 192extern int printk_ratelimit_burst;
@@ -205,9 +202,6 @@ static inline int vprintk(const char *s, va_list args) { return 0; }
205static inline int printk(const char *s, ...) 202static inline int printk(const char *s, ...)
206 __attribute__ ((format (printf, 1, 2))); 203 __attribute__ ((format (printf, 1, 2)));
207static inline int __cold printk(const char *s, ...) { return 0; } 204static inline int __cold printk(const char *s, ...) { return 0; }
208static inline int log_buf_get_len(void) { return 0; }
209static inline int log_buf_read(int idx) { return 0; }
210static inline int log_buf_copy(char *dest, int idx, int len) { return 0; }
211static inline int printk_ratelimit(void) { return 0; } 205static inline int printk_ratelimit(void) { return 0; }
212static inline int __printk_ratelimit(int ratelimit_jiffies, \ 206static inline int __printk_ratelimit(int ratelimit_jiffies, \
213 int ratelimit_burst) { return 0; } 207 int ratelimit_burst) { return 0; }
@@ -216,7 +210,7 @@ static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \
216 { return false; } 210 { return false; }
217#endif 211#endif
218 212
219extern void __attribute__((format(printf, 1, 2))) 213extern void asmlinkage __attribute__((format(printf, 1, 2)))
220 early_printk(const char *fmt, ...); 214 early_printk(const char *fmt, ...);
221 215
222unsigned long int_sqrt(unsigned long); 216unsigned long int_sqrt(unsigned long);
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index e8ffce898bf9..cf9f40a91c9c 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -1,11 +1,11 @@
1#ifndef _LINUX_KERNEL_STAT_H 1#ifndef _LINUX_KERNEL_STAT_H
2#define _LINUX_KERNEL_STAT_H 2#define _LINUX_KERNEL_STAT_H
3 3
4#include <asm/irq.h>
5#include <linux/smp.h> 4#include <linux/smp.h>
6#include <linux/threads.h> 5#include <linux/threads.h>
7#include <linux/percpu.h> 6#include <linux/percpu.h>
8#include <linux/cpumask.h> 7#include <linux/cpumask.h>
8#include <asm/irq.h>
9#include <asm/cputime.h> 9#include <asm/cputime.h>
10 10
11/* 11/*
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 1036631ff4fa..04a3556bdea6 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -259,6 +259,10 @@ void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head);
259struct jprobe; 259struct jprobe;
260struct kretprobe; 260struct kretprobe;
261 261
262static inline struct kprobe *get_kprobe(void *addr)
263{
264 return NULL;
265}
262static inline struct kprobe *kprobe_running(void) 266static inline struct kprobe *kprobe_running(void)
263{ 267{
264 return NULL; 268 return NULL;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index e57e5d08312d..5b247b8a6b3b 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -27,6 +27,7 @@
27#define __LINUX_LIBATA_H__ 27#define __LINUX_LIBATA_H__
28 28
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/jiffies.h>
30#include <linux/interrupt.h> 31#include <linux/interrupt.h>
31#include <linux/dma-mapping.h> 32#include <linux/dma-mapping.h>
32#include <linux/scatterlist.h> 33#include <linux/scatterlist.h>
@@ -115,7 +116,7 @@ enum {
115 /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ 116 /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */
116 ATA_MAX_QUEUE = 32, 117 ATA_MAX_QUEUE = 32,
117 ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, 118 ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1,
118 ATA_SHORT_PAUSE = (HZ >> 6) + 1, 119 ATA_SHORT_PAUSE = 16,
119 120
120 ATAPI_MAX_DRAIN = 16 << 10, 121 ATAPI_MAX_DRAIN = 16 << 10,
121 122
@@ -168,6 +169,7 @@ enum {
168 ATA_LFLAG_ASSUME_CLASS = ATA_LFLAG_ASSUME_ATA | ATA_LFLAG_ASSUME_SEMB, 169 ATA_LFLAG_ASSUME_CLASS = ATA_LFLAG_ASSUME_ATA | ATA_LFLAG_ASSUME_SEMB,
169 ATA_LFLAG_NO_RETRY = (1 << 5), /* don't retry this link */ 170 ATA_LFLAG_NO_RETRY = (1 << 5), /* don't retry this link */
170 ATA_LFLAG_DISABLED = (1 << 6), /* link is disabled */ 171 ATA_LFLAG_DISABLED = (1 << 6), /* link is disabled */
172 ATA_LFLAG_SW_ACTIVITY = (1 << 7), /* keep activity stats */
171 173
172 /* struct ata_port flags */ 174 /* struct ata_port flags */
173 ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */ 175 ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */
@@ -190,6 +192,10 @@ enum {
190 ATA_FLAG_AN = (1 << 18), /* controller supports AN */ 192 ATA_FLAG_AN = (1 << 18), /* controller supports AN */
191 ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */ 193 ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */
192 ATA_FLAG_IPM = (1 << 20), /* driver can handle IPM */ 194 ATA_FLAG_IPM = (1 << 20), /* driver can handle IPM */
195 ATA_FLAG_EM = (1 << 21), /* driver supports enclosure
196 * management */
197 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity
198 * led */
193 199
194 /* The following flag belongs to ap->pflags but is kept in 200 /* The following flag belongs to ap->pflags but is kept in
195 * ap->flags because it's referenced in many LLDs and will be 201 * ap->flags because it's referenced in many LLDs and will be
@@ -234,17 +240,16 @@ enum {
234 /* bits 24:31 of host->flags are reserved for LLD specific flags */ 240 /* bits 24:31 of host->flags are reserved for LLD specific flags */
235 241
236 /* various lengths of time */ 242 /* various lengths of time */
237 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ 243 ATA_TMOUT_BOOT = 30000, /* heuristic */
238 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ 244 ATA_TMOUT_BOOT_QUICK = 7000, /* heuristic */
239 ATA_TMOUT_INTERNAL = 30 * HZ, 245 ATA_TMOUT_INTERNAL_QUICK = 5000,
240 ATA_TMOUT_INTERNAL_QUICK = 5 * HZ,
241 246
242 /* FIXME: GoVault needs 2s but we can't afford that without 247 /* FIXME: GoVault needs 2s but we can't afford that without
243 * parallel probing. 800ms is enough for iVDR disk 248 * parallel probing. 800ms is enough for iVDR disk
244 * HHD424020F7SV00. Increase to 2secs when parallel probing 249 * HHD424020F7SV00. Increase to 2secs when parallel probing
245 * is in place. 250 * is in place.
246 */ 251 */
247 ATA_TMOUT_FF_WAIT = 4 * HZ / 5, 252 ATA_TMOUT_FF_WAIT = 800,
248 253
249 /* Spec mandates to wait for ">= 2ms" before checking status 254 /* Spec mandates to wait for ">= 2ms" before checking status
250 * after reset. We wait 150ms, because that was the magic 255 * after reset. We wait 150ms, because that was the magic
@@ -256,14 +261,14 @@ enum {
256 * 261 *
257 * Old drivers/ide uses the 2mS rule and then waits for ready. 262 * Old drivers/ide uses the 2mS rule and then waits for ready.
258 */ 263 */
259 ATA_WAIT_AFTER_RESET_MSECS = 150, 264 ATA_WAIT_AFTER_RESET = 150,
260 265
261 /* If PMP is supported, we have to do follow-up SRST. As some 266 /* If PMP is supported, we have to do follow-up SRST. As some
262 * PMPs don't send D2H Reg FIS after hardreset, LLDs are 267 * PMPs don't send D2H Reg FIS after hardreset, LLDs are
263 * advised to wait only for the following duration before 268 * advised to wait only for the following duration before
264 * doing SRST. 269 * doing SRST.
265 */ 270 */
266 ATA_TMOUT_PMP_SRST_WAIT = 1 * HZ, 271 ATA_TMOUT_PMP_SRST_WAIT = 1000,
267 272
268 /* ATA bus states */ 273 /* ATA bus states */
269 BUS_UNKNOWN = 0, 274 BUS_UNKNOWN = 0,
@@ -340,6 +345,11 @@ enum {
340 345
341 SATA_PMP_RW_TIMEOUT = 3000, /* PMP read/write timeout */ 346 SATA_PMP_RW_TIMEOUT = 3000, /* PMP read/write timeout */
342 347
348 /* This should match the actual table size of
349 * ata_eh_cmd_timeout_table in libata-eh.c.
350 */
351 ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 5,
352
343 /* Horkage types. May be set by libata or controller on drives 353 /* Horkage types. May be set by libata or controller on drives
344 (some horkage may be drive/controller pair dependant */ 354 (some horkage may be drive/controller pair dependant */
345 355
@@ -441,6 +451,15 @@ enum link_pm {
441 MEDIUM_POWER, 451 MEDIUM_POWER,
442}; 452};
443extern struct device_attribute dev_attr_link_power_management_policy; 453extern struct device_attribute dev_attr_link_power_management_policy;
454extern struct device_attribute dev_attr_em_message_type;
455extern struct device_attribute dev_attr_em_message;
456extern struct device_attribute dev_attr_sw_activity;
457
458enum sw_activity {
459 OFF,
460 BLINK_ON,
461 BLINK_OFF,
462};
444 463
445#ifdef CONFIG_ATA_SFF 464#ifdef CONFIG_ATA_SFF
446struct ata_ioports { 465struct ata_ioports {
@@ -597,10 +616,14 @@ struct ata_eh_info {
597struct ata_eh_context { 616struct ata_eh_context {
598 struct ata_eh_info i; 617 struct ata_eh_info i;
599 int tries[ATA_MAX_DEVICES]; 618 int tries[ATA_MAX_DEVICES];
619 int cmd_timeout_idx[ATA_MAX_DEVICES]
620 [ATA_EH_CMD_TIMEOUT_TABLE_SIZE];
600 unsigned int classes[ATA_MAX_DEVICES]; 621 unsigned int classes[ATA_MAX_DEVICES];
601 unsigned int did_probe_mask; 622 unsigned int did_probe_mask;
602 unsigned int saved_ncq_enabled; 623 unsigned int saved_ncq_enabled;
603 u8 saved_xfer_mode[ATA_MAX_DEVICES]; 624 u8 saved_xfer_mode[ATA_MAX_DEVICES];
625 /* timestamp for the last reset attempt or success */
626 unsigned long last_reset;
604}; 627};
605 628
606struct ata_acpi_drive 629struct ata_acpi_drive
@@ -692,6 +715,7 @@ struct ata_port {
692 struct timer_list fastdrain_timer; 715 struct timer_list fastdrain_timer;
693 unsigned long fastdrain_cnt; 716 unsigned long fastdrain_cnt;
694 717
718 int em_message_type;
695 void *private_data; 719 void *private_data;
696 720
697#ifdef CONFIG_ATA_ACPI 721#ifdef CONFIG_ATA_ACPI
@@ -783,6 +807,12 @@ struct ata_port_operations {
783 u8 (*bmdma_status)(struct ata_port *ap); 807 u8 (*bmdma_status)(struct ata_port *ap);
784#endif /* CONFIG_ATA_SFF */ 808#endif /* CONFIG_ATA_SFF */
785 809
810 ssize_t (*em_show)(struct ata_port *ap, char *buf);
811 ssize_t (*em_store)(struct ata_port *ap, const char *message,
812 size_t size);
813 ssize_t (*sw_activity_show)(struct ata_device *dev, char *buf);
814 ssize_t (*sw_activity_store)(struct ata_device *dev,
815 enum sw_activity val);
786 /* 816 /*
787 * Obsolete 817 * Obsolete
788 */ 818 */
@@ -895,8 +925,7 @@ extern void ata_host_resume(struct ata_host *host);
895#endif 925#endif
896extern int ata_ratelimit(void); 926extern int ata_ratelimit(void);
897extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, 927extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
898 unsigned long interval_msec, 928 unsigned long interval, unsigned long timeout);
899 unsigned long timeout_msec);
900extern int atapi_cmd_type(u8 opcode); 929extern int atapi_cmd_type(u8 opcode);
901extern void ata_tf_to_fis(const struct ata_taskfile *tf, 930extern void ata_tf_to_fis(const struct ata_taskfile *tf,
902 u8 pmp, int is_cmd, u8 *fis); 931 u8 pmp, int is_cmd, u8 *fis);
@@ -1389,6 +1418,12 @@ static inline int ata_check_ready(u8 status)
1389 return 0; 1418 return 0;
1390} 1419}
1391 1420
1421static inline unsigned long ata_deadline(unsigned long from_jiffies,
1422 unsigned long timeout_msecs)
1423{
1424 return from_jiffies + msecs_to_jiffies(timeout_msecs);
1425}
1426
1392 1427
1393/************************************************************************** 1428/**************************************************************************
1394 * PMP - drivers/ata/libata-pmp.c 1429 * PMP - drivers/ata/libata-pmp.c
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 2119610b24f8..56ba37394656 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -1,8 +1,11 @@
1#ifndef _LINUX_LINKAGE_H 1#ifndef _LINUX_LINKAGE_H
2#define _LINUX_LINKAGE_H 2#define _LINUX_LINKAGE_H
3 3
4#include <linux/compiler.h>
4#include <asm/linkage.h> 5#include <asm/linkage.h>
5 6
7#define notrace __attribute__((no_instrument_function))
8
6#ifdef __cplusplus 9#ifdef __cplusplus
7#define CPP_ASMLINKAGE extern "C" 10#define CPP_ASMLINKAGE extern "C"
8#else 11#else
@@ -17,6 +20,9 @@
17# define asmregparm 20# define asmregparm
18#endif 21#endif
19 22
23#define __page_aligned_data __section(.data.page_aligned) __aligned(PAGE_SIZE)
24#define __page_aligned_bss __section(.bss.page_aligned) __aligned(PAGE_SIZE)
25
20/* 26/*
21 * This is used by architectures to keep arguments on the stack 27 * This is used by architectures to keep arguments on the stack
22 * untouched by the compiler by keeping them live until the end. 28 * untouched by the compiler by keeping them live until the end.
diff --git a/include/linux/list.h b/include/linux/list.h
index 08cf4f651889..139ec41d9c2e 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -85,65 +85,6 @@ static inline void list_add_tail(struct list_head *new, struct list_head *head)
85} 85}
86 86
87/* 87/*
88 * Insert a new entry between two known consecutive entries.
89 *
90 * This is only for internal list manipulation where we know
91 * the prev/next entries already!
92 */
93static inline void __list_add_rcu(struct list_head * new,
94 struct list_head * prev, struct list_head * next)
95{
96 new->next = next;
97 new->prev = prev;
98 smp_wmb();
99 next->prev = new;
100 prev->next = new;
101}
102
103/**
104 * list_add_rcu - add a new entry to rcu-protected list
105 * @new: new entry to be added
106 * @head: list head to add it after
107 *
108 * Insert a new entry after the specified head.
109 * This is good for implementing stacks.
110 *
111 * The caller must take whatever precautions are necessary
112 * (such as holding appropriate locks) to avoid racing
113 * with another list-mutation primitive, such as list_add_rcu()
114 * or list_del_rcu(), running on this same list.
115 * However, it is perfectly legal to run concurrently with
116 * the _rcu list-traversal primitives, such as
117 * list_for_each_entry_rcu().
118 */
119static inline void list_add_rcu(struct list_head *new, struct list_head *head)
120{
121 __list_add_rcu(new, head, head->next);
122}
123
124/**
125 * list_add_tail_rcu - add a new entry to rcu-protected list
126 * @new: new entry to be added
127 * @head: list head to add it before
128 *
129 * Insert a new entry before the specified head.
130 * This is useful for implementing queues.
131 *
132 * The caller must take whatever precautions are necessary
133 * (such as holding appropriate locks) to avoid racing
134 * with another list-mutation primitive, such as list_add_tail_rcu()
135 * or list_del_rcu(), running on this same list.
136 * However, it is perfectly legal to run concurrently with
137 * the _rcu list-traversal primitives, such as
138 * list_for_each_entry_rcu().
139 */
140static inline void list_add_tail_rcu(struct list_head *new,
141 struct list_head *head)
142{
143 __list_add_rcu(new, head->prev, head);
144}
145
146/*
147 * Delete a list entry by making the prev/next entries 88 * Delete a list entry by making the prev/next entries
148 * point to each other. 89 * point to each other.
149 * 90 *
@@ -174,36 +115,6 @@ extern void list_del(struct list_head *entry);
174#endif 115#endif
175 116
176/** 117/**
177 * list_del_rcu - deletes entry from list without re-initialization
178 * @entry: the element to delete from the list.
179 *
180 * Note: list_empty() on entry does not return true after this,
181 * the entry is in an undefined state. It is useful for RCU based
182 * lockfree traversal.
183 *
184 * In particular, it means that we can not poison the forward
185 * pointers that may still be used for walking the list.
186 *
187 * The caller must take whatever precautions are necessary
188 * (such as holding appropriate locks) to avoid racing
189 * with another list-mutation primitive, such as list_del_rcu()
190 * or list_add_rcu(), running on this same list.
191 * However, it is perfectly legal to run concurrently with
192 * the _rcu list-traversal primitives, such as
193 * list_for_each_entry_rcu().
194 *
195 * Note that the caller is not permitted to immediately free
196 * the newly deleted entry. Instead, either synchronize_rcu()
197 * or call_rcu() must be used to defer freeing until an RCU
198 * grace period has elapsed.
199 */
200static inline void list_del_rcu(struct list_head *entry)
201{
202 __list_del(entry->prev, entry->next);
203 entry->prev = LIST_POISON2;
204}
205
206/**
207 * list_replace - replace old entry by new one 118 * list_replace - replace old entry by new one
208 * @old : the element to be replaced 119 * @old : the element to be replaced
209 * @new : the new element to insert 120 * @new : the new element to insert
@@ -227,25 +138,6 @@ static inline void list_replace_init(struct list_head *old,
227} 138}
228 139
229/** 140/**
230 * list_replace_rcu - replace old entry by new one
231 * @old : the element to be replaced
232 * @new : the new element to insert
233 *
234 * The @old entry will be replaced with the @new entry atomically.
235 * Note: @old should not be empty.
236 */
237static inline void list_replace_rcu(struct list_head *old,
238 struct list_head *new)
239{
240 new->next = old->next;
241 new->prev = old->prev;
242 smp_wmb();
243 new->next->prev = new;
244 new->prev->next = new;
245 old->prev = LIST_POISON2;
246}
247
248/**
249 * list_del_init - deletes entry from list and reinitialize it. 141 * list_del_init - deletes entry from list and reinitialize it.
250 * @entry: the element to delete from the list. 142 * @entry: the element to delete from the list.
251 */ 143 */
@@ -369,62 +261,6 @@ static inline void list_splice_init(struct list_head *list,
369} 261}
370 262
371/** 263/**
372 * list_splice_init_rcu - splice an RCU-protected list into an existing list.
373 * @list: the RCU-protected list to splice
374 * @head: the place in the list to splice the first list into
375 * @sync: function to sync: synchronize_rcu(), synchronize_sched(), ...
376 *
377 * @head can be RCU-read traversed concurrently with this function.
378 *
379 * Note that this function blocks.
380 *
381 * Important note: the caller must take whatever action is necessary to
382 * prevent any other updates to @head. In principle, it is possible
383 * to modify the list as soon as sync() begins execution.
384 * If this sort of thing becomes necessary, an alternative version
385 * based on call_rcu() could be created. But only if -really-
386 * needed -- there is no shortage of RCU API members.
387 */
388static inline void list_splice_init_rcu(struct list_head *list,
389 struct list_head *head,
390 void (*sync)(void))
391{
392 struct list_head *first = list->next;
393 struct list_head *last = list->prev;
394 struct list_head *at = head->next;
395
396 if (list_empty(head))
397 return;
398
399 /* "first" and "last" tracking list, so initialize it. */
400
401 INIT_LIST_HEAD(list);
402
403 /*
404 * At this point, the list body still points to the source list.
405 * Wait for any readers to finish using the list before splicing
406 * the list body into the new list. Any new readers will see
407 * an empty list.
408 */
409
410 sync();
411
412 /*
413 * Readers are finished with the source list, so perform splice.
414 * The order is important if the new list is global and accessible
415 * to concurrent RCU readers. Note that RCU readers are not
416 * permitted to traverse the prev pointers without excluding
417 * this function.
418 */
419
420 last->next = at;
421 smp_wmb();
422 head->next = first;
423 first->prev = head;
424 at->prev = last;
425}
426
427/**
428 * list_entry - get the struct for this entry 264 * list_entry - get the struct for this entry
429 * @ptr: the &struct list_head pointer. 265 * @ptr: the &struct list_head pointer.
430 * @type: the type of the struct this is embedded in. 266 * @type: the type of the struct this is embedded in.
@@ -629,57 +465,6 @@ static inline void list_splice_init_rcu(struct list_head *list,
629 &pos->member != (head); \ 465 &pos->member != (head); \
630 pos = n, n = list_entry(n->member.prev, typeof(*n), member)) 466 pos = n, n = list_entry(n->member.prev, typeof(*n), member))
631 467
632/**
633 * list_for_each_rcu - iterate over an rcu-protected list
634 * @pos: the &struct list_head to use as a loop cursor.
635 * @head: the head for your list.
636 *
637 * This list-traversal primitive may safely run concurrently with
638 * the _rcu list-mutation primitives such as list_add_rcu()
639 * as long as the traversal is guarded by rcu_read_lock().
640 */
641#define list_for_each_rcu(pos, head) \
642 for (pos = rcu_dereference((head)->next); \
643 prefetch(pos->next), pos != (head); \
644 pos = rcu_dereference(pos->next))
645
646#define __list_for_each_rcu(pos, head) \
647 for (pos = rcu_dereference((head)->next); \
648 pos != (head); \
649 pos = rcu_dereference(pos->next))
650
651/**
652 * list_for_each_entry_rcu - iterate over rcu list of given type
653 * @pos: the type * to use as a loop cursor.
654 * @head: the head for your list.
655 * @member: the name of the list_struct within the struct.
656 *
657 * This list-traversal primitive may safely run concurrently with
658 * the _rcu list-mutation primitives such as list_add_rcu()
659 * as long as the traversal is guarded by rcu_read_lock().
660 */
661#define list_for_each_entry_rcu(pos, head, member) \
662 for (pos = list_entry(rcu_dereference((head)->next), typeof(*pos), member); \
663 prefetch(pos->member.next), &pos->member != (head); \
664 pos = list_entry(rcu_dereference(pos->member.next), typeof(*pos), member))
665
666
667/**
668 * list_for_each_continue_rcu
669 * @pos: the &struct list_head to use as a loop cursor.
670 * @head: the head for your list.
671 *
672 * Iterate over an rcu-protected list, continuing after current point.
673 *
674 * This list-traversal primitive may safely run concurrently with
675 * the _rcu list-mutation primitives such as list_add_rcu()
676 * as long as the traversal is guarded by rcu_read_lock().
677 */
678#define list_for_each_continue_rcu(pos, head) \
679 for ((pos) = rcu_dereference((pos)->next); \
680 prefetch((pos)->next), (pos) != (head); \
681 (pos) = rcu_dereference((pos)->next))
682
683/* 468/*
684 * Double linked lists with a single pointer list head. 469 * Double linked lists with a single pointer list head.
685 * Mostly useful for hash tables where the two pointer list head is 470 * Mostly useful for hash tables where the two pointer list head is
@@ -730,31 +515,6 @@ static inline void hlist_del(struct hlist_node *n)
730 n->pprev = LIST_POISON2; 515 n->pprev = LIST_POISON2;
731} 516}
732 517
733/**
734 * hlist_del_rcu - deletes entry from hash list without re-initialization
735 * @n: the element to delete from the hash list.
736 *
737 * Note: list_unhashed() on entry does not return true after this,
738 * the entry is in an undefined state. It is useful for RCU based
739 * lockfree traversal.
740 *
741 * In particular, it means that we can not poison the forward
742 * pointers that may still be used for walking the hash list.
743 *
744 * The caller must take whatever precautions are necessary
745 * (such as holding appropriate locks) to avoid racing
746 * with another list-mutation primitive, such as hlist_add_head_rcu()
747 * or hlist_del_rcu(), running on this same list.
748 * However, it is perfectly legal to run concurrently with
749 * the _rcu list-traversal primitives, such as
750 * hlist_for_each_entry().
751 */
752static inline void hlist_del_rcu(struct hlist_node *n)
753{
754 __hlist_del(n);
755 n->pprev = LIST_POISON2;
756}
757
758static inline void hlist_del_init(struct hlist_node *n) 518static inline void hlist_del_init(struct hlist_node *n)
759{ 519{
760 if (!hlist_unhashed(n)) { 520 if (!hlist_unhashed(n)) {
@@ -763,27 +523,6 @@ static inline void hlist_del_init(struct hlist_node *n)
763 } 523 }
764} 524}
765 525
766/**
767 * hlist_replace_rcu - replace old entry by new one
768 * @old : the element to be replaced
769 * @new : the new element to insert
770 *
771 * The @old entry will be replaced with the @new entry atomically.
772 */
773static inline void hlist_replace_rcu(struct hlist_node *old,
774 struct hlist_node *new)
775{
776 struct hlist_node *next = old->next;
777
778 new->next = next;
779 new->pprev = old->pprev;
780 smp_wmb();
781 if (next)
782 new->next->pprev = &new->next;
783 *new->pprev = new;
784 old->pprev = LIST_POISON2;
785}
786
787static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) 526static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
788{ 527{
789 struct hlist_node *first = h->first; 528 struct hlist_node *first = h->first;
@@ -794,38 +533,6 @@ static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
794 n->pprev = &h->first; 533 n->pprev = &h->first;
795} 534}
796 535
797
798/**
799 * hlist_add_head_rcu
800 * @n: the element to add to the hash list.
801 * @h: the list to add to.
802 *
803 * Description:
804 * Adds the specified element to the specified hlist,
805 * while permitting racing traversals.
806 *
807 * The caller must take whatever precautions are necessary
808 * (such as holding appropriate locks) to avoid racing
809 * with another list-mutation primitive, such as hlist_add_head_rcu()
810 * or hlist_del_rcu(), running on this same list.
811 * However, it is perfectly legal to run concurrently with
812 * the _rcu list-traversal primitives, such as
813 * hlist_for_each_entry_rcu(), used to prevent memory-consistency
814 * problems on Alpha CPUs. Regardless of the type of CPU, the
815 * list-traversal primitive must be guarded by rcu_read_lock().
816 */
817static inline void hlist_add_head_rcu(struct hlist_node *n,
818 struct hlist_head *h)
819{
820 struct hlist_node *first = h->first;
821 n->next = first;
822 n->pprev = &h->first;
823 smp_wmb();
824 if (first)
825 first->pprev = &n->next;
826 h->first = n;
827}
828
829/* next must be != NULL */ 536/* next must be != NULL */
830static inline void hlist_add_before(struct hlist_node *n, 537static inline void hlist_add_before(struct hlist_node *n,
831 struct hlist_node *next) 538 struct hlist_node *next)
@@ -847,63 +554,6 @@ static inline void hlist_add_after(struct hlist_node *n,
847 next->next->pprev = &next->next; 554 next->next->pprev = &next->next;
848} 555}
849 556
850/**
851 * hlist_add_before_rcu
852 * @n: the new element to add to the hash list.
853 * @next: the existing element to add the new element before.
854 *
855 * Description:
856 * Adds the specified element to the specified hlist
857 * before the specified node while permitting racing traversals.
858 *
859 * The caller must take whatever precautions are necessary
860 * (such as holding appropriate locks) to avoid racing
861 * with another list-mutation primitive, such as hlist_add_head_rcu()
862 * or hlist_del_rcu(), running on this same list.
863 * However, it is perfectly legal to run concurrently with
864 * the _rcu list-traversal primitives, such as
865 * hlist_for_each_entry_rcu(), used to prevent memory-consistency
866 * problems on Alpha CPUs.
867 */
868static inline void hlist_add_before_rcu(struct hlist_node *n,
869 struct hlist_node *next)
870{
871 n->pprev = next->pprev;
872 n->next = next;
873 smp_wmb();
874 next->pprev = &n->next;
875 *(n->pprev) = n;
876}
877
878/**
879 * hlist_add_after_rcu
880 * @prev: the existing element to add the new element after.
881 * @n: the new element to add to the hash list.
882 *
883 * Description:
884 * Adds the specified element to the specified hlist
885 * after the specified node while permitting racing traversals.
886 *
887 * The caller must take whatever precautions are necessary
888 * (such as holding appropriate locks) to avoid racing
889 * with another list-mutation primitive, such as hlist_add_head_rcu()
890 * or hlist_del_rcu(), running on this same list.
891 * However, it is perfectly legal to run concurrently with
892 * the _rcu list-traversal primitives, such as
893 * hlist_for_each_entry_rcu(), used to prevent memory-consistency
894 * problems on Alpha CPUs.
895 */
896static inline void hlist_add_after_rcu(struct hlist_node *prev,
897 struct hlist_node *n)
898{
899 n->next = prev->next;
900 n->pprev = &prev->next;
901 smp_wmb();
902 prev->next = n;
903 if (n->next)
904 n->next->pprev = &n->next;
905}
906
907#define hlist_entry(ptr, type, member) container_of(ptr,type,member) 557#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
908 558
909#define hlist_for_each(pos, head) \ 559#define hlist_for_each(pos, head) \
@@ -964,21 +614,4 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
964 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 614 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
965 pos = n) 615 pos = n)
966 616
967/**
968 * hlist_for_each_entry_rcu - iterate over rcu list of given type
969 * @tpos: the type * to use as a loop cursor.
970 * @pos: the &struct hlist_node to use as a loop cursor.
971 * @head: the head for your list.
972 * @member: the name of the hlist_node within the struct.
973 *
974 * This list-traversal primitive may safely run concurrently with
975 * the _rcu list-mutation primitives such as hlist_add_head_rcu()
976 * as long as the traversal is guarded by rcu_read_lock().
977 */
978#define hlist_for_each_entry_rcu(tpos, pos, head, member) \
979 for (pos = rcu_dereference((head)->first); \
980 pos && ({ prefetch(pos->next); 1;}) && \
981 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
982 pos = rcu_dereference(pos->next))
983
984#endif 617#endif
diff --git a/include/linux/lm_interface.h b/include/linux/lm_interface.h
index f274997bc283..2ed8fa1b762b 100644
--- a/include/linux/lm_interface.h
+++ b/include/linux/lm_interface.h
@@ -122,11 +122,9 @@ typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data);
122 */ 122 */
123 123
124#define LM_OUT_ST_MASK 0x00000003 124#define LM_OUT_ST_MASK 0x00000003
125#define LM_OUT_CACHEABLE 0x00000004
126#define LM_OUT_CANCELED 0x00000008 125#define LM_OUT_CANCELED 0x00000008
127#define LM_OUT_ASYNC 0x00000080 126#define LM_OUT_ASYNC 0x00000080
128#define LM_OUT_ERROR 0x00000100 127#define LM_OUT_ERROR 0x00000100
129#define LM_OUT_CONV_DEADLK 0x00000200
130 128
131/* 129/*
132 * lm_callback_t types 130 * lm_callback_t types
@@ -138,9 +136,6 @@ typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data);
138 * LM_CB_NEED_RECOVERY 136 * LM_CB_NEED_RECOVERY
139 * The given journal needs to be recovered. 137 * The given journal needs to be recovered.
140 * 138 *
141 * LM_CB_DROPLOCKS
142 * Reduce the number of cached locks.
143 *
144 * LM_CB_ASYNC 139 * LM_CB_ASYNC
145 * The given lock has been granted. 140 * The given lock has been granted.
146 */ 141 */
@@ -149,7 +144,6 @@ typedef void (*lm_callback_t) (void *ptr, unsigned int type, void *data);
149#define LM_CB_NEED_D 258 144#define LM_CB_NEED_D 258
150#define LM_CB_NEED_S 259 145#define LM_CB_NEED_S 259
151#define LM_CB_NEED_RECOVERY 260 146#define LM_CB_NEED_RECOVERY 260
152#define LM_CB_DROPLOCKS 261
153#define LM_CB_ASYNC 262 147#define LM_CB_ASYNC 262
154 148
155/* 149/*
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 4c4d236ded18..2486eb4edbf1 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -182,6 +182,9 @@ struct lock_list {
182 * We record lock dependency chains, so that we can cache them: 182 * We record lock dependency chains, so that we can cache them:
183 */ 183 */
184struct lock_chain { 184struct lock_chain {
185 u8 irq_context;
186 u8 depth;
187 u16 base;
185 struct list_head entry; 188 struct list_head entry;
186 u64 chain_key; 189 u64 chain_key;
187}; 190};
@@ -276,14 +279,6 @@ extern void lockdep_init_map(struct lockdep_map *lock, const char *name,
276 (lock)->dep_map.key, sub) 279 (lock)->dep_map.key, sub)
277 280
278/* 281/*
279 * To initialize a lockdep_map statically use this macro.
280 * Note that _name must not be NULL.
281 */
282#define STATIC_LOCKDEP_MAP_INIT(_name, _key) \
283 { .name = (_name), .key = (void *)(_key), }
284
285
286/*
287 * Acquire a lock. 282 * Acquire a lock.
288 * 283 *
289 * Values for "read": 284 * Values for "read":
diff --git a/include/linux/marker.h b/include/linux/marker.h
index 430f6adf9762..1290653f9241 100644
--- a/include/linux/marker.h
+++ b/include/linux/marker.h
@@ -44,8 +44,8 @@ struct marker {
44 */ 44 */
45 char state; /* Marker state. */ 45 char state; /* Marker state. */
46 char ptype; /* probe type : 0 : single, 1 : multi */ 46 char ptype; /* probe type : 0 : single, 1 : multi */
47 void (*call)(const struct marker *mdata, /* Probe wrapper */ 47 /* Probe wrapper */
48 void *call_private, const char *fmt, ...); 48 void (*call)(const struct marker *mdata, void *call_private, ...);
49 struct marker_probe_closure single; 49 struct marker_probe_closure single;
50 struct marker_probe_closure *multi; 50 struct marker_probe_closure *multi;
51} __attribute__((aligned(8))); 51} __attribute__((aligned(8)));
@@ -58,8 +58,12 @@ struct marker {
58 * Make sure the alignment of the structure in the __markers section will 58 * Make sure the alignment of the structure in the __markers section will
59 * not add unwanted padding between the beginning of the section and the 59 * not add unwanted padding between the beginning of the section and the
60 * structure. Force alignment to the same alignment as the section start. 60 * structure. Force alignment to the same alignment as the section start.
61 *
62 * The "generic" argument controls which marker enabling mechanism must be used.
63 * If generic is true, a variable read is used.
64 * If generic is false, immediate values are used.
61 */ 65 */
62#define __trace_mark(name, call_private, format, args...) \ 66#define __trace_mark(generic, name, call_private, format, args...) \
63 do { \ 67 do { \
64 static const char __mstrtab_##name[] \ 68 static const char __mstrtab_##name[] \
65 __attribute__((section("__markers_strings"))) \ 69 __attribute__((section("__markers_strings"))) \
@@ -72,15 +76,14 @@ struct marker {
72 __mark_check_format(format, ## args); \ 76 __mark_check_format(format, ## args); \
73 if (unlikely(__mark_##name.state)) { \ 77 if (unlikely(__mark_##name.state)) { \
74 (*__mark_##name.call) \ 78 (*__mark_##name.call) \
75 (&__mark_##name, call_private, \ 79 (&__mark_##name, call_private, ## args);\
76 format, ## args); \
77 } \ 80 } \
78 } while (0) 81 } while (0)
79 82
80extern void marker_update_probe_range(struct marker *begin, 83extern void marker_update_probe_range(struct marker *begin,
81 struct marker *end); 84 struct marker *end);
82#else /* !CONFIG_MARKERS */ 85#else /* !CONFIG_MARKERS */
83#define __trace_mark(name, call_private, format, args...) \ 86#define __trace_mark(generic, name, call_private, format, args...) \
84 __mark_check_format(format, ## args) 87 __mark_check_format(format, ## args)
85static inline void marker_update_probe_range(struct marker *begin, 88static inline void marker_update_probe_range(struct marker *begin,
86 struct marker *end) 89 struct marker *end)
@@ -88,15 +91,30 @@ static inline void marker_update_probe_range(struct marker *begin,
88#endif /* CONFIG_MARKERS */ 91#endif /* CONFIG_MARKERS */
89 92
90/** 93/**
91 * trace_mark - Marker 94 * trace_mark - Marker using code patching
92 * @name: marker name, not quoted. 95 * @name: marker name, not quoted.
93 * @format: format string 96 * @format: format string
94 * @args...: variable argument list 97 * @args...: variable argument list
95 * 98 *
96 * Places a marker. 99 * Places a marker using optimized code patching technique (imv_read())
100 * to be enabled when immediate values are present.
97 */ 101 */
98#define trace_mark(name, format, args...) \ 102#define trace_mark(name, format, args...) \
99 __trace_mark(name, NULL, format, ## args) 103 __trace_mark(0, name, NULL, format, ## args)
104
105/**
106 * _trace_mark - Marker using variable read
107 * @name: marker name, not quoted.
108 * @format: format string
109 * @args...: variable argument list
110 *
111 * Places a marker using a standard memory read (_imv_read()) to be
112 * enabled. Should be used for markers in code paths where instruction
113 * modification based enabling is not welcome. (__init and __exit functions,
114 * lockdep, some traps, printk).
115 */
116#define _trace_mark(name, format, args...) \
117 __trace_mark(1, name, NULL, format, ## args)
100 118
101/** 119/**
102 * MARK_NOARGS - Format string for a marker with no argument. 120 * MARK_NOARGS - Format string for a marker with no argument.
@@ -117,9 +135,9 @@ static inline void __printf(1, 2) ___mark_check_format(const char *fmt, ...)
117extern marker_probe_func __mark_empty_function; 135extern marker_probe_func __mark_empty_function;
118 136
119extern void marker_probe_cb(const struct marker *mdata, 137extern void marker_probe_cb(const struct marker *mdata,
120 void *call_private, const char *fmt, ...); 138 void *call_private, ...);
121extern void marker_probe_cb_noarg(const struct marker *mdata, 139extern void marker_probe_cb_noarg(const struct marker *mdata,
122 void *call_private, const char *fmt, ...); 140 void *call_private, ...);
123 141
124/* 142/*
125 * Connect a probe to a marker. 143 * Connect a probe to a marker.
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index a744383d16e9..81b3dd5206e0 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -398,7 +398,8 @@ int mlx4_srq_query(struct mlx4_dev *dev, struct mlx4_srq *srq, int *limit_waterm
398int mlx4_INIT_PORT(struct mlx4_dev *dev, int port); 398int mlx4_INIT_PORT(struct mlx4_dev *dev, int port);
399int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port); 399int mlx4_CLOSE_PORT(struct mlx4_dev *dev, int port);
400 400
401int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]); 401int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
402 int block_mcast_loopback);
402int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]); 403int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]);
403 404
404int mlx4_map_phys_fmr(struct mlx4_dev *dev, struct mlx4_fmr *fmr, u64 *page_list, 405int mlx4_map_phys_fmr(struct mlx4_dev *dev, struct mlx4_fmr *fmr, u64 *page_list,
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 586a943cab01..cf1cd3a2ed78 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -998,8 +998,8 @@ extern void free_area_init_node(int nid, pg_data_t *pgdat,
998extern void free_area_init_nodes(unsigned long *max_zone_pfn); 998extern void free_area_init_nodes(unsigned long *max_zone_pfn);
999extern void add_active_range(unsigned int nid, unsigned long start_pfn, 999extern void add_active_range(unsigned int nid, unsigned long start_pfn,
1000 unsigned long end_pfn); 1000 unsigned long end_pfn);
1001extern void shrink_active_range(unsigned int nid, unsigned long old_end_pfn, 1001extern void remove_active_range(unsigned int nid, unsigned long start_pfn,
1002 unsigned long new_end_pfn); 1002 unsigned long end_pfn);
1003extern void push_node_boundaries(unsigned int nid, unsigned long start_pfn, 1003extern void push_node_boundaries(unsigned int nid, unsigned long start_pfn,
1004 unsigned long end_pfn); 1004 unsigned long end_pfn);
1005extern void remove_all_active_ranges(void); 1005extern void remove_all_active_ranges(void);
@@ -1011,6 +1011,8 @@ extern unsigned long find_min_pfn_with_active_regions(void);
1011extern unsigned long find_max_pfn_with_active_regions(void); 1011extern unsigned long find_max_pfn_with_active_regions(void);
1012extern void free_bootmem_with_active_regions(int nid, 1012extern void free_bootmem_with_active_regions(int nid,
1013 unsigned long max_low_pfn); 1013 unsigned long max_low_pfn);
1014typedef int (*work_fn_t)(unsigned long, unsigned long, void *);
1015extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data);
1014extern void sparse_memory_present_with_active_regions(int nid); 1016extern void sparse_memory_present_with_active_regions(int nid);
1015#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID 1017#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
1016extern int early_pfn_to_nid(unsigned long pfn); 1018extern int early_pfn_to_nid(unsigned long pfn);
@@ -1024,6 +1026,7 @@ extern void mem_init(void);
1024extern void show_mem(void); 1026extern void show_mem(void);
1025extern void si_meminfo(struct sysinfo * val); 1027extern void si_meminfo(struct sysinfo * val);
1026extern void si_meminfo_node(struct sysinfo *val, int nid); 1028extern void si_meminfo_node(struct sysinfo *val, int nid);
1029extern int after_bootmem;
1027 1030
1028#ifdef CONFIG_NUMA 1031#ifdef CONFIG_NUMA
1029extern void setup_per_cpu_pageset(void); 1032extern void setup_per_cpu_pageset(void);
diff --git a/include/linux/mmiotrace.h b/include/linux/mmiotrace.h
new file mode 100644
index 000000000000..61d19e1b7a0b
--- /dev/null
+++ b/include/linux/mmiotrace.h
@@ -0,0 +1,85 @@
1#ifndef MMIOTRACE_H
2#define MMIOTRACE_H
3
4#include <linux/types.h>
5#include <linux/list.h>
6
7struct kmmio_probe;
8struct pt_regs;
9
10typedef void (*kmmio_pre_handler_t)(struct kmmio_probe *,
11 struct pt_regs *, unsigned long addr);
12typedef void (*kmmio_post_handler_t)(struct kmmio_probe *,
13 unsigned long condition, struct pt_regs *);
14
15struct kmmio_probe {
16 struct list_head list; /* kmmio internal list */
17 unsigned long addr; /* start location of the probe point */
18 unsigned long len; /* length of the probe region */
19 kmmio_pre_handler_t pre_handler; /* Called before addr is executed. */
20 kmmio_post_handler_t post_handler; /* Called after addr is executed */
21 void *private;
22};
23
24/* kmmio is active by some kmmio_probes? */
25static inline int is_kmmio_active(void)
26{
27 extern unsigned int kmmio_count;
28 return kmmio_count;
29}
30
31extern int register_kmmio_probe(struct kmmio_probe *p);
32extern void unregister_kmmio_probe(struct kmmio_probe *p);
33
34/* Called from page fault handler. */
35extern int kmmio_handler(struct pt_regs *regs, unsigned long addr);
36
37/* Called from ioremap.c */
38#ifdef CONFIG_MMIOTRACE
39extern void mmiotrace_ioremap(resource_size_t offset, unsigned long size,
40 void __iomem *addr);
41extern void mmiotrace_iounmap(volatile void __iomem *addr);
42#else
43static inline void mmiotrace_ioremap(resource_size_t offset,
44 unsigned long size, void __iomem *addr)
45{
46}
47
48static inline void mmiotrace_iounmap(volatile void __iomem *addr)
49{
50}
51#endif /* CONFIG_MMIOTRACE_HOOKS */
52
53enum mm_io_opcode {
54 MMIO_READ = 0x1, /* struct mmiotrace_rw */
55 MMIO_WRITE = 0x2, /* struct mmiotrace_rw */
56 MMIO_PROBE = 0x3, /* struct mmiotrace_map */
57 MMIO_UNPROBE = 0x4, /* struct mmiotrace_map */
58 MMIO_MARKER = 0x5, /* raw char data */
59 MMIO_UNKNOWN_OP = 0x6, /* struct mmiotrace_rw */
60};
61
62struct mmiotrace_rw {
63 resource_size_t phys; /* PCI address of register */
64 unsigned long value;
65 unsigned long pc; /* optional program counter */
66 int map_id;
67 unsigned char opcode; /* one of MMIO_{READ,WRITE,UNKNOWN_OP} */
68 unsigned char width; /* size of register access in bytes */
69};
70
71struct mmiotrace_map {
72 resource_size_t phys; /* base address in PCI space */
73 unsigned long virt; /* base virtual address */
74 unsigned long len; /* mapping size */
75 int map_id;
76 unsigned char opcode; /* MMIO_PROBE or MMIO_UNPROBE */
77};
78
79/* in kernel/trace/trace_mmiotrace.c */
80extern void enable_mmiotrace(void);
81extern void disable_mmiotrace(void);
82extern void mmio_trace_rw(struct mmiotrace_rw *rw);
83extern void mmio_trace_mapping(struct mmiotrace_map *map);
84
85#endif /* MMIOTRACE_H */
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 69b2342d5ebb..c4db5827963d 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -159,6 +159,15 @@ struct ap_device_id {
159 159
160#define AP_DEVICE_ID_MATCH_DEVICE_TYPE 0x01 160#define AP_DEVICE_ID_MATCH_DEVICE_TYPE 0x01
161 161
162/* s390 css bus devices (subchannels) */
163struct css_device_id {
164 __u8 match_flags;
165 __u8 type; /* subchannel type */
166 __u16 pad2;
167 __u32 pad3;
168 kernel_ulong_t driver_data;
169};
170
162#define ACPI_ID_LEN 16 /* only 9 bytes needed here, 16 bytes are used */ 171#define ACPI_ID_LEN 16 /* only 9 bytes needed here, 16 bytes are used */
163 /* to workaround crosscompile issues */ 172 /* to workaround crosscompile issues */
164 173
diff --git a/include/linux/mpage.h b/include/linux/mpage.h
index 068a0c9946af..5c42821da2d1 100644
--- a/include/linux/mpage.h
+++ b/include/linux/mpage.h
@@ -11,11 +11,21 @@
11 */ 11 */
12#ifdef CONFIG_BLOCK 12#ifdef CONFIG_BLOCK
13 13
14struct mpage_data {
15 struct bio *bio;
16 sector_t last_block_in_bio;
17 get_block_t *get_block;
18 unsigned use_writepage;
19};
20
14struct writeback_control; 21struct writeback_control;
15 22
23struct bio *mpage_bio_submit(int rw, struct bio *bio);
16int mpage_readpages(struct address_space *mapping, struct list_head *pages, 24int mpage_readpages(struct address_space *mapping, struct list_head *pages,
17 unsigned nr_pages, get_block_t get_block); 25 unsigned nr_pages, get_block_t get_block);
18int mpage_readpage(struct page *page, get_block_t get_block); 26int mpage_readpage(struct page *page, get_block_t get_block);
27int __mpage_writepage(struct page *page, struct writeback_control *wbc,
28 void *data);
19int mpage_writepages(struct address_space *mapping, 29int mpage_writepages(struct address_space *mapping,
20 struct writeback_control *wbc, get_block_t get_block); 30 struct writeback_control *wbc, get_block_t get_block);
21int mpage_writepage(struct page *page, get_block_t *get_block, 31int mpage_writepage(struct page *page, get_block_t *get_block,
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index f31debfac926..0d2a4e7012aa 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -157,6 +157,7 @@ PAGEFLAG(Active, active) __CLEARPAGEFLAG(Active, active)
157__PAGEFLAG(Slab, slab) 157__PAGEFLAG(Slab, slab)
158PAGEFLAG(Checked, owner_priv_1) /* Used by some filesystems */ 158PAGEFLAG(Checked, owner_priv_1) /* Used by some filesystems */
159PAGEFLAG(Pinned, owner_priv_1) TESTSCFLAG(Pinned, owner_priv_1) /* Xen */ 159PAGEFLAG(Pinned, owner_priv_1) TESTSCFLAG(Pinned, owner_priv_1) /* Xen */
160PAGEFLAG(SavePinned, dirty); /* Xen */
160PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved) 161PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved)
161PAGEFLAG(Private, private) __CLEARPAGEFLAG(Private, private) 162PAGEFLAG(Private, private) __CLEARPAGEFLAG(Private, private)
162 __SETPAGEFLAG(Private, private) 163 __SETPAGEFLAG(Private, private)
diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h
index e875905f7b12..e8c06122be36 100644
--- a/include/linux/pageblock-flags.h
+++ b/include/linux/pageblock-flags.h
@@ -25,13 +25,11 @@
25 25
26#include <linux/types.h> 26#include <linux/types.h>
27 27
28/* Macro to aid the definition of ranges of bits */
29#define PB_range(name, required_bits) \
30 name, name ## _end = (name + required_bits) - 1
31
32/* Bit indices that affect a whole block of pages */ 28/* Bit indices that affect a whole block of pages */
33enum pageblock_bits { 29enum pageblock_bits {
34 PB_range(PB_migrate, 3), /* 3 bits required for migrate types */ 30 PB_migrate,
31 PB_migrate_end = PB_migrate + 3 - 1,
32 /* 3 bits required for migrate types */
35 NR_PAGEBLOCK_BITS 33 NR_PAGEBLOCK_BITS
36}; 34};
37 35
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index 9007ccdfc112..208388835357 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -35,7 +35,7 @@ int percpu_counter_init_irq(struct percpu_counter *fbc, s64 amount);
35void percpu_counter_destroy(struct percpu_counter *fbc); 35void percpu_counter_destroy(struct percpu_counter *fbc);
36void percpu_counter_set(struct percpu_counter *fbc, s64 amount); 36void percpu_counter_set(struct percpu_counter *fbc, s64 amount);
37void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch); 37void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch);
38s64 __percpu_counter_sum(struct percpu_counter *fbc); 38s64 __percpu_counter_sum(struct percpu_counter *fbc, int set);
39 39
40static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount) 40static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount)
41{ 41{
@@ -44,13 +44,19 @@ static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount)
44 44
45static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc) 45static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc)
46{ 46{
47 s64 ret = __percpu_counter_sum(fbc); 47 s64 ret = __percpu_counter_sum(fbc, 0);
48 return ret < 0 ? 0 : ret; 48 return ret < 0 ? 0 : ret;
49} 49}
50 50
51static inline s64 percpu_counter_sum_and_set(struct percpu_counter *fbc)
52{
53 return __percpu_counter_sum(fbc, 1);
54}
55
56
51static inline s64 percpu_counter_sum(struct percpu_counter *fbc) 57static inline s64 percpu_counter_sum(struct percpu_counter *fbc)
52{ 58{
53 return __percpu_counter_sum(fbc); 59 return __percpu_counter_sum(fbc, 0);
54} 60}
55 61
56static inline s64 percpu_counter_read(struct percpu_counter *fbc) 62static inline s64 percpu_counter_read(struct percpu_counter *fbc)
diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index 23f0c54175cd..72b1a10a59b6 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -10,7 +10,7 @@
10#include <linux/linkage.h> 10#include <linux/linkage.h>
11#include <linux/list.h> 11#include <linux/list.h>
12 12
13#ifdef CONFIG_DEBUG_PREEMPT 13#if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER)
14 extern void add_preempt_count(int val); 14 extern void add_preempt_count(int val);
15 extern void sub_preempt_count(int val); 15 extern void sub_preempt_count(int val);
16#else 16#else
@@ -52,6 +52,34 @@ do { \
52 preempt_check_resched(); \ 52 preempt_check_resched(); \
53} while (0) 53} while (0)
54 54
55/* For debugging and tracer internals only! */
56#define add_preempt_count_notrace(val) \
57 do { preempt_count() += (val); } while (0)
58#define sub_preempt_count_notrace(val) \
59 do { preempt_count() -= (val); } while (0)
60#define inc_preempt_count_notrace() add_preempt_count_notrace(1)
61#define dec_preempt_count_notrace() sub_preempt_count_notrace(1)
62
63#define preempt_disable_notrace() \
64do { \
65 inc_preempt_count_notrace(); \
66 barrier(); \
67} while (0)
68
69#define preempt_enable_no_resched_notrace() \
70do { \
71 barrier(); \
72 dec_preempt_count_notrace(); \
73} while (0)
74
75/* preempt_check_resched is OK to trace */
76#define preempt_enable_notrace() \
77do { \
78 preempt_enable_no_resched_notrace(); \
79 barrier(); \
80 preempt_check_resched(); \
81} while (0)
82
55#else 83#else
56 84
57#define preempt_disable() do { } while (0) 85#define preempt_disable() do { } while (0)
@@ -59,6 +87,10 @@ do { \
59#define preempt_enable() do { } while (0) 87#define preempt_enable() do { } while (0)
60#define preempt_check_resched() do { } while (0) 88#define preempt_check_resched() do { } while (0)
61 89
90#define preempt_disable_notrace() do { } while (0)
91#define preempt_enable_no_resched_notrace() do { } while (0)
92#define preempt_enable_notrace() do { } while (0)
93
62#endif 94#endif
63 95
64#ifdef CONFIG_PREEMPT_NOTIFIERS 96#ifdef CONFIG_PREEMPT_NOTIFIERS
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index f98501ba557e..c6f5f9dd0cee 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -95,8 +95,12 @@ extern void __ptrace_link(struct task_struct *child,
95 struct task_struct *new_parent); 95 struct task_struct *new_parent);
96extern void __ptrace_unlink(struct task_struct *child); 96extern void __ptrace_unlink(struct task_struct *child);
97extern void ptrace_untrace(struct task_struct *child); 97extern void ptrace_untrace(struct task_struct *child);
98extern int ptrace_may_attach(struct task_struct *task); 98#define PTRACE_MODE_READ 1
99extern int __ptrace_may_attach(struct task_struct *task); 99#define PTRACE_MODE_ATTACH 2
100/* Returns 0 on success, -errno on denial. */
101extern int __ptrace_may_access(struct task_struct *task, unsigned int mode);
102/* Returns true on success, false on denial. */
103extern bool ptrace_may_access(struct task_struct *task, unsigned int mode);
100 104
101static inline int ptrace_reparented(struct task_struct *child) 105static inline int ptrace_reparented(struct task_struct *child)
102{ 106{
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
new file mode 100644
index 000000000000..3945f803d514
--- /dev/null
+++ b/include/linux/pwm.h
@@ -0,0 +1,31 @@
1#ifndef __LINUX_PWM_H
2#define __LINUX_PWM_H
3
4struct pwm_device;
5
6/*
7 * pwm_request - request a PWM device
8 */
9struct pwm_device *pwm_request(int pwm_id, const char *label);
10
11/*
12 * pwm_free - free a PWM device
13 */
14void pwm_free(struct pwm_device *pwm);
15
16/*
17 * pwm_config - change a PWM device configuration
18 */
19int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns);
20
21/*
22 * pwm_enable - start a PWM output toggling
23 */
24int pwm_enable(struct pwm_device *pwm);
25
26/*
27 * pwm_disable - stop a PWM output toggling
28 */
29void pwm_disable(struct pwm_device *pwm);
30
31#endif /* __ASM_ARCH_PWM_H */
diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h
new file mode 100644
index 000000000000..7a9754c96775
--- /dev/null
+++ b/include/linux/pwm_backlight.h
@@ -0,0 +1,17 @@
1/*
2 * Generic PWM backlight driver data - see drivers/video/backlight/pwm_bl.c
3 */
4#ifndef __LINUX_PWM_BACKLIGHT_H
5#define __LINUX_PWM_BACKLIGHT_H
6
7struct platform_pwm_backlight_data {
8 int pwm_id;
9 unsigned int max_brightness;
10 unsigned int dft_brightness;
11 unsigned int pwm_period_ns;
12 int (*init)(struct device *dev);
13 int (*notify)(int brightness);
14 void (*exit)(struct device *dev);
15};
16
17#endif
diff --git a/include/linux/rcuclassic.h b/include/linux/rcuclassic.h
index b3aa05baab8a..8c774905dcfe 100644
--- a/include/linux/rcuclassic.h
+++ b/include/linux/rcuclassic.h
@@ -151,7 +151,10 @@ extern struct lockdep_map rcu_lock_map;
151 151
152#define __synchronize_sched() synchronize_rcu() 152#define __synchronize_sched() synchronize_rcu()
153 153
154#define call_rcu_sched(head, func) call_rcu(head, func)
155
154extern void __rcu_init(void); 156extern void __rcu_init(void);
157#define rcu_init_sched() do { } while (0)
155extern void rcu_check_callbacks(int cpu, int user); 158extern void rcu_check_callbacks(int cpu, int user);
156extern void rcu_restart_cpu(int cpu); 159extern void rcu_restart_cpu(int cpu);
157 160
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index bde4586f4382..b0f39be08b6c 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -1,6 +1,373 @@
1#ifndef _LINUX_RCULIST_H 1#ifndef _LINUX_RCULIST_H
2#define _LINUX_RCULIST_H 2#define _LINUX_RCULIST_H
3 3
4#ifdef __KERNEL__
5
6/*
7 * RCU-protected list version
8 */
4#include <linux/list.h> 9#include <linux/list.h>
10#include <linux/rcupdate.h>
11
12/*
13 * Insert a new entry between two known consecutive entries.
14 *
15 * This is only for internal list manipulation where we know
16 * the prev/next entries already!
17 */
18static inline void __list_add_rcu(struct list_head *new,
19 struct list_head *prev, struct list_head *next)
20{
21 new->next = next;
22 new->prev = prev;
23 rcu_assign_pointer(prev->next, new);
24 next->prev = new;
25}
26
27/**
28 * list_add_rcu - add a new entry to rcu-protected list
29 * @new: new entry to be added
30 * @head: list head to add it after
31 *
32 * Insert a new entry after the specified head.
33 * This is good for implementing stacks.
34 *
35 * The caller must take whatever precautions are necessary
36 * (such as holding appropriate locks) to avoid racing
37 * with another list-mutation primitive, such as list_add_rcu()
38 * or list_del_rcu(), running on this same list.
39 * However, it is perfectly legal to run concurrently with
40 * the _rcu list-traversal primitives, such as
41 * list_for_each_entry_rcu().
42 */
43static inline void list_add_rcu(struct list_head *new, struct list_head *head)
44{
45 __list_add_rcu(new, head, head->next);
46}
47
48/**
49 * list_add_tail_rcu - add a new entry to rcu-protected list
50 * @new: new entry to be added
51 * @head: list head to add it before
52 *
53 * Insert a new entry before the specified head.
54 * This is useful for implementing queues.
55 *
56 * The caller must take whatever precautions are necessary
57 * (such as holding appropriate locks) to avoid racing
58 * with another list-mutation primitive, such as list_add_tail_rcu()
59 * or list_del_rcu(), running on this same list.
60 * However, it is perfectly legal to run concurrently with
61 * the _rcu list-traversal primitives, such as
62 * list_for_each_entry_rcu().
63 */
64static inline void list_add_tail_rcu(struct list_head *new,
65 struct list_head *head)
66{
67 __list_add_rcu(new, head->prev, head);
68}
69
70/**
71 * list_del_rcu - deletes entry from list without re-initialization
72 * @entry: the element to delete from the list.
73 *
74 * Note: list_empty() on entry does not return true after this,
75 * the entry is in an undefined state. It is useful for RCU based
76 * lockfree traversal.
77 *
78 * In particular, it means that we can not poison the forward
79 * pointers that may still be used for walking the list.
80 *
81 * The caller must take whatever precautions are necessary
82 * (such as holding appropriate locks) to avoid racing
83 * with another list-mutation primitive, such as list_del_rcu()
84 * or list_add_rcu(), running on this same list.
85 * However, it is perfectly legal to run concurrently with
86 * the _rcu list-traversal primitives, such as
87 * list_for_each_entry_rcu().
88 *
89 * Note that the caller is not permitted to immediately free
90 * the newly deleted entry. Instead, either synchronize_rcu()
91 * or call_rcu() must be used to defer freeing until an RCU
92 * grace period has elapsed.
93 */
94static inline void list_del_rcu(struct list_head *entry)
95{
96 __list_del(entry->prev, entry->next);
97 entry->prev = LIST_POISON2;
98}
99
100/**
101 * list_replace_rcu - replace old entry by new one
102 * @old : the element to be replaced
103 * @new : the new element to insert
104 *
105 * The @old entry will be replaced with the @new entry atomically.
106 * Note: @old should not be empty.
107 */
108static inline void list_replace_rcu(struct list_head *old,
109 struct list_head *new)
110{
111 new->next = old->next;
112 new->prev = old->prev;
113 rcu_assign_pointer(new->prev->next, new);
114 new->next->prev = new;
115 old->prev = LIST_POISON2;
116}
117
118/**
119 * list_splice_init_rcu - splice an RCU-protected list into an existing list.
120 * @list: the RCU-protected list to splice
121 * @head: the place in the list to splice the first list into
122 * @sync: function to sync: synchronize_rcu(), synchronize_sched(), ...
123 *
124 * @head can be RCU-read traversed concurrently with this function.
125 *
126 * Note that this function blocks.
127 *
128 * Important note: the caller must take whatever action is necessary to
129 * prevent any other updates to @head. In principle, it is possible
130 * to modify the list as soon as sync() begins execution.
131 * If this sort of thing becomes necessary, an alternative version
132 * based on call_rcu() could be created. But only if -really-
133 * needed -- there is no shortage of RCU API members.
134 */
135static inline void list_splice_init_rcu(struct list_head *list,
136 struct list_head *head,
137 void (*sync)(void))
138{
139 struct list_head *first = list->next;
140 struct list_head *last = list->prev;
141 struct list_head *at = head->next;
142
143 if (list_empty(head))
144 return;
145
146 /* "first" and "last" tracking list, so initialize it. */
147
148 INIT_LIST_HEAD(list);
149
150 /*
151 * At this point, the list body still points to the source list.
152 * Wait for any readers to finish using the list before splicing
153 * the list body into the new list. Any new readers will see
154 * an empty list.
155 */
156
157 sync();
158
159 /*
160 * Readers are finished with the source list, so perform splice.
161 * The order is important if the new list is global and accessible
162 * to concurrent RCU readers. Note that RCU readers are not
163 * permitted to traverse the prev pointers without excluding
164 * this function.
165 */
166
167 last->next = at;
168 rcu_assign_pointer(head->next, first);
169 first->prev = head;
170 at->prev = last;
171}
172
173/**
174 * list_for_each_rcu - iterate over an rcu-protected list
175 * @pos: the &struct list_head to use as a loop cursor.
176 * @head: the head for your list.
177 *
178 * This list-traversal primitive may safely run concurrently with
179 * the _rcu list-mutation primitives such as list_add_rcu()
180 * as long as the traversal is guarded by rcu_read_lock().
181 */
182#define list_for_each_rcu(pos, head) \
183 for (pos = rcu_dereference((head)->next); \
184 prefetch(pos->next), pos != (head); \
185 pos = rcu_dereference(pos->next))
186
187#define __list_for_each_rcu(pos, head) \
188 for (pos = rcu_dereference((head)->next); \
189 pos != (head); \
190 pos = rcu_dereference(pos->next))
191
192/**
193 * list_for_each_entry_rcu - iterate over rcu list of given type
194 * @pos: the type * to use as a loop cursor.
195 * @head: the head for your list.
196 * @member: the name of the list_struct within the struct.
197 *
198 * This list-traversal primitive may safely run concurrently with
199 * the _rcu list-mutation primitives such as list_add_rcu()
200 * as long as the traversal is guarded by rcu_read_lock().
201 */
202#define list_for_each_entry_rcu(pos, head, member) \
203 for (pos = list_entry(rcu_dereference((head)->next), typeof(*pos), member); \
204 prefetch(pos->member.next), &pos->member != (head); \
205 pos = list_entry(rcu_dereference(pos->member.next), typeof(*pos), member))
206
207
208/**
209 * list_for_each_continue_rcu
210 * @pos: the &struct list_head to use as a loop cursor.
211 * @head: the head for your list.
212 *
213 * Iterate over an rcu-protected list, continuing after current point.
214 *
215 * This list-traversal primitive may safely run concurrently with
216 * the _rcu list-mutation primitives such as list_add_rcu()
217 * as long as the traversal is guarded by rcu_read_lock().
218 */
219#define list_for_each_continue_rcu(pos, head) \
220 for ((pos) = rcu_dereference((pos)->next); \
221 prefetch((pos)->next), (pos) != (head); \
222 (pos) = rcu_dereference((pos)->next))
223
224/**
225 * hlist_del_rcu - deletes entry from hash list without re-initialization
226 * @n: the element to delete from the hash list.
227 *
228 * Note: list_unhashed() on entry does not return true after this,
229 * the entry is in an undefined state. It is useful for RCU based
230 * lockfree traversal.
231 *
232 * In particular, it means that we can not poison the forward
233 * pointers that may still be used for walking the hash list.
234 *
235 * The caller must take whatever precautions are necessary
236 * (such as holding appropriate locks) to avoid racing
237 * with another list-mutation primitive, such as hlist_add_head_rcu()
238 * or hlist_del_rcu(), running on this same list.
239 * However, it is perfectly legal to run concurrently with
240 * the _rcu list-traversal primitives, such as
241 * hlist_for_each_entry().
242 */
243static inline void hlist_del_rcu(struct hlist_node *n)
244{
245 __hlist_del(n);
246 n->pprev = LIST_POISON2;
247}
248
249/**
250 * hlist_replace_rcu - replace old entry by new one
251 * @old : the element to be replaced
252 * @new : the new element to insert
253 *
254 * The @old entry will be replaced with the @new entry atomically.
255 */
256static inline void hlist_replace_rcu(struct hlist_node *old,
257 struct hlist_node *new)
258{
259 struct hlist_node *next = old->next;
260
261 new->next = next;
262 new->pprev = old->pprev;
263 rcu_assign_pointer(*new->pprev, new);
264 if (next)
265 new->next->pprev = &new->next;
266 old->pprev = LIST_POISON2;
267}
268
269/**
270 * hlist_add_head_rcu
271 * @n: the element to add to the hash list.
272 * @h: the list to add to.
273 *
274 * Description:
275 * Adds the specified element to the specified hlist,
276 * while permitting racing traversals.
277 *
278 * The caller must take whatever precautions are necessary
279 * (such as holding appropriate locks) to avoid racing
280 * with another list-mutation primitive, such as hlist_add_head_rcu()
281 * or hlist_del_rcu(), running on this same list.
282 * However, it is perfectly legal to run concurrently with
283 * the _rcu list-traversal primitives, such as
284 * hlist_for_each_entry_rcu(), used to prevent memory-consistency
285 * problems on Alpha CPUs. Regardless of the type of CPU, the
286 * list-traversal primitive must be guarded by rcu_read_lock().
287 */
288static inline void hlist_add_head_rcu(struct hlist_node *n,
289 struct hlist_head *h)
290{
291 struct hlist_node *first = h->first;
292
293 n->next = first;
294 n->pprev = &h->first;
295 rcu_assign_pointer(h->first, n);
296 if (first)
297 first->pprev = &n->next;
298}
299
300/**
301 * hlist_add_before_rcu
302 * @n: the new element to add to the hash list.
303 * @next: the existing element to add the new element before.
304 *
305 * Description:
306 * Adds the specified element to the specified hlist
307 * before the specified node while permitting racing traversals.
308 *
309 * The caller must take whatever precautions are necessary
310 * (such as holding appropriate locks) to avoid racing
311 * with another list-mutation primitive, such as hlist_add_head_rcu()
312 * or hlist_del_rcu(), running on this same list.
313 * However, it is perfectly legal to run concurrently with
314 * the _rcu list-traversal primitives, such as
315 * hlist_for_each_entry_rcu(), used to prevent memory-consistency
316 * problems on Alpha CPUs.
317 */
318static inline void hlist_add_before_rcu(struct hlist_node *n,
319 struct hlist_node *next)
320{
321 n->pprev = next->pprev;
322 n->next = next;
323 rcu_assign_pointer(*(n->pprev), n);
324 next->pprev = &n->next;
325}
326
327/**
328 * hlist_add_after_rcu
329 * @prev: the existing element to add the new element after.
330 * @n: the new element to add to the hash list.
331 *
332 * Description:
333 * Adds the specified element to the specified hlist
334 * after the specified node while permitting racing traversals.
335 *
336 * The caller must take whatever precautions are necessary
337 * (such as holding appropriate locks) to avoid racing
338 * with another list-mutation primitive, such as hlist_add_head_rcu()
339 * or hlist_del_rcu(), running on this same list.
340 * However, it is perfectly legal to run concurrently with
341 * the _rcu list-traversal primitives, such as
342 * hlist_for_each_entry_rcu(), used to prevent memory-consistency
343 * problems on Alpha CPUs.
344 */
345static inline void hlist_add_after_rcu(struct hlist_node *prev,
346 struct hlist_node *n)
347{
348 n->next = prev->next;
349 n->pprev = &prev->next;
350 rcu_assign_pointer(prev->next, n);
351 if (n->next)
352 n->next->pprev = &n->next;
353}
354
355/**
356 * hlist_for_each_entry_rcu - iterate over rcu list of given type
357 * @tpos: the type * to use as a loop cursor.
358 * @pos: the &struct hlist_node to use as a loop cursor.
359 * @head: the head for your list.
360 * @member: the name of the hlist_node within the struct.
361 *
362 * This list-traversal primitive may safely run concurrently with
363 * the _rcu list-mutation primitives such as hlist_add_head_rcu()
364 * as long as the traversal is guarded by rcu_read_lock().
365 */
366#define hlist_for_each_entry_rcu(tpos, pos, head, member) \
367 for (pos = rcu_dereference((head)->first); \
368 pos && ({ prefetch(pos->next); 1; }) && \
369 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
370 pos = rcu_dereference(pos->next))
5 371
6#endif /* _LINUX_RCULIST_H */ 372#endif /* __KERNEL__ */
373#endif
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index d42dbec06083..e8b4039cfb2f 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -40,6 +40,7 @@
40#include <linux/cpumask.h> 40#include <linux/cpumask.h>
41#include <linux/seqlock.h> 41#include <linux/seqlock.h>
42#include <linux/lockdep.h> 42#include <linux/lockdep.h>
43#include <linux/completion.h>
43 44
44/** 45/**
45 * struct rcu_head - callback structure for use with RCU 46 * struct rcu_head - callback structure for use with RCU
@@ -168,6 +169,27 @@ struct rcu_head {
168 (p) = (v); \ 169 (p) = (v); \
169 }) 170 })
170 171
172/* Infrastructure to implement the synchronize_() primitives. */
173
174struct rcu_synchronize {
175 struct rcu_head head;
176 struct completion completion;
177};
178
179extern void wakeme_after_rcu(struct rcu_head *head);
180
181#define synchronize_rcu_xxx(name, func) \
182void name(void) \
183{ \
184 struct rcu_synchronize rcu; \
185 \
186 init_completion(&rcu.completion); \
187 /* Will wake me after RCU finished. */ \
188 func(&rcu.head, wakeme_after_rcu); \
189 /* Wait for it. */ \
190 wait_for_completion(&rcu.completion); \
191}
192
171/** 193/**
172 * synchronize_sched - block until all CPUs have exited any non-preemptive 194 * synchronize_sched - block until all CPUs have exited any non-preemptive
173 * kernel code sequences. 195 * kernel code sequences.
@@ -224,8 +246,8 @@ extern void call_rcu_bh(struct rcu_head *head,
224/* Exported common interfaces */ 246/* Exported common interfaces */
225extern void synchronize_rcu(void); 247extern void synchronize_rcu(void);
226extern void rcu_barrier(void); 248extern void rcu_barrier(void);
227extern long rcu_batches_completed(void); 249extern void rcu_barrier_bh(void);
228extern long rcu_batches_completed_bh(void); 250extern void rcu_barrier_sched(void);
229 251
230/* Internal to kernel */ 252/* Internal to kernel */
231extern void rcu_init(void); 253extern void rcu_init(void);
diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h
index 8a05c7e20bc4..f04b64eca636 100644
--- a/include/linux/rcupreempt.h
+++ b/include/linux/rcupreempt.h
@@ -40,10 +40,39 @@
40#include <linux/cpumask.h> 40#include <linux/cpumask.h>
41#include <linux/seqlock.h> 41#include <linux/seqlock.h>
42 42
43#define rcu_qsctr_inc(cpu) 43struct rcu_dyntick_sched {
44 int dynticks;
45 int dynticks_snap;
46 int sched_qs;
47 int sched_qs_snap;
48 int sched_dynticks_snap;
49};
50
51DECLARE_PER_CPU(struct rcu_dyntick_sched, rcu_dyntick_sched);
52
53static inline void rcu_qsctr_inc(int cpu)
54{
55 struct rcu_dyntick_sched *rdssp = &per_cpu(rcu_dyntick_sched, cpu);
56
57 rdssp->sched_qs++;
58}
44#define rcu_bh_qsctr_inc(cpu) 59#define rcu_bh_qsctr_inc(cpu)
45#define call_rcu_bh(head, rcu) call_rcu(head, rcu) 60#define call_rcu_bh(head, rcu) call_rcu(head, rcu)
46 61
62/**
63 * call_rcu_sched - Queue RCU callback for invocation after sched grace period.
64 * @head: structure to be used for queueing the RCU updates.
65 * @func: actual update function to be invoked after the grace period
66 *
67 * The update function will be invoked some time after a full
68 * synchronize_sched()-style grace period elapses, in other words after
69 * all currently executing preempt-disabled sections of code (including
70 * hardirq handlers, NMI handlers, and local_irq_save() blocks) have
71 * completed.
72 */
73extern void call_rcu_sched(struct rcu_head *head,
74 void (*func)(struct rcu_head *head));
75
47extern void __rcu_read_lock(void) __acquires(RCU); 76extern void __rcu_read_lock(void) __acquires(RCU);
48extern void __rcu_read_unlock(void) __releases(RCU); 77extern void __rcu_read_unlock(void) __releases(RCU);
49extern int rcu_pending(int cpu); 78extern int rcu_pending(int cpu);
@@ -55,6 +84,7 @@ extern int rcu_needs_cpu(int cpu);
55extern void __synchronize_sched(void); 84extern void __synchronize_sched(void);
56 85
57extern void __rcu_init(void); 86extern void __rcu_init(void);
87extern void rcu_init_sched(void);
58extern void rcu_check_callbacks(int cpu, int user); 88extern void rcu_check_callbacks(int cpu, int user);
59extern void rcu_restart_cpu(int cpu); 89extern void rcu_restart_cpu(int cpu);
60extern long rcu_batches_completed(void); 90extern long rcu_batches_completed(void);
@@ -81,20 +111,20 @@ extern struct rcupreempt_trace *rcupreempt_trace_cpu(int cpu);
81struct softirq_action; 111struct softirq_action;
82 112
83#ifdef CONFIG_NO_HZ 113#ifdef CONFIG_NO_HZ
84DECLARE_PER_CPU(long, dynticks_progress_counter); 114DECLARE_PER_CPU(struct rcu_dyntick_sched, rcu_dyntick_sched);
85 115
86static inline void rcu_enter_nohz(void) 116static inline void rcu_enter_nohz(void)
87{ 117{
88 smp_mb(); /* CPUs seeing ++ must see prior RCU read-side crit sects */ 118 smp_mb(); /* CPUs seeing ++ must see prior RCU read-side crit sects */
89 __get_cpu_var(dynticks_progress_counter)++; 119 __get_cpu_var(rcu_dyntick_sched).dynticks++;
90 WARN_ON(__get_cpu_var(dynticks_progress_counter) & 0x1); 120 WARN_ON(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1);
91} 121}
92 122
93static inline void rcu_exit_nohz(void) 123static inline void rcu_exit_nohz(void)
94{ 124{
95 __get_cpu_var(dynticks_progress_counter)++;
96 smp_mb(); /* CPUs seeing ++ must see later RCU read-side crit sects */ 125 smp_mb(); /* CPUs seeing ++ must see later RCU read-side crit sects */
97 WARN_ON(!(__get_cpu_var(dynticks_progress_counter) & 0x1)); 126 __get_cpu_var(rcu_dyntick_sched).dynticks++;
127 WARN_ON(!(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1));
98} 128}
99 129
100#else /* CONFIG_NO_HZ */ 130#else /* CONFIG_NO_HZ */
diff --git a/include/linux/resume-trace.h b/include/linux/resume-trace.h
index f3f4f28c6960..c9ba2fdf807d 100644
--- a/include/linux/resume-trace.h
+++ b/include/linux/resume-trace.h
@@ -8,7 +8,7 @@ extern int pm_trace_enabled;
8 8
9struct device; 9struct device;
10extern void set_trace_device(struct device *); 10extern void set_trace_device(struct device *);
11extern void generate_resume_trace(void *tracedata, unsigned int user); 11extern void generate_resume_trace(const void *tracedata, unsigned int user);
12 12
13#define TRACE_DEVICE(dev) do { \ 13#define TRACE_DEVICE(dev) do { \
14 if (pm_trace_enabled) \ 14 if (pm_trace_enabled) \
diff --git a/include/linux/sched.h b/include/linux/sched.h
index c5d3f847ca8d..21349173d148 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -134,7 +134,6 @@ extern unsigned long nr_running(void);
134extern unsigned long nr_uninterruptible(void); 134extern unsigned long nr_uninterruptible(void);
135extern unsigned long nr_active(void); 135extern unsigned long nr_active(void);
136extern unsigned long nr_iowait(void); 136extern unsigned long nr_iowait(void);
137extern unsigned long weighted_cpuload(const int cpu);
138 137
139struct seq_file; 138struct seq_file;
140struct cfs_rq; 139struct cfs_rq;
@@ -246,6 +245,8 @@ extern asmlinkage void schedule_tail(struct task_struct *prev);
246extern void init_idle(struct task_struct *idle, int cpu); 245extern void init_idle(struct task_struct *idle, int cpu);
247extern void init_idle_bootup_task(struct task_struct *idle); 246extern void init_idle_bootup_task(struct task_struct *idle);
248 247
248extern int runqueue_is_locked(void);
249
249extern cpumask_t nohz_cpu_mask; 250extern cpumask_t nohz_cpu_mask;
250#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) 251#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
251extern int select_nohz_load_balancer(int cpu); 252extern int select_nohz_load_balancer(int cpu);
@@ -784,6 +785,8 @@ struct sched_domain {
784 unsigned int balance_interval; /* initialise to 1. units in ms. */ 785 unsigned int balance_interval; /* initialise to 1. units in ms. */
785 unsigned int nr_balance_failed; /* initialise to 0 */ 786 unsigned int nr_balance_failed; /* initialise to 0 */
786 787
788 u64 last_update;
789
787#ifdef CONFIG_SCHEDSTATS 790#ifdef CONFIG_SCHEDSTATS
788 /* load_balance() stats */ 791 /* load_balance() stats */
789 unsigned int lb_count[CPU_MAX_IDLE_TYPES]; 792 unsigned int lb_count[CPU_MAX_IDLE_TYPES];
@@ -823,23 +826,6 @@ extern int arch_reinit_sched_domains(void);
823 826
824#endif /* CONFIG_SMP */ 827#endif /* CONFIG_SMP */
825 828
826/*
827 * A runqueue laden with a single nice 0 task scores a weighted_cpuload of
828 * SCHED_LOAD_SCALE. This function returns 1 if any cpu is laden with a
829 * task of nice 0 or enough lower priority tasks to bring up the
830 * weighted_cpuload
831 */
832static inline int above_background_load(void)
833{
834 unsigned long cpu;
835
836 for_each_online_cpu(cpu) {
837 if (weighted_cpuload(cpu) >= SCHED_LOAD_SCALE)
838 return 1;
839 }
840 return 0;
841}
842
843struct io_context; /* See blkdev.h */ 829struct io_context; /* See blkdev.h */
844#define NGROUPS_SMALL 32 830#define NGROUPS_SMALL 32
845#define NGROUPS_PER_BLOCK ((unsigned int)(PAGE_SIZE / sizeof(gid_t))) 831#define NGROUPS_PER_BLOCK ((unsigned int)(PAGE_SIZE / sizeof(gid_t)))
@@ -921,8 +907,8 @@ struct sched_class {
921 void (*set_cpus_allowed)(struct task_struct *p, 907 void (*set_cpus_allowed)(struct task_struct *p,
922 const cpumask_t *newmask); 908 const cpumask_t *newmask);
923 909
924 void (*join_domain)(struct rq *rq); 910 void (*rq_online)(struct rq *rq);
925 void (*leave_domain)(struct rq *rq); 911 void (*rq_offline)(struct rq *rq);
926 912
927 void (*switched_from) (struct rq *this_rq, struct task_struct *task, 913 void (*switched_from) (struct rq *this_rq, struct task_struct *task,
928 int running); 914 int running);
@@ -1039,6 +1025,7 @@ struct task_struct {
1039#endif 1025#endif
1040 1026
1041 int prio, static_prio, normal_prio; 1027 int prio, static_prio, normal_prio;
1028 unsigned int rt_priority;
1042 const struct sched_class *sched_class; 1029 const struct sched_class *sched_class;
1043 struct sched_entity se; 1030 struct sched_entity se;
1044 struct sched_rt_entity rt; 1031 struct sched_rt_entity rt;
@@ -1122,7 +1109,6 @@ struct task_struct {
1122 int __user *set_child_tid; /* CLONE_CHILD_SETTID */ 1109 int __user *set_child_tid; /* CLONE_CHILD_SETTID */
1123 int __user *clear_child_tid; /* CLONE_CHILD_CLEARTID */ 1110 int __user *clear_child_tid; /* CLONE_CHILD_CLEARTID */
1124 1111
1125 unsigned int rt_priority;
1126 cputime_t utime, stime, utimescaled, stimescaled; 1112 cputime_t utime, stime, utimescaled, stimescaled;
1127 cputime_t gtime; 1113 cputime_t gtime;
1128 cputime_t prev_utime, prev_stime; 1114 cputime_t prev_utime, prev_stime;
@@ -1141,12 +1127,12 @@ struct task_struct {
1141 gid_t gid,egid,sgid,fsgid; 1127 gid_t gid,egid,sgid,fsgid;
1142 struct group_info *group_info; 1128 struct group_info *group_info;
1143 kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset; 1129 kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset;
1144 unsigned securebits;
1145 struct user_struct *user; 1130 struct user_struct *user;
1131 unsigned securebits;
1146#ifdef CONFIG_KEYS 1132#ifdef CONFIG_KEYS
1133 unsigned char jit_keyring; /* default keyring to attach requested keys to */
1147 struct key *request_key_auth; /* assumed request_key authority */ 1134 struct key *request_key_auth; /* assumed request_key authority */
1148 struct key *thread_keyring; /* keyring private to this thread */ 1135 struct key *thread_keyring; /* keyring private to this thread */
1149 unsigned char jit_keyring; /* default keyring to attach requested keys to */
1150#endif 1136#endif
1151 char comm[TASK_COMM_LEN]; /* executable name excluding path 1137 char comm[TASK_COMM_LEN]; /* executable name excluding path
1152 - access with [gs]et_task_comm (which lock 1138 - access with [gs]et_task_comm (which lock
@@ -1233,8 +1219,8 @@ struct task_struct {
1233# define MAX_LOCK_DEPTH 48UL 1219# define MAX_LOCK_DEPTH 48UL
1234 u64 curr_chain_key; 1220 u64 curr_chain_key;
1235 int lockdep_depth; 1221 int lockdep_depth;
1236 struct held_lock held_locks[MAX_LOCK_DEPTH];
1237 unsigned int lockdep_recursion; 1222 unsigned int lockdep_recursion;
1223 struct held_lock held_locks[MAX_LOCK_DEPTH];
1238#endif 1224#endif
1239 1225
1240/* journalling filesystem info */ 1226/* journalling filesystem info */
@@ -1262,10 +1248,6 @@ struct task_struct {
1262 u64 acct_vm_mem1; /* accumulated virtual memory usage */ 1248 u64 acct_vm_mem1; /* accumulated virtual memory usage */
1263 cputime_t acct_stimexpd;/* stime since last update */ 1249 cputime_t acct_stimexpd;/* stime since last update */
1264#endif 1250#endif
1265#ifdef CONFIG_NUMA
1266 struct mempolicy *mempolicy;
1267 short il_next;
1268#endif
1269#ifdef CONFIG_CPUSETS 1251#ifdef CONFIG_CPUSETS
1270 nodemask_t mems_allowed; 1252 nodemask_t mems_allowed;
1271 int cpuset_mems_generation; 1253 int cpuset_mems_generation;
@@ -1285,6 +1267,10 @@ struct task_struct {
1285 struct list_head pi_state_list; 1267 struct list_head pi_state_list;
1286 struct futex_pi_state *pi_state_cache; 1268 struct futex_pi_state *pi_state_cache;
1287#endif 1269#endif
1270#ifdef CONFIG_NUMA
1271 struct mempolicy *mempolicy;
1272 short il_next;
1273#endif
1288 atomic_t fs_excl; /* holding fs exclusive resources */ 1274 atomic_t fs_excl; /* holding fs exclusive resources */
1289 struct rcu_head rcu; 1275 struct rcu_head rcu;
1290 1276
@@ -1504,6 +1490,7 @@ static inline void put_task_struct(struct task_struct *t)
1504#define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ 1490#define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */
1505#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */ 1491#define PF_SPREAD_PAGE 0x01000000 /* Spread page cache over cpuset */
1506#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ 1492#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */
1493#define PF_THREAD_BOUND 0x04000000 /* Thread bound to specific cpu */
1507#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ 1494#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
1508#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ 1495#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
1509#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */ 1496#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */
@@ -1573,13 +1560,28 @@ static inline void sched_clock_idle_sleep_event(void)
1573static inline void sched_clock_idle_wakeup_event(u64 delta_ns) 1560static inline void sched_clock_idle_wakeup_event(u64 delta_ns)
1574{ 1561{
1575} 1562}
1576#else 1563
1564#ifdef CONFIG_NO_HZ
1565static inline void sched_clock_tick_stop(int cpu)
1566{
1567}
1568
1569static inline void sched_clock_tick_start(int cpu)
1570{
1571}
1572#endif
1573
1574#else /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */
1577extern void sched_clock_init(void); 1575extern void sched_clock_init(void);
1578extern u64 sched_clock_cpu(int cpu); 1576extern u64 sched_clock_cpu(int cpu);
1579extern void sched_clock_tick(void); 1577extern void sched_clock_tick(void);
1580extern void sched_clock_idle_sleep_event(void); 1578extern void sched_clock_idle_sleep_event(void);
1581extern void sched_clock_idle_wakeup_event(u64 delta_ns); 1579extern void sched_clock_idle_wakeup_event(u64 delta_ns);
1580#ifdef CONFIG_NO_HZ
1581extern void sched_clock_tick_stop(int cpu);
1582extern void sched_clock_tick_start(int cpu);
1582#endif 1583#endif
1584#endif /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */
1583 1585
1584/* 1586/*
1585 * For kernel-internal use: high-speed (but slightly incorrect) per-cpu 1587 * For kernel-internal use: high-speed (but slightly incorrect) per-cpu
@@ -1622,6 +1624,7 @@ extern unsigned int sysctl_sched_child_runs_first;
1622extern unsigned int sysctl_sched_features; 1624extern unsigned int sysctl_sched_features;
1623extern unsigned int sysctl_sched_migration_cost; 1625extern unsigned int sysctl_sched_migration_cost;
1624extern unsigned int sysctl_sched_nr_migrate; 1626extern unsigned int sysctl_sched_nr_migrate;
1627extern unsigned int sysctl_sched_shares_ratelimit;
1625 1628
1626int sched_nr_latency_handler(struct ctl_table *table, int write, 1629int sched_nr_latency_handler(struct ctl_table *table, int write,
1627 struct file *file, void __user *buffer, size_t *length, 1630 struct file *file, void __user *buffer, size_t *length,
@@ -1655,6 +1658,8 @@ extern int can_nice(const struct task_struct *p, const int nice);
1655extern int task_curr(const struct task_struct *p); 1658extern int task_curr(const struct task_struct *p);
1656extern int idle_cpu(int cpu); 1659extern int idle_cpu(int cpu);
1657extern int sched_setscheduler(struct task_struct *, int, struct sched_param *); 1660extern int sched_setscheduler(struct task_struct *, int, struct sched_param *);
1661extern int sched_setscheduler_nocheck(struct task_struct *, int,
1662 struct sched_param *);
1658extern struct task_struct *idle_task(int cpu); 1663extern struct task_struct *idle_task(int cpu);
1659extern struct task_struct *curr_task(int cpu); 1664extern struct task_struct *curr_task(int cpu);
1660extern void set_curr_task(int cpu, struct task_struct *p); 1665extern void set_curr_task(int cpu, struct task_struct *p);
@@ -2131,6 +2136,18 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm)
2131} 2136}
2132#endif 2137#endif
2133 2138
2139#ifdef CONFIG_TRACING
2140extern void
2141__trace_special(void *__tr, void *__data,
2142 unsigned long arg1, unsigned long arg2, unsigned long arg3);
2143#else
2144static inline void
2145__trace_special(void *__tr, void *__data,
2146 unsigned long arg1, unsigned long arg2, unsigned long arg3)
2147{
2148}
2149#endif
2150
2134extern long sched_setaffinity(pid_t pid, const cpumask_t *new_mask); 2151extern long sched_setaffinity(pid_t pid, const cpumask_t *new_mask);
2135extern long sched_getaffinity(pid_t pid, cpumask_t *mask); 2152extern long sched_getaffinity(pid_t pid, cpumask_t *mask);
2136 2153
@@ -2225,6 +2242,8 @@ static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
2225} 2242}
2226#endif /* CONFIG_MM_OWNER */ 2243#endif /* CONFIG_MM_OWNER */
2227 2244
2245#define TASK_STATE_TO_CHAR_STR "RSDTtZX"
2246
2228#endif /* __KERNEL__ */ 2247#endif /* __KERNEL__ */
2229 2248
2230#endif 2249#endif
diff --git a/include/linux/security.h b/include/linux/security.h
index 50737c70e78e..31c8851ec5d0 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -46,7 +46,8 @@ struct audit_krule;
46 */ 46 */
47extern int cap_capable(struct task_struct *tsk, int cap); 47extern int cap_capable(struct task_struct *tsk, int cap);
48extern int cap_settime(struct timespec *ts, struct timezone *tz); 48extern int cap_settime(struct timespec *ts, struct timezone *tz);
49extern int cap_ptrace(struct task_struct *parent, struct task_struct *child); 49extern int cap_ptrace(struct task_struct *parent, struct task_struct *child,
50 unsigned int mode);
50extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 51extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
51extern int cap_capset_check(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 52extern int cap_capset_check(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
52extern void cap_capset_set(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 53extern void cap_capset_set(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
@@ -79,6 +80,7 @@ struct xfrm_selector;
79struct xfrm_policy; 80struct xfrm_policy;
80struct xfrm_state; 81struct xfrm_state;
81struct xfrm_user_sec_ctx; 82struct xfrm_user_sec_ctx;
83struct seq_file;
82 84
83extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); 85extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);
84extern int cap_netlink_recv(struct sk_buff *skb, int cap); 86extern int cap_netlink_recv(struct sk_buff *skb, int cap);
@@ -289,10 +291,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
289 * Update module state after a successful pivot. 291 * Update module state after a successful pivot.
290 * @old_path contains the path for the old root. 292 * @old_path contains the path for the old root.
291 * @new_path contains the path for the new root. 293 * @new_path contains the path for the new root.
292 * @sb_get_mnt_opts:
293 * Get the security relevant mount options used for a superblock
294 * @sb the superblock to get security mount options from
295 * @opts binary data structure containing all lsm mount data
296 * @sb_set_mnt_opts: 294 * @sb_set_mnt_opts:
297 * Set the security relevant mount options used for a superblock 295 * Set the security relevant mount options used for a superblock
298 * @sb the superblock to set security mount options for 296 * @sb the superblock to set security mount options for
@@ -1170,6 +1168,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1170 * attributes would be changed by the execve. 1168 * attributes would be changed by the execve.
1171 * @parent contains the task_struct structure for parent process. 1169 * @parent contains the task_struct structure for parent process.
1172 * @child contains the task_struct structure for child process. 1170 * @child contains the task_struct structure for child process.
1171 * @mode contains the PTRACE_MODE flags indicating the form of access.
1173 * Return 0 if permission is granted. 1172 * Return 0 if permission is granted.
1174 * @capget: 1173 * @capget:
1175 * Get the @effective, @inheritable, and @permitted capability sets for 1174 * Get the @effective, @inheritable, and @permitted capability sets for
@@ -1240,11 +1239,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1240 * @pages contains the number of pages. 1239 * @pages contains the number of pages.
1241 * Return 0 if permission is granted. 1240 * Return 0 if permission is granted.
1242 * 1241 *
1243 * @register_security:
1244 * allow module stacking.
1245 * @name contains the name of the security module being stacked.
1246 * @ops contains a pointer to the struct security_operations of the module to stack.
1247 *
1248 * @secid_to_secctx: 1242 * @secid_to_secctx:
1249 * Convert secid to security context. 1243 * Convert secid to security context.
1250 * @secid contains the security ID. 1244 * @secid contains the security ID.
@@ -1295,7 +1289,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1295struct security_operations { 1289struct security_operations {
1296 char name[SECURITY_NAME_MAX + 1]; 1290 char name[SECURITY_NAME_MAX + 1];
1297 1291
1298 int (*ptrace) (struct task_struct *parent, struct task_struct *child); 1292 int (*ptrace) (struct task_struct *parent, struct task_struct *child,
1293 unsigned int mode);
1299 int (*capget) (struct task_struct *target, 1294 int (*capget) (struct task_struct *target,
1300 kernel_cap_t *effective, 1295 kernel_cap_t *effective,
1301 kernel_cap_t *inheritable, kernel_cap_t *permitted); 1296 kernel_cap_t *inheritable, kernel_cap_t *permitted);
@@ -1328,6 +1323,7 @@ struct security_operations {
1328 void (*sb_free_security) (struct super_block *sb); 1323 void (*sb_free_security) (struct super_block *sb);
1329 int (*sb_copy_data) (char *orig, char *copy); 1324 int (*sb_copy_data) (char *orig, char *copy);
1330 int (*sb_kern_mount) (struct super_block *sb, void *data); 1325 int (*sb_kern_mount) (struct super_block *sb, void *data);
1326 int (*sb_show_options) (struct seq_file *m, struct super_block *sb);
1331 int (*sb_statfs) (struct dentry *dentry); 1327 int (*sb_statfs) (struct dentry *dentry);
1332 int (*sb_mount) (char *dev_name, struct path *path, 1328 int (*sb_mount) (char *dev_name, struct path *path,
1333 char *type, unsigned long flags, void *data); 1329 char *type, unsigned long flags, void *data);
@@ -1343,8 +1339,6 @@ struct security_operations {
1343 struct path *new_path); 1339 struct path *new_path);
1344 void (*sb_post_pivotroot) (struct path *old_path, 1340 void (*sb_post_pivotroot) (struct path *old_path,
1345 struct path *new_path); 1341 struct path *new_path);
1346 int (*sb_get_mnt_opts) (const struct super_block *sb,
1347 struct security_mnt_opts *opts);
1348 int (*sb_set_mnt_opts) (struct super_block *sb, 1342 int (*sb_set_mnt_opts) (struct super_block *sb,
1349 struct security_mnt_opts *opts); 1343 struct security_mnt_opts *opts);
1350 void (*sb_clone_mnt_opts) (const struct super_block *oldsb, 1344 void (*sb_clone_mnt_opts) (const struct super_block *oldsb,
@@ -1472,10 +1466,6 @@ struct security_operations {
1472 int (*netlink_send) (struct sock *sk, struct sk_buff *skb); 1466 int (*netlink_send) (struct sock *sk, struct sk_buff *skb);
1473 int (*netlink_recv) (struct sk_buff *skb, int cap); 1467 int (*netlink_recv) (struct sk_buff *skb, int cap);
1474 1468
1475 /* allow module stacking */
1476 int (*register_security) (const char *name,
1477 struct security_operations *ops);
1478
1479 void (*d_instantiate) (struct dentry *dentry, struct inode *inode); 1469 void (*d_instantiate) (struct dentry *dentry, struct inode *inode);
1480 1470
1481 int (*getprocattr) (struct task_struct *p, char *name, char **value); 1471 int (*getprocattr) (struct task_struct *p, char *name, char **value);
@@ -1565,7 +1555,6 @@ struct security_operations {
1565extern int security_init(void); 1555extern int security_init(void);
1566extern int security_module_enable(struct security_operations *ops); 1556extern int security_module_enable(struct security_operations *ops);
1567extern int register_security(struct security_operations *ops); 1557extern int register_security(struct security_operations *ops);
1568extern int mod_reg_security(const char *name, struct security_operations *ops);
1569extern struct dentry *securityfs_create_file(const char *name, mode_t mode, 1558extern struct dentry *securityfs_create_file(const char *name, mode_t mode,
1570 struct dentry *parent, void *data, 1559 struct dentry *parent, void *data,
1571 const struct file_operations *fops); 1560 const struct file_operations *fops);
@@ -1573,7 +1562,8 @@ extern struct dentry *securityfs_create_dir(const char *name, struct dentry *par
1573extern void securityfs_remove(struct dentry *dentry); 1562extern void securityfs_remove(struct dentry *dentry);
1574 1563
1575/* Security operations */ 1564/* Security operations */
1576int security_ptrace(struct task_struct *parent, struct task_struct *child); 1565int security_ptrace(struct task_struct *parent, struct task_struct *child,
1566 unsigned int mode);
1577int security_capget(struct task_struct *target, 1567int security_capget(struct task_struct *target,
1578 kernel_cap_t *effective, 1568 kernel_cap_t *effective,
1579 kernel_cap_t *inheritable, 1569 kernel_cap_t *inheritable,
@@ -1606,6 +1596,7 @@ int security_sb_alloc(struct super_block *sb);
1606void security_sb_free(struct super_block *sb); 1596void security_sb_free(struct super_block *sb);
1607int security_sb_copy_data(char *orig, char *copy); 1597int security_sb_copy_data(char *orig, char *copy);
1608int security_sb_kern_mount(struct super_block *sb, void *data); 1598int security_sb_kern_mount(struct super_block *sb, void *data);
1599int security_sb_show_options(struct seq_file *m, struct super_block *sb);
1609int security_sb_statfs(struct dentry *dentry); 1600int security_sb_statfs(struct dentry *dentry);
1610int security_sb_mount(char *dev_name, struct path *path, 1601int security_sb_mount(char *dev_name, struct path *path,
1611 char *type, unsigned long flags, void *data); 1602 char *type, unsigned long flags, void *data);
@@ -1617,8 +1608,6 @@ void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *d
1617void security_sb_post_addmount(struct vfsmount *mnt, struct path *mountpoint); 1608void security_sb_post_addmount(struct vfsmount *mnt, struct path *mountpoint);
1618int security_sb_pivotroot(struct path *old_path, struct path *new_path); 1609int security_sb_pivotroot(struct path *old_path, struct path *new_path);
1619void security_sb_post_pivotroot(struct path *old_path, struct path *new_path); 1610void security_sb_post_pivotroot(struct path *old_path, struct path *new_path);
1620int security_sb_get_mnt_opts(const struct super_block *sb,
1621 struct security_mnt_opts *opts);
1622int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); 1611int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts);
1623void security_sb_clone_mnt_opts(const struct super_block *oldsb, 1612void security_sb_clone_mnt_opts(const struct super_block *oldsb,
1624 struct super_block *newsb); 1613 struct super_block *newsb);
@@ -1755,9 +1744,11 @@ static inline int security_init(void)
1755 return 0; 1744 return 0;
1756} 1745}
1757 1746
1758static inline int security_ptrace(struct task_struct *parent, struct task_struct *child) 1747static inline int security_ptrace(struct task_struct *parent,
1748 struct task_struct *child,
1749 unsigned int mode)
1759{ 1750{
1760 return cap_ptrace(parent, child); 1751 return cap_ptrace(parent, child, mode);
1761} 1752}
1762 1753
1763static inline int security_capget(struct task_struct *target, 1754static inline int security_capget(struct task_struct *target,
@@ -1881,6 +1872,12 @@ static inline int security_sb_kern_mount(struct super_block *sb, void *data)
1881 return 0; 1872 return 0;
1882} 1873}
1883 1874
1875static inline int security_sb_show_options(struct seq_file *m,
1876 struct super_block *sb)
1877{
1878 return 0;
1879}
1880
1884static inline int security_sb_statfs(struct dentry *dentry) 1881static inline int security_sb_statfs(struct dentry *dentry)
1885{ 1882{
1886 return 0; 1883 return 0;
@@ -1927,12 +1924,6 @@ static inline int security_sb_pivotroot(struct path *old_path,
1927static inline void security_sb_post_pivotroot(struct path *old_path, 1924static inline void security_sb_post_pivotroot(struct path *old_path,
1928 struct path *new_path) 1925 struct path *new_path)
1929{ } 1926{ }
1930static inline int security_sb_get_mnt_opts(const struct super_block *sb,
1931 struct security_mnt_opts *opts)
1932{
1933 security_init_mnt_opts(opts);
1934 return 0;
1935}
1936 1927
1937static inline int security_sb_set_mnt_opts(struct super_block *sb, 1928static inline int security_sb_set_mnt_opts(struct super_block *sb,
1938 struct security_mnt_opts *opts) 1929 struct security_mnt_opts *opts)
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 55232ccf9cfd..48262f86c969 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -7,9 +7,18 @@
7 */ 7 */
8 8
9#include <linux/errno.h> 9#include <linux/errno.h>
10#include <linux/list.h>
11#include <linux/cpumask.h>
10 12
11extern void cpu_idle(void); 13extern void cpu_idle(void);
12 14
15struct call_single_data {
16 struct list_head list;
17 void (*func) (void *info);
18 void *info;
19 unsigned int flags;
20};
21
13#ifdef CONFIG_SMP 22#ifdef CONFIG_SMP
14 23
15#include <linux/preempt.h> 24#include <linux/preempt.h>
@@ -52,15 +61,34 @@ extern void smp_cpus_done(unsigned int max_cpus);
52/* 61/*
53 * Call a function on all other processors 62 * Call a function on all other processors
54 */ 63 */
55int smp_call_function(void(*func)(void *info), void *info, int retry, int wait); 64int smp_call_function(void(*func)(void *info), void *info, int wait);
56 65int smp_call_function_mask(cpumask_t mask, void(*func)(void *info), void *info,
66 int wait);
57int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, 67int smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
58 int retry, int wait); 68 int wait);
69void __smp_call_function_single(int cpuid, struct call_single_data *data);
70
71/*
72 * Generic and arch helpers
73 */
74#ifdef CONFIG_USE_GENERIC_SMP_HELPERS
75void generic_smp_call_function_single_interrupt(void);
76void generic_smp_call_function_interrupt(void);
77void init_call_single_data(void);
78void ipi_call_lock(void);
79void ipi_call_unlock(void);
80void ipi_call_lock_irq(void);
81void ipi_call_unlock_irq(void);
82#else
83static inline void init_call_single_data(void)
84{
85}
86#endif
59 87
60/* 88/*
61 * Call a function on all processors 89 * Call a function on all processors
62 */ 90 */
63int on_each_cpu(void (*func) (void *info), void *info, int retry, int wait); 91int on_each_cpu(void (*func) (void *info), void *info, int wait);
64 92
65#define MSG_ALL_BUT_SELF 0x8000 /* Assume <32768 CPU's */ 93#define MSG_ALL_BUT_SELF 0x8000 /* Assume <32768 CPU's */
66#define MSG_ALL 0x8001 94#define MSG_ALL 0x8001
@@ -90,9 +118,9 @@ static inline int up_smp_call_function(void (*func)(void *), void *info)
90{ 118{
91 return 0; 119 return 0;
92} 120}
93#define smp_call_function(func, info, retry, wait) \ 121#define smp_call_function(func, info, wait) \
94 (up_smp_call_function(func, info)) 122 (up_smp_call_function(func, info))
95#define on_each_cpu(func,info,retry,wait) \ 123#define on_each_cpu(func,info,wait) \
96 ({ \ 124 ({ \
97 local_irq_disable(); \ 125 local_irq_disable(); \
98 func(info); \ 126 func(info); \
@@ -102,7 +130,7 @@ static inline int up_smp_call_function(void (*func)(void *), void *info)
102static inline void smp_send_reschedule(int cpu) { } 130static inline void smp_send_reschedule(int cpu) { }
103#define num_booting_cpus() 1 131#define num_booting_cpus() 1
104#define smp_prepare_boot_cpu() do {} while (0) 132#define smp_prepare_boot_cpu() do {} while (0)
105#define smp_call_function_single(cpuid, func, info, retry, wait) \ 133#define smp_call_function_single(cpuid, func, info, wait) \
106({ \ 134({ \
107 WARN_ON(cpuid != 0); \ 135 WARN_ON(cpuid != 0); \
108 local_irq_disable(); \ 136 local_irq_disable(); \
@@ -112,7 +140,9 @@ static inline void smp_send_reschedule(int cpu) { }
112}) 140})
113#define smp_call_function_mask(mask, func, info, wait) \ 141#define smp_call_function_mask(mask, func, info, wait) \
114 (up_smp_call_function(func, info)) 142 (up_smp_call_function(func, info))
115 143static inline void init_call_single_data(void)
144{
145}
116#endif /* !SMP */ 146#endif /* !SMP */
117 147
118/* 148/*
diff --git a/include/linux/smp_lock.h b/include/linux/smp_lock.h
index aab3a4cff4e1..813be59bf345 100644
--- a/include/linux/smp_lock.h
+++ b/include/linux/smp_lock.h
@@ -27,11 +27,24 @@ static inline int reacquire_kernel_lock(struct task_struct *task)
27extern void __lockfunc lock_kernel(void) __acquires(kernel_lock); 27extern void __lockfunc lock_kernel(void) __acquires(kernel_lock);
28extern void __lockfunc unlock_kernel(void) __releases(kernel_lock); 28extern void __lockfunc unlock_kernel(void) __releases(kernel_lock);
29 29
30/*
31 * Various legacy drivers don't really need the BKL in a specific
32 * function, but they *do* need to know that the BKL became available.
33 * This function just avoids wrapping a bunch of lock/unlock pairs
34 * around code which doesn't really need it.
35 */
36static inline void cycle_kernel_lock(void)
37{
38 lock_kernel();
39 unlock_kernel();
40}
41
30#else 42#else
31 43
32#define lock_kernel() do { } while(0) 44#define lock_kernel() do { } while(0)
33#define unlock_kernel() do { } while(0) 45#define unlock_kernel() do { } while(0)
34#define release_kernel_lock(task) do { } while(0) 46#define release_kernel_lock(task) do { } while(0)
47#define cycle_kernel_lock() do { } while(0)
35#define reacquire_kernel_lock(task) 0 48#define reacquire_kernel_lock(task) 0
36#define kernel_locked() 1 49#define kernel_locked() 1
37 50
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 24f3d2282e11..2158fc0d5a56 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -179,4 +179,17 @@ void arch_update_cpu_topology(void);
179#endif 179#endif
180#endif /* CONFIG_NUMA */ 180#endif /* CONFIG_NUMA */
181 181
182#ifndef topology_physical_package_id
183#define topology_physical_package_id(cpu) ((void)(cpu), -1)
184#endif
185#ifndef topology_core_id
186#define topology_core_id(cpu) ((void)(cpu), 0)
187#endif
188#ifndef topology_thread_siblings
189#define topology_thread_siblings(cpu) cpumask_of_cpu(cpu)
190#endif
191#ifndef topology_core_siblings
192#define topology_core_siblings(cpu) cpumask_of_cpu(cpu)
193#endif
194
182#endif /* _LINUX_TOPOLOGY_H */ 195#endif /* _LINUX_TOPOLOGY_H */
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index f462439cc288..12b15c561a1f 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -63,6 +63,7 @@ struct writeback_control {
63 unsigned for_writepages:1; /* This is a writepages() call */ 63 unsigned for_writepages:1; /* This is a writepages() call */
64 unsigned range_cyclic:1; /* range_start is cyclic */ 64 unsigned range_cyclic:1; /* range_start is cyclic */
65 unsigned more_io:1; /* more io to be dispatched */ 65 unsigned more_io:1; /* more io to be dispatched */
66 unsigned range_cont:1;
66}; 67};
67 68
68/* 69/*
@@ -105,6 +106,8 @@ extern int vm_highmem_is_dirtyable;
105extern int block_dump; 106extern int block_dump;
106extern int laptop_mode; 107extern int laptop_mode;
107 108
109extern unsigned long determine_dirtyable_memory(void);
110
108extern int dirty_ratio_handler(struct ctl_table *table, int write, 111extern int dirty_ratio_handler(struct ctl_table *table, int write,
109 struct file *filp, void __user *buffer, size_t *lenp, 112 struct file *filp, void __user *buffer, size_t *lenp,
110 loff_t *ppos); 113 loff_t *ppos);
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 2ca6bae88721..fb0c215a3051 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -339,6 +339,7 @@ struct xfrm_usersa_info {
339#define XFRM_STATE_NOPMTUDISC 4 339#define XFRM_STATE_NOPMTUDISC 4
340#define XFRM_STATE_WILDRECV 8 340#define XFRM_STATE_WILDRECV 8
341#define XFRM_STATE_ICMP 16 341#define XFRM_STATE_ICMP 16
342#define XFRM_STATE_AF_UNSPEC 32
342}; 343};
343 344
344struct xfrm_usersa_id { 345struct xfrm_usersa_id {