[RFC PATCH v2 2/3] drm/i915/gvt: Introduce enable_direct_flip attribute
Zhenyu Wang
zhenyuw at linux.intel.com
Mon May 13 03:29:14 UTC 2019
On 2019.05.10 12:15:27 +0800, Tina Zhang wrote:
> This attribute is introduced to work as a switch of the gvt-g vGPU direct
> flip function. Userspace can simply switch on/off the direct flip
> function by echoing 1/0 to this attributte.
>
> Signed-off-by: Tina Zhang <tina.zhang at intel.com>
> ---
I do not think this is appropriate interface which doesn't align with
vGPU lifecycle and also doesn't work together with control state of vfio
gfx ioctl. Why this?
> drivers/gpu/drm/i915/gvt/kvmgt.c | 38 ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 38 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
> index a68addf..2911818 100644
> --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> @@ -1581,12 +1581,50 @@ hw_id_show(struct device *dev, struct device_attribute *attr,
> return sprintf(buf, "\n");
> }
>
> +static ssize_t
> +enable_direct_flip_show(struct device *dev, struct device_attribute *attr,
> + char *buf)
> +{
> + struct mdev_device *mdev = mdev_from_dev(dev);
> +
> + if (mdev) {
> + struct intel_vgpu *vgpu = (struct intel_vgpu *)
> + mdev_get_drvdata(mdev);
> + return sprintf(buf, "%u\n",
> + vgpu->display.shadow_fbs.enable_direct_flip);
> + }
> + return sprintf(buf, "\n");
> +}
> +
> +static ssize_t
> +enable_direct_flip_store(struct device *dev, struct device_attribute *attr,
> + const char *buf, size_t n)
> +{
> + struct mdev_device *mdev = mdev_from_dev(dev);
> + ssize_t ret;
> + u32 val;
> +
> + ret = kstrtou32(buf, 0, &val);
> + if (ret)
> + return ret;
> +
> + if (mdev) {
> + struct intel_vgpu *vgpu = (struct intel_vgpu *)
> + mdev_get_drvdata(mdev);
> + vgpu->display.shadow_fbs.enable_direct_flip = !!val;
> + }
> +
> + return n;
> +}
> +
> static DEVICE_ATTR_RO(vgpu_id);
> static DEVICE_ATTR_RO(hw_id);
> +static DEVICE_ATTR_RW(enable_direct_flip);
>
> static struct attribute *intel_vgpu_attrs[] = {
> &dev_attr_vgpu_id.attr,
> &dev_attr_hw_id.attr,
> + &dev_attr_enable_direct_flip.attr,
> NULL
> };
>
> --
> 2.7.4
>
> _______________________________________________
> intel-gvt-dev mailing list
> intel-gvt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev
--
Open Source Technology Center, Intel ltd.
$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gvt-dev/attachments/20190513/a5b7abab/attachment-0001.sig>
More information about the intel-gvt-dev
mailing list