Received: by 10.213.65.68 with SMTP id h4csp227021imn; Mon, 12 Mar 2018 11:52:35 -0700 (PDT) X-Google-Smtp-Source: AG47ELuI6/4sNj352nfq55ZFA/RMg55eN8tZm4811gi41OGQfh7KOvETLiyfQrfOp+NO3nM/Qisp X-Received: by 10.98.223.143 with SMTP id d15mr9010280pfl.208.1520880755736; Mon, 12 Mar 2018 11:52:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520880755; cv=none; d=google.com; s=arc-20160816; b=XukkWSvhAGC7SBgTT4ipTBbKJ3FlwslQZVZRuXv8sSM6TN+8N0qBqrXhSbvnpMNCW5 /8KtxZeOfzYP1cANfyezW7hWAbTEuIWMYUCCbMKT7kCEEP9Szmm5GNZHTXvwrguCBpbd e7+ufTCkGURNkrgyjVhM7Hlwhqiu/CPjex1Q5bgH2RdD2/bwl6pNf2Bc2JbyFjP9GPlo Yb4V8OomkKF8XeHMmEXflxNtGVRI/hTbGrzJqXKyTd6sHmpUpocQzLJ+nzQu4igKd8FM +LoRZgamP6riZviISxVa2h/NDrpCIswohi/WItPcaKoEjPjR5/l7JJjADNfcpksEgt9d bExQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=No9zxHF7KaTeKzqM/r5YhJD2LCIwcZ8QlXiiDYAUFfc=; b=LV5tfmC674VN5PsNTx07M1ZAuAPA17HUE5OdAd88Y+pvAIgDh3ZvLCnrmDATe3WRz7 2qSngarKSmdoLuN7P452FSU2U0Oxj3AlKeHvX6ZgOEXKJzNUC5J/Sf19ACPSrG9Oi0ua kp2ZsEN3DWx4YIaHqsfXj6PxBE5QdD5pNjfmxSNU5XdsNMba4P45MId1CACtr69HAg1d PPmUsmkTNC6J33bu9aj/i7XbK/9eybH/w+JTgWInXRwgIQ6qIWkGCfTB7TsamhVk4fGn OeDzahrs6aon/H5AwqIERZrB287FazswwzJ3hFLio/UyffTIXQRyf0lz8rlImn1az8e9 6Gqg== 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 j10-v6si6385121plg.657.2018.03.12.11.52.21; Mon, 12 Mar 2018 11:52:35 -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 S932252AbeCLSvV (ORCPT + 99 others); Mon, 12 Mar 2018 14:51:21 -0400 Received: from mga05.intel.com ([192.55.52.43]:62875 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751232AbeCLSvU (ORCPT ); Mon, 12 Mar 2018 14:51:20 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Mar 2018 11:21:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,462,1515484800"; d="scan'208";a="182027177" Received: from unknown (HELO localhost.localdomain) ([10.232.112.44]) by orsmga004.jf.intel.com with ESMTP; 12 Mar 2018 11:21:25 -0700 Date: Mon, 12 Mar 2018 12:23:21 -0600 From: Keith Busch To: Alexander Duyck Cc: Bjorn Helgaas , "Duyck, Alexander H" , linux-pci@vger.kernel.org, virtio-dev@lists.oasis-open.org, kvm@vger.kernel.org, Netdev , "Daly, Dan" , LKML , linux-nvme@lists.infradead.org, netanel@amazon.com, Maximilian Heyne , "Wang, Liang-min" , "Rustad, Mark D" , David Woodhouse , Christoph Hellwig , dwmw@amazon.co.uk Subject: Re: [pci PATCH v5 1/4] pci: Add pci_sriov_configure_simple for PFs that don't manage VF resources Message-ID: <20180312182321.GG18494@localhost.localdomain> References: <20180312171813.3487.94803.stgit@localhost.localdomain> <20180312172031.3487.20651.stgit@localhost.localdomain> <20180312174012.GE18494@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 12, 2018 at 11:09:34AM -0700, Alexander Duyck wrote: > On Mon, Mar 12, 2018 at 10:40 AM, Keith Busch wrote: > > On Mon, Mar 12, 2018 at 10:21:29AM -0700, Alexander Duyck wrote: > >> diff --git a/include/linux/pci.h b/include/linux/pci.h > >> index 024a1beda008..9cab9d0d51dc 100644 > >> --- a/include/linux/pci.h > >> +++ b/include/linux/pci.h > >> @@ -1953,6 +1953,7 @@ static inline void pci_mmcfg_late_init(void) { } > >> int pci_vfs_assigned(struct pci_dev *dev); > >> int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); > >> int pci_sriov_get_totalvfs(struct pci_dev *dev); > >> +int pci_sriov_configure_simple(struct pci_dev *dev, int nr_virtfn); > >> resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno); > >> void pci_vf_drivers_autoprobe(struct pci_dev *dev, bool probe); > >> #else > > > > I recommend stubbing 'pci_sriov_configure_simple' or defining it to > > NULL in the '#else' section here so you don't need to repeat the "#ifdef > > CONFIG_PCI_IOV" in each driver wishing to use this function. Otherwise > > looks fine to me. > > My concern with defining it as NULL is that somebody may end up > calling it in the future directly and that may end up causing issues. > One thought I have been debating is moving it to a different file. I > am just not sure where the best place to put something like this would > be. I could move this function to drivers/pci/pci.c if everyone is > okay with it and then I could just strip the contents out by wrapping > them in a #ifdef instead. Okay, instead of NULL, a stub implementation in the header file may suffice when CONFIG_PCI_IOV is not defined: static inline int pci_sriov_configure_simple(struct pci_dev *dev, int nr_virtfn) { return -ENOSYS; } See pci_iov_virtfn_bus, pci_iov_virtfn_devfn, pci_iov_add_virtfn, or pci_enable_sriov for other examples.