1. 05 1月, 2022 1 次提交
    • S
      ACPI: PCC: Implement OperationRegion handler for the PCC Type 3 subtype · 77e2a047
      Sudeep Holla 提交于
      PCC OpRegion provides a mechanism to communicate with the platform
      directly from the AML. PCCT provides the list of PCC channel available
      in the platform, a subset or all of them can be used in PCC Opregion.
      
      This patch registers the PCC OpRegion handler before ACPI tables are
      loaded. This relies on the special context data passed to identify and
      set up the PCC channel before the OpRegion handler is executed for the
      first time.
      
      Typical PCC Opregion declaration looks like this:
      
      OperationRegion (PFRM, PCC, 2, 0x74)
      Field (PFRM, ByteAcc, NoLock, Preserve)
      {
          SIGN,   32,
          FLGS,   32,
          LEN,    32,
          CMD,    32,
          DATA,   800
      }
      
      It contains four named double words followed by 100 bytes of buffer
      names DATA.
      
      ASL can fill out the buffer something like:
      
          /* Create global or local buffer */
          Name (BUFF, Buffer (0x0C){})
          /* Create double word fields over the buffer */
          CreateDWordField (BUFF, 0x0, WD0)
          CreateDWordField (BUFF, 0x04, WD1)
          CreateDWordField (BUFF, 0x08, WD2)
      
          /* Fill the named fields */
          WD0 = 0x50434300
          SIGN = BUFF
          WD0 = 1
          FLGS = BUFF
          WD0 = 0x10
          LEN = BUFF
      
          /* Fill the payload in the DATA buffer */
          WD0 = 0
          WD1 = 0x08
          WD2 = 0
          DATA = BUFF
      
          /* Write to CMD field to trigger handler */
          WD0 = 0x4404
          CMD = BUFF
      
      This buffer is received by acpi_pcc_opregion_space_handler. This
      handler will fetch the complete buffer via internal_pcc_buffer.
      
      The setup handler will receive the special PCC context data which will
      contain the PCC channel index which used to set up the channel. The
      buffer pointer and length is saved in region context which is then used
      in the handler.
      
      (kernel test robot: Build failure with CONFIG_ACPI_DEBUGGER)
      Link: https://lore.kernel.org/r/202201041539.feAV0l27-lkp@intel.comReported-by: Nkernel test robot <lkp@intel.com>
      Signed-off-by: NSudeep Holla <sudeep.holla@arm.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      77e2a047
  2. 02 12月, 2021 1 次提交
  3. 21 7月, 2021 1 次提交
    • U
      bus: Make remove callback return void · fc7a6209
      Uwe Kleine-König 提交于
      The driver core ignores the return value of this callback because there
      is only little it can do when a device disappears.
      
      This is the final bit of a long lasting cleanup quest where several
      buses were converted to also return void from their remove callback.
      Additionally some resource leaks were fixed that were caused by drivers
      returning an error code in the expectation that the driver won't go
      away.
      
      With struct bus_type::remove returning void it's prevented that newly
      implemented buses return an ignored error code and so don't anticipate
      wrong expectations for driver authors.
      
      Reviewed-by: Tom Rix <trix@redhat.com> (For fpga)
      Reviewed-by: NMathieu Poirier <mathieu.poirier@linaro.org>
      Reviewed-by: Cornelia Huck <cohuck@redhat.com> (For drivers/s390 and drivers/vfio)
      Acked-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> (For ARM, Amba and related parts)
      Acked-by: NMark Brown <broonie@kernel.org>
      Acked-by: Chen-Yu Tsai <wens@csie.org> (for sunxi-rsb)
      Acked-by: NPali Rohár <pali@kernel.org>
      Acked-by: Mauro Carvalho Chehab <mchehab@kernel.org> (for media)
      Acked-by: Hans de Goede <hdegoede@redhat.com> (For drivers/platform)
      Acked-by: NAlexandre Belloni <alexandre.belloni@bootlin.com>
      Acked-By: NVinod Koul <vkoul@kernel.org>
      Acked-by: Juergen Gross <jgross@suse.com> (For xen)
      Acked-by: Lee Jones <lee.jones@linaro.org> (For mfd)
      Acked-by: Johannes Thumshirn <jth@kernel.org> (For mcb)
      Acked-by: NJohan Hovold <johan@kernel.org>
      Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> (For slimbus)
      Acked-by: Kirti Wankhede <kwankhede@nvidia.com> (For vfio)
      Acked-by: NMaximilian Luz <luzmaximilian@gmail.com>
      Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> (For ulpi and typec)
      Acked-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> (For ipack)
      Acked-by: Geoff Levand <geoff@infradead.org> (For ps3)
      Acked-by: Yehezkel Bernat <YehezkelShB@gmail.com> (For thunderbolt)
      Acked-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> (For intel_th)
      Acked-by: Dominik Brodowski <linux@dominikbrodowski.net> (For pcmcia)
      Acked-by: Rafael J. Wysocki <rafael@kernel.org> (For ACPI)
      Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org> (rpmsg and apr)
      Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> (For intel-ish-hid)
      Acked-by: Dan Williams <dan.j.williams@intel.com> (For CXL, DAX, and NVDIMM)
      Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com> (For isa)
      Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (For firewire)
      Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> (For hid)
      Acked-by: Thorsten Scherer <t.scherer@eckelmann.de> (For siox)
      Acked-by: Sven Van Asbroeck <TheSven73@gmail.com> (For anybuss)
      Acked-by: Ulf Hansson <ulf.hansson@linaro.org> (For MMC)
      Acked-by: Wolfram Sang <wsa@kernel.org> # for I2C
      Acked-by: NSudeep Holla <sudeep.holla@arm.com>
      Acked-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Acked-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      Acked-by: NFinn Thain <fthain@linux-m68k.org>
      Signed-off-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Link: https://lore.kernel.org/r/20210713193522.1770306-6-u.kleine-koenig@pengutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fc7a6209
  4. 17 7月, 2021 1 次提交
  5. 02 7月, 2021 1 次提交
  6. 25 6月, 2021 1 次提交
  7. 22 6月, 2021 1 次提交
    • R
      ACPI: scan: Simplify acpi_table_events_fn() · 8d287e82
      Rafael J. Wysocki 提交于
      Notice that the table field of struct acpi_table_events_work is never
      read and its event field is always equal to ACPI_TABLE_EVENT_LOAD, so
      both of them are redundant.
      
      Accordingly, drop struct acpi_table_events_work and use struct
      work_struct directly instead of it, simplify acpi_scan_table_handler()
      and rename it to acpi_scan_table_notify().
      
      Moreover, make acpi_bus_table_handler() check the event code against
      ACPI_TABLE_EVENT_LOAD before calling acpi_scan_table_notify(), so it
      is not necessary to do that check in the latter.
      
      No intentional functional impact.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      8d287e82
  8. 10 6月, 2021 3 次提交
    • 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
  9. 09 6月, 2021 1 次提交
  10. 07 6月, 2021 3 次提交
  11. 05 2月, 2021 1 次提交
    • R
      ACPI: bus: Clean up printing messages · ee98460b
      Rafael J. Wysocki 提交于
      Replace all of the ACPI_DEBUG_PRINT() and ACPI_EXCEPTION() instances
      in bus.c with pr_debug() and pr_info(), respectively, drop the
      _COMPONENT and ACPI_MODULE_NAME() definitions that are not used any
      more and replace direct printk() invocations with the matching
      pr_*() calls (with a couple of exceptions where the log level is
      decreased).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ee98460b
  12. 04 2月, 2021 2 次提交
    • M
      ACPI: Add support for native USB4 control _OSC · 5a6a2c0f
      Mika Westerberg 提交于
      ACPI 6.4 introduced a new _OSC capability that is used negotiate native
      connection manager support. Connection manager is the entity that is
      responsible for tunneling over the USB4 fabric. If the platform rejects
      the native access then firmware based connection manager is used.
      
      The new _OSC also includes a set of bits that can be used to disable
      certain tunnel types such as PCIe for security reasons for instance.
      
      This implements the new USB4 _OSC so that we try to negotiate native
      USB4 support if the Thunderbolt/USB4 (CONFIG_USB4) driver is enabled.
      Drivers can determine what was negotiated by checking two new variables
      exposed in this patch.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      5a6a2c0f
    • M
      ACPI: Execute platform _OSC also with query bit clear · 719e1f56
      Mario Limonciello 提交于
      The platform _OSC can change the hardware state when query bit is not
      set. According to ACPI spec it is recommended that the OS runs _OSC with
      query bit set until the platform does not mask any of the capabilities.
      Then it should run it with query bit clear in order to actually commit
      the changes. Linux has not been doing this for the reasons that there
      has not been anything to commit, until now.
      
      The ACPI 6.4 introduced _OSC for USB4 to allow the OS to negotiate
      native control over USB4 tunneling. The platform might implement this so
      that it only activates the software connection manager path when the OS
      calls the _OSC with the query bit clear. Otherwise it may default to the
      firmware connection manager, for instance.
      
      For this reason modify the _OSC support so that we first execute it with
      query bit set, then use the returned value as base of the features we
      want to control and run the _OSC again with query bit clear. This also
      follows what Windows is doing.
      
      Also rename the function to better match what it does.
      Signed-off-by: NMario Limonciello <mario.limonciello@dell.com>
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      719e1f56
  13. 03 10月, 2020 1 次提交
  14. 03 9月, 2020 1 次提交
  15. 29 11月, 2019 1 次提交
    • V
      ACPI: bus: Fix NULL pointer check in acpi_bus_get_private_data() · 627ead72
      Vamshi K Sthambamkadi 提交于
      kmemleak reported backtrace:
          [<bbee0454>] kmem_cache_alloc_trace+0x128/0x260
          [<6677f215>] i2c_acpi_install_space_handler+0x4b/0xe0
          [<1180f4fc>] i2c_register_adapter+0x186/0x400
          [<6083baf7>] i2c_add_adapter+0x4e/0x70
          [<a3ddf966>] intel_gmbus_setup+0x1a2/0x2c0 [i915]
          [<84cb69ae>] i915_driver_probe+0x8d8/0x13a0 [i915]
          [<81911d4b>] i915_pci_probe+0x48/0x160 [i915]
          [<4b159af1>] pci_device_probe+0xdc/0x160
          [<b3c64704>] really_probe+0x1ee/0x450
          [<bc029f5a>] driver_probe_device+0x142/0x1b0
          [<d8829d20>] device_driver_attach+0x49/0x50
          [<de71f045>] __driver_attach+0xc9/0x150
          [<df33ac83>] bus_for_each_dev+0x56/0xa0
          [<80089bba>] driver_attach+0x19/0x20
          [<cc73f583>] bus_add_driver+0x177/0x220
          [<7b29d8c7>] driver_register+0x56/0xf0
      
      In i2c_acpi_remove_space_handler(), a leak occurs whenever the
      "data" parameter is initialized to 0 before being passed to
      acpi_bus_get_private_data().
      
      This is because the NULL pointer check in acpi_bus_get_private_data()
      (condition->if(!*data)) returns EINVAL and, in consequence, memory is
      never freed in i2c_acpi_remove_space_handler().
      
      Fix the NULL pointer check in acpi_bus_get_private_data() to follow
      the analogous check in acpi_get_data_full().
      Signed-off-by: NVamshi K Sthambamkadi <vamshi.k.sthambamkadi@gmail.com>
      [ rjw: Subject & changelog ]
      Cc: All applicable <stable@vger.kernel.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      627ead72
  16. 31 5月, 2019 1 次提交
    • T
      treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 · c942fddf
      Thomas Gleixner 提交于
      Based on 3 normalized pattern(s):
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version this program is distributed in the
        hope that it will be useful but without any warranty without even
        the implied warranty of merchantability or fitness for a particular
        purpose see the gnu general public license for more details
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version [author] [kishon] [vijay] [abraham]
        [i] [kishon]@[ti] [com] this program is distributed in the hope that
        it will be useful but without any warranty without even the implied
        warranty of merchantability or fitness for a particular purpose see
        the gnu general public license for more details
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version [author] [graeme] [gregory]
        [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i]
        [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema]
        [hk] [hemahk]@[ti] [com] this program is distributed in the hope
        that it will be useful but without any warranty without even the
        implied warranty of merchantability or fitness for a particular
        purpose see the gnu general public license for more details
      
      extracted by the scancode license scanner the SPDX license identifier
      
        GPL-2.0-or-later
      
      has been chosen to replace the boilerplate/reference in 1105 file(s).
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NAllison Randal <allison@lohutok.net>
      Reviewed-by: NRichard Fontana <rfontana@redhat.com>
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Cc: linux-spdx@vger.kernel.org
      Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c942fddf
  17. 25 3月, 2019 1 次提交
  18. 27 2月, 2019 1 次提交
  19. 07 2月, 2019 1 次提交
  20. 16 1月, 2019 1 次提交
    • R
      ACPI: EC: Look for ECDT EC after calling acpi_load_tables() · b1c03308
      Rafael J. Wysocki 提交于
      Some systems have had functional issues since commit 5a8361f7
      (ACPICA: Integrate package handling with module-level code) that,
      among other things, changed the initial values of the
      acpi_gbl_group_module_level_code and acpi_gbl_parse_table_as_term_list
      global flags in ACPICA which implicitly caused acpi_ec_ecdt_probe() to
      be called before acpi_load_tables() on the vast majority of platforms.
      
      Namely, before commit 5a8361f7, acpi_load_tables() was called from
      acpi_early_init() if acpi_gbl_parse_table_as_term_list was FALSE and
      acpi_gbl_group_module_level_code was TRUE, which almost always was
      the case as FALSE and TRUE were their initial values, respectively.
      The acpi_gbl_parse_table_as_term_list value would be changed to TRUE
      for a couple of platforms in acpi_quirks_dmi_table[], but it remained
      FALSE in the vast majority of cases.
      
      After commit 5a8361f7, the initial values of the two flags have
      been reversed, so in effect acpi_load_tables() has not been called
      from acpi_early_init() any more.  That, in turn, affects
      acpi_ec_ecdt_probe() which is invoked before acpi_load_tables() now
      and it is not possible to evaluate the _REG method for the EC address
      space handler installed by it.  That effectively causes the EC address
      space to be inaccessible to AML on platforms with an ECDT matching the
      EC device definition in the DSDT and functional problems ensue in
      there.
      
      Because the default behavior before commit 5a8361f7 was to call
      acpi_ec_ecdt_probe() after acpi_load_tables(), it should be safe to
      do that again.  Moreover, the EC address space handler installed by
      acpi_ec_ecdt_probe() is only needed for AML to be able to access the
      EC address space and the only AML that can run during acpi_load_tables()
      is module-level code which only is allowed to access address spaces
      with default handlers (memory, I/O and PCI config space).
      
      For this reason, move the acpi_ec_ecdt_probe() invocation back to
      acpi_bus_init(), from where it was taken away by commit d737f333
      (ACPI: probe ECDT before loading AML tables regardless of module-level
      code flag), and put it after the invocation of acpi_load_tables() to
      restore the original code ordering from before commit 5a8361f7.
      
      Fixes: 5a8361f7 ("ACPICA: Integrate package handling with module-level code")
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=199981Reported-by: Nstep-ali <sunmooon15@gmail.com>
      Reported-by: NCharles Stanhope <charles.stanhope@gmail.com>
      Tested-by: NCharles Stanhope <charles.stanhope@gmail.com>
      Reported-by: NPaulo Nascimento <paulo.ulusu@googlemail.com>
      Reported-by: NDavid Purton <dcpurton@marshwiggle.net>
      Reported-by: NAdam Harvey <adam@adamharvey.name>
      Reported-by: NZhang Rui <rui.zhang@intel.com>
      Tested-by: NZhang Rui <rui.zhang@intel.com>
      Tested-by: NJean-Marc Lenoir <archlinux@jihemel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      b1c03308
  21. 27 11月, 2018 1 次提交
  22. 18 10月, 2018 1 次提交
  23. 06 9月, 2018 1 次提交
    • J
      ACPI / bus: Only call dmi_check_system() on X86 · 5d128fbd
      Jean Delvare 提交于
      Calling dmi_check_system() early only works on X86. Other
      architectures initialize the DMI subsystem later so it's not
      ready yet when ACPI itself gets initialized.
      
      In the best case it results in a useless call to a function which
      will do nothing. But depending on the dmi implementation, it could
      also result in warnings. Best is to not call the function when it
      can't work and isn't needed.
      
      Additionally, if anyone ever needs to add non-x86 quirks, it would
      surprisingly not work, so document the limitation to avoid confusion.
      Signed-off-by: NJean Delvare <jdelvare@suse.de>
      Fixes: cce4f632 (ACPI: fix early DSDT dmi check warnings on ia64)
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      5d128fbd
  24. 09 8月, 2018 1 次提交
  25. 20 7月, 2018 1 次提交
  26. 19 3月, 2018 1 次提交
  27. 12 2月, 2018 4 次提交
  28. 07 2月, 2018 1 次提交
  29. 04 2月, 2018 2 次提交
  30. 13 12月, 2017 1 次提交
  31. 14 9月, 2017 1 次提交