qxl_dev.h: add client monitors configuration notification to guest

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.

We compute crc over the monitors configuration to avoid host-write from a
following update while guest-read corruption. 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.
This commit is contained in:
Alon Levy 2012-09-10 03:16:11 +03:00
parent 361fd166b2
commit d1a6f3dfd8

View File

@ -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,7 @@ 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)
/* qxl-1 compat: append only */
typedef struct SPICE_ATTR_PACKED QXLRam {