Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 255297
b: refs/heads/master
c: e2cbc11
h: refs/heads/master
i:
  255295: 21a91ee
v: v3
  • Loading branch information
Antonio Quartulli authored and Sven Eckelmann committed May 30, 2011
1 parent c857a99 commit 7557cce
Show file tree
Hide file tree
Showing 69 changed files with 252 additions and 790 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e11ec900cfbea3d8f6a188674ee6fcb65f2a73d6
refs/heads/master: e2cbc11c0e1225bd5fe183a967fc80df3db10745
2 changes: 1 addition & 1 deletion trunk/Documentation/virtual/lguest/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This creates the demonstration utility "lguest" which runs a Linux guest.
# Missing headers? Add "-I../../../include -I../../../arch/x86/include"
# Missing headers? Add "-I../../include -I../../arch/x86/include"
CFLAGS:=-m32 -Wall -Wmissing-declarations -Wmissing-prototypes -O3 -U_FORTIFY_SOURCE

all: lguest
Expand Down
22 changes: 20 additions & 2 deletions trunk/Documentation/virtual/lguest/lguest.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#include <linux/virtio_rng.h>
#include <linux/virtio_ring.h>
#include <asm/bootparam.h>
#include "../../../include/linux/lguest_launcher.h"
#include "../../include/linux/lguest_launcher.h"
/*L:110
* We can ignore the 42 include files we need for this program, but I do want
* to draw attention to the use of kernel-style types.
Expand Down Expand Up @@ -135,6 +135,9 @@ struct device {
/* Is it operational */
bool running;

/* Does Guest want an intrrupt on empty? */
bool irq_on_empty;

/* Device-specific data. */
void *priv;
};
Expand Down Expand Up @@ -634,7 +637,10 @@ static void trigger_irq(struct virtqueue *vq)

/* If they don't want an interrupt, don't send one... */
if (vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT) {
return;
/* ... unless they've asked us to force one on empty. */
if (!vq->dev->irq_on_empty
|| lg_last_avail(vq) != vq->vring.avail->idx)
return;
}

/* Send the Guest an interrupt tell them we used something up. */
Expand Down Expand Up @@ -1051,6 +1057,15 @@ static void create_thread(struct virtqueue *vq)
close(vq->eventfd);
}

static bool accepted_feature(struct device *dev, unsigned int bit)
{
const u8 *features = get_feature_bits(dev) + dev->feature_len;

if (dev->feature_len < bit / CHAR_BIT)
return false;
return features[bit / CHAR_BIT] & (1 << (bit % CHAR_BIT));
}

