From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751969AbcGAA3q (ORCPT ); Thu, 30 Jun 2016 20:29:46 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:45692 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751052AbcGAA3o (ORCPT ); Thu, 30 Jun 2016 20:29:44 -0400 X-IBM-Helo: d23dlp03.au.ibm.com X-IBM-MailFrom: gwshan@linux.vnet.ibm.com X-IBM-RcptTo: linux-doc@vger.kernel.org;linux-kernel@vger.kernel.org;linux-pci@vger.kernel.org Date: Fri, 1 Jul 2016 10:28:52 +1000 From: Gavin Shan To: Yongji Xie Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-doc@vger.kernel.org, bhelgaas@google.com, alex.williamson@redhat.com, aik@ozlabs.ru, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, corbet@lwn.net, warrier@linux.vnet.ibm.com, zhong@linux.vnet.ibm.com, nikunj@linux.vnet.ibm.com, gwshan@linux.vnet.ibm.com Subject: Re: [PATCH v3 1/7] PCI: Ignore enforced alignment when kernel uses existing firmware setup Reply-To: Gavin Shan References: <1467283993-3185-1-git-send-email-xyjxie@linux.vnet.ibm.com> <1467283993-3185-2-git-send-email-xyjxie@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1467283993-3185-2-git-send-email-xyjxie@linux.vnet.ibm.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16070100-0012-0000-0000-000001A5BC83 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16070100-0013-0000-0000-000005805281 Message-Id: <20160701002852.GA15147@gwshan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-06-30_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1607010002 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 30, 2016 at 06:53:07PM +0800, Yongji Xie wrote: >PCI resources allocator will use firmware setup and not try to >reassign resource when PCI_PROBE_ONLY or IORESOURCE_PCI_FIXED >is set. > >The enforced alignment in pci_reassigndev_resource_alignment() >should be ignored in this case. Otherwise, some PCI devices' >resources would be released here and not re-allocated. > >Signed-off-by: Yongji Xie >--- > drivers/pci/pci.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > >diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c >index c8b4dbd..be8f72c 100644 >--- a/drivers/pci/pci.c >+++ b/drivers/pci/pci.c >@@ -4760,6 +4760,13 @@ static resource_size_t pci_specified_resource_alignment(struct pci_dev *dev) > > spin_lock(&resource_alignment_lock); > p = resource_alignment_param; >+ if (pci_has_flag(PCI_PROBE_ONLY)) { >+ if (*p) >+ printk_once(KERN_INFO "PCI: Ignore resource_alignment parameter: %s with PCI_PROBE_ONLY set\n", >+ p); We don't have to print @resource_alignment as it's ignored completely. The content included in it doesn't mean anything: pr_info_once("PCI: resource_alignment ignored with PCI_PROBE_ONLY\n"); >+ spin_unlock(&resource_alignment_lock); >+ return 0; >+ } A empty line is needed here. > while (*p) { > count = 0; > if (sscanf(p, "%d%n", &align_order, &count) == 1 && >@@ -4837,6 +4844,11 @@ void pci_reassigndev_resource_alignment(struct pci_dev *dev) > r = &dev->resource[i]; > if (!(r->flags & IORESOURCE_MEM)) > continue; >+ if (r->flags & IORESOURCE_PCI_FIXED) { >+ dev_info(&dev->dev, "No alignment for fixed BAR%d: %pR\n", >+ i, r); The message would be like below to match PCI code style. I'm thinking it probably uses dev_dbg() instead dev_info(), but not sure for 100%. dev_info(&dev->dev, "BAR %d: fixed %pR, no alignment\n", i, r); >+ continue; >+ } A empty line is needed here. > size = resource_size(r); > if (size < align) { > size = align; Thanks, Gavin