From a5c3426d9b4082e41b4cea693b1c40341d8336e4 Mon Sep 17 00:00:00 2001 From: Shelly Sela Date: Sun, 3 Nov 2024 09:59:34 +0200 Subject: [PATCH] fix for "[MSTFLINT] Bug SW #4143961: [mstflint kernel]: Failed to run mstflint tools over devices after load mstflint_access.ko module" Description: the recovery space in VSC is supported only in ConnectX8, Quantum3 and above, so in get_space_support_status function the check whether its supported should be after SS_ALL_SPACES_SUPPORTED is set, as this space is only for recovery and SS_ALL_SPACES_SUPPORTED is relevant only for functional devices. Tested OS: linux Tested devices: ConnectX4 Tested flows: insmod mstflint_access.ko mstdlint -d 44:00.0 q Known gaps (with RM ticket):n/a Issue:4143961 --- kernel/mst_main.c | 13 +++++++------ mtcr_ul/mtcr_ul_com.c | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/kernel/mst_main.c b/kernel/mst_main.c index 1fdf3d7b..a58695ec 100644 --- a/kernel/mst_main.c +++ b/kernel/mst_main.c @@ -232,12 +232,13 @@ int check_syndrome(struct mst_dev_data* dev) static int _update_vsc_type(struct mst_dev_data* dev) { unsigned int vsc_first_dword; + u_int8_t vsc_type = 0; int ret = pci_read_config_dword(dev->pci_dev, dev->functional_vsc_offset, &vsc_first_dword); if (ret) { return ret; } - u_int8_t vsc_type = EXTRACT(vsc_first_dword, MLX_VSC_TYPE_OFFSET, MLX_VSC_TYPE_LEN); + vsc_type = EXTRACT(vsc_first_dword, MLX_VSC_TYPE_OFFSET, MLX_VSC_TYPE_LEN); if (vsc_type == RECOVERY_VSC) { dev->recovery_vsc_offset = dev->functional_vsc_offset; @@ -561,13 +562,13 @@ static int read4_block_vsec(struct mst_dev_data* dev, int address_space, unsigne static int get_space_support_status(struct mst_dev_data* dev) { + int ret = 0; // If VSC is of type RECOVERY, all the spaces are not supported if (dev->functional_vsc_offset == RECOVERY_VSC) { dev->spaces_support_status = SS_NOT_ALL_SPACES_SUPPORTED; return 0; } - int ret; // printk("[MST] Checking if the Vendor CAP %d supports the SPACES in devices\n", vend_cap); if ((!dev->functional_vsc_offset) || (!dev->pci_dev)) return 0; @@ -581,10 +582,6 @@ static int get_space_support_status(struct mst_dev_data* dev) return 1; } - if (_set_addr_space(dev, AS_RECOVERY)) - { - capability_support_info_message(dev, RECOVERY); // this space is supported only for ConnectX8, Quantum3 and above. For recovery from Zombiefish mode. - } else if (_set_addr_space(dev, AS_CR_SPACE)) { capability_support_info_message(dev, CR_SPACE); @@ -604,6 +601,10 @@ static int get_space_support_status(struct mst_dev_data* dev) { dev->spaces_support_status = SS_ALL_SPACES_SUPPORTED; } + if (_set_addr_space(dev, AS_RECOVERY)) + { + capability_support_info_message(dev, RECOVERY); // this space is supported only for ConnectX8, Quantum3 and above. For recovery from Zombiefish mode. + } if (!_set_addr_space(dev, AS_PCI_CRSPACE) && !_set_addr_space(dev, AS_PCI_ICMD) && !_set_addr_space(dev, AS_PCI_SEMAPHORE)) { dev->pci_vsec_space_fully_supported = 1; // Support PCI space diff --git a/mtcr_ul/mtcr_ul_com.c b/mtcr_ul/mtcr_ul_com.c index 4e5f33ce..1ee74983 100644 --- a/mtcr_ul/mtcr_ul_com.c +++ b/mtcr_ul/mtcr_ul_com.c @@ -1715,6 +1715,7 @@ static int mtcr_pciconf_open(mfile* mf, const char* name, u_int32_t adv_opt) get_space_support_status(mf, AS_PCI_ALL_ICMD); get_space_support_status(mf, AS_PCI_SCAN_CRSPACE); get_space_support_status(mf, AS_PCI_GLOBAL_SEMAPHORE); + get_space_support_status(mf, AS_RECOVERY); mf->vsec_cap_mask |= (1 << VCC_INITIALIZED); mtcr_pciconf_cap9_sem(mf, 0);