sonic-buildimage/platform/mellanox/non-upstream-patches/patches/0217-UBUNTU-SAUCE-mlxbf-pmc-Fix-error-when-reading-unprog.patch
Kebo Liu e286869b24
[Mellanox] Update HW-MGMT package to new version V.7.0030.1011 (#16239)
- Why I did it
1. Update Mellanox HW-MGMT package to newer version V.7.0030.1011
2. Replace the SONiC PMON Thermal control algorithm with the one inside the HW-MGMT package on all Nvidia platforms
3. Support Spectrum-4 systems

- How I did it
1. Update the HW-MGMT package version number and submodule pointer
2. Remove the thermal control algorithm implementation from Mellanox platform API
3. Revise the patch to HW-MGMT package which will disable HW-MGMT from running on SIMX
4. Update the downstream kernel patch list

Signed-off-by: Kebo Liu <kebol@nvidia.com>
2023-09-06 11:32:08 +03:00

141 lines
4.3 KiB
Diff

From f88fbeabee18fbd15de2e717fe45d9bf2c287468 Mon Sep 17 00:00:00 2001
From: Shravan Kumar Ramani <shravankr@nvidia.com>
Date: Fri, 9 Sep 2022 05:31:43 -0400
Subject: [PATCH backport 5.10 18/63] UBUNTU: SAUCE: mlxbf-pmc: Fix error when
reading unprogrammed events
BugLink: https://bugs.launchpad.net/bugs/1989172
Firstly, all events have a reset value of 0, which is not a valid
event as per the event_list for most blocks and hence seen as an
error. Add a "disable" event with event_number 0 for all blocks.
Second, the enable bit for each counter need not be checked before
reading the event info, and hence removed.
Signed-off-by: Shravan Kumar Ramani <shravankr@nvidia.com>
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
---
drivers/platform/mellanox/mlxbf-pmc.c | 32 +++++----------------------
drivers/platform/mellanox/mlxbf-pmc.h | 6 +++++
2 files changed, 12 insertions(+), 26 deletions(-)
diff --git a/drivers/platform/mellanox/mlxbf-pmc.c b/drivers/platform/mellanox/mlxbf-pmc.c
index 3305d2a5d..106acea8c 100644
--- a/drivers/platform/mellanox/mlxbf-pmc.c
+++ b/drivers/platform/mellanox/mlxbf-pmc.c
@@ -19,7 +19,7 @@
#include "mlxbf-pmc.h"
-#define DRIVER_VERSION 2.2
+#define DRIVER_VERSION 2.3
static struct mlxbf_pmc_context *pmc;
@@ -562,7 +562,7 @@ int mlxbf_read_event(int blk_num, uint32_t cnt_num, bool is_l3,
uint64_t *result)
{
uint32_t perfcfg_offset, perfval_offset;
- uint64_t perfmon_cfg, perfevt, perfctl;
+ uint64_t perfmon_cfg, perfevt;
if (cnt_num >= pmc->block[blk_num].counters)
return -EINVAL;
@@ -573,26 +573,6 @@ int mlxbf_read_event(int blk_num, uint32_t cnt_num, bool is_l3,
perfcfg_offset = cnt_num * 8;
perfval_offset = perfcfg_offset + pmc->block[blk_num].counters * 8;
- /* Set counter in "read" mode */
- perfmon_cfg = 0;
- perfmon_cfg |= FIELD_PREP(MLXBF_GEN_PERFMON_CONFIG__ADDR,
- MLXBF_PERFCTL);
- perfmon_cfg |= FIELD_PREP(MLXBF_GEN_PERFMON_CONFIG__STROBE, 1);
- perfmon_cfg |= FIELD_PREP(MLXBF_GEN_PERFMON_CONFIG__WR_R_B, 0);
-
- if (mlxbf_pmc_writeq(perfmon_cfg,
- pmc->block[blk_num].mmio_base + perfcfg_offset))
- return -EFAULT;
-
- /* Check if the counter is enabled */
-
- if (mlxbf_pmc_readq(&perfctl,
- pmc->block[blk_num].mmio_base + perfval_offset))
- return -EFAULT;
-
- if (FIELD_GET(MLXBF_GEN_PERFCTL__EN0, perfctl) == 0)
- return -EINVAL;
-
/* Set counter in "read" mode */
perfmon_cfg = 0;
perfmon_cfg |= FIELD_PREP(MLXBF_GEN_PERFMON_CONFIG__ADDR,
@@ -812,10 +792,10 @@ static ssize_t mlxbf_print_event_list(struct kobject *ko,
buf[0] = '\0';
while (events[i].evt_name != NULL) {
size += snprintf(e_info,
- sizeof(e_info),
- "%x: %s\n",
- events[i].evt_num,
- events[i].evt_name);
+ sizeof(e_info),
+ "%x: %s\n",
+ events[i].evt_num,
+ events[i].evt_name);
if (size >= PAGE_SIZE)
break;
strcat(buf, e_info);
diff --git a/drivers/platform/mellanox/mlxbf-pmc.h b/drivers/platform/mellanox/mlxbf-pmc.h
index b15614e90..894c3cc88 100644
--- a/drivers/platform/mellanox/mlxbf-pmc.h
+++ b/drivers/platform/mellanox/mlxbf-pmc.h
@@ -186,6 +186,7 @@ struct mlxbf_pmc_events mlxbf_smgen_events[] = {
};
struct mlxbf_pmc_events mlxbf1_trio_events[] = {
+{0x00, "DISABLE"},
{0xa0, "TPIO_DATA_BEAT"},
{0xa1, "TDMA_DATA_BEAT"},
{0xa2, "MAP_DATA_BEAT"},
@@ -210,6 +211,7 @@ struct mlxbf_pmc_events mlxbf1_trio_events[] = {
};
struct mlxbf_pmc_events mlxbf2_trio_events[] = {
+{0x00, "DISABLE"},
{0xa0, "TPIO_DATA_BEAT"},
{0xa1, "TDMA_DATA_BEAT"},
{0xa2, "MAP_DATA_BEAT"},
@@ -243,6 +245,7 @@ struct mlxbf_pmc_events mlxbf2_trio_events[] = {
};
struct mlxbf_pmc_events mlxbf_ecc_events[] = {
+{0x00, "DISABLE"},
{0x100, "ECC_SINGLE_ERROR_CNT"},
{0x104, "ECC_DOUBLE_ERROR_CNT"},
{0x114, "SERR_INJ"},
@@ -256,6 +259,7 @@ struct mlxbf_pmc_events mlxbf_ecc_events[] = {
};
struct mlxbf_pmc_events mlxbf_mss_events[] = {
+{0x00, "DISABLE"},
{0xc0, "RXREQ_MSS"},
{0xc1, "RXDAT_MSS"},
{0xc2, "TXRSP_MSS"},
@@ -264,6 +268,7 @@ struct mlxbf_pmc_events mlxbf_mss_events[] = {
};
struct mlxbf_pmc_events mlxbf_hnf_events[] = {
+{0x00, "DISABLE"},
{0x45, "HNF_REQUESTS"},
{0x46, "HNF_REJECTS"},
{0x47, "ALL_BUSY"},
@@ -323,6 +328,7 @@ struct mlxbf_pmc_events mlxbf_hnf_events[] = {
};
struct mlxbf_pmc_events mlxbf2_hnfnet_events[] = {
+{0x00, "DISABLE"},
{0x12, "CDN_REQ"},
{0x13, "DDN_REQ"},
{0x14, "NDN_REQ"},
--
2.20.1