Commit Graph

1688 Commits

Author SHA1 Message Date
Linus Torvalds 2baa85d692 ACPI updates for 5.9-rc1
- Eliminate significant AML processing overhead related to using
    operation regions in system memory by reworking the management
    of memory mappings in the ACPI code to defer unmap operations
    (to do them outside of the ACPICA locks, among other things) and
    making the memory operation reagion handler avoid releasing memory
    mappings created by it too early (Rafael Wysocki).
 
  - Update the ACPICA code in the kernel to upstream revision
    20200717:
 
    * Prevent operation region reference counts from overflowing in
      some cases (Erik Kaneda).
 
    * Replace one-element array with flexible-array (Gustavo A. R.
      Silva).
 
  - Fix ACPI PCI hotplug reference counting (Rafael Wysocki).
 
  - Drop last bits of the ACPI procfs interface (Thomas Renninger).
 
  - Drop some redundant checks from the code parsing ACPI tables
    related to NUMA (Hanjun Guo).
 
  - Avoid redundant object evaluation in the ACPI device properties
    handling code (Heikki Krogerus).
 
  - Avoid unecessary memory overhead related to storing the signatures
    of the ACPI tables recognized by the kernel (Ard Biesheuvel).
 
  - Add missing newline characters when printing module parameter
    values in some places (Xiongfeng Wang).
 
  - Update the link to the ACPI specifications in some places (Tiezhu
    Yang).
 
  - Use the fallthrough pseudo-keyword in the ACPI code (Gustavo A. R.
    Silva).
 
  - Drop redundant variable initialization from the APEI code (Colin
    Ian King).
 
  - Drop uninitialized_var() from the ACPI PAD driver (Jason Yan).
 
  - Replace HTTP links with HTTPS ones in the ACPI code (Alexander A.
    Klimov).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAl8oO8gSHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRx2nUP/iSRAW0DK4PYDNLDV1Q+y5RrQw44iMDf
 yfLQu3agardM1KGtPuYw5zmU0UoEYtW8s2r027bxw9Hvn0IzBh5TiDvcVjMEnbVC
 +6m/fWg3EStfZ9w2dxDzXDMIk/oiEZsjtWSRaDTfAIH2jc/xVcSXDojlMgBPQDu5
 hIITjMbGGx783o4PNCYbIZy1ReJgd8MNQ+Xp3MCpTgbFgHMHKBOJ6B/nS8aTfilO
 eE5JvzhXED7qITaXYWxI9OZpRTPTNQ3eaEPbWvnw4KJ5boMfyREMGdTBipXO+kSA
 SwKhFysYEUAZM7Ffq0eTnWSCU7VWogAsTauIgs4+d9z8VrGhWi5+b6N/E/uwTKtj
 HF98xtk+Loe8V24LwN0snvv51O7P5nAH47QxwIBvQssfR8ZSgdwHtUQcckybAJhx
 LLmPtJrM8ZAefc9H4o0eVqumjoh1amGKC9dTY0g1j0UIE0y3ZIFHTvDNvhpTzgBk
 5uUHHEiolGNWHVrs1LIMOEejqx62m+EjVc9b8XUdJqHoboTccMM73DRk/00meP/7
 br/VfMI0aTjPLssvSC/ZSlTZt+ddrBm+cXw9eqruDQwdQaqxpJu+D3odjdaYSjpg
 luiYQrQdoDmIDh4UNuJbvG/Hub3CLzvJSqGWLExNbX7nWXxH4HIx/8PcNtVkKZRV
 qBXotIc+i4VD
 =Nn2Q
 -----END PGP SIGNATURE-----

Merge tag 'acpi-5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI updates from Rafael Wysocki:
 "These eliminate significant AML processing overhead related to using
  operation regions in system memory, update the ACPICA code in the
  kernel to upstream revision 20200717 (including a fix to prevent
  operation region reference counts from overflowing in some cases),
  remove the last bits of the (long deprecated) ACPI procfs interface
  and do some assorted cleanups.

  Specifics:

   - Eliminate significant AML processing overhead related to using
     operation regions in system memory by reworking the management of
     memory mappings in the ACPI code to defer unmap operations (to do
     them outside of the ACPICA locks, among other things) and making
     the memory operation reagion handler avoid releasing memory
     mappings created by it too early (Rafael Wysocki).

   - Update the ACPICA code in the kernel to upstream revision 20200717:

       * Prevent operation region reference counts from overflowing in
         some cases (Erik Kaneda).

       * Replace one-element array with flexible-array (Gustavo A. R.
         Silva).

   - Fix ACPI PCI hotplug reference counting (Rafael Wysocki).

   - Drop last bits of the ACPI procfs interface (Thomas Renninger).

   - Drop some redundant checks from the code parsing ACPI tables
     related to NUMA (Hanjun Guo).

   - Avoid redundant object evaluation in the ACPI device properties
     handling code (Heikki Krogerus).

   - Avoid unecessary memory overhead related to storing the signatures
     of the ACPI tables recognized by the kernel (Ard Biesheuvel).

   - Add missing newline characters when printing module parameter
     values in some places (Xiongfeng Wang).

   - Update the link to the ACPI specifications in some places (Tiezhu
     Yang).

   - Use the fallthrough pseudo-keyword in the ACPI code (Gustavo A. R.
     Silva).

   - Drop redundant variable initialization from the APEI code (Colin
     Ian King).

   - Drop uninitialized_var() from the ACPI PAD driver (Jason Yan).

   - Replace HTTP links with HTTPS ones in the ACPI code (Alexander A.
     Klimov)"

* tag 'acpi-5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (22 commits)
  ACPI: APEI: remove redundant assignment to variable rc
  ACPI: NUMA: Remove the useless 'node >= MAX_NUMNODES' check
  ACPI: NUMA: Remove the useless sub table pointer check
  ACPI: tables: Remove the duplicated checks for acpi_parse_entries_array()
  ACPICA: Update version to 20200717
  ACPICA: Do not increment operation_region reference counts for field units
  ACPICA: Replace one-element array with flexible-array
  ACPI: Replace HTTP links with HTTPS ones
  ACPI: Use valid link to the ACPI specification
  ACPI: OSL: Clean up the removal of unused memory mappings
  ACPI: OSL: Use deferred unmapping in acpi_os_unmap_iomem()
  ACPI: OSL: Use deferred unmapping in acpi_os_unmap_generic_address()
  ACPICA: Preserve memory opregion mappings
  ACPI: OSL: Implement deferred unmapping of ACPI memory
  ACPI: Use fallthrough pseudo-keyword
  PCI: hotplug: ACPI: Fix context refcounting in acpiphp_grab_context()
  ACPI: tables: avoid relocations for table signature array
  ACPI: PAD: Eliminate usage of uninitialized_var() macro
  ACPI: sysfs: add newlines when printing module parameters
  ACPI: EC: add newline when printing 'ec_event_clearing' module parameter
  ...
