From: BALATON Zoltan <balaton@eik.bme.hu>
To: bzt bzt <bztemail@gmail.com>
Cc: Andrew Baumann <Andrew.Baumann@microsoft.com>,
Peter Maydell <peter.maydell@linaro.org>,
"qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] BCM2837 and machine raspi3
Date: Tue, 24 Oct 2017 13:05:32 +0200 (CEST) [thread overview]
Message-ID: <alpine.BSF.2.21.1710241246330.82180@zero.eik.bme.hu> (raw)
In-Reply-To: <CADYoBw1ksGDo26-PC4eMnyqxZQoZkXNLDeGoWfcRHs-SfTCJkw@mail.gmail.com>
On Tue, 24 Oct 2017, bzt bzt wrote:
> On Mon, Oct 23, 2017 at 6:34 PM, Andrew Baumann <Andrew.Baumann@microsoft.com> wrote:
>>> +/* According to
>>> https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2837/
>>> README.md
>>> + * The underlying architecture of the BCM2837 is identical to the
>> BCM2836.
>>> The only significant
>>> + * difference is the replacement of the ARMv7 quad core cluster with a
>>> quad-core ARM Cortex A53
>>> + * (ARMv8) cluster. So we use cortex-a53- here. */
>>
>> Are there any changes from bcm2836 other than the CPU model?
>
>
>> Duplicating the whole file just to have a different CPU seems like a bad
>> idea to me. I would suggest parameterising the CPU model in bcm2836 (and
>> maybe noting in header comments etc. that it can also model 2837), and then
>> instantiating it from raspi.c with the correct CPU type depending on which
>> machine is being used. That will also reduce the size of the patch
>> significantly, which will make it easier to get it reviewed.
>>
>
> For now, there's no more difference in the emulation than the CPU, but
> BCM2837 has a lot more to offer (40 bit address space, wifi, bluetooth
> etc.). So sooner or later it will need it's own source file to support all
> of that without getting the code messy. I have asked Peter whether it does
> worth writing future proof code, or keep the change at the bare minimum,
> but had no answer yet.
>
>
>>
>> (Alternatively, if there are minor but non-trivial differences between
>> 2836 and 2837 other than the CPU model, you may want to create something
>> like bcm2835_peripherals that contains all the functionality common to
>> both. But I suspect that isn't the case here.)
>>
>
> Well, bcm2837 is backward compatible with the bcm2836, but has a lot more
> registers and a different boot up process (different address and no atags).
> The common functionality is already in bcm2835_peripherals, and the MMIO
> address change from bcm2835 to bcm2836 has already been added by you.
> What's different is a lot more devices, which imho would be unwise to add
> to bcm2835 or either to bcm2836. So to be future proof I've created a
> separated file, but you are right at the current level of emulation it's
> not necessary.
[...]
>> Similarly, this looks like a clone of raspi2_init. I think it would be
>> better to have one function, parametrised if needed.
>>
>
> For now, yes. But the extra devices bcm2837 have will need extra
> initialization, and I though it would be clearer to separate in advance.
> Again, I've asked Peter about this, but had no response. As I see having a
> parametrised single function is simplier for now, but could lead to a messy
> code later when all the SoC features will be added. But I'm ain't no expert
> on qemu source, this is my first patch, so I'm open to suggestions! :-)
>
> Summa summarum, which one is preferred? Think of the future or keep it at a
> bare minimum?
I don't feel I have a deciding word in this but to share my opinion I
think it's better to keep it in one file avoiding too much code
duplication as long as those features that would make the implementations
different aren't added now. Then when those features are added the files
could be split or the best way can be decided at that point based on how
those features will be implemented so no need to think that far ahead now.
This would make patches easier to review now and maintaining the common
code easier until they are different enough so a split needs to be done.
Regrads,
BALATON Zoltan
next prev parent reply other threads:[~2017-10-24 11:05 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-22 13:20 [Qemu-devel] [PATCH] BCM2837 and machine raspi3 bzt bzt
2017-10-23 9:34 ` KONRAD Frederic
2017-10-23 12:39 ` bzt bzt
2017-10-23 16:34 ` Andrew Baumann
2017-10-24 9:53 ` bzt bzt
2017-10-24 11:05 ` BALATON Zoltan [this message]
2017-10-24 16:30 ` bzt bzt
2017-10-24 16:44 ` Andrew Baumann
2017-10-25 8:52 ` bzt bzt
2017-11-25 16:43 ` bzt bzt
2017-11-25 18:04 ` Peter Maydell
2017-11-27 19:06 ` Andrew Baumann
2017-11-28 11:26 ` bzt bzt
2017-11-28 11:56 ` Peter Maydell
2017-11-29 7:17 ` bzt bzt
2017-11-28 17:54 ` Andrew Baumann
2017-11-29 7:52 ` bzt bzt
2018-01-18 21:39 ` bzt bzt
2018-01-22 11:41 ` BALATON Zoltan
2018-01-23 11:13 ` bzt bzt
2018-01-23 11:22 ` Peter Maydell
2018-01-23 12:32 ` bzt bzt
2018-01-22 12:12 ` Peter Maydell
2018-01-23 11:49 ` bzt bzt
2018-01-23 15:09 ` BALATON Zoltan
2018-01-23 18:14 ` 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=alpine.BSF.2.21.1710241246330.82180@zero.eik.bme.hu \
--to=balaton@eik.bme.hu \
--cc=Andrew.Baumann@microsoft.com \
--cc=bztemail@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.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).