]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
x86/cpu: Get rid of an unnecessary local variable in get_cpu_address_sizes()
authorBorislav Petkov (AMD) <bp@alien8.de>
Sat, 16 Mar 2024 12:07:06 +0000 (13:07 +0100)
committerRoxana Nicolescu <roxana.nicolescu@canonical.com>
Fri, 2 Aug 2024 14:27:05 +0000 (16:27 +0200)
BugLink: https://bugs.launchpad.net/bugs/2074091
[ Upstream commit 95bfb35269b2e85cff0dd2c957b2d42ebf95ae5f ]

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
Stable-dep-of: 2a38e4ca3022 ("x86/cpu: Provide default cache line size if not enumerated")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Portia Stephens <portia.stephens@canonical.com>
Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
arch/x86/kernel/cpu/common.c

index a1cf3a86bc7caeb18de752d7115c0794f517ae89..79c250756ef22647beb7107a1cc61f20131386e2 100644 (file)
@@ -1096,18 +1096,9 @@ void get_cpu_cap(struct cpuinfo_x86 *c)
 void get_cpu_address_sizes(struct cpuinfo_x86 *c)
 {
        u32 eax, ebx, ecx, edx;
-       bool vp_bits_from_cpuid = true;
 
        if (!cpu_has(c, X86_FEATURE_CPUID) ||
-           (c->extended_cpuid_level < 0x80000008))
-               vp_bits_from_cpuid = false;
-
-       if (vp_bits_from_cpuid) {
-               cpuid(0x80000008, &eax, &ebx, &ecx, &edx);
-
-               c->x86_virt_bits = (eax >> 8) & 0xff;
-               c->x86_phys_bits = eax & 0xff;
-       } else {
+           (c->extended_cpuid_level < 0x80000008)) {
                if (IS_ENABLED(CONFIG_X86_64)) {
                        c->x86_clflush_size = 64;
                        c->x86_phys_bits = 36;
@@ -1121,7 +1112,13 @@ void get_cpu_address_sizes(struct cpuinfo_x86 *c)
                            cpu_has(c, X86_FEATURE_PSE36))
                                c->x86_phys_bits = 36;
                }
+       } else {
+               cpuid(0x80000008, &eax, &ebx, &ecx, &edx);
+
+               c->x86_virt_bits = (eax >> 8) & 0xff;
+               c->x86_phys_bits = eax & 0xff;
        }
+
        c->x86_cache_bits = c->x86_phys_bits;
        c->x86_cache_alignment = c->x86_clflush_size;
 }