2020-08-03 20:37:22 -07:00
Linus Torvalds 145ff1ec09 arm64 and cross-arch updates for 5.9:
- Removal of the tremendously unpopular read_barrier_depends() barrier,
   which is a NOP on all architectures apart from Alpha, in favour of
   allowing architectures to override READ_ONCE() and do whatever dance
   they need to do to ensure address dependencies provide LOAD ->
   LOAD/STORE ordering. This work also offers a potential solution if
   compilers are shown to convert LOAD -> LOAD address dependencies into
   control dependencies (e.g. under LTO), as weakly ordered architectures
   will effectively be able to upgrade READ_ONCE() to smp_load_acquire().
   The latter case is not used yet, but will be discussed further at LPC.
 
 - Make the MSI/IOMMU input/output ID translation PCI agnostic, augment
   the MSI/IOMMU ACPI/OF ID mapping APIs to accept an input ID
   bus-specific parameter and apply the resulting changes to the device
   ID space provided by the Freescale FSL bus.
 
 - arm64 support for TLBI range operations and translation table level
   hints (part of the ARMv8.4 architecture version).
 
 - Time namespace support for arm64.
 
 - Export the virtual and physical address sizes in vmcoreinfo for
   makedumpfile and crash utilities.
 
 - CPU feature handling cleanups and checks for programmer errors
   (overlapping bit-fields).
 
 - ACPI updates for arm64: disallow AML accesses to EFI code regions and
   kernel memory.
 
 - perf updates for arm64.
 
 - Miscellaneous fixes and cleanups, most notably PLT counting
   optimisation for module loading, recordmcount fix to ignore
   relocations other than R_AARCH64_CALL26, CMA areas reserved for
   gigantic pages on 16K and 64K configurations.
 
 - Trivial typos, duplicate words.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE5RElWfyWxS+3PLO2a9axLQDIXvEFAl8oTcsACgkQa9axLQDI
 XvEj6hAAkn39mO5xrR/Vhpg3DyFPk63ZlMSX9SsOeVyaLbovT6stTs1XAZXPpnkt
 rV3gwACyGSrqH6+uey9pHgHJuPF2TdrGEVK08yVKo9KGW/6yXSIncdKFE4jUJ/WJ
 wF5j7eMET2aGzcpm5AlzMmq6HOrKB8nZac9H8/x6H+Ox2WdgJkEjOkDvyqACUyum
 N3FsTZkWj2pIkTXHNgDZ8KjxVLO8HlFaB2hkxFDl9NPlX2UTCQJ8Tg1KiPLafKaK
 gUvH4usQDFdb5RU/UWogre37J4emO0ZTApZOyju+U+PMMWlWVHjZ4isUIS9zz/AE
 JNZ23dnKZX2HrYa5p8HZx175zwj/vXUqUHCZPLvQXaAudCEhF8BVljPiG0e80FV5
 GHFUgUbylKspp01I/9L+2JvsG96Mr0e+P3Sx7L2HTI42cmtoSa14+MpoSRj7zlft
 Qcl8hfrVOjCjUnFRHa/1y1cGvnD9GbgnKJR7zgVxl9bD/Jd48r1HUtwRORZCzWFr
 mRPVbPS72fWxMzMV9DZYJm02jJY9kLX2BMl49njbB8MhAhzOvrMVzoVVtMMeRFLR
 XHeJpmg36W09FiRGe7LRXlkXIhCQzQG2bJfiphuupCfhjRAitPoq8I925G6Pig60
 c8RWaXGU7PrEsdMNrL83vekvGKgqrkoFkRVtsCoQ2X6Hvu/XdYI=
 =mh79
 -----END PGP SIGNATURE-----

Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux

Pull arm64 and cross-arch updates from Catalin Marinas:
 "Here's a slightly wider-spread set of updates for 5.9.

  Going outside the usual arch/arm64/ area is the removal of
  read_barrier_depends() series from Will and the MSI/IOMMU ID
  translation series from Lorenzo.

  The notable arm64 updates include ARMv8.4 TLBI range operations and
  translation level hint, time namespace support, and perf.

  Summary:

   - Removal of the tremendously unpopular read_barrier_depends()
     barrier, which is a NOP on all architectures apart from Alpha, in
     favour of allowing architectures to override READ_ONCE() and do
     whatever dance they need to do to ensure address dependencies
     provide LOAD -> LOAD/STORE ordering.

     This work also offers a potential solution if compilers are shown
     to convert LOAD -> LOAD address dependencies into control
     dependencies (e.g. under LTO), as weakly ordered architectures will
     effectively be able to upgrade READ_ONCE() to smp_load_acquire().
     The latter case is not used yet, but will be discussed further at
     LPC.

   - Make the MSI/IOMMU input/output ID translation PCI agnostic,
     augment the MSI/IOMMU ACPI/OF ID mapping APIs to accept an input ID
     bus-specific parameter and apply the resulting changes to the
     device ID space provided by the Freescale FSL bus.

   - arm64 support for TLBI range operations and translation table level
     hints (part of the ARMv8.4 architecture version).

   - Time namespace support for arm64.

   - Export the virtual and physical address sizes in vmcoreinfo for
     makedumpfile and crash utilities.

   - CPU feature handling cleanups and checks for programmer errors
     (overlapping bit-fields).

   - ACPI updates for arm64: disallow AML accesses to EFI code regions
     and kernel memory.

   - perf updates for arm64.

   - Miscellaneous fixes and cleanups, most notably PLT counting
     optimisation for module loading, recordmcount fix to ignore
     relocations other than R_AARCH64_CALL26, CMA areas reserved for
     gigantic pages on 16K and 64K configurations.

   - Trivial typos, duplicate words"

Link: http://lkml.kernel.org/r/20200710165203.31284-1-will@kernel.org
Link: http://lkml.kernel.org/r/20200619082013.13661-1-lorenzo.pieralisi@arm.com

* tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (82 commits)
  arm64: use IRQ_STACK_SIZE instead of THREAD_SIZE for irq stack
  arm64/mm: save memory access in check_and_switch_context() fast switch path
  arm64: sigcontext.h: delete duplicated word
  arm64: ptrace.h: delete duplicated word
  arm64: pgtable-hwdef.h: delete duplicated words
  bus: fsl-mc: Add ACPI support for fsl-mc
  bus/fsl-mc: Refactor the MSI domain creation in the DPRC driver
  of/irq: Make of_msi_map_rid() PCI bus agnostic
  of/irq: make of_msi_map_get_device_domain() bus agnostic
  dt-bindings: arm: fsl: Add msi-map device-tree binding for fsl-mc bus
  of/device: Add input id to of_dma_configure()
  of/iommu: Make of_map_rid() PCI agnostic
  ACPI/IORT: Add an input ID to acpi_dma_configure()
  ACPI/IORT: Remove useless PCI bus walk
  ACPI/IORT: Make iort_msi_map_rid() PCI agnostic
  ACPI/IORT: Make iort_get_device_domain IRQ domain agnostic
  ACPI/IORT: Make iort_match_node_callback walk the ACPI namespace for NC
  arm64: enable time namespace support
  arm64/vdso: Restrict splitting VVAR VMA
  arm64/vdso: Handle faults on timens page
  ...
2020-08-03 14:11:08 -07:00
Rafael J. Wysocki db1da2f52e Merge branches 'acpi-mm', 'acpi-tables', 'acpi-apei' and 'acpi-misc'
* acpi-mm:
  ACPI: OSL: Clean up the removal of unused memory mappings
  ACPI: OSL: Use deferred unmapping in acpi_os_unmap_iomem()
  ACPI: OSL: Use deferred unmapping in acpi_os_unmap_generic_address()
  ACPICA: Preserve memory opregion mappings
  ACPI: OSL: Implement deferred unmapping of ACPI memory

* acpi-tables:
  ACPI: NUMA: Remove the useless 'node >= MAX_NUMNODES' check
  ACPI: NUMA: Remove the useless sub table pointer check
  ACPI: tables: Remove the duplicated checks for acpi_parse_entries_array()
  ACPI: tables: avoid relocations for table signature array

* acpi-apei:
  ACPI: APEI: remove redundant assignment to variable rc

* acpi-misc:
  ACPI: Replace HTTP links with HTTPS ones
  ACPI: Use valid link to the ACPI specification
  ACPI: Use fallthrough pseudo-keyword
2020-08-03 13:14:42 +02:00
Lorenzo Pieralisi b8e069a2a8 ACPI/IORT: Add an input ID to acpi_dma_configure()
Some HW devices are created as child devices of proprietary busses,
that have a bus specific policy defining how the child devices
wires representing the devices ID are translated into IOMMU and
IRQ controllers device IDs.

Current IORT code provides translations for:

- PCI devices, where the device ID is well identified at bus level
  as the requester ID (RID)
