[PATCH] drm/i915/gvt: support inconsecutive partial PTE update

Zhenyu Wang zhenyuw at linux.intel.com
Tue Sep 18 02:41:07 UTC 2018


On 2018.09.17 18:53:16 +0800, intel-gvt-dev-bounces at lists.freedesktop.org wrote:
> > > > +        bool found = false;
> > > > +
> > > > +        list_for_each_entry_safe(pos, n,
> > > > +                &ggtt_mm->ggtt_mm.partial_pte_list, list) {
> > > > +            if (g_gtt_index == pos->offset >>
> > > > +                    info->gtt_entry_size_shift) {
> > > > +                if (off != pos->offset) {
> > > > +                    /* the second partial part*/
> > > > +
> > > > +                    int last_off = pos->offset &
> > > > +                        (info->gtt_entry_size - 1);
> > > > +
> > > > +                    memcpy((void *)&e.val64 + last_off,
> > > > +                        (void *)&pos->data + last_off,
> > > > +                        bytes);
> > > > +
> > > > +                    list_del(&pos->list);
> > > > +                    kfree(pos);
> > > > +                } else {
> > > > +                    /* update of the first partial part */
> > > > +
> > > > +                    pos->data = e.val64;
> > > > +                    ggtt_set_guest_entry(ggtt_mm, &e,
> > > > +                        g_gtt_index);
> > > > +                    return 0;
> > > > +                }
> > > > +                found = true;
> > > > +                break;
> > > 
> > > Move this two lines in above if (off != pos->offset) is easier to read.
> > Ok.
> Recalled there is coding style warning if move 'break' in 'if' branch and
> follow by 'else' branch. So have the two lines after 'else' branch.
> 

yeah, if move break in if (off != pos->offset) then else is not needed.

-- 
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/20180918/b9e29fd8/attachment.sig>


More information about the intel-gvt-dev mailing list