Page MenuHomeFreeBSD

riscv: Create a newbus device for the SBI driver
ClosedPublic

Authored by jrtc27 on Jul 24 2022, 9:57 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Oct 26, 4:21 AM
Unknown Object (File)
Sat, Oct 26, 4:20 AM
Unknown Object (File)
Tue, Oct 22, 9:45 PM
Unknown Object (File)
Tue, Oct 22, 9:45 PM
Unknown Object (File)
Tue, Oct 22, 9:45 PM
Unknown Object (File)
Tue, Oct 22, 9:45 PM
Unknown Object (File)
Tue, Oct 22, 9:45 PM
Unknown Object (File)
Sun, Oct 20, 3:35 AM
Subscribers

Details

Summary

This approach is based on the Arm PSCI driver, though that makes more
extensive use of its softc than we do here. This will be used to extract
the SBI IPI code as a real PIC.

MFC after: 1 month

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This generally looks good. I'm not 100% sure the probe value is correct, but it's not wrong. The value that's there will work, but maybe 0 would be better unless there's multiple sbi devices at the root nexus.

sys/riscv/riscv/sbi.c
343

Since we added this device specifically, can there be a time when we'll need to 'bid' on it?

This revision is now accepted and ready to land.Jul 24 2022, 10:04 PM
sys/riscv/riscv/sbi.c
343

Since this hangs off nexus we'd otherwise risk attaching to other nexus children, rather than just the one that was added in sbi_identify with this explicit driver?

sys/riscv/riscv/sbi.c
343

Don't we have the same problem if there's multiple identified devices on the nexus bus? We'd really only have an issue when there's children of nexus that aren't specific devices and need to bid. Since there's no way to differentiate those from others (eg, no PNP info), such devices are already a programming error since what driver attaches to them will be a crap shoot.

sys/riscv/riscv/sbi.c
343

Hm you're right, the problem is only fi there are non-fixed class drivers. I think I still prefer NOWILDCARD here though as it does no harm and is in general the correct thing to do, even if you can get away with anything here.

343

*non-fixed class devices...

sys/riscv/riscv/sbi.c
343

Yea, we likely should have a BUS_PROBE_FIXED define for this case.
Since 0 isn't undeniably better, I'll remove my mild objection / aside.

mhorne added inline comments.
sys/riscv/riscv/sbi.c
326–339

In nexus_attach() we add a few children explicitly, e.g. timer0. I think adding sbi0 there would be preferable to the IDENTIFY method.

sys/riscv/riscv/sbi.c
326–339

sys/riscv is unusual in that regard; other architectures solely add ofwbus or acpi as appropriate, as far as I can tell (including arm64 wrt psci). So this is the more normal thing to do, and I'd like to see timer and rcons move over to identify too...

This revision now requires review to proceed.Jan 19 2024, 8:46 PM

Pull build fixes from later revision into this

This revision is now accepted and ready to land.Jan 22 2024, 4:10 PM