From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f181.google.com (mail-pf0-f181.google.com [209.85.192.181]) by dpdk.org (Postfix) with ESMTP id 5BE3D91E3 for ; Thu, 14 Jan 2016 14:29:27 +0100 (CET) Received: by mail-pf0-f181.google.com with SMTP id n128so99907357pfn.3 for ; Thu, 14 Jan 2016 05:29:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mvista-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=r5WBAgE2ixWDlej4eyh/BytHSpGsfv8oZe7TzIIv+Iw=; b=LxcfdmL+GScygV5DDJiNPKt20x5GDLx/BAFi/1ydrU6AeeCFFdytStOXnsP1IXuC+9 yqnrYlF6aVApKFLIPgtXnSYu+bgA5Tc9C4GrTihz35o4TBTJWUC8TH2Xf9Hy31NzxERk LomqwXpCL6poMVWgbC37hHWkg2IWj0xZWVZzXOwtUJUVg5Y+zibVBmHLF++h4Rn8quam HEMNq7+sPd7uXgGPNLRA+eYZDypzZfjYHZhKrXUGpzILNVC/+hj7CznTXBnyPgHOTqxX AvBmtaRqaliP/Z7Pir+guBK8wL1UC1L0jX6PRZ5yzh35McbYDnm/6Gs4M6dvxp1V+YtE 55Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=r5WBAgE2ixWDlej4eyh/BytHSpGsfv8oZe7TzIIv+Iw=; b=Z5ygXX36/VV09ZoOQ54v8QWz7GYbMMHVhNUDH9WtwKnmzU3COAdZFQY36deX8dKref cNyUZZXI9RWxX+hCeuLrTtcrmAs0n5SunOnIU3hvlGoU3VcatAKr0KLZBaC/v4DwN19W cmFqpVMujnb2CDpl6ME+mr690pMxMEcqXK74k0vSmdaBZs+n2IO4FSZp0qHAqB6gb0St fqhLMy9KIk8GMmkg6gdSPqDZAkMyQMqICMPUEuPKONol9fVBXU/q2o2rto1BhmW5kbLw DfpuuzawSEYxsUfJq7ZkYGK4+8IC1iZ8jhuxjDxjO6NK9c6jIuspPYE1mI0v8P1Bcf40 Ae0g== X-Gm-Message-State: ALoCoQknDuj4jPWZz+o6Rp+hMy4KnOW7oXLNikZ6syqte1VulIbt/C8/MXYUCKHFLhGhUlw4drBao488mvnN1U3yw9p+YG7XPA== X-Received: by 10.98.70.151 with SMTP id o23mr5794687pfi.124.1452778166764; Thu, 14 Jan 2016 05:29:26 -0800 (PST) Received: from santosh-Latitude-E5530-non-vPro.mvista.com ([111.93.218.67]) by smtp.gmail.com with ESMTPSA id v71sm9438472pfi.91.2016.01.14.05.29.23 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Jan 2016 05:29:25 -0800 (PST) From: Santosh Shukla To: dev@dpdk.org Date: Thu, 14 Jan 2016 18:58:36 +0530 Message-Id: <1452778117-30178-14-git-send-email-sshukla@mvista.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1452778117-30178-1-git-send-email-sshukla@mvista.com> References: <1452778117-30178-1-git-send-email-sshukla@mvista.com> Subject: [dpdk-dev] [PATCH v4 13/14] virtio: enable vfio in pmd driver X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jan 2016 13:29:27 -0000 Using mapping api i.e. rte_eal_pci_map_device() to create vfio container, group id and get the vfio-dev-fd for virtio-net-pci interface. Later vfio_dev_fd used for virtio device rd/wr operation. Signed-off-by: Santosh Shukla --- v3->v4: - Per stephens comment, removed static driver flag RTE_PCI_XXX_XX_NEED_MAPPING , now vfio virtio pmd driver intialized vifio interface at runtime. drivers/net/virtio/virtio_ethdev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 8f2260f..ce03a24 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -497,6 +497,8 @@ virtio_dev_close(struct rte_eth_dev *dev) hw->started = 0; virtio_dev_free_mbufs(dev); virtio_free_queues(dev); + + /* For vfio case : hotunplug/unmap not supported (todo) */ } static void @@ -1286,6 +1288,16 @@ static int virtio_hw_init_by_vfio(struct virtio_hw *hw, return -1; } + /* + * pci_map_device used not to actually map ioport region but + * create vfio container/group and vfio-dev-fd for _this_ + * virtio interface. + */ + if (rte_eal_pci_map_device(pci_dev) != 0) { + PMD_INIT_LOG(ERR, "vfio pci mapping failed for ioport bar\n"); + return -1; + } + /* .. So attached interface is vfio */ vdev->is_vfio = true; vdev->pci_dev = pci_dev; -- 1.7.9.5