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 9E752A056A; Thu, 5 Mar 2020 21:08:24 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4E44F2BB8; Thu, 5 Mar 2020 21:08:24 +0100 (CET) Received: from mail-oi1-f194.google.com (mail-oi1-f194.google.com [209.85.167.194]) by dpdk.org (Postfix) with ESMTP id 4A2913B5 for ; Thu, 5 Mar 2020 21:08:23 +0100 (CET) Received: by mail-oi1-f194.google.com with SMTP id v19so92989oic.12 for ; Thu, 05 Mar 2020 12:08:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=s7MvkQ4XJxk2M0R37gjHK2MVatOo4uhC9khwK8vDZi4=; b=Uop1URGtO3SpDxSnH5DrPn4fvJKQSensOdXjmaq86GhCRQUZf2pmmw6mbkD9W87e7t cJLkxJjgkuDXup1PAucFbENuPXV6cPK2KV2WVTtPgtO+9vwPQVqVT5DwfdSYI32FiQWT y5VpQUdofX/+gZ4WlzEcNdLh98tGz5wybT0rE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=s7MvkQ4XJxk2M0R37gjHK2MVatOo4uhC9khwK8vDZi4=; b=Ld1ZrX1wMa+2fMTpsrAV8qBcm+J6eQeurAOJs+PIIvf3z4TgfakOU/5um0Cqwpqe54 R9Qw8vwhsRdq0UY5Eg+qHwW6TVeh5rOR1ioHdOdRw1SGGyQbDmNcklC5/upRX/LUDiIo xIX29T/KafGEO53bYyImjZeGE06dbL8rqr/ZHqnjpyvcg480Gs7+ABjMn3EUvtgi7o3a 23NohHf0xN8ygUZMcpjITPL662SzjZhWssL7Fn9G5FloYvGHYYZ2kTCcopmdvo0JqyCm 9reQQi8nUqR0C+ApS+VddpAW2mGjU514ZcFkg4B4zMiDto4QnFH2GC9YSOeDySBqPOtp bY5Q== X-Gm-Message-State: ANhLgQ3ubcx4ygp8bP02yYxTGTkHfUGXbPn4iAvm2KFxBv/paWkSU27P +Y6JXMUjD0hEywBp+z/Za0sO68W1bZQ8xEvY6u8Rfg== X-Google-Smtp-Source: ADFU+vvb8cxzDhqym6Ov1+GW51bGtfflx+2rRrDKBtyapbV4MyHeuqAcxANklFDXpWUjGTvdHvqe0fSyfpn17iy46SY= X-Received: by 2002:aca:cf48:: with SMTP id f69mr117177oig.122.1583438902416; Thu, 05 Mar 2020 12:08:22 -0800 (PST) MIME-Version: 1.0 References: <158213716959.17090.8399427017403507114.stgit@gimli.home> <158213846731.17090.37693075723046377.stgit@gimli.home> <20200305112230.0dd77712@w520.home> In-Reply-To: <20200305112230.0dd77712@w520.home> From: Ajit Khaparde Date: Thu, 5 Mar 2020 12:08:05 -0800 Message-ID: To: Alex Williamson Cc: "Tian, Kevin" , "kvm@vger.kernel.org" , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "dev@dpdk.org" , "mtosatti@redhat.com" , "thomas@monjalon.net" , "bluca@debian.org" , "jerinjacobk@gmail.com" , "Richardson, Bruce" , "cohuck@redhat.com" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v2 5/7] vfio/pci: Add sriov_configure support 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" On Thu, Mar 5, 2020 at 10:22 AM Alex Williamson wrote: > On Tue, 25 Feb 2020 03:08:00 +0000 > "Tian, Kevin" wrote: > > > > From: Alex Williamson > > > Sent: Thursday, February 20, 2020 2:54 AM > > > > > > With the VF Token interface we can now expect that a vfio userspace > > > driver must be in collaboration with the PF driver, an unwitting > > > userspace driver will not be able to get past the GET_DEVICE_FD step > > > in accessing the device. We can now move on to actually allowing > > > SR-IOV to be enabled by vfio-pci on the PF. Support for this is not > > > enabled by default in this commit, but it does provide a module option > > > for this to be enabled (enable_sriov=1). Enabling VFs is rather > > > straightforward, except we don't want to risk that a VF might get > > > autoprobed and bound to other drivers, so a bus notifier is used to > > > "capture" VFs to vfio-pci using the driver_override support. We > > > assume any later action to bind the device to other drivers is > > > condoned by the system admin and allow it with a log warning. > > > > > > vfio-pci will disable SR-IOV on a PF before releasing the device, > > > allowing a VF driver to be assured other drivers cannot take over the > > > PF and that any other userspace driver must know the shared VF token. > > > This support also does not provide a mechanism for the PF userspace > > > driver itself to manipulate SR-IOV through the vfio API. With this > > > patch SR-IOV can only be enabled via the host sysfs interface and the > > > PF driver user cannot create or remove VFs. > > > > I'm not sure how many devices can be properly configured simply > > with pci_enable_sriov. It is not unusual to require PF driver prepare > > something before turning PCI SR-IOV capability. If you look kernel > > PF drivers, there are only two using generic pci_sriov_configure_ > > simple (simple wrapper like pci_enable_sriov), while most others > > implementing their own callback. However vfio itself has no idea > > thus I'm not sure how an user knows whether using this option can > > actually meet his purpose. I may miss something here, possibly > > using DPDK as an example will make it clearer. > > There is still the entire vfio userspace driver interface. Imagine for > example that QEMU emulates the SR-IOV capability and makes a call out > to libvirt (or maybe runs with privs for the PF SR-IOV sysfs attribs) > when the guest enables SR-IOV. Can't we assume that any PF specific > support can still be performed in the userspace/guest driver, leaving > us with a very simple and generic sriov_configure callback in vfio-pci? > Sorry for getting to this late. I think this is something worth considering. > Thanks, > > Alex > >