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

Alon Levy alevy at redhat.com
Tue Sep 11 07:35:52 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:
  (1) set QXLRom::client_monitors_config_updating
  (2) fill QXLRom::client_monitors_config
  (3) raise QXL_INTERRUPT_CLIENT_MONITORS_CONFIG
  (4) clear QXLRom::client_monitors_config_updating

guest:
  (1) clear QXL_INTERRUPT_CLIENT_MONITORS_CONFIG bit in irq status
  (2) wait until QXLRom::client_monitors_config_updating is clear
  (3) parse QXLRom::client_monitors_config
  (4) check that QXLRom::client_monitors_Config_updating is clear
      (a) when set, goto (1)
  (5) check QXL_INTERRUPT_CLIENT_MONITORS_CONFIG bit in irq status
      (a) when set, goto (1)
      (b) when clear we are done

If the interrupt mask is ~0 or 0 we will assume a guest that doesn't support
the new interrupt. If it's mask is neither but doesn't set
QXL_INTERRUPT_CLIENT_MONITORS_CONFIG, we also assume it doesn't support this
interrupt.
---
 spice/qxl_dev.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/spice/qxl_dev.h b/spice/qxl_dev.h
index 50784dc..035f86a 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,6 +158,12 @@ typedef struct SPICE_ATTR_PACKED QXLRom {
     /* appended for qxl-4 */
     uint8_t client_present;
     uint8_t client_capabilities[58];
+    uint8_t client_monitors_config_updating;
+    uint8_t padding[1];
+    struct {
+        uint16_t count;
+        QXLURect heads[64];
+    } client_monitors_config;
 } QXLRom;
 
 /* qxl-1 compat: fixed */
@@ -234,6 +247,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