[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v5 05/14] libxl: Load guest BIOS from file
On Wed, Jun 22, 2016 at 06:15:36PM +0100, Anthony PERARD wrote: > The path to the BIOS blob can be overriden by the xl's > bios_path_override option, or provided by u.hvm.bios_firmware in the > domain_build_info struct by other libxl user. > > Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> > > --- > Changes in V5: > - man page, use B<> to highlight config option in description. > - rename config option from `bios_override` to `bios_path_override` > - store libxl_read_file_contents() return value into r instead of e > (just renamed the variable) > - rename domain_build_info.u.hvm.bios_firmware to system_firmware > > Changes in V4: > - updating man page to have bios_override described. > - return ERROR_INVAL in libxl__load_hvm_firmware_module when the file is > empty. > > Changes in V3: > - move seabios_path and ovmf_path to libxl_path.c (with renaming) > - fix some coding style > - warn for empty file > - remove rombios stuff (will still be built-in hvmloader) > - rename field bios_filename in domain_build_info to bios_firmware to > follow naming of acpi and smbios. > - log an error after libxl_read_file_contents() only when it return ENOENT > - return an error on empty file. > - added #define LIBXL_HAVE_BUILDINFO_HVM_BIOS_FIRMWARE > --- > docs/man/xl.cfg.pod.5.in | 9 +++++++ > tools/libxl/libxl.h | 8 +++++++ > tools/libxl/libxl_dom.c | 57 > ++++++++++++++++++++++++++++++++++++++++++++ > tools/libxl/libxl_internal.h | 2 ++ > tools/libxl/libxl_paths.c | 10 ++++++++ > tools/libxl/libxl_types.idl | 1 + > tools/libxl/xl_cmdimpl.c | 11 ++++++--- > 7 files changed, 95 insertions(+), 3 deletions(-) > > diff --git a/docs/man/xl.cfg.pod.5.in b/docs/man/xl.cfg.pod.5.in > index 3bb27d0..a685b83 100644 > --- a/docs/man/xl.cfg.pod.5.in > +++ b/docs/man/xl.cfg.pod.5.in > @@ -1212,6 +1212,15 @@ Requires device_model_version=qemu-xen. > > =back > > +=item B<bios_path_override="PATH"> > + > +Override the path to the blob to be used as BIOS. The blob provided here MUST > +be consistent with the B<bios=> which you have specified. You should not > +normally need to specify this option. > + > +This options does not have any effect if using B<bios="rombios"> or > +B<device_model_version="qemu-xen-traditional">. > + > =item B<pae=BOOLEAN> > > Hide or expose the IA32 Physical Address Extensions. These extensions > diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h > index 2c0f868..2b1f678 100644 > --- a/tools/libxl/libxl.h > +++ b/tools/libxl/libxl.h > @@ -928,6 +928,14 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, > libxl_mac *src); > #define LIBXL_HAVE_CHECKPOINTED_STREAM 1 > > /* > + * LIBXL_HAVE_BUILDINFO_HVM_SYSTEM_FIRMWARE > + * > + * libxl_domain_build_info has u.hvm.system_firmware field which can be use > + * to provide a different firmware blob (like SeaBIOS or OVMF). > + */ > +#define LIBXL_HAVE_BUILDINFO_HVM_SYSTEM_FIRMWARE > + > +/* > * ERROR_REMUS_XXX error code only exists from Xen 4.5, Xen 4.6 and it > * is changed to ERROR_CHECKPOINT_XXX in Xen 4.7 > */ > diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c > index ec29060..c341a29 100644 > --- a/tools/libxl/libxl_dom.c > +++ b/tools/libxl/libxl_dom.c > @@ -862,6 +862,38 @@ err: > return ret; > } > > +static int libxl__load_hvm_firmware_module(libxl__gc *gc, > + const char *filename, > + const char *what, > + struct xc_hvm_firmware_module *m) > +{ > + int datalen = 0; > + void *data = NULL; > + int r; > + > + LOG(DEBUG, "Loading %s: %s", what, filename); > + r = libxl_read_file_contents(CTX, filename, &data, &datalen); > + if (r) { > + /* > + * Print a message only on ENOENT, other errors are logged by the > + * function libxl_read_file_contents(). > + */ > + if (r == ENOENT) > + LOGEV(ERROR, r, "failed to read %s file", what); > + return ERROR_FAIL; > + } > + libxl__ptr_add(gc, data); > + if (datalen) { > + /* Only accept non-empty files */ > + m->data = data; > + m->length = datalen; > + } else { > + LOG(ERROR, "file %s for %s is empty", filename, what); > + return ERROR_INVAL; > + } > + return 0; > +} > + Please use goto style error handling to be consistent with other code. Wei. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |