Commit Graph

107 Commits

Author SHA1 Message Date
David Arcari e8e767125d platform/x86/intel/pmc: Remove unneeded extern keyword in header
JIRA: https://issues.redhat.com/browse/RHEL-20138

commit c5855d2022b0d33702d5da24ed8caa80a3e57c23
Author: Xi Pardee <xi.pardee@linux.intel.com>
Date:   Fri Feb 14 13:44:11 2025 -0800

    platform/x86/intel/pmc: Remove unneeded extern keyword in header

    Remove unneeded extern keyword in header file. Functions are
    extern by default so extern keyword is not unnecessary for
    function declaration.

    Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com>
    Link: https://lore.kernel.org/r/20250214214416.10150-4-xi.pardee@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2025-04-03 11:24:48 -04:00
David Arcari 2b475d7af2 platform/x86/intel/pmc: Remove unnecessary declarations in header
JIRA: https://issues.redhat.com/browse/RHEL-20138

commit 9eeeb2a7c77313530a223b58ac53f0eba1c6292c
Author: Xi Pardee <xi.pardee@linux.intel.com>
Date:   Fri Feb 14 13:44:10 2025 -0800

    platform/x86/intel/pmc: Remove unnecessary declarations in header

    Remove unnecessary declarations in header file. Variable that are
    used by only one .c file are removed from header file and changed
    to be static in their corresponding .c file.

    Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com>
    Link: https://lore.kernel.org/r/20250214214416.10150-3-xi.pardee@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2025-04-03 11:24:48 -04:00
David Arcari 5442e614b8 platform/x86/intel/pmc: Add Panther Lake support to intel_pmc_core
JIRA: https://issues.redhat.com/browse/RHEL-20138

commit d31feed799c1a25750cc72113c22b1d4d744be21
Author: Xi Pardee <xi.pardee@linux.intel.com>
Date:   Fri Feb 14 13:44:09 2025 -0800

    platform/x86/intel/pmc: Add Panther Lake support to intel_pmc_core

    Add Panther Lake support to intel_pmc_core driver

    Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
    Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com>
    Link: https://lore.kernel.org/r/20250214214416.10150-2-xi.pardee@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2025-04-03 11:24:48 -04:00
David Arcari e632c467de platform/x86:intel/pmc: Move arch specific action to init function
JIRA: https://issues.redhat.com/browse/RHEL-20138

commit d026feb03bdcde33e22a75777d59ed9d8725bcdd
Author: Xi Pardee <xi.pardee@linux.intel.com>
Date:   Tue Feb 11 17:05:56 2025 -0800

    platform/x86:intel/pmc: Move arch specific action to init function

    Move arch specific action from core.c to the init() function of spt.c.

    Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com>
    Link: https://lore.kernel.org/r/20250212010621.1003663-1-xi.pardee@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2025-04-03 11:24:48 -04:00
David Arcari be02627744 platform/x86/intel/pmc: Add Arrow Lake U/H support to intel_pmc_core driver
JIRA: https://issues.redhat.com/browse/RHEL-20138

commit bd820906ea9dc3acfcac9de4f1be89b78609e2ac
Author: Xi Pardee <xi.pardee@linux.intel.com>
Date:   Fri Feb 7 14:56:12 2025 -0800

    platform/x86/intel/pmc: Add Arrow Lake U/H support to intel_pmc_core driver

    Add Arrow Lake U and Arrow Lake H support in intel_pmc_core driver.

    Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
    Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com>
    Link: https://lore.kernel.org/r/20250207225615.401235-7-xi.pardee@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2025-04-03 11:24:48 -04:00
David Arcari 1c061f4203 platform/x86/intel/pmc: Remove simple init functions
JIRA: https://issues.redhat.com/browse/RHEL-20138

commit 45fa1a0d4d8759787bf62b49019952e2d56a66f9
Author: Xi Pardee <xi.pardee@linux.intel.com>
Date:   Fri Feb 7 14:56:10 2025 -0800

    platform/x86/intel/pmc: Remove simple init functions

    Remove simple init functions to avoid duplicate code. Store
    init function performing architecture specific action in the
    corresponding pmc_dev_info structure. Replace init function
    with pmc_dev_info structure in X86_MATCH_VFM() of core.c.

    Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com>
    Link: https://lore.kernel.org/r/20250207225615.401235-5-xi.pardee@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2025-04-03 11:24:48 -04:00
David Arcari 9d348937b3 platform/x86:intel/pmc: Create generic_core_init() for all platforms
JIRA: https://issues.redhat.com/browse/RHEL-20138

commit ac6bef0d54014cc010831ec86ac425f482a981ae
Author: Xi Pardee <xi.pardee@linux.intel.com>
Date:   Fri Feb 7 14:56:09 2025 -0800

    platform/x86:intel/pmc: Create generic_core_init() for all platforms

    Create a generic_core_init() function for all architectures to reduce
    duplicate code in each architecture file. Create an info structure
    to catch the variations between each architecture and pass it to the
    generic init function.

    Convert all architectures to call the generic core init function.

    Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com>
    Link: https://lore.kernel.org/r/20250207225615.401235-4-xi.pardee@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2025-04-03 11:24:48 -04:00
David Arcari 27da4c66e9 platform/x86/intel/pmc: Remove duplicate enum
JIRA: https://issues.redhat.com/browse/RHEL-20138

commit 78eaf4d12d7c4ec6cf2f5ed8d8737ae0da390930
Author: Xi Pardee <xi.pardee@linux.intel.com>
Date:   Fri Feb 7 14:56:08 2025 -0800

    platform/x86/intel/pmc: Remove duplicate enum

    Remove duplicate enum PMC_IDX_SOC. PMC_IDX_SOC has the same value
    as PMC_IDX_MAIN. Replace it with PMC_IDX_MAIN to avoid confusion.

    Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20250207225615.401235-3-xi.pardee@linux.intel.com
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2025-04-03 11:24:47 -04:00
David Arcari 1ac2870708 platform/x86:intel/pmc: Make tgl_core_generic_init() static
JIRA: https://issues.redhat.com/browse/RHEL-20138

commit db7155b5e3d6e808c9e888e76a8f95690964a456
Author: Xi Pardee <xi.pardee@linux.intel.com>
Date:   Fri Feb 7 14:56:07 2025 -0800

    platform/x86:intel/pmc: Make tgl_core_generic_init() static

    Make tgl_core_generic_init() a static function as the function has no
    callers outside of tgl.c. Remove the prototype in core.h and reorder
    the code in tgl.c.

    Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20250207225615.401235-2-xi.pardee@linux.intel.com
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2025-04-03 11:24:47 -04:00
David Arcari 28055d5622 platform/x86/intel: pmc: fix ltr decode in pmc_core_ltr_show()
JIRA: https://issues.redhat.com/browse/RHEL-79553

