mbox series

[00/24] hw/arm: New board model mps3-an524

Message ID 20210205170019.25319-1-peter.maydell@linaro.org
Headers show
Series hw/arm: New board model mps3-an524 | expand

Message

Peter Maydell Feb. 5, 2021, 4:59 p.m. UTC
This patchseries implements a new board model in the mps2/mps3 family,
based on Application Note AN524:
https://developer.arm.com/documentation/dai0524/latest/

Like the other MPS models, this board is an FPGA image; the AN524
image is based on the SSE-200, like the mps2-an521, but it is
for the MPS3 board rather than the MPS2+. The major differences
are QSPI flash and USB (which we don't model), and support for
2GB of RAM (which we do). Since the MPS3 is very similar to the
MPS2, I've implemented mps3-an524 as a subclass of TYPE_MPS2TZ_MACHINE,
sharing most of the code with mps2-an505 and mps2-an521.

The motivation for this model is two-fold:
 * Linaro's Zephyr team would like it, so they can test their
   code targeting the MPS3 on QEMU
 * It's a useful stepping-stone towards a future MPS family model
   which uses the SSE-300 and Cortex-M55. All the "make various bits
   of mps2-tz.c be driven by per-board data structures rather than
   hardcoding them" changes will be needed for that future board model.
   This way they can be code-reviewed now, rather than making the
   future patchseries even bigger (it will be pretty large even so,
   because of all the "implement SSE-300 model" patches).

This model can run the parts of the AN524 selftest image that
would be expected to work, i.e. the ones that don't rely on things
QEMU doesn't implement. (The selftest is part of the AN524
download so it's behind a EULA click-through and we can't put it
into an acceptance test. We might be able to get something
based on Zephyr or Arm TFM.)

thanks
-- PMM

Peter Maydell (24):
  hw/arm/mps2-tz: Make SYSCLK frequency board-specific
  hw/misc/mps2-scc: Support configurable number of OSCCLK values
  hw/arm/mps2-tz: Correct the OSCCLK settings for mps2-an505 and
    mps2-an511
  hw/arm/mps2-tz: Make the OSCCLK settings be configurable per-board
  hw/misc/mps2-fpgaio: Make number of LEDs configurable by board
  hw/misc/mps2-fpgaio: Support SWITCH register
  hw/arm/mps2-tz: Make FPGAIO switch and LED config per-board
  hw/arm/mps2-tz: Condition IRQ splitting on number of CPUs, not board
    type
  hw/arm/mps2-tz: Make number of IRQs board-specific
  hw/misc/mps2-scc: Implement CFG_REG5 and CFG_REG6 for MPS3 AN524
  hw/arm/mps2-tz: Correct wrong interrupt numbers for DMA and SPI
  hw/arm/mps2-tz: Allow PPCPortInfo structures to specify device
    interrupts
  hw/arm/mps2-tz: Move device IRQ info to data structures
  hw/arm/mps2-tz: Size the uart-irq-orgate based on the number of UARTs
  hw/arm/mps2-tz: Allow boards to have different PPCInfo data
  hw/arm/mps2-tz: Make RAM arrangement board-specific
  hw/arm/mps2-tz: Set MachineClass default_ram info from RAMInfo data
  hw/arm/mps2-tz: Support ROMs as well as RAMs
  hw/arm/mps2-tz: Get armv7m_load_kernel() size argument from RAMInfo
  hw/arm/mps2-tz: Add new mps3-an524 board
  hw/arm/mps2-tz: Stub out USB controller for mps3-an524
  hw/arm/mps2-tz: Provide PL031 RTC on mps3-an524
  docs/system/arm/mps2.rst: Document the new mps3-an524 board
  hw/arm/mps2: Update old infocenter.arm.com URLs

 docs/system/arm/mps2.rst         |  24 +-
 include/hw/arm/armsse.h          |   4 +-
 include/hw/misc/armsse-cpuid.h   |   2 +-
 include/hw/misc/armsse-mhu.h     |   2 +-
 include/hw/misc/iotkit-secctl.h  |   2 +-
 include/hw/misc/iotkit-sysctl.h  |   2 +-
 include/hw/misc/iotkit-sysinfo.h |   2 +-
 include/hw/misc/mps2-fpgaio.h    |   8 +-
 include/hw/misc/mps2-scc.h       |  10 +-
 hw/arm/mps2-tz.c                 | 629 +++++++++++++++++++++++++------
 hw/arm/mps2.c                    |   5 +
 hw/misc/armsse-cpuid.c           |   2 +-
 hw/misc/armsse-mhu.c             |   2 +-
 hw/misc/iotkit-sysctl.c          |   2 +-
 hw/misc/iotkit-sysinfo.c         |   2 +-
 hw/misc/mps2-fpgaio.c            |  43 ++-
 hw/misc/mps2-scc.c               |  93 ++++-
 17 files changed, 677 insertions(+), 157 deletions(-)

-- 
2.20.1

Comments

Philippe Mathieu-Daudé Feb. 5, 2021, 6:05 p.m. UTC | #1
On 2/5/21 5:59 PM, Peter Maydell wrote:
> This patchseries implements a new board model in the mps2/mps3 family,

> based on Application Note AN524:

> https://developer.arm.com/documentation/dai0524/latest/

> 

> Like the other MPS models, this board is an FPGA image; the AN524

> image is based on the SSE-200, like the mps2-an521, but it is

> for the MPS3 board rather than the MPS2+. The major differences

> are QSPI flash and USB (which we don't model), and support for

> 2GB of RAM (which we do). Since the MPS3 is very similar to the

> MPS2, I've implemented mps3-an524 as a subclass of TYPE_MPS2TZ_MACHINE,

> sharing most of the code with mps2-an505 and mps2-an521.

> 

> The motivation for this model is two-fold:

>  * Linaro's Zephyr team would like it, so they can test their

>    code targeting the MPS3 on QEMU

>  * It's a useful stepping-stone towards a future MPS family model

>    which uses the SSE-300 and Cortex-M55. All the "make various bits

>    of mps2-tz.c be driven by per-board data structures rather than

>    hardcoding them" changes will be needed for that future board model.

>    This way they can be code-reviewed now, rather than making the

>    future patchseries even bigger (it will be pretty large even so,

>    because of all the "implement SSE-300 model" patches).

> 

> This model can run the parts of the AN524 selftest image that

> would be expected to work, i.e. the ones that don't rely on things

> QEMU doesn't implement.


Yes selftest are annoying when emulation :) Lot of features important
for real hardware but we can happily bypass when emulation.

> (The selftest is part of the AN524

> download so it's behind a EULA click-through and we can't put it

> into an acceptance test. We might be able to get something

> based on Zephyr or Arm TFM.)


Wondering about that... If anyone can go/click/accepts the EULA and
download artifacts, then I'd like these tests to be committed to the
repository, with a comment containing the download link, and the test
can use the skipUntil(BLOB_PATH && BLOB_HASH) syntax to assert the
binary I downloaded is the same you used for your test. Then I could
run locally:

  $ PATH_TO_EULA_ACCEPTED_ARTIFACTS=~/Private/DL avocado run ...

Would it be acceptable? What is missing or should be fixed?

Thanks,

Phil.
no-reply@patchew.org Feb. 5, 2021, 6:27 p.m. UTC | #2
Patchew URL: https://patchew.org/QEMU/20210205170019.25319-1-peter.maydell@linaro.org/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20210205170019.25319-1-peter.maydell@linaro.org
Subject: [PATCH 00/24] hw/arm: New board model mps3-an524

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 - [tag update]      patchew/20210205091857.845389-1-thuth@redhat.com -> patchew/20210205091857.845389-1-thuth@redhat.com
 * [new tag]         patchew/20210205170019.25319-1-peter.maydell@linaro.org -> patchew/20210205170019.25319-1-peter.maydell@linaro.org
