]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
perf/x86/amd/ibs: Update IBS MSRs and feature definitions
authorAravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
Mon, 10 Nov 2014 20:24:26 +0000 (14:24 -0600)
committerJiri Slaby <jslaby@suse.cz>
Tue, 2 Jun 2015 09:50:21 +0000 (11:50 +0200)
commit 904cb3677f3adcd3d837be0a0d0b14251ba8d6f7 upstream.

New Fam15h models carry extra feature bits and extend
the MSR register space for IBS ops. Adding them here.

While at it, add functionality to read IbsBrTarget and
OpData4 depending on their availability if user wants a
PERF_SAMPLE_RAW.

Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
Acked-by: Borislav Petkov <bp@suse.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: <paulus@samba.org>
Cc: <acme@kernel.org>
Link: http://lkml.kernel.org/r/1415651066-13523-1-git-send-email-Aravind.Gopalakrishnan@amd.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
arch/x86/include/asm/perf_event.h
arch/x86/include/uapi/asm/msr-index.h
arch/x86/kernel/cpu/perf_event_amd_ibs.c

index 8249df45d2f2b52dcecd46411db73408bf1ab392..348d9ac94d4e701da053d6a1225fb80498757976 100644 (file)
@@ -169,6 +169,9 @@ struct x86_pmu_capability {
 #define IBS_CAPS_BRNTRGT               (1U<<5)
 #define IBS_CAPS_OPCNTEXT              (1U<<6)
 #define IBS_CAPS_RIPINVALIDCHK         (1U<<7)
+#define IBS_CAPS_OPBRNFUSE             (1U<<8)
+#define IBS_CAPS_FETCHCTLEXTD          (1U<<9)
+#define IBS_CAPS_OPDATA4               (1U<<10)
 
 #define IBS_CAPS_DEFAULT               (IBS_CAPS_AVAIL         \
                                         | IBS_CAPS_FETCHSAM    \
index 228d95f6592abf4eac9ca5cf73f8f3c72d80a09f..dbb591390b9e823c3b527908131fb196f9190a76 100644 (file)
 #define MSR_AMD64_IBSOP_REG_MASK       ((1UL<<MSR_AMD64_IBSOP_REG_COUNT)-1)
 #define MSR_AMD64_IBSCTL               0xc001103a
 #define MSR_AMD64_IBSBRTARGET          0xc001103b
+#define MSR_AMD64_IBSOPDATA4           0xc001103d
 #define MSR_AMD64_IBS_REG_COUNT_MAX    8 /* includes MSR_AMD64_IBSBRTARGET */
 
 /* Fam 16h MSRs */
index 4b8e4d3cd6ea62bc9c9047e869fa84cbd9cbe33a..6a4b5456240ad6704502a68a2be57107d6220533 100644 (file)
@@ -565,6 +565,21 @@ static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs)
                                       perf_ibs->offset_max,
                                       offset + 1);
        } while (offset < offset_max);
+       if (event->attr.sample_type & PERF_SAMPLE_RAW) {
+               /*
+                * Read IbsBrTarget and IbsOpData4 separately
+                * depending on their availability.
+                * Can't add to offset_max as they are staggered
+                */
+               if (ibs_caps & IBS_CAPS_BRNTRGT) {
+                       rdmsrl(MSR_AMD64_IBSBRTARGET, *buf++);
+                       size++;
+               }
+               if (ibs_caps & IBS_CAPS_OPDATA4) {
+                       rdmsrl(MSR_AMD64_IBSOPDATA4, *buf++);
+                       size++;
+               }
+       }
        ibs_data.size = sizeof(u64) * size;
 
        regs = *iregs;