|
@@ -62,8 +62,8 @@ typedef uint8_t u8;
|
|
#endif
|
|
#endif
|
|
/* We can have up to 256 pages for devices. */
|
|
/* We can have up to 256 pages for devices. */
|
|
#define DEVICE_PAGES 256
|
|
#define DEVICE_PAGES 256
|
|
-/* This fits nicely in a single 4096-byte page. */
|
|
|
|
-#define VIRTQUEUE_NUM 127
|
|
|
|
|
|
+/* This will occupy 2 pages: it must be a power of 2. */
|
|
|
|
+#define VIRTQUEUE_NUM 128
|
|
|
|
|
|
/*L:120 verbose is both a global flag and a macro. The C preprocessor allows
|
|
/*L:120 verbose is both a global flag and a macro. The C preprocessor allows
|
|
* this, and although I wouldn't recommend it, it works quite nicely here. */
|
|
* this, and although I wouldn't recommend it, it works quite nicely here. */
|
|
@@ -1036,7 +1036,8 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs,
|
|
void *p;
|
|
void *p;
|
|
|
|
|
|
/* First we need some pages for this virtqueue. */
|
|
/* First we need some pages for this virtqueue. */
|
|
- pages = (vring_size(num_descs) + getpagesize() - 1) / getpagesize();
|
|
|
|
|
|
+ pages = (vring_size(num_descs, getpagesize()) + getpagesize() - 1)
|
|
|
|
+ / getpagesize();
|
|
p = get_pages(pages);
|
|
p = get_pages(pages);
|
|
|
|
|
|
/* Initialize the configuration. */
|
|
/* Initialize the configuration. */
|
|
@@ -1045,7 +1046,7 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs,
|
|
vq->config.pfn = to_guest_phys(p) / getpagesize();
|
|
vq->config.pfn = to_guest_phys(p) / getpagesize();
|
|
|
|
|
|
/* Initialize the vring. */
|
|
/* Initialize the vring. */
|
|
- vring_init(&vq->vring, num_descs, p);
|
|
|
|
|
|
+ vring_init(&vq->vring, num_descs, p, getpagesize());
|
|
|
|
|
|
/* Add the configuration information to this device's descriptor. */
|
|
/* Add the configuration information to this device's descriptor. */
|
|
add_desc_field(dev, VIRTIO_CONFIG_F_VIRTQUEUE,
|
|
add_desc_field(dev, VIRTIO_CONFIG_F_VIRTQUEUE,
|