[Spice-devel] [PATCH] Allow Qemu to pass maximum head to guest

Frediano Ziglio fziglio at redhat.com
Mon Jun 8 10:24:33 PDT 2015


> 
> Hi Frediano
> 
> ----- Original Message -----
> > Add a max_head field to QXLRom so Qemu can specify the maximum heads it
> > wants. This to support heads argument in libvirt properly.
> > Padding fields are added to make the structure multiple of 8 bytes. This
> > as Qemu append to this structure some fields for mode settings. As
> > this structure is packed not adding padding could lead to unaligned
> > memory accesses.
> 
> I suspect this to be just a hint, as the guest may still request any
> configuration.
> 
> Isn't it enough to rely on driver/kernel level hints then? (kernel qxl
> num_heads for ex?)
> 
> otherwise, looks ok to me.
> 

Hi,
  the idea behind this is to be able from libvirt to set the number of heads.
Other cards (like vmware) support this "heads" setting.
Actually is expected to work with QXL using Windows guest as in this configuration every libvirt head will have a separate video card in the guest.
QXL/Linux depends on configurations. Userspace driver uses min(16, X setting default 4) while kernel will use a parameter (by defaults 4). I have patches for both userspace driver and kms/drm.
It's quite hard to pass this limit from libvirt (you have also to consider changing configuration after installation) for all guests. Actually there is no way for Qemu to enforce this limit (so yes, is an hint).
This change is a bit different from previous ones as instead of requiring a pci revision boost to add a field just use a flag. I tested and is back compatible.

Frediano

> > 
> > Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> > ---
> >  spice/qxl_dev.h | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/spice/qxl_dev.h b/spice/qxl_dev.h
> > index a3e91a5..b5c97e9 100644
> > --- a/spice/qxl_dev.h
> > +++ b/spice/qxl_dev.h
> > @@ -164,8 +164,14 @@ typedef struct SPICE_ATTR_PACKED QXLRom {
> >          uint16_t padding;
> >          QXLURect heads[64];
> >      } client_monitors_config;
> > +    uint16_t max_heads;               /* valid if flags contains
> > QXL_ROM_FLAG_MAX_HEADS */
> > +    /* align structure to 8 bytes */
> > +    uint16_t padding_end1;
> > +    uint32_t padding_end2;
> >  } QXLRom;
> >  
> > +#define QXL_ROM_FLAG_MAX_HEADS          (1<<0)
> > +
> >  #define CLIENT_MONITORS_CONFIG_CRC32_POLY 0xedb88320
> >  
> >  /* qxl-1 compat: fixed */
> > --
> > 2.1.0
> > 


More information about the Spice-devel mailing list