diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2025-07-28 23:21:28 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2025-07-28 23:21:28 -0700 |
commit | 9669b2499ea377764f8320dd562dd6cd4ea80a5d (patch) | |
tree | 4db53dfaec4d46c6f0887fc845712f81cc89e60d /drivers/platform/x86/intel/pmt/class.c | |
parent | f38b7512903a50eaeb300e9c8d9448187dd3959c (diff) | |
parent | 1798561befd8be1e52feb54f850efcab5a595f43 (diff) |
Merge tag 'platform-drivers-x86-v6.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
Pull x86 platform drivers from Ilpo Järvinen:
- alienware: Add more precise labels to fans
- amd/hsmp: Improve misleading probe errors (make the legacy driver
aware when HSMP is supported through the ACPI driver)
- amd/pmc: Add Lenovo Yoga 6 13ALCL6 to pmc quirk list
- drm/xe: Correct (D)VSEC information to support PMT crashlog feature
- fujitsu: Clamp charge threshold instead of returning an error
- ideapad: Expore change types
- intel/pmt:
- Add PMT Discovery driver
- Add API to retrieve telemetry regions by feature
- Fix crashlog NULL access
- Support Battlemage GPU (BMG) crashlog
- intel/vsec:
- Add Discovery feature
- Add feature dependency support using device links
- lenovo:
- Move lenovo drivers under drivers/platform/x86/lenovo/
- Add WMI drivers for Lenovo Gaming series
- Improve DMI handling
- oxpec:
- Add support for OneXPlayer X1 Mini Pro (Strix Point variant)
- Fix EC registers for G1 AMD
- samsung-laptop: Expose change types
- wmi: Fix WMI device naming issue (same GUID corner cases)
- x86-android-tables: Add ovc-capacity-table to generic battery nodes
- Miscellaneous cleanups / refactoring / improvements
* tag 'platform-drivers-x86-v6.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: (63 commits)
platform/x86: oxpec: Add support for OneXPlayer X1 Mini Pro (Strix Point)
platform/x86: oxpec: Fix turbo register for G1 AMD
platform/x86/intel/pmt: support BMG crashlog
platform/x86/intel/pmt: use a version struct
platform/x86/intel/pmt: refactor base parameter
platform/x86/intel/pmt: add register access helpers
platform/x86/intel/pmt: decouple sysfs and namespace
platform/x86/intel/pmt: correct types
platform/x86/intel/pmt: re-order trigger logic
platform/x86/intel/pmt: use guard(mutex)
platform/x86/intel/pmt: mutex clean up
platform/x86/intel/pmt: white space cleanup
drm/xe: Correct BMG VSEC header sizing
drm/xe: Correct the rev value for the DVSEC entries
platform/x86/intel/pmt: fix a crashlog NULL pointer access
platform/x86: samsung-laptop: Expose charge_types
platform/x86/amd: pmc: Add Lenovo Yoga 6 13ALC6 to pmc quirk list
platform/x86: dell-uart-backlight: Use blacklight power constant
platform/x86/intel/pmt: fix build dependency for kunit test
platform/x86: lenovo: gamezone needs "other mode"
...
Diffstat (limited to 'drivers/platform/x86/intel/pmt/class.c')
-rw-r--r-- | drivers/platform/x86/intel/pmt/class.c | 50 |
1 files changed, 41 insertions, 9 deletions
diff --git a/drivers/platform/x86/intel/pmt/class.c b/drivers/platform/x86/intel/pmt/class.c index 7233b654bbad..edcce340ea67 100644 --- a/drivers/platform/x86/intel/pmt/class.c +++ b/drivers/platform/x86/intel/pmt/class.c @@ -9,11 +9,13 @@ */ #include <linux/kernel.h> +#include <linux/log2.h> #include <linux/intel_vsec.h> #include <linux/io-64-nonatomic-lo-hi.h> #include <linux/module.h> #include <linux/mm.h> #include <linux/pci.h> +#include <linux/sysfs.h> #include "class.h" @@ -97,7 +99,7 @@ intel_pmt_read(struct file *filp, struct kobject *kobj, if (count > entry->size - off) count = entry->size - off; - count = pmt_telem_read_mmio(entry->ep->pcidev, entry->cb, entry->header.guid, buf, + count = pmt_telem_read_mmio(entry->pcidev, entry->cb, entry->header.guid, buf, entry->base, off, count); return count; @@ -166,12 +168,41 @@ static struct attribute *intel_pmt_attrs[] = { &dev_attr_offset.attr, NULL }; -ATTRIBUTE_GROUPS(intel_pmt); -static struct class intel_pmt_class = { +static umode_t intel_pmt_attr_visible(struct kobject *kobj, + struct attribute *attr, int n) +{ + struct device *dev = container_of(kobj, struct device, kobj); + struct auxiliary_device *auxdev = to_auxiliary_dev(dev->parent); + struct intel_vsec_device *ivdev = auxdev_to_ivdev(auxdev); + + /* + * Place the discovery features folder in /sys/class/intel_pmt, but + * exclude the common attributes as they are not applicable. + */ + if (ivdev->cap_id == ilog2(VSEC_CAP_DISCOVERY)) + return 0; + + return attr->mode; +} + +static bool intel_pmt_group_visible(struct kobject *kobj) +{ + return true; +} +DEFINE_SYSFS_GROUP_VISIBLE(intel_pmt); + +static const struct attribute_group intel_pmt_group = { + .attrs = intel_pmt_attrs, + .is_visible = SYSFS_GROUP_VISIBLE(intel_pmt), +}; +__ATTRIBUTE_GROUPS(intel_pmt); + +struct class intel_pmt_class = { .name = "intel_pmt", .dev_groups = intel_pmt_groups, }; +EXPORT_SYMBOL_GPL(intel_pmt_class); static int intel_pmt_populate_entry(struct intel_pmt_entry *entry, struct intel_vsec_device *ivdev, @@ -252,6 +283,7 @@ static int intel_pmt_populate_entry(struct intel_pmt_entry *entry, return -EINVAL; } + entry->pcidev = pci_dev; entry->guid = header->guid; entry->size = header->size; entry->cb = ivdev->priv_data; @@ -284,8 +316,8 @@ static int intel_pmt_dev_register(struct intel_pmt_entry *entry, entry->kobj = &dev->kobj; - if (ns->attr_grp) { - ret = sysfs_create_group(entry->kobj, ns->attr_grp); + if (entry->attr_grp) { + ret = sysfs_create_group(entry->kobj, entry->attr_grp); if (ret) goto fail_sysfs_create_group; } @@ -326,8 +358,8 @@ static int intel_pmt_dev_register(struct intel_pmt_entry *entry, fail_add_endpoint: sysfs_remove_bin_file(entry->kobj, &entry->pmt_bin_attr); fail_ioremap: - if (ns->attr_grp) - sysfs_remove_group(entry->kobj, ns->attr_grp); + if (entry->attr_grp) + sysfs_remove_group(entry->kobj, entry->attr_grp); fail_sysfs_create_group: device_unregister(dev); fail_dev_create: @@ -369,8 +401,8 @@ void intel_pmt_dev_destroy(struct intel_pmt_entry *entry, if (entry->size) sysfs_remove_bin_file(entry->kobj, &entry->pmt_bin_attr); - if (ns->attr_grp) - sysfs_remove_group(entry->kobj, ns->attr_grp); + if (entry->attr_grp) + sysfs_remove_group(entry->kobj, entry->attr_grp); device_unregister(dev); xa_erase(ns->xa, entry->devid); |