Commit Graph

12 Commits

Author SHA1 Message Date
David Arcari 15e72ddfb0 platform/x86/intel/pmt: allow user offset for PMT callbacks
JIRA: https://issues.redhat.com/browse/RHEL-79553

commit 0c32840763b1579c923b4216c18bb756ca4ba473
Author: Michael J. Ruhl <michael.j.ruhl@intel.com>
Date:   Thu Nov 14 08:03:57 2024 -0500

    platform/x86/intel/pmt: allow user offset for PMT callbacks

    Usage of the telem sysfs file allows for partial reads at an offset.
    The current callback method returns the buffer starting from offset 0
    only.

    Include the requested offset in the callback and update the necessary
    address calculations with the offset.

    Note: offset addition is moved from the caller to the local usage. For
    non-callback usage this is unchanged behavior.

    Fixes: e92affc74cd8 ("platform/x86/intel/vsec: Add PMT read callbacks")
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
    Link: https://lore.kernel.org/r/20241114130358.2467787-2-michael.j.ruhl@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 a618a220fc platform/x86/intel/pmt: Use PMT callbacks
JIRA: https://issues.redhat.com/browse/RHEL-65816

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

    platform/x86/intel/pmt: Use PMT callbacks

    PMT providers may require device specific actions before their telemetry
    may be read. If the read_telem() is assigned, call it instead of
    memcpy_fromio() and return. Since this needs to be done in multiple
    locations, add pmt_telem_read_mmio() as a wrapper function to perform this
    and any other needed checks.

    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-4-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 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 ead58f2cbb platform/x86/intel/pmt: telemetry: Export API to read telemetry
JIRA: https://issues.redhat.com/browse/RHEL-15539

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

    platform/x86/intel/pmt: telemetry: Export API to read telemetry

    Export symbols to allow access to Intel PMT Telemetry data on available
    devices. Provides APIs to search, register, and read telemetry using a
    kref managed pointer that serves as a handle to a telemetry endpoint.
    To simplify searching for present devices, have the IDA start at 1
    instead of 0 so that 0 can be used to indicate end of search.

    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-11-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 10:01:42 -05:00
David Arcari 7c7474ec6e platform/x86/intel/pmt: Add header to struct intel_pmt_entry
JIRA: https://issues.redhat.com/browse/RHEL-15539

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

    platform/x86/intel/pmt: Add header to struct intel_pmt_entry

    The PMT header is passed to several functions. Instead, store the header in
    struct intel_pmt_entry which is also passed to these functions and shorten
    the argument list. This simplifies the calls in preparation for later
    changes. While here also perform a newline cleanup.

    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-10-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 10:01:09 -05:00
David Arcari 7a219bbafe platform/x86/intel/pmt: Ignore uninitialized entries
JIRA: https://issues.redhat.com/browse/RHEL-19678

commit 3f581602a22cc5445a66501fa13a80894d83e42a
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Wed Apr 12 18:29:22 2023 -0700

    platform/x86/intel/pmt: Ignore uninitialized entries

    On Intel Xeon, unused PMT regions will have uninitialized discovery headers
    containing all 0xF. Instead of returning an error, just skip the region.

    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/20230413012922.1521377-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-12-18 07:43:34 -05:00
David Arcari 359d10a40d platform/x86/intel/pmt: Add INTEL_PMT module namespace
JIRA: https://issues.redhat.com/browse/RHEL-19678

commit d908084385a41cfdb82dca6ab4086e3f1a9dd4ae
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Thu Mar 16 15:57:35 2023 -0700

    platform/x86/intel/pmt: Add INTEL_PMT module namespace

    Since the currently exported symbols in pmt_class are only used by other
    Intel PMT drivers, create an INTEL_PMT module namespace for them.

    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
    Link: https://lore.kernel.org/r/20230316225736.2856521-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-12-18 07:43:30 -05:00
David Arcari 373b41d1cb platform/x86/intel/pmt: telemetry: Fix fixed region handling
Bugzilla: https://bugzilla.redhat.com/2076745

