Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 97539
b: refs/heads/master
c: 61ac7bf
h: refs/heads/master
i:
  97537: 9817799
  97535: bf8f3dd
v: v3
  • Loading branch information
Linus Torvalds committed May 30, 2008
1 parent e211e98 commit 800be79
Show file tree
Hide file tree
Showing 28 changed files with 338 additions and 103 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: 3072c379bccfa2844e33103ed9ff530780e660ea
refs/heads/master: 61ac7bf538db2044d0238fcd87b3d9df59294bf2
12 changes: 10 additions & 2 deletions trunk/Documentation/lguest/lguest.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ struct virtqueue

/* The routine to call when the Guest pings us. */
void (*handle_output)(int fd, struct virtqueue *me);

/* Outstanding buffers */
unsigned int inflight;
};

/* Remember the arguments to the program so we can "reboot" */
Expand Down Expand Up @@ -702,6 +705,7 @@ static unsigned get_vq_desc(struct virtqueue *vq,
errx(1, "Looped descriptor");
} while ((i = next_desc(vq, i)) != vq->vring.num);

vq->inflight++;
return head;
}

Expand All @@ -719,15 +723,17 @@ static void add_used(struct virtqueue *vq, unsigned int head, int len)
/* Make sure buffer is written before we update index. */
wmb();
vq->vring.used->idx++;
vq->inflight--;
}

/* This actually sends the interrupt for this virtqueue */
static void trigger_irq(int fd, struct virtqueue *vq)
{
unsigned long buf[] = { LHREQ_IRQ, vq->config.irq };

/* If they don't want an interrupt, don't send one. */
if (vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT)
/* If they don't want an interrupt, don't send one, unless empty. */
if ((vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT)
&& vq->inflight)
return;

/* Send the Guest an interrupt tell them we used something up. */
Expand Down Expand Up @@ -1107,6 +1113,7 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs,
vq->next = NULL;
vq->last_avail_idx = 0;
vq->dev = dev;
vq->inflight = 0;

/* Initialize the configuration. */
vq->config.num = num_descs;
Expand Down Expand Up @@ -1368,6 +1375,7 @@ static void setup_tun_net(const char *arg)

/* Tell Guest what MAC address to use. */
add_feature(dev, VIRTIO_NET_F_MAC);
add_feature(dev, VIRTIO_F_NOTIFY_ON_EMPTY);
set_config(dev, sizeof(conf), &conf);

/* We don't need the socket any more; setup is done. */
Expand Down
5 changes: 3 additions & 2 deletions trunk/arch/x86/lguest/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,9 @@ static void __init lguest_init_IRQ(void)
int vector = FIRST_EXTERNAL_VECTOR + i;
if (vector != SYSCALL_VECTOR) {
set_intr_gate(vector, interrupt[i]);
set_irq_chip_and_handler(i, &lguest_irq_controller,
handle_level_irq);
set_irq_chip_and_handler_name(i, &lguest_irq_controller,
handle_level_irq,
"level");
}
}
/* This call is required to set up for 4k stacks, where we have
Expand Down
7 changes: 6 additions & 1 deletion trunk/drivers/block/virtio_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@ static int virtblk_probe(struct virtio_device *vdev)
if (virtio_has_feature(vdev, VIRTIO_BLK_F_BARRIER))
blk_queue_ordered(vblk->disk->queue, QUEUE_ORDERED_TAG, NULL);

/* If disk is read-only in the host, the guest should obey */
if (virtio_has_feature(vdev, VIRTIO_BLK_F_RO))
set_disk_ro(vblk->disk, 1);

/* Host must always specify the capacity. */
vdev->config->get(vdev, offsetof(struct virtio_blk_config, capacity),
&cap, sizeof(cap));
Expand Down Expand Up @@ -311,6 +315,7 @@ static void virtblk_remove(struct virtio_device *vdev)
/* Stop all the virtqueues. */
vdev->config->reset(vdev);

