Re: [PATCH] cirrus: handle wraparound in cirrus_invalidate_region

2020-09-01 Thread Gerd Hoffmann
On Tue, Sep 01, 2020 at 03:37:17PM +0800, Li Qiang wrote: > Gerd Hoffmann 于2020年9月1日周二 下午3:16写道: > > > > Hi, > > > > > +/* wraparound */ > > > +memory_region_set_dirty(&s->vga.vram, off_cur, > > > s->cirrus_addr_mask - off_cur); > > > > > So the len is 's->cirrus_addr_mas

Re: [PATCH] cirrus: handle wraparound in cirrus_invalidate_region

2020-09-01 Thread Li Qiang
Gerd Hoffmann 于2020年9月1日周二 下午3:16写道: > > Hi, > > > +/* wraparound */ > > +memory_region_set_dirty(&s->vga.vram, off_cur, > > s->cirrus_addr_mask - off_cur); > > > So the len is 's->cirrus_addr_mask->off_cur+1'. > > Correct. So do you agree me the first set size should be

Re: [PATCH] cirrus: handle wraparound in cirrus_invalidate_region

2020-09-01 Thread Gerd Hoffmann
Hi, > +/* wraparound */ > +memory_region_set_dirty(&s->vga.vram, off_cur, > s->cirrus_addr_mask - off_cur); > So the len is 's->cirrus_addr_mask->off_cur+1'. Correct. > +memory_region_set_dirty(&s->vga.vram, 0, off_cur_end); > > For the 'off_cur_end' here,

Re: [PATCH] cirrus: handle wraparound in cirrus_invalidate_region

2020-08-31 Thread Li Qiang
Gerd Hoffmann 于2020年9月1日周二 下午1:15写道: > > Hi, > > > > > > off_cur_end = ((off_cur + bytesperline - 1) & > > > > > s->cirrus_addr_mask) + 1; > [ ... ] > > > > > +memory_region_set_dirty(&s->vga.vram, 0, off_cur_end); > > > > > > > > And here be 'off_cur_end -1' > > > > > > --

Re: [PATCH] cirrus: handle wraparound in cirrus_invalidate_region

2020-08-31 Thread Gerd Hoffmann
Hi, > > > > off_cur_end = ((off_cur + bytesperline - 1) & > > > > s->cirrus_addr_mask) + 1; [ ... ] > > > > +memory_region_set_dirty(&s->vga.vram, 0, off_cur_end); > > > > > > And here be 'off_cur_end -1' > > > > --verbose please. I think this one is correct. > > Here the

Re: [PATCH] cirrus: handle wraparound in cirrus_invalidate_region

2020-08-31 Thread Li Qiang
Gerd Hoffmann 于2020年8月31日周一 下午7:23写道: > > > > for (y = 0; y < lines; y++) { > > > -off_cur = off_begin; > > > +off_cur = off_begin & s->cirrus_addr_mask; > > > off_cur_end = ((off_cur + bytesperline - 1) & > > > s->cirrus_addr_mask) + 1; > > > -assert(off_cur

Re: [PATCH] cirrus: handle wraparound in cirrus_invalidate_region

2020-08-31 Thread Gerd Hoffmann
> > for (y = 0; y < lines; y++) { > > -off_cur = off_begin; > > +off_cur = off_begin & s->cirrus_addr_mask; > > off_cur_end = ((off_cur + bytesperline - 1) & s->cirrus_addr_mask) > > + 1; > > -assert(off_cur_end >= off_cur); > > -memory_region_set_dirt

Re: [PATCH] cirrus: handle wraparound in cirrus_invalidate_region

2020-08-21 Thread Alexander Bulekov
On 200821 1251, Philippe Mathieu-Daudé wrote: > On 8/21/20 10:26 AM, Gerd Hoffmann wrote: > > Code simply asserts that there is no wraparound instead of handling > > it properly. The assert() can be triggered by the guest (must be > > privilidged inside the guest though). Fix it. > > Thanks for

Re: [PATCH] cirrus: handle wraparound in cirrus_invalidate_region

2020-08-21 Thread Philippe Mathieu-Daudé
On 8/21/20 10:26 AM, Gerd Hoffmann wrote: > Code simply asserts that there is no wraparound instead of handling > it properly. The assert() can be triggered by the guest (must be > privilidged inside the guest though). Fix it. Thanks for fixing this! > Buglink: https://bugs.launchpad.net/qemu/+

Re: [PATCH] cirrus: handle wraparound in cirrus_invalidate_region

2020-08-21 Thread Li Qiang
Gerd Hoffmann 于2020年8月21日周五 下午4:27写道: > > Code simply asserts that there is no wraparound instead of handling > it properly. The assert() can be triggered by the guest (must be > privilidged inside the guest though). Fix it. > > Buglink: https://bugs.launchpad.net/qemu/+bug/1880189 > Cc: Li Qian