The pff ioread32 currently is:
u32 pff = ioread32(&stdev->mmio_part_cfg[partition].vep_pff_inst_id);
but it should be:
u32 pff = ioread32(&stdev->mmio_part_cfg_all[partition].vep_pff_inst_id);
Since the partition index is provided as an argument, the index should apply to the base of the partition config registers (mmio_part_cfg_all), not the self_partition offset (mmio_part_cfg). This line of code caused an issue when we had 3 partitions and the 3rd partition returned an invalid pff (0xFFFFFFFF).
Also, the code should verify that pff is a valid index. I suggest the following.
pff = ioread32(&stdev->mmio_part_cfg_all[partition].vep_pff_inst_id);
if(pff == 0xFFFFFFFF)
{
dev_warn(&sndev->stdev->dev,
"ntb_part_link_speed - invalid pff, setting speed/width to 0");
*speed=0;
*width=0;
return;
}
linksta = ioread32(&stdev->mmio_pff_csr[pff].pci_cap_region[13]);
The pff ioread32 currently is:
u32 pff = ioread32(&stdev->mmio_part_cfg[partition].vep_pff_inst_id);
but it should be:
u32 pff = ioread32(&stdev->mmio_part_cfg_all[partition].vep_pff_inst_id);
Since the partition index is provided as an argument, the index should apply to the base of the partition config registers (mmio_part_cfg_all), not the self_partition offset (mmio_part_cfg). This line of code caused an issue when we had 3 partitions and the 3rd partition returned an invalid pff (0xFFFFFFFF).
Also, the code should verify that pff is a valid index. I suggest the following.