commit 8e669b382c3533793356261c6d748df56162a2c6 Author: Jim Fehlig Date: Tue Apr 7 16:37:09 2020 -0600 conf: Add a new xenbus controller option for event channels Event channels are like PV interrupts and in conjuction with grant frames form a data transfer mechanism for PV drivers. They are also used for inter-processor interrupts. Guests with a large number of vcpus and/or many PV devices many need to increase the maximum default value of 1023. For this reason the native Xen config format supports the 'max_event_channels' setting. See xl.cfg(5) man page for more details. Similar to the existing maxGrantFrames option, add a new xenbus controller option 'maxEventChannels', allowing to adjust the maximum value via libvirt. Signed-off-by: Jim Fehlig Reviewed-by: Daniel P. Berrangé Index: libvirt-6.2.0/docs/formatdomain.html.in =================================================================== --- libvirt-6.2.0.orig/docs/formatdomain.html.in +++ libvirt-6.2.0/docs/formatdomain.html.in @@ -4416,7 +4416,7 @@ <driver iothread='4'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/> </controller> - <controller type='xenbus' maxGrantFrames='64'/> + <controller type='xenbus' maxGrantFrames='64' maxEventChannels='2047'/> ... </devices> ... @@ -4476,7 +4476,11 @@
Since 5.2.0, the xenbus controller has an optional attribute maxGrantFrames, which specifies the maximum number of grant frames the controller - makes available for connected devices.
+ makes available for connected devices. + Since 6.3.0, the xenbus controller + supports the optional maxEventChannels attribute, + which specifies maximum number of event channels (PV interrupts) + that can be used by the guest.

Index: libvirt-6.2.0/docs/schemas/domaincommon.rng =================================================================== --- libvirt-6.2.0.orig/docs/schemas/domaincommon.rng +++ libvirt-6.2.0/docs/schemas/domaincommon.rng @@ -2548,6 +2548,11 @@ + + + + + Index: libvirt-6.2.0/src/conf/domain_conf.c =================================================================== --- libvirt-6.2.0.orig/src/conf/domain_conf.c +++ libvirt-6.2.0/src/conf/domain_conf.c @@ -2245,6 +2245,7 @@ virDomainControllerDefNew(virDomainContr break; case VIR_DOMAIN_CONTROLLER_TYPE_XENBUS: def->opts.xenbusopts.maxGrantFrames = -1; + def->opts.xenbusopts.maxEventChannels = -1; break; case VIR_DOMAIN_CONTROLLER_TYPE_IDE: case VIR_DOMAIN_CONTROLLER_TYPE_FDC: @@ -11337,6 +11338,7 @@ virDomainControllerDefParseXML(virDomain break; case VIR_DOMAIN_CONTROLLER_TYPE_XENBUS: { g_autofree char *gntframes = virXMLPropString(node, "maxGrantFrames"); + g_autofree char *eventchannels = virXMLPropString(node, "maxEventChannels"); if (gntframes) { int r = virStrToLong_i(gntframes, NULL, 10, @@ -11347,6 +11349,15 @@ virDomainControllerDefParseXML(virDomain goto error; } } + if (eventchannels) { + int r = virStrToLong_i(eventchannels, NULL, 10, + &def->opts.xenbusopts.maxEventChannels); + if (r != 0 || def->opts.xenbusopts.maxEventChannels < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid maxEventChannels: %s"), eventchannels); + goto error; + } + } break; } @@ -25267,6 +25278,10 @@ virDomainControllerDefFormat(virBufferPt virBufferAsprintf(&attrBuf, " maxGrantFrames='%d'", def->opts.xenbusopts.maxGrantFrames); } + if (def->opts.xenbusopts.maxEventChannels != -1) { + virBufferAsprintf(&attrBuf, " maxEventChannels='%d'", + def->opts.xenbusopts.maxEventChannels); + } break; default: Index: libvirt-6.2.0/src/conf/domain_conf.h =================================================================== --- libvirt-6.2.0.orig/src/conf/domain_conf.h +++ libvirt-6.2.0/src/conf/domain_conf.h @@ -730,6 +730,7 @@ struct _virDomainUSBControllerOpts { struct _virDomainXenbusControllerOpts { int maxGrantFrames; /* -1 == undef */ + int maxEventChannels; /* -1 == undef */ }; /* Stores the virtual disk controller configuration */