Commit Graph

107 Commits

Author SHA1 Message Date
David Arcari 50249b5050 platform/x86/intel/pmc: Move common code to core.c
JIRA: https://issues.redhat.com/browse/RHEL-15539

commit d79c3c82ee82cc99ffde4c4f5fe69db35bcfb733
Author: Rajvi Jingar <rajvi.jingar@linux.intel.com>
Date:   Mon Dec 18 20:22:13 2023 -0800

    platform/x86/intel/pmc: Move common code to core.c

    Functions like mtl_set_device_d3() and mtl_punit_pmt_init() were added for
    Meteor Lake. To be able to use them in Arrow Lake and future platforms,
    move them to core.c.

    Also, to support different guids, add guid argument in
    pmc_core_punit_pmt_init() and to support different PCI function numbers,
    add func arg in pmc_core_ssram_init().

    Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
    Link: https://lore.kernel.org/r/20231219042216.2592029-5-rajvi.jingar@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-01-10 09:35:52 -05:00
David Arcari bb63e29d47 platform/x86/intel/pmc: Add PSON residency counter for Alder Lake
JIRA: https://issues.redhat.com/browse/RHEL-15539

commit d873f380525c502904737f592008d509cff20c78
Author: Rajvi Jingar <rajvi.jingar@linux.intel.com>
Date:   Mon Dec 18 20:22:12 2023 -0800

    platform/x86/intel/pmc: Add PSON residency counter for Alder Lake

    Add PSON register offsets for Alder Lake PCH that provides an access to
    PSON residency counter.

    Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
    Link: https://lore.kernel.org/r/20231219042216.2592029-4-rajvi.jingar@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-01-10 09:35:52 -05:00
David Arcari 355adb4b62 platform/x86/intel/pmc: Add regmap for Tiger Lake H PCH
JIRA: https://issues.redhat.com/browse/RHEL-15539

commit 544f7b7f651cf5745f3a1f3d28b298ee2b128eb1
Author: Rajvi Jingar <rajvi.jingar@linux.intel.com>
Date:   Mon Dec 18 20:22:11 2023 -0800

    platform/x86/intel/pmc: Add regmap for Tiger Lake H PCH

    Tiger Lake H PCH is same as Tiger Lake LP PCH from the driver
    perspective with the addition of the PSON residency counter. Add regmap
    for TGP H to add PSON register offsets for Tiger Lake H PCH.

    Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
    Link: https://lore.kernel.org/r/20231219042216.2592029-3-rajvi.jingar@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-01-10 09:35:51 -05:00
David Arcari f6f143c1fc platform/x86/intel/pmc: Add PSON residency counter
JIRA: https://issues.redhat.com/browse/RHEL-15539

commit b6258fa2c7b3dd23e362801410f171567d0d16af
Author: Rajvi Jingar <rajvi.jingar@linux.intel.com>
Date:   Mon Dec 18 20:22:10 2023 -0800

    platform/x86/intel/pmc: Add PSON residency counter

    Tiger Lake platform onwards, devices have the capability to track the
    duration of time that their Power Supply Units (PSUs) are turned off
    during S0ix. This patch adds a debugfs file `pson_residency_usec` to
    provide access to this counter.

    Signed-off-by: Michael Bottini <michael.a.bottini@linux.intel.com>
    Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20231219042216.2592029-2-rajvi.jingar@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-01-10 09:35:51 -05:00
David Arcari f435422918 platform/x86/intel/pmc: Fix in mtl_punit_pmt_init()
JIRA: https://issues.redhat.com/browse/RHEL-15539

commit 1f5e56c9f6cc92c45d27adfe78fb54c716fed2e2
Author: Rajvi Jingar <rajvi.jingar@linux.intel.com>
Date:   Mon Dec 18 20:22:09 2023 -0800

    platform/x86/intel/pmc: Fix in mtl_punit_pmt_init()

    pci_get_domain_bus_and_slot() increases the reference count on the pci
    device that is used to register the endpoint. In case of failure in
    registration, decrease reference count using pci_dev_put(pcidev) before
    returning.

    Fixes: 6e7964855381 ("platform/x86/intel/pmc: Show Die C6 counter on Meteor Lake")
    Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20231219042216.2592029-1-rajvi.jingar@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-01-10 09:35:51 -05:00
David Arcari ef0a4bfaa1 platform/x86/intel/pmc: Fix in pmc_core_ssram_get_pmc()
JIRA: https://issues.redhat.com/browse/RHEL-15539

commit a92d3078244891c1bc4dc2112ae58b416875d296
Author: Rajvi Jingar <rajvi.jingar@linux.intel.com>
Date:   Fri Dec 15 17:17:02 2023 -0800

    platform/x86/intel/pmc: Fix in pmc_core_ssram_get_pmc()

    Passing PMC_IDX_MAIN in pmc_core_pmc_add() adds only primary pmc to pmcdev.
    Use pmc_idx instead to add all available pmcs.

    Fixes: a01486dc4bb1 ("platform/x86/intel/pmc: Cleanup SSRAM discovery")
    Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20231216011702.1976408-1-rajvi.jingar@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-01-10 09:35:51 -05:00
David Arcari f529c74eeb platform/x86/intel/pmc: Fix hang in pmc_core_send_ltr_ignore()
JIRA: https://issues.redhat.com/browse/RHEL-15539

commit fbcf67ce5a9e2831c14bdfb895be05213e611724
Author: Rajvi Jingar <rajvi.jingar@linux.intel.com>
Date:   Fri Dec 15 17:16:50 2023 -0800

    platform/x86/intel/pmc: Fix hang in pmc_core_send_ltr_ignore()

    For input value 0, PMC stays unassigned which causes crash while trying
    to access PMC for register read/write. Include LTR index 0 in pmc_index
    and ltr_index calculation.

    Fixes: 2bcef4529222 ("platform/x86:intel/pmc: Enable debugfs multiple PMC support")
    Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20231216011650.1973941-1-rajvi.jingar@linux.intel.com
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-01-10 09:35:51 -05:00
David Arcari a58d62cf62 platform/x86/intel/pmc: Show Die C6 counter on Meteor Lake
JIRA: https://issues.redhat.com/browse/RHEL-15539

commit 6e79648553818bb21021ccf72ae27f4508844818
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Wed Nov 29 14:21:32 2023 -0800

    platform/x86/intel/pmc: Show Die C6 counter on Meteor Lake

    Expose the Die C6 counter on Meteor Lake.

    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20231129222132.2331261-21-david.e.box@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-01-10 09:35:51 -05:00
