ia64/xen-unstable

changeset 18095:2fd648307ad1

[IA64] kexec: Map EFI regions into the same place they are maped into in Linux

Map EFI regions into the same place they are maped into in Linux

This is because of an unfortunate problem with the way that EFI interacts
with Kexec. The call to map the EFI regions may only be made once. This
means that after Kexec the EFI regions must be mapped into the same region
that they were mapped into prior to Kexec.

This is not usually a problem when kexecing from xen to xen or from linux
to linux, as the mapping will be the same. However when kexecing from xen
to linux or linux to xen, the mapping is different, and the problem
manifests.

So far Magnus Damm and I have come up with three different ideas for
resolving this problem.

1. Leave the EFI in physical mode
- This is nice and simple
- There is a potential performance hit, but PAL calls are not
made very often, so it shouldn't be a problem
- I have patches to do this, some of which are in the
series that accompany this patch.
- The SGI people tell me that it won't work on SN because
it allows the OS to provide EFI (or SAL?) code.

2. Always map EFI into the space that Linux uses
- Not so simple
- Requires Xen to jump through some hoops
- But leaves Linux unmodified
- But it will break if Linux ever changes its mapping
- This patch series implements this change

3. Always map EFI to some agreed space
- Similar to 2. but less likely to break in the future
- But it requires Xen and Linux to agree on a space to be used
- Reqires both Xen and Linux to be modified

Cc: Isaku Yamahata <yamahata@valinux.co.jp>
Cc: Tristan Gingold <tgingold@free.fr>
Cc: Alex Williamson <alex.williamson@hp.com>
Cc: Aron Griffis <aron@hp.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
author Isaku Yamahata <yamahata@valinux.co.jp>
date Tue Jul 22 12:15:02 2008 +0900 (2008-07-22)
parents 7da7b53b2139
children 1e7a371cee11
files xen/arch/ia64/linux-xen/efi.c xen/include/asm-ia64/xenpage.h
line diff
     1.1 --- a/xen/arch/ia64/linux-xen/efi.c	Tue Jul 22 12:15:02 2008 +0900
     1.2 +++ b/xen/arch/ia64/linux-xen/efi.c	Tue Jul 22 12:15:02 2008 +0900
     1.3 @@ -641,6 +641,17 @@ efi_enter_virtual_mode (void)
     1.4  
     1.5  	for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
     1.6  		md = p;
     1.7 +#ifdef XEN
     1.8 +		if (md->attribute & EFI_MEMORY_RUNTIME) {
     1.9 +			if (md->attribute & EFI_MEMORY_WB)
    1.10 +				md->virt_addr = __IA64_EFI_CACHED_OFFSET|
    1.11 +						md->phys_addr;
    1.12 +			else if (md->attribute & (EFI_MEMORY_UC|EFI_MEMORY_WC|
    1.13 +						  EFI_MEMORY_WT))
    1.14 +				md->virt_addr = __IA64_EFI_UNCACHED_OFFSET|
    1.15 +						md->phys_addr;
    1.16 +		}
    1.17 +#else
    1.18  		if (md->attribute & EFI_MEMORY_RUNTIME) {
    1.19  			/*
    1.20  			 * Some descriptors have multiple bits set, so the order of
    1.21 @@ -673,6 +684,7 @@ efi_enter_virtual_mode (void)
    1.22  #endif
    1.23  			}
    1.24  		}
    1.25 +#endif
    1.26  	}
    1.27  
    1.28  	status = efi_call_phys(__va(runtime->set_virtual_address_map),
     2.1 --- a/xen/include/asm-ia64/xenpage.h	Tue Jul 22 12:15:02 2008 +0900
     2.2 +++ b/xen/include/asm-ia64/xenpage.h	Tue Jul 22 12:15:02 2008 +0900
     2.3 @@ -97,14 +97,7 @@ static inline u64 pa_clear_uc(u64 paddr)
     2.4  /* It is sometimes very useful to have unsigned long as result.  */
     2.5  #define __va_ul(x)	({xen_va _v; _v.l = (long) (x); _v.f.reg = -1; _v.l;})
     2.6  
     2.7 -/* __va_efi() should just call __va() until the use of
     2.8 - * __IA64_EFI_CACHED_OFFSET is activated in efi_enter_virtual_mode()
     2.9 - */
    2.10 -#if 0
    2.11  #define __va_efi(x)	((void*)((unsigned long)(x) | __IA64_EFI_CACHED_OFFSET))
    2.12 -#else
    2.13 -#define __va_efi(x)	__va(x)
    2.14 -#endif
    2.15  
    2.16  #endif
    2.17  #endif /* _ASM_IA64_XENPAGE_H */