From: Hemant Agrawal <hemant.agrawal@oss.nxp.com>
To: Romain Delhomel <romain.delhomel@6wind.com>,
hemant.agrawal@nxp.com, sachin.saxena@oss.nxp.com
Cc: dev@dpdk.org, olivier.matz@6wind.com, stephane.gonauer@6wind.com,
guillaume.gaudonville@6wind.com, elias.boutaleb@6wind.com
Subject: Re: [RFC v2] bus/fslmc: fix invalid use of default VFIO config
Date: Fri, 3 Jun 2022 19:28:56 +0530 [thread overview]
Message-ID: <21b2fe06-ab71-87b6-2942-fea89cf9e9e8@oss.nxp.com> (raw)
In-Reply-To: <20220531092753.10825-1-romain.delhomel@6wind.com>
Tested ok
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
On 5/31/2022 2:57 PM, Romain Delhomel wrote:
> At device probe, the fslmc bus driver calls rte_vfio_get_group_fd() to
> get a fd associated to a vfio group. This function first checks if the
> group is already opened, else it opens /dev/vfio/%u, and increases the
> number of active groups in default_vfio_cfg (which references the
> default vfio container).
>
> When adding the first group to a vfio_cfg, the caller is supposed to
> pick an IOMMU type and set up DMA mappings for container, as it's done
> by pci bus, but it is not done here. Instead, a new container is created
> and used.
>
> This prevents the pci bus driver, which uses the default_vfio_cfg
> container, to configure the container because
> default_vfio_cfg->active_group > 1.
>
> This patch fixes the issue by always creating a new container (and its
> associated vfio_cfg) and binding the group to it.
>
> Fixes: a69f79300262 ("bus/fslmc: support multi VFIO group")
> Signed-off-by: Romain Delhomel <romain.delhomel@6wind.com>
> ---
> v2:
> * Fix wrong indentation
>
> drivers/bus/fslmc/fslmc_vfio.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
> index b4704eeae4e2..abe1cab2ee20 100644
> --- a/drivers/bus/fslmc/fslmc_vfio.c
> +++ b/drivers/bus/fslmc/fslmc_vfio.c
> @@ -979,6 +979,7 @@ fslmc_vfio_setup_group(void)
> {
> int groupid;
> int ret;
> + int vfio_container_fd;
> struct vfio_group_status status = { .argsz = sizeof(status) };
>
> /* if already done once */
> @@ -997,8 +998,15 @@ fslmc_vfio_setup_group(void)
> return 0;
> }
>
> + ret = rte_vfio_container_create();
> + if (ret < 0) {
> + DPAA2_BUS_ERR("Failed to open VFIO container");
> + return ret;
> + }
> + vfio_container_fd = ret;
> +
> /* Get the actual group fd */
> - ret = rte_vfio_get_group_fd(groupid);
> + ret = rte_vfio_container_group_bind(vfio_container_fd, groupid);
> if (ret < 0)
> return ret;
> vfio_group.fd = ret;
next prev parent reply other threads:[~2022-06-03 13:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-27 8:28 [RFC] bus/fslmc: fix invalid use of default vfio config Romain Delhomel
2022-05-27 8:34 ` Romain Delhomel
2022-05-27 8:38 ` Romain Delhomel
2022-05-31 9:27 ` [RFC v2] bus/fslmc: fix invalid use of default VFIO config Romain Delhomel
2022-06-03 13:58 ` Hemant Agrawal [this message]
2022-06-03 15:18 ` [PATCH] " Romain Delhomel
2022-06-07 15:41 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=21b2fe06-ab71-87b6-2942-fea89cf9e9e8@oss.nxp.com \
--to=hemant.agrawal@oss.nxp.com \
--cc=dev@dpdk.org \
--cc=elias.boutaleb@6wind.com \
--cc=guillaume.gaudonville@6wind.com \
--cc=hemant.agrawal@nxp.com \
--cc=olivier.matz@6wind.com \
--cc=romain.delhomel@6wind.com \
--cc=sachin.saxena@oss.nxp.com \
--cc=stephane.gonauer@6wind.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).