- Platform devices that are endpoint devices where the device ID is
  retrieved from the ACPI object IORT mappings (Named components single
  mappings). A platform device is represented in IORT as a named
  component node

For devices that are child devices of proprietary busses the IORT
firmware represents the bus node as a named component node in IORT
and it is up to that named component node to define in/out bus
specific ID translations for the bus child devices that are
allocated and created in a bus specific manner.

In order to make IORT ID translations available for proprietary
bus child devices, the current ACPI (and IORT) code must be
augmented to provide an additional ID parameter to acpi_dma_configure()
representing the child devices input ID. This ID is bus specific
and it is retrieved in bus specific code.

By adding an ID parameter to acpi_dma_configure(), the IORT
code can map the child device ID to an IOMMU stream ID through
the IORT named component representing the bus in/out ID mappings.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Hanjun Guo <guohanjun@huawei.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Link: https://lore.kernel.org/r/20200619082013.13661-6-lorenzo.pieralisi@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2020-07-28 15:51:31 +01:00
Bob Moore 2861ba7a0c ACPICA: Update version to 20200717
ACPICA commit c1adb9a2a775df7a85df0103342ebf090e1b2016

Version 20200717.

Link: https://github.com/acpica/acpica/commit/c1adb9a2
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-07-27 14:55:42 +02:00
Gustavo A. R. Silva 10cfde5dc6 ACPICA: Replace one-element array with flexible-array
ACPICA commit 7ba2f3d91a32f104765961fda0ed78b884ae193d

The current codebase makes use of one-element arrays in the following
form:

struct something {
    int length;
    u8 data[1];
};

struct something *instance;

instance = kmalloc(sizeof(*instance) + size, GFP_KERNEL);
instance->length = size;
memcpy(instance->data, source, size);

but the preferred mechanism to declare variable-length types such as
these ones is a flexible array member[1][2], introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure,
which will help us prevent some kind of undefined behavior bugs from
being inadvertently introduced[3] to the linux codebase from now on.

This issue was found with the help of Coccinelle and audited _manually_.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 7649773293 ("cxgb3/l2t: Fix undefined behaviour")

Link: https://github.com/acpica/acpica/commit/7ba2f3d9
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-07-27 14:55:42 +02:00
Rafael J. Wysocki b8fcd0e588 ACPICA: Preserve memory opregion mappings
The ACPICA's strategy with respect to the handling of memory mappings
associated with memory operation regions is to avoid mapping the
entire region at once which may be problematic at least in principle
(for example, it may lead to conflicts with overlapping mappings
having different attributes created by drivers).  It may also be
wasteful, because memory opregions on some systems take up vast
chunks of address space while the fields in those regions actually
accessed by AML are sparsely distributed.

For this reason, a one-page "window" is mapped for a given opregion
on the first memory access through it and if that "window" does not
cover an address range accessed through that opregion subsequently,
it is unmapped and a new "window" is mapped to replace it.  Next,
if the new "window" is not sufficient to acess memory through the
opregion in question in the future, it will be replaced with yet
another "window" and so on.  That may lead to a suboptimal sequence
of memory mapping and unmapping operations, for example if two fields
in one opregion separated from each other by a sufficiently wide
chunk of unused address space are accessed in an alternating pattern.

The situation may still be suboptimal if the deferred unmapping
introduced previously is supported by the OS layer.  For instance,
the alternating memory access pattern mentioned above may produce
a relatively long list of mappings to release with substantial
duplication among the entries in it, which could be avoided if
acpi_ex_system_memory_space_handler() did not release the mapping
used by it previously as soon as the current access was not covered
by it.

In order to improve that, modify acpi_ex_system_memory_space_handler()
to preserve all of the memory mappings created by it until the memory
regions associated with them go away.

Accordingly, update acpi_ev_system_memory_region_setup() to unmap all
memory associated with memory opregions that go away.

Reported-by: Dan Williams <dan.j.williams@intel.com>
Tested-by: Xiang Li <xiang.z.li@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-07-27 12:29:02 +02:00
Stefan Berger 18306111e6 acpi: Extend TPM2 ACPI table with missing log fields
Recent extensions of the TPM2 ACPI table added 3 more fields
including 12 bytes of start method specific parameters and Log Area
Minimum Length (u32) and Log Area Start Address (u64). So, we define
a new structure acpi_tpm2_phy that holds these optional new fields.
The new fields allow non-UEFI systems to access the TPM2's log.

The specification that has the new fields is the following:
  TCG ACPI Specification
  Family "1.2" and "2.0"
  Version 1.2, Revision 8

https://trustedcomputinggroup.org/wp-content/uploads/TCG_ACPIGeneralSpecification_v1.20_r8.pdf

Cc: linux-acpi@vger.kernel.org
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
2020-07-24 09:29:21 +03:00
Rafael J. Wysocki ede439be68 Merge branch 'acpica'
* acpica:
  ACPICA: Update version to 20200528
  ACPICA: iASL: add new OperationRegion subtype keyword PlatformRtMechanism
  ACPICA: acpidump: Removed dead code from oslinuxtbl.c
2020-06-10 17:27:28 +02:00
Bob Moore 34a09bffd9 ACPICA: Update version to 20200528
ACPICA commit 30ceafb55b59724f73ae6f2b35523417c4e569ea

Version 20200528.

Link: https://github.com/acpica/acpica/commit/30ceafb5
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-06-05 13:34:23 +02:00
Erik Kaneda f083906fa9 ACPICA: iASL: add new OperationRegion subtype keyword PlatformRtMechanism
ACPICA commit 2c2eefa827bd37297f5f9ca4b263fcba829aaf3f

Link: https://github.com/acpica/acpica/commit/2c2eefa8
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-06-05 13:34:23 +02:00
Rafael J. Wysocki 48ccdeddc5 Merge branches 'acpi-apei', 'acpi-pmic', 'acpi-video' and 'acpi-dptf'
* acpi-apei:
  arm64: acpi: Make apei_claim_sea() synchronise with APEI's irq work
  ACPI: APEI: Kick the memory_failure() queue for synchronous errors
  mm/memory-failure: Add memory_failure_queue_kick()

* acpi-pmic:
  ACPI / PMIC: Add i2c address for thermal control

* acpi-video:
  ACPI: video: Use native backlight on Acer TravelMate 5735Z

* acpi-dptf:
  ACPI: DPTF: Add battery participant driver
  ACPI: DPTF: Additional sysfs attributes for power participant driver
2020-06-01 17:19:43 +02:00
Rafael J. Wysocki 228b79aa33 Merge branches 'acpi-processor', 'acpi-cppc', 'acpi-dbg', 'acpi-misc' and 'acpi-pci'
* acpi-processor:
  ACPI: processor: idle: Allow probing on platforms with one ACPI C-state

* acpi-cppc:
  ACPI: CPPC: Fix reference count leak in acpi_cppc_processor_probe()
  ACPI: CPPC: Make some symbols static

* acpi-dbg:
  ACPI: debug: Make two functions static

* acpi-misc:
  ACPI: GED: use correct trigger type field in _Exx / _Lxx handling
  ACPI: GED: add support for _Exx / _Lxx handler methods
  ACPI: Delete unused proc filename macros

* acpi-pci:
  ACPI: hotplug: PCI: Use the new acpi_evaluate_reg() helper
  ACPI: utils: Add acpi_evaluate_reg() helper
2020-06-01 17:19:06 +02:00
James Morse 7f17b4a121 ACPI: APEI: Kick the memory_failure() queue for synchronous errors
memory_failure() offlines or repairs pages of memory that have been
discovered to be corrupt. These may be detected by an external
component, (e.g. the memory controller), and notified via an IRQ.
In this case the work is queued as not all of memory_failure()s work
can happen in IRQ context.

