platform/x86/amd/hsmp: Replace amd_num_nodes() with topology_max_packages()
Subsystems (2)
PATCH 1/1 platform/x86/amd/hsmp: Replace amd_num_nodes() with topology_max_packages()
The amd_num_nodes() function returns the number of data fabrics present. On older EPYC processors, there was one data fabric per socket. However, newer EPYC processors have more than one data fabric per socket, leading to a situation where the number of sockets is not equal to the number of data fabrics. Therefore, it is appropriate to use topology_max_packages() to know the number of sockets in the system.
Also remove node.h header inclusion and socket number comparison against data fabric nodes.
plat.c is supported only for legacy platforms where socket number and data fabric numbers are same. So it can remain unchanged.
--- drivers/platform/x86/amd/hsmp/acpi.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/platform/x86/amd/hsmp/acpi.c +4 -5
@@ -22,12 +22,11 @@#include <linux/module.h> #include <linux/platform_device.h> #include <linux/sysfs.h> +#include <linux/topology.h> #include <linux/uuid.h> #include <uapi/asm-generic/errno-base.h> -#include <asm/amd/node.h> -#include "hsmp.h" #define DRIVER_NAME "hsmp_acpi"
@@ -586,9 +585,9 @@ static int hsmp_acpi_probe(struct platform_device *pdev)return -ENOMEM ;if (!hsmp_pdev->is_probed) { - hsmp_pdev->num_sockets =amd_num_nodes (); -if (hsmp_pdev->num_sockets ==0 || hsmp_pdev->num_sockets >MAX_AMD_NUM_NODES ) { -dev_err (&pdev->dev,"Wrong number of sockets\n" ); + hsmp_pdev->num_sockets =topology_max_packages (); +if (!hsmp_pdev->num_sockets) { +dev_err (&pdev->dev,"No CPU sockets detected\n" );return -ENODEV ; }
Signature · 1 line
2.25.1
Ilpo Järvinen
maintainerQuoted 8 lines · Suma Hegde
The
amd_num_nodes()function returns the number of data fabrics present. On older EPYC processors, there was one data fabric per socket. However, newer EPYC processors have more than one data fabric per socket, leading to a situation where the number of sockets is not equal to the number of data fabrics. Therefore, it is appropriate to usetopology_max_packages()to know the number of sockets in the system.[...]
Thank you for your contribution, it has been applied to my local review-ilpo-next branch. Note it will show up in the public platform-drivers-x86/review-ilpo-next branch only once I've pushed my local branch there, which might take a while.
The list of commits applied:
[1/1] platform/x86/amd/hsmp: Replace amd_num_nodes() with topology_max_packages()
commit: 0bd0f9833196d76666fd2f58524ebfff7ee2628b
--
i.