David Arcari 35e6fcc348 platform/x86/intel/pmc: Add debug attribute for Die C6 counter
JIRA: https://issues.redhat.com/browse/RHEL-15539

commit 3621df43b07d9a32e18309de569f43a8b6453966
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Wed Nov 29 14:21:31 2023 -0800

    platform/x86/intel/pmc: Add debug attribute for Die C6 counter

    Add a "die_c6_us_show" debugfs attribute.  Reads the counter value using
    Intel Platform Monitoring Technology (PMT) driver API. This counter is
    useful for determining the idle residency of CPUs in the compute tile.
    Also adds a missing forward declaration for punit_ep which was declared in
    an earlier upstream commit but only used for the first time in this one.

    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20231129222132.2331261-20-david.e.box@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-01-10 09:35:49 -05:00
David Arcari 8ddd6eb860 platform/x86/intel/pmc: Read low power mode requirements for MTL-M and MTL-P
JIRA: https://issues.redhat.com/browse/RHEL-15539

commit 935b8211a31a52c82150b2b83c8428859393860d
Author: Xi Pardee <xi.pardee@intel.com>
Date:   Wed Nov 29 14:21:30 2023 -0800

    platform/x86/intel/pmc: Read low power mode requirements for MTL-M and MTL-P

    Add support to read the low power mode requirements for Meteor Lake M and
    Meteor Lake P.

    Signed-off-by: Xi Pardee <xi.pardee@intel.com>
    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20231129222132.2331261-19-david.e.box@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-01-10 09:35:49 -05:00
David Arcari 496bf3a04f platform/x86/intel/pmc: Retrieve LPM information using Intel PMT
JIRA: https://issues.redhat.com/browse/RHEL-15539

commit 4d621c3f02ba71cb8ed48b7c32ecb0910000cc28
Author: Xi Pardee <xi.pardee@intel.com>
Date:   Wed Nov 29 14:21:29 2023 -0800

    platform/x86/intel/pmc: Retrieve LPM information using Intel PMT

    On supported platforms, the low power mode (LPM) requirements for entering
    each idle substate are described in Platform Monitoring Technology (PMT)
    telemetry entries. Provide a function for platform code to attempt to find
    and read the requirements from the telemetry entries.

    Signed-off-by: Xi Pardee <xi.pardee@intel.com>
    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20231129222132.2331261-18-david.e.box@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-01-10 09:35:49 -05:00
David Arcari 60ffe792f1 platform/x86/intel/pmc: Display LPM requirements for multiple PMCs
JIRA: https://issues.redhat.com/browse/RHEL-15539

commit 0f601dec1856d675a1251e25e858d8f1cb0b8026
Author: Rajvi Jingar <rajvi.jingar@linux.intel.com>
Date:   Wed Nov 29 14:21:28 2023 -0800

    platform/x86/intel/pmc: Display LPM requirements for multiple PMCs

    Update the substate_requirements attribute to display the requirements for
    all the PMCs on a package.

    Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20231129222132.2331261-17-david.e.box@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-01-10 09:35:49 -05:00
David Arcari 9180919518 platform/x86/intel/pmc: Find and register PMC telemetry entries
JIRA: https://issues.redhat.com/browse/RHEL-15539

commit 104f74943f4830f3a65fb96565b89014c882db85
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Wed Nov 29 14:21:27 2023 -0800

    platform/x86/intel/pmc: Find and register PMC telemetry entries

    The PMC SSRAM device contains counters that are structured in Intel
    Platform Monitoring Technology (PMT) telemetry regions. Look for and
    register these telemetry regions from the driver so that they may be read
    using the Intel PMT ABI.

    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20231129222132.2331261-16-david.e.box@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-01-10 09:35:49 -05:00
David Arcari 53e95bd05e platform/x86/intel/pmc/mtl: Use return value from pmc_core_ssram_init()
JIRA: https://issues.redhat.com/browse/RHEL-15539

commit 642dd26f58d91f4bb2e2fcaaf178bbc35369b73a
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Wed Nov 29 14:21:26 2023 -0800

    platform/x86/intel/pmc/mtl: Use return value from pmc_core_ssram_init()

    Instead of checking for a NULL regbase, use the return value from
    pmc_core_ssram_init() to check if PMC discovery was successful. If not, use
    the legacy enumeration method (which only works for the primary PMC).

    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20231129222132.2331261-15-david.e.box@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-01-10 09:35:49 -05:00
David Arcari 136ce23c56 platform/x86/intel/pmc: Cleanup SSRAM discovery
JIRA: https://issues.redhat.com/browse/RHEL-15539

commit a01486dc4bb17de976c6d0a4b1ad5f8106525dfb
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Wed Nov 29 14:21:25 2023 -0800

    platform/x86/intel/pmc: Cleanup SSRAM discovery

    Clean up the code handling SSRAM discovery. Handle all resource allocation
    and cleanup in pmc_core_ssram_get_pmc(). Return the error status from this
    function but only fail the init if we fail to discover the primary PMC.

    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20231129222132.2331261-14-david.e.box@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-01-10 09:35:49 -05:00
David Arcari f2dbac9230 platform/x86/intel/pmc: Allow pmc_core_ssram_init to fail
JIRA: https://issues.redhat.com/browse/RHEL-15539

commit 9512920a6be57af191ab2849b3ec393b8e92530a
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Wed Nov 29 14:21:24 2023 -0800

    platform/x86/intel/pmc: Allow pmc_core_ssram_init to fail

    Currently, if the PMC SSRAM initialization fails, no error is returned and
    the only indication is that a PMC device has not been created.  Instead,
    allow an error to be returned and handled directly by the caller.

    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20231129222132.2331261-13-david.e.box@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-01-10 09:35:49 -05:00
David Arcari 0ede2e8028 platform/x86:intel/pmc: Call pmc_get_low_power_modes from platform init
JIRA: https://issues.redhat.com/browse/RHEL-15539

commit 2e35e3aa9f10ea430468207c3dd9dc33ba1afc33
Author: Xi Pardee <xi.pardee@intel.com>
Date:   Wed Nov 29 14:21:23 2023 -0800

    platform/x86:intel/pmc: Call pmc_get_low_power_modes from platform init

    In order to setup a table of low power mode requirements for Meteor Lake,
    pmc_core_get_low_power_modes() will need to be run from platform init code
    so that the enabled modes are known, allowing the use of the
    pmc_for_each_mode helper. Make the function global and call it from the
    platform init code.

    Signed-off-by: Xi Pardee <xi.pardee@intel.com>
    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20231129222132.2331261-12-david.e.box@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-01-10 09:35:49 -05:00
