dm/VBS-U: implement virtio_dev_error
When the device has experienced an error from which it cannot re-cover, DEVICE_NEEDS_RESET is set to the device status register and a config change intr is sent to the guest driver. Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com> Reviewed-by: Hao Li <hao.l.li@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
ce098260de
commit
0398498846
|
@ -1008,6 +1008,19 @@ virtio_set_modern_bar(struct virtio_base *base, bool use_notify_pio)
|
|||
return rc;
|
||||
}
|
||||
|
||||
void
|
||||
virtio_dev_error(struct virtio_base *base)
|
||||
{
|
||||
if (base->negotiated_caps & VIRTIO_F_VERSION_1) {
|
||||
/* see 2.1.2. if DRIVER_OK is set, need to send
|
||||
* a device configuration change notification to the driver
|
||||
*/
|
||||
base->status |= VIRTIO_CR_STATUS_NEEDS_RESET;
|
||||
if (base->status & VIRTIO_CR_STATUS_DRIVER_OK)
|
||||
virtio_config_changed(base);
|
||||
}
|
||||
}
|
||||
|
||||
static struct cap_region {
|
||||
uint64_t cap_offset; /* offset of capability region */
|
||||
int cap_size; /* size of capability region */
|
||||
|
|
|
@ -841,6 +841,19 @@ uint64_t virtio_pci_read(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
|
|||
void virtio_pci_write(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
|
||||
int baridx, uint64_t offset, int size, uint64_t value);
|
||||
|
||||
/**
|
||||
* @brief Indicate the device has experienced an error.
|
||||
*
|
||||
* This is called when the device has experienced an error from which it
|
||||
* cannot re-cover. DEVICE_NEEDS_RESET is set to the device status register
|
||||
* and a config change intr is sent to the guest driver.
|
||||
*
|
||||
* @param base Pointer to struct virtio_base.
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void virtio_dev_error(struct virtio_base *base);
|
||||
|
||||
/**
|
||||
* @brief Set modern BAR (usually 4) to map PCI config registers.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue