Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 123976
b: refs/heads/master
c: 2966af7
h: refs/heads/master
v: v3
  • Loading branch information
Rusty Russell committed Dec 29, 2008
1 parent 48b3509 commit 3a58ca7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 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: 498af14783935af487d17dbee4ac451783cbc2b7
refs/heads/master: 2966af73e70dee461c256b5eb877b2ff757f8c82
6 changes: 3 additions & 3 deletions trunk/Documentation/lguest/lguest.c
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ static void update_device_status(struct device *dev)
/* Zero out the virtqueues. */
for (vq = dev->vq; vq; vq = vq->next) {
memset(vq->vring.desc, 0,
vring_size(vq->config.num, getpagesize()));
vring_size(vq->config.num, LGUEST_VRING_ALIGN));
lg_last_avail(vq) = 0;
}
} else if (dev->desc->status & VIRTIO_CONFIG_S_FAILED) {
Expand Down Expand Up @@ -1211,7 +1211,7 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs,
void *p;

/* First we need some memory for this virtqueue. */
pages = (vring_size(num_descs, getpagesize()) + getpagesize() - 1)
pages = (vring_size(num_descs, LGUEST_VRING_ALIGN) + getpagesize() - 1)
/ getpagesize();
p = get_pages(pages);

Expand All @@ -1228,7 +1228,7 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs,
vq->config.pfn = to_guest_phys(p) / getpagesize();

/* Initialize the vring. */
vring_init(&vq->vring, num_descs, p, getpagesize());
vring_init(&vq->vring, num_descs, p, LGUEST_VRING_ALIGN);

/* Append virtqueue to this device's descriptor. We use
* device_config() to get the end of the device's current virtqueues;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/lguest/lguest_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ static struct virtqueue *lg_find_vq(struct virtio_device *vdev,
/* Figure out how many pages the ring will take, and map that memory */
lvq->pages = lguest_map((unsigned long)lvq->config.pfn << PAGE_SHIFT,
DIV_ROUND_UP(vring_size(lvq->config.num,
PAGE_SIZE),
LGUEST_VRING_ALIGN),
PAGE_SIZE));
if (!lvq->pages) {
err = -ENOMEM;
Expand Down
4 changes: 4 additions & 0 deletions trunk/include/linux/lguest_launcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,8 @@ enum lguest_req
LHREQ_IRQ, /* + irq */
LHREQ_BREAK, /* + on/off flag (on blocks until someone does off) */
};

/* The alignment to use between consumer and producer parts of vring.
* x86 pagesize for historical reasons. */
#define LGUEST_VRING_ALIGN 4096
#endif /* _LINUX_LGUEST_LAUNCHER */

0 comments on commit 3a58ca7

Please sign in to comment.