qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Avi Kivity <avi@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Memory API: handling unassigned physical memory
Date: Tue, 01 May 2012 09:15:40 -0500	[thread overview]
Message-ID: <4F9FF00C.2070000@codemonkey.ws> (raw)
In-Reply-To: <4F9FEE83.70306@redhat.com>

On 05/01/2012 09:09 AM, Avi Kivity wrote:
> On 05/01/2012 04:50 PM, Anthony Liguori wrote:
>> On 05/01/2012 08:01 AM, Avi Kivity wrote:
>>> On 05/01/2012 03:49 PM, Peter Maydell wrote:
>>>> On 1 May 2012 13:48, Avi Kivity<avi@redhat.com>   wrote:
>>>>> On 05/01/2012 03:43 PM, Peter Maydell wrote:
>>>>>> On 1 May 2012 13:42, Avi Kivity<avi@redhat.com>   wrote:
>>>>>>> sysbus should just die.
>>>>>>
>>>>>> Totally agreed. It's not going to go quietly though...
>>>>>
>>>>> Not if you keep suggesting workarounds when I tell unsuspecting
>>>>> developers to qomify their devices.
>>>>
>>>> When QOM supports (1) exporting gpio signals and
>>
>> This is trivial.  It'll come in as soon as 1.2 opens up.  If folks
>> want to start working on a branch with it:
>>
>> https://github.com/aliguori/qemu/tree/qom-pin.4
>>
>>>> (2) exporting memory regions, then it will be providing the
>>>> main things that sysbus provides.
>>
>> This is a little tricky.  Here's the problems I've encountered so far:
>>
>> a) A lot of devices need the equivalent of it_shift.  it_shift affects
>> how addresses are decoded and the size of the memory region.  it_shift
>> usually needs to be a device property.
>>
>> Since we need to know the size of the memory region to initialize it,
>> we need to know the value of it_shift before we can initialize it
>> which means we have to delay the initialization of the mmemory region
>> until realize.
>>
>> I think a nice fix would be to make it_shift as memory region mutator
>> and allow it to be set after initialization.
>
> Indeed I wanted to make it_shift as part of the memory core.  But a
> mutator?  It doesn't change in real hardware, so this looks artificial.
> So far all mutators really change at runtime.

QOM has a concept of initialization and realize.  You can change properties 
after initialization but not before realize.

So as long as it_shift can be set after initialization but before realize (which 
I think is roughly memory_region_add_subregion) it doesn't need to be a mutator.

> What is the problem with delaying region initialization until realize?

We need to initialize the MemoryRegion in order to expose it as a property.  We 
want to do that during initialize.  Here's an example:

qom-create isa-i8259 foo
qom-set /peripheral/foo/io it_shift 1
qom-set /peripheral/foo/realize true

For this to work, it_shift needs to be a QOM property of the "io" MemoryRegion. 
  The MemoryRegion needs to be created in instance_init.

>> b) There's some duplication in MemoryRegions with respect to QOM.
>> Memory regions want to have a name but with QOM they'll be addressable
>> via a path.  I go back and forth about how aggressively we want to
>> refactor MemoryRegions.
>
> These days region names are purely for debugging.  The ABI bit was moved
> to a separate function.

Fair enough.

BTW, in the branch I've posted, I've got a number of memory API conversions or 
removal of legacy interfaces.

Regards,

Anthony Liguori

  reply	other threads:[~2012-05-01 14:15 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4F9D797E.500@ilande.co.uk>
     [not found] ` <4F9D97F3.8080608@codemonkey.ws>
     [not found]   ` <4F9E5028.7010306@redhat.com>
     [not found]     ` <4F9E82C7.10706@ilande.co.uk>
     [not found]       ` <4F9E9268.70408@redhat.com>
     [not found]         ` <CAFEAcA_sKtzmHpFcdhkANLCY0=FuW0Hbof0ifp3uHM66NkWoOQ@mail.gmail.com>
     [not found]           ` <4F9E9906.8060401@ilande.co.uk>
2012-05-01  6:57             ` [Qemu-devel] Memory API: handling unassigned physical memory Blue Swirl
2012-05-01 13:53               ` Anthony Liguori
2012-05-01 18:48               ` Mark Cave-Ayland
2012-05-02 15:15                 ` Bob Breuer
2012-05-06  8:45                   ` Blue Swirl
2012-05-06  8:41                 ` Blue Swirl
     [not found]             ` <CAFEAcA9VeJWPQ-LU=DvX6vp+=g44-uWda7zokK2NKfLiSkgGAg@mail.gmail.com>
     [not found]               ` <4F9EA2AD.9050208@ilande.co.uk>
2012-05-01  7:10                 ` Blue Swirl
2012-05-01 18:50                   ` Mark Cave-Ayland
2012-05-01 21:21                     ` Andreas Färber
     [not found]           ` <4F9E9569.5000700@redhat.com>
     [not found]             ` <CAFEAcA_wFfsq=PwHAc_r-2bgdwUpSHaTOaL2VPVCJSs9x_JT6A@mail.gmail.com>
2012-05-01 12:39               ` Avi Kivity
2012-05-01 12:41                 ` Peter Maydell
2012-05-01 12:42                   ` Avi Kivity
2012-05-01 12:43                     ` Peter Maydell
2012-05-01 12:48                       ` Avi Kivity
2012-05-01 12:49                         ` Peter Maydell
2012-05-01 13:01                           ` Avi Kivity
2012-05-01 13:50                             ` Anthony Liguori
2012-05-01 14:00                               ` Peter Maydell
2012-05-01 14:06                                 ` Anthony Liguori
2012-05-01 14:20                                   ` Peter Maydell
2012-05-01 15:09                                     ` Anthony Liguori
2012-05-01 15:20                                       ` Peter Maydell
2012-05-01 15:26                                         ` Anthony Liguori
2012-05-01 15:37                                           ` Peter Maydell
2012-05-01 17:21                                             ` Anthony Liguori
2012-05-01 18:57                                         ` Mark Cave-Ayland
2012-05-01 19:03                                           ` Peter Maydell
2012-05-01 14:09                               ` Avi Kivity
2012-05-01 14:15                                 ` Anthony Liguori [this message]
2012-05-01 14:26                                   ` Avi Kivity
2012-05-01 15:13                                     ` Anthony Liguori
     [not found]             ` <4F9E96EC.5080005@codemonkey.ws>
2012-05-01 12:41               ` Avi Kivity
     [not found]         ` <4F9E964A.1010408@ilande.co.uk>
2012-05-01 12:46           ` 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=4F9FF00C.2070000@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --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).