qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Avi Kivity <avi@redhat.com>, QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] modelling omap_gpmc with the hierarchical memory API
Date: Tue, 02 Aug 2011 21:25:43 -0500	[thread overview]
Message-ID: <4E38B1A7.4090403@codemonkey.ws> (raw)
In-Reply-To: <CAFEAcA8nO+OUgS1X_B_MH2-SwE1S6T+zC+deRVfyj46wuNfJ+Q@mail.gmail.com>

On 08/02/2011 04:28 PM, Peter Maydell wrote:
> On 2 August 2011 21:56, Anthony Liguori<anthony@codemonkey.ws>  wrote:
>> Hrm, this looks like badness to me.
>>
>> You're effectively using MemoryRegions to implement an ad-hoc interface.
>
> As you'll see below, the hardware intreface is somewhat ad-hoc :-)
>
>>   This is not what MemoryRegions are meant to do though.  You want something
>> like:
>>
>> class WhateverDevice : public Device, implements SimpleDevice
>> {
>>    MemoryRegion *get_memory_region(void);
>> };
>>
>> class OmapGmc : public Device
>> {
>>    SimpleDevice *slots[8];
>> };
>>
>> In qdev of today, you should implement something other than SysBus as a base
>> class and make OmapGmc a bus.
>
> Doesn't this then preclude connecting the memory region of an
> existing sysbus device model into the OmapGpmc bus? After all,
> it wouldn't be implementing SimpleDevice.

Yes, that's a feature not a bug.

>> What's the relationship between the omap_gpmc and the devices in real
>> hardware?  Are the devices designed to connect to the GPMC explicitly via a
>> common set of pins?  Is there an intermediate bridge chip or something?
>
> The external interface (ie the one to the outside of the OMAP3 SOC,
> into which a board can wire devices) looks like this:
>
>   gpmc_a[10:1]   output    Address (note no bit zero!)
>   gpmc_d[15:0]   i/o       Data
>   gpmc_ncs[7:0]  output    Chip selects
>   gpmc_nadv_ale  output    Address valid (or address latch enable for NAND)
>   gpmc_noe_nre   output    Output enable (or read enable for NAND)
>   gpmc_nwe       output    Write enable
>   gpmc_nbe0_cle  output    Lower byte enable (also command latch enable for NAND)
>   gpmc_nbe1      output    Byte 1 enable
>   gpmc_nwp       output    Write protect
>   gpmc_io_dir    output    gpmc_d[15:0] direction control (input vs output)
>
> ...which you can then use in a number of different modes by programming
> the GPMC appropriately:
>   * multiplexed address-and-data NOR-like device:
>     gpmc_d[15:0] are a 16 bit data bus and also used for addressing:
>     gpmc_a[10:1] + gpmc_d[15:0] together give an address bus A26..A1
>     (no A0, so you can't byte-address, only 16-bit-word address)
>   * non-multiplexed NOR like device:
>     gpmc_d[15:0] are a 16 bit data bus only
>     gpmc_a[10:1] are A10..A1 address bus (again, no A0)
>   * 16 bit NAND device wired up to gpmc_d[15:0], with the NAND
>     control pins being gpmc_nadv_ale etc as above
>   * 8 bit NAND device, as 16 bit NAND but only using gpmc_d[7:0]
>
> Assuming we aren't going to actually try to model this at a pin
> level, this disentangles into talking to one of two interfaces:
>   * a NAND device (which at the moment nand.c implements via
>     nand_setpins/nand_getpins/nand_setio/nand_getio)
>   * a random addressable memory region
>

So you basically have a OMAP3 SOC bus.  You can't connect devices 
directly to it, you need some sort of bridge to bridge existing devices 
to this bus.

It's no different than something like ISA on the classic PC.

> Typically in the latter case the device we're talking to will
> also provide some gpio or irq signals, which will be routed in
> a totally different direction having nothing to do with the GPMC.
> So it's important that we should be able to take an existing
> device model and route its registers through the GPMC and its
> GPIO elsewhere.

So I think the modelling disconnect here is that you're trying to model 
the wire connections to hook up arbitrary devices to a OMAP SOC.

Unless you're modelling each pin (which I don't think you're doing), I 
think it makes more sense to treat this as a bus and model accordingly.

Regards,

Anthony Liguori

>
> -- PMM
>

  parent reply	other threads:[~2011-08-03  2:25 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
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 [this message]
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=4E38B1A7.4090403@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=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).