linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	Jason Cooper <jason@lakedaemon.net>,
	Ezequiel Garcia <ezequiel.garcia@free-electrons.com>,
	linux-arm <linux-arm-kernel@lists.infradead.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Subject: Re: [PATCH v2] PCI: mvebu - Support a bridge with no IO port window
Date: Thu, 31 Oct 2013 23:28:48 -0600	[thread overview]
Message-ID: <20131101052848.GA20163@obsidianresearch.com> (raw)
In-Reply-To: <CAErSpo4NDuNJ4mj1n4V8UgsdAJxMrSRy43Qz=3JNvtsrv2rMjA@mail.gmail.com>

On Thu, Oct 31, 2013 at 08:44:36PM -0600, Bjorn Helgaas wrote:
 
> You obviously understand all this, so sorry for the repetition; I
> guess I'm just trying to get it clear in my own mind :)

Ditto, it is tricky. When I first looked at that code I thought it was
trying to do something else..

> > How about this instead:
> >
> >         if (!io) {
> >                 /* Disable the IO window by setting limit < base */
> >                 pci_write_config_word(bridge, PCI_IO_BASE, 0x00f0);
> >                 pci_read_config_word(bridge, PCI_IO_BASE, &io);
> >         }
> >         /* Bridges without IO support must wire the IO register to 0 */
> >         if (io)
> >                 b_res[0].flags |= IORESOURCE_IO;
> 
> If an I/O window happened to be configured to the 4K region at 0x0,
> this disables it.  An I/O window configured anywhere else is left
> enabled.  Previously the only effect of the function was to set bits
> in b_res[].flags; with this change it would also sometimes disable an
> I/O window.  That seems worse to me.  Am I just misunderstanding the
> problem you're solving?

No, you've got it right. The problem I had is completely solved by
PATCH 1/2 PCI: mvebu - The bridge should obey the MEM and IO command
bits

But the code looks odd to me. 

It is certainly correct as written if the check is only ever called
with PCI_COMMAND_IO cleared. 

However, I am having trouble convincing myself of this. Notably
pci_setup_bridge does not seem to make that assumption.

If PCI_COMMAND_IO is set, it can just assume IORESOURCE_IO and skip
the testing of the PCI_IO_BASE register.

Why 0xf0f0 anyhow? :)

Jason

  reply	other threads:[~2013-11-01  5:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-15 20:16 [PATCH v2] PCI: mvebu - Support a bridge with no IO port window Jason Gunthorpe
2013-10-17 13:10 ` Jason Cooper
2013-10-17 14:41   ` Jason Gunthorpe
2013-10-17 14:47     ` Jason Cooper
2013-10-31  9:13 ` Thomas Petazzoni
2013-10-31 16:48   ` Jason Gunthorpe
2013-10-31 17:10     ` Bjorn Helgaas
2013-10-31 23:32       ` Jason Gunthorpe
2013-11-01  2:44         ` Bjorn Helgaas
2013-11-01  5:28           ` Jason Gunthorpe [this message]
2013-11-01 13:50             ` Bjorn Helgaas
2013-11-01 16:56               ` Jason Gunthorpe

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=20131101052848.GA20163@obsidianresearch.com \
    --to=jgunthorpe@obsidianresearch.com \
    --cc=bhelgaas@google.com \
    --cc=ezequiel.garcia@free-electrons.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --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).