1. 24 6月, 2021 4 次提交
    • D
      ACPI: PM: postpone bringing devices to D0 unless we need them · f7599be2
      Dmitry Torokhov 提交于
      Currently ACPI power domain brings devices into D0 state in the "resume
      early" phase. Normally this does not cause any issues, as powering up
      happens quickly. However there are peripherals that have certain timing
      requirements for powering on, for example some models of Elan
      touchscreens need 300msec after powering up/releasing reset line before
      they can accept commands from the host. Such devices will dominate
      the time spent in early resume phase and cause increase in overall
      resume time as we wait for early resume to complete before we can
      proceed to the normal resume stage.
      
      There are ways for a driver to indicate that it can tolerate device
      being in the low power mode and that it knows how to power the device
      back up when resuming, bit that requires changes to individual drivers
      that may not really care about details of ACPI controlled power
      management.
      
      This change attempts to solve this issue at ACPI power domain level, by
      postponing powering up device until we get to the normal resume stage,
      unless there is early resume handler defined for the device, or device
      does not declare any resume handlers, in which case we continue powering
      up such devices early. This allows us to shave off several hundred
      milliseconds of resume time on affected systems.
      Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      f7599be2
    • R
      ACPI: tables: Add custom DSDT file as makefile prerequisite · d1059c1b
      Richard Fitzgerald 提交于
      A custom DSDT file is mostly used during development or debugging,
      and in that case it is quite likely to want to rebuild the kernel
      after changing ONLY the content of the DSDT.
      
      This patch adds the custom DSDT as a prerequisite to tables.o
      to ensure a rebuild if the DSDT file is updated. Make will merge
      the prerequisites from multiple rules for the same target.
      Signed-off-by: NRichard Fitzgerald <rf@opensource.cirrus.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      d1059c1b
    • N
      ACPI: bgrt: Use sysfs_emit · 6554ca9c
      Nathan Chancellor 提交于
      sysfs_emit is preferred to snprintf for emitting values after
      commit 2efc459d ("sysfs: Add sysfs_emit and sysfs_emit_at to format
      sysfs output").
      Signed-off-by: NNathan Chancellor <nathan@kernel.org>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      6554ca9c
    • N
      ACPI: bgrt: Fix CFI violation · f37ccf8f
      Nathan Chancellor 提交于
      clang's Control Flow Integrity requires that every indirect call has a
      valid target, which is based on the type of the function pointer. The
      *_show() functions in this file are written as if they will be called
      from dev_attr_show(); however, they will be called from
      sysfs_kf_seq_show() because the files were created by
      sysfs_create_group() and the sysfs ops are based on kobj_sysfs_ops
      because of kobject_add_and_create(). Because the *_show() functions do
      not match the type of the show() member in struct kobj_attribute, there
      is a CFI violation.
      
      $ cat /sys/firmware/acpi/bgrt/{status,type,version,{x,y}offset}}
      1
      0
      1
      522
      307
      
      $ dmesg | grep "CFI failure"
      [  267.761825] CFI failure (target: type_show.d5e1ad21498a5fd14edbc5c320906598.cfi_jt+0x0/0x8):
      [  267.762246] CFI failure (target: xoffset_show.d5e1ad21498a5fd14edbc5c320906598.cfi_jt+0x0/0x8):
      [  267.762584] CFI failure (target: status_show.d5e1ad21498a5fd14edbc5c320906598.cfi_jt+0x0/0x8):
      [  267.762973] CFI failure (target: yoffset_show.d5e1ad21498a5fd14edbc5c320906598.cfi_jt+0x0/0x8):
      [  267.763330] CFI failure (target: version_show.d5e1ad21498a5fd14edbc5c320906598.cfi_jt+0x0/0x8):
      
      Convert these functions to the type of the show() member in struct
      kobj_attribute so that there is no more CFI violation. Because these
      functions are all so similar, combine them into a macro.
      
      Fixes: d1ff4b1c ("ACPI: Add support for exposing BGRT data")
      Link: https://github.com/ClangBuiltLinux/linux/issues/1406Signed-off-by: NNathan Chancellor <nathan@kernel.org>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      f37ccf8f
  2. 22 6月, 2021 2 次提交
  3. 19 6月, 2021 7 次提交
  4. 17 6月, 2021 16 次提交
  5. 14 6月, 2021 5 次提交
  6. 10 6月, 2021 4 次提交
    • C
      ACPI: scan: initialize local variable to avoid garbage being returned · 23db673d
      Colin Ian King 提交于
      In the unlikely event that there are no callback calls made in
      acpi_walk_dep_device_list(), local variable ret will be returned as
      an uninitialized value.
      
      Clean up static analysis warnings by ensuring ret is initialized.
      
      Addresses-Coverity: ("Uninitialized scalar variable")
      Fixes: a9e10e58 ("ACPI: scan: Extend acpi_walk_dep_device_list()")
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Reviewed-by: NDaniel Scally <djrscally@gmail.com>
      [ rjw: Subject and changelog edits ]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      23db673d
    • H
      ACPI: Remove redundant clearing of context->ret.pointer from acpi_run_osc() · f39de44f
      Hans de Goede 提交于
      context->ret.pointer already gets set to NULL at the beginning of
      acpi_run_osc() and it only gets assigned a new value in the success
      path near the end of acpi_run_osc(), so the clearing of
      context->ret.pointer (when status != AE_OK) at the end of
      acpi_run_osc() is redundant since it will always already be NULL when
      status != AE_OK.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      f39de44f
    • E
      ACPI: Add \_SB._OSC bit for PRM · 60faa8f1
      Erik Kaneda 提交于
      Signed-off-by: NErik Kaneda <erik.kaneda@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      60faa8f1
    • E
      ACPI: PRM: implement OperationRegion handler for the PlatformRtMechanism subtype · cefc7ca4
      Erik Kaneda 提交于
      Platform Runtime Mechanism (PRM) is a firmware interface that exposes
      a set of binary executables that can either be called from the AML
      interpreter or device drivers by bypassing the AML interpreter.
      This change implements the AML interpreter path.
      
      According to the specification [1], PRM services are listed in an
      ACPI table called the PRMT. This patch parses module and handler
      information listed in the PRMT and registers the PlatformRtMechanism
      OpRegion handler before ACPI tables are loaded.
      
      Each service is defined by a 16-byte GUID and called from writing a
      26-byte ASL buffer containing the identifier to a FieldUnit object
      defined inside a PlatformRtMechanism OperationRegion.
      
          OperationRegion (PRMR, PlatformRtMechanism, 0, 26)
          Field (PRMR, BufferAcc, NoLock, Preserve)
          {
              PRMF, 208 // Write to this field to invoke the OperationRegion Handler
          }
      
      The 26-byte ASL buffer is defined as the following:
      
      Byte Offset   Byte Length    Description
      =============================================================
           0             1         PRM OperationRegion handler status
           1             8         PRM service status
           9             1         PRM command
          10            16         PRM handler GUID
      
      The ASL caller fills out a 26-byte buffer containing the PRM command
      and the PRM handler GUID like so:
      
          /* Local0 is the PRM data buffer */
          Local0 = buffer (26){}
      
          /* Create byte fields over the buffer */
          CreateByteField (Local0, 0x9, CMD)
          CreateField (Local0, 0x50, 0x80, GUID)
      
          /* Fill in the command and data fields of the data buffer */
          CMD = 0 // run command
          GUID = ToUUID("xxxx-xx-xxx-xxxx")
      
          /*
           * Invoke PRM service with an ID that matches GUID and save the
           * result.
           */
          Local0 = (\_SB.PRMT.PRMF = Local0)
      
      Byte offset 0 - 8 are written by the handler as a status passed back to AML
      and used by ASL like so:
      
          /* Create byte fields over the buffer */
          CreateByteField (Local0, 0x0, PSTA)
          CreateQWordField (Local0, 0x1, USTA)
      
      In this ASL code, PSTA contains a status from the OperationRegion and
      USTA contains a status from the PRM service.
      
      The 26-byte buffer is recieved by acpi_platformrt_space_handler. This
      handler will look at the command value and the handler guid and take
      the approperiate actions.
      
      Command value    Action
      =====================================================================
          0            Run the PRM service indicated by the PRM handler
                       GUID (bytes 10-26)
      
          1            Prevent PRM runtime updates from happening to the
                       service's parent module
      
          2            Allow PRM updates from happening to the service's parent module
      
      This patch enables command value 0.
      
      Link: https://uefi.org/sites/default/files/resources/Platform%20Runtime%20Mechanism%20-%20with%20legal%20notice.pdf # [1]
      Signed-off-by: NErik Kaneda <erik.kaneda@intel.com>
      [ rjw: Subject and changelog edits ]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      cefc7ca4
  7. 09 6月, 2021 2 次提交