Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/virtio.h
Show First 20 Lines • Show All 281 Lines • ▼ Show 20 Lines | vring_size(u_int qsz) | ||||
size = roundup2(size, VRING_ALIGN); | size = roundup2(size, VRING_ALIGN); | ||||
return (size); | return (size); | ||||
} | } | ||||
struct vmctx; | struct vmctx; | ||||
struct pci_devinst; | struct pci_devinst; | ||||
struct vqueue_info; | struct vqueue_info; | ||||
struct vm_snapshot_meta; | |||||
/* | /* | ||||
* A virtual device, with some number (possibly 0) of virtual | * A virtual device, with some number (possibly 0) of virtual | ||||
* queues and some size (possibly 0) of configuration-space | * queues and some size (possibly 0) of configuration-space | ||||
* registers private to the device. The virtio_softc should come | * registers private to the device. The virtio_softc should come | ||||
* at the front of each "derived class", so that a pointer to the | * at the front of each "derived class", so that a pointer to the | ||||
* virtio_softc is also a pointer to the more specific, derived- | * virtio_softc is also a pointer to the more specific, derived- | ||||
* from-virtio driver's softc. | * from-virtio driver's softc. | ||||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | void (*vc_qnotify)(void *, struct vqueue_info *); | ||||
/* called on QNOTIFY if no VQ notify */ | /* called on QNOTIFY if no VQ notify */ | ||||
int (*vc_cfgread)(void *, int, int, uint32_t *); | int (*vc_cfgread)(void *, int, int, uint32_t *); | ||||
/* called to read config regs */ | /* called to read config regs */ | ||||
int (*vc_cfgwrite)(void *, int, int, uint32_t); | int (*vc_cfgwrite)(void *, int, int, uint32_t); | ||||
/* called to write config regs */ | /* called to write config regs */ | ||||
void (*vc_apply_features)(void *, uint64_t); | void (*vc_apply_features)(void *, uint64_t); | ||||
/* called to apply negotiated features */ | /* called to apply negotiated features */ | ||||
uint64_t vc_hv_caps; /* hypervisor-provided capabilities */ | uint64_t vc_hv_caps; /* hypervisor-provided capabilities */ | ||||
void (*vc_pause)(void *); /* called to pause device activity */ | |||||
void (*vc_resume)(void *); /* called to resume device activity */ | |||||
int (*vc_snapshot)(void *, struct vm_snapshot_meta *); | |||||
/* called to save / restore device state */ | |||||
}; | }; | ||||
/* | /* | ||||
* Data structure allocated (statically) per virtual queue. | * Data structure allocated (statically) per virtual queue. | ||||
* | * | ||||
* Drivers may change vq_qsize after a reset. When the guest OS | * Drivers may change vq_qsize after a reset. When the guest OS | ||||
* requests a device reset, the hypervisor first calls | * requests a device reset, the hypervisor first calls | ||||
* vs->vs_vc->vc_reset(); then the data structure below is | * vs->vs_vc->vc_reset(); then the data structure below is | ||||
▲ Show 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | |||||
void vq_relchain_publish(struct vqueue_info *vq); | void vq_relchain_publish(struct vqueue_info *vq); | ||||
void vq_relchain(struct vqueue_info *vq, uint16_t idx, uint32_t iolen); | void vq_relchain(struct vqueue_info *vq, uint16_t idx, uint32_t iolen); | ||||
void vq_endchains(struct vqueue_info *vq, int used_all_avail); | void vq_endchains(struct vqueue_info *vq, int used_all_avail); | ||||
uint64_t vi_pci_read(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, | uint64_t vi_pci_read(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, | ||||
int baridx, uint64_t offset, int size); | int baridx, uint64_t offset, int size); | ||||
void vi_pci_write(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, | void vi_pci_write(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, | ||||
int baridx, uint64_t offset, int size, uint64_t value); | int baridx, uint64_t offset, int size, uint64_t value); | ||||
#ifdef BHYVE_SNAPSHOT | |||||
int vi_pci_snapshot(struct vm_snapshot_meta *meta); | |||||
int vi_pci_pause(struct vmctx *ctx, struct pci_devinst *pi); | |||||
int vi_pci_resume(struct vmctx *ctx, struct pci_devinst *pi); | |||||
#endif | |||||
#endif /* _VIRTIO_H_ */ | #endif /* _VIRTIO_H_ */ |