public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Eric Auger <eric.auger@linaro.org>
Cc: eric.auger@st.com, christoffer.dall@linaro.org,
	linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, agraf@suse.de,
	b.reynal@virtualopensystems.com, linux-kernel@vger.kernel.org,
	patches@linaro.org, Bharat.Bhushan@freescale.com
Subject: Re: [RFC 1/3] VFIO: platform: add reset support
Date: Fri, 17 Apr 2015 08:29:11 -0600	[thread overview]
Message-ID: <1429280951.10086.50.camel@redhat.com> (raw)
In-Reply-To: <1429277833-28663-2-git-send-email-eric.auger@linaro.org>

On Fri, 2015-04-17 at 15:37 +0200, Eric Auger wrote:
> This patch adds support for vfio platform reset. The modality only is
> exposed when a specialized VFIO driver populates the reset callback.
> For the generic vfio platform/amba driver, the modality is not supported
> since the driver is by essence a metadriver and does not know how to
> reset the underlying device.
> 
> Signed-off-by: Eric Auger <eric.auger@linaro.org>
> ---
>  drivers/vfio/platform/vfio_platform_common.c  | 12 ++++++++++--
>  drivers/vfio/platform/vfio_platform_private.h |  1 +
>  2 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c
> index 4113d46..b989ce5 100644
> --- a/drivers/vfio/platform/vfio_platform_common.c
> +++ b/drivers/vfio/platform/vfio_platform_common.c
> @@ -100,6 +100,8 @@ static void vfio_platform_release(void *device_data)
>  	mutex_lock(&driver_lock);
>  
>  	if (!(--vdev->refcnt)) {
> +		if (vdev->reset)
> +			vdev->reset(vdev);
>  		vfio_platform_regions_cleanup(vdev);
>  		vfio_platform_irq_cleanup(vdev);
>  	}
> @@ -159,6 +161,8 @@ static long vfio_platform_ioctl(void *device_data,
>  		if (info.argsz < minsz)
>  			return -EINVAL;
>  
> +		if (vdev->reset)
> +			vdev->flags |= VFIO_DEVICE_FLAGS_RESET;
>  		info.flags = vdev->flags;
>  		info.num_regions = vdev->num_regions;
>  		info.num_irqs = vdev->num_irqs;
> @@ -252,8 +256,12 @@ static long vfio_platform_ioctl(void *device_data,
>  
>  		return ret;
>  
> -	} else if (cmd == VFIO_DEVICE_RESET)
> -		return -EINVAL;
> +	} else if (cmd == VFIO_DEVICE_RESET) {
> +		if (vdev->reset)
> +			return vdev->reset(vdev);
> +		else
> +			return -ENOTTY;

nit, this should probably still return -EINVAL.  The ioctl is there, but
it's unsupported for this device as the user should have learned from
the above flags.  It's therefore not lack of an ioctl, but invalid use
of an ioctl.

> +	}
>  
>  	return -ENOTTY;
>  }
> diff --git a/drivers/vfio/platform/vfio_platform_private.h b/drivers/vfio/platform/vfio_platform_private.h
> index 253caa3..0a20028 100644
> --- a/drivers/vfio/platform/vfio_platform_private.h
> +++ b/drivers/vfio/platform/vfio_platform_private.h
> @@ -68,6 +68,7 @@ struct vfio_platform_device {
>  	struct resource*
>  		(*get_resource)(struct vfio_platform_device *vdev, int i);
>  	int	(*get_irq)(struct vfio_platform_device *vdev, int i);
> +	int	(*reset)(struct vfio_platform_device *vdev);
>  };
>  
>  extern int vfio_platform_probe_common(struct vfio_platform_device *vdev,




  reply	other threads:[~2015-04-17 14:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-17 13:37 [RFC 0/3] VFIO platform reset Eric Auger
2015-04-17 13:37 ` [RFC 1/3] VFIO: platform: add reset support Eric Auger
2015-04-17 14:29   ` Alex Williamson [this message]
2015-04-17 13:37 ` [RFC 2/3] VFIO: platform: export platform callbacks, probe and remove Eric Auger
2015-04-17 14:29   ` Alex Williamson
2015-04-17 13:37 ` [RFC 3/3] VFIO: platform: add vfio-platform-calxedaxgmac driver Eric Auger
2015-04-17 14:29   ` Alex Williamson
2015-04-17 15:01     ` Eric Auger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1429280951.10086.50.camel@redhat.com \
    --to=alex.williamson@redhat.com \
    --cc=Bharat.Bhushan@freescale.com \
    --cc=agraf@suse.de \
    --cc=b.reynal@virtualopensystems.com \
    --cc=christoffer.dall@linaro.org \
    --cc=eric.auger@linaro.org \
    --cc=eric.auger@st.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox