linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 04/10] bus: introduce an Marvell EBU MBus driver
Date: Fri, 8 Mar 2013 13:50:15 +0000	[thread overview]
Message-ID: <201303081350.15429.arnd@arndb.de> (raw)
In-Reply-To: <20130307113917.0b751a75@skate>

On Thursday 07 March 2013, Thomas Petazzoni wrote:
> This doesn't work for PCIe interfaces. The PCIe windows cannot be
> described in the DT, because they are inherently dynamic, and depend on
> which PCIe devices are plugged into the PCIe slots, and how much I/O
> and memory space each of those devices require.
> 
> This means that regardless of what you think, some windows will have
> to be created dynamically during the system initialization, and we will
> not be able to describe all windows in the Device Tree.
> 
> And to me, it seems completely stupid to have some windows defined
> statically in the Device Tree, and some other windows set up
> dynamically when the system initializes.

You could have no "ranges" property in the boot time DT if you are
looking for consistency here.

Ideally, the ranges would contain exactly the setup of the MBUS windows
that was configured with at boot time, and then get updated by the
kernel when the windows are dynamically changed. An skipping the
ranges at boot time would imply that none of the devices underneath
MBUS are currently mapped to physical addresses. Putting some of
the ranges is there is a way to handle two cases though:

* Overriding the boot loader (or hardware) defaults, telling the
  kernel that we really want to set up the windows differently. In
  a perfect world, this would not be necessary, because the boot
  loader should be able to make sure the two always match.
* Windows that we don't want to be set up at boot time yet because
  we know that we want dynamic allocation.

> > At the stanza of MBUS driver's bus. Each line represents a MBUS target
> > (this is a physical HW IP block). The MAPDEF is a SOC specific 'target
> > id' that is currently living in tables in the driver. This value is
> > directly compatible with the mbus window register and is defined by
> > Marvell. The 2nd number is the CPU base address of that window, and
> > the last is the size.
> 
> Please explain how you handle PCIe windows.

Any window that we don't want to hardcode, like the PCIe windows, can
be absent from the "ranges", which in DT syntax means exactly the right
thing: There are bus addresses on the child bus that are wired to one
device but not currently mapped into the parent bus. This is exactly
what we do for instance on a PCI bus ranges property that does not map
its I/O space window into the parent bus as a linear map. This is the
normal case on x86, but also done on a few other platforms.

> > Per OF conventions the base address should be the value the bootloader
> > left it at - but that is not important, the value could be 0. A
> > dynamic MBUS driver would go through each item in the ranges, find
> > an address range and program a window with the MAPDEF from the DT. It
> > would then write the base address back into the DT (at runtime!) so
> > that the entire DT remains conistent with the current state of the
> > hardware.
> 
> Why the heck would the kernel need to rewrite the DT ?
> 
> Just like a driver does an ioremap() to create a virtual -> physical
> mapping, the driver can just as well do mvebu_mbus_add_window() to
> create a physical -> device mapping. It doesn't have to be hardcoded
> into the Device Tree.

The important difference is that the DT describes the physical address
space as seen from the CPU bus interface, but does not care at all about
the virtual addresses that the kernel puts into page tables.

