Commit graph

3 commits

Author SHA1 Message Date
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
Dmytro Firsov
c9d2fb7d40 xen: refactor Xen hypervisor Kconfig options
Xen-related Kconfig options were highly dependand on BOARD/SOC xenvm.
It is not correct because Xen support may be used on any board and SoC.

So, Kconfig structure was refactored, now CONFIG_XEN is located in
arch/ directory (same as in Linux kernel) and can be selected for
any Cortex-A arm64 setup (no other platforms are currently supported).

Also remove confusion in Domain 0 naming: Domain-0, initial domain,
Dom0, privileged domain etc. Now all options related to Xen Domain 0
will be controlled by CONFIG_XEN_DOM0.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2023-09-15 11:15:00 +01:00
Dmytro Firsov
f4cea5da70 xenvm: drivers: xen: add Xen grant table driver
This commit introduces driver for granting access for own grant
table and for mapping/unmapping foreign gref. Grant tables are used
for data exchange between Xen domains via shared memory page(s) (e.g.
for sharing ring buffer with driver data) This functionality is
widely used and needed for implementing PV backend/frontend drivers.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2022-06-28 22:34:26 -04:00