Page MenuHomeFreeBSD

HiFive Unleashed support
ClosedPublic

Authored by br on May 10 2019, 2:55 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 27 2024, 11:55 AM
Unknown Object (File)
Feb 21 2024, 10:33 AM
Unknown Object (File)
Nov 22 2023, 11:15 AM
Unknown Object (File)
Nov 11 2023, 1:02 PM
Unknown Object (File)
Nov 9 2023, 8:03 PM
Unknown Object (File)
Nov 7 2023, 10:27 PM
Unknown Object (File)
Nov 7 2023, 7:14 PM
Unknown Object (File)
Nov 7 2023, 3:01 PM
Subscribers

Details

Summary
  1. Pick a hart to boot on using hart lottery. This is an official RISC-V way to avoid booting on the management hart used in Linux. Management hart runs BBL initialization sequence and it releases main CPUs before it jumps to FreeBSD entry point itself. So it never wins the lottery.
  2. Renumber CPUs early on boot so we can boot on any hart.

This fixes operation on HiFive Unleashed.

Test Plan

Tested in QEMU and HiFive Unleashed.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

  1. Store hart in struct pcpu
  2. Store harts not CPUIDs in pmap->pm_active

Use all_harts mask in release_aps()

Fix bug: use CPU_FILL to fill up kernel pmap pm_active.
all_harts is not initialized yet in pmap_boostrap()

sys/riscv/riscv/mp_machdep.c
398 ↗(On Diff #57314)

Hmm. Looks like Linux assumes that hartIDs can fit in a cpuset. I guess we can assume that too, but IMO we should assert that hartids are < MAXCPU.

sys/riscv/riscv/pmap.c
4295 ↗(On Diff #57314)

The var should be called "hart", ditto elsewhere.

  • Assert that hart < MAXCPU
  • Rename cpu variable to hart
This revision is now accepted and ready to land.May 12 2019, 1:08 AM
This revision was automatically updated to reflect the committed changes.