aboutsummaryrefslogtreecommitdiffstats
path: root/src/hw/virtio-blk.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-07-11 12:30:26 -0400
committerKevin O'Connor <kevin@koconnor.net>2017-09-27 19:02:34 -0400
commitf3d2a156448f006e5d83eb60cb1da2dea6c997bf (patch)
tree618e0b3a309bbd60ea8cf4b713091a269d302aa3 /src/hw/virtio-blk.c
parente5a0b6163703627728f978d079d8c5f449af5fdd (diff)
downloadseabios-f3d2a156448f006e5d83eb60cb1da2dea6c997bf.tar.gz
virtio: Allocate drive_s storage in low memory
Use the "low" memory segment instead of the f-segment for the drive_s storage. This can help avoid running out of memory in the f-segment. Tested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/hw/virtio-blk.c')
-rw-r--r--src/hw/virtio-blk.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/hw/virtio-blk.c b/src/hw/virtio-blk.c
index ad162007..88d7e54a 100644
--- a/src/hw/virtio-blk.c
+++ b/src/hw/virtio-blk.c
@@ -32,9 +32,9 @@ struct virtiodrive_s {
static int
virtio_blk_op(struct disk_op_s *op, int write)
{
- struct virtiodrive_s *vdrive_gf =
+ struct virtiodrive_s *vdrive =
container_of(op->drive_fl, struct virtiodrive_s, drive);
- struct vring_virtqueue *vq = vdrive_gf->vq;
+ struct vring_virtqueue *vq = vdrive->vq;
struct virtio_blk_outhdr hdr = {
.type = write ? VIRTIO_BLK_T_OUT : VIRTIO_BLK_T_IN,
.ioprio = 0,
@@ -48,7 +48,7 @@ virtio_blk_op(struct disk_op_s *op, int write)
},
{
.addr = op->buf_fl,
- .length = vdrive_gf->drive.blksize * op->count,
+ .length = vdrive->drive.blksize * op->count,
},
{
.addr = (void*)(&status),
@@ -61,7 +61,7 @@ virtio_blk_op(struct disk_op_s *op, int write)
vring_add_buf(vq, sg, 2, 1, 0, 0);
else
vring_add_buf(vq, sg, 1, 2, 0, 0);
- vring_kick(&vdrive_gf->vp, vq, 1);
+ vring_kick(&vdrive->vp, vq, 1);
/* Wait for reply */
while (!vring_more_used(vq))
@@ -73,7 +73,7 @@ virtio_blk_op(struct disk_op_s *op, int write)
/* Clear interrupt status register. Avoid leaving interrupts stuck if
* VRING_AVAIL_F_NO_INTERRUPT was ignored and interrupts were raised.
*/
- vp_get_isr(&vdrive_gf->vp);
+ vp_get_isr(&vdrive->vp);
return status == VIRTIO_BLK_S_OK ? DISK_RET_SUCCESS : DISK_RET_EBADTRACK;
}
@@ -99,7 +99,7 @@ init_virtio_blk(void *data)
struct pci_device *pci = data;
u8 status = VIRTIO_CONFIG_S_ACKNOWLEDGE | VIRTIO_CONFIG_S_DRIVER;
dprintf(1, "found virtio-blk at %pP\n", pci);
- struct virtiodrive_s *vdrive = malloc_fseg(sizeof(*vdrive));
+ struct virtiodrive_s *vdrive = malloc_low(sizeof(*vdrive));
if (!vdrive) {
warn_noalloc();
return;