qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 1/2] memory: Fix old portio word accesses


From: Jan Kiszka
Subject: Re: [Qemu-devel] [PATCH v2 1/2] memory: Fix old portio word accesses
Date: Mon, 19 Sep 2011 14:55:49 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

On 2011-09-19 14:42, Avi Kivity wrote:
> On 09/19/2011 03:32 PM, Jan Kiszka wrote:
>> >  It's opt-in.  If a device sets
>> >  MemoryRegionOps::impl.{min,max}_access_size = 1, it will only be fed
>> >  byte accesses (the core will take care of breaking apart larger
>> >  writes).  If it sets MemoryRegionOps::impl.{min,max}_access_size =
>> 4, it
>> >  will only get long accesses (and the core will/should shift/mask or
>> >  RMW).  Refusing illegal access sizes is done using
>> >  MemoryRegionOps::valid.  Most of this is unimplemented unfortunately.
>>
>> That makes sense (for non-old_portio users).
>>
>>
> 
> The trick of having a way to register N callbacks with one shot is worth
> growing.  Ideally each register in a BAR would have a callback and we'd
> do something like
> 
>     MemoryRegionOps mydev_ops = {
>         .registers = {
>              { MYDEV_REG_x, 4, 4, mydev_reg_x_read, mydev_reg_x_write, },
>              ...
>          },
>     }
> 
> with hints to the core like "this register sits at this offset, use it
> for reads instead of a callback", or, "this is a read-only register".

This has pros and cons. If you have n registers to dispatch, you then
have to write n function prologues and maybe epilogues instead of just
one. Specifically if the register access is trivial, that could case
quite some LoC blowup on the device side.

What may have a better ratio are generic register get/set handlers.

Jan

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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