This patch addresses the problem of accessing HID0 from a partitioned
machine. We remove the need for accessing this register.
--
Corey Ashford
Software Engineer
IBM Linux Technology Center, Linux Toolchain
Beaverton, OR
503-578-3507
[EMAIL PROTECTED]
HID0 is not accessible from a partition. Its access is disabled by the
hypervisor, so we can not use it to distinguish between POWER5+ and POWER5++.
To work around this, we fall back on the mechanism that uses the rev level
of the PVR to infer the value of HID0[40] (backward-compatibility bit).
According to the docs, HID[40] is set whenever the rev is less than 0x300.
Index: linux-2.6/arch/powerpc/perfmon/perfmon.c
===================================================================
--- linux-2.6.orig/arch/powerpc/perfmon/perfmon.c 2008-07-03
14:35:59.000000000 -0400
+++ linux-2.6/arch/powerpc/perfmon/perfmon.c 2008-07-03 15:59:19.000000000
-0400
@@ -228,7 +228,6 @@
char *pfm_arch_get_pmu_module_name(void)
{
unsigned int pvr = mfspr(SPRN_PVR);
- unsigned long hid0;
switch (PVR_VER(pvr)) {
case 0x0004: /* 604 */
@@ -252,8 +251,7 @@
case PV_POWER5:
return "perfmon_power5";
case PV_POWER5p:
- hid0 = mfspr(SPRN_HID0);
- if (hid0 & HID0_PMC5_6_GR_MODE)
+ if (PVR_REV(pvr) < 0x300)
/* PMU behaves like POWER5 */
return "perfmon_power5";
else
Index: linux-2.6/arch/powerpc/perfmon/perfmon_power6.c
===================================================================
--- linux-2.6.orig/arch/powerpc/perfmon/perfmon_power6.c 2008-07-03
15:57:47.000000000 -0400
+++ linux-2.6/arch/powerpc/perfmon/perfmon_power6.c 2008-07-03
16:01:37.000000000 -0400
@@ -122,16 +122,14 @@
static int pfm_power6_probe_pmu(void)
{
unsigned long pvr = mfspr(SPRN_PVR);
- unsigned long hid0 = mfspr(SPRN_HID0);
switch (PVR_VER(pvr)) {
case PV_POWER6:
return 0;
case PV_POWER5p:
- /* If this is a POWER5+ and the backward compatibility mode
- bit (makes it behave as a POWER5) is set, don't treat it
- as a POWER6. */
- return (hid0 & HID0_PMC5_6_GR_MODE) ? -1 : 0;
+ /* If this is a POWER5+ and the revision is less than 0x300,
+ don't treat it as a POWER6. */
+ return (PVR_REV(pvr) < 0x300) ? -1 : 0;
default:
return -1;
}
Index: linux-2.6/arch/powerpc/perfmon/perfmon_power5.c
===================================================================
--- linux-2.6.orig/arch/powerpc/perfmon/perfmon_power5.c 2008-07-03
14:35:59.000000000 -0400
+++ linux-2.6/arch/powerpc/perfmon/perfmon_power5.c 2008-07-03
16:08:07.000000000 -0400
@@ -59,13 +59,12 @@
static int pfm_power5_probe_pmu(void)
{
unsigned long pvr = mfspr(SPRN_PVR);
- unsigned long hid0 = mfspr(SPRN_HID0);
switch (PVR_VER(pvr)) {
case PV_POWER5:
return 0;
case PV_POWER5p:
- return (hid0 & HID0_PMC5_6_GR_MODE) ? 0 : -1;
+ return (PVR_REV(pvr) < 0x300) ? 0 : -1;
default:
return -1;
}
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
perfmon2-devel mailing list
perfmon2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel