[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 25/29] vmsvga: Add basic support for GMR registers a
From: |
Liran Alon |
Subject: |
[Qemu-devel] [PATCH 25/29] vmsvga: Add basic support for GMR registers and FIFO commands |
Date: |
Thu, 9 Aug 2018 14:46:38 +0300 |
We don't support GMR regions while reporting caps, but some guests may try
to send us some GMR queries and we do our best to ignore them while avoiding
FIFO command crash.
Reported-by: Leonid Shatz <address@hidden>
Reviewed-by: Darren Kenny <address@hidden>
Signed-off-by: Liran Alon <address@hidden>
---
hw/display/vmware_vga.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
index 1db8f92f053b..b2f3456357bd 100644
--- a/hw/display/vmware_vga.c
+++ b/hw/display/vmware_vga.c
@@ -164,6 +164,12 @@ enum {
SVGA_REG_PITCHLOCK = 32, /* Fixed pitch for all modes */
SVGA_REG_IRQMASK = 33, /* Interrupt mask */
+ /* Guest memory regions */
+ SVGA_REG_GMR_ID = 41,
+ SVGA_REG_GMR_DESCRIPTOR = 42,
+ SVGA_REG_GMR_MAX_IDS = 43,
+ SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH = 44,
+
SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */
SVGA_PALETTE_END = SVGA_PALETTE_BASE + 767,
SVGA_SCRATCH_BASE = SVGA_PALETTE_BASE + 768,
@@ -409,6 +415,8 @@ enum {
SVGA_CMD_SURFACE_ALPHA_BLEND = 28, /* deprecated */
SVGA_CMD_FRONT_ROP_FILL = 29,
SVGA_CMD_FENCE = 30,
+ SVGA_CMD_DEFINE_GMR2 = 41,
+ SVGA_CMD_REMAP_GMR2 = 42,
};
/* Legal values for the SVGA_REG_CURSOR_ON register in cursor bypass mode */
@@ -419,6 +427,13 @@ enum {
SVGA_CURSOR_ON_RESTORE_TO_FB = 3,
};
+enum {
+ SVGA_REMAP_GMR2_PPN32 = 0,
+ SVGA_REMAP_GMR2_VIA_GMR = (1 << 0),
+ SVGA_REMAP_GMR2_PPN64 = (1 << 1),
+ SVGA_REMAP_GMR2_SINGLE_PPN = (1 << 2),
+};
+
/* Update cursor position from SVGA_FIFO_CURSOR registers */
static void cursor_update_from_fifo(struct vmsvga_state_s *s)
{
@@ -795,6 +810,7 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s)
struct vmsvga_cursor_definition_s cursor;
uint32_t cmd_start;
uint32_t fence_arg;
+ uint32_t flags, num_pages;
bool cmd_ignored;
bool irq_pending = false;
bool fifo_progress = false;
@@ -961,6 +977,36 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s)
break;
+ case SVGA_CMD_DEFINE_GMR2:
+ len -= 1;
+ if (len < 0) {
+ goto rewind;
+ }
+ args = 2;
+ goto badcmd;
+
+ case SVGA_CMD_REMAP_GMR2:
+ len -= 5;
+ if (len < 0) {
+ goto rewind;
+ }
+
+ vmsvga_fifo_read(s); /* gmrId */
+ flags = vmsvga_fifo_read(s);
+ vmsvga_fifo_read(s); /* offsetPages */
+ num_pages = vmsvga_fifo_read(s);
+
+ if (flags & SVGA_REMAP_GMR2_VIA_GMR) {
+ /* Read single struct SVGAGuestPtr */
+ args = 2;
+ } else {
+ args = (flags & SVGA_REMAP_GMR2_SINGLE_PPN) ? 1 : num_pages;
+ if (flags & SVGA_REMAP_GMR2_PPN64)
+ args *= 2;
+ }
+
+ goto badcmd;
+
/*
* Deprecated commands are neither documented in VMware SVGA
development kit
* nor in Linux kernel vmware-svga driver source code.
@@ -1242,6 +1288,15 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t
address)
ret = s->irq_mask;
break;
+ /* Guest memory regions */
+ case SVGA_REG_GMR_ID:
+ case SVGA_REG_GMR_DESCRIPTOR:
+ case SVGA_REG_GMR_MAX_IDS:
+ case SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH:
+ /* We don't support GMRs */
+ ret = 0;
+ break;
+
default:
if (s->index >= SVGA_SCRATCH_BASE &&
s->index < SVGA_SCRATCH_BASE + s->scratch_size) {
--
1.9.1
- [Qemu-devel] [PATCH 16/29] vmsvga: Add framework code for SVGA command to raise interrupt, (continued)
- [Qemu-devel] [PATCH 16/29] vmsvga: Add framework code for SVGA command to raise interrupt, Liran Alon, 2018/08/09
- [Qemu-devel] [PATCH 17/29] vmsvga: Define interrupt source flags for interrupt status and mask registers, Liran Alon, 2018/08/09
- [Qemu-devel] [PATCH 18/29] vmsvga: Add support for SVGA_IRQFLAG_FIFO_PROGRESS, Liran Alon, 2018/08/09
- [Qemu-devel] [PATCH 19/29] vmsvga: Handle SVGA_CMD_FENCE command, Liran Alon, 2018/08/09
- [Qemu-devel] [PATCH 20/29] vmsvga: Use standard names for params defining hardware cursor image, Liran Alon, 2018/08/09
- [Qemu-devel] [PATCH 21/29] vmsvga: Use AND mask bpp parameter in SVGA_CMD_DEFINE_CURSOR, Liran Alon, 2018/08/09
- [Qemu-devel] [PATCH 22/29] vmsvga: Increase size of cursor AND bitmask, Liran Alon, 2018/08/09
- [Qemu-devel] [PATCH 23/29] vmsvga: Implement initial support for rgb-alpha cursors, Liran Alon, 2018/08/09
- [Qemu-devel] [PATCH 24/29] vmsvga: Add support for SVGA_FIFO_CAP_CURSOR_BYPASS_3, Liran Alon, 2018/08/09
- [Qemu-devel] [PATCH 25/29] vmsvga: Add basic support for GMR registers and FIFO commands,
Liran Alon <=
- [Qemu-devel] [PATCH 26/29] vmsvga: Add basic support for display topology, Liran Alon, 2018/08/09
- [Qemu-devel] [PATCH 27/29] vmsvga: Add support for pitchlock register (a display line stride), Liran Alon, 2018/08/09
- [Qemu-devel] [PATCH 28/29] vmsvga: Introduce new function for reporting device capabilities, Liran Alon, 2018/08/09
- [Qemu-devel] [PATCH 29/29] vmsvga: Don't allow setting screen size with zero width or height, Liran Alon, 2018/08/09
- Re: [Qemu-devel] [PATCH 00/29]: vmsvga: Various fixes and enhancements, Gerd Hoffmann, 2018/08/10