[PATCH v2] eal/linux: force iova-mode va without pa available
Dmitry Kozlyuk
dmitry.kozliuk at gmail.com
Fri Nov 24 11:29:41 CET 2023
2023-11-24 11:09 (UTC+0100), christian.ehrhardt at canonical.com:
[...]
> diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
> index 57da058cec..2f1fce3c54 100644
> --- a/lib/eal/linux/eal.c
> +++ b/lib/eal/linux/eal.c
> @@ -1067,6 +1067,16 @@ rte_eal_init(int argc, char **argv)
>
> phys_addrs = rte_eal_using_phys_addrs() != 0;
>
> + if (!phys_addrs) {
> + /* if we have no access to physical addresses, pick IOVA as VA mode. */
> + if (internal_conf->iova_mode == RTE_IOVA_PA)
> + RTE_LOG(WARNING, EAL, "WARNING: --iova-mode=pa, but Physical addresses are unavailable, selecting IOVA as VA mode.\n");
If an impossible combination of options is requested,
initialization should fail instead.
> + else
> + RTE_LOG(DEBUG, EAL, "Physical addresses are unavailable, selecting IOVA as VA mode.\n");
> + internal_conf->iova_mode = RTE_IOVA_VA;
> + rte_eal_get_configuration()->iova_mode = internal_conf->iova_mode;
> + }
> +
> /* if no EAL option "--iova-mode=<pa|va>", use bus IOVA scheme */
> if (internal_conf->iova_mode == RTE_IOVA_DC) {
> /* autodetect the IOVA mapping mode */
What do you think about keeping the existing code structure:
if (--iova-mode not specified) {
iova_mode = VA if !phys_addrs or !RTE_IOVA_IN_MBUF (with logs)
if (iova_mode == DC) {
// autodetect from bus requirements and IOMMU (with logs)
}
rte_eal_get_configuration()->iova_mode = iova_mode;
} else {
rte_eal_get_configuration()->iova_mode =
internal_conf->iova_mode;
}
// verify rte_eal_get_configuration()->iova_mode
Note: the logic should be consistent across OS when possible.
More information about the dev
mailing list