[PATCH] drm/i915/kvmgt: Simplify function intel_vgpu_read/write

Zhang, Xiong Y xiong.y.zhang at intel.com
Mon Jan 29 05:56:01 UTC 2018


> On Sun, Jan 28, 2018 at 09:44:17PM -0800, Zhang, Xiong Y wrote:
> > > On Sun, Jan 28, 2018 at 06:05:37PM -0800, Zhang, Xiong Y wrote:
> > > > > From: Changbin Du <changbin.du at intel.com>
> > > > >
> > > > > The code needn't so complex, simplify it.
> > > > >
> > > > > Signed-off-by: Changbin Du <changbin.du at intel.com>
> > > > > ---
> > > > >  drivers/gpu/drm/i915/gvt/kvmgt.c | 106
> > > > > +++++++++------------------------------
> > > > >  1 file changed, 24 insertions(+), 82 deletions(-)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c
> > > > > b/drivers/gpu/drm/i915/gvt/kvmgt.c
> > > > > index 3c68727..8a4ad26 100644
> > > > > --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> > > > > +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> > > > > @@ -740,50 +740,21 @@ static ssize_t intel_vgpu_read(struct
> > > > > mdev_device *mdev, char __user *buf,
> > > > >  	int ret;
> > > > >
> > > > >  	while (count) {
> > > > > -		size_t filled;
> > > > > +		size_t rsz = *ppos % 2 ? 1 : (*ppos % 4 ? 2 : 4);
> > > > [Zhang, Xiong Y] for odd *ppos is always 1 byte, which is
> > > > different from the
> > > original without your patch.
> > >
> > > Can you give a example?
> > [Zhang, Xiong Y] if *ppos=3, count=3.
> > The original r/w would be: len =1, then len =2 With your patch: it
> > always len =1, len =1, len =1.
> It is 1,2, not 1,1,1. Maybe you missed sth?
[Zhang, Xiong Y] oh, I missed this sentence is in the while() loop.
> 
> > >
> > > > >
> > > > > _______________________________________________
> > > > > intel-gvt-dev mailing list
> > > > > intel-gvt-dev at lists.freedesktop.org
> > > > > https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev
> > >
> > > --
> > > Thanks,
> > > Changbin Du
> 
> --
> Thanks,
> Changbin Du


More information about the intel-gvt-dev mailing list