From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753915Ab2A0VFo (ORCPT ); Fri, 27 Jan 2012 16:05:44 -0500 Received: from mail-yx0-f174.google.com ([209.85.213.174]:51544 "EHLO mail-yx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752327Ab2A0VFm convert rfc822-to-8bit (ORCPT ); Fri, 27 Jan 2012 16:05:42 -0500 MIME-Version: 1.0 In-Reply-To: <20120127191032.GA22999@dirshya.in.ibm.com> References: <20120127191032.GA22999@dirshya.in.ibm.com> Date: Fri, 27 Jan 2012 13:05:41 -0800 X-Google-Sender-Auth: W6b_XP_CTG1lgz6ktRo_NFL_-78 Message-ID: Subject: Re: [BUGFIX][PATCH] pci: check for 4k resource_size alignment in sriov_init From: Yinghai Lu To: svaidy@linux.vnet.ibm.com Cc: Ram Pai , Jesse Barnes , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 27, 2012 at 11:10 AM, Vaidyanathan Srinivasan wrote: > Hi Ram and Jesse, > > I found a trivial issue with page size alignment check on IBM POWER > box with 64k base page size.  In sriov_init(), changing the check from > PAGE_SIZE (arch and config dependent) to HW_PAGE_SIZE (always 4k) was > required to use one of the sriov adapter as PF since the > resource_size() comes up as 0x8000 and PAGE_SIZE would be 0x10000 for > pseries boxes. > > I think resource_size() could be less than SystemPageSize, but I would > like your comments/ack/nack on any consequences of checking for only > 4k alignment here in a system with larger base page size. > > Thanks, > Vaidy > > --- > >    pci: check for 4k resource_size alignment in sriov_init > >    pci sriov_init should check for 4k page size alignment of resource_size >    even if base page size is larger -- like 64k in powerpc. > >    Signed-off-by: Vaidyanathan Srinivasan > > diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c > index 0321fa3..5816fa0 100644 > --- a/drivers/pci/iov.c > +++ b/drivers/pci/iov.c > @@ -474,7 +474,7 @@ found: >                                     pos + PCI_SRIOV_BAR + i * 4); >                if (!res->flags) >                        continue; > -               if (resource_size(res) & (PAGE_SIZE - 1)) { > +               if (resource_size(res) & (HW_PAGE_SIZE - 1)) { >                        rc = -EIO; >                        goto failed; >                } > but HW_PAGE_SIZE is only defined for powerpc. also there is PAGE_SHIFT around in that function. maybe you can just define another MARCO according to IOV spec? Thanks Yinghai