diff --git a/0001-libxc-Rework-extra-module-initialisation.patch b/0001-libxc-Rework-extra-module-initialisation.patch new file mode 100644 index 0000000..7c84b79 --- /dev/null +++ b/0001-libxc-Rework-extra-module-initialisation.patch @@ -0,0 +1,185 @@ +From 270b8e85b5379fe93192f36966384ff07400fe7b Mon Sep 17 00:00:00 2001 +From: Anthony PERARD +Date: Mon, 14 Mar 2016 17:55:36 +0000 +Subject: [PATCH 01/15] libxc: Rework extra module initialisation + +This patch use xc_dom_alloc_segment() to allocate the memory space for the +ACPI modules and the SMBIOS modules. This is to replace the arbitrary +placement of 1MB after the hvmloader image. + +In later patches, while trying to load a firmware such as OVMF, the later +could easily be loaded past the address 4MB (OVMF is a 2MB binary), but +hvmloader use a range of memory from 4MB to 8MB to perform tests and in the +process, clear the memory, before loading the modules. + +Signed-off-by: Anthony PERARD +--- + tools/libxc/xc_dom_hvmloader.c | 131 ++++++++++++----------------------------- + 1 file changed, 38 insertions(+), 93 deletions(-) + +Index: xen-4.7.0-testing/tools/libxc/xc_dom_hvmloader.c +=================================================================== +--- xen-4.7.0-testing.orig/tools/libxc/xc_dom_hvmloader.c ++++ xen-4.7.0-testing/tools/libxc/xc_dom_hvmloader.c +@@ -129,98 +129,52 @@ static elf_errorstatus xc_dom_parse_hvm_ + return rc; + } + +-static int modules_init(struct xc_dom_image *dom, +- uint64_t vend, struct elf_binary *elf, +- uint64_t *mstart_out, uint64_t *mend_out) ++static int module_init_one(struct xc_dom_image *dom, ++ struct xc_hvm_firmware_module *module, ++ char *name) + { +-#define MODULE_ALIGN 1UL << 7 +-#define MB_ALIGN 1UL << 20 +-#define MKALIGN(x, a) (((uint64_t)(x) + (a) - 1) & ~(uint64_t)((a) - 1)) +- uint64_t total_len = 0, offset1 = 0; +- +- if ( dom->acpi_module.length == 0 && dom->smbios_module.length == 0 ) +- return 0; +- +- /* Find the total length for the firmware modules with a reasonable large +- * alignment size to align each the modules. +- */ +- total_len = MKALIGN(dom->acpi_module.length, MODULE_ALIGN); +- offset1 = total_len; +- total_len += MKALIGN(dom->smbios_module.length, MODULE_ALIGN); +- +- /* Want to place the modules 1Mb+change behind the loader image. */ +- *mstart_out = MKALIGN(elf->pend, MB_ALIGN) + (MB_ALIGN); +- *mend_out = *mstart_out + total_len; +- +- if ( *mend_out > vend ) +- return -1; +- +- if ( dom->acpi_module.length != 0 ) +- dom->acpi_module.guest_addr_out = *mstart_out; +- if ( dom->smbios_module.length != 0 ) +- dom->smbios_module.guest_addr_out = *mstart_out + offset1; ++ struct xc_dom_seg seg; ++ void *dest; ++ ++ if ( module->length ) ++ { ++ if ( xc_dom_alloc_segment(dom, &seg, name, 0, module->length) ) ++ goto err; ++ dest = xc_dom_seg_to_ptr(dom, &seg); ++ if ( dest == NULL ) ++ { ++ DOMPRINTF("%s: xc_dom_seg_to_ptr(dom, &seg) => NULL", ++ __FUNCTION__); ++ goto err; ++ } ++ memcpy(dest, module->data, module->length); ++ module->guest_addr_out = seg.vstart; ++ if ( module->guest_addr_out > UINT32_MAX || ++ module->guest_addr_out + module->length > UINT32_MAX ) ++ { ++ DOMPRINTF("%s: Module %s would be loaded abrove 4GB", ++ __FUNCTION__, name); ++ goto err; ++ } ++ } + + return 0; ++err: ++ return -1; + } + +-static int loadmodules(struct xc_dom_image *dom, +- uint64_t mstart, uint64_t mend, +- uint32_t domid) ++static int modules_init(struct xc_dom_image *dom) + { +- privcmd_mmap_entry_t *entries = NULL; +- unsigned long pfn_start; +- unsigned long pfn_end; +- size_t pages; +- uint32_t i; +- uint8_t *dest; +- int rc = -1; +- xc_interface *xch = dom->xch; +- +- if ( mstart == 0 || mend == 0 ) +- return 0; +- +- pfn_start = (unsigned long)(mstart >> PAGE_SHIFT); +- pfn_end = (unsigned long)((mend + PAGE_SIZE - 1) >> PAGE_SHIFT); +- pages = pfn_end - pfn_start; ++ int rc; + +- /* Map address space for module list. */ +- entries = calloc(pages, sizeof(privcmd_mmap_entry_t)); +- if ( entries == NULL ) +- goto error_out; ++ rc = module_init_one(dom, &dom->acpi_module, "acpi module"); ++ if ( rc ) goto err; ++ rc = module_init_one(dom, &dom->smbios_module, "smbios module"); ++ if ( rc ) goto err; + +- for ( i = 0; i < pages; i++ ) +- entries[i].mfn = (mstart >> PAGE_SHIFT) + i; +- +- dest = xc_map_foreign_ranges( +- xch, domid, pages << PAGE_SHIFT, PROT_READ | PROT_WRITE, 1 << PAGE_SHIFT, +- entries, pages); +- if ( dest == NULL ) +- goto error_out; +- +- /* Zero the range so padding is clear between modules */ +- memset(dest, 0, pages << PAGE_SHIFT); +- +- /* Load modules into range */ +- if ( dom->acpi_module.length != 0 ) +- { +- memcpy(dest, +- dom->acpi_module.data, +- dom->acpi_module.length); +- } +- if ( dom->smbios_module.length != 0 ) +- { +- memcpy(dest + (dom->smbios_module.guest_addr_out - mstart), +- dom->smbios_module.data, +- dom->smbios_module.length); +- } +- +- munmap(dest, pages << PAGE_SHIFT); +- rc = 0; +- +- error_out: +- free(entries); +- +- return rc; ++ return 0; ++err: ++ return -1; + } + + static elf_errorstatus xc_dom_load_hvm_kernel(struct xc_dom_image *dom) +@@ -229,7 +183,6 @@ static elf_errorstatus xc_dom_load_hvm_k + privcmd_mmap_entry_t *entries = NULL; + size_t pages = (elf->pend - elf->pstart + PAGE_SIZE - 1) >> PAGE_SHIFT; + elf_errorstatus rc; +- uint64_t m_start = 0, m_end = 0; + int i; + + /* Map address space for initial elf image. */ +@@ -262,15 +215,7 @@ static elf_errorstatus xc_dom_load_hvm_k + + munmap(elf->dest_base, elf->dest_size); + +- rc = modules_init(dom, dom->total_pages << PAGE_SHIFT, elf, &m_start, +- &m_end); +- if ( rc != 0 ) +- { +- DOMPRINTF("%s: insufficient space to load modules.", __func__); +- goto error; +- } +- +- rc = loadmodules(dom, m_start, m_end, dom->guest_domid); ++ rc = modules_init(dom); + if ( rc != 0 ) + { + DOMPRINTF("%s: unable to load modules.", __func__); diff --git a/0002-libxc-Prepare-a-start-info-structure-for-hvmloader.patch b/0002-libxc-Prepare-a-start-info-structure-for-hvmloader.patch new file mode 100644 index 0000000..c2b8b53 --- /dev/null +++ b/0002-libxc-Prepare-a-start-info-structure-for-hvmloader.patch @@ -0,0 +1,261 @@ +From 34cd9218de8579722240d1acdcaae4e4278f667e Mon Sep 17 00:00:00 2001 +From: Anthony PERARD +Date: Mon, 14 Mar 2016 17:55:37 +0000 +Subject: [PATCH 02/15] libxc: Prepare a start info structure for hvmloader + +... and load BIOS into guest memory. + +This adds a new firmware module, bios_module. It is +loaded in the guest memory and final location is provided to hvmloader +via the hvm_start_info struct. + +This patch create the hvm_start_info struct for HVM guest that have a +device model, so this is now common code with HVM guest without device +model. + +Signed-off-by: Anthony PERARD +--- + tools/libxc/include/xc_dom.h | 3 + + tools/libxc/xc_dom_hvmloader.c | 2 + + tools/libxc/xc_dom_x86.c | 132 ++++++++++++++++++++++++++++------------- + xen/include/public/xen.h | 2 +- + 4 files changed, 96 insertions(+), 43 deletions(-) + +Index: xen-4.7.0-testing/tools/libxc/include/xc_dom.h +=================================================================== +--- xen-4.7.0-testing.orig/tools/libxc/include/xc_dom.h ++++ xen-4.7.0-testing/tools/libxc/include/xc_dom.h +@@ -209,6 +209,9 @@ struct xc_dom_image { + /* If unset disables the setup of the IOREQ pages. */ + bool device_model; + ++ /* BIOS passed to HVMLOADER */ ++ struct xc_hvm_firmware_module bios_module; ++ + /* Extra ACPI tables passed to HVMLOADER */ + struct xc_hvm_firmware_module acpi_module; + +Index: xen-4.7.0-testing/tools/libxc/xc_dom_hvmloader.c +=================================================================== +--- xen-4.7.0-testing.orig/tools/libxc/xc_dom_hvmloader.c ++++ xen-4.7.0-testing/tools/libxc/xc_dom_hvmloader.c +@@ -167,6 +167,8 @@ static int modules_init(struct xc_dom_im + { + int rc; + ++ rc = module_init_one(dom, &dom->bios_module, "bios module"); ++ if ( rc ) goto err; + rc = module_init_one(dom, &dom->acpi_module, "acpi module"); + if ( rc ) goto err; + rc = module_init_one(dom, &dom->smbios_module, "smbios module"); +Index: xen-4.7.0-testing/tools/libxc/xc_dom_x86.c +=================================================================== +--- xen-4.7.0-testing.orig/tools/libxc/xc_dom_x86.c ++++ xen-4.7.0-testing/tools/libxc/xc_dom_x86.c +@@ -69,6 +69,9 @@ + #define round_up(addr, mask) ((addr) | (mask)) + #define round_pg_up(addr) (((addr) + PAGE_SIZE_X86 - 1) & ~(PAGE_SIZE_X86 - 1)) + ++#define HVMLOADER_MODULE_MAX_COUNT 1 ++#define HVMLOADER_MODULE_NAME_SIZE 10 ++ + struct xc_dom_params { + unsigned levels; + xen_vaddr_t vaddr_mask; +@@ -590,6 +593,7 @@ static int alloc_magic_pages_hvm(struct + xen_pfn_t special_array[X86_HVM_NR_SPECIAL_PAGES]; + xen_pfn_t ioreq_server_array[NR_IOREQ_SERVER_PAGES]; + xc_interface *xch = dom->xch; ++ size_t start_info_size = sizeof(struct hvm_start_info); + + /* Allocate and clear special pages. */ + for ( i = 0; i < X86_HVM_NR_SPECIAL_PAGES; i++ ) +@@ -624,8 +628,6 @@ static int alloc_magic_pages_hvm(struct + + if ( !dom->device_model ) + { +- size_t start_info_size = sizeof(struct hvm_start_info); +- + if ( dom->cmdline ) + { + dom->cmdline_size = ROUNDUP(strlen(dom->cmdline) + 1, 8); +@@ -635,17 +637,26 @@ static int alloc_magic_pages_hvm(struct + /* Limited to one module. */ + if ( dom->ramdisk_blob ) + start_info_size += sizeof(struct hvm_modlist_entry); +- +- rc = xc_dom_alloc_segment(dom, &dom->start_info_seg, +- "HVMlite start info", 0, start_info_size); +- if ( rc != 0 ) +- { +- DOMPRINTF("Unable to reserve memory for the start info"); +- goto out; +- } + } + else + { ++ start_info_size += ++ sizeof(struct hvm_modlist_entry) * HVMLOADER_MODULE_MAX_COUNT; ++ /* Add extra space to write modules name */ ++ start_info_size += ++ HVMLOADER_MODULE_NAME_SIZE * HVMLOADER_MODULE_MAX_COUNT; ++ } ++ ++ rc = xc_dom_alloc_segment(dom, &dom->start_info_seg, ++ "HVMlite start info", 0, start_info_size); ++ if ( rc != 0 ) ++ { ++ DOMPRINTF("Unable to reserve memory for the start info"); ++ goto out; ++ } ++ ++ if ( dom->device_model ) ++ { + /* + * Allocate and clear additional ioreq server pages. The default + * server will use the IOREQ and BUFIOREQ special pages above. +@@ -1689,39 +1700,68 @@ static int alloc_pgtables_hvm(struct xc_ + return 0; + } + ++static void add_module_to_list(struct xc_dom_image *dom, ++ struct xc_hvm_firmware_module *module, ++ const char *name, ++ struct hvm_modlist_entry *modlist, ++ struct hvm_start_info *start_info) ++{ ++ uint32_t index = start_info->nr_modules; ++ if ( module->length == 0 ) ++ return; ++ ++ assert(start_info->nr_modules < HVMLOADER_MODULE_MAX_COUNT); ++ assert(strnlen(name, HVMLOADER_MODULE_NAME_SIZE) ++ < HVMLOADER_MODULE_NAME_SIZE); ++ ++ modlist[index].paddr = module->guest_addr_out; ++ modlist[index].size = module->length; ++ strncpy((char*)(modlist + HVMLOADER_MODULE_MAX_COUNT) ++ + HVMLOADER_MODULE_NAME_SIZE * index, ++ name, HVMLOADER_MODULE_NAME_SIZE); ++ modlist[index].cmdline_paddr = ++ (dom->start_info_seg.pfn << PAGE_SHIFT) + ++ ((uintptr_t)modlist - (uintptr_t)start_info) + ++ sizeof(struct hvm_modlist_entry) * HVMLOADER_MODULE_MAX_COUNT + ++ HVMLOADER_MODULE_NAME_SIZE * index; ++ ++ start_info->nr_modules++; ++} ++ + static int bootlate_hvm(struct xc_dom_image *dom) + { + uint32_t domid = dom->guest_domid; + xc_interface *xch = dom->xch; ++ struct hvm_start_info *start_info; ++ size_t start_info_size; ++ void *start_page; ++ struct hvm_modlist_entry *modlist; + +- if ( !dom->device_model ) +- { +- struct hvm_start_info *start_info; +- size_t start_info_size; +- void *start_page; +- +- start_info_size = sizeof(*start_info) + dom->cmdline_size; +- if ( dom->ramdisk_blob ) +- start_info_size += sizeof(struct hvm_modlist_entry); ++ start_info_size = sizeof(*start_info) + dom->cmdline_size; ++ if ( dom->ramdisk_blob ) ++ start_info_size += sizeof(struct hvm_modlist_entry); + +- if ( start_info_size > +- dom->start_info_seg.pages << XC_DOM_PAGE_SHIFT(dom) ) +- { +- DOMPRINTF("Trying to map beyond start_info_seg"); +- return -1; +- } ++ if ( start_info_size > ++ dom->start_info_seg.pages << XC_DOM_PAGE_SHIFT(dom) ) ++ { ++ DOMPRINTF("Trying to map beyond start_info_seg"); ++ return -1; ++ } + +- start_page = xc_map_foreign_range(xch, domid, start_info_size, +- PROT_READ | PROT_WRITE, +- dom->start_info_seg.pfn); +- if ( start_page == NULL ) +- { +- DOMPRINTF("Unable to map HVM start info page"); +- return -1; +- } ++ start_page = xc_map_foreign_range(xch, domid, start_info_size, ++ PROT_READ | PROT_WRITE, ++ dom->start_info_seg.pfn); ++ if ( start_page == NULL ) ++ { ++ DOMPRINTF("Unable to map HVM start info page"); ++ return -1; ++ } + +- start_info = start_page; ++ start_info = start_page; ++ modlist = start_page + sizeof(*start_info) + dom->cmdline_size; + ++ if ( !dom->device_model ) ++ { + if ( dom->cmdline ) + { + char *cmdline = start_page + sizeof(*start_info); +@@ -1733,22 +1773,30 @@ static int bootlate_hvm(struct xc_dom_im + + if ( dom->ramdisk_blob ) + { +- struct hvm_modlist_entry *modlist = +- start_page + sizeof(*start_info) + dom->cmdline_size; + + modlist[0].paddr = dom->ramdisk_seg.vstart - dom->parms.virt_base; + modlist[0].size = dom->ramdisk_seg.vend - dom->ramdisk_seg.vstart; +- start_info->modlist_paddr = (dom->start_info_seg.pfn << PAGE_SHIFT) + +- ((uintptr_t)modlist - (uintptr_t)start_info); + start_info->nr_modules = 1; + } +- +- start_info->magic = XEN_HVM_START_MAGIC_VALUE; +- +- munmap(start_page, start_info_size); + } + else + { ++ add_module_to_list(dom, &dom->bios_module, "bios", ++ modlist, start_info); ++ } ++ ++ if ( start_info->nr_modules ) ++ { ++ start_info->modlist_paddr = (dom->start_info_seg.pfn << PAGE_SHIFT) + ++ ((uintptr_t)modlist - (uintptr_t)start_info); ++ } ++ ++ start_info->magic = XEN_HVM_START_MAGIC_VALUE; ++ ++ munmap(start_page, start_info_size); ++ ++ if ( dom->device_model ) ++ { + void *hvm_info_page; + + if ( (hvm_info_page = xc_map_foreign_range( +Index: xen-4.7.0-testing/xen/include/public/xen.h +=================================================================== +--- xen-4.7.0-testing.orig/xen/include/public/xen.h ++++ xen-4.7.0-testing/xen/include/public/xen.h +@@ -814,7 +814,7 @@ struct start_info { + typedef struct start_info start_info_t; + + /* +- * Start of day structure passed to PVH guests in %ebx. ++ * Start of day structure passed to PVH guests and to HVM guests in %ebx. + * + * NOTE: nothing will be loaded at physical address 0, so a 0 value in any + * of the address fields should be treated as not present. diff --git a/0003-configure-define-SEABIOS_PATH-and-OVMF_PATH.patch b/0003-configure-define-SEABIOS_PATH-and-OVMF_PATH.patch new file mode 100644 index 0000000..4eb2c61 --- /dev/null +++ b/0003-configure-define-SEABIOS_PATH-and-OVMF_PATH.patch @@ -0,0 +1,38 @@ +From d12d422d347ca3a8fd8181b78ee2736561cd0e57 Mon Sep 17 00:00:00 2001 +From: Anthony PERARD +Date: Mon, 14 Mar 2016 17:55:38 +0000 +Subject: [PATCH 03/15] configure: #define SEABIOS_PATH and OVMF_PATH + +Those paths are to be used by libxl, in order to load the firmware in +memory. If a system path is not define via --with-system-seabios or +--with-system-ovmf, then this default to the Xen firmware directory. + +Signed-off-by: Anthony PERARD +--- + tools/configure.ac | 6 ++++++ + 1 file changed, 6 insertions(+) + +Index: xen-4.7.0-testing/tools/configure.ac +=================================================================== +--- xen-4.7.0-testing.orig/tools/configure.ac ++++ xen-4.7.0-testing/tools/configure.ac +@@ -218,6 +218,9 @@ AC_ARG_WITH([system-seabios], + esac + ],[]) + AC_SUBST(seabios_path) ++AC_DEFINE_UNQUOTED([SEABIOS_PATH], ++ ["${seabios_path:-$XENFIRMWAREDIR/seabios.bin}"], ++ [SeaBIOS path]) + + AC_ARG_WITH([system-ovmf], + AS_HELP_STRING([--with-system-ovmf@<:@=PATH@:>@], +@@ -229,6 +232,9 @@ AC_ARG_WITH([system-ovmf], + esac + ],[]) + AC_SUBST(ovmf_path) ++AC_DEFINE_UNQUOTED([OVMF_PATH], ++ ["${ovmf_path:-$XENFIRMWAREDIR/ovmf.bin}"], ++ [OVMF path]) + + AC_ARG_WITH([extra-qemuu-configure-args], + AS_HELP_STRING([--with-extra-qemuu-configure-args@<:@="--ARG1 ..."@:>@], diff --git a/0004-firmware-makefile-install-BIOS-blob.patch b/0004-firmware-makefile-install-BIOS-blob.patch new file mode 100644 index 0000000..623e126 --- /dev/null +++ b/0004-firmware-makefile-install-BIOS-blob.patch @@ -0,0 +1,43 @@ +From b44077cb7b2844d083ddae0d2174d4ae8a5101b6 Mon Sep 17 00:00:00 2001 +From: Anthony PERARD +Date: Mon, 14 Mar 2016 17:55:39 +0000 +Subject: [PATCH 04/15] firmware/makefile: install BIOS blob ... + +... into the firmware directory, along with hvmloader. + +Signed-off-by: Anthony PERARD +--- + tools/firmware/Makefile | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +Index: xen-4.7.0-testing/tools/firmware/Makefile +=================================================================== +--- xen-4.7.0-testing.orig/tools/firmware/Makefile ++++ xen-4.7.0-testing/tools/firmware/Makefile +@@ -19,6 +19,9 @@ SUBDIRS-y += hvmloader + + LD32BIT-$(CONFIG_FreeBSD) := LD32BIT_FLAG=-melf_i386_fbsd + ++SEABIOS_ROM := seabios-dir/out/bios.bin ++OVMF_ROM := ovmf-dir/ovmf.bin ++ + ovmf-dir: + GIT=$(GIT) $(XEN_ROOT)/scripts/git-checkout.sh $(OVMF_UPSTREAM_URL) $(OVMF_UPSTREAM_REVISION) ovmf-dir + cp ovmf-makefile ovmf-dir/Makefile; +@@ -45,6 +48,16 @@ endif + install: all + [ -d $(INST_DIR) ] || $(INSTALL_DIR) $(INST_DIR) + [ ! -e $(TARGET) ] || $(INSTALL_DATA) $(TARGET) $(INST_DIR) ++ifeq ($(CONFIG_SEABIOS),y) ++ifeq ($(SEABIOS_PATH),) ++ $(INSTALL_DATA) $(SEABIOS_ROM) $(INST_DIR)/seabios.bin ++endif ++endif ++ifeq ($(CONFIG_OVMF),y) ++ifeq ($(OVMF_PATH),) ++ $(INSTALL_DATA) $(OVMF_ROM) $(INST_DIR)/ovmf.bin ++endif ++endif + + .PHONY: clean + clean: subdirs-clean diff --git a/0005-libxl-Load-guest-BIOS-from-file.patch b/0005-libxl-Load-guest-BIOS-from-file.patch new file mode 100644 index 0000000..f421001 --- /dev/null +++ b/0005-libxl-Load-guest-BIOS-from-file.patch @@ -0,0 +1,212 @@ +From a8eef037b010662e73428907af761b6d2aef4eae Mon Sep 17 00:00:00 2001 +From: Anthony PERARD +Date: Mon, 14 Mar 2016 17:55:40 +0000 +Subject: [PATCH 05/15] libxl: Load guest BIOS from file + +The path to the BIOS blob can be override by the xl's bios_override option, +or provided by u.hvm.bios_firmware in the domain_build_info struct by other +libxl user. + +Signed-off-by: Anthony PERARD +--- + docs/man/xl.cfg.pod.5 | 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(-) + +Index: xen-4.7.0-testing/docs/man/xl.cfg.pod.5 +=================================================================== +--- xen-4.7.0-testing.orig/docs/man/xl.cfg.pod.5 ++++ xen-4.7.0-testing/docs/man/xl.cfg.pod.5 +@@ -1268,6 +1268,15 @@ Requires device_model_version=qemu-xen. + + =back + ++=item B ++ ++Override the path to the blob to be used as BIOS. The blob provided here MUST ++be consistent with the `bios` which you have specified. You should not normally ++need to specify this option. ++ ++This options does not have any effect if using bios="rombios" or ++device_model_version="qemu-xen-traditional". ++ + =item B + + Hide or expose the IA32 Physical Address Extensions. These extensions +Index: xen-4.7.0-testing/tools/libxl/libxl.h +=================================================================== +--- xen-4.7.0-testing.orig/tools/libxl/libxl.h ++++ xen-4.7.0-testing/tools/libxl/libxl.h +@@ -947,6 +947,14 @@ void libxl_mac_copy(libxl_ctx *ctx, libx + #define LIBXL_HAVE_CHECKPOINTED_STREAM 1 + + /* ++ * LIBXL_HAVE_BUILDINFO_HVM_BIOS_FIRMWARE ++ * ++ * libxl_domain_build_info has u.hvm.bios_firmware field which can be use ++ * to provide a different bios blob (like SeaBIOS or OVMF). ++ */ ++#define LIBXL_HAVE_BUILDINFO_HVM_BIOS_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 + */ +Index: xen-4.7.0-testing/tools/libxl/libxl_dom.c +=================================================================== +--- xen-4.7.0-testing.orig/tools/libxl/libxl_dom.c ++++ xen-4.7.0-testing/tools/libxl/libxl_dom.c +@@ -860,6 +860,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 e; ++ ++ LOG(DEBUG, "Loading %s: %s", what, filename); ++ e = libxl_read_file_contents(CTX, filename, &data, &datalen); ++ if (e) { ++ /* ++ * Print a message only on ENOENT, other error are logged by the ++ * function libxl_read_file_contents(). ++ */ ++ if (e == ENOENT) ++ LOGEV(ERROR, e, "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; ++} ++ + static int libxl__domain_firmware(libxl__gc *gc, + libxl_domain_build_info *info, + struct xc_dom_image *dom) +@@ -869,6 +901,7 @@ static int libxl__domain_firmware(libxl_ + int e, rc; + int datalen = 0; + void *data; ++ const char *bios_filename = NULL; + + if (info->u.hvm.firmware) + firmware = info->u.hvm.firmware; +@@ -912,6 +945,30 @@ static int libxl__domain_firmware(libxl_ + goto out; + } + ++ if (info->device_model_version == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) { ++ if (info->u.hvm.bios_firmware) { ++ bios_filename = info->u.hvm.bios_firmware; ++ } else { ++ switch (info->u.hvm.bios) { ++ case LIBXL_BIOS_TYPE_SEABIOS: ++ bios_filename = libxl__seabios_path(); ++ break; ++ case LIBXL_BIOS_TYPE_OVMF: ++ bios_filename = libxl__ovmf_path(); ++ break; ++ case LIBXL_BIOS_TYPE_ROMBIOS: ++ default: ++ abort(); ++ } ++ } ++ } ++ ++ if (bios_filename) { ++ rc = libxl__load_hvm_firmware_module(gc, bios_filename, "BIOS", ++ &dom->bios_module); ++ if (rc) goto out; ++ } ++ + if (info->u.hvm.smbios_firmware) { + data = NULL; + e = libxl_read_file_contents(ctx, info->u.hvm.smbios_firmware, +Index: xen-4.7.0-testing/tools/libxl/libxl_internal.h +=================================================================== +--- xen-4.7.0-testing.orig/tools/libxl/libxl_internal.h ++++ xen-4.7.0-testing/tools/libxl/libxl_internal.h +@@ -2317,6 +2317,8 @@ _hidden const char *libxl__xen_config_di + _hidden const char *libxl__xen_script_dir_path(void); + _hidden const char *libxl__lock_dir_path(void); + _hidden const char *libxl__run_dir_path(void); ++_hidden const char *libxl__seabios_path(void); ++_hidden const char *libxl__ovmf_path(void); + + /*----- subprocess execution with timeout -----*/ + +Index: xen-4.7.0-testing/tools/libxl/libxl_paths.c +=================================================================== +--- xen-4.7.0-testing.orig/tools/libxl/libxl_paths.c ++++ xen-4.7.0-testing/tools/libxl/libxl_paths.c +@@ -35,6 +35,16 @@ const char *libxl__run_dir_path(void) + return XEN_RUN_DIR; + } + ++const char *libxl__seabios_path(void) ++{ ++ return SEABIOS_PATH; ++} ++ ++const char *libxl__ovmf_path(void) ++{ ++ return OVMF_PATH; ++} ++ + /* + * Local variables: + * mode: C +Index: xen-4.7.0-testing/tools/libxl/libxl_types.idl +=================================================================== +--- xen-4.7.0-testing.orig/tools/libxl/libxl_types.idl ++++ xen-4.7.0-testing/tools/libxl/libxl_types.idl +@@ -513,6 +513,7 @@ libxl_domain_build_info = Struct("domain + ("timer_mode", libxl_timer_mode), + ("nested_hvm", libxl_defbool), + ("altp2m", libxl_defbool), ++ ("bios_firmware", string), + ("smbios_firmware", string), + ("acpi_firmware", string), + ("hdtype", libxl_hdtype), +Index: xen-4.7.0-testing/tools/libxl/xl_cmdimpl.c +=================================================================== +--- xen-4.7.0-testing.orig/tools/libxl/xl_cmdimpl.c ++++ xen-4.7.0-testing/tools/libxl/xl_cmdimpl.c +@@ -1562,12 +1562,17 @@ static void parse_config_data(const char + + xlu_cfg_replace_string (config, "firmware_override", + &b_info->u.hvm.firmware, 0); +- if (!xlu_cfg_get_string(config, "bios", &buf, 0) && +- libxl_bios_type_from_string(buf, &b_info->u.hvm.bios)) { ++ xlu_cfg_replace_string (config, "bios_override", ++ &b_info->u.hvm.bios_firmware, 0); ++ if (!xlu_cfg_get_string(config, "bios", &buf, 0)) { ++ if (libxl_bios_type_from_string(buf, &b_info->u.hvm.bios)) { + fprintf(stderr, "ERROR: invalid value \"%s\" for \"bios\"\n", + buf); + exit (1); +- } ++ } ++ } else if (b_info->u.hvm.bios_firmware) ++ fprintf(stderr, "WARNING: " ++ "bios_override given without specific bios name\n"); + + xlu_cfg_get_defbool(config, "pae", &b_info->u.hvm.pae, 0); + xlu_cfg_get_defbool(config, "apic", &b_info->u.hvm.apic, 0); diff --git a/0006-xen-Move-the-hvm_start_info-C-representation-from-li.patch b/0006-xen-Move-the-hvm_start_info-C-representation-from-li.patch new file mode 100644 index 0000000..8f85ca8 --- /dev/null +++ b/0006-xen-Move-the-hvm_start_info-C-representation-from-li.patch @@ -0,0 +1,99 @@ +From b920bea09b69c1cdd5bb4c5964ce20d0bf7ced8b Mon Sep 17 00:00:00 2001 +From: Anthony PERARD +Date: Mon, 14 Mar 2016 17:55:41 +0000 +Subject: [PATCH 06/15] xen: Move the hvm_start_info C representation from + libxc to public/xen.h + +Instead of having several representation of hvm_start_info in C, define +it in public/xen.h so both libxc and hvmloader can use it. + +Signed-off-by: Anthony PERARD +--- + tools/libxc/include/xc_dom.h | 31 ------------------------------- + xen/include/public/xen.h | 31 +++++++++++++++++++++++++++++++ + 2 files changed, 31 insertions(+), 31 deletions(-) + +Index: xen-4.7.0-testing/tools/libxc/include/xc_dom.h +=================================================================== +--- xen-4.7.0-testing.orig/tools/libxc/include/xc_dom.h ++++ xen-4.7.0-testing/tools/libxc/include/xc_dom.h +@@ -219,37 +219,6 @@ struct xc_dom_image { + struct xc_hvm_firmware_module smbios_module; + }; + +-#if defined(__i386__) || defined(__x86_64__) +-/* C representation of the x86/HVM start info layout. +- * +- * The canonical definition of this layout resides in public/xen.h, this +- * is just a way to represent the layout described there using C types. +- * +- * NB: the packed attribute is not really needed, but it helps us enforce +- * the fact this this is just a representation, and it might indeed +- * be required in the future if there are alignment changes. +- */ +-struct hvm_start_info { +- uint32_t magic; /* Contains the magic value 0x336ec578 */ +- /* ("xEn3" with the 0x80 bit of the "E" set).*/ +- uint32_t version; /* Version of this structure. */ +- uint32_t flags; /* SIF_xxx flags. */ +- uint32_t nr_modules; /* Number of modules passed to the kernel. */ +- uint64_t modlist_paddr; /* Physical address of an array of */ +- /* hvm_modlist_entry. */ +- uint64_t cmdline_paddr; /* Physical address of the command line. */ +- uint64_t rsdp_paddr; /* Physical address of the RSDP ACPI data */ +- /* structure. */ +-} __attribute__((packed)); +- +-struct hvm_modlist_entry { +- uint64_t paddr; /* Physical address of the module. */ +- uint64_t size; /* Size of the module in bytes. */ +- uint64_t cmdline_paddr; /* Physical address of the command line. */ +- uint64_t reserved; +-} __attribute__((packed)); +-#endif /* x86 */ +- + /* --- pluggable kernel loader ------------------------------------- */ + + struct xc_dom_loader { +Index: xen-4.7.0-testing/xen/include/public/xen.h +=================================================================== +--- xen-4.7.0-testing.orig/xen/include/public/xen.h ++++ xen-4.7.0-testing/xen/include/public/xen.h +@@ -859,6 +859,37 @@ typedef struct start_info start_info_t; + */ + #define XEN_HVM_START_MAGIC_VALUE 0x336ec578 + ++#if defined(__i386__) || defined(__x86_64__) ++/* C representation of the x86/HVM start info layout. ++ * ++ * The canonical definition of this layout resides in public/xen.h, this ++ * is just a way to represent the layout described there using C types. ++ * ++ * NB: the packed attribute is not really needed, but it helps us enforce ++ * the fact this this is just a representation, and it might indeed ++ * be required in the future if there are alignment changes. ++ */ ++struct hvm_start_info { ++ uint32_t magic; /* Contains the magic value 0x336ec578 */ ++ /* ("xEn3" with the 0x80 bit of the "E" set).*/ ++ uint32_t version; /* Version of this structure. */ ++ uint32_t flags; /* SIF_xxx flags. */ ++ uint32_t nr_modules; /* Number of modules passed to the kernel. */ ++ uint64_t modlist_paddr; /* Physical address of an array of */ ++ /* hvm_modlist_entry. */ ++ uint64_t cmdline_paddr; /* Physical address of the command line. */ ++ uint64_t rsdp_paddr; /* Physical address of the RSDP ACPI data */ ++ /* structure. */ ++} __attribute__((packed)); ++ ++struct hvm_modlist_entry { ++ uint64_t paddr; /* Physical address of the module. */ ++ uint64_t size; /* Size of the module in bytes. */ ++ uint64_t cmdline_paddr; /* Physical address of the command line. */ ++ uint64_t reserved; ++} __attribute__((packed)); ++#endif /* x86 */ ++ + /* New console union for dom0 introduced in 0x00030203. */ + #if __XEN_INTERFACE_VERSION__ < 0x00030203 + #define console_mfn console.domU.mfn diff --git a/0007-hvmloader-Grab-the-hvm_start_info-pointer.patch b/0007-hvmloader-Grab-the-hvm_start_info-pointer.patch new file mode 100644 index 0000000..4c9b546 --- /dev/null +++ b/0007-hvmloader-Grab-the-hvm_start_info-pointer.patch @@ -0,0 +1,55 @@ +From e3d13cec19a919b06dea49edd64a50c68e1094a7 Mon Sep 17 00:00:00 2001 +From: Anthony PERARD +Date: Mon, 14 Mar 2016 17:55:42 +0000 +Subject: [PATCH 07/15] hvmloader: Grab the hvm_start_info pointer + +Signed-off-by: Anthony PERARD +--- + tools/firmware/hvmloader/hvmloader.c | 5 +++++ + tools/firmware/hvmloader/util.h | 3 +++ + 2 files changed, 8 insertions(+) + +Index: xen-4.7.0-testing/tools/firmware/hvmloader/hvmloader.c +=================================================================== +--- xen-4.7.0-testing.orig/tools/firmware/hvmloader/hvmloader.c ++++ xen-4.7.0-testing/tools/firmware/hvmloader/hvmloader.c +@@ -29,6 +29,8 @@ + #include + #include + ++const struct hvm_start_info *hvm_start_info; ++ + asm ( + " .text \n" + " .globl _start \n" +@@ -46,6 +48,8 @@ asm ( + " ljmp $"STR(SEL_CODE32)",$1f \n" + "1: movl $stack_top,%esp \n" + " movl %esp,%ebp \n" ++ /* store HVM start info ptr */ ++ " mov %ebx, hvm_start_info \n" + " call main \n" + /* Relocate real-mode trampoline to 0x0. */ + " mov $trampoline_start,%esi \n" +@@ -258,6 +262,7 @@ int main(void) + memset((void *)HYPERCALL_PHYSICAL_ADDRESS, 0xc3 /* RET */, PAGE_SIZE); + + printf("HVM Loader\n"); ++ BUG_ON(hvm_start_info->magic != XEN_HVM_START_MAGIC_VALUE); + + init_hypercalls(); + +Index: xen-4.7.0-testing/tools/firmware/hvmloader/util.h +=================================================================== +--- xen-4.7.0-testing.orig/tools/firmware/hvmloader/util.h ++++ xen-4.7.0-testing/tools/firmware/hvmloader/util.h +@@ -158,6 +158,9 @@ static inline void cpu_relax(void) + struct hvm_info_table *get_hvm_info_table(void) __attribute__ ((const)); + #define hvm_info (get_hvm_info_table()) + ++/* HVM start info */ ++extern const struct hvm_start_info *hvm_start_info; ++ + /* String and memory functions */ + int strcmp(const char *cs, const char *ct); + int strncmp(const char *s1, const char *s2, uint32_t n); diff --git a/0008-hvmloader-Locate-the-BIOS-blob.patch b/0008-hvmloader-Locate-the-BIOS-blob.patch new file mode 100644 index 0000000..848350f --- /dev/null +++ b/0008-hvmloader-Locate-the-BIOS-blob.patch @@ -0,0 +1,139 @@ +From 463aedc4fd6e09518b4711e931048bf932b6ee39 Mon Sep 17 00:00:00 2001 +From: Anthony PERARD +Date: Mon, 14 Mar 2016 17:55:43 +0000 +Subject: [PATCH 08/15] hvmloader: Locate the BIOS blob + +The BIOS can be found an entry called "bios" of the modlist of the +hvm_start_info struct. + +The found BIOS blob is not loaded by this patch, but only passed as +argument to bios_load() function. It is going to be used by the next few +patches. + +Signed-off-by: Anthony PERARD +--- + tools/firmware/hvmloader/config.h | 2 +- + tools/firmware/hvmloader/hvmloader.c | 42 ++++++++++++++++++++++++++++++++++-- + tools/firmware/hvmloader/ovmf.c | 3 ++- + tools/firmware/hvmloader/rombios.c | 3 ++- + tools/firmware/hvmloader/util.h | 2 ++ + 5 files changed, 47 insertions(+), 5 deletions(-) + +Index: xen-4.7.0-testing/tools/firmware/hvmloader/config.h +=================================================================== +--- xen-4.7.0-testing.orig/tools/firmware/hvmloader/config.h ++++ xen-4.7.0-testing/tools/firmware/hvmloader/config.h +@@ -22,7 +22,7 @@ struct bios_config { + /* ROMS */ + void (*load_roms)(void); + +- void (*bios_load)(const struct bios_config *config); ++ void (*bios_load)(const struct bios_config *config, void *addr, uint32_t size); + + void (*bios_info_setup)(void); + void (*bios_info_finish)(void); +Index: xen-4.7.0-testing/tools/firmware/hvmloader/hvmloader.c +=================================================================== +--- xen-4.7.0-testing.orig/tools/firmware/hvmloader/hvmloader.c ++++ xen-4.7.0-testing/tools/firmware/hvmloader/hvmloader.c +@@ -253,10 +253,40 @@ static void acpi_enable_sci(void) + BUG_ON(!(pm1a_cnt_val & ACPI_PM1C_SCI_EN)); + } + ++const struct hvm_modlist_entry *get_module_entry( ++ const struct hvm_start_info *info, ++ const char *name) ++{ ++ const struct hvm_modlist_entry *modlist = ++ (struct hvm_modlist_entry *)((uintptr_t)info->modlist_paddr); ++ unsigned int i; ++ ++ if ( !modlist ) ++ return NULL; ++ ++ for ( i = 0; i < info->nr_modules; i++ ) ++ { ++ uint32_t module_name = modlist[i].cmdline_paddr; ++ ++ BUG_ON(!modlist[i].cmdline_paddr || ++ modlist[i].cmdline_paddr > UINT_MAX); ++ ++ if ( !strcmp(name, (char*)module_name) ) ++ { ++ BUG_ON(!modlist[i].paddr || modlist[i].paddr > UINT_MAX || ++ modlist[i].size > UINT_MAX); ++ return &modlist[i]; ++ } ++ } ++ ++ return NULL; ++} ++ + int main(void) + { + const struct bios_config *bios; + int acpi_enabled; ++ const struct hvm_modlist_entry *bios_module; + + /* Initialise hypercall stubs with RET, rendering them no-ops. */ + memset((void *)HYPERCALL_PHYSICAL_ADDRESS, 0xc3 /* RET */, PAGE_SIZE); +@@ -292,8 +322,16 @@ int main(void) + } + + printf("Loading %s ...\n", bios->name); +- if ( bios->bios_load ) +- bios->bios_load(bios); ++ bios_module = get_module_entry(hvm_start_info, "bios"); ++ if ( bios_module && bios->bios_load ) ++ { ++ uint32_t paddr = bios_module->paddr; ++ bios->bios_load(bios, (void*)paddr, bios_module->size); ++ } ++ else if ( bios->bios_load ) ++ { ++ bios->bios_load(bios, 0, 0); ++ } + else + { + BUG_ON(bios->bios_address + bios->image_size > +Index: xen-4.7.0-testing/tools/firmware/hvmloader/ovmf.c +=================================================================== +--- xen-4.7.0-testing.orig/tools/firmware/hvmloader/ovmf.c ++++ xen-4.7.0-testing/tools/firmware/hvmloader/ovmf.c +@@ -93,7 +93,8 @@ static void ovmf_finish_bios_info(void) + info->checksum = -checksum; + } + +-static void ovmf_load(const struct bios_config *config) ++static void ovmf_load(const struct bios_config *config, ++ void *bios_addr, uint32_t bios_length) + { + xen_pfn_t mfn; + uint64_t addr = OVMF_BEGIN; +Index: xen-4.7.0-testing/tools/firmware/hvmloader/rombios.c +=================================================================== +--- xen-4.7.0-testing.orig/tools/firmware/hvmloader/rombios.c ++++ xen-4.7.0-testing/tools/firmware/hvmloader/rombios.c +@@ -121,7 +121,8 @@ static void rombios_load_roms(void) + option_rom_phys_addr + option_rom_sz - 1); + } + +-static void rombios_load(const struct bios_config *config) ++static void rombios_load(const struct bios_config *config, ++ void *unused_addr, uint32_t unused_size) + { + uint32_t bioshigh; + struct rombios_info *info; +Index: xen-4.7.0-testing/tools/firmware/hvmloader/util.h +=================================================================== +--- xen-4.7.0-testing.orig/tools/firmware/hvmloader/util.h ++++ xen-4.7.0-testing/tools/firmware/hvmloader/util.h +@@ -34,6 +34,8 @@ enum { + #undef NULL + #define NULL ((void*)0) + ++#define UINT_MAX (~0U) ++ + void __assert_failed(char *assertion, char *file, int line) + __attribute__((noreturn)); + #define ASSERT(p) \ diff --git a/0009-hvmloader-Check-modules-whereabouts-in-perform_tests.patch b/0009-hvmloader-Check-modules-whereabouts-in-perform_tests.patch new file mode 100644 index 0000000..3d04772 --- /dev/null +++ b/0009-hvmloader-Check-modules-whereabouts-in-perform_tests.patch @@ -0,0 +1,44 @@ +From c3f4c5bcf0d8d93b5116f3e368c4739abe2dc06d Mon Sep 17 00:00:00 2001 +From: Anthony PERARD +Date: Mon, 14 Mar 2016 17:55:44 +0000 +Subject: [PATCH 09/15] hvmloader: Check modules whereabouts in perform_tests + +As perform_tests() is going to clear memory past 4MB, we check that the +memory can be use or we skip the tests. + +Signed-off-by: Anthony PERARD +--- + tools/firmware/hvmloader/tests.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +Index: xen-4.7.0-testing/tools/firmware/hvmloader/tests.c +=================================================================== +--- xen-4.7.0-testing.orig/tools/firmware/hvmloader/tests.c ++++ xen-4.7.0-testing/tools/firmware/hvmloader/tests.c +@@ -210,6 +210,26 @@ void perform_tests(void) + return; + } + ++ /* Check that tests does not use memory where modules are stored */ ++ if ( ((uint32_t)hvm_start_info + sizeof(struct hvm_start_info)) > 4 << 20 ++ && (uint32_t)hvm_start_info < 8 << 20 ) ++ { ++ printf("Skipping tests due to memory used by hvm_start_info\n"); ++ return; ++ } ++ for ( unsigned i = 0; i < hvm_start_info->nr_modules; i++ ) ++ { ++ const struct hvm_modlist_entry *modlist = ++ (struct hvm_modlist_entry *)((uintptr_t)hvm_start_info->modlist_paddr); ++ if ( modlist[i].paddr ++ && modlist[i].paddr + modlist[i].size > 4ul << 20 ++ && modlist[i].paddr < 8ul << 20 ) ++ { ++ printf("Skipping tests due to memory used by a module\n"); ++ return; ++ } ++ } ++ + passed = skipped = 0; + for ( i = 0; tests[i].test; i++ ) + { diff --git a/0010-hvmloader-Load-SeaBIOS-from-hvm_start_info-modules.patch b/0010-hvmloader-Load-SeaBIOS-from-hvm_start_info-modules.patch new file mode 100644 index 0000000..f1a5528 --- /dev/null +++ b/0010-hvmloader-Load-SeaBIOS-from-hvm_start_info-modules.patch @@ -0,0 +1,112 @@ +From df9fdafcfc38c931181dae1de3e6a9eee28829d4 Mon Sep 17 00:00:00 2001 +From: Anthony PERARD +Date: Mon, 14 Mar 2016 17:55:45 +0000 +Subject: [PATCH 10/15] hvmloader: Load SeaBIOS from hvm_start_info modules + +... and do not include the SeaBIOS ROM into hvmloader anymore. + +This also fix the dependency on roms.inc, hvmloader.o does not include it. + +Signed-off-by: Anthony PERARD +--- + tools/firmware/hvmloader/Makefile | 15 +-------------- + tools/firmware/hvmloader/seabios.c | 24 ++++++++++++++---------- + 2 files changed, 15 insertions(+), 24 deletions(-) + +Index: xen-4.7.0-testing/tools/firmware/hvmloader/Makefile +=================================================================== +--- xen-4.7.0-testing.orig/tools/firmware/hvmloader/Makefile ++++ xen-4.7.0-testing/tools/firmware/hvmloader/Makefile +@@ -45,7 +45,6 @@ CIRRUSVGA_DEBUG ?= n + + OVMF_DIR := ../ovmf-dir + ROMBIOS_DIR := ../rombios +-SEABIOS_DIR := ../seabios-dir + + ifeq ($(CONFIG_ROMBIOS),y) + STDVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.bin +@@ -80,19 +79,13 @@ endif + ifeq ($(CONFIG_SEABIOS),y) + OBJS += seabios.o + CFLAGS += -DENABLE_SEABIOS +-ifeq ($(SEABIOS_PATH),) +- SEABIOS_ROM := $(SEABIOS_DIR)/out/bios.bin +-else +- SEABIOS_ROM := $(SEABIOS_PATH) +-endif +-ROMS += $(SEABIOS_ROM) + endif + + .PHONY: all + all: subdirs-all + $(MAKE) hvmloader + +-ovmf.o rombios.o seabios.o hvmloader.o: roms.inc ++ovmf.o rombios.o: roms.inc + smbios.o: CFLAGS += -D__SMBIOS_DATE__="\"$(SMBIOS_REL_DATE)\"" + + hvmloader: $(OBJS) acpi/acpi.a +@@ -109,12 +102,6 @@ ifneq ($(ROMBIOS_ROM),) + echo "#endif" >> $@.new + endif + +-ifneq ($(SEABIOS_ROM),) +- echo "#ifdef ROM_INCLUDE_SEABIOS" >> $@.new +- sh ./mkhex seabios $(SEABIOS_ROM) >> $@.new +- echo "#endif" >> $@.new +-endif +- + ifneq ($(OVMF_ROM),) + echo "#ifdef ROM_INCLUDE_OVMF" >> $@.new + sh ./mkhex ovmf $(OVMF_ROM) >> $@.new +Index: xen-4.7.0-testing/tools/firmware/hvmloader/seabios.c +=================================================================== +--- xen-4.7.0-testing.orig/tools/firmware/hvmloader/seabios.c ++++ xen-4.7.0-testing/tools/firmware/hvmloader/seabios.c +@@ -27,9 +27,6 @@ + #include "smbios_types.h" + #include "acpi/acpi2_0.h" + +-#define ROM_INCLUDE_SEABIOS +-#include "roms.inc" +- + extern unsigned char dsdt_anycpu_qemu_xen[]; + extern int dsdt_anycpu_qemu_xen_len; + +@@ -127,22 +124,29 @@ static void seabios_setup_e820(void) + struct e820entry *e820 = scratch_alloc(sizeof(struct e820entry)*16, 0); + info->e820 = (uint32_t)e820; + ++ BUG_ON(seabios_config.bios_address < 0xc0000 || seabios_config.bios_address >= 0x100000); + /* SeaBIOS reserves memory in e820 as necessary so no low reservation. */ +- info->e820_nr = build_e820_table(e820, 0, 0x100000-sizeof(seabios)); ++ info->e820_nr = build_e820_table(e820, 0, seabios_config.bios_address); + dump_e820_table(e820, info->e820_nr); + } + +-struct bios_config seabios_config = { +- .name = "SeaBIOS", ++static void seabios_load(const struct bios_config *bios, ++ void *bios_addr, uint32_t bios_length) ++{ ++ unsigned int bios_dest = 0x100000 - bios_length; + +- .image = seabios, +- .image_size = sizeof(seabios), ++ BUG_ON(bios_dest + bios_length > HVMLOADER_PHYSICAL_ADDRESS); ++ memcpy((void *)bios_dest, bios_addr, bios_length); ++ seabios_config.bios_address = bios_dest; ++ seabios_config.image_size = bios_length; ++} + +- .bios_address = 0x100000 - sizeof(seabios), ++struct bios_config seabios_config = { ++ .name = "SeaBIOS", + + .load_roms = NULL, + +- .bios_load = NULL, ++ .bios_load = seabios_load, + + .bios_info_setup = seabios_setup_bios_info, + .bios_info_finish = seabios_finish_bios_info, diff --git a/0011-hvmloader-Load-OVMF-from-modules.patch b/0011-hvmloader-Load-OVMF-from-modules.patch new file mode 100644 index 0000000..18f45e1 --- /dev/null +++ b/0011-hvmloader-Load-OVMF-from-modules.patch @@ -0,0 +1,131 @@ +From 009fef2fc4bdffd1c9e5caf557157b4949d3842b Mon Sep 17 00:00:00 2001 +From: Anthony PERARD +Date: Mon, 14 Mar 2016 17:55:46 +0000 +Subject: [PATCH 11/15] hvmloader: Load OVMF from modules + +... and do not include the OVMF ROM into hvmloader anymore. + +Signed-off-by: Anthony PERARD +--- + tools/firmware/hvmloader/Makefile | 15 +-------------- + tools/firmware/hvmloader/ovmf.c | 30 +++++++++++++----------------- + 2 files changed, 14 insertions(+), 31 deletions(-) + +Index: xen-4.7.0-testing/tools/firmware/hvmloader/Makefile +=================================================================== +--- xen-4.7.0-testing.orig/tools/firmware/hvmloader/Makefile ++++ xen-4.7.0-testing/tools/firmware/hvmloader/Makefile +@@ -43,7 +43,6 @@ endif + + CIRRUSVGA_DEBUG ?= n + +-OVMF_DIR := ../ovmf-dir + ROMBIOS_DIR := ../rombios + + ifeq ($(CONFIG_ROMBIOS),y) +@@ -61,12 +60,6 @@ ROMS := + ifeq ($(CONFIG_OVMF),y) + OBJS += ovmf.o + CFLAGS += -DENABLE_OVMF +-ifeq ($(OVMF_PATH),) +- OVMF_ROM := $(OVMF_DIR)/ovmf.bin +-else +- OVMF_ROM := $(OVMF_PATH) +-endif +-ROMS += $(OVMF_ROM) + endif + + ifeq ($(CONFIG_ROMBIOS),y) +@@ -85,7 +78,7 @@ endif + all: subdirs-all + $(MAKE) hvmloader + +-ovmf.o rombios.o: roms.inc ++rombios.o: roms.inc + smbios.o: CFLAGS += -D__SMBIOS_DATE__="\"$(SMBIOS_REL_DATE)\"" + + hvmloader: $(OBJS) acpi/acpi.a +@@ -102,12 +95,6 @@ ifneq ($(ROMBIOS_ROM),) + echo "#endif" >> $@.new + endif + +-ifneq ($(OVMF_ROM),) +- echo "#ifdef ROM_INCLUDE_OVMF" >> $@.new +- sh ./mkhex ovmf $(OVMF_ROM) >> $@.new +- echo "#endif" >> $@.new +-endif +- + ifneq ($(STDVGA_ROM),) + echo "#ifdef ROM_INCLUDE_VGABIOS" >> $@.new + sh ./mkhex vgabios_stdvga $(STDVGA_ROM) >> $@.new +Index: xen-4.7.0-testing/tools/firmware/hvmloader/ovmf.c +=================================================================== +--- xen-4.7.0-testing.orig/tools/firmware/hvmloader/ovmf.c ++++ xen-4.7.0-testing/tools/firmware/hvmloader/ovmf.c +@@ -34,17 +34,10 @@ + #include + #include + +-#define ROM_INCLUDE_OVMF +-#include "roms.inc" +- +-#define OVMF_SIZE (sizeof(ovmf)) + #define OVMF_MAXOFFSET 0x000FFFFFULL +-#define OVMF_BEGIN (0x100000000ULL - ((OVMF_SIZE + OVMF_MAXOFFSET) & ~OVMF_MAXOFFSET)) +-#define OVMF_END (OVMF_BEGIN + OVMF_SIZE) + #define LOWCHUNK_BEGIN 0x000F0000 + #define LOWCHUNK_SIZE 0x00010000 + #define LOWCHUNK_MAXOFFSET 0x0000FFFF +-#define LOWCHUNK_END (OVMF_BEGIN + OVMF_SIZE) + #define OVMF_INFO_PHYSICAL_ADDRESS 0x00001000 + + extern unsigned char dsdt_anycpu_qemu_xen[]; +@@ -97,24 +90,31 @@ static void ovmf_load(const struct bios_ + void *bios_addr, uint32_t bios_length) + { + xen_pfn_t mfn; +- uint64_t addr = OVMF_BEGIN; ++ uint64_t addr = 0x100000000ULL ++ - ((bios_length + OVMF_MAXOFFSET) & ~OVMF_MAXOFFSET); ++ uint64_t ovmf_end = addr + bios_length; ++ ++ ovmf_config.bios_address = addr; ++ ovmf_config.image_size = bios_length; + + /* Copy low-reset vector portion. */ +- memcpy((void *) LOWCHUNK_BEGIN, (uint8_t *) config->image +- + OVMF_SIZE +- - LOWCHUNK_SIZE, ++ memcpy((void *) LOWCHUNK_BEGIN, ++ (uint8_t *) bios_addr + bios_length - LOWCHUNK_SIZE, + LOWCHUNK_SIZE); + + /* Ensure we have backing page prior to moving FD. */ +- while ( (addr >> PAGE_SHIFT) != (OVMF_END >> PAGE_SHIFT) ) ++ while ( (addr >> PAGE_SHIFT) != (ovmf_end >> PAGE_SHIFT) ) + { + mfn = (uint32_t) (addr >> PAGE_SHIFT); + addr += PAGE_SIZE; + mem_hole_populate_ram(mfn, 1); + } + ++ /* Check that source and destination does not overlaps. */ ++ BUG_ON(addr + bios_length > (unsigned)bios_addr ++ && addr < (unsigned)bios_addr + bios_length); + /* Copy FD. */ +- memcpy((void *) OVMF_BEGIN, config->image, OVMF_SIZE); ++ memcpy((void *) ovmf_config.bios_address, bios_addr, bios_length); + } + + static void ovmf_acpi_build_tables(void) +@@ -151,10 +151,6 @@ static void ovmf_setup_e820(void) + struct bios_config ovmf_config = { + .name = "OVMF", + +- .image = ovmf, +- .image_size = sizeof(ovmf), +- +- .bios_address = OVMF_BEGIN, + .bios_load = ovmf_load, + + .load_roms = 0, diff --git a/0012-hvmloader-Specific-bios_load-function-required.patch b/0012-hvmloader-Specific-bios_load-function-required.patch new file mode 100644 index 0000000..6b57635 --- /dev/null +++ b/0012-hvmloader-Specific-bios_load-function-required.patch @@ -0,0 +1,51 @@ +From 258c5050f08bdf69394dd8790398b6dfe453886e Mon Sep 17 00:00:00 2001 +From: Anthony PERARD +Date: Mon, 14 Mar 2016 17:55:47 +0000 +Subject: [PATCH 12/15] hvmloader: Specific bios_load function required + +All BIOS but ROMBIOS needs to be loaded via modules. + +ROMBIOS is handled as a special case. + +Signed-off-by: Anthony PERARD +Acked-by: Jan Beulich +--- + tools/firmware/hvmloader/hvmloader.c | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +Index: xen-4.7.0-testing/tools/firmware/hvmloader/hvmloader.c +=================================================================== +--- xen-4.7.0-testing.orig/tools/firmware/hvmloader/hvmloader.c ++++ xen-4.7.0-testing/tools/firmware/hvmloader/hvmloader.c +@@ -323,21 +323,25 @@ int main(void) + + printf("Loading %s ...\n", bios->name); + bios_module = get_module_entry(hvm_start_info, "bios"); +- if ( bios_module && bios->bios_load ) ++ if ( bios_module ) + { + uint32_t paddr = bios_module->paddr; + bios->bios_load(bios, (void*)paddr, bios_module->size); + } +- else if ( bios->bios_load ) ++#ifdef ENABLE_ROMBIOS ++ else if ( bios == &rombios_config ) + { + bios->bios_load(bios, 0, 0); + } ++#endif + else + { +- BUG_ON(bios->bios_address + bios->image_size > +- HVMLOADER_PHYSICAL_ADDRESS); +- memcpy((void *)bios->bios_address, bios->image, +- bios->image_size); ++ /* ++ * If there is no BIOS module supplied and if there is no embeded BIOS ++ * image, then we failed. Only rombios might have an embedded bios blob. ++ */ ++ printf("no BIOS ROM image found\n"); ++ BUG(); + } + + if ( (hvm_info->nr_vcpus > 1) || hvm_info->apic_mode ) diff --git a/0013-hvmloader-Always-build-in-SeaBIOS-and-OVMF-loader.patch b/0013-hvmloader-Always-build-in-SeaBIOS-and-OVMF-loader.patch new file mode 100644 index 0000000..0808125 --- /dev/null +++ b/0013-hvmloader-Always-build-in-SeaBIOS-and-OVMF-loader.patch @@ -0,0 +1,65 @@ +From e7497ead178f01fd5c94cfb8506d31b77cc38c94 Mon Sep 17 00:00:00 2001 +From: Anthony PERARD +Date: Mon, 14 Mar 2016 17:55:48 +0000 +Subject: [PATCH 13/15] hvmloader: Always build-in SeaBIOS and OVMF loader + +Signed-off-by: Anthony PERARD +Acked-by: Jan Beulich +--- + tools/firmware/hvmloader/Makefile | 11 +---------- + tools/firmware/hvmloader/hvmloader.c | 4 ---- + 2 files changed, 1 insertion(+), 14 deletions(-) + +Index: xen-4.7.0-testing/tools/firmware/hvmloader/Makefile +=================================================================== +--- xen-4.7.0-testing.orig/tools/firmware/hvmloader/Makefile ++++ xen-4.7.0-testing/tools/firmware/hvmloader/Makefile +@@ -37,6 +37,7 @@ OBJS = hvmloader.o mp_tables.o util.o s + OBJS += smp.o cacheattr.o xenbus.o vnuma.o + OBJS += e820.o pci.o pir.o ctype.o + OBJS += hvm_param.o ++OBJS += ovmf.o seabios.o + ifeq ($(debug),y) + OBJS += tests.o + endif +@@ -57,11 +58,6 @@ endif + + ROMS := + +-ifeq ($(CONFIG_OVMF),y) +-OBJS += ovmf.o +-CFLAGS += -DENABLE_OVMF +-endif +- + ifeq ($(CONFIG_ROMBIOS),y) + OBJS += optionroms.o 32bitbios_support.o rombios.o + CFLAGS += -DENABLE_ROMBIOS +@@ -69,11 +65,6 @@ ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs + ROMS += $(ROMBIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM) $(ETHERBOOT_ROMS) + endif + +-ifeq ($(CONFIG_SEABIOS),y) +-OBJS += seabios.o +-CFLAGS += -DENABLE_SEABIOS +-endif +- + .PHONY: all + all: subdirs-all + $(MAKE) hvmloader +Index: xen-4.7.0-testing/tools/firmware/hvmloader/hvmloader.c +=================================================================== +--- xen-4.7.0-testing.orig/tools/firmware/hvmloader/hvmloader.c ++++ xen-4.7.0-testing/tools/firmware/hvmloader/hvmloader.c +@@ -209,12 +209,8 @@ struct bios_info { + #ifdef ENABLE_ROMBIOS + { "rombios", &rombios_config, }, + #endif +-#ifdef ENABLE_SEABIOS + { "seabios", &seabios_config, }, +-#endif +-#ifdef ENABLE_OVMF + { "ovmf", &ovmf_config, }, +-#endif + { NULL, NULL } + }; + diff --git a/0014-configure-do-not-depend-on-SEABIOS_PATH-or-OVMF_PATH.patch b/0014-configure-do-not-depend-on-SEABIOS_PATH-or-OVMF_PATH.patch new file mode 100644 index 0000000..e0c9b56 --- /dev/null +++ b/0014-configure-do-not-depend-on-SEABIOS_PATH-or-OVMF_PATH.patch @@ -0,0 +1,84 @@ +From d42d9e59472e2c637776245db8e80de0b907d46b Mon Sep 17 00:00:00 2001 +From: Anthony PERARD +Date: Mon, 14 Mar 2016 17:55:49 +0000 +Subject: [PATCH 14/15] configure: do not depend on SEABIOS_PATH or OVMF_PATH + ... + +... to compile SeaBIOS and OVMF. Only depends on CONFIG_*. + +If --with-system-* configure option is used, then set *_CONFIG=n to not +compile SEABIOS and OVMF. + +Signed-off-by: Anthony PERARD +--- + tools/configure.ac | 6 ++++-- + tools/firmware/Makefile | 8 -------- + 2 files changed, 4 insertions(+), 10 deletions(-) + +Index: xen-4.7.0-testing/tools/configure.ac +=================================================================== +--- xen-4.7.0-testing.orig/tools/configure.ac ++++ xen-4.7.0-testing/tools/configure.ac +@@ -212,12 +212,13 @@ AC_ARG_WITH([system-seabios], + AS_HELP_STRING([--with-system-seabios@<:@=PATH@:>@], + [Use system supplied seabios PATH instead of building and installing + our own version]),[ ++ # Disable compilation of SeaBIOS. ++ seabios=n + case $withval in + no) seabios_path= ;; + *) seabios_path=$withval ;; + esac + ],[]) +-AC_SUBST(seabios_path) + AC_DEFINE_UNQUOTED([SEABIOS_PATH], + ["${seabios_path:-$XENFIRMWAREDIR/seabios.bin}"], + [SeaBIOS path]) +@@ -226,12 +227,13 @@ AC_ARG_WITH([system-ovmf], + AS_HELP_STRING([--with-system-ovmf@<:@=PATH@:>@], + [Use system supplied OVMF PATH instead of building and installing + our own version]),[ ++ # Disable compilation of OVMF. ++ ovmf=n + case $withval in + no) ovmf_path= ;; + *) ovmf_path=$withval ;; + esac + ],[]) +-AC_SUBST(ovmf_path) + AC_DEFINE_UNQUOTED([OVMF_PATH], + ["${ovmf_path:-$XENFIRMWAREDIR/ovmf.bin}"], + [OVMF path]) +Index: xen-4.7.0-testing/tools/firmware/Makefile +=================================================================== +--- xen-4.7.0-testing.orig/tools/firmware/Makefile ++++ xen-4.7.0-testing/tools/firmware/Makefile +@@ -6,12 +6,8 @@ TARGET := hvmloader/hvmloader + INST_DIR := $(DESTDIR)$(XENFIRMWAREDIR) + + SUBDIRS-y := +-ifeq ($(OVMF_PATH),) + SUBDIRS-$(CONFIG_OVMF) += ovmf-dir +-endif +-ifeq ($(SEABIOS_PATH),) + SUBDIRS-$(CONFIG_SEABIOS) += seabios-dir +-endif + SUBDIRS-$(CONFIG_ROMBIOS) += rombios + SUBDIRS-$(CONFIG_ROMBIOS) += vgabios + SUBDIRS-$(CONFIG_ROMBIOS) += etherboot +@@ -49,15 +45,11 @@ install: all + [ -d $(INST_DIR) ] || $(INSTALL_DIR) $(INST_DIR) + [ ! -e $(TARGET) ] || $(INSTALL_DATA) $(TARGET) $(INST_DIR) + ifeq ($(CONFIG_SEABIOS),y) +-ifeq ($(SEABIOS_PATH),) + $(INSTALL_DATA) $(SEABIOS_ROM) $(INST_DIR)/seabios.bin + endif +-endif + ifeq ($(CONFIG_OVMF),y) +-ifeq ($(OVMF_PATH),) + $(INSTALL_DATA) $(OVMF_ROM) $(INST_DIR)/ovmf.bin + endif +-endif + + .PHONY: clean + clean: subdirs-clean diff --git a/55f7f9d2-libxl-slightly-refine-pci-assignable-add-remove-handling.patch b/55f7f9d2-libxl-slightly-refine-pci-assignable-add-remove-handling.patch deleted file mode 100644 index f6ccdb7..0000000 --- a/55f7f9d2-libxl-slightly-refine-pci-assignable-add-remove-handling.patch +++ /dev/null @@ -1,106 +0,0 @@ -References: bsc#945167 - -# Commit 6e1e3480c3878bac5d244925974a6852c47c809b -# Date 2015-09-15 11:58:26 +0100 -# Author Jan Beulich -# Committer Ian Campbell -libxl: slightly refine pci-assignable-{add, remove} handling - -While it appears to be intentional for "xl pci-assignable-remove" to -not re-bind the original driver by default (requires the -r option), -permanently losing the information which driver was originally used -seems bad. Make "add; remove; add; remove -r" re-bind the original -driver by allowing "remove" to delete the information only upon -successful re-bind. - -In the course of this I also noticed that binding information is lost -when upon first "add" pciback isn't loaded yet, due to its presence not -being checked for early enough. Adjust pciback_dev_is_assigned() -accordingly, and properly distinguish "yes" and "error" returns in the -"add" case (removing a redundant error message from the "remove" path -for consistency). - -Signed-off-by: Jan Beulich -Reviewed-by: George Dunlap -Acked-by: Ian Campbell - ---- a/tools/libxl/libxl_pci.c -+++ b/tools/libxl/libxl_pci.c -@@ -543,6 +543,17 @@ static int pciback_dev_is_assigned(libxl - int rc; - struct stat st; - -+ if ( access(SYSFS_PCIBACK_DRIVER, F_OK) < 0 ) { -+ if ( errno == ENOENT ) { -+ LIBXL__LOG(ctx, LIBXL__LOG_ERROR, -+ "Looks like pciback driver is not loaded"); -+ } else { -+ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, -+ "Can't access "SYSFS_PCIBACK_DRIVER); -+ } -+ return -1; -+ } -+ - spath = libxl__sprintf(gc, SYSFS_PCIBACK_DRIVER"/"PCI_BDF, - pcidev->domain, pcidev->bus, - pcidev->dev, pcidev->func); -@@ -658,6 +669,7 @@ static int libxl__device_pci_assignable_ - libxl_ctx *ctx = libxl__gc_owner(gc); - unsigned dom, bus, dev, func; - char *spath, *driver_path = NULL; -+ int rc; - struct stat st; - - /* Local copy for convenience */ -@@ -674,7 +686,11 @@ static int libxl__device_pci_assignable_ - } - - /* Check to see if it's already assigned to pciback */ -- if ( pciback_dev_is_assigned(gc, pcidev) ) { -+ rc = pciback_dev_is_assigned(gc, pcidev); -+ if ( rc < 0 ) { -+ return ERROR_FAIL; -+ } -+ if ( rc ) { - LIBXL__LOG(ctx, LIBXL__LOG_WARNING, PCI_BDF" already assigned to pciback", - dom, bus, dev, func); - return 0; -@@ -692,11 +708,18 @@ static int libxl__device_pci_assignable_ - if ( rebind ) { - if ( driver_path ) { - pci_assignable_driver_path_write(gc, pcidev, driver_path); -+ } else if ( (driver_path = -+ pci_assignable_driver_path_read(gc, pcidev)) != NULL ) { -+ LIBXL__LOG(ctx, LIBXL__LOG_INFO, -+ PCI_BDF" not bound to a driver, will be rebound to %s", -+ dom, bus, dev, func, driver_path); - } else { - LIBXL__LOG(ctx, LIBXL__LOG_WARNING, - PCI_BDF" not bound to a driver, will not be rebound.", - dom, bus, dev, func); - } -+ } else { -+ pci_assignable_driver_path_remove(gc, pcidev); - } - - if ( pciback_dev_assign(gc, pcidev) ) { -@@ -717,7 +740,6 @@ static int libxl__device_pci_assignable_ - - /* Unbind from pciback */ - if ( (rc=pciback_dev_is_assigned(gc, pcidev)) < 0 ) { -- LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Checking if pciback was assigned"); - return ERROR_FAIL; - } else if ( rc ) { - pciback_dev_unassign(gc, pcidev); -@@ -741,9 +763,9 @@ static int libxl__device_pci_assignable_ - "Couldn't bind device to %s", driver_path); - return -1; - } -- } - -- pci_assignable_driver_path_remove(gc, pcidev); -+ pci_assignable_driver_path_remove(gc, pcidev); -+ } - } else { - if ( rebind ) { - LIBXL__LOG(ctx, LIBXL__LOG_WARNING, diff --git a/5628fc67-libxl-No-emulated-disk-driver-for-xvdX-disk.patch b/5628fc67-libxl-No-emulated-disk-driver-for-xvdX-disk.patch deleted file mode 100644 index 0d98633..0000000 --- a/5628fc67-libxl-No-emulated-disk-driver-for-xvdX-disk.patch +++ /dev/null @@ -1,31 +0,0 @@ -Subject: libxl: No emulated disk driver for xvdX disk -From: Anthony PERARD anthony.perard@citrix.com Wed Oct 14 12:05:17 2015 +0100 -Date: Thu Oct 22 16:10:31 2015 +0100: -Git: c0c099d157cc5bc942afef766cf141628a6380a1 - -When a guest configuration list xvdX for its disks, there is no need to -provide an emulated driver for the same target. - -Such configuration can work with the OVMF firmware, as it supports PV -disk. - -Signed-off-by: Anthony PERARD -Acked-by: Ian Jackson - -Index: xen-4.6.0-testing/tools/libxl/libxl_dm.c -=================================================================== ---- xen-4.6.0-testing.orig/tools/libxl/libxl_dm.c -+++ xen-4.6.0-testing/tools/libxl/libxl_dm.c -@@ -1152,6 +1152,12 @@ static int libxl__build_device_model_arg - drive = libxl__sprintf - (gc, "file=%s,if=scsi,bus=0,unit=%d,format=%s,cache=writeback", - pdev_path, disk, format); -+ else if (strncmp(disks[i].vdev, "xvd", 3) == 0) -+ /* -+ * Do not add any emulated disk when PV disk are -+ * explicitly asked for. -+ */ -+ continue; - else if (disk < 6 && b_info->u.hvm.hdtype == LIBXL_HDTYPE_AHCI) { - flexarray_vappend(dm_args, "-drive", - GCSPRINTF("file=%s,if=none,id=ahcidisk-%d,format=%s,cache=writeback", diff --git a/5644b756-x86-HVM-don-t-inject-DB-with-error-code.patch b/5644b756-x86-HVM-don-t-inject-DB-with-error-code.patch deleted file mode 100644 index 3f5734e..0000000 --- a/5644b756-x86-HVM-don-t-inject-DB-with-error-code.patch +++ /dev/null @@ -1,20 +0,0 @@ -# Commit 057e0e72d2a5d598087c5f167ec6a13203a3cf65 -# Date 2015-11-12 16:59:18 +0100 -# Author Jan Beulich -# Committer Jan Beulich -x86/HVM: don't inject #DB with error code - -Signed-off-by: Jan Beulich -Reviewed-by: Andrew Cooper - ---- a/xen/arch/x86/hvm/hvm.c -+++ b/xen/arch/x86/hvm/hvm.c -@@ -4071,7 +4071,7 @@ void hvm_task_switch( - goto out; - - if ( (tss.trace & 1) && !exn_raised ) -- hvm_inject_hw_exception(TRAP_debug, tss_sel & 0xfff8); -+ hvm_inject_hw_exception(TRAP_debug, HVM_DELIVER_NO_ERROR_CODE); - - tr.attr.fields.type = 0xb; /* busy 32-bit tss */ - hvm_set_segment_register(v, x86_seg_tr, &tr); diff --git a/5649bcbe-libxl-relax-readonly-check-introduced-by-XSA-142-fix.patch b/5649bcbe-libxl-relax-readonly-check-introduced-by-XSA-142-fix.patch deleted file mode 100644 index 7833ace..0000000 --- a/5649bcbe-libxl-relax-readonly-check-introduced-by-XSA-142-fix.patch +++ /dev/null @@ -1,105 +0,0 @@ -Subject: libxl: relax readonly check introduced by XSA-142 fix -From: Jim Fehlig jfehlig@suse.com Thu Nov 12 19:40:46 2015 -0700 -Date: Mon Nov 16 11:23:42 2015 +0000: -Git: ef6cb76026628e26e3d1ae53c50ccde1c3c78b1b - -The fix for XSA-142 is quite a big hammer, rejecting readonly -disk configuration even when the requested backend is known to -support readonly. While it is true that qemu doesn't support -readonly for emulated IDE or AHCI disks - -$ /usr/lib/xen/bin/qemu-system-i386 \ - -drive file=/tmp/disk.raw,if=ide,media=disk,format=raw,readonly=on -qemu-system-i386: Can't use a read-only drive - -$ /usr/lib/xen/bin/qemu-system-i386 -device ahci,id=ahci0 \ - -drive file=/tmp/disk.raw,if=none,id=ahcidisk-0,format=raw,readonly=on \ - -device ide-hd,bus=ahci0.0,unit=0,drive=ahcidisk-0 -qemu-system-i386: -device ide-hd,bus=ahci0.0,unit=0,drive=ahcidisk-0: -Can't use a read-only drive - -It does support readonly SCSI disks - -$ /usr/lib/xen/bin/qemu-system-i386 \ - -drive file=/tmp/disk.raw,if=scsi,media=disk,format=raw,readonly=on -[ok] - -Inside a guest using such a disk, the SCSI kernel driver sees write -protect on - -[ 7.339232] sd 2:0:1:0: [sdb] Write Protect is on - -Also, PV drivers support readonly, but the patch rejects such -configuration even when PV drivers (vdev=xvd*) have been explicitly -specified and creation of an emulated twin is skiped. - -This follow-up patch loosens the restriction to reject readonly when -creating an emulated IDE or AHCI disk, but allows it when the backend -is known to support readonly. - -Signed-off-by: Jim Fehlig -Acked-by: Stefano Stabellini -Acked-by: Ian Campbell - -Index: xen-4.6.0-testing/tools/libxl/libxl_dm.c -=================================================================== ---- xen-4.6.0-testing.orig/tools/libxl/libxl_dm.c -+++ xen-4.6.0-testing/tools/libxl/libxl_dm.c -@@ -1117,11 +1117,6 @@ static int libxl__build_device_model_arg - (gc, "file=%s,if=ide,index=%d,readonly=%s,media=cdrom,format=%s,cache=writeback,id=ide-%i", - disks[i].pdev_path, disk, disks[i].readwrite ? "off" : "on", format, dev_number); - } else { -- if (!disks[i].readwrite) { -- LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "qemu-xen doesn't support read-only disk drivers"); -- return ERROR_INVAL; -- } -- - if (disks[i].format == LIBXL_DISK_FORMAT_EMPTY) { - LIBXL__LOG(ctx, LIBXL__LOG_WARNING, "cannot support" - " empty disk format for %s", disks[i].vdev); -@@ -1148,29 +1143,38 @@ static int libxl__build_device_model_arg - * For other disks we translate devices 0..3 into - * hd[a-d] and ignore the rest. - */ -- if (strncmp(disks[i].vdev, "sd", 2) == 0) -+ if (strncmp(disks[i].vdev, "sd", 2) == 0) { - drive = libxl__sprintf -- (gc, "file=%s,if=scsi,bus=0,unit=%d,format=%s,cache=writeback", -- pdev_path, disk, format); -- else if (strncmp(disks[i].vdev, "xvd", 3) == 0) -+ (gc, "file=%s,if=scsi,bus=0,unit=%d,format=%s,readonly=%s,cache=writeback", -+ pdev_path, disk, format, disks[i].readwrite ? "off" : "on"); -+ } else if (strncmp(disks[i].vdev, "xvd", 3) == 0) { - /* - * Do not add any emulated disk when PV disk are - * explicitly asked for. - */ - continue; -- else if (disk < 6 && b_info->u.hvm.hdtype == LIBXL_HDTYPE_AHCI) { -+ } else if (disk < 6 && b_info->u.hvm.hdtype == LIBXL_HDTYPE_AHCI) { -+ if (!disks[i].readwrite) { -+ LOG(ERROR, "qemu-xen doesn't support read-only AHCI disk drivers"); -+ return ERROR_INVAL; -+ } - flexarray_vappend(dm_args, "-drive", - GCSPRINTF("file=%s,if=none,id=ahcidisk-%d,format=%s,cache=writeback", - pdev_path, disk, format), - "-device", GCSPRINTF("ide-hd,bus=ahci0.%d,unit=0,drive=ahcidisk-%d", - disk, disk), NULL); - continue; -- } else if (disk < 4) -+ } else if (disk < 4) { -+ if (!disks[i].readwrite) { -+ LOG(ERROR, "qemu-xen doesn't support read-only IDE disk drivers"); -+ return ERROR_INVAL; -+ } - drive = libxl__sprintf - (gc, "file=%s,if=ide,index=%d,media=disk,format=%s,cache=writeback", - pdev_path, disk, format); -- else -+ } else { - continue; /* Do not emulate this disk */ -+ } - } - - flexarray_append(dm_args, "-drive"); diff --git a/CVE-2014-3672-qemut-xsa180.patch b/CVE-2014-3672-qemut-xsa180.patch new file mode 100644 index 0000000..803cd86 --- /dev/null +++ b/CVE-2014-3672-qemut-xsa180.patch @@ -0,0 +1,87 @@ +References: bsc#981264 CVE-2014-3672 XSA-180 + +From 7490dab5c1a01b1623e9d87bdc653cb4f963dd8a Mon Sep 17 00:00:00 2001 +From: Ian Jackson +Date: Thu, 19 May 2016 19:38:35 +0100 +Subject: [PATCH] main loop: Big hammer to fix logfile disk DoS in Xen setups + +Each time round the main loop, we now fstat stderr. If it is too big, +we dup2 /dev/null onto it. This is not a very pretty patch but it is +very simple, easy to see that it's correct, and has a low risk of +collateral damage. + +The limit is 1Mby by default but can be adjusted by setting a new +environment variable. + +This fixes CVE-2014-3672. + +Signed-off-by: Ian Jackson +Tested-by: Ian Jackson +--- + vl.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 46 insertions(+) + +Index: xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/vl.c +=================================================================== +--- xen-4.7.0-testing.orig/tools/qemu-xen-traditional-dir-remote/vl.c ++++ xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/vl.c +@@ -3752,6 +3752,50 @@ static void host_main_loop_wait(int *tim + } + #endif + ++static void check_cve_2014_3672_xen(void) ++{ ++ static unsigned long limit = ~0UL; ++ const int fd = 2; ++ struct stat stab; ++ ++ if (limit == ~0UL) { ++ const char *s = getenv("XEN_QEMU_CONSOLE_LIMIT"); ++ /* XEN_QEMU_CONSOLE_LIMIT=0 means no limit */ ++ limit = s ? strtoul(s,0,0) : 1*1024*1024; ++ } ++ if (limit == 0) ++ return; ++ ++ int r = fstat(fd, &stab); ++ if (r) { ++ perror("fstat stderr (for CVE-2014-3672 check)"); ++ exit(-1); ++ } ++ if (!S_ISREG(stab.st_mode)) ++ return; ++ if (stab.st_size <= limit) ++ return; ++ ++ /* oh dear */ ++ fprintf(stderr,"\r\n" ++ "Closing stderr due to CVE-2014-3672 limit. " ++ " Set XEN_QEMU_CONSOLE_LIMIT to number of bytes to override," ++ " or 0 for no limit.\n"); ++ fflush(stderr); ++ ++ int nfd = open("/dev/null", O_WRONLY); ++ if (nfd < 0) { ++ perror("open /dev/null (for CVE-2014-3672 check)"); ++ exit(-1); ++ } ++ r = dup2(nfd, fd); ++ if (r != fd) { ++ perror("dup2 /dev/null (for CVE-2014-3672 check)"); ++ exit(-1); ++ } ++ close(nfd); ++} ++ + void main_loop_wait(int timeout) + { + IOHandlerRecord *ioh; +@@ -3763,6 +3807,8 @@ void main_loop_wait(int timeout) + + host_main_loop_wait(&timeout); + ++ check_cve_2014_3672_xen(); ++ + /* poll any events */ + /* XXX: separate device handlers from system ones */ + nfds = -1; diff --git a/CVE-2016-4439-qemut-scsi-esp-OOB-write-while-writing-to-cmdbuf-in-esp_reg_write.patch b/CVE-2016-4439-qemut-scsi-esp-OOB-write-while-writing-to-cmdbuf-in-esp_reg_write.patch new file mode 100644 index 0000000..6fb4c8a --- /dev/null +++ b/CVE-2016-4439-qemut-scsi-esp-OOB-write-while-writing-to-cmdbuf-in-esp_reg_write.patch @@ -0,0 +1,33 @@ +References: bsc#980716 CVE-2016-4439 + +The 53C9X Fast SCSI Controller(FSC) comes with an internal 16-byte +FIFO buffer. It is used to handle command and data transfer. While +writing to this command buffer 's->cmdbuf[TI_BUFSZ=16]', a check +was missing to validate input length. Add check to avoid OOB write +access. + +Fixes CVE-2016-4439 +Reported-by: Li Qiang + +Signed-off-by: Prasad J Pandit +--- + hw/scsi/esp.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +Index: xen-4.4.4-testing/tools/qemu-xen-traditional-dir-remote/hw/esp.c +=================================================================== +--- xen-4.4.4-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/esp.c ++++ xen-4.4.4-testing/tools/qemu-xen-traditional-dir-remote/hw/esp.c +@@ -471,7 +471,11 @@ static void esp_mem_writeb(void *opaque, + break; + case ESP_FIFO: + if (s->do_cmd) { +- s->cmdbuf[s->cmdlen++] = val & 0xff; ++ if (s->cmdlen < TI_BUFSZ) { ++ s->cmdbuf[s->cmdlen++] = val & 0xff; ++ } else { ++ ESP_ERROR("fifo overrun\n"); ++ } + } else if (s->ti_size == TI_BUFSZ - 1) { + ESP_ERROR("fifo overrun\n"); + } else { diff --git a/CVE-2016-4441-qemut-scsi-esp-OOB-write-while-writing-to-cmdbuf-in-get_cmd.patch b/CVE-2016-4441-qemut-scsi-esp-OOB-write-while-writing-to-cmdbuf-in-get_cmd.patch new file mode 100644 index 0000000..118050c --- /dev/null +++ b/CVE-2016-4441-qemut-scsi-esp-OOB-write-while-writing-to-cmdbuf-in-get_cmd.patch @@ -0,0 +1,56 @@ +References: bsc#980724 CVE-2016-4441 + +The 53C9X Fast SCSI Controller(FSC) comes with an internal 16-byte +FIFO buffer. It is used to handle command and data transfer. +Routine get_cmd() uses DMA to read scsi commands into this buffer. +Add check to validate DMA length against buffer size to avoid any +overrun. + +Fixes CVE-2016-4441 +Reported-by: Li Qiang + +Signed-off-by: Prasad J Pandit +--- + hw/scsi/esp.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +Index: xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/hw/esp.c +=================================================================== +--- xen-4.7.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/esp.c ++++ xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/hw/esp.c +@@ -162,7 +162,7 @@ static void esp_lower_irq(ESPState *s) + } + } + +-static uint32_t get_cmd(ESPState *s, uint8_t *buf) ++static uint32_t get_cmd(ESPState *s, uint8_t *buf, uint8_t buflen) + { + uint32_t dmalen; + int target; +@@ -170,6 +170,9 @@ static uint32_t get_cmd(ESPState *s, uin + target = s->wregs[ESP_WBUSID] & BUSID_DID; + if (s->dma) { + dmalen = s->rregs[ESP_TCLO] | (s->rregs[ESP_TCMID] << 8); ++ if (dmalen > buflen) { ++ return 0; ++ } + s->dma_memory_read(s->dma_opaque, buf, dmalen); + } else { + dmalen = s->ti_size; +@@ -231,14 +234,14 @@ static void handle_satn(ESPState *s) + uint8_t buf[32]; + int len; + +- len = get_cmd(s, buf); ++ len = get_cmd(s, buf, sizeof(buf)); + if (len) + do_cmd(s, buf); + } + + static void handle_satn_stop(ESPState *s) + { +- s->cmdlen = get_cmd(s, s->cmdbuf); ++ s->cmdlen = get_cmd(s, s->cmdbuf, sizeof(s->cmdbuf)); + if (s->cmdlen) { + DPRINTF("Set ATN & Stop: cmdlen %d\n", s->cmdlen); + s->do_cmd = 1; diff --git a/CVE-2016-5238-qemut-scsi-esp-OOB-write-when-using-non-DMA-mode-in-get_cmd.patch b/CVE-2016-5238-qemut-scsi-esp-OOB-write-when-using-non-DMA-mode-in-get_cmd.patch new file mode 100644 index 0000000..b506174 --- /dev/null +++ b/CVE-2016-5238-qemut-scsi-esp-OOB-write-when-using-non-DMA-mode-in-get_cmd.patch @@ -0,0 +1,37 @@ +References: bsc#982960 CVE-2016-5238 + +The 53C9X Fast SCSI Controller(FSC) comes with an internal 16-byte +FIFO buffer. It is used to handle command and data transfer. +Routine get_cmd() in non-DMA mode, uses 'ti_size' to read scsi +command into a buffer. Add check to validate command length against +buffer size to avoid any overrun. + +Reported-by: Li Qiang +Signed-off-by: Prasad J Pandit +--- + hw/scsi/esp.c | 3 +++ + 1 file changed, 3 insertions(+) + +Index: xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/hw/esp.c +=================================================================== +--- xen-4.7.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/esp.c ++++ xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/hw/esp.c +@@ -176,6 +176,9 @@ static uint32_t get_cmd(ESPState *s, uin + s->dma_memory_read(s->dma_opaque, buf, dmalen); + } else { + dmalen = s->ti_size; ++ if (dmalen > TI_BUFSZ) { ++ return 0; ++ } + memcpy(buf, s->ti_buf, dmalen); + buf[0] = 0; + } +@@ -265,7 +268,7 @@ static void write_response(ESPState *s) + } else { + s->ti_size = 2; + s->ti_rptr = 0; +- s->ti_wptr = 0; ++ s->ti_wptr = 2; + s->rregs[ESP_RFLAGS] = 2; + } + esp_raise_irq(s); diff --git a/CVE-2016-5338-qemut-scsi-esp-OOB-rw-access-while-processing-ESP_FIFO.patch b/CVE-2016-5338-qemut-scsi-esp-OOB-rw-access-while-processing-ESP_FIFO.patch new file mode 100644 index 0000000..5d034a3 --- /dev/null +++ b/CVE-2016-5338-qemut-scsi-esp-OOB-rw-access-while-processing-ESP_FIFO.patch @@ -0,0 +1,65 @@ +References: bsc#983984 CVE-2016-5338 + +The 53C9X Fast SCSI Controller(FSC) comes with internal 16-byte +FIFO buffers. One is used to handle commands and other is for +information transfer. Three control variables 'ti_rptr', +'ti_wptr' and 'ti_size' are used to control r/w access to the +information transfer buffer ti_buf[TI_BUFSZ=16]. In that, + +'ti_rptr' is used as read index, where read occurs. +'ti_wptr' is a write index, where write would occur. +'ti_size' indicates total bytes to be read from the buffer. + +While reading/writing to this buffer, index could exceed its +size. Add check to avoid OOB r/w access. + +Reported-by: Huawei PSIRT +Reported-by: Li Qiang +Signed-off-by: Prasad J Pandit +--- + hw/scsi/esp.c | 20 +++++++++----------- + 1 file changed, 9 insertions(+), 11 deletions(-) + +Update as per: + -> https://lists.gnu.org/archive/html/qemu-devel/2016-06/msg01326.html + +Index: xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/hw/esp.c +=================================================================== +--- xen-4.7.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/esp.c ++++ xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/hw/esp.c +@@ -435,18 +435,17 @@ static uint32_t esp_mem_readb(void *opaq + DPRINTF("read reg[%d]: 0x%2.2x\n", saddr, s->rregs[saddr]); + switch (saddr) { + case ESP_FIFO: +- if (s->ti_size > 0) { ++ if ((s->rregs[ESP_RSTAT] & STAT_PIO_MASK) == 0) { ++ /* Data out. */ ++ ESP_ERROR("PIO data read not implemented\n"); ++ s->rregs[ESP_FIFO] = 0; ++ esp_raise_irq(s); ++ } else if (s->ti_rptr < s->ti_wptr) { + s->ti_size--; +- if ((s->rregs[ESP_RSTAT] & STAT_PIO_MASK) == 0) { +- /* Data out. */ +- ESP_ERROR("PIO data read not implemented\n"); +- s->rregs[ESP_FIFO] = 0; +- } else { +- s->rregs[ESP_FIFO] = s->ti_buf[s->ti_rptr++]; +- } ++ s->rregs[ESP_FIFO] = s->ti_buf[s->ti_rptr++]; + esp_raise_irq(s); + } +- if (s->ti_size == 0) { ++ if (s->ti_rptr == s->ti_wptr) { + s->ti_rptr = 0; + s->ti_wptr = 0; + } +@@ -482,7 +481,7 @@ static void esp_mem_writeb(void *opaque, + } else { + ESP_ERROR("fifo overrun\n"); + } +- } else if (s->ti_size == TI_BUFSZ - 1) { ++ } else if (s->ti_wptr == TI_BUFSZ - 1) { + ESP_ERROR("fifo overrun\n"); + } else { + s->ti_size++; diff --git a/VNC-Support-for-ExtendedKeyEvent-client-message.patch b/VNC-Support-for-ExtendedKeyEvent-client-message.patch index 436ae49..6a1cfe8 100644 --- a/VNC-Support-for-ExtendedKeyEvent-client-message.patch +++ b/VNC-Support-for-ExtendedKeyEvent-client-message.patch @@ -20,10 +20,10 @@ git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5076 c046a42c-6fe2-441c-8c8 vnc.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 50 insertions(+), 9 deletions(-) -Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/vnc.c +Index: xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/vnc.c =================================================================== ---- xen-4.6.1-testing.orig/tools/qemu-xen-traditional-dir-remote/vnc.c -+++ xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/vnc.c +--- xen-4.7.0-testing.orig/tools/qemu-xen-traditional-dir-remote/vnc.c ++++ xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/vnc.c @@ -1285,35 +1285,22 @@ static void press_key_altgr_down(VncStat } } @@ -140,7 +140,7 @@ Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/vnc.c default: printf("Msg: %d\n", data[0]); vnc_client_error(vs); -@@ -2461,10 +2496,11 @@ void vnc_display_init(DisplayState *ds) +@@ -2486,10 +2521,11 @@ void vnc_display_init(DisplayState *ds) vs->ds = ds; diff --git a/aarch64-rename-PSR_MODE_ELxx-to-match-linux-headers.patch b/aarch64-rename-PSR_MODE_ELxx-to-match-linux-headers.patch index 02f3cfa..0baa686 100644 --- a/aarch64-rename-PSR_MODE_ELxx-to-match-linux-headers.patch +++ b/aarch64-rename-PSR_MODE_ELxx-to-match-linux-headers.patch @@ -10,11 +10,11 @@ Signed-off-by: Olaf Hering xen/include/public/arch-arm.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -Index: xen-4.6.0-testing/xen/include/public/arch-arm.h +Index: xen-4.7.0-testing/xen/include/public/arch-arm.h =================================================================== ---- xen-4.6.0-testing.orig/xen/include/public/arch-arm.h -+++ xen-4.6.0-testing/xen/include/public/arch-arm.h -@@ -365,13 +365,13 @@ typedef uint64_t xen_callback_t; +--- xen-4.7.0-testing.orig/xen/include/public/arch-arm.h ++++ xen-4.7.0-testing/xen/include/public/arch-arm.h +@@ -362,13 +362,13 @@ typedef uint64_t xen_callback_t; /* 64 bit modes */ #define PSR_MODE_BIT 0x10 /* Set iff AArch32 */ diff --git a/block-dmmd b/block-dmmd index e681a43..64475ed 100644 --- a/block-dmmd +++ b/block-dmmd @@ -272,7 +272,7 @@ case "$command" in add) p=`xenstore-read $XENBUS_PATH/params` || true claim_lock "dmmd" - dmmd=$p + dmmd=${p#dmmd:} parse_par activate "$dmmd" rc=$? if [ $rc -ne 0 ]; then @@ -291,7 +291,7 @@ case "$command" in remove) p=`xenstore-read $XENBUS_PATH/params` || true claim_lock "dmmd" - dmmd=$p + dmmd=${p#dmmd:} parse_par noactivate "$dmmd" cleanup_stack release_lock "dmmd" diff --git a/gcc6-warnings-as-errors.patch b/gcc6-warnings-as-errors.patch deleted file mode 100644 index 79ab47c..0000000 --- a/gcc6-warnings-as-errors.patch +++ /dev/null @@ -1,33 +0,0 @@ -References: bsc#969377 - xen does not build with GCC 6 - ---- xen-4.6.1-testing/xen/arch/x86/cpu/mcheck/non-fatal.c.orig 2016-03-04 15:59:08.000000000 -0700 -+++ xen-4.6.1-testing/xen/arch/x86/cpu/mcheck/non-fatal.c 2016-03-04 16:00:25.000000000 -0700 -@@ -94,8 +94,8 @@ static int __init init_nonfatal_mce_chec - if (mce_disabled || !mce_available(c)) - return -ENODEV; - -- if ( __get_cpu_var(poll_bankmask) == NULL ) -- return -EINVAL; -+ if ( __get_cpu_var(poll_bankmask) == NULL ) -+ return -EINVAL; - - /* - * Check for non-fatal errors every MCE_RATE s ---- xen-4.6.1-testing/extras/mini-os-remote/lib/sys.c.orig 2016-03-04 15:27:26.000000000 -0700 -+++ xen-4.6.1-testing/extras/mini-os-remote/lib/sys.c 2016-03-04 15:30:32.000000000 -0700 -@@ -634,6 +634,7 @@ int closedir(DIR *dir) - - /* We assume that only the main thread calls select(). */ - -+#if defined(LIBC_VERBOSE) || defined(LIBC_DEBUG) - static const char file_types[] = { - [FTYPE_NONE] = 'N', - [FTYPE_CONSOLE] = 'C', -@@ -646,6 +647,7 @@ static const char file_types[] = { - [FTYPE_KBD] = 'K', - [FTYPE_FB] = 'G', - }; -+#endif - #ifdef LIBC_DEBUG - static void dump_set(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) - { diff --git a/hotplug-Linux-block-performance-fix.patch b/hotplug-Linux-block-performance-fix.patch deleted file mode 100644 index 6d1dfdf..0000000 --- a/hotplug-Linux-block-performance-fix.patch +++ /dev/null @@ -1,204 +0,0 @@ -Reference: bsc#941074 - -During the attachment of a loopback mounted image file, the mode of all -curent instances of this device already attached to other domains must be -checked. This requires finding all loopback devices pointing to the inode -of the shared image file, and then comparing the major and minor number of -these devices to the major and minor number of every vbd device found in the -xenstore database. - -Prior to this patch, the entire xenstore database is walked for every instance -of every loopback device pointing to the same shared image file. This process -causes the block attachment process to becomes exponentially slower with every -additional attachment of a shared image. - -Rather than scanning all of xenstore for every instance of a shared loopback -device, this patch creates a list of the major and minor numbers from all -matching loopback devices. After generating this list, Xenstore is walked -once, and major and minor numbers from every vbd are checked against the list. -If a match is found, the mode of that vbd is checked for compatibility with -the mode of the device being attached. - -Signed-off-by: Mike Latimer ---- - tools/hotplug/Linux/block | 89 ++++++++++++++++++++++++++++++----------------- - 1 file changed, 57 insertions(+), 32 deletions(-) - -Index: xen-4.6.0-testing/tools/hotplug/Linux/block -=================================================================== ---- xen-4.6.0-testing.orig/tools/hotplug/Linux/block -+++ xen-4.6.0-testing/tools/hotplug/Linux/block -@@ -38,7 +38,7 @@ find_free_loopback_dev() { - } - - ## --# check_sharing device mode -+# check_sharing devtype device mode [inode] - # - # Check whether the device requested is already in use. To use the device in - # read-only mode, it may be in use in read-only mode, but may not be in use in -@@ -47,19 +47,44 @@ find_free_loopback_dev() { - # - # Prints one of - # --# 'local': the device may not be used because it is mounted in the current --# (i.e. the privileged domain) in a way incompatible with the --# requested mode; --# 'guest': the device may not be used because it already mounted by a guest --# in a way incompatible with the requested mode; or --# 'ok': the device may be used. -+# 'local $d': the device ($d) may not be used because it is mounted in the -+# current (i.e. the privileged domain) in a way incompatible -+# with the requested mode; -+# 'guest $d': the device may not be used because it is already mounted -+# through device $d by a guest in a way incompatible with the -+# requested mode; or -+# 'ok': the device may be used. - # - check_sharing() - { -- local dev="$1" -- local mode="$2" -+ local devtype=$1 -+ local dev="$2" -+ local mode="$3" -+ local devmm="," -+ -+ if [ "$devtype" = "file" ]; -+ then -+ local inode="$4" -+ -+ shared_list=$(losetup -a | -+ sed -n -e "s@^\([^:]\+\)\(:[[:blank:]]\[0*${dev}\]:${inode}[[:blank:]](.*)\)@\1@p" ) -+ for dev in $shared_list -+ do -+ if [ -n "$dev" ] -+ then -+ devmm="${devmm}$(device_major_minor $dev)," -+ fi -+ done -+ # if $devmm is unchanged, file being checked is not a shared loopback device -+ if [ "$devmm" = "," ]; -+ then -+ echo 'ok' -+ return -+ fi -+ else -+ devmm=${devmm}$(device_major_minor "$dev")"," -+ fi - -- local devmm=$(device_major_minor "$dev") - local file - - if [ "$mode" = 'w' ] -@@ -75,9 +100,10 @@ check_sharing() - then - local d=$(device_major_minor "$file") - -- if [ "$d" = "$devmm" ] -+ # checking for $d in $devmm is best through the [[...]] bashism -+ if [[ "$devmm" == *",$d,"* ]] - then -- echo 'local' -+ echo "local $d" - return - fi - fi -@@ -90,13 +116,14 @@ check_sharing() - do - d=$(xenstore_read_default "$base_path/$dom/$dev/physical-device" "") - -- if [ "$d" = "$devmm" ] -+ # checking for $d in $devmm is best through the [[...]] bashism -+ if [ -n "$d" ] && [[ "$devmm" == *",$d,"* ]] - then - if [ "$mode" = 'w' ] - then - if ! same_vm $dom - then -- echo 'guest' -+ echo "guest $d" - return - fi - else -@@ -107,7 +134,7 @@ check_sharing() - then - if ! same_vm $dom - then -- echo 'guest' -+ echo "guest $d" - return - fi - fi -@@ -129,6 +156,7 @@ check_device_sharing() - { - local dev="$1" - local mode=$(canonicalise_mode "$2") -+ local type="device" - local result - - if [ "x$mode" = 'x!' ] -@@ -136,33 +164,38 @@ check_device_sharing() - return 0 - fi - -- result=$(check_sharing "$dev" "$mode") -+ result=$(check_sharing "$type" "$dev" "$mode") - - if [ "$result" != 'ok' ] - then -- do_ebusy "Device $dev is mounted " "$mode" "$result" -+ do_ebusy "Device $dev is mounted " "$mode" "${result%% *}" - fi - } - - - ## --# check_device_sharing file dev mode -+# check_device_sharing file dev mode inode - # --# Perform the sharing check for the given file mounted through the given --# loopback interface, in the given mode. -+# Perform the sharing check for the given file, with its corresponding -+# device, inode and mode. As the file can be mounted multiple times, -+# the inode is passed through to check_sharing for all instances to be -+# checked. - # - check_file_sharing() - { - local file="$1" - local dev="$2" - local mode="$3" -+ local inode="$4" -+ local type="file" -+ local result - -- result=$(check_sharing "$dev" "$mode") -+ result=$(check_sharing "$type" "$dev" "$mode" "$inode") - - if [ "$result" != 'ok' ] - then -- do_ebusy "File $file is loopback-mounted through $dev, --which is mounted " "$mode" "$result" -+ do_ebusy "File $file is loopback-mounted through ${result#* }, -+which is mounted " "$mode" "${result%% *}" - fi - } - -@@ -281,15 +314,7 @@ mount it read-write in a guest domain." - fatal "Unable to lookup $file: dev: $dev inode: $inode" - fi - -- shared_list=$(losetup -a | -- sed -n -e "s@^\([^:]\+\)\(:[[:blank:]]\[0*${dev}\]:${inode}[[:blank:]](.*)\)@\1@p" ) -- for dev in $shared_list -- do -- if [ -n "$dev" ] -- then -- check_file_sharing "$file" "$dev" "$mode" -- fi -- done -+ check_file_sharing "$file" "$dev" "$mode" "$inode" - fi - - loopdev=$(losetup -f 2>/dev/null || find_free_loopback_dev) diff --git a/ioemu-disable-emulated-ide-if-pv.patch b/ioemu-disable-emulated-ide-if-pv.patch index 8398c2b..789c5bd 100644 --- a/ioemu-disable-emulated-ide-if-pv.patch +++ b/ioemu-disable-emulated-ide-if-pv.patch @@ -1,7 +1,7 @@ -Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/qemu-xen.h +Index: xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/qemu-xen.h =================================================================== ---- xen-4.6.1-testing.orig/tools/qemu-xen-traditional-dir-remote/qemu-xen.h -+++ xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/qemu-xen.h +--- xen-4.7.0-testing.orig/tools/qemu-xen-traditional-dir-remote/qemu-xen.h ++++ xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/qemu-xen.h @@ -1,6 +1,8 @@ #ifndef QEMU_XEN_H #define QEMU_XEN_H @@ -20,11 +20,11 @@ Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/qemu-xen.h int xenstore_parse_disable_pf_config(void); int xenstore_fd(void); void xenstore_process_event(void *opaque); -Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/vl.c +Index: xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/vl.c =================================================================== ---- xen-4.6.1-testing.orig/tools/qemu-xen-traditional-dir-remote/vl.c -+++ xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/vl.c -@@ -5861,9 +5861,9 @@ int main(int argc, char **argv, char **e +--- xen-4.7.0-testing.orig/tools/qemu-xen-traditional-dir-remote/vl.c ++++ xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/vl.c +@@ -5907,9 +5907,9 @@ int main(int argc, char **argv, char **e if ((msg = xenbus_read(XBT_NIL, "domid", &domid_s))) fprintf(stderr,"Can not read our own domid: %s\n", msg); else @@ -36,10 +36,10 @@ Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/vl.c #endif /* CONFIG_STUBDOM */ } -Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c +Index: xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c =================================================================== ---- xen-4.6.1-testing.orig/tools/qemu-xen-traditional-dir-remote/xenstore.c -+++ xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c +--- xen-4.7.0-testing.orig/tools/qemu-xen-traditional-dir-remote/xenstore.c ++++ xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/xenstore.c @@ -445,7 +445,7 @@ void xenstore_init(void) } } diff --git a/ioemu-hvm-pv-support.patch b/ioemu-hvm-pv-support.patch index 38838f6..fdbe136 100644 --- a/ioemu-hvm-pv-support.patch +++ b/ioemu-hvm-pv-support.patch @@ -2,19 +2,24 @@ tools/qemu-xen-traditional-dir-remote/hw/xen_platform.c | 46 ++++++++++++++++ 1 file changed, 46 insertions(+) -Index: xen-4.5.0-testing/tools/qemu-xen-traditional-dir-remote/xen-hooks.mak +Index: xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/xen-hooks.mak =================================================================== ---- xen-4.5.0-testing.orig/tools/qemu-xen-traditional-dir-remote/xen-hooks.mak -+++ xen-4.5.0-testing/tools/qemu-xen-traditional-dir-remote/xen-hooks.mak -@@ -1,3 +1,4 @@ +--- xen-4.7.0-testing.orig/tools/qemu-xen-traditional-dir-remote/xen-hooks.mak ++++ xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/xen-hooks.mak +@@ -2,6 +2,9 @@ CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/tool + CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/evtchn/include + CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/gnttab/include + CPPFLAGS+= -DXC_WANT_COMPAT_MAP_FOREIGN_API +CPPFLAGS+= -I$(XEN_ROOT)/tools/libxc ++CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/call/include ++CPPFLAGS+= -I$(XEN_ROOT)/tools/libs/foreignmemory/include CPPFLAGS+= -I$(XEN_ROOT)/tools/libxc/include CPPFLAGS+= -I$(XEN_ROOT)/tools/xenstore/include CPPFLAGS+= -I$(XEN_ROOT)/tools/include -Index: xen-4.4.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_platform.c +Index: xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_platform.c =================================================================== ---- xen-4.4.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/xen_platform.c -+++ xen-4.4.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_platform.c +--- xen-4.7.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/xen_platform.c ++++ xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/hw/xen_platform.c @@ -30,6 +30,8 @@ #include "qemu-xen.h" #include "net.h" diff --git a/ioemu-watchdog-support.patch b/ioemu-watchdog-support.patch index d790b89..4e9a530 100644 --- a/ioemu-watchdog-support.patch +++ b/ioemu-watchdog-support.patch @@ -10,10 +10,10 @@ everything that was raised about the previous version ... Signed-off-by: Richard W.M. Jones Signed-off-by: Anthony Liguori -Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/Makefile.target +Index: xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/Makefile.target =================================================================== ---- xen-4.6.1-testing.orig/tools/qemu-xen-traditional-dir-remote/Makefile.target -+++ xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/Makefile.target +--- xen-4.7.0-testing.orig/tools/qemu-xen-traditional-dir-remote/Makefile.target ++++ xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/Makefile.target @@ -580,6 +580,10 @@ OBJS += e1000.o # Serial mouse OBJS += msmouse.o @@ -25,10 +25,10 @@ Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/Makefile.target ifeq ($(TARGET_BASE_ARCH), i386) # Hardware support ifdef CONFIG_AUDIO -Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/hw/pc.c +Index: xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/hw/pc.c =================================================================== ---- xen-4.6.1-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/pc.c -+++ xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/hw/pc.c +--- xen-4.7.0-testing.orig/tools/qemu-xen-traditional-dir-remote/hw/pc.c ++++ xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/hw/pc.c @@ -41,6 +41,7 @@ #include "virtio-balloon.h" #include "virtio-console.h" @@ -46,10 +46,10 @@ Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/hw/pc.c for(i = 0; i < nb_nics; i++) { NICInfo *nd = &nd_table[i]; -Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/hw/watchdog.c +Index: xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/hw/watchdog.c =================================================================== --- /dev/null -+++ xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/hw/watchdog.c ++++ xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/hw/watchdog.c @@ -0,0 +1,136 @@ +/* + * Virtual hardware watchdog. @@ -187,10 +187,10 @@ Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/hw/watchdog.c + wdt_ib700_init(); + wdt_i6300esb_init(); +} -Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/hw/watchdog.h +Index: xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/hw/watchdog.h =================================================================== --- /dev/null -+++ xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/hw/watchdog.h ++++ xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/hw/watchdog.h @@ -0,0 +1,65 @@ +/* + * Virtual hardware watchdog. @@ -257,10 +257,10 @@ Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/hw/watchdog.h +extern void register_watchdogs(void); + +#endif /* QEMU_WATCHDOG_H */ -Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/hw/wdt_i6300esb.c +Index: xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/hw/wdt_i6300esb.c =================================================================== --- /dev/null -+++ xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/hw/wdt_i6300esb.c ++++ xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/hw/wdt_i6300esb.c @@ -0,0 +1,470 @@ +/* + * Virtual hardware watchdog. @@ -732,10 +732,10 @@ Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/hw/wdt_i6300esb.c +{ + watchdog_add_model(&model); +} -Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/hw/wdt_ib700.c +Index: xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/hw/wdt_ib700.c =================================================================== --- /dev/null -+++ xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/hw/wdt_ib700.c ++++ xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/hw/wdt_ib700.c @@ -0,0 +1,112 @@ +/* + * Virtual hardware watchdog. @@ -849,10 +849,10 @@ Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/hw/wdt_ib700.c + watchdog_add_model(&model); + timer = qemu_new_timer(vm_clock, ib700_timer_expired, NULL); +} -Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/monitor.c +Index: xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/monitor.c =================================================================== ---- xen-4.6.1-testing.orig/tools/qemu-xen-traditional-dir-remote/monitor.c -+++ xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/monitor.c +--- xen-4.7.0-testing.orig/tools/qemu-xen-traditional-dir-remote/monitor.c ++++ xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/monitor.c @@ -26,6 +26,7 @@ #include "hw/pcmcia.h" #include "hw/pc.h" @@ -884,10 +884,10 @@ Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/monitor.c { "cpu_set", "is", do_cpu_set_nr, "cpu [online|offline]", "change cpu state" }, { NULL, NULL, }, -Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/vl.c +Index: xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/vl.c =================================================================== ---- xen-4.6.1-testing.orig/tools/qemu-xen-traditional-dir-remote/vl.c -+++ xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/vl.c +--- xen-4.7.0-testing.orig/tools/qemu-xen-traditional-dir-remote/vl.c ++++ xen-4.7.0-testing/tools/qemu-xen-traditional-dir-remote/vl.c @@ -30,6 +30,7 @@ #include "hw/isa.h" #include "hw/baum.h" @@ -905,7 +905,7 @@ Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/vl.c const char *option_rom[MAX_OPTION_ROMS]; int nb_option_roms; int semihosting_enabled = 0; -@@ -4176,6 +4179,10 @@ static void help(int exitcode) +@@ -4222,6 +4225,10 @@ static void help(int exitcode) "-startdate select initial date of the clock\n" "-icount [N|auto]\n" " enable virtual instruction counter with 2^N clock ticks per instruction\n" @@ -916,7 +916,7 @@ Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/vl.c "-echr chr set terminal escape character instead of ctrl-a\n" "-virtioconsole c\n" " set virtio console\n" -@@ -4323,6 +4330,8 @@ enum { +@@ -4369,6 +4376,8 @@ enum { QEMU_OPTION_localtime, QEMU_OPTION_startdate, QEMU_OPTION_icount, @@ -925,7 +925,7 @@ Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/vl.c QEMU_OPTION_echr, QEMU_OPTION_virtiocon, QEMU_OPTION_show_cursor, -@@ -4449,6 +4458,8 @@ static const QEMUOption qemu_options[] = +@@ -4495,6 +4504,8 @@ static const QEMUOption qemu_options[] = { "localtime", 0, QEMU_OPTION_localtime }, { "startdate", HAS_ARG, QEMU_OPTION_startdate }, { "icount", HAS_ARG, QEMU_OPTION_icount }, @@ -934,7 +934,7 @@ Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/vl.c { "echr", HAS_ARG, QEMU_OPTION_echr }, { "virtioconsole", HAS_ARG, QEMU_OPTION_virtiocon }, { "show-cursor", 0, QEMU_OPTION_show_cursor }, -@@ -4950,6 +4961,8 @@ int main(int argc, char **argv, char **e +@@ -4996,6 +5007,8 @@ int main(int argc, char **argv, char **e tb_size = 0; autostart= 1; @@ -943,7 +943,7 @@ Index: xen-4.6.1-testing/tools/qemu-xen-traditional-dir-remote/vl.c optind = 1; for(;;) { if (optind >= argc) -@@ -5324,6 +5337,17 @@ int main(int argc, char **argv, char **e +@@ -5370,6 +5383,17 @@ int main(int argc, char **argv, char **e serial_devices[serial_device_index] = optarg; serial_device_index++; break; diff --git a/ipxe-use-rpm-opt-flags.patch b/ipxe-use-rpm-opt-flags.patch index 3f170db..b76be22 100644 --- a/ipxe-use-rpm-opt-flags.patch +++ b/ipxe-use-rpm-opt-flags.patch @@ -12,7 +12,7 @@ Index: xen-4.6.1-testing/tools/firmware/etherboot/patches/ipxe-use-rpm-opt-flags + + CLEANUP := +-CFLAGS := -++CFLAGS := $(RPM_OPT_FLAGS) -Wno-error=array-bounds +++CFLAGS := $(RPM_OPT_FLAGS) -Wno-error=array-bounds -Wno-nonnull-compare -Wno-unused-const-variable -Wno-misleading-indentation -Wno-shift-negative-value + ASFLAGS := + LDFLAGS := + MAKEDEPS := Makefile diff --git a/ipxe.tar.bz2 b/ipxe.tar.bz2 index 2ca0647..0c0393c 100644 --- a/ipxe.tar.bz2 +++ b/ipxe.tar.bz2 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6e448144cdd7d1b12a08094b6f955e2c75c167d05bf8da40ec5b9c085d920eef -size 2877217 +oid sha256:cedb8a940072948d3c94933f75d48749ca5f3f7b4b103fab2146d86e7a04250e +size 2877499 diff --git a/libxl.add-option-to-disable-disk-cache-flushes-in-qdisk.patch b/libxl.add-option-to-disable-disk-cache-flushes-in-qdisk.patch index e21c450..2535774 100644 --- a/libxl.add-option-to-disable-disk-cache-flushes-in-qdisk.patch +++ b/libxl.add-option-to-disable-disk-cache-flushes-in-qdisk.patch @@ -7,11 +7,11 @@ https://bugzilla.novell.com/show_bug.cgi?id=879425 tools/libxl/libxlu_disk_l.l | 1 + 5 files changed, 18 insertions(+), 1 deletion(-) -Index: xen-4.6.1-testing/tools/libxl/libxl.c +Index: xen-4.7.0-testing/tools/libxl/libxl.c =================================================================== ---- xen-4.6.1-testing.orig/tools/libxl/libxl.c -+++ xen-4.6.1-testing/tools/libxl/libxl.c -@@ -2833,6 +2833,8 @@ static void device_disk_add(libxl__egc * +--- xen-4.7.0-testing.orig/tools/libxl/libxl.c ++++ xen-4.7.0-testing/tools/libxl/libxl.c +@@ -2575,6 +2575,8 @@ static void device_disk_add(libxl__egc * flexarray_append_pair(back, "discard-enable", libxl_defbool_val(disk->discard_enable) ? "1" : "0"); @@ -19,13 +19,13 @@ Index: xen-4.6.1-testing/tools/libxl/libxl.c + flexarray_append_pair(back, "suse-diskcache-disable-flush", "1"); flexarray_append(front, "backend-id"); - flexarray_append(front, libxl__sprintf(gc, "%d", disk->backend_domid)); -Index: xen-4.6.1-testing/tools/libxl/libxl.h + flexarray_append(front, GCSPRINTF("%d", disk->backend_domid)); +Index: xen-4.7.0-testing/tools/libxl/libxl.h =================================================================== ---- xen-4.6.1-testing.orig/tools/libxl/libxl.h -+++ xen-4.6.1-testing/tools/libxl/libxl.h -@@ -205,6 +205,18 @@ - #define LIBXL_HAVE_BUILDINFO_ARM_GIC_VERSION 1 +--- xen-4.7.0-testing.orig/tools/libxl/libxl.h ++++ xen-4.7.0-testing/tools/libxl/libxl.h +@@ -253,6 +253,18 @@ + #define LIBXL_HAVE_BUILD_ID 1 /* + * The libxl_device_disk has no way to indicate that cache=unsafe is @@ -43,10 +43,10 @@ Index: xen-4.6.1-testing/tools/libxl/libxl.h * libxl ABI compatibility * * The only guarantee which libxl makes regarding ABI compatibility -Index: xen-4.6.1-testing/tools/libxl/libxlu_disk.c +Index: xen-4.7.0-testing/tools/libxl/libxlu_disk.c =================================================================== ---- xen-4.6.1-testing.orig/tools/libxl/libxlu_disk.c -+++ xen-4.6.1-testing/tools/libxl/libxlu_disk.c +--- xen-4.7.0-testing.orig/tools/libxl/libxlu_disk.c ++++ xen-4.7.0-testing/tools/libxl/libxlu_disk.c @@ -79,6 +79,8 @@ int xlu_disk_parse(XLU_Config *cfg, if (!disk->pdev_path || !strcmp(disk->pdev_path, "")) disk->format = LIBXL_DISK_FORMAT_EMPTY; @@ -56,10 +56,10 @@ Index: xen-4.6.1-testing/tools/libxl/libxlu_disk.c if (!disk->vdev) { xlu__disk_err(&dpc,0, "no vdev specified"); -Index: xen-4.6.1-testing/tools/libxl/libxlu_disk_i.h +Index: xen-4.7.0-testing/tools/libxl/libxlu_disk_i.h =================================================================== ---- xen-4.6.1-testing.orig/tools/libxl/libxlu_disk_i.h -+++ xen-4.6.1-testing/tools/libxl/libxlu_disk_i.h +--- xen-4.7.0-testing.orig/tools/libxl/libxlu_disk_i.h ++++ xen-4.7.0-testing/tools/libxl/libxlu_disk_i.h @@ -10,7 +10,7 @@ typedef struct { void *scanner; YY_BUFFER_STATE buf; @@ -69,14 +69,14 @@ Index: xen-4.6.1-testing/tools/libxl/libxlu_disk_i.h const char *spec; } DiskParseContext; -Index: xen-4.6.1-testing/tools/libxl/libxlu_disk_l.l +Index: xen-4.7.0-testing/tools/libxl/libxlu_disk_l.l =================================================================== ---- xen-4.6.1-testing.orig/tools/libxl/libxlu_disk_l.l -+++ xen-4.6.1-testing/tools/libxl/libxlu_disk_l.l -@@ -176,6 +176,7 @@ script=[^,]*,? { STRIP(','); SAVESTRING( - direct-io-safe,? { DPC->disk->direct_io_safe = 1; } - discard,? { libxl_defbool_set(&DPC->disk->discard_enable, true); } - no-discard,? { libxl_defbool_set(&DPC->disk->discard_enable, false); } +--- xen-4.7.0-testing.orig/tools/libxl/libxlu_disk_l.l ++++ xen-4.7.0-testing/tools/libxl/libxlu_disk_l.l +@@ -195,6 +195,7 @@ colo-port=[^,]*,? { STRIP(','); setcolop + colo-export=[^,]*,? { STRIP(','); SAVESTRING("colo-export", colo_export, FROMEQUALS); } + active-disk=[^,]*,? { STRIP(','); SAVESTRING("active-disk", active_disk, FROMEQUALS); } + hidden-disk=[^,]*,? { STRIP(','); SAVESTRING("hidden-disk", hidden_disk, FROMEQUALS); } +suse-diskcache-disable-flush,? { DPC->suse_diskcache_disable_flush = 1; } /* the target magic parameter, eats the rest of the string */ diff --git a/libxl.pvscsi.patch b/libxl.pvscsi.patch index 1a64cf9..bfbad39 100644 --- a/libxl.pvscsi.patch +++ b/libxl.pvscsi.patch @@ -1,82 +1,111 @@ -* local-fate316613-pvscsi-staging-4.4 - git://github.com/olafhering/xen.git : local-fate316613-pvscsi-staging-4.4 - -Implement pvscsi in xl/libxl +Subject: [PATCH v12 1/2] libxl: add support for vscsi +Date: Wed, 13 Apr 2016 08:56:59 +0000 +Message-Id: <1460537820-15398-2-git-send-email-olaf@aepfle.de> fate#316613 , https://fate.suse.com/316613 -10bd594 pvscsi: move parse_vscsi_config code block to avoid fuzz -06914e1 Merge pull request #4 from aaannz/pvscsi -fe65eb3 define SUSE PVSCSI extension for 3rd party use -8a34a98 pvscsi: check null pointer in libxl__add_vscsis -09fa151 pvscsi: avoid double assignment of host devices -aa88928 pvscsi: fix double free in scsi-attach -2de1507 pvscsi: update comments about libxl.so ABI -483f7e9 Merge pull request #3 from aaannz/pvscsi -d98458c Xen4.2 ABI compat -73744a5 preserve Xen4.2 ABI, WIP -0f8e701 fix minor memory leaks -1b1c55d pvscsi: correct comment for DEFINE_DEVICES_ADD -6f50972 pvscsi: move libxl__add_vscsis call -6fd1327 pvscsi: add comment for DEFINE_DEVICES_ADD -e4bf1fd pvscsi: fix DEFINE_DEVICE_REMOVE destroy -51b63a6 pvscsi: man pages -e461042 pvscsi: implememnt single device scsi-detach -540e524 Merge pull request #2 from aaannz/pvscsi -919a851 implement vscsi-attach -e07db68 fix indentation -b087b9d pvscsi: implement simple scsi-detach -824f286 pvscsi: simplify sysfs parsing in parse_vscsi_config -977d81d pvscsi: include stddef in xl_cmdimpl.c to get offsetof -ee2e7e5 Merge pull request #1 from aaannz/pvscsi -7de6f49 support character devices too -c84381b allow /dev/sda as scsi devspec -f11e3a2 pvscsi -Index: xen-4.6.0-testing/docs/man/xl.cfg.pod.5 +Port pvscsi support from xend to libxl: + + vscsi=['pdev,vdev{,options}'] + xl scsi-attach + xl scsi-detach + xl scsi-list + +Signed-off-by: Olaf Hering +Cc: Ian Jackson +Cc: Stefano Stabellini +Cc: Ian Campbell +Cc: Wei Liu +--- + docs/man/xl.cfg.pod.5 | 56 + + docs/man/xl.pod.1 | 18 + tools/libxl/Makefile | 2 + tools/libxl/libxl.c | 9 + tools/libxl/libxl.h | 42 + + tools/libxl/libxl_create.c | 41 + + tools/libxl/libxl_device.c | 2 + tools/libxl/libxl_internal.h | 8 + tools/libxl/libxl_types.idl | 53 + + tools/libxl/libxl_types_internal.idl | 1 + tools/libxl/libxl_vscsi.c | 1169 +++++++++++++++++++++++++++++++++++ + tools/libxl/libxlu_vscsi.c | 667 +++++++++++++++++++ + tools/libxl/libxlutil.h | 19 + tools/libxl/xl.h | 3 + tools/libxl/xl_cmdimpl.c | 225 ++++++ + tools/libxl/xl_cmdtable.c | 15 + 16 files changed, 2326 insertions(+), 4 deletions(-) + +Index: xen-4.7.0-testing/docs/man/xl.cfg.pod.5 =================================================================== ---- xen-4.6.0-testing.orig/docs/man/xl.cfg.pod.5 -+++ xen-4.6.0-testing/docs/man/xl.cfg.pod.5 -@@ -506,6 +506,36 @@ value is optional if this is a guest dom +--- xen-4.7.0-testing.orig/docs/man/xl.cfg.pod.5 ++++ xen-4.7.0-testing/docs/man/xl.cfg.pod.5 +@@ -517,6 +517,62 @@ value is optional if this is a guest dom =back +=item B + +Specifies the PVSCSI devices to be provided to the guest. PVSCSI passes -+dom0 SCSI devices as-is to the guest. ++SCSI devices from the backend domain to the guest. + -+Each B is a mapping from dom0 SCSI devices to guest visible -+SCSI devices, like 'pvdev,vdev[,option]'. Example: '/dev/sdm,3:0:4:5,feature-host' ++Each VSCSI_SPEC_STRING consists of "pdev,vdev[,options]". ++'pdev' describes the physical device, preferable in a persistent format ++such as /dev/disk/by-*/*. ++'vdev' is the domU device in vHOST:CHANNEL:TARGET:LUN notation, all integers. ++'options' lists additional flags which a backend may recognize. ++ ++The supported values for "pdev" and "options" depends on the backend driver used: ++ ++=over 4 ++ ++=item B + +=over 4 + +=item C + -+Specifies the dom0 visible SCSI device. The string can be either a device path -+like to a block device like /dev/disk/by-id/scsi-XYZ. Or it can be a device path -+to a char device like /dev/sg5. Or it can be specified in the SCSI notation -+HOST:CHANNEL:TARGET:LUN. Note that the latter format is unreliable because -+the HOST value can change across dom0 reboots. ++The backend driver in the pvops kernel is part of the Linux-IO Target framework ++(LIO). As such the SCSI devices have to be configured first with the tools ++provided by this framework, such as a xen-scsiback aware targetcli. The "pdev" ++in domU.cfg has to refer to a config item in that framework instead of the raw ++device. Usually this is a WWN in the form of "naa.WWN:LUN". + -+=item C ++=item C + -+Specifies how the SCSI device is mapped into the guest. The notation is in -+SCSI notation HOST:CHANNEL:TARGET:LUN. HOST in this case means a virthal -+SCSI host within the guest. ++No options recognized. + -+=item C