On Wed, Feb 12, 2025 at 09:46:09AM +0300, Alexander Shursha wrote: > Sponsored by: Future Crew, LLC > Signed-off-by: Alexander Shursha <kekek2@xxxxx> > --- > src/bhyve/bhyve_command.c | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) This should come with additions to bhyvexml2argvtest.c data files. > > diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c > index bc287307c8..5da88ec9bd 100644 > --- a/src/bhyve/bhyve_command.c > +++ b/src/bhyve/bhyve_command.c > @@ -152,6 +152,30 @@ bhyveBuildConsoleArgStr(const virDomainDef *def, virCommand *cmd) > return 0; > } > > +static int > +bhyveBuildHostdevArgStr(const virDomainDef *def, virCommand *cmd) > +{ > + size_t i; > + > + for (i = 0; i < def->nhostdevs; i++) { > + virDomainHostdevDef *hostdev = def->hostdevs[i]; > + virDomainHostdevSubsys *subsys = &hostdev->source.subsys; > + > + if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS || > + subsys->type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) > + { > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", > + _("unsupported hostdev")); > + return -1; > + } We should probably be diagnosing this in bhyveDomainDeviceDefValidate so it gets reported to the user much earlier. > + virCommandAddArg(cmd, "-s"); > + virCommandAddArgFormat(cmd, "%d,passthru,%d/%d/%d", > + hostdev->info->addr.pci.slot, subsys->u.pci.addr.bus, > + subsys->u.pci.addr.slot, subsys->u.pci.addr.function); > + } > + return 0; > +} > + > static int > bhyveBuildAHCIControllerArgStr(const virDomainDef *def, > virDomainControllerDef *controller, > @@ -819,6 +843,9 @@ virBhyveProcessBuildBhyveCmd(struct _bhyveConn *driver, virDomainDef *def, > virCommandAddArg(cmd, bhyvecmd->args[i]); > } > > + if (bhyveBuildHostdevArgStr(def, cmd) < 0) > + return NULL; > + > virCommandAddArg(cmd, def->name); > > return g_steal_pointer(&cmd); > -- > 2.47.1 > With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|