del_gendisk(vblk->disk);
blk_cleanup_queue(vblk->disk->queue);
put_disk(vblk->disk);
mempool_destroy(vblk->pool);
Expand All @@ -325,7 +330,7 @@ static struct virtio_device_id id_table[] = {

static unsigned int features[] = {
VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX,
VIRTIO_BLK_F_GEOMETRY,
VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO,
};

static struct virtio_driver virtio_blk = {
Expand Down
9 changes: 9 additions & 0 deletions trunk/drivers/char/hw_random/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,12 @@ config HW_RANDOM_PASEMI

If unsure, say Y.

config HW_RANDOM_VIRTIO
tristate "VirtIO Random Number Generator support"
depends on HW_RANDOM && VIRTIO
---help---
This driver provides kernel-side support for the virtual Random Number
Generator hardware.

To compile this driver as a module, choose M here: the
module will be called virtio-rng. If unsure, say N.
1 change: 1 addition & 0 deletions trunk/drivers/char/hw_random/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ obj-$(CONFIG_HW_RANDOM_VIA) += via-rng.o
obj-$(CONFIG_HW_RANDOM_IXP4XX) += ixp4xx-rng.o
obj-$(CONFIG_HW_RANDOM_OMAP) += omap-rng.o
obj-$(CONFIG_HW_RANDOM_PASEMI) += pasemi-rng.o
obj-$(CONFIG_HW_RANDOM_VIRTIO) += virtio-rng.o
155 changes: 155 additions & 0 deletions trunk/drivers/char/hw_random/virtio-rng.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
/*
* Randomness driver for virtio
* Copyright (C) 2007, 2008 Rusty Russell IBM Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <linux/err.h>
#include <linux/hw_random.h>
#include <linux/scatterlist.h>
#include <linux/spinlock.h>
#include <linux/virtio.h>
#include <linux/virtio_rng.h>

/* The host will fill any buffer we give it with sweet, sweet randomness. We
* give it 64 bytes at a time, and the hwrng framework takes it 4 bytes at a
* time. */
#define RANDOM_DATA_SIZE 64

static struct virtqueue *vq;
static u32 *random_data;
static unsigned int data_left;
static DECLARE_COMPLETION(have_data);

static void random_recv_done(struct virtqueue *vq)
{
int len;

/* We never get spurious callbacks. */
if (!vq->vq_ops->get_buf(vq, &len))
BUG();

data_left = len / sizeof(random_data[0]);
complete(&have_data);
}

static void register_buffer(void)
{
struct scatterlist sg;

sg_init_one(&sg, random_data, RANDOM_DATA_SIZE);
/* There should always be room for one buffer. */
if (vq->vq_ops->add_buf(vq, &sg, 0, 1, random_data) != 0)
BUG();
vq->vq_ops->kick(vq);
}

/* At least we don't udelay() in a loop like some other drivers. */
static int virtio_data_present(struct hwrng *rng, int wait)
{
if (data_left)
return 1;

if (!wait)
return 0;

wait_for_completion(&have_data);
return 1;
}

/* virtio_data_present() must have succeeded before this is called. */
static int virtio_data_read(struct hwrng *rng, u32 *data)
{
BUG_ON(!data_left);

*data = random_data[--data_left];

if (!data_left) {
init_completion(&have_data);
register_buffer();
}
return sizeof(*data);
}

static struct hwrng virtio_hwrng = {
.name = "virtio",
.data_present = virtio_data_present,
.data_read = virtio_data_read,
};

static int virtrng_probe(struct virtio_device *vdev)
{
int err;

/* We expect a single virtqueue. */
vq = vdev->config->find_vq(vdev, 0, random_recv_done);
if (IS_ERR(vq))
return PTR_ERR(vq);

err = hwrng_register(&virtio_hwrng);
if (err) {
vdev->config->del_vq(vq);
return err;
}

register_buffer();
return 0;
}

static void virtrng_remove(struct virtio_device *vdev)
{
vdev->config->reset(vdev);
hwrng_unregister(&virtio_hwrng);
vdev->config->del_vq(vq);
}

static struct virtio_device_id id_table[] = {
{ VIRTIO_ID_RNG, VIRTIO_DEV_ANY_ID },
{ 0 },
};

static struct virtio_driver virtio_rng = {
.driver.name = KBUILD_MODNAME,
.driver.owner = THIS_MODULE,
.id_table = id_table,
.probe = virtrng_probe,
.remove = __devexit_p(virtrng_remove),
};

static int __init init(void)
{
int err;

random_data = kmalloc(RANDOM_DATA_SIZE, GFP_KERNEL);
if (!random_data)
return -ENOMEM;

err = register_virtio_driver(&virtio_rng);
if (err)
kfree(random_data);
return err;
}

static void __exit fini(void)
{
kfree(random_data);
unregister_virtio_driver(&virtio_rng);
}
module_init(init);
module_exit(fini);

MODULE_DEVICE_TABLE(virtio, id_table);
MODULE_DESCRIPTION("Virtio random number driver");
MODULE_LICENSE("GPL");
2 changes: 2 additions & 0 deletions trunk/drivers/input/keyboard/atkbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,8 @@ static int atkbd_activate(struct atkbd *atkbd)
static void atkbd_cleanup(struct serio *serio)
{
struct atkbd *atkbd = serio_get_drvdata(serio);

atkbd_disable(atkbd);
ps2_command(&atkbd->ps2dev, NULL, ATKBD_CMD_RESET_BAT);
}

Expand Down
38 changes: 25 additions & 13 deletions trunk/drivers/input/keyboard/pxa27x_keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,24 +136,31 @@ static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad)
set_bit(code, input_dev->keybit);
}

