Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp7125068yba; Thu, 2 May 2019 04:49:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfXeUVykqCiOGJCJixkteYbYhRWBZzjMwWSdhPvsQifIfXWqT31cU/zyh7VjmZ+sErgZ5D X-Received: by 2002:a17:902:778b:: with SMTP id o11mr3302062pll.333.1556797797738; Thu, 02 May 2019 04:49:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556797797; cv=none; d=google.com; s=arc-20160816; b=ZOchedIC2h8+Kp3QRWHglCcg9C0YDcTZBDJCSN9pqSqAhDL0QdHPzif9bQo1wU7YIq Df9vQuq4RRIXWT1A4AaFb1QMk+AS9RMU0AzNT7ID6lFFtDmLrYv9kEdmUoJaLA81PUJK 6i4W5M3zsuo6SgMmG9hjx7gwP+9IdTMguW480F1+Q+RYMfuMN3DlJx8BQnIigExdfP6l sWM60DONzxIXxzwz9e5MzrdsRC2iEf37C5XXtDVkA1rVpmarNjUBvtgzpW50Ucq78bwz rJvoDB3KpV2LWhQv3Zk/ckwx2gQBEpTq+GwpMmhUcrQo1Hy5lkV8EpWHPRYsAW8jplgq pAuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=XAA0xf1mhuH/1HVW1iNe3kkuONapyEcG4Bu5HWDP/Ek=; b=uQPRbWYbbAJCcn2l0IXl1Q5Rrn16WOj0c85Zv0Js6d1Z95hOS9CCrlM3dfmW6YPWxJ ByyuMQaRLUiRmwlYpCJFZE9A1ux0t/hm3rjECb5alUaIZG5g58vDTY++BdJEG/TzNNlR g2QEUKVwjDDoWGHY40ne5HavjXrX7MLmni9i9N9HaDAbosKSA3nuHVIt2eJmLtZ6YANV OzfcGHGb5pu8Vc3Uu/1BZg1aRgbm9lMAe9kBagn/D1gBqbkP5UDfOXMx4kp0b1p4BQwR nBFsdHWKRWQWRegW4FWz1fN2BFCkLi1owmCGIec4+JBKPF1jtv7vWvpWrYjNVbNbu0qp Ydnw== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v22si8757247pff.62.2019.05.02.04.49.42; Thu, 02 May 2019 04:49:57 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726457AbfEBLsk (ORCPT + 99 others); Thu, 2 May 2019 07:48:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47968 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726189AbfEBLsj (ORCPT ); Thu, 2 May 2019 07:48:39 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 39AFDF74AB; Thu, 2 May 2019 11:48:39 +0000 (UTC) Received: from maximlenovopc.usersys.redhat.com (unknown [10.35.206.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7999317DDF; Thu, 2 May 2019 11:48:34 +0000 (UTC) From: Maxim Levitsky To: linux-nvme@lists.infradead.org Cc: Maxim Levitsky , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Jens Axboe , Alex Williamson , Keith Busch , Christoph Hellwig , Sagi Grimberg , Kirti Wankhede , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Wolfram Sang , Nicolas Ferre , "Paul E . McKenney " , Paolo Bonzini , Liang Cunming , Liu Changpeng , Fam Zheng , Amnon Ilan , John Ferlan Subject: [PATCH v2 02/10] vfio/mdev: add .request callback Date: Thu, 2 May 2019 14:47:53 +0300 Message-Id: <20190502114801.23116-3-mlevitsk@redhat.com> In-Reply-To: <20190502114801.23116-1-mlevitsk@redhat.com> References: <20190502114801.23116-1-mlevitsk@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 02 May 2019 11:48:39 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This will allow the hotplug to be enabled for mediated devices Signed-off-by: Maxim Levitsky --- drivers/vfio/mdev/vfio_mdev.c | 11 +++++++++++ include/linux/mdev.h | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/drivers/vfio/mdev/vfio_mdev.c b/drivers/vfio/mdev/vfio_mdev.c index d230620fe02d..17aa76de0764 100644 --- a/drivers/vfio/mdev/vfio_mdev.c +++ b/drivers/vfio/mdev/vfio_mdev.c @@ -101,6 +101,16 @@ static int vfio_mdev_mmap(void *device_data, struct vm_area_struct *vma) return parent->ops->mmap(mdev, vma); } +static void vfio_mdev_request(void *device_data, unsigned int count) +{ + struct mdev_device *mdev = device_data; + struct mdev_parent *parent = mdev->parent; + + if (unlikely(!parent->ops->request)) + return; + parent->ops->request(mdev, count); +} + static const struct vfio_device_ops vfio_mdev_dev_ops = { .name = "vfio-mdev", .open = vfio_mdev_open, @@ -109,6 +119,7 @@ static const struct vfio_device_ops vfio_mdev_dev_ops = { .read = vfio_mdev_read, .write = vfio_mdev_write, .mmap = vfio_mdev_mmap, + .request = vfio_mdev_request, }; static int vfio_mdev_probe(struct device *dev) diff --git a/include/linux/mdev.h b/include/linux/mdev.h index d7aee90e5da5..6f315cb9575c 100644 --- a/include/linux/mdev.h +++ b/include/linux/mdev.h @@ -13,6 +13,9 @@ #ifndef MDEV_H #define MDEV_H +#include +#include + struct mdev_device; /** @@ -81,6 +84,7 @@ struct mdev_parent_ops { long (*ioctl)(struct mdev_device *mdev, unsigned int cmd, unsigned long arg); int (*mmap)(struct mdev_device *mdev, struct vm_area_struct *vma); + void (*request)(struct mdev_device *mdev, unsigned int count); }; /* interface for exporting mdev supported type attributes */ -- 2.17.2