From patchwork Thu Jul 24 06:22:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 4614651 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 08CDAC0515 for ; Thu, 24 Jul 2014 06:23:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 42111201BC for ; Thu, 24 Jul 2014 06:23:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 653E1201BF for ; Thu, 24 Jul 2014 06:23:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758717AbaGXGXF (ORCPT ); Thu, 24 Jul 2014 02:23:05 -0400 Received: from e28smtp08.in.ibm.com ([122.248.162.8]:52470 "EHLO e28smtp08.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758713AbaGXGWz (ORCPT ); Thu, 24 Jul 2014 02:22:55 -0400 Received: from /spool/local by e28smtp08.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 24 Jul 2014 11:52:52 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp08.in.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 24 Jul 2014 11:52:50 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id 398DD125805B for ; Thu, 24 Jul 2014 11:52:43 +0530 (IST) Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s6O6OdBq36110408 for ; Thu, 24 Jul 2014 11:54:39 +0530 Received: from d28av03.in.ibm.com (localhost [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s6O6Ml44010785 for ; Thu, 24 Jul 2014 11:52:48 +0530 Received: from localhost (richard.cn.ibm.com [9.111.17.69]) by d28av03.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s6O6MklK010748; Thu, 24 Jul 2014 11:52:46 +0530 From: Wei Yang To: linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org, bhelgaas@google.com, benh@au1.ibm.com, gwshan@linux.vnet.ibm.com, yan@linux.vnet.ibm.com, qiudayu@linux.vnet.ibm.com Cc: Wei Yang Subject: [PATCH V7 09/17] powerpc/powernv: mark IOV BAR with IORESOURCE_ARCH Date: Thu, 24 Jul 2014 14:22:19 +0800 Message-Id: <1406182947-11302-10-git-send-email-weiyang@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1406182947-11302-1-git-send-email-weiyang@linux.vnet.ibm.com> References: <1406182947-11302-1-git-send-email-weiyang@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14072406-2000-0000-0000-00000139C9BC Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On powernv platform, the IOV BAR size will be adjusted to meet the alignment requirement from hardware. This leads to the VF resource size need to be retrieved from hardware directly. This patch adds this flag for IOV BAR on powernv platform. Signed-off-by: Wei Yang --- arch/powerpc/platforms/powernv/pci.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c index b97aa79..cc7c9a6 100644 --- a/arch/powerpc/platforms/powernv/pci.c +++ b/arch/powerpc/platforms/powernv/pci.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -876,3 +877,20 @@ static int __init tce_iommu_bus_notifier_init(void) } subsys_initcall_sync(tce_iommu_bus_notifier_init); + +static void pnv_sriov_final_fixup(struct pci_dev *dev) +{ + struct resource *res; + int i; + + if (!dev->is_physfn) + return; + + for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) { + res = dev->resource + PCI_IOV_RESOURCES + i; + if (!res->flags) + continue; + res->flags |= IORESOURCE_ARCH; + } +} +DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, pnv_sriov_final_fixup);