Switched to a new branch 'test'
b6d08c9 hw/arm/mps2: Update old infocenter.arm.com URLs
90c7c16 docs/system/arm/mps2.rst: Document the new mps3-an524 board
5f3bfb9 hw/arm/mps2-tz: Provide PL031 RTC on mps3-an524
2dcefaf hw/arm/mps2-tz: Stub out USB controller for mps3-an524
73d10e6 hw/arm/mps2-tz: Add new mps3-an524 board
d7d9e95 hw/arm/mps2-tz: Get armv7m_load_kernel() size argument from RAMInfo
9b7abe4 hw/arm/mps2-tz: Support ROMs as well as RAMs
7c21327 hw/arm/mps2-tz: Set MachineClass default_ram info from RAMInfo data
95cda0e hw/arm/mps2-tz: Make RAM arrangement board-specific
6b98680 hw/arm/mps2-tz: Allow boards to have different PPCInfo data
59fe34c hw/arm/mps2-tz: Size the uart-irq-orgate based on the number of UARTs
511cc99 hw/arm/mps2-tz: Move device IRQ info to data structures
c158168 hw/arm/mps2-tz: Allow PPCPortInfo structures to specify device interrupts
71a2a99 hw/arm/mps2-tz: Correct wrong interrupt numbers for DMA and SPI
cd14323 hw/misc/mps2-scc: Implement CFG_REG5 and CFG_REG6 for MPS3 AN524
d1e1616 hw/arm/mps2-tz: Make number of IRQs board-specific
ab0223a hw/arm/mps2-tz: Condition IRQ splitting on number of CPUs, not board type
60e6b6f hw/arm/mps2-tz: Make FPGAIO switch and LED config per-board
2f73e0e hw/misc/mps2-fpgaio: Support SWITCH register
f6b999f hw/misc/mps2-fpgaio: Make number of LEDs configurable by board
815ebc8 hw/arm/mps2-tz: Make the OSCCLK settings be configurable per-board
cb75560 hw/arm/mps2-tz: Correct the OSCCLK settings for mps2-an505 and mps2-an511
adb2102 hw/misc/mps2-scc: Support configurable number of OSCCLK values
5ca5a46 hw/arm/mps2-tz: Make SYSCLK frequency board-specific

=== OUTPUT BEGIN ===
1/24 Checking commit 5ca5a46bfa16 (hw/arm/mps2-tz: Make SYSCLK frequency board-specific)
2/24 Checking commit adb210220d27 (hw/misc/mps2-scc: Support configurable number of OSCCLK values)
3/24 Checking commit cb75560589fd (hw/arm/mps2-tz: Correct the OSCCLK settings for mps2-an505 and mps2-an511)
4/24 Checking commit 815ebc852713 (hw/arm/mps2-tz: Make the OSCCLK settings be configurable per-board)
5/24 Checking commit f6b999f1b230 (hw/misc/mps2-fpgaio: Make number of LEDs configurable by board)
6/24 Checking commit 2f73e0e32bbe (hw/misc/mps2-fpgaio: Support SWITCH register)
7/24 Checking commit 60e6b6f41c7e (hw/arm/mps2-tz: Make FPGAIO switch and LED config per-board)
8/24 Checking commit ab0223afa265 (hw/arm/mps2-tz: Condition IRQ splitting on number of CPUs, not board type)
9/24 Checking commit d1e1616e7bff (hw/arm/mps2-tz: Make number of IRQs board-specific)
10/24 Checking commit cd143239e739 (hw/misc/mps2-scc: Implement CFG_REG5 and CFG_REG6 for MPS3 AN524)
11/24 Checking commit 71a2a99734cd (hw/arm/mps2-tz: Correct wrong interrupt numbers for DMA and SPI)
12/24 Checking commit c158168a5a67 (hw/arm/mps2-tz: Allow PPCPortInfo structures to specify device interrupts)
13/24 Checking commit 511cc99a17de (hw/arm/mps2-tz: Move device IRQ info to data structures)
WARNING: line over 80 characters
#115: FILE: hw/arm/mps2-tz.c:557:
+                { "uart0", make_uart, &mms->uart[0], 0x40200000, 0x1000, { 32, 33, 42 } },

WARNING: line over 80 characters
#116: FILE: hw/arm/mps2-tz.c:558:
+                { "uart1", make_uart, &mms->uart[1], 0x40201000, 0x1000, { 34, 35, 43 } },

WARNING: line over 80 characters
#117: FILE: hw/arm/mps2-tz.c:559:
+                { "uart2", make_uart, &mms->uart[2], 0x40202000, 0x1000, { 36, 37, 44 } },

WARNING: line over 80 characters
#118: FILE: hw/arm/mps2-tz.c:560:
+                { "uart3", make_uart, &mms->uart[3], 0x40203000, 0x1000, { 38, 39, 45 } },

WARNING: line over 80 characters
#119: FILE: hw/arm/mps2-tz.c:561:
+                { "uart4", make_uart, &mms->uart[4], 0x40204000, 0x1000, { 40, 41, 46 } },

WARNING: line over 80 characters
#137: FILE: hw/arm/mps2-tz.c:588:
+                { "dma0", make_dma, &mms->dma[0], 0x40110000, 0x1000, { 58, 56, 57 } },

