1. 03 2月, 2018 1 次提交
    • J
      firmware: dmi: Optimize dmi_matches · 8cf4e6a0
      Jean Delvare 提交于
      Function dmi_matches can me made a bit faster:
      
      * The documented purpose of dmi_initialized is to catch too early
        calls to dmi_check_system(). I'm not fully convinced it justifies
        slowing down the initialization of all systems out there, but at
        least the check should not have been moved from dmi_check_system()
        to dmi_matches(). dmi_matches() is being called for every entry of
        the table passed to dmi_check_system(), causing the same redundant
        check to be performed again and again. So move it back to
        dmi_check_system(), reverting this specific portion of commit
        d7b1956f ("DMI: Introduce dmi_first_match to make the interface
        more flexible").
      
      * Don't check for the exact_match flag again when we already know its
        value.
      Signed-off-by: NJean Delvare <jdelvare@suse.de>
      Fixes: d7b1956f ("DMI: Introduce dmi_first_match to make the interface more flexible")
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: Jeff Garzik <jgarzik@redhat.com>
      8cf4e6a0
  2. 15 6月, 2017 3 次提交
  3. 23 5月, 2017 1 次提交
  4. 19 12月, 2016 1 次提交
  5. 16 1月, 2016 4 次提交
  6. 08 1月, 2016 1 次提交
  7. 25 6月, 2015 5 次提交
  8. 14 5月, 2015 2 次提交
    • J
      firmware: dmi_scan: Fix ordering of product_uuid · 5c1ac56b
      Jean Delvare 提交于
      In function dmi_present(), dmi_walk_early() calls dmi_table(), which
      calls dmi_decode(), which ultimately calls dmi_save_uuid(). This last
      function makes a decision based on the value of global variable
      dmi_ver. The problem is that this variable is set right _after_
      dmi_walk_early() returns. So dmi_save_uuid() always sees dmi_ver == 0
      regardless of the actual version implemented.
      
      This causes /sys/class/dmi/id/product_uuid to always use the old
      ordering even on systems implementing DMI/SMBIOS 2.6 or later, which
      should use the new ordering.
      
      This is broken since kernel v3.8 for legacy DMI implementations and
      since kernel v3.10 for SMBIOS 2 implementations. SMBIOS 3
      implementations with the 64-bit entry point are not affected.
      
      The first breakage does not matter much as in practice legacy DMI
      implementations are always for versions older than 2.6, which is when
      the UUID ordering changed. The second breakage is more problematic as
      it affects the vast majority of x86 systems manufactured since 2009.
      Signed-off-by: NJean Delvare <jdelvare@suse.de>
      Fixes: 9f9c9cbb ("drivers/firmware/dmi_scan.c: fetch dmi version from SMBIOS if it exists")
      Fixes: 79bae42d ("dmi_scan: refactor dmi_scan_machine(), {smbios,dmi}_present()")
      Acked-by: NZhenzhong Duan <zhenzhong.duan@oracle.com>
      Cc: Ben Hutchings <ben@decadent.org.uk>
      Cc: Artem Savkov <artem.savkov@gmail.com>
      Cc: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
      Cc: Matt Fleming <matt.fleming@intel.com>
      Cc: stable@vger.kernel.org [v3.10+]
      5c1ac56b
    • J
      firmware: dmi_scan: Simplified displayed version · c2493045
      Jean Delvare 提交于
      The trailing .x adds no information for the reader, and if anyone
      tries to parse that line, this is more work as they have 3 different
      formats to handle instead of 2. Plus, this makes backporting fixes
      harder.
      Signed-off-by: NJean Delvare <jdelvare@suse.de>
      Fixes: 95be58df ("firmware: dmi_scan: Use full dmi version for SMBIOS3")
      Cc: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
      c2493045
  9. 27 3月, 2015 1 次提交
    • J
      firmware: dmi_scan: Prevent dmi_num integer overflow · bfbaafae
      Jean Delvare 提交于
      dmi_num is a u16, dmi_len is a u32, so this construct:
      
      	dmi_num = dmi_len / 4;
      
      would result in an integer overflow for a DMI table larger than
      256 kB. I've never see such a large table so far, but SMBIOS 3.0
      makes it possible so maybe we'll see such tables in the future.
      
      So instead of faking a structure count when the entry point does
      not provide it, adjust the loop condition in dmi_table() to properly
      deal with the case where dmi_num is not set.
      
      This bug was introduced with the initial SMBIOS 3.0 support in commit
      fc430262 ("dmi: add support for SMBIOS 3.0 64-bit entry point").
      Signed-off-by: NJean Delvare <jdelvare@suse.de>
      Cc: Matt Fleming <matt.fleming@intel.com>
      Cc: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
      Cc: <stable@vger.kernel.org>
      Acked-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      bfbaafae
  10. 26 3月, 2015 2 次提交
  11. 25 2月, 2015 1 次提交
  12. 18 2月, 2015 1 次提交
  13. 05 11月, 2014 1 次提交
    • A
      dmi: add support for SMBIOS 3.0 64-bit entry point · fc430262
      Ard Biesheuvel 提交于
      The DMTF SMBIOS reference spec v3.0.0 defines a new 64-bit entry point,
      which enables support for SMBIOS structure tables residing at a physical
      offset over 4 GB. This is especially important for upcoming arm64
      platforms whose system RAM resides entirely above the 4 GB boundary.
      
      For the UEFI case, this code attempts to detect the new SMBIOS 3.0
      header magic at the offset passed in the SMBIOS3_TABLE_GUID UEFI
      configuration table. If this configuration table is not provided, or
      if we fail to parse the header, we fall back to using the legacy
      SMBIOS_TABLE_GUID configuration table. This is in line with the spec,
      that allows both configuration tables to be provided, but mandates that
      they must point to the same structure table, unless the version pointed
      to by the 64-bit entry point is a superset of the 32-bit one.
      
      For the non-UEFI case, the detection logic is modified to look for the
      SMBIOS 3.0 header magic before it looks for the legacy header magic.
      
      Note that this patch is based on version 3.0.0d [draft] of the
      specification, which is expected not to deviate from the final version
      in ways that would affect the correctness of this implementation.
      Tested-by: NSuravee Suthikulpanit <suravee.suthikulpanit@amd.com>
      Acked-by: NLeif Lindholm <leif.lindholm@linaro.org>
      Tested-by: NLeif Lindholm <leif.lindholm@linaro.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Tony Luck <tony.luck@intel.com>
      Acked-by: NMatt Fleming <matt.fleming@intel.com>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      fc430262
  14. 24 1月, 2014 1 次提交
  15. 03 11月, 2013 1 次提交
  16. 24 10月, 2013 1 次提交
  17. 12 9月, 2013 4 次提交
  18. 01 8月, 2013 1 次提交
  19. 04 7月, 2013 1 次提交
  20. 01 5月, 2013 3 次提交
    • B
      dmi_scan: refactor dmi_scan_machine(), {smbios,dmi}_present() · 79bae42d
      Ben Hutchings 提交于
      Move the calls to memcpy_fromio() up into the loop in
      dmi_scan_machine(), and move the signature checks back down into
      dmi_decode().  We need to check at 16-byte intervals but keep a 32-byte
      buffer for an SMBIOS entry, so shift the buffer after each iteration.
      
      Merge smbios_present() into dmi_present(), so we look for an SMBIOS
      signature at the beginning of the given buffer and then for a DMI
      signature at an offset of 16 bytes.
      
      [artem.savkov@gmail.com: use proper buf type in dmi_present()]
      Signed-off-by: NBen Hutchings <ben@decadent.org.uk>
      Reported-by: NTim McGrath <tmhikaru@gmail.com>
      Tested-by: NTim Mcgrath <tmhikaru@gmail.com>
      Cc: Zhenzhong Duan <zhenzhong.duan@oracle.com>
      Signed-off-by: NArtem Savkov <artem.savkov@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      79bae42d
    • T
      dump_stack: implement arch-specific hardware description in task dumps · 98e5e1bf
      Tejun Heo 提交于
      x86 and ia64 can acquire extra hardware identification information
      from DMI and print it along with task dumps; however, the usage isn't
      consistent.
      
      * x86 show_regs() collects vendor, product and board strings and print
        them out with PID, comm and utsname.  Some of the information is
        printed again later in the same dump.
      
      * warn_slowpath_common() explicitly accesses the DMI board and prints
        it out with "Hardware name:" label.  This applies to both x86 and
        ia64 but is irrelevant on all other archs.
      
      * ia64 doesn't show DMI information on other non-WARN dumps.
      
      This patch introduces arch-specific hardware description used by
      dump_stack().  It can be set by calling dump_stack_set_arch_desc()
      during boot and, if exists, printed out in a separate line with
      "Hardware name:" label.
      
      dmi_set_dump_stack_arch_desc() is added which sets arch-specific
      description from DMI data.  It uses dmi_ids_string[] which is set from
      dmi_present() used for DMI debug message.  It is superset of the
      information x86 show_regs() is using.  The function is called from x86
      and ia64 boot code right after dmi_scan_machine().
      
      This makes the explicit DMI handling in warn_slowpath_common()
      unnecessary.  Removed.
      
      show_regs() isn't yet converted to use generic debug information
      printing and this patch doesn't remove the duplicate DMI handling in
      x86 show_regs().  The next patch will unify show_regs() handling and
      remove the duplication.
      
      An example WARN dump follows.
      
       WARNING: at kernel/workqueue.c:4841 init_workqueues+0x35/0x505()
       Modules linked in:
       CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.9.0-rc1-work+ #3
       Hardware name: empty empty/S3992, BIOS 080011  10/26/2007
        0000000000000009 ffff88007c861e08 ffffffff81c614dc ffff88007c861e48
        ffffffff8108f500 ffffffff82228240 0000000000000040 ffffffff8234a08e
        0000000000000000 0000000000000000 0000000000000000 ffff88007c861e58
       Call Trace:
        [<ffffffff81c614dc>] dump_stack+0x19/0x1b
        [<ffffffff8108f500>] warn_slowpath_common+0x70/0xa0
        [<ffffffff8108f54a>] warn_slowpath_null+0x1a/0x20
        [<ffffffff8234a0c3>] init_workqueues+0x35/0x505
        ...
      
      v2: Use the same string as the debug message from dmi_present() which
          also contains BIOS information.  Move hardware name into its own
          line as warn_slowpath_common() did.  This change was suggested by
          Bjorn Helgaas.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Fengguang Wu <fengguang.wu@intel.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Mike Frysinger <vapier@gentoo.org>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      98e5e1bf
    • T
      dmi: morph dmi_dump_ids() into dmi_format_ids() which formats into a buffer · c90fe6bc
      Tejun Heo 提交于
      We're goning to use DMI identification for other purposes too.  Morph
      dmi_dump_ids() which is used to print DMI identification as a debug
      message during boot into dmi_format_ids() which formats the same
      information sans the leading "DMI:" tag into a string buffer.
      
      dmi_present() is updated to format the information into dmi_ids_string[]
      using the new function and print it with "DMI:" prefix.
      
      dmi_ids_string[] will be used for another purpose by a future patch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Fengguang Wu <fengguang.wu@intel.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Mike Frysinger <vapier@gentoo.org>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c90fe6bc
  21. 09 3月, 2013 1 次提交
  22. 31 1月, 2013 1 次提交
    • M
      efi: Make 'efi_enabled' a function to query EFI facilities · 83e68189
      Matt Fleming 提交于
      Originally 'efi_enabled' indicated whether a kernel was booted from
      EFI firmware. Over time its semantics have changed, and it now
      indicates whether or not we are booted on an EFI machine with
      bit-native firmware, e.g. 64-bit kernel with 64-bit firmware.
      
      The immediate motivation for this patch is the bug report at,
      
          https://bugs.launchpad.net/ubuntu-cdimage/+bug/1040557
      
      which details how running a platform driver on an EFI machine that is
      designed to run under BIOS can cause the machine to become
      bricked. Also, the following report,
      
          https://bugzilla.kernel.org/show_bug.cgi?id=47121
      
      details how running said driver can also cause Machine Check
      Exceptions. Drivers need a new means of detecting whether they're
      running on an EFI machine, as sadly the expression,
      
          if (!efi_enabled)
      
      hasn't been a sufficient condition for quite some time.
      
      Users actually want to query 'efi_enabled' for different reasons -
      what they really want access to is the list of available EFI
      facilities.
      
      For instance, the x86 reboot code needs to know whether it can invoke
      the ResetSystem() function provided by the EFI runtime services, while
      the ACPI OSL code wants to know whether the EFI config tables were
      mapped successfully. There are also checks in some of the platform
      driver code to simply see if they're running on an EFI machine (which
      would make it a bad idea to do BIOS-y things).
      
      This patch is a prereq for the samsung-laptop fix patch.
      
      Cc: David Airlie <airlied@linux.ie>
      Cc: Corentin Chary <corentincj@iksaif.net>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Cc: Dave Jiang <dave.jiang@intel.com>
      Cc: Olof Johansson <olof@lixom.net>
      Cc: Peter Jones <pjones@redhat.com>
      Cc: Colin Ian King <colin.king@canonical.com>
      Cc: Steve Langasek <steve.langasek@canonical.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Konrad Rzeszutek Wilk <konrad@kernel.org>
      Cc: Rafael J. Wysocki <rjw@sisk.pl>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      83e68189
  23. 21 12月, 2012 2 次提交