sonic-buildimage/platform/mellanox/non-upstream-patches/patches/0234-UBUNTU-SAUCE-mlxbf_gige-add-validation-of-ACPI-table.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

63 lines
2.1 KiB
Diff

From 8c7dd66540096a636aa35406cdb023dd549e2755 Mon Sep 17 00:00:00 2001
From: David Thompson <davthompson@nvidia.com>
Date: Wed, 20 Jul 2022 18:17:09 -0400
Subject: [PATCH backport 5.10 35/63] UBUNTU: SAUCE: mlxbf_gige: add validation
of ACPI table version
BugLink: https://bugs.launchpad.net/bugs/1982427
This patch checks the "version" property in the OOB ACPI table,
ensuring that the driver probe will only succeed if the expected
version is found.
Change-Id: I8dc1f877338f9b23ab3560c0315a1727e144dd57
Signed-off-by: David Thompson <davthompson@nvidia.com>
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
---
.../mellanox/mlxbf_gige/mlxbf_gige_main.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
index e8f9290a8..c9176a2e6 100644
--- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
+++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
@@ -19,6 +19,11 @@
#include "mlxbf_gige.h"
#include "mlxbf_gige_regs.h"
+/* This setting defines the version of the ACPI table
+ * content that is compatible with this driver version.
+ */
+#define MLXBF_GIGE_ACPI_TABLE_VERSION 2
+
/* Allocate SKB whose payload pointer aligns with the Bluefield
* hardware DMA limitation, i.e. DMA operation can't cross
* a 4KB boundary. A maximum packet size of 2KB is assumed in the
@@ -282,9 +287,23 @@ static int mlxbf_gige_probe(struct platform_device *pdev)
void __iomem *plu_base;
void __iomem *base;
int addr, phy_irq;
+ u32 version;
u64 control;
int err;
+ version = 0;
+ err = device_property_read_u32(&pdev->dev, "version", &version);
+ if (err) {
+ dev_err(&pdev->dev, "ACPI table version not found\n");
+ return -EINVAL;
+ }
+
+ if (version != MLXBF_GIGE_ACPI_TABLE_VERSION) {
+ dev_err(&pdev->dev, "ACPI table version mismatch: expected %d found %d\n",
+ MLXBF_GIGE_ACPI_TABLE_VERSION, version);
+ return -EINVAL;
+ }
+
mac_res = platform_get_resource(pdev, IORESOURCE_MEM, MLXBF_GIGE_RES_MAC);
if (!mac_res)
return -ENXIO;
--
2.20.1