1. 21 8月, 2017 5 次提交
    • H
      efi/reboot: Fall back to original power-off method if EFI_RESET_SHUTDOWN returns · b6a3780d
      Hans de Goede 提交于
      Commit:
      
        44be28e9 ("x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced flag")
      
      sets pm_power_off to efi_power_off() when the acpi_gbl_reduced_hardware
      flag is set.
      
      According to its commit message this is necessary because: "BayTrail-T
      class of hardware requires EFI in order to powerdown and reboot and no
      other reliable method exists".
      
      But I have a Bay Trail CR tablet where the EFI_RESET_SHUTDOWN call does
      not work, it simply returns without doing anything (AFAICT).
      
      So it seems that some Bay Trail devices must use EFI for power-off, while
      for others only ACPI works.
      
      Note that efi_power_off() only gets used if the platform code defines
      efi_poweroff_required() and that returns true, this currently only ever
      happens on x86.
      
      Since on the devices which need ACPI for power-off the EFI_RESET_SHUTDOWN
      call simply returns, this patch makes the efi-reboot code remember the
      old pm_power_off handler and if EFI_RESET_SHUTDOWN returns it falls back
      to calling that.
      
      This seems preferable to dmi-quirking our way out of this, since there
      are likely quite a few devices suffering from this.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NMatt Fleming <matt@codeblueprint.co.uk>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Len Brown <lenb@kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Peter Jones <pjones@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20170818194947.19347-7-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      b6a3780d
    • A
      efi/arm/arm64: Add missing assignment of efi.config_table · 9a9de5c0
      Ard Biesheuvel 提交于
      The ARM EFI init code never assigns the config_table member of the
      efi struct, which means the sysfs device node is missing, and other
      in-kernel users will not work correctly. So add the missing assignment.
      
      Note that, for now, the runtime and fw_vendor members are still
      omitted. This is deliberate: exposing physical addresses via sysfs nodes
      encourages behavior that we would like to avoid on ARM (given how it is
      more finicky about using correct memory attributes when mapping memory
      in userland that may be mapped by the kernel already as well).
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20170818194947.19347-6-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      9a9de5c0
    • A
      efi/libstub/arm64: Set -fpie when building the EFI stub · 91ee5b21
      Ard Biesheuvel 提交于
      Clang may emit absolute symbol references when building in non-PIC mode,
      even when using the default 'small' code model, which is already mostly
      position independent to begin with, due to its use of adrp/add pairs
      that have a relative range of +/- 4 GB. The remedy is to pass the -fpie
      flag, which can be done safely now that the code has been updated to avoid
      GOT indirections (which may be emitted due to the compiler assuming that
      the PIC/PIE code may end up in a shared library that is subject to ELF
      symbol preemption)
      
      Passing -fpie when building code that needs to execute at an a priori
      unknown offset is arguably an improvement in any case, and given that
      the recent visibility changes allow the PIC build to pass with GCC as
      well, let's add -fpie for all arm64 builds rather than only for Clang.
      Tested-by: NMatthias Kaehlcke <mka@chromium.org>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20170818194947.19347-5-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      91ee5b21
    • A
      efi/libstub/arm64: Force 'hidden' visibility for section markers · 0426a4e6
      Ard Biesheuvel 提交于
      To prevent the compiler from emitting absolute references to the section
      markers when running in PIC mode, override the visibility to 'hidden' for
      all contents of asm/sections.h
      Tested-by: NMatthias Kaehlcke <mka@chromium.org>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20170818194947.19347-4-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      0426a4e6
    • A
      efi/arm: Don't mark ACPI reclaim memory as MEMBLOCK_NOMAP · f56ab9a5
      Ard Biesheuvel 提交于
      On ARM, regions of memory that are described by UEFI as having special
      significance to the firmware itself are omitted from the linear mapping.
      This is necessary since we cannot guarantee that alternate mappings of
      the same physical region will use attributes that are compatible with
      the ones we use for the linear mapping, and aliases with mismatched
      attributes are prohibited by the architecture.
      
      The above does not apply to ACPI reclaim regions: such regions have no
      special significance to the firmware, and it is up to the OS to decide
      whether or not to preserve them after it has consumed their contents,
      and for how long, after which time the OS can use the memory in any way
      it likes. In the Linux case, such regions are preserved indefinitely,
      and are simply treated the same way as other 'reserved' memory types.
      
      Punching holes into the linear mapping causes page table fragmentation,
      which increases TLB pressure, and so we should avoid doing so if we can.
      So add a special case for regions of type EFI_ACPI_RECLAIM_MEMORY, and
      memblock_reserve() them instead of marking them MEMBLOCK_NOMAP.
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: NMark Rutland <mark.rutland@arm.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20170818194947.19347-2-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      f56ab9a5
  2. 13 7月, 2017 1 次提交
  3. 23 6月, 2017 3 次提交
    • D
      efi: Process the MEMATTR table only if EFI_MEMMAP is enabled · 457ea3f7
      Daniel Kiper 提交于
      Otherwise e.g. Xen dom0 on x86_64 EFI platforms crashes.
      
      In theory we can check EFI_PARAVIRT too, however,
      EFI_MEMMAP looks more targeted and covers more cases.
      Signed-off-by: NDaniel Kiper <daniel.kiper@oracle.com>
      Reviewed-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      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: boris.ostrovsky@oracle.com
      Cc: jgross@suse.com
      Cc: linux-efi@vger.kernel.org
      Cc: matt@codeblueprint.co.uk
      Cc: stable@vger.kernel.org
      Cc: xen-devel@lists.xenproject.org
      Link: http://lkml.kernel.org/r/1498128697-12943-2-git-send-email-daniel.kiper@oracle.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      457ea3f7
    • T
      trace, ras: add ARM processor error trace event · e9279e83
      Tyler Baicar 提交于
      Currently there are trace events for the various RAS
      errors with the exception of ARM processor type errors.
      Add a new trace event for such errors so that the user
      will know when they occur. These trace events are
      consistent with the ARM processor error section type
      defined in UEFI 2.6 spec section N.2.4.4.
      Signed-off-by: NTyler Baicar <tbaicar@codeaurora.org>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      e9279e83
    • T
      efi: print unrecognized CPER section · 0fc300f4
      Tyler Baicar 提交于
      UEFI spec allows for non-standard section in Common Platform Error
      Record. This is defined in section N.2.3 of UEFI version 2.5.
      
      Currently if the CPER section's type (UUID) does not match with
      one of the section types that the kernel knows how to parse, the
      section is skipped. Therefore, user is not able to see
      such CPER data, for instance, error record of non-standard section.
      
      This change prints out the raw data in hex in the dmesg buffer so
      that non-standard sections are reported to the user. Non-standard
      section type errors should be reported to the user because these
      can include errors which are vendor specific. The data length is
      taken from Error Data length field of Generic Error Data Entry.
      
      The following is a sample output from dmesg:
       Hardware error from APEI Generic Hardware Error Source: 2
       It has been corrected by h/w and requires no further action
       event severity: corrected
        time: precise 2017-03-15 20:37:35
        Error 0, type: corrected
         section type: unknown, d2e2621c-f936-468d-0d84-15a4ed015c8b
         section length: 0x238
         00000000: 4d415201 4d492031 453a4d45 435f4343  .RAM1 IMEM:ECC_C
         00000010: 53515f45 44525f42 00000000 00000000  E_QSB_RD........
         00000020: 00000000 00000000 00000000 00000000  ................
         00000030: 00000000 00000000 01010000 01010000  ................
         00000040: 00000000 00000000 00000005 00000000  ................
         00000050: 01010000 00000000 00000001 00dddd00  ................
      ...
      
      The raw data from the error can then be decoded using vendor
      specific tools.
      Signed-off-by: NTyler Baicar <tbaicar@codeaurora.org>
      CC: Jonathan (Zhixiong) Zhang <zjzhang@codeaurora.org>
      Reviewed-by: NJames Morse <james.morse@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      0fc300f4
  4. 22 6月, 2017 3 次提交
  5. 09 6月, 2017 1 次提交
    • D
      efi: Fix boot panic because of invalid BGRT image address · 792ef14d
      Dave Young 提交于
      Maniaxx reported a kernel boot crash in the EFI code, which I emulated
      by using same invalid phys addr in code:
      
        BUG: unable to handle kernel paging request at ffffffffff280001
        IP: efi_bgrt_init+0xfb/0x153
        ...
        Call Trace:
         ? bgrt_init+0xbc/0xbc
         acpi_parse_bgrt+0xe/0x12
         acpi_table_parse+0x89/0xb8
         acpi_boot_init+0x445/0x4e2
         ? acpi_parse_x2apic+0x79/0x79
         ? dmi_ignore_irq0_timer_override+0x33/0x33
         setup_arch+0xb63/0xc82
         ? early_idt_handler_array+0x120/0x120
         start_kernel+0xb7/0x443
         ? early_idt_handler_array+0x120/0x120
         x86_64_start_reservations+0x29/0x2b
         x86_64_start_kernel+0x154/0x177
         secondary_startup_64+0x9f/0x9f
      
      There is also a similar bug filed in bugzilla.kernel.org:
      
        https://bugzilla.kernel.org/show_bug.cgi?id=195633
      
      The crash is caused by this commit:
      
        7b0a9114 efi/x86: Move the EFI BGRT init code to early init code
      
      The root cause is the firmware on those machines provides invalid BGRT
      image addresses.
      
      In a kernel before above commit BGRT initializes late and uses ioremap()
      to map the image address. Ioremap validates the address, if it is not a
      valid physical address ioremap() just fails and returns. However in current
      kernel EFI BGRT initializes early and uses early_memremap() which does not
      validate the image address, and kernel panic happens.
      
      According to ACPI spec the BGRT image address should fall into
      EFI_BOOT_SERVICES_DATA, see the section 5.2.22.4 of below document:
      
        http://www.uefi.org/sites/default/files/resources/ACPI_6_1.pdf
      
      Fix this issue by validating the image address in efi_bgrt_init(). If the
      image address does not fall into any EFI_BOOT_SERVICES_DATA areas we just
      bail out with a warning message.
      Reported-by: NManiaxx <tripleshiftone@gmail.com>
      Signed-off-by: NDave Young <dyoung@redhat.com>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Fixes: 7b0a9114 ("efi/x86: Move the EFI BGRT init code to early init code")
      Link: http://lkml.kernel.org/r/20170609084558.26766-2-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      792ef14d
  6. 05 6月, 2017 11 次提交
  7. 01 6月, 2017 2 次提交
    • K
      pstore: Populate pstore record->time field · c7f3c595
      Kees Cook 提交于
      The current time will be initially available in the record->time field
      for all pstore_read() and pstore_write() calls. Backends can either
      update the field during read(), or use the field during write() instead
      of fetching time themselves.
      Signed-off-by: NKees Cook <keescook@chromium.org>
      c7f3c595
    • K
      efi-pstore: Refactor erase routine · efb74e4b
      Kees Cook 提交于
      Right now, every pass through the EFI variables during erase would build
      a copy of the old format variable name. Instead, try each name one time
      through the EFI variables list. Additionally bump up the buffer size to
      avoid truncation in pathological cases, and wipe the write name buffer.
      Signed-off-by: NKees Cook <keescook@chromium.org>
      efb74e4b
  8. 28 5月, 2017 2 次提交
  9. 23 5月, 2017 1 次提交
  10. 17 5月, 2017 1 次提交
  11. 17 4月, 2017 1 次提交
  12. 06 4月, 2017 1 次提交
  13. 05 4月, 2017 8 次提交