Page MenuHomeFreeBSD

Bring in the start of the arm64 kernel.

Authored by andrew on Apr 1 2015, 6:54 PM.



This is only the minimum set of files needed to boot in qemu. As such it is
missing a few things.

The bus_dma code is currently only stub functions with a full implementation from the development tree to follow.

The gic driver has been copied as the interrupt framework is different. It is expected the two drivers will be merged by the arm intrng project, however this will need to be imported into the tree and support for arm64 would need to be added.

This includes code developed by myself, SemiHalf, Ed Maste, and Robin Randhawa from ARM. This has been funded by the FreeBSD Foundation, with early development by myself in my spare time with assistance from Robin.

Test Plan

This boots to multi-user in qemu, however the userland changes are not fully
in svn so may need to be built from git.

Diff Detail

rS FreeBSD src repository
Lint Skipped
Unit Tests Skipped

Event Timeline

andrew updated this revision to Diff 4578.Apr 1 2015, 6:54 PM
andrew retitled this revision from to Bring in the arm64 kernel.
andrew updated this object.
andrew edited the test plan for this revision. (Show Details)
andrew added reviewers: ARM, emaste.
andrew added a comment.Apr 1 2015, 6:56 PM

I have created a copy of the gic driver as we have a slightly different KPI. I expect arm64 will use intrng when it's ready.

imp added inline comments.Apr 1 2015, 7:12 PM
48 ↗(On Diff #4578)

We're using arm/arm/devmap.c on aarch64?

104 ↗(On Diff #4578)

This set of changes (for get/set_el*) could be done separately. IT looks self contained. If you want.

19 ↗(On Diff #4578)

fun times, eh?

56 ↗(On Diff #4578)

Should we return EOPNOTSUPP here?

32 ↗(On Diff #4578)

It isn't clear that this qualifies for copyright protection...

31 ↗(On Diff #4578)


31 ↗(On Diff #4578)

ditto on copyright.

31 ↗(On Diff #4578)


2–3 ↗(On Diff #4578)

ah, interesting... surprised more isn't shared...

1 ↗(On Diff #4578)

Why is this needed?

45 ↗(On Diff #4578)

Why only arm?

emaste added inline comments.Apr 1 2015, 7:30 PM
1 ↗(On Diff #4578)

This one's on the list for de-duplication

2–3 ↗(On Diff #4578)

Probably a new copyright here

32 ↗(On Diff #4578)

Yeah - the x86 pass-through headers state

 * This file is in the public domain.
/* $FreeBSD$ */

but I'm not even sure I'd put that message in.

emaste edited edge metadata.Apr 1 2015, 8:26 PM

For reference, commits to sys/ in the arm64-dev git branch come from:


Some of the Semihalf work comes in with this merge (e.g. kernel debugger changes), although I expect they will commit the bulk of their ThunderX changes themselves in mid-April.

Still, when this goes into HEAD I think we ought to put a small reference to the development process in the commit message, along with a short acknowledgement of the contributors to the changes in the commit (which will be a subset of those above). Do you have an easy way to grab that?

I'd think something like

This change includes my work from the FreeBSD SVN projects/arm64 branch
in addition to work done by myself and others in the arm64-dev branch in
the FreeBSDFoundation/freebsd Github repository.

Most of this change is my work but I would like to acknowledge the
contributions of:

which might be adjusted over time of course if we split pieces out into individual commits. You may want to reference that you did the initial work (in the SVN arm64 branch) as a volunteer, too - up to you.

andrew added inline comments.Apr 4 2015, 10:10 AM
48 ↗(On Diff #4578)

Yes, for pmap_mapdev

104 ↗(On Diff #4578)


19 ↗(On Diff #4578)

This will come in in a future review. We don't call them in qemu so I'm holding off importing them.

1 ↗(On Diff #4578)

So we can have "cpu ARM64" in GENERIC

45 ↗(On Diff #4578)

Nathan thinks the file shouldn't exist. It looks like it was only needed for fdtbus_bs_tag. It also exists on mips, so I'll change it to !aarch64.

andrew updated this revision to Diff 4654.Apr 4 2015, 11:09 AM
andrew edited edge metadata.

Various updates based on review, and things I've found.

andrew updated this revision to Diff 4656.Apr 4 2015, 11:31 AM

Fix the uart driver, check we will return from signals with the correct cpsr state

emaste added a comment.Apr 6 2015, 2:22 PM
  • Probably commit sys/arm/arm/devmap.c separately
2–6 ↗(On Diff #4656)

does this apply still?

59–68 ↗(On Diff #4656)

are all these headers needed?

103 ↗(On Diff #4578)

EOL whitespace (here and many spots)

18–19 ↗(On Diff #4656)

mention these in the commit message, something like "implementation for stub functions are in progress on the development branch and will follow in a future merge."

1–8 ↗(On Diff #4656)

also be sure to make a reference to the reason we have a (temporary) copy of gic for arm64

2–15 ↗(On Diff #4656)

What is left from other archs?

2–3 ↗(On Diff #4656)

this (c) doesn't apply for the current stub implementation

2–3 ↗(On Diff #4656)

old (c) doesn't apply for this new stub implementation

172 ↗(On Diff #4656)

should probably commit these atomic.h changes independently, any time now

2–3 ↗(On Diff #4656)

this trivial pass-through implementation should probably not have a (c) statement

2–4 ↗(On Diff #4656)

this most likely does not apply; this is all new

2–3 ↗(On Diff #4656)

this does not apply for new stub implementations

120–121 ↗(On Diff #4656)

should this change go in now too?

1–5 ↗(On Diff #4656)

previous (c) may not apply

23 ↗(On Diff #4656)


26–27 ↗(On Diff #4656)

should @ go away?

andrew added inline comments.Apr 7 2015, 1:23 PM
2–15 ↗(On Diff #4656)

Quite a lot. Most of my changes are due to the differences in pagetable format, the logic is still similar.

andrew updated this revision to Diff 4721.Apr 7 2015, 3:49 PM

Update based on feedback. Split out the devmap change to D2249.

andrew retitled this revision from Bring in the arm64 kernel to Bring in the start of the arm64 kernel..Apr 7 2015, 4:15 PM
andrew updated this object.

I've updated the proposed commit message, feel free to suggest changes.

emaste added a comment.Apr 7 2015, 8:24 PM
In D2199#17, @andrew wrote:

I've updated the proposed commit message, feel free to suggest changes.

Proposed message looks fine, note though that Semihalf doesn't use camel case.

emaste added a comment.Apr 7 2015, 9:16 PM

Seems reasonable to me to bring this to HEAD in this state. @imp any other comments? I think inadvertently copied copyright statements are now cleaned up other than perhaps Makefile.arm64.

2–3 ↗(On Diff #4656)

ignore this file now, moved to other review and that confused Phabricator

21–22 ↗(On Diff #4721)

If applied to existing code should be the "Portions of" text.

emaste added inline comments.Apr 13 2015, 1:43 PM
1–3 ↗(On Diff #4721)
69 ↗(On Diff #4721)

No newline

2–3 ↗(On Diff #4721)

Stub implementation, should not have old (C)

2–5 ↗(On Diff #4721)

new stub impl

andrew added inline comments.Apr 13 2015, 2:04 PM
2–5 ↗(On Diff #4721)

This is from sys/sparc64/sparc64/elf_machdep.c, with the relocation code removed.

andrew updated this revision to Diff 4802.Apr 13 2015, 2:15 PM

Update based on comments, etc.

andrew updated this revision to Diff 4803.Apr 13 2015, 2:19 PM

Fix a duplicate license, and add myself and the FreeBSD Foundation to
elf_machdep.c, it is copied from the sparc64 version.

andrew closed this revision.Apr 13 2015, 2:43 PM
andrew updated this revision to Diff 4804.

Closed by commit rS281494 (authored by @andrew).