From patchwork Thu Mar 8 19:00:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Duyck X-Patchwork-Id: 883257 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="romjlgLZ"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zy0G71M6Dz9shp for ; Fri, 9 Mar 2018 06:00:46 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752179AbeCHTAp (ORCPT ); Thu, 8 Mar 2018 14:00:45 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:40738 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752168AbeCHTAn (ORCPT ); Thu, 8 Mar 2018 14:00:43 -0500 Received: by mail-it0-f67.google.com with SMTP id e64so9177315ita.5; Thu, 08 Mar 2018 11:00:43 -0800 (PST) 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=miuOI+68Mwmr9OuXg9ETd3+PWPvlKnZv0hD4k/UDaPM=; b=romjlgLZ3tcU6kiZwTnqPv+stH1P5Sd3N82Mcs3Ow/DDdrt7ditCxk1E4icOR7A1fj qMgyP8JFdk2+IH+8LBwwnJXrhI3/DbkYksShfLJW+t/Y3S2qlcfjUz/S0HC9H/lJEWlb UPlUYop7ti7ArXjNXFznu+8ozPxqpcmLlpZTpfKN9MGrblCawdQ4P0AoB1oLjwXjoFVc 81pDSb6sjy1uhXtDoFOF8nIsrlWqHYWF5Ulc1rcFpeyX7OYXD7W5MWU69yH4u4DnCXS9 upXx3uXHatvsLFMa/m0rIcBTwz4q3Pkf4YimLDOKo5KExxhP2xysvSrA/4VujoTmULmu xlKQ== 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=miuOI+68Mwmr9OuXg9ETd3+PWPvlKnZv0hD4k/UDaPM=; b=IDbK8LTYd9BlUGtIEXJEXoM5QID+MXQbLqK/O0MF+CnDhMbOs8NyEFmuj+1g5yySoa u9UC90WrFlQnZjVheefBmgvysT+01+y8uHc3BzkXBzjsL6QbqtY60soUWsMO/MZShYio AQAYVgKBd+qtDk6cKpIBc+pzun3vVBVbQNtfp3xG6yeRW3rrPUCUdJGE+Z8fXfgeJeXp A+t1khUTSpjIZWx2E/fjv9OgDDpjWuJ3T9Vil0mMPgZXiA3+p50DPfAfNq5G0W1DBmaV TAYI548/C/n07G+WUFEygiRBLS73bbVxl82e26H0eRU/VwytvIn0S9fF/Rry6i4nT1XN Vefg== X-Gm-Message-State: AElRT7GBiweRHHRM9hK8D9lWQExdsWd/X/c4+5lFQQru33L42HrahWPY L8eB5lm6t0YXU6yCzv/X4wU= X-Google-Smtp-Source: AG47ELsjPmc7w2bMORtlC1G/oH20bgcqtoff+ocDp+AA+/SzqhyhIZCxc5u3WMjjO7Hal5e4rzSvkQ== X-Received: by 10.36.175.70 with SMTP id l6mr30323937iti.76.1520535642623; Thu, 08 Mar 2018 11:00:42 -0800 (PST) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id r35sm3698701ioi.25.2018.03.08.11.00.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Mar 2018 11:00:42 -0800 (PST) Subject: [pci PATCH v4 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, 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, 08 Mar 2018 11:00:40 -0800 Message-ID: <20180308185507.5433.98830.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@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 Cc: Mark Rustad Cc: Maximilian Heyne Cc: Liang-Min Wang Cc: David Woodhouse --- Alexander Duyck (4): pci-iov: Add support for unmanaged SR-IOV 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 Documentation/ABI/testing/sysfs-bus-pci | 25 +++++++++++++++ drivers/net/ethernet/amazon/ena/ena_netdev.c | 30 ++----------------- drivers/nvme/host/pci.c | 22 ++------------ drivers/pci/iov.c | 42 ++++++++++++++++++++++++++ drivers/pci/pci-driver.c | 2 + drivers/pci/pci-sysfs.c | 29 ++++++++++++++++++ drivers/pci/pci.h | 4 ++ drivers/virtio/virtio_pci_common.c | 3 ++ include/linux/pci.h | 1 + 9 files changed, 110 insertions(+), 48 deletions(-) --