Skip to content

Commit aa63a74

Browse files
aeglgregkh
authored andcommitted
topology/sysfs: Hide PPIN on systems that do not support it.
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent ce522ba commit aa63a74

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/base/topology.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,21 @@ static struct attribute *default_attrs[] = {
152152
NULL
153153
};
154154

155+
static umode_t topology_is_visible(struct kobject *kobj,
156+
struct attribute *attr, int unused)
157+
{
158+
struct device *dev = kobj_to_dev(kobj);
159+
160+
if (attr == &dev_attr_ppin.attr && !topology_ppin(dev->id))
161+
return 0;
162+
163+
return attr->mode;
164+
}
165+
155166
static const struct attribute_group topology_attr_group = {
156167
.attrs = default_attrs,
157168
.bin_attrs = bin_attrs,
169+
.is_visible = topology_is_visible,
158170
.name = "topology"
159171
};
160172

0 commit comments

Comments
 (0)