linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pratyush Anand <pratyush.anand@st.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Jingoo Han <jg1.han@samsung.com>,
	Mohit KUMAR DCG <Mohit.KUMAR@st.com>, Marek Vasut <marex@denx.de>,
	Richard Zhu <Hong-Xing.Zhu@freescale.com>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Tim Harvey <tharvey@gateworks.com>
Subject: Re: [Query/Discussion]: IO translation with designware PCIe controller
Date: Fri, 6 Dec 2013 14:42:09 +0530	[thread overview]
Message-ID: <20131206091209.GC2298@pratyush-vbox> (raw)
In-Reply-To: <201312052233.13169.arnd@arndb.de>

Hi Arnd,

Thanks a lot for detailed explanation.

On Fri, Dec 06, 2013 at 05:33:12AM +0800, Arnd Bergmann wrote:
> On Thursday 05 December 2013, Pratyush Anand wrote:
> > Hi Arnd / Jingoo,
> > 
> > Sorry for not able to follow earlier discussion you had on this
> > topic while initial reviews of patches from Jingoo.
> > 
> > I have few doubts that how will it actually work.
> > 
> > As per my understanding under current implementation:
> > 
> > 1. Physical IO addresses are in the range of 0x1000 to 0xfffff.
> > 2. They are mapped to fixed virtual address 0xFEE00000 using
> > pci_ioremap_io.
> > 3. IO resource addresses to any PCIe device will be allocated in above
> > range.
> > 4. Driver for that PCIe device will write in the above range only for
> > IO transaction to the device.
> > 5. As per current IO translation programming, its one to one
> > translation. It means PCIe translation unit will have both input and
> > output address in the range of 0x1000 to 0xfffff.
> > 
> > Did I miss something, or if above statements are correct, then what I
> > do not understand is how can designware PCIe translation unit accept
> > input address in the range of 0x1000 to 0xfffff?
> 
> Hi Pratyush,
> 
> I think the part that you are missing is that there are four, not two
> address spaces involved:
> 
> 1. The "bus" I/O port address, in the range between 0x1000 and 0xffff
> (65535). This is the address used in data frames in the actual bus
> transaction going over the PCIe wires. If you have more than one PCIe
> host bridge, each of them can normally have a range of up to 65536
> addresses. The bus addresses get written into BAR registers of the
> device.

Correct. Got this point. So this address should be output of
designware outbound address translation unit.

> 
> 2. The Linux I/O port numbers, between 0x00000 and 0xfffff (1048575).
> This is a logical number space that aggregates all bus I/O port numbers.
> The first 4096 ports are normally reserved for ISA devices and are
> not available for PCIe resources. Each PCI or PCIe host bridge can have
> a 0x10000 byte naturally aligned range in here. The common case is that
> you have only one host bridge using the range 0x1000-0xffff. If you have
> more than one, there may be an offset between them, e.g. the second PCIe
> host may have io_offset set to 0x10000, which means that its bus range
> 0x1000-0xffff gets translated to Linux port number 0x11000-0x1ffff.
> Linux port numbers are visible e.g. in /proc/ioport and /dev/port

Ok, got it. To know more, which binding function maps this logical
number space to address space in 4?

> 
> 3. The CPU physical address space: Each PCIe host normally has its
> bus I/O port space mapped into PCU visible addresses, either hardwired
> or (in case of dw_pcie) set up using an outbound translation window.
> These addresses are what get passed to pci_ioremap_io.

OK.

> 
> 4. The CPU virtual address space: This is an implementation detail
> of the kernel, which results in the Linux I/O port numbers 0x0-0xfffff
> to be mapped at 0xfee00000-0xfeefffff.
> 
> > For example in SPEAr1340, physically RAM is mapped on above addresses.
> > PCIe address translation unit can accept address only in the range of
> > core addresses which are assigned to PCIe RC ie 0x80000000-0x8FFFFFFF.
> 
> Since this is a physical address, it corresponds to address space 3 in
> my list above, and the address you pick here is what you pass to
> pci_ioremap_io.

This is what I was expecting. But currently designware driver does not
pass this address to pci_ioremap_io.
OK.. We will fix it and will send patch.

Regards
Pratyush

> 
> 	Arnd

  reply	other threads:[~2013-12-06  9:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-05  5:04 [Query/Discussion]: IO translation with designware PCIe controller Pratyush Anand
2013-12-05 21:33 ` Arnd Bergmann
2013-12-06  9:12   ` Pratyush Anand [this message]
2013-12-06 14:46     ` Arnd Bergmann
2013-12-09  7:12       ` Pratyush Anand
2013-12-09 16:09         ` Arnd Bergmann
2013-12-10  4:34           ` Pratyush Anand
2013-12-10  5:25             ` Jingoo Han
2013-12-10  6:31               ` Mohit KUMAR DCG
2013-12-10  6:57                 ` Pratyush Anand
2013-12-10  7:02                 ` Jingoo Han
2013-12-13  7:36                   ` Hong-Xing.Zhu
2013-12-10 13:26         ` Marek Vasut
2013-12-10 22:22           ` Jingoo Han
2013-12-10 23:23             ` Tim Harvey
2013-12-10 23:25               ` Marek Vasut
2013-12-10 23:58               ` Jingoo Han

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=20131206091209.GC2298@pratyush-vbox \
    --to=pratyush.anand@st.com \
    --cc=Hong-Xing.Zhu@freescale.com \
    --cc=Mohit.KUMAR@st.com \
    --cc=arnd@arndb.de \
    --cc=jg1.han@samsung.com \
    --cc=kishon@ti.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=tharvey@gateworks.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).