If the error was detected as a result of user-space accessing a
corrupt memory location the CPU may take an abort instead. On arm64
this is a 'synchronous external abort', and on a firmware first
system it is replayed using NOTIFY_SEA.

This notification has NMI like properties, (it can interrupt
IRQ-masked code), so the memory_failure() work is queued. If we
return to user-space before the queued memory_failure() work is
processed, we will take the fault again. This loop may cause platform
firmware to exceed some threshold and reboot when Linux could have
recovered from this error.

For NMIlike notifications keep track of whether memory_failure() work
was queued, and make task_work pending to flush out the queue.
To save memory allocations, the task_work is allocated as part of
the ghes_estatus_node, and free()ing it back to the pool is deferred.

Signed-off-by: James Morse <james.morse@arm.com>
Tested-by: Tyler Baicar <baicar@os.amperecomputing.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-05-19 19:51:11 +02:00
Hans de Goede 132565d8ec ACPI: utils: Add acpi_evaluate_reg() helper
With a recent fix to the pinctrl-cherryview driver we now have
2 drivers open-coding the parameter building / passing for calling
_REG on an ACPI handle.

Add a helper for this, so that these 2 drivers can be converted to this
helper.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-05-09 11:40:25 +02:00
Bob Moore 2d2feb6813 ACPICA: Update version to 20200430
ACPICA commit c00a5cd99fa3fe6cd053a2a1a557e54b4fea26f7

Version 20200430.

Link: https://github.com/acpica/acpica/commit/c00a5cd9
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-05-09 10:55:54 +02:00
Linus Torvalds 7e63420847 Additional ACPI updates for 5.7-rc1
- Update the ACPICA code in the kernel to upstream revision 20200326
    including:
 
    * Fix for a typo in a comment field (Bob Moore).
    * acpiExec namespace init file fixes (Bob Moore).
    * Addition of NHLT to the known tables list (Cezary Rojewski).
    * Conversion of PlatformCommChannel ASL keyword to PCC (Erik
      Kaneda).
    * acpiexec cleanup (Erik Kaneda).
    * WSMT-related typo fix (Erik Kaneda).
    * sprintf() utility function fix (John Levon).
    * IVRS IVHD type 11h parsing implementation (Michał Żygowski).
    * IVRS IVHD type 10h reserved field name fix (Michał Żygowski).
 
  - Fix ACPI-related CPU hotplug deadlock on x86 (Qian Cai).
 
  - Fix Intel Tiger Lake ACPI device IDs in several places (Gayatri
    Kammela).
 
  - Add ACPI backlight blacklist entry for Acer Aspire 5783z (Hans
    de Goede).
 
  - Fix documentation of the "acpi_backlight" kernel command line
    switch (Randy Dunlap).
 
  - Clean up the acpi_get_psd_map() CPPC library routine (Liguang
    Zhang).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAl6LQEASHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRxqfoQAI/GPq7xhb8jOofmTfLxa4ahO2NDxK1E
 Ye4Tcm8JLv78hro7iMUlbPsRXm15lyDxMldGRfxsiLFTF2xQtYhdTnPx+KZ439j+
 QokMHUT6gFEMAV7OPFvXd2r58ShJJHezobbn241zTILx1c3ai66dCQrqyhYjlZ28
 0hUCyY4ilgXWuYInlckGW3Rp/Qxc9IVOxzFUV90EW9pTb4vKzoqznjNm+dpY8rHm
 QFNb2BkTJygOPmJiumi/yJX+74YSZrzW5fS1PDQS4Lr46j0imvWVVataMd1qbQ0+
 fDhvhL7IimHiM/qZg67hKpsAt6AcQPhaZ6JyoEGUoafxpBQN0a7b5rMwmL0P/HWV
 pL5mKM+jc7zh0HTb+xkpNotJxT+KBFo1jTRxGyVAnK8SThzlyFhKhetiOwaHCIDv
 dNYao6bCNsuGLh3T/09xbAmEeCSt7k+ok892N4o9wzqNfoDg6fX/c0M5ZD1F+Awb
 l9agU7XChziyDJwAqTbqndx71DK4ALrhZa1tNKA5PGTY8b5XrojoKsOyYk6PYA1x
 CqU20muRV4VAzB0pvdiwBc2Yrtfiv32mv5jMNrqrrv3D6S6R8vBUNhHlWKu/75a9
 9muIoEHWnK0/a9kmVJG8CUSXTTTPQpvOovesznruTxvGx3Mp9gw+d3/1tjuA/QNM
 ZoOOru5AEyi+
 =b3Dp
 -----END PGP SIGNATURE-----

Merge tag 'acpi-5.7-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull more ACPI updates from Rafael Wysocki:
 "Additional ACPI updates.

  These update the ACPICA code in the kernel to the 20200326 upstream
  revision, fix an ACPI-related CPU hotplug deadlock on x86, update
  Intel Tiger Lake device IDs in some places, add a new ACPI backlight
  blacklist entry, update the "acpi_backlight" kernel command line
  switch documentation and clean up a CPPC library routine.

  Specifics:

   - Update the ACPICA code in the kernel to upstream revision 20200326
     including:
      * Fix for a typo in a comment field (Bob Moore)
      * acpiExec namespace init file fixes (Bob Moore)
      * Addition of NHLT to the known tables list (Cezary Rojewski)
      * Conversion of PlatformCommChannel ASL keyword to PCC (Erik
        Kaneda)
      * acpiexec cleanup (Erik Kaneda)
      * WSMT-related typo fix (Erik Kaneda)
      * sprintf() utility function fix (John Levon)
      * IVRS IVHD type 11h parsing implementation (Michał Żygowski)
      * IVRS IVHD type 10h reserved field name fix (Michał Żygowski)

   - Fix ACPI-related CPU hotplug deadlock on x86 (Qian Cai)

   - Fix Intel Tiger Lake ACPI device IDs in several places (Gayatri
     Kammela)

   - Add ACPI backlight blacklist entry for Acer Aspire 5783z (Hans de
     Goede)

   - Fix documentation of the "acpi_backlight" kernel command line
     switch (Randy Dunlap)

   - Clean up the acpi_get_psd_map() CPPC library routine (Liguang
     Zhang)"

* tag 'acpi-5.7-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  x86: ACPI: fix CPU hotplug deadlock
  thermal: int340x_thermal: fix: Update Tiger Lake ACPI device IDs
  platform/x86: intel-hid: fix: Update Tiger Lake ACPI device ID
  ACPI: Update Tiger Lake ACPI device IDs
  ACPI: video: Use native backlight on Acer Aspire 5783z
  ACPI: video: Docs update for "acpi_backlight" kernel parameter options
  ACPICA: Update version 20200326
  ACPICA: Fixes for acpiExec namespace init file
  ACPICA: Add NHLT table signature
  ACPICA: WSMT: Fix typo, no functional change
  ACPICA: utilities: fix sprintf()
  ACPICA: acpiexec: remove redeclaration of acpi_gbl_db_opt_no_region_support
  ACPICA: Change PlatformCommChannel ASL keyword to PCC
  ACPICA: Fix IVRS IVHD type 10h reserved field name
  ACPICA: Implement IVRS IVHD type 11h parsing
  ACPICA: Fix a typo in a comment field
  ACPI: CPPC: clean up acpi_get_psd_map()
2020-04-06 10:35:06 -07:00
Rafael J. Wysocki fd0360583a Merge branch 'acpica'
* acpica:
  ACPICA: Update version 20200326
  ACPICA: Fixes for acpiExec namespace init file
  ACPICA: Add NHLT table signature
  ACPICA: WSMT: Fix typo, no functional change
  ACPICA: utilities: fix sprintf()
  ACPICA: acpiexec: remove redeclaration of acpi_gbl_db_opt_no_region_support
  ACPICA: Change PlatformCommChannel ASL keyword to PCC
  ACPICA: Fix IVRS IVHD type 10h reserved field name
  ACPICA: Implement IVRS IVHD type 11h parsing
  ACPICA: Fix a typo in a comment field
