Re: [PATCH 2/6] bhyve: add support for booting from UEFI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/12/2017 04:12 PM, Roman Bogorodskiy wrote:
> From: Fabian Freyer <fabian.freyer@xxxxxxxxxxxxxxxxxxx>
> 
> Allow to boot using UEFI rather than using an external boot loader
> such as bhyveload or grub-bhyve.
> 
> Also, make LPC PCI-ISA bridge handling more flexible as now it's
> needed not only for serial ports, but for bootrom as well.
> 
> Signed-off-by: Roman Bogorodskiy <bogorodskiy@xxxxxxxxx>
> ---
>  src/bhyve/bhyve_command.c | 30 +++++++++++++++++++++++++-
>  src/bhyve/bhyve_driver.c  | 27 +++++++++++++++++++----
>  src/bhyve/bhyve_process.c | 55 +++++++++++++++++++++++++----------------------
>  3 files changed, 81 insertions(+), 31 deletions(-)
> 
> diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
> index e7131625c..450800920 100644
> --- a/src/bhyve/bhyve_command.c
> +++ b/src/bhyve/bhyve_command.c
> @@ -163,7 +163,6 @@ bhyveBuildConsoleArgStr(const virDomainDef *def, virCommandPtr cmd)
>          return -1;
>      }
>  
> -    virCommandAddArgList(cmd, "-s", "1,lpc", NULL);
>      virCommandAddArg(cmd, "-l");
>      virCommandAddArgFormat(cmd, "com%d,%s",
>                             chr->target.port + 1, chr->source->data.file.path);
> @@ -283,6 +282,14 @@ bhyveBuildVirtIODiskArgStr(const virDomainDef *def ATTRIBUTE_UNUSED,
>      return 0;
>  }
>  
> +static int
> +bhyveBuildLPCArgStr(const virDomainDef *def ATTRIBUTE_UNUSED,
> +                    virCommandPtr cmd)
> +{
> +    virCommandAddArgList(cmd, "-s", "1,lpc", NULL);
> +    return 0;
> +}
> +
>  virCommandPtr
>  virBhyveProcessBuildBhyveCmd(virConnectPtr conn,
>                               virDomainDefPtr def, bool dryRun)
> @@ -296,6 +303,7 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn,
>       *            vm0
>       */
>      size_t i;
> +    bool add_lpc = false;
>  
>      virCommandPtr cmd = virCommandNew(BHYVE);
>  
> @@ -350,6 +358,21 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn,
>      virCommandAddArg(cmd, "-P"); /* vmexit from guest on pause */
>  
>      virCommandAddArgList(cmd, "-s", "0:0,hostbridge", NULL);
> +
> +    if (def->os.bootloader == NULL &&
> +        def->os.loader) {
> +        if ((bhyveDriverGetCaps(conn) & BHYVE_CAP_LPC_BOOTROM)) {
> +            virCommandAddArg(cmd, "-l");
> +            virCommandAddArgFormat(cmd, "bootrom,%s", def->os.loader->path);
> +            add_lpc = true;
> +        } else {
> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                           _("Installed bhyve binary does not support "
> +                             "UEFI loader"));
> +            goto error;
> +        }
> +    }
> +
>      /* Devices */
>      for (i = 0; i < def->ncontrollers; i++) {
>          virDomainControllerDefPtr controller = def->controllers[i];
> @@ -389,8 +412,13 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn,
>              goto error;
>          }
>      }
> +
> +    if (add_lpc || def->nserials)
> +        bhyveBuildLPCArgStr(def, cmd);
> +
>      if (bhyveBuildConsoleArgStr(def, cmd) < 0)
>          goto error;
> +
>      virCommandAddArg(cmd, def->name);
>  
>      return cmd;
> diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
> index f4ccef32b..0f9961ae0 100644
> --- a/src/bhyve/bhyve_driver.c
> +++ b/src/bhyve/bhyve_driver.c
> @@ -734,15 +734,34 @@ bhyveConnectDomainXMLToNative(virConnectPtr conn,
>      if (bhyveDomainAssignAddresses(def, NULL) < 0)
>          goto cleanup;
>  
> -    if (!(loadcmd = virBhyveProcessBuildLoadCmd(conn, def, "<device.map>",
> +    if (def->os.bootloader == NULL &&
> +        def->os.loader) {
> +
> +        if ((def->os.loader->readonly != VIR_TRISTATE_BOOL_YES)
> +            || (def->os.loader->type != VIR_DOMAIN_LOADER_TYPE_PFLASH)) {

Please move the or operator at the end of the previous line.

> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                           _("Only read-only pflash is supported."));
> +            goto cleanup;
> +        }

ACK

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux