Skip to content
Snippets Groups Projects
  1. Mar 17, 2020
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/palmer/tags/riscv-for-master-5.0-sf5' into staging · 3189e9d3
      Peter Maydell authored
      
      RISC-V Patches for the 5.0 Soft Freeze, Part 5
      
      This tag contains the last of the patches I'd like to target for the 5.0 soft
      freeze.  At this point we're mostly collecting fixes, but there are a few new
      features.  The changes include:
      
      * An OpenSBI update, including the various bits necessary to put CI together
        and an image for the 32-bit sifive_u board.
      * A fix that disallows TSR when outside of machine mode.
      * A fix for VS-mode interrupt forwarding.
      
      # gpg: Signature made Tue 17 Mar 2020 03:59:58 GMT
      # gpg:                using RSA key 2B3C3747446843B24A943A7A2E1319F35FBB1889
      # gpg:                issuer "palmer@dabbelt.com"
      # gpg: Good signature from "Palmer Dabbelt <palmer@dabbelt.com>" [unknown]
      # gpg:                 aka "Palmer Dabbelt <palmer@sifive.com>" [unknown]
      # gpg:                 aka "Palmer Dabbelt <palmerdabbelt@google.com>" [unknown]
      # gpg: WARNING: This key is not certified with a trusted signature!
      # gpg:          There is no indication that the signature belongs to the owner.
      # Primary key fingerprint: 00CE 76D1 8349 60DF CE88  6DF8 EF4C A150 2CCB AB41
      #      Subkey fingerprint: 2B3C 3747 4468 43B2 4A94  3A7A 2E13 19F3 5FBB 1889
      
      * remotes/palmer/tags/riscv-for-master-5.0-sf5:
        target/riscv: Fix VS mode interrupts forwarding.
        gitlab-ci.yml: Add jobs to build OpenSBI firmware binaries
        riscv: sifive_u: Update BIOS_FILENAME for 32-bit
        roms: opensbi: Add 32-bit firmware image for sifive_u machine
        roms: opensbi: Upgrade from v0.5 to v0.6
        target/riscv: Correctly implement TSR trap
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      3189e9d3
    • Rajnesh Kanwal's avatar
      target/riscv: Fix VS mode interrupts forwarding. · c5969a3a
      Rajnesh Kanwal authored
      
      Currently riscv_cpu_local_irq_pending is used to find out pending
      interrupt and VS mode interrupts are being shifted to represent
      S mode interrupts in this function. So when the cause returned by
      this function is passed to riscv_cpu_do_interrupt to actually
      forward the interrupt, the VS mode forwarding check does not work
      as intended and interrupt is actually forwarded to hypervisor. This
      patch fixes this issue.
      
      Signed-off-by: default avatarRajnesh Kanwal <rajnesh.kanwal49@gmail.com>
      Reviewed-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
      Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
    • Bin Meng's avatar
      gitlab-ci.yml: Add jobs to build OpenSBI firmware binaries · c6fc0fc1
      Bin Meng authored
      Add two GitLab jobs to build the OpenSBI firmware binaries.
      
      The first job builds a Docker image with the packages requisite
      to build OpenSBI, and stores this image in the GitLab registry.
      The second job pulls the image from the registry and builds the
      OpenSBI firmware binaries.
      
      The docker image is only rebuilt if the GitLab YAML or the
      Dockerfile is updated. The second job is only built when the
      roms/opensbi/ submodule is updated, when a git-ref starts with
      'opensbi' or when the last commit contains 'OpenSBI'. The files
      generated are archived in the artifacts.zip file.
      
      With OpenSBI v0.6, it took 2 minutes 56 seconds to build
      the docker image, and 1 minute 24 seconds to generate the
      artifacts.zip with the firmware binaries (filesize: 111KiB).
      
      See: https://gitlab.com/lbmeng/qemu/pipelines/120520138
      
      
      
      Suggested-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
    • Bin Meng's avatar
      riscv: sifive_u: Update BIOS_FILENAME for 32-bit · b78c3296
      Bin Meng authored
      
      Update BIOS_FILENAME to consider 32-bit bios image file name.
      
      Tested booting Linux v5.5 32-bit image (built from rv32_defconfig
      plus CONFIG_SOC_SIFIVE) with the default 32-bit bios image.
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      Reviewed-by: default avatarAlistair Francis <alistair.francis@wdc.com>
      Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
    • Bin Meng's avatar
      roms: opensbi: Add 32-bit firmware image for sifive_u machine · a6fcc80b
      Bin Meng authored
      
      Although the real world SiFive HiFive Unleashed board is a 64-bit
      hardware configuration, with QEMU it is possible to test 32-bit
      configuration with the same hardware features.
      
      This updates the roms Makefile to add the build rules for creating
      the 32-bit OpenSBI firmware image for sifive_u machine. A pre-built
      OpenSBI v0.6 image has been added as the default bios for 32-bit
      sifive_u machine.
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      Reviewed-by: default avatarAlistair Francis <alistair.francis@wdc.com>
      Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
    • Bin Meng's avatar
      roms: opensbi: Upgrade from v0.5 to v0.6 · bfd05e81
      Bin Meng authored
      
      Upgrade OpenSBI from v0.5 to v0.6 and the pre-built bios images.
      
      The v0.6 release includes the following commits:
      
      dd8ef28 firmware: Fix compile error for FW_PAYLOAD with latest GCC binutils
      98f4a20 firmware: Introduce relocation lottery
      f728a0b include: Sync-up encoding with priv v1.12-draft and hypervisor v0.5-draft
      18897aa include: Use _UL() and _ULL() for defines in riscv_encoding.h
      7a13beb firmware: Add preferred boot HART field in struct fw_dynamic_info
      215421c lib: Remove date and time from init message
      838657c include: Remove ilen member of struct unpriv_trap
      b1d8c98 lib: No need to set VSSTATUS.MXR bit in get_insn()
      0e1322b lib: Better naming of unpriv APIs for wider use
      75f903d lib: Simplify trap parameters in sbi_ecall functions
      c96cc03 lib: Fix CPU capabilities detection function
      ab14f94 lib: Fix probe extension
      813f7f4 lib: Add error detection for misa_extension
      dc40042 include: sbi_platform: fix compilation for GCC-9
      bd732ae include: Add guest external interrupt related defines
      6590a7d lib: Delegate guest page faults to HS-mode
      4370f18 include: Extend struct sbi_trap_info for mtval2 and mtinst
      086dbdf lib: Fix sbi_get_insn() for load guest page fault
      2be424b lib: Extend trap redirection for hypervisor v0.5 spec
      7219477 lib: Use MTINST CSR in misaligned load/store emulation
      b8732fe lib: Add replacement extension and function ids
      aa0ed1d lib: Remove redundant IPI types
      1092663 lib: Add TIME extension in SBI
      9777aee lib: Add IPI extension in SBI
      9407202 lib: Add hfence instruction encoding
      331ff6a lib: Support stage1 and stage2 tlb flushing
      86a31f5 lib: Implement RFENCE extension
      c7d1b12 firmware: Return real DTB address when FW_xyz_FDT_ADDR is not defined
      9beb573 firmware: Improve comments for fw_prev_arg1() and fw_next_arg1()
      fc6bd90 docs: Improve docs for FDT address passing
      46a90d9 lib: utils: Support CLINT with 32bit MMIO access on RV64 system
      c0849cd platform: Add T-head C910 initial support
      e746673 lib: Remove unnecessary checks from init_coldboot() and init_warmboot()
      c3e406f lib: Add initial sbi_exit() API
      55e191e lib: Add system early_exit and final_exit APIs
      6469ed1 lib: Add timer exit API
      b325f6b lib: Add ipi exit API
      1993182 lib: Add irqchip exit API
      2aa43a1 lib: save/restore MIE CSR in sbi_hart_wait_for_coldboot()
      b0c9787 lib: do sbi_exit() upon halt IPI
      15ed1e7 lib: improve system reboot and shutdown implementation
      73c19e6 lib: zero-out memory allocated using sbi_scratch_alloc_offset()
      a67fd68 lib: Add sbi_init_count() API
      049ad0b build: Use -ffreestanding
      e340bbf include: Add OPENSBI_EXTERNAL_SBI_TYPES in sbi_types.h
      b28b8ac docs: Add description of using OPENSBI_EXTERNAL_SBI_TYPES
      adf8b73 platform: thead/c910: Remove SBI_PLATFORM_HAS_PMP
      f95dd39 docs: platform: Update SiFive FU540 doc as-per U-Boot v2020.01
      6ffe1be firmware: Fix placement of .align directives
      7daccae platform: thead/c910: Don't enable L2 cache in warm boot
      a73d45c platform: thead/c910: Don't set plic/clint address in warm boot
      30cdf00 scripts: Add C910 to platform list in the binary archive script
      0492c5d include: Typo fix in comment for SBI_SCRATCH_SIZE define
      046cc16 lib: Move struct sbi_ipi_data definition to sbi_ipi.c
      3d2aaac lib: Introduce sbi_ipi_send_smode() API
      da9b76b lib: Introduce sbi_ipi_send_halt() API
      a8b4b83 lib: Introduce sbi_tlb_fifo_request() API
      5f762d1 lib: Introduce sbi_ipi_event_create/destroy() APIs
      817d50d lib: Drop _fifo from the name of various sbi_tlb_fifo_xyz() functions
      84cd4fc lib: Initialize TLB management directly from coldboot/warmboot path
      0a411bf include: Add generic and simple list handling APIs
      37923c4 lib: Add dynamic registration of SBI extensions
      7668502 lib: Factor-out SBI legacy extension
      161b348 lib: Factor-out SBI replacement extensions
      43ac621 lib: Factor-out SBI vendor extension
      021b9e7 lib: Factor-out SBI base extension
      85647a1 platform: template: typo fix in system reboot/shutdown names
      ac1c229 platform: Update UART base addresses for qemu/sifve_u
      d79173b platform: Add an platform ops to return platform specific tlb flush limit
      2c2bbe7 platform: sifive/fu540: Set tlb range flush limit to zero
      5ff1ab0 makefile: add support for building on macOS
      6d0b4c5 platform: Drop qemu/sifive_u support
      9a717ec platform: sifive: fu540: Add platform specific 'make run' cmd
      d6fa7f9 doc: sifive: fu540: Update QEMU instruction when using U-Boot as the payload
      179edde lib: sbi_scratch: use bitwise ops in sbi_scratch_alloc_offset()
      897b8fb lib: Use __builtin_ctzl() in pmp_get()
      1a8ca08 lib: Initialize out value in SBI calls
      c2bfa2b lib: irqchip/plic: Disable all contexts and IRQs
      c2f23cc platform: Add Spike initial support
      a062200 platform: Remove stale options from config.mk files
      c03c8a1 scripts: Add Spike to platform list of binary archive script
      29bb2a6 docs: platform: Add documentation for Spike platform
      48b06ad ThirdPartyNotices: Fix doc styles
      892e879 doc: coreboot: Fix doc styles
      fdfb533 doc: payload_linux: Fix doc styles
      44d1296 doc: andes-ae350: Fix doc styles
      a8ef0b5 doc: ariane-fpga: Fix doc styles
      82fd42f doc: qemu_virt: Fix doc styles
      f8ce996 doc: sifive_fu540: Fix doc styles
      27a5c7f doc: thead-c910: Fix doc styles
      0b41453 Revert "lib: Use __builtin_ctzl() in pmp_get()"
      c66543d lib: utils: htif: Fix 32-bit build
      bc874e3 lib: Don't check MIDELEG and MEDELEG at end of delegate_traps()
      24c3082 lib: Print interrupt and exception delegation in boot prints
      66fb729 platform: sifive: fu540: Add 32-bit specific fdt/payload addresses
      3e7d666 platform: qemu: virt: Correct the typo in config.mk
      c3b3b8f lib: Fix typo in atomic exchange functions
      3936243 lib: Use available hart mask for correct hbase value
      f8b3bb8 lib: Simplify the for-loop in sbi_ipi_send_many()
      ac5e821 include: Bump-up version to 0.6
      
      Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
      Reviewed-by: default avatarAlistair Francis <alistair.francis@wdc.com>
      Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
    • Alistair Francis's avatar
      target/riscv: Correctly implement TSR trap · ed5abf46
      Alistair Francis authored
      As reported in: https://bugs.launchpad.net/qemu/+bug/1851939
      
       we weren't
      correctly handling illegal instructions based on the value of MSTATUS_TSR
      and the current privledge level.
      
      This patch fixes the issue raised in the bug by raising an illegal
      instruction if TSR is set and we are in S-Mode.
      
      Signed-off-by: default avatarAlistair Francis <alistair.francis@wdc.com>
      Reviewed-by: default avatarJonathan Behrens <jonathan@fintelia.io>
      Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
  2. Mar 16, 2020
  3. Mar 13, 2020
  4. Mar 12, 2020
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200312' into staging · d4f7d567
      Peter Maydell authored
      
      target-arm queue:
       * Fix various bugs that might result in an assert() due to
         incorrect hflags for M-profile CPUs
       * Fix Aspeed SMC Controller user-mode select handling
       * Report correct (with-tag) address in fault address register
         when TBI is enabled
       * cubieboard: make sure SOC object isn't leaked
       * fsl-imx25: Wire up eSDHC controllers
       * fsl-imx25: Wire up USB controllers
       * New board model: orangepi-pc (OrangePi PC)
       * ARM/KVM: if user doesn't select GIC version and the
         host kernel can only provide GICv3, use that, rather
         than defaulting to "fail because GICv2 isn't possible"
       * kvm: Only do KVM_SET_VCPU_EVENTS at the last stage of sync
      
      # gpg: Signature made Thu 12 Mar 2020 16:43:46 GMT
      # gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
      # gpg:                issuer "peter.maydell@linaro.org"
      # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [ultimate]
      # gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [ultimate]
      # gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [ultimate]
      # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE
      
      * remotes/pmaydell/tags/pull-target-arm-20200312: (36 commits)
        target/arm: kvm: Inject events at the last stage of sync
        hw/arm/virt: kvm: allow gicv3 by default if v2 cannot work
        hw/arm/virt: kvm: Restructure finalize_gic_version()
        target/arm/kvm: Let kvm_arm_vgic_probe() return a bitmap
        hw/arm/virt: Introduce finalize_gic_version()
        hw/arm/virt: Introduce VirtGICType enum type
        hw/arm/virt: Document 'max' value in gic-version property description
        docs: add Orange Pi PC document
        tests/boot_linux_console: Test booting NetBSD via U-Boot on OrangePi PC
        tests/boot_linux_console: Add a SLOW test booting Ubuntu on OrangePi PC
        tests/boot_linux_console: Add a SD card 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 quick test for the OrangePi PC board
        hw/arm/allwinner: add RTC device support
        hw/arm/allwinner-h3: add SDRAM controller device
        hw/arm/allwinner-h3: add Boot ROM support
        hw/arm/allwinner-h3: add EMAC ethernet device
        hw/arm/allwinner: add SD/MMC host controller
        hw/arm/allwinner: add Security Identifier device
        hw/arm/allwinner: add CPU Configuration module
        ...
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      d4f7d567
    • Peter Maydell's avatar
      Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging · 49780a58
      Peter Maydell authored
      
      Block layer patches:
      
      - Relax restrictions for blockdev-snapshot (allows libvirt to do live
        storage migration with blockdev-mirror)
      - luks: Delete created files when block_crypto_co_create_opts_luks fails
      - Fix memleaks in qmp_object_add
      
      # gpg: Signature made Wed 11 Mar 2020 15:38:59 GMT
      # gpg:                using RSA key 7F09B272C88F2FD6
      # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full]
      # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6
      
      * remotes/kevin/tags/for-upstream:
        qemu-iotests: adding LUKS cleanup for non-UTF8 secret error
        crypto.c: cleanup created file when block_crypto_co_create_opts_luks fails
        block.c: adding bdrv_co_delete_file
        block: introducing 'bdrv_co_delete_file' interface
        tests/qemu-iotests: Fix socket_scm_helper build path
        qapi: Add '@allow-write-only-overlay' feature for 'blockdev-snapshot'
        iotests: Add iothread cases to 155
        block: Fix cross-AioContext blockdev-snapshot
        iotests: Test mirror with temporarily disabled target backing file
        iotests: Fix run_job() with use_log=False
        block: Relax restrictions for blockdev-snapshot
        block: Make bdrv_get_cumulative_perm() public
        qom-qmp-cmds: fix two memleaks in qmp_object_add
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      49780a58
    • Beata Michalska's avatar
      target/arm: kvm: Inject events at the last stage of sync · aca53be3
      Beata Michalska authored
      
      KVM_SET_VCPU_EVENTS might actually lead to vcpu registers being modified.
      As such this should be the last step of sync to avoid potential overwriting
      of whatever changes KVM might have done.
      
      Signed-off-by: default avatarBeata Michalska <beata.michalska@linaro.org>
      Reviewed-by: default avatarAndrew Jones <drjones@redhat.com>
      Message-id: 20200312003401.29017-2-beata.michalska@linaro.org
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      aca53be3
    • Eric Auger's avatar
      hw/arm/virt: kvm: allow gicv3 by default if v2 cannot work · 6785aee0
      Eric Auger authored
      
      At the moment if the end-user does not specify the gic-version along
      with KVM acceleration, v2 is set by default. However most of the
      systems now have GICv3 and sometimes they do not support GICv2
      compatibility.
      
      This patch keeps the default v2 selection in all cases except
      in the KVM accelerated mode when either
      - the host does not support GICv2 in-kernel emulation or
      - number of VCPUS exceeds 8.
      
      Those cases did not work anyway so we do not break any compatibility.
      Now we get v3 selected in such a case.
      
      Signed-off-by: default avatarEric Auger <eric.auger@redhat.com>
      Reported-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      Reviewed-by: default avatarAndrew Jones <drjones@redhat.com>
      Message-id: 20200311131618.7187-7-eric.auger@redhat.com
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      6785aee0
    • Eric Auger's avatar
      hw/arm/virt: kvm: Restructure finalize_gic_version() · 97b4c918
      Eric Auger authored
      
      Restructure the finalize_gic_version with switch cases and
      clearly separate the following cases:
      
      - KVM mode / in-kernel irqchip
      - KVM mode / userspace irqchip
      - TCG mode
      
      In KVM mode / in-kernel irqchip , we explictly check whether
      the chosen version is supported by the host. If the end-user
      explicitly sets v2/v3 and this is not supported by the host,
      then the user gets an explicit error message. Note that for
      old kernels where the CREATE_DEVICE ioctl doesn't exist then
      we will now fail if the user specifically asked for gicv2,
      where previously we (probably) would have succeeded.
      
      In KVM mode / userspace irqchip we immediatly output an error
      in case the end-user explicitly selected v3. Also we warn the
      end-user about the unexpected usage of gic-version=host in
      that case as only userspace GICv2 is supported.
      
      Signed-off-by: default avatarEric Auger <eric.auger@redhat.com>
      Reviewed-by: default avatarAndrew Jones <drjones@redhat.com>
      Message-id: 20200311131618.7187-6-eric.auger@redhat.com
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      97b4c918
    • Eric Auger's avatar
      target/arm/kvm: Let kvm_arm_vgic_probe() return a bitmap · d45efe47
      Eric Auger authored
      
      Convert kvm_arm_vgic_probe() so that it returns a
      bitmap of supported in-kernel emulation VGIC versions instead
      of the max version: at the moment values can be v2 and v3.
      This allows to expose the case where the host GICv3 also
      supports GICv2 emulation. This will be useful to choose the
      default version in KVM accelerated mode.
      
      Signed-off-by: default avatarEric Auger <eric.auger@redhat.com>
      Reviewed-by: default avatarAndrew Jones <drjones@redhat.com>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Message-id: 20200311131618.7187-5-eric.auger@redhat.com
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      d45efe47
    • Eric Auger's avatar
      hw/arm/virt: Introduce finalize_gic_version() · 36bf4ec8
      Eric Auger authored
      
      Let's move the code which freezes which gic-version to
      be applied in a dedicated function. We also now set by
      default the VIRT_GIC_VERSION_NO_SET. This eventually
      turns into the legacy v2 choice in the finalize() function.
      
      Signed-off-by: default avatarEric Auger <eric.auger@redhat.com>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Reviewed-by: default avatarAndrew Jones <drjones@redhat.com>
      Message-id: 20200311131618.7187-4-eric.auger@redhat.com
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      36bf4ec8
    • Eric Auger's avatar
      hw/arm/virt: Introduce VirtGICType enum type · d04460e5
      Eric Auger authored
      
      We plan to introduce yet another value for the gic version (nosel).
      As we already use exotic values such as 0 and -1, let's introduce
      a dedicated enum type and let vms->gic_version take this
      type.
      
      Signed-off-by: default avatarEric Auger <eric.auger@redhat.com>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Reviewed-by: default avatarAndrew Jones <drjones@redhat.com>
      Message-id: 20200311131618.7187-3-eric.auger@redhat.com
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      d04460e5
    • Eric Auger's avatar
      hw/arm/virt: Document 'max' value in gic-version property description · 71b296d9
      Eric Auger authored
      
      Mention 'max' value in the gic-version property description.
      
      Signed-off-by: default avatarEric Auger <eric.auger@redhat.com>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Reviewed-by: default avatarAndrew Jones <drjones@redhat.com>
      Message-id: 20200311131618.7187-2-eric.auger@redhat.com
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      71b296d9
    • Niek Linnenbank's avatar
      docs: add Orange Pi PC document · 0553ef42
      Niek Linnenbank authored
      
      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.
      
      Signed-off-by: default avatarNiek Linnenbank <nieklinnenbank@gmail.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Message-id: 20200311221854.30370-19-nieklinnenbank@gmail.com
      [PMM: moved file into docs/system/arm to match the reorg
      of the arm target part of the docs; tweaked heading to
      match other boards]
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      0553ef42
    • Philippe Mathieu-Daudé's avatar
      tests/boot_linux_console: Test booting NetBSD via U-Boot on OrangePi PC · 921589fb
      Philippe Mathieu-Daudé authored
      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]         mkrepro@mkrepro.NetBSD.org:/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 s
      
      Note, 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/qemu-devel@nongnu.org/msg669347.html
      
      
      
      Signed-off-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Signed-off-by: default avatarNiek Linnenbank <nieklinnenbank@gmail.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Tested-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Message-id: 20200311221854.30370-18-nieklinnenbank@gmail.com
      [NL: changed test to use NetBSD 9.0 final release and -global allwinner-rtc.base-year]
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      921589fb
    • Philippe Mathieu-Daudé's avatar
      tests/boot_linux_console: Add a SLOW test booting Ubuntu on OrangePi PC · 784b8796
      Philippe Mathieu-Daudé authored
      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>.
      
      Signed-off-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Signed-off-by: default avatarNiek Linnenbank <nieklinnenbank@gmail.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Tested-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Message-id: 20200311221854.30370-17-nieklinnenbank@gmail.com
      [NL: rename in commit message Raspbian to Armbian, remove vm.set_machine()]
      [NL: changed test to boot from SD card via BootROM, added check for 7z]
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      784b8796
    • Philippe Mathieu-Daudé's avatar
      tests/boot_linux_console: Add a SD card test for the OrangePi PC board · de2749bc
      Philippe Mathieu-Daudé authored
      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 (root@armbian.com) (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
      
      Signed-off-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Signed-off-by: default avatarNiek Linnenbank <nieklinnenbank@gmail.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Tested-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Message-id: 20200311221854.30370-16-nieklinnenbank@gmail.com
      [NL: rename in commit message Raspbian to Armbian, remove vm.set_machine()]
      [NL: extend test with ethernet device checks]
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      de2749bc
    • Philippe Mathieu-Daudé's avatar
      tests/boot_linux_console: Add initrd test for the Orange Pi PC board · c40b1ded
      Philippe Mathieu-Daudé authored
      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 (root@armbian.com) (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 (root@armbian.com) (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
      
      Signed-off-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Signed-off-by: default avatarNiek Linnenbank <nieklinnenbank@gmail.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Tested-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Message-id: 20200311221854.30370-15-nieklinnenbank@gmail.com
      [NL: rename in commit message Raspbian to Armbian, remove vm.set_machine()]
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      c40b1ded
    • Philippe Mathieu-Daudé's avatar
      tests/boot_linux_console: Add a quick test for the OrangePi PC board · 5abe9f0b
      Philippe Mathieu-Daudé authored
      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 (root@armbian.com) (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
      
      Signed-off-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Signed-off-by: default avatarNiek Linnenbank <nieklinnenbank@gmail.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Tested-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Message-id: 20200311221854.30370-14-nieklinnenbank@gmail.com
      [NL: rename in commit message Raspbian to Armbian, remove vm.set_machine()]
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      5abe9f0b
    • Niek Linnenbank's avatar
      hw/arm/allwinner: add RTC device support · a9ad9e73
      Niek Linnenbank authored
      
      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
      
      The following boards are extended with the RTC device:
      
       * Cubieboard (hw/arm/cubieboard.c)
       * Orange Pi PC (hw/arm/orangepi.c)
      
      Signed-off-by: default avatarNiek Linnenbank <nieklinnenbank@gmail.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Message-id: 20200311221854.30370-13-nieklinnenbank@gmail.com
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      a9ad9e73
    • Niek Linnenbank's avatar
      hw/arm/allwinner-h3: add SDRAM controller device · b71d0385
      Niek Linnenbank authored
      
      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: default avatarNiek Linnenbank <nieklinnenbank@gmail.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Message-id: 20200311221854.30370-12-nieklinnenbank@gmail.com
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      b71d0385
    • Niek Linnenbank's avatar
      hw/arm/allwinner-h3: add Boot ROM support · a80beb16
      Niek Linnenbank authored
      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: default avatarNiek Linnenbank <nieklinnenbank@gmail.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Message-id: 20200311221854.30370-11-nieklinnenbank@gmail.com
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      a80beb16
Loading