Received: by 10.213.65.68 with SMTP id h4csp129574imn; Thu, 15 Mar 2018 11:43:15 -0700 (PDT) X-Google-Smtp-Source: AG47ELsKTLAH+EQTPcszZnEJsyvaUoX0zCHfAUbD71VWFd49GxVNVL5S7tAC0VglFuigsTsKrppX X-Received: by 2002:a17:902:7291:: with SMTP id d17-v6mr7917489pll.65.1521139395720; Thu, 15 Mar 2018 11:43:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521139395; cv=none; d=google.com; s=arc-20160816; b=bMpm6woU1GWoGPa2oFqer+xnwdWcR/UIeuFi5cFBryMzEFZCbaNFzz7w1XFaDwTMYP 8HFPlWOirj04C1jXt64+ClSlbStKX3aDOmqQkfLdq8SuoMHMD/qi/LKdnc/XiZ75+rms e7/KeKhfB+iuo8NMHcUGMTv5yE79hIRSTG8YV6mC8DeLgJlPtV0rbfyDwkVHeWJWv5ml 4WoeP4SNSKxf/KWsuCjCziwRv908YoLo75x6DST03yg5VY/nh8736+diHG/AHwSASO+z C2L/1HEW0qhZj344tQ/a68IGbDodzldZpiT41LppUKbG+2arSVlu0AyMMHdVjKhqg/Q+ z0Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:message-id:date:cc:to:from:subject:dkim-signature :arc-authentication-results; bh=I26edgMqyNLUM+t/rtw+xart0s/fmRS1pIQhjk/h/r8=; b=lG1CCPvSrM0qmzIQjKiWgWoF+aB8bE/34DYiBXOY0+sr31XoRNkhEHeCpwhzlL7om5 aTydlypcDvTFvOkMJ4TtFAA4tLYFNMcFGYR/o/U6cLGILm08xKsAPiWOyc/cTjaPJKeK BWgjzLKQRbvb3IjkRe4G5uJbAwxmRNrH3Jv7/cssMZPmjyHI4FA/KMILUUtOTaYv6KSt x+Sr0iKfzjO62z5pfjzbvaUuEA52qqR1LxBaCnCnDZG8kM4pdo555ciLmM645eR8QYIM uf4UUHovLN6zpi+59Ngk65KfpMbylQxjLuzOiRIdzmFXWxHsYuTYnm2budJ1RqjBMETm QQxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vYAFVNfO; 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 o2si3773381pgf.658.2018.03.15.11.43.00; Thu, 15 Mar 2018 11:43:15 -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=vYAFVNfO; 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 S1752688AbeCOSkz (ORCPT + 99 others); Thu, 15 Mar 2018 14:40:55 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:38277 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751508AbeCOSkv (ORCPT ); Thu, 15 Mar 2018 14:40:51 -0400 Received: by mail-pf0-f194.google.com with SMTP id d26so3162241pfn.5; Thu, 15 Mar 2018 11:40:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:date:message-id:user-agent:mime-version :content-transfer-encoding; bh=I26edgMqyNLUM+t/rtw+xart0s/fmRS1pIQhjk/h/r8=; b=vYAFVNfOS8CO81Las16t4gLiOcUDpLUNUvGZ273QZl+Ilzf7F4+QBpZXI72mxlfPXH 8T/Rpp+EgHLjC/0CS/uCSNRRHTsUf+S8H88/BczLvSYrqKwxzWDE+3c/GvFEAKzTIJeQ dThRiNbOmRw+JH6qQuphNheDYHSsHvnkfG6OOJM/WDAxH19ukV8EgZRoBto1rBX0pC55 cnwixKZAnIZZEknMwEkQk6h8qyCUT6UDXFayjbenhbqoLXIbXgcN+6ZlwpDH0LTwIu/A QA1Wby+f7KvHY3fQ14VSNNmONarCYxw4TNMu80xtnuSfPfG/G6o/V5aKEDKPjrdgKy2O AX1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:date:message-id:user-agent :mime-version:content-transfer-encoding; bh=I26edgMqyNLUM+t/rtw+xart0s/fmRS1pIQhjk/h/r8=; b=LFlHpnLdzynbjpIZJUHOUctWBnQrI7ODmusSG7Mz8qJHwoR4sPkrNyf43vR7wrVbpa wGOrqnPnpcjJ69d7eumRwmuVypWTowW+BjwOmfFiCa+F9KQVufSQm+Kc0kZqWPjRfEyp erMqqrzPN1GBSAnYOh0F6TJD6YizQeBVI2W1CyGrFwz3azDLKwlu2jY5ZPklpOzlJvEe oXA1q+A5TOf/jf4RboqJ7LCKxMe4TolDAC6l+K8EA9h7ozkZzsc/Qr4bQeVSbtTO/hJK fAPtaFKa82UNHfUAYrc1Npz5dT1VOTbr0eUNwtyFkwxMLJMbWtXbBbbUKDHaNLAtYske 8S0A== X-Gm-Message-State: AElRT7Fv7foIZN0M4eR7lPytzP5D7/A3bB8xTaDlnSzrwoJ8gNji3lLC RwlkQl7atg78kg0MKnMjEbo= X-Received: by 10.101.83.13 with SMTP id m13mr1253721pgq.248.1521139250449; Thu, 15 Mar 2018 11:40:50 -0700 (PDT) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id s7sm3728765pgr.90.2018.03.15.11.40.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Mar 2018 11:40:49 -0700 (PDT) Subject: [pci PATCH v7 0/5] Add support for unmanaged SR-IOV From: Alexander Duyck To: bhelgaas@google.com, alexander.h.duyck@intel.com, linux-pci@vger.kernel.org Cc: virtio-dev@lists.oasis-open.org, kvm@vger.kernel.org, netdev@vger.kernel.org, dan.daly@intel.com, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, keith.busch@intel.com, netanel@amazon.com, ddutile@redhat.com, mheyne@amazon.de, liang-min.wang@intel.com, mark.d.rustad@intel.com, dwmw2@infradead.org, hch@lst.de, dwmw@amazon.co.uk Date: Thu, 15 Mar 2018 11:40:48 -0700 Message-ID: <20180315183449.3102.64791.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series is meant to add support for SR-IOV on devices when the VFs are not managed by the kernel. Examples of recent patches attempting to do this include: virto - https://patchwork.kernel.org/patch/10241225/ pci-stub - https://patchwork.kernel.org/patch/10109935/ vfio - https://patchwork.kernel.org/patch/10103353/ uio - https://patchwork.kernel.org/patch/9974031/ Since this is quickly blowing up into a multi-driver problem it is probably best to implement this solution as generically as possible. This series is an attempt to do that. What we do with this patch set is provide a generic framework to enable SR-IOV in the case that the PF driver doesn't support managing the VFs itself. I based my patch set originally on the patch by Mark Rustad but there isn't much left after going through and cleaning out the bits that were no longer needed, and after incorporating the feedback from David Miller. At this point the only items to be fully reused was his patch description which is now present in patch 3 of the set. This solution is limited in scope to just adding support for devices that provide no functionality for SR-IOV other than allocating the VFs by calling pci_enable_sriov. Previous sets had included patches for VFIO, but for now I am dropping that as the scope of that work is larger then I think I can take on at this time. v2: Reduced scope back to just virtio_pci and vfio-pci Broke into 3 patch set from single patch Changed autoprobe behavior to always set when num_vfs is set non-zero v3: Updated Documentation to clarify when sriov_unmanaged_autoprobe is used Wrapped vfio_pci_sriov_configure to fix build errors w/o SR-IOV in kernel v4: Dropped vfio-pci patch Added ena and nvme to drivers now using pci_sriov_configure_unmanaged Dropped pci_disable_sriov call in virtio_pci to be consistent with ena v5: Dropped sriov_unmanaged_autoprobe and pci_sriov_conifgure_unmanaged Added new patch that enables pci_sriov_configure_simple Updated drivers to use pci_sriov_configure_simple v6: Defined pci_sriov_configure_simple as NULL when SR-IOV is not enabled Updated drivers to drop "#ifdef" checks for IOV Added pci-pf-stub as place for PF-only drivers to add support v7: Dropped pci_id table explanation from pci-pf-stub driver Updated pci_sriov_configure_simple to drop need for err value Fixed comment explaining why pci_sriov_configure_simple is NULL Cc: Mark Rustad Cc: Maximilian Heyne Cc: Liang-Min Wang Cc: David Woodhouse --- Alexander Duyck (5): pci: Add pci_sriov_configure_simple for PFs that don't manage VF resources virtio_pci: Add support for unmanaged SR-IOV on virtio_pci devices ena: Migrate over to unmanaged SR-IOV support nvme: Migrate over to unmanaged SR-IOV support pci-pf-stub: Add PF driver stub for PFs that function only to enable VFs drivers/net/ethernet/amazon/ena/ena_netdev.c | 28 ------------- drivers/nvme/host/pci.c | 20 ---------- drivers/pci/Kconfig | 12 ++++++ drivers/pci/Makefile | 2 + drivers/pci/iov.c | 31 +++++++++++++++ drivers/pci/pci-pf-stub.c | 54 ++++++++++++++++++++++++++ drivers/virtio/virtio_pci_common.c | 1 include/linux/pci.h | 3 + include/linux/pci_ids.h | 2 + 9 files changed, 107 insertions(+), 46 deletions(-) create mode 100644 drivers/pci/pci-pf-stub.c --