Vga 20180903 patches
The following changes since commit 19b599f7664b2ebfd0f405fb79c14dd241557452:
Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2018-08-27-v2' into staging (2018-08-27 16:44:20 +0100)
are available in the git repository at:
git://git.kraxel.org/qemu tags/vga-20180903-pull-request
for you to fetch changes up to 8da132a56f7ebaabc5b674b5a3a2e6fa8934be45:
virtio-gpu: add iommu support (2018-09-03 08:31:57 +0200)
----------------------------------------------------------------
vga: virtio reset fix, virtio iommu support.
----------------------------------------------------------------
Gerd Hoffmann (5):
virtio-vga: fix reset
Revert "virtio-gpu: fix crashes upon warm reboot with vga mode" use dpy_gfx_update_full
virtio-gpu: pass down VirtIOGPU pointer to a bunch of functions
virtio-gpu: add iommu support
include/hw/virtio/virtio-gpu.h | 8 +++--- hw/display/exynos4210_fimd.c | 4 +-- hw/display/g364fb.c | 2 +- hw/display/jazz_led.c | 3 +-- hw/display/tc6393xb.c | 4 +-- hw/display/vga.c | 3 +-- hw/display/virtio-gpu-3d.c | 8 +++--- hw/display/virtio-gpu.c | 59 ++++++++++++++++++++++-------------------- hw/display/virtio-vga.c | 17 ++++-------- hw/display/vmware_vga.c | 5 +--- hw/display/xlnx_dp.c | 3 +-- 11 files changed, 53 insertions(+), 63 deletions(-)
Signature · 1 line
2.9.3
[Qemu-arm] [PULL 1/5] virtio-vga: fix reset
We must call the reset functions for both virtio-gpu and vga to properly reset the combo device.
Message-id: [email protected]
--- include/hw/virtio/virtio-gpu.h | 1 + hw/display/virtio-gpu.c | 2 +- hw/display/virtio-vga.c | 6 +++++- 3 files changed, 7 insertions(+), 2 deletions(-)
include/hw/virtio/virtio-gpu.h +1 -0
@@ -150,6 +150,7 @@ extern const GraphicHwOps virtio_gpu_ops; }while (0 )/* virtio-gpu.c */ +void virtio_gpu_reset(VirtIODevice *vdev); void virtio_gpu_ctrl_response(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd, struct virtio_gpu_ctrl_hdr *resp,
hw/display/virtio-gpu.c +1 -1
@@ -1289,7 +1289,7 @@ static void virtio_gpu_instance_init(Object *obj) { } -static void virtio_gpu_reset (VirtIODevice *vdev) +void virtio_gpu_reset (VirtIODevice *vdev) {VirtIOGPU *g =VIRTIO_GPU (vdev);struct virtio_gpu_simple_resource *res, *tmp;
hw/display/virtio-vga.c +5 -1
@@ -179,8 +179,12 @@ static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev, Error **errp)static void virtio_vga_reset (DeviceState *dev) {VirtIOVGA *vvga =VIRTIO_VGA (dev); - vvga->vdev.enable =0 ; +/* reset virtio-gpu */ +virtio_gpu_reset (VIRTIO_DEVICE (&vvga->vdev)); + +/* reset vga */ +vga_common_reset (&vvga->vga);vga_dirty_log_start (&vvga->vga); }
Signature · 1 line
2.9.3
[Qemu-arm] [PULL 2/5] Revert "virtio-gpu: fix crashes upon warm reboot with vga mode"
In reply to Gerd HoffmannThis reverts commit 93f874fe9dbe0b997b5a9459840957efd13d7191.
Now with virtio-vga being resetted properly the
crash workaround is not needed any more.
Message-id: [email protected]
--- include/hw/virtio/virtio-gpu.h | 1 - hw/display/virtio-gpu.c | 5 ----- hw/display/virtio-vga.c | 11 ----------- 3 files changed, 17 deletions(-)
include/hw/virtio/virtio-gpu.h +0 -1
@@ -125,7 +125,6 @@ typedef struct VirtIOGPU {uint32_t bytes_3d; } stats; -void (*disable_scanout)(struct VirtIOGPU *g,int scanout_id);Error *migration_blocker; } VirtIOGPU;
hw/display/virtio-gpu.c +0 -5
@@ -421,11 +421,6 @@ static void virtio_gpu_disable_scanout(VirtIOGPU *g, int scanout_id) scanout->height ?:480 , "Guest disabled display."); } - -if (g->disable_scanout) { - g->disable_scanout (g, scanout_id); - } -dpy_gfx_replace_surface (scanout->con, ds); scanout->resource_id =0 ; scanout->ds =NULL ;
hw/display/virtio-vga.c +0 -11
@@ -75,16 +75,6 @@ static void virtio_vga_gl_block(void *opaque, bool block) } } -static void virtio_vga_disable_scanout (VirtIOGPU *g,int scanout_id) -{ -VirtIOVGA *vvga =container_of (g, VirtIOVGA, vdev); - -if (scanout_id ==0 ) { -/* reset surface if needed */ - vvga->vga.graphic_mode =-1 ; - } -} -static const GraphicHwOps virtio_vga_ops = { .invalidate = virtio_vga_invalidate_display, .gfx_update = virtio_vga_update_display,
@@ -166,7 +156,6 @@ static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev, Error **errp) vvga->vga_mrs, true); vga->con = g->scanout[0 ].con; - g->disable_scanout = virtio_vga_disable_scanout;graphic_console_set_hwops (vga->con, &virtio_vga_ops, vvga);for (i =0 ; i < g->conf.max_outputs; i++) {
Signature · 1 line
2.9.3
[Qemu-arm] [PULL 5/5] virtio-gpu: add iommu support
In reply to Gerd HoffmannSwitch from cpu_physical_memory_map to dma_memory_map, so iommu mappings for virtio-gpu objects work properly.
Message-Id: <[email protected]>
--- hw/display/virtio-gpu.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
hw/display/virtio-gpu.c +14 -11
@@ -17,6 +17,7 @@#include "qemu/iov.h" #include "ui/console.h" #include "trace.h" +#include "sysemu/dma.h" #include "hw/virtio/virtio.h" #include "hw/virtio/virtio-gpu.h" #include "hw/virtio/virtio-bus.h"
@@ -726,7 +727,8 @@ int virtio_gpu_create_mapping_iov(VirtIOGPU *g,uint32_t l =le32_to_cpu (ents[i].length);hwaddr len = l; (*iov)[i].iov_len = l; - (*iov)[i].iov_base =cpu_physical_memory_map (a, &len,1 ); + (*iov)[i].iov_base =dma_memory_map (VIRTIO_DEVICE (g)->dma_as, + a, &len,DMA_DIRECTION_TO_DEVICE );if (addr) { (*addr)[i] = a; }
@@ -754,8 +756,10 @@ void virtio_gpu_cleanup_mapping_iov(VirtIOGPU *g,int i;for (i =0 ; i < count; i++) { -cpu_physical_memory_unmap (iov[i].iov_base, iov[i].iov_len,1 , - iov[i].iov_len); +dma_memory_unmap (VIRTIO_DEVICE (g)->dma_as, + iov[i].iov_base, iov[i].iov_len, +DMA_DIRECTION_TO_DEVICE , + iov[i].iov_len); }g_free (iov); }
@@ -1147,13 +1151,17 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size,for (i =0 ; i < res->iov_cnt; i++) {hwaddr len = res->iov[i].iov_len; res->iov[i].iov_base = -cpu_physical_memory_map (res->addrs[i], &len,1 ); +dma_memory_map (VIRTIO_DEVICE (g)->dma_as, + res->addrs[i], &len,DMA_DIRECTION_TO_DEVICE );if (!res->iov[i].iov_base || len != res->iov[i].iov_len) {/* Clean up the half-a-mapping we just created... */ if (res->iov[i].iov_base) { -cpu_physical_memory_unmap (res->iov[i].iov_base, - len,0 ,0 ); +dma_memory_unmap (VIRTIO_DEVICE (g)->dma_as, + res->iov[i].iov_base, + res->iov[i].iov_len, +DMA_DIRECTION_TO_DEVICE , + res->iov[i].iov_len); }/* ...and the mappings for previous loop iterations */ res->iov_cnt = i;
@@ -1205,11 +1213,6 @@ static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)Error *local_err =NULL ;int i; -if (virtio_host_has_feature (vdev,VIRTIO_F_IOMMU_PLATFORM )) { -error_setg (errp,"virtio-gpu does not support vIOMMU yet" ); -return ; - } -if (g->conf.max_outputs >VIRTIO_GPU_MAX_SCANOUTS ) {error_setg (errp,"invalid max_outputs > %d" ,VIRTIO_GPU_MAX_SCANOUTS );return ;
Signature · 1 line
2.9.3
[Qemu-arm] [PULL 4/5] virtio-gpu: pass down VirtIOGPU pointer to a bunch of functions
In reply to Gerd HoffmannNo functional change, just preparation for a followup patch which needs a VirtIOGPU pointer.
Message-Id: <[email protected]>
--- include/hw/virtio/virtio-gpu.h | 6 ++++-- hw/display/virtio-gpu-3d.c | 8 ++++---- hw/display/virtio-gpu.c | 25 +++++++++++++++---------- 3 files changed, 23 insertions(+), 16 deletions(-)
include/hw/virtio/virtio-gpu.h +4 -2
@@ -159,10 +159,12 @@ void virtio_gpu_ctrl_response_nodata(VirtIOGPU *g, enum virtio_gpu_ctrl_type type);void virtio_gpu_get_display_info (VirtIOGPU *g,struct virtio_gpu_ctrl_command *cmd); -int virtio_gpu_create_mapping_iov (struct virtio_gpu_resource_attach_backing *ab, +int virtio_gpu_create_mapping_iov (VirtIOGPU *g, +struct virtio_gpu_resource_attach_backing *ab,struct virtio_gpu_ctrl_command *cmd,uint64_t **addr,struct iovec **iov); -void virtio_gpu_cleanup_mapping_iov (struct iovec *iov,uint32_t count); +void virtio_gpu_cleanup_mapping_iov (VirtIOGPU *g, +struct iovec *iov,uint32_t count);void virtio_gpu_process_cmdq (VirtIOGPU *g);/* virtio-gpu-3d.c */
hw/display/virtio-gpu-3d.c +4 -4
@@ -86,7 +86,7 @@ static void virgl_cmd_resource_unref(VirtIOGPU *g, &res_iovs, &num_iovs);if (res_iovs !=NULL && num_iovs !=0 ) { -virtio_gpu_cleanup_mapping_iov (res_iovs, num_iovs); +virtio_gpu_cleanup_mapping_iov (g, res_iovs, num_iovs); }virgl_renderer_resource_unref (unref.resource_id); }
@@ -291,7 +291,7 @@ static void virgl_resource_attach_backing(VirtIOGPU *g,VIRTIO_GPU_FILL_CMD (att_rb);trace_virtio_gpu_cmd_res_back_attach (att_rb.resource_id); - ret =virtio_gpu_create_mapping_iov (&att_rb, cmd,NULL , &res_iovs); + ret =virtio_gpu_create_mapping_iov (g, &att_rb, cmd,NULL , &res_iovs);if (ret !=0 ) { cmd->error =VIRTIO_GPU_RESP_ERR_UNSPEC ;return ;
@@ -301,7 +301,7 @@ static void virgl_resource_attach_backing(VirtIOGPU *g, res_iovs, att_rb.nr_entries);if (ret !=0 ) -virtio_gpu_cleanup_mapping_iov (res_iovs, att_rb.nr_entries); +virtio_gpu_cleanup_mapping_iov (g, res_iovs, att_rb.nr_entries); } static void virgl_resource_detach_backing(VirtIOGPU *g,
@@ -320,7 +320,7 @@ static void virgl_resource_detach_backing(VirtIOGPU *g,if (res_iovs ==NULL || num_iovs ==0 ) {return ; } -virtio_gpu_cleanup_mapping_iov (res_iovs, num_iovs); +virtio_gpu_cleanup_mapping_iov (g, res_iovs, num_iovs); }
hw/display/virtio-gpu.c +15 -10
@@ -29,7 +29,8 @@static struct virtio_gpu_simple_resource *virtio_gpu_find_resource (VirtIOGPU *g,uint32_t resource_id); -static void virtio_gpu_cleanup_mapping (struct virtio_gpu_simple_resource *res); +static void virtio_gpu_cleanup_mapping (VirtIOGPU *g, +struct virtio_gpu_simple_resource *res);static void virtio_gpu_ctrl_hdr_bswap (struct virtio_gpu_ctrl_hdr *hdr)
@@ -442,7 +443,7 @@ static void virtio_gpu_resource_destroy(VirtIOGPU *g, }pixman_image_unref (res->image); -virtio_gpu_cleanup_mapping (res); +virtio_gpu_cleanup_mapping (g, res);QTAILQ_REMOVE (&g->reslist, res, next); g->hostmem -= res->hostmem;g_free (res);
@@ -688,7 +689,8 @@ static void virtio_gpu_set_scanout(VirtIOGPU *g, scanout->height = ss.r.height; } -int virtio_gpu_create_mapping_iov (struct virtio_gpu_resource_attach_backing *ab, +int virtio_gpu_create_mapping_iov (VirtIOGPU *g, +struct virtio_gpu_resource_attach_backing *ab,struct virtio_gpu_ctrl_command *cmd,uint64_t **addr,struct iovec **iov) {
@@ -732,7 +734,7 @@ int virtio_gpu_create_mapping_iov(struct virtio_gpu_resource_attach_backing *ab,qemu_log_mask (LOG_GUEST_ERROR ,"%s: failed to map MMIO memory for" " resource %d element %d\n" , __func__, ab->resource_id, i); -virtio_gpu_cleanup_mapping_iov (*iov, i); +virtio_gpu_cleanup_mapping_iov (g, *iov, i);g_free (ents); *iov =NULL ;if (addr) {
@@ -746,7 +748,8 @@ int virtio_gpu_create_mapping_iov(struct virtio_gpu_resource_attach_backing *ab,return 0 ; } -void virtio_gpu_cleanup_mapping_iov (struct iovec *iov,uint32_t count) +void virtio_gpu_cleanup_mapping_iov (VirtIOGPU *g, +struct iovec *iov,uint32_t count) {int i;
@@ -757,9 +760,10 @@ void virtio_gpu_cleanup_mapping_iov(struct iovec *iov, uint32_t count)g_free (iov); } -static void virtio_gpu_cleanup_mapping (struct virtio_gpu_simple_resource *res) +static void virtio_gpu_cleanup_mapping (VirtIOGPU *g, +struct virtio_gpu_simple_resource *res) { -virtio_gpu_cleanup_mapping_iov (res->iov, res->iov_cnt); +virtio_gpu_cleanup_mapping_iov (g, res->iov, res->iov_cnt); res->iov =NULL ; res->iov_cnt =0 ;g_free (res->addrs);
@@ -791,7 +795,7 @@ virtio_gpu_resource_attach_backing(VirtIOGPU *g,return ; } - ret =virtio_gpu_create_mapping_iov (&ab, cmd, &res->addrs, &res->iov); + ret =virtio_gpu_create_mapping_iov (g, &ab, cmd, &res->addrs, &res->iov);if (ret !=0 ) { cmd->error =VIRTIO_GPU_RESP_ERR_UNSPEC ;return ;
@@ -818,7 +822,7 @@ virtio_gpu_resource_detach_backing(VirtIOGPU *g, cmd->error =VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID ;return ; } -virtio_gpu_cleanup_mapping (res); +virtio_gpu_cleanup_mapping (g, res); } static void virtio_gpu_simple_process_cmd(VirtIOGPU *g,
@@ -1144,6 +1148,7 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size,hwaddr len = res->iov[i].iov_len; res->iov[i].iov_base =cpu_physical_memory_map (res->addrs[i], &len,1 ); +if (!res->iov[i].iov_base || len != res->iov[i].iov_len) {/* Clean up the half-a-mapping we just created... */ if (res->iov[i].iov_base) {
@@ -1152,7 +1157,7 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size, }/* ...and the mappings for previous loop iterations */ res->iov_cnt = i; -virtio_gpu_cleanup_mapping (res); +virtio_gpu_cleanup_mapping (g, res);pixman_image_unref (res->image);g_free (res);return -EINVAL ;
Signature · 1 line
2.9.3
[Qemu-arm] [PULL 3/5] use dpy_gfx_update_full
In reply to Gerd HoffmannMessage-id: [email protected]
--- hw/display/exynos4210_fimd.c | 4 +--- hw/display/g364fb.c | 2 +- hw/display/jazz_led.c | 3 +-- hw/display/tc6393xb.c | 4 ++-- hw/display/vga.c | 3 +-- hw/display/virtio-gpu.c | 2 +- hw/display/vmware_vga.c | 5 +---- hw/display/xlnx_dp.c | 3 +-- 8 files changed, 9 insertions(+), 17 deletions(-)
hw/display/exynos4210_fimd.c +1 -3
@@ -1272,8 +1272,6 @@ static void exynos4210_fimd_update(void *opaque)uint8_t *host_fb_addr;bool is_dirty = false;const int global_width = (s->vidtcon[2 ] &FIMD_VIDTCON2_SIZE_MASK ) +1 ; -const int global_height = ((s->vidtcon[2 ] >>FIMD_VIDTCON2_VER_SHIFT ) & -FIMD_VIDTCON2_SIZE_MASK ) +1 ;if (!s || !s->console || !s->enabled ||surface_bits_per_pixel (qemu_console_surface (s->console)) ==0 ) {
@@ -1329,7 +1327,7 @@ static void exynos4210_fimd_update(void *opaque)fimd_copy_line_toqemu (global_width, s->ifb + global_width * line *RGBA_SIZE , d + global_width * line * bpp); } -dpy_gfx_update (s->console,0 ,0 , global_width, global_height); +dpy_gfx_update_full (s->console); } s->invalidate = false; s->vidintcon[1 ] |=FIMD_VIDINT_INTFRMPEND ;
hw/display/g364fb.c +1 -1
@@ -229,7 +229,7 @@ static void g364fb_draw_blank(G364State *s) d +=surface_stride (surface); } -dpy_gfx_update (s->con,0 ,0 , s->width, s->height); +dpy_gfx_update_full (s->con); s->blanked =1 ; }
hw/display/jazz_led.c +1 -2
@@ -214,8 +214,7 @@ static void jazz_led_update_display(void *opaque) } s->state =REDRAW_NONE ; -dpy_gfx_update (s->con,0 ,0 , -surface_width (surface),surface_height (surface)); +dpy_gfx_update_full (s->con); }static void jazz_led_invalidate_display (void *opaque)
hw/display/tc6393xb.c +2 -2
@@ -461,7 +461,7 @@ static void tc6393xb_draw_graphic(TC6393xbState *s, int full_update)return ; } -dpy_gfx_update (s->con,0 ,0 , s->scr_width, s->scr_height); +dpy_gfx_update_full (s->con); }static void tc6393xb_draw_blank (TC6393xbState *s,int full_update)
@@ -480,7 +480,7 @@ static void tc6393xb_draw_blank(TC6393xbState *s, int full_update) d +=surface_stride (surface); } -dpy_gfx_update (s->con,0 ,0 , s->scr_width, s->scr_height); +dpy_gfx_update_full (s->con); }static void tc6393xb_update_display (void *opaque)
hw/display/vga.c +1 -2
@@ -1745,8 +1745,7 @@ static void vga_draw_blank(VGACommonState *s, int full_update)memset (d,0 , w); d +=surface_stride (surface); } -dpy_gfx_update (s->con,0 ,0 , - s->last_scr_width, s->last_scr_height); +dpy_gfx_update_full (s->con); }#define GMODE_TEXT 0
hw/display/virtio-gpu.c +1 -1
@@ -1182,7 +1182,7 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size, }dpy_gfx_replace_surface (scanout->con, scanout->ds); -dpy_gfx_update (scanout->con,0 ,0 , scanout->width, scanout->height); +dpy_gfx_update_full (scanout->con);if (scanout->cursor.resource_id) {update_cursor (g, &scanout->cursor); }
hw/display/vmware_vga.c +1 -4
@@ -1116,7 +1116,6 @@ static inline void vmsvga_check_size(struct vmsvga_state_s *s)static void vmsvga_update_display (void *opaque) {struct vmsvga_state_s *s = opaque; -DisplaySurface *surface;if (!s->enable || !s->config) {/* in standard vga mode */
@@ -1125,15 +1124,13 @@ static void vmsvga_update_display(void *opaque) }vmsvga_check_size (s); - surface =qemu_console_surface (s->vga.con);vmsvga_fifo_run (s);vmsvga_update_rect_flush (s);if (s->invalidated) { s->invalidated =0 ; -dpy_gfx_update (s->vga.con,0 ,0 , -surface_width (surface),surface_height (surface)); +dpy_gfx_update_full (s->vga.con); } }
hw/display/xlnx_dp.c +1 -2
@@ -1186,8 +1186,7 @@ static void xlnx_dp_update_display(void *opaque)/* * XXX: We might want to update only what changed. */ -dpy_gfx_update (s->console,0 ,0 ,surface_width (s->g_plane.surface), -surface_height (s->g_plane.surface)); +dpy_gfx_update_full (s->console); }static const GraphicHwOps xlnx_dp_gfx_ops = {
Signature · 1 line
2.9.3
Peter Maydell
AppliedQuoted 8 lines · Gerd Hoffmann
The following changes since commit
19b599f7664b2ebfd0f405fb79c14dd241557452:Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2018-08-27-v2' into staging (2018-08-27 16:44:20 +0100)
are available in the git repository at:
git://git.kraxel.org/qemutags/vga-20180903-pull-request
Quoted 8 lines
for you to fetch changes up to
8da132a56f7ebaabc5b674b5a3a2e6fa8934be45:virtio-gpu: add iommu support (2018-09-03 08:31:57 +0200)
----------------------------------------------------------------
vga: virtio reset fix, virtio iommu support.----------------------------------------------------------------
Applied, thanks.
-- PMM