2020-04-06 16:23:31 +02:00
Qian Cai 696ac2e3bf x86: ACPI: fix CPU hotplug deadlock
Similar to commit 0266d81e9b ("acpi/processor: Prevent cpu hotplug
deadlock") except this is for acpi_processor_ffh_cstate_probe():

"The problem is that the work is scheduled on the current CPU from the
hotplug thread associated with that CPU.

It's not required to invoke these functions via the workqueue because
the hotplug thread runs on the target CPU already.

Check whether current is a per cpu thread pinned on the target CPU and
invoke the function directly to avoid the workqueue."

 WARNING: possible circular locking dependency detected
 ------------------------------------------------------
 cpuhp/1/15 is trying to acquire lock:
 ffffc90003447a28 ((work_completion)(&wfc.work)){+.+.}-{0:0}, at: __flush_work+0x4c6/0x630

 but task is already holding lock:
 ffffffffafa1c0e8 (cpuidle_lock){+.+.}-{3:3}, at: cpuidle_pause_and_lock+0x17/0x20

 which lock already depends on the new lock.

 the existing dependency chain (in reverse order) is:

 -> #1 (cpu_hotplug_lock){++++}-{0:0}:
 cpus_read_lock+0x3e/0xc0
 irq_calc_affinity_vectors+0x5f/0x91
 __pci_enable_msix_range+0x10f/0x9a0
 pci_alloc_irq_vectors_affinity+0x13e/0x1f0
 pci_alloc_irq_vectors_affinity at drivers/pci/msi.c:1208
 pqi_ctrl_init+0x72f/0x1618 [smartpqi]
 pqi_pci_probe.cold.63+0x882/0x892 [smartpqi]
 local_pci_probe+0x7a/0xc0
 work_for_cpu_fn+0x2e/0x50
 process_one_work+0x57e/0xb90
 worker_thread+0x363/0x5b0
 kthread+0x1f4/0x220
 ret_from_fork+0x27/0x50

 -> #0 ((work_completion)(&wfc.work)){+.+.}-{0:0}:
 __lock_acquire+0x2244/0x32a0
 lock_acquire+0x1a2/0x680
 __flush_work+0x4e6/0x630
 work_on_cpu+0x114/0x160
 acpi_processor_ffh_cstate_probe+0x129/0x250
 acpi_processor_evaluate_cst+0x4c8/0x580
 acpi_processor_get_power_info+0x86/0x740
 acpi_processor_hotplug+0xc3/0x140
 acpi_soft_cpu_online+0x102/0x1d0
 cpuhp_invoke_callback+0x197/0x1120
 cpuhp_thread_fun+0x252/0x2f0
 smpboot_thread_fn+0x255/0x440
 kthread+0x1f4/0x220
 ret_from_fork+0x27/0x50

 other info that might help us debug this:

 Chain exists of:
 (work_completion)(&wfc.work) --> cpuhp_state-up --> cpuidle_lock

 Possible unsafe locking scenario:

 CPU0                    CPU1
 ----                    ----
 lock(cpuidle_lock);
                         lock(cpuhp_state-up);
                         lock(cpuidle_lock);
 lock((work_completion)(&wfc.work));

 *** DEADLOCK ***

 3 locks held by cpuhp/1/15:
 #0: ffffffffaf51ab10 (cpu_hotplug_lock){++++}-{0:0}, at: cpuhp_thread_fun+0x69/0x2f0
 #1: ffffffffaf51ad40 (cpuhp_state-up){+.+.}-{0:0}, at: cpuhp_thread_fun+0x69/0x2f0
 #2: ffffffffafa1c0e8 (cpuidle_lock){+.+.}-{3:3}, at: cpuidle_pause_and_lock+0x17/0x20

 Call Trace:
 dump_stack+0xa0/0xea
 print_circular_bug.cold.52+0x147/0x14c
 check_noncircular+0x295/0x2d0
 __lock_acquire+0x2244/0x32a0
 lock_acquire+0x1a2/0x680
 __flush_work+0x4e6/0x630
 work_on_cpu+0x114/0x160
 acpi_processor_ffh_cstate_probe+0x129/0x250
 acpi_processor_evaluate_cst+0x4c8/0x580
 acpi_processor_get_power_info+0x86/0x740
 acpi_processor_hotplug+0xc3/0x140
 acpi_soft_cpu_online+0x102/0x1d0
 cpuhp_invoke_callback+0x197/0x1120
 cpuhp_thread_fun+0x252/0x2f0
 smpboot_thread_fn+0x255/0x440
 kthread+0x1f4/0x220
 ret_from_fork+0x27/0x50

Signed-off-by: Qian Cai <cai@lca.pw>
Tested-by: Borislav Petkov <bp@suse.de>
[ rjw: Subject ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-04-04 16:28:24 +02:00
Linus Torvalds 4b9fd8a829 Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull locking updates from Ingo Molnar:
 "The main changes in this cycle were:

   - Continued user-access cleanups in the futex code.

   - percpu-rwsem rewrite that uses its own waitqueue and atomic_t
     instead of an embedded rwsem. This addresses a couple of
     weaknesses, but the primary motivation was complications on the -rt
     kernel.

   - Introduce raw lock nesting detection on lockdep
     (CONFIG_PROVE_RAW_LOCK_NESTING=y), document the raw_lock vs. normal
     lock differences. This too originates from -rt.

   - Reuse lockdep zapped chain_hlocks entries, to conserve RAM
     footprint on distro-ish kernels running into the "BUG:
     MAX_LOCKDEP_CHAIN_HLOCKS too low!" depletion of the lockdep
     chain-entries pool.

   - Misc cleanups, smaller fixes and enhancements - see the changelog
     for details"

* 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (55 commits)
  fs/buffer: Make BH_Uptodate_Lock bit_spin_lock a regular spinlock_t
  thermal/x86_pkg_temp: Make pkg_temp_lock a raw_spinlock_t
  Documentation/locking/locktypes: Minor copy editor fixes
  Documentation/locking/locktypes: Further clarifications and wordsmithing
  m68knommu: Remove mm.h include from uaccess_no.h
  x86: get rid of user_atomic_cmpxchg_inatomic()
  generic arch_futex_atomic_op_inuser() doesn't need access_ok()
  x86: don't reload after cmpxchg in unsafe_atomic_op2() loop
  x86: convert arch_futex_atomic_op_inuser() to user_access_begin/user_access_end()
  objtool: whitelist __sanitizer_cov_trace_switch()
  [parisc, s390, sparc64] no need for access_ok() in futex handling
  sh: no need of access_ok() in arch_futex_atomic_op_inuser()
  futex: arch_futex_atomic_op_inuser() calling conventions change
  completion: Use lockdep_assert_RT_in_threaded_ctx() in complete_all()
  lockdep: Add posixtimer context tracing bits
  lockdep: Annotate irq_work
  lockdep: Add hrtimer context tracing bits
  lockdep: Introduce wait-type checks
  completion: Use simple wait queues
  sched/swait: Prepare usage in completions
  ...
2020-03-30 16:17:15 -07:00
Linus Torvalds 6d90508121 ACPI updates for 5.7-rc1
- Update the ACPICA code in the kernel to the 20200214 upstream
    release including:
 
    * Fix to re-enable the sleep button after wakeup (Anchal Agarwal).
    * Fixes for mistakes in comments and typos (Bob Moore).
    * ASL-ASL+ converter updates (Erik Kaneda).
    * Type casting cleanups (Sven Barth).
 
  - Clean up the intialization of the EC driver and eliminate some
    dead code from it (Rafael Wysocki).
 
  - Clean up the quirk tables in the AC and battery drivers (Hans de
    Goede).
 
  - Fix the global lock handling on x86 to ignore unspecified bit
    positions in the global lock field (Jan Engelhardt).
 
  - Add a new "tiny" driver for ACPI button devices exposed by VMs to
    guest kernels to send signals directly to init (Josh Triplett).
 
  - Add a kernel parameter to disable ACPI BGRT on x86 (Alex Hung).
 
  - Make the ACPI PCI host bridge and fan drivers use scnprintf() to
    avoid potential buffer overflows (Takashi Iwai).
 
  - Clean up assorted pieces of code:
 
    * Reorder "asmlinkage" to make g++ happy (Alexey Dobriyan).
    * Drop unneeded variable initialization (Colin Ian King).
    * Add missing __acquires/__releases annotations (Jules Irenge).
    * Replace list_for_each_safe() with list_for_each_entry_safe()
      (chenqiwu).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAl6CCQASHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRx15UQAISSZxFTq6huh9c3r0xEgddamhn7VOX+
 phjRuTmPzRn2RqFt7Q/ypiy5qqRgBko7oR0UyMJeHc7YPYcJ2nrRx/6Ymg46nmac
 mdIwTG3y1bH6cD/Fz8cM+9ZCtQl8iZRf36zvlY/8fNpk+Cj98et+x+wbUN8GMO9F
 9anHpPKk7hHCwxSN/SnyrJGJpjKdW057sv9sYwgR65XnM35dGxExQNjqtQVFk/ih
 N7TKVHUAlEE06liS0QYCeugsZsu5/GviU/1uy3qwg+Fxcxw7muHfG/impZwFhdjn
 QrdnFOGz9lFXzY+ynQplW0tJtt1AvOLJzQtzGVOxurTJIgz1pEJnptvDXFWP2YBX
 aESfuFt47bzi/NT1f31L3YQ3vuOJczwkS/QlDxv4TJh6rFdZFnQQNo+iIxBAlB6n
 xSsADFbZ3OaAU2VcjVn6WSL7iD3znnIBZp/xQIybb+9BUoDhSXCTH7rNT7p025cR
 g4KGAevlNDEVKIsZs3UHRQYpFQ+qHDM3WNiAiIEyF9cdenSXEMKrBnEYKSbV7DnI
 rBYexFTvjAyVEb6qnuaQDwHHKhu5Xc0JebIXeTjByg993Y8SFLll7a5d40H71S6Z
 /nG4mOa8+Qt6MqhwvkXLu/cxrXgNmnCG8W9RH0/2sQs25AMys9SESo1jsvEeCS2o
 tC2xCpKl2TlU
 =kQmH
 -----END PGP SIGNATURE-----

Merge tag 'acpi-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI updates from Rafael Wysocki:

   - Update the ACPICA code in the kernel to the 20200214 upstream
     release including:

       * Fix to re-enable the sleep button after wakeup (Anchal
         Agarwal).

       * Fixes for mistakes in comments and typos (Bob Moore).

       * ASL-ASL+ converter updates (Erik Kaneda).

       * Type casting cleanups (Sven Barth).

   - Clean up the intialization of the EC driver and eliminate some dead
     code from it (Rafael Wysocki).

   - Clean up the quirk tables in the AC and battery drivers (Hans de
     Goede).

   - Fix the global lock handling on x86 to ignore unspecified bit
     positions in the global lock field (Jan Engelhardt).

   - Add a new "tiny" driver for ACPI button devices exposed by VMs to
     guest kernels to send signals directly to init (Josh Triplett).

   - Add a kernel parameter to disable ACPI BGRT on x86 (Alex Hung).

   - Make the ACPI PCI host bridge and fan drivers use scnprintf() to
     avoid potential buffer overflows (Takashi Iwai).

   - Clean up assorted pieces of code:

       * Reorder "asmlinkage" to make g++ happy (Alexey Dobriyan).

       * Drop unneeded variable initialization (Colin Ian King).

       * Add missing __acquires/__releases annotations (Jules Irenge).

       * Replace list_for_each_safe() with list_for_each_entry_safe()
         (chenqiwu)"

* tag 'acpi-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (31 commits)
  ACPICA: Update version to 20200214
  ACPI: PCI: Use scnprintf() for avoiding potential buffer overflow
  ACPI: fan: Use scnprintf() for avoiding potential buffer overflow
  ACPI: EC: Eliminate EC_FLAGS_QUERY_HANDSHAKE
  ACPI: EC: Do not clear boot_ec_is_ecdt in acpi_ec_add()
  ACPI: EC: Simplify acpi_ec_ecdt_start() and acpi_ec_init()
  ACPI: EC: Consolidate event handler installation code
  acpi/x86: ignore unspecified bit positions in the ACPI global lock field
  acpi/x86: add a kernel parameter to disable ACPI BGRT
  x86/acpi: make "asmlinkage" part first thing in the function definition
  ACPI: list_for_each_safe() -> list_for_each_entry_safe()
  ACPI: video: remove redundant assignments to variable result
  ACPI: OSL: Add missing __acquires/__releases annotations
  ACPI / battery: Cleanup Lenovo Ideapad Miix 320 DMI table entry
  ACPI / AC: Cleanup DMI quirk table
  ACPI: EC: Use fast path in acpi_ec_add() for DSDT boot EC
  ACPI: EC: Simplify acpi_ec_add()
  ACPI: EC: Drop AE_NOT_FOUND special case from ec_install_handlers()
  ACPI: EC: Avoid passing redundant argument to functions
  ACPI: EC: Avoid printing confusing messages in acpi_ec_setup()
  ...
2020-03-30 15:17:04 -07:00
Rafael J. Wysocki f94a57a189 Merge branches 'acpi-button', 'acpi-battery', 'acpi-osl', 'acpi-video' and 'acpi-misc'
* acpi-button:
  ACPI: Add new tiny-power-button driver to directly signal init
  ACPI: button: move HIDs to acpi/button.h

* acpi-battery:
  ACPI / battery: Cleanup Lenovo Ideapad Miix 320 DMI table entry
  ACPI / AC: Cleanup DMI quirk table

* acpi-osl:
  ACPI: OSL: Add missing __acquires/__releases annotations

* acpi-video:
  ACPI: video: remove redundant assignments to variable result

* acpi-misc:
  ACPI: list_for_each_safe() -> list_for_each_entry_safe()
2020-03-30 14:54:01 +02:00
Rafael J. Wysocki 6d582d7e31 Merge branch 'acpica'
* acpica:
  ACPICA: Update version to 20200214
  ACPICA: Fix a couple of typos
  ACPICA: use acpi_size instead of u32 for prefix_path_length
  ACPICA: cast length arguement to acpi_ns_build_normalized_path() as u32
  ACPICA: cast the result of the pointer difference to u32
  ACPICA: Table Manager: Update comments in a function header
  ACPICA: Enable sleep button on ACPI legacy wake
  ACPICA: Fix a comment "enable" fixed events -> "disable" all fixed events.
  ACPICA: ASL-ASL+ converter: make root file a parameter for cv_init_file_tree
  ACPICA: ASL-ASL+ converter: remove function parameters from cv_init_file_tree()
2020-03-30 14:53:36 +02:00
Bob Moore 6461e59cc2 ACPICA: Update version 20200326
ACPICA commit 994fe943d93fe18eaaed1b6cd725023399f8a5c6

Version 20200326.

Link: https://github.com/acpica/acpica/commit/994fe943
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-03-30 14:52:33 +02:00
Cezary Rojewski 88055d8f4a ACPICA: Add NHLT table signature
ACPICA commit 422166b656565d180bb3aac712009bdce5e70cdd

NHLT (Non-HDAudio Link Table) provides configuration of audio
endpoints for Intel SST (Smart Sound Technology) DSP products.
Similarly to other ACPI tables, data provided by BIOS may not
describe it correctly, thus overriding is required.

ACPI override mechanism checks for unknown signature before
proceeding. Update known signatures array to support NHLT.

Link: https://github.com/acpica/acpica/commit/422166b6
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-03-30 14:52:33 +02:00
Erik Kaneda afb908708b ACPICA: WSMT: Fix typo, no functional change
ACPICA commit 764d18c5a83949ff3b0dbda6055cee1929b9caa2

The table signature WSMT stands for "Windows SMM Mitigations Table".
It is not "Windows SMM Migrations Table".

Link: https://github.com/acpica/acpica/commit/764d18c5
Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-03-30 14:52:33 +02:00
Michał Żygowski 0dc7e79520 ACPICA: Fix IVRS IVHD type 10h reserved field name
ACPICA commit 87a1ab2b2a63e28776261c48bdbae345f790d05d

According to AMD IOMMU Specification Revision 3.05 the reserved field
should be IOMMU Feature Reporting. Change the name of the field to the
correct one.

Link: https://github.com/acpica/acpica/commit/87a1ab2b
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-03-30 14:52:32 +02:00
Michał Żygowski 1f6239ca16 ACPICA: Implement IVRS IVHD type 11h parsing
ACPICA commit 6ddc19419896e4149ced1b5f35f0dc12516c0399

The AMD IVRS table parsing supported only IVHD type 10h structures.
Parsing an IVHD type 11h caused the iasl to report unknown subtable type.
Add necessary structure definition for IVHD type 11h and apply correct
parsing method based on subtable type.

Link: https://github.com/acpica/acpica/commit/6ddc1941
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-03-30 14:52:32 +02:00
Bob Moore 1c040f3a6a ACPICA: Fix a typo in a comment field
ACPICA commit f3504c591c8766c70402dcc786391ff6748b515a

Link: https://github.com/acpica/acpica/commit/f3504c59
Reported-by: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-03-30 14:52:32 +02:00
Bob Moore c7be17a6b4 ACPICA: Update version to 20200214
ACPICA commit ac0c1b8a43a317702bb11e11fd5067a1c59e3002

Version 20200214

Link: https://github.com/acpica/acpica/commit/ac0c1b8a
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-03-30 14:51:50 +02:00
Rafael J. Wysocki 0ce792d660 ACPICA: Allow acpi_any_gpe_status_set() to skip one GPE
The check carried out by acpi_any_gpe_status_set() is not precise enough
for the suspend-to-idle implementation in Linux and in some cases it is
necessary make it skip one GPE (specifically, the EC GPE) from the check
to prevent a race condition leading to a premature system resume from
occurring.

For this reason, redefine acpi_any_gpe_status_set() to take the number
of a GPE to skip as an argument.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=206629
Tested-by: Ondřej Caletka <ondrej@caletka.cz>
Cc: 5.4+ <stable@vger.kernel.org> # 5.4+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-03-25 12:57:27 +01:00
Peter Zijlstra df23e2be3d acpi: Remove header dependency
In order to avoid future header hell, remove the inclusion of
proc_fs.h from acpi_bus.h. All it needs is a forward declaration of a
struct.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lkml.kernel.org/r/20200321113241.246190285@linutronix.de
2020-03-21 16:00:21 +01:00
Linus Torvalds c60c040213 ACPI fixes for 5.6-rc4
Fix a couple of configuration issues in the ACPI watchdog (WDAT)
 driver (Mika Westerberg) and make it possible to disable that
 driver at boot time in case it still does not work as
 expected (Jean Delvare).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAl5Y6UYSHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRxj7YP/1qVMcIJo3CcItiQVV7+2S+WS+kK+Rf8
 t6g+8F5KL0DBrDqji7l19kv0O+kPpn2uGnREcNk3T3mHEu0jSywghvBI+nzrym2P
 Q+p2+2Fryy5zgiNTyhq7imA3IH4Zw5CVt6GRJjITvzFwhMGM38NQsDUbZEpZtJrz
 HTVQyqPgmhvox5sa2Qk1+vZOtclWlkPenWmtJEs8m+Pg8w+Ejfs4Lj+CQYlI5RB8
 GGhTgBiBMS7A80yTVxl8LULsrini6PWAGGY2yMScwDUYNZTAUuT8QSUx4/QBmyyP
 U5K1sIK2pd/JuE2QqSBztrYC7x1fpfoBJylF8B0HK5uNBpZth7eXhe6t+xDYVTpw
 U31unYfmcx6UT47lF/yWWNuhP6EDvdvZ0Xx4DHlgBJqKNuyfhz4Uazsr7HyLi2sI
 /YrBPimtgvICFHYorrNVwEheTUEp+QXtNZp6aTugLGVX6zbQ3nZp7ajifNO7hdsQ
 K+IjjRgH/YsVi9GQY/U3A/zTO+39fSupQgKiH33pG8Yp5bZbreoo1kPKzlnt23JJ
 DXuaN7wH74sgT2EqZm30lFapF/0wv+iIpdWmorlE/4WwTwIeDck/ULeBiGFqpUI6
 9Di10O6w+TJ+VevyJ5Hqkzukjlj93Vq+kCY8eOiWVpTga2ieQiYKFSbxDPE3OC1k
 j2wkDwKqkh0o
 =eIlw
 -----END PGP SIGNATURE-----

Merge tag 'acpi-5.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI fixes from Rafael Wysocki:
 "Fix a couple of configuration issues in the ACPI watchdog (WDAT)
  driver (Mika Westerberg) and make it possible to disable that driver
  at boot time in case it still does not work as expected (Jean
  Delvare)"

* tag 'acpi-5.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI: watchdog: Set default timeout in probe
  ACPI: watchdog: Fix gas->access_width usage
  ACPICA: Introduce ACPI_ACCESS_BYTE_WIDTH() macro
  ACPI: watchdog: Allow disabling WDAT at boot
2020-02-28 09:02:18 -08:00
Rafael J. Wysocki 63fb962342 ACPI: PM: s2idle: Check fixed wakeup events in acpi_s2idle_wake()
Commit fdde0ff859 ("ACPI: PM: s2idle: Prevent spurious SCIs from
waking up the system") overlooked the fact that fixed events can wake
up the system too and broke RTC wakeup from suspend-to-idle as a
result.

Fix this issue by checking the fixed events in acpi_s2idle_wake() in
addition to checking wakeup GPEs and break out of the suspend-to-idle
loop if the status bits of any enabled fixed events are set then.

Fixes: fdde0ff859 ("ACPI: PM: s2idle: Prevent spurious SCIs from waking up the system")
Reported-and-tested-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: 5.4+ <stable@vger.kernel.org> # 5.4+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-02-21 10:01:25 -08:00
Bob Moore 54a2a15a56 ACPICA: Fix a couple of typos
Squashed ACPICA commit e93a53d4d312a83a3ec72aa9cfb12d781b4fefca
and df52c574572344cd9095b66a0f580d51249deb2a

Submitted by: ehaouas@noos.fr

Link: https://github.com/acpica/acpica/commit/e93a53d4
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-02-16 10:19:53 +01:00
Mika Westerberg 1dade3a704 ACPICA: Introduce ACPI_ACCESS_BYTE_WIDTH() macro
Sometimes it is useful to find the access_width field value in bytes and
not in bits so add a helper that can be used for this purpose.

Suggested-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Cc: 4.16+ <stable@vger.kernel.org> # 4.16+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-02-13 23:51:30 +01:00
Josh Triplett ac1cc6b485 ACPI: button: move HIDs to acpi/button.h
This makes it possible to use ACPI_BUTTON_HID_POWER in another driver.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-02-13 23:36:23 +01:00
Rafael J. Wysocki ea128834dd ACPICA: Introduce acpi_any_gpe_status_set()
Introduce a new helper function, acpi_any_gpe_status_set(), for
checking the status bits of all enabled GPEs in one go.

It is needed to distinguish spurious SCIs from genuine ones when
deciding whether or not to wake up the system from suspend-to-idle.

Cc: 5.4+ <stable@vger.kernel.org> # 5.4+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-02-11 23:26:15 +01:00
Bob Moore be91c44288 ACPICA: Update version to 20200110
ACPICA commit f78d50aacc2a1c6dfa59052a696a54cec16e6aab

Version 20200110.

Link: https://github.com/acpica/acpica/commit/f78d50aa
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-01-13 11:52:48 +01:00
Bob Moore 800ba7c5ea ACPICA: All acpica: Update copyrights to 2020 Including tool signons.
ACPICA commit 8b9c69d0984067051ffbe8526f871448ead6a26b

Link: https://github.com/acpica/acpica/commit/8b9c69d0
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-01-13 11:52:48 +01:00
Bob Moore ae6252d8df ACPICA: Update version to 20191213
ACPICA commit 0b61217c5c706b39070bb6b4b154435e9ef36c3e

Version 20191213.

Link: https://github.com/acpica/acpica/commit/0b61217c
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-12-19 23:04:22 +01:00
Erik Kaneda 69e86e59ad ACPICA: acpisrc: add unix line ending support for non-windows build
ACPICA commit 48ef9f7456f0a73d1d6023ea8e79442cdcff757f

Link: https://github.com/acpica/acpica/commit/48ef9f74
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-12-19 23:04:21 +01:00
Rafael J. Wysocki 995e2ef082 Merge branches 'acpi-utils', 'acpi-platform', 'acpi-video' and 'acpi-doc'
* acpi-utils:
  iommu/amd: Switch to use acpi_dev_hid_uid_match()
  mmc: sdhci-acpi: Switch to use acpi_dev_hid_uid_match()
  ACPI / LPSS: Switch to use acpi_dev_hid_uid_match()
  ACPI / utils: Introduce acpi_dev_hid_uid_match() helper
  ACPI / utils: Move acpi_dev_get_first_match_dev() under CONFIG_ACPI
  ACPI / utils: Describe function parameters in kernel-doc

* acpi-platform:
  ACPI: platform: Unregister stale platform devices
  ACPI: Always build evged in

* acpi-video:
  ACPI: video: update doc for acpi_video_bus_DOS()

* acpi-doc:
  ACPI: Documentation: Minor spelling fix in namespace.rst
2019-11-26 10:30:49 +01:00
Rafael J. Wysocki 1fca7e0e6f Merge branches 'acpi-ec', 'acpi-soc', 'acpi-pmic' and 'acpi-button'
* acpi-ec:
  ACPI: EC: add support for hardware-reduced systems
  ACPI: EC: tweak naming in preparation for GpioInt support

* acpi-soc:
  ACPI: LPSS: Add dmi quirk for skipping _DEP check for some device-links
  ACPI: LPSS: Add LNXVIDEO -> BYT I2C1 to lpss_device_links
  ACPI: LPSS: Add LNXVIDEO -> BYT I2C7 to lpss_device_links

* acpi-pmic:
  ACPI / PMIC: Add Cherry Trail Crystal Cove PMIC OpRegion driver
  ACPI / PMIC: Add byt prefix to Crystal Cove PMIC OpRegion driver
  ACPI / PMIC: Do not register handlers for unhandled OpRegions

* acpi-button:
  ACPI: button: Remove unused acpi_lid_notifier_[un]register() functions
  ACPI: button: Add DMI quirk for Asus T200TA
  ACPI: button: Add DMI quirk for Medion Akoya E2215T
  ACPI: button: Turn lid_blacklst DMI table into a generic quirk table
  ACPI: button: Allow disabling LID support with the lid_init_state module option
  ACPI: button: Refactor lid_init_state module parsing code
2019-11-26 10:30:12 +01:00
Bob Moore c7ccf10bb9 ACPICA: Update version to 20191018
ACPICA commit 3d70fd4894824ed1e685f2d059ca22ccd9ac6163

Version 20191018.

Link: https://github.com/acpica/acpica/commit/3d70fd48
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-10-28 22:12:46 +01:00
Nikolaus Voss 1770093c5b ACPICA: make acpi_load_table() return table index
ACPICA commit d1716a829d19be23277d9157c575a03b9abb7457

For unloading an ACPI table, it is necessary to provide the index of
the table. The method intended for dynamically loading or hotplug
addition of tables, acpi_load_table(), should provide this information
via an optional pointer to the loaded table index.

This patch fixes the table unload function of acpi_configfs.

Reported-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Fixes: d06c47e3dd ("ACPI: configfs: Resolve objects on host-directed table loads")
Link: https://github.com/acpica/acpica/commit/d1716a82
Signed-off-by: Nikolaus Voss <nikolaus.voss@loewensteinmedical.de>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Tested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-10-28 22:12:46 +01:00
Bob Moore 42d939fadb ACPICA: Add new external interface, acpi_unload_table()
ACPICA commit c69369cd9cf0134e1aac516e97d612947daa8dc2

Unload a table via the table_index.

Link: https://github.com/acpica/acpica/commit/c69369cd
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-10-28 22:12:46 +01:00
Hans de Goede e346d0cf2c ACPI: button: Remove unused acpi_lid_notifier_[un]register() functions
There are no users of the acpi_lid_notifier_[un]register functions,
so lets remove them.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-10-28 15:40:26 +01:00
Rafael J. Wysocki 3000ce3c52 cpufreq: Use per-policy frequency QoS
Replace the CPU device PM QoS used for the management of min and max
frequency constraints in cpufreq (and its users) with per-policy
frequency QoS to avoid problems with cpufreq policies covering
more then one CPU.

Namely, a cpufreq driver is registered with the subsys interface
which calls cpufreq_add_dev() for each CPU, starting from CPU0, so
currently the PM QoS notifiers are added to the first CPU in the
policy (i.e. CPU0 in the majority of cases).

In turn, when the cpufreq driver is unregistered, the subsys interface
doing that calls cpufreq_remove_dev() for each CPU, starting from CPU0,
and the PM QoS notifiers are only removed when cpufreq_remove_dev() is
called for the last CPU in the policy, say CPUx, which as a rule is
not CPU0 if the policy covers more than one CPU.  Then, the PM QoS
notifiers cannot be removed, because CPUx does not have them, and
they are still there in the device PM QoS notifiers list of CPU0,
which prevents new PM QoS notifiers from being registered for CPU0
on the next attempt to register the cpufreq driver.

The same issue occurs when the first CPU in the policy goes offline
before unregistering the driver.

After this change it does not matter which CPU is the policy CPU at
the driver registration time and whether or not it is online all the
time, because the frequency QoS is per policy and not per CPU.

Fixes: 67d874c3b2 ("cpufreq: Register notifiers with the PM QoS framework")
Reported-by: Dmitry Osipenko <digetx@gmail.com>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
Reported-by: Sudeep Holla <sudeep.holla@arm.com>
Tested-by: Sudeep Holla <sudeep.holla@arm.com>
Diagnosed-by: Viresh Kumar <viresh.kumar@linaro.org>
Link: https://lore.kernel.org/linux-pm/5ad2624194baa2f53acc1f1e627eb7684c577a19.1562210705.git.viresh.kumar@linaro.org/T/#md2d89e95906b8c91c15f582146173dce2e86e99f
Link: https://lore.kernel.org/linux-pm/20191017094612.6tbkwoq4harsjcqv@vireshk-i7/T/#m30d48cc23b9a80467fbaa16e30f90b3828a5a29b
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
2019-10-21 02:05:21 +02:00
Andy Shevchenko 35009c8074 ACPI / utils: Introduce acpi_dev_hid_uid_match() helper
There are users outside of ACPI realm which reimplementing the comparator
function to check if the given device matches to given HID and UID.

For better utilization, introduce a helper for everyone to use.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-10-15 12:06:23 +02:00