Page MenuHomeFreeBSD

HiFive Unleashed support
ClosedPublic

Authored by br on May 10 2019, 2:55 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Dec 21, 9:07 AM
Unknown Object (File)
Sat, Dec 21, 6:10 AM
Unknown Object (File)
Mon, Dec 9, 7:55 PM
Unknown Object (File)
Fri, Dec 6, 2:54 PM
Unknown Object (File)
Nov 20 2024, 7:41 AM
Unknown Object (File)
Oct 10 2024, 5:10 AM
Unknown Object (File)
Sep 26 2024, 11:04 PM
Unknown Object (File)
Sep 23 2024, 11:46 AM
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

Lint
Lint Skipped
Unit
Tests Skipped

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
405

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

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.