[SRU][J:linux-bluefield][PATCH v1 03/14] Revert "UBUNTU: SAUCE: mlxbf-pmc: Add support for 64-bit counters and cycle count"
Shravan Kumar Ramani
shravankr at nvidia.com
Thu Mar 20 06:41:10 UTC 2025
BugLink: https://bugs.launchpad.net/bugs/2103611
This reverts commit 4016f211aa9fd4dbab42a07a357129082d64c0b6.
Signed-off-by: Shravan Kumar Ramani <shravankr at nvidia.com>
---
drivers/platform/mellanox/mlxbf-pmc.c | 128 --------------------------
1 file changed, 128 deletions(-)
diff --git a/drivers/platform/mellanox/mlxbf-pmc.c b/drivers/platform/mellanox/mlxbf-pmc.c
index a87842269986..1dd84c7a79de 100644
--- a/drivers/platform/mellanox/mlxbf-pmc.c
+++ b/drivers/platform/mellanox/mlxbf-pmc.c
@@ -88,8 +88,6 @@
#define MLXBF_PMC_CRSPACE_PERFMON_CTL(n) (n * MLXBF_PMC_CRSPACE_PERFMON_REG0_SZ)
#define MLXBF_PMC_CRSPACE_PERFMON_EN BIT(30)
#define MLXBF_PMC_CRSPACE_PERFMON_CLR BIT(28)
-#define MLXBF_PMC_CRSPACE_PERFMON_UOC GENMASK(15, 0)
-#define MLXBF_PMC_CRSPACE_PERFMON_COUNT_CLOCK(n) (MLXBF_PMC_CRSPACE_PERFMON_CTL(n) + 0x4)
#define MLXBF_PMC_CRSPACE_PERFMON_VAL0(n) (MLXBF_PMC_CRSPACE_PERFMON_CTL(n) + 0xc)
/**
@@ -116,8 +114,6 @@ struct mlxbf_pmc_attribute {
* @attr_event: Attributes for "event" sysfs files
* @attr_event_list: Attributes for "event_list" sysfs files
* @attr_enable: Attributes for "enable" sysfs files
- * @attr_use_odd_counter: Attributes for "use_odd_counter" sysfs files
- * @attr_count_clock: Attributes for "count_clock" sysfs files
* @block_attr: All attributes needed for the block
* @block_attr_grp: Attribute group for the block
*/
@@ -130,8 +126,6 @@ struct mlxbf_pmc_block_info {
struct mlxbf_pmc_attribute *attr_event;
struct mlxbf_pmc_attribute attr_event_list;
struct mlxbf_pmc_attribute attr_enable;
- struct mlxbf_pmc_attribute attr_use_odd_counter;
- struct mlxbf_pmc_attribute attr_count_clock;
struct attribute *block_attr[MLXBF_PMC_MAX_ATTRS];
struct attribute_group block_attr_grp;
};
@@ -1765,101 +1759,6 @@ static ssize_t mlxbf_pmc_enable_store(struct device *dev,
return count;
}
-/* Show function for "use_odd_counter" sysfs files - only for crspace */
-static ssize_t mlxbf_pmc_use_odd_counter_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct mlxbf_pmc_attribute *attr_use_odd_counter = container_of(
- attr, struct mlxbf_pmc_attribute, dev_attr);
- int blk_num, value;
- uint32_t word;
-
- blk_num = attr_use_odd_counter->nr;
-
- if (mlxbf_pmc_readl(pmc->block[blk_num].mmio_base +
- MLXBF_PMC_CRSPACE_PERFMON_CTL(pmc->block[blk_num].counters),
- &word))
- return -EINVAL;
-
- value = FIELD_GET(MLXBF_PMC_CRSPACE_PERFMON_UOC, word);
-
- return sysfs_emit(buf, "%d\n", value);
-}
-
-/* Store function for "use_odd_counter" sysfs files - only for crspace */
-static ssize_t mlxbf_pmc_use_odd_counter_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- struct mlxbf_pmc_attribute *attr_use_odd_counter = container_of(
- attr, struct mlxbf_pmc_attribute, dev_attr);
- uint32_t uoc, word;
- int err, blk_num;
-
- blk_num = attr_use_odd_counter->nr;
-
- err = kstrtoint(buf, 0, &uoc);
- if (err < 0)
- return err;
-
- err = mlxbf_pmc_readl(pmc->block[blk_num].mmio_base +
- MLXBF_PMC_CRSPACE_PERFMON_CTL(pmc->block[blk_num].counters),
- &word);
- if (err)
- return -EINVAL;
-
- word &= ~MLXBF_PMC_CRSPACE_PERFMON_UOC;
- word |= FIELD_PREP(MLXBF_PMC_CRSPACE_PERFMON_UOC, uoc);
-
- mlxbf_pmc_write(pmc->block[blk_num].mmio_base +
- MLXBF_PMC_CRSPACE_PERFMON_CTL(pmc->block[blk_num].counters),
- MLXBF_PMC_WRITE_REG_32, word);
-
- return count;
-}
-
-/* Show function for "count_clock" sysfs files - only for crspace */
-static ssize_t mlxbf_pmc_count_clock_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct mlxbf_pmc_attribute *attr_count_clock = container_of(
- attr, struct mlxbf_pmc_attribute, dev_attr);
- uint32_t word;
- int blk_num;
-
- blk_num = attr_count_clock->nr;
-
- if (mlxbf_pmc_readl(pmc->block[blk_num].mmio_base +
- MLXBF_PMC_CRSPACE_PERFMON_COUNT_CLOCK(pmc->block[blk_num].counters),
- &word))
- return -EINVAL;
-
- return sysfs_emit(buf, "%d\n", word);
-}
-
-/* Store function for "count_clock" sysfs files - only for crspace */
-static ssize_t mlxbf_pmc_count_clock_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- struct mlxbf_pmc_attribute *attr_count_clock = container_of(
- attr, struct mlxbf_pmc_attribute, dev_attr);
- int err, blk_num;
- uint32_t word;
-
- blk_num = attr_count_clock->nr;
-
- err = kstrtoint(buf, 0, &word);
- if (err < 0)
- return err;
-
- mlxbf_pmc_write(pmc->block[blk_num].mmio_base +
- MLXBF_PMC_CRSPACE_PERFMON_COUNT_CLOCK(pmc->block[blk_num].counters),
- MLXBF_PMC_WRITE_REG_32, word);
-
- return count;
-}
-
/* Populate attributes for blocks with counters to monitor performance */
static int mlxbf_pmc_init_perftype_counter(struct device *dev, int blk_num)
{
@@ -1893,33 +1792,6 @@ static int mlxbf_pmc_init_perftype_counter(struct device *dev, int blk_num)
attr = NULL;
}
- if (pmc->block[blk_num].type == MLXBF_PMC_TYPE_CRSPACE) {
- /*
- * "use_odd_counter" sysfs to couple odd counters with even counters to
- * form 64-bit counters. One bit per even counter.
- **/
- attr = &pmc->block[blk_num].attr_use_odd_counter;
- attr->dev_attr.attr.mode = 0644;
- attr->dev_attr.show = mlxbf_pmc_use_odd_counter_show;
- attr->dev_attr.store = mlxbf_pmc_use_odd_counter_store;
- attr->nr = blk_num;
- attr->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL,
- "use_odd_counter");
- pmc->block[blk_num].block_attr[++i] = &attr->dev_attr.attr;
- attr = NULL;
-
- /* "count_clock" sysfs to program crspace counters to count clock cycles */
- attr = &pmc->block[blk_num].attr_count_clock;
- attr->dev_attr.attr.mode = 0644;
- attr->dev_attr.show = mlxbf_pmc_count_clock_show;
- attr->dev_attr.store = mlxbf_pmc_count_clock_store;
- attr->nr = blk_num;
- attr->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL,
- "count_clock");
- pmc->block[blk_num].block_attr[++i] = &attr->dev_attr.attr;
- attr = NULL;
- }
-
pmc->block[blk_num].attr_counter = devm_kcalloc(
dev, pmc->block[blk_num].counters,
sizeof(struct mlxbf_pmc_attribute), GFP_KERNEL);
--
2.43.2
More information about the kernel-team
mailing list