Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate HW-MGMT Version 7.0030.0940 #60

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion platform/mellanox/hw-management.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
# Mellanox HW Management

MLNX_HW_MANAGEMENT_VERSION = 7.0020.4104
MLNX_HW_MANAGEMENT_VERSION = 7.0030.0940

export MLNX_HW_MANAGEMENT_VERSION

Expand Down
2 changes: 1 addition & 1 deletion platform/mellanox/hw-management/hw-mgmt
Submodule hw-mgmt updated 325 files
72 changes: 10 additions & 62 deletions platform/mellanox/hw-management/hwmgmt_nonup_patches
Original file line number Diff line number Diff line change
@@ -1,63 +1,11 @@
# Current non-upstream patch list, should be updated by hwmgmt_kernel_patches.py script
0099-mlxsw-core_hwmon-Fix-variable-names-for-hwmon-attrib.patch
0100-mlxsw-core_thermal-Rename-labels-according-to-naming.patch
0101-mlxsw-core_thermal-Remove-obsolete-API-for-query-res.patch
0102-mlxsw-reg-Add-mgpir_-prefix-to-MGPIR-fields-comments.patch
0103-mlxsw-core-Remove-unnecessary-asserts.patch
0104-mlxsw-reg-Extend-MTMP-register-with-new-slot-number-.patch
0105-mlxsw-reg-Extend-MTBR-register-with-new-slot-number-.patch
0106-mlxsw-reg-Extend-MCIA-register-with-new-slot-number-.patch
0107-mlxsw-reg-Extend-MCION-register-with-new-slot-number.patch
0108-mlxsw-reg-Extend-PMMP-register-with-new-slot-number-.patch
0109-mlxsw-reg-Extend-MGPIR-register-with-new-slot-fields.patch
0110-mlxsw-core_env-Pass-slot-index-during-PMAOS-register.patch
0111-mlxsw-reg-Add-new-field-to-Management-General-Periph.patch
0112-mlxsw-core-Extend-interfaces-for-cable-info-access-w.patch
0113-mlxsw-core-Extend-port-module-data-structures-for-li.patch
0114-mlxsw-core-Move-port-module-events-enablement-to-a-s.patch
0115-mlxsw-core_hwmon-Split-gearbox-initialization.patch
0116-mlxsw-core_hwmon-Extend-internal-structures-to-suppo.patch
0117-mlxsw-core_hwmon-Introduce-slot-parameter-in-hwmon-i.patch
0118-mlxsw-core_hwmon-Extend-hwmon-device-with-gearbox-ma.patch
0119-mlxsw-core_thermal-Extend-internal-structures-to-sup.patch
0120-mlxsw-core_thermal-Split-gearbox-initialization.patch
0121-mlxsw-core_thermal-Extend-thermal-area-with-gearbox-.patch
0122-mlxsw-core_thermal-Add-line-card-id-prefix-to-line-c.patch
0123-mlxsw-core_thermal-Use-exact-name-of-cooling-devices.patch
0124-mlxsw-core_thermal-Use-common-define-for-thermal-zon.patch
0125-devlink-add-support-to-create-line-card-and-expose-t.patch
0126-devlink-implement-line-card-provisioning.patch
0127-devlink-implement-line-card-active-state.patch
0128-devlink-add-port-to-line-card-relationship-set.patch
0129-devlink-introduce-linecard-info-get-message.patch
0130-devlink-introduce-linecard-info-get-message.patch
0131-mlxsw-reg-Add-Ports-Mapping-event-Configuration-Regi.patch
0132-mlxsw-reg-Add-Management-DownStream-Device-Query-Reg.patch
0133-mlxsw-reg-Add-Management-DownStream-Device-Control-R.patch
0134-mlxsw-reg-Add-Management-Binary-Code-Transfer-Regist.patch
0135-mlxsw-core_linecards-Add-line-card-objects-and-imple.patch
0136-mlxsw-core_linecards-Implement-line-card-activation-.patch
0137-mlxsw-core-Extend-driver-ops-by-remove-selected-port.patch
0138-mlxsw-spectrum-Add-port-to-linecard-mapping.patch
0139-mlxsw-reg-Introduce-Management-Temperature-Extended-.patch
0140-mlxsw-core-Add-APIs-for-thermal-sensor-mapping.patch
0141-mlxsw-reg-Add-Management-DownStream-Device-Tunneling.patch
0142-mlxsw-core_linecards-Probe-devices-for-provisioned-l.patch
0143-mlxsw-core_linecards-Expose-device-FW-version-over-d.patch
0144-mlxsw-core-Introduce-flash-update-components.patch
0145-mlxfw-Get-the-PSID-value-using-op-instead-of-passing.patch
0146-mlxsw-core_linecards-Implement-line-card-device-flas.patch
0147-mlxsw-core_linecards-Introduce-ops-for-linecards-sta.patch
0148-mlxsw-core-Add-interfaces-for-line-card-initializati.patch
0149-mlxsw-core_thermal-Add-interfaces-for-line-card-init.patch
0150-mlxsw-core_hwmon-Add-interfaces-for-line-card-initia.patch
0151-mlxsw-minimal-Prepare-driver-for-modular-system-supp.patch
0152-mlxsw-core-Extend-bus-init-function-with-event-handl.patch
0153-mlxsw-i2c-Add-support-for-system-events-handling.patch
0154-mlxsw-core-Export-line-card-API.patch
0155-mlxsw-minimal-Add-system-event-handler.patch
0156-mlxsw-minimal-Add-interfaces-for-line-card-initializ.patch
0163-platform-mellanox-Introduce-support-for-rack-manager.patch
0176-platform-mellanox-fix-reset_pwr_converter_fail-attri.patch
0177-Documentation-ABI-fix-description-of-fix-reset_pwr_c.patch
0178-platform-mellanox-Introduce-support-for-next-generat.patch
0049-leds-mlxreg-Provide-conversion-for-hardware-LED-colo.patch
0050-leds-mlxreg-Skip-setting-LED-color-during-initializa.patch
0051-leds-mlxreg-Allow-multi-instantiation-of-same-name-L.patch
0167-DS-lan743x-Add-support-for-fixed-phy.patch
0168-TMP-mlxsw-minimal-Ignore-error-reading-SPAD-register.patch
0169-TMP-mlxsw-i2c-Prevent-transaction-execution-for-spec.patch
0174-DS-mlxsw-core_linecards-Skip-devlink-and-provisionin.patch
0181-Revert-Fix-out-of-bounds-memory-accesses-in-thermal.patch
0268-DS-mlxsw-core_linecards-Disable-firmware-bundling-ma.patch
9002-TMP-fix-for-fan-minimum-speed.patch
16 changes: 12 additions & 4 deletions platform/mellanox/integration-scripts.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ KCFG_LIST = $(TEMP_HW_MGMT_DIR)/kconfig
HWMGMT_NONUP_LIST = $(BUILD_WORKDIR)/$($(MLNX_HW_MANAGEMENT)_SRC_PATH)/hwmgmt_nonup_patches
HWMGMT_USER_OUTFILE = $(BUILD_WORKDIR)/integrate-mlnx-hw-mgmt_user.out
TMPFILE_OUT := $(shell mktemp)
SB_COM_MSG := $(shell mktemp -t sb_commit_msg_file_XXXXX.log)
SLK_COM_MSG := $(shell mktemp -t slk_commit_msg_file_XXXXX.log)
SB_HEAD = $(shell git rev-parse --short HEAD)
SLK_HEAD = $(shell cd src/sonic-linux-kernel; git rev-parse --short HEAD)

