Commit 2e3ddbff authored by Pu Wen's avatar Pu Wen Committed by Zheng Zengkai
Browse files

x86/cpu/hygon: Set __max_die_per_package on Hygon

mainline inclusion
from mainline-v5.13-rc1
commit 59eca2fa
category: bugfix
bugzilla: 188047, https://gitee.com/src-openeuler/kernel/issues/I64FW4
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=59eca2fa1934de42d8aa44d3bef655c92ea69703



--------------------------------

Set the maximum DIE per package variable on Hygon using the
nodes_per_socket value in order to do per-DIE manipulations for drivers
such as powercap.

Signed-off-by: default avatarPu Wen <puwen@hygon.cn>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Link: https://lkml.kernel.org/r/20210302020217.1827-1-puwen@hygon.cn


Signed-off-by: default avatarYuyao Lin <linyuyao1@huawei.com>
Reviewed-by: default avatarXiongfeng Wang <wangxiongfeng2@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 603eda38
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -235,12 +235,12 @@ static void bsp_init_hygon(struct cpuinfo_x86 *c)
		u32 ecx;

		ecx = cpuid_ecx(0x8000001e);
		nodes_per_socket = ((ecx >> 8) & 7) + 1;
		__max_die_per_package = nodes_per_socket = ((ecx >> 8) & 7) + 1;
	} else if (boot_cpu_has(X86_FEATURE_NODEID_MSR)) {
		u64 value;

		rdmsrl(MSR_FAM10H_NODE_ID, value);
		nodes_per_socket = ((value >> 3) & 7) + 1;
		__max_die_per_package = nodes_per_socket = ((value >> 3) & 7) + 1;
	}

	if (!boot_cpu_has(X86_FEATURE_AMD_SSBD) &&