zephyr/drivers/xen/Kconfig
Dmytro Firsov cd31a41328 drivers: xen: gnttab: limit number of grant frames via config
Xen allocates a region that should be used as a place for grant table
mapping and passes it via the device tree. By design, this region may
be quite large (up to 4096+ frames/pages), but the number of frames is
usually limited by the max_grant_frames domain parameter (usually 32 or
64).

Linux maps these frames on demand and when reaches mentioned limit
it just stops expanding. At the same time, previous implementation of
Zephyr gnttab driver calculated the number of grant frames by dividing
whole region by page size and tried to map it during init. If the
region specified in the device tree was larger than the
max_grant_frames set by Xen, it would fail on ASSERT, since Xen would
return an error.

To address these issues CONFIG_NR_GRANT_FRAMES was introduced. It
allows to limit size of grant table and map only required number of
pages. Additionally, a check for max_grant_frames Xen limit was
introduced to initialization - if this value will be less than
CONFIG_NR_GRANT_FRAMES, k_panic() will be called.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2025-02-14 10:41:33 +01:00

34 lines
902 B
Text

# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2022-2024 EPAM Systems
if XEN
menu "Xen drivers"
config XEN_GRANT_TABLE
bool "Xen grant table driver"
depends on HEAP_MEM_POOL_SIZE > 0
default y
help
Xen grant table driver. Please note that driver uses dynamic memory
allocation with k_malloc(), so CONFIG_HEAP_MEM_POOL_SIZE should be
>= number of pages, that you want to alloc and grant or foreign frames
that you want to map.
config XEN_GRANT_TABLE_INIT_PRIORITY
int "Grant table driver init priority"
depends on XEN_GRANT_TABLE
default 50
config NR_GRANT_FRAMES
int "Number of grant frames mapped to Zephyr"
depends on XEN_GRANT_TABLE
default 1
help
This value configures how much grant frames will be supported by Zephyr
grant table driver in runtime. This value should be <= max_grant_frames
configured for domain in Xen hypervisor.
endmenu
endif # XEN