WARNING: line over 80 characters
#138: FILE: hw/arm/mps2-tz.c:589:
+                { "dma1", make_dma, &mms->dma[1], 0x40111000, 0x1000, { 61, 59, 60 } },

WARNING: line over 80 characters
#139: FILE: hw/arm/mps2-tz.c:590:
+                { "dma2", make_dma, &mms->dma[2], 0x40112000, 0x1000, { 64, 62, 63 } },

WARNING: line over 80 characters
#140: FILE: hw/arm/mps2-tz.c:591:
+                { "dma3", make_dma, &mms->dma[3], 0x40113000, 0x1000, { 67, 65, 66 } },

total: 0 errors, 9 warnings, 114 lines checked

Patch 13/24 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
14/24 Checking commit 59fe34c8eb20 (hw/arm/mps2-tz: Size the uart-irq-orgate based on the number of UARTs)
15/24 Checking commit 6b9868049b26 (hw/arm/mps2-tz: Allow boards to have different PPCInfo data)
16/24 Checking commit 95cda0e29a44 (hw/arm/mps2-tz: Make RAM arrangement board-specific)
17/24 Checking commit 7c213275c7a0 (hw/arm/mps2-tz: Set MachineClass default_ram info from RAMInfo data)
18/24 Checking commit 9b7abe476ae0 (hw/arm/mps2-tz: Support ROMs as well as RAMs)
19/24 Checking commit d7d9e95d8e88 (hw/arm/mps2-tz: Get armv7m_load_kernel() size argument from RAMInfo)
20/24 Checking commit 73d10e613f39 (hw/arm/mps2-tz: Add new mps3-an524 board)
WARNING: Block comments use a leading /* on a separate line
#157: FILE: hw/arm/mps2-tz.c:783:
+                { /* port 7 reserved */ },

WARNING: line over 80 characters
#167: FILE: hw/arm/mps2-tz.c:793:
+                { "uart0", make_uart, &mms->uart[0], 0x41303000, 0x1000, { 32, 33, 42 } },

WARNING: line over 80 characters
#168: FILE: hw/arm/mps2-tz.c:794:
+                { "uart1", make_uart, &mms->uart[1], 0x41304000, 0x1000, { 34, 35, 43 } },

WARNING: line over 80 characters
#169: FILE: hw/arm/mps2-tz.c:795:
+                { "uart2", make_uart, &mms->uart[2], 0x41305000, 0x1000, { 36, 37, 44 } },

WARNING: line over 80 characters
#170: FILE: hw/arm/mps2-tz.c:796:
+                { "uart3", make_uart, &mms->uart[3], 0x41306000, 0x1000, { 38, 39, 45 } },

WARNING: line over 80 characters
#171: FILE: hw/arm/mps2-tz.c:797:
+                { "uart4", make_uart, &mms->uart[4], 0x41307000, 0x1000, { 40, 41, 46 } },

ERROR: line over 90 characters
#172: FILE: hw/arm/mps2-tz.c:798:
+                { "uart5", make_uart, &mms->uart[5], 0x41308000, 0x1000, { 124, 125, 126 } },

WARNING: Block comments use a leading /* on a separate line
#174: FILE: hw/arm/mps2-tz.c:800:
+                { /* port 9 reserved */ },

total: 1 errors, 7 warnings, 215 lines checked

Patch 20/24 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

21/24 Checking commit 2dcefaf55c38 (hw/arm/mps2-tz: Stub out USB controller for mps3-an524)
22/24 Checking commit 5f3bfb91617c (hw/arm/mps2-tz: Provide PL031 RTC on mps3-an524)
23/24 Checking commit 90c7c1612bfc (docs/system/arm/mps2.rst: Document the new mps3-an524 board)
24/24 Checking commit b6d08c9d201d (hw/arm/mps2: Update old infocenter.arm.com URLs)
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20210205170019.25319-1-peter.maydell@linaro.org/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Peter Maydell Feb. 5, 2021, 7:20 p.m. UTC | #3
On Fri, 5 Feb 2021 at 18:05, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> On 2/5/21 5:59 PM, Peter Maydell wrote:

> > (The selftest is part of the AN524

> > download so it's behind a EULA click-through and we can't put it

> > into an acceptance test. We might be able to get something

> > based on Zephyr or Arm TFM.)

>

