diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/blkdev.h | 2 | ||||
-rw-r--r-- | include/linux/compiler.h | 5 | ||||
-rw-r--r-- | include/linux/fuse.h | 31 | ||||
-rw-r--r-- | include/linux/genhd.h | 1 | ||||
-rw-r--r-- | include/linux/ide.h | 46 | ||||
-rw-r--r-- | include/linux/if_ether.h | 1 | ||||
-rw-r--r-- | include/linux/lguest.h | 4 | ||||
-rw-r--r-- | include/linux/lguest_launcher.h | 3 | ||||
-rw-r--r-- | include/linux/module.h | 1 | ||||
-rw-r--r-- | include/linux/moduleparam.h | 40 | ||||
-rw-r--r-- | include/linux/virtio.h | 15 | ||||
-rw-r--r-- | include/linux/virtio_config.h | 49 | ||||
-rw-r--r-- | include/linux/virtio_pci.h | 10 | ||||
-rw-r--r-- | include/linux/virtio_ring.h | 8 |
14 files changed, 160 insertions, 56 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index ebdfde8fe556..0b1a6cae9de1 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -1226,6 +1226,8 @@ struct block_device_operations { | |||
1226 | int (*direct_access) (struct block_device *, sector_t, | 1226 | int (*direct_access) (struct block_device *, sector_t, |
1227 | void **, unsigned long *); | 1227 | void **, unsigned long *); |
1228 | int (*media_changed) (struct gendisk *); | 1228 | int (*media_changed) (struct gendisk *); |
1229 | unsigned long long (*set_capacity) (struct gendisk *, | ||
1230 | unsigned long long); | ||
1229 | int (*revalidate_disk) (struct gendisk *); | 1231 | int (*revalidate_disk) (struct gendisk *); |
1230 | int (*getgeo)(struct block_device *, struct hd_geometry *); | 1232 | int (*getgeo)(struct block_device *, struct hd_geometry *); |
1231 | struct module *owner; | 1233 | struct module *owner; |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 37bcb50a4d7c..04fb5135b4e1 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -261,6 +261,11 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); | |||
261 | # define __section(S) __attribute__ ((__section__(#S))) | 261 | # define __section(S) __attribute__ ((__section__(#S))) |
262 | #endif | 262 | #endif |
263 | 263 | ||
264 | /* Are two types/vars the same type (ignoring qualifiers)? */ | ||
265 | #ifndef __same_type | ||
266 | # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) | ||
267 | #endif | ||
268 | |||
264 | /* | 269 | /* |
265 | * Prevent the compiler from merging or refetching accesses. The compiler | 270 | * Prevent the compiler from merging or refetching accesses. The compiler |
266 | * is also forbidden from reordering successive instances of ACCESS_ONCE(), | 271 | * is also forbidden from reordering successive instances of ACCESS_ONCE(), |
diff --git a/include/linux/fuse.h b/include/linux/fuse.h index 162e5defe683..d41ed593f79f 100644 --- a/include/linux/fuse.h +++ b/include/linux/fuse.h | |||
@@ -121,6 +121,13 @@ struct fuse_file_lock { | |||
121 | #define FUSE_BIG_WRITES (1 << 5) | 121 | #define FUSE_BIG_WRITES (1 << 5) |
122 | 122 | ||
123 | /** | 123 | /** |
124 | * CUSE INIT request/reply flags | ||
125 | * | ||
126 | * CUSE_UNRESTRICTED_IOCTL: use unrestricted ioctl | ||
127 | */ | ||
128 | #define CUSE_UNRESTRICTED_IOCTL (1 << 0) | ||
129 | |||
130 | /** | ||
124 | * Release flags | 131 | * Release flags |
125 | */ | 132 | */ |
126 | #define FUSE_RELEASE_FLUSH (1 << 0) | 133 | #define FUSE_RELEASE_FLUSH (1 << 0) |
@@ -210,6 +217,9 @@ enum fuse_opcode { | |||
210 | FUSE_DESTROY = 38, | 217 | FUSE_DESTROY = 38, |
211 | FUSE_IOCTL = 39, | 218 | FUSE_IOCTL = 39, |
212 | FUSE_POLL = 40, | 219 | FUSE_POLL = 40, |
220 | |||
221 | /* CUSE specific operations */ | ||
222 | CUSE_INIT = 4096, | ||
213 | }; | 223 | }; |
214 | 224 | ||
215 | enum fuse_notify_code { | 225 | enum fuse_notify_code { |
@@ -401,6 +411,27 @@ struct fuse_init_out { | |||
401 | __u32 max_write; | 411 | __u32 max_write; |
402 | }; | 412 | }; |
403 | 413 | ||
414 | #define CUSE_INIT_INFO_MAX 4096 | ||
415 | |||
416 | struct cuse_init_in { | ||
417 | __u32 major; | ||
418 | __u32 minor; | ||
419 | __u32 unused; | ||
420 | __u32 flags; | ||
421 | }; | ||
422 | |||
423 | struct cuse_init_out { | ||
424 | __u32 major; | ||
425 | __u32 minor; | ||
426 | __u32 unused; | ||
427 | __u32 flags; | ||
428 | __u32 max_read; | ||
429 | __u32 max_write; | ||
430 | __u32 dev_major; /* chardev major */ | ||
431 | __u32 dev_minor; /* chardev minor */ | ||
432 | __u32 spare[10]; | ||
433 | }; | ||
434 | |||
404 | struct fuse_interrupt_in { | 435 | struct fuse_interrupt_in { |
405 | __u64 unique; | 436 | __u64 unique; |
406 | }; | 437 | }; |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 149fda264c86..7cbd38d363a2 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -114,6 +114,7 @@ struct hd_struct { | |||
114 | #define GENHD_FL_UP 16 | 114 | #define GENHD_FL_UP 16 |
115 | #define GENHD_FL_SUPPRESS_PARTITION_INFO 32 | 115 | #define GENHD_FL_SUPPRESS_PARTITION_INFO 32 |
116 | #define GENHD_FL_EXT_DEVT 64 /* allow extended devt */ | 116 | #define GENHD_FL_EXT_DEVT 64 /* allow extended devt */ |
117 | #define GENHD_FL_NATIVE_CAPACITY 128 | ||
117 | 118 | ||
118 | #define BLK_SCSI_MAX_CMDS (256) | 119 | #define BLK_SCSI_MAX_CMDS (256) |
119 | #define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8)) | 120 | #define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8)) |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 867cb68d8461..a6c6a2fad7c8 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -178,7 +178,7 @@ typedef u8 hwif_chipset_t; | |||
178 | /* | 178 | /* |
179 | * Structure to hold all information about the location of this port | 179 | * Structure to hold all information about the location of this port |
180 | */ | 180 | */ |
181 | typedef struct hw_regs_s { | 181 | struct ide_hw { |
182 | union { | 182 | union { |
183 | struct ide_io_ports io_ports; | 183 | struct ide_io_ports io_ports; |
184 | unsigned long io_ports_array[IDE_NR_PORTS]; | 184 | unsigned long io_ports_array[IDE_NR_PORTS]; |
@@ -186,12 +186,11 @@ typedef struct hw_regs_s { | |||
186 | 186 | ||
187 | int irq; /* our irq number */ | 187 | int irq; /* our irq number */ |
188 | ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ | 188 | ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ |
189 | hwif_chipset_t chipset; | ||
190 | struct device *dev, *parent; | 189 | struct device *dev, *parent; |
191 | unsigned long config; | 190 | unsigned long config; |
192 | } hw_regs_t; | 191 | }; |
193 | 192 | ||
194 | static inline void ide_std_init_ports(hw_regs_t *hw, | 193 | static inline void ide_std_init_ports(struct ide_hw *hw, |
195 | unsigned long io_addr, | 194 | unsigned long io_addr, |
196 | unsigned long ctl_addr) | 195 | unsigned long ctl_addr) |
197 | { | 196 | { |
@@ -218,21 +217,12 @@ static inline void ide_std_init_ports(hw_regs_t *hw, | |||
218 | 217 | ||
219 | /* | 218 | /* |
220 | * Special Driver Flags | 219 | * Special Driver Flags |
221 | * | ||
222 | * set_geometry : respecify drive geometry | ||
223 | * recalibrate : seek to cyl 0 | ||
224 | * set_multmode : set multmode count | ||
225 | * reserved : unused | ||
226 | */ | 220 | */ |
227 | typedef union { | 221 | enum { |
228 | unsigned all : 8; | 222 | IDE_SFLAG_SET_GEOMETRY = (1 << 0), |
229 | struct { | 223 | IDE_SFLAG_RECALIBRATE = (1 << 1), |
230 | unsigned set_geometry : 1; | 224 | IDE_SFLAG_SET_MULTMODE = (1 << 2), |
231 | unsigned recalibrate : 1; | 225 | }; |
232 | unsigned set_multmode : 1; | ||
233 | unsigned reserved : 5; | ||
234 | } b; | ||
235 | } special_t; | ||
236 | 226 | ||
237 | /* | 227 | /* |
238 | * Status returned from various ide_ functions | 228 | * Status returned from various ide_ functions |
@@ -391,6 +381,7 @@ struct ide_drive_s; | |||
391 | struct ide_disk_ops { | 381 | struct ide_disk_ops { |
392 | int (*check)(struct ide_drive_s *, const char *); | 382 | int (*check)(struct ide_drive_s *, const char *); |
393 | int (*get_capacity)(struct ide_drive_s *); | 383 | int (*get_capacity)(struct ide_drive_s *); |
384 | u64 (*set_capacity)(struct ide_drive_s *, u64); | ||
394 | void (*setup)(struct ide_drive_s *); | 385 | void (*setup)(struct ide_drive_s *); |
395 | void (*flush)(struct ide_drive_s *); | 386 | void (*flush)(struct ide_drive_s *); |
396 | int (*init_media)(struct ide_drive_s *, struct gendisk *); | 387 | int (*init_media)(struct ide_drive_s *, struct gendisk *); |
@@ -468,6 +459,8 @@ enum { | |||
468 | IDE_DFLAG_NICE1 = (1 << 5), | 459 | IDE_DFLAG_NICE1 = (1 << 5), |
469 | /* device is physically present */ | 460 | /* device is physically present */ |
470 | IDE_DFLAG_PRESENT = (1 << 6), | 461 | IDE_DFLAG_PRESENT = (1 << 6), |
462 | /* disable Host Protected Area */ | ||
463 | IDE_DFLAG_NOHPA = (1 << 7), | ||
471 | /* id read from device (synthetic if not set) */ | 464 | /* id read from device (synthetic if not set) */ |
472 | IDE_DFLAG_ID_READ = (1 << 8), | 465 | IDE_DFLAG_ID_READ = (1 << 8), |
473 | IDE_DFLAG_NOPROBE = (1 << 9), | 466 | IDE_DFLAG_NOPROBE = (1 << 9), |
@@ -506,6 +499,7 @@ enum { | |||
506 | /* write protect */ | 499 | /* write protect */ |
507 | IDE_DFLAG_WP = (1 << 29), | 500 | IDE_DFLAG_WP = (1 << 29), |
508 | IDE_DFLAG_FORMAT_IN_PROGRESS = (1 << 30), | 501 | IDE_DFLAG_FORMAT_IN_PROGRESS = (1 << 30), |
502 | IDE_DFLAG_NIEN_QUIRK = (1 << 31), | ||
509 | }; | 503 | }; |
510 | 504 | ||
511 | struct ide_drive_s { | 505 | struct ide_drive_s { |
@@ -530,14 +524,13 @@ struct ide_drive_s { | |||
530 | unsigned long sleep; /* sleep until this time */ | 524 | unsigned long sleep; /* sleep until this time */ |
531 | unsigned long timeout; /* max time to wait for irq */ | 525 | unsigned long timeout; /* max time to wait for irq */ |
532 | 526 | ||
533 | special_t special; /* special action flags */ | 527 | u8 special_flags; /* special action flags */ |
534 | 528 | ||
535 | u8 select; /* basic drive/head select reg value */ | 529 | u8 select; /* basic drive/head select reg value */ |
536 | u8 retry_pio; /* retrying dma capable host in pio */ | 530 | u8 retry_pio; /* retrying dma capable host in pio */ |
537 | u8 waiting_for_dma; /* dma currently in progress */ | 531 | u8 waiting_for_dma; /* dma currently in progress */ |
538 | u8 dma; /* atapi dma flag */ | 532 | u8 dma; /* atapi dma flag */ |
539 | 533 | ||
540 | u8 quirk_list; /* considered quirky, set for a specific host */ | ||
541 | u8 init_speed; /* transfer rate set at boot */ | 534 | u8 init_speed; /* transfer rate set at boot */ |
542 | u8 current_speed; /* current transfer rate set */ | 535 | u8 current_speed; /* current transfer rate set */ |
543 | u8 desired_speed; /* desired transfer rate set */ | 536 | u8 desired_speed; /* desired transfer rate set */ |
@@ -562,8 +555,7 @@ struct ide_drive_s { | |||
562 | unsigned int drive_data; /* used by set_pio_mode/dev_select() */ | 555 | unsigned int drive_data; /* used by set_pio_mode/dev_select() */ |
563 | unsigned int failures; /* current failure count */ | 556 | unsigned int failures; /* current failure count */ |
564 | unsigned int max_failures; /* maximum allowed failure count */ | 557 | unsigned int max_failures; /* maximum allowed failure count */ |
565 | u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */ | 558 | u64 probed_capacity;/* initial/native media capacity */ |
566 | |||
567 | u64 capacity64; /* total number of sectors */ | 559 | u64 capacity64; /* total number of sectors */ |
568 | 560 | ||
569 | int lun; /* logical unit */ | 561 | int lun; /* logical unit */ |
@@ -1222,7 +1214,7 @@ static inline int ide_pci_is_in_compatibility_mode(struct pci_dev *dev) | |||
1222 | } | 1214 | } |
1223 | 1215 | ||
1224 | void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, | 1216 | void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, |
1225 | hw_regs_t *, hw_regs_t **); | 1217 | struct ide_hw *, struct ide_hw **); |
1226 | void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); | 1218 | void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); |
1227 | 1219 | ||
1228 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | 1220 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI |
@@ -1461,16 +1453,18 @@ static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} | |||
1461 | void ide_register_region(struct gendisk *); | 1453 | void ide_register_region(struct gendisk *); |
1462 | void ide_unregister_region(struct gendisk *); | 1454 | void ide_unregister_region(struct gendisk *); |
1463 | 1455 | ||
1456 | void ide_check_nien_quirk_list(ide_drive_t *); | ||
1464 | void ide_undecoded_slave(ide_drive_t *); | 1457 | void ide_undecoded_slave(ide_drive_t *); |
1465 | 1458 | ||
1466 | void ide_port_apply_params(ide_hwif_t *); | 1459 | void ide_port_apply_params(ide_hwif_t *); |
1467 | int ide_sysfs_register_port(ide_hwif_t *); | 1460 | int ide_sysfs_register_port(ide_hwif_t *); |
1468 | 1461 | ||
1469 | struct ide_host *ide_host_alloc(const struct ide_port_info *, hw_regs_t **); | 1462 | struct ide_host *ide_host_alloc(const struct ide_port_info *, struct ide_hw **, |
1463 | unsigned int); | ||
1470 | void ide_host_free(struct ide_host *); | 1464 | void ide_host_free(struct ide_host *); |
1471 | int ide_host_register(struct ide_host *, const struct ide_port_info *, | 1465 | int ide_host_register(struct ide_host *, const struct ide_port_info *, |
1472 | hw_regs_t **); | 1466 | struct ide_hw **); |
1473 | int ide_host_add(const struct ide_port_info *, hw_regs_t **, | 1467 | int ide_host_add(const struct ide_port_info *, struct ide_hw **, unsigned int, |
1474 | struct ide_host **); | 1468 | struct ide_host **); |
1475 | void ide_host_remove(struct ide_host *); | 1469 | void ide_host_remove(struct ide_host *); |
1476 | int ide_legacy_device_add(const struct ide_port_info *, unsigned long); | 1470 | int ide_legacy_device_add(const struct ide_port_info *, unsigned long); |
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index cfe4fe1b7132..60e8934d10b5 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h | |||
@@ -79,6 +79,7 @@ | |||
79 | #define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ | 79 | #define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ |
80 | #define ETH_P_TIPC 0x88CA /* TIPC */ | 80 | #define ETH_P_TIPC 0x88CA /* TIPC */ |
81 | #define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */ | 81 | #define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */ |
82 | #define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */ | ||
82 | #define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ | 83 | #define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ |
83 | 84 | ||
84 | /* | 85 | /* |
diff --git a/include/linux/lguest.h b/include/linux/lguest.h index 175e63f4a8c0..7bc1440fc473 100644 --- a/include/linux/lguest.h +++ b/include/linux/lguest.h | |||
@@ -30,6 +30,10 @@ struct lguest_data | |||
30 | /* Wallclock time set by the Host. */ | 30 | /* Wallclock time set by the Host. */ |
31 | struct timespec time; | 31 | struct timespec time; |
32 | 32 | ||
33 | /* Interrupt pending set by the Host. The Guest should do a hypercall | ||
34 | * if it re-enables interrupts and sees this set (to X86_EFLAGS_IF). */ | ||
35 | int irq_pending; | ||
36 | |||
33 | /* Async hypercall ring. Instead of directly making hypercalls, we can | 37 | /* Async hypercall ring. Instead of directly making hypercalls, we can |
34 | * place them in here for processing the next time the Host wants. | 38 | * place them in here for processing the next time the Host wants. |
35 | * This batching can be quite efficient. */ | 39 | * This batching can be quite efficient. */ |
diff --git a/include/linux/lguest_launcher.h b/include/linux/lguest_launcher.h index a53407a4165c..bfefbdf7498a 100644 --- a/include/linux/lguest_launcher.h +++ b/include/linux/lguest_launcher.h | |||
@@ -57,7 +57,8 @@ enum lguest_req | |||
57 | LHREQ_INITIALIZE, /* + base, pfnlimit, start */ | 57 | LHREQ_INITIALIZE, /* + base, pfnlimit, start */ |
58 | LHREQ_GETDMA, /* No longer used */ | 58 | LHREQ_GETDMA, /* No longer used */ |
59 | LHREQ_IRQ, /* + irq */ | 59 | LHREQ_IRQ, /* + irq */ |
60 | LHREQ_BREAK, /* + on/off flag (on blocks until someone does off) */ | 60 | LHREQ_BREAK, /* No longer used */ |
61 | LHREQ_EVENTFD, /* + address, fd. */ | ||
61 | }; | 62 | }; |
62 | 63 | ||
63 | /* The alignment to use between consumer and producer parts of vring. | 64 | /* The alignment to use between consumer and producer parts of vring. |
diff --git a/include/linux/module.h b/include/linux/module.h index a8f2c0aa4c32..a7bc6e7b43a7 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -77,6 +77,7 @@ search_extable(const struct exception_table_entry *first, | |||
77 | void sort_extable(struct exception_table_entry *start, | 77 | void sort_extable(struct exception_table_entry *start, |
78 | struct exception_table_entry *finish); | 78 | struct exception_table_entry *finish); |
79 | void sort_main_extable(void); | 79 | void sort_main_extable(void); |
80 | void trim_init_extable(struct module *m); | ||
80 | 81 | ||
81 | #ifdef MODULE | 82 | #ifdef MODULE |
82 | #define MODULE_GENERIC_TABLE(gtype,name) \ | 83 | #define MODULE_GENERIC_TABLE(gtype,name) \ |
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index a4f0b931846c..6547c3cdbc4c 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h | |||
@@ -36,9 +36,14 @@ typedef int (*param_set_fn)(const char *val, struct kernel_param *kp); | |||
36 | /* Returns length written or -errno. Buffer is 4k (ie. be short!) */ | 36 | /* Returns length written or -errno. Buffer is 4k (ie. be short!) */ |
37 | typedef int (*param_get_fn)(char *buffer, struct kernel_param *kp); | 37 | typedef int (*param_get_fn)(char *buffer, struct kernel_param *kp); |
38 | 38 | ||
39 | /* Flag bits for kernel_param.flags */ | ||
40 | #define KPARAM_KMALLOCED 1 | ||
41 | #define KPARAM_ISBOOL 2 | ||
42 | |||
39 | struct kernel_param { | 43 | struct kernel_param { |
40 | const char *name; | 44 | const char *name; |
41 | unsigned int perm; | 45 | u16 perm; |
46 | u16 flags; | ||
42 | param_set_fn set; | 47 | param_set_fn set; |
43 | param_get_fn get; | 48 | param_get_fn get; |
44 | union { | 49 | union { |
@@ -79,7 +84,7 @@ struct kparam_array | |||
79 | parameters. perm sets the visibility in sysfs: 000 means it's | 84 | parameters. perm sets the visibility in sysfs: 000 means it's |
80 | not there, read bits mean it's readable, write bits mean it's | 85 | not there, read bits mean it's readable, write bits mean it's |
81 | writable. */ | 86 | writable. */ |
82 | #define __module_param_call(prefix, name, set, get, arg, perm) \ | 87 | #define __module_param_call(prefix, name, set, get, arg, isbool, perm) \ |
83 | /* Default value instead of permissions? */ \ | 88 | /* Default value instead of permissions? */ \ |
84 | static int __param_perm_check_##name __attribute__((unused)) = \ | 89 | static int __param_perm_check_##name __attribute__((unused)) = \ |
85 | BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ | 90 | BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ |
@@ -88,10 +93,13 @@ struct kparam_array | |||
88 | static struct kernel_param __moduleparam_const __param_##name \ | 93 | static struct kernel_param __moduleparam_const __param_##name \ |
89 | __used \ | 94 | __used \ |
90 | __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ | 95 | __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ |
91 | = { __param_str_##name, perm, set, get, { arg } } | 96 | = { __param_str_##name, perm, isbool ? KPARAM_ISBOOL : 0, \ |
97 | set, get, { arg } } | ||
92 | 98 | ||
93 | #define module_param_call(name, set, get, arg, perm) \ | 99 | #define module_param_call(name, set, get, arg, perm) \ |
94 | __module_param_call(MODULE_PARAM_PREFIX, name, set, get, arg, perm) | 100 | __module_param_call(MODULE_PARAM_PREFIX, \ |
101 | name, set, get, arg, \ | ||
102 | __same_type(*(arg), bool), perm) | ||
95 | 103 | ||
96 | /* Helper functions: type is byte, short, ushort, int, uint, long, | 104 | /* Helper functions: type is byte, short, ushort, int, uint, long, |
97 | ulong, charp, bool or invbool, or XXX if you define param_get_XXX, | 105 | ulong, charp, bool or invbool, or XXX if you define param_get_XXX, |
@@ -120,15 +128,16 @@ struct kparam_array | |||
120 | #define core_param(name, var, type, perm) \ | 128 | #define core_param(name, var, type, perm) \ |
121 | param_check_##type(name, &(var)); \ | 129 | param_check_##type(name, &(var)); \ |
122 | __module_param_call("", name, param_set_##type, param_get_##type, \ | 130 | __module_param_call("", name, param_set_##type, param_get_##type, \ |
123 | &var, perm) | 131 | &var, __same_type(var, bool), perm) |
124 | #endif /* !MODULE */ | 132 | #endif /* !MODULE */ |
125 | 133 | ||
126 | /* Actually copy string: maxlen param is usually sizeof(string). */ | 134 | /* Actually copy string: maxlen param is usually sizeof(string). */ |
127 | #define module_param_string(name, string, len, perm) \ | 135 | #define module_param_string(name, string, len, perm) \ |
128 | static const struct kparam_string __param_string_##name \ | 136 | static const struct kparam_string __param_string_##name \ |
129 | = { len, string }; \ | 137 | = { len, string }; \ |
130 | module_param_call(name, param_set_copystring, param_get_string, \ | 138 | __module_param_call(MODULE_PARAM_PREFIX, name, \ |
131 | .str = &__param_string_##name, perm); \ | 139 | param_set_copystring, param_get_string, \ |
140 | .str = &__param_string_##name, 0, perm); \ | ||
132 | __MODULE_PARM_TYPE(name, "string") | 141 | __MODULE_PARM_TYPE(name, "string") |
133 | 142 | ||
134 | /* Called on module insert or kernel boot */ | 143 | /* Called on module insert or kernel boot */ |
@@ -186,21 +195,30 @@ extern int param_set_charp(const char *val, struct kernel_param *kp); | |||
186 | extern int param_get_charp(char *buffer, struct kernel_param *kp); | 195 | extern int param_get_charp(char *buffer, struct kernel_param *kp); |
187 | #define param_check_charp(name, p) __param_check(name, p, char *) | 196 | #define param_check_charp(name, p) __param_check(name, p, char *) |
188 | 197 | ||
198 | /* For historical reasons "bool" parameters can be (unsigned) "int". */ | ||
189 | extern int param_set_bool(const char *val, struct kernel_param *kp); | 199 | extern int param_set_bool(const char *val, struct kernel_param *kp); |
190 | extern int param_get_bool(char *buffer, struct kernel_param *kp); | 200 | extern int param_get_bool(char *buffer, struct kernel_param *kp); |
191 | #define param_check_bool(name, p) __param_check(name, p, int) | 201 | #define param_check_bool(name, p) \ |
202 | static inline void __check_##name(void) \ | ||
203 | { \ | ||
204 | BUILD_BUG_ON(!__same_type(*(p), bool) && \ | ||
205 | !__same_type(*(p), unsigned int) && \ | ||
206 | !__same_type(*(p), int)); \ | ||
207 | } | ||
192 | 208 | ||
193 | extern int param_set_invbool(const char *val, struct kernel_param *kp); | 209 | extern int param_set_invbool(const char *val, struct kernel_param *kp); |
194 | extern int param_get_invbool(char *buffer, struct kernel_param *kp); | 210 | extern int param_get_invbool(char *buffer, struct kernel_param *kp); |
195 | #define param_check_invbool(name, p) __param_check(name, p, int) | 211 | #define param_check_invbool(name, p) __param_check(name, p, bool) |
196 | 212 | ||
197 | /* Comma-separated array: *nump is set to number they actually specified. */ | 213 | /* Comma-separated array: *nump is set to number they actually specified. */ |
198 | #define module_param_array_named(name, array, type, nump, perm) \ | 214 | #define module_param_array_named(name, array, type, nump, perm) \ |
199 | static const struct kparam_array __param_arr_##name \ | 215 | static const struct kparam_array __param_arr_##name \ |
200 | = { ARRAY_SIZE(array), nump, param_set_##type, param_get_##type,\ | 216 | = { ARRAY_SIZE(array), nump, param_set_##type, param_get_##type,\ |
201 | sizeof(array[0]), array }; \ | 217 | sizeof(array[0]), array }; \ |
202 | module_param_call(name, param_array_set, param_array_get, \ | 218 | __module_param_call(MODULE_PARAM_PREFIX, name, \ |
203 | .arr = &__param_arr_##name, perm); \ | 219 | param_array_set, param_array_get, \ |
220 | .arr = &__param_arr_##name, \ | ||
221 | __same_type(array[0], bool), perm); \ | ||
204 | __MODULE_PARM_TYPE(name, "array of " #type) | 222 | __MODULE_PARM_TYPE(name, "array of " #type) |
205 | 223 | ||
206 | #define module_param_array(name, type, nump, perm) \ | 224 | #define module_param_array(name, type, nump, perm) \ |
diff --git a/include/linux/virtio.h b/include/linux/virtio.h index 06005fa9e982..4fca4f5440ba 100644 --- a/include/linux/virtio.h +++ b/include/linux/virtio.h | |||
@@ -10,14 +10,17 @@ | |||
10 | 10 | ||
11 | /** | 11 | /** |
12 | * virtqueue - a queue to register buffers for sending or receiving. | 12 | * virtqueue - a queue to register buffers for sending or receiving. |
13 | * @list: the chain of virtqueues for this device | ||
13 | * @callback: the function to call when buffers are consumed (can be NULL). | 14 | * @callback: the function to call when buffers are consumed (can be NULL). |
15 | * @name: the name of this virtqueue (mainly for debugging) | ||
14 | * @vdev: the virtio device this queue was created for. | 16 | * @vdev: the virtio device this queue was created for. |
15 | * @vq_ops: the operations for this virtqueue (see below). | 17 | * @vq_ops: the operations for this virtqueue (see below). |
16 | * @priv: a pointer for the virtqueue implementation to use. | 18 | * @priv: a pointer for the virtqueue implementation to use. |
17 | */ | 19 | */ |
18 | struct virtqueue | 20 | struct virtqueue { |
19 | { | 21 | struct list_head list; |
20 | void (*callback)(struct virtqueue *vq); | 22 | void (*callback)(struct virtqueue *vq); |
23 | const char *name; | ||
21 | struct virtio_device *vdev; | 24 | struct virtio_device *vdev; |
22 | struct virtqueue_ops *vq_ops; | 25 | struct virtqueue_ops *vq_ops; |
23 | void *priv; | 26 | void *priv; |
@@ -76,15 +79,16 @@ struct virtqueue_ops { | |||
76 | * @dev: underlying device. | 79 | * @dev: underlying device. |
77 | * @id: the device type identification (used to match it with a driver). | 80 | * @id: the device type identification (used to match it with a driver). |
78 | * @config: the configuration ops for this device. | 81 | * @config: the configuration ops for this device. |
82 | * @vqs: the list of virtqueues for this device. | ||
79 | * @features: the features supported by both driver and device. | 83 | * @features: the features supported by both driver and device. |
80 | * @priv: private pointer for the driver's use. | 84 | * @priv: private pointer for the driver's use. |
81 | */ | 85 | */ |
82 | struct virtio_device | 86 | struct virtio_device { |
83 | { | ||
84 | int index; | 87 | int index; |
85 | struct device dev; | 88 | struct device dev; |
86 | struct virtio_device_id id; | 89 | struct virtio_device_id id; |
87 | struct virtio_config_ops *config; | 90 | struct virtio_config_ops *config; |
91 | struct list_head vqs; | ||
88 | /* Note that this is a Linux set_bit-style bitmap. */ | 92 | /* Note that this is a Linux set_bit-style bitmap. */ |
89 | unsigned long features[1]; | 93 | unsigned long features[1]; |
90 | void *priv; | 94 | void *priv; |
@@ -99,8 +103,7 @@ void unregister_virtio_device(struct virtio_device *dev); | |||
99 | * @id_table: the ids serviced by this driver. | 103 | * @id_table: the ids serviced by this driver. |
100 | * @feature_table: an array of feature numbers supported by this device. | 104 | * @feature_table: an array of feature numbers supported by this device. |
101 | * @feature_table_size: number of entries in the feature table array. | 105 | * @feature_table_size: number of entries in the feature table array. |
102 | * @probe: the function to call when a device is found. Returns a token for | 106 | * @probe: the function to call when a device is found. Returns 0 or -errno. |
103 | * remove, or PTR_ERR(). | ||
104 | * @remove: the function when a device is removed. | 107 | * @remove: the function when a device is removed. |
105 | * @config_changed: optional function to call when the device configuration | 108 | * @config_changed: optional function to call when the device configuration |
106 | * changes; may be called in interrupt context. | 109 | * changes; may be called in interrupt context. |
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h index bf8ec283b232..99f514575f6a 100644 --- a/include/linux/virtio_config.h +++ b/include/linux/virtio_config.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #define VIRTIO_F_NOTIFY_ON_EMPTY 24 | 29 | #define VIRTIO_F_NOTIFY_ON_EMPTY 24 |
30 | 30 | ||
31 | #ifdef __KERNEL__ | 31 | #ifdef __KERNEL__ |
32 | #include <linux/err.h> | ||
32 | #include <linux/virtio.h> | 33 | #include <linux/virtio.h> |
33 | 34 | ||
34 | /** | 35 | /** |
@@ -49,15 +50,26 @@ | |||
49 | * @set_status: write the status byte | 50 | * @set_status: write the status byte |
50 | * vdev: the virtio_device | 51 | * vdev: the virtio_device |
51 | * status: the new status byte | 52 | * status: the new status byte |
53 | * @request_vqs: request the specified number of virtqueues | ||
54 | * vdev: the virtio_device | ||
55 | * max_vqs: the max number of virtqueues we want | ||
56 | * If supplied, must call before any virtqueues are instantiated. | ||
57 | * To modify the max number of virtqueues after request_vqs has been | ||
58 | * called, call free_vqs and then request_vqs with a new value. | ||
59 | * @free_vqs: cleanup resources allocated by request_vqs | ||
60 | * vdev: the virtio_device | ||
61 | * If supplied, must call after all virtqueues have been deleted. | ||
52 | * @reset: reset the device | 62 | * @reset: reset the device |
53 | * vdev: the virtio device | 63 | * vdev: the virtio device |
54 | * After this, status and feature negotiation must be done again | 64 | * After this, status and feature negotiation must be done again |
55 | * @find_vq: find a virtqueue and instantiate it. | 65 | * @find_vqs: find virtqueues and instantiate them. |
56 | * vdev: the virtio_device | 66 | * vdev: the virtio_device |
57 | * index: the 0-based virtqueue number in case there's more than one. | 67 | * nvqs: the number of virtqueues to find |
58 | * callback: the virqtueue callback | 68 | * vqs: on success, includes new virtqueues |
59 | * Returns the new virtqueue or ERR_PTR() (eg. -ENOENT). | 69 | * callbacks: array of callbacks, for each virtqueue |
60 | * @del_vq: free a virtqueue found by find_vq(). | 70 | * names: array of virtqueue names (mainly for debugging) |
71 | * Returns 0 on success or error status | ||
72 | * @del_vqs: free virtqueues found by find_vqs(). | ||
61 | * @get_features: get the array of feature bits for this device. | 73 | * @get_features: get the array of feature bits for this device. |
62 | * vdev: the virtio_device | 74 | * vdev: the virtio_device |
63 | * Returns the first 32 feature bits (all we currently need). | 75 | * Returns the first 32 feature bits (all we currently need). |
@@ -66,6 +78,7 @@ | |||
66 | * This gives the final feature bits for the device: it can change | 78 | * This gives the final feature bits for the device: it can change |
67 | * the dev->feature bits if it wants. | 79 | * the dev->feature bits if it wants. |
68 | */ | 80 | */ |
81 | typedef void vq_callback_t(struct virtqueue *); | ||
69 | struct virtio_config_ops | 82 | struct virtio_config_ops |
70 | { | 83 | { |
71 | void (*get)(struct virtio_device *vdev, unsigned offset, | 84 | void (*get)(struct virtio_device *vdev, unsigned offset, |
@@ -75,10 +88,11 @@ struct virtio_config_ops | |||
75 | u8 (*get_status)(struct virtio_device *vdev); | 88 | u8 (*get_status)(struct virtio_device *vdev); |
76 | void (*set_status)(struct virtio_device *vdev, u8 status); | 89 | void (*set_status)(struct virtio_device *vdev, u8 status); |
77 | void (*reset)(struct virtio_device *vdev); | 90 | void (*reset)(struct virtio_device *vdev); |
78 | struct virtqueue *(*find_vq)(struct virtio_device *vdev, | 91 | int (*find_vqs)(struct virtio_device *, unsigned nvqs, |
79 | unsigned index, | 92 | struct virtqueue *vqs[], |
80 | void (*callback)(struct virtqueue *)); | 93 | vq_callback_t *callbacks[], |
81 | void (*del_vq)(struct virtqueue *vq); | 94 | const char *names[]); |
95 | void (*del_vqs)(struct virtio_device *); | ||
82 | u32 (*get_features)(struct virtio_device *vdev); | 96 | u32 (*get_features)(struct virtio_device *vdev); |
83 | void (*finalize_features)(struct virtio_device *vdev); | 97 | void (*finalize_features)(struct virtio_device *vdev); |
84 | }; | 98 | }; |
@@ -99,7 +113,9 @@ static inline bool virtio_has_feature(const struct virtio_device *vdev, | |||
99 | if (__builtin_constant_p(fbit)) | 113 | if (__builtin_constant_p(fbit)) |
100 | BUILD_BUG_ON(fbit >= 32); | 114 | BUILD_BUG_ON(fbit >= 32); |
101 | 115 | ||
102 | virtio_check_driver_offered_feature(vdev, fbit); | 116 | if (fbit < VIRTIO_TRANSPORT_F_START) |
117 | virtio_check_driver_offered_feature(vdev, fbit); | ||
118 | |||
103 | return test_bit(fbit, vdev->features); | 119 | return test_bit(fbit, vdev->features); |
104 | } | 120 | } |
105 | 121 | ||
@@ -126,5 +142,18 @@ static inline int virtio_config_buf(struct virtio_device *vdev, | |||
126 | vdev->config->get(vdev, offset, buf, len); | 142 | vdev->config->get(vdev, offset, buf, len); |
127 | return 0; | 143 | return 0; |
128 | } | 144 | } |
145 | |||
146 | static inline | ||
147 | struct virtqueue *virtio_find_single_vq(struct virtio_device *vdev, | ||
148 | vq_callback_t *c, const char *n) | ||
149 | { | ||
150 | vq_callback_t *callbacks[] = { c }; | ||
151 | const char *names[] = { n }; | ||
152 | struct virtqueue *vq; | ||
153 | int err = vdev->config->find_vqs(vdev, 1, &vq, callbacks, names); | ||
154 | if (err < 0) | ||
155 | return ERR_PTR(err); | ||
156 | return vq; | ||
157 | } | ||
129 | #endif /* __KERNEL__ */ | 158 | #endif /* __KERNEL__ */ |
130 | #endif /* _LINUX_VIRTIO_CONFIG_H */ | 159 | #endif /* _LINUX_VIRTIO_CONFIG_H */ |
diff --git a/include/linux/virtio_pci.h b/include/linux/virtio_pci.h index cd0fd5d181a6..9a3d7c48c622 100644 --- a/include/linux/virtio_pci.h +++ b/include/linux/virtio_pci.h | |||
@@ -47,9 +47,17 @@ | |||
47 | /* The bit of the ISR which indicates a device configuration change. */ | 47 | /* The bit of the ISR which indicates a device configuration change. */ |
48 | #define VIRTIO_PCI_ISR_CONFIG 0x2 | 48 | #define VIRTIO_PCI_ISR_CONFIG 0x2 |
49 | 49 | ||
50 | /* MSI-X registers: only enabled if MSI-X is enabled. */ | ||
51 | /* A 16-bit vector for configuration changes. */ | ||
52 | #define VIRTIO_MSI_CONFIG_VECTOR 20 | ||
53 | /* A 16-bit vector for selected queue notifications. */ | ||
54 | #define VIRTIO_MSI_QUEUE_VECTOR 22 | ||
55 | /* Vector value used to disable MSI for queue */ | ||
56 | #define VIRTIO_MSI_NO_VECTOR 0xffff | ||
57 | |||
50 | /* The remaining space is defined by each driver as the per-driver | 58 | /* The remaining space is defined by each driver as the per-driver |
51 | * configuration space */ | 59 | * configuration space */ |
52 | #define VIRTIO_PCI_CONFIG 20 | 60 | #define VIRTIO_PCI_CONFIG(dev) ((dev)->msix_enabled ? 24 : 20) |
53 | 61 | ||
54 | /* Virtio ABI version, this must match exactly */ | 62 | /* Virtio ABI version, this must match exactly */ |
55 | #define VIRTIO_PCI_ABI_VERSION 0 | 63 | #define VIRTIO_PCI_ABI_VERSION 0 |
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h index 71e03722fb59..693e0ec5afa6 100644 --- a/include/linux/virtio_ring.h +++ b/include/linux/virtio_ring.h | |||
@@ -14,6 +14,8 @@ | |||
14 | #define VRING_DESC_F_NEXT 1 | 14 | #define VRING_DESC_F_NEXT 1 |
15 | /* This marks a buffer as write-only (otherwise read-only). */ | 15 | /* This marks a buffer as write-only (otherwise read-only). */ |
16 | #define VRING_DESC_F_WRITE 2 | 16 | #define VRING_DESC_F_WRITE 2 |
17 | /* This means the buffer contains a list of buffer descriptors. */ | ||
18 | #define VRING_DESC_F_INDIRECT 4 | ||
17 | 19 | ||
18 | /* The Host uses this in used->flags to advise the Guest: don't kick me when | 20 | /* The Host uses this in used->flags to advise the Guest: don't kick me when |
19 | * you add a buffer. It's unreliable, so it's simply an optimization. Guest | 21 | * you add a buffer. It's unreliable, so it's simply an optimization. Guest |
@@ -24,6 +26,9 @@ | |||
24 | * optimization. */ | 26 | * optimization. */ |
25 | #define VRING_AVAIL_F_NO_INTERRUPT 1 | 27 | #define VRING_AVAIL_F_NO_INTERRUPT 1 |
26 | 28 | ||
29 | /* We support indirect buffer descriptors */ | ||
30 | #define VIRTIO_RING_F_INDIRECT_DESC 28 | ||
31 | |||
27 | /* Virtio ring descriptors: 16 bytes. These can chain together via "next". */ | 32 | /* Virtio ring descriptors: 16 bytes. These can chain together via "next". */ |
28 | struct vring_desc | 33 | struct vring_desc |
29 | { | 34 | { |
@@ -119,7 +124,8 @@ struct virtqueue *vring_new_virtqueue(unsigned int num, | |||
119 | struct virtio_device *vdev, | 124 | struct virtio_device *vdev, |
120 | void *pages, | 125 | void *pages, |
121 | void (*notify)(struct virtqueue *vq), | 126 | void (*notify)(struct virtqueue *vq), |
122 | void (*callback)(struct virtqueue *vq)); | 127 | void (*callback)(struct virtqueue *vq), |
128 | const char *name); | ||
123 | void vring_del_virtqueue(struct virtqueue *vq); | 129 | void vring_del_virtqueue(struct virtqueue *vq); |
124 | /* Filter out transport-specific feature bits. */ | 130 | /* Filter out transport-specific feature bits. */ |
125 | void vring_transport_features(struct virtio_device *vdev); | 131 | void vring_transport_features(struct virtio_device *vdev); |