lkml.org 
[lkml]   [2012]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    SubjectRe: [tip:x86/urgent] x86, efi: Delete efi_ioremap() and fix CONFIG_X86_32 oops
    From
    On Wed, Feb 22, 2012 at 7:32 PM, H. Peter Anvin <hpa@zytor.com> wrote:
    > On 02/22/2012 06:20 PM, Yinghai Lu wrote:
    >>
    >> Why is MAXMEM used here?
    >>
    >> EFI reserved area could be above 4G?
    >>
    >> if that is the case, you will map all mmio hole below 4g.
    >>
    >
    > OK, dropping this patch for now, at least from -urgent.
    >
    > We really need to restrict the memory types we map, at least without
    > ioremap() called on them.  In theory, on x86-64, we could have a
    > dedicated "1:1" address for each physical address, but there is no good
    > reason we should ever map memory types other than RAM, ACPI and EFI by
    > default -- with the possible exception of the low 1 MiB legacy area.

    please check attach patch for tip/efi branch.

    Thanks

    Yinghai
    Subject: [PATCH] x86, efi: use e820_end_pfn_efi with low_pfn and max_pfn
    From: Yinghai Lu <yinghai@kernel.org>

    So avoid to map mmio below 4g, if system have EFI range above 4g.

    Signed-off-by: Yinghai Lu <yinghai@kernel.org>

    ---
    arch/x86/kernel/setup.c | 42 ++++++++++++++++++++++++------------------
    1 file changed, 24 insertions(+), 18 deletions(-)

    Index: linux-2.6/arch/x86/kernel/setup.c
    ===================================================================
    --- linux-2.6.orig/arch/x86/kernel/setup.c
    +++ linux-2.6/arch/x86/kernel/setup.c
    @@ -681,6 +681,27 @@ static int __init parse_reservelow(char

    early_param("reservelow", parse_reservelow);

    +static unsigned long __init e820_end_pfn_efi(unsigned long end_pfn,
    + unsigned long limit_pfn)
    +{
    +#ifdef CONFIG_X86_64
    + /*
    + * There may be regions after the last E820_RAM region that we
    + * want to include in the kernel direct mapping because their
    + * contents are needed at runtime.
    + */
    + if (efi_enabled) {
    + unsigned long efi_end;
    +
    + efi_end = e820_end_pfn(limit_pfn, E820_RESERVED_EFI);
    + if (efi_end > end_pfn)
    + end_pfn = efi_end;
    + }
    +#endif
    +
    + return end_pfn;
    +}
    +
    /*
    * Determine if we were loaded by an EFI loader. If so, then we have also been
    * passed the efi memmap, systab, etc., so we should use these data structures
    @@ -934,30 +955,15 @@ void __init setup_arch(char **cmdline_p)
    init_gbpages();

    /* max_pfn_mapped is updated here */
    - end_pfn = max_low_pfn;
    -
    -#ifdef CONFIG_X86_64
    - /*
    - * There may be regions after the last E820_RAM region that we
    - * want to include in the kernel direct mapping because their
    - * contents are needed at runtime.
    - */
    - if (efi_enabled) {
    - unsigned long efi_end;
    -
    - efi_end = e820_end_pfn(MAXMEM>>PAGE_SHIFT, E820_RESERVED_EFI);
    - if (efi_end > end_pfn)
    - end_pfn = efi_end;
    - }
    -#endif
    -
    + end_pfn = e820_end_pfn_efi(max_low_pfn, 1UL<<(32-PAGE_SHIFT));
    max_low_pfn_mapped = init_memory_mapping(0, end_pfn << PAGE_SHIFT);
    max_pfn_mapped = max_low_pfn_mapped;

    #ifdef CONFIG_X86_64
    if (max_pfn > max_low_pfn) {
    + end_pfn = e820_end_pfn_efi(max_pfn, MAXMEM>>PAGE_SHIFT);
    max_pfn_mapped = init_memory_mapping(1UL<<32,
    - max_pfn<<PAGE_SHIFT);
    + end_pfn<<PAGE_SHIFT);
    /* can we preseve max_low_pfn ?*/
    max_low_pfn = max_pfn;
    }
    \
     
     \ /
      Last update: 2012-02-23 11:39    [W:0.024 / U:2.032 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site