[PATCH v1 2/2] net/mlx5: Enable unprivileged read of PCI VPD file

Leon Romanovsky posted 2 patches 2 weeks, 2 days ago
[PATCH v1 2/2] net/mlx5: Enable unprivileged read of PCI VPD file
Posted by Leon Romanovsky 2 weeks, 2 days ago
From: Leon Romanovsky <leonro@nvidia.com>

mlx5 devices are PCIe spec compliant, doesn't expose any sensitive
information Vital Product Data (VPD) section. In addition, these devices
are capable to provide an unprivileged read access file exposed by PCI core.

The parsed VPD section looks like this:
08:00.0 Ethernet controller: Mellanox Technologies MT2910 Family
[ConnectX-7]
...
  Capabilities: [48] Vital Product Data
    Product Name: NVIDIA ConnectX-7 HHHL adapter Card, 200GbE / NDR200 IB, Dual-port QSFP112, PCIe 5.0 x16 with x16 PCIe
extension option, Crypto, Secure Boot Capable
    Read-only fields:
        [PN] Part number: MCX713106AEHEA_QP1
        [EC] Engineering changes: A5
        [V2] Vendor specific: MCX713106AEHEA_QP1
        [SN] Serial number: MT2314XZ0JUZ
        [V3] Vendor specific: 0a5efb8958deed118000946dae7db798
        [VA] Vendor specific: MLX:MN=MLNX:CSKU=V2:UUID=V3:PCI=V0:MODL=CX713106A
        [V0] Vendor specific: PCIeGen5 x16
        [VU] Vendor specific: MT2314XZ0JUZMLNXS0D0F0
        [RV] Reserved: checksum good, 1 byte(s) reserved
    End

Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 220a9ac75c8b..7e34badd174b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -2280,6 +2280,7 @@ static struct pci_driver mlx5_core_driver = {
 	.sriov_configure   = mlx5_core_sriov_configure,
 	.sriov_get_vf_total_msix = mlx5_sriov_get_vf_total_msix,
 	.sriov_set_msix_vec_count = mlx5_core_sriov_set_msix_vec_count,
+	.downgrade_vpd_read = true,
 };
 
 /**
-- 
2.47.0
Re: [PATCH v1 2/2] net/mlx5: Enable unprivileged read of PCI VPD file
Posted by Jakub Kicinski 2 weeks, 2 days ago
On Thu,  7 Nov 2024 20:56:57 +0200 Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@nvidia.com>
> 
> mlx5 devices are PCIe spec compliant, doesn't expose any sensitive
> information Vital Product Data (VPD) section. In addition, these devices
> are capable to provide an unprivileged read access file exposed by PCI core.

Acked-by: Jakub Kicinski <kuba@kernel.org>