linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Murali Karicheri <m-karicheri2@ti.com>
Cc: Bjorn Helgaas <helgaas@kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Subject: Re: PCI IO resource question.
Date: Fri, 18 Mar 2016 11:28:02 +0000	[thread overview]
Message-ID: <20160318112802.GA1810@red-moon> (raw)
In-Reply-To: <56EB217F.8070603@ti.com>

On Thu, Mar 17, 2016 at 05:28:31PM -0400, Murali Karicheri wrote:

[...]

> > The only ways I see that PCI_PROBE_ONLY can be set on ARM are if you have
> > "linux,pci-probe-only" in your DT or you boot with "pci=firmware".
> > 
> > I expect you're in this path:
> > 
> >   ahci_init_one
> >     pcim_enable_device
> >       pci_enable_device
> >         pci_enable_device_flags(dev, IORESOURCE_MEM | IORESOURCE_IO)
> >           # build "bars" mask
> >           do_pci_enable_device(dev, bars)
> >             pcibios_enable_device
> >               if (pci_has_flag(PCI_PROBE_ONLY))
> >                 return 0;
> >               pci_enable_resources
> > 
> > Can you add a little debug code like this to verify that we're in this
> > path?
> 
> Yes we are in the path.
> 
> 
> [    1.557561] ahci_init_one
> [    1.560214] ahci 0000:01:00.0: version 3.0
> [    1.564302] pcim_enable_device
> [    1.567349] pci_enable_device
> [    1.570340] pci_enable_device_flags
> [    1.573824] do_pci_enable_device
> [    1.577042] pcibios_enable_device
> [    1.580380] pci_enable_resources

So resources are actually enabled (ie PCI_PROBE_ONLY is not set)
and that makes sense otherwise you would not be able to use the
MEM resources anyway (ie they would not be enabled).

I suspect the PCI dev IO resources were reset in reset_resource() in
assign_requested_resource_sorted(), hence the bar mask that is built
in pci_enable_device_flags() does not contain the IO resources,
it would be helpful if you can print the bar mask passed to
pcibios_enable_device() (ie the mask parameter).

Not saying that's what should happen, I think that's what's happening,
that's the only reason I see why you do not have pci_enable_resources()
failures when you remove the IO range from the host bridge.

Lorenzo

> [    1.583608] ahci 0000:01:00.0: limiting MRRS to 256
> [    1.588595] ahci 0000:01:00.0: AHCI 0001.0000 32 slots 2 ports 6 Gbps 0x3 impl SATA mode
> [    1.596716] ahci 0000:01:00.0: flags: 64bit ncq sntf led only pmp fbs pio slum part sxs 
> [    1.606183] scsi host0: ahci
> [    1.609448] scsi host1: ahci
> [    1.612636] ata1: SATA max UDMA/133 abar m512@0x60000000 port 0x60000100 irq 82
> [    1.619974] ata2: SATA max UDMA/133 abar m512@0x60000000 port 0x60000180 irq 82
> 
> > 
> >> I looked at pci_enable_resources()
> >>
> >> 	for (i = 0; i < PCI_NUM_RESOURCES; i++) {
> >> 		if (!(mask & (1 << i)))
> >> 			continue;
> >>
> >> 		r = &dev->resource[i];
> > 
> >                 dev_info(&dev->dev, "BAR %d %pR mask %#04x parent %p\n", i, r, mask, r->parent);
> > 
> >>
> >> 		if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM)))
> >> 			continue;
> >> 		if ((i == PCI_ROM_RESOURCE) &&
> >> 				(!(r->flags & IORESOURCE_ROM_ENABLE)))
> >> 			continue;
> >>
> >> 		if (r->flags & IORESOURCE_UNSET) {
> >> 			dev_err(&dev->dev, "can't enable device: BAR %d %pR not assigned\n",
> >> 				i, r);
> >> 			return -EINVAL;
> >> 		}
> >>
> >> 		if (!r->parent) {
> >> 			dev_err(&dev->dev, "can't enable device: BAR %d %pR not claimed\n",
> >> 				i, r);
> >> 			return -EINVAL;
> >> 		}
> >>
> >> I don't see the error "can't enable device: BAR %d %pR not assigned" , so it doesn't
> >> depend on IO bar as you mention below or is it in a different function?
> > 
> 
> 
> -- 
> Murali Karicheri
> Linux Kernel, Keystone
> --
> 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
> 

  reply	other threads:[~2016-03-18 11:25 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-16 16:20 PCI IO resource question Murali Karicheri
2016-03-16 16:45 ` Bjorn Helgaas
2016-03-16 18:08   ` Murali Karicheri
2016-03-16 19:29     ` Bjorn Helgaas
2016-03-16 20:13       ` Murali Karicheri
2016-03-16 21:47         ` Bjorn Helgaas
2016-03-17 17:11           ` Murali Karicheri
2016-03-17 21:28           ` Murali Karicheri
2016-03-18 11:28             ` Lorenzo Pieralisi [this message]
2016-03-18 14:13               ` Bjorn Helgaas
2016-03-18 15:09               ` Murali Karicheri
2016-03-18 15:25                 ` Murali Karicheri
2016-03-18 15:28                 ` Bjorn Helgaas
2016-03-18 18:12                   ` Murali Karicheri
2016-03-18 19:34                     ` Bjorn Helgaas
2016-03-18 19:51                       ` Murali Karicheri
2016-03-18 23:05                 ` Lorenzo Pieralisi
2016-03-21 15:24                   ` Murali Karicheri
2016-03-21 18:02                     ` Lorenzo Pieralisi
2016-03-22 19:41                       ` Murali Karicheri
2016-03-23 22:02                         ` Lorenzo Pieralisi
2016-03-16 18:09 ` Lorenzo Pieralisi
2016-03-16 19:32   ` Bjorn Helgaas
2016-03-16 20:33   ` Murali Karicheri

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=20160318112802.GA1810@red-moon \
    --to=lorenzo.pieralisi@arm.com \
    --cc=bhelgaas@google.com \
    --cc=helgaas@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=m-karicheri2@ti.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).