[SLOF] [PATCH v1 13/27] virtio: make virtio_set_status 1.0 aware
Nikunj A Dadhania
nikunj at linux.vnet.ibm.com
Wed Jan 13 22:17:00 AEDT 2016
Make virtio_device_reset use virtio_set_status.
Signed-off-by: Nikunj A Dadhania <nikunj at linux.vnet.ibm.com>
---
lib/libvirtio/virtio.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/lib/libvirtio/virtio.c b/lib/libvirtio/virtio.c
index 993e9cc..746c825 100644
--- a/lib/libvirtio/virtio.c
+++ b/lib/libvirtio/virtio.c
@@ -320,9 +320,7 @@ void virtio_fill_desc(struct vring_desc *desc,
*/
void virtio_reset_device(struct virtio_device *dev)
{
- if (dev->type == VIRTIO_TYPE_PCI) {
- ci_write_8(dev->base+VIRTIOHDR_DEVICE_STATUS, 0);
- }
+ virtio_set_status(dev, 0);
}
@@ -373,12 +371,15 @@ int virtio_queue_init_vq(struct virtio_device *dev, struct vqs *vq, unsigned int
*/
void virtio_set_status(struct virtio_device *dev, int status)
{
- if (dev->type == VIRTIO_TYPE_PCI) {
+ if (dev->type != VIRTIO_TYPE_PCI)
+ return;
+ if (dev->is_modern) {
+ ci_write_8(dev->common.addr +
+ offset_of(struct virtio_dev_common, dev_status), status);
+ } else
ci_write_8(dev->base+VIRTIOHDR_DEVICE_STATUS, status);
- }
}
-
/**
* Set guest feature bits
*/
--
2.5.0
More information about the SLOF
mailing list