Skip to content

Commit 8290d33

Browse files
committed
pci: add support for PCIe Gen4 link speed
It doesn't look official yet but was sufficiently advertised. By the way, make the code assume Gen5 and later will double linerate again, even if it looks like Gen5 will change things much more than Gen4 does. Signed-off-by: Brice Goglin <[email protected]>
1 parent 6aaa2fa commit 8290d33

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

hwloc/pci-common.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright © 2009-2016 Inria. All rights reserved.
2+
* Copyright © 2009-2017 Inria. All rights reserved.
33
* See COPYING in top-level directory.
44
*/
55

@@ -707,9 +707,17 @@ hwloc_pci_find_linkspeed(const unsigned char *config,
707707
/* PCIe Gen1 = 2.5GT/s signal-rate per lane with 8/10 encoding = 0.25GB/s data-rate per lane
708708
* PCIe Gen2 = 5 GT/s signal-rate per lane with 8/10 encoding = 0.5 GB/s data-rate per lane
709709
* PCIe Gen3 = 8 GT/s signal-rate per lane with 128/130 encoding = 1 GB/s data-rate per lane
710+
* PCIe Gen4 = 16 GT/s signal-rate per lane with 128/130 encoding = 2 GB/s data-rate per lane
710711
*/
711-
lanespeed = speed <= 2 ? 2.5f * speed * 0.8f : 8.0f * 128/130; /* Gbit/s per lane */
712-
*linkspeed = lanespeed * width / 8; /* GB/s */
712+
713+
/* lanespeed in Gbit/s */
714+
if (speed <= 2)
715+
lanespeed = 2.5f * speed * 0.8f;
716+
else
717+
lanespeed = 8.0f * (1<<(speed-3)) * 128/130; /* assume Gen5 will be 32 GT/s and so on */
718+
719+
/* linkspeed in GB/s */
720+
*linkspeed = lanespeed * width / 8;
713721
return 0;
714722
}
715723

0 commit comments

Comments
 (0)