From patchwork Mon Aug 5 22:21:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 2839082 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 CD592BF535 for ; Mon, 5 Aug 2013 22:21:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 05EBB20412 for ; Mon, 5 Aug 2013 22:21:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 24FBE203F7 for ; Mon, 5 Aug 2013 22:21:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755683Ab3HEWVn (ORCPT ); Mon, 5 Aug 2013 18:21:43 -0400 Received: from mail-qa0-f54.google.com ([209.85.216.54]:60409 "EHLO mail-qa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755680Ab3HEWVk (ORCPT ); Mon, 5 Aug 2013 18:21:40 -0400 Received: by mail-qa0-f54.google.com with SMTP id bv4so1290723qab.13 for ; Mon, 05 Aug 2013 15:21:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=Ty5A7PuS+SVJ8yV5XZj0xmuKKdR+V5Rl22hZfrPT5qU=; b=LsNp1UbdtDTgVZWOxT9UeX0rw/BZKP2MMmKz9HlNEKoYBTBoK+8P9zTHVtQe4nMgLb pm1IKba0lWZaNu7xB7vJTHZx4ZeoA3HNPJtt4P0VE6eVtnWZsMIvNyiVNs+OiTD2R/Gd kvkn78jqWTtrLa6p6jf9keTcyY3IFyXrXY9xngHxEDo/xQqTfsQFEt9gg0gbM17HBW8J Yj3dywtuz3CmVJPnTMO5xENHQcH66I4Lmae7GYOb0kDUqxvhaEmiNeXIf+pVCivxYacn bcjY76yUESEiQMyeI73BxpwpvMgVZNb6C1LrUu7uDQUJ31MRLBe/1xH7UxpEvz/lHvfu Nuow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent :x-gm-message-state; bh=Ty5A7PuS+SVJ8yV5XZj0xmuKKdR+V5Rl22hZfrPT5qU=; b=Kus2jO+GJLGoP8N4F3s85ZFAnm9scjMGGWe14hFKm/mMD5/hqx9r+GJIEEuI7XSZus 5N6+7Hc/npkRs7PT5gJW9vBDB2bv2mC2FlCLfHZa9k6xiJBAxYJ0uqELItbF8UoTXnjv bLoB6blyPWmik2Cc1RffQLxYKJxZ3wug018oHy3pZYvFx9da+e63gR6N0CMBAQfvL0Wt pOFMt5BVfnZ2+F6L13s7PEH4JAG7UmxmMq9QNtNRMiDsaXWq8+WfJ5Cvqr8uU/guzvNd Cq1CLWazEXKIowysnPZ1azh1wGzTdTSR08cTakW7d5v2oHh3QZAsisLhqjQQF+ddqu5I Q4Xw== X-Received: by 10.49.41.74 with SMTP id d10mr28755584qel.81.1375741299718; Mon, 05 Aug 2013 15:21:39 -0700 (PDT) Received: from google.com ([172.16.51.11]) by mx.google.com with ESMTPSA id y1sm2060462qaj.2.2013.08.05.15.21.37 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 05 Aug 2013 15:21:38 -0700 (PDT) Date: Mon, 5 Aug 2013 16:21:35 -0600 From: Bjorn Helgaas To: Yinghai Lu Cc: Wei Yang , "linux-pci@vger.kernel.org" , Ram Pai , Gavin Shan Subject: Re: [PATCH 4/4] PCI: fix the io resource alignment calculation in pbus_size_io() Message-ID: <20130805222135.GA29875@google.com> References: <1375435866-16332-1-git-send-email-weiyang@linux.vnet.ibm.com> <1375435866-16332-5-git-send-email-weiyang@linux.vnet.ibm.com> <20130805195149.GA19127@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQmFHYUA8Z5qPsBAjRSCKl+VhsS/X2cYBRC6q60iCwhC5UoWkRkzGZ9VUXbGz36A5tbEBIKUXI4yGst3NdB4HAoYtoEraO4RCLZb1s18QSFzEEyGODuk9bFadCXckZfpgSHgrybG6a49TuuovOTpR4HBbX9IPX3Yl+uiKUmFr2rBLuBQOvaE9dMyW7iF+HdFV8400M7TUjBxVSqJcEDdP033HbLIkg== 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.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Mon, Aug 05, 2013 at 02:09:27PM -0700, Yinghai Lu wrote: > On Mon, Aug 5, 2013 at 1:59 PM, Bjorn Helgaas wrote: > >> then, we should drop that 4k capping. > >> I was thinking there could be strange or wild res with bigger than 4k. > > > > If there *were* an I/O BAR larger than 4KB, how should it be handled? > > I don't think capping the alignment to 4KB sounds like the best way. > > For example, a 16KB I/O BAR would still need to be aligned on 16KB. > > > > And I think capping to 4KB as you did above will break the powerpc > > pcibios_window_alignment() implementation. For example, if > > pcibios_window_alignment() returned 16KB, and we later capped it to > > 4KB, we're going to allocate space for the bridge window with the > > wrong alignment. > > Agree. OK. Can you guys try this out and see whether it fixes the problem? I don't know what the actual problem *is*, so I can't tell whether this is a possible fix. --- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index d4f1ad9..8333c92 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -749,12 +749,12 @@ static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size, struct resource *b_res = find_free_bus_resource(bus, IORESOURCE_IO); resource_size_t size = 0, size0 = 0, size1 = 0; resource_size_t children_add_size = 0; - resource_size_t min_align, io_align, align; + resource_size_t min_align, align; if (!b_res) return; - io_align = min_align = window_alignment(bus, IORESOURCE_IO); + min_align = window_alignment(bus, IORESOURCE_IO); list_for_each_entry(dev, &bus->devices, bus_list) { int i; @@ -781,9 +781,6 @@ static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size, } } - if (min_align > io_align) - min_align = io_align; - size0 = calculate_iosize(size, min_size, size1, resource_size(b_res), min_align); if (children_add_size > add_size)