1. 27 6月, 2016 2 次提交
    • A
      efi: Convert efi_call_virt() to efi_call_virt_pointer() · 80e75596
      Alex Thorlton 提交于
      This commit makes a few slight modifications to the efi_call_virt() macro
      to get it to work with function pointers that are stored in locations
      other than efi.systab->runtime, and renames the macro to
      efi_call_virt_pointer().  The majority of the changes here are to pull
      these macros up into header files so that they can be accessed from
      outside of drivers/firmware/efi/runtime-wrappers.c.
      
      The most significant change not directly related to the code move is to
      add an extra "p" argument into the appropriate efi_call macros, and use
      that new argument in place of the, formerly hard-coded,
      efi.systab->runtime pointer.
      
      The last piece of the puzzle was to add an efi_call_virt() macro back into
      drivers/firmware/efi/runtime-wrappers.c to wrap around the new
      efi_call_virt_pointer() macro - this was mainly to keep the code from
      looking too cluttered by adding a bunch of extra references to
      efi.systab->runtime everywhere.
      
      Note that I also broke up the code in the efi_call_virt_pointer() macro a
      bit in the process of moving it.
      Signed-off-by: NAlex Thorlton <athorlton@sgi.com>
      Signed-off-by: NMatt Fleming <matt@codeblueprint.co.uk>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Dimitri Sivanich <sivanich@sgi.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Roy Franz <roy.franz@linaro.org>
      Cc: Russ Anderson <rja@sgi.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/1466839230-12781-5-git-send-email-matt@codeblueprint.co.ukSigned-off-by: NIngo Molnar <mingo@kernel.org>
      80e75596
    • P
      efi: Document #define FOO_PROTOCOL_GUID layout · 54fd11fe
      Peter Jones 提交于
      Add a comment documenting why EFI GUIDs are laid out like they are.
      
      Ideally I'd like to change all the ", " to "," too, but right now the
      format is such that checkpatch won't complain with new ones, and staring
      at checkpatch didn't get me anywhere towards making that work.
      Signed-off-by: NPeter Jones <pjones@redhat.com>
      Signed-off-by: NMatt Fleming <matt@codeblueprint.co.uk>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Joe Perches <joe@perches.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/1466839230-12781-3-git-send-email-matt@codeblueprint.co.ukSigned-off-by: NIngo Molnar <mingo@kernel.org>
      54fd11fe
  2. 03 6月, 2016 1 次提交
    • V
      efi: Fix for_each_efi_memory_desc_in_map() for empty memmaps · 55f1ea15
      Vitaly Kuznetsov 提交于
      Commit:
      
        78ce248f ("efi: Iterate over efi.memmap in for_each_efi_memory_desc()")
      
      introduced a regression for systems booted with the 'noefi' kernel option.
      
      In particular, I observed an early kernel hang in efi_find_mirror()'s
      for_each_efi_memory_desc() call. As we don't have efi memmap on this
      system we enter this iterator with the following parameters:
      
        efi.memmap.map = 0, efi.memmap.map_end = 0, efi.memmap.desc_size = 28
      
      ... then for_each_efi_memory_desc_in_map() does the following comparison:
      
        (md) <= (efi_memory_desc_t *)((m)->map_end - (m)->desc_size);
      
      ... where md = 0, (m)->map_end = 0 and (m)->desc_size = 28 but when we subtract
      something from a NULL pointer wrap around happens and we end up returning
      invalid pointer and crash.
      
      Fix it by using the correct pointer arithmetics.
      Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: NMatt Fleming <matt@codeblueprint.co.uk>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: K. Y. Srinivasan <kys@microsoft.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Fixes: 78ce248f ("efi: Iterate over efi.memmap in for_each_efi_memory_desc()")
      Link: http://lkml.kernel.org/r/1464690224-4503-2-git-send-email-matt@codeblueprint.co.uk
      [ Made the changelog more readable. ]
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      55f1ea15
  3. 21 5月, 2016 1 次提交
  4. 07 5月, 2016 1 次提交
    • J
      efi: Merge boolean flag arguments · 1cfd6316
      Julia Lawall 提交于
      The parameters atomic and duplicates of efivar_init always have opposite
      values.  Drop the parameter atomic, replace the uses of !atomic with
      duplicates, and update the call sites accordingly.
      
      The code using duplicates is slightly reorganized with an 'else', to avoid
      duplicating the lock code.
      Signed-off-by: NJulia Lawall <Julia.Lawall@lip6.fr>
      Signed-off-by: NMatt Fleming <matt@codeblueprint.co.uk>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      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: Jeremy Kerr <jk@ozlabs.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Saurabh Sengar <saurabh.truth@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vaishali Thakkar <vaishali.thakkar@oracle.com>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/1462570771-13324-5-git-send-email-matt@codeblueprint.co.ukSigned-off-by: NIngo Molnar <mingo@kernel.org>
      1cfd6316
  5. 28 4月, 2016 12 次提交
  6. 24 2月, 2016 1 次提交
  7. 22 2月, 2016 1 次提交
  8. 11 2月, 2016 2 次提交
  9. 03 2月, 2016 4 次提交
  10. 28 10月, 2015 1 次提交
    • A
      efi: Use correct type for struct efi_memory_map::phys_map · 44511fb9
      Ard Biesheuvel 提交于
      We have been getting away with using a void* for the physical
      address of the UEFI memory map, since, even on 32-bit platforms
      with 64-bit physical addresses, no truncation takes place if the
      memory map has been allocated by the firmware (which only uses
      1:1 virtually addressable memory), which is usually the case.
      
      However, commit:
      
        0f96a99d ("efi: Add "efi_fake_mem" boot option")
      
      adds code that clones and modifies the UEFI memory map, and the
      clone may live above 4 GB on 32-bit platforms.
      
      This means our use of void* for struct efi_memory_map::phys_map has
      graduated from 'incorrect but working' to 'incorrect and
      broken', and we need to fix it.
      
      So redefine struct efi_memory_map::phys_map as phys_addr_t, and
      get rid of a bunch of casts that are now unneeded.
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Reviewed-by: NMatt Fleming <matt@codeblueprint.co.uk>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: izumi.taku@jp.fujitsu.com
      Cc: kamezawa.hiroyu@jp.fujitsu.com
      Cc: linux-efi@vger.kernel.org
      Cc: matt.fleming@intel.com
      Link: http://lkml.kernel.org/r/1445593697-1342-1-git-send-email-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      44511fb9
  11. 12 10月, 2015 4 次提交
  12. 08 8月, 2015 1 次提交
  13. 25 6月, 2015 1 次提交
  14. 08 6月, 2015 1 次提交
    • P
      efi: Work around ia64 build problem with ESRT driver · 3846c158
      Peter Jones 提交于
      So, I'm told this problem exists in the world:
      
       > Subject: Build error in -next due to 'efi: Add esrt support'
       >
       > Building ia64:defconfig ... failed
       > --------------
       > Error log:
       >
       > drivers/firmware/efi/esrt.c:28:31: fatal error: asm/early_ioremap.h: No such file or directory
       >
      
      I'm not really sure how it's okay that we have things in asm-generic on
      some platforms but not others - is having it the same everywhere not the
      whole point of asm-generic?
      
      That said, ia64 doesn't have early_ioremap.h .  So instead, since it's
      difficult to imagine new IA64 machines with UEFI 2.5, just don't build
      this code there.
      
      To me this looks like a workaround - doing something like:
      
      generic-y += early_ioremap.h
      
      in arch/ia64/include/asm/Kbuild would appear to be more correct, but
      ia64 has its own early_memremap() decl in arch/ia64/include/asm/io.h ,
      and it's a macro.  So adding the above /and/ requiring that asm/io.h be
      included /after/ asm/early_ioremap.h in all cases would fix it, but
      that's pretty ugly as well.  Since I'm not going to spend the rest of my
      life rectifying ia64 headers vs "generic" headers that aren't generic,
      it's much simpler to just not build there.
      
      Note that I've only actually tried to build this patch on x86_64, but
      esrt.o still gets built there, and that would seem to demonstrate that
      the conditional building is working correctly at all the places the code
      built before.  I no longer have any ia64 machines handy to test that the
      exclusion actually works there.
      Signed-off-by: NPeter Jones <pjones@redhat.com>
      Acked-by: NTony Luck <tony.luck@intel.com>
      Reviewed-by: NGuenter Roeck <linux@roeck-us.net>
      (Compile-)Tested-by: Guenter Roeck <linux@roeck-us.net>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      3846c158
  15. 28 5月, 2015 1 次提交
    • D
      e820, efi: add ACPI 6.0 persistent memory types · ad5fb870
      Dan Williams 提交于
      ACPI 6.0 formalizes e820-type-7 and efi-type-14 as persistent memory.
      Mark it "reserved" and allow it to be claimed by a persistent memory
      device driver.
      
      This definition is in addition to the Linux kernel's existing type-12
      definition that was recently added in support of shipping platforms with
      NVDIMM support that predate ACPI 6.0 (which now classifies type-12 as
      OEM reserved).
      
      Note, /proc/iomem can be consulted for differentiating legacy
      "Persistent Memory (legacy)" E820_PRAM vs standard "Persistent Memory"
      E820_PMEM.
      
      Cc: Boaz Harrosh <boaz@plexistor.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Jens Axboe <axboe@fb.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matthew Wilcox <willy@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Acked-by: NJeff Moyer <jmoyer@redhat.com>
      Acked-by: NAndy Lutomirski <luto@amacapital.net>
      Reviewed-by: NRoss Zwisler <ross.zwisler@linux.intel.com>
      Acked-by: NChristoph Hellwig <hch@lst.de>
      Tested-by: NToshi Kani <toshi.kani@hp.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      ad5fb870
  16. 01 5月, 2015 1 次提交
  17. 01 4月, 2015 1 次提交
  18. 12 1月, 2015 1 次提交
  19. 08 1月, 2015 1 次提交
  20. 05 11月, 2014 1 次提交
  21. 04 10月, 2014 1 次提交
    • M
      efi: Provide a non-blocking SetVariable() operation · 6d80dba1
      Matt Fleming 提交于
      There are some circumstances that call for trying to write an EFI
      variable in a non-blocking way. One such scenario is when writing pstore
      data in efi_pstore_write() via the pstore_dump() kdump callback.
      
      Now that we have an EFI runtime spinlock we need a way of aborting if
      there is contention instead of spinning, since when writing pstore data
      from the kdump callback, the runtime lock may already be held by the CPU
      that's running the callback if we crashed in the middle of an EFI
      variable operation.
      
      The situation is sufficiently special that a new EFI variable operation
      is warranted.
      
      Introduce ->set_variable_nonblocking() for this use case. It is an
      optional EFI backend operation, and need only be implemented by those
      backends that usually acquire locks to serialize access to EFI
      variables, as is the case for virt_efi_set_variable() where we now grab
      the EFI runtime spinlock.
      
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      6d80dba1