|
@@ -17,6 +17,7 @@
|
|
|
#include <asm/machdep.h>
|
|
|
#include <asm/smp.h>
|
|
|
#include <asm/pmc.h>
|
|
|
+#include <asm/firmware.h>
|
|
|
|
|
|
#include "cacheinfo.h"
|
|
|
|
|
@@ -179,15 +180,25 @@ SYSFS_PMCSETUP(spurr, SPRN_SPURR);
|
|
|
SYSFS_PMCSETUP(dscr, SPRN_DSCR);
|
|
|
SYSFS_PMCSETUP(pir, SPRN_PIR);
|
|
|
|
|
|
+/*
|
|
|
+ Lets only enable read for phyp resources and
|
|
|
+ enable write when needed with a separate function.
|
|
|
+ Lets be conservative and default to pseries.
|
|
|
+*/
|
|
|
static DEVICE_ATTR(mmcra, 0600, show_mmcra, store_mmcra);
|
|
|
static DEVICE_ATTR(spurr, 0400, show_spurr, NULL);
|
|
|
static DEVICE_ATTR(dscr, 0600, show_dscr, store_dscr);
|
|
|
-static DEVICE_ATTR(purr, 0600, show_purr, store_purr);
|
|
|
+static DEVICE_ATTR(purr, 0400, show_purr, store_purr);
|
|
|
static DEVICE_ATTR(pir, 0400, show_pir, NULL);
|
|
|
|
|
|
unsigned long dscr_default = 0;
|
|
|
EXPORT_SYMBOL(dscr_default);
|
|
|
|
|
|
+static void add_write_permission_dev_attr(struct device_attribute *attr)
|
|
|
+{
|
|
|
+ attr->attr.mode |= 0200;
|
|
|
+}
|
|
|
+
|
|
|
static ssize_t show_dscr_default(struct device *dev,
|
|
|
struct device_attribute *attr, char *buf)
|
|
|
{
|
|
@@ -394,8 +405,11 @@ static void register_cpu_online(unsigned int cpu)
|
|
|
if (cpu_has_feature(CPU_FTR_MMCRA))
|
|
|
device_create_file(s, &dev_attr_mmcra);
|
|
|
|
|
|
- if (cpu_has_feature(CPU_FTR_PURR))
|
|
|
+ if (cpu_has_feature(CPU_FTR_PURR)) {
|
|
|
+ if (!firmware_has_feature(FW_FEATURE_LPAR))
|
|
|
+ add_write_permission_dev_attr(&dev_attr_purr);
|
|
|
device_create_file(s, &dev_attr_purr);
|
|
|
+ }
|
|
|
|
|
|
if (cpu_has_feature(CPU_FTR_SPURR))
|
|
|
device_create_file(s, &dev_attr_spurr);
|