Skip to contentSkip to conversation

RISC-V Fixes for 4.2-rc2

GIT PULL Applied Palmer Dabbelt 2 participants 6 messages Nov 15, 2019

Subsystems (2)
lore
Share & tools
lore

Palmer Dabbelt

author maintainer
#0 lore raw

The following changes since commit aa464db69b40b4b695be31085e6d2f1e90956c89:

Update version for v4.2.0-rc1 release (2019-11-12 18:40:02 +0000)

are available in the Git repository at:

[email protected]:palmer-dabbelt/qemu.git tags/riscv-for-master-4.2-rc2

for you to fetch changes up to 6911fde41006b2afe3510755c4cff259ca56c1d9:

riscv/virt: Increase flash size (2019-11-14 09:53:28 -0800)

----------------------------------------------------------------
RISC-V Fixes for 4.2-rc2

This contains a handful of patches that I'd like to target for 4.2:

* OpenSBI upgrade to 0.5
* Increase in the flash size of the virt board.
* A non-functional cleanup.
* A cleanup to our MIP handling that avoids atomics.

This passes "make check" and boots OpenEmbedded for me.

----------------------------------------------------------------
Alistair Francis (3):
target/riscv: Remove atomic accesses to MIP CSR
opensbi: Upgrade from v0.4 to v0.5 riscv/virt: Increase flash size

hiroyuki.obinata (1):
remove unnecessary ifdef TARGET_RISCV64

 hw/riscv/virt.c                              |   2 +-
 pc-bios/opensbi-riscv32-virt-fw_jump.bin     | Bin 36888 -> 40984 bytes
 pc-bios/opensbi-riscv64-sifive_u-fw_jump.bin | Bin 45064 -> 49160 bytes
 pc-bios/opensbi-riscv64-virt-fw_jump.bin     | Bin 40968 -> 45064 bytes
 roms/opensbi                                 |   2 +-
 target/riscv/cpu.c                           |   5 ++-
 target/riscv/cpu.h                           |   9 -----
 target/riscv/cpu_helper.c                    |  48 ++++++++++-----------------
 target/riscv/csr.c                           |   2 +-
 target/riscv/translate.c                     |   4 +--
 10 files changed, 24 insertions(+), 48 deletions(-)
author maintainer
#1 lore raw

[PULL 1/4] remove unnecessary ifdef TARGET_RISCV64

From: "hiroyuki.obinata" <[email protected]>

---
 target/riscv/translate.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
target/riscv/translate.c +1 -3
index b26533d4fd78..ab6a891dc381 100644
@@ -64,12 +64,10 @@ static const int tcg_memop_lookup[8] = {
     [0] = MO_SB,
     [1] = MO_TESW,
     [2] = MO_TESL,
+    [3] = MO_TEQ,
     [4] = MO_UB,
     [5] = MO_TEUW,
-#ifdef TARGET_RISCV64
-    [3] = MO_TEQ,
     [6] = MO_TEUL,
-#endif
 };
 #endif
 
Signature · 1 line
2.21.0
author maintainer
#2 lore raw

[PULL 2/4] target/riscv: Remove atomic accesses to MIP CSR

In reply to Palmer Dabbelt

From: Alistair Francis <[email protected]>

Instead of relying on atomics to access the MIP register let's update our helper function to instead just lock the IO mutex thread before writing. This follows the same concept as used in PPC for handling interrupts

---
 target/riscv/cpu.c        |  5 ++--
 target/riscv/cpu.h        |  9 --------
 target/riscv/cpu_helper.c | 48 +++++++++++++++------------------------
 target/riscv/csr.c        |  2 +-
 4 files changed, 21 insertions(+), 43 deletions(-)
target/riscv/cpu.c +2 -3
index 3939963b71ab..d37861a4305b 100644
@@ -224,8 +224,7 @@ static void riscv_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 #ifndef CONFIG_USER_ONLY
     qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mhartid ", env->mhartid);
     qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mstatus ", env->mstatus);
-    qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mip     ",
-                 (target_ulong)atomic_read(&env->mip));
+    qemu_fprintf(f, " %s 0x%x\n", "mip     ", env->mip);
     qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mie     ", env->mie);
     qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mideleg ", env->mideleg);
     qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "medeleg ", env->medeleg);
@@ -275,7 +274,7 @@ static bool riscv_cpu_has_work(CPUState *cs)
      * Definition of the WFI instruction requires it to ignore the privilege
      * mode and delegation registers, but respect individual enables
      */
