linux-stable/arch
Borislav Petkov 8f95274148 x86/Kconfig: Do not enable AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT automatically
commit 711885906b upstream.

This Kconfig option was added initially so that memory encryption is
enabled by default on machines which support it.

However, devices which have DMA masks that are less than the bit
position of the encryption bit, aka C-bit, require the use of an IOMMU
or the use of SWIOTLB.

If the IOMMU is disabled or in passthrough mode, the kernel would switch
to SWIOTLB bounce-buffering for those transfers.

In order to avoid that,

  2cc13bb4f5 ("iommu: Disable passthrough mode when SME is active")

disables the default IOMMU passthrough mode so that devices for which the
default 256K DMA is insufficient, can use the IOMMU instead.

However 2, there are cases where the IOMMU is disabled in the BIOS, etc.
(think the usual hardware folk "oops, I dropped the ball there" cases) or a
driver doesn't properly use the DMA APIs or a device has a firmware or
hardware bug, e.g.:

  ea68573d40 ("drm/amdgpu: Fail to load on RAVEN if SME is active")

However 3, in the above GPU use case, there are APIs like Vulkan and
some OpenGL/OpenCL extensions which are under the assumption that
user-allocated memory can be passed in to the kernel driver and both the
GPU and CPU can do coherent and concurrent access to the same memory.
That cannot work with SWIOTLB bounce buffers, of course.

So, in order for those devices to function, drop the "default y" for the
SME by default active option so that users who want to have SME enabled,
will need to either enable it in their config or use "mem_encrypt=on" on
the kernel command line.

 [ tlendacky: Generalize commit message. ]

Fixes: 7744ccdbc1 ("x86/mm: Add Secure Memory Encryption (SME) support")
Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Cc: <stable@vger.kernel.org>
Link: https://lkml.kernel.org/r/8bbacd0e-4580-3194-19d2-a0ecad7df09c@molgen.mpg.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-10-20 10:42:04 +02:00
..
alpha alpha: Declare virt_to_phys and virt_to_bus parameter as pointer to volatile 2021-10-06 15:05:07 +02:00
arc ARC: export clear_user_page() for modules 2021-09-22 11:45:35 +02:00
arm ARM: imx6: disable the GIC CPU interface before calling stby-poweroff sequence 2021-10-17 10:08:33 +02:00
arm64 arm64: Extend workaround for erratum 1024718 to all versions of Cortex-A55 2021-10-06 15:05:10 +02:00
blackfin
c6x
cris
frv
h8300 h8300: fix PREEMPTION build, TI_PRE_COUNT undefined 2021-02-23 14:00:33 +01:00
hexagon hexagon: use common DISCARDS macro 2021-07-20 16:17:54 +02:00
ia64 ia64: mca_drv: fix incorrect array size calculation 2021-07-20 16:17:34 +02:00
m32r
m68k m68k: Handle arrivals of multiple signals correctly 2021-10-17 10:08:34 +02:00
metag
microblaze microblaze: Prevent the overflow of the start 2020-02-28 16:36:08 +01:00
mips bpf, mips: Validate conditional branch offsets 2021-10-17 10:08:32 +02:00
mn10300
nios2 nios2: ksyms: Add missing symbol exports 2020-01-27 14:46:24 +01:00
openrisc openrisc: don't printk() unconditionally 2021-09-22 11:45:26 +02:00
parisc parisc: Use absolute_pointer() to define PAGE0 2021-10-06 15:05:07 +02:00
powerpc powerpc/fsl/dts: Fix phy-connection-type for fm1mac3 2021-10-17 10:08:33 +02:00
s390 s390: fix strrchr() implementation 2021-10-20 10:42:03 +02:00
score
sh sh: dma: fix kconfig dependency for G2_DMA 2021-01-30 13:31:15 +01:00
sparc sparc64: fix pci_iounmap() when CONFIG_PCI is not set 2021-10-09 14:09:46 +02:00
tile
um um: fix error return code in winch_tramp() 2021-07-20 16:17:53 +02:00
unicore32
x86 x86/Kconfig: Do not enable AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT automatically 2021-10-20 10:42:04 +02:00
xtensa xtensa: call irqchip_init only when CONFIG_USE_OF is selected 2021-10-17 10:08:32 +02:00
.gitignore
Kconfig mm: fix exec activate_mm vs TLB shootdown and lazy tlb switching race 2020-11-18 18:28:03 +01:00