Received: by 10.213.65.68 with SMTP id h4csp3871331imn; Tue, 3 Apr 2018 12:07:41 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/TXsvOIVC8l6g+5eYWu+8AHJcI9dPEm9t2JlpDYnzySSUCq36azSf24XEsQcXRTZwaXRwr X-Received: by 10.99.97.130 with SMTP id v124mr9847940pgb.351.1522782461517; Tue, 03 Apr 2018 12:07:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522782461; cv=none; d=google.com; s=arc-20160816; b=wMoYPbv3f3q/zPhBe+9f1pCbcK2wC5HIUxPhhlp/Sb+VsVralwzHAFOVHZEFbVNOcs 7hM6RZBESpXM3wn0hCZMwK0/+1PGavrjTrBdcxJEKNNa7AuaoFmffFfxCw+jCW3j5OsX gXRy6ena2AfshkubUvZyBpef1Mm7My5Nl4NmIS0bwQF5af5qg7UQC+tMbtTyg31oA2R0 rKYjn/DYHatc8JtglldACiH9+aV6yTUfRZ3nrz8jlIaqavLgwwFLPpzCaRPWcg/77Q76 /oQXxaZ18ofltUK/WWFgnYfskP7V6XEz6k1Z/kjhDRIWFIp8Rdl5yULZrMtSUxND750I B7PQ== 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=lxBTG/yVj9qT4sF7rgOIthPJiAfgGhsm804LX8oGFDo=; b=xBNP4k6Ifb/F91PDZ6IYO93dWMQsc3Ft6GFsrDUzp9k6qa1HtrTU4HdMG/MNh9HOzr SIu3IhSHoAxO7qXbw0BJGLEnZLAGjVGKS9jVVgY388orQHJro1nPRiJVmsJJRpXvk5sF vK00mKh3DrVzFVgljzs23SLH4ajdo6SPFUWGE/MGPKR9MMtECwvLk18kP5svVzo3pDMW 8p0oLf//MHm+kSl2UkJotBb1kuejUT9Kmee5kRjtWpP13ennNM7g/cawDGUsbEOBZvWx C8GfF3X+4lu60gK6doqI2p36O8MGNNMy5fNGUzK8mZrpvFXOFEXJpVuIVxMAYmQAb6qP c6AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JFZ0UMhJ; 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 d31-v6si1139509pld.495.2018.04.03.12.07.25; Tue, 03 Apr 2018 12:07:41 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JFZ0UMhJ; 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 S1753081AbeDCTGI (ORCPT + 99 others); Tue, 3 Apr 2018 15:06:08 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:37256 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752240AbeDCTGG (ORCPT ); Tue, 3 Apr 2018 15:06:06 -0400 Received: by mail-wm0-f65.google.com with SMTP id r131so37166855wmb.2; Tue, 03 Apr 2018 12:06:05 -0700 (PDT) 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=lxBTG/yVj9qT4sF7rgOIthPJiAfgGhsm804LX8oGFDo=; b=JFZ0UMhJvaFmCl/m+CHMgQ4yBDN5GW/ItRWXubLJ/V1XuvKYpJKtjtMSXAxBfi/fIe fZtT6/Nxw+rhl/fNhZ6WaQXYbw2REejMswOFG+SMuyZZvD7f6MDc3iARTikU6DrV7Ose IPIz+IkMDtbuw/B5WfgSfFhaVmIolvnaezpdwIZXA8E+/FaGc4BoRA04bYbYsj453adj rm04rXTofBt4PKtr7fBzxoQ3GozQUQ2ARKkHhb9Jleosc0XaYsjsEDdaAkcvs14k0sm3 FHT3JeEHaGgA6EXskMXCFHWpYkvL+rsMIxoS2a3oRVfW77viSI9K2/s6x7SKNzHM1lm8 wgXw== 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=lxBTG/yVj9qT4sF7rgOIthPJiAfgGhsm804LX8oGFDo=; b=TvPnzFtIHZdF5T2PA9Fv4y3+gwJ/IzTeJK6L5J1WowCU/AUjBCZUcQg2Nec/5rAone hXmXP7aOgBjQVi1aUpEmlMDpoh3qsvJ1Lo+exoEnwTkZzPtyiqf9wQSmJSn6QSZ8ZOWm dZaoH6x0gMAqggYhYYrTVAl1iQia0xHIkqgl7PAN8zub1V64DkKNtfyxBcCt+hIR+Qvw fP8cSqFCWvG0/IjpfVz1Rk9wLLRJexgCWe7eHjQTHakw5ITJjX+D62f8zD90JL/v1ZFZ oLkwIP3IgBFMkvMTUOMfj4wlQ5OyOWLI+Jvji9OowOosOoBtouPIrxfQKDbzCCymqs++ yfWw== X-Gm-Message-State: ALQs6tDQVP4x2aLaJvupPq4/NQzTIH0t4/mWZTddlDOE7YOW+AjbQ3hJ kQ5tHmKv6DWqENaZCA2YvOk5s9yKo98uOdo8R/SvLg== X-Received: by 10.28.69.93 with SMTP id s90mr4854590wma.71.1522782364377; Tue, 03 Apr 2018 12:06:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.184.189 with HTTP; Tue, 3 Apr 2018 12:06:03 -0700 (PDT) In-Reply-To: <20180403212503-mutt-send-email-mst@kernel.org> References: <20180315183449.3102.64791.stgit@localhost.localdomain> <20180315184132.3102.90947.stgit@localhost.localdomain> <20180316183042-mutt-send-email-mst@kernel.org> <20180403161151-mutt-send-email-mst@kernel.org> <20180403212503-mutt-send-email-mst@kernel.org> From: Alexander Duyck Date: Tue, 3 Apr 2018 12:06:03 -0700 Message-ID: Subject: Re: [virtio-dev] [pci PATCH v7 2/5] virtio_pci: Add support for unmanaged SR-IOV on virtio_pci devices To: "Michael S. Tsirkin" Cc: "Daly, Dan" , Bjorn Helgaas , "Duyck, Alexander H" , linux-pci@vger.kernel.org, virtio-dev@lists.oasis-open.org, kvm@vger.kernel.org, Netdev , LKML , linux-nvme@lists.infradead.org, Keith Busch , netanel@amazon.com, Don Dutile , Maximilian Heyne , "Wang, Liang-min" , "Rustad, Mark D" , David Woodhouse , Christoph Hellwig , dwmw@amazon.co.uk 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 Tue, Apr 3, 2018 at 11:27 AM, Michael S. Tsirkin wrote: > On Tue, Apr 03, 2018 at 10:32:00AM -0700, Alexander Duyck wrote: >> On Tue, Apr 3, 2018 at 6:12 AM, Michael S. Tsirkin wrote: >> > On Fri, Mar 16, 2018 at 09:40:34AM -0700, Alexander Duyck wrote: >> >> On Fri, Mar 16, 2018 at 9:34 AM, Michael S. Tsirkin wrote: >> >> > On Thu, Mar 15, 2018 at 11:42:41AM -0700, Alexander Duyck wrote: >> >> >> From: Alexander Duyck >> >> >> >> >> >> 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 currently 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. >> >> >> >> >> >> Reviewed-by: Christoph Hellwig >> >> >> Signed-off-by: Mark Rustad >> >> >> Signed-off-by: Alexander Duyck >> >> > >> >> > So if and when virtio PFs can manage the VFs, then we can >> >> > add a feature bit for that? >> >> > Seems reasonable. >> >> >> >> Yes. If nothing else you may not even need a feature bit depending on >> >> how things go. >> > >> > OTOH if the interface is changed in an incompatible way, >> > and old Linux will attempt to drive the new device >> > since there is no check. >> > >> > I think we should add a feature bit right away. >> >> I'm not sure why you would need a feature bit. The capability is >> controlled via PCI configuration space. If it is present the device >> has the capability. If it is not then it does not. >> >> Basically if the PCI configuration space is not present then the sysfs >> entries will not be spawned and nothing will attempt to use this >> function. >> >> - ALex > > It's about compability with older guests which ignore the > capability. > > The feature is thus helpful so host knows whether guest supports VFs. The thing is if the capability is ignored then the feature isn't used. So for SR-IOV it isn't an uncommon thing for there to be drivers for the PF floating around that do not support SR-IOV. In such cases SR-IOV just isn't used while the hardware could support it. I would think in the case of virtio it would be the same kind of thing. Basically if SR-IOV is supported by the host then the capability would be present. If SR-IOV is supported by the guest then it would make use of the capability to spawn VFs. If either the capability isn't present, or the driver doesn't use it then you won't be able to spawn VFs in the guest. Maybe I am missing something. Do you support dynamically changing the PCI configuration space for Virtio devices based on the presence of feature bits provided by the guest? Also are you saying this patch set should wait on the feature bit to be added, or are you talking about doing this as some sort of follow-up? - Alex