Page MenuHomeFreeBSD

Modules support for arm64
ClosedPublic

Authored by kib on Oct 4 2015, 11:33 AM.
Tags
Referenced Files
Unknown Object (File)
Sat, Jun 8, 7:34 PM
Unknown Object (File)
May 26 2024, 4:58 PM
Unknown Object (File)
May 14 2024, 6:31 PM
Unknown Object (File)
May 2 2024, 12:43 AM
Unknown Object (File)
May 2 2024, 12:42 AM
Unknown Object (File)
May 2 2024, 12:42 AM
Unknown Object (File)
May 2 2024, 12:42 AM
Unknown Object (File)
May 2 2024, 12:42 AM
Subscribers

Details

Summary

I have to use shared objects format for modules, instead of relocatable objects, due to limitations in the addressing.

The bug in 2.25.1 binutils requires the hack to avoid ld -r, which eg makes ctfmerge non-functional. I verified that git head for binutils has the issue fixed, but I did not digged exact change that did it.

It seems that the architecture requires -fPIC for shared objects, linker was not able to link modules built without -fPIC.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kib retitled this revision from to Modules support for arm64.
kib updated this object.
kib edited the test plan for this revision. (Show Details)
kib added reviewers: andrew, emaste.
kib set the repository for this revision to rS FreeBSD src repository - subversion.
kib added a project: arm64.
sys/arm64/arm64/elf_machdep.c
190–191

Used

207

Used

sys/arm64/arm64/trap.c
278 ↗(On Diff #9126)

This appears to be unrelated (but useful, just commit)

sys/dev/sym/sym_hipd.c
140

Could this be a dmb(ish)?

kib marked 3 inline comments as done.Oct 4 2015, 12:58 PM
kib added inline comments.
sys/dev/sym/sym_hipd.c
140

I think this driver should be disabled for anything but i386. I have no opinion about ish/sy, in fact, I think that either one is wrong.

kib removed rS FreeBSD src repository - subversion as the repository for this revision.

Remove __unused; some editing to the ld comment. Committed the trap.c assert change.

kib set the repository for this revision to rS FreeBSD src repository - subversion.

Full context, by emaste request.

BTW, after the agreement to use shared objects as the module format is reached, it may be easier to expedite this in two stages. First, elf_machdep.c changes are really straightforward. Then, the sys/conf changes (or hacks, if you so inclined) can be shaped.

sys/arm64/arm64/elf_machdep.c
161

ugh, seems we do this on other archs too. should just return -1 instead?

sys/conf/kern.post.mk
215

Sigh, I wish we didn't need this. But I don't think there's a better way.

sys/conf/kmod.mk
132–135

I think we ought to keep these md parts in (mostly) alpha order

192

We ought to see if this fix made it back to the 2.25 branch and try to get it merged back if not so that we can pick it up with the next binutils port update.

sys/dev/sym/sym_hipd.c
140

Agreed, this has no value on arm64.

sys/modules/Makefile
483

this one could stay in alpha order

BTW, after the agreement to use shared objects as the module format is reached, it may be easier to expedite this in two stages. First, elf_machdep.c changes are really straightforward. Then, the sys/conf changes (or hacks, if you so inclined) can be shaped.

Sounds good to me.

kib marked 2 inline comments as done.Oct 5 2015, 7:19 AM
kib added inline comments.
sys/arm64/arm64/elf_machdep.c
161

The presence of unknown relocation type practically means that the loaded file is corrupted. There are very high chances that we already applied some relocations, and that relocations can modify arbitrary kernel memory.

Since we detected a blob, which is not of the expected content, and which already polluted kernel address space, I think that the panic is the best reaction.

sys/conf/kern.post.mk
215

This is a consequence of calling the $MACHINE arm64 instead of aarch64. It was a reasonable thing to distinguish between powerpc and powerpc64, but it is not clear that having three names aarch64/armv8/arm64, all of them ortohonal, would serve us usefully in future.

sys/conf/kmod.mk
192

Wouldn't it is wiser to wait for 2.26 and then remove the hack ?

kib edited edge metadata.

Reorder some Makefile hacks.

Also, I added ff copyright for year 2015. Please review the existing copyright holders in the elf_machdep.c. I believe that only Andrew and FF are correct, everything else is copy/paste mistake.

sys/conf/kmod.mk
192

As long as it's going to be arriving in time that makes sense.

In D3796#78662, @kib wrote:

Reorder some Makefile hacks.

Also, I added ff copyright for year 2015. Please review the existing copyright holders in the elf_machdep.c. I believe that only Andrew and FF are correct, everything else is copy/paste mistake.

Yes, it looks like you are correct, this is new work.

andrew edited edge metadata.

I've tested on a HiKey board by both loading modules from loader, and with kldload.

sys/arm64/arm64/elf_machdep.c
213

Why is this needed?

This revision is now accepted and ready to land.Oct 8 2015, 12:32 PM
emaste edited edge metadata.
This revision was automatically updated to reflect the committed changes.

Partial commit was done; more to come.

This revision is now accepted and ready to land.Oct 8 2015, 5:02 PM
This revision was automatically updated to reflect the committed changes.