for (i = 0; i < pdata->direct_key_num; i++)
set_bit(pdata->direct_key_map[i], input_dev->keybit);

keypad->rotary_up_key[0] = pdata->rotary0_up_key;
keypad->rotary_up_key[1] = pdata->rotary1_up_key;
keypad->rotary_down_key[0] = pdata->rotary0_down_key;
keypad->rotary_down_key[1] = pdata->rotary1_down_key;
keypad->rotary_rel_code[0] = pdata->rotary0_rel_code;
keypad->rotary_rel_code[1] = pdata->rotary1_rel_code;

if (pdata->rotary0_up_key && pdata->rotary0_down_key) {
set_bit(pdata->rotary0_up_key, input_dev->keybit);
set_bit(pdata->rotary0_down_key, input_dev->keybit);
} else
set_bit(pdata->rotary0_rel_code, input_dev->relbit);

if (pdata->rotary1_up_key && pdata->rotary1_down_key) {
set_bit(pdata->rotary1_up_key, input_dev->keybit);
set_bit(pdata->rotary1_down_key, input_dev->keybit);
} else
set_bit(pdata->rotary1_rel_code, input_dev->relbit);
if (pdata->enable_rotary0) {
if (pdata->rotary0_up_key && pdata->rotary0_down_key) {
set_bit(pdata->rotary0_up_key, input_dev->keybit);
set_bit(pdata->rotary0_down_key, input_dev->keybit);
} else
set_bit(pdata->rotary0_rel_code, input_dev->relbit);
}

if (pdata->enable_rotary1) {
if (pdata->rotary1_up_key && pdata->rotary1_down_key) {
set_bit(pdata->rotary1_up_key, input_dev->keybit);
set_bit(pdata->rotary1_down_key, input_dev->keybit);
} else
set_bit(pdata->rotary1_rel_code, input_dev->relbit);
}
}

static inline unsigned int lookup_matrix_keycode(
Expand Down Expand Up @@ -484,8 +491,13 @@ static int __devinit pxa27x_keypad_probe(struct platform_device *pdev)
keypad->input_dev = input_dev;
input_set_drvdata(input_dev, keypad);

input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) |
BIT_MASK(EV_REL);
input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
if ((keypad->pdata->enable_rotary0 &&
keypad->pdata->rotary0_rel_code) ||
(keypad->pdata->enable_rotary1 &&
keypad->pdata->rotary1_rel_code)) {
input_dev->evbit[0] |= BIT_MASK(EV_REL);
}

pxa27x_keypad_build_keycode(keypad);
platform_set_drvdata(pdev, keypad);
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/input/misc/apanel.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <linux/module.h>
#include <linux/ioport.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/input-polldev.h>
#include <linux/i2c.h>
#include <linux/workqueue.h>
Expand Down
7 changes: 7 additions & 0 deletions trunk/drivers/input/serio/i8042-x86ia64io.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,13 @@ static struct dmi_system_id __initdata i8042_dmi_dritek_table[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 9110"),
},
},
{
.ident = "Acer TravelMate 660",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 660"),
},
},
{
.ident = "Acer TravelMate 2490",
.matches = {
Expand Down
Loading

0 comments on commit 800be79

Please sign in to comment.