qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC] Memory API and fine grained Memory Regions


From: Edgar E. Iglesias
Subject: Re: [Qemu-devel] [RFC] Memory API and fine grained Memory Regions
Date: Sat, 27 Oct 2012 06:12:00 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]