kernel_samsung_a53x/arch
Yazen Ghannam 80852dba1a x86/amd_nb: Check for invalid SMN reads
[ Upstream commit c625dabbf1c4a8e77e4734014f2fde7aa9071a1f ]

AMD Zen-based systems use a System Management Network (SMN) that
provides access to implementation-specific registers.

SMN accesses are done indirectly through an index/data pair in PCI
config space. The PCI config access may fail and return an error code.
This would prevent the "read" value from being updated.

However, the PCI config access may succeed, but the return value may be
invalid. This is in similar fashion to PCI bad reads, i.e. return all
bits set.

Most systems will return 0 for SMN addresses that are not accessible.
This is in line with AMD convention that unavailable registers are
Read-as-Zero/Writes-Ignored.

However, some systems will return a "PCI Error Response" instead. This
value, along with an error code of 0 from the PCI config access, will
confuse callers of the amd_smn_read() function.

Check for this condition, clear the return value, and set a proper error
code.

Fixes: ddfe43cdc0da ("x86/amd_nb: Add SMN and Indirect Data Fabric access for AMD Fam17h")
Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230403164244.471141-1-yazen.ghannam@amd.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 14:19:30 +01:00
..
alpha Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
arc ARC: [plat-hsdk]: Remove misplaced interrupt-cells property 2024-11-19 11:32:36 +01:00
arm ARM: dts: samsung: smdk4412: fix keypad no-autorepeat 2024-11-19 14:19:10 +01:00
arm64 KVM: arm64: Allow AArch32 PSTATE.M to be restored as System mode 2024-11-19 12:27:18 +01:00
c6x Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
csky Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
h8300 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hexagon hexagon: vmlinux.lds.S: handle attributes section 2024-11-19 09:22:41 +01:00
ia64 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
m68k m68k: mac: Fix reboot hang on Mac IIci 2024-11-19 12:26:56 +01:00
microblaze microblaze: Remove early printk call from cpuinfo-static.c 2024-11-19 12:27:04 +01:00
mips mips: bmips: BCM6358: make sure CBR is correctly set 2024-11-19 14:19:07 +01:00
nds32 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nios2 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
openrisc Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
parisc parisc: add missing export of __cmpxchg_u8() 2024-11-19 12:26:52 +01:00
powerpc powerpc/io: Avoid clang null pointer arithmetic warnings 2024-11-19 14:19:07 +01:00
riscv riscv: Disable STACKPROTECTOR_PER_TASK if GCC_PLUGIN_RANDSTRUCT is enabled 2024-11-19 11:32:40 +01:00
s390 s390/ipl: Fix incorrect initialization of nvme dump block 2024-11-19 12:27:05 +01:00
sh Revert "sh: Handle calling csum_partial with misaligned data" 2024-11-19 12:26:56 +01:00
sparc sparc: move struct termio to asm/termios.h 2024-11-19 12:27:19 +01:00
um um: Fix the -Wmissing-prototypes warning for __switch_mm 2024-11-19 12:27:06 +01:00
x86 x86/amd_nb: Check for invalid SMN reads 2024-11-19 14:19:30 +01:00
xtensa Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig cpu: Re-enable CPU mitigations by default for !X86 architectures 2024-11-19 11:32:38 +01:00