Add Nuvoton NPCM730/NPCM750 SoCs and two BMC machines
v7 cover Add Nuvoton NPCM730/NPCM750 SoCs and two BMC machines
I also pushed this and the previous two patchsets to my qemu fork on github. The branches are named npcm7xx-v[1-7].
https://github.com/hskinnemoen/qemu
This patch series models enough of the Nuvoton NPCM730 and NPCM750 SoCs to boot an OpenBMC image built for quanta-gsj. This includes device models for:
- Global Configuration Registers
- Clock Control
- Timers
- Fuses
- Memory Controller
- Flash Controller
These modules, along with the existing Cortex A9 CPU cores and built-in peripherals, are integrated into a NPCM730 or NPCM750 SoC, which in turn form the foundation for the quanta-gsj and npcm750-evb machines, respectively. The two SoCs are very similar; the only difference is that NPCM730 is missing some peripherals that NPCM750 has, and which are not considered essential for datacenter use (e.g. graphics controllers). For more information, see
https://www.nuvoton.com/products/cloud-computing/ibmc/
Both quanta-gsj and npcm750-evb correspond to real boards supported by OpenBMC. At the end of the series, qemu can boot an OpenBMC image built for one of these boards with some minor modifications.
The patches in this series were developed by Google and reviewed by Nuvoton. We will be maintaining the machine and peripheral support together.
The data sheet for these SoCs is not generally available. Please let me know if more comments are needed to understand the device behavior.
Changes since v6:
- Use size_to_str to report DRAM sizes in npcm7xx_gcr.
- Simplify the interrupt logic in npcm7xx_timer.
- Update global bios_name instead of temporary.
- Add npcm7xx_bootrom to MAINTAINERS and pc-bios/README.
- Use a predefined name for the gsj boot image in the acceptance test.
Changes since v5:
- Boot ROM included, as a git submodule and a binary blob, and loaded by default, so the -bios option is usually not necessary anymore.
- Two acceptance tests added (openbmc image boot, and direct kernel boot).
- npcm7xx_load_kernel() moved to SoC code.
- NPCM7XX_TIMER_REF_HZ definition moved to CLK header.
- Comments added clarifying available SPI flash chip selects.
- Error handling adjustments:
- Errors from CPU and GCR realization are propagated through the SoC since they may be triggered by user-configurable parameters.
- Machine init uses error_fatal instead of error_abort for SoC realization flash init. This makes error messages more helpful.
- Comments added to indicate whether peripherals may fail to realize.
- Use ERRP_GUARD() instead of Error *err when possible.
- Default CPU type is now set, and attempting to set it to anything else will fail.
- Format string fixes (use HWADDR_PRIx, etc.)
- Simplified memory size encoding and error checking in npcm7xx_gcr.
- Encapsulate non-obvious pointer subtraction into helper functions in the FIU and TIMER modules.
- Incorporate review feedback into the FIU module:
- Add select/deselect trace events.
- Use npcm7xx_fiu_{de,}select() consistently.
- Use extract/deposit in more places for consistency.
- Use -Wimplicit-fallthrough compatible fallthrough comments.
- Use qdev_init_gpio_out_named instead of sysbus_init_irq for chip selects.
- Incorporate review feedback into the TIMER module:
- Assert that we never pause a timer that has already expired, instead of trying to handle it. This should be safe since QEMU_CLOCK_VIRTUAL is stopped while this code is running.
- Simplify the switch blocks in the read and write handlers.
I made a change to error out if a flash drive was not specified, but reverted it because it caused make check to fail (qom-test). When specifying a NULL block device, the m25p flash device initializes its in-memory storage with 0xff and doesn't attempt to write anything back. This seems correct to me.
Changes since v4:
- OTP cleanups suggested by Philippe Mathieu-Daudé.
- Added fuse array definitions based on public Nuvoton bootblock code.
- Moved class structure to .c file since it's only used internally.
- Readability improvements.
- Split the first patch and folded parts of it into three other patches so that CONFIG_NPCM7XX is only enabled after the initial NPCM7xx machine support is added.
- DRAM init moved to machine init code.
- Consistently use lower-case hex literals.
- Switched to fine-grained unimplemented devices, based on public bootblock source code. Added a tiny SRAM that got left out previously.
- Simplified error handling in npcm7xx_realize() since the board code will abort anyway, and SoCs are not hot-pluggable.
Changes since v3:
- License headers are now GPL v2-or-later throughout.
- Added vmstate throughout (except the memory controller, which doesn't really have any state worth saving). Successfully booted a gsj image with two stop/savevm/quit/loadvm cycles along the way.
- JFFS2 really doesn't like it if I let qemu keep running after savevm, and then jump back in time with loadvm. I assume this is expected.
- Fixed an error API violation in npcm7xx_realize, removed pointless error check after object_property_set_link().
- Switched the OTP device to use an embedded array instead of a g_malloc0'd one because I couldn't figure out how to set up vmstate for the latter.
Changes since v2:
- Simplified the MAINTAINERS entry.
- Added link to OpenPOWER jenkins for gsj BMC images.
- Reverted the smpboot change, back to byte swapping.
- Adapted to upstream API changes:
- sysbus_init_child_obj -> object_initialize_child
- object_property_set_bool -> qdev_realize / sysbus_realize
- ssi_create_slave_no_init -> qdev_new
- qdev_init_nofail -> qdev_realize_and_unref
- ssi_auto_connect_slaves removed
- Moved Boot ROM loading from soc to machine init.
- Plumbed power-on-straps property from GCR to the machine init code so it can be properly initialized. Turns out npcm750 memory init doesn't work without this. npcm730 is fine either way, though I'm not sure why.
- Reworked the flash init code so it looks more like aspeed (i.e. the flash device gets added even if there's no drive).
Changes since v1 (requested by reviewers):
- Clarify the source of CLK reset values.
- Made smpboot a constant byte array, eliinated byte swapping.
- NPCM7xxState now stores an array of ARMCPUs, not pointers to ARMCPUs.
- Clarify why EL3 is disabled.
- Introduce NPCM7XX_NUM_IRQ constant.
- Set the number of CPUs according to SoC variant, and disallow command line overrides (i.e. you can no longer override the number of CPUs with the -smp parameter). This is trying to follow the spirit of
https://patchwork.kernel.org/patch/11595407/.
- Switch register operations to DEVICE_LITTLE_ENDIAN throughout.
- Machine documentation added (new patch).
Changes since v1 to support flash booting:
- GCR reset value changes to get past memory initialization when booting from flash (patches 2 and 5):
- INTCR2 now indicates that the DDR controller is initialized.
- INTCR3 is initialized according to DDR memory size. A realize() method was implemented to achieve this.
- Refactor the machine initialization a bit to make it easier to drop in machine-specific flash initialization (patch 6).
- Extend the series with additional patches to enable booting from flash:
- Boot ROM (through the -bios option).
- OTP (fuse) controller.
- Memory Controller stub (just enough to skip memory training).
- Flash controller.
- Board-specific flash initialization.
Thanks for reviewing,
Havard
Havard Skinnemoen (13):
hw/misc: Add NPCM7xx System Global Control Registers device model hw/misc: Add NPCM7xx Clock Controller device model hw/timer: Add NPCM7xx Timer device model
hw/arm: Add NPCM730 and NPCM750 SoC models
hw/arm: Add two NPCM7xx-based machines
roms: Add virtual Boot ROM for NPCM7xx SoCs
hw/arm: Load -bios image as a boot ROM for npcm7xx hw/nvram: NPCM7xx OTP device model
hw/mem: Stubbed out NPCM7xx Memory Controller model hw/ssi: NPCM7xx Flash Interface Unit device model hw/arm: Wire up BMC boot flash for npcm750-evb and quanta-gsj docs/system: Add Nuvoton machine documentation tests/acceptance: console boot tests for quanta-gsj
.gitmodules | 3 + MAINTAINERS | 10 + Makefile | 1 + default-configs/arm-softmmu.mak | 1 + docs/system/arm/nuvoton.rst | 90 +++++ docs/system/target-arm.rst | 1 + hw/arm/Kconfig | 9 + hw/arm/Makefile.objs | 1 + hw/arm/npcm7xx.c | 500 +++++++++++++++++++++++ hw/arm/npcm7xx_boards.c | 192 +++++++++ hw/mem/Makefile.objs | 1 + hw/mem/npcm7xx_mc.c | 84 ++++ hw/misc/Makefile.objs | 2 + hw/misc/npcm7xx_clk.c | 234 +++++++++++ hw/misc/npcm7xx_gcr.c | 228 +++++++++++ hw/misc/trace-events | 8 + hw/nvram/Makefile.objs | 1 + hw/nvram/npcm7xx_otp.c | 424 +++++++++++++++++++ hw/ssi/Makefile.objs | 1 + hw/ssi/npcm7xx_fiu.c | 539 +++++++++++++++++++++++++ hw/ssi/trace-events | 11 + hw/timer/Makefile.objs | 1 + hw/timer/npcm7xx_timer.c | 485 ++++++++++++++++++++++ hw/timer/trace-events | 5 + include/hw/arm/npcm7xx.h | 111 +++++ include/hw/mem/npcm7xx_mc.h | 36 ++ include/hw/misc/npcm7xx_clk.h | 72 ++++ include/hw/misc/npcm7xx_gcr.h | 76 ++++ include/hw/nvram/npcm7xx_otp.h | 88 ++++ include/hw/ssi/npcm7xx_fiu.h | 100 +++++ include/hw/timer/npcm7xx_timer.h | 96 +++++ pc-bios/README | 6 + pc-bios/npcm7xx_bootrom.bin | Bin 0 -> 768 bytes roms/Makefile | 7 + roms/vbootrom | 1 + tests/acceptance/boot_linux_console.py | 65 +++ 36 files changed, 3490 insertions(+) create mode 100644 docs/system/arm/nuvoton.rst create mode 100644 hw/arm/npcm7xx.c create mode 100644 hw/arm/npcm7xx_boards.c create mode 100644 hw/mem/npcm7xx_mc.c create mode 100644 hw/misc/npcm7xx_clk.c create mode 100644 hw/misc/npcm7xx_gcr.c create mode 100644 hw/nvram/npcm7xx_otp.c create mode 100644 hw/ssi/npcm7xx_fiu.c create mode 100644 hw/timer/npcm7xx_timer.c create mode 100644 include/hw/arm/npcm7xx.h create mode 100644 include/hw/mem/npcm7xx_mc.h create mode 100644 include/hw/misc/npcm7xx_clk.h create mode 100644 include/hw/misc/npcm7xx_gcr.h create mode 100644 include/hw/nvram/npcm7xx_otp.h create mode 100644 include/hw/ssi/npcm7xx_fiu.h create mode 100644 include/hw/timer/npcm7xx_timer.h create mode 100644 pc-bios/npcm7xx_bootrom.bin create mode 160000 roms/vbootrom
Signature · 1 line
2.28.0.236.gb10cc79966-goog
PATCH v7 1/13 hw/misc: Add NPCM7xx System Global Control Registers device model
Implement a device model for the System Global Control Registers in the NPCM730 and NPCM750 BMC SoCs.
This is primarily used to enable SMP boot (the boot ROM spins reading the SCRPAD register) and DDR memory initialization; other registers are best effort for now.
The reset values of the MDLR and PWRON registers are determined by the SoC variant (730 vs 750) and board straps respectively.
--- MAINTAINERS | 8 ++ hw/arm/Kconfig | 3 + hw/misc/Makefile.objs | 1 + hw/misc/npcm7xx_gcr.c | 228 ++++++++++++++++++++++++++++++++++ hw/misc/trace-events | 4 + include/hw/misc/npcm7xx_gcr.h | 76 ++++++++++++ 6 files changed, 320 insertions(+) create mode 100644 hw/misc/npcm7xx_gcr.c create mode 100644 include/hw/misc/npcm7xx_gcr.h
MAINTAINERS +8 -0
@@ -749,6 +749,14 @@ S: Odd Fixes F: hw/arm/musicpal.c F: docs/system/arm/musicpal.rst +Nuvoton NPCM7xx +M: Havard Skinnemoen <[email protected]> +M: Tyrone Ting <[email protected]> +L: [email protected] +S: Supported +F: hw/*/npcm7xx* +F: include/hw/*/npcm7xx* + nSeries M: Andrzej Zaborowski <[email protected]> M: Peter Maydell <[email protected]>
hw/arm/Kconfig +3 -0
@@ -355,6 +355,9 @@ config XLNX_VERSAL select VIRTIO_MMIO select UNIMP +config NPCM7XX + bool + config FSL_IMX25 bool select IMX
hw/misc/Makefile.objs +1 -0
@@ -51,6 +51,7 @@ common-obj-$(CONFIG_IMX) += imx_rngc.o common-obj-$(CONFIG_MILKYMIST) += milkymist-hpdmc.o common-obj-$(CONFIG_MILKYMIST) += milkymist-pfpu.o common-obj-$(CONFIG_MAINSTONE) += mst_fpga.o +common-obj-$(CONFIG_NPCM7XX) += npcm7xx_gcr.o common-obj-$(CONFIG_OMAP) += omap_clk.o common-obj-$(CONFIG_OMAP) += omap_gpmc.o common-obj-$(CONFIG_OMAP) += omap_l4.o
hw/misc/npcm7xx_gcr.c new file +228 -0
228 lines not on this page · raw message
hw/misc/trace-events +4 -0
@@ -111,6 +111,10 @@ mos6522_set_sr_int(void) "set sr_int" mos6522_write(uint64_t addr, uint64_t val) "reg=0x%"PRIx64 " val=0x%"PRIx64 mos6522_read(uint64_t addr, unsigned val) "reg=0x%"PRIx64 " val=0x%x" +# npcm7xx_gcr.c +npcm7xx_gcr_read(uint64_t offset, uint32_t value) " offset: 0x%04" PRIx64 " value: 0x%08" PRIx32 +npcm7xx_gcr_write(uint64_t offset, uint32_t value) "offset: 0x%04" PRIx64 " value: 0x%08" PRIx32 + # stm32f4xx_syscfg stm32f4xx_syscfg_set_irq(int gpio, int line, int level) "Interupt: GPIO: %d, Line: %d; Level: %d" stm32f4xx_pulse_exti(int irq) "Pulse EXTI: %d"
include/hw/misc/npcm7xx_gcr.h new file +76 -0
76 lines not on this page · raw message
Signature · 1 line
2.28.0.236.gb10cc79966-goog
PATCH v7 2/13 hw/misc: Add NPCM7xx Clock Controller device model
In reply to Havard SkinnemoenEnough functionality to boot the Linux kernel has been implemented. This includes:
- Correct power-on reset values so the various clock rates can be accurately calculated.
- Clock enables stick around when written.
In addition, a best effort attempt to implement SECCNT and CNTR25M was made even though I don't think the kernel needs them.
--- hw/misc/Makefile.objs | 1 + hw/misc/npcm7xx_clk.c | 234 ++++++++++++++++++++++++++++++++++ hw/misc/trace-events | 4 + include/hw/misc/npcm7xx_clk.h | 72 +++++++++++ 4 files changed, 311 insertions(+) create mode 100644 hw/misc/npcm7xx_clk.c create mode 100644 include/hw/misc/npcm7xx_clk.h
hw/misc/Makefile.objs +1 -0
@@ -51,6 +51,7 @@ common-obj-$(CONFIG_IMX) += imx_rngc.o common-obj-$(CONFIG_MILKYMIST) += milkymist-hpdmc.o common-obj-$(CONFIG_MILKYMIST) += milkymist-pfpu.o common-obj-$(CONFIG_MAINSTONE) += mst_fpga.o +common-obj-$(CONFIG_NPCM7XX) += npcm7xx_clk.o common-obj-$(CONFIG_NPCM7XX) += npcm7xx_gcr.o common-obj-$(CONFIG_OMAP) += omap_clk.o common-obj-$(CONFIG_OMAP) += omap_gpmc.o
hw/misc/npcm7xx_clk.c new file +234 -0
234 lines not on this page · raw message
hw/misc/trace-events +4 -0
@@ -111,6 +111,10 @@ mos6522_set_sr_int(void) "set sr_int" mos6522_write(uint64_t addr, uint64_t val) "reg=0x%"PRIx64 " val=0x%"PRIx64 mos6522_read(uint64_t addr, unsigned val) "reg=0x%"PRIx64 " val=0x%x" +# npcm7xx_clk.c +npcm7xx_clk_read(uint64_t offset, uint32_t value) " offset: 0x%04" PRIx64 " value: 0x%08" PRIx32 +npcm7xx_clk_write(uint64_t offset, uint32_t value) "offset: 0x%04" PRIx64 " value: 0x%08" PRIx32 + # npcm7xx_gcr.c npcm7xx_gcr_read(uint64_t offset, uint32_t value) " offset: 0x%04" PRIx64 " value: 0x%08" PRIx32 npcm7xx_gcr_write(uint64_t offset, uint32_t value) "offset: 0x%04" PRIx64 " value: 0x%08" PRIx32
include/hw/misc/npcm7xx_clk.h new file +72 -0
72 lines not on this page · raw message
Signature · 1 line
2.28.0.236.gb10cc79966-goog
Re: [PATCH v7 02/13] hw/misc: Add NPCM7xx Clock Controller device model
Quoted 40 lines · Havard Skinnemoen
Enough functionality to boot the Linux kernel has been implemented. This includes:
- Correct power-on reset values so the various clock rates can be accurately calculated.
- Clock enables stick around when written.In addition, a best effort attempt to implement SECCNT and CNTR25M was made even though I don't think the kernel needs them.
Reviewed-by Tyrone Ting <[email protected]>Reviewed-by Joel Stanley <[email protected]>Reviewed-by Cédric Le Goater <[email protected]>Signed-off-by Havard Skinnemoen <[email protected]>--- hw/misc/Makefile.objs | 1 + hw/misc/npcm7xx_clk.c | 234 ++++++++++++++++++++++++++++++++++ hw/misc/trace-events | 4 + include/hw/misc/npcm7xx_clk.h | 72 +++++++++++ 4 files changed, 311 insertions(+) create mode 100644 hw/misc/npcm7xx_clk.c create mode 100644 include/hw/misc/npcm7xx_clk.hhw/misc/Makefile.objs +1
-0@@ -51,6 +51,7 @@ common-obj-$(CONFIG_IMX) += imx_rngc.o common-obj-$(CONFIG_MILKYMIST) += milkymist-hpdmc.o common-obj-$(CONFIG_MILKYMIST) += milkymist-pfpu.o common-obj-$(CONFIG_MAINSTONE) += mst_fpga.o +common-obj-$(CONFIG_NPCM7XX) += npcm7xx_clk.o common-obj-$(CONFIG_NPCM7XX) += npcm7xx_gcr.o common-obj-$(CONFIG_OMAP) += omap_clk.o common-obj-$(CONFIG_OMAP) += omap_gpmc.ohw/misc/npcm7xx_clk.c new file +0
-0
[...]
Quoted 5 lines
hw/misc/npcm7xx_clk.c new file +5
-0+static void npcm7xx_clk_init (Object *obj) +{ +NPCM7xxCLKState *s =NPCM7XX_CLK (obj); + + memory_region_init_io(&s->iomem, obj, &npcm7xx_clk_ops, s,
hw/misc/npcm7xx_clk.c line 206
Quoted 10 lines
hw/misc/npcm7xx_clk.c new file +10
-0+ TYPE_NPCM7XX_CLK, 4 * KiB); +sysbus_init_mmio (&s->parent, &s->iomem); +} + +static const VMStateDescription vmstate_npcm7xx_clk = { + .name ="npcm7xx-clk" , + .version_id =0 , + .minimum_version_id =0 , + .fields = (VMStateField []) { +VMSTATE_UINT32_ARRAY (regs, NPCM7xxCLKState,NPCM7XX_CLK_NR_REGS ),
I wonder if this won't be a migration problem later if you add more entries to NPCM7xxCLKRegisters...
Quoted 94 lines
hw/misc/npcm7xx_clk.c new file +28
-0+ VMSTATE_INT64(ref_ns, NPCM7xxCLKState), + VMSTATE_END_OF_LIST(), + }, +}; + +static void npcm7xx_clk_class_init (ObjectClass *klass,void *data) +{ +ResettableClass *rc =RESETTABLE_CLASS (klass); +DeviceClass *dc =DEVICE_CLASS (klass); + + dc->desc ="NPCM7xx Clock Control Registers" ; + dc->vmsd = &vmstate_npcm7xx_clk; + rc->phases.enter = npcm7xx_clk_enter_reset; +} + +static const TypeInfo npcm7xx_clk_info = { + .name =TYPE_NPCM7XX_CLK , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (NPCM7xxCLKState), + .instance_init = npcm7xx_clk_init, + .class_init = npcm7xx_clk_class_init, +}; + +static void npcm7xx_clk_register_type (void ) +{ +type_register_static (&npcm7xx_clk_info); +} +type_init (npcm7xx_clk_register_type);hw/misc/trace-events +4
-0@@ -111,6 +111,10 @@ mos6522_set_sr_int(void) "set sr_int" mos6522_write(uint64_t addr, uint64_t val) "reg=0x%"PRIx64 " val=0x%"PRIx64 mos6522_read(uint64_t addr, unsigned val) "reg=0x%"PRIx64 " val=0x%x" +# npcm7xx_clk.c +npcm7xx_clk_read(uint64_t offset, uint32_t value) " offset: 0x%04" PRIx64 " value: 0x%08" PRIx32 +npcm7xx_clk_write(uint64_t offset, uint32_t value) "offset: 0x%04" PRIx64 " value: 0x%08" PRIx32 + # npcm7xx_gcr.c npcm7xx_gcr_read(uint64_t offset, uint32_t value) " offset: 0x%04" PRIx64 " value: 0x%08" PRIx32 npcm7xx_gcr_write(uint64_t offset, uint32_t value) "offset: 0x%04" PRIx64 " value: 0x%08" PRIx32include/hw/misc/npcm7xx_clk.h new file +45
-0@@ -0,0 +1,72 @@ +/* +* Nuvoton NPCM7xx Clock Control Registers. +* +* Copyright 2020 Google LLC +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* for more details. +*/ +#ifndef NPCM7XX_CLK_H +#define NPCM7XX_CLK_H + +#include "exec/memory.h" +#include "hw/sysbus.h" + +/* +* The reference clock frequency for the timer modules, and the SECCNT and +* CNTR25M registers in this module, is always 25 MHz. +*/ +#define NPCM7XX_TIMER_REF_HZ (25000000) + +enum NPCM7xxCLKRegisters { +NPCM7XX_CLK_CLKEN1 , +NPCM7XX_CLK_CLKSEL , +NPCM7XX_CLK_CLKDIV1 , +NPCM7XX_CLK_PLLCON0 , +NPCM7XX_CLK_PLLCON1 , +NPCM7XX_CLK_SWRSTR , +NPCM7XX_CLK_IPSRST1 =0x20 /sizeof (uint32_t ), +NPCM7XX_CLK_IPSRST2 , +NPCM7XX_CLK_CLKEN2 , +NPCM7XX_CLK_CLKDIV2 , +NPCM7XX_CLK_CLKEN3 , +NPCM7XX_CLK_IPSRST3 , +NPCM7XX_CLK_WD0RCR , +NPCM7XX_CLK_WD1RCR , +NPCM7XX_CLK_WD2RCR , +NPCM7XX_CLK_SWRSTC1 , + NPCM7XX_CLK_SWRSTC2,
include/hw/misc/npcm7xx_clk.h line 55
Quoted 10 lines
include/hw/misc/npcm7xx_clk.h new file +10
-0+NPCM7XX_CLK_SWRSTC3 , +NPCM7XX_CLK_SWRSTC4 , +NPCM7XX_CLK_PLLCON2 , +NPCM7XX_CLK_CLKDIV3 , +NPCM7XX_CLK_CORSTC , +NPCM7XX_CLK_PLLCONG , +NPCM7XX_CLK_AHBCKFI , +NPCM7XX_CLK_SECCNT , +NPCM7XX_CLK_CNTR25M , + NPCM7XX_CLK_NR_REGS,
... it might be simpler to define NPCM7XX_CLK_NR_REGS here, and keep NPCM7xxCLKRegisters in the source file, eventually adding something like QEMU_BUILD_BUG_ON(NPCM7XX_CLK_xxx >= NPCM7XX_CLK_NR_REGS).
Quoted 18 lines
include/hw/misc/npcm7xx_clk.h new file +17
-0+}; + +typedef struct NPCM7xxCLKState { +SysBusDevice parent; + +MemoryRegion iomem; + +uint32_t regs[NPCM7XX_CLK_NR_REGS ]; + +/* Time reference for SECCNT and CNTR25M, initialized by power on reset */ +int64_t ref_ns; +}NPCM7xxCLKState ; + +#define TYPE_NPCM7XX_CLK "npcm7xx-clk" +#define NPCM7XX_CLK (obj) OBJECT_CHECK(NPCM7xxCLKState, (obj), TYPE_NPCM7XX_CLK) + +#endif /* NPCM7XX_CLK_H */
PATCH v7 3/13 hw/timer: Add NPCM7xx Timer device model
In reply to Havard SkinnemoenThe NPCM730 and NPCM750 SoCs have three timer modules each holding five timers and some shared registers (e.g. interrupt status).
Each timer runs at 25 MHz divided by a prescaler, and counts down from a configurable initial value to zero. When zero is reached, the interrupt flag for the timer is set, and the timer is disabled (one-shot mode) or reloaded from its initial value (periodic mode).
This implementation is sufficient to boot a Linux kernel configured for NPCM750. Note that the kernel does not seem to actually turn on the interrupts.
--- hw/timer/Makefile.objs | 1 + hw/timer/npcm7xx_timer.c | 485 +++++++++++++++++++++++++++++++ hw/timer/trace-events | 5 + include/hw/timer/npcm7xx_timer.h | 96 ++++++ 4 files changed, 587 insertions(+) create mode 100644 hw/timer/npcm7xx_timer.c create mode 100644 include/hw/timer/npcm7xx_timer.h
hw/timer/Makefile.objs +1 -0
@@ -14,6 +14,7 @@ common-obj-$(CONFIG_IMX) += imx_epit.o common-obj-$(CONFIG_IMX) += imx_gpt.o common-obj-$(CONFIG_LM32) += lm32_timer.o common-obj-$(CONFIG_MILKYMIST) += milkymist-sysctl.o +common-obj-$(CONFIG_NPCM7XX) += npcm7xx_timer.o common-obj-$(CONFIG_NRF51_SOC) += nrf51_timer.o common-obj-$(CONFIG_ALTERA_TIMER) += altera_timer.o
hw/timer/npcm7xx_timer.c new file +485 -0
485 lines not on this page · raw message
hw/timer/trace-events +5 -0
@@ -66,6 +66,11 @@ cmsdk_apb_dualtimer_read(uint64_t offset, uint64_t data, unsigned size) "CMSDK A cmsdk_apb_dualtimer_write(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB dualtimer write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" cmsdk_apb_dualtimer_reset(void) "CMSDK APB dualtimer: reset" +# npcm7xx_timer.c +npcm7xx_timer_read(const char *id, uint64_t offset, uint64_t value) " %s offset: 0x%04" PRIx64 " value 0x%08" PRIx64 +npcm7xx_timer_write(const char *id, uint64_t offset, uint64_t value) "%s offset: 0x%04" PRIx64 " value 0x%08" PRIx64 +npcm7xx_timer_irq(const char *id, int timer, int state) "%s timer %d state %d" + # nrf51_timer.c nrf51_timer_read(uint8_t timer_id, uint64_t addr, uint32_t value, unsigned size) "timer %u read addr 0x%" PRIx64 " data 0x%" PRIx32 " size %u" nrf51_timer_write(uint8_t timer_id, uint64_t addr, uint32_t value, unsigned size) "timer %u write addr 0x%" PRIx64 " data 0x%" PRIx32 " size %u"
include/hw/timer/npcm7xx_timer.h new file +96 -0
96 lines not on this page · raw message
Signature · 1 line
2.28.0.236.gb10cc79966-goog
PATCH v7 4/13 hw/arm: Add NPCM730 and NPCM750 SoC models
In reply to Havard SkinnemoenThe Nuvoton NPCM7xx SoC family are used to implement Baseboard Management Controllers in servers. While the family includes four SoCs, this patch implements limited support for two of them: NPCM730 (targeted for Data Center applications) and NPCM750 (targeted for Enterprise applications).
This patch includes little more than the bare minimum needed to boot a Linux kernel built with NPCM7xx support in direct-kernel mode:
- Two Cortex-A9 CPU cores with built-in periperhals.
- Global Configuration Registers.
- Clock Management.
- 3 Timer Modules with 5 timers each.
- 4 serial ports.
The chips themselves have a lot more features, some of which will be added to the model at a later stage.
--- hw/arm/Kconfig | 5 + hw/arm/Makefile.objs | 1 + hw/arm/npcm7xx.c | 407 +++++++++++++++++++++++++++++++++++++++ include/hw/arm/npcm7xx.h | 85 ++++++++ 4 files changed, 498 insertions(+) create mode 100644 hw/arm/npcm7xx.c create mode 100644 include/hw/arm/npcm7xx.h
hw/arm/Kconfig +5 -0
@@ -357,6 +357,11 @@ config XLNX_VERSAL config NPCM7XX bool + select A9MPCORE + select ARM_GIC + select PL310 # cache controller + select SERIAL + select UNIMP config FSL_IMX25 bool
hw/arm/Makefile.objs +1 -0
@@ -41,6 +41,7 @@ obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o obj-$(CONFIG_STM32F405_SOC) += stm32f405_soc.o obj-$(CONFIG_XLNX_ZYNQMP_ARM) += xlnx-zynqmp.o xlnx-zcu102.o obj-$(CONFIG_XLNX_VERSAL) += xlnx-versal.o xlnx-versal-virt.o +obj-$(CONFIG_NPCM7XX) += npcm7xx.o obj-$(CONFIG_FSL_IMX25) += fsl-imx25.o imx25_pdk.o obj-$(CONFIG_FSL_IMX31) += fsl-imx31.o kzm.o obj-$(CONFIG_FSL_IMX6) += fsl-imx6.o
hw/arm/npcm7xx.c new file +407 -0
407 lines not on this page · raw message
include/hw/arm/npcm7xx.h new file +85 -0
85 lines not on this page · raw message
Signature · 1 line
2.28.0.236.gb10cc79966-goog
PATCH v7 5/13 hw/arm: Add two NPCM7xx-based machines
In reply to Havard SkinnemoenThis adds two new machines, both supported by OpenBMC:
- npcm750-evb: Nuvoton NPCM750 Evaluation Board.
- quanta-gsj: A board with a NPCM730 chip.
They rely on the NPCM7xx SoC device to do the heavy lifting. They are almost completely identical at the moment, apart from the SoC type, which currently only changes the reset contents of one register (GCR.MDLR), but they might grow apart a bit more as more functionality is added.
Both machines can boot the Linux kernel into /bin/sh.
--- default-configs/arm-softmmu.mak | 1 + hw/arm/Makefile.objs | 2 +- hw/arm/npcm7xx_boards.c | 144 ++++++++++++++++++++++++++++++++ include/hw/arm/npcm7xx.h | 19 +++++ 4 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 hw/arm/npcm7xx_boards.c
default-configs/arm-softmmu.mak +1 -0
@@ -27,6 +27,7 @@ CONFIG_GUMSTIX=y CONFIG_SPITZ=y CONFIG_TOSA=y CONFIG_Z2=y +CONFIG_NPCM7XX=y CONFIG_COLLIE=y CONFIG_ASPEED_SOC=y CONFIG_NETDUINO2=y
hw/arm/Makefile.objs +1 -1
@@ -41,7 +41,7 @@ obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o obj-$(CONFIG_STM32F405_SOC) += stm32f405_soc.o obj-$(CONFIG_XLNX_ZYNQMP_ARM) += xlnx-zynqmp.o xlnx-zcu102.o obj-$(CONFIG_XLNX_VERSAL) += xlnx-versal.o xlnx-versal-virt.o -obj-$(CONFIG_NPCM7XX) += npcm7xx.o +obj-$(CONFIG_NPCM7XX) += npcm7xx.o npcm7xx_boards.o obj-$(CONFIG_FSL_IMX25) += fsl-imx25.o imx25_pdk.o obj-$(CONFIG_FSL_IMX31) += fsl-imx31.o kzm.o obj-$(CONFIG_FSL_IMX6) += fsl-imx6.o
hw/arm/npcm7xx_boards.c new file +144 -0
144 lines not on this page · raw message
include/hw/arm/npcm7xx.h +19 -0
@@ -35,6 +35,25 @@#define NPCM7XX_SMP_BOOTREG_ADDR (0xf080013c)/* GCR.SCRPAD */ #define NPCM7XX_GIC_CPU_IF_ADDR (0xf03fe100)/* GIC within A9 */ +typedef struct NPCM7xxMachine { +MachineState parent; +}NPCM7xxMachine ; + +#define TYPE_NPCM7XX_MACHINE MACHINE_TYPE_NAME("npcm7xx") +#define NPCM7XX_MACHINE (obj) \ + OBJECT_CHECK(NPCM7xxMachine, (obj), TYPE_NPCM7XX_MACHINE) + +typedef struct NPCM7xxMachineClass { +MachineClass parent; + +const char *soc_type; +}NPCM7xxMachineClass ; + +#define NPCM7XX_MACHINE_CLASS (klass) \ + OBJECT_CLASS_CHECK(NPCM7xxMachineClass, (klass), TYPE_NPCM7XX_MACHINE) +#define NPCM7XX_MACHINE_GET_CLASS (obj) \ + OBJECT_GET_CLASS(NPCM7xxMachineClass, (obj), TYPE_NPCM7XX_MACHINE) + typedef struct NPCM7xxState { DeviceState parent;
Signature · 1 line
2.28.0.236.gb10cc79966-goog
PATCH v7 6/13 roms: Add virtual Boot ROM for NPCM7xx SoCs
In reply to Havard SkinnemoenThis is a minimalistic boot ROM written specifically for use with QEMU. It supports loading the second-stage loader from SPI flash into RAM, SMP boot, and not much else.
--- .gitmodules | 3 +++ MAINTAINERS | 2 ++ Makefile | 1 + pc-bios/README | 6 ++++++ pc-bios/npcm7xx_bootrom.bin | Bin 0 -> 768 bytes roms/Makefile | 7 +++++++ roms/vbootrom | 1 + 7 files changed, 20 insertions(+) create mode 100644 pc-bios/npcm7xx_bootrom.bin create mode 160000 roms/vbootrom
.gitmodules +3 -0
@@ -58,3 +58,6 @@ [submodule "roms/qboot"] path = roms/qboot url = https://github.com/bonzini/qboot +[submodule "roms/vbootrom"] + path = roms/vbootrom + url = https://github.com/google/vbootrom.git
MAINTAINERS +2 -0
@@ -756,6 +756,8 @@ L: [email protected] S: Supported F: hw/*/npcm7xx* F: include/hw/*/npcm7xx* +F: pc-bios/npcm7xx_bootrom.bin +F: roms/vbootrom nSeries M: Andrzej Zaborowski <[email protected]>
Makefile +1 -0
@@ -839,6 +839,7 @@ s390-ccw.img s390-netboot.img \ slof.bin skiboot.lid \ palcode-clipper \ u-boot.e500 u-boot-sam460-20100605.bin \ +npcm7xx_bootrom.bin \ qemu_vga.ndrv \ edk2-licenses.txt \ hppa-firmware.img \
pc-bios/README +6 -0
@@ -71,3 +71,9 @@ ("Simplified BSD License" or "FreeBSD License", SPDX: BSD-2-Clause). OpenSBI source code also contains code reused from other projects desribed here: https://github.com/riscv/opensbi/blob/master/ThirdPartyNotices.md. + +- npcm7xx_bootrom.bin is a simplified, free (Apache 2.0) boot ROM for Nuvoton + NPCM7xx BMC devices. It currently implements the bare minimum to load, parse, + initialize and run boot images stored in SPI flash, but may grow more + features over time as needed. The source code is available at: + https://github.com/google/vbootrom
pc-bios/npcm7xx_bootrom.bin new file binary +0 -0
roms/Makefile +7 -0
@@ -34,6 +34,7 @@ find-cross-gcc = $(firstword $(wildcard $(patsubst %ld,%gcc,$(call find-cross-ld # finally strip off path + toolname so we get the prefix find-cross-prefix = $(subst gcc,,$(notdir $(call find-cross-gcc,$(1)))) +arm_cross_prefix := $(call find-cross-prefix,arm) powerpc64_cross_prefix := $(call find-cross-prefix,powerpc64) powerpc_cross_prefix := $(call find-cross-prefix,powerpc) x86_64_cross_prefix := $(call find-cross-prefix,x86_64)
@@ -63,6 +64,7 @@ default help: @echo " skiboot -- update skiboot.lid" @echo " u-boot.e500 -- update u-boot.e500" @echo " u-boot.sam460 -- update u-boot.sam460" + @echo " npcm7xx_bootrom -- update vbootrom for npcm7xx" @echo " efi -- update UEFI (edk2) platform firmware" @echo " opensbi32-virt -- update OpenSBI for 32-bit virt machine" @echo " opensbi64-virt -- update OpenSBI for 64-bit virt machine"
@@ -198,6 +200,10 @@ bios-microvm: $(MAKE) -C qboot cp qboot/bios.bin ../pc-bios/bios-microvm.bin +npcm7xx_bootrom: + $(MAKE) -C vbootrom CROSS_COMPILE=$(arm_cross_prefix) + cp vbootrom/npcm7xx_bootrom.bin ../pc-bios/npcm7xx_bootrom.bin + clean: rm -rf seabios/.config seabios/out seabios/builds $(MAKE) -C sgabios clean
@@ -211,3 +217,4 @@ clean: $(MAKE) -f Makefile.edk2 clean $(MAKE) -C opensbi clean $(MAKE) -C qboot clean + $(MAKE) -C vbootrom clean
roms/vbootrom new file +1 -0
@@ -0,0 +1 @@ +Subproject commit 0c37a43527f0ee2b9584e7fb2fdc805e902635ac
Signature · 1 line
2.28.0.236.gb10cc79966-goog
PATCH v7 7/13 hw/arm: Load -bios image as a boot ROM for npcm7xx
In reply to Havard SkinnemoenIf a -bios option is specified on the command line, load the image into the internal ROM memory region, which contains the first instructions run by the CPU after reset.
If -bios is not specified, the vbootrom included with qemu is loaded by default.
--- hw/arm/npcm7xx_boards.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
hw/arm/npcm7xx_boards.c +28 -0
@@ -18,12 +18,38 @@#include "hw/arm/npcm7xx.h" #include "hw/core/cpu.h" +#include "hw/loader.h" #include "qapi/error.h" +#include "qemu-common.h" #include "qemu/units.h" +#include "sysemu/sysemu.h" #define NPCM750_EVB_POWER_ON_STRAPS 0x00001ff7#define QUANTA_GSJ_POWER_ON_STRAPS 0x00001fff +static const char npcm7xx_default_bootrom[] ="npcm7xx_bootrom.bin" ; + +static void npcm7xx_load_bootrom (NPCM7xxState *soc) +{ + g_autofree char *filename = NULL; +int ret; + +if (!bios_name) { + bios_name = npcm7xx_default_bootrom; + } + + filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , bios_name); +if (!filename) { +error_report ("Could not find ROM image '%s'" , bios_name); +exit (1 ); + } + ret =load_image_mr (filename, &soc->irom); +if (ret <0 ) { +error_report ("Failed to load ROM image '%s'" , filename); +exit (1 ); + } +} +static void npcm7xx_connect_dram (NPCM7xxState *soc,MemoryRegion *dram) {memory_region_add_subregion (get_system_memory (),NPCM7XX_DRAM_BA , dram);
@@ -60,6 +86,7 @@ static void npcm750_evb_init(MachineState *machine)npcm7xx_connect_dram (soc, machine->ram);qdev_realize (DEVICE (soc),NULL , &error_fatal); +npcm7xx_load_bootrom (soc);npcm7xx_load_kernel (machine, soc); }
@@ -71,6 +98,7 @@ static void quanta_gsj_init(MachineState *machine)npcm7xx_connect_dram (soc, machine->ram);qdev_realize (DEVICE (soc),NULL , &error_fatal); +npcm7xx_load_bootrom (soc);npcm7xx_load_kernel (machine, soc); }
Signature · 1 line
2.28.0.236.gb10cc79966-goog
Re: [PATCH v7 07/13] hw/arm: Load -bios image as a boot ROM for npcm7xx
Hi Havard,
Quoted 36 lines · Havard Skinnemoen
If a -bios option is specified on the command line, load the image into the internal ROM memory region, which contains the first instructions run by the CPU after reset.
If -bios is not specified, the vbootrom included with qemu is loaded by default.
Reviewed-by Tyrone Ting <[email protected]>Reviewed-by Cédric Le Goater <[email protected]>Signed-off-by Havard Skinnemoen <[email protected]>--- hw/arm/npcm7xx_boards.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)hw/arm/npcm7xx_boards.c +8
-0@@ -18,12 +18,38 @@#include "hw/arm/npcm7xx.h" #include "hw/core/cpu.h" +#include "hw/loader.h" #include "qapi/error.h" +#include "qemu-common.h" #include "qemu/units.h" +#include "sysemu/sysemu.h" #define NPCM750_EVB_POWER_ON_STRAPS 0x00001ff7#define QUANTA_GSJ_POWER_ON_STRAPS 0x00001fff +static const char npcm7xx_default_bootrom[] ="npcm7xx_bootrom.bin" ; + +static void npcm7xx_load_bootrom (NPCM7xxState *soc) +{ + g_autofree char *filename = NULL;
hw/arm/npcm7xx_boards.c line 44
Quoted 10 lines
hw/arm/npcm7xx_boards.c +10
-0+int ret; + +if (!bios_name) { + bios_name = npcm7xx_default_bootrom; + } + + filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , bios_name); +if (!filename) { +error_report ("Could not find ROM image '%s'" , bios_name); +exit (1 );
Is that OK to refuse starting a guest when -kernel is provided but not ROM available?
Quoted 12 lines
hw/arm/npcm7xx_boards.c +8
-0+ } + ret =load_image_mr (filename, &soc->irom); +if (ret <0 ) { +error_report ("Failed to load ROM image '%s'" , filename); +exit (1 ); + } +} +static void npcm7xx_connect_dram (NPCM7xxState *soc,MemoryRegion *dram) {memory_region_add_subregion (get_system_memory (),NPCM7XX_DRAM_BA , dram);
hw/arm/npcm7xx_boards.c static void npcm750_evb_init(MachineState *machine) · line 90
Quoted 5 lines
hw/arm/npcm7xx_boards.c +1
-0@@ -60,6 +86,7 @@ static void npcm750_evb_init(MachineState *machine)npcm7xx_connect_dram (soc, machine->ram);qdev_realize (DEVICE (soc),NULL , &error_fatal); +npcm7xx_load_bootrom (soc);npcm7xx_load_kernel (machine, soc);
Maybe invert here, if no kernel provided, fallback to ROM? Something like:
if (!npcm7xx_load_kernel(machine, soc)) {
npcm7xx_load_bootrom(soc);
}Quoted 11 lines
hw/arm/npcm7xx_boards.c +1
-0}@@ -71,6 +98,7 @@ static void quanta_gsj_init(MachineState *machine)npcm7xx_connect_dram (soc, machine->ram);qdev_realize (DEVICE (soc),NULL , &error_fatal); +npcm7xx_load_bootrom (soc);npcm7xx_load_kernel (machine, soc); }
PATCH v7 8/13 hw/nvram: NPCM7xx OTP device model
In reply to Havard SkinnemoenThis supports reading and writing OTP fuses and keys. Only fuse reading has been tested. Protection is not implemented.
--- hw/arm/npcm7xx.c | 29 +++ hw/nvram/Makefile.objs | 1 + hw/nvram/npcm7xx_otp.c | 424 +++++++++++++++++++++++++++++++++ include/hw/arm/npcm7xx.h | 3 + include/hw/nvram/npcm7xx_otp.h | 88 +++++++ 5 files changed, 545 insertions(+) create mode 100644 hw/nvram/npcm7xx_otp.c create mode 100644 include/hw/nvram/npcm7xx_otp.h
hw/arm/npcm7xx.c +29 -0
@@ -34,6 +34,10 @@#define NPCM7XX_MMIO_BA (0x80000000)#define NPCM7XX_MMIO_SZ (0x7ffd0000) +/* OTP key storage and fuse strap array */ +#define NPCM7XX_OTP1_BA (0xf0189000) +#define NPCM7XX_OTP2_BA (0xf018a000) +/* Core system modules. */ #define NPCM7XX_L2C_BA (0xf03fc000)#define NPCM7XX_CPUP_BA (0xf03fe000)
@@ -144,6 +148,20 @@ void npcm7xx_load_kernel(MachineState *machine, NPCM7xxState *soc)arm_load_kernel (&soc->cpu[0 ], machine, &npcm7xx_binfo); } +static void npcm7xx_init_fuses (NPCM7xxState *s) +{ +NPCM7xxClass *nc =NPCM7XX_GET_CLASS (s); +uint32_t value; + +/* +* The initial mask of disabled modules indicates the chip derivative (e.g. +* NPCM750 or NPCM730). +*/ + value =tswap32 (nc->disabled_modules); +npcm7xx_otp_array_write (&s->fuse_array, &value,NPCM7XX_FUSE_DERIVATIVE , +sizeof (value)); +} +static qemu_irq npcm7xx_irq (NPCM7xxState *s,int n) {return qdev_get_gpio_in (DEVICE (&s->a9mpcore), n);
@@ -164,6 +182,10 @@ static void npcm7xx_init(Object *obj)object_property_add_alias (obj,"power-on-straps" ,OBJECT (&s->gcr),"power-on-straps" );object_initialize_child (obj,"clk" , &s->clk,TYPE_NPCM7XX_CLK ); +object_initialize_child (obj,"otp1" , &s->key_storage, +TYPE_NPCM7XX_KEY_STORAGE ); +object_initialize_child (obj,"otp2" , &s->fuse_array, +TYPE_NPCM7XX_FUSE_ARRAY );for (i =0 ; i <ARRAY_SIZE (s->tim); i++) {object_initialize_child (obj,"tim[*]" , &s->tim[i],TYPE_NPCM7XX_TIMER );
@@ -232,6 +254,13 @@ static void npcm7xx_realize(DeviceState *dev, Error **errp)sysbus_realize (SYS_BUS_DEVICE (&s->clk), &error_abort);sysbus_mmio_map (SYS_BUS_DEVICE (&s->clk),0 ,NPCM7XX_CLK_BA ); +/* OTP key storage and fuse strap array. Cannot fail. */ +sysbus_realize (SYS_BUS_DEVICE (&s->key_storage), &error_abort); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->key_storage),0 ,NPCM7XX_OTP1_BA ); +sysbus_realize (SYS_BUS_DEVICE (&s->fuse_array), &error_abort); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->fuse_array),0 ,NPCM7XX_OTP2_BA ); +npcm7xx_init_fuses (s); +/* Timer Modules (TIM). Cannot fail. */ QEMU_BUILD_BUG_ON (ARRAY_SIZE (npcm7xx_tim_addr) !=ARRAY_SIZE (s->tim));for (i =0 ; i <ARRAY_SIZE (s->tim); i++) {
hw/nvram/Makefile.objs +1 -0
@@ -4,5 +4,6 @@ common-obj-$(CONFIG_AT24C) += eeprom_at24c.o common-obj-y += fw_cfg.o common-obj-$(CONFIG_CHRP_NVRAM) += chrp_nvram.o common-obj-$(CONFIG_MAC_NVRAM) += mac_nvram.o +common-obj-$(CONFIG_NPCM7XX) += npcm7xx_otp.o common-obj-$(CONFIG_NRF51_SOC) += nrf51_nvm.o obj-$(CONFIG_PSERIES) += spapr_nvram.o
hw/nvram/npcm7xx_otp.c new file +424 -0
424 lines not on this page · raw message
include/hw/arm/npcm7xx.h +3 -0
@@ -20,6 +20,7 @@#include "hw/cpu/a9mpcore.h" #include "hw/misc/npcm7xx_clk.h" #include "hw/misc/npcm7xx_gcr.h" +#include "hw/nvram/npcm7xx_otp.h" #include "hw/timer/npcm7xx_timer.h" #include "target/arm/cpu.h"
@@ -68,6 +69,8 @@ typedef struct NPCM7xxState {NPCM7xxGCRState gcr;NPCM7xxCLKState clk;NPCM7xxTimerCtrlState tim[3 ]; +NPCM7xxOTPState key_storage; +NPCM7xxOTPState fuse_array; } NPCM7xxState;#define TYPE_NPCM7XX "npcm7xx"
include/hw/nvram/npcm7xx_otp.h new file +88 -0
88 lines not on this page · raw message
Signature · 1 line
2.28.0.236.gb10cc79966-goog
PATCH v7 9/13 hw/mem: Stubbed out NPCM7xx Memory Controller model
In reply to Havard SkinnemoenThis just implements the bare minimum to cause the boot block to skip memory initialization.
--- hw/arm/npcm7xx.c | 6 +++ hw/mem/Makefile.objs | 1 + hw/mem/npcm7xx_mc.c | 84 +++++++++++++++++++++++++++++++++++++ include/hw/arm/npcm7xx.h | 2 + include/hw/mem/npcm7xx_mc.h | 36 ++++++++++++++++ 5 files changed, 129 insertions(+) create mode 100644 hw/mem/npcm7xx_mc.c create mode 100644 include/hw/mem/npcm7xx_mc.h
hw/arm/npcm7xx.c +6 -0
@@ -43,6 +43,7 @@#define NPCM7XX_CPUP_BA (0xf03fe000)#define NPCM7XX_GCR_BA (0xf0800000)#define NPCM7XX_CLK_BA (0xf0801000) +#define NPCM7XX_MC_BA (0xf0824000)/* Internal AHB SRAM */ #define NPCM7XX_RAM3_BA (0xc0008000)
@@ -186,6 +187,7 @@ static void npcm7xx_init(Object *obj) TYPE_NPCM7XX_KEY_STORAGE);object_initialize_child (obj,"otp2" , &s->fuse_array,TYPE_NPCM7XX_FUSE_ARRAY ); +object_initialize_child (obj,"mc" , &s->mc,TYPE_NPCM7XX_MC );for (i =0 ; i <ARRAY_SIZE (s->tim); i++) {object_initialize_child (obj,"tim[*]" , &s->tim[i],TYPE_NPCM7XX_TIMER );
@@ -261,6 +263,10 @@ static void npcm7xx_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->fuse_array),0 ,NPCM7XX_OTP2_BA );npcm7xx_init_fuses (s); +/* Fake Memory Controller (MC). Cannot fail. */ +sysbus_realize (SYS_BUS_DEVICE (&s->mc), &error_abort); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->mc),0 ,NPCM7XX_MC_BA ); +/* Timer Modules (TIM). Cannot fail. */ QEMU_BUILD_BUG_ON (ARRAY_SIZE (npcm7xx_tim_addr) !=ARRAY_SIZE (s->tim));for (i =0 ; i <ARRAY_SIZE (s->tim); i++) {
hw/mem/Makefile.objs +1 -0
@@ -1,3 +1,4 @@ common-obj-$(CONFIG_DIMM) += pc-dimm.o common-obj-y += memory-device.o +common-obj-$(CONFIG_NPCM7XX) += npcm7xx_mc.o common-obj-$(CONFIG_NVDIMM) += nvdimm.o
hw/mem/npcm7xx_mc.c new file +84 -0
84 lines not on this page · raw message
include/hw/arm/npcm7xx.h +2 -0
@@ -18,6 +18,7 @@#include "hw/boards.h" #include "hw/cpu/a9mpcore.h" +#include "hw/mem/npcm7xx_mc.h" #include "hw/misc/npcm7xx_clk.h" #include "hw/misc/npcm7xx_gcr.h" #include "hw/nvram/npcm7xx_otp.h"
@@ -71,6 +72,7 @@ typedef struct NPCM7xxState {NPCM7xxTimerCtrlState tim[3 ];NPCM7xxOTPState key_storage;NPCM7xxOTPState fuse_array; +NPCM7xxMCState mc; } NPCM7xxState;#define TYPE_NPCM7XX "npcm7xx"
include/hw/mem/npcm7xx_mc.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* Nuvoton NPCM7xx Memory Controller stub +* +* Copyright 2020 Google LLC +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* for more details. +*/ +#ifndef NPCM7XX_MC_H +#define NPCM7XX_MC_H + +#include "exec/memory.h" +#include "hw/sysbus.h" + +/** +* struct NPCM7xxMCState - Device state for the memory controller. +* @parent: System bus device. +* @mmio: Memory region through which registers are accessed. +*/ +typedef struct NPCM7xxMCState { +SysBusDevice parent; + +MemoryRegion mmio; +}NPCM7xxMCState ; + +#define TYPE_NPCM7XX_MC "npcm7xx-mc" +#define NPCM7XX_MC (obj) OBJECT_CHECK(NPCM7xxMCState, (obj), TYPE_NPCM7XX_MC) + +#endif /* NPCM7XX_MC_H */
Signature · 1 line
2.28.0.236.gb10cc79966-goog
PATCH v7 10/13 hw/ssi: NPCM7xx Flash Interface Unit device model
In reply to Havard SkinnemoenThis implements a device model for the NPCM7xx SPI flash controller.
Direct reads and writes, and user-mode transactions have been tested in various modes. Protection features are not implemented yet.
All the FIU instances are available in the SoC's address space, regardless of whether or not they're connected to actual flash chips.
--- hw/arm/Kconfig | 1 + hw/arm/npcm7xx.c | 58 ++++ hw/ssi/Makefile.objs | 1 + hw/ssi/npcm7xx_fiu.c | 539 +++++++++++++++++++++++++++++++++++ hw/ssi/trace-events | 11 + include/hw/arm/npcm7xx.h | 2 + include/hw/ssi/npcm7xx_fiu.h | 100 +++++++ 7 files changed, 712 insertions(+) create mode 100644 hw/ssi/npcm7xx_fiu.c create mode 100644 include/hw/ssi/npcm7xx_fiu.h
hw/arm/Kconfig +1 -0
@@ -361,6 +361,7 @@ config NPCM7XX select ARM_GIC select PL310 # cache controller select SERIAL + select SSI select UNIMP config FSL_IMX25
hw/arm/npcm7xx.c +58 -0
76 lines not on this page · raw message
hw/ssi/Makefile.objs +1 -0
@@ -5,6 +5,7 @@ common-obj-$(CONFIG_XILINX_SPIPS) += xilinx_spips.o common-obj-$(CONFIG_ASPEED_SOC) += aspeed_smc.o common-obj-$(CONFIG_STM32F2XX_SPI) += stm32f2xx_spi.o common-obj-$(CONFIG_MSF2) += mss-spi.o +common-obj-$(CONFIG_NPCM7XX) += npcm7xx_fiu.o common-obj-$(CONFIG_OMAP) += omap_spi.o common-obj-$(CONFIG_IMX) += imx_spi.o
hw/ssi/npcm7xx_fiu.c new file +539 -0
539 lines not on this page · raw message
hw/ssi/trace-events +11 -0
@@ -9,3 +9,14 @@ aspeed_smc_dma_checksum(uint32_t addr, uint32_t data) "0x%08x: 0x%08x" aspeed_smc_dma_rw(const char *dir, uint32_t flash_addr, uint32_t dram_addr, uint32_t size) "%s flash:@0x%08x dram:@0x%08x size:0x%08x" aspeed_smc_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size %u: 0x%" PRIx64 aspeed_smc_flash_select(int cs, const char *prefix) "CS%d %sselect" + +# npcm7xx_fiu.c + +npcm7xx_fiu_enter_reset(const char *id, int reset_type) "%s reset type: %d" +npcm7xx_fiu_hold_reset(const char *id) "%s" +npcm7xx_fiu_select(const char *id, int cs) "%s select CS%d" +npcm7xx_fiu_deselect(const char *id, int cs) "%s deselect CS%d" +npcm7xx_fiu_ctrl_read(const char *id, uint64_t addr, uint32_t data) "%s offset: 0x%04" PRIx64 " value: 0x%08" PRIx32 +npcm7xx_fiu_ctrl_write(const char *id, uint64_t addr, uint32_t data) "%s offset: 0x%04" PRIx64 " value: 0x%08" PRIx32 +npcm7xx_fiu_flash_read(const char *id, int cs, uint64_t addr, unsigned int size, uint64_t value) "%s[%d] offset: 0x%08" PRIx64 " size: %u value: 0x%" PRIx64 +npcm7xx_fiu_flash_write(const char *id, int cs, uint64_t addr, unsigned int size, uint64_t value) "%s[%d] offset: 0x%08" PRIx64 " size: %u value: 0x%" PRIx64
include/hw/arm/npcm7xx.h +2 -0
@@ -23,6 +23,7 @@#include "hw/misc/npcm7xx_gcr.h" #include "hw/nvram/npcm7xx_otp.h" #include "hw/timer/npcm7xx_timer.h" +#include "hw/ssi/npcm7xx_fiu.h" #include "target/arm/cpu.h" #define NPCM7XX_MAX_NUM_CPUS (2)
@@ -73,6 +74,7 @@ typedef struct NPCM7xxState {NPCM7xxOTPState key_storage;NPCM7xxOTPState fuse_array;NPCM7xxMCState mc; +NPCM7xxFIUState fiu[2 ]; } NPCM7xxState;#define TYPE_NPCM7XX "npcm7xx"
include/hw/ssi/npcm7xx_fiu.h new file +100 -0
100 lines not on this page · raw message
Signature · 1 line
2.28.0.236.gb10cc79966-goog
PATCH v7 11/13 hw/arm: Wire up BMC boot flash for npcm750-evb and quanta-gsj
In reply to Havard SkinnemoenThis allows these NPCM7xx-based boards to boot from a flash image, e.g. one built with OpenBMC. For example like this:
IMAGE=${OPENBMC}/build/tmp/deploy/images/gsj/image-bmc
qemu-system-arm -machine quanta-gsj -nographic \
-drive file=${IMAGE},if=mtd,bus=0,unit=0,format=raw,snapshot=on--- hw/arm/npcm7xx_boards.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
hw/arm/npcm7xx_boards.c +20 -0
@@ -19,6 +19,7 @@#include "hw/arm/npcm7xx.h" #include "hw/core/cpu.h" #include "hw/loader.h" +#include "hw/qdev-properties.h" #include "qapi/error.h" #include "qemu-common.h" #include "qemu/units.h"
@@ -50,6 +51,22 @@ static void npcm7xx_load_bootrom(NPCM7xxState *soc) } } +static void npcm7xx_connect_flash (NPCM7xxFIUState *fiu,int cs_no, +const char *flash_type,DriveInfo *dinfo) +{ +DeviceState *flash; +qemu_irq flash_cs; + + flash =qdev_new (flash_type); +if (dinfo) { +qdev_prop_set_drive (flash,"drive" ,blk_by_legacy_dinfo (dinfo)); + } +qdev_realize_and_unref (flash,BUS (fiu->spi), &error_fatal); + + flash_cs =qdev_get_gpio_in_named (flash,SSI_GPIO_CS ,0 ); +qdev_connect_gpio_out_named (DEVICE (fiu),"cs" , cs_no, flash_cs); +} +static void npcm7xx_connect_dram (NPCM7xxState *soc,MemoryRegion *dram) {memory_region_add_subregion (get_system_memory (),NPCM7XX_DRAM_BA , dram);
@@ -87,6 +104,7 @@ static void npcm750_evb_init(MachineState *machine)qdev_realize (DEVICE (soc),NULL , &error_fatal);npcm7xx_load_bootrom (soc); +npcm7xx_connect_flash (&soc->fiu[0 ],0 ,"w25q256" ,drive_get (IF_MTD ,0 ,0 ));npcm7xx_load_kernel (machine, soc); }
@@ -99,6 +117,8 @@ static void quanta_gsj_init(MachineState *machine)qdev_realize (DEVICE (soc),NULL , &error_fatal);npcm7xx_load_bootrom (soc); +npcm7xx_connect_flash (&soc->fiu[0 ],0 ,"mx25l25635e" , +drive_get (IF_MTD ,0 ,0 ));npcm7xx_load_kernel (machine, soc); }
Signature · 1 line
2.28.0.236.gb10cc79966-goog
PATCH v7 12/13 docs/system: Add Nuvoton machine documentation
In reply to Havard Skinnemoen--- docs/system/arm/nuvoton.rst | 90 +++++++++++++++++++++++++++++++++++++ docs/system/target-arm.rst | 1 + 2 files changed, 91 insertions(+) create mode 100644 docs/system/arm/nuvoton.rst
docs/system/arm/nuvoton.rst new file +90 -0
@@ -0,0 +1,90 @@ +Nuvoton iBMC boards (``npcm750-evb``, ``quanta-gsj``) +===================================================== + +The `Nuvoton iBMC`_ chips (NPCM7xx) are a family of ARM-based SoCs that are +designed to be used as Baseboard Management Controllers (BMCs) in various +servers. They all feature one or two ARM Cortex A9 CPU cores, as well as an +assortment of peripherals targeted for either Enterprise or Data Center / +Hyperscale applications. The former is a superset of the latter, so NPCM750 has +all the peripherals of NPCM730 and more. + +.. _Nuvoton iBMC: https://www.nuvoton.com/products/cloud-computing/ibmc/ + +The NPCM750 SoC has two Cortex A9 cores and is targeted for the Enterprise +segment. The following machines are based on this chip : + +- ``npcm750-evb`` Nuvoton NPCM750 Evaluation board + +The NPCM730 SoC has two Cortex A9 cores and is targeted for Data Center and +Hyperscale applications. The following machines are based on this chip : + +- ``quanta-gsj`` Quanta GSJ server BMC + +There are also two more SoCs, NPCM710 and NPCM705, which are single-core +variants of NPCM750 and NPCM730, respectively. These are currently not +supported by QEMU. + +Supported devices +----------------- + + * SMP (Dual Core Cortex-A9) + * Cortex-A9MPCore built-in peripherals: SCU, GIC, Global Timer, Private Timer + and Watchdog. + * SRAM, ROM and DRAM mappings + * System Global Control Registers (GCR) + * Clock and reset controller (CLK) + * Timer controller (TIM) + * Serial ports (16550-based) + * DDR4 memory controller (dummy interface indicating memory training is done) + * OTP controllers (no protection features) + * Flash Interface Unit (FIU; no protection features) + +Missing devices +--------------- + + * GPIO controller + * LPC/eSPI host-to-BMC interface, including + + * Keyboard and mouse controller interface (KBCI) + * Keyboard Controller Style (KCS) channels + * BIOS POST code FIFO + * System Wake-up Control (SWC) + * Shared memory (SHM) + * eSPI slave interface + + * Ethernet controllers (GMAC and EMC) + * USB host (USBH) + * USB device (USBD) + * SMBus controller (SMBF) + * Peripheral SPI controller (PSPI) + * Analog to Digital Converter (ADC) + * SD/MMC host + * Random Number Generator (RNG) + * PECI interface + * Pulse Width Modulation (PWM) + * Tachometer + * PCI and PCIe root complex and bridges + * VDM and MCTP support + * Serial I/O expansion + * LPC/eSPI host + * Coprocessor + * Graphics + * Video capture + * Encoding compression engine + * Security features + +Boot options +------------ + +The Nuvoton machines can boot from an OpenBMC firmware image, or directly into +a kernel using the ``-kernel`` option. OpenBMC images for `quanta-gsj` and +possibly others can be downloaded from the OpenPOWER jenkins : + + https://openpower.xyz/ + +The firmware image should be attached as an MTD drive. Example : + +.. code-block:: bash + + $ qemu-system-arm -machine quanta-gsj -nographic \ + -drive file=image-bmc,if=mtd,bus=0,unit=0,format=raw
docs/system/target-arm.rst +1 -0
@@ -86,6 +86,7 @@ undocumented; you can get a complete list by running arm/musicpal arm/gumstix arm/nseries + arm/nuvoton arm/orangepi arm/palm arm/xscale
Signature · 1 line
2.28.0.236.gb10cc79966-goog
PATCH v7 13/13 tests/acceptance: console boot tests for quanta-gsj
In reply to Havard SkinnemoenThis adds two acceptance tests for the quanta-gsj machine.
One test downloads a lightly patched openbmc flash image from github and verifies that it boots all the way to the login prompt.
The other test downloads a kernel, initrd and dtb built from the same openbmc source and verifies that the kernel detects all CPUs and boots to the point where it can't find the root filesystem (because we have no flash image in this case).
--- tests/acceptance/boot_linux_console.py | 65 ++++++++++++++++++++++++++ 1 file changed, 65 insertions(+)
tests/acceptance/boot_linux_console.py +65 -0
@@ -569,6 +569,71 @@ class BootLinuxConsole(LinuxKernelTest): 'sda') # cubieboard's reboot is not functioning; omit reboot test. + def test_arm_quanta_gsj(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:quanta-gsj + """ + # 25 MiB compressed, 32 MiB uncompressed. + image_url = ( + 'https://github.com/hskinnemoen/openbmc/releases/download/' + '20200711-gsj-qemu-0/obmc-phosphor-image-gsj.static.mtd.gz') + image_hash = '14895e634923345cb5c8776037ff7876df96f6b1' + image_path_gz = self.fetch_asset(image_url, asset_hash=image_hash) + image_name = 'obmc.mtd' + image_path = os.path.join(self.workdir, image_name) + archive.gzip_uncompress(image_path_gz, image_path) + + self.vm.set_console() + drive_args = 'file=' + image_path + ',if=mtd,bus=0,unit=0' + self.vm.add_args('-drive', drive_args) + self.vm.launch() + + self.wait_for_console_pattern('> BootBlock by Nuvoton') + self.wait_for_console_pattern('>Device: Poleg BMC NPCM730') + self.wait_for_console_pattern('>Skip DDR init.') + self.wait_for_console_pattern('U-Boot ') + self.wait_for_console_pattern('Booting Linux on physical CPU 0x0') + self.wait_for_console_pattern('CPU1: thread -1, cpu 1, socket 0') + self.wait_for_console_pattern('OpenBMC Project Reference Distro') + self.wait_for_console_pattern('gsj login:') + + def test_arm_quanta_gsj_initrd(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:quanta-gsj + """ + initrd_url = ( + 'https://github.com/hskinnemoen/openbmc/releases/download/' + '20200711-gsj-qemu-0/obmc-phosphor-initramfs-gsj.cpio.xz') + initrd_hash = '98fefe5d7e56727b1eb17d5c00311b1b5c945300' + initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash) + kernel_url = ( + 'https://github.com/hskinnemoen/openbmc/releases/download/' + '20200711-gsj-qemu-0/uImage-gsj.bin') + kernel_hash = 'fa67b2f141d56d39b3c54305c0e8a899c99eb2c7' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + dtb_url = ( + 'https://github.com/hskinnemoen/openbmc/releases/download/' + '20200711-gsj-qemu-0/nuvoton-npcm730-gsj.dtb') + dtb_hash = '18315f7006d7b688d8312d5c727eecd819aa36a4' + dtb_path = self.fetch_asset(dtb_url, asset_hash=dtb_hash) + + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyS0,115200n8 ' + 'earlycon=uart8250,mmio32,0xf0001000') + self.vm.add_args('-kernel', kernel_path, + '-initrd', initrd_path, + '-dtb', dtb_path, + '-append', kernel_command_line) + self.vm.launch() + + self.wait_for_console_pattern('Booting Linux on physical CPU 0x0') + self.wait_for_console_pattern('CPU1: thread -1, cpu 1, socket 0') + self.wait_for_console_pattern( + 'Give root password for system maintenance') + def test_arm_orangepi(self): """ :avocado: tags=arch:arm
Signature · 1 line
2.28.0.236.gb10cc79966-goog
Re: [PATCH v7 13/13] tests/acceptance: console boot tests for quanta-gsj
Hi Havard,
Quoted 39 lines · Havard Skinnemoen
This adds two acceptance tests for the quanta-gsj machine.
One test downloads a lightly patched openbmc flash image from github and verifies that it boots all the way to the login prompt.
The other test downloads a kernel, initrd and dtb built from the same openbmc source and verifies that the kernel detects all CPUs and boots to the point where it can't find the root filesystem (because we have no flash image in this case).
Reviewed-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Havard Skinnemoen <[email protected]>--- tests/acceptance/boot_linux_console.py | 65 ++++++++++++++++++++++++++ 1 file changed, 65 insertions(+)tests/acceptance/boot_linux_console.py +15
-0@@ -569,6 +569,71 @@ class BootLinuxConsole(LinuxKernelTest): 'sda') # cubieboard's reboot is not functioning; omit reboot test. + def test_arm_quanta_gsj(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:quanta-gsj + """ + # 25 MiB compressed, 32 MiB uncompressed. + image_url = ( + 'https://github.com/hskinnemoen/openbmc/releases/download/' + '20200711-gsj-qemu-0/obmc-phosphor-image-gsj.static.mtd.gz') + image_hash = '14895e634923345cb5c8776037ff7876df96f6b1' + image_path_gz = self.fetch_asset(image_url, asset_hash=image_hash) + image_name = 'obmc.mtd' + image_path = os.path.join(self.workdir, image_name) + archive.gzip_uncompress(image_path_gz, image_path) +
tests/acceptance/boot_linux_console.py class BootLinuxConsole(LinuxKernelTest): · line 596
Quoted 10 lines
tests/acceptance/boot_linux_console.py +10
-0+ self.vm.set_console() + drive_args = 'file=' + image_path + ',if=mtd,bus=0,unit=0' + self.vm.add_args('-drive', drive_args) + self.vm.launch() + + self.wait_for_console_pattern('> BootBlock by Nuvoton') + self.wait_for_console_pattern('>Device: Poleg BMC NPCM730') + self.wait_for_console_pattern('>Skip DDR init.') + self.wait_for_console_pattern('U-Boot ') + self.wait_for_console_pattern('Booting Linux on physical CPU 0x0')
Tests timeout using QEMU configured with '--enable-debug --extra-cflags=-ggdb':
console: Booting Linux on physical CPU 0x0
console: CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
console: stmmaceth f0802000.eth: DMA HW capability register supported
console: stmmaceth f0802000.eth: Normal descriptors
console: stmmaceth f0802000.eth: Ring mode enabled
console: stmmaceth f0802000.eth: device MAC address 92:f6:8f:80:9f:bb
INTERRUPTED: Test interrupted by SIGTERM
Runner error occurred: Timeout reached
(91.05 s)
My guess is unoptimized build makes guest hashing checks over the bitbanged SPI flash emulation takes too long.
Trying with timeout=240s:
console: [* ] (1 of 2) A start job is running for…dplug all Devices
(44s / no limit)
console: [** ] (2 of 2) A start job is running for…Save Random Seed
(44s / 10min 13s)
console: [*** ] (2 of 2) A start job is running for…Save Random Seed
(45s / 10min 13s)
console: [ *** ] (2 of 2) A start job is running for…Save Random Seed (45s / 10min 13s)
console: [ *** ] (1 of 2) A start job is running for…dplug all Devices (46s / no limit)
console: [ ***] (1 of 2) A start job is running for…dplug all Devices
(46s / no limit)
console: [ **] (1 of 2) A start job is running for…dplug all Devices
(47s / no limit)
console: [ *] (2 of 2) A start job is running for…Save Random Seed
(47s / 10min 13s)
console: [ **] (2 of 2) A start job is running for…Save Random Seed
(48s / 10min 13s)
console: [ ***] (2 of 2) A start job is running for…Save Random Seed
(48s / 10min 13s)
console: [ *** ] (1 of 2) A start job is running for…dplug all Devices (49s / no limit)
console: [ *** ] (1 of 2) A start job is running for…dplug all Devices (51s / no limit)
console: [*** ] (1 of 2) A start job is running for…dplug all Devices
(53s / no limit)
console: [** ] (2 of 2) A start job is running for…Save Random Seed
(53s / 10min 13s)
console: [* ] (2 of 2) A start job is running for…Save Random Seed
(54s / 10min 13s)
console: [** ] (2 of 2) A start job is running for…Save Random Seed
(55s / 10min 13s)
console: [*** ] (1 of 2) A start job is running for…dplug all Devices
(56s / no limit)
console: [ *** ] (1 of 2) A start job is running for…dplug all Devices (57s / no limit)
console: [ *** ] (1 of 2) A start job is running for…dplug all Devices (57s / no limit)
Maybe you can disable some expensive services for the test purpose? See examples of cmdline 'systemd.mask=' in test_arm_orangepi_bionic().
Compiled with -O2:
console: [ *** ] A start job is running for Load/Save Random Seed (1s / 9min 45s)
console: [ *** ] A start job is running for Load/Save Random Seed (1s / 9min 45s)
console: [*** ] A start job is running for Load/Save Random Seed (1s /
9min 45s)
console: [** ] A start job is running for Load/Save Random Seed (2s /
9min 45s)
console: [* ] A start job is running for Load/Save Random Seed (2s /
9min 45s)
console: [** ] A start job is running for Load/Save Random Seed (2s /
9min 45s)
...
console: Phosphor OpenBMC (Phosphor OpenBMC Project Reference Distro) 0.1.0 gsj ttyS0
console: gsj login: stmmaceth f0802000.eth eth1: stmmac_open: Cannot attach to PHY (error: -22)
PASS (102.36 s)
It pass but took >90sec.
tests/acceptance/boot_linux_console.py class BootLinuxConsole(LinuxKernelTest): · line 597
Quoted 1 line
tests/acceptance/boot_linux_console.py +1
-0+ self.wait_for_console_pattern('CPU1: thread -1, cpu 1, socket 0')
BTW Cc'ing Cleber/Wainer because there was an Avocado feature request to be able to kick the test timeout watchdog at runtime, so here this console pattern would give the test more time to allow success. Not sure this is implemented or released yet.
Quoted 26 lines
tests/acceptance/boot_linux_console.py +26
-0+ self.wait_for_console_pattern('OpenBMC Project Reference Distro') + self.wait_for_console_pattern('gsj login:') + + def test_arm_quanta_gsj_initrd(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:quanta-gsj + """ + initrd_url = ( + 'https://github.com/hskinnemoen/openbmc/releases/download/' + '20200711-gsj-qemu-0/obmc-phosphor-initramfs-gsj.cpio.xz') + initrd_hash = '98fefe5d7e56727b1eb17d5c00311b1b5c945300' + initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash) + kernel_url = ( + 'https://github.com/hskinnemoen/openbmc/releases/download/' + '20200711-gsj-qemu-0/uImage-gsj.bin') + kernel_hash = 'fa67b2f141d56d39b3c54305c0e8a899c99eb2c7' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + dtb_url = ( + 'https://github.com/hskinnemoen/openbmc/releases/download/' + '20200711-gsj-qemu-0/nuvoton-npcm730-gsj.dtb') + dtb_hash = '18315f7006d7b688d8312d5c727eecd819aa36a4' + dtb_path = self.fetch_asset(dtb_url, asset_hash=dtb_hash) + + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
tests/acceptance/boot_linux_console.py class BootLinuxConsole(LinuxKernelTest): · line 633
Quoted 10 lines
tests/acceptance/boot_linux_console.py +10
-0+ 'console=ttyS0,115200n8 ' + 'earlycon=uart8250,mmio32,0xf0001000') + self.vm.add_args('-kernel', kernel_path, + '-initrd', initrd_path, + '-dtb', dtb_path, + '-append', kernel_command_line) + self.vm.launch() + + self.wait_for_console_pattern('Booting Linux on physical CPU 0x0') + self.wait_for_console_pattern('CPU1: thread -1, cpu 1, socket 0')
Similarly:
console: RPC: Registered named UNIX socket transport module.
console: RPC: Registered udp transport module.
console: RPC: Registered tcp transport module.
console: RPC: Registered tcp NFSv4.1 backchannel transport module.
console: Trying to unpack rootfs image as initramfs...
INTERRUPTED: Test interrupted by SIGTERM
Runner error occurred: Timeout reached
(90.85 s)
Trying with timeout=240s:
console: npcm7xx-ehci: EHCI npcm7xx driver
console: npcm7xx-ehci f0806000.usb: EHCI Host Controller
console: npcm7xx-ehci f0806000.usb: new USB bus registered, assigned bus number 1
console: npcm7xx-ehci f0806000.usb: can't setup: -110
console: npcm7xx-ehci f0806000.usb: USB bus 1 deregistered
console: npcm7xx-ehci f0806000.usb: init fail, -110
console: npcm7xx-ehci: probe of f0806000.usb failed with error -110
console: rcu: INFO: rcu_sched self-detected stall on CPU
console: rcu: 0-....: (2131 ticks this GP) idle=1fe/1/0x40000002
softirq=2485/2487 fqs=105
console: (t=2100 jiffies g=3217 q=8)
console: NMI backtrace for cpu 0
console: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.4.32-7dc9442-dirty-8978043 #1
console: Hardware name: NPCM7XX Chip family
console: Backtrace:
console: [<b0107c4c>] (dump_backtrace) from [<b010823c>] (show_stack+0x20/0x24)
console: r7:00000000 r6:600f0193 r5:00000000 r4:b0b5b1b8
console: [<b010821c>] (show_stack) from [<b077b230>] (dump_stack+0x94/0xa8)
console: [<b077b19c>] (dump_stack) from [<b0782d78>] (nmi_cpu_backtrace+0xc8/0xcc)
console: r7:00000000 r6:00000000 r5:00000000 r4:00000000
console: [<b0782cb0>] (nmi_cpu_backtrace) from [<b0782e0c>] (nmi_trigger_cpumask_backtrace+0x90/0x130)
console: r5:b0b06d58 r4:b0109454
console: [<b0782d7c>] (nmi_trigger_cpumask_backtrace) from [<b010a578>] (arch_trigger_cpumask_backtrace+0x20/0x24)
console: r9:800f0193 r8:b0800948 r7:b0b03e2c r6:b0b03ed0 r5:b0b0e080 r4:00000000
console: [<b010a558>] (arch_trigger_cpumask_backtrace) from [<b0188584>] (rcu_dump_cpu_stacks+0x98/0xdc)
console: [<b01884ec>] (rcu_dump_cpu_stacks) from [<b01869d0>] (print_cpu_stall+0x104/0x19c)
console: r10:b0a78ab8 r9:b0b03e2c r8:b0b03f00 r7:b0b0e080 r6:b0b042b0 r5:00000008
console: r4:b0b02d00 r3:00025cd3
console: [<b01868cc>] (print_cpu_stall) from [<b0186e0c>] (check_cpu_stall+0x138/0x238)
console: r9:00000000 r8:cf08c000 r7:b0b0e080 r6:00025cd3 r5:b0b03ec0 r4:b0b0e080
console: [<b0186cd4>] (check_cpu_stall) from [<b0186f3c>] (rcu_pending+0x30/0xac)
console: r9:00000000 r8:cf08c000 r7:b0b0e080 r6:1f13e000 r5:cfbc1700 r4:b0a83700
console: [<b0186f0c>] (rcu_pending) from [<b0187764>] (rcu_sched_clock_irq+0x174/0x20c)
console: r7:cf0907c0 r6:00000000 r5:b0a83779 r4:b0b5f050
console: [<b01875f0>] (rcu_sched_clock_irq) from [<b018ecf0>] (update_process_times+0x70/0x98)
console: r7:cf0907c0 r6:1f13e000 r5:00000000 r4:cfbbb340
console: [<b018ec80>] (update_process_times) from [<b019f10c>] (tick_periodic+0xc4/0xcc)
console: r7:cf0907c0 r6:cfbc4700 r5:7fffffff r4:b0b02d40
console: [<b019f048>] (tick_periodic) from [<b019f1bc>] (tick_handle_periodic+0x38/0x9c)
console: r5:7fffffff r4:ffffffff
console: [<b019f184>] (tick_handle_periodic) from [<b010af04>] (twd_handler+0x40/0x48)
console: r9:cf0bbde0 r8:cf08c000 r7:cf0907c0 r6:00000010 r5:b0b04504 r4:00000001
console: [<b010aec4>] (twd_handler) from [<b017666c>] (handle_percpu_devid_irq+0x10c/0x278)
console: r5:b0b04504 r4:cf08aa00
console: [<b0176560>] (handle_percpu_devid_irq) from [<b016fd34>] (__handle_domain_irq+0xb8/0xcc)
console: r10:b0a78ab8 r9:cf0bbde0 r8:cf08c000 r7:00000001 r6:00000000 r5:00000000
console: r4:b0a82b88 r3:b0176560
console: [<b016fc7c>] (__handle_domain_irq) from [<b0102234>] (gic_handle_irq+0x6c/0xa0)
console: r9:cf0bbde0 r8:d0803100 r7:d0802100 r6:d080210c r5:b0b37db4 r4:b0b04504
console: [<b01021c8>] (gic_handle_irq) from [<b0101a8c>] (__irq_svc+0x6c/0x90)
console: Exception stack(0xcf0bbde0 to 0xcf0bbe28)
console: bde0: cf1b8e10 b0b4576c 00000002 00000354 00000000 b0b4576c b04b3be8 b0b3dd20
console: be00: b0a00510 b0a53854 b0a78ab8 cf0bbe5c cf0bbe08 cf0bbe30 b04b0c14 b04b3be8
console: be20: a00f0013 ffffffff
console: r9:cf0ba000 r8:b0a00510 r7:cf0bbe14 r6:ffffffff r5:a00f0013 r4:b04b3be8
console: [<b04b0ba4>] (bus_for_each_dev) from [<b04b2748>] (driver_attach+0x2c/0x30)
console: r6:00000000 r5:cb640200 r4:b0b4576c
console: [<b04b271c>] (driver_attach) from [<b04b213c>] (bus_add_driver+0x128/0x214)
console: [<b04b2014>] (bus_add_driver) from [<b04b4940>] (driver_register+0xdc/0x118)
console: r7:00000000 r6:ffffe000 r5:00000000 r4:b0b4576c
console: [<b04b4864>] (driver_register) from [<b04b5c04>] (__platform_driver_register+0x50/0x58)
console: r5:b0a2e408 r4:b0b3dd20
console: [<b04b5bb4>] (__platform_driver_register) from [<b0a2e45c>] (ehci_npcm7xx_init+0x54/0x60)
console: r5:b0a2e408 r4:00000000
console: [<b0a2e408>] (ehci_npcm7xx_init) from [<b0102d80>] (do_one_initcall+0xd0/0x260)
console: r5:b0a2e408 r4:b0b5eb00
console: [<b0102cb0>] (do_one_initcall) from [<b0a01280>] (kernel_init_freeable+0x15c/0x1f4)
console: r7:b09bbb4c r6:b0a53834 r5:b0b72700 r4:00000007
console: [<b0a01124>] (kernel_init_freeable) from [<b0794f8c>] (kernel_init+0x18/0x120)
console: r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:b0794f74
console: r4:00000000
console: [<b0794f74>] (kernel_init) from [<b01010e8>] (ret_from_fork+0x14/0x2c)
console: Exception stack(0xcf0bbfb0 to 0xcf0bbff8)
console: bfa0: 00000000 00000000
00000000 00000000
console: bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
console: bfe0: 00000000 00000000 00000000 00000000 00000013 00000000
console: r5:b0794f74 r4:00000000
...
console: rcu: INFO: rcu_sched self-detected stall on CPU
console: rcu: 1-....: (18 ticks this GP) idle=92e/1/0x40000002
softirq=2723/2723 fqs=111
console: (t=2106 jiffies g=3257 q=1)
console: NMI backtrace for cpu 1
console: CPU: 1 PID: 17 Comm: kworker/1:0 Not tainted 5.4.32-7dc9442-dirty-8978043 #1
console: Hardware name: NPCM7XX Chip family
console: Workqueue: events regulator_init_complete_work_function
console: Backtrace:
console: [<b0107c4c>] (dump_backtrace) from [<b010823c>] (show_stack+0x20/0x24)
console: r7:00000000 r6:600f0193 r5:00000000 r4:b0b5b1b8
console: [<b010821c>] (show_stack) from [<b077b230>] (dump_stack+0x94/0xa8)
console: [<b077b19c>] (dump_stack) from [<b0782d78>] (nmi_cpu_backtrace+0xc8/0xcc)
console: r7:00000000 r6:00000001 r5:00000000 r4:00000001
console: [<b0782cb0>] (nmi_cpu_backtrace) from [<b0782e0c>] (nmi_trigger_cpumask_backtrace+0x90/0x130)
console: r5:b0b06d58 r4:b0109454
console: [<b0782d7c>] (nmi_trigger_cpumask_backtrace) from [<b010a578>] (arch_trigger_cpumask_backtrace+0x20/0x24)
console: r9:800f0193 r8:b0800948 r7:b0b03e2c r6:b0b03ed0 r5:b0b0e080 r4:00000001
console: [<b010a558>] (arch_trigger_cpumask_backtrace) from [<b0188584>] (rcu_dump_cpu_stacks+0x98/0xdc)
console: [<b01884ec>] (rcu_dump_cpu_stacks) from [<b01869d0>] (print_cpu_stall+0x104/0x19c)
console: r10:00000000 r9:b0b03e2c r8:b0b03f00 r7:b0b0e080 r6:b0b042b0 r5:00000001
console: r4:b0b02d00 r3:0002a7f6
console: [<b01868cc>] (print_cpu_stall) from [<b0186e0c>] (check_cpu_stall+0x138/0x238)
console: r9:00000001 r8:cf08c000 r7:b0b0e080 r6:0002a7ef r5:b0b03ec0 r4:b0b0e080
console: [<b0186cd4>] (check_cpu_stall) from [<b0186f3c>] (rcu_pending+0x30/0xac)
console: r9:00000001 r8:cf08c000 r7:b0b0e080 r6:1f150000 r5:cfbd3700 r4:b0a83700
console: [<b0186f0c>] (rcu_pending) from [<b0187764>] (rcu_sched_clock_irq+0x174/0x20c)
console: r7:cf0907c0 r6:00000000 r5:b0a83779 r4:b0b5f050
console: [<b01875f0>] (rcu_sched_clock_irq) from [<b018ecf0>] (update_process_times+0x70/0x98)
console: r7:cf0907c0 r6:1f150000 r5:00000000 r4:cfbcd340
console: [<b018ec80>] (update_process_times) from [<b019f10c>] (tick_periodic+0xc4/0xcc)
console: r7:cf0907c0 r6:cfbd6700 r5:7fffffff r4:ffffffff
console: [<b019f048>] (tick_periodic) from [<b019f1bc>] (tick_handle_periodic+0x38/0x9c)
console: r5:7fffffff r4:ffffffff
console: [<b019f184>] (tick_handle_periodic) from [<b010af04>] (twd_handler+0x40/0x48)
console: r9:cf101eb8 r8:cf08c000 r7:cf0907c0 r6:00000010 r5:b0b04504 r4:00000001
console: [<b010aec4>] (twd_handler) from [<b017666c>] (handle_percpu_devid_irq+0x10c/0x278)
console: r5:b0b04504 r4:cf08aa00
console: [<b0176560>] (handle_percpu_devid_irq) from [<b016fd34>] (__handle_domain_irq+0xb8/0xcc)
console: r10:00000000 r9:cf101eb8 r8:cf08c000 r7:00000001 r6:00000000 r5:00000000
console: r4:b0a82b88 r3:b0176560
console: [<b016fc7c>] (__handle_domain_irq) from [<b0102234>] (gic_handle_irq+0x6c/0xa0)
console: r9:cf101eb8 r8:d0803100 r7:d0802100 r6:d080210c r5:b0b37db4 r4:b0b04504
console: [<b01021c8>] (gic_handle_irq) from [<b0101a8c>] (__irq_svc+0x6c/0x90)
console: Exception stack(0xcf101eb8 to 0xcf101f00)
console: 1ea0:b0b38e5c cf007264
console: 1ec0: b0b54cc4 b046a4ac b0b38e5c cf006600 cfbd2c00 cfbd5f00 00000000 b0b5ec90
console: 1ee0: 00000000 cf101f44 00007374 cf101f08 b0136778 b046a4ac 600f0113 ffffffff
console: r9:cf100000 r8:00000000 r7:cf101eec r6:ffffffff r5:600f0113 r4:b046a4ac
console: [<b0136444>] (process_one_work) from [<b0136c54>] (worker_thread+0x2d0/0x4e4)
console: r10:cfbd2c00 r9:b0b02d00 r8:cf100000 r7:cfbd2c18 r6:cf006614 r5:cfbd2c00
console: r4:cf006600
console: [<b0136984>] (worker_thread) from [<b013c8d0>] (kthread+0x150/0x158)
console: r10:cf0d851c r9:b0136984 r8:cf006600 r7:cf100000 r6:cf0bbd7c r5:cf0d8580
console: r4:cf0d8500
console: [<b013c780>] (kthread) from [<b01010e8>] (ret_from_fork+0x14/0x2c)
console: Exception stack(0xcf101fb0 to 0xcf101ff8)
console: 1fa0: 00000000 00000000
00000000 00000000
console: 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
console: 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000
console: r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:b013c780
console: r4:cf0d8580 r3:00000001
console: Run /init as init process
console: rcu: INFO: rcu_sched self-detected stall on CPU
console: rcu: 1-....: (2120 ticks this GP) idle=ab2/1/0x40000002
softirq=3079/3079 fqs=78
console: (t=2107 jiffies g=3741 q=0)
console: NMI backtrace for cpu 1
console: CPU: 1 PID: 138 Comm: mount Not tainted 5.4.32-7dc9442-dirty-8978043 #1
console: Hardware name: NPCM7XX Chip family
console: Backtrace:
console: [<b0107c4c>] (dump_backtrace) from [<b010823c>] (show_stack+0x20/0x24)
console: r7:00000000 r6:600d0193 r5:00000000 r4:b0b5b1b8
console: [<b010821c>] (show_stack) from [<b077b230>] (dump_stack+0x94/0xa8)
console: [<b077b19c>] (dump_stack) from [<b0782d78>] (nmi_cpu_backtrace+0xc8/0xcc)
console: r7:00000000 r6:00000001 r5:00000000 r4:00000001
console: [<b0782cb0>] (nmi_cpu_backtrace) from [<b0782e0c>] (nmi_trigger_cpumask_backtrace+0x90/0x130)
console: r5:b0b06d58 r4:b0109454
console: [<b0782d7c>] (nmi_trigger_cpumask_backtrace) from [<b010a578>] (arch_trigger_cpumask_backtrace+0x20/0x24)
console: r9:800d0193 r8:b0800948 r7:b0b03e2c r6:b0b03ed0 r5:b0b0e080 r4:00000001
console: [<b010a558>] (arch_trigger_cpumask_backtrace) from [<b0188584>] (rcu_dump_cpu_stacks+0x98/0xdc)
console: [<b01884ec>] (rcu_dump_cpu_stacks) from [<b01869d0>] (print_cpu_stall+0x104/0x19c)
console: r10:00000015 r9:b0b03e2c r8:b0b03f00 r7:b0b0e080 r6:b0b042b0 r5:00000000
console: r4:b0b02d00 r3:0003301a
console: [<b01868cc>] (print_cpu_stall) from [<b0186e0c>] (check_cpu_stall+0x138/0x238)
console: r9:00000001 r8:cf08c000 r7:b0b0e080 r6:00033011 r5:b0b03ec0 r4:b0b0e080
console: [<b0186cd4>] (check_cpu_stall) from [<b0186f3c>] (rcu_pending+0x30/0xac)
console: r9:00000001 r8:cf08c000 r7:b0b0e080 r6:1f150000 r5:cfbd3700 r4:b0a83700
console: [<b0186f0c>] (rcu_pending) from [<b0187764>] (rcu_sched_clock_irq+0x174/0x20c)
console: r7:cf0907c0 r6:00000000 r5:b0a83779 r4:b0b5f050
console: [<b01875f0>] (rcu_sched_clock_irq) from [<b018ecf0>] (update_process_times+0x70/0x98)
console: r7:cf0907c0 r6:1f150000 r5:00000000 r4:cfbcd340
console: [<b018ec80>] (update_process_times) from [<b019f10c>] (tick_periodic+0xc4/0xcc)
console: r7:cf0907c0 r6:cfbd6700 r5:7fffffff r4:ffffffff
console: [<b019f048>] (tick_periodic) from [<b019f1bc>] (tick_handle_periodic+0x38/0x9c)
console: r5:7fffffff r4:ffffffff
console: [<b019f184>] (tick_handle_periodic) from [<b010af04>] (twd_handler+0x40/0x48)
console: r9:cb7c7ed0 r8:cf08c000 r7:cf0907c0 r6:00000010 r5:b0b04504 r4:00000001
console: [<b010aec4>] (twd_handler) from [<b017666c>] (handle_percpu_devid_irq+0x10c/0x278)
console: r5:b0b04504 r4:cf08aa00
console: [<b0176560>] (handle_percpu_devid_irq) from [<b016fd34>] (__handle_domain_irq+0xb8/0xcc)
console: r10:00000015 r9:cb7c7ed0 r8:cf08c000 r7:00000001 r6:00000000 r5:00000000
console: r4:b0a82b88 r3:b0176560
console: [<b016fc7c>] (__handle_domain_irq) from [<b0102234>] (gic_handle_irq+0x6c/0xa0)
console: r9:cb7c7ed0 r8:d0803100 r7:d0802100 r6:d080210c r5:b0b37db4 r4:b0b04504
console: [<b01021c8>] (gic_handle_irq) from [<b0101a8c>] (__irq_svc+0x6c/0x90)
console: Exception stack(0xcb7c7ed0 to 0xcb7c7f18)
console: 7ec0: 00000000 aeffffff
00000000 00000055
console: 7ee0: 0000021c cb7c6000 cb7c0de4 000b21a0 00008004 cb7c6000 00000015 cb7c7f3c
console: 7f00: 00000051 cb7c7f20 b0278a5c b0278a60 000d0013 ffffffff
console: r9:cb7c6000 r8:00008004 r7:cb7c7f04 r6:ffffffff r5:000d0013 r4:b0278a60
console: [<b02789dc>] (exact_copy_from_user) from [<b027dc60>] (copy_mount_options+0x58/0xa0)
console: r7:aea22fa9 r6:cb7c0000 r5:000b11a0 r4:00001000
console: [<b027dc08>] (copy_mount_options) from [<b027e538>] (ksys_mount+0x74/0xc4)
console: r7:aea22fa9 r6:cb77db00 r5:00008004 r4:cb77d240
console: [<b027e4c4>] (ksys_mount) from [<b027e5ac>] (sys_mount+0x24/0x2c)
console: r8:b0101204 r7:00000015 r6:000974dc r5:00008004 r4:000b11a0
console: [<b027e588>] (sys_mount) from [<b0101000>] (ret_fast_syscall+0x0/0x54)
console: Exception stack(0xcb7c7fa8 to 0xcb7c7ff0)
console: 7fa0: 000b11a0 00008004 aea22fa3 aea22fa9aea22fb0 00008004
console: 7fc0: 000b11a0 00008004 000974dc 00000015 000b11a0 00000000 00000000 000af65c
console: 7fe0: 000af4e0 aea22bb8 0004f3e0 49fe8330
INTERRUPTED: Test interrupted by SIGTERM
Runner error occurred: Timeout reached
(240.45 s)
Is that expected?
Compiled with -O2 it works much better:
console: Give root password for system maintenance PASS (11.71 s)
Quoted 7 lines
tests/acceptance/boot_linux_console.py +3
-0+ self.wait_for_console_pattern( + 'Give root password for system maintenance') + def test_arm_orangepi(self): """ :avocado: tags=arch:arm
Re: [PATCH v7 13/13] tests/acceptance: console boot tests for quanta-gsj
Quoted 68 lines · Philippe Mathieu-Daudé
Hi Havard,
Quoted 39 lines · Havard Skinnemoen
This adds two acceptance tests for the quanta-gsj machine.
One test downloads a lightly patched openbmc flash image from github and verifies that it boots all the way to the login prompt.
The other test downloads a kernel, initrd and dtb built from the same openbmc source and verifies that the kernel detects all CPUs and boots to the point where it can't find the root filesystem (because we have no flash image in this case).
Reviewed-by Philippe Mathieu-Daudé <[email protected]>Signed-off-by Havard Skinnemoen <[email protected]>--- tests/acceptance/boot_linux_console.py | 65 ++++++++++++++++++++++++++ 1 file changed, 65 insertions(+)tests/acceptance/boot_linux_console.py +15
-0@@ -569,6 +569,71 @@ class BootLinuxConsole(LinuxKernelTest): 'sda') # cubieboard's reboot is not functioning; omit reboot test. + def test_arm_quanta_gsj(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:quanta-gsj + """ + # 25 MiB compressed, 32 MiB uncompressed. + image_url = ( + 'https://github.com/hskinnemoen/openbmc/releases/download/' + '20200711-gsj-qemu-0/obmc-phosphor-image-gsj.static.mtd.gz') + image_hash = '14895e634923345cb5c8776037ff7876df96f6b1' + image_path_gz = self.fetch_asset(image_url, asset_hash=image_hash) + image_name = 'obmc.mtd' + image_path = os.path.join(self.workdir, image_name) + archive.gzip_uncompress(image_path_gz, image_path) +tests/acceptance/boot_linux_console.py class BootLinuxConsole(LinuxKernelTest): · line 596
Quoted 10 lines
tests/acceptance/boot_linux_console.py +10
-0+ self.vm.set_console() + drive_args = 'file=' + image_path + ',if=mtd,bus=0,unit=0' + self.vm.add_args('-drive', drive_args) + self.vm.launch() + + self.wait_for_console_pattern('> BootBlock by Nuvoton') + self.wait_for_console_pattern('>Device: Poleg BMC NPCM730') + self.wait_for_console_pattern('>Skip DDR init.') + self.wait_for_console_pattern('U-Boot ') + self.wait_for_console_pattern('Booting Linux on physical CPU 0x0')Tests timeout using QEMU configured with '--enable-debug --extra-cflags=-ggdb':
console: Booting Linux on physical CPU
0x0
console: CPU1: thread -1, cpu 1, socket 0, mpidr 80000001console: stmmaceth f0802000.eth: DMA HW capability register supported
console: stmmaceth f0802000.eth: Normal descriptors
console: stmmaceth f0802000.eth: Ring mode enabled
console: stmmaceth f0802000.eth: device MAC address 92:f6:8f:80:9f:bb
INTERRUPTED: Test interrupted by SIGTERM
Runner error occurred: Timeout reached
(91.05 s)
Quoted 2 lines
My guess is unoptimized build makes guest hashing checks over the bitbanged SPI flash emulation takes too long.
Right, flash access is super slow when optimization is turned off.
Quoted 41 lines
Trying with timeout=240s:
console: [* ] (1 of 2) A start job is running for…dplug all Devices
(44s / no limit)
console: [** ] (2 of 2) A start job is running for…Save Random Seed
(44s / 10min 13s)
console: [*** ] (2 of 2) A start job is running for…Save Random Seed
(45s / 10min 13s)
console: [ *** ] (2 of 2) A start job is running for…Save Random Seed (45s / 10min 13s)
console: [ *** ] (1 of 2) A start job is running for…dplug all Devices (46s / no limit)
console: [ ***] (1 of 2) A start job is running for…dplug all Devices
(46s / no limit)
console: [ **] (1 of 2) A start job is running for…dplug all Devices
(47s / no limit)
console: [ *] (2 of 2) A start job is running for…Save Random Seed
(47s / 10min 13s)
console: [ **] (2 of 2) A start job is running for…Save Random Seed
(48s / 10min 13s)
console: [ ***] (2 of 2) A start job is running for…Save Random Seed
(48s / 10min 13s)
console: [ *** ] (1 of 2) A start job is running for…dplug all Devices (49s / no limit)
console: [ *** ] (1 of 2) A start job is running for…dplug all Devices (51s / no limit)
console: [*** ] (1 of 2) A start job is running for…dplug all Devices
(53s / no limit)
console: [** ] (2 of 2) A start job is running for…Save Random Seed
(53s / 10min 13s)
console: [* ] (2 of 2) A start job is running for…Save Random Seed
(54s / 10min 13s)
console: [** ] (2 of 2) A start job is running for…Save Random Seed
(55s / 10min 13s)
console: [*** ] (1 of 2) A start job is running for…dplug all Devices
(56s / no limit)
console: [ *** ] (1 of 2) A start job is running for…dplug all Devices (57s / no limit)
console: [ *** ] (1 of 2) A start job is running for…dplug all Devices (57s / no limit)
Quoted 2 lines
Maybe you can disable some expensive services for the test purpose? See examples of cmdline 'systemd.mask=' in
test_arm_orangepi_bionic().
I'll try that, thanks!
Quoted 394 lines
Compiled with -O2:
console: [ *** ] A start job is running for Load/Save Random Seed (1s / 9min 45s)
console: [ *** ] A start job is running for Load/Save Random Seed (1s / 9min 45s)
console: [*** ] A start job is running for Load/Save Random Seed (1s /
9min 45s)
console: [** ] A start job is running for Load/Save Random Seed (2s /
9min 45s)
console: [* ] A start job is running for Load/Save Random Seed (2s /
9min 45s)
console: [** ] A start job is running for Load/Save Random Seed (2s /
9min 45s)
...
console: Phosphor OpenBMC (Phosphor OpenBMC Project Reference Distro) 0.1.0 gsj ttyS0
console: gsj login: stmmaceth f0802000.eth eth1:stmmac_open: Cannot attach to PHY (error: -22)
PASS (102.36 s)It pass but took >90sec.
tests/acceptance/boot_linux_console.py class BootLinuxConsole(LinuxKernelTest): · line 597
Quoted 1 line
tests/acceptance/boot_linux_console.py +1
-0+ self.wait_for_console_pattern('CPU1: thread -1, cpu 1, socket 0')BTW Cc'ing Cleber/Wainer because there was an Avocado feature request to be able to kick the test timeout watchdog at runtime, so here this console pattern would give the test more time to allow success. Not sure this is implemented or released yet.
Quoted 26 lines
tests/acceptance/boot_linux_console.py +26
-0+ self.wait_for_console_pattern('OpenBMC Project Reference Distro') + self.wait_for_console_pattern('gsj login:') + + def test_arm_quanta_gsj_initrd(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:quanta-gsj + """ + initrd_url = ( + 'https://github.com/hskinnemoen/openbmc/releases/download/' + '20200711-gsj-qemu-0/obmc-phosphor-initramfs-gsj.cpio.xz') + initrd_hash = '98fefe5d7e56727b1eb17d5c00311b1b5c945300' + initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash) + kernel_url = ( + 'https://github.com/hskinnemoen/openbmc/releases/download/' + '20200711-gsj-qemu-0/uImage-gsj.bin') + kernel_hash = 'fa67b2f141d56d39b3c54305c0e8a899c99eb2c7' + kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + dtb_url = ( + 'https://github.com/hskinnemoen/openbmc/releases/download/' + '20200711-gsj-qemu-0/nuvoton-npcm730-gsj.dtb') + dtb_hash = '18315f7006d7b688d8312d5c727eecd819aa36a4' + dtb_path = self.fetch_asset(dtb_url, asset_hash=dtb_hash) + + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +tests/acceptance/boot_linux_console.py class BootLinuxConsole(LinuxKernelTest): · line 633
Quoted 10 lines
tests/acceptance/boot_linux_console.py +10
-0+ 'console=ttyS0,115200n8 ' + 'earlycon=uart8250,mmio32,0xf0001000') + self.vm.add_args('-kernel', kernel_path, + '-initrd', initrd_path, + '-dtb', dtb_path, + '-append', kernel_command_line) + self.vm.launch() + + self.wait_for_console_pattern('Booting Linux on physical CPU 0x0') + self.wait_for_console_pattern('CPU1: thread -1, cpu 1, socket 0')Similarly:
console: RPC: Registered named UNIX socket transport module.
console: RPC: Registered udp transport module.
console: RPC: Registered tcp transport module.
console: RPC: Registered tcp NFSv4.1 backchannel transport module.
console: Trying to unpack rootfs image as initramfs...
INTERRUPTED: Test interrupted by SIGTERM
Runner error occurred: Timeout reached
(90.85 s)Trying with timeout=240s:
console: npcm7xx-ehci: EHCI npcm7xx driver
console: npcm7xx-ehci f0806000.usb: EHCI Host Controller
console: npcm7xx-ehci f0806000.usb: new USB bus registered, assigned bus number 1
console: npcm7xx-ehci f0806000.usb: can't setup: -110
console: npcm7xx-ehci f0806000.usb: USB bus 1 deregistered
console: npcm7xx-ehci f0806000.usb: init fail, -110
console: npcm7xx-ehci: probe of f0806000.usb failed with error -110
console: rcu: INFO:rcu_schedself-detected stall on CPU
console: rcu: 0-....: (2131 ticks this GP) idle=1fe/1/0x40000002
softirq=2485/2487 fqs=105
console: (t=2100 jiffies g=3217 q=8)
console: NMI backtrace for cpu 0
console: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.4.32-7dc9442-dirty-8978043 #1
console: Hardware name: NPCM7XX Chip family
console: Backtrace:
console: [<b0107c4c>] (dump_backtrace) from [<b010823c>] (show_stack+0x20/0x24)
console: r7:00000000 r6:600f0193 r5:00000000 r4:b0b5b1b8
console: [<b010821c>] (show_stack) from [<b077b230>] (dump_stack+0x94/0xa8)
console: [<b077b19c>] (dump_stack) from [<b0782d78>] (nmi_cpu_backtrace+0xc8/0xcc)
console: r7:00000000 r6:00000000 r5:00000000 r4:00000000
console: [<b0782cb0>] (nmi_cpu_backtrace) from [<b0782e0c>] (nmi_trigger_cpumask_backtrace+0x90/0x130)
console: r5:b0b06d58 r4:b0109454
console: [<b0782d7c>] (nmi_trigger_cpumask_backtrace) from [<b010a578>] (arch_trigger_cpumask_backtrace+0x20/0x24)
console: r9:800f0193 r8:b0800948 r7:b0b03e2c r6:b0b03ed0 r5:b0b0e080 r4:00000000
console: [<b010a558>] (arch_trigger_cpumask_backtrace) from [<b0188584>] (rcu_dump_cpu_stacks+0x98/0xdc)
console: [<b01884ec>] (rcu_dump_cpu_stacks) from [<b01869d0>] (print_cpu_stall+0x104/0x19c)
console: r10:b0a78ab8 r9:b0b03e2c r8:b0b03f00 r7:b0b0e080 r6:b0b042b0 r5:00000008
console: r4:b0b02d00 r3:00025cd3
console: [<b01868cc>] (print_cpu_stall) from [<b0186e0c>] (check_cpu_stall+0x138/0x238)
console: r9:00000000 r8:cf08c000 r7:b0b0e080 r6:00025cd3 r5:b0b03ec0 r4:b0b0e080
console: [<b0186cd4>] (check_cpu_stall) from [<b0186f3c>] (rcu_pending+0x30/0xac)
console: r9:00000000 r8:cf08c000 r7:b0b0e080 r6:1f13e000 r5:cfbc1700 r4:b0a83700
console: [<b0186f0c>] (rcu_pending) from [<b0187764>] (rcu_sched_clock_irq+0x174/0x20c)
console: r7:cf0907c0 r6:00000000 r5:b0a83779 r4:b0b5f050
console: [<b01875f0>] (rcu_sched_clock_irq) from [<b018ecf0>] (update_process_times+0x70/0x98)
console: r7:cf0907c0 r6:1f13e000 r5:00000000 r4:cfbbb340
console: [<b018ec80>] (update_process_times) from [<b019f10c>] (tick_periodic+0xc4/0xcc)
console: r7:cf0907c0 r6:cfbc4700 r5:7fffffff r4:b0b02d40
console: [<b019f048>] (tick_periodic) from [<b019f1bc>] (tick_handle_periodic+0x38/0x9c)
console: r5:7fffffff r4:ffffffff
console: [<b019f184>] (tick_handle_periodic) from [<b010af04>] (twd_handler+0x40/0x48)
console: r9:cf0bbde0 r8:cf08c000 r7:cf0907c0 r6:00000010 r5:b0b04504 r4:00000001
console: [<b010aec4>] (twd_handler) from [<b017666c>] (handle_percpu_devid_irq+0x10c/0x278)
console: r5:b0b04504 r4:cf08aa00
console: [<b0176560>] (handle_percpu_devid_irq) from [<b016fd34>] (__handle_domain_irq+0xb8/0xcc)
console: r10:b0a78ab8 r9:cf0bbde0 r8:cf08c000 r7:00000001 r6:00000000 r5:00000000
console: r4:b0a82b88 r3:b0176560
console: [<b016fc7c>] (__handle_domain_irq) from [<b0102234>] (gic_handle_irq+0x6c/0xa0)
console: r9:cf0bbde0 r8:d0803100 r7:d0802100 r6:d080210c r5:b0b37db4 r4:b0b04504
console: [<b01021c8>] (gic_handle_irq) from [<b0101a8c>] (__irq_svc+0x6c/0x90)
console: Exception stack(0xcf0bbde0 to0xcf0bbe28)
console: bde0:cf1b8e10b0b4576c00000002 00000354 00000000b0b4576cb04b3be8b0b3dd20
console: be00:b0a00510b0a53854b0a78ab8cf0bbe5ccf0bbe08cf0bbe30b04b0c14b04b3be8
console: be20:a00f0013ffffffff
console: r9:cf0ba000 r8:b0a00510 r7:cf0bbe14 r6:ffffffff r5:a00f0013 r4:b04b3be8
console: [<b04b0ba4>] (bus_for_each_dev) from [<b04b2748>] (driver_attach+0x2c/0x30)
console: r6:00000000 r5:cb640200 r4:b0b4576c
console: [<b04b271c>] (driver_attach) from [<b04b213c>] (bus_add_driver+0x128/0x214)
console: [<b04b2014>] (bus_add_driver) from [<b04b4940>] (driver_register+0xdc/0x118)
console: r7:00000000 r6:ffffe000 r5:00000000 r4:b0b4576c
console: [<b04b4864>] (driver_register) from [<b04b5c04>] (__platform_driver_register+0x50/0x58)
console: r5:b0a2e408 r4:b0b3dd20
console: [<b04b5bb4>] (__platform_driver_register) from [<b0a2e45c>] (ehci_npcm7xx_init+0x54/0x60)
console: r5:b0a2e408 r4:00000000
console: [<b0a2e408>] (ehci_npcm7xx_init) from [<b0102d80>] (do_one_initcall+0xd0/0x260)
console: r5:b0a2e408 r4:b0b5eb00
console: [<b0102cb0>] (do_one_initcall) from [<b0a01280>] (kernel_init_freeable+0x15c/0x1f4)
console: r7:b09bbb4c r6:b0a53834 r5:b0b72700 r4:00000007
console: [<b0a01124>] (kernel_init_freeable) from [<b0794f8c>] (kernel_init+0x18/0x120)
console: r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:b0794f74
console: r4:00000000
console: [<b0794f74>] (kernel_init) from [<b01010e8>] (ret_from_fork+0x14/0x2c)
console: Exception stack(0xcf0bbfb0 to0xcf0bbff8)
console: bfa0: 00000000 00000000
00000000 00000000
console: bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
console: bfe0: 00000000 00000000 00000000 00000000 00000013 00000000
console: r5:b0794f74 r4:00000000
...
console: rcu: INFO:rcu_schedself-detected stall on CPU
console: rcu: 1-....: (18 ticks this GP) idle=92e/1/0x40000002
softirq=2723/2723 fqs=111
console: (t=2106 jiffies g=3257 q=1)
console: NMI backtrace for cpu 1
console: CPU: 1 PID: 17 Comm: kworker/1:0 Not tainted 5.4.32-7dc9442-dirty-8978043 #1
console: Hardware name: NPCM7XX Chip family
console: Workqueue: eventsregulator_init_complete_work_function
console: Backtrace:
console: [<b0107c4c>] (dump_backtrace) from [<b010823c>] (show_stack+0x20/0x24)
console: r7:00000000 r6:600f0193 r5:00000000 r4:b0b5b1b8
console: [<b010821c>] (show_stack) from [<b077b230>] (dump_stack+0x94/0xa8)
console: [<b077b19c>] (dump_stack) from [<b0782d78>] (nmi_cpu_backtrace+0xc8/0xcc)
console: r7:00000000 r6:00000001 r5:00000000 r4:00000001
console: [<b0782cb0>] (nmi_cpu_backtrace) from [<b0782e0c>] (nmi_trigger_cpumask_backtrace+0x90/0x130)
console: r5:b0b06d58 r4:b0109454
console: [<b0782d7c>] (nmi_trigger_cpumask_backtrace) from [<b010a578>] (arch_trigger_cpumask_backtrace+0x20/0x24)
console: r9:800f0193 r8:b0800948 r7:b0b03e2c r6:b0b03ed0 r5:b0b0e080 r4:00000001
console: [<b010a558>] (arch_trigger_cpumask_backtrace) from [<b0188584>] (rcu_dump_cpu_stacks+0x98/0xdc)
console: [<b01884ec>] (rcu_dump_cpu_stacks) from [<b01869d0>] (print_cpu_stall+0x104/0x19c)
console: r10:00000000 r9:b0b03e2c r8:b0b03f00 r7:b0b0e080 r6:b0b042b0 r5:00000001
console: r4:b0b02d00 r3:0002a7f6
console: [<b01868cc>] (print_cpu_stall) from [<b0186e0c>] (check_cpu_stall+0x138/0x238)
console: r9:00000001 r8:cf08c000 r7:b0b0e080 r6:0002a7ef r5:b0b03ec0 r4:b0b0e080
console: [<b0186cd4>] (check_cpu_stall) from [<b0186f3c>] (rcu_pending+0x30/0xac)
console: r9:00000001 r8:cf08c000 r7:b0b0e080 r6:1f150000 r5:cfbd3700 r4:b0a83700
console: [<b0186f0c>] (rcu_pending) from [<b0187764>] (rcu_sched_clock_irq+0x174/0x20c)
console: r7:cf0907c0 r6:00000000 r5:b0a83779 r4:b0b5f050
console: [<b01875f0>] (rcu_sched_clock_irq) from [<b018ecf0>] (update_process_times+0x70/0x98)
console: r7:cf0907c0 r6:1f150000 r5:00000000 r4:cfbcd340
console: [<b018ec80>] (update_process_times) from [<b019f10c>] (tick_periodic+0xc4/0xcc)
console: r7:cf0907c0 r6:cfbd6700 r5:7fffffff r4:ffffffff
console: [<b019f048>] (tick_periodic) from [<b019f1bc>] (tick_handle_periodic+0x38/0x9c)
console: r5:7fffffff r4:ffffffff
console: [<b019f184>] (tick_handle_periodic) from [<b010af04>] (twd_handler+0x40/0x48)
console: r9:cf101eb8 r8:cf08c000 r7:cf0907c0 r6:00000010 r5:b0b04504 r4:00000001
console: [<b010aec4>] (twd_handler) from [<b017666c>] (handle_percpu_devid_irq+0x10c/0x278)
console: r5:b0b04504 r4:cf08aa00
console: [<b0176560>] (handle_percpu_devid_irq) from [<b016fd34>] (__handle_domain_irq+0xb8/0xcc)
console: r10:00000000 r9:cf101eb8 r8:cf08c000 r7:00000001 r6:00000000 r5:00000000
console: r4:b0a82b88 r3:b0176560
console: [<b016fc7c>] (__handle_domain_irq) from [<b0102234>] (gic_handle_irq+0x6c/0xa0)
console: r9:cf101eb8 r8:d0803100 r7:d0802100 r6:d080210c r5:b0b37db4 r4:b0b04504
console: [<b01021c8>] (gic_handle_irq) from [<b0101a8c>] (__irq_svc+0x6c/0x90)
console: Exception stack(0xcf101eb8 to0xcf101f00)
console: 1ea0:b0b38e5ccf007264
console: 1ec0:b0b54cc4b046a4acb0b38e5ccf006600cfbd2c00cfbd5f0000000000b0b5ec90
console: 1ee0: 00000000cf101f4400007374cf101f08b0136778b046a4ac600f0113ffffffff
console: r9:cf100000 r8:00000000 r7:cf101eec r6:ffffffff r5:600f0113 r4:b046a4ac
console: [<b0136444>] (process_one_work) from [<b0136c54>] (worker_thread+0x2d0/0x4e4)
console: r10:cfbd2c00 r9:b0b02d00 r8:cf100000 r7:cfbd2c18 r6:cf006614 r5:cfbd2c00
console: r4:cf006600
console: [<b0136984>] (worker_thread) from [<b013c8d0>] (kthread+0x150/0x158)
console: r10:cf0d851c r9:b0136984 r8:cf006600 r7:cf100000 r6:cf0bbd7c r5:cf0d8580
console: r4:cf0d8500
console: [<b013c780>] (kthread) from [<b01010e8>] (ret_from_fork+0x14/0x2c)
console: Exception stack(0xcf101fb0 to0xcf101ff8)
console: 1fa0: 00000000 00000000
00000000 00000000
console: 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
console: 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000
console: r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:b013c780
console: r4:cf0d8580 r3:00000001
console: Run /init as init process
console: rcu: INFO:rcu_schedself-detected stall on CPU
console: rcu: 1-....: (2120 ticks this GP) idle=ab2/1/0x40000002
softirq=3079/3079 fqs=78
console: (t=2107 jiffies g=3741 q=0)
console: NMI backtrace for cpu 1
console: CPU: 1 PID: 138 Comm: mount Not tainted 5.4.32-7dc9442-dirty-8978043 #1
console: Hardware name: NPCM7XX Chip family
console: Backtrace:
console: [<b0107c4c>] (dump_backtrace) from [<b010823c>] (show_stack+0x20/0x24)
console: r7:00000000 r6:600d0193 r5:00000000 r4:b0b5b1b8
console: [<b010821c>] (show_stack) from [<b077b230>] (dump_stack+0x94/0xa8)
console: [<b077b19c>] (dump_stack) from [<b0782d78>] (nmi_cpu_backtrace+0xc8/0xcc)
console: r7:00000000 r6:00000001 r5:00000000 r4:00000001
console: [<b0782cb0>] (nmi_cpu_backtrace) from [<b0782e0c>] (nmi_trigger_cpumask_backtrace+0x90/0x130)
console: r5:b0b06d58 r4:b0109454
console: [<b0782d7c>] (nmi_trigger_cpumask_backtrace) from [<b010a578>] (arch_trigger_cpumask_backtrace+0x20/0x24)
console: r9:800d0193 r8:b0800948 r7:b0b03e2c r6:b0b03ed0 r5:b0b0e080 r4:00000001
console: [<b010a558>] (arch_trigger_cpumask_backtrace) from [<b0188584>] (rcu_dump_cpu_stacks+0x98/0xdc)
console: [<b01884ec>] (rcu_dump_cpu_stacks) from [<b01869d0>] (print_cpu_stall+0x104/0x19c)
console: r10:00000015 r9:b0b03e2c r8:b0b03f00 r7:b0b0e080 r6:b0b042b0 r5:00000000
console: r4:b0b02d00 r3:0003301a
console: [<b01868cc>] (print_cpu_stall) from [<b0186e0c>] (check_cpu_stall+0x138/0x238)
console: r9:00000001 r8:cf08c000 r7:b0b0e080 r6:00033011 r5:b0b03ec0 r4:b0b0e080
console: [<b0186cd4>] (check_cpu_stall) from [<b0186f3c>] (rcu_pending+0x30/0xac)
console: r9:00000001 r8:cf08c000 r7:b0b0e080 r6:1f150000 r5:cfbd3700 r4:b0a83700
console: [<b0186f0c>] (rcu_pending) from [<b0187764>] (rcu_sched_clock_irq+0x174/0x20c)
console: r7:cf0907c0 r6:00000000 r5:b0a83779 r4:b0b5f050
console: [<b01875f0>] (rcu_sched_clock_irq) from [<b018ecf0>] (update_process_times+0x70/0x98)
console: r7:cf0907c0 r6:1f150000 r5:00000000 r4:cfbcd340
console: [<b018ec80>] (update_process_times) from [<b019f10c>] (tick_periodic+0xc4/0xcc)
console: r7:cf0907c0 r6:cfbd6700 r5:7fffffff r4:ffffffff
console: [<b019f048>] (tick_periodic) from [<b019f1bc>] (tick_handle_periodic+0x38/0x9c)
console: r5:7fffffff r4:ffffffff
console: [<b019f184>] (tick_handle_periodic) from [<b010af04>] (twd_handler+0x40/0x48)
console: r9:cb7c7ed0 r8:cf08c000 r7:cf0907c0 r6:00000010 r5:b0b04504 r4:00000001
console: [<b010aec4>] (twd_handler) from [<b017666c>] (handle_percpu_devid_irq+0x10c/0x278)
console: r5:b0b04504 r4:cf08aa00
console: [<b0176560>] (handle_percpu_devid_irq) from [<b016fd34>] (__handle_domain_irq+0xb8/0xcc)
console: r10:00000015 r9:cb7c7ed0 r8:cf08c000 r7:00000001 r6:00000000 r5:00000000
console: r4:b0a82b88 r3:b0176560
console: [<b016fc7c>] (__handle_domain_irq) from [<b0102234>] (gic_handle_irq+0x6c/0xa0)
console: r9:cb7c7ed0 r8:d0803100 r7:d0802100 r6:d080210c r5:b0b37db4 r4:b0b04504
console: [<b01021c8>] (gic_handle_irq) from [<b0101a8c>] (__irq_svc+0x6c/0x90)
console: Exception stack(0xcb7c7ed0 to0xcb7c7f18)
console: 7ec0: 00000000 aeffffff
00000000 00000055
console: 7ee0:0000021ccb7c6000cb7c0de4000b21a000008004cb7c600000000015cb7c7f3c
console: 7f00: 00000051cb7c7f20b0278a5cb0278a60000d0013ffffffff
console: r9:cb7c6000 r8:00008004 r7:cb7c7f04 r6:ffffffff r5:000d0013 r4:b0278a60
console: [<b02789dc>] (exact_copy_from_user) from [<b027dc60>] (copy_mount_options+0x58/0xa0)
console: r7:aea22fa9 r6:cb7c0000 r5:000b11a0 r4:00001000
console: [<b027dc08>] (copy_mount_options) from [<b027e538>] (ksys_mount+0x74/0xc4)
console: r7:aea22fa9 r6:cb77db00 r5:00008004 r4:cb77d240
console: [<b027e4c4>] (ksys_mount) from [<b027e5ac>] (sys_mount+0x24/0x2c)
console: r8:b0101204 r7:00000015 r6:000974dc r5:00008004 r4:000b11a0
console: [<b027e588>] (sys_mount) from [<b0101000>] (ret_fast_syscall+0x0/0x54)
console: Exception stack(0xcb7c7fa8 to0xcb7c7ff0)
console: 7fa0:000b11a000008004aea22fa3aea22fa9aea22fb000008004
console: 7fc0:000b11a000008004000974dc00000015000b11a000000000 00000000000af65c
console: 7fe0:000af4e0aea22bb80004f3e049fe8330
INTERRUPTED: Test interrupted by SIGTERM
Runner error occurred: Timeout reached
(240.45 s)
Quoted 1 line
Is that expected?
I'm not sure why it only happens when running direct kernel boot with unoptimized qemu, but it seems a little happier if I enable a few more peripherals that I have queued up (sd, ehci, ohci and rng), though not enough.
It still stalls for an awfully long time on "console: Run /init as init process" though. I'm not sure what it's doing there. With -O2 it only takes a couple of seconds to move on.
Adding set -x to the top of /init give me this:
https://gist.github.com/hskinnemoen/d48982b791dd8389e41468c9a3fbffbe
The blkid invocations seem to take a lot of time (e.g. there was an NMI backtrace while running blkid /dev/mtdblock6). Perhaps it takes especially long when there's no valid filesystem in the flash?
Quoted 13 lines
Compiled with -O2 it works much better:
console: Give root password for system maintenance PASS (11.71 s)
Quoted 7 lines
tests/acceptance/boot_linux_console.py +3
-0+ self.wait_for_console_pattern( + 'Give root password for system maintenance') + def test_arm_orangepi(self): """ :avocado: tags=arch:arm
Re: [PATCH v7 13/13] tests/acceptance: console boot tests for quanta-gsj
Quoted 8 lines · Havard Skinnemoen
Quoted 5 lines · Philippe Mathieu-Daudé
INTERRUPTED: Test interrupted by SIGTERM
Runner error occurred: Timeout reached
(240.45 s)Is that expected?
Quoted 8 lines
I'm not sure why it only happens when running direct kernel boot with unoptimized qemu, but it seems a little happier if I enable a few more peripherals that I have queued up (sd, ehci, ohci and rng), though not enough.
It still stalls for an awfully long time on "console: Run /init as init process" though. I'm not sure what it's doing there. With -O2 it only takes a couple of seconds to move on.
So it turns out that the kernel gets _really_ sluggish when skipping the clock initialization normally done by the boot loader.
I changed the reset value of CLKSEL like this:
hw/misc/npcm7xx_clk.c +1 -1
@@ -67,7 +67,7 @@ enum NPCM7xxCLKRegisters {*/ static const uint32_t cold_reset_values[NPCM7XX_CLK_NR_REGS ] = { [NPCM7XX_CLK_CLKEN1 ] =0xffffffff , - [NPCM7XX_CLK_CLKSEL ] =0x004aaaaa , + [NPCM7XX_CLK_CLKSEL ] =0x004aaba9 , [NPCM7XX_CLK_CLKDIV1 ] =0x5413f855 , [NPCM7XX_CLK_PLLCON0 ] =0x00222101 |PLLCON_LOKI , [NPCM7XX_CLK_PLLCON1 ] =0x00202101 |PLLCON_LOKI ,
which switches the CPU core and UART to run from PLL2 instead of CLKREF (25 MHz).
With this change, the test passes without optimization:
(02/19) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_quanta_gsj_initrd:
PASS (39.62 s)
It doesn't look like this change hurts booting from the bootrom (IIUC the nuvoton bootblock overwrites CLKSEL anyway), but it's not super clean.
Perhaps I should make it conditional on kernel_filename being set? Or would it be better to provide a write_board_setup hook for this?
Re: [PATCH v7 13/13] tests/acceptance: console boot tests for quanta-gsj
+Eric / Richard for compiler optimizations.
Quoted 46 lines · Havard Skinnemoen
Quoted 8 lines · Havard Skinnemoen
Quoted 5 lines · Philippe Mathieu-Daudé
INTERRUPTED: Test interrupted by SIGTERM
Runner error occurred: Timeout reached
(240.45 s)Is that expected?
Quoted 8 lines
I'm not sure why it only happens when running direct kernel boot with unoptimized qemu, but it seems a little happier if I enable a few more peripherals that I have queued up (sd, ehci, ohci and rng), though not enough.
It still stalls for an awfully long time on "console: Run /init as init process" though. I'm not sure what it's doing there. With -O2 it only takes a couple of seconds to move on.
So it turns out that the kernel gets _really_ sluggish when skipping the clock initialization normally done by the boot loader.
I changed the reset value of CLKSEL like this:
hw/misc/npcm7xx_clk.c +1
-1@@ -67,7 +67,7 @@ enum NPCM7xxCLKRegisters {*/ static const uint32_t cold_reset_values[NPCM7XX_CLK_NR_REGS ] = { [NPCM7XX_CLK_CLKEN1 ] =0xffffffff , - [NPCM7XX_CLK_CLKSEL ] =0x004aaaaa , + [NPCM7XX_CLK_CLKSEL ] =0x004aaba9 , [NPCM7XX_CLK_CLKDIV1 ] =0x5413f855 , [NPCM7XX_CLK_PLLCON0 ] =0x00222101 |PLLCON_LOKI , [NPCM7XX_CLK_PLLCON1 ] =0x00202101 |PLLCON_LOKI ,which switches the CPU core and UART to run from PLL2 instead of CLKREF (25 MHz).
With this change, the test passes without optimization:
(02/19) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_quanta_gsj_initrd:
PASS (39.62 s)
Quoted 6 lines
It doesn't look like this change hurts booting from the bootrom (IIUC the nuvoton bootblock overwrites CLKSEL anyway), but it's not super clean.
Perhaps I should make it conditional on
kernel_filenamebeing set? Or would it be better to provide awrite_board_setuphook for this?
QEMU prefers to avoid ifdef'ry at all cost. However I find this approach acceptable (anyway up to the maintainer):
+static void npcm7xx_clk_cold_reset_fixup(NPCM7xxCLKState *s) +{
+#ifndef __OPTIMIZE__
+ /*
+ * When built without optimization, ... + * so run CPU core and UART from PLL2 instead of CLKREF. + */
+ s->regs[NPCM7XX_CLK_CLKSEL] |= 0x103,
+#endif
+}
static void npcm7xx_clk_enter_reset(Object *obj, ResetType type)
{
NPCM7xxCLKState *s = NPCM7XX_CLK(obj);
QEMU_BUILD_BUG_ON(sizeof(s->regs) != sizeof(cold_reset_values));
switch (type) {
case RESET_TYPE_COLD:
memcpy(s->regs, cold_reset_values, sizeof(cold_reset_values));
+ npcm7xx_clk_cold_reset_fixup(s);
s->ref_ns = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
return;
}
...Regards,
Phil.
Re: [PATCH v7 13/13] tests/acceptance: console boot tests for quanta-gsj
Quoted 24 lines · Philippe Mathieu-Daudé
+Eric / Richard for compiler optimizations.
Quoted 21 lines · Havard Skinnemoen
Quoted 8 lines · Havard Skinnemoen
Quoted 5 lines · Philippe Mathieu-Daudé
INTERRUPTED: Test interrupted by SIGTERM
Runner error occurred: Timeout reached
(240.45 s)Is that expected?
Quoted 8 lines
I'm not sure why it only happens when running direct kernel boot with unoptimized qemu, but it seems a little happier if I enable a few more peripherals that I have queued up (sd, ehci, ohci and rng), though not enough.
It still stalls for an awfully long time on "console: Run /init as init process" though. I'm not sure what it's doing there. With -O2 it only takes a couple of seconds to move on.
So it turns out that the kernel gets _really_ sluggish when skipping the clock initialization normally done by the boot loader.
Hmm IIRC other boards are affected (raspi and orange-pi).
Maybe it is time to define some static inlined boolean function in "qemu/compiler.h", maybe qemu_build_optimized()? Or not inlined function but simply expand to true/false:
/**
* qemu_build_not_reached()
*
* The compiler, during optimization, is expected to prove that a call
* to this function cannot be reached and remove it. If the compiler
* supports QEMU_ERROR, this will be reported at compile time; o therwise
* this will be reported at link time due to the missing symbol. */
#if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
extern void QEMU_NORETURN QEMU_ERROR("code path is reachable")
qemu_build_not_reached(void);
#else
#define qemu_build_not_reached() g_assert_not_reached() #endif
+
+#if defined(__OPTIMIZE__)
+#define qemu_build_optimized() true
+#else
+#define qemu_build_optimized() false
+#endif
Quoted 65 lines
Quoted 25 lines
I changed the reset value of CLKSEL like this:
hw/misc/npcm7xx_clk.c +1
-1@@ -67,7 +67,7 @@ enum NPCM7xxCLKRegisters {*/ static const uint32_t cold_reset_values[NPCM7XX_CLK_NR_REGS ] = { [NPCM7XX_CLK_CLKEN1 ] =0xffffffff , - [NPCM7XX_CLK_CLKSEL ] =0x004aaaaa , + [NPCM7XX_CLK_CLKSEL ] =0x004aaba9 , [NPCM7XX_CLK_CLKDIV1 ] =0x5413f855 , [NPCM7XX_CLK_PLLCON0 ] =0x00222101 |PLLCON_LOKI , [NPCM7XX_CLK_PLLCON1 ] =0x00202101 |PLLCON_LOKI ,which switches the CPU core and UART to run from PLL2 instead of CLKREF (25 MHz).
With this change, the test passes without optimization:
(02/19) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_quanta_gsj_initrd:
PASS (39.62 s)Quoted 6 lines
It doesn't look like this change hurts booting from the bootrom (IIUC the nuvoton bootblock overwrites CLKSEL anyway), but it's not super clean.
Perhaps I should make it conditional on
kernel_filenamebeing set? Or would it be better to provide awrite_board_setuphook for this?QEMU prefers to avoid ifdef'ry at all cost. However I find this approach acceptable (anyway up to the maintainer):
(quoted diff) +11
-0+static void npcm7xx_clk_cold_reset_fixup(NPCM7xxCLKState *s) +{ +#ifndef __OPTIMIZE__ + /* + * When built without optimization, ... + * so run CPU core and UART from PLL2 instead of CLKREF. + */ + s->regs[NPCM7XX_CLK_CLKSEL] |= 0x103, +#endif +} static void npcm7xx_clk_enter_reset(Object *obj, ResetType type) { NPCM7xxCLKState *s = NPCM7XX_CLK(obj); QEMU_BUILD_BUG_ON(sizeof(s->regs) != sizeof(cold_reset_values)); switch (type) { case RESET_TYPE_COLD: memcpy(s->regs, cold_reset_values, sizeof(cold_reset_values)); + npcm7xx_clk_cold_reset_fixup(s); s->ref_ns = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); return; }Regards,
Phil.
Re: [PATCH v7 13/13] tests/acceptance: console boot tests for quanta-gsj
In reply to Philippe Mathieu-DaudéQuoted 60 lines · Philippe Mathieu-Daudé
+Eric / Richard for compiler optimizations.
Quoted 46 lines · Havard Skinnemoen
Quoted 8 lines · Havard Skinnemoen
Quoted 5 lines · Philippe Mathieu-Daudé
INTERRUPTED: Test interrupted by SIGTERM
Runner error occurred: Timeout reached
(240.45 s)Is that expected?
Quoted 8 lines
I'm not sure why it only happens when running direct kernel boot with unoptimized qemu, but it seems a little happier if I enable a few more peripherals that I have queued up (sd, ehci, ohci and rng), though not enough.
It still stalls for an awfully long time on "console: Run /init as init process" though. I'm not sure what it's doing there. With -O2 it only takes a couple of seconds to move on.
So it turns out that the kernel gets _really_ sluggish when skipping the clock initialization normally done by the boot loader.
I changed the reset value of CLKSEL like this:
hw/misc/npcm7xx_clk.c +1
-1@@ -67,7 +67,7 @@ enum NPCM7xxCLKRegisters {*/ static const uint32_t cold_reset_values[NPCM7XX_CLK_NR_REGS ] = { [NPCM7XX_CLK_CLKEN1 ] =0xffffffff , - [NPCM7XX_CLK_CLKSEL ] =0x004aaaaa , + [NPCM7XX_CLK_CLKSEL ] =0x004aaba9 , [NPCM7XX_CLK_CLKDIV1 ] =0x5413f855 , [NPCM7XX_CLK_PLLCON0 ] =0x00222101 |PLLCON_LOKI , [NPCM7XX_CLK_PLLCON1 ] =0x00202101 |PLLCON_LOKI ,which switches the CPU core and UART to run from PLL2 instead of CLKREF (25 MHz).
With this change, the test passes without optimization:
(02/19) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_quanta_gsj_initrd:
PASS (39.62 s)Quoted 6 lines
It doesn't look like this change hurts booting from the bootrom (IIUC the nuvoton bootblock overwrites CLKSEL anyway), but it's not super clean.
Perhaps I should make it conditional on
kernel_filenamebeing set? Or would it be better to provide awrite_board_setuphook for this?QEMU prefers to avoid ifdef'ry at all cost. However I find this approach acceptable (anyway up to the maintainer):
Review
Quoted 10 lines
(quoted diff) +10
-0+static void npcm7xx_clk_cold_reset_fixup(NPCM7xxCLKState *s) +{ +#ifndef __OPTIMIZE__ + /* + * When built without optimization, ... + * so run CPU core and UART from PLL2 instead of CLKREF. + */ + s->regs[NPCM7XX_CLK_CLKSEL] |= 0x103, +#endif +}
I think this is actually a problem regardless of optimization level. Turning optimization off amplifies the problem, but the problem is still there with optimization on.
This does not affect booting a full flash image, as these fixups (and more) are done by the boot loader in that case.
Havard
Re: [PATCH v7 13/13] tests/acceptance: console boot tests for quanta-gsj
Quoted 61 lines · Havard Skinnemoen
Quoted 60 lines · Philippe Mathieu-Daudé
+Eric / Richard for compiler optimizations.
Quoted 46 lines · Havard Skinnemoen
Quoted 8 lines · Havard Skinnemoen
Quoted 5 lines · Philippe Mathieu-Daudé
INTERRUPTED: Test interrupted by SIGTERM
Runner error occurred: Timeout reached
(240.45 s)Is that expected?
Quoted 8 lines
I'm not sure why it only happens when running direct kernel boot with unoptimized qemu, but it seems a little happier if I enable a few more peripherals that I have queued up (sd, ehci, ohci and rng), though not enough.
It still stalls for an awfully long time on "console: Run /init as init process" though. I'm not sure what it's doing there. With -O2 it only takes a couple of seconds to move on.
So it turns out that the kernel gets _really_ sluggish when skipping the clock initialization normally done by the boot loader.
I changed the reset value of CLKSEL like this:
hw/misc/npcm7xx_clk.c +1
-1@@ -67,7 +67,7 @@ enum NPCM7xxCLKRegisters {*/ static const uint32_t cold_reset_values[NPCM7XX_CLK_NR_REGS ] = { [NPCM7XX_CLK_CLKEN1 ] =0xffffffff , - [NPCM7XX_CLK_CLKSEL ] =0x004aaaaa , + [NPCM7XX_CLK_CLKSEL ] =0x004aaba9 , [NPCM7XX_CLK_CLKDIV1 ] =0x5413f855 , [NPCM7XX_CLK_PLLCON0 ] =0x00222101 |PLLCON_LOKI , [NPCM7XX_CLK_PLLCON1 ] =0x00202101 |PLLCON_LOKI ,which switches the CPU core and UART to run from PLL2 instead of CLKREF (25 MHz).
With this change, the test passes without optimization:
(02/19) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_quanta_gsj_initrd:
PASS (39.62 s)Quoted 6 lines
It doesn't look like this change hurts booting from the bootrom (IIUC the nuvoton bootblock overwrites CLKSEL anyway), but it's not super clean.
Perhaps I should make it conditional on
kernel_filenamebeing set? Or would it be better to provide awrite_board_setuphook for this?QEMU prefers to avoid ifdef'ry at all cost. However I find this approach acceptable (anyway up to the maintainer):
Quoted 14 lines
Review
Quoted 10 lines
(quoted diff) +10
-0+static void npcm7xx_clk_cold_reset_fixup(NPCM7xxCLKState *s) +{ +#ifndef __OPTIMIZE__ + /* + * When built without optimization, ... + * so run CPU core and UART from PLL2 instead of CLKREF. + */ + s->regs[NPCM7XX_CLK_CLKSEL] |= 0x103, +#endif +}I think this is actually a problem regardless of optimization level. Turning optimization off amplifies the problem, but the problem is still there with optimization on.
OK, this reminds me few more details about the problem I had with the raspi3 when adding the ClockPowerResetManager block.
Found the branch. A bit bitter/sad it was more than 1 year ago.
So if ARM_FEATURE_GENERIC_TIMER is available, Linux polls the CNTFRQ_EL0 register. At that time this register were using a fixed frequency:
#define ARM_CPU_FREQ 1000000000 /* FIXME: 1 GHz, should be configurable */
Xilinx' fork does it this way:
https://github.com/Xilinx/qemu/commit/9e939b54e2d
Now I see Andrew Jeffery fixed that in 96eec6b2b38 ("target/arm: Prepare generic timer for per-platform CNTFRQ") adding a 'cntfrq' property, which he then sets in the Aspeed machine in commit 058d095532d ("ast2600: Configure CNTFRQ at 1125MHz").
Maybe your SoC is simply missing this property?
Quoted 6 lines
This does not affect booting a full flash image, as these fixups (and more) are done by the boot loader in that case.
Havard
Re: [PATCH v7 13/13] tests/acceptance: console boot tests for quanta-gsj
Quoted 90 lines · Philippe Mathieu-Daudé
Quoted 61 lines · Havard Skinnemoen
Quoted 60 lines · Philippe Mathieu-Daudé
+Eric / Richard for compiler optimizations.
Quoted 46 lines · Havard Skinnemoen
Quoted 8 lines · Havard Skinnemoen
Quoted 5 lines · Philippe Mathieu-Daudé
INTERRUPTED: Test interrupted by SIGTERM
Runner error occurred: Timeout reached
(240.45 s)Is that expected?
Quoted 8 lines
I'm not sure why it only happens when running direct kernel boot with unoptimized qemu, but it seems a little happier if I enable a few more peripherals that I have queued up (sd, ehci, ohci and rng), though not enough.
It still stalls for an awfully long time on "console: Run /init as init process" though. I'm not sure what it's doing there. With -O2 it only takes a couple of seconds to move on.
So it turns out that the kernel gets _really_ sluggish when skipping the clock initialization normally done by the boot loader.
I changed the reset value of CLKSEL like this:
hw/misc/npcm7xx_clk.c +1
-1@@ -67,7 +67,7 @@ enum NPCM7xxCLKRegisters {*/ static const uint32_t cold_reset_values[NPCM7XX_CLK_NR_REGS ] = { [NPCM7XX_CLK_CLKEN1 ] =0xffffffff , - [NPCM7XX_CLK_CLKSEL ] =0x004aaaaa , + [NPCM7XX_CLK_CLKSEL ] =0x004aaba9 , [NPCM7XX_CLK_CLKDIV1 ] =0x5413f855 , [NPCM7XX_CLK_PLLCON0 ] =0x00222101 |PLLCON_LOKI , [NPCM7XX_CLK_PLLCON1 ] =0x00202101 |PLLCON_LOKI ,which switches the CPU core and UART to run from PLL2 instead of CLKREF (25 MHz).
With this change, the test passes without optimization:
(02/19) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_quanta_gsj_initrd:
PASS (39.62 s)Quoted 6 lines
It doesn't look like this change hurts booting from the bootrom (IIUC the nuvoton bootblock overwrites CLKSEL anyway), but it's not super clean.
Perhaps I should make it conditional on
kernel_filenamebeing set? Or would it be better to provide awrite_board_setuphook for this?QEMU prefers to avoid ifdef'ry at all cost. However I find this approach acceptable (anyway up to the maintainer):
Quoted 14 lines
Review
Quoted 10 lines
(quoted diff) +10
-0+static void npcm7xx_clk_cold_reset_fixup(NPCM7xxCLKState *s) +{ +#ifndef __OPTIMIZE__ + /* + * When built without optimization, ... + * so run CPU core and UART from PLL2 instead of CLKREF. + */ + s->regs[NPCM7XX_CLK_CLKSEL] |= 0x103, +#endif +}I think this is actually a problem regardless of optimization level. Turning optimization off amplifies the problem, but the problem is still there with optimization on.
OK, this reminds me few more details about the problem I had with the raspi3 when adding the ClockPowerResetManager block.
Found the branch. A bit bitter/sad it was more than 1 year ago.So if
ARM_FEATURE_GENERIC_TIMERis available, Linux polls theCNTFRQ_EL0register. At that time this register were using a fixed frequency:#define
ARM_CPU_FREQ1000000000 /* FIXME: 1 GHz, should be configurable */Xilinx' fork does it this way:
https://github.com/Xilinx/qemu/commit/9e939b54e2d
Quoted 6 lines
Now I see Andrew Jeffery fixed that in
96eec6b2b38("target/arm: Prepare generic timer for per-platform CNTFRQ") adding a 'cntfrq' property, which he then sets in the Aspeed machine in commit058d095532d("ast2600: Configure CNTFRQ at 1125MHz").Maybe your SoC is simply missing this property?
Hmm, it doesn't look like Cortex-A9 has this property...
Unexpected error in object_property_find() at /usr/local/google/home/hskinnemoen/qemu/upstream/qom/object.c:1254:
qemu-system-arm: Property '.cntfrq' not found
However, I did notice there are a lot of constraints on input frequencies to the CPU and various peripherals, and many of these are not met by the power-on reset values.
For example, the UART needs a 24 MHz input clock, but there's no way to generate this from the default 25 MHz reference clock. However, PLL2 is set up to run at 960 MHz by default (as soon as it's locked), with a fixed /2 divider. The UART uses a /20 divider by default, so it gets a 25 MHz / 20 = 1.25 MHz clock with power-on defaults. However, switching the source to PLL2 results in 960 MHz / 2 / 20 = 24 MHz.
Similarly, the CPU is supposed to run at 800 MHz, but it runs at 25 MHz with power-on defaults. PLL1 runs at 800 MHz by default, with a fixed /2 divider. The boot loader doubles the feedback divider so it turns into 1600 MHz / 2 = 800 MHz.
Turns out I was wrong above, the patch snippet routes PLL1, not PLL2, to the CPU. But it will only result in half the recommended speed, so a patch to PLLCON1 is needed as well.
It seems like the cleanest solution would be to add a write_board_setup hook to fix up these registers so clocks are within normal ranges when bypassing the boot loader. In particular:
- Switch UART to PLL2 for a 24 MHz input clock.
- Set up PLL1 to run at 1600 MHz.
- Switch the CPU core to PLL1 / 2 for a 800 MHz input clock.
Does that make sense? It should be just three simple register writes, which is doable with hand-edited machine code.
I'll add this as a separate patch (right before the acceptance test) so it's clear what's happening.
Unfortunately, I haven't been able to make the flash boot test pass without optimization. U-boot seems to have a tiny buffer for the command line, so I can only disable two or three systemd services before it gets truncated. I might try to create a reduced openbmc image instead.
Havard
Re: [PATCH v7 13/13] tests/acceptance: console boot tests for quanta-gsj
Hi Havard,
Quoted 100 lines · Havard Skinnemoen
Quoted 90 lines · Philippe Mathieu-Daudé
Quoted 61 lines · Havard Skinnemoen
Quoted 60 lines · Philippe Mathieu-Daudé
+Eric / Richard for compiler optimizations.
Quoted 46 lines · Havard Skinnemoen
Quoted 8 lines · Havard Skinnemoen
Quoted 5 lines · Philippe Mathieu-Daudé
INTERRUPTED: Test interrupted by SIGTERM
Runner error occurred: Timeout reached
(240.45 s)Is that expected?
Quoted 8 lines
I'm not sure why it only happens when running direct kernel boot with unoptimized qemu, but it seems a little happier if I enable a few more peripherals that I have queued up (sd, ehci, ohci and rng), though not enough.
It still stalls for an awfully long time on "console: Run /init as init process" though. I'm not sure what it's doing there. With -O2 it only takes a couple of seconds to move on.
So it turns out that the kernel gets _really_ sluggish when skipping the clock initialization normally done by the boot loader.
I changed the reset value of CLKSEL like this:
hw/misc/npcm7xx_clk.c +1
-1@@ -67,7 +67,7 @@ enum NPCM7xxCLKRegisters {*/ static const uint32_t cold_reset_values[NPCM7XX_CLK_NR_REGS ] = { [NPCM7XX_CLK_CLKEN1 ] =0xffffffff , - [NPCM7XX_CLK_CLKSEL ] =0x004aaaaa , + [NPCM7XX_CLK_CLKSEL ] =0x004aaba9 , [NPCM7XX_CLK_CLKDIV1 ] =0x5413f855 , [NPCM7XX_CLK_PLLCON0 ] =0x00222101 |PLLCON_LOKI , [NPCM7XX_CLK_PLLCON1 ] =0x00202101 |PLLCON_LOKI ,which switches the CPU core and UART to run from PLL2 instead of CLKREF (25 MHz).
With this change, the test passes without optimization:
(02/19) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_quanta_gsj_initrd:
PASS (39.62 s)Quoted 6 lines
It doesn't look like this change hurts booting from the bootrom (IIUC the nuvoton bootblock overwrites CLKSEL anyway), but it's not super clean.
Perhaps I should make it conditional on
kernel_filenamebeing set? Or would it be better to provide awrite_board_setuphook for this?QEMU prefers to avoid ifdef'ry at all cost. However I find this approach acceptable (anyway up to the maintainer):
Quoted 14 lines
Review
Quoted 10 lines
(quoted diff) +10
-0+static void npcm7xx_clk_cold_reset_fixup(NPCM7xxCLKState *s) +{ +#ifndef __OPTIMIZE__ + /* + * When built without optimization, ... + * so run CPU core and UART from PLL2 instead of CLKREF. + */ + s->regs[NPCM7XX_CLK_CLKSEL] |= 0x103, +#endif +}I think this is actually a problem regardless of optimization level. Turning optimization off amplifies the problem, but the problem is still there with optimization on.
OK, this reminds me few more details about the problem I had with the raspi3 when adding the ClockPowerResetManager block.
Found the branch. A bit bitter/sad it was more than 1 year ago.So if
ARM_FEATURE_GENERIC_TIMERis available, Linux polls theCNTFRQ_EL0register. At that time this register were using a fixed frequency:#define
ARM_CPU_FREQ1000000000 /* FIXME: 1 GHz, should be configurable */Xilinx' fork does it this way:
https://github.com/Xilinx/qemu/commit/9e939b54e2dQuoted 6 lines
Now I see Andrew Jeffery fixed that in
96eec6b2b38("target/arm: Prepare generic timer for per-platform CNTFRQ") adding a 'cntfrq' property, which he then sets in the Aspeed machine in commit058d095532d("ast2600: Configure CNTFRQ at 1125MHz").Maybe your SoC is simply missing this property?
Hmm, it doesn't look like Cortex-A9 has this property...
Quoted 7 lines
Unexpected error in
object_property_find()at/usr/local/google/home/hskinnemoen/qemu/upstream/qom/object.c:1254:
qemu-system-arm: Property '.cntfrq' not foundHowever, I did notice there are a lot of constraints on input frequencies to the CPU and various peripherals, and many of these are not met by the power-on reset values.
Oh OK.
Quoted 7 lines
For example, the UART needs a 24 MHz input clock, but there's no way to generate this from the default 25 MHz reference clock. However, PLL2 is set up to run at 960 MHz by default (as soon as it's locked), with a fixed /2 divider. The UART uses a /20 divider by default, so it gets a 25 MHz / 20 = 1.25 MHz clock with power-on defaults. However, switching the source to PLL2 results in 960 MHz / 2 / 20 = 24 MHz.
Yes, thanks to Damien's work we can now use the Clock API to model that correctly. This API is very recent, and very few devices use it. We need to adapt them one by one.
I started with the serial:
https://www.mail-archive.com/[email protected]/msg727975.html
Quoted 4 lines
Similarly, the CPU is supposed to run at 800 MHz, but it runs at 25 MHz with power-on defaults. PLL1 runs at 800 MHz by default, with a fixed /2 divider. The boot loader doubles the feedback divider so it turns into 1600 MHz / 2 = 800 MHz.
I noticed in my projects is that the Clock API lacks something like a FixedDividerClock. qdev_init_clock_in() expects a callback, but with fixed divisor we could have the divisor in a state and use a generic callback, but the callback doesn't take pointer to state.
Maybe that can be a new field in NamedClockList. I didn't had time to write patches tests and ping Damien/Peter about it, but will do during Sept.
Quoted 9 lines
Turns out I was wrong above, the patch snippet routes PLL1, not PLL2, to the CPU. But it will only result in half the recommended speed, so a patch to PLLCON1 is needed as well.
It seems like the cleanest solution would be to add a
write_board_setuphook to fix up these registers so clocks are within normal ranges when bypassing the boot loader. In particular:
Quoted 6 lines
- Switch UART to PLL2 for a 24 MHz input clock.
- Set up PLL1 to run at 1600 MHz.
- Switch the CPU core to PLL1 / 2 for a 800 MHz input clock.Does that make sense? It should be just three simple register writes, which is doable with hand-edited machine code.
It makes sense but since (I guess) we could properly model that using the Clock API, this hook is a temporary kludge...
I'm not against it however, since except this detail, this series is almost perfect, and you already spent enough time.
IOW IMHO this kludge is acceptable for now, and modelling the missing parts to use the Clock API can be done on top (or not...).
Quoted 9 lines
I'll add this as a separate patch (right before the acceptance test) so it's clear what's happening.
Unfortunately, I haven't been able to make the flash boot test pass without optimization. U-boot seems to have a tiny buffer for the command line, so I can only disable two or three systemd services before it gets truncated. I might try to create a reduced openbmc image instead.
I haven't think of that limitation. I rather prefer we test the original OpenBMC image. Simply disable the 3 longest services, and we'll adjust the test time.
Thanks for the detailed info you provided.
Regards,
Phil.
Quoted 3 lines
Havard