From 82e844b7039d4a1c448b896fe3b1de73b73f31df462376bb18ec1ffaa3711e44 Mon Sep 17 00:00:00 2001 From: Charles Arnold Date: Thu, 7 Jul 2011 16:20:18 +0000 Subject: [PATCH] - Fixes for EFI support x86-EFI-discard-comment.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=131 --- 23614-x86_64-EFI-boot.patch | 26 ++++++++++++++++++++---- 23615-x86_64-EFI-runtime.patch | 37 ++++++++++++++++++++++++++++++++-- x86-EFI-discard-comment.patch | 18 +++++++++++++++++ xen-changeset.diff | 4 ++-- xen.changes | 6 ++++++ xen.spec | 21 ++++++++++--------- 6 files changed, 95 insertions(+), 17 deletions(-) create mode 100644 x86-EFI-discard-comment.patch diff --git a/23614-x86_64-EFI-boot.patch b/23614-x86_64-EFI-boot.patch index d2cb396..642c261 100644 --- a/23614-x86_64-EFI-boot.patch +++ b/23614-x86_64-EFI-boot.patch @@ -29,6 +29,19 @@ the community). Signed-off-by: Jan Beulich +# HG changeset patch +# User Jan Beulich +# Date 1309549342 -3600 +# Node ID 638f31a30b6ccb3fe26f79b991bed4cd03995809 +# Parent 7631c461132000979f05759705c055eb3c975c0b +x86/EFI: adjust installation logic + +We should always install xen.efi into /usr/lib64/efi/; installation +into /boot/efi/efi/$(EFI_VENDOR) remains dependent upon specifying +EFI_VENDOR. + +Signed-off-by: Jan Beulich + --- a/xen/Makefile +++ b/xen/Makefile @@ -11,6 +11,8 @@ export XEN_DOMAIN ?= $(shell ([ -x /bin/ @@ -40,15 +53,20 @@ Signed-off-by: Jan Beulich .PHONY: default default: build -@@ -32,6 +34,13 @@ _install: $(TARGET).gz +@@ -32,6 +34,18 @@ _install: $(TARGET).gz ln -f -s $(notdir $(TARGET))-$(XEN_FULLVERSION).gz $(DESTDIR)/boot/$(notdir $(TARGET))-$(XEN_VERSION).gz ln -f -s $(notdir $(TARGET))-$(XEN_FULLVERSION).gz $(DESTDIR)/boot/$(notdir $(TARGET)).gz $(INSTALL_DATA) $(TARGET)-syms $(DESTDIR)/boot/$(notdir $(TARGET))-syms-$(XEN_FULLVERSION) -+ if [ -r $(TARGET).efi -a -n "$(EFI_MOUNTPOINT)" ]; then \ -+ if [ -n '$(EFI_VENDOR)' ]; then \ ++ if [ -r $(TARGET).efi ]; then \ ++ [ -d $(DESTDIR)$(LIBDIR)/efi ] || $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)/efi; \ ++ $(INSTALL_DATA) $(TARGET).efi $(DESTDIR)$(LIBDIR)/efi/$(notdir $(TARGET))-$(XEN_FULLVERSION).efi; \ ++ ln -sf $(notdir $(TARGET))-$(XEN_FULLVERSION).efi $(DESTDIR)$(LIBDIR)/efi/$(notdir $(TARGET))-$(XEN_VERSION).$(XEN_SUBVERSION).efi; \ ++ ln -sf $(notdir $(TARGET))-$(XEN_FULLVERSION).efi $(DESTDIR)$(LIBDIR)/efi/$(notdir $(TARGET))-$(XEN_VERSION).efi; \ ++ ln -sf $(notdir $(TARGET))-$(XEN_FULLVERSION).efi $(DESTDIR)$(LIBDIR)/efi/$(notdir $(TARGET)).efi; \ ++ if [ -n '$(EFI_MOUNTPOINT)' -a -n '$(EFI_VENDOR)' ]; then \ + $(INSTALL_DATA) $(TARGET).efi $(DESTDIR)$(EFI_MOUNTPOINT)/efi/$(EFI_VENDOR)/$(notdir $(TARGET))-$(XEN_FULLVERSION).efi; \ + elif [ "$(DESTDIR)" = "$(patsubst $(shell cd $(XEN_ROOT) && pwd)/%,%,$(DESTDIR))" ]; then \ -+ echo 'EFI installation not done (EFI_VENDOR not set)' >&2; \ ++ echo 'EFI installation only partially done (EFI_VENDOR not set)' >&2; \ + fi; \ + fi diff --git a/23615-x86_64-EFI-runtime.patch b/23615-x86_64-EFI-runtime.patch index 5c0023c..9e40c7d 100644 --- a/23615-x86_64-EFI-runtime.patch +++ b/23615-x86_64-EFI-runtime.patch @@ -17,6 +17,19 @@ being quoted because this is a mode with paging enabled [otherwise Signed-off-by: Jan Beulich +# HG changeset patch +# User Jan Beulich +# Date 1309549303 -3600 +# Node ID 7631c461132000979f05759705c055eb3c975c0b +# Parent 335e96664589dd14dfce7ef72e3fee71ad9c39e3 +x86/EFI: fix interrupt and fault handling during runtime services calls + +The missing piece was the setting up of an accessible GDT prior to +switching page tables (and reverting to the original setting after +having established the normal page tables again afterwards). + +Signed-off-by: Jan Beulich + --- a/xen/arch/x86/efi/boot.c +++ b/xen/arch/x86/efi/boot.c @@ -16,6 +16,7 @@ @@ -198,7 +211,7 @@ Signed-off-by: Jan Beulich UINTN __read_mostly efi_memmap_size; UINTN __read_mostly efi_mdesc_size; -@@ -30,6 +32,68 @@ struct efi __read_mostly efi = { +@@ -30,6 +32,88 @@ struct efi __read_mostly efi = { .smbios = EFI_INVALID_TABLE_ADDR, }; @@ -213,6 +226,17 @@ Signed-off-by: Jan Beulich + /* prevent fixup_page_fault() from doing anything */ + irq_enter(); + ++ if ( !is_hvm_vcpu(current) && !is_idle_vcpu(current) ) ++ { ++ struct desc_ptr gdt_desc = { ++ .limit = LAST_RESERVED_GDT_BYTE, ++ .base = (unsigned long)(per_cpu(gdt_table, smp_processor_id()) - ++ FIRST_RESERVED_GDT_ENTRY) ++ }; ++ ++ asm volatile ( "lgdt %0" : : "m" (gdt_desc) ); ++ } ++ + write_cr3(virt_to_maddr(efi_l4_pgtable)); + + return cr3; @@ -221,6 +245,15 @@ Signed-off-by: Jan Beulich +void efi_rs_leave(unsigned long cr3) +{ + write_cr3(cr3); ++ if ( !is_hvm_vcpu(current) && !is_idle_vcpu(current) ) ++ { ++ struct desc_ptr gdt_desc = { ++ .limit = LAST_RESERVED_GDT_BYTE, ++ .base = GDT_VIRT_START(current) ++ }; ++ ++ asm volatile ( "lgdt %0" : : "m" (gdt_desc) ); ++ } + irq_exit(); + spin_unlock(&efi_rs_lock); +} @@ -267,7 +300,7 @@ Signed-off-by: Jan Beulich #endif int efi_get_info(uint32_t idx, union xenpf_efi_info *info) -@@ -86,3 +150,267 @@ int efi_get_info(uint32_t idx, union xen +@@ -86,3 +170,267 @@ int efi_get_info(uint32_t idx, union xen return 0; } diff --git a/x86-EFI-discard-comment.patch b/x86-EFI-discard-comment.patch new file mode 100644 index 0000000..636ff9f --- /dev/null +++ b/x86-EFI-discard-comment.patch @@ -0,0 +1,18 @@ +The SuSE version of gcc produces a non-standard section named +.comment.SUSE.OPTs, but the PE32+ handling in binutils can't really +deal with any section to be placed at virtual address zero (and not +needing to be loaded). Even if binutils did, at least the UEFI +implementation in EDK 1.06 doesn't look at the section characteristics +at all, and hence would attempt to load such a section, and fail or +corrupt other data. + +--- a/xen/arch/x86/xen.lds.S ++++ b/xen/arch/x86/xen.lds.S +@@ -163,6 +163,7 @@ SECTIONS + *(.eh_frame) + #ifdef EFI + *(.comment) ++ *(.comment.*) + #endif + } + diff --git a/xen-changeset.diff b/xen-changeset.diff index 4cf1c91..f8bb6a9 100644 --- a/xen-changeset.diff +++ b/xen-changeset.diff @@ -5,7 +5,7 @@ # This is the correct place to edit the build version. # All other places this is stored (eg. compile.h) should be autogenerated. export XEN_VERSION = 4 -@@ -91,7 +92,7 @@ delete-unfresh-files: +@@ -96,7 +97,7 @@ delete-unfresh-files: @rm -f $@1 $@2 # compile.h contains dynamic build info. Rebuilt on every 'make' invocation. @@ -14,7 +14,7 @@ @sed -e 's/@@date@@/$(shell LC_ALL=C date)/g' \ -e 's/@@time@@/$(shell LC_ALL=C date +%T)/g' \ -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \ -@@ -101,10 +102,9 @@ include/xen/compile.h: include/xen/compi +@@ -106,10 +107,9 @@ include/xen/compile.h: include/xen/compi -e 's/@@version@@/$(XEN_VERSION)/g' \ -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \ -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \ diff --git a/xen.changes b/xen.changes index 2138db0..676fd3d 100644 --- a/xen.changes +++ b/xen.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Jul 7 10:17:08 MDT 2011 - carnold@novell.com + +- Fixes for EFI support + x86-EFI-discard-comment.patch + ------------------------------------------------------------------- Wed Jun 29 09:37:05 MDT 2011 - carnold@novell.com diff --git a/xen.spec b/xen.spec index d3af2f1..a0313ac 100644 --- a/xen.spec +++ b/xen.spec @@ -72,8 +72,8 @@ BuildRequires: te_latex BuildRequires: tetex %endif %ifarch x86_64 -# EFI -#BuildRequires: libgcc46 gcc46 +# EFI requires gcc45 or newer +BuildRequires: gcc45 BuildRequires: glibc-32bit glibc-devel-32bit BuildRequires: gcc-32bit BuildRequires: gcc43-32bit @@ -288,6 +288,7 @@ Patch511: supported_module.diff Patch512: magic_ioport_compat.patch Patch513: xen.sles11sp1.bug684297.xen_oldmem_pfn_is_ram.patch Patch514: xen.sles11sp1.fate311487.xen_platform_pci.dmistring.patch +Patch515: x86-EFI-discard-comment.patch Patch650: disable_emulated_device.diff Patch651: ioemu-disable-scsi.patch Patch652: ioemu-disable-emulated-ide-if-pv.patch @@ -805,6 +806,7 @@ tar xfj %{SOURCE2} -C $RPM_BUILD_DIR/%{xen_build_dir}/tools %patch512 -p1 %patch513 -p1 %patch514 -p1 +%patch515 -p1 %patch650 -p1 %patch651 -p1 %patch652 -p1 @@ -874,10 +876,10 @@ done export CFLAGS="$RPM_OPT_FLAGS" %if %{?with_dom0_support}0 # EFI -#%ifarch x86_64 -#make -C xen install CC=gcc-4.6 max_phys_cpus=%{max_cpus} debug=n crash_debug=n DESTDIR=$RPM_BUILD_ROOT EFI_VENDOR=SuSE %{?_smp_mflags} -#make -C xen clean -#%endif +%ifarch x86_64 +make -C xen install CC=gcc-4.5 max_phys_cpus=%{max_cpus} debug=n crash_debug=n DESTDIR=$RPM_BUILD_ROOT %{?_smp_mflags} +make -C xen clean +%endif install_xen() { local ext="" @@ -1073,9 +1075,10 @@ rm -f $RPM_BUILD_ROOT/%{_bindir}/xencons /boot/xen-syms-dbg-%{version}-%{release} /boot/xen.gz # EFI -#%ifarch x86_64 -#/boot/efi/efi/SuSE/xen-%{version}-%{release}.efi -#%endif +%ifarch x86_64 +%dir %{_libdir}/efi +%{_libdir}/efi/xen*.efi +%endif %endif %files libs