-    return (atomic_read(&env->mip) & env->mie) != 0;
+    return (env->mip & env->mie) != 0;
 #else
     return true;
 #endif
target/riscv/cpu.h +0 -9
index 8c64c68538d8..e59343e13c02 100644
@@ -121,15 +121,6 @@ struct CPURISCVState {
     target_ulong mhartid;
     target_ulong mstatus;
 
-    /*
-     * CAUTION! Unlike the rest of this struct, mip is accessed asynchonously
-     * by I/O threads. It should be read with atomic_read. It should be updated
-     * using riscv_cpu_update_mip with the iothread mutex held. The iothread
-     * mutex must be held because mip must be consistent with the CPU inturrept
-     * state. riscv_cpu_update_mip calls cpu_interrupt or cpu_reset_interrupt
-     * wuth the invariant that CPU_INTERRUPT_HARD is set iff mip is non-zero.
-     * mip is 32-bits to allow atomic_read on 32-bit hosts.
-     */
     uint32_t mip;
     uint32_t miclaim;
 
target/riscv/cpu_helper.c +18 -30

73 lines not on this page · raw message

target/riscv/csr.c +1 -1
index 974c9c20b5f4..da02f9f0b177 100644
@@ -579,7 +579,7 @@ static int rmw_mip(CPURISCVState *env, int csrno, target_ulong *ret_value,
     if (mask) {
         old_mip = riscv_cpu_update_mip(cpu, mask, (new_value & mask));
     } else {
-        old_mip = atomic_read(&env->mip);
+        old_mip = env->mip;
     }
 
     if (ret_value) {
Signature · 1 line
2.21.0
author maintainer
#3 lore raw

[PULL 4/4] riscv/virt: Increase flash size

In reply to Palmer Dabbelt

From: Alistair Francis <[email protected]>

Coreboot developers have requested that they have at least 32MB of flash to load binaries. We currently have 32MB of flash, but it is split in two to allow loading two flash binaries. Let's increase the flash size from 32MB to 64MB to ensure we have a single region that is 32MB.

No QEMU release has include flash in the RISC-V virt machine, so this isn't a breaking change.

---
 hw/riscv/virt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/riscv/virt.c +1 -1
index cc8f311e6bbb..23f340df193e 100644
@@ -62,7 +62,7 @@ static const struct MemmapEntry {
     [VIRT_PLIC] =        {  0xc000000,     0x4000000 },
     [VIRT_UART0] =       { 0x10000000,         0x100 },
     [VIRT_VIRTIO] =      { 0x10001000,        0x1000 },
-    [VIRT_FLASH] =       { 0x20000000,     0x2000000 },
+    [VIRT_FLASH] =       { 0x20000000,     0x4000000 },
     [VIRT_DRAM] =        { 0x80000000,           0x0 },
     [VIRT_PCIE_MMIO] =   { 0x40000000,    0x40000000 },
     [VIRT_PCIE_PIO] =    { 0x03000000,    0x00010000 },
Signature · 1 line
2.21.0
author maintainer
#4 lore raw

[PULL 3/4] opensbi: Upgrade from v0.4 to v0.5

In reply to Palmer Dabbelt

From: Alistair Francis <[email protected]>

This release has:
Lot of critical fixes
Hypervisor extension support
SBI v0.2 base extension support
Debug prints support
Handle traps when doing unpriv load/store Allow compiling without FP support
Use git describe to generate boot-time banner Andes AE350 platform support

ShortLog:

Anup Patel (14):
platform: sifive/fu540: Move FDT further up
lib: Allow compiling without FP support
lib: Introduce sbi_dprintf() API
lib: Use sbi_dprintf() for invalid CSRs
lib: Handle traps when doing unpriv load/store in get_insn()
lib: Delegate supervisor ecall to HS-mode when H extension available
lib: Extend sbi_hart_switch_mode() to support hypervisor extension
lib: Extend sbi_trap_redirect() for hypervisor extension
lib: Redirect WFI trapped from VS/VU mode to HS-mode
include: Extend get_insn() to read instruction from VS/VU mode
lib: Emulate HTIMEDELTA CSR for platforms not having TIME CSR
Makefile: Minor fix in OPENSBI_VERSION_GIT
lib: Fix coldboot race condition observed on emulators/simulators
include: Bump-up version to 0.5

Atish Patra (16):
lib: Provide an atomic exchange function unsigned long
lib: Fix race conditions in tlb fifo access.
platform: Remove the ipi_sync method from all platforms.
lib: Fix timer for 32 bit
lib: Support atomic swap instructions
lib: Upgrade to full flush if size is at least threshold
docs: Update the fu540 platform guide as per U-Boot documents.
lib: Change tlb range flush threshold to 4k page instead of 1G
lib: provide a platform specific tlb range flush threshold
lib: Fix tlb flush range limit value
Test: Move test payload related code out of interface header
lib: Align error codes as per SBI specification.
lib: Rename existing SBI implementation as 0.1.
lib: Remove redundant variable assignment
lib: Implement SBI v0.2
lib: Provide a platform hook to implement vendor specific SBI extensions.

Bin Meng (6):
platform: sifive: fu540: Use standard value string for cpu node status
README: Document 32-bit / 64-bit images build
treewide: Use conventional names for 32-bit and 64-bit
platform: sifive: fu540: Expand FDT size before any patching
firmware: Use macro instead of magic number for boot status
docs: platform: Update descriptions for qemu/sifive_u support

Damien Le Moal (4):
kendryte/k210: Use sifive UART driver
kendryte/k210: remove sysctl code
README: Update license information
kendryte/k210: remove unused file

Georg Kotheimer (1):
utils: Use cpu_to_fdt32() when writing to fdt

Jacob Garber (4):
lib: Use bitwise & instead of boolean &&
lib: Use correct type for return value
lib: Prevent unintended sign extensions
lib: Correct null pointer check

Lukas Auer (1):
firmware: do not use relocated _boot_status before it is valid

Nylon Chen (3):
firmware: Fix the loop condition of _wait_relocate_copy_done section
platform: Add Andes AE350 initial support
scripts: Add AE350 to platform list in the binary archive script

Palmer Dabbelt (1):
Include git describe in OpenSBI

Zong Li (1):
Write MSIP by using memory-mapped control register

---
 pc-bios/opensbi-riscv32-virt-fw_jump.bin     | Bin 36888 -> 40984 bytes
 pc-bios/opensbi-riscv64-sifive_u-fw_jump.bin | Bin 45064 -> 49160 bytes
 pc-bios/opensbi-riscv64-virt-fw_jump.bin     | Bin 40968 -> 45064 bytes
 roms/opensbi                                 |   2 +-
 4 files changed, 1 insertion(+), 1 deletion(-)
pc-bios/opensbi-riscv32-virt-fw_jump.bin binary +0 -0
index f5bcaa56954c860d09acc0cb337c1666d88b6efb..6c5b7b89f676392b687d9835ac9fbdc34f3052cd 100644
GIT binary patch
pc-bios/opensbi-riscv64-sifive_u-fw_jump.bin binary +0 -0
index eb22aefdfb468cfe2804cb4b0bc422d8ebcae93b..971f2be4054d481461efbddca947c44fcfc73ce9 100644
GIT binary patch
pc-bios/opensbi-riscv64-virt-fw_jump.bin binary +0 -0
index 4cec6f0210f31969ac232123ce101ce71bbf9f2b..45a5aed1ce0cc2121a9e9b9733010d85da5f53ba 100644
GIT binary patch
roms/opensbi +1 -1
index ce228ee0919d..be92da280d87 160000
@@ -1 +1 @@
-Subproject commit ce228ee0919deb9957192d723eecc8aaae2697c6
+Subproject commit be92da280d87c38a2e0adc5d3f43bab7b5468f09
Signature · 1 line
2.21.0
#5 lore raw
In reply to Palmer Dabbelt
Quoted 16 lines · Palmer Dabbelt

The following changes since commit aa464db69b40b4b695be31085e6d2f1e90956c89:

Update version for v4.2.0-rc1 release (2019-11-12 18:40:02 +0000)

are available in the Git repository at:

[email protected]:palmer-dabbelt/qemu.git tags/riscv-for-master-4.2-rc2

for you to fetch changes up to 6911fde41006b2afe3510755c4cff259ca56c1d9:

riscv/virt: Increase flash size (2019-11-14 09:53:28 -0800)

----------------------------------------------------------------
RISC-V Fixes for 4.2-rc2

Quoted 9 lines

This contains a handful of patches that I'd like to target for 4.2:

* OpenSBI upgrade to 0.5
* Increase in the flash size of the virt board.
* A non-functional cleanup.
* A cleanup to our MIP handling that avoids atomics.

This passes "make check" and boots OpenEmbedded for me.

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.2
for any user-visible changes.

-- PMM