Expand Down Expand Up @@ -66,7 +68,9 @@ endif
# Pre-processing before runing hw_mgmt script
integration-scripts/hwmgmt_kernel_patches.py pre \
--config_inclusion $(KCFG_LIST) \
--build_root $(BUILD_WORKDIR) $(LOG_SIMPLE)
--build_root $(BUILD_WORKDIR) \
--kernel_version $(KERNEL_VERSION) \
--hw_mgmt_ver ${MLNX_HW_MANAGEMENT_VERSION} $(LOG_SIMPLE)

$(BUILD_WORKDIR)/$($(MLNX_HW_MANAGEMENT)_SRC_PATH)/hw-mgmt/recipes-kernel/linux/deploy_kernel_patches.py \
--dst_accepted_folder $(PTCH_DIR) \
Expand All @@ -80,10 +84,14 @@ endif
integration-scripts/hwmgmt_kernel_patches.py post \
--patches $(PTCH_DIR) \
--non_up_patches $(NON_UP_PTCH_DIR) \
--kernel_version $(KERNEL_VERSION) \
--hw_mgmt_ver ${MLNX_HW_MANAGEMENT_VERSION} \
--config_inclusion $(KCFG_LIST) \
--series $(PTCH_LIST) \
--current_non_up_patches $(HWMGMT_NONUP_LIST) \
--build_root $(BUILD_WORKDIR) $(LOG_SIMPLE)
--build_root $(BUILD_WORKDIR) \
--sb_msg $(SB_COM_MSG) \
--slk_msg $(SLK_COM_MSG) $(LOG_SIMPLE)