static void start_device(struct device *dev)
{
unsigned int i;
Expand All @@ -1064,6 +1079,8 @@ static void start_device(struct device *dev)
verbose(" %02x", get_feature_bits(dev)
[dev->feature_len+i]);

dev->irq_on_empty = accepted_feature(dev, VIRTIO_F_NOTIFY_ON_EMPTY);

for (vq = dev->vq; vq; vq = vq->next) {
if (vq->service)
create_thread(vq);
Expand Down Expand Up @@ -1547,6 +1564,7 @@ static void setup_tun_net(char *arg)
/* Set up the tun device. */
configure_device(ipfd, tapif, ip);

add_feature(dev, VIRTIO_F_NOTIFY_ON_EMPTY);
/* Expect Guest to handle everything except UFO */
add_feature(dev, VIRTIO_NET_F_CSUM);
add_feature(dev, VIRTIO_NET_F_GUEST_CSUM);
Expand Down
3 changes: 1 addition & 2 deletions trunk/arch/ia64/include/asm/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,11 @@
#define __NR_clock_adjtime 1328
#define __NR_syncfs 1329
#define __NR_setns 1330
#define __NR_sendmmsg 1331

#ifdef __KERNEL__


#define NR_syscalls 308 /* length of syscall table */
#define NR_syscalls 307 /* length of syscall table */

/*
* The following defines stop scripts/checksyscalls.sh from complaining about
Expand Down
1 change: 0 additions & 1 deletion trunk/arch/ia64/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -1776,7 +1776,6 @@ sys_call_table:
data8 sys_clock_adjtime
data8 sys_syncfs
data8 sys_setns // 1330
data8 sys_sendmmsg

.org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */
3 changes: 1 addition & 2 deletions trunk/arch/powerpc/platforms/powermac/pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -715,8 +715,7 @@ static struct syscore_ops pmacpic_syscore_ops = {

static int __init init_pmacpic_syscore(void)
{
if (pmac_irq_hw[0])
register_syscore_ops(&pmacpic_syscore_ops);
register_syscore_ops(&pmacpic_syscore_ops);
return 0;
}

Expand Down
2 changes: 0 additions & 2 deletions trunk/arch/x86/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE)

ifdef CONFIG_FUNCTION_TRACER
# Do not profile debug and lowlevel utilities
CFLAGS_REMOVE_tsc.o = -pg
CFLAGS_REMOVE_rtc.o = -pg
CFLAGS_REMOVE_paravirt-spinlocks.o = -pg
CFLAGS_REMOVE_pvclock.o = -pg
Expand All @@ -29,7 +28,6 @@ CFLAGS_paravirt.o := $(nostackp)
GCOV_PROFILE_vsyscall_64.o := n
GCOV_PROFILE_hpet.o := n
GCOV_PROFILE_tsc.o := n
GCOV_PROFILE_vread_tsc_64.o := n
GCOV_PROFILE_paravirt.o := n

# vread_tsc_64 is hot and should be fully optimized:
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/x86/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ static int __init idle_setup(char *str)
boot_option_idle_override = IDLE_POLL;
} else if (!strcmp(str, "mwait")) {
boot_option_idle_override = IDLE_FORCE_MWAIT;
WARN_ONCE(1, "\"idle=mwait\" will be removed in 2012\n");
WARN_ONCE(1, "\idle=mwait\" will be removed in 2012\"\n");
} else if (!strcmp(str, "halt")) {
/*
* When the boot option of idle=halt is added, halt is
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/x86/kernel/smpboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ static inline void mwait_play_dead(void)
void *mwait_ptr;
struct cpuinfo_x86 *c = __this_cpu_ptr(&cpu_info);

if (!(this_cpu_has(X86_FEATURE_MWAIT) && mwait_usable(c)))
if (!this_cpu_has(X86_FEATURE_MWAIT) && mwait_usable(c))
return;
if (!this_cpu_has(X86_FEATURE_CLFLSH))
return;
Expand Down
1 change: 0 additions & 1 deletion trunk/arch/x86/lguest/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,6 @@ static void lguest_time_irq(unsigned int irq, struct irq_desc *desc)
static void lguest_time_init(void)
{
/* Set up the timer interrupt (0) to go to our simple timer routine */
lguest_setup_irq(0);
irq_set_handler(0, lguest_time_irq);

clocksource_register_hz(&lguest_clock, NSEC_PER_SEC);
Expand Down
91 changes: 11 additions & 80 deletions trunk/drivers/block/virtio_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
#include <linux/virtio.h>
#include <linux/virtio_blk.h>
#include <linux/scatterlist.h>
#include <linux/string_helpers.h>
#include <scsi/scsi_cmnd.h>

#define PART_BITS 4

static int major, index;
struct workqueue_struct *virtblk_wq;

struct virtio_blk
{
Expand All @@ -29,9 +26,6 @@ struct virtio_blk

mempool_t *pool;

/* Process context for config space updates */
struct work_struct config_work;

/* What host tells us, plus 2 for header & tailer. */
unsigned int sg_elems;

Expand Down Expand Up @@ -147,7 +141,7 @@ static bool do_req(struct request_queue *q, struct virtio_blk *vblk,
num = blk_rq_map_sg(q, vbr->req, vblk->sg + out);

if (vbr->req->cmd_type == REQ_TYPE_BLOCK_PC) {
sg_set_buf(&vblk->sg[num + out + in++], vbr->req->sense, SCSI_SENSE_BUFFERSIZE);
sg_set_buf(&vblk->sg[num + out + in++], vbr->req->sense, 96);
sg_set_buf(&vblk->sg[num + out + in++], &vbr->in_hdr,
sizeof(vbr->in_hdr));
}
Expand Down Expand Up @@ -297,46 +291,6 @@ static ssize_t virtblk_serial_show(struct device *dev,
}
DEVICE_ATTR(serial, S_IRUGO, virtblk_serial_show, NULL);

static void virtblk_config_changed_work(struct work_struct *work)
{
struct virtio_blk *vblk =
container_of(work, struct virtio_blk, config_work);
struct virtio_device *vdev = vblk->vdev;
struct request_queue *q = vblk->disk->queue;
char cap_str_2[10], cap_str_10[10];
u64 capacity, size;

/* Host must always specify the capacity. */
vdev->config->get(vdev, offsetof(struct virtio_blk_config, capacity),
&capacity, sizeof(capacity));

/* If capacity is too big, truncate with warning. */
if ((sector_t)capacity != capacity) {
dev_warn(&vdev->dev, "Capacity %llu too large: truncating\n",
(unsigned long long)capacity);
capacity = (sector_t)-1;
}

size = capacity * queue_logical_block_size(q);
string_get_size(size, STRING_UNITS_2, cap_str_2, sizeof(cap_str_2));
string_get_size(size, STRING_UNITS_10, cap_str_10, sizeof(cap_str_10));

dev_notice(&vdev->dev,
"new size: %llu %d-byte logical blocks (%s/%s)\n",
(unsigned long long)capacity,
queue_logical_block_size(q),
cap_str_10, cap_str_2);

set_capacity(vblk->disk, capacity);
}

static void virtblk_config_changed(struct virtio_device *vdev)
{
struct virtio_blk *vblk = vdev->priv;

queue_work(virtblk_wq, &vblk->config_work);
}

static int __devinit virtblk_probe(struct virtio_device *vdev)
{
struct virtio_blk *vblk;
Expand Down Expand Up @@ -373,7 +327,6 @@ static int __devinit virtblk_probe(struct virtio_device *vdev)
vblk->vdev = vdev;
vblk->sg_elems = sg_elems;
sg_init_table(vblk->sg, vblk->sg_elems);
INIT_WORK(&vblk->config_work, virtblk_config_changed_work);

/* We expect one virtqueue, for output. */
vblk->vq = virtio_find_single_vq(vdev, blk_done, "requests");
Expand Down Expand Up @@ -524,8 +477,6 @@ static void __devexit virtblk_remove(struct virtio_device *vdev)
{
struct virtio_blk *vblk = vdev->priv;

flush_work(&vblk->config_work);

/* Nothing should be pending. */
BUG_ON(!list_empty(&vblk->reqs));

Expand Down Expand Up @@ -557,47 +508,27 @@ static unsigned int features[] = {
* Use __refdata to avoid this warning.
*/
static struct virtio_driver __refdata virtio_blk = {
.feature_table = features,
.feature_table_size = ARRAY_SIZE(features),
.driver.name = KBUILD_MODNAME,
.driver.owner = THIS_MODULE,
.id_table = id_table,
.probe = virtblk_probe,
.remove = __devexit_p(virtblk_remove),
.config_changed = virtblk_config_changed,
.feature_table = features,
.feature_table_size = ARRAY_SIZE(features),
.driver.name = KBUILD_MODNAME,
.driver.owner = THIS_MODULE,
.id_table = id_table,
.probe = virtblk_probe,
.remove = __devexit_p(virtblk_remove),
};

static int __init init(void)
{
int error;

virtblk_wq = alloc_workqueue("virtio-blk", 0, 0);
if (!virtblk_wq)
return -ENOMEM;

major = register_blkdev(0, "virtblk");
if (major < 0) {
error = major;
goto out_destroy_workqueue;
}

error = register_virtio_driver(&virtio_blk);
if (error)
goto out_unregister_blkdev;
return 0;

out_unregister_blkdev:
unregister_blkdev(major, "virtblk");
out_destroy_workqueue:
destroy_workqueue(virtblk_wq);
return error;
if (major < 0)
return major;
return register_virtio_driver(&virtio_blk);
}

static void __exit fini(void)
{
unregister_blkdev(major, "virtblk");
unregister_virtio_driver(&virtio_blk);
destroy_workqueue(virtblk_wq);
}
module_init(init);
module_exit(fini);
Expand Down
5 changes: 5 additions & 0 deletions trunk/drivers/char/virtio_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -1677,12 +1677,17 @@ static int __devinit virtcons_probe(struct virtio_device *vdev)
portdev->config.max_nr_ports = 1;
if (virtio_has_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT)) {
multiport = true;
vdev->features[0] |= 1 << VIRTIO_CONSOLE_F_MULTIPORT;

vdev->config->get(vdev, offsetof(struct virtio_console_config,
max_nr_ports),
&portdev->config.max_nr_ports,
sizeof(portdev->config.max_nr_ports));
}

/* Let the Host know we support multiple ports.*/
vdev->config->finalize_features(vdev);

err = init_vqs(portdev);
if (err < 0) {
dev_err(&vdev->dev, "Error %d initializing vqs\n", err);
Expand Down
14 changes: 7 additions & 7 deletions trunk/drivers/net/3c509.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ static int max_interrupt_work = 10;
static int nopnp;
#endif

static int __devinit el3_common_init(struct net_device *dev);
static int el3_common_init(struct net_device *dev);
static void el3_common_remove(struct net_device *dev);
static ushort id_read_eeprom(int index);
static ushort read_eeprom(int ioaddr, int index);
Expand Down Expand Up @@ -395,7 +395,7 @@ static struct isa_driver el3_isa_driver = {
static int isa_registered;

#ifdef CONFIG_PNP
static struct pnp_device_id el3_pnp_ids[] = {
static const struct pnp_device_id el3_pnp_ids[] __devinitconst = {
{ .id = "TCM5090" }, /* 3Com Etherlink III (TP) */
{ .id = "TCM5091" }, /* 3Com Etherlink III */
{ .id = "TCM5094" }, /* 3Com Etherlink III (combo) */
Expand Down Expand Up @@ -478,7 +478,7 @@ static int pnp_registered;
#endif /* CONFIG_PNP */

#ifdef CONFIG_EISA
static struct eisa_device_id el3_eisa_ids[] = {
static const struct eisa_device_id el3_eisa_ids[] __devinitconst = {
{ "TCM5090" },
{ "TCM5091" },
{ "TCM5092" },
Expand Down Expand Up @@ -508,7 +508,7 @@ static int eisa_registered;
#ifdef CONFIG_MCA
static int el3_mca_probe(struct device *dev);

static short el3_mca_adapter_ids[] __initdata = {
static const short el3_mca_adapter_ids[] __devinitconst = {
0x627c,
0x627d,
0x62db,
Expand All @@ -517,7 +517,7 @@ static short el3_mca_adapter_ids[] __initdata = {
0x0000
};

static char *el3_mca_adapter_names[] __initdata = {
static const char *const el3_mca_adapter_names[] __devinitconst = {
"3Com 3c529 EtherLink III (10base2)",
"3Com 3c529 EtherLink III (10baseT)",
"3Com 3c529 EtherLink III (test mode)",
Expand Down Expand Up @@ -601,7 +601,7 @@ static void el3_common_remove (struct net_device *dev)
}

#ifdef CONFIG_MCA
static int __init el3_mca_probe(struct device *device)
static int __devinit el3_mca_probe(struct device *device)
{
/* Based on Erik Nygren's (nygren@mit.edu) 3c529 patch,
* heavily modified by Chris Beauregard
Expand Down Expand Up @@ -671,7 +671,7 @@ static int __init el3_mca_probe(struct device *device)
#endif /* CONFIG_MCA */

#ifdef CONFIG_EISA
static int __init el3_eisa_probe (struct device *device)
static int __devinit el3_eisa_probe (struct device *device)
{
short i;
int ioaddr, irq, if_port;
Expand Down
Loading

0 comments on commit 7557cce

Please sign in to comment.