• John Garry's avatar
    perf jevents: Add support for system events tables · 4689f567
    John Garry authored
    Process the JSONs to find support for "system" events, which are not
    tied to a specific CPUID.
    
    A "COMPAT" property is now used to match against the namespace ID from
    the kernel PMU driver.
    
    The generated pmu-events.c will now have 2 tables:
    
    a. CPU events, as before.
    b. New pmu_sys_event_tables[] table, which will have events matched to
       specific SoCs.
    
    It will look like this:
    
    struct pmu_event pme_hisilicon_hip09_sys[] = {
    {
    	.name = "cycles",
    	.compat = "0x00030736",
    	.event = "event=0",
    	.desc = "Clock cycles",
    	.topic = "smmu v3 pmcg",
    	.long_desc = "Clock cycles",
    },
    {
    	.name = "smmuv3_pmcg.l1_tlb",
    	.compat = "0x00030736",
    	.event = "event=0x8a",
    	.desc = "SMMUv3 PMCG l1_tlb. Unit: smmuv3_pmcg ",
    	.topic = "smmu v3 pmcg",
    	.long_desc = "SMMUv3 PMCG l1_tlb",
    	.pmu = "smmuv3_pmcg",
    },
    ...
    };
    
    struct pmu_event pme_arm_cortex_a53[] = {
    {
    	.name = "ext_mem_req",
    	.event = "event=0xc0",
    	.desc = "External memory request",
    	.topic = "memory",
    },
    {
    	.name = "ext_mem_req_nc",
    	.event = "event=0xc1",
    	.desc = "Non-cacheable external memory request",
    	.topic = "memory",
    },
    ...
    };
    
    struct pmu_event pme_hisilicon_hip09_cpu[] = {
    {
    	.name = "l2d_cache_refill_wr",
    	.event = "event=0x53",
    	.desc = "L2D cache refill, write",
    	.topic = "core imp def",
    	.long_desc = "Attributable Level 2 data cache refill, write",
    },
    ...
    };
    
    struct pmu_events_map pmu_events_map[] = {
    {
    	.cpuid = "0x00000000410fd030",
    	.version = "v1",
    	.type = "core",
    	.table = pme_arm_cortex_a53
    },
    {
    	.cpuid = "0x00000000480fd010",
    	.version = "v1",
    	.type = "core",
    	.table = pme_hisilicon_hip09_cpu
    },
    	{
    		.table = 0
    	},
    };
    
    struct pmu_event pme_hisilicon_hip09_cpu[] = {
    {
    	.name = "uncore_hisi_l3c.rd_cpipe",
    	.event = "event=0",
    	.desc = "Total read accesses. Unit: hisi_sccl,l3c ",
    	.topic = "uncore l3c",
    	.long_desc = "Total read accesses",
    	.pmu = "hisi_sccl,l3c",
    },
    {
    	.name = "uncore_hisi_l3c.wr_cpipe",
    	.event = "event=0x1",
    	.desc = "Total write accesses. Unit: hisi_sccl,l3c ",
    	.topic = "uncore l3c",
    	.long_desc = "Total write accesses",
    	.pmu = "hisi_sccl,l3c",
    },
    ...
    };
    
    struct pmu_sys_events pmu_sys_event_tables[] = {
    {
    	.table = pme_hisilicon_hip09_sys,
    },
    ...
    };
    
    Committer notes:
    
    Added the fix for architectures without PMU events, provided by John
    after I reported the build failing in such systems.
    
    Link: https://lore.kernel.org/lkml/650baaf2-36b6-a9e2-ff49-963ef864c1f3@huawei.com/Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
    Acked-by: default avatarKajol Jain <kjain@linux.ibm.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Joakim Zhang <qiangqing.zhang@nxp.com>
    Cc: Kan Liang <kan.liang@linux.intel.com>
    Cc: Kim Phillips <kim.phillips@amd.com>
    Cc: Leo Yan <leo.yan@linaro.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Shaokun Zhang <zhangshaokun@hisilicon.com>
    Cc: Will Deacon <will@kernel.org>
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linuxarm@huawei.com
    Link: http://lore.kernel.org/lkml/1607080216-36968-3-git-send-email-john.garry@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    4689f567
pmu-events.h 1.29 KB