commit ba7e421eee0f98fb2f6aedc83bc5231df64556a1
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Wed Jun 29 15:13:33 2022 -0700

    platform/x86/intel/pmt: telemetry: Fix fixed region handling

    Use the telem_type and the fixed block guid to determine if an entry is a
    fixed region. For certain platforms we don't support this.

    Cc: Srinivas Pandruvada <srinivas.pandruvada@intel.com>
    Signed-off-by: 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/20220629221334.434307-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>
2022-09-06 09:07:39 -04:00
David Arcari 11be049cd9 platform/x86/intel: Fix 'rmmod pmt_telemetry' panic
Bugzilla: https://bugzilla.redhat.com/2080320

commit 2cdfa0c20d58da3757054797c2974c967035926a
Author: Prarit Bhargava <prarit@redhat.com>
Date:   Fri Apr 29 08:23:22 2022 -0400

    platform/x86/intel: Fix 'rmmod pmt_telemetry' panic

    'rmmod pmt_telemetry' panics with:

     BUG: kernel NULL pointer dereference, address: 0000000000000040
     #PF: supervisor read access in kernel mode
     #PF: error_code(0x0000) - not-present page
     PGD 0 P4D 0
     Oops: 0000 [#1] PREEMPT SMP NOPTI
     CPU: 4 PID: 1697 Comm: rmmod Tainted: G S      W        --------  ---  5.18.0-rc4 #3
     Hardware name: Intel Corporation Alder Lake Client Platform/AlderLake-P DDR5 RVP, BIOS ADLPFWI1.R00.3056.B00.2201310233 01/31/2022
     RIP: 0010:device_del+0x1b/0x3d0
     Code: e8 1a d9 e9 ff e9 58 ff ff ff 48 8b 08 eb dc 0f 1f 44 00 00 41 56 41 55 41 54 55 48 8d af 80 00 00 00 53 48 89 fb 48 83 ec 18 <4c> 8b 67 40 48 89 ef 65 48 8b 04 25 28 00 00 00 48 89 44 24 10 31
     RSP: 0018:ffffb520415cfd60 EFLAGS: 00010286
     RAX: 0000000000000070 RBX: 0000000000000000 RCX: 0000000000000000
     RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000000000000
     RBP: 0000000000000080 R08: ffffffffffffffff R09: ffffb520415cfd78
     R10: 0000000000000002 R11: ffffb520415cfd78 R12: 0000000000000000
     R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
     FS:  00007f7e198e5740(0000) GS:ffff905c9f700000(0000) knlGS:0000000000000000
     CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
     CR2: 0000000000000040 CR3: 000000010782a005 CR4: 0000000000770ee0
     PKRU: 55555554
     Call Trace:
      <TASK>
      ? __xa_erase+0x53/0xb0
      device_unregister+0x13/0x50
      intel_pmt_dev_destroy+0x34/0x60 [pmt_class]
      pmt_telem_remove+0x40/0x50 [pmt_telemetry]
      auxiliary_bus_remove+0x18/0x30
      device_release_driver_internal+0xc1/0x150
      driver_detach+0x44/0x90
      bus_remove_driver+0x74/0xd0
      auxiliary_driver_unregister+0x12/0x20
      pmt_telem_exit+0xc/0xe4a [pmt_telemetry]
      __x64_sys_delete_module+0x13a/0x250
      ? syscall_trace_enter.isra.19+0x11e/0x1a0
      do_syscall_64+0x58/0x80
      ? syscall_exit_to_user_mode+0x12/0x30
      ? do_syscall_64+0x67/0x80
      ? syscall_exit_to_user_mode+0x12/0x30
      ? do_syscall_64+0x67/0x80
      ? syscall_exit_to_user_mode+0x12/0x30
      ? do_syscall_64+0x67/0x80
      ? exc_page_fault+0x64/0x140
      entry_SYSCALL_64_after_hwframe+0x44/0xae
     RIP: 0033:0x7f7e1803a05b
     Code: 73 01 c3 48 8b 0d 2d 4e 38 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 b0 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d fd 4d 38 00 f7 d8 64 89 01 48

    The probe function, pmt_telem_probe(), adds an entry for devices even if
    they have not been initialized.  This results in the array of initialized
    devices containing both initialized and uninitialized entries.  This
    causes a panic in the remove function, pmt_telem_remove() which expects
    the array to only contain initialized entries.

    Only use an entry when a device is initialized.

    Cc: "David E. Box" <david.e.box@linux.intel.com>
    Cc: Hans de Goede <hdegoede@redhat.com>
    Cc: Mark Gross <markgross@kernel.org>
    Cc: platform-driver-x86@vger.kernel.org
    Signed-off-by: David Arcari <darcari@redhat.com>
    Signed-off-by: Prarit Bhargava <prarit@redhat.com>
    Reviewed-by: David E. Box <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20220429122322.2550003-1-prarit@redhat.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-05-11 11:46:39 -04:00
David Arcari 88a7d8a4f0 platform/x86/intel: Move intel_pmt from MFD to Auxiliary Bus
Bugzilla: https://bugzilla.redhat.com/2058806

commit a3c8f906ed5fc1d4895b5e1a5c6ad6e942d6c0ca
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Tue Dec 7 17:50:12 2021 -0800

    platform/x86/intel: Move intel_pmt from MFD to Auxiliary Bus

    Intel Platform Monitoring Technology (PMT) support is indicated by presence
    of an Intel defined PCIe Designated Vendor Specific Extended Capabilities
    (DVSEC) structure with a PMT specific ID. The current MFD implementation
    creates child devices for each PMT feature, currently telemetry, watcher,
    and crashlog. However DVSEC structures may also be used by Intel to
    indicate support for other features. The Out Of Band Management Services
    Module (OOBMSM) uses DVSEC to enumerate several features, including PMT.
    In order to support them it is necessary to modify the intel_pmt driver to
    handle the creation of the child devices more generically. To that end,
    modify the driver to create child devices for any VSEC/DVSEC features on
    supported devices (indicated by PCI ID).  Additionally, move the
    implementation from MFD to the Auxiliary bus.  VSEC/DVSEC features are
    really multifunctional PCI devices, not platform devices as MFD was
    designed for. Auxiliary bus gives more flexibility by allowing the
    definition of custom structures that can be shared between associated
    auxiliary devices and the parent device. Also, rename the driver from
    intel_pmt to intel_vsec to better reflect the purpose.

    This series also removes the current runtime pm support which was not
    complete to begin with. None of the current devices require runtime pm.
    However the support will be replaced when a device is added that requires
    it.

    Reviewed-by: Mark Gross <markgross@kernel.org>
    Acked-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20211208015015.891275-4-david.e.box@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: David Arcari <darcari@redhat.com>
2022-03-17 12:15:22 -04:00
David Arcari bf35791122 platform/x86: intel_pmt_telemetry: Ignore zero sized entries
Bugzilla: https://bugzilla.redhat.com/2058806

commit ef195e8a7f43924b9979b2cd81ac7fa54f24bb3c
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Tue Aug 17 15:40:17 2021 -0700

    platform/x86: intel_pmt_telemetry: Ignore zero sized entries

    Some devices may expose non-functioning entries that are reserved for
    future use. These entries have zero size. Ignore them during probe.

    Signed-off-by: David E. Box <david.e.box@linux.intel.com>
    Link: https://lore.kernel.org/r/20210817224018.1013192-5-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>
2022-03-17 12:15:22 -04:00
David Arcari 09567f2bb2 platform/x86/intel: Move Intel PMT drivers to new subfolder
Bugzilla: https://bugzilla.redhat.com/2058806

commit e184b1e589a7fbb80bfdd0364c11422999a17a26
Author: David E. Box <david.e.box@linux.intel.com>
Date:   Tue Jul 27 09:49:28 2021 -0700

    platform/x86/intel: Move Intel PMT drivers to new subfolder

    Move all Intel Platform Monitoring Technology drivers to
    drivers/platform/x86/intel/pmt.

    Signed-off-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/20210727164928.3171521-1-david.e.box@linux.intel.com
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2022-03-17 12:15:22 -04:00