kernel_samsung_a53x/arch/x86
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
..
boot x86/boot: Ignore NMIs during very early boot 2024-11-18 12:13:08 +01:00
configs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
crypto crypto: x86/sha256-avx2 - add missing vzeroupper 2024-11-19 12:26:52 +01:00
entry x86/mm: Remove broken vsyscall emulation code from the page fault code 2024-11-19 12:27:13 +01:00
events x86: Share definition of __is_canonical_address() 2024-11-18 11:43:11 +01:00
hyperv Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ia32 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
include x86/cpu: Fix x86_match_cpu() to match just X86_VENDOR_INTEL 2024-11-19 14:19:29 +01:00
kernel x86/amd_nb: Check for invalid SMN reads 2024-11-19 14:19:30 +01:00
kvm KVM: x86: Clear "has_error_code", not "error_code", for RM exception injection 2024-11-19 12:26:38 +01:00
lib x86/insn: Fix PUSH instruction in x86 instruction decoder opcode map 2024-11-19 12:26:59 +01:00
math-emu Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mm x86/mm: Remove broken vsyscall emulation code from the page fault code 2024-11-19 12:27:13 +01:00
net x86/returnthunk: Allow different return thunks 2024-11-18 22:25:38 +01:00
oprofile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pci Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
platform x86/stackprotector/32: Make the canary into a regular percpu variable 2024-11-19 09:22:37 +01:00
power x86/stackprotector/32: Make the canary into a regular percpu variable 2024-11-19 09:22:37 +01:00
purgatory Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ras Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
realmode Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tools x86/boot: Ignore relocations in .notes sections in walk_relocs() too 2024-11-19 12:26:53 +01:00
um Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
video Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xen x86/xen: Drop USERGS_SYSRET64 paravirt call 2024-11-19 12:26:38 +01:00
Kbuild 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
Kconfig.assembler Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig.cpu x86/Kconfig: Transmeta Crusoe is CPU family 5, not 6 2024-11-18 12:13:31 +01:00
Kconfig.debug x86/kconfig: Select ARCH_WANT_FRAME_POINTERS again when UNWINDER_FRAME_POINTER=y 2024-11-19 12:27:09 +01:00
Makefile x86/stackprotector/32: Make the canary into a regular percpu variable 2024-11-19 09:22:37 +01:00
Makefile.um um: allow not setting extra rpaths in the linux binary 2024-11-18 23:19:35 +01:00
Makefile_32.cpu Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00