commit 583ef25bb2a094813351a727ddec38b35a15b9f8
Author: Dmitry Kandybka <d.kandybka@gmail.com>
Date:   Fri Jan 24 01:07:39 2025 +0300

    platform/x86/intel: pmc: fix ltr decode in pmc_core_ltr_show()

    In pmc_core_ltr_show(), promote 'val' to 'u64' to avoid possible integer
    overflow. Values (10 bit) are multiplied by the scale, the result of
    expression is in a range from 1 to 34,326,183,936 which is bigger then
    UINT32_MAX. Compile tested only.

    Found by Linux Verification Center (linuxtesting.org) with SVACE.

    Signed-off-by: Dmitry Kandybka <d.kandybka@gmail.com>
    Reviewed-by: Rajneesh Bhardwaj <irenic.rajneesh@gmail.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20250123220739.68087-1-d.kandybka@gmail.com
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2025-02-14 16:43:41 -05:00
David Arcari 310dfb7e59 platform/x86: intel/pmc: Fix ioremap() of bad address
JIRA: https://issues.redhat.com/browse/RHEL-79553

commit 1d7461d0c8330689117286169106af6531a747ed
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Mon Jan 6 09:46:52 2025 -0800

    platform/x86: intel/pmc: Fix ioremap() of bad address

    In pmc_core_ssram_get_pmc(), the physical addresses for hidden SSRAM
    devices are retrieved from the MMIO region of the primary SSRAM device.
    If additional devices are not present, the address returned is zero.
    Currently, the code does not check for this condition, resulting in
    ioremap() incorrectly attempting to map address 0.

    Add a check for a zero address and return 0 if no additional devices
    are found, as it is not an error for the device to be absent.

    Fixes: a01486dc4bb1 ("platform/x86/intel/pmc: Cleanup SSRAM discovery")
    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20250106174653.1497128-1-david.e.box@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2025-02-14 16:43:40 -05:00
David Arcari 1076531698 x86/tsc: Move away from TSC leaf magic numbers
JIRA: https://issues.redhat.com/browse/RHEL-79553

commit 030c15b5610cedf7eb428dab5382f73d492a7967
Author: Dave Hansen <dave.hansen@linux.intel.com>
Date:   Fri Dec 13 12:50:34 2024 -0800

    x86/tsc: Move away from TSC leaf magic numbers

    The TSC code has a bunch of hard-coded references to leaf 0x15.  Change
    them over to the symbolic name.  Also zap the 'ART_CPUID_LEAF' definition.
    It was a duplicate of 'CPUID_TSC_LEAF'.

    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Link: https://lore.kernel.org/all/20241213205034.B79D6224%40davehans-spike.ostc.intel.com

Signed-off-by: David Arcari <darcari@redhat.com>
2025-02-14 16:43:40 -05:00
David Arcari 93e953df54 platform/x86/intel/pmc: Disable C1 auto-demotion during suspend
JIRA: https://issues.redhat.com/browse/RHEL-66571

commit 7a797cc9f80915cc5f1a5aee46d14880eb444644
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Thu Oct 17 14:04:38 2024 -0700

    platform/x86/intel/pmc: Disable C1 auto-demotion during suspend

    On some platforms, aggressive C1 auto-demotion may lead to failure to enter
    the deepest C-state during suspend-to-idle, causing high power consumption.
    To prevent this, disable C1 auto-demotion during suspend and re-enable on
    resume.

    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Link: https://lore.kernel.org/r/20241017210439.3449324-2-david.e.box@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2025-01-03 09:53:09 -05:00
David Arcari bfacf60216 platform/x86/intel/pmc: Refactor platform resume functions to use cnl_resume()
JIRA: https://issues.redhat.com/browse/RHEL-66571

commit 9fe43c8020a60b9c9ff44c4a9914e7e7df63084e
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Thu Oct 17 14:04:37 2024 -0700

    platform/x86/intel/pmc: Refactor platform resume functions to use cnl_resume()

    Several platform resume functions currently call pmc_core_send_ltr_ignore()
    and pmc_core_resume_common(), both of which are already called by
    cnl_resume(). Simplify the code by having these functions call cnl_resume()
    directly.

    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Link: https://lore.kernel.org/r/20241017210439.3449324-1-david.e.box@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2025-01-03 09:53:08 -05:00
David Arcari 29933077da platform/x86/intel/pmc: Fix pmc_core_iounmap to call iounmap for valid addresses
CVE: CVE-2024-50107
JIRA: https://issues.redhat.com/browse/RHEL-65933
JIRA: https://issues.redhat.com/browse/RHEL-65816

