All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] powerpc/perf: Create mmcra_sihv/mmcra_sipv helpers
@ 2012-06-26 11:00 Anton Blanchard
  2012-06-26 11:01 ` [PATCH 2/4] powerpc/perf: Move code to select SIAR or pt_regs into perf_read_regs Anton Blanchard
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Anton Blanchard @ 2012-06-26 11:00 UTC (permalink / raw)
  To: benh, paulus, sukadev; +Cc: linuxppc-dev


We want to access the MMCRA_SIHV and MMCRA_SIPR bits elsewhere so 
create mmcra_sihv and mmcra_sipr which hide the differences between
the old and new layout of the bits.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Index: linux-build/arch/powerpc/perf/core-book3s.c
===================================================================
--- linux-build.orig/arch/powerpc/perf/core-book3s.c	2012-06-26 10:26:40.695707845 +1000
+++ linux-build/arch/powerpc/perf/core-book3s.c	2012-06-26 10:28:53.325958826 +1000
@@ -116,6 +116,26 @@ static inline void perf_get_data_addr(st
 		*addrp = mfspr(SPRN_SDAR);
 }
 
+static bool mmcra_sihv(unsigned long mmcra)
+{
+	unsigned long sihv = MMCRA_SIHV;
+
+	if (ppmu->flags & PPMU_ALT_SIPR)
+		sihv = POWER6_MMCRA_SIHV;
+
+	return !!(mmcra & sihv);
+}
+
+static bool mmcra_sipr(unsigned long mmcra)
+{
+	unsigned long sipr = MMCRA_SIPR;
+
+	if (ppmu->flags & PPMU_ALT_SIPR)
+		sipr = POWER6_MMCRA_SIPR;
+
+	return !!(mmcra & sipr);
+}
+
 static inline u32 perf_flags_from_msr(struct pt_regs *regs)
 {
 	if (regs->msr & MSR_PR)
@@ -128,8 +148,6 @@ static inline u32 perf_flags_from_msr(st
 static inline u32 perf_get_misc_flags(struct pt_regs *regs)
 {
 	unsigned long mmcra = regs->dsisr;
-	unsigned long sihv = MMCRA_SIHV;
-	unsigned long sipr = MMCRA_SIPR;
 
 	/* Not a PMU interrupt: Make up flags from regs->msr */
 	if (TRAP(regs) != 0xf00)
@@ -156,15 +174,10 @@ static inline u32 perf_get_misc_flags(st
 		return PERF_RECORD_MISC_USER;
 	}
 
-	if (ppmu->flags & PPMU_ALT_SIPR) {
-		sihv = POWER6_MMCRA_SIHV;
-		sipr = POWER6_MMCRA_SIPR;
-	}
-
 	/* PR has priority over HV, so order below is important */
-	if (mmcra & sipr)
+	if (mmcra_sipr(mmcra))
 		return PERF_RECORD_MISC_USER;
-	if ((mmcra & sihv) && (freeze_events_kernel != MMCR0_FCHV))
+	if (mmcra_sihv(mmcra) && (freeze_events_kernel != MMCR0_FCHV))
 		return PERF_RECORD_MISC_HYPERVISOR;
 	return PERF_RECORD_MISC_KERNEL;
 }

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-07-09  4:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-26 11:00 [PATCH 1/4] powerpc/perf: Create mmcra_sihv/mmcra_sipv helpers Anton Blanchard
2012-06-26 11:01 ` [PATCH 2/4] powerpc/perf: Move code to select SIAR or pt_regs into perf_read_regs Anton Blanchard
2012-06-26 11:02 ` [PATCH 3/4] powerpc/perf: Always use pt_regs for userspace samples Anton Blanchard
2012-06-26 11:04 ` [PATCH 4/4] powerpc/perf: Use perf_instruction_pointer in callchains Anton Blanchard
2012-06-26 23:04   ` Scott Wood
2012-06-27  3:59     ` Anton Blanchard
2012-06-27 15:03       ` Scott Wood
2012-07-09  4:20 ` [PATCH 1/4] powerpc/perf: Create mmcra_sihv/mmcra_sipv helpers Anshuman Khandual

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.