@@ -254,13 +254,33 @@ static ssize_t cpumask_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct arm_spe_pmu *spe_pmu = dev_get_drvdata(dev);
+ cpumask_var_t mask;
+ ssize_t n;
- return cpumap_print_to_pagebuf(true, buf, &spe_pmu->supported_cpus);
+ /* If allocation failed then show the supported_cpus */
+ if (!alloc_cpumask_var(&mask, GFP_KERNEL))
+ return cpumap_print_to_pagebuf(true, buf, &spe_pmu->supported_cpus);
+
+ cpumask_and(mask, &spe_pmu->supported_cpus, cpu_online_mask);
+ n = cpumap_print_to_pagebuf(true, buf, mask);
+ free_cpumask_var(mask);
+
+ return n;
}
static DEVICE_ATTR_RO(cpumask);
+static ssize_t supported_cpus_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct arm_spe_pmu *spe_pmu = dev_get_drvdata(dev);
+
+ return cpumap_print_to_pagebuf(true, buf, &spe_pmu->supported_cpus);
+}
+static DEVICE_ATTR_RO(supported_cpus);
+
static struct attribute *arm_spe_pmu_attrs[] = {
&dev_attr_cpumask.attr,
+ &dev_attr_supported_cpus.attr,
NULL,
};