aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/lguest/lguest.c62
-rw-r--r--arch/ia64/ia32/ia32_signal.c2
-rw-r--r--arch/ia64/kernel/acpi.c2
-rw-r--r--arch/ia64/kernel/irq.c4
-rw-r--r--arch/ia64/kernel/palinfo.c2
-rw-r--r--arch/ia64/kernel/perfmon.c199
-rw-r--r--arch/ia64/kernel/signal.c15
-rw-r--r--arch/ia64/kernel/smp.c68
-rw-r--r--arch/ia64/kernel/time.c5
-rw-r--r--arch/ia64/kernel/topology.c16
-rw-r--r--arch/m32r/Makefile2
-rw-r--r--arch/m32r/defconfig863
-rw-r--r--arch/m32r/kernel/vmlinux.lds.S3
-rw-r--r--drivers/block/virtio_blk.c44
-rw-r--r--drivers/lguest/lguest_device.c68
-rw-r--r--drivers/lguest/lguest_user.c4
-rw-r--r--drivers/net/virtio_net.c96
-rw-r--r--drivers/virtio/virtio.c38
-rw-r--r--drivers/virtio/virtio_balloon.c12
-rw-r--r--drivers/virtio/virtio_pci.c34
-rw-r--r--drivers/virtio/virtio_ring.c5
-rw-r--r--include/asm-ia64/cpu.h2
-rw-r--r--include/asm-ia64/thread_info.h13
-rw-r--r--include/linux/Kbuild5
-rw-r--r--include/linux/device.h8
-rw-r--r--include/linux/irq.h1
-rw-r--r--include/linux/virtio.h7
-rw-r--r--include/linux/virtio_blk.h14
-rw-r--r--include/linux/virtio_config.h81
-rw-r--r--include/linux/virtio_net.h13
-rw-r--r--kernel/irq/manage.c49
-rw-r--r--kernel/irq/spurious.c4
32 files changed, 525 insertions, 1216 deletions
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 4c1fc65a8b3d..3be8ab2a886a 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -131,6 +131,9 @@ struct device
131 /* Any queues attached to this device */ 131 /* Any queues attached to this device */
132 struct virtqueue *vq; 132 struct virtqueue *vq;
133 133
134 /* Handle status being finalized (ie. feature bits stable). */
135 void (*ready)(struct device *me);
136
134 /* Device-specific data. */ 137 /* Device-specific data. */
135 void *priv; 138 void *priv;
136}; 139};
@@ -925,24 +928,40 @@ static void enable_fd(int fd, struct virtqueue *vq)
925 write(waker_fd, &vq->dev->fd, sizeof(vq->dev->fd)); 928 write(waker_fd, &vq->dev->fd, sizeof(vq->dev->fd));
926} 929}
927 930
928/* When the Guest asks us to reset a device, it's is fairly easy. */ 931/* When the Guest tells us they updated the status field, we handle it. */
929static void reset_device(struct device *dev) 932static void update_device_status(struct device *dev)
930{ 933{
931 struct virtqueue *vq; 934 struct virtqueue *vq;
932 935
933 verbose("Resetting device %s\n", dev->name); 936 /* This is a reset. */
934 /* Clear the status. */ 937 if (dev->desc->status == 0) {
935 dev->desc->status = 0; 938 verbose("Resetting device %s\n", dev->name);
936 939
937 /* Clear any features they've acked. */ 940 /* Clear any features they've acked. */
938 memset(get_feature_bits(dev) + dev->desc->feature_len, 0, 941 memset(get_feature_bits(dev) + dev->desc->feature_len, 0,
939 dev->desc->feature_len); 942 dev->desc->feature_len);
940 943
941 /* Zero out the virtqueues. */ 944 /* Zero out the virtqueues. */
942 for (vq = dev->vq; vq; vq = vq->next) { 945 for (vq = dev->vq; vq; vq = vq->next) {
943 memset(vq->vring.desc, 0, 946 memset(vq->vring.desc, 0,
944 vring_size(vq->config.num, getpagesize())); 947 vring_size(vq->config.num, getpagesize()));
945 vq->last_avail_idx = 0; 948 vq->last_avail_idx = 0;
949 }
950 } else if (dev->desc->status & VIRTIO_CONFIG_S_FAILED) {
951 warnx("Device %s configuration FAILED", dev->name);
952 } else if (dev->desc->status & VIRTIO_CONFIG_S_DRIVER_OK) {
953 unsigned int i;
954
955 verbose("Device %s OK: offered", dev->name);
956 for (i = 0; i < dev->desc->feature_len; i++)
957 verbose(" %08x", get_feature_bits(dev)[i]);
958 verbose(", accepted");
959 for (i = 0; i < dev->desc->feature_len; i++)
960 verbose(" %08x", get_feature_bits(dev)
961 [dev->desc->feature_len+i]);
962
963 if (dev->ready)
964 dev->ready(dev);
946 } 965 }
947} 966}
948 967
@@ -954,9 +973,9 @@ static void handle_output(int fd, unsigned long addr)
954 973
955 /* Check each device and virtqueue. */ 974 /* Check each device and virtqueue. */
956 for (i = devices.dev; i; i = i->next) { 975 for (i = devices.dev; i; i = i->next) {
957 /* Notifications to device descriptors reset the device. */ 976 /* Notifications to device descriptors update device status. */
958 if (from_guest_phys(addr) == i->desc) { 977 if (from_guest_phys(addr) == i->desc) {
959 reset_device(i); 978 update_device_status(i);
960 return; 979 return;
961 } 980 }
962 981
@@ -1170,6 +1189,7 @@ static struct device *new_device(const char *name, u16 type, int fd,
1170 dev->handle_input = handle_input; 1189 dev->handle_input = handle_input;
1171 dev->name = name; 1190 dev->name = name;
1172 dev->vq = NULL; 1191 dev->vq = NULL;
1192 dev->ready = NULL;
1173 1193
1174 /* Append to device list. Prepending to a single-linked list is 1194 /* Append to device list. Prepending to a single-linked list is
1175 * easier, but the user expects the devices to be arranged on the bus 1195 * easier, but the user expects the devices to be arranged on the bus
@@ -1398,7 +1418,7 @@ static bool service_io(struct device *dev)
1398 struct vblk_info *vblk = dev->priv; 1418 struct vblk_info *vblk = dev->priv;
1399 unsigned int head, out_num, in_num, wlen; 1419 unsigned int head, out_num, in_num, wlen;
1400 int ret; 1420 int ret;
1401 struct virtio_blk_inhdr *in; 1421 u8 *in;
1402 struct virtio_blk_outhdr *out; 1422 struct virtio_blk_outhdr *out;
1403 struct iovec iov[dev->vq->vring.num]; 1423 struct iovec iov[dev->vq->vring.num];
1404 off64_t off; 1424 off64_t off;
@@ -1416,7 +1436,7 @@ static bool service_io(struct device *dev)
1416 head, out_num, in_num); 1436 head, out_num, in_num);
1417 1437
1418 out = convert(&iov[0], struct virtio_blk_outhdr); 1438 out = convert(&iov[0], struct virtio_blk_outhdr);
1419 in = convert(&iov[out_num+in_num-1], struct virtio_blk_inhdr); 1439 in = convert(&iov[out_num+in_num-1], u8);
1420 off = out->sector * 512; 1440 off = out->sector * 512;
1421 1441
1422 /* The block device implements "barriers", where the Guest indicates 1442 /* The block device implements "barriers", where the Guest indicates
@@ -1430,7 +1450,7 @@ static bool service_io(struct device *dev)
1430 * It'd be nice if we supported eject, for example, but we don't. */ 1450 * It'd be nice if we supported eject, for example, but we don't. */
1431 if (out->type & VIRTIO_BLK_T_SCSI_CMD) { 1451 if (out->type & VIRTIO_BLK_T_SCSI_CMD) {
1432 fprintf(stderr, "Scsi commands unsupported\n"); 1452 fprintf(stderr, "Scsi commands unsupported\n");
1433 in->status = VIRTIO_BLK_S_UNSUPP; 1453 *in = VIRTIO_BLK_S_UNSUPP;
1434 wlen = sizeof(*in); 1454 wlen = sizeof(*in);
1435 } else if (out->type & VIRTIO_BLK_T_OUT) { 1455 } else if (out->type & VIRTIO_BLK_T_OUT) {
1436 /* Write */ 1456 /* Write */
@@ -1453,7 +1473,7 @@ static bool service_io(struct device *dev)
1453 errx(1, "Write past end %llu+%u", off, ret); 1473 errx(1, "Write past end %llu+%u", off, ret);
1454 } 1474 }
1455 wlen = sizeof(*in); 1475 wlen = sizeof(*in);
1456 in->status = (ret >= 0 ? VIRTIO_BLK_S_OK : VIRTIO_BLK_S_IOERR); 1476 *in = (ret >= 0 ? VIRTIO_BLK_S_OK : VIRTIO_BLK_S_IOERR);
1457 } else { 1477 } else {
1458 /* Read */ 1478 /* Read */
1459 1479
@@ -1466,10 +1486,10 @@ static bool service_io(struct device *dev)
1466 verbose("READ from sector %llu: %i\n", out->sector, ret); 1486 verbose("READ from sector %llu: %i\n", out->sector, ret);
1467 if (ret >= 0) { 1487 if (ret >= 0) {
1468 wlen = sizeof(*in) + ret; 1488 wlen = sizeof(*in) + ret;
1469 in->status = VIRTIO_BLK_S_OK; 1489 *in = VIRTIO_BLK_S_OK;
1470 } else { 1490 } else {
1471 wlen = sizeof(*in); 1491 wlen = sizeof(*in);
1472 in->status = VIRTIO_BLK_S_IOERR; 1492 *in = VIRTIO_BLK_S_IOERR;
1473 } 1493 }
1474 } 1494 }
1475 1495
diff --git a/arch/ia64/ia32/ia32_signal.c b/arch/ia64/ia32/ia32_signal.c
index 256a7faeda07..b763ca19ef17 100644
--- a/arch/ia64/ia32/ia32_signal.c
+++ b/arch/ia64/ia32/ia32_signal.c
@@ -463,7 +463,7 @@ sys32_sigsuspend (int history0, int history1, old_sigset_t mask)
463 463
464 current->state = TASK_INTERRUPTIBLE; 464 current->state = TASK_INTERRUPTIBLE;
465 schedule(); 465 schedule();
466 set_thread_flag(TIF_RESTORE_SIGMASK); 466 set_restore_sigmask();
467 return -ERESTARTNOHAND; 467 return -ERESTARTNOHAND;
468} 468}
469 469
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index c7467f863c7a..19709a079635 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -966,7 +966,7 @@ acpi_map_iosapics (void)
966fs_initcall(acpi_map_iosapics); 966fs_initcall(acpi_map_iosapics);
967#endif /* CONFIG_ACPI_NUMA */ 967#endif /* CONFIG_ACPI_NUMA */
968 968
969int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base) 969int __ref acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
970{ 970{
971 int err; 971 int err;
972 972
diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c
index 6dee579f205f..7fd18f54c056 100644
--- a/arch/ia64/kernel/irq.c
+++ b/arch/ia64/kernel/irq.c
@@ -183,10 +183,10 @@ void fixup_irqs(void)
183{ 183{
184 unsigned int irq; 184 unsigned int irq;
185 extern void ia64_process_pending_intr(void); 185 extern void ia64_process_pending_intr(void);
186 extern void ia64_disable_timer(void);
187 extern volatile int time_keeper_id; 186 extern volatile int time_keeper_id;
188 187
189 ia64_disable_timer(); 188 /* Mask ITV to disable timer */
189 ia64_set_itv(1 << 16);
190 190
191 /* 191 /*
192 * Find a new timesync master 192 * Find a new timesync master
diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c
index 396004e8cd14..4547a2092af9 100644
--- a/arch/ia64/kernel/palinfo.c
+++ b/arch/ia64/kernel/palinfo.c
@@ -1053,7 +1053,7 @@ static int __cpuinit palinfo_cpu_callback(struct notifier_block *nfb,
1053 return NOTIFY_OK; 1053 return NOTIFY_OK;
1054} 1054}
1055 1055
1056static struct notifier_block palinfo_cpu_notifier __cpuinitdata = 1056static struct notifier_block __refdata palinfo_cpu_notifier =
1057{ 1057{
1058 .notifier_call = palinfo_cpu_callback, 1058 .notifier_call = palinfo_cpu_callback,
1059 .priority = 0, 1059 .priority = 0,
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 7fbb51e10bbe..c1ad27de2dd2 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -867,7 +867,7 @@ pfm_rvfree(void *mem, unsigned long size)
867} 867}
868 868
869static pfm_context_t * 869static pfm_context_t *
870pfm_context_alloc(void) 870pfm_context_alloc(int ctx_flags)
871{ 871{
872 pfm_context_t *ctx; 872 pfm_context_t *ctx;
873 873
@@ -878,6 +878,46 @@ pfm_context_alloc(void)
878 ctx = kzalloc(sizeof(pfm_context_t), GFP_KERNEL); 878 ctx = kzalloc(sizeof(pfm_context_t), GFP_KERNEL);
879 if (ctx) { 879 if (ctx) {
880 DPRINT(("alloc ctx @%p\n", ctx)); 880 DPRINT(("alloc ctx @%p\n", ctx));
881
882 /*
883 * init context protection lock
884 */
885 spin_lock_init(&ctx->ctx_lock);
886
887 /*
888 * context is unloaded
889 */
890 ctx->ctx_state = PFM_CTX_UNLOADED;
891
892 /*
893 * initialization of context's flags
894 */
895 ctx->ctx_fl_block = (ctx_flags & PFM_FL_NOTIFY_BLOCK) ? 1 : 0;
896 ctx->ctx_fl_system = (ctx_flags & PFM_FL_SYSTEM_WIDE) ? 1: 0;
897 ctx->ctx_fl_no_msg = (ctx_flags & PFM_FL_OVFL_NO_MSG) ? 1: 0;
898 /*
899 * will move to set properties
900 * ctx->ctx_fl_excl_idle = (ctx_flags & PFM_FL_EXCL_IDLE) ? 1: 0;
901 */
902
903 /*
904 * init restart semaphore to locked
905 */
906 init_completion(&ctx->ctx_restart_done);
907
908 /*
909 * activation is used in SMP only
910 */
911 ctx->ctx_last_activation = PFM_INVALID_ACTIVATION;
912 SET_LAST_CPU(ctx, -1);
913
914 /*
915 * initialize notification message queue
916 */
917 ctx->ctx_msgq_head = ctx->ctx_msgq_tail = 0;
918 init_waitqueue_head(&ctx->ctx_msgq_wait);
919 init_waitqueue_head(&ctx->ctx_zombieq);
920
881 } 921 }
882 return ctx; 922 return ctx;
883} 923}
@@ -2165,28 +2205,21 @@ static struct dentry_operations pfmfs_dentry_operations = {
2165}; 2205};
2166 2206
2167 2207
2168static int 2208static struct file *
2169pfm_alloc_fd(struct file **cfile) 2209pfm_alloc_file(pfm_context_t *ctx)
2170{ 2210{
2171 int fd, ret = 0; 2211 struct file *file;
2172 struct file *file = NULL; 2212 struct inode *inode;
2173 struct inode * inode; 2213 struct dentry *dentry;
2174 char name[32]; 2214 char name[32];
2175 struct qstr this; 2215 struct qstr this;
2176 2216
2177 fd = get_unused_fd();
2178 if (fd < 0) return -ENFILE;
2179
2180 ret = -ENFILE;
2181
2182 file = get_empty_filp();
2183 if (!file) goto out;
2184
2185 /* 2217 /*
2186 * allocate a new inode 2218 * allocate a new inode
2187 */ 2219 */
2188 inode = new_inode(pfmfs_mnt->mnt_sb); 2220 inode = new_inode(pfmfs_mnt->mnt_sb);
2189 if (!inode) goto out; 2221 if (!inode)
2222 return ERR_PTR(-ENOMEM);
2190 2223
2191 DPRINT(("new inode ino=%ld @%p\n", inode->i_ino, inode)); 2224 DPRINT(("new inode ino=%ld @%p\n", inode->i_ino, inode));
2192 2225
@@ -2199,59 +2232,28 @@ pfm_alloc_fd(struct file **cfile)
2199 this.len = strlen(name); 2232 this.len = strlen(name);
2200 this.hash = inode->i_ino; 2233 this.hash = inode->i_ino;
2201 2234
2202 ret = -ENOMEM;
2203
2204 /* 2235 /*
2205 * allocate a new dcache entry 2236 * allocate a new dcache entry
2206 */ 2237 */
2207 file->f_path.dentry = d_alloc(pfmfs_mnt->mnt_sb->s_root, &this); 2238 dentry = d_alloc(pfmfs_mnt->mnt_sb->s_root, &this);
2208 if (!file->f_path.dentry) goto out; 2239 if (!dentry) {
2240 iput(inode);
2241 return ERR_PTR(-ENOMEM);
2242 }
2209 2243
2210 file->f_path.dentry->d_op = &pfmfs_dentry_operations; 2244 dentry->d_op = &pfmfs_dentry_operations;
2245 d_add(dentry, inode);
2211 2246
2212 d_add(file->f_path.dentry, inode); 2247 file = alloc_file(pfmfs_mnt, dentry, FMODE_READ, &pfm_file_ops);
2213 file->f_path.mnt = mntget(pfmfs_mnt); 2248 if (!file) {
2214 file->f_mapping = inode->i_mapping; 2249 dput(dentry);
2250 return ERR_PTR(-ENFILE);
2251 }
2215 2252
2216 file->f_op = &pfm_file_ops;
2217 file->f_mode = FMODE_READ;
2218 file->f_flags = O_RDONLY; 2253 file->f_flags = O_RDONLY;
2219 file->f_pos = 0; 2254 file->private_data = ctx;
2220
2221 /*
2222 * may have to delay until context is attached?
2223 */
2224 fd_install(fd, file);
2225
2226 /*
2227 * the file structure we will use
2228 */
2229 *cfile = file;
2230
2231 return fd;
2232out:
2233 if (file) put_filp(file);
2234 put_unused_fd(fd);
2235 return ret;
2236}
2237
2238static void
2239pfm_free_fd(int fd, struct file *file)
2240{
2241 struct files_struct *files = current->files;
2242 struct fdtable *fdt;
2243 2255
2244 /* 2256 return file;
2245 * there ie no fd_uninstall(), so we do it here
2246 */
2247 spin_lock(&files->file_lock);
2248 fdt = files_fdtable(files);
2249 rcu_assign_pointer(fdt->fd[fd], NULL);
2250 spin_unlock(&files->file_lock);
2251
2252 if (file)
2253 put_filp(file);
2254 put_unused_fd(fd);
2255} 2257}
2256 2258
2257static int 2259static int
@@ -2475,6 +2477,7 @@ pfm_setup_buffer_fmt(struct task_struct *task, struct file *filp, pfm_context_t
2475 2477
2476 /* link buffer format and context */ 2478 /* link buffer format and context */
2477 ctx->ctx_buf_fmt = fmt; 2479 ctx->ctx_buf_fmt = fmt;
2480 ctx->ctx_fl_is_sampling = 1; /* assume record() is defined */
2478 2481
2479 /* 2482 /*
2480 * check if buffer format wants to use perfmon buffer allocation/mapping service 2483 * check if buffer format wants to use perfmon buffer allocation/mapping service
@@ -2669,78 +2672,45 @@ pfm_context_create(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg
2669{ 2672{
2670 pfarg_context_t *req = (pfarg_context_t *)arg; 2673 pfarg_context_t *req = (pfarg_context_t *)arg;
2671 struct file *filp; 2674 struct file *filp;
2675 struct path path;
2672 int ctx_flags; 2676 int ctx_flags;
2677 int fd;
2673 int ret; 2678 int ret;
2674 2679
2675 /* let's check the arguments first */ 2680 /* let's check the arguments first */
2676 ret = pfarg_is_sane(current, req); 2681 ret = pfarg_is_sane(current, req);
2677 if (ret < 0) return ret; 2682 if (ret < 0)
2683 return ret;
2678 2684
2679 ctx_flags = req->ctx_flags; 2685 ctx_flags = req->ctx_flags;
2680 2686
2681 ret = -ENOMEM; 2687 ret = -ENOMEM;
2682 2688
2683 ctx = pfm_context_alloc(); 2689 fd = get_unused_fd();
2684 if (!ctx) goto error; 2690 if (fd < 0)
2691 return fd;
2685 2692
2686 ret = pfm_alloc_fd(&filp); 2693 ctx = pfm_context_alloc(ctx_flags);
2687 if (ret < 0) goto error_file; 2694 if (!ctx)
2695 goto error;
2688 2696
2689 req->ctx_fd = ctx->ctx_fd = ret; 2697 filp = pfm_alloc_file(ctx);
2698 if (IS_ERR(filp)) {
2699 ret = PTR_ERR(filp);
2700 goto error_file;
2701 }
2690 2702
2691 /* 2703 req->ctx_fd = ctx->ctx_fd = fd;
2692 * attach context to file
2693 */
2694 filp->private_data = ctx;
2695 2704
2696 /* 2705 /*
2697 * does the user want to sample? 2706 * does the user want to sample?
2698 */ 2707 */
2699 if (pfm_uuid_cmp(req->ctx_smpl_buf_id, pfm_null_uuid)) { 2708 if (pfm_uuid_cmp(req->ctx_smpl_buf_id, pfm_null_uuid)) {
2700 ret = pfm_setup_buffer_fmt(current, filp, ctx, ctx_flags, 0, req); 2709 ret = pfm_setup_buffer_fmt(current, filp, ctx, ctx_flags, 0, req);
2701 if (ret) goto buffer_error; 2710 if (ret)
2711 goto buffer_error;
2702 } 2712 }
2703 2713
2704 /*
2705 * init context protection lock
2706 */
2707 spin_lock_init(&ctx->ctx_lock);
2708
2709 /*
2710 * context is unloaded
2711 */
2712 ctx->ctx_state = PFM_CTX_UNLOADED;
2713
2714 /*
2715 * initialization of context's flags
2716 */
2717 ctx->ctx_fl_block = (ctx_flags & PFM_FL_NOTIFY_BLOCK) ? 1 : 0;
2718 ctx->ctx_fl_system = (ctx_flags & PFM_FL_SYSTEM_WIDE) ? 1: 0;
2719 ctx->ctx_fl_is_sampling = ctx->ctx_buf_fmt ? 1 : 0; /* assume record() is defined */
2720 ctx->ctx_fl_no_msg = (ctx_flags & PFM_FL_OVFL_NO_MSG) ? 1: 0;
2721 /*
2722 * will move to set properties
2723 * ctx->ctx_fl_excl_idle = (ctx_flags & PFM_FL_EXCL_IDLE) ? 1: 0;
2724 */
2725
2726 /*
2727 * init restart semaphore to locked
2728 */
2729 init_completion(&ctx->ctx_restart_done);
2730
2731 /*
2732 * activation is used in SMP only
2733 */
2734 ctx->ctx_last_activation = PFM_INVALID_ACTIVATION;
2735 SET_LAST_CPU(ctx, -1);
2736
2737 /*
2738 * initialize notification message queue
2739 */
2740 ctx->ctx_msgq_head = ctx->ctx_msgq_tail = 0;
2741 init_waitqueue_head(&ctx->ctx_msgq_wait);
2742 init_waitqueue_head(&ctx->ctx_zombieq);
2743
2744 DPRINT(("ctx=%p flags=0x%x system=%d notify_block=%d excl_idle=%d no_msg=%d ctx_fd=%d \n", 2714 DPRINT(("ctx=%p flags=0x%x system=%d notify_block=%d excl_idle=%d no_msg=%d ctx_fd=%d \n",
2745 ctx, 2715 ctx,
2746 ctx_flags, 2716 ctx_flags,
@@ -2755,10 +2725,14 @@ pfm_context_create(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg
2755 */ 2725 */
2756 pfm_reset_pmu_state(ctx); 2726 pfm_reset_pmu_state(ctx);
2757 2727
2728 fd_install(fd, filp);
2729
2758 return 0; 2730 return 0;
2759 2731
2760buffer_error: 2732buffer_error:
2761 pfm_free_fd(ctx->ctx_fd, filp); 2733 path = filp->f_path;
2734 put_filp(filp);
2735 path_put(&path);
2762 2736
2763 if (ctx->ctx_buf_fmt) { 2737 if (ctx->ctx_buf_fmt) {
2764 pfm_buf_fmt_exit(ctx->ctx_buf_fmt, current, NULL, regs); 2738 pfm_buf_fmt_exit(ctx->ctx_buf_fmt, current, NULL, regs);
@@ -2767,6 +2741,7 @@ error_file:
2767 pfm_context_free(ctx); 2741 pfm_context_free(ctx);
2768 2742
2769error: 2743error:
2744 put_unused_fd(fd);
2770 return ret; 2745 return ret;
2771} 2746}
2772 2747
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c
index 5740296c35af..19c5a78636fc 100644
--- a/arch/ia64/kernel/signal.c
+++ b/arch/ia64/kernel/signal.c
@@ -464,7 +464,7 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
464 if (!user_mode(&scr->pt)) 464 if (!user_mode(&scr->pt))
465 return; 465 return;
466 466
467 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 467 if (current_thread_info()->status & TS_RESTORE_SIGMASK)
468 oldset = &current->saved_sigmask; 468 oldset = &current->saved_sigmask;
469 else 469 else
470 oldset = &current->blocked; 470 oldset = &current->blocked;
@@ -530,12 +530,13 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
530 * continue to iterate in this loop so we can deliver the SIGSEGV... 530 * continue to iterate in this loop so we can deliver the SIGSEGV...
531 */ 531 */
532 if (handle_signal(signr, &ka, &info, oldset, scr)) { 532 if (handle_signal(signr, &ka, &info, oldset, scr)) {
533 /* a signal was successfully delivered; the saved 533 /*
534 * A signal was successfully delivered; the saved
534 * sigmask will have been stored in the signal frame, 535 * sigmask will have been stored in the signal frame,
535 * and will be restored by sigreturn, so we can simply 536 * and will be restored by sigreturn, so we can simply
536 * clear the TIF_RESTORE_SIGMASK flag */ 537 * clear the TS_RESTORE_SIGMASK flag.
537 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 538 */
538 clear_thread_flag(TIF_RESTORE_SIGMASK); 539 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
539 return; 540 return;
540 } 541 }
541 } 542 }
@@ -566,8 +567,8 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
566 567
567 /* if there's no signal to deliver, we just put the saved sigmask 568 /* if there's no signal to deliver, we just put the saved sigmask
568 * back */ 569 * back */
569 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 570 if (current_thread_info()->status & TS_RESTORE_SIGMASK) {
570 clear_thread_flag(TIF_RESTORE_SIGMASK); 571 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
571 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); 572 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
572 } 573 }
573} 574}
diff --git a/arch/ia64/kernel/smp.c b/arch/ia64/kernel/smp.c
index 9a9d4c489330..983296f1c813 100644
--- a/arch/ia64/kernel/smp.c
+++ b/arch/ia64/kernel/smp.c
@@ -98,8 +98,33 @@ unlock_ipi_calllock(void)
98 spin_unlock_irq(&call_lock); 98 spin_unlock_irq(&call_lock);
99} 99}
100 100
101static inline void
102handle_call_data(void)
103{
104 struct call_data_struct *data;
105 void (*func)(void *info);
106 void *info;
107 int wait;
108
109 /* release the 'pointer lock' */
110 data = (struct call_data_struct *)call_data;
111 func = data->func;
112 info = data->info;
113 wait = data->wait;
114
115 mb();
116 atomic_inc(&data->started);
117 /* At this point the structure may be gone unless wait is true. */
118 (*func)(info);
119
120 /* Notify the sending CPU that the task is done. */
121 mb();
122 if (wait)
123 atomic_inc(&data->finished);
124}
125
101static void 126static void
102stop_this_cpu (void) 127stop_this_cpu(void)
103{ 128{
104 /* 129 /*
105 * Remove this CPU: 130 * Remove this CPU:
@@ -138,44 +163,21 @@ handle_IPI (int irq, void *dev_id)
138 ops &= ~(1 << which); 163 ops &= ~(1 << which);
139 164
140 switch (which) { 165 switch (which) {
141 case IPI_CALL_FUNC: 166 case IPI_CALL_FUNC:
142 { 167 handle_call_data();
143 struct call_data_struct *data; 168 break;
144 void (*func)(void *info); 169
145 void *info; 170 case IPI_CPU_STOP:
146 int wait;
147
148 /* release the 'pointer lock' */
149 data = (struct call_data_struct *) call_data;
150 func = data->func;
151 info = data->info;
152 wait = data->wait;
153
154 mb();
155 atomic_inc(&data->started);
156 /*
157 * At this point the structure may be gone unless
158 * wait is true.
159 */
160 (*func)(info);
161
162 /* Notify the sending CPU that the task is done. */
163 mb();
164 if (wait)
165 atomic_inc(&data->finished);
166 }
167 break;
168
169 case IPI_CPU_STOP:
170 stop_this_cpu(); 171 stop_this_cpu();
171 break; 172 break;
172#ifdef CONFIG_KEXEC 173#ifdef CONFIG_KEXEC
173 case IPI_KDUMP_CPU_STOP: 174 case IPI_KDUMP_CPU_STOP:
174 unw_init_running(kdump_cpu_freeze, NULL); 175 unw_init_running(kdump_cpu_freeze, NULL);
175 break; 176 break;
176#endif 177#endif
177 default: 178 default:
178 printk(KERN_CRIT "Unknown IPI on CPU %d: %lu\n", this_cpu, which); 179 printk(KERN_CRIT "Unknown IPI on CPU %d: %lu\n",
180 this_cpu, which);
179 break; 181 break;
180 } 182 }
181 } while (ops); 183 } while (ops);
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 48e15a51782f..8c73643f2d66 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -379,11 +379,6 @@ static struct irqaction timer_irqaction = {
379 .name = "timer" 379 .name = "timer"
380}; 380};
381 381
382void __devinit ia64_disable_timer(void)
383{
384 ia64_set_itv(1 << 16);
385}
386
387void __init 382void __init
388time_init (void) 383time_init (void)
389{ 384{
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index abb17a613b17..26228e2d01ae 100644
--- a/arch/ia64/kernel/topology.c
+++ b/arch/ia64/kernel/topology.c
@@ -36,9 +36,11 @@ void arch_fix_phys_package_id(int num, u32 slot)
36} 36}
37EXPORT_SYMBOL_GPL(arch_fix_phys_package_id); 37EXPORT_SYMBOL_GPL(arch_fix_phys_package_id);
38 38
39int arch_register_cpu(int num) 39
40#ifdef CONFIG_HOTPLUG_CPU
41int __ref arch_register_cpu(int num)
40{ 42{
41#if defined (CONFIG_ACPI) && defined (CONFIG_HOTPLUG_CPU) 43#ifdef CONFIG_ACPI
42 /* 44 /*
43 * If CPEI can be re-targetted or if this is not 45 * If CPEI can be re-targetted or if this is not
44 * CPEI target, then it is hotpluggable 46 * CPEI target, then it is hotpluggable
@@ -47,19 +49,21 @@ int arch_register_cpu(int num)
47 sysfs_cpus[num].cpu.hotpluggable = 1; 49 sysfs_cpus[num].cpu.hotpluggable = 1;
48 map_cpu_to_node(num, node_cpuid[num].nid); 50 map_cpu_to_node(num, node_cpuid[num].nid);
49#endif 51#endif
50
51 return register_cpu(&sysfs_cpus[num].cpu, num); 52 return register_cpu(&sysfs_cpus[num].cpu, num);
52} 53}
53 54EXPORT_SYMBOL(arch_register_cpu);
54#ifdef CONFIG_HOTPLUG_CPU
55 55
56void arch_unregister_cpu(int num) 56void arch_unregister_cpu(int num)
57{ 57{
58 unregister_cpu(&sysfs_cpus[num].cpu); 58 unregister_cpu(&sysfs_cpus[num].cpu);
59 unmap_cpu_from_node(num, cpu_to_node(num)); 59 unmap_cpu_from_node(num, cpu_to_node(num));
60} 60}
61EXPORT_SYMBOL(arch_register_cpu);
62EXPORT_SYMBOL(arch_unregister_cpu); 61EXPORT_SYMBOL(arch_unregister_cpu);
62#else
63static int __init arch_register_cpu(int num)
64{
65 return register_cpu(&sysfs_cpus[num].cpu, num);
66}
63#endif /*CONFIG_HOTPLUG_CPU*/ 67#endif /*CONFIG_HOTPLUG_CPU*/
64 68
65 69
diff --git a/arch/m32r/Makefile b/arch/m32r/Makefile
index 4072a07ebf8e..469766b24e22 100644
--- a/arch/m32r/Makefile
+++ b/arch/m32r/Makefile
@@ -5,6 +5,8 @@
5# architecture-specific flags and dependencies. 5# architecture-specific flags and dependencies.
6# 6#
7 7
8KBUILD_DEFCONFIG := m32700ut.smp_defconfig
9
8LDFLAGS := 10LDFLAGS :=
9OBJCOPYFLAGS := -O binary -R .note -R .comment -S 11OBJCOPYFLAGS := -O binary -R .note -R .comment -S
10LDFLAGS_vmlinux := 12LDFLAGS_vmlinux :=
diff --git a/arch/m32r/defconfig b/arch/m32r/defconfig
deleted file mode 100644
index af3b98179113..000000000000
--- a/arch/m32r/defconfig
+++ /dev/null
@@ -1,863 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23-rc1
4# Wed Aug 1 17:22:35 2007
5#
6CONFIG_M32R=y
7CONFIG_GENERIC_ISA_DMA=y
8CONFIG_ZONE_DMA=y
9CONFIG_GENERIC_HARDIRQS=y
10CONFIG_GENERIC_IRQ_PROBE=y
11CONFIG_NO_IOPORT=y
12CONFIG_NO_DMA=y
13CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
14
15#
16# Code maturity level options
17#
18CONFIG_EXPERIMENTAL=y
19CONFIG_LOCK_KERNEL=y
20CONFIG_INIT_ENV_ARG_LIMIT=32
21
22#
23# General setup
24#
25CONFIG_LOCALVERSION=""
26CONFIG_LOCALVERSION_AUTO=y
27CONFIG_SWAP=y
28CONFIG_SYSVIPC=y
29CONFIG_SYSVIPC_SYSCTL=y
30# CONFIG_POSIX_MQUEUE is not set
31CONFIG_BSD_PROCESS_ACCT=y
32# CONFIG_BSD_PROCESS_ACCT_V3 is not set
33# CONFIG_TASKSTATS is not set
34# CONFIG_USER_NS is not set
35# CONFIG_AUDIT is not set
36CONFIG_IKCONFIG=y
37CONFIG_IKCONFIG_PROC=y
38CONFIG_LOG_BUF_SHIFT=15
39# CONFIG_CPUSETS is not set
40CONFIG_SYSFS_DEPRECATED=y
41# CONFIG_RELAY is not set
42# CONFIG_BLK_DEV_INITRD is not set
43# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
44CONFIG_SYSCTL=y
45CONFIG_EMBEDDED=y
46CONFIG_SYSCTL_SYSCALL=y
47# CONFIG_KALLSYMS is not set
48CONFIG_HOTPLUG=y
49CONFIG_PRINTK=y
50CONFIG_BUG=y
51CONFIG_ELF_CORE=y
52CONFIG_BASE_FULL=y
53# CONFIG_FUTEX is not set
54CONFIG_ANON_INODES=y
55# CONFIG_EPOLL is not set
56CONFIG_SIGNALFD=y
57CONFIG_TIMERFD=y
58CONFIG_EVENTFD=y
59CONFIG_SHMEM=y
60CONFIG_VM_EVENT_COUNTERS=y
61CONFIG_SLAB=y
62# CONFIG_SLUB is not set
63# CONFIG_SLOB is not set
64# CONFIG_TINY_SHMEM is not set
65CONFIG_BASE_SMALL=0
66CONFIG_MODULES=y
67CONFIG_MODULE_UNLOAD=y
68# CONFIG_MODULE_FORCE_UNLOAD is not set
69# CONFIG_MODVERSIONS is not set
70# CONFIG_MODULE_SRCVERSION_ALL is not set
71CONFIG_KMOD=y
72CONFIG_STOP_MACHINE=y
73CONFIG_BLOCK=y
74# CONFIG_LBD is not set
75# CONFIG_BLK_DEV_IO_TRACE is not set
76# CONFIG_LSF is not set
77# CONFIG_BLK_DEV_BSG is not set
78
79#
80# IO Schedulers
81#
82CONFIG_IOSCHED_NOOP=y
83# CONFIG_IOSCHED_AS is not set
84CONFIG_IOSCHED_DEADLINE=y
85CONFIG_IOSCHED_CFQ=y
86# CONFIG_DEFAULT_AS is not set
87# CONFIG_DEFAULT_DEADLINE is not set
88CONFIG_DEFAULT_CFQ=y
89# CONFIG_DEFAULT_NOOP is not set
90CONFIG_DEFAULT_IOSCHED="cfq"
91
92#
93# Processor type and features
94#
95# CONFIG_PLAT_MAPPI is not set
96# CONFIG_PLAT_USRV is not set
97CONFIG_PLAT_M32700UT=y
98# CONFIG_PLAT_OPSPUT is not set
99# CONFIG_PLAT_OAKS32R is not set
100# CONFIG_PLAT_MAPPI2 is not set
101# CONFIG_PLAT_MAPPI3 is not set
102# CONFIG_PLAT_M32104UT is not set
103CONFIG_CHIP_M32700=y
104# CONFIG_CHIP_M32102 is not set
105# CONFIG_CHIP_M32104 is not set
106# CONFIG_CHIP_VDEC2 is not set
107# CONFIG_CHIP_OPSP is not set
108CONFIG_MMU=y
109CONFIG_TLB_ENTRIES=32
110CONFIG_ISA_M32R2=y
111CONFIG_ISA_DSP_LEVEL2=y
112CONFIG_ISA_DUAL_ISSUE=y
113CONFIG_BUS_CLOCK=50000000
114CONFIG_TIMER_DIVIDE=128
115# CONFIG_CPU_LITTLE_ENDIAN is not set
116CONFIG_MEMORY_START=0x08000000
117CONFIG_MEMORY_SIZE=0x01000000
118CONFIG_NOHIGHMEM=y
119CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
120CONFIG_SELECT_MEMORY_MODEL=y
121# CONFIG_FLATMEM_MANUAL is not set
122CONFIG_DISCONTIGMEM_MANUAL=y
123# CONFIG_SPARSEMEM_MANUAL is not set
124CONFIG_DISCONTIGMEM=y
125CONFIG_FLAT_NODE_MEM_MAP=y
126CONFIG_NEED_MULTIPLE_NODES=y
127# CONFIG_SPARSEMEM_STATIC is not set
128CONFIG_SPLIT_PTLOCK_CPUS=4
129# CONFIG_RESOURCES_64BIT is not set
130CONFIG_ZONE_DMA_FLAG=1
131CONFIG_BOUNCE=y
132CONFIG_VIRT_TO_BUS=y
133CONFIG_IRAM_START=0x00f00000
134CONFIG_IRAM_SIZE=0x00080000
135CONFIG_RWSEM_GENERIC_SPINLOCK=y
136# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
137# CONFIG_ARCH_HAS_ILOG2_U32 is not set
138# CONFIG_ARCH_HAS_ILOG2_U64 is not set
139CONFIG_GENERIC_FIND_NEXT_BIT=y
140CONFIG_GENERIC_HWEIGHT=y
141CONFIG_GENERIC_CALIBRATE_DELAY=y
142CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
143CONFIG_PREEMPT=y
144CONFIG_SMP=y
145# CONFIG_CHIP_M32700_TS1 is not set
146CONFIG_NR_CPUS=2
147CONFIG_NODES_SHIFT=1
148
149#
150# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
151#
152# CONFIG_ARCH_SUPPORTS_MSI is not set
153# CONFIG_ISA is not set
154
155#
156# PCCARD (PCMCIA/CardBus) support
157#
158# CONFIG_PCCARD is not set
159
160#
161# Executable file formats
162#
163CONFIG_BINFMT_ELF=y
164# CONFIG_BINFMT_MISC is not set
165
166#
167# Networking
168#
169CONFIG_NET=y
170
171#
172# Networking options
173#
174CONFIG_PACKET=y
175# CONFIG_PACKET_MMAP is not set
176CONFIG_UNIX=y
177CONFIG_XFRM=y
178# CONFIG_XFRM_USER is not set
179# CONFIG_XFRM_SUB_POLICY is not set
180# CONFIG_XFRM_MIGRATE is not set
181# CONFIG_NET_KEY is not set
182CONFIG_INET=y
183# CONFIG_IP_MULTICAST is not set
184# CONFIG_IP_ADVANCED_ROUTER is not set
185CONFIG_IP_FIB_HASH=y
186CONFIG_IP_PNP=y
187CONFIG_IP_PNP_DHCP=y
188# CONFIG_IP_PNP_BOOTP is not set
189# CONFIG_IP_PNP_RARP is not set
190# CONFIG_NET_IPIP is not set
191# CONFIG_NET_IPGRE is not set
192# CONFIG_ARPD is not set
193# CONFIG_SYN_COOKIES is not set
194# CONFIG_INET_AH is not set
195# CONFIG_INET_ESP is not set
196# CONFIG_INET_IPCOMP is not set
197# CONFIG_INET_XFRM_TUNNEL is not set
198# CONFIG_INET_TUNNEL is not set
199CONFIG_INET_XFRM_MODE_TRANSPORT=y
200CONFIG_INET_XFRM_MODE_TUNNEL=y
201CONFIG_INET_XFRM_MODE_BEET=y
202CONFIG_INET_DIAG=y
203CONFIG_INET_TCP_DIAG=y
204# CONFIG_TCP_CONG_ADVANCED is not set
205CONFIG_TCP_CONG_CUBIC=y
206CONFIG_DEFAULT_TCP_CONG="cubic"
207# CONFIG_TCP_MD5SIG is not set
208# CONFIG_IPV6 is not set
209# CONFIG_INET6_XFRM_TUNNEL is not set
210# CONFIG_INET6_TUNNEL is not set
211# CONFIG_NETWORK_SECMARK is not set
212# CONFIG_NETFILTER is not set
213# CONFIG_IP_DCCP is not set
214# CONFIG_IP_SCTP is not set
215# CONFIG_TIPC is not set
216# CONFIG_ATM is not set
217# CONFIG_BRIDGE is not set
218# CONFIG_VLAN_8021Q is not set
219# CONFIG_DECNET is not set
220# CONFIG_LLC2 is not set
221# CONFIG_IPX is not set
222# CONFIG_ATALK is not set
223# CONFIG_X25 is not set
224# CONFIG_LAPB is not set
225# CONFIG_ECONET is not set
226# CONFIG_WAN_ROUTER is not set
227
228#
229# QoS and/or fair queueing
230#
231# CONFIG_NET_SCHED is not set
232
233#
234# Network testing
235#
236# CONFIG_NET_PKTGEN is not set
237# CONFIG_HAMRADIO is not set
238# CONFIG_IRDA is not set
239# CONFIG_BT is not set
240# CONFIG_AF_RXRPC is not set
241
242#
243# Wireless
244#
245# CONFIG_CFG80211 is not set
246# CONFIG_WIRELESS_EXT is not set
247# CONFIG_MAC80211 is not set
248# CONFIG_IEEE80211 is not set
249# CONFIG_RFKILL is not set
250# CONFIG_NET_9P is not set
251
252#
253# Device Drivers
254#
255
256#
257# Generic Driver Options
258#
259CONFIG_STANDALONE=y
260CONFIG_PREVENT_FIRMWARE_BUILD=y
261CONFIG_FW_LOADER=y
262# CONFIG_SYS_HYPERVISOR is not set
263# CONFIG_CONNECTOR is not set
264CONFIG_MTD=y
265# CONFIG_MTD_DEBUG is not set
266# CONFIG_MTD_CONCAT is not set
267CONFIG_MTD_PARTITIONS=y
268CONFIG_MTD_REDBOOT_PARTS=y
269CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
270# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
271# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
272# CONFIG_MTD_CMDLINE_PARTS is not set
273
274#
275# User Modules And Translation Layers
276#
277# CONFIG_MTD_CHAR is not set
278CONFIG_MTD_BLKDEVS=y
279CONFIG_MTD_BLOCK=y
280# CONFIG_FTL is not set
281# CONFIG_NFTL is not set
282# CONFIG_INFTL is not set
283# CONFIG_RFD_FTL is not set
284# CONFIG_SSFDC is not set
285
286#
287# RAM/ROM/Flash chip drivers
288#
289CONFIG_MTD_CFI=m
290CONFIG_MTD_JEDECPROBE=m
291CONFIG_MTD_GEN_PROBE=m
292CONFIG_MTD_CFI_ADV_OPTIONS=y
293# CONFIG_MTD_CFI_NOSWAP is not set
294CONFIG_MTD_CFI_BE_BYTE_SWAP=y
295# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
296CONFIG_MTD_CFI_GEOMETRY=y
297CONFIG_MTD_MAP_BANK_WIDTH_1=y
298CONFIG_MTD_MAP_BANK_WIDTH_2=y
299CONFIG_MTD_MAP_BANK_WIDTH_4=y
300# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
301# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
302# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
303CONFIG_MTD_CFI_I1=y
304# CONFIG_MTD_CFI_I2 is not set
305# CONFIG_MTD_CFI_I4 is not set
306# CONFIG_MTD_CFI_I8 is not set
307# CONFIG_MTD_OTP is not set
308# CONFIG_MTD_CFI_INTELEXT is not set
309CONFIG_MTD_CFI_AMDSTD=m
310# CONFIG_MTD_CFI_STAA is not set
311CONFIG_MTD_CFI_UTIL=m
312# CONFIG_MTD_RAM is not set
313# CONFIG_MTD_ROM is not set
314# CONFIG_MTD_ABSENT is not set
315
316#
317# Mapping drivers for chip access
318#
319# CONFIG_MTD_COMPLEX_MAPPINGS is not set
320# CONFIG_MTD_PHYSMAP is not set
321# CONFIG_MTD_PLATRAM is not set
322
323#
324# Self-contained MTD device drivers
325#
326# CONFIG_MTD_SLRAM is not set
327# CONFIG_MTD_PHRAM is not set
328# CONFIG_MTD_MTDRAM is not set
329# CONFIG_MTD_BLOCK2MTD is not set
330
331#
332# Disk-On-Chip Device Drivers
333#
334# CONFIG_MTD_DOC2000 is not set
335# CONFIG_MTD_DOC2001 is not set
336# CONFIG_MTD_DOC2001PLUS is not set
337# CONFIG_MTD_NAND is not set
338# CONFIG_MTD_ONENAND is not set
339
340#
341# UBI - Unsorted block images
342#
343# CONFIG_MTD_UBI is not set
344# CONFIG_PARPORT is not set
345CONFIG_BLK_DEV=y
346# CONFIG_BLK_DEV_COW_COMMON is not set
347CONFIG_BLK_DEV_LOOP=y
348# CONFIG_BLK_DEV_CRYPTOLOOP is not set
349CONFIG_BLK_DEV_NBD=y
350CONFIG_BLK_DEV_RAM=y
351CONFIG_BLK_DEV_RAM_COUNT=16
352CONFIG_BLK_DEV_RAM_SIZE=4096
353CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
354# CONFIG_CDROM_PKTCDVD is not set
355CONFIG_ATA_OVER_ETH=m
356CONFIG_MISC_DEVICES=y
357# CONFIG_EEPROM_93CX6 is not set
358CONFIG_IDE=y
359CONFIG_IDE_MAX_HWIFS=4
360CONFIG_BLK_DEV_IDE=y
361
362#
363# Please see Documentation/ide.txt for help/info on IDE drives
364#
365# CONFIG_BLK_DEV_IDE_SATA is not set
366CONFIG_BLK_DEV_IDEDISK=y
367# CONFIG_IDEDISK_MULTI_MODE is not set
368CONFIG_BLK_DEV_IDECD=m
369# CONFIG_BLK_DEV_IDETAPE is not set
370# CONFIG_BLK_DEV_IDEFLOPPY is not set
371# CONFIG_BLK_DEV_IDESCSI is not set
372# CONFIG_IDE_TASK_IOCTL is not set
373CONFIG_IDE_PROC_FS=y
374
375#
376# IDE chipset support/bugfixes
377#
378CONFIG_IDE_GENERIC=y
379# CONFIG_IDEPCI_PCIBUS_ORDER is not set
380# CONFIG_IDE_ARM is not set
381# CONFIG_BLK_DEV_IDEDMA is not set
382# CONFIG_BLK_DEV_HD is not set
383
384#
385# SCSI device support
386#
387# CONFIG_RAID_ATTRS is not set
388CONFIG_SCSI=m
389# CONFIG_SCSI_DMA is not set
390# CONFIG_SCSI_TGT is not set
391# CONFIG_SCSI_NETLINK is not set
392CONFIG_SCSI_PROC_FS=y
393
394#
395# SCSI support type (disk, tape, CD-ROM)
396#
397CONFIG_BLK_DEV_SD=m
398# CONFIG_CHR_DEV_ST is not set
399# CONFIG_CHR_DEV_OSST is not set
400CONFIG_BLK_DEV_SR=m
401# CONFIG_BLK_DEV_SR_VENDOR is not set
402CONFIG_CHR_DEV_SG=m
403# CONFIG_CHR_DEV_SCH is not set
404
405#
406# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
407#
408CONFIG_SCSI_MULTI_LUN=y
409# CONFIG_SCSI_CONSTANTS is not set
410# CONFIG_SCSI_LOGGING is not set
411# CONFIG_SCSI_SCAN_ASYNC is not set
412CONFIG_SCSI_WAIT_SCAN=m
413
414#
415# SCSI Transports
416#
417# CONFIG_SCSI_SPI_ATTRS is not set
418# CONFIG_SCSI_FC_ATTRS is not set
419# CONFIG_SCSI_ISCSI_ATTRS is not set
420# CONFIG_SCSI_SAS_LIBSAS is not set
421CONFIG_SCSI_LOWLEVEL=y
422# CONFIG_ISCSI_TCP is not set
423# CONFIG_SCSI_DEBUG is not set
424# CONFIG_MD is not set
425CONFIG_NETDEVICES=y
426# CONFIG_NETDEVICES_MULTIQUEUE is not set
427# CONFIG_DUMMY is not set
428# CONFIG_BONDING is not set
429# CONFIG_MACVLAN is not set
430# CONFIG_EQUALIZER is not set
431# CONFIG_TUN is not set
432# CONFIG_PHYLIB is not set
433CONFIG_NET_ETHERNET=y
434CONFIG_MII=y
435CONFIG_SMC91X=y
436# CONFIG_NE2000 is not set
437CONFIG_NETDEV_1000=y
438CONFIG_NETDEV_10000=y
439
440#
441# Wireless LAN
442#
443# CONFIG_WLAN_PRE80211 is not set
444# CONFIG_WLAN_80211 is not set
445# CONFIG_WAN is not set
446# CONFIG_PPP is not set
447# CONFIG_SLIP is not set
448# CONFIG_SHAPER is not set
449# CONFIG_NETCONSOLE is not set
450# CONFIG_NETPOLL is not set
451# CONFIG_NET_POLL_CONTROLLER is not set
452# CONFIG_ISDN is not set
453# CONFIG_PHONE is not set
454
455#
456# Input device support
457#
458CONFIG_INPUT=y
459# CONFIG_INPUT_FF_MEMLESS is not set
460# CONFIG_INPUT_POLLDEV is not set
461
462#
463# Userland interfaces
464#
465# CONFIG_INPUT_MOUSEDEV is not set
466# CONFIG_INPUT_JOYDEV is not set
467# CONFIG_INPUT_TSDEV is not set
468# CONFIG_INPUT_EVDEV is not set
469# CONFIG_INPUT_EVBUG is not set
470
471#
472# Input Device Drivers
473#
474# CONFIG_INPUT_KEYBOARD is not set
475# CONFIG_INPUT_MOUSE is not set
476# CONFIG_INPUT_JOYSTICK is not set
477# CONFIG_INPUT_TABLET is not set
478# CONFIG_INPUT_TOUCHSCREEN is not set
479# CONFIG_INPUT_MISC is not set
480
481#
482# Hardware I/O ports
483#
484CONFIG_SERIO=y
485# CONFIG_SERIO_I8042 is not set
486CONFIG_SERIO_SERPORT=y
487# CONFIG_SERIO_LIBPS2 is not set
488# CONFIG_SERIO_RAW is not set
489# CONFIG_GAMEPORT is not set
490
491#
492# Character devices
493#
494CONFIG_VT=y
495CONFIG_VT_CONSOLE=y
496CONFIG_HW_CONSOLE=y
497# CONFIG_VT_HW_CONSOLE_BINDING is not set
498# CONFIG_SERIAL_NONSTANDARD is not set
499
500#
501# Serial drivers
502#
503# CONFIG_SERIAL_8250 is not set
504
505#
506# Non-8250 serial port support
507#
508CONFIG_SERIAL_CORE=y
509CONFIG_SERIAL_CORE_CONSOLE=y
510CONFIG_SERIAL_M32R_SIO=y
511CONFIG_SERIAL_M32R_SIO_CONSOLE=y
512CONFIG_SERIAL_M32R_PLDSIO=y
513CONFIG_UNIX98_PTYS=y
514CONFIG_LEGACY_PTYS=y
515CONFIG_LEGACY_PTY_COUNT=256
516# CONFIG_IPMI_HANDLER is not set
517# CONFIG_WATCHDOG is not set
518CONFIG_HW_RANDOM=y
519# CONFIG_RTC is not set
520CONFIG_DS1302=y
521# CONFIG_R3964 is not set
522# CONFIG_RAW_DRIVER is not set
523# CONFIG_TCG_TPM is not set
524# CONFIG_I2C is not set
525
526#
527# SPI support
528#
529# CONFIG_SPI is not set
530# CONFIG_SPI_MASTER is not set
531# CONFIG_W1 is not set
532# CONFIG_POWER_SUPPLY is not set
533CONFIG_HWMON=y
534# CONFIG_HWMON_VID is not set
535# CONFIG_SENSORS_ABITUGURU is not set
536# CONFIG_SENSORS_ABITUGURU3 is not set
537# CONFIG_SENSORS_F71805F is not set
538# CONFIG_SENSORS_IT87 is not set
539# CONFIG_SENSORS_PC87360 is not set
540# CONFIG_SENSORS_PC87427 is not set
541# CONFIG_SENSORS_SMSC47M1 is not set
542# CONFIG_SENSORS_SMSC47B397 is not set
543# CONFIG_SENSORS_VT1211 is not set
544# CONFIG_SENSORS_W83627HF is not set
545# CONFIG_SENSORS_W83627EHF is not set
546# CONFIG_HWMON_DEBUG_CHIP is not set
547
548#
549# Multifunction device drivers
550#
551# CONFIG_MFD_SM501 is not set
552
553#
554# Multimedia devices
555#
556CONFIG_VIDEO_DEV=m
557CONFIG_VIDEO_V4L1=y
558CONFIG_VIDEO_V4L1_COMPAT=y
559CONFIG_VIDEO_V4L2=y
560CONFIG_VIDEO_CAPTURE_DRIVERS=y
561# CONFIG_VIDEO_ADV_DEBUG is not set
562CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
563# CONFIG_VIDEO_CPIA is not set
564CONFIG_VIDEO_M32R_AR=m
565CONFIG_VIDEO_M32R_AR_M64278=m
566CONFIG_RADIO_ADAPTERS=y
567# CONFIG_DVB_CORE is not set
568CONFIG_DAB=y
569
570#
571# Graphics support
572#
573# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
574
575#
576# Display device support
577#
578# CONFIG_DISPLAY_SUPPORT is not set
579# CONFIG_VGASTATE is not set
580CONFIG_VIDEO_OUTPUT_CONTROL=m
581CONFIG_FB=y
582CONFIG_FIRMWARE_EDID=y
583# CONFIG_FB_DDC is not set
584CONFIG_FB_CFB_FILLRECT=y
585CONFIG_FB_CFB_COPYAREA=y
586CONFIG_FB_CFB_IMAGEBLIT=y
587# CONFIG_FB_SYS_FILLRECT is not set
588# CONFIG_FB_SYS_COPYAREA is not set
589# CONFIG_FB_SYS_IMAGEBLIT is not set
590# CONFIG_FB_SYS_FOPS is not set
591CONFIG_FB_DEFERRED_IO=y
592# CONFIG_FB_SVGALIB is not set
593# CONFIG_FB_MACMODES is not set
594# CONFIG_FB_BACKLIGHT is not set
595# CONFIG_FB_MODE_HELPERS is not set
596# CONFIG_FB_TILEBLITTING is not set
597
598#
599# Frame buffer hardware drivers
600#
601CONFIG_FB_S1D13XXX=y
602# CONFIG_FB_VIRTUAL is not set
603
604#
605# Console display driver support
606#
607# CONFIG_VGA_CONSOLE is not set
608CONFIG_DUMMY_CONSOLE=y
609CONFIG_FRAMEBUFFER_CONSOLE=y
610# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
611# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
612# CONFIG_FONTS is not set
613CONFIG_FONT_8x8=y
614CONFIG_FONT_8x16=y
615CONFIG_LOGO=y
616CONFIG_LOGO_LINUX_MONO=y
617CONFIG_LOGO_LINUX_VGA16=y
618CONFIG_LOGO_LINUX_CLUT224=y
619CONFIG_LOGO_M32R_CLUT224=y
620
621#
622# Sound
623#
624# CONFIG_SOUND is not set
625CONFIG_HID_SUPPORT=y
626CONFIG_HID=y
627# CONFIG_HID_DEBUG is not set
628CONFIG_USB_SUPPORT=y
629# CONFIG_USB_ARCH_HAS_HCD is not set
630# CONFIG_USB_ARCH_HAS_OHCI is not set
631# CONFIG_USB_ARCH_HAS_EHCI is not set
632
633#
634# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
635#
636
637#
638# USB Gadget Support
639#
640# CONFIG_USB_GADGET is not set
641CONFIG_MMC=y
642CONFIG_MMC_DEBUG=y
643# CONFIG_MMC_UNSAFE_RESUME is not set
644
645#
646# MMC/SD Card Drivers
647#
648CONFIG_MMC_BLOCK=y
649CONFIG_MMC_BLOCK_BOUNCE=y
650
651#
652# MMC/SD Host Controller Drivers
653#
654# CONFIG_NEW_LEDS is not set
655
656#
657# Real Time Clock
658#
659# CONFIG_RTC_CLASS is not set
660
661#
662# Userspace I/O
663#
664# CONFIG_UIO is not set
665
666#
667# File systems
668#
669CONFIG_EXT2_FS=y
670# CONFIG_EXT2_FS_XATTR is not set
671# CONFIG_EXT2_FS_XIP is not set
672CONFIG_EXT3_FS=y
673CONFIG_EXT3_FS_XATTR=y
674# CONFIG_EXT3_FS_POSIX_ACL is not set
675# CONFIG_EXT3_FS_SECURITY is not set
676# CONFIG_EXT4DEV_FS is not set
677CONFIG_JBD=y
678CONFIG_JBD_DEBUG=y
679CONFIG_FS_MBCACHE=y
680CONFIG_REISERFS_FS=m
681# CONFIG_REISERFS_CHECK is not set
682# CONFIG_REISERFS_PROC_INFO is not set
683# CONFIG_REISERFS_FS_XATTR is not set
684# CONFIG_JFS_FS is not set
685# CONFIG_FS_POSIX_ACL is not set
686# CONFIG_XFS_FS is not set
687# CONFIG_GFS2_FS is not set
688# CONFIG_OCFS2_FS is not set
689# CONFIG_MINIX_FS is not set
690# CONFIG_ROMFS_FS is not set
691CONFIG_INOTIFY=y
692CONFIG_INOTIFY_USER=y
693# CONFIG_QUOTA is not set
694CONFIG_DNOTIFY=y
695# CONFIG_AUTOFS_FS is not set
696# CONFIG_AUTOFS4_FS is not set
697# CONFIG_FUSE_FS is not set
698
699#
700# CD-ROM/DVD Filesystems
701#
702CONFIG_ISO9660_FS=m
703CONFIG_JOLIET=y
704# CONFIG_ZISOFS is not set
705CONFIG_UDF_FS=m
706CONFIG_UDF_NLS=y
707
708#
709# DOS/FAT/NT Filesystems
710#
711CONFIG_FAT_FS=m
712CONFIG_MSDOS_FS=m
713CONFIG_VFAT_FS=m
714CONFIG_FAT_DEFAULT_CODEPAGE=437
715CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
716# CONFIG_NTFS_FS is not set
717
718#
719# Pseudo filesystems
720#
721CONFIG_PROC_FS=y
722CONFIG_PROC_KCORE=y
723CONFIG_PROC_SYSCTL=y
724CONFIG_SYSFS=y
725CONFIG_TMPFS=y
726# CONFIG_TMPFS_POSIX_ACL is not set
727# CONFIG_HUGETLB_PAGE is not set
728CONFIG_RAMFS=y
729# CONFIG_CONFIGFS_FS is not set
730
731#
732# Miscellaneous filesystems
733#
734# CONFIG_ADFS_FS is not set
735# CONFIG_AFFS_FS is not set
736# CONFIG_HFS_FS is not set
737# CONFIG_HFSPLUS_FS is not set
738# CONFIG_BEFS_FS is not set
739# CONFIG_BFS_FS is not set
740# CONFIG_EFS_FS is not set
741# CONFIG_JFFS2_FS is not set
742# CONFIG_CRAMFS is not set
743# CONFIG_VXFS_FS is not set
744# CONFIG_HPFS_FS is not set
745# CONFIG_QNX4FS_FS is not set
746# CONFIG_SYSV_FS is not set
747# CONFIG_UFS_FS is not set
748
749#
750# Network File Systems
751#
752CONFIG_NFS_FS=y
753CONFIG_NFS_V3=y
754# CONFIG_NFS_V3_ACL is not set
755# CONFIG_NFS_V4 is not set
756# CONFIG_NFS_DIRECTIO is not set
757# CONFIG_NFSD is not set
758CONFIG_ROOT_NFS=y
759CONFIG_LOCKD=y
760CONFIG_LOCKD_V4=y
761CONFIG_NFS_COMMON=y
762CONFIG_SUNRPC=y
763# CONFIG_SUNRPC_BIND34 is not set
764# CONFIG_RPCSEC_GSS_KRB5 is not set
765# CONFIG_RPCSEC_GSS_SPKM3 is not set
766# CONFIG_SMB_FS is not set
767# CONFIG_CIFS is not set
768# CONFIG_NCP_FS is not set
769# CONFIG_CODA_FS is not set
770# CONFIG_AFS_FS is not set
771
772#
773# Partition Types
774#
775# CONFIG_PARTITION_ADVANCED is not set
776CONFIG_MSDOS_PARTITION=y
777
778#
779# Native Language Support
780#
781CONFIG_NLS=y
782CONFIG_NLS_DEFAULT="iso8859-1"
783# CONFIG_NLS_CODEPAGE_437 is not set
784# CONFIG_NLS_CODEPAGE_737 is not set
785# CONFIG_NLS_CODEPAGE_775 is not set
786# CONFIG_NLS_CODEPAGE_850 is not set
787# CONFIG_NLS_CODEPAGE_852 is not set
788# CONFIG_NLS_CODEPAGE_855 is not set
789# CONFIG_NLS_CODEPAGE_857 is not set
790# CONFIG_NLS_CODEPAGE_860 is not set
791# CONFIG_NLS_CODEPAGE_861 is not set
792# CONFIG_NLS_CODEPAGE_862 is not set
793# CONFIG_NLS_CODEPAGE_863 is not set
794# CONFIG_NLS_CODEPAGE_864 is not set
795# CONFIG_NLS_CODEPAGE_865 is not set
796# CONFIG_NLS_CODEPAGE_866 is not set
797# CONFIG_NLS_CODEPAGE_869 is not set
798# CONFIG_NLS_CODEPAGE_936 is not set
799# CONFIG_NLS_CODEPAGE_950 is not set
800# CONFIG_NLS_CODEPAGE_932 is not set
801# CONFIG_NLS_CODEPAGE_949 is not set
802# CONFIG_NLS_CODEPAGE_874 is not set
803# CONFIG_NLS_ISO8859_8 is not set
804# CONFIG_NLS_CODEPAGE_1250 is not set
805# CONFIG_NLS_CODEPAGE_1251 is not set
806# CONFIG_NLS_ASCII is not set
807# CONFIG_NLS_ISO8859_1 is not set
808# CONFIG_NLS_ISO8859_2 is not set
809# CONFIG_NLS_ISO8859_3 is not set
810# CONFIG_NLS_ISO8859_4 is not set
811# CONFIG_NLS_ISO8859_5 is not set
812# CONFIG_NLS_ISO8859_6 is not set
813# CONFIG_NLS_ISO8859_7 is not set
814# CONFIG_NLS_ISO8859_9 is not set
815# CONFIG_NLS_ISO8859_13 is not set
816# CONFIG_NLS_ISO8859_14 is not set
817# CONFIG_NLS_ISO8859_15 is not set
818# CONFIG_NLS_KOI8_R is not set
819# CONFIG_NLS_KOI8_U is not set
820# CONFIG_NLS_UTF8 is not set
821
822#
823# Distributed Lock Manager
824#
825# CONFIG_DLM is not set
826
827#
828# Profiling support
829#
830CONFIG_PROFILING=y
831CONFIG_OPROFILE=y
832
833#
834# Kernel hacking
835#
836# CONFIG_PRINTK_TIME is not set
837CONFIG_ENABLE_MUST_CHECK=y
838# CONFIG_MAGIC_SYSRQ is not set
839# CONFIG_UNUSED_SYMBOLS is not set
840# CONFIG_DEBUG_FS is not set
841# CONFIG_HEADERS_CHECK is not set
842# CONFIG_DEBUG_KERNEL is not set
843# CONFIG_DEBUG_BUGVERBOSE is not set
844# CONFIG_FRAME_POINTER is not set
845
846#
847# Security options
848#
849# CONFIG_KEYS is not set
850# CONFIG_SECURITY is not set
851# CONFIG_CRYPTO is not set
852
853#
854# Library routines
855#
856CONFIG_BITREVERSE=y
857# CONFIG_CRC_CCITT is not set
858# CONFIG_CRC16 is not set
859# CONFIG_CRC_ITU_T is not set
860CONFIG_CRC32=y
861# CONFIG_CRC7 is not set
862# CONFIG_LIBCRC32C is not set
863CONFIG_HAS_IOMEM=y
diff --git a/arch/m32r/kernel/vmlinux.lds.S b/arch/m32r/kernel/vmlinux.lds.S
index 41b07854fcc6..15a6f36c06db 100644
--- a/arch/m32r/kernel/vmlinux.lds.S
+++ b/arch/m32r/kernel/vmlinux.lds.S
@@ -60,9 +60,6 @@ SECTIONS
60 . = ALIGN(4096); 60 . = ALIGN(4096);
61 __nosave_end = .; 61 __nosave_end = .;
62 62
63 . = ALIGN(4096);
64 .data.page_aligned : { *(.data.idt) }
65
66 . = ALIGN(32); 63 . = ALIGN(32);
67 .data.cacheline_aligned : { *(.data.cacheline_aligned) } 64 .data.cacheline_aligned : { *(.data.cacheline_aligned) }
68 65
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 0cfbe8c594a5..84e064ffee52 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -35,7 +35,7 @@ struct virtblk_req
35 struct list_head list; 35 struct list_head list;
36 struct request *req; 36 struct request *req;
37 struct virtio_blk_outhdr out_hdr; 37 struct virtio_blk_outhdr out_hdr;
38 struct virtio_blk_inhdr in_hdr; 38 u8 status;
39}; 39};
40 40
41static void blk_done(struct virtqueue *vq) 41static void blk_done(struct virtqueue *vq)
@@ -48,7 +48,7 @@ static void blk_done(struct virtqueue *vq)
48 spin_lock_irqsave(&vblk->lock, flags); 48 spin_lock_irqsave(&vblk->lock, flags);
49 while ((vbr = vblk->vq->vq_ops->get_buf(vblk->vq, &len)) != NULL) { 49 while ((vbr = vblk->vq->vq_ops->get_buf(vblk->vq, &len)) != NULL) {
50 int uptodate; 50 int uptodate;
51 switch (vbr->in_hdr.status) { 51 switch (vbr->status) {
52 case VIRTIO_BLK_S_OK: 52 case VIRTIO_BLK_S_OK:
53 uptodate = 1; 53 uptodate = 1;
54 break; 54 break;
@@ -101,7 +101,7 @@ static bool do_req(struct request_queue *q, struct virtio_blk *vblk,
101 sg_init_table(vblk->sg, VIRTIO_MAX_SG); 101 sg_init_table(vblk->sg, VIRTIO_MAX_SG);
102 sg_set_buf(&vblk->sg[0], &vbr->out_hdr, sizeof(vbr->out_hdr)); 102 sg_set_buf(&vblk->sg[0], &vbr->out_hdr, sizeof(vbr->out_hdr));
103 num = blk_rq_map_sg(q, vbr->req, vblk->sg+1); 103 num = blk_rq_map_sg(q, vbr->req, vblk->sg+1);
104 sg_set_buf(&vblk->sg[num+1], &vbr->in_hdr, sizeof(vbr->in_hdr)); 104 sg_set_buf(&vblk->sg[num+1], &vbr->status, sizeof(vbr->status));
105 105
106 if (rq_data_dir(vbr->req) == WRITE) { 106 if (rq_data_dir(vbr->req) == WRITE) {
107 vbr->out_hdr.type |= VIRTIO_BLK_T_OUT; 107 vbr->out_hdr.type |= VIRTIO_BLK_T_OUT;
@@ -157,10 +157,25 @@ static int virtblk_ioctl(struct inode *inode, struct file *filp,
157/* We provide getgeo only to please some old bootloader/partitioning tools */ 157/* We provide getgeo only to please some old bootloader/partitioning tools */
158static int virtblk_getgeo(struct block_device *bd, struct hd_geometry *geo) 158static int virtblk_getgeo(struct block_device *bd, struct hd_geometry *geo)
159{ 159{
160 /* some standard values, similar to sd */ 160 struct virtio_blk *vblk = bd->bd_disk->private_data;
161 geo->heads = 1 << 6; 161 struct virtio_blk_geometry vgeo;
162 geo->sectors = 1 << 5; 162 int err;
163 geo->cylinders = get_capacity(bd->bd_disk) >> 11; 163
164 /* see if the host passed in geometry config */
165 err = virtio_config_val(vblk->vdev, VIRTIO_BLK_F_GEOMETRY,
166 offsetof(struct virtio_blk_config, geometry),
167 &vgeo);
168
169 if (!err) {
170 geo->heads = vgeo.heads;
171 geo->sectors = vgeo.sectors;
172 geo->cylinders = vgeo.cylinders;
173 } else {
174 /* some standard values, similar to sd */
175 geo->heads = 1 << 6;
176 geo->sectors = 1 << 5;
177 geo->cylinders = get_capacity(bd->bd_disk) >> 11;
178 }
164 return 0; 179 return 0;
165} 180}
166 181
@@ -242,12 +257,12 @@ static int virtblk_probe(struct virtio_device *vdev)
242 index++; 257 index++;
243 258
244 /* If barriers are supported, tell block layer that queue is ordered */ 259 /* If barriers are supported, tell block layer that queue is ordered */
245 if (vdev->config->feature(vdev, VIRTIO_BLK_F_BARRIER)) 260 if (virtio_has_feature(vdev, VIRTIO_BLK_F_BARRIER))
246 blk_queue_ordered(vblk->disk->queue, QUEUE_ORDERED_TAG, NULL); 261 blk_queue_ordered(vblk->disk->queue, QUEUE_ORDERED_TAG, NULL);
247 262
248 /* Host must always specify the capacity. */ 263 /* Host must always specify the capacity. */
249 __virtio_config_val(vdev, offsetof(struct virtio_blk_config, capacity), 264 vdev->config->get(vdev, offsetof(struct virtio_blk_config, capacity),
250 &cap); 265 &cap, sizeof(cap));
251 266
252 /* If capacity is too big, truncate with warning. */ 267 /* If capacity is too big, truncate with warning. */
253 if ((sector_t)cap != cap) { 268 if ((sector_t)cap != cap) {
@@ -289,7 +304,6 @@ out:
289static void virtblk_remove(struct virtio_device *vdev) 304static void virtblk_remove(struct virtio_device *vdev)
290{ 305{
291 struct virtio_blk *vblk = vdev->priv; 306 struct virtio_blk *vblk = vdev->priv;
292 int major = vblk->disk->major;
293 307
294 /* Nothing should be pending. */ 308 /* Nothing should be pending. */
295 BUG_ON(!list_empty(&vblk->reqs)); 309 BUG_ON(!list_empty(&vblk->reqs));
@@ -299,7 +313,6 @@ static void virtblk_remove(struct virtio_device *vdev)
299 313
300 blk_cleanup_queue(vblk->disk->queue); 314 blk_cleanup_queue(vblk->disk->queue);
301 put_disk(vblk->disk); 315 put_disk(vblk->disk);
302 unregister_blkdev(major, "virtblk");
303 mempool_destroy(vblk->pool); 316 mempool_destroy(vblk->pool);
304 vdev->config->del_vq(vblk->vq); 317 vdev->config->del_vq(vblk->vq);
305 kfree(vblk); 318 kfree(vblk);
@@ -310,7 +323,14 @@ static struct virtio_device_id id_table[] = {
310 { 0 }, 323 { 0 },
311}; 324};
312 325
326static unsigned int features[] = {
327 VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX,
328 VIRTIO_BLK_F_GEOMETRY,
329};
330
313static struct virtio_driver virtio_blk = { 331static struct virtio_driver virtio_blk = {
332 .feature_table = features,
333 .feature_table_size = ARRAY_SIZE(features),
314 .driver.name = KBUILD_MODNAME, 334 .driver.name = KBUILD_MODNAME,
315 .driver.owner = THIS_MODULE, 335 .driver.owner = THIS_MODULE,
316 .id_table = id_table, 336 .id_table = id_table,
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c
index 2bc9bf7e88e5..8080249957af 100644
--- a/drivers/lguest/lguest_device.c
+++ b/drivers/lguest/lguest_device.c
@@ -85,27 +85,34 @@ static unsigned desc_size(const struct lguest_device_desc *desc)
85 + desc->config_len; 85 + desc->config_len;
86} 86}
87 87
88/* This tests (and acknowleges) a feature bit. */ 88/* This gets the device's feature bits. */
89static bool lg_feature(struct virtio_device *vdev, unsigned fbit) 89static u32 lg_get_features(struct virtio_device *vdev)
90{ 90{
91 unsigned int i;
92 u32 features = 0;
91 struct lguest_device_desc *desc = to_lgdev(vdev)->desc; 93 struct lguest_device_desc *desc = to_lgdev(vdev)->desc;
92 u8 *features; 94 u8 *in_features = lg_features(desc);
93 95
94 /* Obviously if they ask for a feature off the end of our feature 96 /* We do this the slow but generic way. */
95 * bitmap, it's not set. */ 97 for (i = 0; i < min(desc->feature_len * 8, 32); i++)
96 if (fbit / 8 > desc->feature_len) 98 if (in_features[i / 8] & (1 << (i % 8)))
97 return false; 99 features |= (1 << i);
98 100
99 /* The feature bitmap comes after the virtqueues. */ 101 return features;
100 features = lg_features(desc); 102}
101 if (!(features[fbit / 8] & (1 << (fbit % 8)))) 103
102 return false; 104static void lg_set_features(struct virtio_device *vdev, u32 features)
103 105{
104 /* We set the matching bit in the other half of the bitmap to tell the 106 unsigned int i;
105 * Host we want to use this feature. We don't use this yet, but we 107 struct lguest_device_desc *desc = to_lgdev(vdev)->desc;
106 * could in future. */ 108 /* Second half of bitmap is features we accept. */
107 features[desc->feature_len + fbit / 8] |= (1 << (fbit % 8)); 109 u8 *out_features = lg_features(desc) + desc->feature_len;
108 return true; 110
111 memset(out_features, 0, desc->feature_len);
112 for (i = 0; i < min(desc->feature_len * 8, 32); i++) {
113 if (features & (1 << i))
114 out_features[i / 8] |= (1 << (i % 8));
115 }
109} 116}
110 117
111/* Once they've found a field, getting a copy of it is easy. */ 118/* Once they've found a field, getting a copy of it is easy. */
@@ -137,20 +144,26 @@ static u8 lg_get_status(struct virtio_device *vdev)
137 return to_lgdev(vdev)->desc->status; 144 return to_lgdev(vdev)->desc->status;
138} 145}
139 146
147/* To notify on status updates, we (ab)use the NOTIFY hypercall, with the
148 * descriptor address of the device. A zero status means "reset". */
149static void set_status(struct virtio_device *vdev, u8 status)
150{
151 unsigned long offset = (void *)to_lgdev(vdev)->desc - lguest_devices;
152
153 /* We set the status. */
154 to_lgdev(vdev)->desc->status = status;
155 hcall(LHCALL_NOTIFY, (max_pfn<<PAGE_SHIFT) + offset, 0, 0);
156}
157
140static void lg_set_status(struct virtio_device *vdev, u8 status) 158static void lg_set_status(struct virtio_device *vdev, u8 status)
141{ 159{
142 BUG_ON(!status); 160 BUG_ON(!status);
143 to_lgdev(vdev)->desc->status = status; 161 set_status(vdev, status);
144} 162}
145 163
146/* To reset the device, we (ab)use the NOTIFY hypercall, with the descriptor
147 * address of the device. The Host will zero the status and all the
148 * features. */
149static void lg_reset(struct virtio_device *vdev) 164static void lg_reset(struct virtio_device *vdev)
150{ 165{
151 unsigned long offset = (void *)to_lgdev(vdev)->desc - lguest_devices; 166 set_status(vdev, 0);
152
153 hcall(LHCALL_NOTIFY, (max_pfn<<PAGE_SHIFT) + offset, 0, 0);
154} 167}
155 168
156/* 169/*
@@ -286,7 +299,8 @@ static void lg_del_vq(struct virtqueue *vq)
286 299
287/* The ops structure which hooks everything together. */ 300/* The ops structure which hooks everything together. */
288static struct virtio_config_ops lguest_config_ops = { 301static struct virtio_config_ops lguest_config_ops = {
289 .feature = lg_feature, 302 .get_features = lg_get_features,
303 .set_features = lg_set_features,
290 .get = lg_get, 304 .get = lg_get,
291 .set = lg_set, 305 .set = lg_set,
292 .get_status = lg_get_status, 306 .get_status = lg_get_status,
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index 645e6e040bfb..e73a000473cc 100644
--- a/drivers/lguest/lguest_user.c
+++ b/drivers/lguest/lguest_user.c
@@ -102,7 +102,7 @@ static ssize_t read(struct file *file, char __user *user, size_t size,loff_t*o)
102static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip) 102static int lg_cpu_start(struct lg_cpu *cpu, unsigned id, unsigned long start_ip)
103{ 103{
104 /* We have a limited number the number of CPUs in the lguest struct. */ 104 /* We have a limited number the number of CPUs in the lguest struct. */
105 if (id >= NR_CPUS) 105 if (id >= ARRAY_SIZE(cpu->lg->cpus))
106 return -EINVAL; 106 return -EINVAL;
107 107
108 /* Set up this CPU's id, and pointer back to the lguest struct. */ 108 /* Set up this CPU's id, and pointer back to the lguest struct. */
@@ -251,8 +251,6 @@ static ssize_t write(struct file *file, const char __user *in,
251 if (!lg || (cpu_id >= lg->nr_cpus)) 251 if (!lg || (cpu_id >= lg->nr_cpus))
252 return -EINVAL; 252 return -EINVAL;
253 cpu = &lg->cpus[cpu_id]; 253 cpu = &lg->cpus[cpu_id];
254 if (!cpu)
255 return -EINVAL;
256 254
257 /* Once the Guest is dead, you can only read() why it died. */ 255 /* Once the Guest is dead, you can only read() why it died. */
258 if (lg->dead) 256 if (lg->dead)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 555b70c8b863..f926b5ab3d09 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -41,6 +41,9 @@ struct virtnet_info
41 struct net_device *dev; 41 struct net_device *dev;
42 struct napi_struct napi; 42 struct napi_struct napi;
43 43
44 /* The skb we couldn't send because buffers were full. */
45 struct sk_buff *last_xmit_skb;
46
44 /* Number of input buffers, and max we've ever had. */ 47 /* Number of input buffers, and max we've ever had. */
45 unsigned int num, max; 48 unsigned int num, max;
46 49
@@ -142,10 +145,10 @@ drop:
142static void try_fill_recv(struct virtnet_info *vi) 145static void try_fill_recv(struct virtnet_info *vi)
143{ 146{
144 struct sk_buff *skb; 147 struct sk_buff *skb;
145 struct scatterlist sg[1+MAX_SKB_FRAGS]; 148 struct scatterlist sg[2+MAX_SKB_FRAGS];
146 int num, err; 149 int num, err;
147 150
148 sg_init_table(sg, 1+MAX_SKB_FRAGS); 151 sg_init_table(sg, 2+MAX_SKB_FRAGS);
149 for (;;) { 152 for (;;) {
150 skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN); 153 skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN);
151 if (unlikely(!skb)) 154 if (unlikely(!skb))
@@ -221,23 +224,22 @@ static void free_old_xmit_skbs(struct virtnet_info *vi)
221 while ((skb = vi->svq->vq_ops->get_buf(vi->svq, &len)) != NULL) { 224 while ((skb = vi->svq->vq_ops->get_buf(vi->svq, &len)) != NULL) {
222 pr_debug("Sent skb %p\n", skb); 225 pr_debug("Sent skb %p\n", skb);
223 __skb_unlink(skb, &vi->send); 226 __skb_unlink(skb, &vi->send);
224 vi->dev->stats.tx_bytes += len; 227 vi->dev->stats.tx_bytes += skb->len;
225 vi->dev->stats.tx_packets++; 228 vi->dev->stats.tx_packets++;
226 kfree_skb(skb); 229 kfree_skb(skb);
227 } 230 }
228} 231}
229 232
230static int start_xmit(struct sk_buff *skb, struct net_device *dev) 233static int xmit_skb(struct virtnet_info *vi, struct sk_buff *skb)
231{ 234{
232 struct virtnet_info *vi = netdev_priv(dev); 235 int num;
233 int num, err; 236 struct scatterlist sg[2+MAX_SKB_FRAGS];
234 struct scatterlist sg[1+MAX_SKB_FRAGS];
235 struct virtio_net_hdr *hdr; 237 struct virtio_net_hdr *hdr;
236 const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest; 238 const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest;
237 239
238 sg_init_table(sg, 1+MAX_SKB_FRAGS); 240 sg_init_table(sg, 2+MAX_SKB_FRAGS);
239 241
240 pr_debug("%s: xmit %p " MAC_FMT "\n", dev->name, skb, 242 pr_debug("%s: xmit %p " MAC_FMT "\n", vi->dev->name, skb,
241 dest[0], dest[1], dest[2], 243 dest[0], dest[1], dest[2],
242 dest[3], dest[4], dest[5]); 244 dest[3], dest[4], dest[5]);
243 245
@@ -272,30 +274,51 @@ static int start_xmit(struct sk_buff *skb, struct net_device *dev)
272 274
273 vnet_hdr_to_sg(sg, skb); 275 vnet_hdr_to_sg(sg, skb);
274 num = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1; 276 num = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1;
275 __skb_queue_head(&vi->send, skb); 277
278 return vi->svq->vq_ops->add_buf(vi->svq, sg, num, 0, skb);
279}
280
281static int start_xmit(struct sk_buff *skb, struct net_device *dev)
282{
283 struct virtnet_info *vi = netdev_priv(dev);
276 284
277again: 285again:
278 /* Free up any pending old buffers before queueing new ones. */ 286 /* Free up any pending old buffers before queueing new ones. */
279 free_old_xmit_skbs(vi); 287 free_old_xmit_skbs(vi);
280 err = vi->svq->vq_ops->add_buf(vi->svq, sg, num, 0, skb); 288
281 if (err) { 289 /* If we has a buffer left over from last time, send it now. */
282 pr_debug("%s: virtio not prepared to send\n", dev->name); 290 if (vi->last_xmit_skb) {
283 netif_stop_queue(dev); 291 if (xmit_skb(vi, vi->last_xmit_skb) != 0) {
284 292 /* Drop this skb: we only queue one. */
285 /* Activate callback for using skbs: if this returns false it 293 vi->dev->stats.tx_dropped++;
286 * means some were used in the meantime. */ 294 kfree_skb(skb);
287 if (unlikely(!vi->svq->vq_ops->enable_cb(vi->svq))) { 295 goto stop_queue;
288 vi->svq->vq_ops->disable_cb(vi->svq);
289 netif_start_queue(dev);
290 goto again;
291 } 296 }
292 __skb_unlink(skb, &vi->send); 297 vi->last_xmit_skb = NULL;
298 }
293 299
294 return NETDEV_TX_BUSY; 300 /* Put new one in send queue and do transmit */
301 __skb_queue_head(&vi->send, skb);
302 if (xmit_skb(vi, skb) != 0) {
303 vi->last_xmit_skb = skb;
304 goto stop_queue;
295 } 305 }
306done:
296 vi->svq->vq_ops->kick(vi->svq); 307 vi->svq->vq_ops->kick(vi->svq);
297 308 return NETDEV_TX_OK;
298 return 0; 309
310stop_queue:
311 pr_debug("%s: virtio not prepared to send\n", dev->name);
312 netif_stop_queue(dev);
313
314 /* Activate callback for using skbs: if this returns false it
315 * means some were used in the meantime. */
316 if (unlikely(!vi->svq->vq_ops->enable_cb(vi->svq))) {
317 vi->svq->vq_ops->disable_cb(vi->svq);
318 netif_start_queue(dev);
319 goto again;
320 }
321 goto done;
299} 322}
300 323
301#ifdef CONFIG_NET_POLL_CONTROLLER 324#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -355,17 +378,26 @@ static int virtnet_probe(struct virtio_device *vdev)
355 SET_NETDEV_DEV(dev, &vdev->dev); 378 SET_NETDEV_DEV(dev, &vdev->dev);
356 379
357 /* Do we support "hardware" checksums? */ 380 /* Do we support "hardware" checksums? */
358 if (csum && vdev->config->feature(vdev, VIRTIO_NET_F_CSUM)) { 381 if (csum && virtio_has_feature(vdev, VIRTIO_NET_F_CSUM)) {
359 /* This opens up the world of extra features. */ 382 /* This opens up the world of extra features. */
360 dev->features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST; 383 dev->features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST;
361 if (gso && vdev->config->feature(vdev, VIRTIO_NET_F_GSO)) { 384 if (gso && virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) {
362 dev->features |= NETIF_F_TSO | NETIF_F_UFO 385 dev->features |= NETIF_F_TSO | NETIF_F_UFO
363 | NETIF_F_TSO_ECN | NETIF_F_TSO6; 386 | NETIF_F_TSO_ECN | NETIF_F_TSO6;
364 } 387 }
388 /* Individual feature bits: what can host handle? */
389 if (gso && virtio_has_feature(vdev, VIRTIO_NET_F_HOST_TSO4))
390 dev->features |= NETIF_F_TSO;
391 if (gso && virtio_has_feature(vdev, VIRTIO_NET_F_HOST_TSO6))
392 dev->features |= NETIF_F_TSO6;
393 if (gso && virtio_has_feature(vdev, VIRTIO_NET_F_HOST_ECN))
394 dev->features |= NETIF_F_TSO_ECN;
395 if (gso && virtio_has_feature(vdev, VIRTIO_NET_F_HOST_UFO))
396 dev->features |= NETIF_F_UFO;
365 } 397 }
366 398
367 /* Configuration may specify what MAC to use. Otherwise random. */ 399 /* Configuration may specify what MAC to use. Otherwise random. */
368 if (vdev->config->feature(vdev, VIRTIO_NET_F_MAC)) { 400 if (virtio_has_feature(vdev, VIRTIO_NET_F_MAC)) {
369 vdev->config->get(vdev, 401 vdev->config->get(vdev,
370 offsetof(struct virtio_net_config, mac), 402 offsetof(struct virtio_net_config, mac),
371 dev->dev_addr, dev->addr_len); 403 dev->dev_addr, dev->addr_len);
@@ -454,7 +486,15 @@ static struct virtio_device_id id_table[] = {
454 { 0 }, 486 { 0 },
455}; 487};
456 488
489static unsigned int features[] = {
490 VIRTIO_NET_F_CSUM, VIRTIO_NET_F_GSO, VIRTIO_NET_F_MAC,
491 VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_UFO, VIRTIO_NET_F_HOST_TSO6,
492 VIRTIO_NET_F_HOST_ECN,
493};
494
457static struct virtio_driver virtio_net = { 495static struct virtio_driver virtio_net = {
496 .feature_table = features,
497 .feature_table_size = ARRAY_SIZE(features),
458 .driver.name = KBUILD_MODNAME, 498 .driver.name = KBUILD_MODNAME,
459 .driver.owner = THIS_MODULE, 499 .driver.owner = THIS_MODULE,
460 .id_table = id_table, 500 .id_table = id_table,
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index b535483bc556..13866789b356 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -80,19 +80,51 @@ static void add_status(struct virtio_device *dev, unsigned status)
80 dev->config->set_status(dev, dev->config->get_status(dev) | status); 80 dev->config->set_status(dev, dev->config->get_status(dev) | status);
81} 81}
82 82
83void virtio_check_driver_offered_feature(const struct virtio_device *vdev,
84 unsigned int fbit)
85{
86 unsigned int i;
87 struct virtio_driver *drv = container_of(vdev->dev.driver,
88 struct virtio_driver, driver);
89
90 for (i = 0; i < drv->feature_table_size; i++)
91 if (drv->feature_table[i] == fbit)
92 return;
93 BUG();
94}
95EXPORT_SYMBOL_GPL(virtio_check_driver_offered_feature);
96
83static int virtio_dev_probe(struct device *_d) 97static int virtio_dev_probe(struct device *_d)
84{ 98{
85 int err; 99 int err, i;
86 struct virtio_device *dev = container_of(_d,struct virtio_device,dev); 100 struct virtio_device *dev = container_of(_d,struct virtio_device,dev);
87 struct virtio_driver *drv = container_of(dev->dev.driver, 101 struct virtio_driver *drv = container_of(dev->dev.driver,
88 struct virtio_driver, driver); 102 struct virtio_driver, driver);
103 u32 device_features;
89 104
105 /* We have a driver! */
90 add_status(dev, VIRTIO_CONFIG_S_DRIVER); 106 add_status(dev, VIRTIO_CONFIG_S_DRIVER);
107
108 /* Figure out what features the device supports. */
109 device_features = dev->config->get_features(dev);
110
111 /* Features supported by both device and driver into dev->features. */
112 memset(dev->features, 0, sizeof(dev->features));
113 for (i = 0; i < drv->feature_table_size; i++) {
114 unsigned int f = drv->feature_table[i];
115 BUG_ON(f >= 32);
116 if (device_features & (1 << f))
117 set_bit(f, dev->features);
118 }
119
91 err = drv->probe(dev); 120 err = drv->probe(dev);
92 if (err) 121 if (err)
93 add_status(dev, VIRTIO_CONFIG_S_FAILED); 122 add_status(dev, VIRTIO_CONFIG_S_FAILED);
94 else 123 else {
95 add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK); 124 add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK);
125 /* They should never have set feature bits beyond 32 */
126 dev->config->set_features(dev, dev->features[0]);
127 }
96 return err; 128 return err;
97} 129}
98 130
@@ -114,6 +146,8 @@ static int virtio_dev_remove(struct device *_d)
114 146
115int register_virtio_driver(struct virtio_driver *driver) 147int register_virtio_driver(struct virtio_driver *driver)
116{ 148{
149 /* Catch this early. */
150 BUG_ON(driver->feature_table_size && !driver->feature_table);
117 driver->driver.bus = &virtio_bus; 151 driver->driver.bus = &virtio_bus;
118 driver->driver.probe = virtio_dev_probe; 152 driver->driver.probe = virtio_dev_probe;
119 driver->driver.remove = virtio_dev_remove; 153 driver->driver.remove = virtio_dev_remove;
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 0b3efc31ee6d..bfef604160d1 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -155,9 +155,9 @@ static void virtballoon_changed(struct virtio_device *vdev)
155static inline s64 towards_target(struct virtio_balloon *vb) 155static inline s64 towards_target(struct virtio_balloon *vb)
156{ 156{
157 u32 v; 157 u32 v;
158 __virtio_config_val(vb->vdev, 158 vb->vdev->config->get(vb->vdev,
159 offsetof(struct virtio_balloon_config, num_pages), 159 offsetof(struct virtio_balloon_config, num_pages),
160 &v); 160 &v, sizeof(v));
161 return v - vb->num_pages; 161 return v - vb->num_pages;
162} 162}
163 163
@@ -227,7 +227,7 @@ static int virtballoon_probe(struct virtio_device *vdev)
227 } 227 }
228 228
229 vb->tell_host_first 229 vb->tell_host_first
230 = vdev->config->feature(vdev, VIRTIO_BALLOON_F_MUST_TELL_HOST); 230 = virtio_has_feature(vdev, VIRTIO_BALLOON_F_MUST_TELL_HOST);
231 231
232 return 0; 232 return 0;
233 233
@@ -259,7 +259,11 @@ static void virtballoon_remove(struct virtio_device *vdev)
259 kfree(vb); 259 kfree(vb);
260} 260}
261 261
262static unsigned int features[] = { VIRTIO_BALLOON_F_MUST_TELL_HOST };
263
262static struct virtio_driver virtio_balloon = { 264static struct virtio_driver virtio_balloon = {
265 .feature_table = features,
266 .feature_table_size = ARRAY_SIZE(features),
263 .driver.name = KBUILD_MODNAME, 267 .driver.name = KBUILD_MODNAME,
264 .driver.owner = THIS_MODULE, 268 .driver.owner = THIS_MODULE,
265 .id_table = id_table, 269 .id_table = id_table,
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index c0df924766a7..27e9fc9117cd 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -87,23 +87,22 @@ static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev)
87 return container_of(vdev, struct virtio_pci_device, vdev); 87 return container_of(vdev, struct virtio_pci_device, vdev);
88} 88}
89 89
90/* virtio config->feature() implementation */ 90/* virtio config->get_features() implementation */
91static bool vp_feature(struct virtio_device *vdev, unsigned bit) 91static u32 vp_get_features(struct virtio_device *vdev)
92{
93 struct virtio_pci_device *vp_dev = to_vp_device(vdev);
94
95 /* When someone needs more than 32 feature bits, we'll need to
96 * steal a bit to indicate that the rest are somewhere else. */
97 return ioread32(vp_dev->ioaddr + VIRTIO_PCI_HOST_FEATURES);
98}
99
100/* virtio config->set_features() implementation */
101static void vp_set_features(struct virtio_device *vdev, u32 features)
92{ 102{
93 struct virtio_pci_device *vp_dev = to_vp_device(vdev); 103 struct virtio_pci_device *vp_dev = to_vp_device(vdev);
94 u32 mask;
95
96 /* Since this function is supposed to have the side effect of
97 * enabling a queried feature, we simulate that by doing a read
98 * from the host feature bitmask and then writing to the guest
99 * feature bitmask */
100 mask = ioread32(vp_dev->ioaddr + VIRTIO_PCI_HOST_FEATURES);
101 if (mask & (1 << bit)) {
102 mask |= (1 << bit);
103 iowrite32(mask, vp_dev->ioaddr + VIRTIO_PCI_GUEST_FEATURES);
104 }
105 104
106 return !!(mask & (1 << bit)); 105 iowrite32(features, vp_dev->ioaddr + VIRTIO_PCI_GUEST_FEATURES);
107} 106}
108 107
109/* virtio config->get() implementation */ 108/* virtio config->get() implementation */
@@ -145,14 +144,14 @@ static void vp_set_status(struct virtio_device *vdev, u8 status)
145 struct virtio_pci_device *vp_dev = to_vp_device(vdev); 144 struct virtio_pci_device *vp_dev = to_vp_device(vdev);
146 /* We should never be setting status to 0. */ 145 /* We should never be setting status to 0. */
147 BUG_ON(status == 0); 146 BUG_ON(status == 0);
148 return iowrite8(status, vp_dev->ioaddr + VIRTIO_PCI_STATUS); 147 iowrite8(status, vp_dev->ioaddr + VIRTIO_PCI_STATUS);
149} 148}
150 149
151static void vp_reset(struct virtio_device *vdev) 150static void vp_reset(struct virtio_device *vdev)
152{ 151{
153 struct virtio_pci_device *vp_dev = to_vp_device(vdev); 152 struct virtio_pci_device *vp_dev = to_vp_device(vdev);
154 /* 0 status means a reset. */ 153 /* 0 status means a reset. */
155 return iowrite8(0, vp_dev->ioaddr + VIRTIO_PCI_STATUS); 154 iowrite8(0, vp_dev->ioaddr + VIRTIO_PCI_STATUS);
156} 155}
157 156
158/* the notify function used when creating a virt queue */ 157/* the notify function used when creating a virt queue */
@@ -293,7 +292,6 @@ static void vp_del_vq(struct virtqueue *vq)
293} 292}
294 293
295static struct virtio_config_ops virtio_pci_config_ops = { 294static struct virtio_config_ops virtio_pci_config_ops = {
296 .feature = vp_feature,
297 .get = vp_get, 295 .get = vp_get,
298 .set = vp_set, 296 .set = vp_set,
299 .get_status = vp_get_status, 297 .get_status = vp_get_status,
@@ -301,6 +299,8 @@ static struct virtio_config_ops virtio_pci_config_ops = {
301 .reset = vp_reset, 299 .reset = vp_reset,
302 .find_vq = vp_find_vq, 300 .find_vq = vp_find_vq,
303 .del_vq = vp_del_vq, 301 .del_vq = vp_del_vq,
302 .get_features = vp_get_features,
303 .set_features = vp_set_features,
304}; 304};
305 305
306/* the PCI probing function */ 306/* the PCI probing function */
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index c2fa5c630813..937a49d6772c 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -184,6 +184,11 @@ static void *vring_get_buf(struct virtqueue *_vq, unsigned int *len)
184 184
185 START_USE(vq); 185 START_USE(vq);
186 186
187 if (unlikely(vq->broken)) {
188 END_USE(vq);
189 return NULL;
190 }
191
187 if (!more_used(vq)) { 192 if (!more_used(vq)) {
188 pr_debug("No more buffers in queue\n"); 193 pr_debug("No more buffers in queue\n");
189 END_USE(vq); 194 END_USE(vq);
diff --git a/include/asm-ia64/cpu.h b/include/asm-ia64/cpu.h
index e87fa3210a2b..fcca30b9f110 100644
--- a/include/asm-ia64/cpu.h
+++ b/include/asm-ia64/cpu.h
@@ -14,8 +14,8 @@ DECLARE_PER_CPU(struct ia64_cpu, cpu_devices);
14 14
15DECLARE_PER_CPU(int, cpu_state); 15DECLARE_PER_CPU(int, cpu_state);
16 16
17extern int arch_register_cpu(int num);
18#ifdef CONFIG_HOTPLUG_CPU 17#ifdef CONFIG_HOTPLUG_CPU
18extern int arch_register_cpu(int num);
19extern void arch_unregister_cpu(int); 19extern void arch_unregister_cpu(int);
20#endif 20#endif
21 21
diff --git a/include/asm-ia64/thread_info.h b/include/asm-ia64/thread_info.h
index f30e05583869..2422ac61658a 100644
--- a/include/asm-ia64/thread_info.h
+++ b/include/asm-ia64/thread_info.h
@@ -108,13 +108,11 @@ extern void tsk_clear_notify_resume(struct task_struct *tsk);
108#define TIF_DB_DISABLED 19 /* debug trap disabled for fsyscall */ 108#define TIF_DB_DISABLED 19 /* debug trap disabled for fsyscall */
109#define TIF_FREEZE 20 /* is freezing for suspend */ 109#define TIF_FREEZE 20 /* is freezing for suspend */
110#define TIF_RESTORE_RSE 21 /* user RBS is newer than kernel RBS */ 110#define TIF_RESTORE_RSE 21 /* user RBS is newer than kernel RBS */
111#define TIF_RESTORE_SIGMASK 22 /* restore signal mask in do_signal() */
112 111
113#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 112#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
114#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) 113#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
115#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) 114#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
116#define _TIF_SYSCALL_TRACEAUDIT (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP) 115#define _TIF_SYSCALL_TRACEAUDIT (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP)
117#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
118#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 116#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
119#define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 117#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
120#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 118#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
@@ -131,7 +129,18 @@ extern void tsk_clear_notify_resume(struct task_struct *tsk);
131#define TIF_WORK_MASK (TIF_ALLWORK_MASK&~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)) 129#define TIF_WORK_MASK (TIF_ALLWORK_MASK&~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT))
132 130
133#define TS_POLLING 1 /* true if in idle loop and not sleeping */ 131#define TS_POLLING 1 /* true if in idle loop and not sleeping */
132#define TS_RESTORE_SIGMASK 2 /* restore signal mask in do_signal() */
134 133
135#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING) 134#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING)
136 135
136#ifndef __ASSEMBLY__
137#define HAVE_SET_RESTORE_SIGMASK 1
138static inline void set_restore_sigmask(void)
139{
140 struct thread_info *ti = current_thread_info();
141 ti->status |= TS_RESTORE_SIGMASK;
142 set_bit(TIF_SIGPENDING, &ti->flags);
143}
144#endif /* !__ASSEMBLY__ */
145
137#endif /* _ASM_IA64_THREAD_INFO_H */ 146#endif /* _ASM_IA64_THREAD_INFO_H */
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 78fade0a1e35..b7d81b2a9041 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -346,6 +346,11 @@ unifdef-y += videodev.h
346unifdef-y += virtio_config.h 346unifdef-y += virtio_config.h
347unifdef-y += virtio_blk.h 347unifdef-y += virtio_blk.h
348unifdef-y += virtio_net.h 348unifdef-y += virtio_net.h
349unifdef-y += virtio_9p.h
350unifdef-y += virtio_balloon.h
351unifdef-y += virtio_console.h
352unifdef-y += virtio_pci.h
353unifdef-y += virtio_ring.h
349unifdef-y += vt.h 354unifdef-y += vt.h
350unifdef-y += wait.h 355unifdef-y += wait.h
351unifdef-y += wanrouter.h 356unifdef-y += wanrouter.h
diff --git a/include/linux/device.h b/include/linux/device.h
index 832fb0eb2933..8c23e3dfe3ac 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -380,6 +380,12 @@ struct device {
380/* Get the wakeup routines, which depend on struct device */ 380/* Get the wakeup routines, which depend on struct device */
381#include <linux/pm_wakeup.h> 381#include <linux/pm_wakeup.h>
382 382
383static inline const char *dev_name(struct device *dev)
384{
385 /* will be changed into kobject_name(&dev->kobj) in the near future */
386 return dev->bus_id;
387}
388
383#ifdef CONFIG_NUMA 389#ifdef CONFIG_NUMA
384static inline int dev_to_node(struct device *dev) 390static inline int dev_to_node(struct device *dev)
385{ 391{
@@ -478,7 +484,7 @@ extern void sysdev_shutdown(void);
478extern const char *dev_driver_string(struct device *dev); 484extern const char *dev_driver_string(struct device *dev);
479#define dev_printk(level, dev, format, arg...) \ 485#define dev_printk(level, dev, format, arg...) \
480 printk(level "%s %s: " format , dev_driver_string(dev) , \ 486 printk(level "%s %s: " format , dev_driver_string(dev) , \
481 (dev)->bus_id , ## arg) 487 dev_name(dev) , ## arg)
482 488
483#define dev_emerg(dev, format, arg...) \ 489#define dev_emerg(dev, format, arg...) \
484 dev_printk(KERN_EMERG , dev , format , ## arg) 490 dev_printk(KERN_EMERG , dev , format , ## arg)
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 1883a85625dd..552e0ec269c9 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -61,6 +61,7 @@ typedef void (*irq_flow_handler_t)(unsigned int irq,
61#define IRQ_WAKEUP 0x00100000 /* IRQ triggers system wakeup */ 61#define IRQ_WAKEUP 0x00100000 /* IRQ triggers system wakeup */
62#define IRQ_MOVE_PENDING 0x00200000 /* need to re-target IRQ destination */ 62#define IRQ_MOVE_PENDING 0x00200000 /* need to re-target IRQ destination */
63#define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */ 63#define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */
64#define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */
64 65
65#ifdef CONFIG_IRQ_PER_CPU 66#ifdef CONFIG_IRQ_PER_CPU
66# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) 67# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index e7d10845b3c1..06005fa9e982 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -76,6 +76,7 @@ struct virtqueue_ops {
76 * @dev: underlying device. 76 * @dev: underlying device.
77 * @id: the device type identification (used to match it with a driver). 77 * @id: the device type identification (used to match it with a driver).
78 * @config: the configuration ops for this device. 78 * @config: the configuration ops for this device.
79 * @features: the features supported by both driver and device.
79 * @priv: private pointer for the driver's use. 80 * @priv: private pointer for the driver's use.
80 */ 81 */
81struct virtio_device 82struct virtio_device
@@ -84,6 +85,8 @@ struct virtio_device
84 struct device dev; 85 struct device dev;
85 struct virtio_device_id id; 86 struct virtio_device_id id;
86 struct virtio_config_ops *config; 87 struct virtio_config_ops *config;
88 /* Note that this is a Linux set_bit-style bitmap. */
89 unsigned long features[1];
87 void *priv; 90 void *priv;
88}; 91};
89 92
@@ -94,6 +97,8 @@ void unregister_virtio_device(struct virtio_device *dev);
94 * virtio_driver - operations for a virtio I/O driver 97 * virtio_driver - operations for a virtio I/O driver
95 * @driver: underlying device driver (populate name and owner). 98 * @driver: underlying device driver (populate name and owner).
96 * @id_table: the ids serviced by this driver. 99 * @id_table: the ids serviced by this driver.
100 * @feature_table: an array of feature numbers supported by this device.
101 * @feature_table_size: number of entries in the feature table array.
97 * @probe: the function to call when a device is found. Returns a token for 102 * @probe: the function to call when a device is found. Returns a token for
98 * remove, or PTR_ERR(). 103 * remove, or PTR_ERR().
99 * @remove: the function when a device is removed. 104 * @remove: the function when a device is removed.
@@ -103,6 +108,8 @@ void unregister_virtio_device(struct virtio_device *dev);
103struct virtio_driver { 108struct virtio_driver {
104 struct device_driver driver; 109 struct device_driver driver;
105 const struct virtio_device_id *id_table; 110 const struct virtio_device_id *id_table;
111 const unsigned int *feature_table;
112 unsigned int feature_table_size;
106 int (*probe)(struct virtio_device *dev); 113 int (*probe)(struct virtio_device *dev);
107 void (*remove)(struct virtio_device *dev); 114 void (*remove)(struct virtio_device *dev);
108 void (*config_changed)(struct virtio_device *dev); 115 void (*config_changed)(struct virtio_device *dev);
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h
index bca0b10d7947..d4695a3356d0 100644
--- a/include/linux/virtio_blk.h
+++ b/include/linux/virtio_blk.h
@@ -9,6 +9,7 @@
9#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */ 9#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */
10#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */ 10#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */
11#define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */ 11#define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */
12#define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */
12 13
13struct virtio_blk_config 14struct virtio_blk_config
14{ 15{
@@ -18,6 +19,12 @@ struct virtio_blk_config
18 __le32 size_max; 19 __le32 size_max;
19 /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */ 20 /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */
20 __le32 seg_max; 21 __le32 seg_max;
22 /* geometry the device (if VIRTIO_BLK_F_GEOMETRY) */
23 struct virtio_blk_geometry {
24 __le16 cylinders;
25 __u8 heads;
26 __u8 sectors;
27 } geometry;
21} __attribute__((packed)); 28} __attribute__((packed));
22 29
23/* These two define direction. */ 30/* These two define direction. */
@@ -41,13 +48,8 @@ struct virtio_blk_outhdr
41 __u64 sector; 48 __u64 sector;
42}; 49};
43 50
51/* And this is the final byte of the write scatter-gather list. */
44#define VIRTIO_BLK_S_OK 0 52#define VIRTIO_BLK_S_OK 0
45#define VIRTIO_BLK_S_IOERR 1 53#define VIRTIO_BLK_S_IOERR 1
46#define VIRTIO_BLK_S_UNSUPP 2 54#define VIRTIO_BLK_S_UNSUPP 2
47
48/* This is the first element of the write scatter-gather list */
49struct virtio_blk_inhdr
50{
51 unsigned char status;
52};
53#endif /* _LINUX_VIRTIO_BLK_H */ 55#endif /* _LINUX_VIRTIO_BLK_H */
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index d581b2914b34..50db245c81ad 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -16,27 +16,20 @@
16#define VIRTIO_CONFIG_S_FAILED 0x80 16#define VIRTIO_CONFIG_S_FAILED 0x80
17 17
18#ifdef __KERNEL__ 18#ifdef __KERNEL__
19struct virtio_device; 19#include <linux/virtio.h>
20 20
21/** 21/**
22 * virtio_config_ops - operations for configuring a virtio device 22 * virtio_config_ops - operations for configuring a virtio device
23 * @feature: search for a feature in this config
24 * vdev: the virtio_device
25 * bit: the feature bit
26 * Returns true if the feature is supported. Acknowledges the feature
27 * so the host can see it.
28 * @get: read the value of a configuration field 23 * @get: read the value of a configuration field
29 * vdev: the virtio_device 24 * vdev: the virtio_device
30 * offset: the offset of the configuration field 25 * offset: the offset of the configuration field
31 * buf: the buffer to write the field value into. 26 * buf: the buffer to write the field value into.
32 * len: the length of the buffer 27 * len: the length of the buffer
33 * Note that contents are conventionally little-endian.
34 * @set: write the value of a configuration field 28 * @set: write the value of a configuration field
35 * vdev: the virtio_device 29 * vdev: the virtio_device
36 * offset: the offset of the configuration field 30 * offset: the offset of the configuration field
37 * buf: the buffer to read the field value from. 31 * buf: the buffer to read the field value from.
38 * len: the length of the buffer 32 * len: the length of the buffer
39 * Note that contents are conventionally little-endian.
40 * @get_status: read the status byte 33 * @get_status: read the status byte
41 * vdev: the virtio_device 34 * vdev: the virtio_device
42 * Returns the status byte 35 * Returns the status byte
@@ -52,10 +45,15 @@ struct virtio_device;
52 * callback: the virqtueue callback 45 * callback: the virqtueue callback
53 * Returns the new virtqueue or ERR_PTR() (eg. -ENOENT). 46 * Returns the new virtqueue or ERR_PTR() (eg. -ENOENT).
54 * @del_vq: free a virtqueue found by find_vq(). 47 * @del_vq: free a virtqueue found by find_vq().
48 * @get_features: get the array of feature bits for this device.
49 * vdev: the virtio_device
50 * Returns the first 32 feature bits (all we currently need).
51 * @set_features: confirm what device features we'll be using.
52 * vdev: the virtio_device
53 * feature: the first 32 feature bits
55 */ 54 */
56struct virtio_config_ops 55struct virtio_config_ops
57{ 56{
58 bool (*feature)(struct virtio_device *vdev, unsigned bit);
59 void (*get)(struct virtio_device *vdev, unsigned offset, 57 void (*get)(struct virtio_device *vdev, unsigned offset,
60 void *buf, unsigned len); 58 void *buf, unsigned len);
61 void (*set)(struct virtio_device *vdev, unsigned offset, 59 void (*set)(struct virtio_device *vdev, unsigned offset,
@@ -67,43 +65,52 @@ struct virtio_config_ops
67 unsigned index, 65 unsigned index,
68 void (*callback)(struct virtqueue *)); 66 void (*callback)(struct virtqueue *));
69 void (*del_vq)(struct virtqueue *vq); 67 void (*del_vq)(struct virtqueue *vq);
68 u32 (*get_features)(struct virtio_device *vdev);
69 void (*set_features)(struct virtio_device *vdev, u32 features);
70}; 70};
71 71
72/* If driver didn't advertise the feature, it will never appear. */
73void virtio_check_driver_offered_feature(const struct virtio_device *vdev,
74 unsigned int fbit);
75
72/** 76/**
73 * virtio_config_val - look for a feature and get a single virtio config. 77 * virtio_has_feature - helper to determine if this device has this feature.
74 * @vdev: the virtio device 78 * @vdev: the device
75 * @fbit: the feature bit 79 * @fbit: the feature bit
76 * @offset: the type to search for. 80 */
77 * @val: a pointer to the value to fill in. 81static inline bool virtio_has_feature(const struct virtio_device *vdev,
78 * 82 unsigned int fbit)
79 * The return value is -ENOENT if the feature doesn't exist. Otherwise 83{
80 * the value is endian-corrected and returned in v. */ 84 /* Did you forget to fix assumptions on max features? */
81#define virtio_config_val(vdev, fbit, offset, v) ({ \ 85 if (__builtin_constant_p(fbit))
82 int _err; \ 86 BUILD_BUG_ON(fbit >= 32);
83 if ((vdev)->config->feature((vdev), (fbit))) { \ 87
84 __virtio_config_val((vdev), (offset), (v)); \ 88 virtio_check_driver_offered_feature(vdev, fbit);
85 _err = 0; \ 89 return test_bit(fbit, vdev->features);
86 } else \ 90}
87 _err = -ENOENT; \
88 _err; \
89})
90 91
91/** 92/**
92 * __virtio_config_val - get a single virtio config without feature check. 93 * virtio_config_val - look for a feature and get a virtio config entry.
93 * @vdev: the virtio device 94 * @vdev: the virtio device
95 * @fbit: the feature bit
94 * @offset: the type to search for. 96 * @offset: the type to search for.
95 * @val: a pointer to the value to fill in. 97 * @val: a pointer to the value to fill in.
96 * 98 *
97 * The value is endian-corrected and returned in v. */ 99 * The return value is -ENOENT if the feature doesn't exist. Otherwise
98#define __virtio_config_val(vdev, offset, v) do { \ 100 * the config value is copied into whatever is pointed to by v. */
99 BUILD_BUG_ON(sizeof(*(v)) != 1 && sizeof(*(v)) != 2 \ 101#define virtio_config_val(vdev, fbit, offset, v) \
100 && sizeof(*(v)) != 4 && sizeof(*(v)) != 8); \ 102 virtio_config_buf((vdev), (fbit), (offset), (v), sizeof(v))
101 (vdev)->config->get((vdev), (offset), (v), sizeof(*(v))); \ 103
102 switch (sizeof(*(v))) { \ 104static inline int virtio_config_buf(struct virtio_device *vdev,
103 case 2: le16_to_cpus((__u16 *) v); break; \ 105 unsigned int fbit,
104 case 4: le32_to_cpus((__u32 *) v); break; \ 106 unsigned int offset,
105 case 8: le64_to_cpus((__u64 *) v); break; \ 107 void *buf, unsigned len)
106 } \ 108{
107} while(0) 109 if (!virtio_has_feature(vdev, fbit))
110 return -ENOENT;
111
112 vdev->config->get(vdev, offset, buf, len);
113 return 0;
114}
108#endif /* __KERNEL__ */ 115#endif /* __KERNEL__ */
109#endif /* _LINUX_VIRTIO_CONFIG_H */ 116#endif /* _LINUX_VIRTIO_CONFIG_H */
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index 1ea3351df609..9405aa6cdf26 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -6,9 +6,18 @@
6#define VIRTIO_ID_NET 1 6#define VIRTIO_ID_NET 1
7 7
8/* The feature bitmap for virtio net */ 8/* The feature bitmap for virtio net */
9#define VIRTIO_NET_F_CSUM 0 /* Can handle pkts w/ partial csum */ 9#define VIRTIO_NET_F_CSUM 0 /* Host handles pkts w/ partial csum */
10#define VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ partial csum */
10#define VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */ 11#define VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */
11#define VIRTIO_NET_F_GSO 6 /* Can handle pkts w/ any GSO type */ 12#define VIRTIO_NET_F_GSO 6 /* Host handles pkts w/ any GSO type */
13#define VIRTIO_NET_F_GUEST_TSO4 7 /* Guest can handle TSOv4 in. */
14#define VIRTIO_NET_F_GUEST_TSO6 8 /* Guest can handle TSOv6 in. */
15#define VIRTIO_NET_F_GUEST_ECN 9 /* Guest can handle TSO[6] w/ ECN in. */
16#define VIRTIO_NET_F_GUEST_UFO 10 /* Guest can handle UFO in. */
17#define VIRTIO_NET_F_HOST_TSO4 11 /* Host can handle TSOv4 in. */
18#define VIRTIO_NET_F_HOST_TSO6 12 /* Host can handle TSOv6 in. */
19#define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */
20#define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */
12 21
13struct virtio_net_config 22struct virtio_net_config
14{ 23{
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 46e4ad1723f0..46d6611a33bb 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -150,6 +150,26 @@ void disable_irq(unsigned int irq)
150} 150}
151EXPORT_SYMBOL(disable_irq); 151EXPORT_SYMBOL(disable_irq);
152 152
153static void __enable_irq(struct irq_desc *desc, unsigned int irq)
154{
155 switch (desc->depth) {
156 case 0:
157 printk(KERN_WARNING "Unbalanced enable for IRQ %d\n", irq);
158 WARN_ON(1);
159 break;
160 case 1: {
161 unsigned int status = desc->status & ~IRQ_DISABLED;
162
163 /* Prevent probing on this irq: */
164 desc->status = status | IRQ_NOPROBE;
165 check_irq_resend(desc, irq);
166 /* fall-through */
167 }
168 default:
169 desc->depth--;
170 }
171}
172
153/** 173/**
154 * enable_irq - enable handling of an irq 174 * enable_irq - enable handling of an irq
155 * @irq: Interrupt to enable 175 * @irq: Interrupt to enable
@@ -169,22 +189,7 @@ void enable_irq(unsigned int irq)
169 return; 189 return;
170 190
171 spin_lock_irqsave(&desc->lock, flags); 191 spin_lock_irqsave(&desc->lock, flags);
172 switch (desc->depth) { 192 __enable_irq(desc, irq);
173 case 0:
174 printk(KERN_WARNING "Unbalanced enable for IRQ %d\n", irq);
175 WARN_ON(1);
176 break;
177 case 1: {
178 unsigned int status = desc->status & ~IRQ_DISABLED;
179
180 /* Prevent probing on this irq: */
181 desc->status = status | IRQ_NOPROBE;
182 check_irq_resend(desc, irq);
183 /* fall-through */
184 }
185 default:
186 desc->depth--;
187 }
188 spin_unlock_irqrestore(&desc->lock, flags); 193 spin_unlock_irqrestore(&desc->lock, flags);
189} 194}
190EXPORT_SYMBOL(enable_irq); 195EXPORT_SYMBOL(enable_irq);
@@ -365,7 +370,7 @@ int setup_irq(unsigned int irq, struct irqaction *new)
365 compat_irq_chip_set_default_handler(desc); 370 compat_irq_chip_set_default_handler(desc);
366 371
367 desc->status &= ~(IRQ_AUTODETECT | IRQ_WAITING | 372 desc->status &= ~(IRQ_AUTODETECT | IRQ_WAITING |
368 IRQ_INPROGRESS); 373 IRQ_INPROGRESS | IRQ_SPURIOUS_DISABLED);
369 374
370 if (!(desc->status & IRQ_NOAUTOEN)) { 375 if (!(desc->status & IRQ_NOAUTOEN)) {
371 desc->depth = 0; 376 desc->depth = 0;
@@ -381,6 +386,16 @@ int setup_irq(unsigned int irq, struct irqaction *new)
381 /* Reset broken irq detection when installing new handler */ 386 /* Reset broken irq detection when installing new handler */
382 desc->irq_count = 0; 387 desc->irq_count = 0;
383 desc->irqs_unhandled = 0; 388 desc->irqs_unhandled = 0;
389
390 /*
391 * Check whether we disabled the irq via the spurious handler
392 * before. Reenable it and give it another chance.
393 */
394 if (shared && (desc->status & IRQ_SPURIOUS_DISABLED)) {
395 desc->status &= ~IRQ_SPURIOUS_DISABLED;
396 __enable_irq(desc, irq);
397 }
398
384 spin_unlock_irqrestore(&desc->lock, flags); 399 spin_unlock_irqrestore(&desc->lock, flags);
385 400
386 new->irq = irq; 401 new->irq = irq;
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
index 088dabbf2d6a..c66d3f10e853 100644
--- a/kernel/irq/spurious.c
+++ b/kernel/irq/spurious.c
@@ -209,8 +209,8 @@ void note_interrupt(unsigned int irq, struct irq_desc *desc,
209 * Now kill the IRQ 209 * Now kill the IRQ
210 */ 210 */
211 printk(KERN_EMERG "Disabling IRQ #%d\n", irq); 211 printk(KERN_EMERG "Disabling IRQ #%d\n", irq);
212 desc->status |= IRQ_DISABLED; 212 desc->status |= IRQ_DISABLED | IRQ_SPURIOUS_DISABLED;
213 desc->depth = 1; 213 desc->depth++;
214 desc->chip->disable(irq); 214 desc->chip->disable(irq);
215 } 215 }
216 desc->irqs_unhandled = 0; 216 desc->irqs_unhandled = 0;