[dpdk-dev] [PATCH v2 2/8] crypto/bcmfs: add vfio support
Akhil Goyal
akhil.goyal at nxp.com
Mon Sep 28 21:00:23 CEST 2020
Hi Vikas,
> Subject: [PATCH v2 2/8] crypto/bcmfs: add vfio support
>
> Add vfio support for device.
>
> Signed-off-by: Vikas Gupta <vikas.gupta at broadcom.com>
> Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi at broadcom.com>
> Reviewed-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
> ---
> drivers/crypto/bcmfs/bcmfs_device.c | 5 ++
> drivers/crypto/bcmfs/bcmfs_device.h | 6 ++
> drivers/crypto/bcmfs/bcmfs_vfio.c | 107 ++++++++++++++++++++++++++++
> drivers/crypto/bcmfs/bcmfs_vfio.h | 17 +++++
> drivers/crypto/bcmfs/meson.build | 3 +-
> 5 files changed, 137 insertions(+), 1 deletion(-)
> create mode 100644 drivers/crypto/bcmfs/bcmfs_vfio.c
> create mode 100644 drivers/crypto/bcmfs/bcmfs_vfio.h
>
> diff --git a/drivers/crypto/bcmfs/bcmfs_device.c
> b/drivers/crypto/bcmfs/bcmfs_device.c
> index 47c776de6..3b5cc9e98 100644
> --- a/drivers/crypto/bcmfs/bcmfs_device.c
> +++ b/drivers/crypto/bcmfs/bcmfs_device.c
> @@ -11,6 +11,7 @@
>
> #include "bcmfs_device.h"
> #include "bcmfs_logs.h"
> +#include "bcmfs_vfio.h"
>
> struct bcmfs_device_attr {
> const char name[BCMFS_MAX_PATH_LEN];
> @@ -71,6 +72,10 @@ fsdev_allocate_one_dev(struct rte_vdev_device *vdev,
>
> fsdev->vdev = vdev;
>
> + /* attach to VFIO */
> + if (bcmfs_attach_vfio(fsdev))
> + goto cleanup;
> +
> TAILQ_INSERT_TAIL(&fsdev_list, fsdev, next);
>
> return fsdev;
> diff --git a/drivers/crypto/bcmfs/bcmfs_device.h
> b/drivers/crypto/bcmfs/bcmfs_device.h
> index cc64a8df2..c41cc0031 100644
> --- a/drivers/crypto/bcmfs/bcmfs_device.h
> +++ b/drivers/crypto/bcmfs/bcmfs_device.h
> @@ -35,6 +35,12 @@ struct bcmfs_device {
> char name[BCMFS_DEV_NAME_LEN];
> /* Parent vdev */
> struct rte_vdev_device *vdev;
> + /* vfio handle */
> + int vfio_dev_fd;
> + /* mapped address */
> + uint8_t *mmap_addr;
> + /* mapped size */
> + uint32_t mmap_size;
> };
>
> #endif /* _BCMFS_DEV_H_ */
> diff --git a/drivers/crypto/bcmfs/bcmfs_vfio.c
> b/drivers/crypto/bcmfs/bcmfs_vfio.c
> new file mode 100644
> index 000000000..dc2def580
> --- /dev/null
> +++ b/drivers/crypto/bcmfs/bcmfs_vfio.c
> @@ -0,0 +1,107 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(C) 2020 Broadcom.
> + * All rights reserved.
> + */
> +
> +#include <errno.h>
> +#include <sys/mman.h>
> +#include <sys/ioctl.h>
> +
> +#include <rte_vfio.h>
> +
> +#include "bcmfs_device.h"
> +#include "bcmfs_logs.h"
> +#include "bcmfs_vfio.h"
> +
> +#ifdef VFIO_PRESENT
I cannot see VFIO_PRESENT flag defined in this patch.
Hence the below code is a dead code and the patch
Title is not justified as it says adding support for VFIO.
> +static int
> +vfio_map_dev_obj(const char *path, const char *dev_obj,
> + uint32_t *size, void **addr, int *dev_fd)
Regards,
Akhil
More information about the dev
mailing list