[PATCH v3] usertools: add check for IOMMU support in dpdk-devbind
Burakov, Anatoly
anatoly.burakov at intel.com
Thu Mar 31 16:37:40 CEST 2022
On 21-Mar-22 12:27 PM, Fidaullah Noonari wrote:
> binding with vfio driver, when IOMMU is disabled, causes program to crash.
> this patch adds a flag for noiommmu-mode. when this is set, if IOMMU is
> disabled, it changes vfio into unsafe noiommu mode and prints warning
> message.
>
> Signed-off-by: Fidaullah Noonari <fidaullah.noonari at emumba.com>
> ---
Hi,
> +def check_noiommu_mode():
> + """checks and enables the noiommu mode for vfio drivers"""
> + global noiommu_flag
> + filename = "/sys/module/vfio/parameters/enable_unsafe_noiommu_mode"
> +
> + try:
> + with open(filename,"r") as f:
> + if f.read(1) == "1":
> + return
> + except OSError as err:
> + sys.exit("Error: failed to enable unsafe noiommu mode - Cannot open %s: %s"
> + % (filename, err))
Nitpick, but maybe use f-strings instead of old-school string interpolation?
> +
> + if not noiommu_flag:
> + print("Error: failed to bind vfio-pci - IOMMU support is disabled")
> + print("Info: use --noiommu-mode for binding in noiommu mode")
> + sys.exit()
> +
> + try:
> + with open(filename, "w") as f:
> + f.write("1")
> + f.close()
> + except OSError as err:
> + sys.exit("Error: failed to enable unsafe noiommu mode - Cannot open %s: %s"
> + % (filename, err))
Same as above.
Otherwise LGTM,
Acked-by: Anatoly Burakov <anatoly.burakov at intel.com>
--
Thanks,
Anatoly
More information about the dev
mailing list