Michael Petlan 983308506a x86/cpu: Fix Gracemont uarch
Bugzilla: https://bugzilla.redhat.com/2177050

upstream
========
commit 882cdb06b668488a42ef717a260c05ba7dc43a49
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Mon Aug 7 14:38:07 2023 +0200

description
===========
Alderlake N is an E-core only product using Gracemont
micro-architecture. It fits the pre-existing naming scheme perfectly
fine, adhere to it.

    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Acked-by: Hans de Goede <hdegoede@redhat.com>
    Link: https://lore.kernel.org/r/20230807150405.686834933@infradead.org

Conflicts:
==========
Some hunks touch code that we haven't backported yet. I don't take it,
since it is unrelated to my area. Namely, I mean these patches:
  - 7420ae3bb977 ("x86/intel_epb: Set Alder Lake N and Raptor Lake P normal EPB")
  - a414a08aefe6 ("drivers/thermal/intel: Add TCC cooling support for AlderLake platform")
  - 312c1a44da37 ("thermal: intel: Add TCC cooling support for Alder Lake-N and Raptor Lake-P")
  - 62f46fc7b8c6 ("thermal: intel_tcc_cooling: Add TCC cooling support for RaptorLake")

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
2023-09-29 10:08:27 +02:00
David Arcari 3849bfd08b platform/x86:intel/pmc: Add Meteor Lake IOE-M PMC related maps
Bugzilla: https://bugzilla.redhat.com/2177038

commit d2a7bd3690990ab8a8239096ee432ad51985d5b6
Author: Xi Pardee <xi.pardee@intel.com>
Date:   Tue Jun 13 15:53:47 2023 -0700

    platform/x86:intel/pmc: Add Meteor Lake IOE-M PMC related maps

    Add device ID and register maps for the PMC in IO expansion die M in
    Meteor Lake.

    Signed-off-by: Xi Pardee <xi.pardee@intel.com>
    Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20230613225347.2720665-9-rajvi.jingar@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-09-15 14:10:03 -04:00
David Arcari c6634a94d6 platform/x86:intel/pmc: Add Meteor Lake IOE-P PMC related maps
Bugzilla: https://bugzilla.redhat.com/2177038

commit 9f17728d96483dad1cbb3de2a4adcf59d1a04b37
Author: Xi Pardee <xi.pardee@intel.com>
Date:   Tue Jun 13 15:53:46 2023 -0700

    platform/x86:intel/pmc: Add Meteor Lake IOE-P PMC related maps

    Add device ID and register maps for the PMC in IO expansion die P in
    Meteor Lake.

    Signed-off-by: Xi Pardee <xi.pardee@intel.com>
    Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20230613225347.2720665-8-rajvi.jingar@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-09-15 14:08:33 -04:00
David Arcari 6d01d01785 platform/x86:intel/pmc: Use SSRAM to discover pwrm base address of primary PMC
Bugzilla: https://bugzilla.redhat.com/2177038

commit 23e74e3ca6b56d12c14c7369d940187713c85d43
Author: Xi Pardee <xi.pardee@intel.com>
Date:   Tue Jun 13 15:53:45 2023 -0700

    platform/x86:intel/pmc: Use SSRAM to discover pwrm base address of primary PMC

    On older platforms, the base address for PMC was hardcoded in the
    driver. Newer platforms can now retrieve the base address from SSRAM.
    Use SSRAM to discover pwrm base address on Meteor Lake platform. If
    this method fails, it will fall back to the hardcoded value.

    Signed-off-by: Xi Pardee <xi.pardee@intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20230613225347.2720665-7-rajvi.jingar@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-09-15 14:08:33 -04:00
David Arcari 58d35a7054 platform/x86:intel/pmc: Discover PMC devices
Bugzilla: https://bugzilla.redhat.com/2177038

commit 1b8c7b843c0043dd1b81e162e5b5fbed4b256896
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Tue Jun 13 15:53:44 2023 -0700

    platform/x86:intel/pmc: Discover PMC devices

    On platforms with multiple PMCs, additional PMC devices are discovered
    in the SSRAM device associated with the primary PMC. Add support for
    discovering PMC devices from SSRAM. Use PMC devid to assign the
    corresponding register map.

    Signed-off-by: Xi Pardee <xi.pardee@intel.com>
    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20230613225347.2720665-6-rajvi.jingar@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-09-15 14:08:33 -04:00
David Arcari 9226239a6d platform/x86:intel/pmc: Enable debugfs multiple PMC support
Bugzilla: https://bugzilla.redhat.com/2177038

commit 2bcef4529222424559ac9b45948ee9d82c09d9b5
Author: Xi Pardee <xi.pardee@intel.com>
Date:   Tue Jun 13 15:53:43 2023 -0700

    platform/x86:intel/pmc: Enable debugfs multiple PMC support

    Enable debugfs support for multiple PMC. These debugfs attributes
    show information for all enabled PMCs.

    pch_ip_power_gating_status
    substate_status_registers
    substate_live_status_registers
    ltr_show
    ltr_ignore

    Signed-off-by: Xi Pardee <xi.pardee@intel.com>
    Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20230613225347.2720665-5-rajvi.jingar@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-09-15 14:08:33 -04:00
David Arcari 25df4c4455 platform/x86:intel/pmc: Add support to handle multiple PMCs
Bugzilla: https://bugzilla.redhat.com/2177038

commit 1c709ae12dad6f7e2dd5becfbac0f5141c2e15fd
Author: Xi Pardee <xi.pardee@intel.com>
Date:   Tue Jun 13 15:53:42 2023 -0700

    platform/x86:intel/pmc: Add support to handle multiple PMCs

    To support platforms with multiple PMCs, add a PMC device structure to
    support each PMC instance.

    Signed-off-by: Xi Pardee <xi.pardee@intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20230613225347.2720665-4-rajvi.jingar@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-09-15 14:08:33 -04:00
David Arcari ff186d321b platform/x86:intel/pmc: Combine core_init() and core_configure()
Bugzilla: https://bugzilla.redhat.com/2177038

