Received: by 10.223.185.116 with SMTP id b49csp4280383wrg; Mon, 26 Feb 2018 14:40:41 -0800 (PST) X-Google-Smtp-Source: AH8x2245wh6wyi4AGU3J+Eb0jhEai9xpRocSsxVYmoVDEUSWr2XtPBcGIwk4A3IjQYheWYo3hHOA X-Received: by 10.98.103.69 with SMTP id b66mr12171737pfc.114.1519684840915; Mon, 26 Feb 2018 14:40:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519684840; cv=none; d=google.com; s=arc-20160816; b=0MKbA4GE69pPtL6PqzVo4+AMlwV0VVQVvT3/IKSL7Qfvbw5g8li8BxK6B+Nnim3snW aWgs5qgdyqhJpTPJ2T/W1KBa9YQ9N6T3ASrDpQAo0L9Md3yQ5rHWbJ+vZ+o/VjLz0BrO hpcrTvMyIo4SyD3pYzyr3kGUFaLlXvpwJAnDfg9yikwCNA3BEnfHR1Q1nmqS8ytuYMlL 0m0T8EKV0WZdokIN5FbFTxaAW3nONk8C2cDtzYwfimaZjKse8fRMYESvcHvYGrSRF1EQ ETfDhi3FYu6XB0DAYHdS9mPjGphfPMQjNus9DM3xN3iKmn0BLBT+9iygV2lAl+Tu72Xv tjjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=cRPYY1yNOf8eyKrC9tY2wIQuv2KYbkVEBO7Eh/APMzs=; b=mg+701QwOL10dBWn0Y7q87EZvbunOzAElqlp5yp+xbct979KmeL3NX31NhwenPXMil eYWHRMn+0Dlta4iMarikHiLIhSZG3bBIPA+cpmvN/sCD55er9GSafbLwZUw13md3fDLh hQX1YKSuIeceVpUFOw1a666kHSnTmmNHQBagGERjV5aQVGzll+J9RDnbGvJn0cX/j6u1 EnRvtsnGhcNe9ZfGN72+zLpoYWikggzgAokq4oSwhnHSzu3dsNVrNH5gueOhGxz4n9Rm CmO2fgWuW4sOvn378CggZ4br3kmIuoY046UuCyC2o2dy0yHYa/fcZCtFd7MIG7sRYxcB qWog== 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 j10si2081357pgq.431.2018.02.26.14.40.24; Mon, 26 Feb 2018 14:40:40 -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; 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 S1751830AbeBZWjS (ORCPT + 99 others); Mon, 26 Feb 2018 17:39:18 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48700 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751233AbeBZWjQ (ORCPT ); Mon, 26 Feb 2018 17:39:16 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5E69040FB64A; Mon, 26 Feb 2018 22:39:15 +0000 (UTC) Received: from redhat.com (ovpn-125-210.rdu2.redhat.com [10.10.125.210]) by smtp.corp.redhat.com (Postfix) with SMTP id ADC382026DFD; Mon, 26 Feb 2018 22:39:14 +0000 (UTC) Date: Tue, 27 Feb 2018 00:39:14 +0200 From: "Michael S. Tsirkin" To: Alexander Duyck Cc: Mark Rustad , virtio-dev@lists.oasis-open.org, Netdev , LKML , linux-pci@vger.kernel.org, "Daly, Dan" , Alex Williamson , Mark Rustad Subject: Re: [RFC PATCH V4] pci: virtio_pci: Add SR-IOV support for virtio_pci devices Message-ID: <20180227003852-mutt-send-email-mst@kernel.org> References: <20180226044837.19543.12267.stgit@mdrustad-mac04.local> <20180227003123-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 26 Feb 2018 22:39:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 26 Feb 2018 22:39:15 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mst@redhat.com' RCPT:'' 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 02:38:01PM -0800, Alexander Duyck wrote: > 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. I see. That's fine then. > 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