summaryrefslogtreecommitdiff
path: root/usr.sbin/vmd/virtio.c
diff options
context:
space:
mode:
authorDave Voutila <dv@cvs.openbsd.org>2023-11-03 11:16:44 +0000
committerDave Voutila <dv@cvs.openbsd.org>2023-11-03 11:16:44 +0000
commitc8dd65c3983adf434c0db95801592305d2e27e67 (patch)
tree7debe4906a12be68dfdae598164b763152138b95 /usr.sbin/vmd/virtio.c
parentb80e063ec1cffc6d6b555c120a9432876c848c42 (diff)
vmd(8): fix block size calculation for vioscsi devices.
During the multi-process rework, I changed the way disk sizes are calculated, switching to storing bytes and not 512-byte blocks. The size calculation from reading an iso did not receive the change in scaling, resulting in the virtio scsi emulation to think iso's are larger than reality. This fixes booting the latest Ubuntu amd64 iso's as apparently there's some program that tries to arbitrarily read the tail end of the iso into memory. ok mlarkin@
Diffstat (limited to 'usr.sbin/vmd/virtio.c')
-rw-r--r--usr.sbin/vmd/virtio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/vmd/virtio.c b/usr.sbin/vmd/virtio.c
index e4795cfb7e7..cca6e041046 100644
--- a/usr.sbin/vmd/virtio.c
+++ b/usr.sbin/vmd/virtio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: virtio.c,v 1.109 2023/09/26 01:53:54 dv Exp $ */
+/* $OpenBSD: virtio.c,v 1.110 2023/11/03 11:16:43 dv Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
@@ -719,7 +719,7 @@ virtio_init(struct vmd_vm *vm, int child_cdrom,
}
vioscsi->locked = 0;
vioscsi->lba = 0;
- vioscsi->n_blocks = vioscsi->sz >> 2; /* num of 2048 blocks in file */
+ vioscsi->n_blocks = vioscsi->sz / VIOSCSI_BLOCK_SIZE_CDROM;
vioscsi->max_xfer = VIOSCSI_BLOCK_SIZE_CDROM;
vioscsi->pci_id = id;
vioscsi->vm_id = vcp->vcp_id;