From patchwork Wed Jun 26 08:07:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 2783431 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 38D089F245 for ; Wed, 26 Jun 2013 08:08:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B47F82025C for ; Wed, 26 Jun 2013 08:08:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C9E7120265 for ; Wed, 26 Jun 2013 08:08:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751856Ab3FZII2 (ORCPT ); Wed, 26 Jun 2013 04:08:28 -0400 Received: from mail-ie0-f178.google.com ([209.85.223.178]:51118 "EHLO mail-ie0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751729Ab3FZIHx (ORCPT ); Wed, 26 Jun 2013 04:07:53 -0400 Received: by mail-ie0-f178.google.com with SMTP id u16so30162098iet.37 for ; Wed, 26 Jun 2013 01:07:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=0PeIF0HZ41tEKgAkzA5GV8dVnXaN0rRbI7zK8VoZVqA=; b=VePUwuFJcZ09bnvvn5UnWVB4tKwB4elkkr/2UoU8fDqqCeOec9Rx849Qp8hHgkTDnr sQOnS4UIbyUAvgX4BD/ouWDN4skStSgHIrd0Gj8Cj8g/IB18E2OjfeJLfzrlrc+KKgmW SOHGSxbRloiM2KAI4rNef6sojd8rNrubnErXSJTw4YlHenqxlr6u+EEnqcgPIGV0PU2B lh34RojheOx+QKkbxPMODCd71NgA/XxAGKZv/yn2HGzTKNZ7PI1DNIYNYYy3aeYmHBMn KC0gjkTPRIzTcH1Vyz0v7WcYaeqEoOmb1mpnq9KwGQfM/RwL8j1f+z9dCAEEfSFtSiT/ lLgA== MIME-Version: 1.0 X-Received: by 10.42.249.72 with SMTP id mj8mr1350307icb.32.1372234073217; Wed, 26 Jun 2013 01:07:53 -0700 (PDT) Received: by 10.64.78.68 with HTTP; Wed, 26 Jun 2013 01:07:53 -0700 (PDT) In-Reply-To: References: <1370066593-22736-1-git-send-email-yinghai@kernel.org> <1370066593-22736-3-git-send-email-yinghai@kernel.org> <20130625211516.GA8494@google.com> <1372196295.3944.221.camel@pasglop> Date: Wed, 26 Jun 2013 01:07:53 -0700 X-Google-Sender-Auth: OZROFmSSXTS5zhgcIBEkI1Yadho Message-ID: Subject: Re: [PATCH v5 3/7] PCI: Use pci_walk_bus to detect unassigned resources From: Yinghai Lu To: Bjorn Helgaas Cc: Benjamin Herrenschmidt , Gavin Shan , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,T_TVD_MIME_EPI, 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 Tue, Jun 25, 2013 at 2:46 PM, Bjorn Helgaas wrote: > On Tue, Jun 25, 2013 at 3:38 PM, Benjamin Herrenschmidt > wrote: >> On Tue, 2013-06-25 at 15:15 -0600, Bjorn Helgaas wrote: >>> - for_each_pci_dev(dev) { >>> > - int i; >>> > + /* Not assigned, or rejected by kernel ? */ >>> > + if (r->flags && !r->start) { >>> > + (*unassigned)++; >>> > + return 1; /* return early from pci_walk_bus */ >>> > + } >>> > + } >> >> BTW. I'm aware you didn't change that logic but ... it's somewhat broken >> in the case where the aperture has an offset. You should compare >> r->start with the offset, not with 0. > > Yes, please fix that in a separate patch that contains only the bugfix. Please check inline word warped patch. Subject: [PATCH] PCI: check pci bus address for unassigned res We should compare res->start with root bus window offset. Otherwise will have problem with arch that support hostbridge resource offset. BenH pointed out that during reviewing patchset that separate assign unassigned to per root buses. According to Bjorn, have it in separated patch. Use pcibios_resource_to_bus to get region at first, and check region.start instead. Suggested-by: Benjamin Herrenschmidt Signed-off-by: Yinghai Lu --- drivers/pci/setup-bus.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) Index: linux-2.6/drivers/pci/setup-bus.c =================================================================== --- linux-2.6.orig/drivers/pci/setup-bus.c +++ linux-2.6/drivers/pci/setup-bus.c @@ -1420,9 +1420,14 @@ static int check_unassigned_resources(st for (i = PCI_IOV_RESOURCES; i <= PCI_IOV_RESOURCE_END; i++) { struct resource *r = &dev->resource[i]; + struct pci_bus_region region; /* Not assigned, or rejected by kernel ? */ - if (r->flags && !r->start) { + if (!r->flags) + continue; + + pcibios_resource_to_bus(dev, ®ion, res); + if (!region.start) { (*unassigned)++; return 1; /* return early from pci_walk_bus */ }