x86/Kconfig: Rework CONFIG_X86_PAE dependency
authorArnd Bergmann <arnd@arndb.de>
Mon, 4 Dec 2023 08:47:02 +0000 (09:47 +0100)
committerBorislav Petkov (AMD) <bp@alien8.de>
Tue, 19 Dec 2023 12:03:06 +0000 (13:03 +0100)
While looking at a Xen Kconfig dependency issue, I tried to understand the
exact dependencies for CONFIG_X86_PAE, which is selected by CONFIG_HIGHMEM64G
but can also be enabled manually.

Apparently the dependencies for CONFIG_HIGHMEM64G are strictly about CPUs
that do support PAE, but the actual feature can be incorrectly enabled on
older CPUs as well. The CONFIG_X86_CMPXCHG64 dependencies on the other hand
include X86_PAE because cmpxchg8b is requried for PAE to work.

Rework this for readability and correctness, using a positive list of CPUs
that support PAE in a new X86_HAVE_PAE symbol that can serve as a dependency
for both X86_PAE and HIGHMEM64G as well as simplify the X86_CMPXCHG64
dependency list.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20231204084722.3789473-2-arnd@kernel.org
arch/x86/Kconfig
arch/x86/Kconfig.cpu

index 3762f41bb092971e3f6180f057b49742014e5f11..469238067aa1a9a2705f8cbf5a093822313ea979 100644 (file)
@@ -1415,7 +1415,7 @@ config HIGHMEM4G
 
 config HIGHMEM64G
        bool "64GB"
-       depends on !M486SX && !M486 && !M586 && !M586TSC && !M586MMX && !MGEODE_LX && !MGEODEGX1 && !MCYRIXIII && !MELAN && !MWINCHIPC6 && !MWINCHIP3D && !MK6
+       depends on X86_HAVE_PAE
        select X86_PAE
        help
          Select this if you have a 32-bit processor and more than 4
@@ -1472,7 +1472,7 @@ config HIGHMEM
 
 config X86_PAE
        bool "PAE (Physical Address Extension) Support"
-       depends on X86_32 && !HIGHMEM4G
+       depends on X86_32 && X86_HAVE_PAE
        select PHYS_ADDR_T_64BIT
        select SWIOTLB
        help
index 00468adf180f1d9192eec9924d6108159bd209d8..b9224cf2ee4d6fcb234be76e072d37fa1cc7ad53 100644 (file)
@@ -362,9 +362,13 @@ config X86_TSC
        def_bool y
        depends on (MWINCHIP3D || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2 || MATOM) || X86_64
 
+config X86_HAVE_PAE
+       def_bool y
+       depends on MCRUSOE || MEFFICEON || MCYRIXIII || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC7 || MCORE2 || MATOM || X86_64
+
 config X86_CMPXCHG64
        def_bool y
-       depends on X86_PAE || X86_64 || MCORE2 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586TSC || M586MMX || MATOM || MGEODE_LX || MGEODEGX1 || MK6 || MK7 || MK8
+       depends on X86_HAVE_PAE || M586TSC || M586MMX || MK6 || MK7
 
 # this should be set for all -march=.. options where the compiler
 # generates cmov.