Received: by 10.192.165.148 with SMTP id m20csp468022imm; Fri, 20 Apr 2018 09:36:34 -0700 (PDT) X-Google-Smtp-Source: AIpwx49w8OizAff47y2YH5PZABGoqyofU8I0wsimBQeS/et5zmraCnsWyaJcZ1AMlie5s9cYXTUQ X-Received: by 10.99.8.135 with SMTP id 129mr3666406pgi.17.1524242193940; Fri, 20 Apr 2018 09:36:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524242193; cv=none; d=google.com; s=arc-20160816; b=X4iMxScIH+7VDn6t5f5nypeKdt1yPwvB39NnjIU9icUuZY1fAXJ+B4TsrdKJEeR0x0 XJpzXJ6jJDyhnRDekJjKnhw44Roghk62GqsYk0d6NNEl2LRuZ8v8/g8/sl6XhJiw4doc yNjTkAcgrdF+HbWeQb1dr71A+/+o6CvWfUJhe+Q24fvIhOu/zun7vW9r3PL1LGcJy22g fe8rDsY84RW/Oa10hr1vnZ/ht0PNm6oBZQgNsU3Tl+5YcY6IkA7uCgifeqwZbxLz9EvR 40Pd2K1DO0XRLxkcA/0HZvbm3telrT3s9ywlRlOa8Wkczq05F1oBAEObPHajM+oVpP/s GCBA== 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 :arc-authentication-results; bh=glmqH9z/C6O9dpW1Ens0d2b+TXloxprzWIwjJG4JXpw=; b=dgBlFHZ/Tqj5lrwwkdyizPP1kFo3CLbYawrT20ZthASrE8OSII4JSNPG+/N6qGDoLf zvjFOQc2eSXa68MjW2o3S0iqiENS/XFDxMpvr4JKC9o/u8Ix5dDCP4Ol+WHItF6WfkhL KcbgR8+7304qNU5wYszNqpnWZEeU+1SUnhrag1ouxGop8rdt0//1sRgnEO2xwocuQ2B9 A98ApwfCmP67Ee3r7u7o4UF9RBsfm/CEGrP7TzcaBRnsSpR0hl1aO5xiD3/hThmSWCh2 UaodRzDGZ//KXtJYy5hBsn7IiHU/AXTlD91Qlz12DJufrQOfpKKWMA1h4R75zCFCuSjn QmbQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c1-v6si6413221pll.449.2018.04.20.09.36.16; Fri, 20 Apr 2018 09:36:33 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752291AbeDTQfF (ORCPT + 99 others); Fri, 20 Apr 2018 12:35:05 -0400 Received: from mga18.intel.com ([134.134.136.126]:13286 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750751AbeDTQfE (ORCPT ); Fri, 20 Apr 2018 12:35:04 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 09:35:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="222038367" Received: from ahduyck-green-test.jf.intel.com ([10.166.244.179]) by fmsmga005.fm.intel.com with ESMTP; 20 Apr 2018 09:34:59 -0700 Subject: [pci PATCH v8 0/4] 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: Fri, 20 Apr 2018 12:28:08 -0400 Message-ID: <20180420162633.46077.49012.stgit@ahduyck-green-test.jf.intel.com> 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 v8: Dropped virtio from the set, support to be added later after TC approval Cc: Mark Rustad Cc: Maximilian Heyne Cc: Liang-Min Wang Cc: David Woodhouse --- Alexander Duyck (4): pci: Add pci_sriov_configure_simple for PFs that don't manage VF resources 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 ++++++++++++++++++++++++++ include/linux/pci.h | 3 + include/linux/pci_ids.h | 2 + 8 files changed, 106 insertions(+), 46 deletions(-) create mode 100644 drivers/pci/pci-pf-stub.c --