1. 28 Jan, 2017 1 commit
    • Ingo Molnar's avatar
      x86/boot/e820: Move asm/e820.h to asm/e820/api.h · 66441bd3
      Ingo Molnar authored
      In line with asm/e820/types.h, move the e820 API declarations to
      asm/e820/api.h and update all usage sites.
      This is just a mechanical, obviously correct move & replace patch,
      there will be subsequent changes to clean up the code and to make
      better use of the new header organization.
      Cc: Alex Thorlton <athorlton@sgi.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Huang, Ying <ying.huang@intel.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul Jackson <pj@sgi.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rafael J. Wysocki <rjw@sisk.pl>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wei Yang <richard.weiyang@gmail.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: Ingo Molnar's avatarIngo Molnar <mingo@kernel.org>
  2. 06 Jan, 2017 1 commit
  3. 11 Aug, 2016 1 commit
  4. 21 Jul, 2016 1 commit
    • Ingo Molnar's avatar
      x86/boot: Reorganize and clean up the BIOS area reservation code · edce2121
      Ingo Molnar authored
      So the reserve_ebda_region() code has accumulated a number of
      problems over the years that make it really difficult to read
      and understand:
      - The calculation of 'lowmem' and 'ebda_addr' is an unnecessarily
        interleaved mess of first lowmem, then ebda_addr, then lowmem tweaks...
      - 'lowmem' here means 'super low mem' - i.e. 16-bit addressable memory. In other
        parts of the x86 code 'lowmem' means 32-bit addressable memory... This makes it
        super confusing to read.
      - It does not help at all that we have various memory range markers, half of which
        are 'start of range', half of which are 'end of range' - but this crucial
        property is not obvious in the naming at all ... gave me a headache trying to
        understand all this.
      - Also, the 'ebda_addr' name sucks: it highlights that it's an address (which is
        obvious, all values here are addresses!), while it does not highlight that it's
        the _start_ of the EBDA region ...
      - 'BIOS_LOWMEM_KILOBYTES' says a lot of things, except that this is the only value
        that is a pointer to a value, not a memory range address!
      - The function name itself is a misnomer: it says 'reserve_ebda_region()' while
        its main purpose is to reserve all the firmware ROM typically between 640K and
        1MB, while the 'EBDA' part is only a small part of that ...
      - Likewise, the paravirt quirk flag name 'ebda_search' is misleading as well: this
        too should be about whether to reserve firmware areas in the paravirt case.
      - In fact thinking about this as 'end of RAM' is confusing: what this function
        *really* wants to reserve is firmware data and code areas! Once the thinking is
        inverted from a mixed 'ram' and 'reserved firmware area' notion to a pure
        'reserved area' notion everything becomes a lot clearer.
      To improve all this rewrite the whole code (without changing the logic):
      - Firstly invert the naming from 'lowmem end' to 'BIOS reserved area start'
        and propagate this concept through all the variable names and constants.
      	ebda_start			// was: ebda_addr
      	bios_start			// was: lowmem
      	BIOS_START_MAX			// was: LOWMEM_CAP
      - Then clean up the name of the function itself by renaming it
        to reserve_bios_regions() and renaming the ::ebda_search paravirt
        flag to ::reserve_bios_regions.
      - Fix up all the comments (fix typos), harmonize and simplify their
        formulation and remove comments that become unnecessary due to
        the much better naming all around.
      Signed-off-by: Ingo Molnar's avatarIngo Molnar <mingo@kernel.org>
  5. 22 Apr, 2016 1 commit
    • Luis R. Rodriguez's avatar
      x86/rtc: Replace paravirt rtc check with platform legacy quirk · 8d152e7a
      Luis R. Rodriguez authored
      We have 4 types of x86 platforms that disable RTC:
        * Intel MID
        * Lguest - uses paravirt
        * Xen dom-U - uses paravirt
        * x86 on legacy systems annotated with an ACPI legacy flag
      We can consolidate all of these into a platform specific legacy
      quirk set early in boot through i386_start_kernel() and through
      x86_64_start_reservations(). This deals with the RTC quirks which
      we can rely on through the hardware subarch, the ACPI check can
      be dealt with separately.
      For Xen things are bit more complex given that the @X86_SUBARCH_XEN
      x86_hardware_subarch is shared on for Xen which uses the PV path for
      both domU and dom0. Since the semantics for differentiating between
      the two are Xen specific we provide a platform helper to help override
      default legacy features -- x86_platform.set_legacy_features(). Use
      of this helper is highly discouraged, its only purpose should be
      to account for the lack of semantics available within your given
      As per 0-day, this bumps the vmlinux size using i386-tinyconfig as
      TOTAL   TEXT   init.text    x86_early_init_platform_quirks()
      +70     +62    +62          +43
      Only 8 bytes overhead total, as the main increase in size is
      all removed via __init.
      Suggested-by: Ingo Molnar's avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarLuis R. Rodriguez <mcgrof@kernel.org>
      Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: andrew.cooper3@citrix.com
      Cc: andriy.shevchenko@linux.intel.com
      Cc: bigeasy@linutronix.de
      Cc: boris.ostrovsky@oracle.com
      Cc: david.vrabel@citrix.com
      Cc: ffainelli@freebox.fr
      Cc: george.dunlap@citrix.com
      Cc: glin@suse.com
      Cc: jlee@suse.com
      Cc: josh@joshtriplett.org
      Cc: julien.grall@linaro.org
      Cc: konrad.wilk@oracle.com
      Cc: kozerkov@parallels.com
      Cc: lenb@kernel.org
      Cc: lguest@lists.ozlabs.org
      Cc: linux-acpi@vger.kernel.org
      Cc: lv.zheng@intel.com
      Cc: matt@codeblueprint.co.uk
      Cc: mbizon@freebox.fr
      Cc: rjw@rjwysocki.net
      Cc: robert.moore@intel.com
      Cc: rusty@rustcorp.com.au
      Cc: tiwai@suse.de
      Cc: toshi.kani@hp.com
      Cc: xen-devel@lists.xensource.com
      Link: http://lkml.kernel.org/r/1460592286-300-5-git-send-email-mcgrof@kernel.orgSigned-off-by: Ingo Molnar's avatarIngo Molnar <mingo@kernel.org>
  6. 04 Feb, 2015 1 commit
  7. 05 May, 2014 1 commit
  8. 17 Oct, 2013 1 commit
  9. 06 Aug, 2013 1 commit
  10. 30 Jan, 2013 1 commit
  11. 29 Jan, 2013 2 commits
  12. 19 Nov, 2012 1 commit
  13. 17 Nov, 2012 1 commit
  14. 08 May, 2012 1 commit
  15. 08 Dec, 2011 1 commit
    • Tejun Heo's avatar
      memblock: Kill memblock_init() · fe091c20
      Tejun Heo authored
      memblock_init() initializes arrays for regions and memblock itself;
      however, all these can be done with struct initializers and
      memblock_init() can be removed.  This patch kills memblock_init() and
      initializes memblock with struct initializer.
      The only difference is that the first dummy entries don't have .nid
      set to MAX_NUMNODES initially.  This doesn't cause any behavior
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Mundt <lethal@linux-sh.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
  16. 14 Jul, 2011 1 commit
  17. 15 Mar, 2011 1 commit
    • Dan Williams's avatar
      x86: Introduce pci_map_biosrom() · 5d94e81f
      Dan Williams authored
      The isci driver needs to retrieve its preboot OROM image which contains
      necessary runtime parameters like platform specific sas addresses and
      phy configuration.  There is no ROM BAR associated with this area,
      instead we will need to scan legacy expansion ROM space.
      1/ Promote the probe_roms_32 implementation to x86-64
      2/ Add a facility to find and map an adapter rom by pci device (according to
         PCI Firmware Specification Revision 3.0)
      Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
      LKML-Reference: <20110308183226.6246.90354.stgit@localhost6.localdomain6>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
  18. 18 Feb, 2011 1 commit
    • H. Peter Anvin's avatar
      x86, trampoline: Common infrastructure for low memory trampolines · 4822b7fc
      H. Peter Anvin authored
      Common infrastructure for low memory trampolines.  This code installs
      the trampolines permanently in low memory very early.  It also permits
      multiple pieces of code to be used for this purpose.
      This code also introduces a standard infrastructure for computing
      symbol addresses in the trampoline code.
      The only change to the actual SMP trampolines themselves is that the
      64-bit trampoline has been made reusable -- the previous version would
      overwrite the code with a status variable; this moves the status
      variable to a separate location.
      Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
      LKML-Reference: <4D5DFBE4.7090104@intel.com>
      Cc: Rafael J. Wysocki <rjw@sisk.pl>
      Cc: Matthieu Castet <castet.matthieu@free.fr>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
  19. 11 Nov, 2010 1 commit
  20. 20 Oct, 2010 1 commit
  21. 27 Aug, 2010 2 commits
    • Yinghai Lu's avatar
      x86, memblock: Replace e820_/_early string with memblock_ · a9ce6bc1
      Yinghai Lu authored
      1.include linux/memblock.h directly. so later could reduce e820.h reference.
      2 this patch is done by sed scripts mainly
      -v2: use MEMBLOCK_ERROR instead of -1ULL or -1UL
      Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
      Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
    • Yinghai Lu's avatar
      x86: Use memblock to replace early_res · 72d7c3b3
      Yinghai Lu authored
      1. replace find_e820_area with memblock_find_in_range
      2. replace reserve_early with memblock_x86_reserve_range
      3. replace free_early with memblock_x86_free_range.
      4. NO_BOOTMEM will switch to use memblock too.
      5. use _e820, _early wrap in the patch, in following patch, will
         replace them all
      6. because memblock_x86_free_range support partial free, we can remove some special care
      7. Need to make sure that memblock_find_in_range() is called after memblock_x86_fill()
         so adjust some calling later in setup.c::setup_arch()
         -- corruption_check and mptable_update
      -v2: Move reserve_brk() early
          Before fill_memblock_area, to avoid overlap between brk and memblock_find_in_range()
          that could happen We have more then 128 RAM entry in E820 tables, and
          memblock_x86_fill() could use memblock_find_in_range() to find a new place for
          memblock.memory.region array.
          and We don't need to use extend_brk() after fill_memblock_area()
          So move reserve_brk() early before fill_memblock_area().
      -v3: Move find_smp_config early
          To make sure memblock_find_in_range not find wrong place, if BIOS doesn't put mptable
          in right place.
      -v4: Treat RESERVED_KERN as RAM in memblock.memory. and they are already in
          memblock.reserved already..
          use __NOT_KEEP_MEMBLOCK to make sure memblock related code could be freed later.
      -v5: Generic version __memblock_find_in_range() is going from high to low, and for 32bit
          active_region for 32bit does include high pages
          need to replace the limit with memblock.default_alloc_limit, aka get_max_mapped()
      -v6: Use current_limit instead
      -v7: check with MEMBLOCK_ERROR instead of -1ULL or -1L
      -v8: Set memblock_can_resize early to handle EFI with more RAM entries
      -v9: update after kmemleak changes in mainline
      Suggested-by: default avatarDavid S. Miller <davem@davemloft.net>
      Suggested-by: Benjamin Herrenschmidt's avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Suggested-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
      Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
  22. 16 Jun, 2010 1 commit
  23. 29 Mar, 2010 1 commit
    • Yinghai Lu's avatar
      x86: Make sure free_init_pages() frees pages on page boundary · c967da6a
      Yinghai Lu authored
      When CONFIG_NO_BOOTMEM=y, it could use memory more effiently, or
      in a more compact fashion.
       Allocated new RAMDISK: 00ec2000 - 0248ce57
       Move RAMDISK from 000000002ea04000 - 000000002ffcee56 to 00ec2000 - 0248ce56
      The new RAMDISK's end is not page aligned.
      Last page could be shared with other users.
      When free_init_pages are called for initrd or .init, the page
      could be freed and we could corrupt other data.
      code segment in free_init_pages():
       |        for (; addr < end; addr += PAGE_SIZE) {
       |                ClearPageReserved(virt_to_page(addr));
       |                init_page_count(virt_to_page(addr));
       |                memset((void *)(addr & ~(PAGE_SIZE-1)),
       |                        POISON_FREE_INITMEM, PAGE_SIZE);
       |                free_page(addr);
       |                totalram_pages++;
       |        }
      last half page could be used as one whole free page.
      So page align the boundaries.
      -v2: make the original initramdisk to be aligned, according to
           Johannes, otherwise we have the chance to lose one page.
           we still need to keep initrd_end not aligned, otherwise it could
           confuse decompressor.
      -v3: change to WARN_ON instead, suggested by Johannes.
      -v4: use PAGE_ALIGN, suggested by Johannes.
           We may fix that macro name later to PAGE_ALIGN_UP, and PAGE_ALIGN_DOWN
           Add comments about assuming ramdisk start is aligned
           in relocate_initrd(), change to re get ramdisk_image instead of save it
           to make diff smaller. Add warning for wrong range, suggested by Johannes.
      -v6: remove one WARN()
           We need to align beginning in free_init_pages()
           do not copy more than ramdisk_size, noticed by Johannes
      Reported-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
      Tested-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
      Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Cc: David Miller <davem@davemloft.net>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      LKML-Reference: <1269830604-26214-3-git-send-email-yinghai@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  24. 12 Feb, 2010 1 commit
  25. 11 Dec, 2009 1 commit
    • Yinghai Lu's avatar
      x86: Use find_e820() instead of hard coded trampoline address · 893f38d1
      Yinghai Lu authored
      Jens found the following crash/regression:
      [    0.000000] found SMP MP-table at [ffff8800000fdd80] fdd80
      [    0.000000] Kernel panic - not syncing: Overlapping early reservations 12-f011 MP-table mpc to 0-fff BIOS data page
      [    0.000000] Kernel panic - not syncing: Overlapping early reservations 12-f011 MP-table mpc to 6000-7fff TRAMPOLINE
      and bisected it to b24c2a92 ("x86: Move find_smp_config()
      earlier and avoid bootmem usage").
      It turns out the BIOS is using the first 64k for mptable,
      without reserving it.
      So try to find good range for the real-mode trampoline instead of
      hard coding it, in case some bios tries to use that range for sth.
      Reported-by: default avatarJens Axboe <jens.axboe@oracle.com>
      Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
      Tested-by: default avatarJens Axboe <jens.axboe@oracle.com>
      Cc: Randy Dunlap <randy.dunlap@oracle.com>
      LKML-Reference: <4B21630A.6000308@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  26. 31 Aug, 2009 2 commits
    • Thomas Gleixner's avatar
      x86: Add Moorestown early detection · 3f4110a4
      Thomas Gleixner authored
      Moorestown MID devices need to be detected early in the boot process
      to setup and do not call x86_default_early_setup as there is no EBDA
      region to reserve.
      [ Copied the minimal code from Jacobs latest MRST series ]
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Jacob Pan <jacob.jun.pan@intel.com>
    • Thomas Gleixner's avatar
      x86: Add early platform detection · 47a3d5da
      Thomas Gleixner authored
      Platforms like Moorestown require early setup and want to avoid the
      call to reserve_ebda_region. The x86_init override is too late when
      the MRST detection happens in setup_arch. Move the default i386
      x86_init overrides and the call to reserve_ebda_region into a separate
      function which is called as the default of a switch case depending on
      the hardware_subarch id in boot params. This allows us to add a case
      for MRST and let MRST have its own early setup function.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
  27. 27 Aug, 2009 4 commits
  28. 15 Mar, 2009 1 commit
  29. 14 Mar, 2009 1 commit
    • Jeremy Fitzhardinge's avatar
      x86: add brk allocation for very, very early allocations · 93dbda7c
      Jeremy Fitzhardinge authored
      Impact: new interface
      Add a brk()-like allocator which effectively extends the bss in order
      to allow very early code to do dynamic allocations.  This is better than
      using statically allocated arrays for data in subsystems which may never
      get used.
      The space for brk allocations is in the bss ELF segment, so that the
      space is mapped properly by the code which maps the kernel, and so
      that bootloaders keep the space free rather than putting a ramdisk or
      something into it.
      The bss itself, delimited by __bss_stop, ends before the brk area
      (__brk_base to __brk_limit).  The kernel text, data and bss is reserved
      up to __bss_stop.
      Any brk-allocated data is reserved separately just before the kernel
      pagetable is built, as that code allocates from unreserved spaces
      in the e820 map, potentially allocating from any unused brk memory.
      Ultimately any unused memory in the brk area is used in the general
      kernel memory pool.
      Initially the brk space is set to 1MB, which is probably much larger
      than any user needs (the largest current user is i386 head_32.S's code
      to build the pagetables to map the kernel, which can get fairly large
      with a big kernel image and no PSE support).  So long as the system
      has sufficient memory for the bootloader to reserve the kernel+1MB brk,
      there are no bad effects resulting from an over-large brk.
      Signed-off-by: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
  30. 08 Dec, 2008 1 commit
    • Rafael J. Wysocki's avatar
      x86: change static allocation of trampoline area · 3e1e9002
      Rafael J. Wysocki authored
      Impact: fix trampoline sizing bug, save space
      While debugging a suspend-to-RAM related issue it occured to me that
      if the trampoline code had grown past 4 KB, we would have been
      allocating too little memory for it, since the 4 KB size of the
      trampoline is hardcoded into arch/x86/kernel/e820.c .  Change that
      by making the kernel compute the trampoline size and allocate as much
      memory as necessary.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  31. 05 Jun, 2008 1 commit
  32. 31 May, 2008 1 commit
  33. 25 May, 2008 1 commit
    • Yinghai Lu's avatar
      x86: extend e820 ealy_res support 32bit · a4c81cf6
      Yinghai Lu authored
      move early_res related from e820_64.c to e820.c
      make edba detection to be done in head32.c
      remove smp_alloc_memory, because we have fixed trampoline address now.
      Signed-off-by: default avatarYinghai Lu <yhlu.kernel@gmail.com>
       arch/x86/kernel/e820.c              |  214 ++++++++++++++++++++++++++++++++++++
       arch/x86/kernel/e820_64.c           |  196 --------------------------------
       arch/x86/kernel/head32.c            |   76 ++++++++++++
       arch/x86/kernel/setup_32.c          |  109 +++---------------
       arch/x86/kernel/smpboot.c           |   17 --
       arch/x86/kernel/trampoline.c        |    2
       arch/x86/mach-voyager/voyager_smp.c |    9 -
       include/asm-x86/e820.h              |    6 +
       include/asm-x86/e820_64.h           |    9 -
       include/asm-x86/smp.h               |    1
       arch/x86/kernel/e820.c              |  214 ++++++++++++++++++++++++++++++++++++
       arch/x86/kernel/e820_64.c           |  196 --------------------------------
       arch/x86/kernel/head32.c            |   76 ++++++++++++
       arch/x86/kernel/setup_32.c          |  109 +++---------------
       arch/x86/kernel/smpboot.c           |   17 --
       arch/x86/kernel/trampoline.c        |    2
       arch/x86/mach-voyager/voyager_smp.c |    9 -
       include/asm-x86/e820.h              |    6 +
       include/asm-x86/e820_64.h           |    9 -
       include/asm-x86/smp.h               |    1
       arch/x86/kernel/e820.c              |  214 ++++++++++++++++++++++++++++++++++++
       arch/x86/kernel/e820_64.c           |  196 --------------------------------
       arch/x86/kernel/head32.c            |   76 ++++++++++++
       arch/x86/kernel/setup_32.c          |  109 +++---------------
       arch/x86/kernel/smpboot.c           |   17 --
       arch/x86/kernel/trampoline.c        |    2
       arch/x86/mach-voyager/voyager_smp.c |    9 -
       include/asm-x86/e820.h              |    6 +
       include/asm-x86/e820_64.h           |    9 -
       include/asm-x86/smp.h               |    1
       10 files changed, 320 insertions(+), 319 deletions(-)
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  34. 17 Apr, 2008 1 commit