> Wondering about that... If anyone can go/click/accepts the EULA and

> download artifacts, then I'd like these tests to be committed to the

> repository, with a comment containing the download link, and the test

> can use the skipUntil(BLOB_PATH && BLOB_HASH) syntax to assert the

> binary I downloaded is the same you used for your test.


I would rather not get into that. The selftest doesn't actually
exercise as much of the emulation as you might think anyway.

-- PMM
Philippe Mathieu-Daudé Feb. 5, 2021, 7:31 p.m. UTC | #4
On Fri, Feb 5, 2021 at 8:21 PM Peter Maydell <peter.maydell@linaro.org> wrote:
> On Fri, 5 Feb 2021 at 18:05, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:

> > On 2/5/21 5:59 PM, Peter Maydell wrote:

> > > (The selftest is part of the AN524

> > > download so it's behind a EULA click-through and we can't put it

> > > into an acceptance test. We might be able to get something

> > > based on Zephyr or Arm TFM.)

> >

> > Wondering about that... If anyone can go/click/accepts the EULA and

> > download artifacts, then I'd like these tests to be committed to the

> > repository, with a comment containing the download link, and the test

> > can use the skipUntil(BLOB_PATH && BLOB_HASH) syntax to assert the

> > binary I downloaded is the same you used for your test.

>

> I would rather not get into that. The selftest doesn't actually

> exercise as much of the emulation as you might think anyway.


This was clear from the previous paragraph, I was asking about the possibility
to have developers/maintainers individually accept EULA to download artifacts
for integration testing.

>

> -- PMM
Peter Maydell Feb. 5, 2021, 7:34 p.m. UTC | #5
On Fri, 5 Feb 2021 at 19:31, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>

> On Fri, Feb 5, 2021 at 8:21 PM Peter Maydell <peter.maydell@linaro.org> wrote:

> > On Fri, 5 Feb 2021 at 18:05, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:

> > > On 2/5/21 5:59 PM, Peter Maydell wrote:

> > > > (The selftest is part of the AN524

> > > > download so it's behind a EULA click-through and we can't put it

> > > > into an acceptance test. We might be able to get something

> > > > based on Zephyr or Arm TFM.)

> > >

> > > Wondering about that... If anyone can go/click/accepts the EULA and

> > > download artifacts, then I'd like these tests to be committed to the

> > > repository, with a comment containing the download link, and the test

> > > can use the skipUntil(BLOB_PATH && BLOB_HASH) syntax to assert the

> > > binary I downloaded is the same you used for your test.

> >

> > I would rather not get into that. The selftest doesn't actually

> > exercise as much of the emulation as you might think anyway.

>

> This was clear from the previous paragraph, I was asking about the possibility

> to have developers/maintainers individually accept EULA to download artifacts

> for integration testing.


Yes, and that is the thing I would rather we didn't get into.
We should just have suitably redistributable acceptance tests
where we can.

-- PMM
Philippe Mathieu-Daudé Feb. 12, 2021, 6:38 p.m. UTC | #6
On 2/5/21 8:34 PM, Peter Maydell wrote:
> On Fri, 5 Feb 2021 at 19:31, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:

>>

>> On Fri, Feb 5, 2021 at 8:21 PM Peter Maydell <peter.maydell@linaro.org> wrote:

>>> On Fri, 5 Feb 2021 at 18:05, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:

>>>> On 2/5/21 5:59 PM, Peter Maydell wrote:

>>>>> (The selftest is part of the AN524

>>>>> download so it's behind a EULA click-through and we can't put it

>>>>> into an acceptance test. We might be able to get something

>>>>> based on Zephyr or Arm TFM.)

>>>>

>>>> Wondering about that... If anyone can go/click/accepts the EULA and

>>>> download artifacts, then I'd like these tests to be committed to the

>>>> repository, with a comment containing the download link, and the test

>>>> can use the skipUntil(BLOB_PATH && BLOB_HASH) syntax to assert the

>>>> binary I downloaded is the same you used for your test.

>>>

>>> I would rather not get into that. The selftest doesn't actually

>>> exercise as much of the emulation as you might think anyway.

>>

>> This was clear from the previous paragraph, I was asking about the possibility

>> to have developers/maintainers individually accept EULA to download artifacts

>> for integration testing.

> 

> Yes, and that is the thing I would rather we didn't get into.

> We should just have suitably redistributable acceptance tests

> where we can.


OK, understood.