# Commit the changes in linux kernel and and log the diff
pushd $(BUILD_WORKDIR)/src/sonic-linux-kernel
Expand All @@ -102,7 +110,7 @@ endif
git diff --no-color --staged --stat --output=${TMPFILE_OUT}
cat ${TMPFILE_OUT} | tee -a ${HWMGMT_USER_OUTFILE}

git diff --staged --quiet || git commit -m "Intgerate HW-MGMT ${MLNX_HW_MANAGEMENT_VERSION} Changes";
git diff --staged --quiet || git commit -m "$$(cat $(SLK_COM_MSG))";
popd

# Commit the changes in buildimage and log the diff
Expand All @@ -127,7 +135,7 @@ endif
git diff --no-color --staged --stat --output=${TMPFILE_OUT} -- $(PLATFORM_PATH)
cat ${TMPFILE_OUT} | tee -a ${HWMGMT_USER_OUTFILE}

git diff --staged --quiet || git commit -m "Intgerate HW-MGMT ${MLNX_HW_MANAGEMENT_VERSION} Changes";
git diff --staged --quiet || git commit -m "$$(cat $(SB_COM_MSG))";
popd

popd $(LOG_SIMPLE)
Expand Down
129 changes: 129 additions & 0 deletions platform/mellanox/integration-scripts/hwmgmt_kernel_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,100 @@

from helper import *

COMMIT_TITLE = "Intgerate HW-MGMT {} Changes"

PATCH_TABLE_LOC = "platform/mellanox/hw-management/hw-mgmt/recipes-kernel/linux/"
PATCH_TABLE_NAME = "Patch_Status_Table.txt"
PATCH_TABLE_DELIMITER = "----------------------"
PATCH_NAME = "patch name"
COMMIT_ID = "Upstream commit id"

def trim_array_str(str_list):
ret = [elem.strip() for elem in str_list]
return ret

def get_line_elements(line):
columns_raw = line.split("|")
if len(columns_raw) < 3:
return False
# remove empty firsta and last elem
columns_raw = columns_raw[1:-1]
columns = trim_array_str(columns_raw)
return columns

def load_patch_table(path, k_version):
patch_table_filename = os.path.join(path, PATCH_TABLE_NAME)

major, minor, subversion = k_version.split(".")
k_ver = "{}.{}".format(major, minor)

print("Loading patch table {} kver:{}".format(patch_table_filename, k_ver))

if not os.path.isfile(patch_table_filename):
print("-> ERR: file {} not found".format(patch_table_filename))
return None

# opening the file
patch_table_file = open(patch_table_filename, "r")
# reading the data from the file
patch_table_data = patch_table_file.read()
# splitting the file data into lines
patch_table_lines = patch_table_data.splitlines()
patch_table_file.close()

# Extract patch table for specified kernel version
kversion_line = "Kernel-{}".format(k_ver)
table_ofset = 0
for table_ofset, line in enumerate(patch_table_lines):
if line == kversion_line:
break

