Skip to content

Commit

Permalink
topology/sysfs: Hide PPIN on systems that do not support it.
Browse files Browse the repository at this point in the history
Systems that do not support a Protected Processor Identification Number
currently report:

	# cat /sys/devices/system/cpu/cpu0/topology/ppin
	0x0

which is confusing/wrong.

Add a ".is_visible" function to suppress inclusion of the ppin file.

Fixes: ab28e94 ("topology/sysfs: Add PPIN in sysfs under cpu topology")
Signed-off-by: Tony Luck <tony.luck@intel.com>
Link: https://lore.kernel.org/r/20220406220150.63855-1-tony.luck@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
aegl authored and gregkh committed Apr 20, 2022
1 parent ce522ba commit aa63a74
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/base/topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,21 @@ static struct attribute *default_attrs[] = {
NULL
};

static umode_t topology_is_visible(struct kobject *kobj,
struct attribute *attr, int unused)
{
struct device *dev = kobj_to_dev(kobj);

if (attr == &dev_attr_ppin.attr && !topology_ppin(dev->id))
return 0;

return attr->mode;
}

static const struct attribute_group topology_attr_group = {
.attrs = default_attrs,
.bin_attrs = bin_attrs,
.is_visible = topology_is_visible,
.name = "topology"
};

Expand Down

0 comments on commit aa63a74

Please sign in to comment.