qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] modelling omap_gpmc with the hierarchical memory API
Date: Tue, 02 Aug 2011 18:58:31 +0300	[thread overview]
Message-ID: <4E381EA7.2070809@redhat.com> (raw)
In-Reply-To: <CAFEAcA9P=1pcjt8+eZQeD53Vbn9rnJGsC916e7+nP07B=TDoyw@mail.gmail.com>

On 08/02/2011 06:47 PM, Peter Maydell wrote:
> I'm trying to update omap_gpmc to (a) support OMAP3/Beagle features
> and (b) use sysbus/qdev rather than ad-hocery, and I'm having
> difficulty figuring out how it fits into the new memory API.
>
> Specifically, omap_gpmc lets you attach up to 8 devices to its chip
> selects, and has registers which specify base address and size for
> each attached device. I want the attached device to be an arbitrary
> sysbus device, because some boards use this (for instance the overo
> board hangs a lan9118 off the gpmc, and the n8x0 connects up the
> tusb6010; the other usual attached devices are nand and onenand).
>
> This kind of "I want to manage the memory layout of a pile of other
> things" seems like what the hierarchical memory API should provide,
> but there's a bit of a difficulty here in that sysbus MMIOs aren't
> necessarily MemoryRegions (and sysbus doesn't provide a "MemoryRegion*
> sysbus_get_memoryregion(SysBusDevice dev, int regionnumber)"
> anyway). How are we planning to move forward here? Will all sysbus
> MMIOs eventually be converted to MemoryRegions?

Yes.

>
> Secondly, I'm not sure how to implement the gpmc size registers with
> the memory API: memory_region_add_subregion() lets you specify the
> offset you want to put the subregion at, but doesn't provide any way
> to say "limit the size of the mapping to this many bytes, regardless
> of how big the underlying device thinks it is".

You can interpose you own container region:


  system_memory
      |
      +--- cs_region-0
              |
              +--- device-connected-to-that-region

cs-region-0 will clip anything under it.


>
> (My pre-memory-API version of these changes implemented a new
> sysbus_mmio_resize(), but you can't restrict the size of a
> MemoryRegion based sysbus MMIO.)
>
> So maybe I'm approaching the problem wrong -- how should I be doing
> this?

I don't think those devices should be connected to the sysbus (since 
they aren't on real hardware).  Connect them to your gpmc instead.  If 
the devices are already designed for sysbus, maybe we can dual-bus them, 
or make gpmc have eight sysbuses hanging off it.

>
> [More detailed summary of how the GPMC base and size registers work:
> the base register gives the top 6 bits of the base address, and there
> is also a 6 bit mask register which effectively gives the size of the
> region: the device is selected if (address[31:26]&  mask) == base. If
> the device is smaller than the specified size then it just repeats
> throughout the region.  Note that you can specify funny masks that
> give 'holes' in the region, although the TRM says not to do that
> :-). Access to a region which was programmed to map to two different
> chip selects generates a bus error instead. I don't think we need to
> model the finer details of holes, repeat-through-region or overlap if
> that is too tricky, though.]
>
> thanks
> -- PMM


-- 
error compiling committee.c: too many arguments to function

  reply	other threads:[~2011-08-02 15:58 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-02 15:47 [Qemu-devel] modelling omap_gpmc with the hierarchical memory API Peter Maydell
2011-08-02 15:58 ` Avi Kivity [this message]
2011-08-02 17:21   ` Peter Maydell
2011-08-02 18:05     ` Avi Kivity
2011-08-02 18:21       ` Peter Maydell
2011-08-02 19:11         ` Avi Kivity
2011-08-02 19:38           ` Peter Maydell
2011-08-02 21:00             ` Anthony Liguori
2011-08-02 21:25             ` Avi Kivity
2011-08-02 20:56         ` Anthony Liguori
2011-08-02 21:28           ` Peter Maydell
2011-08-02 21:48             ` Avi Kivity
2011-08-02 22:04               ` Peter Maydell
2011-08-03  2:26               ` Anthony Liguori
2011-08-03  6:50                 ` Avi Kivity
2011-08-03  2:25             ` Anthony Liguori
2011-08-03  9:10               ` Peter Maydell
2011-08-03  9:23                 ` Avi Kivity
2011-08-02 18:07     ` Jan Kiszka
2011-08-02 19:15       ` Avi Kivity
2011-08-02 21:06       ` Anthony Liguori
2011-08-02 21:29         ` Avi Kivity
2011-08-03  2:33           ` Anthony Liguori
2011-08-03  6:56             ` Avi Kivity

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=4E381EA7.2070809@redhat.com \
    --to=avi@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.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).