]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
riscv: set kernel_pmap hart mask more precisely
authorMitchell Horne <mhorne@FreeBSD.org>
Thu, 5 Nov 2020 00:52:52 +0000 (00:52 +0000)
committerMitchell Horne <mhorne@FreeBSD.org>
Thu, 5 Nov 2020 00:52:52 +0000 (00:52 +0000)
commitcaaddb88e80c9b9033436e74a5176a8a32001d8e
tree85585206bd8d95c25dcd841e021d4f1f40323a2a
parent01db2f5461b88da81cf269639a91411a960da9cc
riscv: set kernel_pmap hart mask more precisely

In pmap_bootstrap(), we fill kernel_pmap->pm_active since it is
invariably active on all harts. However, this marks it as active even
for harts that don't exist in the system, which can cause issue when the
mask is passed to the SBI firmware via sbi_remote_sfence_vma().
Specifically, the SBI spec allows SBI_ERR_INVALID_PARAM to be returned
when an invalid hart is set in the mask.

The latest version of OpenSBI does not have this issue, but v0.6 does,
and this is triggering a recently added KASSERT in CI. Switch to only
setting bits in pm_active for harts that enter the system.

Reported by: Jenkins
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D27080
sys/riscv/riscv/mp_machdep.c
sys/riscv/riscv/pmap.c