commit 48771da48072823956b271dddd568492c13d8170
Author: Vamsi Krishna Brahmajosyula <vamsikrishna.brahmajosyula@gmail.com>
Date:   Fri Oct 18 16:19:58 2024 +0530

    platform/x86/intel/pmc: Fix pmc_core_iounmap to call iounmap for valid addresses

    Commit 50c6dbdfd16e ("x86/ioremap: Improve iounmap() address range checks")
    introduces a WARN when adrress ranges of iounmap are invalid. On Thinkpad
    P1 Gen 7 (Meteor Lake-P) this caused the following warning to appear:

    WARNING: CPU: 7 PID: 713 at arch/x86/mm/ioremap.c:461 iounmap+0x58/0x1f0
    Modules linked in: rfkill(+) snd_timer(+) fjes(+) snd soundcore intel_pmc_core(+)
    int3403_thermal(+) int340x_thermal_zone intel_vsec pmt_telemetry acpi_pad pmt_class
    acpi_tad int3400_thermal acpi_thermal_rel joydev loop nfnetlink zram xe drm_suballoc_helper
    nouveau i915 mxm_wmi drm_ttm_helper gpu_sched drm_gpuvm drm_exec drm_buddy i2c_algo_bit
    crct10dif_pclmul crc32_pclmul ttm crc32c_intel polyval_clmulni rtsx_pci_sdmmc ucsi_acpi
    polyval_generic mmc_core hid_multitouch drm_display_helper ghash_clmulni_intel typec_ucsi
    nvme sha512_ssse3 video sha256_ssse3 nvme_core intel_vpu sha1_ssse3 rtsx_pci cec typec
    nvme_auth i2c_hid_acpi i2c_hid wmi pinctrl_meteorlake serio_raw ip6_tables ip_tables fuse
    CPU: 7 UID: 0 PID: 713 Comm: (udev-worker) Not tainted 6.12.0-rc2iounmap+ #42
    Hardware name: LENOVO 21KWCTO1WW/21KWCTO1WW, BIOS N48ET19W (1.06 ) 07/18/2024
    RIP: 0010:iounmap+0x58/0x1f0
    Code: 85 6a 01 00 00 48 8b 05 e6 e2 28 04 48 39 c5 72 19 eb 26 cc cc cc 48 ba 00 00 00 00 00 00 32 00 48 8d 44 02 ff 48 39 c5 72 23 <0f> 0b 48 83 c4 08 5b 5d 41 5c c3 cc cc cc cc 48 ba 00 00 00 00 00
    RSP: 0018:ffff888131eff038 EFLAGS: 00010207
    RAX: ffffc90000000000 RBX: 0000000000000000 RCX: ffff888e33b80000
    RDX: dffffc0000000000 RSI: ffff888e33bc29c0 RDI: 0000000000000000
    RBP: 0000000000000000 R08: ffff8881598a8000 R09: ffff888e2ccedc10
    R10: 0000000000000003 R11: ffffffffb3367634 R12: 00000000fe000000
    R13: ffff888101d0da28 R14: ffffffffc2e437e0 R15: ffff888110b03b28
    FS:  00007f3c1d4b3980(0000) GS:ffff888e33b80000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00005651cfc93578 CR3: 0000000124e4c002 CR4: 0000000000f70ef0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000ffff07f0 DR7: 0000000000000400
    PKRU: 55555554
    Call Trace:
    <TASK>
    ? __warn.cold+0xb6/0x176
    ? iounmap+0x58/0x1f0
    ? report_bug+0x1f4/0x2b0
    ? handle_bug+0x58/0x90
    ? exc_invalid_op+0x17/0x40
    ? asm_exc_invalid_op+0x1a/0x20
    ? iounmap+0x58/0x1f0
    pmc_core_ssram_get_pmc+0x477/0x6c0 [intel_pmc_core]
    ? __pfx_pmc_core_ssram_get_pmc+0x10/0x10 [intel_pmc_core]
    ? __pfx_do_pci_enable_device+0x10/0x10
    ? pci_wait_for_pending+0x60/0x110
    ? pci_enable_device_flags+0x1e3/0x2e0
    ? __pfx_mtl_core_init+0x10/0x10 [intel_pmc_core]
    pmc_core_ssram_init+0x7f/0x110 [intel_pmc_core]
    mtl_core_init+0xda/0x130 [intel_pmc_core]
    ? __mutex_init+0xb9/0x130
    pmc_core_probe+0x27e/0x10b0 [intel_pmc_core]
    ? _raw_spin_lock_irqsave+0x96/0xf0
    ? __pfx_pmc_core_probe+0x10/0x10 [intel_pmc_core]
    ? __pfx_mutex_unlock+0x10/0x10
    ? __pfx_mutex_lock+0x10/0x10
    ? device_pm_check_callbacks+0x82/0x370
    ? acpi_dev_pm_attach+0x234/0x2b0
    platform_probe+0x9f/0x150
    really_probe+0x1e0/0x8a0
    __driver_probe_device+0x18c/0x370
    ? __pfx___driver_attach+0x10/0x10
    driver_probe_device+0x4a/0x120
    __driver_attach+0x190/0x4a0
    ? __pfx___driver_attach+0x10/0x10
    bus_for_each_dev+0x103/0x180
    ? __pfx_bus_for_each_dev+0x10/0x10
    ? klist_add_tail+0x136/0x270
    bus_add_driver+0x2fc/0x540
    driver_register+0x1a5/0x360
    ? __pfx_pmc_core_driver_init+0x10/0x10 [intel_pmc_core]
    do_one_initcall+0xa4/0x380
    ? __pfx_do_one_initcall+0x10/0x10
    ? kasan_unpoison+0x44/0x70
    do_init_module+0x296/0x800
    load_module+0x5090/0x6ce0
    ? __pfx_load_module+0x10/0x10
    ? ima_post_read_file+0x193/0x200
    ? __pfx_ima_post_read_file+0x10/0x10
    ? rw_verify_area+0x152/0x4c0
    ? kernel_read_file+0x257/0x750
    ? __pfx_kernel_read_file+0x10/0x10
    ? __pfx_filemap_get_read_batch+0x10/0x10
    ? init_module_from_file+0xd1/0x130
    init_module_from_file+0xd1/0x130
    ? __pfx_init_module_from_file+0x10/0x10
    ? __pfx__raw_spin_lock+0x10/0x10
    ? __pfx_cred_has_capability.isra.0+0x10/0x10
    idempotent_init_module+0x236/0x770
    ? __pfx_idempotent_init_module+0x10/0x10
    ? fdget+0x58/0x3f0
    ? security_capable+0x7d/0x110
    __x64_sys_finit_module+0xbe/0x130
    do_syscall_64+0x82/0x160
    ? __pfx_filemap_read+0x10/0x10
    ? __pfx___fsnotify_parent+0x10/0x10
    ? vfs_read+0x3a6/0xa30
    ? vfs_read+0x3a6/0xa30
    ? __seccomp_filter+0x175/0xc60
    ? __pfx___seccomp_filter+0x10/0x10
    ? fdget_pos+0x1ce/0x500
    ? syscall_exit_to_user_mode_prepare+0x149/0x170
    ? syscall_exit_to_user_mode+0x10/0x210
    ? do_syscall_64+0x8e/0x160
    ? switch_fpu_return+0xe3/0x1f0
    ? syscall_exit_to_user_mode+0x1d5/0x210
    ? do_syscall_64+0x8e/0x160
    ? exc_page_fault+0x76/0xf0
    entry_SYSCALL_64_after_hwframe+0x76/0x7e
    RIP: 0033:0x7f3c1d6d155d
    Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 83 58 0f 00 f7 d8 64 89 01 48
    RSP: 002b:00007ffe6309db38 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
    RAX: ffffffffffffffda RBX: 0000557c212550a0 RCX: 00007f3c1d6d155d
    RDX: 0000000000000000 RSI: 00007f3c1cd943bd RDI: 0000000000000025
    RBP: 00007ffe6309dbf0 R08: 00007f3c1d7c7b20 R09: 00007ffe6309db80
    R10: 0000557c21255270 R11: 0000000000000246 R12: 00007f3c1cd943bd
    R13: 0000000000020000 R14: 0000557c21255c80 R15: 0000557c21255240
    </TASK>

    no_free_ptr(tmp_ssram) sets tmp_ssram NULL while assigning ssram.
    pmc_core_iounmap calls iounmap unconditionally causing the above
    warning to appear during boot.

    Fix it by checking for a valid address before calling iounmap.

    Also in the function pmc_core_ssram_get_pmc return -ENOMEM when
    ioremap fails similar to other instances in the file.

    Fixes: a01486dc4bb1 ("platform/x86/intel/pmc: Cleanup SSRAM discovery")
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Reviewed-by: David E. Box <david.e.box@linux.intel.com>
    Signed-off-by: Vamsi Krishna Brahmajosyula <vamsikrishna.brahmajosyula@gmail.com>
    Link: https://lore.kernel.org/r/20241018104958.14195-1-vamsikrishna.brahmajosyula@gmail.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-11-05 16:21:15 -05:00