# if kernel version not found
if table_ofset >= len(patch_table_lines)-5:
print ("Err: kernel version {} not found in {}".format(k_ver, patch_table_filename))
return None

table = []
delimiter_count = 0
column_names = None
for idx, line in enumerate(patch_table_lines[table_ofset:]):
if PATCH_TABLE_DELIMITER in line:
delimiter_count += 1
if delimiter_count >= 3:
print ("Err: too much leading delimers line #{}: {}".format(table_ofset + idx, line))
return None
elif table:
break
continue

# line without delimiter but header still not found
if delimiter_count > 0:
if not column_names:
column_names = get_line_elements(line)
if not column_names:
print ("Err: parsing table header line #{}: {}".format(table_ofset + idx, line))
return None
delimiter_count = 0
continue
elif column_names:
line_arr = get_line_elements(line)
if len(line_arr) != len(column_names):
print ("Err: patch table wrong format linex #{}: {}".format(table_ofset + idx, line))
return None
else:
table_line = dict(zip(column_names, line_arr))
table.append(table_line)
return table

def build_commit_description(changes):
if not changes:
return ""
content = "\n"
content = content + " ## Patch List\n"
for key, value in changes.items():
content = content + f"* {key} : {value}\n"
return content

class Data:
# list of new upstream patches
new_up = list()
Expand Down Expand Up @@ -275,6 +369,24 @@ def handle_exclusions(self):
FileHandler.write_lines(os.path.join(self.args.build_root, SLK_KCONFIG_EXCLUDE), new_lines, True)
print("-> INFO: updated kconfig-exclusion: \n{}".format("".join(FileHandler.read_raw(os.path.join(self.args.build_root, SLK_KCONFIG_EXCLUDE)))))

def parse_id(self, id_):
if id_:
id_ = "https://github.com/gregkh/linux/commit/" + id_
return id_

def create_commit_msg(self, table):
title = COMMIT_TITLE.format(self.args.hw_mgmt_ver)
changes_slk, changes_sb = {}, {}
for patch in table:
id_ = self.parse_id(patch.get(COMMIT_ID, ""))
if patch.get(PATCH_NAME) in Data.new_up:
changes_slk[patch.get(PATCH_NAME)] = id_
elif patch.get(PATCH_NAME) in Data.new_non_up:
changes_sb[patch.get(PATCH_NAME)] = id_
slk_commit_msg = title + "\n" + build_commit_description(changes_slk)
sb_commit_msg = title + "\n" + build_commit_description(changes_sb)
return sb_commit_msg, slk_commit_msg

def perform(self):
""" Read the data output from the deploy_kernel_patches.py script
and move to appropriate locations """
Expand All @@ -299,6 +411,18 @@ def perform(self):
self.construct_series_with_non_up()
self.write_series_diff()

path = os.path.join(self.args.build_root, PATCH_TABLE_LOC)
patch_table = load_patch_table(path, self.args.kernel_version)

sb_msg, slk_msg = self.create_commit_msg(patch_table)

if self.args.sb_msg and sb_msg:
with open(self.args.sb_msg, 'w') as f:
f.write(sb_msg)

if self.args.slk_msg:
with open(self.args.slk_msg, 'w') as f:
f.write(slk_msg)

def create_parser():
# Create argument parser
Expand All @@ -314,6 +438,10 @@ def create_parser():
parser.add_argument("--series", type=str)
parser.add_argument("--current_non_up_patches", type=str)
parser.add_argument("--build_root", type=str)
parser.add_argument("--hw_mgmt_ver", type=str, required=True)
parser.add_argument("--kernel_version", type=str, required=True)
parser.add_argument("--sb_msg", type=str, required=False, default="")
parser.add_argument("--slk_msg", type=str, required=False, default="")
parser.add_argument("--is_test", action="store_true")
return parser

Expand All @@ -322,3 +450,4 @@ def create_parser():
parser = create_parser()
action = HwMgmtAction.get(parser.parse_args())
action.perform()

Loading