qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Rusty Russell <rusty.russell@linaro.org>
Cc: qemu-devel@nongnu.org, "Paul Brook" <paul@codesourcery.com>,
	"Andreas Färber" <afaerber@suse.de>,
	patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH 00/32] target-arm: refactor copro register implementation
Date: Tue, 8 May 2012 18:56:44 +0100	[thread overview]
Message-ID: <CAFEAcA_TQfoL=QctiBTzYuL32577pHx2ZTAYmWwNhTgorh2-Uw@mail.gmail.com> (raw)
In-Reply-To: <87y5p3b4fq.fsf@rustcorp.com.au>

On 8 May 2012 06:57, Rusty Russell <rusty.russell@linaro.org> wrote:
> (Accidentally made first reply to Peter only, fixed that now).
>
> On Mon, 7 May 2012 13:25:07 +0100, Peter Maydell <peter.maydell@linaro.org> wrote:
>> On 7 May 2012 08:23, Rusty Russell <rusty@rustcorp.com.au> wrote:
>> > OK, I reviewed the infrastructure, and it looks excellent.  A few of
>> > minor quibbles, which I only mention to show that I read it :)
>> >
>> > 1) cptype_valid, arm_current_pl and encoded_cp_matches_type could return
>> >   bool.
>> >
>> > 2) the access bits could be an enum type, which could be used in the
>> >   few places they're handled, for a bit more explicitness.
>>
>> Mmm. This kind of thing is my old-school-C heritage showing through
>> :-)
>
> Maybe :)  I was delighted by your use of a non-zero terminal value
> though, so I hardly noticed.

I'd just been bitten by forgetting the terminator on a qdev Property
list and having it work fine when compiled in debug mode and only
break with optimisation turned on, so I wanted to try to catch that
kind of error :-)

>> > 3) Perhaps an "assert(!g_hash_table_lookup(env->cp_regs, key));" before
>> >   the g_hash_table_insert, to avoid overlapping entries.
>>
>> Overlapping entries are deliberately permitted (and used in some
>> cases). The idea is that last entry wins, so you can put in a
>> "whole region behaves like this" wildcard case and override it
>> with a few special cases.
>
> I feel nervous without flag on either the overridden or overriding one,
> to show it's deliberate.

Yes, that's probably a good idea.

> I don't pretend to understand the QEMU Object Model, but it seems like
> you're missing a level of indirection by putting the cp_regs hash into
> each CPUARMState directly.  More logically each ARMCPU would have a
> pointer to its ARMCPUType, which would contain the cp_regs hash (and
> maybe other things).

At some point properties like "does this core have $FEATURE?" and so on
will become user-settable QOM properties, which means that they will
apply per-instance of the object. So different instances of the same
object could have different sets of cp15 registers. Admittedly at
the moment QEMU's insistence that there can be only one CPU means there
aren't really any sane configs where the cores differ[*], but I think
it indicates that in principle the hashtable should be per-instance
rather than per-class.

[*] Apparently there have occasionally been FPGAs with stupid configs
like an A9x2 with only one core with Neon, and that is technically
a valid way to configure the RTL, but nobody does it in practice.

-- PMM

  reply	other threads:[~2012-05-08 17:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1334497585-867-1-git-send-email-peter.maydell@linaro.org>
     [not found] ` <CAFEAcA9tuuM6nx3qTuTh9JFfDfre0nvUKBGM_QWQjKB6ajBH0A@mail.gmail.com>
     [not found]   ` <87ehqwe9pl.fsf@rustcorp.com.au>
     [not found]     ` <CAFEAcA-rzasqW2mVoB9QJyfj+054RQ82gFDMJUXVJb9SmheVRQ@mail.gmail.com>
2012-05-08  5:57       ` [Qemu-devel] [PATCH 00/32] target-arm: refactor copro register implementation Rusty Russell
2012-05-08 17:56         ` Peter Maydell [this message]
2012-05-09 15:18         ` Peter Maydell
     [not found] ` <1334497585-867-2-git-send-email-peter.maydell@linaro.org>
2012-05-13 22:57   ` [Qemu-devel] [PATCH 01/32] target-arm: initial coprocessor register framework Andreas Färber
2012-05-14 10:34     ` Peter Maydell
2012-05-14 12:50       ` Peter Maydell

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='CAFEAcA_TQfoL=QctiBTzYuL32577pHx2ZTAYmWwNhTgorh2-Uw@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=afaerber@suse.de \
    --cc=patches@linaro.org \
    --cc=paul@codesourcery.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rusty.russell@linaro.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).