David Arcari 5668491b2b platform/x86:intel/pmc: Revert "Enable the ACPI PM Timer to be turned off when suspended"
JIRA: https://issues.redhat.com/browse/RHEL-65816

commit 5fa607880168d991bdc819f493a11155e935abe6
Author: Marek Maslanka <mmaslanka@google.com>
Date:   Sat Oct 12 18:26:55 2024 +0000

    platform/x86:intel/pmc: Revert "Enable the ACPI PM Timer to be turned off when suspended"

    Commit e86c8186d03a ("platform/x86:intel/pmc: Enable the ACPI PM Timer to
    be turned off when suspended") can cause the suspend process to hang as
    the pmcdev->lock in the pmc_core_acpi_pm_timer_suspend_resume might already
    be held by the pmc_core_mphy_pg_show or pmc_core_pll_show if the userspace
    gets frozen when these functions are being executed.

    Also, pmc_core_acpi_pm_timer_suspend_resume must not sleep, as this
    function is called indirectly by the tick_freeze function in
    kernel/time/tick-common.c, which holds the spinlock.

    Revert the changes for now to fix these issues.

    Fixes: e86c8186d03a ("platform/x86:intel/pmc: Enable the ACPI PM Timer to be turned off when suspended")
    Reported-by: Luca Coelho <luca@coelho.fi>
    Closes: https://lore.kernel.org/lkml/40555604c3f4be43bf72e72d5409eaece4be9320.camel@coelho.fi/
    Signed-off-by: Marek Maslanka <mmaslanka@google.com>
    Link: https://lore.kernel.org/r/20241012182656.2107178-1-mmaslanka@google.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-11-05 08:58:27 -05:00
David Arcari 3871e480ac platform/x86:intel/pmc: Disable ACPI PM Timer disabling on Sky and Kaby Lake
JIRA: https://issues.redhat.com/browse/RHEL-65816

commit 0bdb4e57a1b0622685e6973321d7c417fb386b42
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Thu Oct 3 22:26:13 2024 +0200

    platform/x86:intel/pmc: Disable ACPI PM Timer disabling on Sky and Kaby Lake

    There have been multiple reports that the ACPI PM Timer disabling is
    causing Sky and Kaby Lake systems to hang on all suspend (s2idle, s3,
    hibernate) methods.

    Remove the acpi_pm_tmr_ctl_offset and acpi_pm_tmr_disable_bit settings from
    spt_reg_map to disable the ACPI PM Timer disabling on Sky and Kaby Lake to
    fix the hang on suspend.

    Fixes: e86c8186d03a ("platform/x86:intel/pmc: Enable the ACPI PM Timer to be turned off when suspended")
    Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
    Closes: https://lore.kernel.org/linux-pm/18784f62-91ff-4d88-9621-6c88eb0af2b5@molgen.mpg.de/
    Reported-by: Todd Brandt <todd.e.brandt@intel.com>
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219346
    Cc: Marek Maslanka <mmaslanka@google.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Tested-by: Todd Brandt <todd.e.brandt@intel.com>
    Tested-by: Paul Menzel <pmenzel@molgen.mpg.de> # Dell XPS 13 9360/0596KF
    Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Link: https://lore.kernel.org/r/20241003202614.17181-2-hdegoede@redhat.com

Signed-off-by: David Arcari <darcari@redhat.com>
2024-11-05 08:53:14 -05:00
David Arcari 0118637ed9 platform/x86: intel/pmc: Ignore all LTRs during suspend
JIRA: https://issues.redhat.com/browse/RHEL-65816

commit cedf233530cc375343c5a0b612fe94392f246c99
Author: Xi Pardee <xi.pardee@intel.com>
Date:   Fri Sep 6 11:40:03 2024 -0700

    platform/x86: intel/pmc: Ignore all LTRs during suspend

    Add support to ignore all LTRs before suspend and restore the previous
    LTR values after suspend. This feature could be turned off with module
    parameter ltr_ignore_all_suspend.

    LTR value is a mechanism for a device to indicate tolerance to access
    the corresponding resource. When system suspends, the resource is not
    available and therefore the LTR value could be ignored. Ignoring all
    LTR values prevents problematic device from blocking the system to get
    to the deepest package state during suspend.

    Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    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/20240906184016.268153-1-xi.pardee@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-11-05 08:53:14 -05:00
David Arcari 2a2f46ff33 platform/x86:intel/pmc: Fix comment for the pmc_core_acpi_pm_timer_suspend_resume function
JIRA: https://issues.redhat.com/browse/RHEL-65816

commit 2376d871f8552aadea19f5bc0b1370db54a3a5f2
Author: Marek Maslanka <mmaslanka@google.com>
Date:   Wed Sep 4 09:47:53 2024 +0000

    platform/x86:intel/pmc: Fix comment for the pmc_core_acpi_pm_timer_suspend_resume function

    Change incorrect kernel-doc comment to regular comment for the
    pmc_core_acpi_pm_timer_suspend_resume function.

    Signed-off-by: Marek Maslanka <mmaslanka@google.com>
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202409031410.a9beukFc-lkp@intel.com/
    Link: https://lore.kernel.org/r/20240904094753.1615549-1-mmaslanka@google.com
    Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-11-05 08:53:14 -05:00
David Arcari 52cbe18844 platform/x86:intel/pmc: Enable the ACPI PM Timer to be turned off when suspended
JIRA: https://issues.redhat.com/browse/RHEL-65816

commit e86c8186d03a6ba018e881ed45f0962ad553e861
Author: Marek Maslanka <mmaslanka@google.com>
Date:   Mon Aug 12 18:42:00 2024 +0000

    platform/x86:intel/pmc: Enable the ACPI PM Timer to be turned off when suspended

    Allow to disable ACPI PM Timer on suspend and enable on resume. A
    disabled timer helps optimise power consumption when the system is
    suspended. On resume the timer is only reactivated if it was activated
    prior to suspend, so unless the ACPI PM timer is enabled in the BIOS,
    this won't change anything.

    The ACPI PM timer is used by Intel's iTCO/wdat_wdt watchdog to drive the
    watchdog, so it doesn't need to run during suspend.

    Signed-off-by: Marek Maslanka <mmaslanka@google.com>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Link: https://lore.kernel.org/r/20240812184208.1080710-1-mmaslanka@google.com
    Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-11-05 08:53:14 -05:00
David Arcari f7e9849505 platform/x86: intel/pmc: Remove unused param idx from pmc_for_each_mode()
JIRA: https://issues.redhat.com/browse/RHEL-65816

commit e35ee8ee498d68de24e6a831ff5d33665b41a802
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Tue Aug 6 11:30:47 2024 +0300

    platform/x86: intel/pmc: Remove unused param idx from pmc_for_each_mode()

    pmc_for_each_mode() takes i (index) variable name as a parameter but
    the loop index is not used by any of the callers. Make the index
    variable internal to pmc_for_each_mode().

    This also changes the loop logic such that ->lpm_en_modes[] is never
    read beyond num_lpm_modes.

    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20240806083047.1562-1-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>
2024-11-05 08:53:14 -05:00
David Arcari bd38684648 platform/x86/intel/vsec.h: Move to include/linux
JIRA: https://issues.redhat.com/browse/RHEL-65816

commit fc9aef4382c02774662da3d7e1de8ba224e04f80
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Thu Jul 25 08:23:40 2024 -0400

    platform/x86/intel/vsec.h: Move to include/linux

    Some drivers outside of PDX86 need access to the vsec header. Move it to
    include/linux to make it easier to include.

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

Signed-off-by: David Arcari <darcari@redhat.com>
2024-11-05 08:53:14 -05:00
David Arcari 4a23c048df platform/x86/intel/pmc: Show live substate requirements
JIRA: https://issues.redhat.com/browse/RHEL-65816

commit a6fe07ce522a9f6242161ec516d46234c124c35f
Author: Kane Chen <kane.chen@intel.com>
Date:   Fri Jul 19 20:28:07 2024 +0800

    platform/x86/intel/pmc: Show live substate requirements

    While debugging runtime s0ix, we do need to check which required IPs
    are not power gated. This patch adds code to show live substate status
    vs requirements in sys/kernel/debug/pmc_core/substate_requirements to
    help runtime s0ix debug.

    Signed-off-by: Kane Chen <kane.chen@intel.com>
    Link: https://lore.kernel.org/r/20240719122807.3853292-1-kane.chen@intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-11-05 08:53:14 -05:00
David Arcari 99a973b883 platform/x86:intel/pmc: Add support to undo ltr_ignore
JIRA: https://issues.redhat.com/browse/RHEL-65816

commit 4dea807fa7e75275efa75f4d6caa72a082f3c86d
Author: Xi Pardee <xi.pardee@linux.intel.com>
Date:   Mon Jun 24 13:32:18 2024 -0700

    platform/x86:intel/pmc: Add support to undo ltr_ignore

    Add ltr_restore support to undo the ltr_ignore action. It sets the
    ltr_ignore bit of the corresponding IP to 0. Ltr_restore reuses some
    functionality of pmc_core_ltr_ignore_write() so moved the common
    functionality into a helper function.

    Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com>
    Link: https://lore.kernel.org/r/20240624203218.2428475-10-xi.pardee@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-11-05 08:53:13 -05:00
David Arcari 397167b81d platform/x86:intel/pmc: Use the Elvis operator
JIRA: https://issues.redhat.com/browse/RHEL-65816

commit 9e7f1e71561899e669ecc205e56027960c37a50c
Author: Xi Pardee <xi.pardee@linux.intel.com>
Date:   Mon Jun 24 13:32:17 2024 -0700

    platform/x86:intel/pmc: Use the Elvis operator

    Replace ternary operator with Elvis operator in
    pmc_core_ltr_ignore_write() for better readability
    of the code.

    Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com>
    Link: https://lore.kernel.org/r/20240624203218.2428475-9-xi.pardee@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-11-05 08:53:13 -05:00
David Arcari 6dbf618df1 platform/x86:intel/pmc: Use DEFINE_SHOW_STORE_ATTRIBUTE macro
JIRA: https://issues.redhat.com/browse/RHEL-65816

commit 590a87fe36f1aa43e2d145a0b16d223f2f374899
Author: Xi Pardee <xi.pardee@linux.intel.com>
Date:   Mon Jun 24 13:32:16 2024 -0700

    platform/x86:intel/pmc: Use DEFINE_SHOW_STORE_ATTRIBUTE macro

    DEFINE_SHOW_STORE_ATTRIBUTE() macro can be used for the ltr_ignore
    attribute for better readability.

    Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com>
    Link: https://lore.kernel.org/r/20240624203218.2428475-8-xi.pardee@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-11-05 08:53:13 -05:00
David Arcari df5e9e3505 platform/x86:intel/pmc: Remove unneeded min_t check
JIRA: https://issues.redhat.com/browse/RHEL-65816

commit 97eb32b0ff3917ab4ec2745aafc318042c95e4a7
Author: Xi Pardee <xi.pardee@linux.intel.com>
Date:   Mon Jun 24 13:32:15 2024 -0700

    platform/x86:intel/pmc: Remove unneeded min_t check

    min_t() check is not needed in pmc_core_ltr_ignore_write().
    kstrtox() has a built-in overflow check.

    Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com>
    Link: https://lore.kernel.org/r/20240624203218.2428475-7-xi.pardee@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-11-05 08:53:13 -05:00
David Arcari 0372dbfca2 platform/x86:intel/pmc: Add support to show ltr_ignore value
JIRA: https://issues.redhat.com/browse/RHEL-65816

commit 438aef8270579d4f8dee976709f015deb084e665
Author: Xi Pardee <xi.pardee@intel.com>
Date:   Mon Jun 24 13:32:14 2024 -0700

    platform/x86:intel/pmc: Add support to show ltr_ignore value

    Add a column in ltr_show output to show if the IP has been ignored.
    A mutex lock is used to protect the critical section as other processes
    might try to write to the LTR ignore register at the same time.

    Signed-off-by: Xi Pardee <xi.pardee@intel.com>
    Link: https://lore.kernel.org/r/20240624203218.2428475-6-xi.pardee@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-11-05 08:53:13 -05:00
David Arcari e77c341be8 platform/x86:intel/pmc: Move pmc assignment closer to first usage
JIRA: https://issues.redhat.com/browse/RHEL-65816

commit 4455e2b1c80cd0838d8883b18022e5bafdf2d1f4
Author: Xi Pardee <xi.pardee@linux.intel.com>
Date:   Mon Jun 24 13:32:13 2024 -0700

    platform/x86:intel/pmc: Move pmc assignment closer to first usage

    Move pmc variable assignment closer to the conditional statement of
    its first use for better readability.

    Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com>
    Link: https://lore.kernel.org/r/20240624203218.2428475-5-xi.pardee@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-11-05 08:53:13 -05:00
David Arcari f8c221604c platform/x86:intel/pmc: Convert index variables to be unsigned
JIRA: https://issues.redhat.com/browse/RHEL-65816

commit a57a94d185004013e05734ffb626b0341742f9fb
Author: Xi Pardee <xi.pardee@intel.com>
Date:   Mon Jun 24 13:32:12 2024 -0700

    platform/x86:intel/pmc: Convert index variables to be unsigned

    Convert the index variables type to unsigned to avoid confusion and
    errors.

    Signed-off-by: Xi Pardee <xi.pardee@intel.com>
    Link: https://lore.kernel.org/r/20240624203218.2428475-4-xi.pardee@linux.intel.com
    [ij: Converted also pmc_core_lpm_get_arr_size() to return unsigned int]
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-11-05 08:53:13 -05:00
David Arcari c149b3ee55 platform/x86:intel/pmc: Simplify mutex usage with cleanup helpers
JIRA: https://issues.redhat.com/browse/RHEL-65816

commit 6d413a1f60fb2417061e8f26124f6bc41e09e504
Author: Xi Pardee <xi.pardee@intel.com>
Date:   Mon Jun 24 13:32:11 2024 -0700

    platform/x86:intel/pmc: Simplify mutex usage with cleanup helpers

    Use macros defined in cleanup.h to automate the mutex lock/unlock flow.

    Signed-off-by: Xi Pardee <xi.pardee@intel.com>
    Link: https://lore.kernel.org/r/20240624203218.2428475-3-xi.pardee@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-11-05 08:53:13 -05:00
David Arcari 056aaa9c92 platform/x86:intel/pmc: Use the return value of pmc_core_send_msg
JIRA: https://issues.redhat.com/browse/RHEL-65816

commit 40fdf3f623041eda2a8f825d0ccd4c18f8571ffb
Author: Xi Pardee <xi.pardee@intel.com>
Date:   Mon Jun 24 13:32:10 2024 -0700

    platform/x86:intel/pmc: Use the return value of pmc_core_send_msg

    Use the return value of pmc_core_send_msg() directly instead of
    assigning another code when an error occurs.

    Signed-off-by: Xi Pardee <xi.pardee@intel.com>
    Link: https://lore.kernel.org/r/20240624203218.2428475-2-xi.pardee@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-11-05 08:53:13 -05:00
David Arcari 6a4b7926ac platform/x86/intel: add missing MODULE_DESCRIPTION() macros
JIRA: https://issues.redhat.com/browse/RHEL-65816

commit 41ab81ce8490b9cad88e87c49315fb8c46208be7
Author: Jeff Johnson <quic_jjohnson@quicinc.com>
Date:   Tue Jun 11 21:56:26 2024 -0700

    platform/x86/intel: add missing MODULE_DESCRIPTION() macros

    With ARCH=x86, make allmodconfig && make W=1 C=1 reports:
    WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/platform/x86/intel/pmc/intel_pmc_core_pltdrv.o
    WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/platform/x86/intel/intel-hid.o
    WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/platform/x86/intel/intel-vbtn.o
    WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/platform/x86/intel/intel-rst.o
    WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/platform/x86/intel/intel-smartconnect.o

    Add the missing invocations of the MODULE_DESCRIPTION() macro.

    Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
    Link: https://lore.kernel.org/r/20240611-md-drivers-platform-x86-intel-v1-1-5ed967425b04@quicinc.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-11-05 08:53:13 -05:00
David Arcari 6ae7e7adc8 platform/x86/intel/pmc: Switch to new Intel CPU model defines
JIRA: https://issues.redhat.com/browse/RHEL-65816

commit 33af65ad67495e61e5008beb1f7fbede22f85318
Author: Tony Luck <tony.luck@intel.com>
Date:   Fri May 31 13:36:57 2024 -0700

    platform/x86/intel/pmc: Switch to new Intel CPU model defines

    New CPU #defines encode vendor and family as well as model.

    Signed-off-by: Tony Luck <tony.luck@intel.com>
    Acked-by: Hans de Goede <hdegoede@redhat.com>
    Link: https://lore.kernel.org/r/20240531203706.233365-2-tony.luck@intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-11-05 08:53:13 -05:00
Steve Best b349666679 platform/x86:intel/pmc: Enable S0ix blocker show in Lunar Lake
JIRA: https://issues.redhat.com/browse/RHEL-46817

commit 86cc9c70fb6a881a92e51017438ed84d46010471
Author: Xi Pardee <xi.pardee@intel.com>
Date:   Thu Apr 25 17:27:52 2024 -0700

    platform/x86:intel/pmc: Enable S0ix blocker show in Lunar Lake

    Update Lunar Lake lpm maps to include S0ix blocker information.
    Add Lunar Lake blocker maps to enable S0ix blocker show in pmc
    core debugfs.

    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/20240426002752.2504282-4-xi.pardee@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: Steve Best <sbest@redhat.com>
2024-07-09 22:00:11 -04:00
Steve Best 6952f5d23a platform/x86:intel/pmc: Update LNL signal status map
JIRA: https://issues.redhat.com/browse/RHEL-46817

commit 4f3eec14729eced6ef5ef7242b63ca14377d87fe
Author: Xi Pardee <xi.pardee@intel.com>
Date:   Thu Apr 25 17:27:50 2024 -0700

    platform/x86:intel/pmc: Update LNL signal status map

    Update Lunar Lake signal status map. This status map has been updated
    since the map was merged. This patch updates the signal status map to
    the lastest version.

    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/20240426002752.2504282-2-xi.pardee@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: Steve Best <sbest@redhat.com>
2024-07-09 22:00:03 -04:00
Steve Best a2b31a4175 platform/x86:intel/pmc: Add support to show S0ix blocker counter
JIRA: https://issues.redhat.com/browse/RHEL-46817

commit d8dc1b95dec9586dacfc3963c94b3f89c8a95a2b
Author: Xi Pardee <xi.pardee@intel.com>
Date:   Thu Apr 25 17:27:51 2024 -0700

    platform/x86:intel/pmc: Add support to show S0ix blocker counter

    S0ix blocker counter is available in PWRM space. Add support to
    read and show S0ix blocker counter value through debugfs.

    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/20240426002752.2504282-3-xi.pardee@linux.intel.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: Steve Best <sbest@redhat.com>
2024-07-09 21:59:58 -04:00
Steve Best 4aed6b8e1b platform/x86/intel/pmc: Fix PCH names in comments
JIRA: https://issues.redhat.com/browse/RHEL-46817

commit f1f663ebfbec349118c41a5563aa266953200058
Author: Colin Ian King <colin.i.king@gmail.com>
Date:   Thu Apr 18 22:52:02 2024 +0100

    platform/x86/intel/pmc: Fix PCH names in comments

    The PCH names in the pmc drivers are incorrect in the comments,
    fix these.

    Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
    Link: https://lore.kernel.org/r/20240418215202.879171-1-colin.i.king@gmail.com
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: Steve Best <sbest@redhat.com>
2024-07-09 21:59:52 -04:00
Steve Best bcd25ed078 platform/x86/intel/pmc: Improve PKGC residency counters debug
JIRA: https://issues.redhat.com/browse/RHEL-46817

commit 16f8091b49175f327120cdbbdde135d38a853ae1
Author: Kane Chen <kane.chen@intel.com>
Date:   Fri Mar 8 11:31:27 2024 +0800

    platform/x86/intel/pmc: Improve PKGC residency counters debug

    The current code only prints PKGC-10 residency when the PKGC-10
    is not reached in previous 'freeze' attempt. To debug PKGC-10 issues, we
    also need to know other PKGC residency counters to better triage issues.
    Ex:
    1. When system is stuck in PC2, it can be caused short LTR from device.
    2. When system is stuck in PC8, it can be caused by display engine.

    To better triage issues, all PKGC residency are needed when issues happen.

    Example log:
     CPU did not enter Package C10!!! (Package C10 cnt=0x0)
     Prev Package C2 cnt = 0x2191a325de, Current Package C2 cnt = 0x21aba30724
     Prev Package C3 cnt = 0x0, Current Package C3 cnt = 0x0
     Prev Package C6 cnt = 0x0, Current Package C6 cnt = 0x0
     Prev Package C7 cnt = 0x0, Current Package C7 cnt = 0x0
     Prev Package C8 cnt = 0x0, Current Package C8 cnt = 0x0
     Prev Package C9 cnt = 0x0, Current Package C9 cnt = 0x0
     Prev Package C10 cnt = 0x0, Current Package C10 cnt = 0x0

    With this log, we can know whether it's a stuck PC2 issue, and we can
    check whether the short LTR from device causes the issue.

    Signed-off-by: Kane Chen <kane.chen@intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20240308033127.1013053-1-kane.chen@intel.com
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: Steve Best <sbest@redhat.com>
2024-07-09 21:59:47 -04:00
Steve Best 574994f82b platform/x86/intel/pmc/arl: Put GNA device in D3
JIRA: https://issues.redhat.com/browse/RHEL-46817

commit ac2d1fd9688fcdfba5acc815fb2b13fec83e5dad
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Tue Feb 27 11:01:34 2024 -0800

    platform/x86/intel/pmc/arl: Put GNA device in D3

    As is the case on Meteor Lake, the Gaussian & Neural Accelerator (GNA)
    device is powered by BIOS to D0 by default. If no driver is loaded, this
    will cause the Package C state to be limited to PC2, leading to
    significant power consumption and decrease in batter life.  Put the GNA
    device in D3 by default if no driver is loaded for it.

    Fixes: 83f168a1a437 ("platform/x86/intel/pmc: Add Arrow Lake S support to intel_pmc_core driver")
    Signed-off-by: "David E. Box" <david.e.box@linux.intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
    Link: https://lore.kernel.org/r/20240227190134.1592072-3-david.e.box@linux.intel.com
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: Steve Best <sbest@redhat.com>
2024-07-09 21:59:42 -04:00
David Arcari 5e4a87a7cd platform/x86/intel/pmc/lnl: Remove SSRAM support
JIRA: https://issues.redhat.com/browse/RHEL-27144

commit e6ba4acde44957dc9bdc3222b5739217a102752d
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Tue Feb 27 11:01:33 2024 -0800

    platform/x86/intel/pmc/lnl: Remove SSRAM support

    A recent PMC firmware change in Lunar Lake caused the pmc_core driver to
    fail to probe. This is due to a change in the GUID for PMC telemetry coming
    from the SSRAM device. Until a final release is ready this value may
    change again. In the meantime, disable the SSRAM support for Lunar Lake so
    the driver can load and provide some basic functionality.

    Fixes: 3748dfdae2a6 ("platform/x86/intel/pmc: Add Lunar Lake M support to intel_pmc_core driver")
    Signed-off-by: "David E. Box" <david.e.box@linux.intel.com>
    Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20240227190134.1592072-2-david.e.box@linux.intel.com
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-05-21 11:38:15 -04:00
David Arcari d71cf01e30 platform/x86/intel/pmc: Add missing extern
JIRA: https://issues.redhat.com/browse/RHEL-15539

commit 669f157fd7ad987dd5beba46576ec357f4d6c686
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Fri Dec 22 19:25:48 2023 -0800

    platform/x86/intel/pmc: Add missing extern

    Add missing extern for tgl_h_reg_map. Fixes sparse warning:

      drivers/platform/x86/intel/pmc/tgl.c:213:26: warning: symbol 'tgl_h_reg_map' was not declared. Should it be static?

    Fixes: 544f7b7f651c ("platform/x86/intel/pmc: Add regmap for Tiger Lake H PCH")
    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20231223032548.1680738-9-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>
2024-01-10 10:02:25 -05:00
David Arcari 4362b82a08 platform/x86/intel/pmc/lnl: Add GBE LTR ignore during suspend
JIRA: https://issues.redhat.com/browse/RHEL-15539

commit 6f9fac5535ba2038063c656f0afb496d7f87bcc1
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Fri Dec 22 19:25:47 2023 -0800

    platform/x86/intel/pmc/lnl: Add GBE LTR ignore during suspend

    Add the GBE LTR ignore suspend time fix for Lunar Lake.

    Fixes: 119652b855e6 ("platform/x86/intel/pmc: Add Lunar Lake M support to intel_pmc_core driver")
    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20231223032548.1680738-8-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>
2024-01-10 10:02:25 -05:00
David Arcari 7e17e095c1 platform/x86/intel/pmc/arl: Add GBE LTR ignore during suspend
JIRA: https://issues.redhat.com/browse/RHEL-15539

commit 10ed9ee0af5a6cab8b36b301865417a288179b06
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Fri Dec 22 19:25:46 2023 -0800

    platform/x86/intel/pmc/arl: Add GBE LTR ignore during suspend

    Add the GBE LTR ignore suspend time fix for Arrow Lake.

    Fixes: f34dcf397286 ("platform/x86/intel/pmc: Add Arrow Lake S support to intel_pmc_core driver")
    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20231223032548.1680738-7-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>
2024-01-10 10:02:25 -05:00
David Arcari 2e73e3dbd4 platform/x86/intel/pmc: Move GBE LTR ignore to suspend callback
JIRA: https://issues.redhat.com/browse/RHEL-15539
Conflicts: Out of order upstream commits (merge 2ad815797ef0)

commit 70681aa0746ae61d7668b9f651221fad5e30c71e
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Fri Dec 22 19:25:45 2023 -0800

    platform/x86/intel/pmc: Move GBE LTR ignore to suspend callback

    Commit 804951203aa5 ("platform/x86:intel/pmc: Combine core_init() and
    core_configure()") caused a network performance regression due to the GBE
    LTR ignore that it added at probe. This was needed in order to allow the
    SoC to enter the deepest Package C state. To fix the regression and at
    least support PC10 during suspend, move the LTR ignore from probe to the
    suspend callback, and enable it again on resume. This solution will allow
    PC10 during suspend but restrict Package C entry at runtime to no deeper
    than PC8/9 while a network cable it attach to the PCH LAN.

    Fixes: 804951203aa5 ("platform/x86:intel/pmc: Combine core_init() and core_configure()")
    Signed-off-by: "David E. Box" <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20231223032548.1680738-6-david.e.box@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@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 10:01:48 -05:00
David Arcari d5f1a114dd platform/x86/intel/pmc: Allow reenabling LTRs
JIRA: https://issues.redhat.com/browse/RHEL-15539

commit 6f9cc5c1f94daa98846b2073733d03ced709704b
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Fri Dec 22 19:25:44 2023 -0800

    platform/x86/intel/pmc: Allow reenabling LTRs

    Commit 804951203aa5 ("platform/x86:intel/pmc: Combine core_init() and
    core_configure()") caused a network performance regression due to the GBE
    LTR ignore that it added during probe. The fix will move the ignore to
    occur at suspend-time (so as to not affect suspend power). This will
    require the ability to enable the LTR again on resume. Modify
    pmc_core_send_ltr_ignore() to allow enabling an LTR.

    Fixes: 804951203aa5 ("platform/x86:intel/pmc: Combine core_init() and core_configure()")
    Signed-off-by: "David E. Box" <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20231223032548.1680738-5-david.e.box@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@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:40:05 -05:00
David Arcari f6b03bb677 platform/x86/intel/pmc: Add suspend callback
JIRA: https://issues.redhat.com/browse/RHEL-15539

commit 7c13f365aee68b01e7e68ee293a71fdc7571c111
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Fri Dec 22 19:25:43 2023 -0800

    platform/x86/intel/pmc: Add suspend callback

    Add a suspend callback to struct pmc for performing platform specific tasks
    before device suspend. This is needed in order to perform GBE LTR ignore on
    certain platforms at suspend-time instead of at probe-time and replace the
    GBE LTR ignore removal that was done in order to fix a bug introduced by
    commit 804951203aa5 ("platform/x86:intel/pmc: Combine core_init() and
    core_configure()").

    Fixes: 804951203aa5 ("platform/x86:intel/pmc: Combine core_init() and core_configure()")
    Signed-off-by: "David E. Box" <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20231223032548.1680738-4-david.e.box@linux.intel.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@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:59 -05:00
David Arcari 8c42578658 platform/x86/intel/pmc: Add Lunar Lake M support to intel_pmc_core driver
JIRA: https://issues.redhat.com/browse/RHEL-15539

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

    platform/x86/intel/pmc: Add Lunar Lake M support to intel_pmc_core driver

    Add Lunar Lake M support in intel_pmc_core driver

    Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
    Link: https://lore.kernel.org/r/20231219042216.2592029-8-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:57 -05:00
David Arcari b1fdc33665 platform/x86/intel/pmc: Add Arrow Lake S support to intel_pmc_core driver
JIRA: https://issues.redhat.com/browse/RHEL-15539

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

    platform/x86/intel/pmc: Add Arrow Lake S support to intel_pmc_core driver

    Add Arrow Lake S support in intel_pmc_core driver

    Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
    Link: https://lore.kernel.org/r/20231219042216.2592029-7-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:54 -05:00
David Arcari 3acf15dfee platform/x86/intel/pmc: Add ssram_init flag in PMC discovery in Meteor Lake
JIRA: https://issues.redhat.com/browse/RHEL-15539

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

    platform/x86/intel/pmc: Add ssram_init flag in PMC discovery in Meteor Lake

    If PMC discovery using pmc_core_ssram_init() was unsuccessful for the
    Meteor Lake platform, the legacy enumeration method is used. In this
    case pci device struct for the PMC SSRAM is not available
    and pmc_core_ssram_get_lpm_reqs() will not work. Add ssram_init flag to
    indicate if the PMC SSRAM initialization was successful or not. Call
    pmc_core_ssram_get_lpm_reqs() only if the ssram_init flag is set to true.

    Signed-off-by: Rajvi Jingar <rajvi.jingar@linux.intel.com>
    Link: https://lore.kernel.org/r/20231219042216.2592029-6-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