]> git.baikalelectronics.ru Git - kernel.git/commit
x86,swiotlb: Adjust SWIOTLB bounce buffer size for SEV guests
authorAshish Kalra <ashish.kalra@amd.com>
Thu, 10 Dec 2020 01:25:15 +0000 (01:25 +0000)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 11 Dec 2020 20:43:41 +0000 (15:43 -0500)
commit3546ae3f30f0062b8b026e5c29c29e8782e32408
tree3bc21e9d11a97ea5c686a917cd03f4835d68d9f5
parentbe9919d50c73e382981878ad564e3064ed8e1c57
x86,swiotlb: Adjust SWIOTLB bounce buffer size for SEV guests

For SEV, all DMA to and from guest has to use shared (un-encrypted) pages.
SEV uses SWIOTLB to make this happen without requiring changes to device
drivers.  However, depending on the workload being run, the default 64MB
of it might not be enough and it may run out of buffers to use for DMA,
resulting in I/O errors and/or performance degradation for high
I/O workloads.

Adjust the default size of SWIOTLB for SEV guests using a
percentage of the total memory available to guest for the SWIOTLB buffers.

Adds a new sev_setup_arch() function which is invoked from setup_arch()
and it calls into a new swiotlb generic code function swiotlb_adjust_size()
to do the SWIOTLB buffer adjustment.

v5 fixed build errors and warnings as
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Ashish Kalra <ashish.kalra@amd.com>
Co-developed-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
arch/x86/include/asm/mem_encrypt.h
arch/x86/kernel/setup.c
arch/x86/mm/mem_encrypt.c
include/linux/swiotlb.h
kernel/dma/swiotlb.c