commit 804951203aa541ad6720c9726c173d18aeb3ab6b
Author: Xi Pardee <xi.pardee@intel.com>
Date:   Tue Jun 13 15:53:41 2023 -0700

    platform/x86:intel/pmc: Combine core_init() and core_configure()

    Combine core_init() and core_configure() functions to have a
    cleaner setup for platforms.

    Signed-off-by: Xi Pardee <xi.pardee@intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20230613225347.2720665-3-rajvi.jingar@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-09-15 14:08:33 -04:00
David Arcari f5b9a0c6af platform/x86:intel/pmc: Update maps for Meteor Lake P/M platforms
Bugzilla: https://bugzilla.redhat.com/2177038

commit 9682cfd1973d01e43c2764c662e6d3291ddf770d
Author: Xi Pardee <xi.pardee@intel.com>
Date:   Tue Jun 13 15:53:40 2023 -0700

    platform/x86:intel/pmc: Update maps for Meteor Lake P/M platforms

    Fix the IP name errors in the register maps used by the following
    debugfs attributes in the Meteor Lake SOC-M PMC.

    pfear_sts
    lpm_sts
    ltr_show

    Fixes: c5ad454a12c6 ("platform/x86: intel/pmc/core: Add Meteor Lake support to pmc core driver")
    Signed-off-by: Xi Pardee <xi.pardee@intel.com>
    Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20230613225347.2720665-2-rajvi.jingar@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-09-15 14:08:33 -04:00
David Arcari d96cc4eb63 platform/x86/intel/pmc/mtl: Put devices in D3 during resume
Bugzilla: https://bugzilla.redhat.com/2177038

commit f2b689ab2f8cc089cc7659c323f282e6a1fb6d64
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Wed Jun 7 16:38:49 2023 -0700

    platform/x86/intel/pmc/mtl: Put devices in D3 during resume

    An earlier commit placed some driverless devices in D3 during boot so that
    they don't block package cstate entry on Meteor Lake. Also place these
    devices in D3 after resume from suspend.

    Fixes: 336ba968d3e3 ("platform/x86/intel/pmc/mtl: Put GNA/IPU/VPU devices in D3")
    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20230607233849.239047-2-david.e.box@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-09-15 14:08:33 -04:00
David Arcari c8de884e21 platform/x86/intel/pmc: Add resume callback
Bugzilla: https://bugzilla.redhat.com/2177038

commit 801e5dc9853fcc36164c502456078145d72b23c5
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Wed Jun 7 16:38:48 2023 -0700

    platform/x86/intel/pmc: Add resume callback

    Add a resume callback to perform platform specific functions during resume
    from suspend.

    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20230607233849.239047-1-david.e.box@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-09-15 14:08:33 -04:00
David Arcari 25f2b640e0 platform/x86:intel/pmc: Remove Meteor Lake S platform support
Bugzilla: https://bugzilla.redhat.com/2177038

