1. 27 4月, 2017 1 次提交
  2. 13 4月, 2017 1 次提交
    • M
      ACPI / scan: Drop support for force_remove · ffc10d82
      Michal Hocko 提交于
      /sys/firmware/acpi/hotplug/force_remove was presumably added to support
      auto offlining in the past. This is, however, inherently dangerous for
      some hotplugable resources like memory. The memory offlining fails when
      the memory is still in use and cannot be dropped or migrated. If we
      ignore the failure we are basically allowing for subtle memory
      corruption or a crash.
      
      We have actually noticed the later while hitting BUG() during the memory
      hotremove (remove_memory):
      	ret = walk_memory_range(PFN_DOWN(start), PFN_UP(start + size - 1), NULL,
      			check_memblock_offlined_cb);
      	if (ret)
      		BUG();
      
      it took us quite non-trivial time realize that the customer had
      force_remove enabled. Even if the BUG was removed here and we could
      propagate the error up the call chain it wouldn't help at all because
      then we would hit a crash or a memory corruption later and harder to
      debug. So force_remove is unfixable for the memory hotremove. We haven't
      checked other hotplugable resources to be prone to a similar problems.
      
      Remove the force_remove functionality because it is not fixable currently.
      Keep the sysfs file and report an error if somebody tries to enable it.
      Encourage users to report about the missing functionality and work with
      them with an alternative solution.
      Reviewed-by: NLee, Chun-Yi <jlee@suse.com>
      Signed-off-by: NMichal Hocko <mhocko@suse.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ffc10d82
  3. 27 12月, 2016 1 次提交
  4. 17 9月, 2016 2 次提交
    • L
      ACPI / sysfs: Update sysfs signature handling code · 914c6194
      Lv Zheng 提交于
      This patch cleans up sysfs table signature handling code:
      
       1. Convert the signature handling code to use the ACPICA APIs to
          benefit from the future improvements of the APIs.
      
       2. Add 'filename' attribute in order to handle both BE/LE name tags.
      
       3. Add instance check in order to avoid the possible buffer overflow
          related to the table file name.
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      [ rjw: Changelog ]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      914c6194
    • L
      ACPI / sysfs: Fix an issue for LoadTable opcode · 307ecb0a
      Lv Zheng 提交于
      OEM tables can be installed via RSDT/XSDT, in this case, they have already
      been created under /sys/firmware/acpi/tables.
      
      For this kind of tables, normally LoadTable opcode will be executed to load
      them. If LoadTable opcode is executed after acpi_sysfs_init(),
      acpi_sysfs_table_handler() will be invoked, thus a redundant table file
      will be created under /sys/firmware/acpi/tables/dynamic. Then running
      "acpidump" on such platform results in an error, complaining blank empty
      table (see Link 1 below).
      
      The bug can be reproduced by customizing an OEM1 table, allowing it to be
      overridden via 'table_sigs' (drivers/acpi/tables.c), adding the following
      code to the customized DSDT to load it:
      
        Name (OEMH, Zero)
        Name (OEMF, One)
        If (LEqual (OEMF, One)) {
            Store (LoadTable ("OEM1", "Intel", "Test"), OEMH)
            Store (Zero, OEMF)
        }
      
      In order to make sure that the OEM1 table is installed after
      acpi_sysfs_init(), acpi_sysfs_init() can be moved before invoking
      acpi_load_tables(). Then the following command execution result can be
      seen:
       # acpidump > acpidump.txt
       Could not read table header: /sysfs/firmware/acpi/tables/dynamic/OEM12
       Could not get ACPI table at index 17, AE_BAD_HEADER
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=150841 # [1]
      Link: https://github.com/acpica/acpica/commit/ed6a5fbcReported-by: NJason Voelz <jason.voelz@intel.com>
      Reported-by: NFrancisco Leoner <francisco.j.lenoer.soto@intel.com>
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      307ecb0a
  5. 17 8月, 2016 1 次提交
  6. 09 7月, 2016 1 次提交
  7. 05 5月, 2016 1 次提交
  8. 26 10月, 2015 1 次提交
  9. 07 8月, 2015 3 次提交
    • L
      ACPI / sysfs: Add support to allow leading "\" missing in trace_method_name. · a0186bcf
      Lv Zheng 提交于
      Since _SB.PCI0 can be used as relative path from root and can be easily
      converted into internal trace_method_name format, we allow users to specify
      trace_method_name using relative paths from root.
      Note this is useful for grub2 for which users failed to pass "\" from the
      grub configuration file.
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a0186bcf
    • L
      ACPI / sysfs: Update method tracing facility. · 7901a052
      Lv Zheng 提交于
      This patch updates the method tracing facility as the acpi_debug_trace()
      API has been updated to allow it to trace AML interpreter execution, the
      meanings and the usages of the API parameters are changed due to the
      updates.
      
      The new API:
      1. Uses ACPI_TRACE_ENABLED flag to indicate the enabling of the tracer;
      2. Allows tracer still can be enabled when method name is not specified so
         that the AML interpreter execution can be traced without knowing the
         method name, which is useful for kernel boot tracing;
      3. Supports arbitrary full path name, it doesn't need to be a name related
         to an entrance of acpi_evaluate_object().
      
      Note that the sysfs parameters are also updated so that when reading the
      attribute files, ACPICA internal settings are returned.
      
      In order to make the sysfs parameters (acpi.trace_state) available during
      boot, this patch adds code to bypass ACPICA semaphore/mutex invocations
      when acpi mutex utilities haven't been initialized.
      
      This patch doesn't update documentation of method tracing facility, it will
      be updated by further patches.
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      7901a052
    • L
      ACPI / sysfs: Add ACPI_LV_REPAIR debug level. · 93d98831
      Lv Zheng 提交于
      This patch updates debug_level file, adding ACPI_LV_REPAIR.
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      93d98831
  10. 10 3月, 2015 1 次提交
  11. 21 10月, 2014 1 次提交
  12. 19 3月, 2014 1 次提交
  13. 28 1月, 2014 1 次提交
  14. 07 12月, 2013 1 次提交
    • L
      ACPI: Clean up inclusions of ACPI header files · 8b48463f
      Lv Zheng 提交于
      Replace direct inclusions of <acpi/acpi.h>, <acpi/acpi_bus.h> and
      <acpi/acpi_drivers.h>, which are incorrect, with <linux/acpi.h>
      inclusions and remove some inclusions of those files that aren't
      necessary.
      
      First of all, <acpi/acpi.h>, <acpi/acpi_bus.h> and <acpi/acpi_drivers.h>
      should not be included directly from any files that are built for
      CONFIG_ACPI unset, because that generally leads to build warnings about
      undefined symbols in !CONFIG_ACPI builds.  For CONFIG_ACPI set,
      <linux/acpi.h> includes those files and for CONFIG_ACPI unset it
      provides stub ACPI symbols to be used in that case.
      
      Second, there are ordering dependencies between those files that always
      have to be met.  Namely, it is required that <acpi/acpi_bus.h> be included
      prior to <acpi/acpi_drivers.h> so that the acpi_pci_root declarations the
      latter depends on are always there.  And <acpi/acpi.h> which provides
      basic ACPICA type declarations should always be included prior to any other
      ACPI headers in CONFIG_ACPI builds.  That also is taken care of including
      <linux/acpi.h> as appropriate.
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Acked-by: Bjorn Helgaas <bhelgaas@google.com> (drivers/pci stuff)
      Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> (Xen stuff)
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      8b48463f
  15. 21 11月, 2013 2 次提交
    • J
      ACPI / sysfs: Fix incorrect ACPI tables walk in acpi_tables_sysfs_init() · de03beed
      Jeremy Compostella 提交于
      When executing on an ACPI Hardware Reduced hardware, all the ACPI
      tables are not exposed in sysfs due to the fact that FACS is
      silently ignored by the kernel in the ACPI hardware reduced mode
      and, moreover, the acpi_tables_sysfs_init() ACPI table walk
      is buggy and stops too soon.
      
      The acpi_tables_sysfs_init() function should rely on the acpi_status
      return value from acpi_get_table_by_index() to decide whether or not
      to stop the iteration (the walk should only be terminated when that
      value is AE_BAD_PARAMETER).  This way, when running in an ACPI Harware
      Reduced environment (where the FACS table is silently ignored by the
      kernel) or if some ACPI tables are not correctly memory mapped or
      have bad checksums, it will still walk through the remaining tables
      that may be correct.
      
      [rjw: Changelog]
      Signed-off-by: NJeremy Compostella <jeremy.compostella@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      de03beed
    • D
      ACPI / sysfs: Set file size for each exposed ACPI table · 083ca8c4
      Daisuke HATAYAMA 提交于
      Currently, each of the ACPI tables exported from
      /sys/firmware/acpi/tables is of zero size:
      
      $ LANG=C ls -ld /sys/firmware/acpi/tables/*
      -r-------- 1 root root 0 Nov 19 09:48 /sys/firmware/acpi/tables/APIC
      -r-------- 1 root root 0 Nov 19 09:48 /sys/firmware/acpi/tables/BOOT
      -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/DSDT
      -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/FACP
      -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/FACS
      -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/MCFG
      -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/SRAT
      drwxr-xr-x 2 root root 0 Nov 19 09:48 /sys/firmware/acpi/tables/dynamic/
      
      due to which, user-land tools fail reading each table. For example:
      
      $ acpidump -f /sys/firmware/acpi/tables/SRAT
      Could not get input file size: /sys/firmware/acpi/tables/SRAT
      
      To deal with the issue, this patch assigns size of each ACPI table to
      the corresponding sysfs file.
      
      $ LANG=C ls -hld /sys/firmware/acpi/tables/*
      -r-------- 1 root root  94 Nov 19 16:45 /sys/firmware/acpi/tables/APIC
      -r-------- 1 root root  40 Nov 19 16:45 /sys/firmware/acpi/tables/BOOT
      -r-------- 1 root root 58K Nov 19 16:55 /sys/firmware/acpi/tables/DSDT
      -r-------- 1 root root 244 Nov 19 16:55 /sys/firmware/acpi/tables/FACP
      -r-------- 1 root root  64 Nov 19 16:55 /sys/firmware/acpi/tables/FACS
      -r-------- 1 root root  60 Nov 19 16:55 /sys/firmware/acpi/tables/MCFG
      -r-------- 1 root root 168 Nov 19 16:45 /sys/firmware/acpi/tables/SRAT
      drwxr-xr-x 2 root root   0 Nov 19 16:55 /sys/firmware/acpi/tables/dynamic/
      
      Then, user-land tools work well like:
      
      $ acpidump -f /sys/firmware/acpi/tables/SRAT
      SRAT @ 0x0000000000000000
        0000: 53 52 41 54 A8 00 00 00 02 65 56 4D 57 41 52 45  SRAT.....eVMWARE
        0010: 4D 45 4D 50 4C 55 47 20 00 00 04 06 56 4D 57 20  MEMPLUG ....VMW
        0020: 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00  ................
        0030: 01 28 00 00 00 00 00 00 00 00 00 00 00 00 00 00  .(..............
        0040: 00 00 0A 00 00 00 00 00 00 00 00 00 01 00 00 00  ................
        0050: 00 00 00 00 00 00 00 00 01 28 00 00 00 00 00 00  .........(......
        0060: 00 00 10 00 00 00 00 00 00 00 F0 BF 00 00 00 00  ................
        0070: 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00  ................
        0080: 01 28 00 00 00 00 00 00 00 00 00 00 01 00 00 00  .(..............
        0090: 00 00 00 40 00 00 00 00 00 00 00 00 01 00 00 00  ...@............
        00A0: 00 00 00 00 00 00 00 00                          ........
      Signed-off-by: NHATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      Acked-by: NZhang Rui <rui.zhang@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      083ca8c4
  16. 01 10月, 2013 3 次提交
  17. 25 9月, 2013 1 次提交
    • L
      ACPI / sysfs: make GPE sysfs attributes only accept correct values · c48b1565
      Lan Tianyu 提交于
      According to the design, GPE sysfs attributes should accept "disable",
      "enable", "clear" and integer numbers as params. Current code checks
      "disable", "enable" and "clear" first. If the param doesn't match,
      pass it to strtoul() as a string representing an integer number and
      assign the return value to the given GPE count. It is missing the check
      of whether or not the param really represents an integer number and
      strtoul() will return 0 if the string is not a number.  This causes any
      params except for "enable", "disable", "clear" and a number to make the
      GPE count become 0. This patch is to use kstrtoul() to replace strtoul()
      and check the return value. If the convertion is successful, use as the
      new GPE count. If not, return an error.
      Signed-off-by: NLan Tianyu <tianyu.lan@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      c48b1565
  18. 04 7月, 2013 1 次提交
    • K
      clean up scary strncpy(dst, src, strlen(src)) uses · 096a8aac
      Kees Cook 提交于
      Fix various weird constructions of strncpy(dst, src, strlen(src)).
      
      Length limits should be about the space available in the destination,
      not repurposed as a method to either always include or always exclude a
      trailing NULL byte.  Either the NULL should always be copied (using
      strlcpy), or it should not be copied (using something like memcpy).
      Readable code should not depend on the weird behavior of strncpy when it
      hits the length limit.  Better to avoid the anti-pattern entirely.
      
      [akpm@linux-foundation.org: revert getdelays.c part due to missing bsd/string.h]
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>	[staging]
      Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>	[acpi]
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Ursula Braun <ursula.braun@de.ibm.com>
      Cc: Frank Blaschka <blaschka@linux.vnet.ibm.com>
      Cc: Richard Weinberger <richard@nod.at>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      096a8aac
  19. 12 5月, 2013 1 次提交
    • R
      ACPI / hotplug: Use device offline/online for graceful hot-removal · 683058e3
      Rafael J. Wysocki 提交于
      Modify the generic ACPI hotplug code to be able to check if devices
      scheduled for hot-removal may be gracefully removed from the system
      using the device offline/online mechanism introduced previously.
      
      Namely, make acpi_scan_hot_remove() handling device hot-removal call
      device_offline() for all physical companions of the ACPI device nodes
      involved in the operation and check the results.  If any of the
      device_offline() calls fails, the function will not progress to the
      removal phase (which cannot be aborted), unless its (new) force
      argument is set (in case of a failing offline it will put the devices
      offlined by it back online).
      
      In support of 'forced' device hot-removal, add a new sysfs attribute
      'force_remove' that will reside under /sys/firmware/acpi/hotplug/.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NToshi Kani <toshi.kani@hp.com>
      683058e3
  20. 19 3月, 2013 1 次提交
  21. 04 3月, 2013 1 次提交
    • R
      ACPI / hotplug: Introduce user space interface for hotplug profiles · 3f8055c3
      Rafael J. Wysocki 提交于
      Introduce user space interface for manipulating hotplug profiles
      associated with ACPI scan handlers.
      
      The interface consists of sysfs directories under
      /sys/firmware/acpi/hotplug/, one for each hotplug profile, containing
      an attribute allowing user space to manipulate the enabled field of
      the corresponding profile.  Namely, switching the enabled attribute
      from '0' to '1' will cause the common hotplug notify handler to be
      installed for all ACPI namespace objects representing devices matching
      the scan handler associated with the given hotplug profile (and
      analogously for the converse switch).
      
      Drivers willing to use the new user space interface should add their
      ACPI scan handlers with the help of new funtion
      acpi_scan_add_handler_with_hotplug().
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      Tested-by: NToshi Kani <toshi.kani@hp.com>
      3f8055c3
  22. 26 1月, 2013 1 次提交
  23. 15 11月, 2012 1 次提交
  24. 27 7月, 2012 1 次提交
  25. 05 6月, 2012 1 次提交
  26. 07 11月, 2011 1 次提交
  27. 17 7月, 2011 1 次提交
  28. 29 5月, 2011 1 次提交
  29. 12 1月, 2011 1 次提交
  30. 29 9月, 2010 1 次提交
    • Z
      ACPI: fix build warnings resulting from merge window conflict · ec652b35
      Zhang Rui 提交于
      drivers/acpi/sysfs.c:154: warning: passing argument 1 of '__check_old_set_param' from incompatible pointer type
      include/linux/moduleparam.h:165: note: expected 'int (*)(const char *, struct kernel_param *)' but argument is of type 'int (*)(const char *, const struct kernel_param *)'
      
      Introduced by commit 1c8fce27 ("ACPI:
      introduce drivers/acpi/sysfs.c") interacting with commit
      9bbb9e5a ("param: use ops in struct
      kernel_param, rather than get and set fns directly").
      
      Use module_param_cb instead of the obsoleted module_param_call to fix a build warning.
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      ec652b35
  31. 15 8月, 2010 1 次提交
    • Z
      ACPI: introduce drivers/acpi/sysfs.c · 1c8fce27
      Zhang Rui 提交于
      Introduce drivers/acpi/sysfs.c.
      
      code for ACPI sysfs I/F, including
      #ifdef ACPI_DEBUG
      /sys/module/acpi/parameters/debug_layer
      /sys/module/acpi/parameters/debug_level
      /sys/module/acpi/parameters/trace_method_name
      /sys/module/acpi/parameters/trace_debug_layer
      /sys/module/acpi/parameters/trace_debug_level
      /sys/module/acpi/parameters/trace_state
      #endif
      /sys/module/acpi/parameters/acpica_version
      /sys/firmware/acpi/tables/
      /sys/firmware/acpi/interrupts/
      is moved to this file.
      
      No function change in this patch.
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      1c8fce27
  32. 07 7月, 2010 1 次提交
  33. 12 6月, 2010 1 次提交
    • R
      ACPI / ACPICA: Fix sysfs GPE interface · 9d3c752d
      Rafael J. Wysocki 提交于
      The sysfs interface allowing user space to disable/enable GPEs
      doesn't work correctly, because a GPE disabled this way will be
      re-enabled shortly by acpi_ev_asynch_enable_gpe() if it was
      previosuly enabled by acpi_enable_gpe() (in which case the
      corresponding bit in its enable register's enable_for_run mask is
      set).
      
      To address this issue make the sysfs GPE interface use
      acpi_enable_gpe() and acpi_disable_gpe() instead of acpi_set_gpe()
      so that GPE reference counters are modified by it along with the
      values of GPE enable registers.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      9d3c752d
  34. 22 5月, 2010 1 次提交