On Wed, Nov 27, 2013 at 11:32:40AM +0100, Heinz Graalfs wrote:
> Code is added to the notify handler to set the 'surprize_removal' flag
> in virtio_device in case a CIO_GONE notification occurs. The remove
> callback of the backend driver must check this flag in order to perform
> special processing for a lost device.
> 
> Signed-off-by: Heinz Graalfs <[email protected]>
> ---
>  drivers/s390/kvm/virtio_ccw.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c
> index 35b9aaa..8f6c74a 100644
> --- a/drivers/s390/kvm/virtio_ccw.c
> +++ b/drivers/s390/kvm/virtio_ccw.c
> @@ -27,6 +27,7 @@
>  #include <linux/module.h>
>  #include <linux/io.h>
>  #include <linux/kvm_para.h>
> +#include <linux/notifier.h>
>  #include <asm/setup.h>
>  #include <asm/irq.h>
>  #include <asm/cio.h>
> @@ -1064,8 +1065,19 @@ out_free:
>  
>  static int virtio_ccw_cio_notify(struct ccw_device *cdev, int event)
>  {
> -     /* TODO: Check whether we need special handling here. */
> -     return 0;
> +     int rc;
> +     struct virtio_ccw_device *vcdev = dev_get_drvdata(&cdev->dev);
> +
> +     switch (event) {
> +     case CIO_GONE:
> +             vcdev->vdev.surprize_removal = true;
> +             rc = NOTIFY_DONE;
> +             break;
> +     default:
> +             rc = NOTIFY_DONE;
> +             break;
> +     }
> +     return rc;
>  }
>  

So again, this seems to mean there is some serialization with
device unregistration?
Otherwise how do we know using dev_get_drvdata is safe?


>  static struct ccw_device_id virtio_ids[] = {
> -- 
> 1.8.3.1
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Reply via email to