All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 0/2] Vga 20200904 patches
@ 2020-09-04 11:26 Gerd Hoffmann
  2020-09-04 11:26 ` [PULL 1/2] virtio-gpu: fix unmap the already mapped items Gerd Hoffmann
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2020-09-04 11:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Michael S. Tsirkin

The following changes since commit 67a7bfe560a1bba59efab085cb3430f45176d382:

  Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2020-09-03' into staging (2020-09-03 16:58:25 +0100)

are available in the Git repository at:

  git://git.kraxel.org/qemu tags/vga-20200904-pull-request

for you to fetch changes up to 5fcf787582dd911df3a971718010bfca5a20e61d:

  cirrus: handle wraparound in cirrus_invalidate_region (2020-09-04 10:12:56 +0200)

----------------------------------------------------------------
vga: fixes for cirrus and virtio-gpu.

----------------------------------------------------------------

Gerd Hoffmann (1):
  cirrus: handle wraparound in cirrus_invalidate_region

Li Zhijian (1):
  virtio-gpu: fix unmap the already mapped items

 hw/display/cirrus_vga.c | 12 +++++++++---
 hw/display/virtio-gpu.c |  5 ++++-
 2 files changed, 13 insertions(+), 4 deletions(-)

-- 
2.27.0




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PULL 1/2] virtio-gpu: fix unmap the already mapped items
  2020-09-04 11:26 [PULL 0/2] Vga 20200904 patches Gerd Hoffmann
@ 2020-09-04 11:26 ` Gerd Hoffmann
  2020-09-04 11:26 ` [PULL 2/2] cirrus: handle wraparound in cirrus_invalidate_region Gerd Hoffmann
  2020-09-07 14:30 ` [PULL 0/2] Vga 20200904 patches Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2020-09-04 11:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: Li Qiang, Gerd Hoffmann, Li Zhijian, Michael S. Tsirkin

From: Li Zhijian <lizhijian@cn.fujitsu.com>

we go here either (!(*iov)[i].iov_base) or (len != l), so we need to consider
to unmap the 'i'th item as well when the 'i'th item is not nil

CC: Li Qiang <liq3ea@gmail.com>
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Message-id: 20200827035855.24354-1-lizhijian@cn.fujitsu.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/display/virtio-gpu.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 5f0dd7c15002..90be4e3ed719 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -646,9 +646,9 @@ int virtio_gpu_create_mapping_iov(VirtIOGPU *g,
         uint64_t a = le64_to_cpu(ents[i].addr);
         uint32_t l = le32_to_cpu(ents[i].length);
         hwaddr len = l;
-        (*iov)[i].iov_len = l;
         (*iov)[i].iov_base = dma_memory_map(VIRTIO_DEVICE(g)->dma_as,
                                             a, &len, DMA_DIRECTION_TO_DEVICE);
+        (*iov)[i].iov_len = len;
         if (addr) {
             (*addr)[i] = a;
         }
@@ -656,6 +656,9 @@ int virtio_gpu_create_mapping_iov(VirtIOGPU *g,
             qemu_log_mask(LOG_GUEST_ERROR, "%s: failed to map MMIO memory for"
                           " resource %d element %d\n",
                           __func__, ab->resource_id, i);
+            if ((*iov)[i].iov_base) {
+                i++; /* cleanup the 'i'th map */
+            }
             virtio_gpu_cleanup_mapping_iov(g, *iov, i);
             g_free(ents);
             *iov = NULL;
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PULL 2/2] cirrus: handle wraparound in cirrus_invalidate_region
  2020-09-04 11:26 [PULL 0/2] Vga 20200904 patches Gerd Hoffmann
  2020-09-04 11:26 ` [PULL 1/2] virtio-gpu: fix unmap the already mapped items Gerd Hoffmann
@ 2020-09-04 11:26 ` Gerd Hoffmann
  2020-09-07 14:30 ` [PULL 0/2] Vga 20200904 patches Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2020-09-04 11:26 UTC (permalink / raw)
  To: qemu-devel
  Cc: Philippe Mathieu-Daudé, Li Qiang, Gerd Hoffmann, Michael S. Tsirkin

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 Qiang <liq3ea@163.com>
Reported-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Li Qiang <liq3ea@163.com>
Message-id: 20200901140944.24101-1-kraxel@redhat.com
---
 hw/display/cirrus_vga.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index 02d9ed0bd465..41e71af08a0f 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -640,10 +640,16 @@ static void cirrus_invalidate_region(CirrusVGAState * s, int off_begin,
     }
 
     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_dirty(&s->vga.vram, off_cur, off_cur_end - off_cur);
+        if (off_cur_end >= off_cur) {
+            memory_region_set_dirty(&s->vga.vram, off_cur, off_cur_end - off_cur);
+        } else {
+            /* wraparound */
+            memory_region_set_dirty(&s->vga.vram, off_cur,
+                                    s->cirrus_addr_mask + 1 - off_cur);
+            memory_region_set_dirty(&s->vga.vram, 0, off_cur_end);
+        }
         off_begin += off_pitch;
     }
 }
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PULL 0/2] Vga 20200904 patches
  2020-09-04 11:26 [PULL 0/2] Vga 20200904 patches Gerd Hoffmann
  2020-09-04 11:26 ` [PULL 1/2] virtio-gpu: fix unmap the already mapped items Gerd Hoffmann
  2020-09-04 11:26 ` [PULL 2/2] cirrus: handle wraparound in cirrus_invalidate_region Gerd Hoffmann
@ 2020-09-07 14:30 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2020-09-07 14:30 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers, Michael S. Tsirkin

On Fri, 4 Sep 2020 at 12:28, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> The following changes since commit 67a7bfe560a1bba59efab085cb3430f45176d382:
>
>   Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2020-09-03' into staging (2020-09-03 16:58:25 +0100)
>
> are available in the Git repository at:
>
>   git://git.kraxel.org/qemu tags/vga-20200904-pull-request
>
> for you to fetch changes up to 5fcf787582dd911df3a971718010bfca5a20e61d:
>
>   cirrus: handle wraparound in cirrus_invalidate_region (2020-09-04 10:12:56 +0200)
>
> ----------------------------------------------------------------
> vga: fixes for cirrus and virtio-gpu.
>

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.2
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-07 14:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-04 11:26 [PULL 0/2] Vga 20200904 patches Gerd Hoffmann
2020-09-04 11:26 ` [PULL 1/2] virtio-gpu: fix unmap the already mapped items Gerd Hoffmann
2020-09-04 11:26 ` [PULL 2/2] cirrus: handle wraparound in cirrus_invalidate_region Gerd Hoffmann
2020-09-07 14:30 ` [PULL 0/2] Vga 20200904 patches Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.