From patchwork Wed Oct 21 22:32:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 534115 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id C272C14016A for ; Thu, 22 Oct 2015 09:32:16 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=RBWitr1X; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754116AbbJUWcP (ORCPT ); Wed, 21 Oct 2015 18:32:15 -0400 Received: from mail-vk0-f65.google.com ([209.85.213.65]:34479 "EHLO mail-vk0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752080AbbJUWcO (ORCPT ); Wed, 21 Oct 2015 18:32:14 -0400 Received: by vkat63 with SMTP id t63so3282406vka.1; Wed, 21 Oct 2015 15:32:13 -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:message-id:subject :from:to:cc:content-type; bh=up6DWR5l/hUWMepiUMR8KdNTM76dxWvuS3mjv87k44U=; b=RBWitr1XdGGneZgB7sLtmP/5QVDvEChl3gpjTwRj9cnW5y1bs0orApIBnBHkh/JK3W rI998OBAAxxdBsTF4wH1vvSdOXYnskAhBepvC7pqFKTZ61iXyicVoNgtcEAVtcw8hL2x 0kh3XlqKSJcmxMcniYBaOsTB3Wvu9FYYM6YEx5QqpkK5BDN+hl0uRecHF9m2VKF+tHjS eacsTcAf/v63dmQ++/o//NyC8BShpvsX2UKhHxwUGrTxsQzkeoL+KlcWMQQdHCWqdcd6 mtkdK5Wp20EddyeRw+vQP3igczBkrDtH9lWD4QSWVMHK2htWytCHFKx6ZCj2ZxN0m5PE A5rw== MIME-Version: 1.0 X-Received: by 10.31.33.200 with SMTP id h191mr7610668vkh.105.1445466733160; Wed, 21 Oct 2015 15:32:13 -0700 (PDT) Received: by 10.103.45.15 with HTTP; Wed, 21 Oct 2015 15:32:13 -0700 (PDT) In-Reply-To: <20151021185046.GD1583@localhost> References: <1444340359-8011-1-git-send-email-yinghai@kernel.org> <1444340359-8011-4-git-send-email-yinghai@kernel.org> <20151020215714.GI8224@localhost> <20151021023522.GJ8224@localhost> <20151021185046.GD1583@localhost> Date: Wed, 21 Oct 2015 15:32:13 -0700 X-Google-Sender-Auth: EZ1EGwnwPzZbXQke7zA5xbHdJM8 Message-ID: Subject: Re: [PATCH v7 03/60] sparc/PCI: Unify pci_register_region() From: Yinghai Lu To: Bjorn Helgaas Cc: Bjorn Helgaas , David Miller , Benjamin Herrenschmidt , Wei Yang , TJ , Yijing Wang , Khalid Aziz , "linux-pci@vger.kernel.org" , Linux Kernel Mailing List Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Wed, Oct 21, 2015 at 11:50 AM, Bjorn Helgaas wrote: > Lots of other architectures have both mem32 and mem64 apertures. You > haven't explained what's unique about sparc yet. Does > pci_find_parent_resource() not work on sparc? If not, is that because the > resource tree looks different on sparc than on other architectures? If so, > is that difference something intentional that we want to keep, or should we > converge on a single resource tree format across all architectures? In the new pci_register_legacy_regions(), we only have root bus. but current pci_find_parent_resource is taking pci dev. So will need to change it to take bus instead, please check if you are ok with following, then I would update other two. --- arch/microblaze/pci/pci-common.c | 4 ++-- arch/powerpc/kernel/pci-common.c | 4 ++-- drivers/pci/pci.c | 5 ++--- drivers/pci/setup-res.c | 4 ++-- drivers/pcmcia/rsrc_nonstatic.c | 2 +- include/linux/pci.h | 2 +- 6 files changed, 10 insertions(+), 11 deletions(-) -- 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 Index: linux-2.6/arch/microblaze/pci/pci-common.c =================================================================== --- linux-2.6.orig/arch/microblaze/pci/pci-common.c +++ linux-2.6/arch/microblaze/pci/pci-common.c @@ -1006,7 +1006,7 @@ static void pcibios_allocate_bus_resourc * and as such ensure proper re-allocation * later. */ - pr = pci_find_parent_resource(bus->self, res); + pr = pci_find_parent_resource(bus->self->bus, res); if (pr == res) { /* this happens when the generic PCI * code (wrongly) decides that this @@ -1064,7 +1064,7 @@ static inline void alloc_resource(struct (unsigned long long)r->end, (unsigned int)r->flags); - pr = pci_find_parent_resource(dev, r); + pr = pci_find_parent_resource(dev->bus, r); if (!pr || (pr->flags & IORESOURCE_UNSET) || request_resource(pr, r) < 0) { pr_warn("PCI: Cannot allocate resource region %d ", idx); Index: linux-2.6/arch/powerpc/kernel/pci-common.c =================================================================== --- linux-2.6.orig/arch/powerpc/kernel/pci-common.c +++ linux-2.6/arch/powerpc/kernel/pci-common.c @@ -1180,7 +1180,7 @@ static void pcibios_allocate_bus_resourc pr = (res->flags & IORESOURCE_IO) ? &ioport_resource : &iomem_resource; else { - pr = pci_find_parent_resource(bus->self, res); + pr = pci_find_parent_resource(bus->self->bus, res); if (pr == res) { /* this happens when the generic PCI * code (wrongly) decides that this @@ -1237,7 +1237,7 @@ static inline void alloc_resource(struct pr_debug("PCI: Allocating %s: Resource %d: %pR\n", pci_name(dev), idx, r); - pr = pci_find_parent_resource(dev, r); + pr = pci_find_parent_resource(dev->bus, r); if (!pr || (pr->flags & IORESOURCE_UNSET) || request_resource(pr, r) < 0) { printk(KERN_WARNING "PCI: Cannot allocate resource region %d" Index: linux-2.6/drivers/pci/pci.c =================================================================== --- linux-2.6.orig/drivers/pci/pci.c +++ linux-2.6/drivers/pci/pci.c @@ -417,16 +417,15 @@ EXPORT_SYMBOL_GPL(pci_find_ht_capability /** * pci_find_parent_resource - return resource region of parent bus of given region - * @dev: PCI device structure contains resources to be searched + * @bus: PCI bus structure contains resources to be searched * @res: child resource record for which parent is sought * * For given resource region of given device, return the resource * region of parent bus the given region is contained in. */ -struct resource *pci_find_parent_resource(const struct pci_dev *dev, +struct resource *pci_find_parent_resource(const struct pci_bus *bus, struct resource *res) { - const struct pci_bus *bus = dev->bus; struct resource *r; int i; Index: linux-2.6/drivers/pci/setup-res.c =================================================================== --- linux-2.6.orig/drivers/pci/setup-res.c +++ linux-2.6/drivers/pci/setup-res.c @@ -121,7 +121,7 @@ int pci_claim_resource(struct pci_dev *d return -EINVAL; } - root = pci_find_parent_resource(dev, res); + root = pci_find_parent_resource(dev->bus, res); if (!root) { dev_info(&dev->dev, "can't claim BAR %d %pR: no compatible bridge window\n", resource, res); @@ -184,7 +184,7 @@ static int pci_revert_fw_address(struct res->end = res->start + size - 1; res->flags &= ~IORESOURCE_UNSET; - root = pci_find_parent_resource(dev, res); + root = pci_find_parent_resource(dev->bus, res); if (!root) { if (res->flags & IORESOURCE_IO) root = &ioport_resource; Index: linux-2.6/drivers/pcmcia/rsrc_nonstatic.c =================================================================== --- linux-2.6.orig/drivers/pcmcia/rsrc_nonstatic.c +++ linux-2.6/drivers/pcmcia/rsrc_nonstatic.c @@ -84,7 +84,7 @@ claim_region(struct pcmcia_socket *s, re if (res) { #ifdef CONFIG_PCI if (s && s->cb_dev) - parent = pci_find_parent_resource(s->cb_dev, res); + parent = pci_find_parent_resource(s->cb_dev->bus, res); #endif if (!parent || request_resource(parent, res)) { kfree(res); Index: linux-2.6/include/linux/pci.h =================================================================== --- linux-2.6.orig/include/linux/pci.h +++ linux-2.6/include/linux/pci.h @@ -818,7 +818,7 @@ void pci_device_add(struct pci_dev *dev, unsigned int pci_scan_child_bus(struct pci_bus *bus); void pci_bus_add_device(struct pci_dev *dev); void pci_read_bridge_bases(struct pci_bus *child); -struct resource *pci_find_parent_resource(const struct pci_dev *dev, +struct resource *pci_find_parent_resource(const struct pci_bus *bus, struct resource *res); u8 pci_swizzle_interrupt_pin(const struct pci_dev *dev, u8 pin); int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge);