summaryrefslogtreecommitdiff
path: root/usr.sbin/vmd
diff options
context:
space:
mode:
authorMike Larkin <mlarkin@cvs.openbsd.org>2018-07-09 08:43:10 +0000
committerMike Larkin <mlarkin@cvs.openbsd.org>2018-07-09 08:43:10 +0000
commitded0cc36256ed91eda5bbb71a6a6b446008689f3 (patch)
tree48a8cd86127b0f335b8ced10c182a787bf816e90 /usr.sbin/vmd
parent4c35ce156c41e93e7570eb2e6aa08bde765a1a0d (diff)
vmd(8): stash device IRQ in the device struct
ok kettenis
Diffstat (limited to 'usr.sbin/vmd')
-rw-r--r--usr.sbin/vmd/virtio.c11
-rw-r--r--usr.sbin/vmd/virtio.h10
-rw-r--r--usr.sbin/vmd/vmd.h4
3 files changed, 18 insertions, 7 deletions
diff --git a/usr.sbin/vmd/virtio.c b/usr.sbin/vmd/virtio.c
index 4452cfcbb53..599dda467bf 100644
--- a/usr.sbin/vmd/virtio.c
+++ b/usr.sbin/vmd/virtio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: virtio.c,v 1.61 2018/06/19 17:12:34 reyk Exp $ */
+/* $OpenBSD: virtio.c,v 1.62 2018/07/09 08:43:09 mlarkin Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
@@ -1769,6 +1769,7 @@ virtio_init(struct vmd_vm *vm, int child_cdrom, int *child_disks,
sizeof(struct vring_desc) * VIORND_QUEUE_SIZE
+ sizeof(uint16_t) * (2 + VIORND_QUEUE_SIZE));
viornd.pci_id = id;
+ viornd.irq = pci_get_dev_irq(id);
if (vcp->vcp_ndisks > 0) {
nr_vioblk = vcp->vcp_ndisks;
@@ -1812,6 +1813,7 @@ virtio_init(struct vmd_vm *vm, int child_cdrom, int *child_disks,
vioblk[i].cfg.device_feature = VIRTIO_BLK_F_SIZE_MAX;
vioblk[i].max_xfer = 1048576;
vioblk[i].pci_id = id;
+ vioblk[i].irq = pci_get_dev_irq(id);
}
}
@@ -1942,6 +1944,7 @@ virtio_init(struct vmd_vm *vm, int child_cdrom, int *child_disks,
vioscsi->n_blocks = sz >> 11; /* num of 2048 blocks in file */
vioscsi->max_xfer = VIOSCSI_BLOCK_SIZE_CDROM;
vioscsi->pci_id = id;
+ vioscsi->irq = pci_get_dev_irq(id);
}
/* virtio control device */
@@ -1993,7 +1996,7 @@ vmmci_restore(int fd, uint32_t vm_id)
}
int
-viornd_restore(int fd)
+viornd_restore(int fd, struct vm_create_params *vcp)
{
log_debug("%s: receiving viornd", __func__);
if (atomicio(read, fd, &viornd, sizeof(viornd)) != sizeof(viornd)) {
@@ -2005,6 +2008,8 @@ viornd_restore(int fd)
__progname);
return (-1);
}
+ viornd.vm_id = vcp->vcp_id;
+
return (0);
}
@@ -2146,7 +2151,7 @@ virtio_restore(int fd, struct vmd_vm *vm, int child_cdrom, int *child_disks,
struct vm_create_params *vcp = &vmc->vmc_params;
int ret;
- if ((ret = viornd_restore(fd)) == -1)
+ if ((ret = viornd_restore(fd, vcp)) == -1)
return ret;
if ((ret = vioblk_restore(fd, vcp, child_disks)) == -1)
diff --git a/usr.sbin/vmd/virtio.h b/usr.sbin/vmd/virtio.h
index 502a619e582..20327f9915c 100644
--- a/usr.sbin/vmd/virtio.h
+++ b/usr.sbin/vmd/virtio.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: virtio.h,v 1.25 2018/04/26 15:59:12 mlarkin Exp $ */
+/* $OpenBSD: virtio.h,v 1.26 2018/07/09 08:43:09 mlarkin Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
@@ -139,6 +139,8 @@ struct viornd_dev {
struct virtio_vq_info vq[VIRTIO_MAX_QUEUES];
uint8_t pci_id;
+ int irq;
+ uint32_t vm_id;
};
struct vioblk_dev {
@@ -151,6 +153,8 @@ struct vioblk_dev {
uint32_t max_xfer;
uint8_t pci_id;
+ int irq;
+ uint32_t vm_id;
};
/* vioscsi will use at least 3 queues - 5.6.2 Virtqueues
@@ -176,6 +180,8 @@ struct vioscsi_dev {
uint32_t max_xfer;
uint8_t pci_id;
+ uint32_t vm_id;
+ int irq;
};
struct vionet_dev {
@@ -250,7 +256,7 @@ uint32_t vring_size(uint32_t);
int virtio_rnd_io(int, uint16_t, uint32_t *, uint8_t *, void *, uint8_t);
int viornd_dump(int);
-int viornd_restore(int);
+int viornd_restore(int, struct vm_create_params *);
void viornd_update_qs(void);
void viornd_update_qa(void);
int viornd_notifyq(void);
diff --git a/usr.sbin/vmd/vmd.h b/usr.sbin/vmd/vmd.h
index 27c17edb187..4daf3def8c7 100644
--- a/usr.sbin/vmd/vmd.h
+++ b/usr.sbin/vmd/vmd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmd.h,v 1.69 2018/06/26 10:00:08 reyk Exp $ */
+/* $OpenBSD: vmd.h,v 1.70 2018/07/09 08:43:09 mlarkin Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
@@ -172,7 +172,7 @@ struct vm_dump_header {
#define VM_DUMP_SIGNATURE VMM_HV_SIGNATURE
uint8_t vmh_pad[3];
uint8_t vmh_version;
-#define VM_DUMP_VERSION 3
+#define VM_DUMP_VERSION 4
struct vm_dump_header_cpuid
vmh_cpuids[VM_DUMP_HEADER_CPUID_COUNT];
} __packed;