commit 416a87c972b978d71ab828442d1d48e3bd194855
Author: Xi Pardee <xi.pardee@intel.com>
Date:   Wed May 31 17:47:06 2023 -0700

    platform/x86:intel/pmc: Remove Meteor Lake S platform support

    commit c5ad454a12c6 ("platform/x86: intel/pmc/core: Add Meteor Lake
    support to pmc core driver") was supposed to add support for Meter
    Lake P/M and mistakenly added support for Meteor Lake S instead. Meteor
    Lake P/M support was added later and MTL-S support needs to be removed
    since its currently assigned to the wrong register maps.

    Fixes: c5ad454a12c6 ("platform/x86: intel/pmc/core: Add Meteor Lake support to pmc core driver")
    Signed-off-by: Xi Pardee <xi.pardee@intel.com>
    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20230601004706.871528-1-xi.pardee@intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-09-15 14:08:33 -04:00
David Arcari ba6b28e374 platform/x86/intel/pmc/mtl: Put GNA/IPU/VPU devices in D3
Bugzilla: https://bugzilla.redhat.com/2177038

commit 336ba968d3e30038c13b03a71f5a672db6c9e303
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Sun Apr 9 12:25:35 2023 -0700

    platform/x86/intel/pmc/mtl: Put GNA/IPU/VPU devices in D3

    On Meteor Lake, the GNA, IPU, and VPU devices are booted in D0 power state
    and will block the SoC from going into the deepest Package C-state if a
    driver is not present. Put each device in D3hot if no driver is found.

    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Link: https://lore.kernel.org/r/20230409192535.914540-1-david.e.box@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-09-15 14:08:33 -04:00
David Arcari 1c3f7812a6 platform/x86/intel/pmc: Alder Lake PCH slp_s0_residency fix
Bugzilla: https://bugzilla.redhat.com/2177038

commit fb5755100a0a5aa5957bdb204fd1e249684557fc
Author: Rajvi Jingar <rajvi.jingar@linux.intel.com>
Date:   Mon Mar 20 14:20:29 2023 -0700

    platform/x86/intel/pmc: Alder Lake PCH slp_s0_residency fix

    For platforms with Alder Lake PCH (Alder Lake S and Raptor Lake S) the
    slp_s0_residency attribute has been reporting the wrong value. Unlike other
    platforms, ADL PCH does not have a counter for the time that the SLP_S0
    signal was asserted. Instead, firmware uses the aggregate of the Low Power
    Mode (LPM) substate counters as the S0ix value.  Since the LPM counters run
    at a different frequency, this lead to misreporting of the S0ix time.

    Add a check for Alder Lake PCH and adjust the frequency accordingly when
    display slp_s0_residency.

    Fixes: bbab31101f44 ("platform/x86/intel: pmc/core: Add Alderlake support to pmc core driver")
    Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Reviewed-by: Rajneesh Bhardwaj <irenic.rajneesh@gmail.com>
    Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
    Link: https://lore.kernel.org/r/20230320212029.3154407-1-david.e.box@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-09-15 14:08:33 -04:00
David Arcari 5bee388617 platform/x86: intel: pmc: core: Convert to platform remove callback returning void
Bugzilla: https://bugzilla.redhat.com/2177038

commit 1655db18b8dd387185dd4b491ce03b21176ab545
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Thu Mar 2 15:47:26 2023 +0100

    platform/x86: intel: pmc: core: Convert to platform remove callback returning void

    The .remove() callback for a platform driver returns an int which makes
    many driver authors wrongly assume it's possible to do error handling by
    returning an error code. However the value returned is (mostly) ignored
    and this typically results in resource leaks. To improve here there is a
    quest to make the remove callback return void. In the first step of this
    quest all drivers are converted to .remove_new() which already returns
    void.

    Trivially convert this driver from always returning zero in the remove
    callback to the void returning variant.

    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Link: https://lore.kernel.org/r/20230302144732.1903781-24-u.kleine-koenig@pengutronix.de
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-09-15 14:08:33 -04:00
David Arcari 08ffb223bd platform/x86/intel/pmc: core: Report duration of time in HW sleep state
Bugzilla: https://bugzilla.redhat.com/2162507

commit ddd66d63473513bb013928245b6482969b97de05
Author: Mario Limonciello <mario.limonciello@amd.com>
Date:   Mon Apr 17 10:27:08 2023 -0500

    platform/x86/intel/pmc: core: Report duration of time in HW sleep state

    intel_pmc_core displays a warning when the module parameter
    `warn_on_s0ix_failures` is set and a suspend didn't get to a HW sleep
    state.

    Report this to the standard kernel reporting infrastructure so that
    userspace software can query after the suspend cycle is done.

    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Reviewed-by: David E. Box <david.e.box@linux.intel.com>
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-06-06 16:24:38 -04:00
David Arcari 882febb393 platform/x86/intel/pmc: core: Always capture counters on suspend
Bugzilla: https://bugzilla.redhat.com/2162507

commit e2348afe702e9431f428e230be7f4ef8a1778b19
Author: Mario Limonciello <mario.limonciello@amd.com>
Date:   Mon Apr 17 10:27:07 2023 -0500

    platform/x86/intel/pmc: core: Always capture counters on suspend

    Currently counters are only captured during suspend when the
    warn_on_s0ix_failures module parameter is set.

    In order to relay this counter information to the kernel reporting
    infrastructure adjust it so that the counters are always captured.

    warn_on_s0ix_failures will be utilized solely for messaging by
    the driver instead.

    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: David E. Box <david.e.box@linux.intel.com>
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-06-06 16:24:38 -04:00
David Arcari dc9c3d3bab platform/x86: intel/pmc: Switch to use acpi_evaluate_dsm_typed()
Bugzilla: https://bugzilla.redhat.com/2153969

commit 6ab983187d80a10f67c8cf19a0a6640ab79a92b9
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date:   Wed Jan 18 11:54:40 2023 +0200

    platform/x86: intel/pmc: Switch to use acpi_evaluate_dsm_typed()

    The acpi_evaluate_dsm_typed() provides a way to check the type of the
    object evaluated by _DSM call. Use it instead of open coded variant.

    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Reviewed-by: Rajneesh Bhardwaj <irenic.rajneesh@gmail.com>
    Link: https://lore.kernel.org/r/20230118095440.41634-1-andriy.shevchenko@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-03-13 11:45:43 -04:00
David Arcari e0a218aa4d platform/x86: intel/pmc/core: Add Meteor Lake mobile support
Bugzilla: https://bugzilla.redhat.com/2153969

commit 6aa5207838ccf79879f212034435a5606f890eea
Author: Gayatri Kammela <gayatri.kammela@linux.intel.com>
Date:   Wed Dec 28 15:05:53 2022 -0800

    platform/x86: intel/pmc/core: Add Meteor Lake mobile support

    Add Meteor Lake mobile support to pmc core driver. Meteor Lake mobile
    parts reuse all the Meteor Lake PCH IPs.

    Cc: David E Box <david.e.box@linux.intel.com>
    Signed-off-by: Gayatri Kammela <gayatri.kammela@linux.intel.com>
    Link: https://lore.kernel.org/r/20221228230553.2497183-1-gayatri.kammela@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-03-13 11:45:43 -04:00
David Arcari 81f69904e4 platform/x86: intel/pmc/core: Add Meteor Lake support to pmc core driver
Bugzilla: https://bugzilla.redhat.com/2153969

commit c5ad454a12c6a6d08dd67c971a0b12adc9953304
Author: Gayatri Kammela <gayatri.kammela@linux.intel.com>
Date:   Mon Nov 14 10:32:57 2022 -0800

    platform/x86: intel/pmc/core: Add Meteor Lake support to pmc core driver

    Add Meteor Lake client and mobile support to pmc core driver. This patch
    adds legacy support.

    Cc: David E Box <david.e.box@linux.intel.com>
    Suggested-by: David E Box <david.e.box@linux.intel.com>
    Reviewed-by: "David E. Box" <david.e.box@linux.intel.com>
    Signed-off-by: Sukumar Ghorai <sukumar.ghorai@intel.com>
    Signed-off-by: Gayatri Kammela <gayatri.kammela@linux.intel.com>
    Signed-off-by: "David E. Box" <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20221114183257.2067662-9-gayatri.kammela@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-03-13 11:45:43 -04:00
David Arcari a082d1c5e3 platform/x86: intel/pmc: Relocate Alder Lake PCH support
Bugzilla: https://bugzilla.redhat.com/2153969

commit 08876884b9eac0666a510ef4f7e7a7c2d377aae5
Author: Gayatri Kammela <gayatri.kammela@linux.intel.com>
Date:   Mon Nov 14 10:32:56 2022 -0800

    platform/x86: intel/pmc: Relocate Alder Lake PCH support

    Create adl.c for Alder Lake PCH specific structures and init().
    This file supports Alder Lake, Raptor Lake and Raptor Lake S platforms
    There are no functional changes involved.

    Cc: David E Box <david.e.box@linux.intel.com>
    Reviewed-by: "David E. Box" <david.e.box@linux.intel.com>
    Signed-off-by: Gayatri Kammela <gayatri.kammela@linux.intel.com>
    Signed-off-by: "David E. Box" <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20221114183257.2067662-8-gayatri.kammela@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-03-13 11:45:43 -04:00
David Arcari 6f906bab93 platform/x86: intel/pmc: Relocate Tiger Lake PCH support
Bugzilla: https://bugzilla.redhat.com/2153969

commit 92f530edd7c9557c225edd6db051e00b3ef9a2ac
Author: Gayatri Kammela <gayatri.kammela@linux.intel.com>
Date:   Mon Nov 14 10:32:55 2022 -0800

    platform/x86: intel/pmc: Relocate Tiger Lake PCH support

    Create tgl.c for Tiger Lake PCH specific structures and init().
    This file supports Tiger Lake, Elkhart Lake, Rocket Lake,
    Alder Lake mobile, Alder Lake N and Raptor Lake P platforms.
    There are no functional changes involved.

    Cc: David E Box <david.e.box@linux.intel.com>
    Reviewed-by: "David E. Box" <david.e.box@linux.intel.com>
    Signed-off-by: Gayatri Kammela <gayatri.kammela@linux.intel.com>
    Signed-off-by: "David E. Box" <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20221114183257.2067662-7-gayatri.kammela@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-03-13 11:45:43 -04:00
David Arcari 11ddcbfc5c platform/x86: intel/pmc: Relocate Ice Lake PCH support
Bugzilla: https://bugzilla.redhat.com/2153969

commit fd2ed6dbc34979fbb2a745a259f2a3b201f64299
Author: Xi Pardee <xi.pardee@intel.com>
Date:   Mon Nov 14 10:32:54 2022 -0800

    platform/x86: intel/pmc: Relocate Ice Lake PCH support

    Create icl.c for Ice Lake PCH specific structures and init().
    This file supports Ice Lake, Ice Lake NNPI and Jasper Lake platforms.
    There are no functional changes involved.

    Cc: David E Box <david.e.box@linux.intel.com>
    Reviewed-by: "David E. Box" <david.e.box@linux.intel.com>
    Signed-off-by: Xi Pardee <xi.pardee@intel.com>
    Signed-off-by: "David E. Box" <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20221114183257.2067662-6-gayatri.kammela@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-03-13 11:45:43 -04:00
David Arcari 40229dd3f1 platform/x86: intel/pmc: Relocate Cannon Lake Point PCH support
Bugzilla: https://bugzilla.redhat.com/2153969

commit d6cd0cc8d16dadf2a3c0ddc93e21cd1d13b02fbb
Author: Xi Pardee <xi.pardee@intel.com>
Date:   Mon Nov 14 10:32:53 2022 -0800

    platform/x86: intel/pmc: Relocate Cannon Lake Point PCH support

    Create cnp.c for Cannon Lake Point PCH specific structures and init().
    This file supports Cannon Lake and Comet Lake platforms.
    There are no functional changes involved.

    Cc: David E Box <david.e.box@linux.intel.com>
    Reviewed-by: "David E. Box" <david.e.box@linux.intel.com>
    Signed-off-by: Xi Pardee <xi.pardee@intel.com>
    Signed-off-by: "David E. Box" <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20221114183257.2067662-5-gayatri.kammela@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-03-13 11:45:42 -04:00
David Arcari eca830392a platform/x86: intel/pmc: Relocate Sunrise Point PCH support
Bugzilla: https://bugzilla.redhat.com/2153969

commit f23e21a345956e3bd234c6d5a3d29818604dfe74
Author: Rajvi Jingar <rajvi.jingar@linux.intel.com>
Date:   Mon Nov 14 10:32:52 2022 -0800

    platform/x86: intel/pmc: Relocate Sunrise Point PCH support

    Create spt.c for Sunrise Point PCH specific structures and init().
    This file supports Sky Lake and Kaby Lake platforms. There are no
    functional changes involved.

    Cc: David E Box <david.e.box@linux.intel.com>
    Reviewed-by: "David E. Box" <david.e.box@linux.intel.com>
    Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
    Signed-off-by: "David E. Box" <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20221114183257.2067662-4-gayatri.kammela@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-03-13 11:45:42 -04:00
David Arcari b7b22076fe platform/x86: intel/pmc: Move variable declarations and definitions to header and core.c
Bugzilla: https://bugzilla.redhat.com/2153969

commit 03c58a1e949d16faa922dd0501db1f2585d66eb3
Author: Xi Pardee <xi.pardee@intel.com>
Date:   Mon Nov 14 10:32:51 2022 -0800

    platform/x86: intel/pmc: Move variable declarations and definitions to header and core.c

    Move the msr_map variable declaration to core.h and move the pmc_lpm_modes
    definition to core.c.

    This is a prepartory patch for redesigning the pmc core driver as the
    variables will be used in multiple PCH specific files.

    Cc: David E Box <david.e.box@linux.intel.com>
    Reviewed-by: "David E. Box" <david.e.box@linux.intel.com>
    Signed-off-by: Xi Pardee <xi.pardee@intel.com>
    Signed-off-by: "David E. Box" <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20221114183257.2067662-3-gayatri.kammela@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-03-13 11:45:42 -04:00
David Arcari 4ed60082e1 platform/x86: intel/pmc: Replace all the reg_map with init functions
Bugzilla: https://bugzilla.redhat.com/2153969

commit 284c01b72ac9cad03b972324a72782759ef980af
Author: Gayatri Kammela <gayatri.kammela@linux.intel.com>
Date:   Mon Nov 14 10:32:50 2022 -0800

    platform/x86: intel/pmc: Replace all the reg_map with init functions

    The current implementation of pmc core driver has the reg_map assigned
    to the CPUID of each platform. Replace the reg_map with init functions
    that are defined for each platform.

    This is a preparatory patch for redesigning the pmc core driver.

    Cc: David E Box <david.e.box@linux.intel.com>
    Reviewed-by: "David E. Box" <david.e.box@linux.intel.com>
    Signed-off-by: Gayatri Kammela <gayatri.kammela@linux.intel.com>
    Signed-off-by: "David E. Box" <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20221114183257.2067662-2-gayatri.kammela@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-03-13 11:45:42 -04:00
David Arcari 94aa58fbe8 platform/x86/intel: pmc: Fix repeated word in comment
Bugzilla: https://bugzilla.redhat.com/2153969

commit 26174aaee3832d681dcc0744b005021c7480a8f6
Author: Jilin Yuan <yuanjilin@cdjrlc.com>
Date:   Wed Oct 19 20:53:55 2022 +0800

    platform/x86/intel: pmc: Fix repeated word in comment

    Delete the redundant word 'to'.

    Signed-off-by: Jilin Yuan <yuanjilin@cdjrlc.com>
    Link: https://lore.kernel.org/r/20221019125355.50674-1-yuanjilin@cdjrlc.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-03-13 11:45:42 -04:00
David Arcari 32a960ec43 platform/x86/intel: pmc: Don't unconditionally attach Intel PMC when virtualized
Bugzilla: https://bugzilla.redhat.com/2153969

commit 2dbfb3f33350e1e868d3d7ed4c176d8777150878
Author: Roger Pau Monné <roger.pau@citrix.com>
Date:   Thu Nov 10 17:31:44 2022 +0100

    platform/x86/intel: pmc: Don't unconditionally attach Intel PMC when virtualized

    The current logic in the Intel PMC driver will forcefully attach it
    when detecting any CPU on the intel_pmc_core_platform_ids array,
    even if the matching ACPI device is not present.

    There's no checking in pmc_core_probe() to assert that the PMC device
    is present, and hence on virtualized environments the PMC device
    probes successfully, even if the underlying registers are not present.
    Before commit 21ae435709 ("platform/x86: intel_pmc_core: Substitute PCI
    with CPUID enumeration") the driver would check for the presence of a
    specific PCI device, and that prevented the driver from attaching when
    running virtualized.

    Fix by only forcefully attaching the PMC device when not running
    virtualized.  Note that virtualized platforms can still get the device
    to load if the appropriate ACPI device is present on the tables
    provided to the VM.

    Make an exception for the Xen initial domain, which does have full
    hardware access, and hence can attach to the PMC if present.

    Fixes: 21ae435709 ("platform/x86: intel_pmc_core: Substitute PCI with CPUID enumeration")
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: David E. Box <david.e.box@linux.intel.com>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Link: https://lore.kernel.org/r/20221110163145.80374-1-roger.pau@citrix.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-03-13 11:45:42 -04:00
David Arcari ea81d58b1d platform/x86/intel: pmc/core: Add Raptor Lake support to pmc core driver
Bugzilla: https://bugzilla.redhat.com/2076733

commit 555a68dd681b7437a2708001d465c85f6dfa6955
Author: Gayatri Kammela <gayatri.kammela@linux.intel.com>
Date:   Mon Sep 12 16:33:07 2022 -0700

    platform/x86/intel: pmc/core: Add Raptor Lake support to pmc core driver

    Add Raptor Lake client parts (both RPL and RPL_S) support to pmc core
    driver. Raptor Lake client parts reuse all the Alder Lake PCH IPs.

    Cc: Srinivas Pandruvada <srinivas.pandruvada@intel.com>
    Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Cc: David Box <david.e.box@intel.com>
    Acked-by: Rajneesh Bhardwaj <irenic.rajneesh@gmail.com>
    Signed-off-by: Gayatri Kammela <gayatri.kammela@linux.intel.com>
    Link: https://lore.kernel.org/r/20220912233307.409954-2-gayatri.kammela@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2022-10-26 08:43:57 -04:00
David Arcari 9a9204a10b platform/x86: intel/pmc: Add Alder Lake N support to PMC core driver
Bugzilla: https://bugzilla.redhat.com/2072655

commit d63eae6747eb8b3192e89712f6553c6aa162f872
Author: Gayatri Kammela <gayatri.kammela@linux.intel.com>
Date:   Tue Jun 14 17:27:51 2022 -0700

    platform/x86: intel/pmc: Add Alder Lake N support to PMC core driver

    Add Alder Lake N (ADL-N) to the list of the platforms that Intel's
    PMC core driver supports. Alder Lake N reuses all the TigerLake PCH IPs.

    Cc: Srinivas Pandruvada <srinivas.pandruvada@intel.com>
    Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Cc: David E. Box <david.e.box@linux.intel.com>
    Signed-off-by: Gayatri Kammela <gayatri.kammela@linux.intel.com>
    Reviewed-by: Rajneesh Bhardwaj <irenic.rajneesh@gmail.com>
    Link: https://lore.kernel.org/r/20220615002751.3371730-1-gayatri.kammela@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2022-09-06 08:31:01 -04:00
David Arcari 0ae25b4ca2 platform/x86/intel: pmc: Support Intel Raptorlake P
Bugzilla: https://bugzilla.redhat.com/2072655

commit 552f3b801de6eb062b225a76e140995483a0609c
Author: George D Sworo <george.d.sworo@intel.com>
Date:   Wed Jun 1 18:26:17 2022 -0700

    platform/x86/intel: pmc: Support Intel Raptorlake P

    Add Raptorlake P to the list of the platforms that intel_pmc_core driver
    supports for pmc_core device. Raptorlake P PCH is based on Alderlake P
    PCH.

    Signed-off-by: George D Sworo <george.d.sworo@intel.com>
    Reviewed-by: David E. Box <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20220602012617.20100-1-george.d.sworo@intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2022-09-06 08:31:01 -04:00
David Arcari fb9aea90e8 platform/x86/intel: pmc/core: Use kobj_to_dev()
Bugzilla: https://bugzilla.redhat.com/2072655

commit 0eb369bf48f25cf4f1cceb7786af27da4edb8dce
Author: Minghao Chi <chi.minghao@zte.com.cn>
Date:   Mon Apr 25 10:55:25 2022 +0000

    platform/x86/intel: pmc/core: Use kobj_to_dev()

    Use kobj_to_dev() instead of open-coding it.

    Reported-by: Zeal Robot <zealci@zte.com.cn>
    Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
    Link: https://lore.kernel.org/r/20220425105525.3515831-1-chi.minghao@zte.com.cn
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2022-09-06 08:31:01 -04:00
David Arcari fbd7f3b0b6 platform/x86/intel: pmc/core: change pmc_lpm_modes to static
Bugzilla: https://bugzilla.redhat.com/2072655

commit b4e74f6842d4928d5d95935b1a058d503c103ed7
Author: Tom Rix <trix@redhat.com>
Date:   Sat Apr 23 08:30:48 2022 -0400

    platform/x86/intel: pmc/core: change pmc_lpm_modes to static

    Sparse reports this issue
    core.c: note: in included file:
    core.h:239:12: warning: symbol 'pmc_lpm_modes' was not declared. Should it be static?

    Global variables should not be defined in headers.  This only works
    because core.h is only included by core.c. Single file use
    variables should be static, so change its storage-class specifier
    to static.

    Signed-off-by: Tom Rix <trix@redhat.com>
    Reviewed-by: David E. Box <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20220423123048.591405-1-trix@redhat.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2022-09-06 08:31:01 -04:00
David Arcari 2f01c5f6b6 platform/x86: intel_pmc_core: fix memleak on registration failure
Bugzilla: https://bugzilla.redhat.com/2072655

commit 26a8b09437804fabfb1db080d676b96c0de68e7c
Author: Johan Hovold <johan@kernel.org>
Date:   Wed Dec 22 11:50:23 2021 +0100

    platform/x86: intel_pmc_core: fix memleak on registration failure

    In case device registration fails during module initialisation, the
    platform device structure needs to be freed using platform_device_put()
    to properly free all resources (e.g. the device name).

    Fixes: 938835aa90 ("platform/x86: intel_pmc_core: do not create a static struct device")
    Cc: stable@vger.kernel.org      # 5.9
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Link: https://lore.kernel.org/r/20211222105023.6205-1-johan@kernel.org
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2022-09-06 08:31:00 -04:00
David Arcari 18f791afe8 platform/x86/intel: pmc/core: Add GBE Package C10 fix for Alder Lake PCH
Bugzilla: http://bugzilla.redhat.com/2007707

commit 66a91c00218c5f5d19e5bfaada05432c672b8241
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Mon Aug 16 09:58:34 2021 -0700

    platform/x86/intel: pmc/core: Add GBE Package C10 fix for Alder Lake PCH

    Alder PCH uses the same Gigabit Ethernet (GBE) device as Tiger Lake PCH
    which cannot achieve PC10 without ignoring the PMC GBE LTR. Add this
    work around for Alder Lake PCH as well.

    Cc: Chao Qin <chao.qin@intel.com>
    Cc: Srinivas Pandruvada <srinivas.pandruvada@intel.com>
    Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Tested-by: You-Sheng Yang <vicamo.yang@canonical.com>
    Acked-by: Rajneesh Bhardwaj <irenic.rajneesh@gmail.com>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/9168e8bd687f2d0d5eb0ed116e08d0764eadf7b3.1629091915.git.gayatri.kammela@intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2021-10-12 10:10:15 -04:00
David Arcari f559f8d614 platform/x86/intel: pmc/core: Add Alder Lake low power mode support for pmc core
Bugzilla: http://bugzilla.redhat.com/2007707

commit 6cfce3ef806c1d458a816db7e63a1c13571abf86
Author: Gayatri Kammela <gayatri.kammela@intel.com>
Date:   Mon Aug 16 09:58:33 2021 -0700

    platform/x86/intel: pmc/core: Add Alder Lake low power mode support for pmc core

    Alder Lake has 14 status registers that are memory mapped. These
    registers show the status of the low power mode requirements. The
    registers are latched on every C10 entry or exit and on every s0ix.y
    entry/exit. Accessing these registers is useful for debugging any low
    power related activities.

    Thus, add debugfs entry to access low power mode status registers.

    Cc: Chao Qin <chao.qin@intel.com>
    Cc: Srinivas Pandruvada <srinivas.pandruvada@intel.com>
    Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Cc: David Box <david.e.box@intel.com>
    Tested-by: You-Sheng Yang <vicamo.yang@canonical.com>
    Acked-by: Rajneesh Bhardwaj <irenic.rajneesh@gmail.com>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
    Signed-off-by: Gayatri Kammela <gayatri.kammela@intel.com>
    Link: https://lore.kernel.org/r/d27ec98589a5aaa569bbce0e937ed03779fc0a22.1629091915.git.gayatri.kammela@intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2021-10-12 10:10:15 -04:00
David Arcari 7c0b20a890 platform/x86/intel: pmc/core: Add Latency Tolerance Reporting (LTR) support to Alder Lake
Bugzilla: http://bugzilla.redhat.com/2007707

commit ee7e89ff80063616c7f81b97ce7d38733019531a
Author: Gayatri Kammela <gayatri.kammela@intel.com>
Date:   Mon Aug 16 09:58:32 2021 -0700

    platform/x86/intel: pmc/core: Add Latency Tolerance Reporting (LTR) support to Alder Lake

    Add support to show the Latency Tolerance Reporting for the IPs on
    the Alder Lake PCH as reported by the PMC. This LTR support on
    Alder Lake is slightly different from the Cannon lake PCH that is being
    reused by all platforms till Tiger Lake.

    Cc: Chao Qin <chao.qin@intel.com>
    Cc: Srinivas Pandruvada <srinivas.pandruvada@intel.com>
    Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Cc: David Box <david.e.box@intel.com>
    Tested-by: You-Sheng Yang <vicamo.yang@canonical.com>
    Acked-by: Rajneesh Bhardwaj <irenic.rajneesh@gmail.com>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
    Signed-off-by: Gayatri Kammela <gayatri.kammela@intel.com>
    Link: https://lore.kernel.org/r/5ca3ea090b53a9bf918b055447ab5c8ef2925cc4.1629091915.git.gayatri.kammela@intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2021-10-12 10:10:15 -04:00
David Arcari 81f626d2ca platform/x86/intel: pmc/core: Add Alderlake support to pmc core driver
Bugzilla: http://bugzilla.redhat.com/2007707

commit bbab31101f44911b24c9da02733ce196e5702fea
Author: Gayatri Kammela <gayatri.kammela@intel.com>
Date:   Mon Aug 16 09:58:31 2021 -0700

    platform/x86/intel: pmc/core: Add Alderlake support to pmc core driver

    Add Alder Lake client and mobile support to pmc core driver.

    Cc: Chao Qin <chao.qin@intel.com>
    Cc: Srinivas Pandruvada <srinivas.pandruvada@intel.com>
    Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Cc: David Box <david.e.box@intel.com>
    Tested-by: You-Sheng Yang <vicamo.yang@canonical.com>
    Acked-by: Rajneesh Bhardwaj <irenic.rajneesh@gmail.com>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
    Signed-off-by: Gayatri Kammela <gayatri.kammela@intel.com>
    Link: https://lore.kernel.org/r/8b32e168f8e69dd00aabfb2e4383db78f22b123b.1629091915.git.gayatri.kammela@intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2021-10-12 10:10:15 -04:00
David Arcari 12db31d4b9 platform/x86: intel_pmc_core: Move to intel sub-directory
Bugzilla: http://bugzilla.redhat.com/2007707

commit fa082a7cf5a66a42a06da048afd972e2cc1b67ea
Author: Kate Hsuan <hpa@redhat.com>
Date:   Fri Aug 20 14:04:44 2021 +0300

    platform/x86: intel_pmc_core: Move to intel sub-directory

    Move Intel PMC core driver to intel sub-directory to improve readability.

    Signed-off-by: Kate Hsuan <hpa@redhat.com>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Reviewed-by: Rajneesh Bhardwaj <irenic.rajneesh@gmail.com>
    Link: https://lore.kernel.org/r/20210820110458.73018-7-andriy.shevchenko@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2021-10-12 10:10:15 -04:00