Received: by 10.223.185.116 with SMTP id b49csp4279315wrg; Mon, 26 Feb 2018 14:39:10 -0800 (PST) X-Google-Smtp-Source: AH8x224/tHbtwn5kXp2TCEBQ3WLUE1braVcQwTxfH77qdvbzkktTc/RfbhCrjWzQbvWEsddO0EI1 X-Received: by 10.99.116.10 with SMTP id p10mr9682028pgc.97.1519684750397; Mon, 26 Feb 2018 14:39:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519684750; cv=none; d=google.com; s=arc-20160816; b=HeZBFWSem94LjSlr1XP5B/4V9dWdtKyny8u/ZIaTQoWElVztpbU6CGm0676er71jdz vgKvfGmmKy0M0HiEu5OtEtGKpwooNSn1Iq8OhogLFDI1FKYUVGI20M3B7gqngiKZ7H1c bHx4wKfqJBA1LjbZAZcLekM0eYsbBMRG6CTksDdWota1GXUyXDZai2Vs28r/nH07HiyN WmUx79Y823ZpWRYTlJT0SvwD7jVoYnbxlR/CbH6ki7iHFxNrub2GQLWazDyCwSl1ZXYu qVSudHUB5pD+LXk2wwpTO0JAklBHdcSlj4TbM8agG8Exop7uNbdUuwfHGISDHJeXB1Xe 2nxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=SvgruiuHZ3AsH+jpBO1XCi+MZdkQQu1vEiPS45auSc8=; b=W41UjiUQUuvR4nQkEhm6TSBA1fYtO+odi1l9I4ZhvLXelc/QuB2BMud7+EpQ7/k8GX +ORN2GuQeuHwTdlZlag5ZT/iU8W0Tk+578s/YW2GfgLkpK3oD/Ts5YXzmcJSTsBtI1/9 fuRc9wWX0p0m7TwkUf8t6YImYmPC5w1xfhih4YBtzUOKh5ZYn6N9p5bSkwQ6jdguhBjl meqe4MjctxUNBcWEkM1dncSAmOdlxxjRcfU4Nt7JyM2RJ4u9I/RLRUtGEX34enHjwZqz jQ3+bnqJrm9LGC6sZnzviqRQRf6X8SxHcPec53o9RpHkDg86Lwh+V7cB1jXYAWf31Ab7 0XdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HBdn8kw/; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w27si7453007pfl.142.2018.02.26.14.38.53; Mon, 26 Feb 2018 14:39:10 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HBdn8kw/; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751586AbeBZWiE (ORCPT + 99 others); Mon, 26 Feb 2018 17:38:04 -0500 Received: from mail-qk0-f194.google.com ([209.85.220.194]:36751 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751236AbeBZWiC (ORCPT ); Mon, 26 Feb 2018 17:38:02 -0500 Received: by mail-qk0-f194.google.com with SMTP id d206so21167157qkb.3; Mon, 26 Feb 2018 14:38:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=SvgruiuHZ3AsH+jpBO1XCi+MZdkQQu1vEiPS45auSc8=; b=HBdn8kw/eN1QA6XubWOxNZrKgE0KU6KQujM0YH7Rob4kWF3Gz9a0/6qTOjpPVyZqM8 za411/rG1nuaahqbELyRhdJJU59/m7FzqRb1Ic/l5PEc+D5K07hJDeSeWCibBD2cZBmS PGPDB9CGuTeZTqmTLlV/ro58RxvFUmZXXmnHqMwpzuQxDKQM9abP6vXXFIG7wxqnXpL7 Qebck9L2NVGX3uDt/abSMmtTQtQtLIqtFoskitYg2Jj+LdIn/6fO5+rjJnHiQpyBky68 QUGk4tVC6SdGyyOmWY5F2+8arN3TRLFlTSJZzs8gzrux93eC8Pkd3FO+GXnb8LLZor0A BhnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=SvgruiuHZ3AsH+jpBO1XCi+MZdkQQu1vEiPS45auSc8=; b=TXS7KQuhLwg6Ka/ZSqQnHwSNeUuBdW0GP0bCACFGGuvxbKC0g5KRClVv2741eHKL/O yFxjjmg/ZgRqwBt+mA9n4FZYOYXiFywOKKSqtuYQhhPuu4aOV8Nft45jVlC7ZyyQRCwB z2+GXe7+LgD+DV3+IqKELwZgwzRsZ6Qbh8ag5RaoQrpmxz4m8WJlgAXN2dcCwTkQPrct M29jcMX1dCsmuWIr3w0zbg8EsRcczZh/x0GPp3EffYUtolYsaDJtAEAcaxDgfV7pwOhu WxNeckoKMjnx1IyTMYg65J6qzEu3l6pELACiArb5NDnGoinZeOjBGbn74YQXkrbF6oF8 3pIg== X-Gm-Message-State: APf1xPCDAhasYcdQXUpC47J2B3/DvyBId2CF3HAwRucSUP8zfF6wnNA1 U1NddgidwgrcTz64zaMATw95oyICIBKPoL2Nllw= X-Received: by 10.55.173.7 with SMTP id f7mr19110909qkm.195.1519684681910; Mon, 26 Feb 2018 14:38:01 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.89.138 with HTTP; Mon, 26 Feb 2018 14:38:01 -0800 (PST) In-Reply-To: <20180227003123-mutt-send-email-mst@kernel.org> References: <20180226044837.19543.12267.stgit@mdrustad-mac04.local> <20180227003123-mutt-send-email-mst@kernel.org> From: Alexander Duyck Date: Mon, 26 Feb 2018 14:38:01 -0800 Message-ID: Subject: Re: [RFC PATCH V4] pci: virtio_pci: Add SR-IOV support for virtio_pci devices To: "Michael S. Tsirkin" Cc: Mark Rustad , virtio-dev@lists.oasis-open.org, Netdev , LKML , linux-pci@vger.kernel.org, "Daly, Dan" , Alex Williamson , Mark Rustad Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 26, 2018 at 2:32 PM, Michael S. Tsirkin wrote: > On Mon, Feb 26, 2018 at 07:26:14AM -0800, Alexander Duyck wrote: >> On Sun, Feb 25, 2018 at 8:48 PM, Mark Rustad wrote: >> > Hardware-realized virtio_pci devices can implement SR-IOV, so this >> > patch enables its use. The device in question is an upcoming Intel >> > NIC that implements both a virtio_net PF and virtio_net VFs. These >> > are hardware realizations of what has been up to now been a software >> > interface. >> > >> > The device in question has the following 4-part PCI IDs: >> > >> > PF: vendor: 1af4 device: 1041 subvendor: 8086 subdevice: 15fe >> > VF: vendor: 1af4 device: 1041 subvendor: 8086 subdevice: 05fe >> > >> > The patch needs no check for device ID, because the callback will >> > never be made for devices that do not assert the capability or >> > when run on a platform incapable of SR-IOV. >> > >> > One reason for this patch is because the hardware requires the >> > vendor ID of a VF to be the same as the vendor ID of the PF that >> > created it. So it seemed logical to simply have a fully-functioning >> > virtio_net PF create the VFs. This patch makes that possible. >> > >> > Signed-off-by: Mark Rustad >> > Reviewed-by: Alexander Duyck >> >> Mark, >> >> In the future please don't put my "Reviewed-by" on a patch that I >> haven't reviewed. I believe I reviewed one of the earlier patches, but >> I hadn't reviewed this version. >> >> Also, after thinking about it over the weekend we may want to look at >> just coming up with a truly "generic" solution that is applied to >> SR-IOV capable devices that don't have a SR-IOV capable driver loaded >> on them. That would allow us to handle the uio, vfio, pci-stub, and >> virtio cases all in one fell swoop. I think us going though and >> modifying one patch at a time to do this kind of thing isn't going to >> scale. > > uio really can't support VFs properly - without proper IOMMU > support any MSIs can corrupt kernel memory, and VFs are > limited to MSIs. UIO wasn't being run on the VFs, it was just running the PF. The point is that there have been about 4 attempts, including this one, to add SR-IOV support to drivers that don't actually do any VF management internally. They were just being used as a shim so that they could add the sriov_configure function to a driver that would load on the PF. If we make the solution generic I think it should turn out pretty clean. Most of the work just needs to happen in the sysfs function for storing the value that is written to sriov_numvfs. I'm working with Mark and a few other people now to get this addressed and I hope that we can have a patch available shortly. Thanks. - Alex