android_kernel_asus_sm8350/arch
Dheeraj Kumar Srivastava f89bcf03e9 x86/apic: Fix kernel panic when booting with intremap=off and x2apic_phys
[ Upstream commit 85d38d5810e285d5aec7fb5283107d1da70c12a9 ]

When booting with "intremap=off" and "x2apic_phys" on the kernel command
line, the physical x2APIC driver ends up being used even when x2APIC
mode is disabled ("intremap=off" disables x2APIC mode). This happens
because the first compound condition check in x2apic_phys_probe() is
false due to x2apic_mode == 0 and so the following one returns true
after default_acpi_madt_oem_check() having already selected the physical
x2APIC driver.

This results in the following panic:

   kernel BUG at arch/x86/kernel/apic/io_apic.c:2409!
   invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
   CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.4.0-rc2-ver4.1rc2 #2
   Hardware name: Dell Inc. PowerEdge R6515/07PXPY, BIOS 2.3.6 07/06/2021
   RIP: 0010:setup_IO_APIC+0x9c/0xaf0
   Call Trace:
    <TASK>
    ? native_read_msr
    apic_intr_mode_init
    x86_late_time_init
    start_kernel
    x86_64_start_reservations
    x86_64_start_kernel
    secondary_startup_64_no_verify
    </TASK>

which is:

setup_IO_APIC:
  apic_printk(APIC_VERBOSE, "ENABLING IO-APIC IRQs\n");
  for_each_ioapic(ioapic)
  	BUG_ON(mp_irqdomain_create(ioapic));

Return 0 to denote that x2APIC has not been enabled when probing the
physical x2APIC driver.

  [ bp: Massage commit message heavily. ]

Fixes: 9ebd680bd0 ("x86, apic: Use probe routines to simplify apic selection")
Signed-off-by: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Kishon Vijay Abraham I <kvijayab@amd.com>
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20230616212236.1389-1-dheerajkumar.srivastava@amd.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-06-28 10:18:42 +02:00
..
alpha alpha: fix R_ALPHA_LITERAL reloc for large modules 2023-03-17 08:32:52 +01:00
arc dma-mapping: drop the dev argument to arch_sync_dma_for_* 2023-04-05 11:16:43 +02:00
arm ARM: dts: Fix erroneous ADS touchscreen polarities 2023-06-28 10:18:41 +02:00
arm64 arm64: Add missing Set/Way CMO encodings 2023-06-28 10:18:40 +02:00
c6x dma-mapping: drop the dev argument to arch_sync_dma_for_* 2023-04-05 11:16:43 +02:00
csky dma-mapping: drop the dev argument to arch_sync_dma_for_* 2023-04-05 11:16:43 +02:00
h8300 h8300: Fix build errors from do_exit() to make_task_dead() transition 2023-02-06 07:52:49 +01:00
hexagon dma-mapping: drop the dev argument to arch_sync_dma_for_* 2023-04-05 11:16:43 +02:00
ia64 treewide: Remove uninitialized_var() usage 2023-06-09 10:29:01 +02:00
m68k m68k: Move signal frame following exception on 68020/030 2023-05-30 12:44:09 +01:00
microblaze dma-mapping: drop the dev argument to arch_sync_dma_for_* 2023-04-05 11:16:43 +02:00
mips Remove DECnet support from kernel 2023-06-21 15:44:10 +02:00
nds32 dma-mapping: drop the dev argument to arch_sync_dma_for_* 2023-04-05 11:16:43 +02:00
nios2 nios2: dts: Fix tse_mac "max-frame-size" property 2023-06-21 15:44:10 +02:00
openrisc openrisc: Properly store r31 to pt_regs on unhandled exceptions 2023-05-17 11:35:53 +02:00
parisc parisc: Improve cache flushing for PCXL in arch_sync_dma_for_cpu() 2023-06-21 15:44:09 +02:00
powerpc Remove DECnet support from kernel 2023-06-21 15:44:10 +02:00
riscv riscv: Bump COMMAND_LINE_SIZE value to 1024 2023-04-05 11:16:39 +02:00
s390 treewide: Remove uninitialized_var() usage 2023-06-09 10:29:01 +02:00
sh sh: nmi_debug: fix return value of __setup handler 2023-05-17 11:36:01 +02:00
sparc dma-mapping: drop the dev argument to arch_sync_dma_for_* 2023-04-05 11:16:43 +02:00
um UML: define RUNTIME_DISCARD_EXIT 2023-03-17 08:32:54 +01:00
unicore32 mm: treewide: clarify pgtable_page_{ctor,dtor}() naming 2019-09-26 10:10:44 -07:00
x86 x86/apic: Fix kernel panic when booting with intremap=off and x2apic_phys 2023-06-28 10:18:42 +02:00
xtensa dma-mapping: drop the dev argument to arch_sync_dma_for_* 2023-04-05 11:16:43 +02:00
.gitignore
Kconfig locking/refcount: Consolidate implementations of refcount_t 2022-07-29 17:14:17 +02:00