Roman Bogorodskiy <bogorodskiy@xxxxxxxxx> writes: > Alexander Shursha wrote: > >> Sponsored by: Future Crew, LLC >> Signed-off-by: Alexander Shursha <kekek2@xxxxx> >> --- >> src/bhyve/bhyve_command.c | 22 ++++++++++++++++++++++ >> 1 file changed, 22 insertions(+) >> >> diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c >> index bc287307c8..16986c9d53 100644 >> --- a/src/bhyve/bhyve_command.c >> +++ b/src/bhyve/bhyve_command.c >> @@ -152,6 +152,25 @@ 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) >> + continue; > > Should not we fail with VIR_ERR_CONFIG_UNSUPPORTED in this case? Done > >> + 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); > > Nit: lines are recommended to be under 100 or better 80 chars length. [1] Done > >> + } >> + return 0; >> +} >> + >> static int >> bhyveBuildAHCIControllerArgStr(const virDomainDef *def, >> virDomainControllerDef *controller, >> @@ -819,6 +838,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 > > This change also needs to have tests/bhyvexml2*.c tests updated. Done > > 1: https://libvirt.org/coding-style.html > -- Александр Шурша