From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9F67FA0350; Mon, 29 Jun 2020 16:09:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E91D61BFAC; Mon, 29 Jun 2020 16:08:53 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 188E11BF9E for ; Mon, 29 Jun 2020 16:08:52 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from matan@mellanox.com) with SMTP; 29 Jun 2020 17:08:47 +0300 Received: from pegasus25.mtr.labs.mlnx. (pegasus25.mtr.labs.mlnx [10.210.16.10]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 05TE8RgR029797; Mon, 29 Jun 2020 17:08:47 +0300 From: Matan Azrad To: Maxime Coquelin Cc: dev@dpdk.org, Xiao Wang Date: Mon, 29 Jun 2020 14:08:19 +0000 Message-Id: <1593439701-136089-5-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1593439701-136089-1-git-send-email-matan@mellanox.com> References: <1593092298-52257-1-git-send-email-matan@mellanox.com> <1593439701-136089-1-git-send-email-matan@mellanox.com> Subject: [dpdk-dev] [PATCH v3 4/6] vhost: handle memory hotplug with vDPA devices X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Some vDPA drivers' basic configurations should be updated when the guest memory is hotplugged. Close vDPA device before hotplug operation and recreate it after the hotplug operation is done. Signed-off-by: Matan Azrad Reviewed-by: Maxime Coquelin Reviewed-by: Chenbo Xia --- lib/librte_vhost/vhost_user.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index b90fc78..f690fdb 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -1073,6 +1073,15 @@ } if (dev->mem) { + if (dev->flags & VIRTIO_DEV_VDPA_CONFIGURED) { + int did = dev->vdpa_dev_id; + struct rte_vdpa_device *vdpa_dev = + rte_vdpa_get_device(did); + + if (vdpa_dev && vdpa_dev->ops->dev_close) + vdpa_dev->ops->dev_close(dev->vid); + dev->flags &= ~VIRTIO_DEV_VDPA_CONFIGURED; + } free_mem_region(dev); rte_free(dev->mem); dev->mem = NULL; -- 1.8.3.1