Skip to content

Commit bdb12a7

Browse files
committed
x86/cpu: Get rid of an unnecessary local variable in get_cpu_address_sizes()
jira LE-2183 bug-fix-prereq x86/sev-es: Set x86_virt_bits commit-author Borislav Petkov (AMD) <bp@alien8.de> commit 95bfb35 Drop 'vp_bits_from_cpuid' as it is not really needed. No functional changes. Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20240316120706.4352-1-bp@alien8.de (cherry picked from commit 95bfb35) Signed-off-by: Jonathan Maple <jmaple@ciq.com> Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 18d2121 commit bdb12a7

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

arch/x86/kernel/cpu/common.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,18 +1020,9 @@ void get_cpu_cap(struct cpuinfo_x86 *c)
10201020
static void get_cpu_address_sizes(struct cpuinfo_x86 *c)
10211021
{
10221022
u32 eax, ebx, ecx, edx;
1023-
bool vp_bits_from_cpuid = true;
10241023

10251024
if (!cpu_has(c, X86_FEATURE_CPUID) ||
1026-
(c->extended_cpuid_level < 0x80000008))
1027-
vp_bits_from_cpuid = false;
1028-
1029-
if (vp_bits_from_cpuid) {
1030-
cpuid(0x80000008, &eax, &ebx, &ecx, &edx);
1031-
1032-
c->x86_virt_bits = (eax >> 8) & 0xff;
1033-
c->x86_phys_bits = eax & 0xff;
1034-
} else {
1025+
(c->extended_cpuid_level < 0x80000008)) {
10351026
if (IS_ENABLED(CONFIG_X86_64)) {
10361027
c->x86_clflush_size = 64;
10371028
c->x86_phys_bits = 36;
@@ -1045,7 +1036,13 @@ static void get_cpu_address_sizes(struct cpuinfo_x86 *c)
10451036
cpu_has(c, X86_FEATURE_PSE36))
10461037
c->x86_phys_bits = 36;
10471038
}
1039+
} else {
1040+
cpuid(0x80000008, &eax, &ebx, &ecx, &edx);
1041+
1042+
c->x86_virt_bits = (eax >> 8) & 0xff;
1043+
c->x86_phys_bits = eax & 0xff;
10481044
}
1045+
10491046
c->x86_cache_bits = c->x86_phys_bits;
10501047
c->x86_cache_alignment = c->x86_clflush_size;
10511048
}

0 commit comments

Comments
 (0)