Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp1440565img; Tue, 19 Mar 2019 07:43:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxU0gELYH4iWrn1U2u51YNFGYx+EdwZyAJgu2wx0T27aIVwpkbzqiDC+4I8BFq11Dy+sM/p X-Received: by 2002:a65:568b:: with SMTP id v11mr2641293pgs.23.1553006589305; Tue, 19 Mar 2019 07:43:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553006589; cv=none; d=google.com; s=arc-20160816; b=su761PmHYaHg7gsi2n5EpXJQnHjtJKlEIznrrLKTsmQfShZZGEY5TqWiF+1w0McwLh LP3q+rZpvNesIZt3razNZ3fu38/RjZoBWlv1Sxjd4yY8Xe2A40Hgrm6ueokUSsHeCtXK IECzqWtaVAVOVTeopXHutMea+qeMcWuB7OrTZNRrwJL1UnItxa6IiSxOna4KzPK71uF0 5sL159AWZkdihGTVjqEMO+gidKrpCyHjFyg3Bu6U5s5ljJNoemP+rtFaw8bInyOdOcId QCBUUuO8dOEiXfxhGi/lTHoCXjXSn0uqBpGZQMQiS5pG9f3xRyKklQxEMwolmDwAfx6a CF2A== 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=f0nDQsA4pIgNGzk1zwUsykTRp6IS6MMIngudKwC146Y=; b=my+2m3gqwDY1USnqRBKeWZfIK0YA/sjjGby26P3evhiUh1X/I+Mi7kWSBuIeGYjThr ZmleuWRT0dpr3Jtuzr7IFJvQmzvy7BXjWqriFvQjnTfSA0AZlHD3VdSEjpAnPgftbepO l3rofHPy82N3/pa4o8aWcfQuG+afQFYxVuLTf6ajZOT4tEXVl85IX9JP7xFfAiJUsrEa lu+ljfsbXs3hfUZRB0y7ByeGiHwTGiJAe1ZKkdGusJnCyfQdTgVIj6X/hTnQYJwMRlBN XAErcs9grFBoMHZjsgtMyaDHL5bbK/649z+GnQlna62VBfloru2nDt7VQalxrFU0gAub ZJYA== 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 f1si12143148plr.55.2019.03.19.07.42.54; Tue, 19 Mar 2019 07:43:09 -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 S1727681AbfCSOl6 (ORCPT + 99 others); Tue, 19 Mar 2019 10:41:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57346 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726794AbfCSOl5 (ORCPT ); Tue, 19 Mar 2019 10:41:57 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D1A455946E; Tue, 19 Mar 2019 14:41:56 +0000 (UTC) Received: from maximlenovopc.usersys.redhat.com (dhcp-4-67.tlv.redhat.com [10.35.4.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9BA35C641; Tue, 19 Mar 2019 14:41:50 +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 1/9] vfio/mdev: add .request callback Date: Tue, 19 Mar 2019 16:41:08 +0200 Message-Id: <20190319144116.400-2-mlevitsk@redhat.com> In-Reply-To: <20190319144116.400-1-mlevitsk@redhat.com> References: <20190319144116.400-1-mlevitsk@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 19 Mar 2019 14:41:57 +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 b6e048e1045f..24887cd56962 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