From: Peter Maydell <peter.maydell@linaro.org>
To: "QEMU Developers" <qemu-devel@nongnu.org>,
"Andreas Färber" <afaerber@suse.de>,
"Paul Brook" <paul@codesourcery.com>,
"Anthony Liguori" <anthony@codemonkey.ws>
Subject: [Qemu-devel] ARM QOM conversion / class hierarchy
Date: Tue, 20 Mar 2012 12:12:45 +0000 [thread overview]
Message-ID: <CAFEAcA_PZ-ZdbhFCWw=oHzPLNJWdx4fKA-qaHxLmuW1pwDNq9w@mail.gmail.com> (raw)
(I can't find the relevant patches in the mailing list at
this point. I'm talking about this tree from Andreas:
http://repo.or.cz/w/qemu/afaerber.git/shortlog/refs/heads/qom-cpu-arm )
So in an IRC discussion yesterday we didn't seem to make much headway
on what the right class hierarchy is here. There seem to be two basic
options:
(1) subclass per CPU type
This is what Andreas' tree does at the moment, so there's an ARMCPU
which is a subclass of CPUState, and then a lot of subclasses of
that, one per CPU ("arm926", "arm1026", "cortex-a8", "cortex-a9", etc).
Mostly these subclasses just arrange for different reset values for
various registers, setting feature bits, etc.
(2) no subclasses for CPU types
This approach would just have a single ARMCPU, and then -cpu foo
is syntactic sugar for setting a lot of qom properties.
Option two looks kind of nice, but I'm not sure whether it would
actually work. I think you could do 95% of what you need for a
different CPU that way (lots of properties for "value of ID_MMFR1",
"value of "ID_MMFR2", "reset value of SCTLR", etc etc, plus properties
for all our existing ARM_FEATURE_*, and some new ones where we're
currently keying off "which CPU is this?" rather than using a feature
bit, or just failing to distinguish things which aren't really
common to all CPUs). But I'm not sure how you'd handle the genuinely
implementation specific cp15 registers (eg cp15 crn=15). We could
have a property which says "is this a 926/1026/1176/A8/A9/..." (or
equivalently, key off the relevant fields of the main ID register) but
it doesn't seem very OO-like to have one class whose behaviour changes
based on an integer that's basically defining an ad-hoc sub-type...
Regardless, it seems to me that we ought to be doing this the
same way for all our target CPUs. I don't know whether mips/x86/
etc have any preference one way or the other.
-- PMM
next reply other threads:[~2012-03-20 12:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-20 12:12 Peter Maydell [this message]
2012-03-20 14:08 ` [Qemu-devel] ARM QOM conversion / class hierarchy Paul Brook
2012-03-20 14:59 ` Peter Maydell
2012-03-20 16:06 ` Paul Brook
2012-03-20 16:20 ` Peter Maydell
2012-03-20 17:14 ` Paul Brook
2012-03-20 17:19 ` Peter Maydell
2012-03-20 16:56 ` Anthony Liguori
2012-03-20 17:14 ` Paul Brook
2012-03-20 17:20 ` Andreas Färber
2012-03-20 16:31 ` Michael Roth
2012-03-20 16:32 ` Peter Maydell
2012-03-20 19:04 ` Michael Roth
2012-03-20 17:01 ` Paul Brook
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_PZ-ZdbhFCWw=oHzPLNJWdx4fKA-qaHxLmuW1pwDNq9w@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=afaerber@suse.de \
--cc=anthony@codemonkey.ws \
--cc=paul@codesourcery.com \
--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).