[RFC PATCH v2 2/3] drm/i915/gvt: Introduce enable_direct_flip attribute

Zhang, Tina tina.zhang at intel.com
Wed May 15 05:04:33 UTC 2019



> -----Original Message-----
> From: Zhenyu Wang [mailto:zhenyuw at linux.intel.com]
> Sent: Monday, May 13, 2019 11:29 AM
> To: Zhang, Tina <tina.zhang at intel.com>
> Cc: kraxel at redhat.com; zhenyuw at linux.intel.com; Lv, Zhiyuan
> <zhiyuan.lv at intel.com>; Wang, Zhi A <zhi.a.wang at intel.com>; Tian, Kevin
> <kevin.tian at intel.com>; daniel at ffwll.ch; Kondapally, Kalyan
> <kalyan.kondapally at intel.com>; Yuan, Hang <hang.yuan at intel.com>;
> ville.syrjala at linux.intel.com; intel-gvt-dev at lists.freedesktop.org
> Subject: Re: [RFC PATCH v2 2/3] drm/i915/gvt: Introduce enable_direct_flip
> attribute
> 
> 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?
It tells whether to enable kernel direct flip or not and won't block vfio gfx ioctl.
Thanks

BR,
Tina

> 
> >  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


More information about the intel-gvt-dev mailing list