virtio-ccw: complete handling of guest-initiated resets
For a guest-initiated reset, we need to not only reset the virtio device, but also reset the VirtioCcwDevice into a clean state. This includes resetting the indicators, or else a guest will not be able to e.g. switch from classic interrupts to adapter interrupts. Split off this routine into a new function virtio_ccw_reset_virtio() to make the distinction between resetting the virtio-related devices and the base subchannel device clear. CC: qemu-stable@nongnu.org Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> (cherry picked from commitfa8b0ca5d1) Conflicts: hw/s390x/virtio-ccw.c *removed context dependency on0b352fdSigned-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
This commit is contained in:
		
							parent
							
								
									81cb0a5657
								
							
						
					
					
						commit
						e8248a5af1
					
				|  | @ -295,6 +295,25 @@ static int virtio_ccw_set_vqs(SubchDev *sch, uint64_t addr, uint32_t align, | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | static void virtio_ccw_reset_virtio(VirtioCcwDevice *dev, VirtIODevice *vdev) | ||||||
|  | { | ||||||
|  |     virtio_ccw_stop_ioeventfd(dev); | ||||||
|  |     virtio_reset(vdev); | ||||||
|  |     if (dev->indicators) { | ||||||
|  |         release_indicator(&dev->routes.adapter, dev->indicators); | ||||||
|  |         dev->indicators = NULL; | ||||||
|  |     } | ||||||
|  |     if (dev->indicators2) { | ||||||
|  |         release_indicator(&dev->routes.adapter, dev->indicators2); | ||||||
|  |         dev->indicators2 = NULL; | ||||||
|  |     } | ||||||
|  |     if (dev->summary_indicator) { | ||||||
|  |         release_indicator(&dev->routes.adapter, dev->summary_indicator); | ||||||
|  |         dev->summary_indicator = NULL; | ||||||
|  |     } | ||||||
|  |     dev->sch->thinint_active = false; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) | static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) | ||||||
| { | { | ||||||
|     int ret; |     int ret; | ||||||
|  | @ -351,8 +370,7 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) | ||||||
|         } |         } | ||||||
|         break; |         break; | ||||||
|     case CCW_CMD_VDEV_RESET: |     case CCW_CMD_VDEV_RESET: | ||||||
|         virtio_ccw_stop_ioeventfd(dev); |         virtio_ccw_reset_virtio(dev, vdev); | ||||||
|         virtio_reset(vdev); |  | ||||||
|         ret = 0; |         ret = 0; | ||||||
|         break; |         break; | ||||||
|     case CCW_CMD_READ_FEAT: |     case CCW_CMD_READ_FEAT: | ||||||
|  | @ -480,7 +498,7 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) | ||||||
|             } |             } | ||||||
|             virtio_set_status(vdev, status); |             virtio_set_status(vdev, status); | ||||||
|             if (vdev->status == 0) { |             if (vdev->status == 0) { | ||||||
|                 virtio_reset(vdev); |                 virtio_ccw_reset_virtio(dev, vdev); | ||||||
|             } |             } | ||||||
|             if (status & VIRTIO_CONFIG_S_DRIVER_OK) { |             if (status & VIRTIO_CONFIG_S_DRIVER_OK) { | ||||||
|                 virtio_ccw_start_ioeventfd(dev); |                 virtio_ccw_start_ioeventfd(dev); | ||||||
|  | @ -1098,21 +1116,8 @@ static void virtio_ccw_reset(DeviceState *d) | ||||||
|     VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d); |     VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d); | ||||||
|     VirtIODevice *vdev = virtio_bus_get_device(&dev->bus); |     VirtIODevice *vdev = virtio_bus_get_device(&dev->bus); | ||||||
| 
 | 
 | ||||||
|     virtio_ccw_stop_ioeventfd(dev); |     virtio_ccw_reset_virtio(dev, vdev); | ||||||
|     virtio_reset(vdev); |  | ||||||
|     css_reset_sch(dev->sch); |     css_reset_sch(dev->sch); | ||||||
|     if (dev->indicators) { |  | ||||||
|         release_indicator(&dev->routes.adapter, dev->indicators); |  | ||||||
|         dev->indicators = NULL; |  | ||||||
|     } |  | ||||||
|     if (dev->indicators2) { |  | ||||||
|         release_indicator(&dev->routes.adapter, dev->indicators2); |  | ||||||
|         dev->indicators2 = NULL; |  | ||||||
|     } |  | ||||||
|     if (dev->summary_indicator) { |  | ||||||
|         release_indicator(&dev->routes.adapter, dev->summary_indicator); |  | ||||||
|         dev->summary_indicator = NULL; |  | ||||||
|     } |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void virtio_ccw_vmstate_change(DeviceState *d, bool running) | static void virtio_ccw_vmstate_change(DeviceState *d, bool running) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Cornelia Huck
						Cornelia Huck