Describing the mapping of addresses from one bus address space to another,
down to the CPU's view is the core of all DT bindings, and we should do
that properly and consistently. If you change the mapping at run-time,
updating the properties is the natural thing to do.

	Arnd

  reply	other threads:[~2013-03-08 13:50 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-06 13:43 [PATCH 3.10] Introduce a Marvell EBU MBus driver Thomas Petazzoni
2013-03-06 13:43 ` [PATCH 01/10] arm: plat-orion: only build addr-map.c when needed Thomas Petazzoni
2013-03-06 13:43 ` [PATCH 02/10] arm: plat-orion: use mv_mbus_dram_info() in PCIe code Thomas Petazzoni
2013-03-06 13:43 ` [PATCH 03/10] arm: mach-orion5x: use mv_mbus_dram_info() in PCI code Thomas Petazzoni
2013-03-06 13:43 ` [PATCH 04/10] bus: introduce an Marvell EBU MBus driver Thomas Petazzoni
2013-03-06 19:08   ` Jason Gunthorpe
2013-03-06 19:27     ` Thomas Petazzoni
2013-03-06 20:24       ` Jason Gunthorpe
2013-03-06 20:40         ` Thomas Petazzoni
2013-03-06 21:50           ` Jason Gunthorpe
2013-03-06 22:27             ` Jason Cooper
2013-03-06 23:04               ` Jason Gunthorpe
2013-03-07 10:39                 ` Thomas Petazzoni
2013-03-08 13:50                   ` Arnd Bergmann [this message]
2013-03-08 14:06                     ` Thomas Petazzoni
2013-03-08 15:41                       ` Arnd Bergmann
2013-03-08 17:50                         ` Jason Gunthorpe
2013-03-08 19:42                           ` Arnd Bergmann
2013-03-08 20:05                             ` Jason Gunthorpe
2013-03-08 22:46                               ` Arnd Bergmann
2013-03-08 17:43                       ` Jason Gunthorpe
2013-03-08 22:58                         ` Arnd Bergmann
2013-03-07 22:20                 ` Ezequiel Garcia
2013-03-07 23:05                   ` Jason Gunthorpe
2013-03-08  1:02                     ` Ezequiel Garcia
2013-03-08  8:10                     ` Thomas Petazzoni
2013-03-08 17:29                       ` Jason Gunthorpe
2013-03-08 17:59                         ` Ezequiel Garcia
2013-03-08 18:31                           ` Jason Gunthorpe
2013-03-08 18:53                             ` Ezequiel Garcia
2013-03-18 16:27                         ` Thomas Petazzoni
2013-03-18 17:18                           ` Jason Gunthorpe
2013-03-08 15:59                     ` Maxime Bizon
2013-03-08 16:48                       ` Jason Gunthorpe
2013-03-08 17:12                         ` Ezequiel Garcia
2013-03-08  8:14                 ` Thomas Petazzoni
2013-03-08 18:26                   ` Jason Gunthorpe
2013-03-07  3:50           ` Arnd Bergmann
2013-03-07  3:37         ` Arnd Bergmann
2013-03-07  6:35           ` Jason Gunthorpe
2013-03-08 16:48             ` Jason Cooper
2013-03-08 19:47               ` Jason Gunthorpe
2013-03-08 22:54                 ` Arnd Bergmann
2013-03-07 10:58           ` Thomas Petazzoni
2013-03-07 17:37             ` Jason Gunthorpe
2013-03-07 19:11               ` Thomas Petazzoni
2013-03-07 19:55                 ` Jason Gunthorpe
2013-03-07 20:28                   ` Thomas Petazzoni
2013-03-07 20:47                     ` Jason Gunthorpe
2013-03-06 13:43 ` [PATCH 05/10] arm: mach-mvebu: convert to use mvebu-mbus driver Thomas Petazzoni
2013-03-06 13:58   ` Thomas Petazzoni
2013-03-06 13:43 ` [PATCH 06/10] arm: mach-kirkwood: " Thomas Petazzoni
2013-03-06 19:09   ` Jason Gunthorpe
2013-03-06 19:31     ` Thomas Petazzoni
2013-03-06 13:43 ` [PATCH 07/10] arm: mach-dove: " Thomas Petazzoni
2013-03-06 13:43 ` [PATCH 08/10] arm: mach-orion5x: " Thomas Petazzoni
2013-03-06 13:43 ` [PATCH 09/10] arm: mach-mv78xx0: convert to use the " Thomas Petazzoni
2013-03-06 13:43 ` [PATCH 10/10] arm: plat-orion: remove addr-map code Thomas Petazzoni
2013-03-06 16:59 [PATCH v2 for 3.10] Introduce a Marvell EBU MBus driver Thomas Petazzoni
2013-03-06 16:59 ` [PATCH 04/10] bus: introduce an " Thomas Petazzoni

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=201303081350.15429.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).