linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Bharat Kumar Gogada <bharat.kumar.gogada@xilinx.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	"Liviu.Dudau@arm.com" <Liviu.Dudau@arm.com>,
	nofooter <nofooter@xilinx.com>,
	"thomas.petazzoni@free-electrons.com" 
	<thomas.petazzoni@free-electrons.com>
Subject: Re: Purpose of pci_remap_iospace
Date: Wed, 13 Jul 2016 14:46:42 +0100	[thread overview]
Message-ID: <20160713134642.GA29309@red-moon> (raw)
In-Reply-To: <8520D5D51A55D047800579B094147198258B8B06@XAP-PVEXMBX01.xlnx.xilinx.com>

On Wed, Jul 13, 2016 at 12:30:44PM +0000, Bharat Kumar Gogada wrote:

[...]

> err = of_pci_get_host_bridge_resources(node, 0, 0xff, &res, &iobase);
>         if (err) {
>                 pr_err("Getting bridge resources failed\n");
>                 return err;
>         }
> resource_list_for_each_entry(window, &res) {            //code for io resource
>                 struct resource *res = window->res;
>                 u64 restype = resource_type(res);
> 
>                 switch (restype) {
>                 case IORESOURCE_IO:
>                         err = pci_remap_iospace(res, iobase);
>                         if(err)
>                                 pr_info("FAILED TO IPREMAP RESOURCE\n");
>                         break;
>                 default:
>                         dev_err(pcie->dev, "invalid resource %pR\n", res);
> 
>                 }
>         }
> 
> Other than above code I haven't done any change in driver.
> 
> Here is the printk added boot log:
> [    2.308680] nwl-pcie fd0e0000.pcie: Link is UP
> [    2.308724] PCI host bridge /amba/pcie@fd0e0000 ranges:
> [    2.308741]   No bus range found for /amba/pcie@fd0e0000, using [bus 00-ff]
> [    2.308755] in pci_add_resource_offset res->start 0   offset 0
> [    2.308774]    IO 0xe0000000..0xe00fffff -> 0x00000000
> [    2.308795] in pci_add_resource_offset res->start 0   offset 0
> [    2.308805]   MEM 0xe0100000..0xeeffffff -> 0xe0100000
> [    2.308824] in pci_add_resource_offset res->start e0100000    offset 0
> [    2.308834] nwl-pcie fd0e0000.pcie: invalid resource [bus 00-ff]
> [    2.308870] nwl-pcie fd0e0000.pcie: invalid resource [mem 0xe0100000-0xeeffffff]
> [    2.308979] nwl-pcie fd0e0000.pcie: PCI host bridge to bus 0000:00
> [    2.308998] pci_bus 0000:00: root bus resource [bus 00-ff]
> [    2.309014] pci_bus 0000:00: root bus resource [io  0x0000-0xfffff]
> [    2.309030] pci_bus 0000:00: root bus resource [mem 0xe0100000-0xeeffffff]
> [    2.309253] pci 0000:00:00.0: cannot attach to SMMU, is it on the same bus?
> [    2.309269] iommu: Adding device 0000:00:00.0 to group 1
> [    2.309625] pci 0000:01:00.0: cannot attach to SMMU, is it on the same bus?
> [    2.309641] iommu: Adding device 0000:01:00.0 to group 1
> [    2.309697] pci 0000:00:00.0: BAR 8: assigned [mem 0xe0100000-0xe02fffff]

Here is your PCI bridge mem space window assignment. I do not see
an IO window assignment which makes me think that IO cycles and
relative IO window is not enabled through the bridge, that's the
reason you can't assign IO space to the endpoint, because it has
no parent IO window enabled IIUC.

You can add some debug info into pci_bridge_check_ranges() in
particular to the reading of PCI_IO_BASE resources to confirm
what I am saying above, thanks.

Lorenzo

> [    2.309718] pci 0000:01:00.0: BAR 0: assigned [mem 0xe0100000-0xe01fffff 64bit]
> [    2.309752] pci 0000:01:00.0: BAR 2: assigned [mem 0xe0200000-0xe02fffff 64bit]
> [    2.309784] pci 0000:01:00.0: BAR 4: no space for [io  size 0x0040]
> [    2.309800] pci 0000:01:00.0: BAR 4: failed to assign [io  size 0x0040]
> [    2.309816] pci 0000:00:00.0: PCI bridge to [bus 01-0c]
> [    2.309833] pci 0000:00:00.0:   bridge window [mem 0xe0100000-0xe02fffff]
> 
> Here is the output of ioports and iomem:
> 
> root@:~# cat /proc/iomem
> 00000000-7fffffff : System RAM
>   00080000-00a76fff : Kernel code
>   01c72000-01d4bfff : Kernel data
> fd0c0000-fd0c1fff : /amba/ahci@fd0c0000
> fd0e0000-fd0e0fff : breg
> fd480000-fd480fff : pcireg
> ff000000-ff000fff : xuartps
> ff010000-ff010fff : xuartps
> ff020000-ff020fff : /amba/i2c@ff020000
> ff030000-ff030fff : /amba/i2c@ff030000
> ff070000-ff070fff : /amba/can@ff070000
> ff0a0000-ff0a0fff : /amba/gpio@ff0a0000
> ff0f0000-ff0f0fff : /amba/spi@ff0f0000
> ff170000-ff170fff : mmc0
> ffa60000-ffa600ff : /amba/rtc@ffa60000
> 8000000000-8000ffffff : cfg
> root@:~# cat /proc/ioports
> root@:~#
> 
> /proc/ioports is empty.
> 
> Thanks & Regards,
> Bharat
> 
> 
> This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
> 

  parent reply	other threads:[~2016-07-13 13:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-12  6:57 Purpose of pci_remap_iospace Bharat Kumar Gogada
2016-07-12  8:31 ` Arnd Bergmann
2016-07-12  8:40   ` Bharat Kumar Gogada
2016-07-13  8:11   ` Bharat Kumar Gogada
2016-07-13  8:30     ` Arnd Bergmann
2016-07-13 12:30       ` Bharat Kumar Gogada
2016-07-13 13:28         ` Arnd Bergmann
2016-07-13 15:16           ` Bharat Kumar Gogada
2016-07-13 15:28             ` Arnd Bergmann
2016-07-13 15:42               ` Liviu.Dudau
2016-07-13 16:13             ` Lorenzo Pieralisi
2016-07-13 13:46         ` Lorenzo Pieralisi [this message]
2016-07-14  6:03           ` Bharat Kumar Gogada
2016-07-14 13:32           ` Bharat Kumar Gogada
2016-07-14 14:56             ` Lorenzo Pieralisi
2016-07-14 15:05               ` Bharat Kumar Gogada
2016-07-14 15:20                 ` Lorenzo Pieralisi
2016-07-14 15:12               ` Arnd Bergmann
2016-07-14 15:27                 ` Lorenzo Pieralisi
2016-07-15  5:21               ` Bharat Kumar Gogada
2016-07-15  6:55                 ` Arnd Bergmann
2016-07-13 13:24     ` Liviu.Dudau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160713134642.GA29309@red-moon \
    --to=lorenzo.pieralisi@arm.com \
    --cc=Liviu.Dudau@arm.com \
    --cc=arnd@arndb.de \
    --cc=bharat.kumar.gogada@xilinx.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=nofooter@xilinx.com \
    --cc=thomas.petazzoni@free-electrons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).