• Mikulas Patocka's avatar
    x86/mm/pat: Don't report PAT on CPUs that don't support it · 99c13b8c
    Mikulas Patocka authored
    The pat_enabled() logic is broken on CPUs which do not support PAT and
    where the initialization code fails to call pat_init(). Due to that the
    enabled flag stays true and pat_enabled() returns true wrongfully.
    
    As a consequence the mappings, e.g. for Xorg, are set up with the wrong
    caching mode and the required MTRR setups are omitted.
    
    To cure this the following changes are required:
    
      1) Make pat_enabled() return true only if PAT initialization was
         invoked and successful.
    
      2) Invoke init_cache_modes() unconditionally in setup_arch() and
         remove the extra callsites in pat_disable() and the pat disabled
         code path in pat_init().
    
    Also rename __pat_enabled to pat_disabled to reflect the real purpose of
    this variable.
    
    Fixes: 9cd25aac ("x86/mm/pat: Emulate PAT when it is disabled")
    Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Cc: Bernhard Held <berny156@gmx.de>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: "Luis R. Rodriguez" <mcgrof@suse.com>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/alpine.LRH.2.02.1707041749300.3456@file01.intranet.prod.int.rdu2.redhat.com
    99c13b8c
pat.h 677 Bytes