Received: by 10.213.65.68 with SMTP id h4csp271977imn; Mon, 12 Mar 2018 13:19:53 -0700 (PDT) X-Google-Smtp-Source: AG47ELsKg928uoXy8EupEt1e1NuPXcfiMhey2uKANukm0oGvEDBc7/txxdvz8BFnzlSSBQHJMi/f X-Received: by 2002:a17:902:5609:: with SMTP id h9-v6mr9319269pli.302.1520885993454; Mon, 12 Mar 2018 13:19:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520885993; cv=none; d=google.com; s=arc-20160816; b=FbGek8lviIfWsbH2BMUBuJx6sjaGE4cgelrdUs9x2xcI79vqeg/Kf4vYxj45HX7WzC 8ju1VftI3CHEoXrqYNgq4gsXbf+KgLe5PFhXM7IDfFyF0v/d1D2/IybHuSIowEqNwbOR 1cAB0zU7P4NTlh6Qq8shAtueD+ZRbeFCzq7jluN3e4EvkqgzlNTFllZq+xBR5DfgNhQ5 lSonk3AHtZZ4HX1DPaUu4RhDcrygAmbgiG8FNpDr8+xNJZrWmI5UmMapVUjLEWCXnh83 +Y5siNpskqDJXtC3xJZEJCcaGEatbhm6j5n8n+WfzR3LwJmTgIaqeMQDUiF9S58ogiQ7 KA4A== 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=3AoQNjSkBlGDWIsEGAFq2EVInL8dpTNbpyatGX8AvUc=; b=ByfQSNqqnS3mXBrNGXjqV4/K2tuKHp5N/g43rT9ATnnGH/mCo2fSrO1uYomOC3mctG fcqE5Kba3NbKg78PEzWoFEaipX8pXxrZwhi5EjplcDXDpeT1WGjfkCslSqfxL+CoZUTb YhoBBFrHSVwNCxOdT6E78EqbfB0HjOMRJ1GHi7GSdFSzzUgclRa71rQHGcNSlpq1FTya vzCYck6vDSpcIMgIjA/DyeVdXJSaSz7Er9ARAf7suxDtIraqBuJYtOFHkskY6Fcg0ndh zhyg5vlRIiDoWdXdQaLySoa9d8Hj33403PzVNbcBPIRRqK4GmvqJq0Ngm19bbnRH9S3P igmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QK2VSb+G; 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 u15-v6si6736621plk.516.2018.03.12.13.19.38; Mon, 12 Mar 2018 13:19:53 -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=QK2VSb+G; 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 S932575AbeCLURG (ORCPT + 99 others); Mon, 12 Mar 2018 16:17:06 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:42838 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932214AbeCLURC (ORCPT ); Mon, 12 Mar 2018 16:17:02 -0400 Received: by mail-qt0-f194.google.com with SMTP id t6so20310852qtn.9; Mon, 12 Mar 2018 13:17:02 -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=3AoQNjSkBlGDWIsEGAFq2EVInL8dpTNbpyatGX8AvUc=; b=QK2VSb+GSM690zm4kgN1DD7nBZsA3iz8ZYpIRwt8but9TE4fH7DX881qzT3uJpdCNm o0ER+GP+nM2kEZjFb6BLRIW8hHF0/J/kDhy8jG8sy/fRAakm27Uda+d7Ho7p3JPQzsFn oB2beMBBMa0uLgQRkJbX3Wxu58UrpWC5CFyzys38ffSPZh4xnob3Qqeyo0QtUp9kwspL 0J7o4Ublkpz0NigOqolmF3RWdFMieE6nm/OaRAgPIDM7wR8nYQctcA6ti0YKwQ8EiQo5 VFNlqs4lAJUJIeqLsGf7gsTLSoTEgzpowYRYHzc1hO5XEI6WRfVBCyt1tWK/lYkpUEV3 G1xg== 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=3AoQNjSkBlGDWIsEGAFq2EVInL8dpTNbpyatGX8AvUc=; b=eZiEwT3aoNmlo6QPDR+vZhQ6Tzi56Y5JOQkqSj/Gxv7Vb54MqHKAcfIc6efi85tJQr N1Cc7TuUwOihTOdVRr2khq2Zk0K8tp2SIFg6HuKOaP8CE1MpIo9f3IAmuLdZtjoy3iE0 0j63VyWSwCQbco0n8zcTXaaiKekQPm1GPUic0THMPeSxjOspETFIIkJottQdg928iHii qa5el0njeIVWPCcz/puQh7Y+HwraKDkC6NBRJB/oSfkgn0vgdPo8AG51mfq/1Ikr6FA/ C/yvEsvIpIJBVwXKuYNS4If2JjKlz+keaaMPQ69PkZLCG/HxFebpkE+hDUICe5PfxO1B 61gw== X-Gm-Message-State: AElRT7FKh3liwe58pqIsc1qgT4SOYMlu7pJWBYgY/aX197KIZWQM/fEO WeMFtuwquQCJx+xbe89KLLpJIddh+vam3NRVA2Q= X-Received: by 10.200.57.117 with SMTP id t50mr9367676qtb.22.1520885821436; Mon, 12 Mar 2018 13:17:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.89.138 with HTTP; Mon, 12 Mar 2018 13:17:00 -0700 (PDT) In-Reply-To: <20180312182321.GG18494@localhost.localdomain> References: <20180312171813.3487.94803.stgit@localhost.localdomain> <20180312172031.3487.20651.stgit@localhost.localdomain> <20180312174012.GE18494@localhost.localdomain> <20180312182321.GG18494@localhost.localdomain> From: Alexander Duyck Date: Mon, 12 Mar 2018 13:17:00 -0700 Message-ID: Subject: Re: [pci PATCH v5 1/4] pci: Add pci_sriov_configure_simple for PFs that don't manage VF resources To: Keith Busch 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 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 Mon, Mar 12, 2018 at 11:23 AM, Keith Busch wrote: > 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. No, I am aware of those. The problem is they aren't accessed as function pointers. As such converting them to static inline functions is easy. As I am sure you are aware an "inline" function doesn't normally generate a function pointer. Actually my original idea has been complicated further by the fact that I realized my code is accessing functions that are static in the iov.c file. I'll need to think about how to come up with a better solution for this.