Lines Matching refs:xgene_pmu
94 struct xgene_pmu *parent;
104 void (*mask_int)(struct xgene_pmu *pmu);
105 void (*unmask_int)(struct xgene_pmu *pmu);
120 struct xgene_pmu { struct
713 static inline void xgene_pmu_mask_int(struct xgene_pmu *xgene_pmu) in xgene_pmu_mask_int() argument
715 writel(PCPPMU_INTENMASK, xgene_pmu->pcppmu_csr + PCPPMU_INTMASK_REG); in xgene_pmu_mask_int()
718 static inline void xgene_pmu_v3_mask_int(struct xgene_pmu *xgene_pmu) in xgene_pmu_v3_mask_int() argument
720 writel(PCPPMU_V3_INTENMASK, xgene_pmu->pcppmu_csr + PCPPMU_INTMASK_REG); in xgene_pmu_v3_mask_int()
723 static inline void xgene_pmu_unmask_int(struct xgene_pmu *xgene_pmu) in xgene_pmu_unmask_int() argument
725 writel(PCPPMU_INTCLRMASK, xgene_pmu->pcppmu_csr + PCPPMU_INTMASK_REG); in xgene_pmu_unmask_int()
728 static inline void xgene_pmu_v3_unmask_int(struct xgene_pmu *xgene_pmu) in xgene_pmu_v3_unmask_int() argument
731 xgene_pmu->pcppmu_csr + PCPPMU_INTMASK_REG); in xgene_pmu_v3_unmask_int()
872 struct xgene_pmu *xgene_pmu = pmu_dev->parent; in xgene_perf_pmu_enable() local
879 xgene_pmu->ops->start_counters(pmu_dev); in xgene_perf_pmu_enable()
885 struct xgene_pmu *xgene_pmu = pmu_dev->parent; in xgene_perf_pmu_disable() local
887 xgene_pmu->ops->stop_counters(pmu_dev); in xgene_perf_pmu_disable()
950 struct xgene_pmu *xgene_pmu = pmu_dev->parent; in xgene_perf_enable_event() local
952 xgene_pmu->ops->write_evttype(pmu_dev, GET_CNTR(event), in xgene_perf_enable_event()
954 xgene_pmu->ops->write_agentmsk(pmu_dev, ~((u32)GET_AGENTID(event))); in xgene_perf_enable_event()
956 xgene_pmu->ops->write_agent1msk(pmu_dev, in xgene_perf_enable_event()
959 xgene_pmu->ops->enable_counter(pmu_dev, GET_CNTR(event)); in xgene_perf_enable_event()
960 xgene_pmu->ops->enable_counter_int(pmu_dev, GET_CNTR(event)); in xgene_perf_enable_event()
966 struct xgene_pmu *xgene_pmu = pmu_dev->parent; in xgene_perf_disable_event() local
968 xgene_pmu->ops->disable_counter(pmu_dev, GET_CNTR(event)); in xgene_perf_disable_event()
969 xgene_pmu->ops->disable_counter_int(pmu_dev, GET_CNTR(event)); in xgene_perf_disable_event()
975 struct xgene_pmu *xgene_pmu = pmu_dev->parent; in xgene_perf_event_set_period() local
987 xgene_pmu->ops->write_counter(pmu_dev, hw->idx, val); in xgene_perf_event_set_period()
993 struct xgene_pmu *xgene_pmu = pmu_dev->parent; in xgene_perf_event_update() local
999 new_raw_count = xgene_pmu->ops->read_counter(pmu_dev, GET_CNTR(event)); in xgene_perf_event_update()
1018 struct xgene_pmu *xgene_pmu = pmu_dev->parent; in xgene_perf_start() local
1032 xgene_pmu->ops->write_counter(pmu_dev, GET_CNTR(event), in xgene_perf_start()
1095 struct xgene_pmu *xgene_pmu; in xgene_init_perf() local
1102 xgene_pmu = pmu_dev->parent; in xgene_init_perf()
1103 if (xgene_pmu->version == PCP_PMU_V1) in xgene_init_perf()
1124 xgene_pmu->ops->stop_counters(pmu_dev); in xgene_init_perf()
1125 xgene_pmu->ops->reset_counters(pmu_dev); in xgene_init_perf()
1131 xgene_pmu_dev_add(struct xgene_pmu *xgene_pmu, struct xgene_pmu_dev_ctx *ctx) in xgene_pmu_dev_add() argument
1133 struct device *dev = xgene_pmu->dev; in xgene_pmu_dev_add()
1139 pmu->parent = xgene_pmu; in xgene_pmu_dev_add()
1145 if (!(xgene_pmu->l3c_active_mask & pmu->inf->enable_mask)) in xgene_pmu_dev_add()
1147 if (xgene_pmu->version == PCP_PMU_V3) in xgene_pmu_dev_add()
1153 if (xgene_pmu->version == PCP_PMU_V3) in xgene_pmu_dev_add()
1159 if (xgene_pmu->version == PCP_PMU_V3) in xgene_pmu_dev_add()
1163 if (!(xgene_pmu->mcb_active_mask & pmu->inf->enable_mask)) in xgene_pmu_dev_add()
1165 if (xgene_pmu->version == PCP_PMU_V3) in xgene_pmu_dev_add()
1171 if (!(xgene_pmu->mc_active_mask & pmu->inf->enable_mask)) in xgene_pmu_dev_add()
1173 if (xgene_pmu->version == PCP_PMU_V3) in xgene_pmu_dev_add()
1194 struct xgene_pmu *xgene_pmu = pmu_dev->parent; in _xgene_pmu_isr() local
1199 xgene_pmu->ops->stop_counters(pmu_dev); in _xgene_pmu_isr()
1201 if (xgene_pmu->version == PCP_PMU_V3) in _xgene_pmu_isr()
1210 if (xgene_pmu->version == PCP_PMU_V1) in _xgene_pmu_isr()
1212 else if (xgene_pmu->version == PCP_PMU_V2) in _xgene_pmu_isr()
1229 xgene_pmu->ops->start_counters(pmu_dev); in _xgene_pmu_isr()
1236 struct xgene_pmu *xgene_pmu = dev_id; in xgene_pmu_isr() local
1240 raw_spin_lock_irqsave(&xgene_pmu->lock, flags); in xgene_pmu_isr()
1243 val = readl(xgene_pmu->pcppmu_csr + PCPPMU_INTSTATUS_REG); in xgene_pmu_isr()
1244 if (xgene_pmu->version == PCP_PMU_V3) { in xgene_pmu_isr()
1256 list_for_each_entry(ctx, &xgene_pmu->mcpmus, next) { in xgene_pmu_isr()
1261 list_for_each_entry(ctx, &xgene_pmu->mcbpmus, next) { in xgene_pmu_isr()
1266 list_for_each_entry(ctx, &xgene_pmu->l3cpmus, next) { in xgene_pmu_isr()
1271 list_for_each_entry(ctx, &xgene_pmu->iobpmus, next) { in xgene_pmu_isr()
1276 raw_spin_unlock_irqrestore(&xgene_pmu->lock, flags); in xgene_pmu_isr()
1281 static int acpi_pmu_probe_active_mcb_mcu_l3c(struct xgene_pmu *xgene_pmu, in acpi_pmu_probe_active_mcb_mcu_l3c() argument
1305 xgene_pmu->l3c_active_mask = 0x1; in acpi_pmu_probe_active_mcb_mcu_l3c()
1310 xgene_pmu->mcb_active_mask = 0x3; in acpi_pmu_probe_active_mcb_mcu_l3c()
1313 xgene_pmu->mc_active_mask = in acpi_pmu_probe_active_mcb_mcu_l3c()
1317 xgene_pmu->mcb_active_mask = 0x1; in acpi_pmu_probe_active_mcb_mcu_l3c()
1320 xgene_pmu->mc_active_mask = in acpi_pmu_probe_active_mcb_mcu_l3c()
1327 static int acpi_pmu_v3_probe_active_mcb_mcu_l3c(struct xgene_pmu *xgene_pmu, in acpi_pmu_v3_probe_active_mcb_mcu_l3c() argument
1346 xgene_pmu->mcb_active_mask = 0x3; in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1348 xgene_pmu->l3c_active_mask = 0xFF; in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1351 xgene_pmu->mc_active_mask = 0xFF; in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1353 xgene_pmu->mc_active_mask = 0x33; in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1355 xgene_pmu->mc_active_mask = 0x11; in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1358 xgene_pmu->mcb_active_mask = 0x1; in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1360 xgene_pmu->l3c_active_mask = 0x0F; in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1363 xgene_pmu->mc_active_mask = 0x0F; in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1365 xgene_pmu->mc_active_mask = 0x03; in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1367 xgene_pmu->mc_active_mask = 0x01; in acpi_pmu_v3_probe_active_mcb_mcu_l3c()
1373 static int fdt_pmu_probe_active_mcb_mcu_l3c(struct xgene_pmu *xgene_pmu, in fdt_pmu_probe_active_mcb_mcu_l3c() argument
1398 xgene_pmu->l3c_active_mask = 0x1; in fdt_pmu_probe_active_mcb_mcu_l3c()
1404 xgene_pmu->mcb_active_mask = 0x3; in fdt_pmu_probe_active_mcb_mcu_l3c()
1408 xgene_pmu->mc_active_mask = in fdt_pmu_probe_active_mcb_mcu_l3c()
1412 xgene_pmu->mcb_active_mask = 0x1; in fdt_pmu_probe_active_mcb_mcu_l3c()
1416 xgene_pmu->mc_active_mask = in fdt_pmu_probe_active_mcb_mcu_l3c()
1423 static int xgene_pmu_probe_active_mcb_mcu_l3c(struct xgene_pmu *xgene_pmu, in xgene_pmu_probe_active_mcb_mcu_l3c() argument
1427 if (xgene_pmu->version == PCP_PMU_V3) in xgene_pmu_probe_active_mcb_mcu_l3c()
1428 return acpi_pmu_v3_probe_active_mcb_mcu_l3c(xgene_pmu, in xgene_pmu_probe_active_mcb_mcu_l3c()
1431 return acpi_pmu_probe_active_mcb_mcu_l3c(xgene_pmu, in xgene_pmu_probe_active_mcb_mcu_l3c()
1434 return fdt_pmu_probe_active_mcb_mcu_l3c(xgene_pmu, pdev); in xgene_pmu_probe_active_mcb_mcu_l3c()
1457 xgene_pmu_dev_ctx *acpi_get_pmu_hw_inf(struct xgene_pmu *xgene_pmu, in acpi_get_pmu_hw_inf() argument
1460 struct device *dev = xgene_pmu->dev; in acpi_get_pmu_hw_inf()
1557 struct xgene_pmu *xgene_pmu = data; in acpi_pmu_dev_add() local
1570 ctx = acpi_get_pmu_hw_inf(xgene_pmu, adev, (u32)acpi_id->driver_data); in acpi_pmu_dev_add()
1574 if (xgene_pmu_dev_add(xgene_pmu, ctx)) { in acpi_pmu_dev_add()
1576 devm_kfree(xgene_pmu->dev, ctx); in acpi_pmu_dev_add()
1582 list_add(&ctx->next, &xgene_pmu->l3cpmus); in acpi_pmu_dev_add()
1585 list_add(&ctx->next, &xgene_pmu->iobpmus); in acpi_pmu_dev_add()
1588 list_add(&ctx->next, &xgene_pmu->iobpmus); in acpi_pmu_dev_add()
1591 list_add(&ctx->next, &xgene_pmu->mcbpmus); in acpi_pmu_dev_add()
1594 list_add(&ctx->next, &xgene_pmu->mcpmus); in acpi_pmu_dev_add()
1600 static int acpi_pmu_probe_pmu_dev(struct xgene_pmu *xgene_pmu, in acpi_pmu_probe_pmu_dev() argument
1603 struct device *dev = xgene_pmu->dev; in acpi_pmu_probe_pmu_dev()
1612 acpi_pmu_dev_add, NULL, xgene_pmu, NULL); in acpi_pmu_probe_pmu_dev()
1621 static int acpi_pmu_probe_pmu_dev(struct xgene_pmu *xgene_pmu, in acpi_pmu_probe_pmu_dev() argument
1629 xgene_pmu_dev_ctx *fdt_get_pmu_hw_inf(struct xgene_pmu *xgene_pmu, in fdt_get_pmu_hw_inf() argument
1632 struct device *dev = xgene_pmu->dev; in fdt_get_pmu_hw_inf()
1672 static int fdt_pmu_probe_pmu_dev(struct xgene_pmu *xgene_pmu, in fdt_pmu_probe_pmu_dev() argument
1683 ctx = fdt_get_pmu_hw_inf(xgene_pmu, np, PMU_TYPE_L3C); in fdt_pmu_probe_pmu_dev()
1685 ctx = fdt_get_pmu_hw_inf(xgene_pmu, np, PMU_TYPE_IOB); in fdt_pmu_probe_pmu_dev()
1687 ctx = fdt_get_pmu_hw_inf(xgene_pmu, np, PMU_TYPE_MCB); in fdt_pmu_probe_pmu_dev()
1689 ctx = fdt_get_pmu_hw_inf(xgene_pmu, np, PMU_TYPE_MC); in fdt_pmu_probe_pmu_dev()
1696 if (xgene_pmu_dev_add(xgene_pmu, ctx)) { in fdt_pmu_probe_pmu_dev()
1698 devm_kfree(xgene_pmu->dev, ctx); in fdt_pmu_probe_pmu_dev()
1704 list_add(&ctx->next, &xgene_pmu->l3cpmus); in fdt_pmu_probe_pmu_dev()
1707 list_add(&ctx->next, &xgene_pmu->iobpmus); in fdt_pmu_probe_pmu_dev()
1710 list_add(&ctx->next, &xgene_pmu->iobpmus); in fdt_pmu_probe_pmu_dev()
1713 list_add(&ctx->next, &xgene_pmu->mcbpmus); in fdt_pmu_probe_pmu_dev()
1716 list_add(&ctx->next, &xgene_pmu->mcpmus); in fdt_pmu_probe_pmu_dev()
1724 static int xgene_pmu_probe_pmu_dev(struct xgene_pmu *xgene_pmu, in xgene_pmu_probe_pmu_dev() argument
1728 return acpi_pmu_probe_pmu_dev(xgene_pmu, pdev); in xgene_pmu_probe_pmu_dev()
1729 return fdt_pmu_probe_pmu_dev(xgene_pmu, pdev); in xgene_pmu_probe_pmu_dev()
1792 struct xgene_pmu *xgene_pmu = hlist_entry_safe(node, struct xgene_pmu, in xgene_pmu_online_cpu() local
1795 if (cpumask_empty(&xgene_pmu->cpu)) in xgene_pmu_online_cpu()
1796 cpumask_set_cpu(cpu, &xgene_pmu->cpu); in xgene_pmu_online_cpu()
1799 WARN_ON(irq_set_affinity(xgene_pmu->irq, &xgene_pmu->cpu)); in xgene_pmu_online_cpu()
1806 struct xgene_pmu *xgene_pmu = hlist_entry_safe(node, struct xgene_pmu, in xgene_pmu_offline_cpu() local
1811 if (!cpumask_test_and_clear_cpu(cpu, &xgene_pmu->cpu)) in xgene_pmu_offline_cpu()
1817 list_for_each_entry(ctx, &xgene_pmu->mcpmus, next) { in xgene_pmu_offline_cpu()
1820 list_for_each_entry(ctx, &xgene_pmu->mcbpmus, next) { in xgene_pmu_offline_cpu()
1823 list_for_each_entry(ctx, &xgene_pmu->l3cpmus, next) { in xgene_pmu_offline_cpu()
1826 list_for_each_entry(ctx, &xgene_pmu->iobpmus, next) { in xgene_pmu_offline_cpu()
1830 cpumask_set_cpu(target, &xgene_pmu->cpu); in xgene_pmu_offline_cpu()
1832 WARN_ON(irq_set_affinity(xgene_pmu->irq, &xgene_pmu->cpu)); in xgene_pmu_offline_cpu()
1841 struct xgene_pmu *xgene_pmu; in xgene_pmu_probe() local
1854 xgene_pmu = devm_kzalloc(&pdev->dev, sizeof(*xgene_pmu), GFP_KERNEL); in xgene_pmu_probe()
1855 if (!xgene_pmu) in xgene_pmu_probe()
1857 xgene_pmu->dev = &pdev->dev; in xgene_pmu_probe()
1858 platform_set_drvdata(pdev, xgene_pmu); in xgene_pmu_probe()
1880 xgene_pmu->ops = &xgene_pmu_v3_ops; in xgene_pmu_probe()
1882 xgene_pmu->ops = &xgene_pmu_ops; in xgene_pmu_probe()
1884 INIT_LIST_HEAD(&xgene_pmu->l3cpmus); in xgene_pmu_probe()
1885 INIT_LIST_HEAD(&xgene_pmu->iobpmus); in xgene_pmu_probe()
1886 INIT_LIST_HEAD(&xgene_pmu->mcbpmus); in xgene_pmu_probe()
1887 INIT_LIST_HEAD(&xgene_pmu->mcpmus); in xgene_pmu_probe()
1889 xgene_pmu->version = version; in xgene_pmu_probe()
1890 dev_info(&pdev->dev, "X-Gene PMU version %d\n", xgene_pmu->version); in xgene_pmu_probe()
1893 xgene_pmu->pcppmu_csr = devm_ioremap_resource(&pdev->dev, res); in xgene_pmu_probe()
1894 if (IS_ERR(xgene_pmu->pcppmu_csr)) { in xgene_pmu_probe()
1896 return PTR_ERR(xgene_pmu->pcppmu_csr); in xgene_pmu_probe()
1905 dev_name(&pdev->dev), xgene_pmu); in xgene_pmu_probe()
1911 xgene_pmu->irq = irq; in xgene_pmu_probe()
1913 raw_spin_lock_init(&xgene_pmu->lock); in xgene_pmu_probe()
1916 rc = xgene_pmu_probe_active_mcb_mcu_l3c(xgene_pmu, pdev); in xgene_pmu_probe()
1919 xgene_pmu->mcb_active_mask = 0x1; in xgene_pmu_probe()
1920 xgene_pmu->mc_active_mask = 0x1; in xgene_pmu_probe()
1925 &xgene_pmu->node); in xgene_pmu_probe()
1932 rc = xgene_pmu_probe_pmu_dev(xgene_pmu, pdev); in xgene_pmu_probe()
1939 xgene_pmu->ops->unmask_int(xgene_pmu); in xgene_pmu_probe()
1945 &xgene_pmu->node); in xgene_pmu_probe()
1950 xgene_pmu_dev_cleanup(struct xgene_pmu *xgene_pmu, struct list_head *pmus) in xgene_pmu_dev_cleanup() argument
1961 struct xgene_pmu *xgene_pmu = dev_get_drvdata(&pdev->dev); in xgene_pmu_remove() local
1963 xgene_pmu_dev_cleanup(xgene_pmu, &xgene_pmu->l3cpmus); in xgene_pmu_remove()
1964 xgene_pmu_dev_cleanup(xgene_pmu, &xgene_pmu->iobpmus); in xgene_pmu_remove()
1965 xgene_pmu_dev_cleanup(xgene_pmu, &xgene_pmu->mcbpmus); in xgene_pmu_remove()
1966 xgene_pmu_dev_cleanup(xgene_pmu, &xgene_pmu->mcpmus); in xgene_pmu_remove()
1968 &xgene_pmu->node); in xgene_pmu_remove()