Add Allwinner H3 SoC and Orange Pi PC Machine
v7 cover Add Allwinner H3 SoC and Orange Pi PC Machine
Dear QEMU developers,
Hereby I would like to contribute the following set of patches to QEMU which add support for the Allwinner H3 System on Chip and the Orange Pi PC machine. The following features and devices are supported:
* SMP (Quad Core Cortex A7)
* Generic Interrupt Controller configuration
* SRAM mappings
* SDRAM controller
* Real Time Clock
* Timer device (re-used from Allwinner A10)
* UART
* SD/MMC storage controller
* EMAC ethernet
* USB 2.0 interfaces
* Clock Control Unit
* System Control module
* Security Identifier device
Functionality related to graphical output such as HDMI, GPU, Display Engine and audio are not included. Recently released mainline Linux kernels (4.19 up to latest master), mainline U-Boot and NetBSD 9.0 are known to work.
For full details on how to use the Orange Pi PC machine, see the file docs/system/orangepi.rst which is included as a patch in this series.
The contents of this patch series is available on Github at:
https://github.com/nieklinnenbank/qemu/tree/allwinner-h3-v7
The followings are currently known issues in this series:
- RTC date & time is not persistent
- boot0 custom Allwinner bootloader not yet working
- Watchdog not yet implemented, affects U-Boot 'reset' and shutdown/reboot
-> This is part of the existing A10 timer that needs to be generalized first
Looking forward to your review comments. I will do my best to update the patches where needed.
===== CHANGELOG =====
v7:
* tests/acceptances/boot_linux_console.py: extend test_arm_orangepi_sd with checks for ethernet device
* docs/system/orangepi.rst: moved from docs/ top level to docs/system/
* docs/system/orangepi.rst: correct indentation and section headers to resolve sphinx parse errors
* docs/system/orangepi.rst: add .. code-block:: bash for each code example
* docs/system/target-arm.rst: include the orangepi.rst file
* hw/misc/allwinner-cpucfg.c: use arm_feature(&target_cpu->env, ARM_FEATURE_AARCH64) to fill target_aa64 for 64-bit compatibility
* hw/arm/orangepi.c: use object_property_add_child to add H3 SoC object to machine and use object_unref, to avoid memory leak on exit
v6: https://lists.gnu.org/archive/html/qemu-devel/2020-03/msg00046.html
https://github.com/nieklinnenbank/qemu/tree/allwinner-h3-v6
v5: https://lists.gnu.org/archive/html/qemu-devel/2020-02/msg04525.html
https://github.com/nieklinnenbank/qemu/tree/allwinner-h3-v5
v4: https://lists.gnu.org/archive/html/qemu-devel/2020-01/msg03960.html
https://github.com/nieklinnenbank/qemu/tree/allwinner-h3-v4
v3: https://lists.gnu.org/archive/html/qemu-devel/2020-01/msg01534.html
https://github.com/nieklinnenbank/qemu/tree/allwinner-h3-v3
v2: https://lists.gnu.org/archive/html/qemu-devel/2019-12/msg03265.html
https://github.com/nieklinnenbank/qemu/tree/allwinner-h3-v2
v1: https://lists.gnu.org/archive/html/qemu-devel/2019-12/msg00320.html
https://github.com/nieklinnenbank/qemu/tree/allwinner-h3-v1
With kind regards,
Niek Linnenbank
Niek Linnenbank (13):
hw/arm: add Allwinner H3 System-on-Chip hw/arm: add Xunlong Orange Pi PC machine hw/arm/allwinner-h3: add Clock Control Unit hw/arm/allwinner-h3: add USB host controller hw/arm/allwinner-h3: add System Control module hw/arm/allwinner: add CPU Configuration module hw/arm/allwinner: add Security Identifier device hw/arm/allwinner: add SD/MMC host controller hw/arm/allwinner-h3: add EMAC ethernet device hw/arm/allwinner-h3: add Boot ROM support hw/arm/allwinner-h3: add SDRAM controller device hw/arm/allwinner: add RTC device support
docs: add Orange Pi PC document
Philippe Mathieu-Daudé (5):
tests/boot_linux_console: Add a quick test for the OrangePi PC board tests/boot_linux_console: Add initrd test for the Orange Pi PC board tests/boot_linux_console: Add a SD card test for the OrangePi PC board tests/boot_linux_console: Add a SLOW test booting Ubuntu on OrangePi
PC
tests/boot_linux_console: Test booting NetBSD via U-Boot on OrangePi
PC
docs/system/orangepi.rst | 253 +++++++ docs/system/target-arm.rst | 2 + default-configs/arm-softmmu.mak | 1 + hw/usb/hcd-ehci.h | 1 + include/hw/arm/allwinner-a10.h | 4 + include/hw/arm/allwinner-h3.h | 161 +++++ include/hw/misc/allwinner-cpucfg.h | 52 ++ include/hw/misc/allwinner-h3-ccu.h | 66 ++ include/hw/misc/allwinner-h3-dramc.h | 106 +++ include/hw/misc/allwinner-h3-sysctrl.h | 67 ++ include/hw/misc/allwinner-sid.h | 60 ++ include/hw/net/allwinner-sun8i-emac.h | 99 +++ include/hw/rtc/allwinner-rtc.h | 134 ++++ include/hw/sd/allwinner-sdhost.h | 135 ++++ hw/arm/allwinner-a10.c | 19 + hw/arm/allwinner-h3.c | 466 +++++++++++++ hw/arm/cubieboard.c | 15 + hw/arm/orangepi.c | 131 ++++ hw/misc/allwinner-cpucfg.c | 282 ++++++++ hw/misc/allwinner-h3-ccu.c | 242 +++++++ hw/misc/allwinner-h3-dramc.c | 358 ++++++++++ hw/misc/allwinner-h3-sysctrl.c | 140 ++++ hw/misc/allwinner-sid.c | 168 +++++ hw/net/allwinner-sun8i-emac.c | 871 +++++++++++++++++++++++++ hw/rtc/allwinner-rtc.c | 411 ++++++++++++ hw/sd/allwinner-sdhost.c | 854 ++++++++++++++++++++++++ hw/usb/hcd-ehci-sysbus.c | 17 + MAINTAINERS | 9 + hw/arm/Kconfig | 12 + hw/arm/Makefile.objs | 1 + hw/misc/Makefile.objs | 5 + hw/misc/trace-events | 19 + hw/net/Kconfig | 3 + hw/net/Makefile.objs | 1 + hw/net/trace-events | 10 + hw/rtc/Makefile.objs | 1 + hw/rtc/trace-events | 4 + hw/sd/Makefile.objs | 1 + hw/sd/trace-events | 7 + tests/acceptance/boot_linux_console.py | 230 +++++++ 40 files changed, 5418 insertions(+) create mode 100644 docs/system/orangepi.rst create mode 100644 include/hw/arm/allwinner-h3.h create mode 100644 include/hw/misc/allwinner-cpucfg.h create mode 100644 include/hw/misc/allwinner-h3-ccu.h create mode 100644 include/hw/misc/allwinner-h3-dramc.h create mode 100644 include/hw/misc/allwinner-h3-sysctrl.h create mode 100644 include/hw/misc/allwinner-sid.h create mode 100644 include/hw/net/allwinner-sun8i-emac.h create mode 100644 include/hw/rtc/allwinner-rtc.h create mode 100644 include/hw/sd/allwinner-sdhost.h create mode 100644 hw/arm/allwinner-h3.c create mode 100644 hw/arm/orangepi.c create mode 100644 hw/misc/allwinner-cpucfg.c create mode 100644 hw/misc/allwinner-h3-ccu.c create mode 100644 hw/misc/allwinner-h3-dramc.c create mode 100644 hw/misc/allwinner-h3-sysctrl.c create mode 100644 hw/misc/allwinner-sid.c create mode 100644 hw/net/allwinner-sun8i-emac.c create mode 100644 hw/rtc/allwinner-rtc.c create mode 100644 hw/sd/allwinner-sdhost.c
Signature · 1 line
2.17.1
PATCH v7 1/18 hw/arm: add Allwinner H3 System-on-Chip
The Allwinner H3 is a System on Chip containing four ARM Cortex A7 processor cores. Features and specifications include DDR2/DDR3 memory, SD/MMC storage cards, 10/100/1000Mbit Ethernet, USB 2.0, HDMI and various I/O modules. This commit adds support for the Allwinner H3 System on Chip.
--- default-configs/arm-softmmu.mak | 1 + include/hw/arm/allwinner-h3.h | 106 +++++++++++ hw/arm/allwinner-h3.c | 327 ++++++++++++++++++++++++++++++++ MAINTAINERS | 7 + hw/arm/Kconfig | 8 + hw/arm/Makefile.objs | 1 + 6 files changed, 450 insertions(+) create mode 100644 include/hw/arm/allwinner-h3.h create mode 100644 hw/arm/allwinner-h3.c
default-configs/arm-softmmu.mak +1 -0
@@ -41,3 +41,4 @@ CONFIG_FSL_IMX25=y CONFIG_FSL_IMX7=y CONFIG_FSL_IMX6UL=y CONFIG_SEMIHOSTING=y +CONFIG_ALLWINNER_H3=y
include/hw/arm/allwinner-h3.h new file +106 -0
106 lines not on this page · raw message
hw/arm/allwinner-h3.c new file +327 -0
327 lines not on this page · raw message
MAINTAINERS +7 -0
@@ -491,6 +491,13 @@ F: hw/*/allwinner* F: include/hw/*/allwinner* F: hw/arm/cubieboard.c +Allwinner-h3 +M: Niek Linnenbank <[email protected]> +L: [email protected] +S: Maintained +F: hw/*/allwinner-h3* +F: include/hw/*/allwinner-h3* + ARM PrimeCell and CMSDK devices M: Peter Maydell <[email protected]> L: [email protected]
hw/arm/Kconfig +8 -0
@@ -297,6 +297,14 @@ config ALLWINNER_A10 select SERIAL select UNIMP +config ALLWINNER_H3 + bool + select ALLWINNER_A10_PIT + select SERIAL + select ARM_TIMER + select ARM_GIC + select UNIMP + config RASPI bool select FRAMEBUFFER
hw/arm/Makefile.objs +1 -0
@@ -35,6 +35,7 @@ obj-$(CONFIG_DIGIC) += digic.o obj-$(CONFIG_OMAP) += omap1.o omap2.o obj-$(CONFIG_STRONGARM) += strongarm.o obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o +obj-$(CONFIG_ALLWINNER_H3) += allwinner-h3.o obj-$(CONFIG_RASPI) += bcm2835_peripherals.o bcm2836.o raspi.o obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o obj-$(CONFIG_STM32F405_SOC) += stm32f405_soc.o
Signature · 1 line
2.17.1
PATCH v7 2/18 hw/arm: add Xunlong Orange Pi PC machine
In reply to Niek LinnenbankThe Xunlong Orange Pi PC is an Allwinner H3 System on Chip based embedded computer with mainline support in both U-Boot and Linux. The board comes with a Quad Core Cortex A7 @ 1.3GHz, 1GiB RAM, 100Mbit ethernet, USB, SD/MMC, USB, HDMI and various other I/O. This commit add support for the Xunlong Orange Pi PC machine.
--- hw/arm/orangepi.c | 92 ++++++++++++++++++++++++++++++++++++++++++++ MAINTAINERS | 1 + hw/arm/Makefile.objs | 2 +- 3 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 hw/arm/orangepi.c
hw/arm/orangepi.c new file +92 -0
@@ -0,0 +1,92 @@ +/* +* Orange Pi emulation +* +* Copyright (C) 2019 Niek Linnenbank <[email protected]> +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "qemu/osdep.h" +#include "qemu/units.h" +#include "exec/address-spaces.h" +#include "qapi/error.h" +#include "cpu.h" +#include "hw/sysbus.h" +#include "hw/boards.h" +#include "hw/qdev-properties.h" +#include "hw/arm/allwinner-h3.h" +#include "sysemu/sysemu.h" + +static struct arm_boot_info orangepi_binfo = { + .nb_cpus =AW_H3_NUM_CPUS , +}; + +static void orangepi_init (MachineState *machine) +{ +AwH3State *h3; + +/* BIOS is not supported by this board */ +if (bios_name) { +error_report ("BIOS not supported for this machine" ); +exit (1 ); + } + +/* This board has fixed size RAM */ +if (machine->ram_size !=1 * GiB) { +error_report ("This machine can only be used with 1GiB of RAM" ); +exit (1 ); + } + +/* Only allow Cortex-A7 for this board */ +if (strcmp (machine->cpu_type,ARM_CPU_TYPE_NAME ("cortex-a7" )) !=0 ) { +error_report ("This board can only be used with cortex-a7 CPU" ); +exit (1 ); + } + + h3 =AW_H3 (object_new (TYPE_AW_H3 )); +object_property_add_child (OBJECT (machine),"soc" ,OBJECT (h3), + &error_abort); +object_unref (OBJECT (h3)); + +/* Setup timer properties */ +object_property_set_int (OBJECT (h3),32768 ,"clk0-freq" , + &error_abort); +object_property_set_int (OBJECT (h3),24 *1000 *1000 ,"clk1-freq" , + &error_abort); + +/* Mark H3 object realized */ +object_property_set_bool (OBJECT (h3), true,"realized" , &error_abort); + +/* SDRAM */ +memory_region_add_subregion (get_system_memory (), h3->memmap[AW_H3_SDRAM ], + machine->ram); + + orangepi_binfo.loader_start = h3->memmap[AW_H3_SDRAM ]; + orangepi_binfo.ram_size = machine->ram_size; +arm_load_kernel (ARM_CPU (first_cpu), machine, &orangepi_binfo); +} + +static void orangepi_machine_init (MachineClass *mc) +{ + mc->desc ="Orange Pi PC" ; + mc->init = orangepi_init; + mc->min_cpus =AW_H3_NUM_CPUS ; + mc->max_cpus =AW_H3_NUM_CPUS ; + mc->default_cpus =AW_H3_NUM_CPUS ; + mc->default_cpu_type =ARM_CPU_TYPE_NAME ("cortex-a7" ); + mc->default_ram_size =1 * GiB; + mc->default_ram_id ="orangepi.ram" ; +} + +DEFINE_MACHINE ("orangepi-pc" , orangepi_machine_init)
MAINTAINERS +1 -0
@@ -497,6 +497,7 @@ L: [email protected] S: Maintained F: hw/*/allwinner-h3* F: include/hw/*/allwinner-h3* +F: hw/arm/orangepi.c ARM PrimeCell and CMSDK devices M: Peter Maydell <[email protected]>
hw/arm/Makefile.objs +1 -1
@@ -35,7 +35,7 @@ obj-$(CONFIG_DIGIC) += digic.o obj-$(CONFIG_OMAP) += omap1.o omap2.o obj-$(CONFIG_STRONGARM) += strongarm.o obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o -obj-$(CONFIG_ALLWINNER_H3) += allwinner-h3.o +obj-$(CONFIG_ALLWINNER_H3) += allwinner-h3.o orangepi.o obj-$(CONFIG_RASPI) += bcm2835_peripherals.o bcm2836.o raspi.o obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o obj-$(CONFIG_STM32F405_SOC) += stm32f405_soc.o
Signature · 1 line
2.17.1
PATCH v7 3/18 hw/arm/allwinner-h3: add Clock Control Unit
In reply to Niek LinnenbankThe Clock Control Unit is responsible for clock signal generation, configuration and distribution in the Allwinner H3 System on Chip. This commit adds support for the Clock Control Unit which emulates a simple read/write register interface.
--- include/hw/arm/allwinner-h3.h | 3 + include/hw/misc/allwinner-h3-ccu.h | 66 ++++++++ hw/arm/allwinner-h3.c | 9 +- hw/misc/allwinner-h3-ccu.c | 242 +++++++++++++++++++++++++++++ hw/misc/Makefile.objs | 1 + 5 files changed, 320 insertions(+), 1 deletion(-) create mode 100644 include/hw/misc/allwinner-h3-ccu.h create mode 100644 hw/misc/allwinner-h3-ccu.c
include/hw/arm/allwinner-h3.h +3 -0
@@ -39,6 +39,7 @@#include "hw/arm/boot.h" #include "hw/timer/allwinner-a10-pit.h" #include "hw/intc/arm_gic.h" +#include "hw/misc/allwinner-h3-ccu.h" #include "target/arm/cpu.h" /**
@@ -55,6 +56,7 @@ enum {AW_H3_SRAM_A1 ,AW_H3_SRAM_A2 ,AW_H3_SRAM_C , +AW_H3_CCU ,AW_H3_PIT ,AW_H3_UART0 , AW_H3_UART1,
@@ -97,6 +99,7 @@ typedef struct AwH3State {ARMCPU cpus[AW_H3_NUM_CPUS ];const hwaddr *memmap;AwA10PITState timer; +AwH3ClockCtlState ccu;GICState gic;MemoryRegion sram_a1;MemoryRegion sram_a2;
include/hw/misc/allwinner-h3-ccu.h new file +66 -0
66 lines not on this page · raw message
hw/arm/allwinner-h3.c +8 -1
@@ -36,6 +36,7 @@ const hwaddr allwinner_h3_memmap[] = { [AW_H3_SRAM_A1] = 0x00000000, [AW_H3_SRAM_A2] = 0x00044000, [AW_H3_SRAM_C] = 0x00010000, + [AW_H3_CCU] = 0x01c20000, [AW_H3_PIT] = 0x01c20c00, [AW_H3_UART0] = 0x01c28000, [AW_H3_UART1] = 0x01c28400,
@@ -77,7 +78,6 @@ struct AwH3Unimplemented { { "usb2-phy", 0x01c1c000, 4 * KiB }, { "usb3-phy", 0x01c1d000, 4 * KiB }, { "smc", 0x01c1e000, 4 * KiB }, - { "ccu", 0x01c20000, 1 * KiB }, { "pio", 0x01c20800, 1 * KiB }, { "owa", 0x01c21000, 1 * KiB }, { "pwm", 0x01c21400, 1 * KiB },
@@ -172,6 +172,9 @@ static void allwinner_h3_init(Object *obj) "clk0-freq", &error_abort);object_property_add_alias (obj,"clk1-freq" ,OBJECT (&s->timer),"clk1-freq" , &error_abort); + +sysbus_init_child_obj (obj,"ccu" , &s->ccu,sizeof (s->ccu), +TYPE_AW_H3_CCU ); }static void allwinner_h3_realize (DeviceState *dev,Error **errp)
@@ -277,6 +280,10 @@ static void allwinner_h3_realize(DeviceState *dev, Error **errp)memory_region_add_subregion (get_system_memory (), s->memmap[AW_H3_SRAM_C ], &s->sram_c); +/* Clock Control Unit */ +qdev_init_nofail (DEVICE (&s->ccu)); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->ccu),0 , s->memmap[AW_H3_CCU ]); +/* UART0. For future clocktree API: All UARTS are connected to APB2_CLK. */ serial_mm_init(get_system_memory(), s->memmap[AW_H3_UART0], 2, qdev_get_gpio_in(DEVICE(&s->gic), AW_H3_GIC_SPI_UART0),
hw/misc/allwinner-h3-ccu.c new file +242 -0
242 lines not on this page · raw message
hw/misc/Makefile.objs +1 -0
@@ -28,6 +28,7 @@ common-obj-$(CONFIG_MACIO) += macio/ common-obj-$(CONFIG_IVSHMEM_DEVICE) += ivshmem.o +common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-h3-ccu.o common-obj-$(CONFIG_REALVIEW) += arm_sysctl.o common-obj-$(CONFIG_NSERIES) += cbus.o common-obj-$(CONFIG_ECCMEMCTL) += eccmemctl.o
Signature · 1 line
2.17.1
PATCH v7 4/18 hw/arm/allwinner-h3: add USB host controller
In reply to Niek LinnenbankThe Allwinner H3 System on Chip contains multiple USB 2.0 bus connections which provide software access using the Enhanced Host Controller Interface (EHCI) and Open Host Controller Interface (OHCI) interfaces. This commit adds support for both interfaces in the Allwinner H3 System on Chip.
--- hw/usb/hcd-ehci.h | 1 + include/hw/arm/allwinner-h3.h | 8 +++++++ hw/arm/allwinner-h3.c | 44 +++++++++++++++++++++++++++++++++++ hw/usb/hcd-ehci-sysbus.c | 17 ++++++++++++++ hw/arm/Kconfig | 2 ++ 5 files changed, 72 insertions(+)
hw/usb/hcd-ehci.h +1 -0
@@ -342,6 +342,7 @@ typedef struct EHCIPCIState {#define TYPE_SYS_BUS_EHCI "sysbus-ehci-usb"#define TYPE_PLATFORM_EHCI "platform-ehci-usb"#define TYPE_EXYNOS4210_EHCI "exynos4210-ehci-usb" +#define TYPE_AW_H3_EHCI "aw-h3-ehci-usb"#define TYPE_TEGRA2_EHCI "tegra2-ehci-usb"#define TYPE_PPC4xx_EHCI "ppc4xx-ehci-usb"#define TYPE_FUSBH200_EHCI "fusbh200-ehci-usb"
include/hw/arm/allwinner-h3.h +8 -0
@@ -56,6 +56,14 @@ enum {AW_H3_SRAM_A1 ,AW_H3_SRAM_A2 ,AW_H3_SRAM_C , +AW_H3_EHCI0 , +AW_H3_OHCI0 , +AW_H3_EHCI1 , +AW_H3_OHCI1 , +AW_H3_EHCI2 , +AW_H3_OHCI2 , +AW_H3_EHCI3 , +AW_H3_OHCI3 ,AW_H3_CCU ,AW_H3_PIT , AW_H3_UART0,
hw/arm/allwinner-h3.c +44 -0
68 lines not on this page · raw message
hw/usb/hcd-ehci-sysbus.c +17 -0
@@ -131,6 +131,22 @@ static const TypeInfo ehci_exynos4210_type_info = { .class_init = ehci_exynos4210_class_init, }; +static void ehci_aw_h3_class_init (ObjectClass *oc,void *data) +{ +SysBusEHCIClass *sec =SYS_BUS_EHCI_CLASS (oc); +DeviceClass *dc =DEVICE_CLASS (oc); + + sec->capsbase =0x0 ; + sec->opregbase =0x10 ; +set_bit (DEVICE_CATEGORY_USB , dc->categories); +} + +static const TypeInfo ehci_aw_h3_type_info = { + .name =TYPE_AW_H3_EHCI , + .parent =TYPE_SYS_BUS_EHCI , + .class_init = ehci_aw_h3_class_init, +}; +static void ehci_tegra2_class_init (ObjectClass *oc,void *data) {SysBusEHCIClass *sec =SYS_BUS_EHCI_CLASS (oc);
@@ -252,6 +268,7 @@ static void ehci_sysbus_register_types(void)type_register_static (&ehci_type_info);type_register_static (&ehci_platform_type_info);type_register_static (&ehci_exynos4210_type_info); +type_register_static (&ehci_aw_h3_type_info);type_register_static (&ehci_tegra2_type_info);type_register_static (&ehci_ppc4xx_type_info);type_register_static (&ehci_fusbh200_type_info);
hw/arm/Kconfig +2 -0
@@ -304,6 +304,8 @@ config ALLWINNER_H3 select ARM_TIMER select ARM_GIC select UNIMP + select USB_OHCI + select USB_EHCI_SYSBUS config RASPI bool
Signature · 1 line
2.17.1
PATCH v7 5/18 hw/arm/allwinner-h3: add System Control module
In reply to Niek LinnenbankThe Allwinner H3 System on Chip has an System Control module that provides system wide generic controls and device information. This commit adds support for the Allwinner H3 System Control module.
--- include/hw/arm/allwinner-h3.h | 3 + include/hw/misc/allwinner-h3-sysctrl.h | 67 ++++++++++++ hw/arm/allwinner-h3.c | 9 +- hw/misc/allwinner-h3-sysctrl.c | 140 +++++++++++++++++++++++++ hw/misc/Makefile.objs | 1 + 5 files changed, 219 insertions(+), 1 deletion(-) create mode 100644 include/hw/misc/allwinner-h3-sysctrl.h create mode 100644 hw/misc/allwinner-h3-sysctrl.c
include/hw/arm/allwinner-h3.h +3 -0
@@ -40,6 +40,7 @@#include "hw/timer/allwinner-a10-pit.h" #include "hw/intc/arm_gic.h" #include "hw/misc/allwinner-h3-ccu.h" +#include "hw/misc/allwinner-h3-sysctrl.h" #include "target/arm/cpu.h" /**
@@ -56,6 +57,7 @@ enum {AW_H3_SRAM_A1 ,AW_H3_SRAM_A2 ,AW_H3_SRAM_C , +AW_H3_SYSCTRL ,AW_H3_EHCI0 ,AW_H3_OHCI0 , AW_H3_EHCI1,
@@ -108,6 +110,7 @@ typedef struct AwH3State {const hwaddr *memmap;AwA10PITState timer;AwH3ClockCtlState ccu; +AwH3SysCtrlState sysctrl;GICState gic;MemoryRegion sram_a1;MemoryRegion sram_a2;
include/hw/misc/allwinner-h3-sysctrl.h new file +67 -0
67 lines not on this page · raw message
hw/arm/allwinner-h3.c +8 -1
@@ -37,6 +37,7 @@ const hwaddr allwinner_h3_memmap[] = { [AW_H3_SRAM_A1] = 0x00000000, [AW_H3_SRAM_A2] = 0x00044000, [AW_H3_SRAM_C] = 0x00010000, + [AW_H3_SYSCTRL] = 0x01c00000, [AW_H3_EHCI0] = 0x01c1a000, [AW_H3_OHCI0] = 0x01c1a400, [AW_H3_EHCI1] = 0x01c1b000,
@@ -66,7 +67,6 @@ struct AwH3Unimplemented { } unimplemented[] = { { "d-engine", 0x01000000, 4 * MiB }, { "d-inter", 0x01400000, 128 * KiB }, - { "syscon", 0x01c00000, 4 * KiB }, { "dma", 0x01c02000, 4 * KiB }, { "nfdc", 0x01c03000, 4 * KiB }, { "ts", 0x01c06000, 4 * KiB },
@@ -192,6 +192,9 @@ static void allwinner_h3_init(Object *obj)sysbus_init_child_obj (obj,"ccu" , &s->ccu,sizeof (s->ccu),TYPE_AW_H3_CCU ); + +sysbus_init_child_obj (obj,"sysctrl" , &s->sysctrl,sizeof (s->sysctrl), +TYPE_AW_H3_SYSCTRL ); }static void allwinner_h3_realize (DeviceState *dev,Error **errp)
@@ -301,6 +304,10 @@ static void allwinner_h3_realize(DeviceState *dev, Error **errp)qdev_init_nofail (DEVICE (&s->ccu));sysbus_mmio_map (SYS_BUS_DEVICE (&s->ccu),0 , s->memmap[AW_H3_CCU ]); +/* System Control */ +qdev_init_nofail (DEVICE (&s->sysctrl)); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->sysctrl),0 , s->memmap[AW_H3_SYSCTRL ]); +/* Universal Serial Bus */ sysbus_create_simple(TYPE_AW_H3_EHCI, s->memmap[AW_H3_EHCI0], qdev_get_gpio_in(DEVICE(&s->gic),
hw/misc/allwinner-h3-sysctrl.c new file +140 -0
140 lines not on this page · raw message
hw/misc/Makefile.objs +1 -0
@@ -29,6 +29,7 @@ common-obj-$(CONFIG_MACIO) += macio/ common-obj-$(CONFIG_IVSHMEM_DEVICE) += ivshmem.o common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-h3-ccu.o +common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-h3-sysctrl.o common-obj-$(CONFIG_REALVIEW) += arm_sysctl.o common-obj-$(CONFIG_NSERIES) += cbus.o common-obj-$(CONFIG_ECCMEMCTL) += eccmemctl.o
Signature · 1 line
2.17.1
PATCH v7 6/18 hw/arm/allwinner: add CPU Configuration module
In reply to Niek LinnenbankVarious Allwinner System on Chip designs contain multiple processors that can be configured and reset using the generic CPU Configuration module interface. This commit adds support for the Allwinner CPU configuration interface which emulates the following features:
* CPU reset
* CPU status
--- include/hw/arm/allwinner-h3.h | 3 + include/hw/misc/allwinner-cpucfg.h | 52 ++++++ hw/arm/allwinner-h3.c | 9 +- hw/misc/allwinner-cpucfg.c | 282 +++++++++++++++++++++++++++++ hw/misc/Makefile.objs | 1 + hw/misc/trace-events | 5 + 6 files changed, 351 insertions(+), 1 deletion(-) create mode 100644 include/hw/misc/allwinner-cpucfg.h create mode 100644 hw/misc/allwinner-cpucfg.c
include/hw/arm/allwinner-h3.h +3 -0
@@ -40,6 +40,7 @@#include "hw/timer/allwinner-a10-pit.h" #include "hw/intc/arm_gic.h" #include "hw/misc/allwinner-h3-ccu.h" +#include "hw/misc/allwinner-cpucfg.h" #include "hw/misc/allwinner-h3-sysctrl.h" #include "target/arm/cpu.h"
@@ -76,6 +77,7 @@ enum {AW_H3_GIC_CPU ,AW_H3_GIC_HYP ,AW_H3_GIC_VCPU , +AW_H3_CPUCFG , AW_H3_SDRAM };
@@ -110,6 +112,7 @@ typedef struct AwH3State {const hwaddr *memmap;AwA10PITState timer;AwH3ClockCtlState ccu; +AwCpuCfgState cpucfg;AwH3SysCtrlState sysctrl;GICState gic;MemoryRegion sram_a1;
include/hw/misc/allwinner-cpucfg.h new file +52 -0
52 lines not on this page · raw message
hw/arm/allwinner-h3.c +8 -1
@@ -56,6 +56,7 @@ const hwaddr allwinner_h3_memmap[] = { [AW_H3_GIC_CPU] = 0x01c82000, [AW_H3_GIC_HYP] = 0x01c84000, [AW_H3_GIC_VCPU] = 0x01c86000, + [AW_H3_CPUCFG] = 0x01f01c00, [AW_H3_SDRAM] = 0x40000000 };
@@ -122,7 +123,6 @@ struct AwH3Unimplemented { { "r_wdog", 0x01f01000, 1 * KiB }, { "r_prcm", 0x01f01400, 1 * KiB }, { "r_twd", 0x01f01800, 1 * KiB }, - { "r_cpucfg", 0x01f01c00, 1 * KiB }, { "r_cir-rx", 0x01f02000, 1 * KiB }, { "r_twi", 0x01f02400, 1 * KiB }, { "r_uart", 0x01f02800, 1 * KiB },
@@ -195,6 +195,9 @@ static void allwinner_h3_init(Object *obj)sysbus_init_child_obj (obj,"sysctrl" , &s->sysctrl,sizeof (s->sysctrl),TYPE_AW_H3_SYSCTRL ); + +sysbus_init_child_obj (obj,"cpucfg" , &s->cpucfg,sizeof (s->cpucfg), +TYPE_AW_CPUCFG ); }static void allwinner_h3_realize (DeviceState *dev,Error **errp)
@@ -308,6 +311,10 @@ static void allwinner_h3_realize(DeviceState *dev, Error **errp)qdev_init_nofail (DEVICE (&s->sysctrl));sysbus_mmio_map (SYS_BUS_DEVICE (&s->sysctrl),0 , s->memmap[AW_H3_SYSCTRL ]); +/* CPU Configuration */ +qdev_init_nofail (DEVICE (&s->cpucfg)); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->cpucfg),0 , s->memmap[AW_H3_CPUCFG ]); +/* Universal Serial Bus */ sysbus_create_simple(TYPE_AW_H3_EHCI, s->memmap[AW_H3_EHCI0], qdev_get_gpio_in(DEVICE(&s->gic),
hw/misc/allwinner-cpucfg.c new file +282 -0
282 lines not on this page · raw message
hw/misc/Makefile.objs +1 -0
@@ -29,6 +29,7 @@ common-obj-$(CONFIG_MACIO) += macio/ common-obj-$(CONFIG_IVSHMEM_DEVICE) += ivshmem.o common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-h3-ccu.o +obj-$(CONFIG_ALLWINNER_H3) += allwinner-cpucfg.o common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-h3-sysctrl.o common-obj-$(CONFIG_REALVIEW) += arm_sysctl.o common-obj-$(CONFIG_NSERIES) += cbus.o
hw/misc/trace-events +5 -0
@@ -1,5 +1,10 @@ # See docs/devel/tracing.txt for syntax documentation. +# allwinner-cpucfg.c +allwinner_cpucfg_cpu_reset(uint8_t cpu_id, uint32_t reset_addr) "id %u, reset_addr 0x%" PRIu32 +allwinner_cpucfg_read(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 +allwinner_cpucfg_write(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 + # eccmemctl.c ecc_mem_writel_mer(uint32_t val) "Write memory enable 0x%08x" ecc_mem_writel_mdr(uint32_t val) "Write memory delay 0x%08x"
Signature · 1 line
2.17.1
Re: [PATCH v7 06/18] hw/arm/allwinner: add CPU Configuration module
Quoted 9 lines · Niek Linnenbank
Various Allwinner System on Chip designs contain multiple processors that can be configured and reset using the generic CPU Configuration module interface. This commit adds support for the Allwinner CPU configuration interface which emulates the following features:
* CPU reset
* CPU statusSigned-off-by Niek Linnenbank <[email protected]>
Quoted 453 lines
--- include/hw/arm/allwinner-h3.h | 3 + include/hw/misc/allwinner-cpucfg.h | 52 ++++++ hw/arm/allwinner-h3.c | 9 +- hw/misc/allwinner-cpucfg.c | 282 +++++++++++++++++++++++++++++ hw/misc/Makefile.objs | 1 + hw/misc/trace-events | 5 + 6 files changed, 351 insertions(+), 1 deletion(-) create mode 100644 include/hw/misc/allwinner-cpucfg.h create mode 100644 hw/misc/allwinner-cpucfg.cinclude/hw/arm/allwinner-h3.h +3
-0@@ -40,6 +40,7 @@#include "hw/timer/allwinner-a10-pit.h" #include "hw/intc/arm_gic.h" #include "hw/misc/allwinner-h3-ccu.h" +#include "hw/misc/allwinner-cpucfg.h" #include "hw/misc/allwinner-h3-sysctrl.h" #include "target/arm/cpu.h" @@ -76,6 +77,7 @@ enum {AW_H3_GIC_CPU ,AW_H3_GIC_HYP ,AW_H3_GIC_VCPU , +AW_H3_CPUCFG , AW_H3_SDRAM };@@ -110,6 +112,7 @@ typedef struct AwH3State {const hwaddr *memmap;AwA10PITState timer;AwH3ClockCtlState ccu; +AwCpuCfgState cpucfg;AwH3SysCtrlState sysctrl;GICState gic;MemoryRegion sram_a1;include/hw/misc/allwinner-cpucfg.h new file +52
-0@@ -0,0 +1,52 @@ +/* +* Allwinner CPU Configuration Module emulation +* +* Copyright (C) 2019 Niek Linnenbank <[email protected]> +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef HW_MISC_ALLWINNER_CPUCFG_H +#define HW_MISC_ALLWINNER_CPUCFG_H + +#include "qom/object.h" +#include "hw/sysbus.h" + +/** +* Object model +* @{ +*/ + +#define TYPE_AW_CPUCFG "allwinner-cpucfg" +#define AW_CPUCFG (obj) \ + OBJECT_CHECK(AwCpuCfgState, (obj), TYPE_AW_CPUCFG) + +/** @} */ + +/** +* Allwinner CPU Configuration Module instance state +*/ +typedef struct AwCpuCfgState { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ + +MemoryRegion iomem; +uint32_t gen_ctrl; +uint32_t super_standby; +uint32_t entry_addr; + +}AwCpuCfgState ; + +#endif /* HW_MISC_ALLWINNER_CPUCFG_H */ hw/arm/allwinner-h3.c +8
-1@@ -56,6 +56,7 @@ const hwaddr allwinner_h3_memmap[] = { [AW_H3_GIC_CPU] = 0x01c82000, [AW_H3_GIC_HYP] = 0x01c84000, [AW_H3_GIC_VCPU] = 0x01c86000, + [AW_H3_CPUCFG] = 0x01f01c00, [AW_H3_SDRAM] = 0x40000000 };@@ -122,7 +123,6 @@ struct AwH3Unimplemented { { "r_wdog", 0x01f01000, 1 * KiB }, { "r_prcm", 0x01f01400, 1 * KiB }, { "r_twd", 0x01f01800, 1 * KiB }, - { "r_cpucfg", 0x01f01c00, 1 * KiB }, { "r_cir-rx", 0x01f02000, 1 * KiB }, { "r_twi", 0x01f02400, 1 * KiB }, { "r_uart", 0x01f02800, 1 * KiB },@@ -195,6 +195,9 @@ static void allwinner_h3_init(Object *obj)sysbus_init_child_obj (obj,"sysctrl" , &s->sysctrl,sizeof (s->sysctrl),TYPE_AW_H3_SYSCTRL ); + +sysbus_init_child_obj (obj,"cpucfg" , &s->cpucfg,sizeof (s->cpucfg), +TYPE_AW_CPUCFG ); }static void allwinner_h3_realize (DeviceState *dev,Error **errp)@@ -308,6 +311,10 @@ static void allwinner_h3_realize(DeviceState *dev, Error **errp)qdev_init_nofail (DEVICE (&s->sysctrl));sysbus_mmio_map (SYS_BUS_DEVICE (&s->sysctrl),0 , s->memmap[AW_H3_SYSCTRL ]); +/* CPU Configuration */ +qdev_init_nofail (DEVICE (&s->cpucfg)); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->cpucfg),0 , s->memmap[AW_H3_CPUCFG ]); +/* Universal Serial Bus */ sysbus_create_simple(TYPE_AW_H3_EHCI, s->memmap[AW_H3_EHCI0], qdev_get_gpio_in(DEVICE(&s->gic),hw/misc/allwinner-cpucfg.c new file +282
-0@@ -0,0 +1,282 @@ +/* +* Allwinner CPU Configuration Module emulation +* +* Copyright (C) 2019 Niek Linnenbank <[email protected]> +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "qemu/osdep.h" +#include "qemu/units.h" +#include "hw/sysbus.h" +#include "migration/vmstate.h" +#include "qemu/log.h" +#include "qemu/module.h" +#include "qemu/error-report.h" +#include "qemu/timer.h" +#include "hw/core/cpu.h" +#include "target/arm/arm-powerctl.h" +#include "target/arm/cpu.h" +#include "hw/misc/allwinner-cpucfg.h" +#include "trace.h" + +/* CPUCFG register offsets */ +enum { +REG_CPUS_RST_CTRL =0x0000 ,/* CPUs Reset Control */ +REG_CPU0_RST_CTRL =0x0040 ,/* CPU#0 Reset Control */ +REG_CPU0_CTRL =0x0044 ,/* CPU#0 Control */ +REG_CPU0_STATUS =0x0048 ,/* CPU#0 Status */ +REG_CPU1_RST_CTRL =0x0080 ,/* CPU#1 Reset Control */ +REG_CPU1_CTRL =0x0084 ,/* CPU#1 Control */ +REG_CPU1_STATUS =0x0088 ,/* CPU#1 Status */ +REG_CPU2_RST_CTRL =0x00C0 ,/* CPU#2 Reset Control */ +REG_CPU2_CTRL =0x00C4 ,/* CPU#2 Control */ +REG_CPU2_STATUS =0x00C8 ,/* CPU#2 Status */ +REG_CPU3_RST_CTRL =0x0100 ,/* CPU#3 Reset Control */ +REG_CPU3_CTRL =0x0104 ,/* CPU#3 Control */ +REG_CPU3_STATUS =0x0108 ,/* CPU#3 Status */ +REG_CPU_SYS_RST =0x0140 ,/* CPU System Reset */ +REG_CLK_GATING =0x0144 ,/* CPU Clock Gating */ +REG_GEN_CTRL =0x0184 ,/* General Control */ +REG_SUPER_STANDBY =0x01A0 ,/* Super Standby Flag */ +REG_ENTRY_ADDR =0x01A4 ,/* Reset Entry Address */ +REG_DBG_EXTERN =0x01E4 ,/* Debug External */ +REG_CNT64_CTRL =0x0280 ,/* 64-bit Counter Control */ +REG_CNT64_LOW =0x0284 ,/* 64-bit Counter Low */ +REG_CNT64_HIGH =0x0288 ,/* 64-bit Counter High */ +}; + +/* CPUCFG register flags */ +enum { +CPUX_RESET_RELEASED = ((1 <<1 ) | (1 <<0 )), +CPUX_STATUS_SMP = (1 <<0 ), +CPU_SYS_RESET_RELEASED = (1 <<0 ), +CLK_GATING_ENABLE = ((1 <<8 ) |0xF ), +}; + +/* CPUCFG register reset values */ +enum { +REG_CLK_GATING_RST =0x0000010F , +REG_GEN_CTRL_RST =0x00000020 , +REG_SUPER_STANDBY_RST =0x0 , +REG_CNT64_CTRL_RST =0x0 , +}; + +/* CPUCFG constants */ +enum { +CPU_EXCEPTION_LEVEL_ON_RESET =3 ,/* EL3 */ +}; + +static void allwinner_cpucfg_cpu_reset (AwCpuCfgState *s,uint8_t cpu_id) +{ +int ret; + +trace_allwinner_cpucfg_cpu_reset (cpu_id, s->entry_addr); + +ARMCPU *target_cpu =ARM_CPU (arm_get_cpu_by_id (cpu_id)); +if (!target_cpu) { +/* +* Called with a bogus value for cpu_id. Guest error will +* already have been logged, we can simply return here. +*/ +return ; + } +bool target_aa64 =arm_feature (&target_cpu->env,ARM_FEATURE_AARCH64 ); + + ret =arm_set_cpu_on (cpu_id, s->entry_addr,0 , +CPU_EXCEPTION_LEVEL_ON_RESET , target_aa64); +if (ret !=QEMU_ARM_POWERCTL_RET_SUCCESS ) { +error_report ("%s: failed to bring up CPU %d: err %d" , + __func__, cpu_id, ret); +return ; + } +} + +static uint64_t allwinner_cpucfg_read (void *opaque,hwaddr offset, +unsigned size) +{ +const AwCpuCfgState *s =AW_CPUCFG (opaque); +uint64_t val =0 ; + +switch (offset) { +case REG_CPUS_RST_CTRL :/* CPUs Reset Control */ +case REG_CPU_SYS_RST :/* CPU System Reset */ + val =CPU_SYS_RESET_RELEASED ; +break ; +case REG_CPU0_RST_CTRL :/* CPU#0 Reset Control */ +case REG_CPU1_RST_CTRL :/* CPU#1 Reset Control */ +case REG_CPU2_RST_CTRL :/* CPU#2 Reset Control */ +case REG_CPU3_RST_CTRL :/* CPU#3 Reset Control */ + val =CPUX_RESET_RELEASED ; +break ; +case REG_CPU0_CTRL :/* CPU#0 Control */ +case REG_CPU1_CTRL :/* CPU#1 Control */ +case REG_CPU2_CTRL :/* CPU#2 Control */ +case REG_CPU3_CTRL :/* CPU#3 Control */ + val =0 ; +break ; +case REG_CPU0_STATUS :/* CPU#0 Status */ +case REG_CPU1_STATUS :/* CPU#1 Status */ +case REG_CPU2_STATUS :/* CPU#2 Status */ +case REG_CPU3_STATUS :/* CPU#3 Status */ + val =CPUX_STATUS_SMP ; +break ; +case REG_CLK_GATING :/* CPU Clock Gating */ + val =CLK_GATING_ENABLE ; +break ; +case REG_GEN_CTRL :/* General Control */ + val = s->gen_ctrl; +break ; +case REG_SUPER_STANDBY :/* Super Standby Flag */ + val = s->super_standby; +break ; +case REG_ENTRY_ADDR :/* Reset Entry Address */ + val = s->entry_addr; +break ; +case REG_DBG_EXTERN :/* Debug External */ +case REG_CNT64_CTRL :/* 64-bit Counter Control */ +case REG_CNT64_LOW :/* 64-bit Counter Low */ +case REG_CNT64_HIGH :/* 64-bit Counter High */ +qemu_log_mask (LOG_UNIMP ,"%s: unimplemented register at 0x%04x\n" , + __func__, (uint32_t )offset); +break ; +default : +qemu_log_mask (LOG_GUEST_ERROR ,"%s: out-of-bounds offset 0x%04x\n" , + __func__, (uint32_t )offset); +break ; + } + +trace_allwinner_cpucfg_read (offset, val, size); + +return val; +} + +static void allwinner_cpucfg_write (void *opaque,hwaddr offset, +uint64_t val,unsigned size) +{ +AwCpuCfgState *s =AW_CPUCFG (opaque); + +trace_allwinner_cpucfg_write (offset, val, size); + +switch (offset) { +case REG_CPUS_RST_CTRL :/* CPUs Reset Control */ +case REG_CPU_SYS_RST :/* CPU System Reset */ +break ; +case REG_CPU0_RST_CTRL :/* CPU#0 Reset Control */ +case REG_CPU1_RST_CTRL :/* CPU#1 Reset Control */ +case REG_CPU2_RST_CTRL :/* CPU#2 Reset Control */ +case REG_CPU3_RST_CTRL :/* CPU#3 Reset Control */ +if (val) { +allwinner_cpucfg_cpu_reset (s, (offset -REG_CPU0_RST_CTRL ) >>6 ); + } +break ; +case REG_CPU0_CTRL :/* CPU#0 Control */ +case REG_CPU1_CTRL :/* CPU#1 Control */ +case REG_CPU2_CTRL :/* CPU#2 Control */ +case REG_CPU3_CTRL :/* CPU#3 Control */ +case REG_CPU0_STATUS :/* CPU#0 Status */ +case REG_CPU1_STATUS :/* CPU#1 Status */ +case REG_CPU2_STATUS :/* CPU#2 Status */ +case REG_CPU3_STATUS :/* CPU#3 Status */ +case REG_CLK_GATING :/* CPU Clock Gating */ +break ; +case REG_GEN_CTRL :/* General Control */ + s->gen_ctrl = val; +break ; +case REG_SUPER_STANDBY :/* Super Standby Flag */ + s->super_standby = val; +break ; +case REG_ENTRY_ADDR :/* Reset Entry Address */ + s->entry_addr = val; +break ; +case REG_DBG_EXTERN :/* Debug External */ +case REG_CNT64_CTRL :/* 64-bit Counter Control */ +case REG_CNT64_LOW :/* 64-bit Counter Low */ +case REG_CNT64_HIGH :/* 64-bit Counter High */ +qemu_log_mask (LOG_UNIMP ,"%s: unimplemented register at 0x%04x\n" , + __func__, (uint32_t )offset); +break ; +default : +qemu_log_mask (LOG_GUEST_ERROR ,"%s: out-of-bounds offset 0x%04x\n" , + __func__, (uint32_t )offset); +break ; + } +} + +static const MemoryRegionOps allwinner_cpucfg_ops = { + .read = allwinner_cpucfg_read, + .write = allwinner_cpucfg_write, + .endianness =DEVICE_NATIVE_ENDIAN , + .valid = { + .min_access_size =4 , + .max_access_size =4 , + }, + .impl.min_access_size =4 , +}; + +static void allwinner_cpucfg_reset (DeviceState *dev) +{ +AwCpuCfgState *s =AW_CPUCFG (dev); + +/* Set default values for registers */ + s->gen_ctrl =REG_GEN_CTRL_RST ; + s->super_standby =REG_SUPER_STANDBY_RST ; + s->entry_addr =0 ; +} + +static void allwinner_cpucfg_init (Object *obj) +{ +SysBusDevice *sbd =SYS_BUS_DEVICE (obj); +AwCpuCfgState *s =AW_CPUCFG (obj); + +/* Memory mapping */ +memory_region_init_io (&s->iomem,OBJECT (s), &allwinner_cpucfg_ops, s, +TYPE_AW_CPUCFG ,1 * KiB); +sysbus_init_mmio (sbd, &s->iomem); +} + +static const VMStateDescription allwinner_cpucfg_vmstate = { + .name ="allwinner-cpucfg" , + .version_id =1 , + .minimum_version_id =1 , + .fields = (VMStateField []) { +VMSTATE_UINT32 (gen_ctrl, AwCpuCfgState), +VMSTATE_UINT32 (super_standby, AwCpuCfgState), +VMSTATE_UINT32 (entry_addr, AwCpuCfgState), +VMSTATE_END_OF_LIST () + } +}; + +static void allwinner_cpucfg_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); + + dc->reset = allwinner_cpucfg_reset; + dc->vmsd = &allwinner_cpucfg_vmstate; +} + +static const TypeInfo allwinner_cpucfg_info = { + .name =TYPE_AW_CPUCFG , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_init = allwinner_cpucfg_init, + .instance_size =sizeof (AwCpuCfgState), + .class_init = allwinner_cpucfg_class_init, +}; + +static void allwinner_cpucfg_register (void ) +{ +type_register_static (&allwinner_cpucfg_info); +} + +type_init (allwinner_cpucfg_register)hw/misc/Makefile.objs +1
-0@@ -29,6 +29,7 @@ common-obj-$(CONFIG_MACIO) += macio/ common-obj-$(CONFIG_IVSHMEM_DEVICE) += ivshmem.o common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-h3-ccu.o +obj-$(CONFIG_ALLWINNER_H3) += allwinner-cpucfg.o common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-h3-sysctrl.o common-obj-$(CONFIG_REALVIEW) += arm_sysctl.o common-obj-$(CONFIG_NSERIES) += cbus.ohw/misc/trace-events +5
-0@@ -1,5 +1,10 @@ # See docs/devel/tracing.txt for syntax documentation. +# allwinner-cpucfg.c +allwinner_cpucfg_cpu_reset(uint8_t cpu_id, uint32_t reset_addr) "id %u, reset_addr 0x%" PRIu32 +allwinner_cpucfg_read(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 +allwinner_cpucfg_write(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 + # eccmemctl.c ecc_mem_writel_mer(uint32_t val) "Write memory enable 0x%08x" ecc_mem_writel_mdr(uint32_t val) "Write memory delay 0x%08x"
Signature · 1 line
Alex Bennée
PATCH v7 7/18 hw/arm/allwinner: add Security Identifier device
In reply to Niek LinnenbankThe Security Identifier device found in various Allwinner System on Chip designs gives applications a per-board unique identifier. This commit adds support for the Allwinner Security Identifier using a 128-bit UUID value as input.
--- include/hw/arm/allwinner-h3.h | 3 + include/hw/misc/allwinner-sid.h | 60 ++++++++++++ hw/arm/allwinner-h3.c | 11 ++- hw/arm/orangepi.c | 9 ++ hw/misc/allwinner-sid.c | 168 ++++++++++++++++++++++++++++++++ hw/misc/Makefile.objs | 1 + hw/misc/trace-events | 4 + 7 files changed, 255 insertions(+), 1 deletion(-) create mode 100644 include/hw/misc/allwinner-sid.h create mode 100644 hw/misc/allwinner-sid.c
include/hw/arm/allwinner-h3.h +3 -0
@@ -42,6 +42,7 @@#include "hw/misc/allwinner-h3-ccu.h" #include "hw/misc/allwinner-cpucfg.h" #include "hw/misc/allwinner-h3-sysctrl.h" +#include "hw/misc/allwinner-sid.h" #include "target/arm/cpu.h" /**
@@ -59,6 +60,7 @@ enum {AW_H3_SRAM_A2 ,AW_H3_SRAM_C ,AW_H3_SYSCTRL , +AW_H3_SID ,AW_H3_EHCI0 ,AW_H3_OHCI0 , AW_H3_EHCI1,
@@ -114,6 +116,7 @@ typedef struct AwH3State {AwH3ClockCtlState ccu;AwCpuCfgState cpucfg;AwH3SysCtrlState sysctrl; +AwSidState sid;GICState gic;MemoryRegion sram_a1;MemoryRegion sram_a2;
include/hw/misc/allwinner-sid.h new file +60 -0
60 lines not on this page · raw message
hw/arm/allwinner-h3.c +10 -1
@@ -38,6 +38,7 @@ const hwaddr allwinner_h3_memmap[] = { [AW_H3_SRAM_A2] = 0x00044000, [AW_H3_SRAM_C] = 0x00010000, [AW_H3_SYSCTRL] = 0x01c00000, + [AW_H3_SID] = 0x01c14000, [AW_H3_EHCI0] = 0x01c1a000, [AW_H3_OHCI0] = 0x01c1a400, [AW_H3_EHCI1] = 0x01c1b000,
@@ -78,7 +79,6 @@ struct AwH3Unimplemented { { "mmc0", 0x01c0f000, 4 * KiB }, { "mmc1", 0x01c10000, 4 * KiB }, { "mmc2", 0x01c11000, 4 * KiB }, - { "sid", 0x01c14000, 1 * KiB }, { "crypto", 0x01c15000, 4 * KiB }, { "msgbox", 0x01c17000, 4 * KiB }, { "spinlock", 0x01c18000, 4 * KiB },
@@ -198,6 +198,11 @@ static void allwinner_h3_init(Object *obj)sysbus_init_child_obj (obj,"cpucfg" , &s->cpucfg,sizeof (s->cpucfg),TYPE_AW_CPUCFG ); + +sysbus_init_child_obj (obj,"sid" , &s->sid,sizeof (s->sid), +TYPE_AW_SID ); +object_property_add_alias (obj,"identifier" ,OBJECT (&s->sid), +"identifier" , &error_abort); }static void allwinner_h3_realize (DeviceState *dev,Error **errp)
@@ -315,6 +320,10 @@ static void allwinner_h3_realize(DeviceState *dev, Error **errp)qdev_init_nofail (DEVICE (&s->cpucfg));sysbus_mmio_map (SYS_BUS_DEVICE (&s->cpucfg),0 , s->memmap[AW_H3_CPUCFG ]); +/* Security Identifier */ +qdev_init_nofail (DEVICE (&s->sid)); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->sid),0 , s->memmap[AW_H3_SID ]); +/* Universal Serial Bus */ sysbus_create_simple(TYPE_AW_H3_EHCI, s->memmap[AW_H3_EHCI0], qdev_get_gpio_in(DEVICE(&s->gic),
hw/arm/orangepi.c +9 -0
@@ -65,6 +65,15 @@ static void orangepi_init(MachineState *machine)object_property_set_int (OBJECT (h3),24 *1000 *1000 ,"clk1-freq" , &error_abort); +/* Setup SID properties. Currently using a default fixed SID identifier. */ +if (qemu_uuid_is_null (&h3->sid.identifier)) { +qdev_prop_set_string (DEVICE (h3),"identifier" , +"02c00081-1111-2222-3333-000044556677" ); + }else if (ldl_be_p (&h3->sid.identifier.data[0 ]) !=0x02c00081 ) { +fprintf (stderr,"WARNING: Security Identifier value does " +"not include H3 prefix\n" ); + } +/* Mark H3 object realized */ object_property_set_bool (OBJECT (h3), true,"realized" , &error_abort);
hw/misc/allwinner-sid.c new file +168 -0
168 lines not on this page · raw message
hw/misc/Makefile.objs +1 -0
@@ -31,6 +31,7 @@ common-obj-$(CONFIG_IVSHMEM_DEVICE) += ivshmem.o common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-h3-ccu.o obj-$(CONFIG_ALLWINNER_H3) += allwinner-cpucfg.o common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-h3-sysctrl.o +common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-sid.o common-obj-$(CONFIG_REALVIEW) += arm_sysctl.o common-obj-$(CONFIG_NSERIES) += cbus.o common-obj-$(CONFIG_ECCMEMCTL) += eccmemctl.o
hw/misc/trace-events +4 -0
@@ -5,6 +5,10 @@ allwinner_cpucfg_cpu_reset(uint8_t cpu_id, uint32_t reset_addr) "id %u, reset_ad allwinner_cpucfg_read(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 allwinner_cpucfg_write(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 +# allwinner-sid.c +allwinner_sid_read(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 +allwinner_sid_write(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 + # eccmemctl.c ecc_mem_writel_mer(uint32_t val) "Write memory enable 0x%08x" ecc_mem_writel_mdr(uint32_t val) "Write memory delay 0x%08x"
Signature · 1 line
2.17.1
Re: [PATCH v7 07/18] hw/arm/allwinner: add Security Identifier device
Quoted 162 lines · Niek Linnenbank
The Security Identifier device found in various Allwinner System on Chip designs gives applications a per-board unique identifier. This commit adds support for the Allwinner Security Identifier using a 128-bit UUID value as input.
Signed-off-by Niek Linnenbank <[email protected]>--- include/hw/arm/allwinner-h3.h | 3 + include/hw/misc/allwinner-sid.h | 60 ++++++++++++ hw/arm/allwinner-h3.c | 11 ++- hw/arm/orangepi.c | 9 ++ hw/misc/allwinner-sid.c | 168 ++++++++++++++++++++++++++++++++ hw/misc/Makefile.objs | 1 + hw/misc/trace-events | 4 + 7 files changed, 255 insertions(+), 1 deletion(-) create mode 100644 include/hw/misc/allwinner-sid.h create mode 100644 hw/misc/allwinner-sid.cinclude/hw/arm/allwinner-h3.h +3
-0@@ -42,6 +42,7 @@#include "hw/misc/allwinner-h3-ccu.h" #include "hw/misc/allwinner-cpucfg.h" #include "hw/misc/allwinner-h3-sysctrl.h" +#include "hw/misc/allwinner-sid.h" #include "target/arm/cpu.h" /** @@ -59,6 +60,7 @@ enum {AW_H3_SRAM_A2 ,AW_H3_SRAM_C ,AW_H3_SYSCTRL , +AW_H3_SID ,AW_H3_EHCI0 ,AW_H3_OHCI0 , AW_H3_EHCI1,@@ -114,6 +116,7 @@ typedef struct AwH3State {AwH3ClockCtlState ccu;AwCpuCfgState cpucfg;AwH3SysCtrlState sysctrl; +AwSidState sid;GICState gic;MemoryRegion sram_a1;MemoryRegion sram_a2;include/hw/misc/allwinner-sid.h new file +60
-0@@ -0,0 +1,60 @@ +/* +* Allwinner Security ID emulation +* +* Copyright (C) 2019 Niek Linnenbank <[email protected]> +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef HW_MISC_ALLWINNER_SID_H +#define HW_MISC_ALLWINNER_SID_H + +#include "qom/object.h" +#include "hw/sysbus.h" +#include "qemu/uuid.h" + +/** +* Object model +* @{ +*/ + +#define TYPE_AW_SID "allwinner-sid" +#define AW_SID (obj) \ + OBJECT_CHECK(AwSidState, (obj), TYPE_AW_SID) + +/** @} */ + +/** +* Allwinner Security ID object instance state +*/ +typedef struct AwSidState { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ + +/** Maps I/O registers in physical memory */ +MemoryRegion iomem; + +/** Control register defines how and what to read */ +uint32_t control; + +/** RdKey register contains the data retrieved by the device */ +uint32_t rdkey; + +/** Stores the emulated device identifier */ +QemuUUID identifier; + +}AwSidState ; + +#endif /* HW_MISC_ALLWINNER_SID_H */ hw/arm/allwinner-h3.c +10
-1@@ -38,6 +38,7 @@ const hwaddr allwinner_h3_memmap[] = { [AW_H3_SRAM_A2] = 0x00044000, [AW_H3_SRAM_C] = 0x00010000, [AW_H3_SYSCTRL] = 0x01c00000, + [AW_H3_SID] = 0x01c14000, [AW_H3_EHCI0] = 0x01c1a000, [AW_H3_OHCI0] = 0x01c1a400, [AW_H3_EHCI1] = 0x01c1b000,@@ -78,7 +79,6 @@ struct AwH3Unimplemented { { "mmc0", 0x01c0f000, 4 * KiB }, { "mmc1", 0x01c10000, 4 * KiB }, { "mmc2", 0x01c11000, 4 * KiB }, - { "sid", 0x01c14000, 1 * KiB }, { "crypto", 0x01c15000, 4 * KiB }, { "msgbox", 0x01c17000, 4 * KiB }, { "spinlock", 0x01c18000, 4 * KiB },@@ -198,6 +198,11 @@ static void allwinner_h3_init(Object *obj)sysbus_init_child_obj (obj,"cpucfg" , &s->cpucfg,sizeof (s->cpucfg),TYPE_AW_CPUCFG ); + +sysbus_init_child_obj (obj,"sid" , &s->sid,sizeof (s->sid), +TYPE_AW_SID ); +object_property_add_alias (obj,"identifier" ,OBJECT (&s->sid), +"identifier" , &error_abort); }static void allwinner_h3_realize (DeviceState *dev,Error **errp)@@ -315,6 +320,10 @@ static void allwinner_h3_realize(DeviceState *dev, Error **errp)qdev_init_nofail (DEVICE (&s->cpucfg));sysbus_mmio_map (SYS_BUS_DEVICE (&s->cpucfg),0 , s->memmap[AW_H3_CPUCFG ]); +/* Security Identifier */ +qdev_init_nofail (DEVICE (&s->sid)); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->sid),0 , s->memmap[AW_H3_SID ]); +/* Universal Serial Bus */ sysbus_create_simple(TYPE_AW_H3_EHCI, s->memmap[AW_H3_EHCI0], qdev_get_gpio_in(DEVICE(&s->gic),hw/arm/orangepi.c +0
-0@@ -65,6 +65,15 @@ static void orangepi_init(MachineState *machine)object_property_set_int (OBJECT (h3),24 *1000 *1000 ,"clk1-freq" , &error_abort);
hw/arm/orangepi.c static void orangepi_init(MachineState *machine) · line 76
Quoted 10 lines
hw/arm/orangepi.c +9
-0+/* Setup SID properties. Currently using a default fixed SID identifier. */ +if (qemu_uuid_is_null (&h3->sid.identifier)) { +qdev_prop_set_string (DEVICE (h3),"identifier" , +"02c00081-1111-2222-3333-000044556677" ); + }else if (ldl_be_p (&h3->sid.identifier.data[0 ]) !=0x02c00081 ) { +fprintf (stderr,"WARNING: Security Identifier value does " +"not include H3 prefix\n" ); + } +
Should this be a LOG_GUEST_ERROR?
Otherwise:
Signature · 1 line
Alex Bennée
Re: [PATCH v7 07/18] hw/arm/allwinner: add Security Identifier device
Quoted 182 lines · Alex Bennée
Quoted 18 lines · Niek Linnenbank
The Security Identifier device found in various Allwinner System on Chip designs gives applications a per-board unique identifier. This commit adds support for the Allwinner Security Identifier using a 128-bit UUID value as input.
Signed-off-by Niek Linnenbank <[email protected]>--- include/hw/arm/allwinner-h3.h | 3 + include/hw/misc/allwinner-sid.h | 60 ++++++++++++ hw/arm/allwinner-h3.c | 11 ++- hw/arm/orangepi.c | 9 ++ hw/misc/allwinner-sid.c | 168 ++++++++++++++++++++++++++++++++ hw/misc/Makefile.objs | 1 + hw/misc/trace-events | 4 + 7 files changed, 255 insertions(+), 1 deletion(-) create mode 100644 include/hw/misc/allwinner-sid.h create mode 100644 hw/misc/allwinner-sid.cReview
Quoted 1 line
(quoted diff) +0
-0
b/include/hw/arm/allwinner-h3.hReview
Quoted 28 lines
index
dc729176ab..85416d9d64100644include/hw/arm/allwinner-h3.h +3
-0@@ -42,6 +42,7 @@#include "hw/misc/allwinner-h3-ccu.h" #include "hw/misc/allwinner-cpucfg.h" #include "hw/misc/allwinner-h3-sysctrl.h" +#include "hw/misc/allwinner-sid.h" #include "target/arm/cpu.h" /** @@ -59,6 +60,7 @@ enum {AW_H3_SRAM_A2 ,AW_H3_SRAM_C ,AW_H3_SYSCTRL , +AW_H3_SID ,AW_H3_EHCI0 ,AW_H3_OHCI0 , AW_H3_EHCI1,@@ -114,6 +116,7 @@ typedef struct AwH3State {AwH3ClockCtlState ccu;AwCpuCfgState cpucfg;AwH3SysCtrlState sysctrl; +AwSidState sid;GICState gic;MemoryRegion sram_a1;MemoryRegion sram_a2;(quoted diff) +0
-0
b/include/hw/misc/allwinner-sid.hhw/arm/allwinner-h3.c static void allwinner_h3_realize(DeviceState *dev,
Quoted 99 lines
new file mode 100644
index 0000000000..4c1fa4762binclude/hw/misc/allwinner-sid.h new file +17
-0@@ -0,0 +1,60 @@ +/* +* Allwinner Security ID emulation +* +* Copyright (C) 2019 Niek Linnenbank <[email protected]> +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/ .
+ */include/hw/misc/allwinner-sid.h new file +42
-0+ +#ifndef HW_MISC_ALLWINNER_SID_H +#define HW_MISC_ALLWINNER_SID_H + +#include "qom/object.h" +#include "hw/sysbus.h" +#include "qemu/uuid.h" + +/** +* Object model +* @{ +*/ + +#define TYPE_AW_SID "allwinner-sid" +#define AW_SID (obj) \ + OBJECT_CHECK(AwSidState, (obj), TYPE_AW_SID) + +/** @} */ + +/** +* Allwinner Security ID object instance state +*/ +typedef struct AwSidState { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ + +/** Maps I/O registers in physical memory */ +MemoryRegion iomem; + +/** Control register defines how and what to read */ +uint32_t control; + +/** RdKey register contains the data retrieved by the device */ +uint32_t rdkey; + +/** Stores the emulated device identifier */ +QemuUUID identifier; + +}AwSidState ; + +#endif /* HW_MISC_ALLWINNER_SID_H */ hw/arm/allwinner-h3.c +6
-1@@ -38,6 +38,7 @@ const hwaddr allwinner_h3_memmap[] = { [AW_H3_SRAM_A2] = 0x00044000, [AW_H3_SRAM_C] = 0x00010000, [AW_H3_SYSCTRL] = 0x01c00000, + [AW_H3_SID] = 0x01c14000, [AW_H3_EHCI0] = 0x01c1a000, [AW_H3_OHCI0] = 0x01c1a400, [AW_H3_EHCI1] = 0x01c1b000,@@ -78,7 +79,6 @@ struct AwH3Unimplemented { { "mmc0", 0x01c0f000, 4 * KiB }, { "mmc1", 0x01c10000, 4 * KiB }, { "mmc2", 0x01c11000, 4 * KiB }, - { "sid", 0x01c14000, 1 * KiB }, { "crypto", 0x01c15000, 4 * KiB }, { "msgbox", 0x01c17000, 4 * KiB }, { "spinlock", 0x01c18000, 4 * KiB },@@ -198,6 +198,11 @@ static void allwinner_h3_init(Object *obj)sysbus_init_child_obj (obj,"cpucfg" , &s->cpucfg,sizeof (s->cpucfg),TYPE_AW_CPUCFG ); + +sysbus_init_child_obj (obj,"sid" , &s->sid,sizeof (s->sid), +TYPE_AW_SID ); +object_property_add_alias (obj,"identifier" ,OBJECT (&s->sid), +"identifier" , &error_abort); }static void allwinner_h3_realize (DeviceState *dev,Error **errp)@@ -315,6 +320,10 @@ static void allwinner_h3_realize(DeviceState *dev,Error **errp)
hw/arm/allwinner-h3.c static void allwinner_h3_realize(DeviceState *dev, · line 321
Quoted 2 lines
hw/arm/allwinner-h3.c +0
-0qdev_init_nofail (DEVICE (&s->cpucfg)); sysbus_mmio_map(SYS_BUS_DEVICE(&s->cpucfg), 0,s->memmap[AW_H3_CPUCFG]);
Quoted 13 lines
hw/arm/allwinner-h3.c +4
-0+/* Security Identifier */ +qdev_init_nofail (DEVICE (&s->sid)); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->sid),0 , s->memmap[AW_H3_SID ]); +/* Universal Serial Bus */ sysbus_create_simple(TYPE_AW_H3_EHCI, s->memmap[AW_H3_EHCI0], qdev_get_gpio_in(DEVICE(&s->gic),hw/arm/orangepi.c +0
-0hw/arm/orangepi.c static void orangepi_init(MachineState *machine) · line 68
Quoted 4 lines
hw/arm/orangepi.c +1
-0@@ -65,6 +65,15 @@ static void orangepi_init(MachineState *machine)object_property_set_int (OBJECT (h3),24 *1000 *1000 ,"clk1-freq" , &error_abort); +/* Setup SID properties. Currently using a default fixed SID identifier. */
hw/arm/orangepi.c static void orangepi_init(MachineState *machine) · line 76
Quoted 8 lines
hw/arm/orangepi.c +8
-0+if (qemu_uuid_is_null (&h3->sid.identifier)) { +qdev_prop_set_string (DEVICE (h3),"identifier" , +"02c00081-1111-2222-3333-000044556677" ); + }else if (ldl_be_p (&h3->sid.identifier.data[0 ]) !=0x02c00081 ) { +fprintf (stderr,"WARNING: Security Identifier value does " +"not include H3 prefix\n" ); + } +
Quoted 2 lines
Should this be a
LOG_GUEST_ERROR?
Hi Alex,
This warning is basically to inform the user when overriding the SID identifier manually with -global,
that the identifier specified by the user does not contain the H3 SoC prefix. Real hardware always has
that particular prefix in its identifier value, and it might be so that software running on the emulated hardware
depends on it. So its basically a proactive warning to inform the user, and not an error of wrong behavior caused by the guest software.
Quoted 5 lines
Otherwise:
Reviewed-by Alex Bennée <[email protected]>
Assuming the above explanation is sufficient, I'll add your review tag, thanks!
Quoted 4 lines
--
Alex Bennée
Signature · 1 line
Niek Linnenbank
Re: [PATCH v7 07/18] hw/arm/allwinner: add Security Identifier device
Quoted 189 lines · Niek Linnenbank
Quoted 182 lines · Alex Bennée
Quoted 18 lines · Niek Linnenbank
The Security Identifier device found in various Allwinner System on Chip designs gives applications a per-board unique identifier. This commit adds support for the Allwinner Security Identifier using a 128-bit UUID value as input.
Signed-off-by Niek Linnenbank <[email protected]>--- include/hw/arm/allwinner-h3.h | 3 + include/hw/misc/allwinner-sid.h | 60 ++++++++++++ hw/arm/allwinner-h3.c | 11 ++- hw/arm/orangepi.c | 9 ++ hw/misc/allwinner-sid.c | 168 ++++++++++++++++++++++++++++++++ hw/misc/Makefile.objs | 1 + hw/misc/trace-events | 4 + 7 files changed, 255 insertions(+), 1 deletion(-) create mode 100644 include/hw/misc/allwinner-sid.h create mode 100644 hw/misc/allwinner-sid.cReview
Quoted 1 line
(quoted diff) +0
-0
b/include/hw/arm/allwinner-h3.hReview
Quoted 28 lines
index
dc729176ab..85416d9d64100644include/hw/arm/allwinner-h3.h +3
-0@@ -42,6 +42,7 @@#include "hw/misc/allwinner-h3-ccu.h" #include "hw/misc/allwinner-cpucfg.h" #include "hw/misc/allwinner-h3-sysctrl.h" +#include "hw/misc/allwinner-sid.h" #include "target/arm/cpu.h" /** @@ -59,6 +60,7 @@ enum {AW_H3_SRAM_A2 ,AW_H3_SRAM_C ,AW_H3_SYSCTRL , +AW_H3_SID ,AW_H3_EHCI0 ,AW_H3_OHCI0 , AW_H3_EHCI1,@@ -114,6 +116,7 @@ typedef struct AwH3State {AwH3ClockCtlState ccu;AwCpuCfgState cpucfg;AwH3SysCtrlState sysctrl; +AwSidState sid;GICState gic;MemoryRegion sram_a1;MemoryRegion sram_a2;(quoted diff) +0
-0
b/include/hw/misc/allwinner-sid.hhw/arm/allwinner-h3.c static void allwinner_h3_realize(DeviceState *dev,
Quoted 99 lines
new file mode 100644
index 0000000000..4c1fa4762binclude/hw/misc/allwinner-sid.h new file +17
-0@@ -0,0 +1,60 @@ +/* +* Allwinner Security ID emulation +* +* Copyright (C) 2019 Niek Linnenbank <[email protected]> +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/ .
+ */include/hw/misc/allwinner-sid.h new file +42
-0+ +#ifndef HW_MISC_ALLWINNER_SID_H +#define HW_MISC_ALLWINNER_SID_H + +#include "qom/object.h" +#include "hw/sysbus.h" +#include "qemu/uuid.h" + +/** +* Object model +* @{ +*/ + +#define TYPE_AW_SID "allwinner-sid" +#define AW_SID (obj) \ + OBJECT_CHECK(AwSidState, (obj), TYPE_AW_SID) + +/** @} */ + +/** +* Allwinner Security ID object instance state +*/ +typedef struct AwSidState { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ + +/** Maps I/O registers in physical memory */ +MemoryRegion iomem; + +/** Control register defines how and what to read */ +uint32_t control; + +/** RdKey register contains the data retrieved by the device */ +uint32_t rdkey; + +/** Stores the emulated device identifier */ +QemuUUID identifier; + +}AwSidState ; + +#endif /* HW_MISC_ALLWINNER_SID_H */ hw/arm/allwinner-h3.c +6
-1@@ -38,6 +38,7 @@ const hwaddr allwinner_h3_memmap[] = { [AW_H3_SRAM_A2] = 0x00044000, [AW_H3_SRAM_C] = 0x00010000, [AW_H3_SYSCTRL] = 0x01c00000, + [AW_H3_SID] = 0x01c14000, [AW_H3_EHCI0] = 0x01c1a000, [AW_H3_OHCI0] = 0x01c1a400, [AW_H3_EHCI1] = 0x01c1b000,@@ -78,7 +79,6 @@ struct AwH3Unimplemented { { "mmc0", 0x01c0f000, 4 * KiB }, { "mmc1", 0x01c10000, 4 * KiB }, { "mmc2", 0x01c11000, 4 * KiB }, - { "sid", 0x01c14000, 1 * KiB }, { "crypto", 0x01c15000, 4 * KiB }, { "msgbox", 0x01c17000, 4 * KiB }, { "spinlock", 0x01c18000, 4 * KiB },@@ -198,6 +198,11 @@ static void allwinner_h3_init(Object *obj)sysbus_init_child_obj (obj,"cpucfg" , &s->cpucfg,sizeof (s->cpucfg),TYPE_AW_CPUCFG ); + +sysbus_init_child_obj (obj,"sid" , &s->sid,sizeof (s->sid), +TYPE_AW_SID ); +object_property_add_alias (obj,"identifier" ,OBJECT (&s->sid), +"identifier" , &error_abort); }static void allwinner_h3_realize (DeviceState *dev,Error **errp)@@ -315,6 +320,10 @@ static void allwinner_h3_realize(DeviceState *dev,Error **errp)
hw/arm/allwinner-h3.c static void allwinner_h3_realize(DeviceState *dev, · line 321
Quoted 2 lines
hw/arm/allwinner-h3.c +0
-0qdev_init_nofail (DEVICE (&s->cpucfg)); sysbus_mmio_map(SYS_BUS_DEVICE(&s->cpucfg), 0,s->memmap[AW_H3_CPUCFG]);
Quoted 13 lines
hw/arm/allwinner-h3.c +4
-0+/* Security Identifier */ +qdev_init_nofail (DEVICE (&s->sid)); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->sid),0 , s->memmap[AW_H3_SID ]); +/* Universal Serial Bus */ sysbus_create_simple(TYPE_AW_H3_EHCI, s->memmap[AW_H3_EHCI0], qdev_get_gpio_in(DEVICE(&s->gic),hw/arm/orangepi.c +0
-0hw/arm/orangepi.c static void orangepi_init(MachineState *machine) · line 68
Quoted 4 lines
hw/arm/orangepi.c +1
-0@@ -65,6 +65,15 @@ static void orangepi_init(MachineState *machine)object_property_set_int (OBJECT (h3),24 *1000 *1000 ,"clk1-freq" , &error_abort); +/* Setup SID properties. Currently using a default fixed SID identifier. */
hw/arm/orangepi.c static void orangepi_init(MachineState *machine) · line 76
Quoted 8 lines
hw/arm/orangepi.c +8
-0+if (qemu_uuid_is_null (&h3->sid.identifier)) { +qdev_prop_set_string (DEVICE (h3),"identifier" , +"02c00081-1111-2222-3333-000044556677" ); + }else if (ldl_be_p (&h3->sid.identifier.data[0 ]) !=0x02c00081 ) { +fprintf (stderr,"WARNING: Security Identifier value does " +"not include H3 prefix\n" ); + } +Quoted 2 lines
Should this be a
LOG_GUEST_ERROR?Hi Alex,
Quoted 8 lines
This warning is basically to inform the user when overriding the SID identifier manually with -global,
that the identifier specified by the user does not contain the H3 SoC prefix. Real hardware always has
that particular prefix in its identifier value, and it might be so that software running on the emulated hardware
depends on it. So its basically a proactive warning to inform the user, and not an error of wrong behavior caused by the guest software.
Ahh in that case I would suggest warn_report instead of a plain printf. That should come out in all the right places but won't error out like error_report.
Quoted 10 lines
Quoted 7 lines
Otherwise:
Reviewed-by Alex Bennée <[email protected]>Assuming the above explanation is sufficient, I'll add your review tag, thanks!
Using warn_report instead will be fine.
Signature · 1 line
Alex Bennée
Re: [PATCH v7 07/18] hw/arm/allwinner: add Security Identifier device
Quoted 209 lines · Alex Bennée
Quoted 1 line · Niek Linnenbank
On Wed, Mar 11, 2020 at 2:53 PM Alex Bennée <[email protected]>
Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 1 line · Niek Linnenbank
The Security Identifier device found in various Allwinner System on
Chip
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
designs gives applications a per-board unique identifier. This commit adds support for the Allwinner Security Identifier using a 128-bit UUID value as input.
Signed-off-by Niek Linnenbank <[email protected]>--- include/hw/arm/allwinner-h3.h | 3 + include/hw/misc/allwinner-sid.h | 60 ++++++++++++ hw/arm/allwinner-h3.c | 11 ++- hw/arm/orangepi.c | 9 ++ hw/misc/allwinner-sid.c | 168++++++++++++++++++++++++++++++++
Quoted 37 lines
Quoted 37 lines
Review
Quoted 7 lines
hw/misc/Makefile.objs | 1 + hw/misc/trace-events | 4 + 7 files changed, 255 insertions(+), 1 deletion(-) create mode 100644 include/hw/misc/allwinner-sid.h create mode 100644 hw/misc/allwinner-sid.c(quoted diff) +0
-0
b/include/hw/arm/allwinner-h3.hReview
Quoted 28 lines
index
dc729176ab..85416d9d64100644include/hw/arm/allwinner-h3.h +3
-0@@ -42,6 +42,7 @@#include "hw/misc/allwinner-h3-ccu.h" #include "hw/misc/allwinner-cpucfg.h" #include "hw/misc/allwinner-h3-sysctrl.h" +#include "hw/misc/allwinner-sid.h" #include "target/arm/cpu.h" /** @@ -59,6 +60,7 @@ enum {AW_H3_SRAM_A2 ,AW_H3_SRAM_C ,AW_H3_SYSCTRL , +AW_H3_SID ,AW_H3_EHCI0 ,AW_H3_OHCI0 , AW_H3_EHCI1,@@ -114,6 +116,7 @@ typedef struct AwH3State {AwH3ClockCtlState ccu;AwCpuCfgState cpucfg;AwH3SysCtrlState sysctrl; +AwSidState sid;GICState gic;MemoryRegion sram_a1;MemoryRegion sram_a2;(quoted diff) +0
-0
b/include/hw/misc/allwinner-sid.hQuoted 11 lines
Quoted 11 lines
include/hw/misc/allwinner-sid.h line 6
Quoted 11 lines
new file mode 100644
index 0000000000..4c1fa4762binclude/hw/misc/allwinner-sid.h new file +6
-0@@ -0,0 +1,60 @@ +/* +* Allwinner Security ID emulation +* +* Copyright (C) 2019 Niek Linnenbank <[email protected]> +* +* This program is free software: you can redistribute it and/or modify
Quoted 1 line
Quoted 1 line
include/hw/misc/allwinner-sid.h line 7
Quoted 1 line
include/hw/misc/allwinner-sid.h new file +1
-0+* it under the terms of the GNU General Public License as published by
Quoted 10 lines
Quoted 10 lines
include/hw/misc/allwinner-sid.h
Quoted 10 lines
include/hw/misc/allwinner-sid.h new file +10
-0+* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see < Quoted 66 lines
Quoted 66 lines
Quoted 66 lines
.
+ */include/hw/misc/allwinner-sid.h new file +42
-0+ +#ifndef HW_MISC_ALLWINNER_SID_H +#define HW_MISC_ALLWINNER_SID_H + +#include "qom/object.h" +#include "hw/sysbus.h" +#include "qemu/uuid.h" + +/** +* Object model +* @{ +*/ + +#define TYPE_AW_SID "allwinner-sid" +#define AW_SID (obj) \ + OBJECT_CHECK(AwSidState, (obj), TYPE_AW_SID) + +/** @} */ + +/** +* Allwinner Security ID object instance state +*/ +typedef struct AwSidState { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ + +/** Maps I/O registers in physical memory */ +MemoryRegion iomem; + +/** Control register defines how and what to read */ +uint32_t control; + +/** RdKey register contains the data retrieved by the device */ +uint32_t rdkey; + +/** Stores the emulated device identifier */ +QemuUUID identifier; + +}AwSidState ; + +#endif /* HW_MISC_ALLWINNER_SID_H */ hw/arm/allwinner-h3.c +1
-1@@ -38,6 +38,7 @@ const hwaddr allwinner_h3_memmap[] = { [AW_H3_SRAM_A2] = 0x00044000, [AW_H3_SRAM_C] = 0x00010000, [AW_H3_SYSCTRL] = 0x01c00000, + [AW_H3_SID] = 0x01c14000, [AW_H3_EHCI0] = 0x01c1a000, [AW_H3_OHCI0] = 0x01c1a400, [AW_H3_EHCI1] = 0x01c1b000,@@ -78,7 +79,6 @@ struct AwH3Unimplemented { { "mmc0", 0x01c0f000, 4 * KiB }, { "mmc1", 0x01c10000, 4 * KiB }, { "mmc2", 0x01c11000, 4 * KiB }, - { "sid", 0x01c14000, 1 * KiB }, { "crypto", 0x01c15000, 4 * KiB }, { "msgbox", 0x01c17000, 4 * KiB }, { "spinlock", 0x01c18000, 4 * KiB },@@ -198,6 +198,11 @@ static void allwinner_h3_init(Object *obj)Quoted 1 line
Quoted 1 line
hw/arm/allwinner-h3.c static void allwinner_h3_init(Object *obj) · line 199
Quoted 1 line
hw/arm/allwinner-h3.c +0
-0sysbus_init_child_obj(obj, "cpucfg", &s->cpucfg,
sizeof(s->cpucfg),Quoted 10 lines
Quoted 10 lines
hw/arm/allwinner-h3.c static void allwinner_h3_realize(DeviceState
Quoted 10 lines
hw/arm/allwinner-h3.c +5
-0TYPE_AW_CPUCFG); + +sysbus_init_child_obj (obj,"sid" , &s->sid,sizeof (s->sid), +TYPE_AW_SID ); +object_property_add_alias (obj,"identifier" ,OBJECT (&s->sid), +"identifier" , &error_abort); }static void allwinner_h3_realize (DeviceState *dev,Error **errp)@@ -315,6 +320,10 @@ static void allwinner_h3_realize(DeviceState*dev,
Quoted 8 lines
Quoted 8 lines
Error **errp)
hw/arm/allwinner-h3.c static void allwinner_h3_realize(DeviceState · line 321
Quoted 2 lines
hw/arm/allwinner-h3.c +0
-0qdev_init_nofail (DEVICE (&s->cpucfg)); sysbus_mmio_map(SYS_BUS_DEVICE(&s->cpucfg), 0,s->memmap[AW_H3_CPUCFG]);
Quoted 4 lines
hw/arm/allwinner-h3.c +3
-0+/* Security Identifier */ +qdev_init_nofail (DEVICE (&s->sid)); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->sid), 0,s->memmap[AW_H3_SID]);
Quoted 10 lines
Quoted 10 lines
hw/arm/orangepi.c static void orangepi_init(MachineState *machine) · line 65
Quoted 10 lines
hw/arm/allwinner-h3.c +1
-0+/* Universal Serial Bus */ sysbus_create_simple(TYPE_AW_H3_EHCI, s->memmap[AW_H3_EHCI0], qdev_get_gpio_in(DEVICE(&s->gic),hw/arm/orangepi.c +0
-0@@ -65,6 +65,15 @@ static void orangepi_init(MachineState *machine) object_property_set_int(OBJECT(h3), 24 * 1000 * 1000,"clk1-freq",
Quoted 18 lines
Quoted 13 lines
hw/arm/orangepi.c static void orangepi_init(MachineState *machine)
Quoted 3 lines
hw/arm/orangepi.c +1
-0&error_abort); +/* Setup SID properties. Currently using a default fixed SID identifier. */
hw/arm/orangepi.c static void orangepi_init(MachineState *machine) · line 76
Quoted 8 lines
hw/arm/orangepi.c +8
-0+if (qemu_uuid_is_null (&h3->sid.identifier)) { +qdev_prop_set_string (DEVICE (h3),"identifier" , +"02c00081-1111-2222-3333-000044556677" ); + }else if (ldl_be_p (&h3->sid.identifier.data[0 ]) !=0x02c00081 ) { +fprintf (stderr,"WARNING: Security Identifier value does " +"not include H3 prefix\n" ); + } +Quoted 2 lines
Should this be a
LOG_GUEST_ERROR?Hi Alex,
Quoted 7 lines
This warning is basically to inform the user when overriding the SID identifier manually with -global,
that the identifier specified by the user does not contain the H3 SoC prefix. Real hardware always has
that particular prefix in its identifier value, and it might be so that software running on the emulated hardware
depends on it. So its basically a proactive warning to inform the user,
Quoted 7 lines
and
Quoted 1 line
not an error of wrong behavior caused by the guest software.
Ahh in that case I would suggest
warn_reportinstead of a plain printf. That should come out in all the right places but won't error out likeerror_report.
OK, that makes sense. I wasnt' aware of warn_report. Sure, I'll change it to use warn_report instead.
Regards,
Niek
Quoted 16 lines
Quoted 10 lines
Quoted 7 lines
Otherwise:
Reviewed-by Alex Bennée <[email protected]>Assuming the above explanation is sufficient, I'll add your review tag, thanks!
Using
warn_reportinstead will be fine.--
Alex Bennée
Signature · 1 line
Niek Linnenbank
PATCH v7 8/18 hw/arm/allwinner: add SD/MMC host controller
In reply to Niek LinnenbankThe Allwinner System on Chip families sun4i and above contain an integrated storage controller for Secure Digital (SD) and Multi Media Card (MMC) interfaces. This commit adds support for the Allwinner SD/MMC storage controller with the following emulated features:
* DMA transfers
* Direct FIFO I/O
* Short/Long format command responses
* Auto-Stop command (CMD12)
* Insert & remove card detection
The following boards are extended with the SD host controller:
* Cubieboard (hw/arm/cubieboard.c)
* Orange Pi PC (hw/arm/orangepi.c)
--- include/hw/arm/allwinner-a10.h | 2 + include/hw/arm/allwinner-h3.h | 3 + include/hw/sd/allwinner-sdhost.h | 135 +++++ hw/arm/allwinner-a10.c | 11 + hw/arm/allwinner-h3.c | 15 +- hw/arm/cubieboard.c | 15 + hw/arm/orangepi.c | 16 + hw/sd/allwinner-sdhost.c | 854 +++++++++++++++++++++++++++++++ hw/arm/Kconfig | 1 + hw/sd/Makefile.objs | 1 + hw/sd/trace-events | 7 + 11 files changed, 1059 insertions(+), 1 deletion(-) create mode 100644 include/hw/sd/allwinner-sdhost.h create mode 100644 hw/sd/allwinner-sdhost.c
include/hw/arm/allwinner-a10.h +2 -0
@@ -7,6 +7,7 @@#include "hw/timer/allwinner-a10-pit.h" #include "hw/intc/allwinner-a10-pic.h" #include "hw/net/allwinner_emac.h" +#include "hw/sd/allwinner-sdhost.h" #include "hw/ide/ahci.h" #include "hw/usb/hcd-ohci.h" #include "hw/usb/hcd-ehci.h"
@@ -31,6 +32,7 @@ typedef struct AwA10State {AwA10PICState intc;AwEmacState emac;AllwinnerAHCIState sata; +AwSdHostState mmc0;MemoryRegion sram_a;EHCISysBusState ehci[AW_A10_NUM_USB ];OHCISysBusState ohci[AW_A10_NUM_USB ];
include/hw/arm/allwinner-h3.h +3 -0
@@ -43,6 +43,7 @@#include "hw/misc/allwinner-cpucfg.h" #include "hw/misc/allwinner-h3-sysctrl.h" #include "hw/misc/allwinner-sid.h" +#include "hw/sd/allwinner-sdhost.h" #include "target/arm/cpu.h" /**
@@ -60,6 +61,7 @@ enum {AW_H3_SRAM_A2 ,AW_H3_SRAM_C ,AW_H3_SYSCTRL , +AW_H3_MMC0 ,AW_H3_SID ,AW_H3_EHCI0 , AW_H3_OHCI0,
@@ -117,6 +119,7 @@ typedef struct AwH3State {AwCpuCfgState cpucfg;AwH3SysCtrlState sysctrl;AwSidState sid; +AwSdHostState mmc0;GICState gic;MemoryRegion sram_a1;MemoryRegion sram_a2;
include/hw/sd/allwinner-sdhost.h new file +135 -0
135 lines not on this page · raw message
hw/arm/allwinner-a10.c +11 -0
@@ -27,6 +27,7 @@#include "hw/boards.h" #include "hw/usb/hcd-ohci.h" +#define AW_A10_MMC0_BASE 0x01c0f000#define AW_A10_PIC_REG_BASE 0x01c20400#define AW_A10_PIT_REG_BASE 0x01c20c00#define AW_A10_UART0_REG_BASE 0x01c28000
@@ -64,6 +65,9 @@ static void aw_a10_init(Object *obj) sizeof(s->ohci[i]), TYPE_SYSBUS_OHCI); } } + +sysbus_init_child_obj (obj,"mmc0" , &s->mmc0,sizeof (s->mmc0), +TYPE_AW_SDHOST_SUN4I ); }static void aw_a10_realize (DeviceState *dev,Error **errp)
@@ -164,6 +168,13 @@ static void aw_a10_realize(DeviceState *dev, Error **errp) qdev_get_gpio_in(dev, 64 + i)); } } + +/* SD/MMC */ +qdev_init_nofail (DEVICE (&s->mmc0)); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->mmc0),0 ,AW_A10_MMC0_BASE ); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->mmc0),0 ,qdev_get_gpio_in (dev,32 )); +object_property_add_alias (OBJECT (s),"sd-bus" ,OBJECT (&s->mmc0), +"sd-bus" , &error_abort); }static void aw_a10_class_init (ObjectClass *oc,void *data)
hw/arm/allwinner-h3.c +14 -1
@@ -38,6 +38,7 @@ const hwaddr allwinner_h3_memmap[] = { [AW_H3_SRAM_A2] = 0x00044000, [AW_H3_SRAM_C] = 0x00010000, [AW_H3_SYSCTRL] = 0x01c00000, + [AW_H3_MMC0] = 0x01c0f000, [AW_H3_SID] = 0x01c14000, [AW_H3_EHCI0] = 0x01c1a000, [AW_H3_OHCI0] = 0x01c1a400,
@@ -76,7 +77,6 @@ struct AwH3Unimplemented { { "lcd0", 0x01c0c000, 4 * KiB }, { "lcd1", 0x01c0d000, 4 * KiB }, { "ve", 0x01c0e000, 4 * KiB }, - { "mmc0", 0x01c0f000, 4 * KiB }, { "mmc1", 0x01c10000, 4 * KiB }, { "mmc2", 0x01c11000, 4 * KiB }, { "crypto", 0x01c15000, 4 * KiB },
@@ -153,6 +153,7 @@ enum {AW_H3_GIC_SPI_UART3 =3 ,AW_H3_GIC_SPI_TIMER0 =18 ,AW_H3_GIC_SPI_TIMER1 =19 , +AW_H3_GIC_SPI_MMC0 =60 ,AW_H3_GIC_SPI_EHCI0 =72 ,AW_H3_GIC_SPI_OHCI0 =73 , AW_H3_GIC_SPI_EHCI1 = 74,
@@ -203,6 +204,9 @@ static void allwinner_h3_init(Object *obj) TYPE_AW_SID);object_property_add_alias (obj,"identifier" ,OBJECT (&s->sid),"identifier" , &error_abort); + +sysbus_init_child_obj (obj,"mmc0" , &s->mmc0,sizeof (s->mmc0), +TYPE_AW_SDHOST_SUN5I ); }static void allwinner_h3_realize (DeviceState *dev,Error **errp)
@@ -324,6 +328,15 @@ static void allwinner_h3_realize(DeviceState *dev, Error **errp)qdev_init_nofail (DEVICE (&s->sid));sysbus_mmio_map (SYS_BUS_DEVICE (&s->sid),0 , s->memmap[AW_H3_SID ]); +/* SD/MMC */ +qdev_init_nofail (DEVICE (&s->mmc0)); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->mmc0),0 , s->memmap[AW_H3_MMC0 ]); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->mmc0),0 , +qdev_get_gpio_in (DEVICE (&s->gic),AW_H3_GIC_SPI_MMC0 )); + +object_property_add_alias (OBJECT (s),"sd-bus" ,OBJECT (&s->mmc0), +"sd-bus" , &error_abort); +/* Universal Serial Bus */ sysbus_create_simple(TYPE_AW_H3_EHCI, s->memmap[AW_H3_EHCI0], qdev_get_gpio_in(DEVICE(&s->gic),
hw/arm/cubieboard.c +15 -0
@@ -22,6 +22,7 @@#include "sysemu/sysemu.h" #include "hw/sysbus.h" #include "hw/boards.h" +#include "hw/qdev-properties.h" #include "hw/arm/allwinner-a10.h" static struct arm_boot_info cubieboard_binfo = {
@@ -33,6 +34,10 @@ static void cubieboard_init(MachineState *machine) {AwA10State *a10;Error *err =NULL ; +DriveInfo *di; +BlockBackend *blk; +BusState *bus; +DeviceState *carddev;/* BIOS is not supported by this board */ if (bios_name) {
@@ -79,6 +84,16 @@ static void cubieboard_init(MachineState *machine)exit (1 ); } +/* Retrieve SD bus */ + di =drive_get_next (IF_SD ); + blk = di ?blk_by_legacy_dinfo (di) :NULL ; + bus =qdev_get_child_bus (DEVICE (a10),"sd-bus" ); + +/* Plug in SD card */ + carddev =qdev_create (bus,TYPE_SD_CARD ); +qdev_prop_set_drive (carddev,"drive" , blk, &error_fatal); +object_property_set_bool (OBJECT (carddev), true,"realized" , &error_fatal); +memory_region_add_subregion (get_system_memory (),AW_A10_SDRAM_BASE , machine->ram);
hw/arm/orangepi.c +16 -0
@@ -35,6 +35,10 @@ static struct arm_boot_info orangepi_binfo = {static void orangepi_init (MachineState *machine) {AwH3State *h3; +DriveInfo *di; +BlockBackend *blk; +BusState *bus; +DeviceState *carddev;/* BIOS is not supported by this board */ if (bios_name) {
@@ -77,6 +81,16 @@ static void orangepi_init(MachineState *machine)/* Mark H3 object realized */ object_property_set_bool (OBJECT (h3), true,"realized" , &error_abort); +/* Retrieve SD bus */ + di =drive_get_next (IF_SD ); + blk = di ?blk_by_legacy_dinfo (di) :NULL ; + bus =qdev_get_child_bus (DEVICE (h3),"sd-bus" ); + +/* Plug in SD card */ + carddev =qdev_create (bus,TYPE_SD_CARD ); +qdev_prop_set_drive (carddev,"drive" , blk, &error_fatal); +object_property_set_bool (OBJECT (carddev), true,"realized" , &error_fatal); +/* SDRAM */ memory_region_add_subregion (get_system_memory (), h3->memmap[AW_H3_SDRAM ], machine->ram);
@@ -90,6 +104,8 @@ static void orangepi_machine_init(MachineClass *mc) { mc->desc ="Orange Pi PC" ; mc->init = orangepi_init; + mc->block_default_type =IF_SD ; + mc->units_per_default_bus =1 ; mc->min_cpus =AW_H3_NUM_CPUS ; mc->max_cpus =AW_H3_NUM_CPUS ; mc->default_cpus =AW_H3_NUM_CPUS ;
hw/sd/allwinner-sdhost.c new file +854 -0
854 lines not on this page · raw message
hw/arm/Kconfig +1 -0
@@ -306,6 +306,7 @@ config ALLWINNER_H3 select UNIMP select USB_OHCI select USB_EHCI_SYSBUS + select SD config RASPI bool
hw/sd/Makefile.objs +1 -0
@@ -4,6 +4,7 @@ common-obj-$(CONFIG_SD) += sd.o core.o sdmmc-internal.o common-obj-$(CONFIG_SDHCI) += sdhci.o common-obj-$(CONFIG_SDHCI_PCI) += sdhci-pci.o +common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-sdhost.o common-obj-$(CONFIG_MILKYMIST) += milkymist-memcard.o common-obj-$(CONFIG_OMAP) += omap_mmc.o common-obj-$(CONFIG_PXA2XX) += pxa2xx_mmci.o
hw/sd/trace-events +7 -0
@@ -1,5 +1,12 @@ # See docs/devel/tracing.txt for syntax documentation. +# allwinner-sdhost.c +allwinner_sdhost_set_inserted(bool inserted) "inserted %u" +allwinner_sdhost_process_desc(uint64_t desc_addr, uint32_t desc_size, bool is_write, uint32_t max_bytes) "desc_addr 0x%" PRIx64 " desc_size %" PRIu32 " is_write %u max_bytes %" PRIu32 +allwinner_sdhost_read(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 +allwinner_sdhost_write(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 +allwinner_sdhost_update_irq(uint32_t irq) "IRQ bits 0x%" PRIx32 + # bcm2835_sdhost.c bcm2835_sdhost_read(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" bcm2835_sdhost_write(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
Signature · 1 line
2.17.1
PATCH v7 9/18 hw/arm/allwinner-h3: add EMAC ethernet device
In reply to Niek LinnenbankThe Allwinner Sun8i System on Chip family includes an Ethernet MAC (EMAC) which provides 10M/100M/1000M Ethernet connectivity. This commit adds support for the Allwinner EMAC from the Sun8i family (H2+, H3, A33, etc), including emulation for the following functionality:
* DMA transfers
* MII interface
* Transmit CRC calculation
--- include/hw/arm/allwinner-h3.h | 3 + include/hw/net/allwinner-sun8i-emac.h | 99 +++ hw/arm/allwinner-h3.c | 16 +- hw/arm/orangepi.c | 3 + hw/net/allwinner-sun8i-emac.c | 871 ++++++++++++++++++++++++++ hw/arm/Kconfig | 1 + hw/net/Kconfig | 3 + hw/net/Makefile.objs | 1 + hw/net/trace-events | 10 + 9 files changed, 1006 insertions(+), 1 deletion(-) create mode 100644 include/hw/net/allwinner-sun8i-emac.h create mode 100644 hw/net/allwinner-sun8i-emac.c
include/hw/arm/allwinner-h3.h +3 -0
@@ -44,6 +44,7 @@#include "hw/misc/allwinner-h3-sysctrl.h" #include "hw/misc/allwinner-sid.h" #include "hw/sd/allwinner-sdhost.h" +#include "hw/net/allwinner-sun8i-emac.h" #include "target/arm/cpu.h" /**
@@ -77,6 +78,7 @@ enum {AW_H3_UART1 ,AW_H3_UART2 ,AW_H3_UART3 , +AW_H3_EMAC ,AW_H3_GIC_DIST ,AW_H3_GIC_CPU , AW_H3_GIC_HYP,
@@ -120,6 +122,7 @@ typedef struct AwH3State {AwH3SysCtrlState sysctrl;AwSidState sid;AwSdHostState mmc0; +AwSun8iEmacState emac;GICState gic;MemoryRegion sram_a1;MemoryRegion sram_a2;
include/hw/net/allwinner-sun8i-emac.h new file +99 -0
99 lines not on this page · raw message
hw/arm/allwinner-h3.c +15 -1
@@ -54,6 +54,7 @@ const hwaddr allwinner_h3_memmap[] = { [AW_H3_UART1] = 0x01c28400, [AW_H3_UART2] = 0x01c28800, [AW_H3_UART3] = 0x01c28c00, + [AW_H3_EMAC] = 0x01c30000, [AW_H3_GIC_DIST] = 0x01c81000, [AW_H3_GIC_CPU] = 0x01c82000, [AW_H3_GIC_HYP] = 0x01c84000,
@@ -106,7 +107,6 @@ struct AwH3Unimplemented { { "twi1", 0x01c2b000, 1 * KiB }, { "twi2", 0x01c2b400, 1 * KiB }, { "scr", 0x01c2c400, 1 * KiB }, - { "emac", 0x01c30000, 64 * KiB }, { "gpu", 0x01c40000, 64 * KiB }, { "hstmr", 0x01c60000, 4 * KiB }, { "dramcom", 0x01c62000, 4 * KiB },
@@ -162,6 +162,7 @@ enum {AW_H3_GIC_SPI_OHCI2 =77 ,AW_H3_GIC_SPI_EHCI3 =78 ,AW_H3_GIC_SPI_OHCI3 =79 , + AW_H3_GIC_SPI_EMAC = 82 };/* Allwinner H3 general constants */
@@ -207,6 +208,9 @@ static void allwinner_h3_init(Object *obj)sysbus_init_child_obj (obj,"mmc0" , &s->mmc0,sizeof (s->mmc0),TYPE_AW_SDHOST_SUN5I ); + +sysbus_init_child_obj (obj,"emac" , &s->emac,sizeof (s->emac), +TYPE_AW_SUN8I_EMAC ); }static void allwinner_h3_realize (DeviceState *dev,Error **errp)
@@ -337,6 +341,16 @@ static void allwinner_h3_realize(DeviceState *dev, Error **errp)object_property_add_alias (OBJECT (s),"sd-bus" ,OBJECT (&s->mmc0),"sd-bus" , &error_abort); +/* EMAC */ +if (nd_table[0 ].used) { +qemu_check_nic_model (&nd_table[0 ],TYPE_AW_SUN8I_EMAC ); +qdev_set_nic_properties (DEVICE (&s->emac), &nd_table[0 ]); + } +qdev_init_nofail (DEVICE (&s->emac)); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->emac),0 , s->memmap[AW_H3_EMAC ]); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->emac),0 , +qdev_get_gpio_in (DEVICE (&s->gic),AW_H3_GIC_SPI_EMAC )); +/* Universal Serial Bus */ sysbus_create_simple(TYPE_AW_H3_EHCI, s->memmap[AW_H3_EHCI0], qdev_get_gpio_in(DEVICE(&s->gic),
hw/arm/orangepi.c +3 -0
@@ -78,6 +78,9 @@ static void orangepi_init(MachineState *machine) "not include H3 prefix\n"); } +/* Setup EMAC properties */ +object_property_set_int (OBJECT (&h3->emac),1 ,"phy-addr" , &error_abort); +/* Mark H3 object realized */ object_property_set_bool (OBJECT (h3), true,"realized" , &error_abort);
hw/net/allwinner-sun8i-emac.c new file +871 -0
871 lines not on this page · raw message
hw/arm/Kconfig +1 -0
@@ -300,6 +300,7 @@ config ALLWINNER_A10 config ALLWINNER_H3 bool select ALLWINNER_A10_PIT + select ALLWINNER_SUN8I_EMAC select SERIAL select ARM_TIMER select ARM_GIC
hw/net/Kconfig +3 -0
@@ -79,6 +79,9 @@ config MIPSNET config ALLWINNER_EMAC bool +config ALLWINNER_SUN8I_EMAC + bool + config IMX_FEC bool
hw/net/Makefile.objs +1 -0
@@ -23,6 +23,7 @@ common-obj-$(CONFIG_XGMAC) += xgmac.o common-obj-$(CONFIG_MIPSNET) += mipsnet.o common-obj-$(CONFIG_XILINX_AXI) += xilinx_axienet.o common-obj-$(CONFIG_ALLWINNER_EMAC) += allwinner_emac.o +common-obj-$(CONFIG_ALLWINNER_SUN8I_EMAC) += allwinner-sun8i-emac.o common-obj-$(CONFIG_IMX_FEC) += imx_fec.o common-obj-$(CONFIG_CADENCE) += cadence_gem.o
hw/net/trace-events +10 -0
@@ -1,5 +1,15 @@ # See docs/devel/tracing.txt for syntax documentation. +# allwinner-sun8i-emac.c +allwinner_sun8i_emac_mii_write_reg(uint32_t reg, uint32_t value) "MII write: reg=0x%" PRIx32 " value=0x%" PRIx32 +allwinner_sun8i_emac_mii_read_reg(uint32_t reg, uint32_t value) "MII read: reg=0x%" PRIx32 " value=0x%" PRIx32 +allwinner_sun8i_emac_receive(uint32_t desc, uint32_t paddr, uint32_t bytes) "RX packet: desc=0x%" PRIx32 " paddr=0x%" PRIx32 " bytes=%" PRIu32 +allwinner_sun8i_emac_transmit(uint32_t desc, uint32_t paddr, uint32_t bytes) "TX packet: desc=0x%" PRIx32 " paddr=0x%" PRIx32 " bytes=%" PRIu32 +allwinner_sun8i_emac_reset(void) "HW reset" +allwinner_sun8i_emac_set_link(bool active) "Set link: active=%u" +allwinner_sun8i_emac_read(uint64_t offset, uint64_t val) "MMIO read: offset=0x%" PRIx64 " value=0x%" PRIx64 +allwinner_sun8i_emac_write(uint64_t offset, uint64_t val) "MMIO write: offset=0x%" PRIx64 " value=0x%" PRIx64 + # etraxfs_eth.c mdio_phy_read(int regnum, uint16_t value) "read phy_reg:%d value:0x%04x" mdio_phy_write(int regnum, uint16_t value) "write phy_reg:%d value:0x%04x"
Signature · 1 line
2.17.1
Re: [PATCH v7 09/18] hw/arm/allwinner-h3: add EMAC ethernet device
Quoted 10 lines · Niek Linnenbank
The Allwinner Sun8i System on Chip family includes an Ethernet MAC (EMAC) which provides 10M/100M/1000M Ethernet connectivity. This commit adds support for the Allwinner EMAC from the Sun8i family (H2+, H3, A33, etc), including emulation for the following functionality:
* DMA transfers
* MII interface
* Transmit CRC calculationSigned-off-by Niek Linnenbank <[email protected]>
Quoted 1,151 lines
--- include/hw/arm/allwinner-h3.h | 3 + include/hw/net/allwinner-sun8i-emac.h | 99 +++ hw/arm/allwinner-h3.c | 16 +- hw/arm/orangepi.c | 3 + hw/net/allwinner-sun8i-emac.c | 871 ++++++++++++++++++++++++++ hw/arm/Kconfig | 1 + hw/net/Kconfig | 3 + hw/net/Makefile.objs | 1 + hw/net/trace-events | 10 + 9 files changed, 1006 insertions(+), 1 deletion(-) create mode 100644 include/hw/net/allwinner-sun8i-emac.h create mode 100644 hw/net/allwinner-sun8i-emac.cinclude/hw/arm/allwinner-h3.h +3
-0@@ -44,6 +44,7 @@#include "hw/misc/allwinner-h3-sysctrl.h" #include "hw/misc/allwinner-sid.h" #include "hw/sd/allwinner-sdhost.h" +#include "hw/net/allwinner-sun8i-emac.h" #include "target/arm/cpu.h" /** @@ -77,6 +78,7 @@ enum {AW_H3_UART1 ,AW_H3_UART2 ,AW_H3_UART3 , +AW_H3_EMAC ,AW_H3_GIC_DIST ,AW_H3_GIC_CPU , AW_H3_GIC_HYP,@@ -120,6 +122,7 @@ typedef struct AwH3State {AwH3SysCtrlState sysctrl;AwSidState sid;AwSdHostState mmc0; +AwSun8iEmacState emac;GICState gic;MemoryRegion sram_a1;MemoryRegion sram_a2;include/hw/net/allwinner-sun8i-emac.h new file +99
-0@@ -0,0 +1,99 @@ +/* +* Allwinner Sun8i Ethernet MAC emulation +* +* Copyright (C) 2019 Niek Linnenbank <[email protected]> +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef HW_NET_ALLWINNER_SUN8I_EMAC_H +#define HW_NET_ALLWINNER_SUN8I_EMAC_H + +#include "qom/object.h" +#include "net/net.h" +#include "hw/sysbus.h" + +/** +* Object model +* @{ +*/ + +#define TYPE_AW_SUN8I_EMAC "allwinner-sun8i-emac" +#define AW_SUN8I_EMAC (obj) \ + OBJECT_CHECK(AwSun8iEmacState, (obj), TYPE_AW_SUN8I_EMAC) + +/** @} */ + +/** +* Allwinner Sun8i EMAC object instance state +*/ +typedef struct AwSun8iEmacState { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ + +/** Maps I/O registers in physical memory */ +MemoryRegion iomem; + +/** Interrupt output signal to notify CPU */ +qemu_irq irq; + +/** Generic Network Interface Controller (NIC) for networking API */ +NICState *nic; + +/** Generic Network Interface Controller (NIC) configuration */ +NICConf conf; + +/** +* @name Media Independent Interface (MII) +* @{ +*/ + +uint8_t mii_phy_addr;/**< PHY address */ +uint32_t mii_cr;/**< Control */ +uint32_t mii_st;/**< Status */ +uint32_t mii_adv;/**< Advertised Abilities */ + +/** @} */ + +/** +* @name Hardware Registers +* @{ +*/ + +uint32_t basic_ctl0;/**< Basic Control 0 */ +uint32_t basic_ctl1;/**< Basic Control 1 */ +uint32_t int_en;/**< Interrupt Enable */ +uint32_t int_sta;/**< Interrupt Status */ +uint32_t frm_flt;/**< Receive Frame Filter */ + +uint32_t rx_ctl0;/**< Receive Control 0 */ +uint32_t rx_ctl1;/**< Receive Control 1 */ +uint32_t rx_desc_head;/**< Receive Descriptor List Address */ +uint32_t rx_desc_curr;/**< Current Receive Descriptor Address */ + +uint32_t tx_ctl0;/**< Transmit Control 0 */ +uint32_t tx_ctl1;/**< Transmit Control 1 */ +uint32_t tx_desc_head;/**< Transmit Descriptor List Address */ +uint32_t tx_desc_curr;/**< Current Transmit Descriptor Address */ +uint32_t tx_flowctl;/**< Transmit Flow Control */ + +uint32_t mii_cmd;/**< Management Interface Command */ +uint32_t mii_data;/**< Management Interface Data */ + +/** @} */ + +}AwSun8iEmacState ; + +#endif /* HW_NET_ALLWINNER_SUN8I_H */ hw/arm/allwinner-h3.c +15
-1@@ -54,6 +54,7 @@ const hwaddr allwinner_h3_memmap[] = { [AW_H3_UART1] = 0x01c28400, [AW_H3_UART2] = 0x01c28800, [AW_H3_UART3] = 0x01c28c00, + [AW_H3_EMAC] = 0x01c30000, [AW_H3_GIC_DIST] = 0x01c81000, [AW_H3_GIC_CPU] = 0x01c82000, [AW_H3_GIC_HYP] = 0x01c84000,@@ -106,7 +107,6 @@ struct AwH3Unimplemented { { "twi1", 0x01c2b000, 1 * KiB }, { "twi2", 0x01c2b400, 1 * KiB }, { "scr", 0x01c2c400, 1 * KiB }, - { "emac", 0x01c30000, 64 * KiB }, { "gpu", 0x01c40000, 64 * KiB }, { "hstmr", 0x01c60000, 4 * KiB }, { "dramcom", 0x01c62000, 4 * KiB },@@ -162,6 +162,7 @@ enum {AW_H3_GIC_SPI_OHCI2 =77 ,AW_H3_GIC_SPI_EHCI3 =78 ,AW_H3_GIC_SPI_OHCI3 =79 , + AW_H3_GIC_SPI_EMAC = 82 };/* Allwinner H3 general constants */ @@ -207,6 +208,9 @@ static void allwinner_h3_init(Object *obj)sysbus_init_child_obj (obj,"mmc0" , &s->mmc0,sizeof (s->mmc0),TYPE_AW_SDHOST_SUN5I ); + +sysbus_init_child_obj (obj,"emac" , &s->emac,sizeof (s->emac), +TYPE_AW_SUN8I_EMAC ); }static void allwinner_h3_realize (DeviceState *dev,Error **errp)@@ -337,6 +341,16 @@ static void allwinner_h3_realize(DeviceState *dev, Error **errp)object_property_add_alias (OBJECT (s),"sd-bus" ,OBJECT (&s->mmc0),"sd-bus" , &error_abort); +/* EMAC */ +if (nd_table[0 ].used) { +qemu_check_nic_model (&nd_table[0 ],TYPE_AW_SUN8I_EMAC ); +qdev_set_nic_properties (DEVICE (&s->emac), &nd_table[0 ]); + } +qdev_init_nofail (DEVICE (&s->emac)); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->emac),0 , s->memmap[AW_H3_EMAC ]); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->emac),0 , +qdev_get_gpio_in (DEVICE (&s->gic),AW_H3_GIC_SPI_EMAC )); +/* Universal Serial Bus */ sysbus_create_simple(TYPE_AW_H3_EHCI, s->memmap[AW_H3_EHCI0], qdev_get_gpio_in(DEVICE(&s->gic),hw/arm/orangepi.c +3
-0@@ -78,6 +78,9 @@ static void orangepi_init(MachineState *machine) "not include H3 prefix\n"); } +/* Setup EMAC properties */ +object_property_set_int (OBJECT (&h3->emac),1 ,"phy-addr" , &error_abort); +/* Mark H3 object realized */ object_property_set_bool (OBJECT (h3), true,"realized" , &error_abort);hw/net/allwinner-sun8i-emac.c new file +871
-0@@ -0,0 +1,871 @@ +/* +* Allwinner Sun8i Ethernet MAC emulation +* +* Copyright (C) 2019 Niek Linnenbank <[email protected]> +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "qemu/osdep.h" +#include "qemu/units.h" +#include "hw/sysbus.h" +#include "migration/vmstate.h" +#include "net/net.h" +#include "hw/irq.h" +#include "hw/qdev-properties.h" +#include "qemu/log.h" +#include "trace.h" +#include "net/checksum.h" +#include "qemu/module.h" +#include "exec/cpu-common.h" +#include "hw/net/allwinner-sun8i-emac.h" + +/* EMAC register offsets */ +enum { +REG_BASIC_CTL_0 =0x0000 ,/* Basic Control 0 */ +REG_BASIC_CTL_1 =0x0004 ,/* Basic Control 1 */ +REG_INT_STA =0x0008 ,/* Interrupt Status */ +REG_INT_EN =0x000C ,/* Interrupt Enable */ +REG_TX_CTL_0 =0x0010 ,/* Transmit Control 0 */ +REG_TX_CTL_1 =0x0014 ,/* Transmit Control 1 */ +REG_TX_FLOW_CTL =0x001C ,/* Transmit Flow Control */ +REG_TX_DMA_DESC_LIST =0x0020 ,/* Transmit Descriptor List Address */ +REG_RX_CTL_0 =0x0024 ,/* Receive Control 0 */ +REG_RX_CTL_1 =0x0028 ,/* Receive Control 1 */ +REG_RX_DMA_DESC_LIST =0x0034 ,/* Receive Descriptor List Address */ +REG_FRM_FLT =0x0038 ,/* Receive Frame Filter */ +REG_RX_HASH_0 =0x0040 ,/* Receive Hash Table 0 */ +REG_RX_HASH_1 =0x0044 ,/* Receive Hash Table 1 */ +REG_MII_CMD =0x0048 ,/* Management Interface Command */ +REG_MII_DATA =0x004C ,/* Management Interface Data */ +REG_ADDR_HIGH =0x0050 ,/* MAC Address High */ +REG_ADDR_LOW =0x0054 ,/* MAC Address Low */ +REG_TX_DMA_STA =0x00B0 ,/* Transmit DMA Status */ +REG_TX_CUR_DESC =0x00B4 ,/* Transmit Current Descriptor */ +REG_TX_CUR_BUF =0x00B8 ,/* Transmit Current Buffer */ +REG_RX_DMA_STA =0x00C0 ,/* Receive DMA Status */ +REG_RX_CUR_DESC =0x00C4 ,/* Receive Current Descriptor */ +REG_RX_CUR_BUF =0x00C8 ,/* Receive Current Buffer */ +REG_RGMII_STA =0x00D0 ,/* RGMII Status */ +}; + +/* EMAC register flags */ +enum { + BASIC_CTL0_100Mbps = (0b11 <<2 ), +BASIC_CTL0_FD = (1 <<0 ), +BASIC_CTL1_SOFTRST = (1 <<0 ), +}; + +enum { +INT_STA_RGMII_LINK = (1 <<16 ), +INT_STA_RX_EARLY = (1 <<13 ), +INT_STA_RX_OVERFLOW = (1 <<12 ), +INT_STA_RX_TIMEOUT = (1 <<11 ), +INT_STA_RX_DMA_STOP = (1 <<10 ), +INT_STA_RX_BUF_UA = (1 <<9 ), +INT_STA_RX = (1 <<8 ), +INT_STA_TX_EARLY = (1 <<5 ), +INT_STA_TX_UNDERFLOW = (1 <<4 ), +INT_STA_TX_TIMEOUT = (1 <<3 ), +INT_STA_TX_BUF_UA = (1 <<2 ), +INT_STA_TX_DMA_STOP = (1 <<1 ), +INT_STA_TX = (1 <<0 ), +}; + +enum { +INT_EN_RX_EARLY = (1 <<13 ), +INT_EN_RX_OVERFLOW = (1 <<12 ), +INT_EN_RX_TIMEOUT = (1 <<11 ), +INT_EN_RX_DMA_STOP = (1 <<10 ), +INT_EN_RX_BUF_UA = (1 <<9 ), +INT_EN_RX = (1 <<8 ), +INT_EN_TX_EARLY = (1 <<5 ), +INT_EN_TX_UNDERFLOW = (1 <<4 ), +INT_EN_TX_TIMEOUT = (1 <<3 ), +INT_EN_TX_BUF_UA = (1 <<2 ), +INT_EN_TX_DMA_STOP = (1 <<1 ), +INT_EN_TX = (1 <<0 ), +}; + +enum { +TX_CTL0_TX_EN = (1 <<31 ), +TX_CTL1_TX_DMA_START = (1 <<31 ), +TX_CTL1_TX_DMA_EN = (1 <<30 ), +TX_CTL1_TX_FLUSH = (1 <<0 ), +}; + +enum { +RX_CTL0_RX_EN = (1 <<31 ), +RX_CTL0_STRIP_FCS = (1 <<28 ), +RX_CTL0_CRC_IPV4 = (1 <<27 ), +}; + +enum { +RX_CTL1_RX_DMA_START = (1 <<31 ), +RX_CTL1_RX_DMA_EN = (1 <<30 ), +RX_CTL1_RX_MD = (1 <<1 ), +}; + +enum { +RX_FRM_FLT_DIS_ADDR = (1 <<31 ), +}; + +enum { +MII_CMD_PHY_ADDR_SHIFT = (12 ), +MII_CMD_PHY_ADDR_MASK = (0xf000 ), +MII_CMD_PHY_REG_SHIFT = (4 ), +MII_CMD_PHY_REG_MASK = (0xf0 ), +MII_CMD_PHY_RW = (1 <<1 ), +MII_CMD_PHY_BUSY = (1 <<0 ), +}; + +enum { +TX_DMA_STA_STOP = (0b000 ), +TX_DMA_STA_RUN_FETCH = (0b001 ), +TX_DMA_STA_WAIT_STA = (0b010 ), +}; + +enum { +RX_DMA_STA_STOP = (0b000 ), +RX_DMA_STA_RUN_FETCH = (0b001 ), +RX_DMA_STA_WAIT_FRM = (0b011 ), +}; + +/* EMAC register reset values */ +enum { +REG_BASIC_CTL_1_RST =0x08000000 , +}; + +/* EMAC constants */ +enum { +AW_SUN8I_EMAC_MIN_PKT_SZ =64 +}; + +/* Transmit/receive frame descriptor */ +typedef struct FrameDescriptor { +uint32_t status; +uint32_t status2; +uint32_t addr; +uint32_t next; +}FrameDescriptor ; + +/* Frame descriptor flags */ +enum { +DESC_STATUS_CTL = (1 <<31 ), +DESC_STATUS2_BUF_SIZE_MASK = (0x7ff ), +}; + +/* Transmit frame descriptor flags */ +enum { +TX_DESC_STATUS_LENGTH_ERR = (1 <<14 ), +TX_DESC_STATUS2_FIRST_DESC = (1 <<29 ), +TX_DESC_STATUS2_LAST_DESC = (1 <<30 ), +TX_DESC_STATUS2_CHECKSUM_MASK = (0x3 <<27 ), +}; + +/* Receive frame descriptor flags */ +enum { +RX_DESC_STATUS_FIRST_DESC = (1 <<9 ), +RX_DESC_STATUS_LAST_DESC = (1 <<8 ), +RX_DESC_STATUS_FRM_LEN_MASK = (0x3fff0000 ), +RX_DESC_STATUS_FRM_LEN_SHIFT = (16 ), +RX_DESC_STATUS_NO_BUF = (1 <<14 ), +RX_DESC_STATUS_HEADER_ERR = (1 <<7 ), +RX_DESC_STATUS_LENGTH_ERR = (1 <<4 ), +RX_DESC_STATUS_CRC_ERR = (1 <<1 ), +RX_DESC_STATUS_PAYLOAD_ERR = (1 <<0 ), +RX_DESC_STATUS2_RX_INT_CTL = (1 <<31 ), +}; + +/* MII register offsets */ +enum { +MII_REG_CR = (0x0 ),/* Control */ +MII_REG_ST = (0x1 ),/* Status */ +MII_REG_ID_HIGH = (0x2 ),/* Identifier High */ +MII_REG_ID_LOW = (0x3 ),/* Identifier Low */ +MII_REG_ADV = (0x4 ),/* Advertised abilities */ +MII_REG_LPA = (0x5 ),/* Link partner abilities */ +}; + +/* MII register flags */ +enum { +MII_REG_CR_RESET = (1 <<15 ), +MII_REG_CR_POWERDOWN = (1 <<11 ), + MII_REG_CR_10Mbit = (0 ), + MII_REG_CR_100Mbit = (1 <<13 ), + MII_REG_CR_1000Mbit = (1 <<6 ), +MII_REG_CR_AUTO_NEG = (1 <<12 ), +MII_REG_CR_AUTO_NEG_RESTART = (1 <<9 ), +MII_REG_CR_FULLDUPLEX = (1 <<8 ), +}; + +enum { +MII_REG_ST_100BASE_T4 = (1 <<15 ), +MII_REG_ST_100BASE_X_FD = (1 <<14 ), +MII_REG_ST_100BASE_X_HD = (1 <<13 ), +MII_REG_ST_10_FD = (1 <<12 ), +MII_REG_ST_10_HD = (1 <<11 ), +MII_REG_ST_100BASE_T2_FD = (1 <<10 ), +MII_REG_ST_100BASE_T2_HD = (1 <<9 ), +MII_REG_ST_AUTONEG_COMPLETE = (1 <<5 ), +MII_REG_ST_AUTONEG_AVAIL = (1 <<3 ), +MII_REG_ST_LINK_UP = (1 <<2 ), +}; + +enum { +MII_REG_LPA_10_HD = (1 <<5 ), +MII_REG_LPA_10_FD = (1 <<6 ), +MII_REG_LPA_100_HD = (1 <<7 ), +MII_REG_LPA_100_FD = (1 <<8 ), +MII_REG_LPA_PAUSE = (1 <<10 ), +MII_REG_LPA_ASYMPAUSE = (1 <<11 ), +}; + +/* MII constants */ +enum { +MII_PHY_ID_HIGH =0x0044 , +MII_PHY_ID_LOW =0x1400 , +}; + +static void allwinner_sun8i_emac_mii_set_link (AwSun8iEmacState *s, +bool link_active) +{ +if (link_active) { + s->mii_st |=MII_REG_ST_LINK_UP ; + }else { + s->mii_st &= ~MII_REG_ST_LINK_UP ; + } +} + +static void allwinner_sun8i_emac_mii_reset (AwSun8iEmacState *s, +bool link_active) +{ + s->mii_cr = MII_REG_CR_100Mbit |MII_REG_CR_AUTO_NEG | +MII_REG_CR_FULLDUPLEX ; + s->mii_st =MII_REG_ST_100BASE_T4 |MII_REG_ST_100BASE_X_FD | +MII_REG_ST_100BASE_X_HD |MII_REG_ST_10_FD |MII_REG_ST_10_HD | +MII_REG_ST_100BASE_T2_FD |MII_REG_ST_100BASE_T2_HD | +MII_REG_ST_AUTONEG_COMPLETE |MII_REG_ST_AUTONEG_AVAIL ; + s->mii_adv =0 ; + +allwinner_sun8i_emac_mii_set_link (s, link_active); +} + +static void allwinner_sun8i_emac_mii_cmd (AwSun8iEmacState *s) +{ +uint8_t addr, reg; + + addr = (s->mii_cmd &MII_CMD_PHY_ADDR_MASK ) >>MII_CMD_PHY_ADDR_SHIFT ; + reg = (s->mii_cmd &MII_CMD_PHY_REG_MASK ) >>MII_CMD_PHY_REG_SHIFT ; + +if (addr != s->mii_phy_addr) { +return ; + } + +/* Read or write a PHY register? */ +if (s->mii_cmd &MII_CMD_PHY_RW ) { +trace_allwinner_sun8i_emac_mii_write_reg (reg, s->mii_data); + +switch (reg) { +case MII_REG_CR : +if (s->mii_data &MII_REG_CR_RESET ) { +allwinner_sun8i_emac_mii_reset (s, s->mii_st & +MII_REG_ST_LINK_UP ); + }else { + s->mii_cr = s->mii_data & ~(MII_REG_CR_RESET | +MII_REG_CR_AUTO_NEG_RESTART ); + } +break ; +case MII_REG_ADV : + s->mii_adv = s->mii_data; +break ; +case MII_REG_ID_HIGH : +case MII_REG_ID_LOW : +case MII_REG_LPA : +break ; +default : +qemu_log_mask (LOG_UNIMP ,"allwinner-h3-emac: write access to " +"unknown MII register 0x%x\n" , reg); +break ; + } + }else { +switch (reg) { +case MII_REG_CR : + s->mii_data = s->mii_cr; +break ; +case MII_REG_ST : + s->mii_data = s->mii_st; +break ; +case MII_REG_ID_HIGH : + s->mii_data =MII_PHY_ID_HIGH ; +break ; +case MII_REG_ID_LOW : + s->mii_data =MII_PHY_ID_LOW ; +break ; +case MII_REG_ADV : + s->mii_data = s->mii_adv; +break ; +case MII_REG_LPA : + s->mii_data =MII_REG_LPA_10_HD |MII_REG_LPA_10_FD | +MII_REG_LPA_100_HD |MII_REG_LPA_100_FD | +MII_REG_LPA_PAUSE |MII_REG_LPA_ASYMPAUSE ; +break ; +default : +qemu_log_mask (LOG_UNIMP ,"allwinner-h3-emac: read access to " +"unknown MII register 0x%x\n" , reg); + s->mii_data =0 ; +break ; + } + +trace_allwinner_sun8i_emac_mii_read_reg (reg, s->mii_data); + } +} + +static void allwinner_sun8i_emac_update_irq (AwSun8iEmacState *s) +{ +qemu_set_irq (s->irq, (s->int_sta & s->int_en) !=0 ); +} + +static uint32_t allwinner_sun8i_emac_next_desc (FrameDescriptor *desc, +size_t min_size) +{ +uint32_t paddr = desc->next; + +cpu_physical_memory_read (paddr, desc,sizeof (*desc)); + +if ((desc->status &DESC_STATUS_CTL ) && + (desc->status2 &DESC_STATUS2_BUF_SIZE_MASK ) >= min_size) { +return paddr; + }else { +return 0 ; + } +} + +static uint32_t allwinner_sun8i_emac_get_desc (FrameDescriptor *desc, +uint32_t start_addr, +size_t min_size) +{ +uint32_t desc_addr = start_addr; + +/* Note that the list is a cycle. Last entry points back to the head. */ +while (desc_addr !=0 ) { +cpu_physical_memory_read (desc_addr, desc,sizeof (*desc)); + +if ((desc->status &DESC_STATUS_CTL ) && + (desc->status2 &DESC_STATUS2_BUF_SIZE_MASK ) >= min_size) { +return desc_addr; + }else if (desc->next == start_addr) { +break ; + }else { + desc_addr = desc->next; + } + } + +return 0 ; +} + +static uint32_t allwinner_sun8i_emac_rx_desc (AwSun8iEmacState *s, +FrameDescriptor *desc, +size_t min_size) +{ +return allwinner_sun8i_emac_get_desc (desc, s->rx_desc_curr, min_size); +} + +static uint32_t allwinner_sun8i_emac_tx_desc (AwSun8iEmacState *s, +FrameDescriptor *desc, +size_t min_size) +{ +return allwinner_sun8i_emac_get_desc (desc, s->tx_desc_head, min_size); +} + +static void allwinner_sun8i_emac_flush_desc (FrameDescriptor *desc, +uint32_t phys_addr) +{ +cpu_physical_memory_write (phys_addr, desc,sizeof (*desc)); +} + +static int allwinner_sun8i_emac_can_receive (NetClientState *nc) +{ +AwSun8iEmacState *s =qemu_get_nic_opaque (nc); +FrameDescriptor desc; + +return (s->rx_ctl0 &RX_CTL0_RX_EN ) && + (allwinner_sun8i_emac_rx_desc (s, &desc,0 ) !=0 ); +} + +static ssize_t allwinner_sun8i_emac_receive (NetClientState *nc, +const uint8_t *buf, +size_t size) +{ +AwSun8iEmacState *s =qemu_get_nic_opaque (nc); +FrameDescriptor desc; +size_t bytes_left = size; +size_t desc_bytes =0 ; +size_t pad_fcs_size =4 ; +size_t padding =0 ; + +if (!(s->rx_ctl0 &RX_CTL0_RX_EN )) { +return -1 ; + } + + s->rx_desc_curr =allwinner_sun8i_emac_rx_desc (s, &desc, +AW_SUN8I_EMAC_MIN_PKT_SZ ); +if (!s->rx_desc_curr) { + s->int_sta |=INT_STA_RX_BUF_UA ; + } + +/* Keep filling RX descriptors until the whole frame is written */ +while (s->rx_desc_curr && bytes_left >0 ) { + desc.status &= ~DESC_STATUS_CTL ; + desc.status &= ~RX_DESC_STATUS_FRM_LEN_MASK ; + +if (bytes_left == size) { + desc.status |=RX_DESC_STATUS_FIRST_DESC ; + } + +if ((desc.status2 &DESC_STATUS2_BUF_SIZE_MASK ) < + (bytes_left + pad_fcs_size)) { + desc_bytes = desc.status2 &DESC_STATUS2_BUF_SIZE_MASK ; + desc.status |= desc_bytes <<RX_DESC_STATUS_FRM_LEN_SHIFT ; + }else { + padding = pad_fcs_size; +if (bytes_left <AW_SUN8I_EMAC_MIN_PKT_SZ ) { + padding += (AW_SUN8I_EMAC_MIN_PKT_SZ - bytes_left); + } + + desc_bytes = (bytes_left); + desc.status |=RX_DESC_STATUS_LAST_DESC ; + desc.status |= (bytes_left + padding) + <<RX_DESC_STATUS_FRM_LEN_SHIFT ; + } + +cpu_physical_memory_write (desc.addr, buf, desc_bytes); +allwinner_sun8i_emac_flush_desc (&desc, s->rx_desc_curr); +trace_allwinner_sun8i_emac_receive (s->rx_desc_curr, desc.addr, + desc_bytes); + +/* Check if frame needs to raise the receive interrupt */ +if (!(desc.status2 &RX_DESC_STATUS2_RX_INT_CTL )) { + s->int_sta |=INT_STA_RX ; + } + +/* Increment variables */ + buf += desc_bytes; + bytes_left -= desc_bytes; + +/* Move to the next descriptor */ + s->rx_desc_curr =allwinner_sun8i_emac_next_desc (&desc,64 ); +if (!s->rx_desc_curr) { +/* Not enough buffer space available */ + s->int_sta |=INT_STA_RX_BUF_UA ; + s->rx_desc_curr = s->rx_desc_head; +break ; + } + } + +/* Report receive DMA is finished */ + s->rx_ctl1 &= ~RX_CTL1_RX_DMA_START ; +allwinner_sun8i_emac_update_irq (s); + +return size; +} + +static void allwinner_sun8i_emac_transmit (AwSun8iEmacState *s) +{ +NetClientState *nc =qemu_get_queue (s->nic); +FrameDescriptor desc; +size_t bytes =0 ; +size_t packet_bytes =0 ; +size_t transmitted =0 ; +static uint8_t packet_buf[2048 ]; + + s->tx_desc_curr =allwinner_sun8i_emac_tx_desc (s, &desc,0 ); + +/* Read all transmit descriptors */ +while (s->tx_desc_curr !=0 ) { + +/* Read from physical memory into packet buffer */ + bytes = desc.status2 &DESC_STATUS2_BUF_SIZE_MASK ; +if (bytes + packet_bytes >sizeof (packet_buf)) { + desc.status |=TX_DESC_STATUS_LENGTH_ERR ; +break ; + } +cpu_physical_memory_read (desc.addr, packet_buf + packet_bytes, bytes); + packet_bytes += bytes; + desc.status &= ~DESC_STATUS_CTL ; +allwinner_sun8i_emac_flush_desc (&desc, s->tx_desc_curr); + +/* After the last descriptor, send the packet */ +if (desc.status2 &TX_DESC_STATUS2_LAST_DESC ) { +if (desc.status2 &TX_DESC_STATUS2_CHECKSUM_MASK ) { +net_checksum_calculate (packet_buf, packet_bytes); + } + +qemu_send_packet (nc, packet_buf, packet_bytes); +trace_allwinner_sun8i_emac_transmit (s->tx_desc_curr, desc.addr, + bytes); + + packet_bytes =0 ; + transmitted++; + } + s->tx_desc_curr =allwinner_sun8i_emac_next_desc (&desc,0 ); + } + +/* Raise transmit completed interrupt */ +if (transmitted >0 ) { + s->int_sta |=INT_STA_TX ; + s->tx_ctl1 &= ~TX_CTL1_TX_DMA_START ; +allwinner_sun8i_emac_update_irq (s); + } +} + +static void allwinner_sun8i_emac_reset (DeviceState *dev) +{ +AwSun8iEmacState *s =AW_SUN8I_EMAC (dev); +NetClientState *nc =qemu_get_queue (s->nic); + +trace_allwinner_sun8i_emac_reset (); + + s->mii_cmd =0 ; + s->mii_data =0 ; + s->basic_ctl0 =0 ; + s->basic_ctl1 =REG_BASIC_CTL_1_RST ; + s->int_en =0 ; + s->int_sta =0 ; + s->frm_flt =0 ; + s->rx_ctl0 =0 ; + s->rx_ctl1 =RX_CTL1_RX_MD ; + s->rx_desc_head =0 ; + s->rx_desc_curr =0 ; + s->tx_ctl0 =0 ; + s->tx_ctl1 =0 ; + s->tx_desc_head =0 ; + s->tx_desc_curr =0 ; + s->tx_flowctl =0 ; + +allwinner_sun8i_emac_mii_reset (s, !nc->link_down); +} + +static uint64_t allwinner_sun8i_emac_read (void *opaque,hwaddr offset, +unsigned size) +{ +AwSun8iEmacState *s =AW_SUN8I_EMAC (opaque); +uint64_t value =0 ; +FrameDescriptor desc; + +switch (offset) { +case REG_BASIC_CTL_0 :/* Basic Control 0 */ + value = s->basic_ctl0; +break ; +case REG_BASIC_CTL_1 :/* Basic Control 1 */ + value = s->basic_ctl1; +break ; +case REG_INT_STA :/* Interrupt Status */ + value = s->int_sta; +break ; +case REG_INT_EN :/* Interupt Enable */ + value = s->int_en; +break ; +case REG_TX_CTL_0 :/* Transmit Control 0 */ + value = s->tx_ctl0; +break ; +case REG_TX_CTL_1 :/* Transmit Control 1 */ + value = s->tx_ctl1; +break ; +case REG_TX_FLOW_CTL :/* Transmit Flow Control */ + value = s->tx_flowctl; +break ; +case REG_TX_DMA_DESC_LIST :/* Transmit Descriptor List Address */ + value = s->tx_desc_head; +break ; +case REG_RX_CTL_0 :/* Receive Control 0 */ + value = s->rx_ctl0; +break ; +case REG_RX_CTL_1 :/* Receive Control 1 */ + value = s->rx_ctl1; +break ; +case REG_RX_DMA_DESC_LIST :/* Receive Descriptor List Address */ + value = s->rx_desc_head; +break ; +case REG_FRM_FLT :/* Receive Frame Filter */ + value = s->frm_flt; +break ; +case REG_RX_HASH_0 :/* Receive Hash Table 0 */ +case REG_RX_HASH_1 :/* Receive Hash Table 1 */ +break ; +case REG_MII_CMD :/* Management Interface Command */ + value = s->mii_cmd; +break ; +case REG_MII_DATA :/* Management Interface Data */ + value = s->mii_data; +break ; +case REG_ADDR_HIGH :/* MAC Address High */ + value = *(((uint32_t *) (s->conf.macaddr.a)) +1 ); +break ; +case REG_ADDR_LOW :/* MAC Address Low */ + value = *(uint32_t *) (s->conf.macaddr.a); +break ; +case REG_TX_DMA_STA :/* Transmit DMA Status */ +break ; +case REG_TX_CUR_DESC :/* Transmit Current Descriptor */ + value = s->tx_desc_curr; +break ; +case REG_TX_CUR_BUF :/* Transmit Current Buffer */ +if (s->tx_desc_curr !=0 ) { +cpu_physical_memory_read (s->tx_desc_curr, &desc,sizeof (desc)); + value = desc.addr; + }else { + value =0 ; + } +break ; +case REG_RX_DMA_STA :/* Receive DMA Status */ +break ; +case REG_RX_CUR_DESC :/* Receive Current Descriptor */ + value = s->rx_desc_curr; +break ; +case REG_RX_CUR_BUF :/* Receive Current Buffer */ +if (s->rx_desc_curr !=0 ) { +cpu_physical_memory_read (s->rx_desc_curr, &desc,sizeof (desc)); + value = desc.addr; + }else { + value =0 ; + } +break ; +case REG_RGMII_STA :/* RGMII Status */ +break ; +default : +qemu_log_mask (LOG_UNIMP ,"allwinner-h3-emac: read access to unknown " +"EMAC register 0x" TARGET_FMT_plx"\n" , + offset); + } + +trace_allwinner_sun8i_emac_read (offset, value); +return value; +} + +static void allwinner_sun8i_emac_write (void *opaque,hwaddr offset, +uint64_t value,unsigned size) +{ +AwSun8iEmacState *s =AW_SUN8I_EMAC (opaque); +NetClientState *nc =qemu_get_queue (s->nic); + +trace_allwinner_sun8i_emac_write (offset, value); + +switch (offset) { +case REG_BASIC_CTL_0 :/* Basic Control 0 */ + s->basic_ctl0 = value; +break ; +case REG_BASIC_CTL_1 :/* Basic Control 1 */ +if (value &BASIC_CTL1_SOFTRST ) { +allwinner_sun8i_emac_reset (DEVICE (s)); + value &= ~BASIC_CTL1_SOFTRST ; + } + s->basic_ctl1 = value; +if (allwinner_sun8i_emac_can_receive (nc)) { +qemu_flush_queued_packets (nc); + } +break ; +case REG_INT_STA :/* Interrupt Status */ + s->int_sta &= ~value; +allwinner_sun8i_emac_update_irq (s); +break ; +case REG_INT_EN :/* Interrupt Enable */ + s->int_en = value; +allwinner_sun8i_emac_update_irq (s); +break ; +case REG_TX_CTL_0 :/* Transmit Control 0 */ + s->tx_ctl0 = value; +break ; +case REG_TX_CTL_1 :/* Transmit Control 1 */ + s->tx_ctl1 = value; +if (value &TX_CTL1_TX_DMA_EN ) { +allwinner_sun8i_emac_transmit (s); + } +break ; +case REG_TX_FLOW_CTL :/* Transmit Flow Control */ + s->tx_flowctl = value; +break ; +case REG_TX_DMA_DESC_LIST :/* Transmit Descriptor List Address */ + s->tx_desc_head = value; + s->tx_desc_curr = value; +break ; +case REG_RX_CTL_0 :/* Receive Control 0 */ + s->rx_ctl0 = value; +break ; +case REG_RX_CTL_1 :/* Receive Control 1 */ + s->rx_ctl1 = value |RX_CTL1_RX_MD ; +if ((value &RX_CTL1_RX_DMA_EN ) && +allwinner_sun8i_emac_can_receive (nc)) { +qemu_flush_queued_packets (nc); + } +break ; +case REG_RX_DMA_DESC_LIST :/* Receive Descriptor List Address */ + s->rx_desc_head = value; + s->rx_desc_curr = value; +break ; +case REG_FRM_FLT :/* Receive Frame Filter */ + s->frm_flt = value; +break ; +case REG_RX_HASH_0 :/* Receive Hash Table 0 */ +case REG_RX_HASH_1 :/* Receive Hash Table 1 */ +break ; +case REG_MII_CMD :/* Management Interface Command */ + s->mii_cmd = value & ~MII_CMD_PHY_BUSY ; +allwinner_sun8i_emac_mii_cmd (s); +break ; +case REG_MII_DATA :/* Management Interface Data */ + s->mii_data = value; +break ; +case REG_ADDR_HIGH :/* MAC Address High */ + s->conf.macaddr.a[4 ] = (value &0xff ); + s->conf.macaddr.a[5 ] = (value &0xff00 ) >>8 ; +break ; +case REG_ADDR_LOW :/* MAC Address Low */ + s->conf.macaddr.a[0 ] = (value &0xff ); + s->conf.macaddr.a[1 ] = (value &0xff00 ) >>8 ; + s->conf.macaddr.a[2 ] = (value &0xff0000 ) >>16 ; + s->conf.macaddr.a[3 ] = (value &0xff000000 ) >>24 ; +break ; +case REG_TX_DMA_STA :/* Transmit DMA Status */ +case REG_TX_CUR_DESC :/* Transmit Current Descriptor */ +case REG_TX_CUR_BUF :/* Transmit Current Buffer */ +case REG_RX_DMA_STA :/* Receive DMA Status */ +case REG_RX_CUR_DESC :/* Receive Current Descriptor */ +case REG_RX_CUR_BUF :/* Receive Current Buffer */ +case REG_RGMII_STA :/* RGMII Status */ +break ; +default : +qemu_log_mask (LOG_UNIMP ,"allwinner-h3-emac: write access to unknown " +"EMAC register 0x" TARGET_FMT_plx"\n" , + offset); + } +} + +static void allwinner_sun8i_emac_set_link (NetClientState *nc) +{ +AwSun8iEmacState *s =qemu_get_nic_opaque (nc); + +trace_allwinner_sun8i_emac_set_link (!nc->link_down); +allwinner_sun8i_emac_mii_set_link (s, !nc->link_down); +} + +static const MemoryRegionOps allwinner_sun8i_emac_mem_ops = { + .read = allwinner_sun8i_emac_read, + .write = allwinner_sun8i_emac_write, + .endianness =DEVICE_NATIVE_ENDIAN , + .valid = { + .min_access_size =4 , + .max_access_size =4 , + }, + .impl.min_access_size =4 , +}; + +static NetClientInfo net_allwinner_sun8i_emac_info = { + .type =NET_CLIENT_DRIVER_NIC , + .size =sizeof (NICState), + .can_receive = allwinner_sun8i_emac_can_receive, + .receive = allwinner_sun8i_emac_receive, + .link_status_changed = allwinner_sun8i_emac_set_link, +}; + +static void allwinner_sun8i_emac_init (Object *obj) +{ +SysBusDevice *sbd =SYS_BUS_DEVICE (obj); +AwSun8iEmacState *s =AW_SUN8I_EMAC (obj); + +memory_region_init_io (&s->iomem,OBJECT (s), &allwinner_sun8i_emac_mem_ops, + s,TYPE_AW_SUN8I_EMAC ,64 * KiB); +sysbus_init_mmio (sbd, &s->iomem); +sysbus_init_irq (sbd, &s->irq); +} + +static void allwinner_sun8i_emac_realize (DeviceState *dev,Error **errp) +{ +AwSun8iEmacState *s =AW_SUN8I_EMAC (dev); + +qemu_macaddr_default_if_unset (&s->conf.macaddr); + s->nic =qemu_new_nic (&net_allwinner_sun8i_emac_info, &s->conf, +object_get_typename (OBJECT (dev)), dev->id, s); +qemu_format_nic_info_str (qemu_get_queue (s->nic), s->conf.macaddr.a); +} + +static Property allwinner_sun8i_emac_properties[] = { +DEFINE_NIC_PROPERTIES (AwSun8iEmacState, conf), +DEFINE_PROP_UINT8 ("phy-addr" , AwSun8iEmacState, mii_phy_addr,0 ), +DEFINE_PROP_END_OF_LIST (), +}; + +static int allwinner_sun8i_emac_post_load (void *opaque,int version_id) +{ +AwSun8iEmacState *s = opaque; + +allwinner_sun8i_emac_set_link (qemu_get_queue (s->nic)); + +return 0 ; +} + +static const VMStateDescription vmstate_aw_emac = { + .name ="allwinner-sun8i-emac" , + .version_id =1 , + .minimum_version_id =1 , + .post_load = allwinner_sun8i_emac_post_load, + .fields = (VMStateField []) { +VMSTATE_UINT8 (mii_phy_addr, AwSun8iEmacState), +VMSTATE_UINT32 (mii_cmd, AwSun8iEmacState), +VMSTATE_UINT32 (mii_data, AwSun8iEmacState), +VMSTATE_UINT32 (mii_cr, AwSun8iEmacState), +VMSTATE_UINT32 (mii_st, AwSun8iEmacState), +VMSTATE_UINT32 (mii_adv, AwSun8iEmacState), +VMSTATE_UINT32 (basic_ctl0, AwSun8iEmacState), +VMSTATE_UINT32 (basic_ctl1, AwSun8iEmacState), +VMSTATE_UINT32 (int_en, AwSun8iEmacState), +VMSTATE_UINT32 (int_sta, AwSun8iEmacState), +VMSTATE_UINT32 (frm_flt, AwSun8iEmacState), +VMSTATE_UINT32 (rx_ctl0, AwSun8iEmacState), +VMSTATE_UINT32 (rx_ctl1, AwSun8iEmacState), +VMSTATE_UINT32 (rx_desc_head, AwSun8iEmacState), +VMSTATE_UINT32 (rx_desc_curr, AwSun8iEmacState), +VMSTATE_UINT32 (tx_ctl0, AwSun8iEmacState), +VMSTATE_UINT32 (tx_ctl1, AwSun8iEmacState), +VMSTATE_UINT32 (tx_desc_head, AwSun8iEmacState), +VMSTATE_UINT32 (tx_desc_curr, AwSun8iEmacState), +VMSTATE_UINT32 (tx_flowctl, AwSun8iEmacState), +VMSTATE_END_OF_LIST () + } +}; + +static void allwinner_sun8i_emac_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); + + dc->realize = allwinner_sun8i_emac_realize; + dc->reset = allwinner_sun8i_emac_reset; + dc->vmsd = &vmstate_aw_emac; +device_class_set_props (dc, allwinner_sun8i_emac_properties); +} + +static const TypeInfo allwinner_sun8i_emac_info = { + .name =TYPE_AW_SUN8I_EMAC , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (AwSun8iEmacState), + .instance_init = allwinner_sun8i_emac_init, + .class_init = allwinner_sun8i_emac_class_init, +}; + +static void allwinner_sun8i_emac_register_types (void ) +{ +type_register_static (&allwinner_sun8i_emac_info); +} + +type_init (allwinner_sun8i_emac_register_types)hw/arm/Kconfig +1
-0@@ -300,6 +300,7 @@ config ALLWINNER_A10 config ALLWINNER_H3 bool select ALLWINNER_A10_PIT + select ALLWINNER_SUN8I_EMAC select SERIAL select ARM_TIMER select ARM_GIChw/net/Kconfig +3
-0@@ -79,6 +79,9 @@ config MIPSNET config ALLWINNER_EMAC bool +config ALLWINNER_SUN8I_EMAC + bool + config IMX_FEC boolhw/net/Makefile.objs +1
-0@@ -23,6 +23,7 @@ common-obj-$(CONFIG_XGMAC) += xgmac.o common-obj-$(CONFIG_MIPSNET) += mipsnet.o common-obj-$(CONFIG_XILINX_AXI) += xilinx_axienet.o common-obj-$(CONFIG_ALLWINNER_EMAC) += allwinner_emac.o +common-obj-$(CONFIG_ALLWINNER_SUN8I_EMAC) += allwinner-sun8i-emac.o common-obj-$(CONFIG_IMX_FEC) += imx_fec.o common-obj-$(CONFIG_CADENCE) += cadence_gem.ohw/net/trace-events +10
-0@@ -1,5 +1,15 @@ # See docs/devel/tracing.txt for syntax documentation. +# allwinner-sun8i-emac.c +allwinner_sun8i_emac_mii_write_reg(uint32_t reg, uint32_t value) "MII write: reg=0x%" PRIx32 " value=0x%" PRIx32 +allwinner_sun8i_emac_mii_read_reg(uint32_t reg, uint32_t value) "MII read: reg=0x%" PRIx32 " value=0x%" PRIx32 +allwinner_sun8i_emac_receive(uint32_t desc, uint32_t paddr, uint32_t bytes) "RX packet: desc=0x%" PRIx32 " paddr=0x%" PRIx32 " bytes=%" PRIu32 +allwinner_sun8i_emac_transmit(uint32_t desc, uint32_t paddr, uint32_t bytes) "TX packet: desc=0x%" PRIx32 " paddr=0x%" PRIx32 " bytes=%" PRIu32 +allwinner_sun8i_emac_reset(void) "HW reset" +allwinner_sun8i_emac_set_link(bool active) "Set link: active=%u" +allwinner_sun8i_emac_read(uint64_t offset, uint64_t val) "MMIO read: offset=0x%" PRIx64 " value=0x%" PRIx64 +allwinner_sun8i_emac_write(uint64_t offset, uint64_t val) "MMIO write: offset=0x%" PRIx64 " value=0x%" PRIx64 + # etraxfs_eth.c mdio_phy_read(int regnum, uint16_t value) "read phy_reg:%d value:0x%04x" mdio_phy_write(int regnum, uint16_t value) "write phy_reg:%d value:0x%04x"
Signature · 1 line
Alex Bennée
PATCH v7 10/18 hw/arm/allwinner-h3: add Boot ROM support
In reply to Niek LinnenbankA real Allwinner H3 SoC contains a Boot ROM which is the first code that runs right after the SoC is powered on.
The Boot ROM is responsible for loading user code (e.g. a bootloader) from any of the supported external devices and writing the downloaded code to internal SRAM. After loading the SoC begins executing the code written to SRAM.
This commits adds emulation of the Boot ROM firmware setup functionality by loading user code from SD card in the A1 SRAM. While the A1 SRAM is 64KiB, we limit the size to 32KiB because the real H3 Boot ROM also rejects sizes larger than 32KiB. For reference, this behaviour is documented by the Linux Sunxi project wiki at:
https://linux-sunxi.org/BROM#U-Boot_SPL_limitations
--- include/hw/arm/allwinner-h3.h | 21 +++++++++++++++++++++ hw/arm/allwinner-h3.c | 18 ++++++++++++++++++ hw/arm/orangepi.c | 5 +++++ 3 files changed, 44 insertions(+)
include/hw/arm/allwinner-h3.h +21 -0
@@ -46,6 +46,7 @@#include "hw/sd/allwinner-sdhost.h" #include "hw/net/allwinner-sun8i-emac.h" #include "target/arm/cpu.h" +#include "sysemu/block-backend.h" /** * Allwinner H3 device list
@@ -129,4 +130,24 @@ typedef struct AwH3State { MemoryRegion sram_c; } AwH3State; +/** +* Emulate Boot ROM firmware setup functionality. +* +* A real Allwinner H3 SoC contains a Boot ROM +* which is the first code that runs right after +* the SoC is powered on. The Boot ROM is responsible +* for loading user code (e.g. a bootloader) from any +* of the supported external devices and writing the +* downloaded code to internal SRAM. After loading the SoC +* begins executing the code written to SRAM. +* +* This function emulates the Boot ROM by copying 32 KiB +* of data from the given block device and writes it to +* the start of the first internal SRAM memory. +* +* @s: Allwinner H3 state object pointer +* @blk: Block backend device object pointer +*/ +void allwinner_h3_bootrom_setup (AwH3State *s,BlockBackend *blk); +#endif /* HW_ARM_ALLWINNER_H3_H */
hw/arm/allwinner-h3.c +18 -0
@@ -29,6 +29,7 @@#include "hw/char/serial.h" #include "hw/misc/unimp.h" #include "hw/usb/hcd-ehci.h" +#include "hw/loader.h" #include "sysemu/sysemu.h" #include "hw/arm/allwinner-h3.h"
@@ -170,6 +171,23 @@ enum { AW_H3_GIC_NUM_SPI = 128 }; +void allwinner_h3_bootrom_setup (AwH3State *s,BlockBackend *blk) +{ +const int64_t rom_size =32 * KiB; +uint8_t *buffer =g_new0 (uint8_t, rom_size); + +if (blk_pread (blk,8 * KiB, buffer, rom_size) <0 ) { +error_setg (&error_fatal,"%s: failed to read BlockBackend data" , + __func__); +return ; + } + +rom_add_blob ("allwinner-h3.bootrom" , buffer, rom_size, + rom_size, s->memmap[AW_H3_SRAM_A1 ], +NULL ,NULL ,NULL ,NULL , false); +g_free (buffer); +} +static void allwinner_h3_init (Object *obj) {AwH3State *s =AW_H3 (obj);
hw/arm/orangepi.c +5 -0
@@ -98,6 +98,11 @@ static void orangepi_init(MachineState *machine)memory_region_add_subregion (get_system_memory (), h3->memmap[AW_H3_SDRAM ], machine->ram); +/* Load target kernel or start using BootROM */ +if (!machine->kernel_filename &&blk_is_available (blk)) { +/* Use Boot ROM to copy data from SD card to SRAM */ +allwinner_h3_bootrom_setup (h3, blk); + } orangepi_binfo.loader_start = h3->memmap[AW_H3_SDRAM ]; orangepi_binfo.ram_size = machine->ram_size;arm_load_kernel (ARM_CPU (first_cpu), machine, &orangepi_binfo);
Signature · 1 line
2.17.1
Re: [PATCH v7 10/18] hw/arm/allwinner-h3: add Boot ROM support
Quoted 72 lines · Niek Linnenbank
A real Allwinner H3 SoC contains a Boot ROM which is the first code that runs right after the SoC is powered on.
The Boot ROM is responsible for loading user code (e.g. a bootloader) from any of the supported external devices and writing the downloaded code to internal SRAM. After loading the SoC begins executing the code written to SRAM.This commits adds emulation of the Boot ROM firmware setup functionality by loading user code from SD card in the A1 SRAM. While the A1 SRAM is 64KiB, we limit the size to 32KiB because the real H3 Boot ROM also rejects sizes larger than 32KiB. For reference, this behaviour is documented by the Linux Sunxi project wiki at:
https://linux-sunxi.org/BROM#U-Boot_SPL_limitations
Signed-off-by Niek Linnenbank <[email protected]>--- include/hw/arm/allwinner-h3.h | 21 +++++++++++++++++++++ hw/arm/allwinner-h3.c | 18 ++++++++++++++++++ hw/arm/orangepi.c | 5 +++++ 3 files changed, 44 insertions(+)include/hw/arm/allwinner-h3.h +21
-0@@ -46,6 +46,7 @@#include "hw/sd/allwinner-sdhost.h" #include "hw/net/allwinner-sun8i-emac.h" #include "target/arm/cpu.h" +#include "sysemu/block-backend.h" /** * Allwinner H3 device list @@ -129,4 +130,24 @@ typedef struct AwH3State { MemoryRegion sram_c; } AwH3State; +/** +* Emulate Boot ROM firmware setup functionality. +* +* A real Allwinner H3 SoC contains a Boot ROM +* which is the first code that runs right after +* the SoC is powered on. The Boot ROM is responsible +* for loading user code (e.g. a bootloader) from any +* of the supported external devices and writing the +* downloaded code to internal SRAM. After loading the SoC +* begins executing the code written to SRAM. +* +* This function emulates the Boot ROM by copying 32 KiB +* of data from the given block device and writes it to +* the start of the first internal SRAM memory. +* +* @s: Allwinner H3 state object pointer +* @blk: Block backend device object pointer +*/ +void allwinner_h3_bootrom_setup (AwH3State *s,BlockBackend *blk); +#endif /* HW_ARM_ALLWINNER_H3_H */ hw/arm/allwinner-h3.c +1
-0@@ -29,6 +29,7 @@#include "hw/char/serial.h" #include "hw/misc/unimp.h" #include "hw/usb/hcd-ehci.h" +#include "hw/loader.h" #include "sysemu/sysemu.h" #include "hw/arm/allwinner-h3.h"
hw/arm/allwinner-h3.c enum { · line 177
Quoted 7 lines
hw/arm/allwinner-h3.c +4
-0@@ -170,6 +171,23 @@ enum { AW_H3_GIC_NUM_SPI = 128 }; +void allwinner_h3_bootrom_setup (AwH3State *s,BlockBackend *blk) +{ +const int64_t rom_size =32 * KiB; +uint8_t *buffer =g_new0 (uint8_t, rom_size);
There is an opportunity to use g_autofree here so you can skip..
hw/arm/allwinner-h3.c enum { · line 190
Quoted 3 lines
hw/arm/allwinner-h3.c +3
-0+g_free (buffer); +} +
<snip>
Otherwise:
Signature · 1 line
Alex Bennée
Re: [PATCH v7 10/18] hw/arm/allwinner-h3: add Boot ROM support
Quoted 87 lines · Alex Bennée
Quoted 10 lines · Niek Linnenbank
A real Allwinner H3 SoC contains a Boot ROM which is the first code that runs right after the SoC is powered on.
The Boot ROM is responsible for loading user code (e.g. a bootloader) from any of the supported external devices and writing the downloaded code to internal SRAM. After loading the SoC begins executing the code written to SRAM.This commits adds emulation of the Boot ROM firmware setup functionality by loading user code from SD card in the A1 SRAM. While the A1 SRAM is 64KiB, we limit the size to 32KiB because the real H3 Boot ROM also
rejects
Quoted 5 lines
sizes larger than 32KiB. For reference, this behaviour is documented by the Linux Sunxi project wiki at:
Review
Quoted 8 lines
Signed-off-by Niek Linnenbank <[email protected]>--- include/hw/arm/allwinner-h3.h | 21 +++++++++++++++++++++ hw/arm/allwinner-h3.c | 18 ++++++++++++++++++ hw/arm/orangepi.c | 5 +++++ 3 files changed, 44 insertions(+)(quoted diff) +0
-0
b/include/hw/arm/allwinner-h3.hQuoted 49 lines
index
f9b9a02373..d338003724100644include/hw/arm/allwinner-h3.h +21
-0@@ -46,6 +46,7 @@#include "hw/sd/allwinner-sdhost.h" #include "hw/net/allwinner-sun8i-emac.h" #include "target/arm/cpu.h" +#include "sysemu/block-backend.h" /** * Allwinner H3 device list @@ -129,4 +130,24 @@ typedef struct AwH3State { MemoryRegion sram_c; } AwH3State; +/** +* Emulate Boot ROM firmware setup functionality. +* +* A real Allwinner H3 SoC contains a Boot ROM +* which is the first code that runs right after +* the SoC is powered on. The Boot ROM is responsible +* for loading user code (e.g. a bootloader) from any +* of the supported external devices and writing the +* downloaded code to internal SRAM. After loading the SoC +* begins executing the code written to SRAM. +* +* This function emulates the Boot ROM by copying 32 KiB +* of data from the given block device and writes it to +* the start of the first internal SRAM memory. +* +* @s: Allwinner H3 state object pointer +* @blk: Block backend device object pointer +*/ +void allwinner_h3_bootrom_setup (AwH3State *s,BlockBackend *blk); +#endif /* HW_ARM_ALLWINNER_H3_H */ hw/arm/allwinner-h3.c +1
-0@@ -29,6 +29,7 @@#include "hw/char/serial.h" #include "hw/misc/unimp.h" #include "hw/usb/hcd-ehci.h" +#include "hw/loader.h" #include "sysemu/sysemu.h" #include "hw/arm/allwinner-h3.h" hw/arm/allwinner-h3.c enum { · line 177
Quoted 7 lines
hw/arm/allwinner-h3.c +4
-0@@ -170,6 +171,23 @@ enum { AW_H3_GIC_NUM_SPI = 128 }; +void allwinner_h3_bootrom_setup (AwH3State *s,BlockBackend *blk) +{ +const int64_t rom_size =32 * KiB; +uint8_t *buffer =g_new0 (uint8_t, rom_size);There is an opportunity to use
g_autofreehere so you can skip..
Quoted 5 lines
Quoted 3 lines
hw/arm/allwinner-h3.c +3
-0+g_free (buffer); +} +<snip>
Thanks Alex, I'll use g_autofree here.
Regards,
Niek
Quoted 8 lines
Otherwise:
Reviewed-by Alex Bennée <[email protected]>--
Alex Bennée
Signature · 1 line
Niek Linnenbank
PATCH v7 11/18 hw/arm/allwinner-h3: add SDRAM controller device
In reply to Niek LinnenbankIn the Allwinner H3 SoC the SDRAM controller is responsible for interfacing with the external Synchronous Dynamic Random Access Memory (SDRAM). Types of memory that the SDRAM controller supports are DDR2/DDR3 and capacities of up to 2GiB. This commit adds emulation support of the Allwinner H3 SDRAM controller.
--- include/hw/arm/allwinner-h3.h | 5 + include/hw/misc/allwinner-h3-dramc.h | 106 ++++++++ hw/arm/allwinner-h3.c | 19 +- hw/arm/orangepi.c | 6 + hw/misc/allwinner-h3-dramc.c | 358 +++++++++++++++++++++++++++ hw/misc/Makefile.objs | 1 + hw/misc/trace-events | 10 + 7 files changed, 502 insertions(+), 3 deletions(-) create mode 100644 include/hw/misc/allwinner-h3-dramc.h create mode 100644 hw/misc/allwinner-h3-dramc.c
include/hw/arm/allwinner-h3.h +5 -0
@@ -41,6 +41,7 @@#include "hw/intc/arm_gic.h" #include "hw/misc/allwinner-h3-ccu.h" #include "hw/misc/allwinner-cpucfg.h" +#include "hw/misc/allwinner-h3-dramc.h" #include "hw/misc/allwinner-h3-sysctrl.h" #include "hw/misc/allwinner-sid.h" #include "hw/sd/allwinner-sdhost.h"
@@ -80,6 +81,9 @@ enum {AW_H3_UART2 ,AW_H3_UART3 ,AW_H3_EMAC , +AW_H3_DRAMCOM , +AW_H3_DRAMCTL , +AW_H3_DRAMPHY ,AW_H3_GIC_DIST ,AW_H3_GIC_CPU , AW_H3_GIC_HYP,
@@ -120,6 +124,7 @@ typedef struct AwH3State {AwA10PITState timer;AwH3ClockCtlState ccu;AwCpuCfgState cpucfg; +AwH3DramCtlState dramc;AwH3SysCtrlState sysctrl;AwSidState sid;AwSdHostState mmc0;
include/hw/misc/allwinner-h3-dramc.h new file +106 -0
106 lines not on this page · raw message
hw/arm/allwinner-h3.c +16 -3
@@ -56,6 +56,9 @@ const hwaddr allwinner_h3_memmap[] = { [AW_H3_UART2] = 0x01c28800, [AW_H3_UART3] = 0x01c28c00, [AW_H3_EMAC] = 0x01c30000, + [AW_H3_DRAMCOM] = 0x01c62000, + [AW_H3_DRAMCTL] = 0x01c63000, + [AW_H3_DRAMPHY] = 0x01c65000, [AW_H3_GIC_DIST] = 0x01c81000, [AW_H3_GIC_CPU] = 0x01c82000, [AW_H3_GIC_HYP] = 0x01c84000,
@@ -110,9 +113,6 @@ struct AwH3Unimplemented { { "scr", 0x01c2c400, 1 * KiB }, { "gpu", 0x01c40000, 64 * KiB }, { "hstmr", 0x01c60000, 4 * KiB }, - { "dramcom", 0x01c62000, 4 * KiB }, - { "dramctl0", 0x01c63000, 4 * KiB }, - { "dramphy0", 0x01c65000, 4 * KiB }, { "spi0", 0x01c68000, 4 * KiB }, { "spi1", 0x01c69000, 4 * KiB }, { "csi", 0x01cb0000, 320 * KiB },
@@ -229,6 +229,13 @@ static void allwinner_h3_init(Object *obj)sysbus_init_child_obj (obj,"emac" , &s->emac,sizeof (s->emac),TYPE_AW_SUN8I_EMAC ); + +sysbus_init_child_obj (obj,"dramc" , &s->dramc,sizeof (s->dramc), +TYPE_AW_H3_DRAMC ); +object_property_add_alias (obj,"ram-addr" ,OBJECT (&s->dramc), +"ram-addr" , &error_abort); +object_property_add_alias (obj,"ram-size" ,OBJECT (&s->dramc), +"ram-size" , &error_abort); }static void allwinner_h3_realize (DeviceState *dev,Error **errp)
@@ -413,6 +420,12 @@ static void allwinner_h3_realize(DeviceState *dev, Error **errp)qdev_get_gpio_in (DEVICE (&s->gic),AW_H3_GIC_SPI_UART3 ), 115200, serial_hd(3), DEVICE_NATIVE_ENDIAN); +/* DRAMC */ +qdev_init_nofail (DEVICE (&s->dramc)); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->dramc),0 , s->memmap[AW_H3_DRAMCOM ]); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->dramc),1 , s->memmap[AW_H3_DRAMCTL ]); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->dramc),2 , s->memmap[AW_H3_DRAMPHY ]); +/* Unimplemented devices */ for (i =0 ; i <ARRAY_SIZE (unimplemented); i++) { create_unimplemented_device(unimplemented[i].device_name,
hw/arm/orangepi.c +6 -0
@@ -81,6 +81,12 @@ static void orangepi_init(MachineState *machine)/* Setup EMAC properties */ object_property_set_int (OBJECT (&h3->emac),1 ,"phy-addr" , &error_abort); +/* DRAMC */ +object_property_set_uint (OBJECT (h3), h3->memmap[AW_H3_SDRAM ], +"ram-addr" , &error_abort); +object_property_set_int (OBJECT (h3), machine->ram_size / MiB,"ram-size" , + &error_abort); +/* Mark H3 object realized */ object_property_set_bool (OBJECT (h3), true,"realized" , &error_abort);
hw/misc/allwinner-h3-dramc.c new file +358 -0
358 lines not on this page · raw message
hw/misc/Makefile.objs +1 -0
@@ -30,6 +30,7 @@ common-obj-$(CONFIG_IVSHMEM_DEVICE) += ivshmem.o common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-h3-ccu.o obj-$(CONFIG_ALLWINNER_H3) += allwinner-cpucfg.o +common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-h3-dramc.o common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-h3-sysctrl.o common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-sid.o common-obj-$(CONFIG_REALVIEW) += arm_sysctl.o
hw/misc/trace-events +10 -0
@@ -5,6 +5,16 @@ allwinner_cpucfg_cpu_reset(uint8_t cpu_id, uint32_t reset_addr) "id %u, reset_ad allwinner_cpucfg_read(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 allwinner_cpucfg_write(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 +# allwinner-h3-dramc.c +allwinner_h3_dramc_rowmirror_disable(void) "Disable row mirror" +allwinner_h3_dramc_rowmirror_enable(uint64_t addr) "Enable row mirror: addr 0x%" PRIx64 +allwinner_h3_dramcom_read(uint64_t offset, uint64_t data, unsigned size) "Read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 +allwinner_h3_dramcom_write(uint64_t offset, uint64_t data, unsigned size) "Write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 +allwinner_h3_dramctl_read(uint64_t offset, uint64_t data, unsigned size) "Read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 +allwinner_h3_dramctl_write(uint64_t offset, uint64_t data, unsigned size) "Write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 +allwinner_h3_dramphy_read(uint64_t offset, uint64_t data, unsigned size) "Read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 +allwinner_h3_dramphy_write(uint64_t offset, uint64_t data, unsigned size) "write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 + # allwinner-sid.c allwinner_sid_read(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 allwinner_sid_write(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32
Signature · 1 line
2.17.1
Re: [PATCH v7 11/18] hw/arm/allwinner-h3: add SDRAM controller device
Quoted 7 lines · Niek Linnenbank
In the Allwinner H3 SoC the SDRAM controller is responsible for interfacing with the external Synchronous Dynamic Random Access Memory (SDRAM). Types of memory that the SDRAM controller supports are DDR2/DDR3 and capacities of up to 2GiB. This commit adds emulation support of the Allwinner H3 SDRAM controller.
Signed-off-by Niek Linnenbank <[email protected]>
Quoted 619 lines
--- include/hw/arm/allwinner-h3.h | 5 + include/hw/misc/allwinner-h3-dramc.h | 106 ++++++++ hw/arm/allwinner-h3.c | 19 +- hw/arm/orangepi.c | 6 + hw/misc/allwinner-h3-dramc.c | 358 +++++++++++++++++++++++++++ hw/misc/Makefile.objs | 1 + hw/misc/trace-events | 10 + 7 files changed, 502 insertions(+), 3 deletions(-) create mode 100644 include/hw/misc/allwinner-h3-dramc.h create mode 100644 hw/misc/allwinner-h3-dramc.cinclude/hw/arm/allwinner-h3.h +5
-0@@ -41,6 +41,7 @@#include "hw/intc/arm_gic.h" #include "hw/misc/allwinner-h3-ccu.h" #include "hw/misc/allwinner-cpucfg.h" +#include "hw/misc/allwinner-h3-dramc.h" #include "hw/misc/allwinner-h3-sysctrl.h" #include "hw/misc/allwinner-sid.h" #include "hw/sd/allwinner-sdhost.h" @@ -80,6 +81,9 @@ enum {AW_H3_UART2 ,AW_H3_UART3 ,AW_H3_EMAC , +AW_H3_DRAMCOM , +AW_H3_DRAMCTL , +AW_H3_DRAMPHY ,AW_H3_GIC_DIST ,AW_H3_GIC_CPU , AW_H3_GIC_HYP,@@ -120,6 +124,7 @@ typedef struct AwH3State {AwA10PITState timer;AwH3ClockCtlState ccu;AwCpuCfgState cpucfg; +AwH3DramCtlState dramc;AwH3SysCtrlState sysctrl;AwSidState sid;AwSdHostState mmc0;include/hw/misc/allwinner-h3-dramc.h new file +106
-0@@ -0,0 +1,106 @@ +/* +* Allwinner H3 SDRAM Controller emulation +* +* Copyright (C) 2019 Niek Linnenbank <[email protected]> +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef HW_MISC_ALLWINNER_H3_DRAMC_H +#define HW_MISC_ALLWINNER_H3_DRAMC_H + +#include "qom/object.h" +#include "hw/sysbus.h" +#include "exec/hwaddr.h" + +/** +* Constants +* @{ +*/ + +/** Highest register address used by DRAMCOM module */ +#define AW_H3_DRAMCOM_REGS_MAXADDR (0x804) + +/** Total number of known DRAMCOM registers */ +#define AW_H3_DRAMCOM_REGS_NUM (AW_H3_DRAMCOM_REGS_MAXADDR / \ + sizeof(uint32_t)) + +/** Highest register address used by DRAMCTL module */ +#define AW_H3_DRAMCTL_REGS_MAXADDR (0x88c) + +/** Total number of known DRAMCTL registers */ +#define AW_H3_DRAMCTL_REGS_NUM (AW_H3_DRAMCTL_REGS_MAXADDR / \ + sizeof(uint32_t)) + +/** Highest register address used by DRAMPHY module */ +#define AW_H3_DRAMPHY_REGS_MAXADDR (0x4) + +/** Total number of known DRAMPHY registers */ +#define AW_H3_DRAMPHY_REGS_NUM (AW_H3_DRAMPHY_REGS_MAXADDR / \ + sizeof(uint32_t)) + +/** @} */ + +/** +* Object model +* @{ +*/ + +#define TYPE_AW_H3_DRAMC "allwinner-h3-dramc" +#define AW_H3_DRAMC (obj) \ + OBJECT_CHECK(AwH3DramCtlState, (obj), TYPE_AW_H3_DRAMC) + +/** @} */ + +/** +* Allwinner H3 SDRAM Controller object instance state. +*/ +typedef struct AwH3DramCtlState { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ + +/** Physical base address for start of RAM */ +hwaddr ram_addr; + +/** Total RAM size in megabytes */ +uint32_t ram_size; + +/** +* @name Memory Regions +* @{ +*/ + +MemoryRegion row_mirror;/**< Simulates rows for RAM size detection */ +MemoryRegion row_mirror_alias;/**< Alias of the row which is mirrored */ +MemoryRegion dramcom_iomem;/**< DRAMCOM module I/O registers */ +MemoryRegion dramctl_iomem;/**< DRAMCTL module I/O registers */ +MemoryRegion dramphy_iomem;/**< DRAMPHY module I/O registers */ + +/** @} */ + +/** +* @name Hardware Registers +* @{ +*/ + +uint32_t dramcom[AW_H3_DRAMCOM_REGS_NUM ];/**< Array of DRAMCOM registers */ +uint32_t dramctl[AW_H3_DRAMCTL_REGS_NUM ];/**< Array of DRAMCTL registers */ +uint32_t dramphy[AW_H3_DRAMPHY_REGS_NUM ] ;/**< Array of DRAMPHY registers */ + +/** @} */ + +}AwH3DramCtlState ; + +#endif /* HW_MISC_ALLWINNER_H3_DRAMC_H */ hw/arm/allwinner-h3.c +16
-3@@ -56,6 +56,9 @@ const hwaddr allwinner_h3_memmap[] = { [AW_H3_UART2] = 0x01c28800, [AW_H3_UART3] = 0x01c28c00, [AW_H3_EMAC] = 0x01c30000, + [AW_H3_DRAMCOM] = 0x01c62000, + [AW_H3_DRAMCTL] = 0x01c63000, + [AW_H3_DRAMPHY] = 0x01c65000, [AW_H3_GIC_DIST] = 0x01c81000, [AW_H3_GIC_CPU] = 0x01c82000, [AW_H3_GIC_HYP] = 0x01c84000,@@ -110,9 +113,6 @@ struct AwH3Unimplemented { { "scr", 0x01c2c400, 1 * KiB }, { "gpu", 0x01c40000, 64 * KiB }, { "hstmr", 0x01c60000, 4 * KiB }, - { "dramcom", 0x01c62000, 4 * KiB }, - { "dramctl0", 0x01c63000, 4 * KiB }, - { "dramphy0", 0x01c65000, 4 * KiB }, { "spi0", 0x01c68000, 4 * KiB }, { "spi1", 0x01c69000, 4 * KiB }, { "csi", 0x01cb0000, 320 * KiB },@@ -229,6 +229,13 @@ static void allwinner_h3_init(Object *obj)sysbus_init_child_obj (obj,"emac" , &s->emac,sizeof (s->emac),TYPE_AW_SUN8I_EMAC ); + +sysbus_init_child_obj (obj,"dramc" , &s->dramc,sizeof (s->dramc), +TYPE_AW_H3_DRAMC ); +object_property_add_alias (obj,"ram-addr" ,OBJECT (&s->dramc), +"ram-addr" , &error_abort); +object_property_add_alias (obj,"ram-size" ,OBJECT (&s->dramc), +"ram-size" , &error_abort); }static void allwinner_h3_realize (DeviceState *dev,Error **errp)@@ -413,6 +420,12 @@ static void allwinner_h3_realize(DeviceState *dev, Error **errp)qdev_get_gpio_in (DEVICE (&s->gic),AW_H3_GIC_SPI_UART3 ), 115200, serial_hd(3), DEVICE_NATIVE_ENDIAN); +/* DRAMC */ +qdev_init_nofail (DEVICE (&s->dramc)); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->dramc),0 , s->memmap[AW_H3_DRAMCOM ]); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->dramc),1 , s->memmap[AW_H3_DRAMCTL ]); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->dramc),2 , s->memmap[AW_H3_DRAMPHY ]); +/* Unimplemented devices */ for (i =0 ; i <ARRAY_SIZE (unimplemented); i++) { create_unimplemented_device(unimplemented[i].device_name,hw/arm/orangepi.c +6
-0@@ -81,6 +81,12 @@ static void orangepi_init(MachineState *machine)/* Setup EMAC properties */ object_property_set_int (OBJECT (&h3->emac),1 ,"phy-addr" , &error_abort); +/* DRAMC */ +object_property_set_uint (OBJECT (h3), h3->memmap[AW_H3_SDRAM ], +"ram-addr" , &error_abort); +object_property_set_int (OBJECT (h3), machine->ram_size / MiB,"ram-size" , + &error_abort); +/* Mark H3 object realized */ object_property_set_bool (OBJECT (h3), true,"realized" , &error_abort);hw/misc/allwinner-h3-dramc.c new file +358
-0@@ -0,0 +1,358 @@ +/* +* Allwinner H3 SDRAM Controller emulation +* +* Copyright (C) 2019 Niek Linnenbank <[email protected]> +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "qemu/osdep.h" +#include "qemu/units.h" +#include "qemu/error-report.h" +#include "hw/sysbus.h" +#include "migration/vmstate.h" +#include "qemu/log.h" +#include "qemu/module.h" +#include "exec/address-spaces.h" +#include "hw/qdev-properties.h" +#include "qapi/error.h" +#include "hw/misc/allwinner-h3-dramc.h" +#include "trace.h" + +#define REG_INDEX (offset) (offset / sizeof(uint32_t)) + +/* DRAMCOM register offsets */ +enum { +REG_DRAMCOM_CR =0x0000 ,/* Control Register */ +}; + +/* DRAMCTL register offsets */ +enum { +REG_DRAMCTL_PIR =0x0000 ,/* PHY Initialization Register */ +REG_DRAMCTL_PGSR =0x0010 ,/* PHY General Status Register */ +REG_DRAMCTL_STATR =0x0018 ,/* Status Register */ +}; + +/* DRAMCTL register flags */ +enum { +REG_DRAMCTL_PGSR_INITDONE = (1 <<0 ), +}; + +enum { +REG_DRAMCTL_STATR_ACTIVE = (1 <<0 ), +}; + +static void allwinner_h3_dramc_map_rows (AwH3DramCtlState *s,uint8_t row_bits, +uint8_t bank_bits,uint16_t page_size) +{ +/* +* This function simulates row addressing behavior when bootloader +* software attempts to detect the amount of available SDRAM. In U-Boot +* the controller is configured with the widest row addressing available. +* Then a pattern is written to RAM at an offset on the row boundary size. +* If the value read back equals the value read back from the +* start of RAM, the bootloader knows the amount of row bits. +* +* This function inserts a mirrored memory region when the configured row +* bits are not matching the actual emulated memory, to simulate the +* same behavior on hardware as expected by the bootloader. +*/ +uint8_t row_bits_actual =0 ; + +/* Calculate the actual row bits using the ram_size property */ +for (uint8_t i =8 ; i <12 ; i++) { +if (1 << i == s->ram_size) { + row_bits_actual = i +3 ; +break ; + } + } + +if (s->ram_size == (1 << (row_bits -3 ))) { +/* When row bits is the expected value, remove the mirror */ +memory_region_set_enabled (&s->row_mirror_alias, false); +trace_allwinner_h3_dramc_rowmirror_disable (); + + }else if (row_bits_actual) { +/* Row bits not matching ram_size, install the rows mirror */ +hwaddr row_mirror = s->ram_addr + ((1 << (row_bits_actual + + bank_bits)) * page_size); + +memory_region_set_enabled (&s->row_mirror_alias, true); +memory_region_set_address (&s->row_mirror_alias, row_mirror); + +trace_allwinner_h3_dramc_rowmirror_enable (row_mirror); + } +} + +static uint64_t allwinner_h3_dramcom_read (void *opaque,hwaddr offset, +unsigned size) +{ +const AwH3DramCtlState *s =AW_H3_DRAMC (opaque); +const uint32_t idx =REG_INDEX (offset); + +if (idx >=AW_H3_DRAMCOM_REGS_NUM ) { +qemu_log_mask (LOG_GUEST_ERROR ,"%s: out-of-bounds offset 0x%04x\n" , + __func__, (uint32_t )offset); +return 0 ; + } + +trace_allwinner_h3_dramcom_read (offset, s->dramcom[idx], size); + +return s->dramcom[idx]; +} + +static void allwinner_h3_dramcom_write (void *opaque,hwaddr offset, +uint64_t val,unsigned size) +{ +AwH3DramCtlState *s =AW_H3_DRAMC (opaque); +const uint32_t idx =REG_INDEX (offset); + +trace_allwinner_h3_dramcom_write (offset, val, size); + +if (idx >=AW_H3_DRAMCOM_REGS_NUM ) { +qemu_log_mask (LOG_GUEST_ERROR ,"%s: out-of-bounds offset 0x%04x\n" , + __func__, (uint32_t )offset); +return ; + } + +switch (offset) { +case REG_DRAMCOM_CR :/* Control Register */ +allwinner_h3_dramc_map_rows (s, ((val >>4 ) &0xf ) +1 , + ((val >>2 ) &0x1 ) +2 , +1 << (((val >>8 ) &0xf ) +3 )); +break ; +default : +break ; + }; + + s->dramcom[idx] = (uint32_t ) val; +} + +static uint64_t allwinner_h3_dramctl_read (void *opaque,hwaddr offset, +unsigned size) +{ +const AwH3DramCtlState *s =AW_H3_DRAMC (opaque); +const uint32_t idx =REG_INDEX (offset); + +if (idx >=AW_H3_DRAMCTL_REGS_NUM ) { +qemu_log_mask (LOG_GUEST_ERROR ,"%s: out-of-bounds offset 0x%04x\n" , + __func__, (uint32_t )offset); +return 0 ; + } + +trace_allwinner_h3_dramctl_read (offset, s->dramctl[idx], size); + +return s->dramctl[idx]; +} + +static void allwinner_h3_dramctl_write (void *opaque,hwaddr offset, +uint64_t val,unsigned size) +{ +AwH3DramCtlState *s =AW_H3_DRAMC (opaque); +const uint32_t idx =REG_INDEX (offset); + +trace_allwinner_h3_dramctl_write (offset, val, size); + +if (idx >=AW_H3_DRAMCTL_REGS_NUM ) { +qemu_log_mask (LOG_GUEST_ERROR ,"%s: out-of-bounds offset 0x%04x\n" , + __func__, (uint32_t )offset); +return ; + } + +switch (offset) { +case REG_DRAMCTL_PIR :/* PHY Initialization Register */ + s->dramctl[REG_INDEX (REG_DRAMCTL_PGSR )] |=REG_DRAMCTL_PGSR_INITDONE ; + s->dramctl[REG_INDEX (REG_DRAMCTL_STATR )] |=REG_DRAMCTL_STATR_ACTIVE ; +break ; +default : +break ; + } + + s->dramctl[idx] = (uint32_t ) val; +} + +static uint64_t allwinner_h3_dramphy_read (void *opaque,hwaddr offset, +unsigned size) +{ +const AwH3DramCtlState *s =AW_H3_DRAMC (opaque); +const uint32_t idx =REG_INDEX (offset); + +if (idx >=AW_H3_DRAMPHY_REGS_NUM ) { +qemu_log_mask (LOG_GUEST_ERROR ,"%s: out-of-bounds offset 0x%04x\n" , + __func__, (uint32_t )offset); +return 0 ; + } + +trace_allwinner_h3_dramphy_read (offset, s->dramphy[idx], size); + +return s->dramphy[idx]; +} + +static void allwinner_h3_dramphy_write (void *opaque,hwaddr offset, +uint64_t val,unsigned size) +{ +AwH3DramCtlState *s =AW_H3_DRAMC (opaque); +const uint32_t idx =REG_INDEX (offset); + +trace_allwinner_h3_dramphy_write (offset, val, size); + +if (idx >=AW_H3_DRAMPHY_REGS_NUM ) { +qemu_log_mask (LOG_GUEST_ERROR ,"%s: out-of-bounds offset 0x%04x\n" , + __func__, (uint32_t )offset); +return ; + } + + s->dramphy[idx] = (uint32_t ) val; +} + +static const MemoryRegionOps allwinner_h3_dramcom_ops = { + .read = allwinner_h3_dramcom_read, + .write = allwinner_h3_dramcom_write, + .endianness =DEVICE_NATIVE_ENDIAN , + .valid = { + .min_access_size =4 , + .max_access_size =4 , + }, + .impl.min_access_size =4 , +}; + +static const MemoryRegionOps allwinner_h3_dramctl_ops = { + .read = allwinner_h3_dramctl_read, + .write = allwinner_h3_dramctl_write, + .endianness =DEVICE_NATIVE_ENDIAN , + .valid = { + .min_access_size =4 , + .max_access_size =4 , + }, + .impl.min_access_size =4 , +}; + +static const MemoryRegionOps allwinner_h3_dramphy_ops = { + .read = allwinner_h3_dramphy_read, + .write = allwinner_h3_dramphy_write, + .endianness =DEVICE_NATIVE_ENDIAN , + .valid = { + .min_access_size =4 , + .max_access_size =4 , + }, + .impl.min_access_size =4 , +}; + +static void allwinner_h3_dramc_reset (DeviceState *dev) +{ +AwH3DramCtlState *s =AW_H3_DRAMC (dev); + +/* Set default values for registers */ +memset (&s->dramcom,0 ,sizeof (s->dramcom)); +memset (&s->dramctl,0 ,sizeof (s->dramctl)); +memset (&s->dramphy,0 ,sizeof (s->dramphy)); +} + +static void allwinner_h3_dramc_realize (DeviceState *dev,Error **errp) +{ +AwH3DramCtlState *s =AW_H3_DRAMC (dev); + +/* Only power of 2 RAM sizes from 256MiB up to 2048MiB are supported */ +for (uint8_t i =8 ; i <13 ; i++) { +if (1 << i == s->ram_size) { +break ; + }else if (i ==12 ) { +error_report ("%s: ram-size %u MiB is not supported" , + __func__, s->ram_size); +exit (1 ); + } + } + +/* Setup row mirror mappings */ +memory_region_init_ram (&s->row_mirror,OBJECT (s), +"allwinner-h3-dramc.row-mirror" , +4 * KiB, &error_abort); +memory_region_add_subregion_overlap (get_system_memory (), s->ram_addr, + &s->row_mirror,10 ); + +memory_region_init_alias (&s->row_mirror_alias,OBJECT (s), +"allwinner-h3-dramc.row-mirror-alias" , + &s->row_mirror,0 ,4 * KiB); +memory_region_add_subregion_overlap (get_system_memory (), + s->ram_addr +1 * MiB, + &s->row_mirror_alias,10 ); +memory_region_set_enabled (&s->row_mirror_alias, false); +} + +static void allwinner_h3_dramc_init (Object *obj) +{ +SysBusDevice *sbd =SYS_BUS_DEVICE (obj); +AwH3DramCtlState *s =AW_H3_DRAMC (obj); + +/* DRAMCOM registers */ +memory_region_init_io (&s->dramcom_iomem,OBJECT (s), + &allwinner_h3_dramcom_ops, s, +TYPE_AW_H3_DRAMC ,4 * KiB); +sysbus_init_mmio (sbd, &s->dramcom_iomem); + +/* DRAMCTL registers */ +memory_region_init_io (&s->dramctl_iomem,OBJECT (s), + &allwinner_h3_dramctl_ops, s, +TYPE_AW_H3_DRAMC ,4 * KiB); +sysbus_init_mmio (sbd, &s->dramctl_iomem); + +/* DRAMPHY registers */ +memory_region_init_io (&s->dramphy_iomem,OBJECT (s), + &allwinner_h3_dramphy_ops, s, +TYPE_AW_H3_DRAMC ,4 * KiB); +sysbus_init_mmio (sbd, &s->dramphy_iomem); +} + +static Property allwinner_h3_dramc_properties[] = { +DEFINE_PROP_UINT64 ("ram-addr" , AwH3DramCtlState, ram_addr,0x0 ), +DEFINE_PROP_UINT32 ("ram-size" , AwH3DramCtlState, ram_size,256 * MiB), +DEFINE_PROP_END_OF_LIST () +}; + +static const VMStateDescription allwinner_h3_dramc_vmstate = { + .name ="allwinner-h3-dramc" , + .version_id =1 , + .minimum_version_id =1 , + .fields = (VMStateField []) { +VMSTATE_UINT32_ARRAY (dramcom, AwH3DramCtlState,AW_H3_DRAMCOM_REGS_NUM ), +VMSTATE_UINT32_ARRAY (dramctl, AwH3DramCtlState,AW_H3_DRAMCTL_REGS_NUM ), +VMSTATE_UINT32_ARRAY (dramphy, AwH3DramCtlState,AW_H3_DRAMPHY_REGS_NUM ), +VMSTATE_END_OF_LIST () + } +}; + +static void allwinner_h3_dramc_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); + + dc->reset = allwinner_h3_dramc_reset; + dc->vmsd = &allwinner_h3_dramc_vmstate; + dc->realize = allwinner_h3_dramc_realize; +device_class_set_props (dc, allwinner_h3_dramc_properties); +} + +static const TypeInfo allwinner_h3_dramc_info = { + .name =TYPE_AW_H3_DRAMC , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_init = allwinner_h3_dramc_init, + .instance_size =sizeof (AwH3DramCtlState), + .class_init = allwinner_h3_dramc_class_init, +}; + +static void allwinner_h3_dramc_register (void ) +{ +type_register_static (&allwinner_h3_dramc_info); +} + +type_init (allwinner_h3_dramc_register)hw/misc/Makefile.objs +1
-0@@ -30,6 +30,7 @@ common-obj-$(CONFIG_IVSHMEM_DEVICE) += ivshmem.o common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-h3-ccu.o obj-$(CONFIG_ALLWINNER_H3) += allwinner-cpucfg.o +common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-h3-dramc.o common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-h3-sysctrl.o common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-sid.o common-obj-$(CONFIG_REALVIEW) += arm_sysctl.ohw/misc/trace-events +10
-0@@ -5,6 +5,16 @@ allwinner_cpucfg_cpu_reset(uint8_t cpu_id, uint32_t reset_addr) "id %u, reset_ad allwinner_cpucfg_read(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 allwinner_cpucfg_write(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 +# allwinner-h3-dramc.c +allwinner_h3_dramc_rowmirror_disable(void) "Disable row mirror" +allwinner_h3_dramc_rowmirror_enable(uint64_t addr) "Enable row mirror: addr 0x%" PRIx64 +allwinner_h3_dramcom_read(uint64_t offset, uint64_t data, unsigned size) "Read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 +allwinner_h3_dramcom_write(uint64_t offset, uint64_t data, unsigned size) "Write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 +allwinner_h3_dramctl_read(uint64_t offset, uint64_t data, unsigned size) "Read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 +allwinner_h3_dramctl_write(uint64_t offset, uint64_t data, unsigned size) "Write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 +allwinner_h3_dramphy_read(uint64_t offset, uint64_t data, unsigned size) "Read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 +allwinner_h3_dramphy_write(uint64_t offset, uint64_t data, unsigned size) "write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 + # allwinner-sid.c allwinner_sid_read(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 allwinner_sid_write(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32
Signature · 1 line
Alex Bennée
PATCH v7 12/18 hw/arm/allwinner: add RTC device support
In reply to Niek LinnenbankAllwinner System-on-Chips usually contain a Real Time Clock (RTC) for non-volatile system date and time keeping. This commit adds a generic Allwinner RTC device that supports the RTC devices found in Allwinner SoC family sun4i (A10), sun7i (A20) and sun6i and newer (A31, H2+, H3, etc). The following RTC functionality and features are implemented:
* Year-Month-Day read/write
* Hour-Minute-Second read/write
* General Purpose storage
The following boards are extended with the RTC device:
* Cubieboard (hw/arm/cubieboard.c)
* Orange Pi PC (hw/arm/orangepi.c)
--- include/hw/arm/allwinner-a10.h | 2 + include/hw/arm/allwinner-h3.h | 3 + include/hw/rtc/allwinner-rtc.h | 134 +++++++++++ hw/arm/allwinner-a10.c | 8 + hw/arm/allwinner-h3.c | 9 +- hw/rtc/allwinner-rtc.c | 411 +++++++++++++++++++++++++++++++++ hw/rtc/Makefile.objs | 1 + hw/rtc/trace-events | 4 + 8 files changed, 571 insertions(+), 1 deletion(-) create mode 100644 include/hw/rtc/allwinner-rtc.h create mode 100644 hw/rtc/allwinner-rtc.c
include/hw/arm/allwinner-a10.h +2 -0
@@ -11,6 +11,7 @@#include "hw/ide/ahci.h" #include "hw/usb/hcd-ohci.h" #include "hw/usb/hcd-ehci.h" +#include "hw/rtc/allwinner-rtc.h" #include "target/arm/cpu.h"
@@ -33,6 +34,7 @@ typedef struct AwA10State {AwEmacState emac;AllwinnerAHCIState sata;AwSdHostState mmc0; +AwRtcState rtc;MemoryRegion sram_a;EHCISysBusState ehci[AW_A10_NUM_USB ];OHCISysBusState ohci[AW_A10_NUM_USB ];
include/hw/arm/allwinner-h3.h +3 -0
@@ -46,6 +46,7 @@#include "hw/misc/allwinner-sid.h" #include "hw/sd/allwinner-sdhost.h" #include "hw/net/allwinner-sun8i-emac.h" +#include "hw/rtc/allwinner-rtc.h" #include "target/arm/cpu.h" #include "sysemu/block-backend.h"
@@ -88,6 +89,7 @@ enum {AW_H3_GIC_CPU ,AW_H3_GIC_HYP ,AW_H3_GIC_VCPU , +AW_H3_RTC ,AW_H3_CPUCFG , AW_H3_SDRAM };
@@ -129,6 +131,7 @@ typedef struct AwH3State {AwSidState sid;AwSdHostState mmc0;AwSun8iEmacState emac; +AwRtcState rtc;GICState gic;MemoryRegion sram_a1;MemoryRegion sram_a2;
include/hw/rtc/allwinner-rtc.h new file +134 -0
134 lines not on this page · raw message
hw/arm/allwinner-a10.c +8 -0
@@ -35,6 +35,7 @@#define AW_A10_EHCI_BASE 0x01c14000#define AW_A10_OHCI_BASE 0x01c14400#define AW_A10_SATA_BASE 0x01c18000 +#define AW_A10_RTC_BASE 0x01c20d00static void aw_a10_init (Object *obj) {
@@ -68,6 +69,9 @@ static void aw_a10_init(Object *obj)sysbus_init_child_obj (obj,"mmc0" , &s->mmc0,sizeof (s->mmc0),TYPE_AW_SDHOST_SUN4I ); + +sysbus_init_child_obj (obj,"rtc" , &s->rtc,sizeof (s->rtc), +TYPE_AW_RTC_SUN4I ); }static void aw_a10_realize (DeviceState *dev,Error **errp)
@@ -175,6 +179,10 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)sysbus_connect_irq (SYS_BUS_DEVICE (&s->mmc0),0 ,qdev_get_gpio_in (dev,32 ));object_property_add_alias (OBJECT (s),"sd-bus" ,OBJECT (&s->mmc0),"sd-bus" , &error_abort); + +/* RTC */ +qdev_init_nofail (DEVICE (&s->rtc)); +sysbus_mmio_map_overlap (SYS_BUS_DEVICE (&s->rtc),0 ,AW_A10_RTC_BASE ,10 ); }static void aw_a10_class_init (ObjectClass *oc,void *data)
hw/arm/allwinner-h3.c +8 -1
@@ -63,6 +63,7 @@ const hwaddr allwinner_h3_memmap[] = { [AW_H3_GIC_CPU] = 0x01c82000, [AW_H3_GIC_HYP] = 0x01c84000, [AW_H3_GIC_VCPU] = 0x01c86000, + [AW_H3_RTC] = 0x01f00000, [AW_H3_CPUCFG] = 0x01f01c00, [AW_H3_SDRAM] = 0x40000000 };
@@ -118,7 +119,6 @@ struct AwH3Unimplemented { { "csi", 0x01cb0000, 320 * KiB }, { "tve", 0x01e00000, 64 * KiB }, { "hdmi", 0x01ee0000, 128 * KiB }, - { "rtc", 0x01f00000, 1 * KiB }, { "r_timer", 0x01f00800, 1 * KiB }, { "r_intc", 0x01f00c00, 1 * KiB }, { "r_wdog", 0x01f01000, 1 * KiB },
@@ -236,6 +236,9 @@ static void allwinner_h3_init(Object *obj) "ram-addr", &error_abort);object_property_add_alias (obj,"ram-size" ,OBJECT (&s->dramc),"ram-size" , &error_abort); + +sysbus_init_child_obj (obj,"rtc" , &s->rtc,sizeof (s->rtc), +TYPE_AW_RTC_SUN6I ); }static void allwinner_h3_realize (DeviceState *dev,Error **errp)
@@ -426,6 +429,10 @@ static void allwinner_h3_realize(DeviceState *dev, Error **errp)sysbus_mmio_map (SYS_BUS_DEVICE (&s->dramc),1 , s->memmap[AW_H3_DRAMCTL ]);sysbus_mmio_map (SYS_BUS_DEVICE (&s->dramc),2 , s->memmap[AW_H3_DRAMPHY ]); +/* RTC */ +qdev_init_nofail (DEVICE (&s->rtc)); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->rtc),0 , s->memmap[AW_H3_RTC ]); +/* Unimplemented devices */ for (i =0 ; i <ARRAY_SIZE (unimplemented); i++) { create_unimplemented_device(unimplemented[i].device_name,
hw/rtc/allwinner-rtc.c new file +411 -0
411 lines not on this page · raw message
hw/rtc/Makefile.objs +1 -0
@@ -12,3 +12,4 @@ obj-$(CONFIG_MC146818RTC) += mc146818rtc.o common-obj-$(CONFIG_SUN4V_RTC) += sun4v-rtc.o common-obj-$(CONFIG_ASPEED_SOC) += aspeed_rtc.o common-obj-$(CONFIG_GOLDFISH_RTC) += goldfish_rtc.o +common-obj-$(CONFIG_ALLWINNER_H3) += allwinner-rtc.o
hw/rtc/trace-events +4 -0
@@ -1,5 +1,9 @@ # See docs/devel/tracing.txt for syntax documentation. +# allwinner-rtc.c +allwinner_rtc_read(uint64_t addr, uint64_t value) "addr 0x%" PRIx64 " value 0x%" PRIx64 +allwinner_rtc_write(uint64_t addr, uint64_t value) "addr 0x%" PRIx64 " value 0x%" PRIx64 + # sun4v-rtc.c sun4v_rtc_read(uint64_t addr, uint64_t value) "read: addr 0x%" PRIx64 " value 0x%" PRIx64 sun4v_rtc_write(uint64_t addr, uint64_t value) "write: addr 0x%" PRIx64 " value 0x%" PRIx64
Signature · 1 line
2.17.1
Re: [PATCH v7 12/18] hw/arm/allwinner: add RTC device support
Quoted 10 lines · Niek Linnenbank
Allwinner System-on-Chips usually contain a Real Time Clock (RTC) for non-volatile system date and time keeping. This commit adds a generic Allwinner RTC device that supports the RTC devices found in Allwinner SoC family sun4i (A10), sun7i (A20) and sun6i and newer (A31, H2+, H3, etc). The following RTC functionality and features are implemented:
* Year-Month-Day read/write
* Hour-Minute-Second read/write
* General Purpose storage
Quoted 6 lines
The following boards are extended with the RTC device:
* Cubieboard (
hw/arm/cubieboard.c)
* Orange Pi PC (hw/arm/orangepi.c)Signed-off-by Niek Linnenbank <[email protected]>
Signature · 1 line
Alex Bennée
PATCH v7 13/18 tests/boot_linux_console: Add a quick test for the OrangePi PC board
In reply to Niek LinnenbankFrom: Philippe Mathieu-Daudé <[email protected]>
This test boots a Linux kernel on a OrangePi PC board and verify the serial output is working.
The kernel image and DeviceTree blob are built by the Armbian project (based on Debian):
https://www.armbian.com/orange-pi-pc/
If ARM is a target being built, "make check-acceptance" will automatically include this test by the use of the "arch:arm" tags.
Alternatively, this test can be run using:
$ make check-venv $ ./tests/venv/bin/avocado --show=console,app run -t machine:orangepi-pc tests/acceptance/boot_linux_console.py JOB ID : 2e4d15eceb13c33672af406f08171e6e9de1414a JOB LOG : ~/job-results/job-2019-12-17T05.46-2e4d15e/job.log (1/1) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_orangepi: console: Uncompressing Linux... done, booting the kernel. console: Booting Linux on physical CPU 0x0 console: Linux version 4.20.7-sunxi ([email protected]) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #5.75 SMP Fri Feb 8 09:02:10 CET 2019 console: CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=50c5387d console: CPU: div instructions available: patching division code console: CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache console: OF: fdt: Machine model: Xunlong Orange Pi PC console: Memory policy: Data cache writealloc console: OF: reserved mem: failed to allocate memory for node 'cma@4a000000' console: cma: Failed to reserve 128 MiB console: psci: probing for conduit method from DT. console: psci: PSCIv0.2 detected in firmware. console: psci: Using standard PSCI v0.2 function IDs console: psci: Trusted OS migration not required console: random: get_random_bytes called from start_kernel+0x8d/0x3c2 with crng_init=0 console: percpu: Embedded 18 pages/cpu @(ptrval) s41228 r8192 d24308 u73728 console: Built 1 zonelists, mobility grouping on. Total pages: 32480 console: Kernel command line: printk.time=0 console=ttyS0,115200 PASS (8.59 s) JOB TIME : 8.81 s
--- tests/acceptance/boot_linux_console.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
tests/acceptance/boot_linux_console.py +25 -0
@@ -507,6 +507,31 @@ class BootLinuxConsole(Test): exec_command_and_wait_for_pattern(self, 'reboot', 'reboot: Restarting system') + def test_arm_orangepi(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:orangepi-pc + """ + deb_url = ('https://apt.armbian.com/pool/main/l/' + 'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb') + deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + kernel_path = self.extract_from_deb(deb_path, + '/boot/vmlinuz-4.20.7-sunxi') + dtb_path = '/usr/lib/linux-image-dev-sunxi/sun8i-h3-orangepi-pc.dtb' + dtb_path = self.extract_from_deb(deb_path, dtb_path) + + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyS0,115200n8 ' + 'earlycon=uart,mmio32,0x1c28000') + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-append', kernel_command_line) + self.vm.launch() + console_pattern = 'Kernel command line: %s' % kernel_command_line + self.wait_for_console_pattern(console_pattern) + def test_s390x_s390_ccw_virtio(self): """ :avocado: tags=arch:s390x
Signature · 1 line
2.17.1
Re: [PATCH v7 13/18] tests/boot_linux_console: Add a quick test for the OrangePi PC board
Quoted 40 lines · Niek Linnenbank
From: Philippe Mathieu-Daudé <[email protected]>
This test boots a Linux kernel on a OrangePi PC board and verify the serial output is working.
The kernel image and DeviceTree blob are built by the Armbian project (based on Debian):
https://www.armbian.com/orange-pi-pc/If ARM is a target being built, "make check-acceptance" will automatically include this test by the use of the "arch:arm" tags.
Alternatively, this test can be run using:
$ make check-venv $ ./tests/venv/bin/avocado --show=console,app run -t machine:orangepi-pc tests/acceptance/boot_linux_console.py JOB ID : 2e4d15eceb13c33672af406f08171e6e9de1414a JOB LOG : ~/job-results/job-2019-12-17T05.46-2e4d15e/job.log (1/1) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_orangepi: console: Uncompressing Linux... done, booting the kernel. console: Booting Linux on physical CPU 0x0 console: Linux version 4.20.7-sunxi ([email protected]) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #5.75 SMP Fri Feb 8 09:02:10 CET 2019 console: CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=50c5387d console: CPU: div instructions available: patching division code console: CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache console: OF: fdt: Machine model: Xunlong Orange Pi PC console: Memory policy: Data cache writealloc console: OF: reserved mem: failed to allocate memory for node 'cma@4a000000' console: cma: Failed to reserve 128 MiB console: psci: probing for conduit method from DT. console: psci: PSCIv0.2 detected in firmware. console: psci: Using standard PSCI v0.2 function IDs console: psci: Trusted OS migration not required console: random: get_random_bytes called from start_kernel+0x8d/0x3c2 with crng_init=0 console: percpu: Embedded 18 pages/cpu @(ptrval) s41228 r8192 d24308 u73728 console: Built 1 zonelists, mobility grouping on. Total pages: 32480 console: Kernel command line: printk.time=0 console=ttyS0,115200 PASS (8.59 s) JOB TIME : 8.81 s
Quoted 3 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>[NL: rename in commit message Raspbian to Armbian, remove vm.set_machine()]Signed-off-by Niek Linnenbank <[email protected]>
Signature · 1 line
Alex Bennée
PATCH v7 14/18 tests/boot_linux_console: Add initrd test for the Orange Pi PC board
In reply to Niek LinnenbankFrom: Philippe Mathieu-Daudé <[email protected]>
This test boots a Linux kernel on a OrangePi PC board and verify the serial output is working.
The kernel image and DeviceTree blob are built by the Armbian project (based on Debian):
https://www.armbian.com/orange-pi-pc/
The cpio image used comes from the linux-build-test project:
https://github.com/groeck/linux-build-test
If ARM is a target being built, "make check-acceptance" will automatically include this test by the use of the "arch:arm" tags.
Alternatively, this test can be run using:
$ avocado --show=console run -t machine:orangepi-pc tests/acceptance/boot_linux_console.py console: Uncompressing Linux... done, booting the kernel. console: Booting Linux on physical CPU 0x0 console: Linux version 4.20.7-sunxi ([email protected]) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #5.75 SMP Fri Feb 8 09:02:10 CET 2019 console: CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=50c5387d console: CPU: div instructions available: patching division code console: CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache console: OF: fdt: Machine model: Xunlong Orange Pi PC [...] console: Trying to unpack rootfs image as initramfs... console: Freeing initrd memory: 3256K console: Freeing unused kernel memory: 1024K console: Run /init as init process console: mount: mounting devtmpfs on /dev failed: Device or resource busy console: Starting logging: OK console: Initializing random number generator... random: dd: uninitialized urandom read (512 bytes read) console: done. console: Starting network: OK console: Found console ttyS0 console: Linux version 4.20.7-sunxi ([email protected]) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #5.75 SMP Fri Feb 8 09:02:10 CET 2019 console: Boot successful. console: cat /proc/cpuinfo console: / # cat /proc/cpuinfo console: processor : 0 console: model name : ARMv7 Processor rev 5 (v7l) console: BogoMIPS : 125.00 console: Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm console: CPU implementer : 0x41 console: CPU architecture: 7 console: CPU variant : 0x0 console: CPU part : 0xc07 console: CPU revision : 5 [...] console: processor : 3 console: model name : ARMv7 Processor rev 5 (v7l) console: BogoMIPS : 125.00 console: Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm console: CPU implementer : 0x41 console: CPU architecture: 7 console: CPU variant : 0x0 console: CPU part : 0xc07 console: CPU revision : 5 console: Hardware : Allwinner sun8i Family console: Revision : 0000 console: Serial : 0000000000000000 console: cat /proc/iomem console: / # cat /proc/iomem console: 01000000-010fffff : clock@1000000 console: 01c00000-01c00fff : system-control@1c00000 console: 01c02000-01c02fff : dma-controller@1c02000 [...] console: reboot console: / # reboot console: / # Found console ttyS0 console: Stopping network: OK console: hrtimer: interrupt took 21852064 ns console: Saving random seed... random: dd: uninitialized urandom read (512 bytes read) console: done. console: Stopping logging: OK console: umount: devtmpfs busy - remounted read-only console: umount: can't unmount /: Invalid argument console: The system is going down NOW! console: Sent SIGTERM to all processes console: Sent SIGKILL to all processes console: Requesting system reboot console: reboot: Restarting system PASS (48.32 s) JOB TIME : 49.16 s
--- tests/acceptance/boot_linux_console.py | 40 ++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
tests/acceptance/boot_linux_console.py +40 -0
@@ -532,6 +532,46 @@ class BootLinuxConsole(Test): console_pattern = 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern) + def test_arm_orangepi_initrd(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:orangepi-pc + """ + deb_url = ('https://apt.armbian.com/pool/main/l/' + 'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb') + deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + kernel_path = self.extract_from_deb(deb_path, + '/boot/vmlinuz-4.20.7-sunxi') + dtb_path = '/usr/lib/linux-image-dev-sunxi/sun8i-h3-orangepi-pc.dtb' + dtb_path = self.extract_from_deb(deb_path, dtb_path) + initrd_url = ('https://github.com/groeck/linux-build-test/raw/' + '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/' + 'arm/rootfs-armv7a.cpio.gz') + initrd_hash = '604b2e45cdf35045846b8bbfbf2129b1891bdc9c' + initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash) + initrd_path = os.path.join(self.workdir, 'rootfs.cpio') + archive.gzip_uncompress(initrd_path_gz, initrd_path) + + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyS0,115200 ' + 'panic=-1 noreboot') + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-initrd', initrd_path, + '-append', kernel_command_line, + '-no-reboot') + self.vm.launch() + self.wait_for_console_pattern('Boot successful.') + + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', + 'Allwinner sun8i Family') + exec_command_and_wait_for_pattern(self, 'cat /proc/iomem', + 'system-control@1c00000') + exec_command_and_wait_for_pattern(self, 'reboot', + 'reboot: Restarting system') + def test_s390x_s390_ccw_virtio(self): """ :avocado: tags=arch:s390x
Signature · 1 line
2.17.1
Re: [PATCH v7 14/18] tests/boot_linux_console: Add initrd test for the Orange Pi PC board
Quoted 5 lines · Niek Linnenbank
From: Philippe Mathieu-Daudé <[email protected]>
This test boots a Linux kernel on a OrangePi PC board and verify the serial output is working.
<snip>
Signature · 1 line
Alex Bennée
PATCH v7 15/18 tests/boot_linux_console: Add a SD card test for the OrangePi PC board
In reply to Niek LinnenbankFrom: Philippe Mathieu-Daudé <[email protected]>
The kernel image and DeviceTree blob are built by the Armbian project (based on Debian):
https://www.armbian.com/orange-pi-pc/
The SD image is from the kernelci.org project:
https://kernelci.org/faq/#the-code
If ARM is a target being built, "make check-acceptance" will automatically include this test by the use of the "arch:arm" tags.
Alternatively, this test can be run using:
$ avocado --show=console run -t machine:orangepi-pc tests/acceptance/boot_linux_console.py console: Uncompressing Linux... done, booting the kernel. console: Booting Linux on physical CPU 0x0 console: Linux version 4.20.7-sunxi ([email protected]) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #5.75 SMP Fri Feb 8 09:02:10 CET 2019 console: CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=50c5387d [...] console: sunxi-wdt 1c20ca0.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0) console: sunxi-mmc 1c0f000.mmc: Linked as a consumer to regulator.2 console: sunxi-mmc 1c0f000.mmc: Got CD GPIO console: ledtrig-cpu: registered to indicate activity on CPUs console: hidraw: raw HID events driver (C) Jiri Kosina console: usbcore: registered new interface driver usbhid console: usbhid: USB HID core driver console: Initializing XFRM netlink socket console: sunxi-mmc 1c0f000.mmc: initialized, max. request size: 16384 KB console: NET: Registered protocol family 10 console: mmc0: host does not support reading read-only switch, assuming write-enable console: mmc0: Problem switching card into high-speed mode! console: mmc0: new SD card at address 4567 console: mmcblk0: mmc0:4567 QEMU! 60.0 MiB [...] console: EXT4-fs (mmcblk0): mounting ext2 file system using the ext4 subsystem console: EXT4-fs (mmcblk0): mounted filesystem without journal. Opts: (null) console: VFS: Mounted root (ext2 filesystem) on device 179:0. console: Run /sbin/init as init process console: EXT4-fs (mmcblk0): re-mounted. Opts: block_validity,barrier,user_xattr,acl console: Starting syslogd: OK console: Starting klogd: OK console: Populating /dev using udev: udevd[203]: starting version 3.2.7 console: /bin/sh: can't access tty; job control turned off console: cat /proc/partitions console: / # cat /proc/partitions console: major minor #blocks name console: 1 0 4096 ram0 console: 1 1 4096 ram1 console: 1 2 4096 ram2 console: 1 3 4096 ram3 console: 179 0 61440 mmcblk0 console: reboot console: / # reboot console: umount: devtmpfs busy - remounted read-only console: EXT4-fs (mmcblk0): re-mounted. Opts: (null) console: The system is going down NOW! console: Sent SIGTERM to all processes console: Sent SIGKILL to all processes console: Requesting system reboot console: reboot: Restarting system JOB TIME : 68.64 s
--- tests/acceptance/boot_linux_console.py | 47 ++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
tests/acceptance/boot_linux_console.py +47 -0
@@ -572,6 +572,53 @@ class BootLinuxConsole(Test): exec_command_and_wait_for_pattern(self, 'reboot', 'reboot: Restarting system') + def test_arm_orangepi_sd(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:orangepi-pc + """ + deb_url = ('https://apt.armbian.com/pool/main/l/' + 'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb') + deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + kernel_path = self.extract_from_deb(deb_path, + '/boot/vmlinuz-4.20.7-sunxi') + dtb_path = '/usr/lib/linux-image-dev-sunxi/sun8i-h3-orangepi-pc.dtb' + dtb_path = self.extract_from_deb(deb_path, dtb_path) + rootfs_url = ('http://storage.kernelci.org/images/rootfs/buildroot/' + 'kci-2019.02/armel/base/rootfs.ext2.xz') + rootfs_hash = '692510cb625efda31640d1de0a8d60e26040f061' + rootfs_path_xz = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash) + rootfs_path = os.path.join(self.workdir, 'rootfs.cpio') + archive.lzma_uncompress(rootfs_path_xz, rootfs_path) + + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyS0,115200 ' + 'root=/dev/mmcblk0 rootwait rw ' + 'panic=-1 noreboot') + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-drive', 'file=' + rootfs_path + ',if=sd,format=raw', + '-append', kernel_command_line, + '-no-reboot') + self.vm.launch() + shell_ready = "/bin/sh: can't access tty; job control turned off" + self.wait_for_console_pattern(shell_ready) + + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', + 'Allwinner sun8i Family') + exec_command_and_wait_for_pattern(self, 'cat /proc/partitions', + 'mmcblk0') + exec_command_and_wait_for_pattern(self, 'ifconfig eth0 up', + 'eth0: Link is Up') + exec_command_and_wait_for_pattern(self, 'udhcpc eth0', + 'udhcpc: lease of 10.0.2.15 obtained') + exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2', + '3 packets transmitted, 3 packets received, 0% packet loss') + exec_command_and_wait_for_pattern(self, 'reboot', + 'reboot: Restarting system') + def test_s390x_s390_ccw_virtio(self): """ :avocado: tags=arch:s390x
Signature · 1 line
2.17.1
Re: [PATCH v7 15/18] tests/boot_linux_console: Add a SD card test for the OrangePi PC board
Quoted 2 lines · Niek Linnenbank
From: Philippe Mathieu-Daudé <[email protected]>
<snip>
Signature · 1 line
Alex Bennée
PATCH v7 16/18 tests/boot_linux_console: Add a SLOW test booting Ubuntu on OrangePi PC
In reply to Niek LinnenbankFrom: Philippe Mathieu-Daudé <[email protected]>
This test boots Ubuntu Bionic on a OrangePi PC board.
As it requires 1GB of storage, and is slow, this test is disabled on automatic CI testing.
It is useful for workstation testing. Currently Avocado timeouts too quickly, so we can't run userland commands.
The kernel image and DeviceTree blob are built by the Armbian project (based on Debian):
https://www.armbian.com/orange-pi-pc/
The Ubuntu image is downloaded from:
https://dl.armbian.com/orangepipc/Bionic_current
This test can be run using:
$ AVOCADO_ALLOW_LARGE_STORAGE=yes \
avocado --show=app,console run -t machine:orangepi-pc \
tests/acceptance/boot_linux_console.py
console: U-Boot SPL 2019.04-armbian (Nov 18 2019 - 23:08:35 +0100)
console: DRAM: 1024 MiB
console: Failed to set core voltage! Can't set CPU frequency
console: Trying to boot from MMC1
console: U-Boot 2019.04-armbian (Nov 18 2019 - 23:08:35 +0100) Allwinner Technology
console: CPU: Allwinner H3 (SUN8I 0000)
console: Model: Xunlong Orange Pi PC
console: DRAM: 1 GiB
console: MMC: mmc@1c0f000: 0
[...]
console: Uncompressing Linux... done, booting the kernel.
console: Booting Linux on physical CPU 0x0
console: Linux version 5.3.9-sunxi (root@builder) (gcc version 8.3.0 (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36))) #19.11.3 SMP Mon Nov 18 18:49:43 CET 2019
console: CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=50c5387d
console: CPU: div instructions available: patching division code
console: CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
console: OF: fdt: Machine model: Xunlong Orange Pi PC
[...]
console: EXT4-fs (mmcblk0p1): mounted filesystem with writeback data mode. Opts: (null)
console: done.
console: Begin: Running /scripts/local-bottom ... done.
console: Begin: Running /scripts/init-bottom ... done.
console: systemd[1]: systemd 237 running in system mode. (...)
console: systemd[1]: Detected architecture arm.
console: Welcome to Ubuntu 18.04.3 LTS!
console: systemd[1]: Set hostname to <orangepipc>.--- tests/acceptance/boot_linux_console.py | 48 ++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
tests/acceptance/boot_linux_console.py +48 -0
@@ -19,7 +19,13 @@ from avocado_qemu import exec_command_and_wait_for_pattern from avocado_qemu import wait_for_console_pattern from avocado.utils import process from avocado.utils import archive +from avocado.utils.path import find_command, CmdNotFoundError +P7ZIP_AVAILABLE = True +try: + find_command('7z') +except CmdNotFoundError: + P7ZIP_AVAILABLE = False class BootLinuxConsole(Test): """
@@ -619,6 +625,48 @@ class BootLinuxConsole(Test): exec_command_and_wait_for_pattern(self, 'reboot', 'reboot: Restarting system') + @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited') + @skipUnless(P7ZIP_AVAILABLE, '7z not installed') + def test_arm_orangepi_bionic(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:orangepi-pc + """ + + # This test download a 196MB compressed image and expand it to 932MB... + image_url = ('https://dl.armbian.com/orangepipc/archive/' + 'Armbian_19.11.3_Orangepipc_bionic_current_5.3.9.7z') + image_hash = '196a8ffb72b0123d92cea4a070894813d305c71e' + image_path_7z = self.fetch_asset(image_url, asset_hash=image_hash) + image_name = 'Armbian_19.11.3_Orangepipc_bionic_current_5.3.9.img' + image_path = os.path.join(self.workdir, image_name) + process.run("7z e -o%s %s" % (self.workdir, image_path_7z)) + + self.vm.set_console() + self.vm.add_args('-drive', 'file=' + image_path + ',if=sd,format=raw', + '-nic', 'user', + '-no-reboot') + self.vm.launch() + + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyS0,115200 ' + 'loglevel=7 ' + 'nosmp ' + 'systemd.default_timeout_start_sec=9000 ' + 'systemd.mask=armbian-zram-config.service ' + 'systemd.mask=armbian-ramlog.service') + + self.wait_for_console_pattern('U-Boot SPL') + self.wait_for_console_pattern('Autoboot in ') + exec_command_and_wait_for_pattern(self, ' ', '=>') + exec_command_and_wait_for_pattern(self, "setenv extraargs '" + + kernel_command_line + "'", '=>') + exec_command_and_wait_for_pattern(self, 'boot', 'Starting kernel ...'); + + self.wait_for_console_pattern('systemd[1]: Set hostname ' + + 'to <orangepipc>') + self.wait_for_console_pattern('Starting Load Kernel Modules...') + def test_s390x_s390_ccw_virtio(self): """ :avocado: tags=arch:s390x
Signature · 1 line
2.17.1
Re: [PATCH v7 16/18] tests/boot_linux_console: Add a SLOW test booting Ubuntu on OrangePi PC
Quoted 4 lines · Niek Linnenbank
From: Philippe Mathieu-Daudé <[email protected]>
This test boots Ubuntu Bionic on a OrangePi PC board.
<snip>
Signature · 1 line
Alex Bennée
PATCH v7 17/18 tests/boot_linux_console: Test booting NetBSD via U-Boot on OrangePi PC
In reply to Niek LinnenbankFrom: Philippe Mathieu-Daudé <[email protected]>
This test boots U-Boot then NetBSD (stored on a SD card) on a OrangePi PC board.
As it requires ~1.3GB of storage, it is disabled by default.
U-Boot is built by the Debian project [1], and the SD card image is provided by the NetBSD organization [2].
Once the compressed SD card image is downloaded (304MB) and extracted, this test is fast:
$ AVOCADO_ALLOW_LARGE_STORAGE=yes \
avocado --show=app,console run -t machine:orangepi-pc \
tests/acceptance/boot_linux_console.py
console: U-Boot SPL 2020.01+dfsg-1 (Jan 08 2020 - 08:19:44 +0000)
console: DRAM: 1024 MiB
console: U-Boot 2020.01+dfsg-1 (Jan 08 2020 - 08:19:44 +0000) Allwinner Technology
console: CPU: Allwinner H3 (SUN8I 0000)
console: scanning bus usb@1c1b000 for devices... 1 USB Device(s) found
console: scanning bus usb@1c1d000 for devices... 1 USB Device(s) found
console: scanning usb for storage devices... 0 Storage Device(s) found
console: Hit any key to stop autoboot: 0
console: => setenv bootargs root=ld0a
console: => setenv kernel netbsd-GENERIC.ub
console: => setenv fdtfile dtb/sun8i-h3-orangepi-pc.dtb
console: => boot
console: ## Booting kernel from Legacy Image at 42000000 ...
console: Image Name: NetBSD/earmv7hf 9.0_RC1
console: Image Type: ARM Linux Kernel Image (no loading done) (uncompressed)
console: XIP Kernel Image (no loading done)
console: Loading Device Tree to 49ff6000, end 49fffe01 ... OK
console: Starting kernel ...
console: [ 1.0000000] NetBSD/evbarm (fdt) booting ...
console: [ 1.0000000] NetBSD 9.0 (GENERIC) #0: Fri Feb 14 00:06:28 UTC 2020
console: [ 1.0000000] [email protected]:/usr/src/sys/arch/evbarm/compile/GENERIC
console: [ 1.0000000] total memory = 1024 MB
console: [ 1.0000000] avail memory = 1003 MB
console: [ 1.0000000] armfdt0 (root)
console: [ 1.0000000] simplebus0 at armfdt0: Xunlong Orange Pi PC
console: [ 1.0000000] cpu0 at cpus0: Cortex-A7 r0p5 (Cortex V7A core)
console: [ 1.0000000] cpu0: DC enabled IC enabled WB enabled LABT branch prediction enabled
console: [ 1.0000000] cpu0: 32KB/64B 2-way L1 VIPT Instruction cache
console: [ 1.0000000] cpu0: 32KB/64B 2-way write-back-locking-C L1 PIPT Data cache
console: [ 1.0000000] cpu0: 2304KB/64B 16-way write-through L2 PIPT Unified cache
console: [ 1.0000000] vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
...
console: [ 2.3812082] sdmmc0: SD card status: 4-bit, C0
console: [ 2.3812082] ld0 at sdmmc0: <0xaa:0x5859:QEMU!:0x01:0xdeadbeef:0x062>
console: [ 2.4012856] ld0: 1226 MB, 622 cyl, 64 head, 63 sec, 512 bytes/sect x 2511872 sectors
console: [ 2.5321222] ld0: 4-bit width, High-Speed/SDR25, 50.000 MHz
console: [ 3.1068718] WARNING: 4 errors while detecting hardware; check system log.
console: [ 3.1179868] boot device: ld0
console: [ 3.1470623] root on ld0a dumps on ld0b
console: [ 3.2464436] root file system type: ffs
console: [ 3.2897123] kern.module.path=/stand/evbarm/9.0/modules
console: Mon Feb 17 20:33:35 UTC 2020
console: Starting root file system check:
PASS (35.96 s)
RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB TIME : 36.09 sNote, this test only took ~65 seconds to run on Travis-CI, see: [3].
This test is based on a description from Niek Linnenbank from [4].
[1] https://wiki.debian.org/InstallingDebianOn/Allwinner#Creating_a_bootable_SD_Card_with_u-boot
[2] https://wiki.netbsd.org/ports/evbarm/allwinner/
[3] https://travis-ci.org/philmd/qemu/jobs/638823612#L3778
[4] https://www.mail-archive.com/[email protected]/msg669347.html
--- tests/acceptance/boot_linux_console.py | 70 ++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)
tests/acceptance/boot_linux_console.py +70 -0
@@ -16,6 +16,7 @@ import shutil from avocado import skipUnless from avocado_qemu import Test from avocado_qemu import exec_command_and_wait_for_pattern +from avocado_qemu import interrupt_interactive_console_until_pattern from avocado_qemu import wait_for_console_pattern from avocado.utils import process from avocado.utils import archive
@@ -667,6 +668,75 @@ class BootLinuxConsole(Test): 'to <orangepipc>') self.wait_for_console_pattern('Starting Load Kernel Modules...') + @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited') + def test_arm_orangepi_uboot_netbsd9(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:orangepi-pc + """ + # This test download a 304MB compressed image and expand it to 1.3GB... + deb_url = ('http://snapshot.debian.org/archive/debian/' + '20200108T145233Z/pool/main/u/u-boot/' + 'u-boot-sunxi_2020.01%2Bdfsg-1_armhf.deb') + deb_hash = 'f67f404a80753ca3d1258f13e38f2b060e13db99' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + # We use the common OrangePi PC 'plus' build of U-Boot for our secondary + # program loader (SPL). We will then set the path to the more specific + # OrangePi "PC" device tree blob with 'setenv fdtfile' in U-Boot prompt, + # before to boot NetBSD. + uboot_path = '/usr/lib/u-boot/orangepi_plus/u-boot-sunxi-with-spl.bin' + uboot_path = self.extract_from_deb(deb_path, uboot_path) + image_url = ('https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0/' + 'evbarm-earmv7hf/binary/gzimg/armv7.img.gz') + image_hash = '2babb29d36d8360adcb39c09e31060945259917a' + image_path_gz = self.fetch_asset(image_url, asset_hash=image_hash) + image_path = os.path.join(self.workdir, 'armv7.img') + image_drive_args = 'if=sd,format=raw,snapshot=on,file=' + image_path + archive.gzip_uncompress(image_path_gz, image_path) + + # dd if=u-boot-sunxi-with-spl.bin of=armv7.img bs=1K seek=8 conv=notrunc + with open(uboot_path, 'rb') as f_in: + with open(image_path, 'r+b') as f_out: + f_out.seek(8 * 1024) + shutil.copyfileobj(f_in, f_out) + + # Extend image, to avoid that NetBSD thinks the partition + # inside the image is larger than device size itself + f_out.seek(0, 2) + f_out.seek(64 * 1024 * 1024, 1) + f_out.write(bytearray([0x00])) + + self.vm.set_console() + self.vm.add_args('-nic', 'user', + '-drive', image_drive_args, + '-global', 'allwinner-rtc.base-year=2000', + '-no-reboot') + self.vm.launch() + wait_for_console_pattern(self, 'U-Boot 2020.01+dfsg-1') + interrupt_interactive_console_until_pattern(self, + 'Hit any key to stop autoboot:', + 'switch to partitions #0, OK') + + exec_command_and_wait_for_pattern(self, '', '=>') + cmd = 'setenv bootargs root=ld0a' + exec_command_and_wait_for_pattern(self, cmd, '=>') + cmd = 'setenv kernel netbsd-GENERIC.ub' + exec_command_and_wait_for_pattern(self, cmd, '=>') + cmd = 'setenv fdtfile dtb/sun8i-h3-orangepi-pc.dtb' + exec_command_and_wait_for_pattern(self, cmd, '=>') + cmd = ("setenv bootcmd 'fatload mmc 0:1 ${kernel_addr_r} ${kernel}; " + "fatload mmc 0:1 ${fdt_addr_r} ${fdtfile}; " + "fdt addr ${fdt_addr_r}; " + "bootm ${kernel_addr_r} - ${fdt_addr_r}'") + exec_command_and_wait_for_pattern(self, cmd, '=>') + + exec_command_and_wait_for_pattern(self, 'boot', + 'Booting kernel from Legacy Image') + wait_for_console_pattern(self, 'Starting kernel ...') + wait_for_console_pattern(self, 'NetBSD 9.0 (GENERIC)') + # Wait for user-space + wait_for_console_pattern(self, 'Starting root file system check') + def test_s390x_s390_ccw_virtio(self): """ :avocado: tags=arch:s390x
Signature · 1 line
2.17.1
Re: [PATCH v7 17/18] tests/boot_linux_console: Test booting NetBSD via U-Boot on OrangePi PC
Quoted 72 lines · Niek Linnenbank
From: Philippe Mathieu-Daudé <[email protected]>
This test boots U-Boot then NetBSD (stored on a SD card) on a OrangePi PC board.
As it requires ~1.3GB of storage, it is disabled by default.
U-Boot is built by the Debian project [1], and the SD card image is provided by the NetBSD organization [2].
Once the compressed SD card image is downloaded (304MB) and extracted, this test is fast:
$ AVOCADO_ALLOW_LARGE_STORAGE=yes \ avocado --show=app,console run -t machine:orangepi-pc \ tests/acceptance/boot_linux_console.py console: U-Boot SPL 2020.01+dfsg-1 (Jan 08 2020 - 08:19:44 +0000) console: DRAM: 1024 MiB console: U-Boot 2020.01+dfsg-1 (Jan 08 2020 - 08:19:44 +0000) Allwinner Technology console: CPU: Allwinner H3 (SUN8I 0000) console: scanning bus usb@1c1b000 for devices... 1 USB Device(s) found console: scanning bus usb@1c1d000 for devices... 1 USB Device(s) found console: scanning usb for storage devices... 0 Storage Device(s) found console: Hit any key to stop autoboot: 0 console: => setenv bootargs root=ld0a console: => setenv kernel netbsd-GENERIC.ub console: => setenv fdtfile dtb/sun8i-h3-orangepi-pc.dtb console: => boot console: ## Booting kernel from Legacy Image at 42000000 ... console: Image Name: NetBSD/earmv7hf 9.0_RC1 console: Image Type: ARM Linux Kernel Image (no loading done) (uncompressed) console: XIP Kernel Image (no loading done) console: Loading Device Tree to 49ff6000, end 49fffe01 ... OK console: Starting kernel ... console: [ 1.0000000] NetBSD/evbarm (fdt) booting ... console: [ 1.0000000] NetBSD 9.0 (GENERIC) #0: Fri Feb 14 00:06:28 UTC 2020 console: [ 1.0000000] [email protected]:/usr/src/sys/arch/evbarm/compile/GENERIC console: [ 1.0000000] total memory = 1024 MB console: [ 1.0000000] avail memory = 1003 MB console: [ 1.0000000] armfdt0 (root) console: [ 1.0000000] simplebus0 at armfdt0: Xunlong Orange Pi PC console: [ 1.0000000] cpu0 at cpus0: Cortex-A7 r0p5 (Cortex V7A core) console: [ 1.0000000] cpu0: DC enabled IC enabled WB enabled LABT branch prediction enabled console: [ 1.0000000] cpu0: 32KB/64B 2-way L1 VIPT Instruction cache console: [ 1.0000000] cpu0: 32KB/64B 2-way write-back-locking-C L1 PIPT Data cache console: [ 1.0000000] cpu0: 2304KB/64B 16-way write-through L2 PIPT Unified cache console: [ 1.0000000] vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals ... console: [ 2.3812082] sdmmc0: SD card status: 4-bit, C0 console: [ 2.3812082] ld0 at sdmmc0: <0xaa:0x5859:QEMU!:0x01:0xdeadbeef:0x062> console: [ 2.4012856] ld0: 1226 MB, 622 cyl, 64 head, 63 sec, 512 bytes/sect x 2511872 sectors console: [ 2.5321222] ld0: 4-bit width, High-Speed/SDR25, 50.000 MHz console: [ 3.1068718] WARNING: 4 errors while detecting hardware; check system log. console: [ 3.1179868] boot device: ld0 console: [ 3.1470623] root on ld0a dumps on ld0b console: [ 3.2464436] root file system type: ffs console: [ 3.2897123] kern.module.path=/stand/evbarm/9.0/modules console: Mon Feb 17 20:33:35 UTC 2020 console: Starting root file system check: PASS (35.96 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 36.09 sNote, this test only took ~65 seconds to run on Travis-CI, see: [3].
This test is based on a description from Niek Linnenbank from [4].
[1] https://wiki.debian.org/InstallingDebianOn/Allwinner#Creating_a_bootable_SD_Card_with_u-boot
[2] https://wiki.netbsd.org/ports/evbarm/allwinner/
[3] https://travis-ci.org/philmd/qemu/jobs/638823612#L3778
[4] https://www.mail-archive.com/[email protected]/msg669347.html
Quoted 4 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>[NL: changed test to use NetBSD 9.0 final release and -global allwinner-rtc.base-year]Tested-by Niek Linnenbank <[email protected]>Signed-off-by Niek Linnenbank <[email protected]>
Signature · 1 line
Alex Bennée
PATCH v7 18/18 docs: add Orange Pi PC document
In reply to Niek LinnenbankThe Xunlong Orange Pi PC machine is a functional ARM machine based on the Allwinner H3 System-on-Chip. It supports mainline Linux, U-Boot, NetBSD and is covered by acceptance tests.
This commit adds a documentation text file with a description of the machine and instructions for the user.
--- docs/system/orangepi.rst | 253 +++++++++++++++++++++++++++++++++++++ docs/system/target-arm.rst | 2 + MAINTAINERS | 1 + 3 files changed, 256 insertions(+) create mode 100644 docs/system/orangepi.rst
docs/system/orangepi.rst new file +253 -0
@@ -0,0 +1,253 @@ +Orange Pi PC Machine Type +^^^^^^^^^^^^^^^^^^^^^^^^^ + +The Xunlong Orange Pi PC is an Allwinner H3 System on Chip +based embedded computer with mainline support in both U-Boot +and Linux. The board comes with a Quad Core Cortex-A7 @ 1.3GHz, +1GiB RAM, 100Mbit ethernet, USB, SD/MMC, USB, HDMI and +various other I/O. + +Supported devices +""""""""""""""""" + +The Orange Pi PC machine supports the following devices: + + * SMP (Quad Core Cortex-A7) + * Generic Interrupt Controller configuration + * SRAM mappings + * SDRAM controller + * Real Time Clock + * Timer device (re-used from Allwinner A10) + * UART + * SD/MMC storage controller + * EMAC ethernet + * USB 2.0 interfaces + * Clock Control Unit + * System Control module + * Security Identifier device + +Limitations +""""""""""" + +Currently, Orange Pi PC does *not* support the following features: + +- Graphical output via HDMI, GPU and/or the Display Engine +- Audio output +- Hardware Watchdog + +Also see the 'unimplemented' array in the Allwinner H3 SoC module +for a complete list of unimplemented I/O devices: ``./hw/arm/allwinner-h3.c`` + +Boot options +"""""""""""" + +The Orange Pi PC machine can start using the standard -kernel functionality +for loading a Linux kernel or ELF executable. Additionally, the Orange Pi PC +machine can also emulate the BootROM which is present on an actual Allwinner H3 +based SoC, which loads the bootloader from a SD card, specified via the -sd argument +to qemu-system-arm. + +Machine-specific options +"""""""""""""""""""""""" + +The following machine-specific options are supported: + +- allwinner-rtc.base-year=YYYY + + The Allwinner RTC device is automatically created by the Orange Pi PC machine + and uses a default base year value which can be overridden using the 'base-year' property. + The base year is the actual represented year when the RTC year value is zero. + This option can be used in case the target operating system driver uses a different + base year value. The minimum value for the base year is 1900. + +- allwinner-sid.identifier=abcd1122-a000-b000-c000-12345678ffff + + The Security Identifier value can be read by the guest. + For example, U-Boot uses it to determine a unique MAC address. + +The above machine-specific options can be specified in qemu-system-arm +via the '-global' argument, for example: + +.. code-block:: bash + + $ qemu-system-arm -M orangepi-pc -sd mycard.img \ + -global allwinner-rtc.base-year=2000 + +Running mainline Linux +"""""""""""""""""""""" + +Mainline Linux kernels from 4.19 up to latest master are known to work. +To build a Linux mainline kernel that can be booted by the Orange Pi PC machine, +simply configure the kernel using the sunxi_defconfig configuration: + +.. code-block:: bash + + $ ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make mrproper + $ ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make sunxi_defconfig + +To be able to use USB storage, you need to manually enable the corresponding +configuration item. Start the kconfig configuration tool: + +.. code-block:: bash + + $ ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make menuconfig + +Navigate to the following item, enable it and save your configuration: + + Device Drivers > USB support > USB Mass Storage support + +Build the Linux kernel with: + +.. code-block:: bash + + $ ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make + +To boot the newly build linux kernel in QEMU with the Orange Pi PC machine, use: + +.. code-block:: bash + + $ qemu-system-arm -M orangepi-pc -nic user -nographic \ + -kernel /path/to/linux/arch/arm/boot/zImage \ + -append 'console=ttyS0,115200' \ + -dtb /path/to/linux/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dtb + +Orange Pi PC images +""""""""""""""""""" + +Note that the mainline kernel does not have a root filesystem. You may provide it +with an official Orange Pi PC image from the official website: + + http://www.orangepi.org/downloadresources/ + +Another possibility is to run an Armbian image for Orange Pi PC which +can be downloaded from: + + https://www.armbian.com/orange-pi-pc/ + +Alternatively, you can also choose to build you own image with buildroot +using the orangepi_pc_defconfig. Also see https://buildroot.org for more information. + +You can choose to attach the selected image either as an SD card or as USB mass storage. +For example, to boot using the Orange Pi PC Debian image on SD card, simply add the -sd +argument and provide the proper root= kernel parameter: + +.. code-block:: bash + + $ qemu-system-arm -M orangepi-pc -nic user -nographic \ + -kernel /path/to/linux/arch/arm/boot/zImage \ + -append 'console=ttyS0,115200 root=/dev/mmcblk0p2' \ + -dtb /path/to/linux/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dtb \ + -sd OrangePi_pc_debian_stretch_server_linux5.3.5_v1.0.img + +To attach the image as an USB mass storage device to the machine, +simply append to the command: + +.. code-block:: bash + + -drive if=none,id=stick,file=myimage.img \ + -device usb-storage,bus=usb-bus.0,drive=stick + +Instead of providing a custom Linux kernel via the -kernel command you may also +choose to let the Orange Pi PC machine load the bootloader from SD card, just like +a real board would do using the BootROM. Simply pass the selected image via the -sd +argument and remove the -kernel, -append, -dbt and -initrd arguments: + +.. code-block:: bash + + $ qemu-system-arm -M orangepi-pc -nic user -nographic \ + -sd Armbian_19.11.3_Orangepipc_buster_current_5.3.9.img + +Note that both the official Orange Pi PC images and Armbian images start +a lot of userland programs via systemd. Depending on the host hardware and OS, +they may be slow to emulate, especially due to emulating the 4 cores. +To help reduce the performance slow down due to emulating the 4 cores, you can +give the following kernel parameters via U-Boot (or via -append): + +.. code-block:: bash + + => setenv extraargs 'systemd.default_timeout_start_sec=9000 loglevel=7 nosmp console=ttyS0,115200' + +Running U-Boot +"""""""""""""" + +U-Boot mainline can be build and configured using the orangepi_pc_defconfig +using similar commands as describe above for Linux. Note that it is recommended +for development/testing to select the following configuration setting in U-Boot: + + Device Tree Control > Provider for DTB for DT Control > Embedded DTB + +To start U-Boot using the Orange Pi PC machine, provide the +u-boot binary to the -kernel argument: + +.. code-block:: bash + + $ qemu-system-arm -M orangepi-pc -nic user -nographic \ + -kernel /path/to/uboot/u-boot -sd disk.img + +Use the following U-boot commands to load and boot a Linux kernel from SD card: + +.. code-block:: bash + + => setenv bootargs console=ttyS0,115200 + => ext2load mmc 0 0x42000000 zImage + => ext2load mmc 0 0x43000000 sun8i-h3-orangepi-pc.dtb + => bootz 0x42000000 - 0x43000000 + +Running NetBSD +"""""""""""""" + +The NetBSD operating system also includes support for Allwinner H3 based boards, +including the Orange Pi PC. NetBSD 9.0 is known to work best for the Orange Pi PC +board and provides a fully working system with serial console, networking and storage. +For the Orange Pi PC machine, get the 'evbarm-earmv7hf' based image from: + + https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0/evbarm-earmv7hf/binary/gzimg/armv7.img.gz + +The image requires manually installing U-Boot in the image. Build U-Boot with +the orangepi_pc_defconfig configuration as described in the previous section. +Next, unzip the NetBSD image and write the U-Boot binary including SPL using: + +.. code-block:: bash + + $ gunzip armv7.img.gz + $ dd if=/path/to/u-boot-sunxi-with-spl.bin of=armv7.img bs=1024 seek=8 conv=notrunc + +Finally, before starting the machine the SD image must be extended such +that the NetBSD kernel will not conclude the NetBSD partition is larger than +the emulated SD card: + +.. code-block:: bash + + $ dd if=/dev/zero bs=1M count=64 >> armv7.img + +Start the machine using the following command: + +.. code-block:: bash + + $ qemu-system-arm -M orangepi-pc -nic user -nographic \ + -sd armv7.img -global allwinner-rtc.base-year=2000 + +At the U-Boot stage, interrupt the automatic boot process by pressing a key +and set the following environment variables before booting: + +.. code-block:: bash + + => setenv bootargs root=ld0a + => setenv kernel netbsd-GENERIC.ub + => setenv fdtfile dtb/sun8i-h3-orangepi-pc.dtb + => setenv bootcmd 'fatload mmc 0:1 ${kernel_addr_r} ${kernel}; fatload mmc 0:1 ${fdt_addr_r} ${fdtfile}; fdt addr ${fdt_addr_r}; bootm ${kernel_addr_r} - ${fdt_addr_r}' + +Optionally you may save the environment variables to SD card with 'saveenv'. +To continue booting simply give the 'boot' command and NetBSD boots. + +Orange Pi PC acceptance tests +""""""""""""""""""""""""""""" + +The Orange Pi PC machine has several acceptance tests included. +To run the whole set of tests, build QEMU from source and simply +provide the following command: + +.. code-block:: bash + + $ AVOCADO_ALLOW_LARGE_STORAGE=yes avocado --show=app,console run \ + -t machine:orangepi-pc tests/acceptance/boot_linux_console.py
docs/system/target-arm.rst +2 -0
@@ -215,3 +215,5 @@ emulation includes the following elements: A Linux 2.6 test image is available on the QEMU web site. More information is available in the QEMU mailing-list archive. + +.. include:: orangepi.rst
MAINTAINERS +1 -0
@@ -498,6 +498,7 @@ S: Maintained F: hw/*/allwinner-h3* F: include/hw/*/allwinner-h3* F: hw/arm/orangepi.c +F: docs/system/orangepi.rst ARM PrimeCell and CMSDK devices M: Peter Maydell <[email protected]>
Signature · 1 line
2.17.1
Re: [PATCH v7 18/18] docs: add Orange Pi PC document
Quoted 6 lines · Niek Linnenbank
The Xunlong Orange Pi PC machine is a functional ARM machine based on the Allwinner H3 System-on-Chip. It supports mainline Linux, U-Boot, NetBSD and is covered by acceptance tests.
This commit adds a documentation text file with a description of the machine and instructions for the user.
Awesome to have such comprehensive documentation for a system. Thanks ;-)
Signature · 1 line
Alex Bennée
Re: [PATCH v7 18/18] docs: add Orange Pi PC document
Quoted 7 lines · Alex Bennée
Quoted 4 lines · Niek Linnenbank
The Xunlong Orange Pi PC machine is a functional ARM machine based on the Allwinner H3 System-on-Chip. It supports mainline Linux, U-Boot, NetBSD and is covered by acceptance tests.
Quoted 6 lines
Quoted 2 lines
This commit adds a documentation text file with a description of the machine and instructions for the user.
Awesome to have such comprehensive documentation for a system. Thanks ;-)
I'm glad to hear that Alex. Perhaps in another patch series we can begin to add documentation for other boards as well.
Regards,
Niek
Quoted 6 lines
Reviewed-by Alex Bennée <[email protected]>--
Alex Bennée
Signature · 1 line
Niek Linnenbank
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series failed the asan build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.
=== TEST SCRIPT BEGIN ===
#!/bin/bash
export ARCH=x86_64
make docker-image-fedora V=1 NETWORK=1
time make docker-test-debug@fedora TARGET_LIST=x86_64-softmmu J=14 NETWORK=1 === TEST SCRIPT END ===
PASS 1 fdc-test /x86_64/fdc/cmos
PASS 2 fdc-test /x86_64/fdc/no_media_on_start
PASS 3 fdc-test /x86_64/fdc/read_without_media
==6195==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 4 fdc-test /x86_64/fdc/media_change
PASS 5 fdc-test /x86_64/fdc/sense_interrupt
PASS 6 fdc-test /x86_64/fdc/relative_seek
---
PASS 32 test-opts-visitor /visitor/opts/range/beyond
PASS 33 test-opts-visitor /visitor/opts/dict/unvisited
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-coroutine -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-coroutine"
==6250==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==6250==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffe5de1c000; bottom 0x7f003ecd9000; size: 0x00fe1f143000 (1091443109888)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 11 fdc-test /x86_64/fdc/read_no_dma_18
---
PASS 12 fdc-test /x86_64/fdc/read_no_dma_19
PASS 13 fdc-test /x86_64/fdc/fuzz-registers
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 QTEST_QEMU_IMG=qemu-img tests/qtest/ide-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="ide-test" ==6273==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 1 ide-test /x86_64/ide/identify
==6265==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 14 test-aio /aio/timer/schedule
==6279==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 15 test-aio /aio/coroutine/queue-chaining
PASS 16 test-aio /aio-gsource/flush
PASS 17 test-aio /aio-gsource/bh/schedule
---
PASS 26 test-aio /aio-gsource/event/flush
PASS 27 test-aio /aio-gsource/event/wait/no-flush-cb
PASS 2 ide-test /x86_64/ide/flush
==6285==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 3 ide-test /x86_64/ide/bmdma/simple_rw
==6291==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 4 ide-test /x86_64/ide/bmdma/trim
PASS 28 test-aio /aio-gsource/timer/schedule
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-aio-multithread -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-aio-multithread"
==6300==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 1 test-aio-multithread /aio/multi/lifecycle
==6297==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 2 test-aio-multithread /aio/multi/schedule
PASS 3 test-aio-multithread /aio/multi/mutex/contended
PASS 4 test-aio-multithread /aio/multi/mutex/handoff
==6332==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 5 test-aio-multithread /aio/multi/mutex/mcs
PASS 6 test-aio-multithread /aio/multi/mutex/pthread
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-throttle -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-throttle"
==6344==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 1 test-throttle /throttle/leak_bucket
PASS 2 test-throttle /throttle/compute_wait
PASS 3 test-throttle /throttle/init
---
PASS 14 test-throttle /throttle/config/max
PASS 15 test-throttle /throttle/config/iops_size
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-thread-pool -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-thread-pool"
==6348==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 1 test-thread-pool /thread-pool/submit
PASS 2 test-thread-pool /thread-pool/submit-aio
PASS 3 test-thread-pool /thread-pool/submit-co
PASS 4 test-thread-pool /thread-pool/submit-many
PASS 5 test-thread-pool /thread-pool/cancel
==6415==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 6 test-thread-pool /thread-pool/cancel-async
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-hbitmap -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-hbitmap"
PASS 1 test-hbitmap /hbitmap/granularity
---
PASS 28 test-hbitmap /hbitmap/truncate/shrink/medium
PASS 29 test-hbitmap /hbitmap/truncate/shrink/large
PASS 30 test-hbitmap /hbitmap/meta/zero
==6425==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 31 test-hbitmap /hbitmap/meta/one
PASS 32 test-hbitmap /hbitmap/meta/byte
PASS 33 test-hbitmap /hbitmap/meta/word
---
PASS 44 test-hbitmap /hbitmap/next_dirty_area/next_dirty_area_4
PASS 45 test-hbitmap /hbitmap/next_dirty_area/next_dirty_area_after_truncate
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-bdrv-drain -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-bdrv-drain"
==6432==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 1 test-bdrv-drain /bdrv-drain/nested
PASS 2 test-bdrv-drain /bdrv-drain/multiparent
PASS 3 test-bdrv-drain /bdrv-drain/set_aio_context
---
PASS 41 test-bdrv-drain /bdrv-drain/bdrv_drop_intermediate/poll
PASS 42 test-bdrv-drain /bdrv-drain/replace_child/mid-drain
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-bdrv-graph-mod -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-bdrv-graph-mod"
==6471==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 1 test-bdrv-graph-mod /bdrv-graph-mod/update-perm-tree
PASS 2 test-bdrv-graph-mod /bdrv-graph-mod/should-update-child
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-blockjob -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-blockjob"
==6475==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 1 test-blockjob /blockjob/ids
PASS 2 test-blockjob /blockjob/cancel/created
PASS 3 test-blockjob /blockjob/cancel/running
---
PASS 7 test-blockjob /blockjob/cancel/pending
PASS 8 test-blockjob /blockjob/cancel/concluded
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-blockjob-txn -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-blockjob-txn"
==6479==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 1 test-blockjob-txn /single/success
PASS 2 test-blockjob-txn /single/failure
PASS 3 test-blockjob-txn /single/cancel
---
PASS 6 test-blockjob-txn /pair/cancel
PASS 7 test-blockjob-txn /pair/fail-cancel-race
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-block-backend -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-block-backend"
==6483==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 1 test-block-backend /block-backend/drain_aio_error
PASS 2 test-block-backend /block-backend/drain_all_aio_error
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-block-iothread -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-block-iothread"
==6489==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 1 test-block-iothread /sync-op/pread
PASS 2 test-block-iothread /sync-op/pwrite
PASS 3 test-block-iothread /sync-op/load_vmstate
---
PASS 15 test-block-iothread /propagate/diamond
PASS 16 test-block-iothread /propagate/mirror
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-image-locking -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-image-locking"
==6485==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==6509==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 1 test-image-locking /image-locking/basic
PASS 2 test-image-locking /image-locking/set-perm-abort
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-x86-cpuid -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-x86-cpuid"
---
PASS 2 rcutorture /rcu/torture/10readers
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-rcu-list -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-rcu-list"
PASS 1 test-rcu-list /rcu/qlist/single-threaded
==6571==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 2 test-rcu-list /rcu/qlist/short-few
PASS 3 test-rcu-list /rcu/qlist/long-many
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-rcu-simpleq -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-rcu-simpleq"
PASS 1 test-rcu-simpleq /rcu/qsimpleq/single-threaded
PASS 2 test-rcu-simpleq /rcu/qsimpleq/short-few
==6616==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 3 test-rcu-simpleq /rcu/qsimpleq/long-many
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-rcu-tailq -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-rcu-tailq"
PASS 1 test-rcu-tailq /rcu/qtailq/single-threaded
PASS 2 test-rcu-tailq /rcu/qtailq/short-few
==6676==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 3 test-rcu-tailq /rcu/qtailq/long-many
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-rcu-slist -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-rcu-slist"
PASS 1 test-rcu-slist /rcu/qslist/single-threaded
---
PASS 7 test-qdist /qdist/binning/expand
PASS 8 test-qdist /qdist/binning/shrink
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-qht -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-qht"
==6718==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 5 ide-test /x86_64/ide/bmdma/various_prdts
==6728==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==6728==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7fff635d9000; bottom 0x7f3167bfe000; size: 0x00cdfb9db000 (884689711104)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 6 ide-test /x86_64/ide/bmdma/no_busmaster
PASS 7 ide-test /x86_64/ide/flush/nodev
==6739==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 8 ide-test /x86_64/ide/flush/empty_drive
==6744==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 9 ide-test /x86_64/ide/flush/retry_pci
==6750==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 10 ide-test /x86_64/ide/flush/retry_isa
==6756==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 11 ide-test /x86_64/ide/cdrom/pio
==6762==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 12 ide-test /x86_64/ide/cdrom/pio_large
PASS 1 test-qht /qht/mode/default
==6768==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 13 ide-test /x86_64/ide/cdrom/dma
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 QTEST_QEMU_IMG=qemu-img tests/qtest/ahci-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="ahci-test" PASS 2 test-qht /qht/mode/resize
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-qht-par -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-qht-par"
==6791==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 1 ahci-test /x86_64/ahci/sanity
PASS 1 test-qht-par /qht/parallel/2threads-0%updates-1s
==6797==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 2 ahci-test /x86_64/ahci/pci_spec
==6809==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 3 ahci-test /x86_64/ahci/pci_enable
PASS 2 test-qht-par /qht/parallel/2threads-20%updates-1s
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-bitops -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-bitops"
---
PASS 3 test-bitcnt /bitcnt/ctpop32
PASS 4 test-bitcnt /bitcnt/ctpop64
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-qdev-global-props -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-qdev-global-props"
==6815==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 1 test-qdev-global-props /qdev/properties/static/default
PASS 2 test-qdev-global-props /qdev/properties/static/global
PASS 3 test-qdev-global-props /qdev/properties/dynamic/global
---
PASS 8 check-qom-proplist /qom/proplist/delchild
PASS 9 check-qom-proplist /qom/resolve/partial
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-qemu-opts -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-qemu-opts"
==6845==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 1 test-qemu-opts /qemu-opts/find_unknown_opts
PASS 2 test-qemu-opts /qemu-opts/find_opts
PASS 3 test-qemu-opts /qemu-opts/opts_create
---
PASS 4 test-crypto-hash /crypto/hash/digest
PASS 5 test-crypto-hash /crypto/hash/base64
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-crypto-hmac -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-crypto-hmac"
==6863==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 1 test-crypto-hmac /crypto/hmac/iov
PASS 2 test-crypto-hmac /crypto/hmac/alloc
PASS 3 test-crypto-hmac /crypto/hmac/prealloc
---
PASS 15 test-crypto-secret /crypto/secret/crypt/missingiv
PASS 16 test-crypto-secret /crypto/secret/crypt/badiv
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-crypto-tlscredsx509 -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-crypto-tlscredsx509"
==6885==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 7 ahci-test /x86_64/ahci/max
==6899==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 1 test-crypto-tlscredsx509 /qcrypto/tlscredsx509/perfectserver
PASS 2 test-crypto-tlscredsx509 /qcrypto/tlscredsx509/perfectclient
PASS 3 test-crypto-tlscredsx509 /qcrypto/tlscredsx509/goodca1
PASS 4 test-crypto-tlscredsx509 /qcrypto/tlscredsx509/goodca2
PASS 8 ahci-test /x86_64/ahci/reset
==6905==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==6905==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffe5876c000; bottom 0x7f3619ffe000; size: 0x00c83e76e000 (860041437184)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 5 test-crypto-tlscredsx509 /qcrypto/tlscredsx509/goodca3
---
PASS 7 test-crypto-tlscredsx509 /qcrypto/tlscredsx509/badca2
PASS 8 test-crypto-tlscredsx509 /qcrypto/tlscredsx509/badca3
PASS 9 ahci-test /x86_64/ahci/io/pio/lba28/simple/zero
==6911==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==6911==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffe6a0cf000; bottom 0x7f20b63fe000; size: 0x00ddb3cd1000 (952204333056)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 10 ahci-test /x86_64/ahci/io/pio/lba28/simple/low
==6917==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 9 test-crypto-tlscredsx509 /qcrypto/tlscredsx509/goodserver1
==6917==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffdb9b96000; bottom 0x7f6baa5fe000; size: 0x00920f598000 (627322748928)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 11 ahci-test /x86_64/ahci/io/pio/lba28/simple/high
PASS 10 test-crypto-tlscredsx509 /qcrypto/tlscredsx509/goodserver2
==6923==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==6923==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffc62843000; bottom 0x7fac01ffe000; size: 0x005060845000 (345216667648)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 12 ahci-test /x86_64/ahci/io/pio/lba28/double/zero
PASS 11 test-crypto-tlscredsx509 /qcrypto/tlscredsx509/goodserver3
==6929==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 12 test-crypto-tlscredsx509 /qcrypto/tlscredsx509/goodserver4
==6929==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7fffb895c000; bottom 0x7fdaab3fe000; size: 0x00250d55e000 (159137521664)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 13 ahci-test /x86_64/ahci/io/pio/lba28/double/low
==6935==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==6935==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffc046aa000; bottom 0x7f28815fe000; size: 0x00d3830ac000 (908436619264)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 14 ahci-test /x86_64/ahci/io/pio/lba28/double/high
PASS 13 test-crypto-tlscredsx509 /qcrypto/tlscredsx509/goodserver5
PASS 14 test-crypto-tlscredsx509 /qcrypto/tlscredsx509/goodserver6
==6941==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==6941==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7fff30aec000; bottom 0x7f8262b24000; size: 0x007ccdfc8000 (536031821824)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 15 ahci-test /x86_64/ahci/io/pio/lba28/long/zero
---
PASS 32 test-crypto-tlscredsx509 /qcrypto/tlscredsx509/inactive1
PASS 33 test-crypto-tlscredsx509 /qcrypto/tlscredsx509/inactive2
PASS 34 test-crypto-tlscredsx509 /qcrypto/tlscredsx509/inactive3
==6947==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==6947==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffd568e4000; bottom 0x7f0dec1fe000; size: 0x00ef6a6e6000 (1028282802176)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 16 ahci-test /x86_64/ahci/io/pio/lba28/long/low
==6953==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==6953==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffc878c6000; bottom 0x7fe016d24000; size: 0x001c70ba2000 (122150330368)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 35 test-crypto-tlscredsx509 /qcrypto/tlscredsx509/chain1
---
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-crypto-tlssession -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-crypto-tlssession"
PASS 17 ahci-test /x86_64/ahci/io/pio/lba28/long/high
PASS 1 test-crypto-tlssession /qcrypto/tlssession/psk
==6963==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 18 ahci-test /x86_64/ahci/io/pio/lba28/short/zero
PASS 2 test-crypto-tlssession /qcrypto/tlssession/basicca
==6969==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 19 ahci-test /x86_64/ahci/io/pio/lba28/short/low
==6975==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 20 ahci-test /x86_64/ahci/io/pio/lba28/short/high
PASS 3 test-crypto-tlssession /qcrypto/tlssession/differentca
==6981==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==6981==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffe66d47000; bottom 0x7f0585bfe000; size: 0x00f8e1149000 (1068928110592)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 21 ahci-test /x86_64/ahci/io/pio/lba48/simple/zero
==6987==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==6987==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffc073aa000; bottom 0x7f34187fe000; size: 0x00c7eebac000 (858703708160)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 22 ahci-test /x86_64/ahci/io/pio/lba48/simple/low
PASS 4 test-crypto-tlssession /qcrypto/tlssession/altname1
PASS 5 test-crypto-tlssession /qcrypto/tlssession/altname2
==6993==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==6993==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffeb35a8000; bottom 0x7f81751fe000; size: 0x007d3e3aa000 (537914941440)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 23 ahci-test /x86_64/ahci/io/pio/lba48/simple/high
PASS 6 test-crypto-tlssession /qcrypto/tlssession/altname3
==6999==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==6999==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffe0488d000; bottom 0x7f2f2bbfe000; size: 0x00ced8c8f000 (888400310272)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 24 ahci-test /x86_64/ahci/io/pio/lba48/double/zero
PASS 7 test-crypto-tlssession /qcrypto/tlssession/altname4
==7005==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 8 test-crypto-tlssession /qcrypto/tlssession/altname5
==7005==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffc0ad09000; bottom 0x7f24f1dfe000; size: 0x00d718f0b000 (923836395520)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 9 test-crypto-tlssession /qcrypto/tlssession/altname6
PASS 25 ahci-test /x86_64/ahci/io/pio/lba48/double/low
PASS 10 test-crypto-tlssession /qcrypto/tlssession/wildcard1
==7011==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7011==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffff6403000; bottom 0x7f50f4ffe000; size: 0x00af01405000 (751640268800)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 26 ahci-test /x86_64/ahci/io/pio/lba48/double/high
PASS 11 test-crypto-tlssession /qcrypto/tlssession/wildcard2
==7017==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7017==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffef8d80000; bottom 0x7f12e69fe000; size: 0x00ec12382000 (1013917949952)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 12 test-crypto-tlssession /qcrypto/tlssession/wildcard3
PASS 27 ahci-test /x86_64/ahci/io/pio/lba48/long/zero
PASS 13 test-crypto-tlssession /qcrypto/tlssession/wildcard4
==7023==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7023==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffead3fd000; bottom 0x7f20de9fe000; size: 0x00ddce9ff000 (952654360576)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 28 ahci-test /x86_64/ahci/io/pio/lba48/long/low
PASS 14 test-crypto-tlssession /qcrypto/tlssession/wildcard5
==7029==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 15 test-crypto-tlssession /qcrypto/tlssession/wildcard6
==7029==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffd095d1000; bottom 0x7f6f82f7c000; size: 0x008d86655000 (607845175296)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 16 test-crypto-tlssession /qcrypto/tlssession/cachain
---
PASS 15 test-qga /qga/invalid-cmd
PASS 16 test-qga /qga/invalid-args
PASS 17 test-qga /qga/fsfreeze-status
==7043==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 30 ahci-test /x86_64/ahci/io/pio/lba48/short/zero
==7052==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 18 test-qga /qga/blacklist
PASS 19 test-qga /qga/config
PASS 20 test-qga /qga/guest-exec
PASS 21 test-qga /qga/guest-exec-invalid
PASS 31 ahci-test /x86_64/ahci/io/pio/lba48/short/low
==7070==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 32 ahci-test /x86_64/ahci/io/pio/lba48/short/high
PASS 22 test-qga /qga/guest-get-osinfo
PASS 23 test-qga /qga/guest-get-host-name
PASS 24 test-qga /qga/guest-get-timezone
PASS 25 test-qga /qga/guest-get-users
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-timed-average -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-timed-average"
==7076==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 1 test-timed-average /timed-average/average
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-util-filemonitor -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-util-filemonitor"
PASS 33 ahci-test /x86_64/ahci/io/dma/lba28/fragmented
---
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-authz-simple -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-authz-simple"
PASS 1 test-authz-simple /authz/simple
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-authz-list -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-authz-list"
==7092==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 1 test-authz-list /auth/list/complex
PASS 2 test-authz-list /auth/list/add-remove
PASS 3 test-authz-list /auth/list/default/deny
---
PASS 8 test-io-channel-socket /io/channel/socket/unix-fd-pass
PASS 9 test-io-channel-socket /io/channel/socket/unix-listen-cleanup
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-io-channel-file -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-io-channel-file"
==7120==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 1 test-io-channel-file /io/channel/file
PASS 2 test-io-channel-file /io/channel/file/rdwr
PASS 3 test-io-channel-file /io/channel/file/fd
---
PASS 5 test-io-channel-file /io/channel/pipe/async
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-io-channel-tls -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-io-channel-tls"
PASS 35 ahci-test /x86_64/ahci/io/dma/lba28/simple/zero
==7178==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 36 ahci-test /x86_64/ahci/io/dma/lba28/simple/low
PASS 1 test-io-channel-tls /qio/channel/tls/basic
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-io-channel-command -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-io-channel-command"
==7186==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 1 test-io-channel-command /io/channel/command/fifo/sync
PASS 2 test-io-channel-command /io/channel/command/fifo/async
PASS 3 test-io-channel-command /io/channel/command/echo/sync
---
PASS 17 test-crypto-pbkdf /crypto/pbkdf/nonrfc/sha384/iter1200
PASS 18 test-crypto-pbkdf /crypto/pbkdf/nonrfc/ripemd160/iter1200
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-crypto-ivgen -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-crypto-ivgen"
==7202==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 1 test-crypto-ivgen /crypto/ivgen/plain/1
PASS 2 test-crypto-ivgen /crypto/ivgen/plain/1f2e3d4c
PASS 3 test-crypto-ivgen /crypto/ivgen/plain/1f2e3d4c5b6a7988
---
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-crypto-block -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-crypto-block"
PASS 1 test-crypto-block /crypto/block/qcow
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-logging -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-logging"
==7227==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 1 test-logging /logging/parse_range
PASS 2 test-logging /logging/parse_path
PASS 3 test-logging /logging/logfile_write_path
PASS 4 test-logging /logging/logfile_lock_path
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-replication -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-replication"
==7242==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 39 ahci-test /x86_64/ahci/io/dma/lba28/double/low
PASS 1 test-replication /replication/primary/read
PASS 2 test-replication /replication/primary/write
==7246==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 3 test-replication /replication/primary/start
PASS 4 test-replication /replication/primary/stop
PASS 40 ahci-test /x86_64/ahci/io/dma/lba28/double/high
PASS 5 test-replication /replication/primary/do_checkpoint
PASS 6 test-replication /replication/primary/get_error_all
==7252==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7252==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffffe800000; bottom 0x7fc0d8923000; size: 0x003f25edd000 (271219281920)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 7 test-replication /replication/secondary/read
PASS 41 ahci-test /x86_64/ahci/io/dma/lba28/long/zero
==7259==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7259==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffc8ec5b000; bottom 0x7f7bf977b000; size: 0x0080954e0000 (552260730880)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 8 test-replication /replication/secondary/write
PASS 42 ahci-test /x86_64/ahci/io/dma/lba28/long/low
==7266==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7266==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffd04bb5000; bottom 0x7f98bedfd000; size: 0x006445db8000 (430668742656)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 43 ahci-test /x86_64/ahci/io/dma/lba28/long/high
==7273==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 44 ahci-test /x86_64/ahci/io/dma/lba28/short/zero
==7242==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffd98ab6000; bottom 0x7f373ded3000; size: 0x00c65abe3000 (851925938176)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
==7297==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 9 test-replication /replication/secondary/start
PASS 45 ahci-test /x86_64/ahci/io/dma/lba28/short/low
==7306==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 46 ahci-test /x86_64/ahci/io/dma/lba28/short/high
==7312==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 47 ahci-test /x86_64/ahci/io/dma/lba48/simple/zero
==7318==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 48 ahci-test /x86_64/ahci/io/dma/lba48/simple/low
PASS 10 test-replication /replication/secondary/stop
==7324==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 49 ahci-test /x86_64/ahci/io/dma/lba48/simple/high
==7330==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 50 ahci-test /x86_64/ahci/io/dma/lba48/double/zero
==7336==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 51 ahci-test /x86_64/ahci/io/dma/lba48/double/low
PASS 11 test-replication /replication/secondary/continuous_replication
==7342==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 52 ahci-test /x86_64/ahci/io/dma/lba48/double/high
==7348==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7348==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffc1a210000; bottom 0x7f165b17b000; size: 0x00e5bf095000 (986752569344)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 53 ahci-test /x86_64/ahci/io/dma/lba48/long/zero
==7355==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 12 test-replication /replication/secondary/do_checkpoint
==7355==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7fff41b29000; bottom 0x7f7bca123000; size: 0x008377a06000 (564647714816)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 54 ahci-test /x86_64/ahci/io/dma/lba48/long/low
==7362==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 13 test-replication /replication/secondary/get_error_all
==7362==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7fff118d9000; bottom 0x7fb0e69fd000; size: 0x004e2aedc000 (335727673344)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 55 ahci-test /x86_64/ahci/io/dma/lba48/long/high
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-bufferiszero -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-bufferiszero"
==7369==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 56 ahci-test /x86_64/ahci/io/dma/lba48/short/zero
==7378==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 57 ahci-test /x86_64/ahci/io/dma/lba48/short/low
==7384==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 58 ahci-test /x86_64/ahci/io/dma/lba48/short/high
==7390==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 59 ahci-test /x86_64/ahci/io/ncq/simple
==7396==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 60 ahci-test /x86_64/ahci/io/ncq/retry
==7402==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 61 ahci-test /x86_64/ahci/flush/simple
==7408==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 62 ahci-test /x86_64/ahci/flush/retry
==7414==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7420==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 63 ahci-test /x86_64/ahci/flush/migrate
==7428==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7434==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 64 ahci-test /x86_64/ahci/migrate/sanity
==7442==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7448==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 65 ahci-test /x86_64/ahci/migrate/dma/simple
==7456==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7462==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 66 ahci-test /x86_64/ahci/migrate/dma/halted
==7470==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7476==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 67 ahci-test /x86_64/ahci/migrate/ncq/simple
==7484==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7490==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 68 ahci-test /x86_64/ahci/migrate/ncq/halted
==7498==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 69 ahci-test /x86_64/ahci/cdrom/eject
==7503==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 70 ahci-test /x86_64/ahci/cdrom/dma/single
==7509==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 71 ahci-test /x86_64/ahci/cdrom/dma/multi
==7515==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 72 ahci-test /x86_64/ahci/cdrom/pio/single
==7521==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7521==WARNING: ASan is ignoring requested __asan_handle_no_return: stack top: 0x7ffd82e29000; bottom 0x7fe55a1aa000; size: 0x001828c7f000 (103763406848)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
PASS 73 ahci-test /x86_64/ahci/cdrom/pio/multi
==7527==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 74 ahci-test /x86_64/ahci/cdrom/pio/bcl
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 QTEST_QEMU_IMG=qemu-img tests/qtest/hd-geo-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="hd-geo-test" PASS 1 hd-geo-test /x86_64/hd-geo/ide/none
==7541==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 2 hd-geo-test /x86_64/hd-geo/ide/drive/cd_0
==7547==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 3 hd-geo-test /x86_64/hd-geo/ide/drive/mbr/blank
PASS 1 test-bufferiszero /cutils/bufferiszero
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-uuid -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-uuid"
---
PASS 527 ptimer-test /ptimer/periodic_with_load_0 policy=wrap_after_one_period,continuous_trigger,no_immediate_reload,no_counter_rounddown,trigger_only_on_decrement,
PASS 528 ptimer-test /ptimer/oneshot_with_load_0 policy=wrap_after_one_period,continuous_trigger,no_immediate_reload,no_counter_rounddown,trigger_only_on_decrement,
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} tests/test-qapi-util -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="test-qapi-util"
==7553==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 4 hd-geo-test /x86_64/hd-geo/ide/drive/mbr/lba
PASS 1 test-qapi-util /qapi/util/qapi_enum_parse
PASS 2 test-qapi-util /qapi/util/parse_qapi_name
---
PASS 21 test-qgraph /qgraph/test_two_test_same_interface
PASS 22 test-qgraph /qgraph/test_test_in_path
PASS 23 test-qgraph /qgraph/test_double_edge
==7569==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 5 hd-geo-test /x86_64/hd-geo/ide/drive/mbr/chs
==7578==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 6 hd-geo-test /x86_64/hd-geo/ide/device/mbr/blank
==7584==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 7 hd-geo-test /x86_64/hd-geo/ide/device/mbr/lba
==7590==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 8 hd-geo-test /x86_64/hd-geo/ide/device/mbr/chs
==7596==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 9 hd-geo-test /x86_64/hd-geo/ide/device/user/chs
==7601==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 10 hd-geo-test /x86_64/hd-geo/ide/device/user/chst
==7607==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7611==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7615==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7619==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7623==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7627==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7631==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7635==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7638==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 11 hd-geo-test /x86_64/hd-geo/override/ide
==7645==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7649==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7653==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7657==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7661==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7665==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7669==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7673==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7676==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 12 hd-geo-test /x86_64/hd-geo/override/scsi
==7683==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7687==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7691==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7695==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7699==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7703==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7707==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7711==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7714==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 13 hd-geo-test /x86_64/hd-geo/override/scsi_2_controllers
==7721==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7725==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7729==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7733==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7736==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 14 hd-geo-test /x86_64/hd-geo/override/virtio_blk
==7743==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7747==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7750==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 15 hd-geo-test /x86_64/hd-geo/override/zero_chs
==7757==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7761==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7765==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7769==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7772==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 16 hd-geo-test /x86_64/hd-geo/override/scsi_hot_unplug
==7779==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7783==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7787==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7791==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
==7794==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 17 hd-geo-test /x86_64/hd-geo/override/virtio_hot_unplug
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 QTEST_QEMU_IMG=qemu-img tests/qtest/boot-order-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="boot-order-test" PASS 1 boot-order-test /x86_64/boot-order/pc
---
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: -accel kvm: failed to initialize kvm: No such file or directory
qemu-system-x86_64: falling back to tcg
==7863==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
Looking for expected file 'tests/data/acpi/pc/FACP'
Using expected file 'tests/data/acpi/pc/FACP'
---
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: -accel kvm: failed to initialize kvm: No such file or directory
qemu-system-x86_64: falling back to tcg
==7869==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
Looking for expected file 'tests/data/acpi/q35/FACP'
Using expected file 'tests/data/acpi/q35/FACP'
---
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: -accel kvm: failed to initialize kvm: No such file or directory
qemu-system-x86_64: falling back to tcg
==7875==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
Looking for expected file 'tests/data/acpi/pc/FACP.bridge'
Looking for expected file 'tests/data/acpi/pc/FACP'
---
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: -accel kvm: failed to initialize kvm: No such file or directory
qemu-system-x86_64: falling back to tcg
==7881==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
Looking for expected file 'tests/data/acpi/pc/FACP.ipmikcs'
Looking for expected file 'tests/data/acpi/pc/FACP'
---
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: -accel kvm: failed to initialize kvm: No such file or directory
qemu-system-x86_64: falling back to tcg
==7887==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
Looking for expected file 'tests/data/acpi/pc/FACP.cphp'
Looking for expected file 'tests/data/acpi/pc/FACP'
---
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: -accel kvm: failed to initialize kvm: No such file or directory
qemu-system-x86_64: falling back to tcg
==7894==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
Looking for expected file 'tests/data/acpi/pc/FACP.memhp'
Looking for expected file 'tests/data/acpi/pc/FACP'
---
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: -accel kvm: failed to initialize kvm: No such file or directory
qemu-system-x86_64: falling back to tcg
==7900==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
Looking for expected file 'tests/data/acpi/pc/FACP.numamem'
Looking for expected file 'tests/data/acpi/pc/FACP'
---
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: -accel kvm: failed to initialize kvm: No such file or directory
qemu-system-x86_64: falling back to tcg
==7906==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
Looking for expected file 'tests/data/acpi/pc/FACP.dimmpxm'
Looking for expected file 'tests/data/acpi/pc/FACP'
---
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: -accel kvm: failed to initialize kvm: No such file or directory
qemu-system-x86_64: falling back to tcg
==7915==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
Looking for expected file 'tests/data/acpi/pc/FACP.acpihmat'
Looking for expected file 'tests/data/acpi/pc/FACP'
---
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: -accel kvm: failed to initialize kvm: No such file or directory
qemu-system-x86_64: falling back to tcg
==7922==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
Looking for expected file 'tests/data/acpi/q35/FACP.bridge'
Looking for expected file 'tests/data/acpi/q35/FACP'
---
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: -accel kvm: failed to initialize kvm: No such file or directory
qemu-system-x86_64: falling back to tcg
==7928==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
Looking for expected file 'tests/data/acpi/q35/FACP.mmio64'
Looking for expected file 'tests/data/acpi/q35/FACP'
---
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: -accel kvm: failed to initialize kvm: No such file or directory
qemu-system-x86_64: falling back to tcg
==7934==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
Looking for expected file 'tests/data/acpi/q35/FACP.ipmibt'
Looking for expected file 'tests/data/acpi/q35/FACP'
---
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: -accel kvm: failed to initialize kvm: No such file or directory
qemu-system-x86_64: falling back to tcg
==7940==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
Looking for expected file 'tests/data/acpi/q35/FACP.cphp'
Looking for expected file 'tests/data/acpi/q35/FACP'
---
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: -accel kvm: failed to initialize kvm: No such file or directory
qemu-system-x86_64: falling back to tcg
==7947==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
Looking for expected file 'tests/data/acpi/q35/FACP.memhp'
Looking for expected file 'tests/data/acpi/q35/FACP'
---
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: -accel kvm: failed to initialize kvm: No such file or directory
qemu-system-x86_64: falling back to tcg
==7953==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
Looking for expected file 'tests/data/acpi/q35/FACP.numamem'
Looking for expected file 'tests/data/acpi/q35/FACP'
---
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: -accel kvm: failed to initialize kvm: No such file or directory
qemu-system-x86_64: falling back to tcg
==7959==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
Looking for expected file 'tests/data/acpi/q35/FACP.dimmpxm'
Looking for expected file 'tests/data/acpi/q35/FACP'
---
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: -accel kvm: failed to initialize kvm: No such file or directory
qemu-system-x86_64: falling back to tcg
==7968==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
Looking for expected file 'tests/data/acpi/q35/FACP.acpihmat'
Looking for expected file 'tests/data/acpi/q35/FACP'
---
PASS 1 i440fx-test /x86_64/i440fx/defaults
PASS 2 i440fx-test /x86_64/i440fx/pam
PASS 3 i440fx-test /x86_64/i440fx/firmware/bios
==8060==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 4 i440fx-test /x86_64/i440fx/firmware/pflash
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 QTEST_QEMU_IMG=qemu-img tests/qtest/fw_cfg-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="fw_cfg-test" PASS 1 fw_cfg-test /x86_64/fw_cfg/signature
---
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 QTEST_QEMU_IMG=qemu-img tests/qtest/drive_del-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="drive_del-test" PASS 1 drive_del-test /x86_64/drive_del/without-dev
PASS 2 drive_del-test /x86_64/drive_del/after_failed_device_add
==8153==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
PASS 3 drive_del-test /x86_64/blockdev/drive_del_device_del
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 QTEST_QEMU_IMG=qemu-img tests/qtest/wdt_ib700-test -m=quick -k --tap < /dev/null | ./scripts/tap-driver.pl --test-name="wdt_ib700-test" PASS 1 wdt_ib700-test /x86_64/wdt_ib700/pause
---
dbus-daemon[8323]: Could not get password database information for UID of current process: User "???" unknown or no memory to allocate password entry
**
ERROR:/tmp/qemu-test/src/tests/qtest/dbus-vmstate-test.c:114:get_connection: assertion failed (err == NULL): The connection is closed (g-io-error-quark, 18)
cleaning up pid 8323
ERROR - Bail out! ERROR:/tmp/qemu-test/src/tests/qtest/dbus-vmstate-test.c:114:get_connection: assertion failed (err == NULL): The connection is closed (g-io-error-quark, 18)
make: *** [/tmp/qemu-test/src/tests/Makefile.include:632: check-qtest-x86_64] Error 1
make: *** Waiting for unfinished jobs....
Traceback (most recent call last):
File "./tests/docker/docker.py", line 664, in <module>
---
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=bbfa30d232f247d9a6ad69943f93d7d2', '-u', '1003', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=x86_64-softmmu', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew2/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-zqe1rc67/src/docker-src.2020-03-10-18.40.45.9826:/var/tmp/qemu:z,ro', 'qemu:fedora', '/var/tmp/qemu/run', 'test-debug']' returned non-zero exit status 2. filter=--filter=label=com.qemu.instance.uuid=bbfa30d232f247d9a6ad69943f93d7d2
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-zqe1rc67/src'
make: *** [docker-run-test-debug@fedora] Error 2
real 28m12.870s
user 0m8.536s
The full log is available at
http://patchew.org/logs/[email protected]/testing.asan/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Quoted 5 lines · Niek Linnenbank
Dear QEMU developers,
Hereby I would like to contribute the following set of patches to QEMU which add support for the Allwinner H3 System on Chip and the Orange Pi PC machine. The following features and devices are supported:
<snip>
I've finished my pass through and I think everything has a review tag now. As there are some small fixes needed you can you do a v8 respin which Peter can apply to target-arm/next.
Signature · 1 line
Alex Bennée
Quoted 5 lines · Alex Bennée
Quoted 2 lines · Niek Linnenbank
Dear QEMU developers,
Quoted 9 lines
Quoted 3 lines
Hereby I would like to contribute the following set of patches to QEMU which add support for the Allwinner H3 System on Chip and the Orange Pi PC machine. The following features and devices are supported:
<snip>
I've finished my pass through and I think everything has a review tag now. As there are some small fixes needed you can you do a v8 respin which Peter can apply to target-arm/next.
Thanks for taking the time to review Alex. I'm including the small fixes you suggested and adding the tags and then I'll send v8 to the list.
Regards,
Niek
Quoted 4 lines
--
Alex Bennée
Signature · 1 line
Niek Linnenbank