OpenCloudOS-Kernel/arch
Juergen Gross 5a32765ac7 x86/xen: allow larger contiguous memory regions in PV guests
[ Upstream commit e93ec87286bd1fd30b7389e7a387cfb259f297e3 ]

Today a PV guest (including dom0) can create 2MB contiguous memory
regions for DMA buffers at max. This has led to problems at least
with the megaraid_sas driver, which wants to allocate a 2.3MB DMA
buffer.

The limiting factor is the frame array used to do the hypercall for
making the memory contiguous, which has 512 entries and is just a
static array in mmu_pv.c.

In order to not waste memory for non-PV guests, put the initial
frame array into .init.data section and dynamically allocate an array
from the .init_after_bootmem hook of PV guests.

In case a contiguous memory area larger than the initially supported
2MB is requested, allocate a larger buffer for the frame list. Note
that such an allocation is tried only after memory management has been
initialized properly, which is tested via a flag being set in the
.init_after_bootmem hook.

Fixes: 9f40ec84a797 ("xen/swiotlb: add alignment check for dma buffers")
Signed-off-by: Juergen Gross <jgross@suse.com>
Tested-by: Alan Robinson <Alan.Robinson@fujitsu.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-02-21 13:57:09 +01:00
..
alpha Revert "change alloc_pages name in dma_map_ops to avoid name conflicts" 2024-09-04 13:28:24 +02:00
arc ARC: build: Try to guess GCC variant of cross compiler 2025-01-09 13:32:05 +01:00
arm ARM: dts: ti/omap: gta04: fix pm issues caused by spi module 2025-02-17 09:40:28 +01:00
arm64 arm64: cacheinfo: Avoid out-of-bounds write to cacheinfo array 2025-02-21 13:57:07 +01:00
csky of/fdt: add dt_phys arg to early_init_dt_scan and early_init_dt_verify 2024-12-09 10:31:56 +01:00
hexagon hexagon: Fix unbalanced spinlock in die() 2025-02-08 09:52:34 +01:00
ia64 vgacon: rework screen_info #ifdef checks 2024-06-27 13:49:15 +02:00
loongarch LoongArch: csum: Fix OoB access in IP checksum code for negative lengths 2025-02-21 13:57:07 +01:00
m68k m68k: vga: Fix I/O defines 2025-02-17 09:40:15 +01:00
microblaze of/fdt: add dt_phys arg to early_init_dt_scan and early_init_dt_verify 2024-12-09 10:31:56 +01:00
mips MIPS: ftrace: Declare ftrace_get_parent_ra_addr() as static 2025-02-17 09:40:41 +01:00
nios2 of/fdt: add dt_phys arg to early_init_dt_scan and early_init_dt_verify 2024-12-09 10:31:56 +01:00
openrisc openrisc: Use asm-generic's version of fix_to_virt() & virt_to_fix() 2024-12-11 16:13:43 +01:00
parisc parisc/ftrace: Fix function graph tracing disablement 2024-12-09 10:32:48 +01:00
powerpc powerpc/pseries/eeh: Fix get PE state translation 2025-02-17 09:40:24 +01:00
riscv RISC-V: Mark riscv_v_init() as __init 2025-02-08 09:52:33 +01:00
s390 KVM: s390: vsie: fix some corner-cases when grabbing vsie pages 2025-02-17 09:40:16 +01:00
sh sh: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK 2024-12-09 10:32:50 +01:00
sparc sparc64: Fix incorrect function signature and add prototype for prom_cif_init 2024-08-03 08:53:55 +02:00
um um: Always dump trace for specified task in show_stack 2024-12-09 10:32:54 +01:00
x86 x86/xen: allow larger contiguous memory regions in PV guests 2025-02-21 13:57:09 +01:00
xtensa of/fdt: add dt_phys arg to early_init_dt_scan and early_init_dt_verify 2024-12-09 10:31:56 +01:00
.gitignore
Kconfig Revert "mm: mmap: allow for the maximum number of bits for randomizing mmap_base by default" 2024-06-27 13:49:15 +02:00