[Spice-devel] [PATCH spice-protocol v2 1/2] qxl_dev.h: add client monitors configuration notification to guest

Alon Levy alevy at redhat.com
Wed Sep 12 06:13:29 PDT 2012


So far we have used the agent to notify the guest of a request to change
the monitors configurations (heads) on the qxl device. This patch introduces
a new interrupt and new fields in the qxl rom to notify the guest about
a new request, similarly to how physical hardware notifies the driver.

To avoid overwriting the rom while the guest is reading it there is a
client_monitors_config_updating field in ROM. The update protocol is:

qemu:
  (2) fill QXLRom::client_monitors_config
  (3) raise QXL_INTERRUPT_CLIENT_MONITORS_CONFIG

guest:
  (1) clear QXL_INTERRUPT_CLIENT_MONITORS_CONFIG bit in irq status
  (2) read QXLRom::client_monitors_config
  (3) (verify-crc)? done : goto 2

If the interrupt mask is ~0 or 0, or does not have
QXL_INTERRUPT_CLIENT_MONITORS_CONFIG set, we also assume it doesn't support
this interrupt.
---
 spice/qxl_dev.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/spice/qxl_dev.h b/spice/qxl_dev.h
index 50784dc..48ad403 100644
--- a/spice/qxl_dev.h
+++ b/spice/qxl_dev.h
@@ -125,6 +125,13 @@ typedef struct SPICE_ATTR_PACKED QXLRect {
     int32_t right;
 } QXLRect;
 
+typedef struct SPICE_ATTR_PACKED QXLURect {
+    uint32_t top;
+    uint32_t left;
+    uint32_t bottom;
+    uint32_t right;
+} QXLURect;
+
 /* qxl-1 compat: append only */
 typedef struct SPICE_ATTR_PACKED QXLRom {
     uint32_t magic;
@@ -151,8 +158,16 @@ typedef struct SPICE_ATTR_PACKED QXLRom {
     /* appended for qxl-4 */
     uint8_t client_present;
     uint8_t client_capabilities[58];
+    uint32_t client_monitors_config_crc;
+    struct {
+        uint16_t count;
+        uint16_t padding;
+        QXLURect heads[64];
+    } client_monitors_config;
 } QXLRom;
 
+#define CLIENT_MONITORS_CONFIG_CRC32_POLY 0xedb88320
+
 /* qxl-1 compat: fixed */
 typedef struct SPICE_ATTR_PACKED QXLMode {
     uint32_t id;
@@ -234,6 +249,9 @@ SPICE_RING_DECLARE(QXLReleaseRing, uint64_t, QXL_RELEASE_RING_SIZE);
 #define QXL_INTERRUPT_IO_CMD (1 << 2)
 #define QXL_INTERRUPT_ERROR  (1 << 3)
 #define QXL_INTERRUPT_CLIENT (1 << 4)
+#define QXL_INTERRUPT_CLIENT_MONITORS_CONFIG  (1 << 5)
+
+#define QXL_GUEST_CAP_CLIENT_MONITORS_CONFIG_ISR 0
 
 /* qxl-1 compat: append only */
 typedef struct SPICE_ATTR_PACKED QXLRam {
-- 
1.7.12



More information about the Spice-devel mailing list