Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5047554ybe; Tue, 17 Sep 2019 01:30:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqw5kI92Kk0qDe1PE216d5Xo8DVmtUDBRUpEhXJ2Jx7KW4ru0bWfNp0m7zW3PtUBGOpvrRuG X-Received: by 2002:a17:906:cf82:: with SMTP id um2mr3667425ejb.254.1568709041820; Tue, 17 Sep 2019 01:30:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568709041; cv=none; d=google.com; s=arc-20160816; b=UZk1q7hLRHN2StRe4h3ofjAvm8xLgl0U2biRcPtpi45Rl3tLTOBZioAvecDbbZeFEU iZP2GHRVkk1qfmHjAhsKfJkeUhwiP6YmA/WkfdYcIFDmfz3KIy4xpjWi2Lyf7Rhe9vSp JkviUXNKTdGAyie6RissGp2e2VR8KeVpjAtUVMaNr+IgYmMohlgPae0ZP2dTVv2VICvp QO5c1pNduPDvv/QB9yJAL0atAF6VbtssWDXnlB1o9Oy6VV6YVOyXg9BNUyxM2A12xeve 7eCER9ho0o+5h7BuvVIsGmZZhL5350Lh1k/qTCZgRPv7WwJvSUiOf9NCBNM7z0T0bbIj ZpUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=qGYk+wQLCbAh9xsAstC80CHB0G6yGmy+g311l5vsOCw=; b=m7m0wrMMMnEoI4XYExy7W8I1Ms2X2ntfjbFeRJDpOKsq9w1sJ79l6E7vlfcso8SyNj uhc5tT44u9bvmdGL3zergFnIoTfXS5VJcaancajW8QJqlxTZcZz+I4LOExAxHbaVUjNJ SIqBz51LmeD6CL3yr7n3uwjKCu80cHXlM5tTAnOpsBIM2PTV3/1IOmL/uREUThwAKQzZ ilXqHahgbKjhDDmZ/AwGraju/OaZ52p2IZI5JVmc1nqn9BqnezFAWhoKjABCN6VDPp10 +gCoNuvw50RD1ubiOnzBr3VZJovuDGjGxNT/I7k8a5fT0xE1wSe8DwBfRkMoNOOueGGb 7pYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v19si725097eja.46.2019.09.17.01.30.18; Tue, 17 Sep 2019 01:30:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390541AbfIQBE7 (ORCPT + 99 others); Mon, 16 Sep 2019 21:04:59 -0400 Received: from mga04.intel.com ([192.55.52.120]:34819 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727996AbfIQBE7 (ORCPT ); Mon, 16 Sep 2019 21:04:59 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Sep 2019 18:04:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,514,1559545200"; d="scan'208";a="180611926" Received: from dpdk-virtio-tbie-2.sh.intel.com ([10.67.104.71]) by orsmga008.jf.intel.com with ESMTP; 16 Sep 2019 18:04:55 -0700 From: Tiwei Bie To: mst@redhat.com, jasowang@redhat.com, alex.williamson@redhat.com, maxime.coquelin@redhat.com Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, dan.daly@intel.com, cunming.liang@intel.com, zhihong.wang@intel.com, lingshan.zhu@intel.com, tiwei.bie@intel.com Subject: [RFC v4 0/3] vhost: introduce mdev based hardware backend Date: Tue, 17 Sep 2019 09:02:01 +0800 Message-Id: <20190917010204.30376-1-tiwei.bie@intel.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This RFC is to demonstrate below ideas, a) Build vhost-mdev on top of the same abstraction defined in the virtio-mdev series [1]; b) Introduce /dev/vhost-mdev to do vhost ioctls and support setting mdev device as backend; Now the userspace API looks like this: - Userspace generates a compatible mdev device; - Userspace opens this mdev device with VFIO API (including doing IOMMU programming for this mdev device with VFIO's container/group based interface); - Userspace opens /dev/vhost-mdev and gets vhost fd; - Userspace uses vhost ioctls to setup vhost (userspace should do VHOST_MDEV_SET_BACKEND ioctl with VFIO group fd and device fd first before doing other vhost ioctls); Only compile test has been done for this series for now. RFCv3: https://patchwork.kernel.org/patch/11117785/ [1] https://lkml.org/lkml/2019/9/10/135 Tiwei Bie (3): vfio: support getting vfio device from device fd vfio: support checking vfio driver by device ops vhost: introduce mdev based hardware backend drivers/vfio/mdev/vfio_mdev.c | 3 +- drivers/vfio/vfio.c | 32 +++ drivers/vhost/Kconfig | 9 + drivers/vhost/Makefile | 3 + drivers/vhost/mdev.c | 462 +++++++++++++++++++++++++++++++ drivers/vhost/vhost.c | 39 ++- drivers/vhost/vhost.h | 6 + include/linux/vfio.h | 11 + include/uapi/linux/vhost.h | 10 + include/uapi/linux/vhost_types.h | 5 + 10 files changed, 573 insertions(+), 7 deletions(-) create mode 100644 drivers/vhost/mdev.c -- 2.17.1