mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 19:32:19 +00:00
Add virtio-related options to video
https://bugzilla.redhat.com/show_bug.cgi?id=1283251 Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
f65db1be12
commit
f5384fb402
@ -6136,6 +6136,18 @@ qemu-kvm -net nic,model=? /dev/null
|
|||||||
The optional <code>address</code> sub-element can be used to
|
The optional <code>address</code> sub-element can be used to
|
||||||
tie the video device to a particular PCI slot.
|
tie the video device to a particular PCI slot.
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
|
<dt><code>driver</code></dt>
|
||||||
|
<dd>
|
||||||
|
The subelement <code>driver</code> can be used to tune the device:
|
||||||
|
<dl>
|
||||||
|
<dt>virtio options</dt>
|
||||||
|
<dd>
|
||||||
|
<a href="#elementsVirtio">Virtio-specific options</a> can also be
|
||||||
|
set. (<span class="since">Since 3.5.0</span>)
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h4><a name="elementsConsole">Consoles, serial, parallel & channel devices</a></h4>
|
<h4><a name="elementsConsole">Consoles, serial, parallel & channel devices</a></h4>
|
||||||
|
@ -3218,6 +3218,11 @@
|
|||||||
-->
|
-->
|
||||||
<define name="video">
|
<define name="video">
|
||||||
<element name="video">
|
<element name="video">
|
||||||
|
<optional>
|
||||||
|
<element name="driver">
|
||||||
|
<ref name="virtioOptions"/>
|
||||||
|
</element>
|
||||||
|
</optional>
|
||||||
<optional>
|
<optional>
|
||||||
<element name="model">
|
<element name="model">
|
||||||
<choice>
|
<choice>
|
||||||
|
@ -2352,6 +2352,7 @@ void virDomainVideoDefFree(virDomainVideoDefPtr def)
|
|||||||
virDomainDeviceInfoClear(&def->info);
|
virDomainDeviceInfoClear(&def->info);
|
||||||
|
|
||||||
VIR_FREE(def->accel);
|
VIR_FREE(def->accel);
|
||||||
|
VIR_FREE(def->virtio);
|
||||||
VIR_FREE(def);
|
VIR_FREE(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -13525,11 +13526,13 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node)
|
|||||||
|
|
||||||
static virDomainVideoDefPtr
|
static virDomainVideoDefPtr
|
||||||
virDomainVideoDefParseXML(xmlNodePtr node,
|
virDomainVideoDefParseXML(xmlNodePtr node,
|
||||||
|
xmlXPathContextPtr ctxt,
|
||||||
const virDomainDef *dom,
|
const virDomainDef *dom,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virDomainVideoDefPtr def;
|
virDomainVideoDefPtr def;
|
||||||
xmlNodePtr cur;
|
xmlNodePtr cur;
|
||||||
|
xmlNodePtr saved = ctxt->node;
|
||||||
char *type = NULL;
|
char *type = NULL;
|
||||||
char *heads = NULL;
|
char *heads = NULL;
|
||||||
char *vram = NULL;
|
char *vram = NULL;
|
||||||
@ -13538,6 +13541,8 @@ virDomainVideoDefParseXML(xmlNodePtr node,
|
|||||||
char *vgamem = NULL;
|
char *vgamem = NULL;
|
||||||
char *primary = NULL;
|
char *primary = NULL;
|
||||||
|
|
||||||
|
ctxt->node = node;
|
||||||
|
|
||||||
if (VIR_ALLOC(def) < 0)
|
if (VIR_ALLOC(def) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -13639,7 +13644,12 @@ virDomainVideoDefParseXML(xmlNodePtr node,
|
|||||||
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0)
|
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
if (virDomainVirtioOptionsParseXML(ctxt, &def->virtio) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
ctxt->node = saved;
|
||||||
|
|
||||||
VIR_FREE(type);
|
VIR_FREE(type);
|
||||||
VIR_FREE(ram);
|
VIR_FREE(ram);
|
||||||
VIR_FREE(vram);
|
VIR_FREE(vram);
|
||||||
@ -14438,7 +14448,7 @@ virDomainDeviceDefParse(const char *xmlStr,
|
|||||||
goto error;
|
goto error;
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_DEVICE_VIDEO:
|
case VIR_DOMAIN_DEVICE_VIDEO:
|
||||||
if (!(dev->data.video = virDomainVideoDefParseXML(node, def, flags)))
|
if (!(dev->data.video = virDomainVideoDefParseXML(node, ctxt, def, flags)))
|
||||||
goto error;
|
goto error;
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_DEVICE_HOSTDEV:
|
case VIR_DOMAIN_DEVICE_HOSTDEV:
|
||||||
@ -18373,7 +18383,7 @@ virDomainDefParseXML(xmlDocPtr xml,
|
|||||||
virDomainVideoDefPtr video;
|
virDomainVideoDefPtr video;
|
||||||
ssize_t insertAt = -1;
|
ssize_t insertAt = -1;
|
||||||
|
|
||||||
if (!(video = virDomainVideoDefParseXML(nodes[i], def, flags)))
|
if (!(video = virDomainVideoDefParseXML(nodes[i], ctxt, def, flags)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (video->primary) {
|
if (video->primary) {
|
||||||
@ -19440,6 +19450,10 @@ virDomainVideoDefCheckABIStability(virDomainVideoDefPtr src,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (src->virtio && dst->virtio &&
|
||||||
|
!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
|
if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -23376,6 +23390,7 @@ virDomainVideoDefFormat(virBufferPtr buf,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
const char *model = virDomainVideoTypeToString(def->type);
|
const char *model = virDomainVideoTypeToString(def->type);
|
||||||
|
virBuffer driverBuf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
if (!model) {
|
if (!model) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -23385,6 +23400,14 @@ virDomainVideoDefFormat(virBufferPtr buf,
|
|||||||
|
|
||||||
virBufferAddLit(buf, "<video>\n");
|
virBufferAddLit(buf, "<video>\n");
|
||||||
virBufferAdjustIndent(buf, 2);
|
virBufferAdjustIndent(buf, 2);
|
||||||
|
virDomainVirtioOptionsFormat(&driverBuf, def->virtio);
|
||||||
|
if (virBufferCheckError(&driverBuf) < 0)
|
||||||
|
return -1;
|
||||||
|
if (virBufferUse(&driverBuf)) {
|
||||||
|
virBufferAddLit(buf, "<driver");
|
||||||
|
virBufferAddBuffer(buf, &driverBuf);
|
||||||
|
virBufferAddLit(buf, "/>\n");
|
||||||
|
}
|
||||||
virBufferAsprintf(buf, "<model type='%s'",
|
virBufferAsprintf(buf, "<model type='%s'",
|
||||||
model);
|
model);
|
||||||
if (def->ram)
|
if (def->ram)
|
||||||
|
@ -1376,6 +1376,7 @@ struct _virDomainVideoDef {
|
|||||||
bool primary;
|
bool primary;
|
||||||
virDomainVideoAccelDefPtr accel;
|
virDomainVideoAccelDefPtr accel;
|
||||||
virDomainDeviceInfo info;
|
virDomainDeviceInfo info;
|
||||||
|
virDomainVirtioOptionsPtr virtio;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* graphics console modes */
|
/* graphics console modes */
|
||||||
|
@ -69,6 +69,7 @@
|
|||||||
<input type='mouse' bus='ps2'/>
|
<input type='mouse' bus='ps2'/>
|
||||||
<input type='keyboard' bus='ps2'/>
|
<input type='keyboard' bus='ps2'/>
|
||||||
<video>
|
<video>
|
||||||
|
<driver iommu='on' ats='on'/>
|
||||||
<model type='virtio' heads='1' primary='yes'>
|
<model type='virtio' heads='1' primary='yes'>
|
||||||
<acceleration accel3d='yes'/>
|
<acceleration accel3d='yes'/>
|
||||||
</model>
|
</model>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user