From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68DFFC3A59D for ; Fri, 16 Aug 2019 17:31:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3A0032086C for ; Fri, 16 Aug 2019 17:31:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565976674; bh=pCq0siwRZY1QgHtPHpJZgOOHgVYfdlVGKRVR33bsDN4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=qrMemdJh+P6yvJAyvVtvw5zpUQ+svmx3Z2P0JrTL256sBA3mME4eC57Z/V2r5eB7p qeaQ6JAu0+9cZ3dUfX8OVgs/K73yNuo+hguGgodKe4UDtxK4U/HdtonBYFgbg9gbu8 Mq9kusgxCYMXc0uenQcEoU4IKERkqcDRTuwL3vqA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727437AbfHPRbN (ORCPT ); Fri, 16 Aug 2019 13:31:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:53198 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727067AbfHPRbN (ORCPT ); Fri, 16 Aug 2019 13:31:13 -0400 Received: from localhost (unknown [69.71.4.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 73EBC2086C; Fri, 16 Aug 2019 17:31:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565976672; bh=pCq0siwRZY1QgHtPHpJZgOOHgVYfdlVGKRVR33bsDN4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=H5a+BuYqbw23LQknyMoPh7AlkC+dco33MPK0CvNHF+1i0WeDWTA6pIv7/hNRT6FIP keBG2N2SEr2wu92hdRLxmSMuHQGoDBZXXxQnajDoRjdX1tjQBT5JW6naCGrOokdIw9 jjwOUfMpUKcZpayozatSDhtoor1RabQDyf/mRC3E= Date: Fri, 16 Aug 2019 12:31:08 -0500 From: Bjorn Helgaas To: Kuppuswamy Sathyanarayanan Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, ashok.raj@intel.com, keith.busch@intel.com Subject: Re: [PATCH v5 2/7] PCI/ATS: Initialize PRI in pci_ats_init() Message-ID: <20190816173108.GP253360@google.com> References: <3dd8c36177ac52d9a87655badb000d11785a5a4a.1564702313.git.sathyanarayanan.kuppuswamy@linux.intel.com> <20190815044657.GD253360@google.com> <20190815173003.GB139211@skuppusw-desk.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190815173003.GB139211@skuppusw-desk.amr.corp.intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Archived-At: List-Archive: List-Post: On Thu, Aug 15, 2019 at 10:30:03AM -0700, Kuppuswamy Sathyanarayanan wrote: > On Wed, Aug 14, 2019 at 11:46:57PM -0500, Bjorn Helgaas wrote: > > On Thu, Aug 01, 2019 at 05:05:59PM -0700, sathyanarayanan.kuppuswamy@linux.intel.com wrote: > > > From: Kuppuswamy Sathyanarayanan > > > > > > Currently, PRI Capability checks are repeated across all PRI API's. > > > Instead, cache the capability check result in pci_pri_init() and use it > > > in other PRI API's. Also, since PRI is a shared resource between PF/VF, > > > initialize default values for common PRI features in pci_pri_init(). > > > > > > Signed-off-by: Kuppuswamy Sathyanarayanan > > > --- > > > drivers/pci/ats.c | 80 ++++++++++++++++++++++++++++------------- > > > include/linux/pci-ats.h | 5 +++ > > > include/linux/pci.h | 1 + > > > 3 files changed, 61 insertions(+), 25 deletions(-) > > > > > > > > diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c > > > index cdd936d10f68..280be911f190 100644 > > > --- a/drivers/pci/ats.c > > > +++ b/drivers/pci/ats.c > > > > > @@ -28,6 +28,8 @@ void pci_ats_init(struct pci_dev *dev) > > > return; > > > > > > dev->ats_cap = pos; > > > + > > > + pci_pri_init(dev); > > > } > > > > > > /** > > > @@ -170,36 +172,72 @@ int pci_ats_page_aligned(struct pci_dev *pdev) > > > EXPORT_SYMBOL_GPL(pci_ats_page_aligned); > > > > > > #ifdef CONFIG_PCI_PRI > > > + > > > +void pci_pri_init(struct pci_dev *pdev) > > > +{ > > > ... > > > +} > > > > > diff --git a/include/linux/pci-ats.h b/include/linux/pci-ats.h > > > index 1a0bdaee2f32..33653d4ca94f 100644 > > > --- a/include/linux/pci-ats.h > > > +++ b/include/linux/pci-ats.h > > > @@ -6,6 +6,7 @@ > > > > > > #ifdef CONFIG_PCI_PRI > > > > > > +void pci_pri_init(struct pci_dev *pdev); > > > > pci_pri_init() is implemented and called in drivers/pci/ats.c. Unless > > there's a need to call this from outside ats.c, it should be static > > and should not be declared here. > > > > If you can make it static, please also reorder the code so you don't > > need a forward declaration in ats.c. > Initially I did implement it as static function in drivers/pci/ats.c > and protected the calling of pci_pri_init() with #ifdef CONFIG_PCI_PRI. > But Keith did not like the implementation using #ifdefs and asked me to > define empty functions. That's the reason for moving it to header file. Defining empty functions doesn't mean it has to be in a header file. It's only needed inside ats.c, so the whole thing should be static there. You can easily #ifdef the implementation, e.g., do the following in ats.c: static void pci_pri_init(struct pci_dev *pdev) { #ifdef CONFIG_PCI_PRI ... #endif }