From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
John Williams <john.williams@xilinx.com>,
"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
Avi Kivity <avi@redhat.com>
Subject: Re: [Qemu-devel] [RFC] Memory API and fine grained Memory Regions
Date: Sat, 27 Oct 2012 06:12:00 +0200 [thread overview]
Message-ID: <20121027041159.GA20153@zapo> (raw)
In-Reply-To: <CAEgOgz4q1oA=W2yktQ0SgZ_3WTjT9DZaDqB3r-0nfod0m1QX8Q@mail.gmail.com>
On Fri, Oct 26, 2012 at 05:03:04PM +1000, Peter Crosthwaite wrote:
> In my recent USB series Avi mentioned he wanted to do some work with
> the memory API and encourage devices to use the memory API to do
> fine-grained register decoding, i.e. each register is its own
> MemoryRegion. This has the advantage of getting rid of the symmetric
> switch statements in the read and write handlers. The big drawback I
> am seeing is however is indexing into the register file. For example
> in a device i'm working on ATM I have this read handler for my device
> registers:
>
> static uint64_t devcfg_read (void *opaque, hwaddr addr,
> unsigned size)
> {
> struct XilinxDevcfg *s = opaque;
> uint32_t ret;
>
> addr >>= 2;
> switch (addr)
> {
> //TODO: implement any read side effects
> }
> ret = s->regs[addr];
> DB_PRINT("addr=" TARGET_FMT_plx " = %x\n", addr * 4, ret);
> return ret;
> }
Hi,
If well designed, most hw has a well designed symtery between regs
that makes things simpler if you can just opencode the decding.
IMO, an mr per reg would just add a massive overhead for no win.
And also, hw implemented decoders look very much like
switch cases in qemu which make things easy to map.
What is the win?
Cheers,
Edgar
next prev parent reply other threads:[~2012-10-27 4:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-26 7:03 [Qemu-devel] [RFC] Memory API and fine grained Memory Regions Peter Crosthwaite
2012-10-26 7:31 ` Gerd Hoffmann
2012-10-27 4:12 ` Edgar E. Iglesias [this message]
2012-10-28 23:37 ` John Williams
2012-10-29 16:34 ` Avi Kivity
2012-10-30 8:35 ` Edgar E. Iglesias
2012-10-29 16:36 ` 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=20121027041159.GA20153@zapo \
--to=edgar.iglesias@gmail.com \
--cc=avi@redhat.com \
--cc=john.williams@xilinx.com \
--cc=peter.crosthwaite@xilinx.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).