Page MenuHomeFreeBSD

Bring in the start of the arm64 kernel.
ClosedPublic

Authored by andrew on Apr 1 2015, 6:54 PM.
Tags
None
Referenced Files
F103271435: D2199.id4656.diff
Fri, Nov 22, 9:44 PM
F103264897: D2199.id.diff
Fri, Nov 22, 7:53 PM
F103255342: D2199.id4721.diff
Fri, Nov 22, 4:53 PM
F103199749: D2199.id4656.diff
Fri, Nov 22, 4:25 AM
Unknown Object (File)
Thu, Nov 21, 9:25 PM
Unknown Object (File)
Thu, Nov 21, 1:20 PM
Unknown Object (File)
Thu, Nov 21, 9:36 AM
Unknown Object (File)
Wed, Nov 20, 10:25 AM
Subscribers

Details

Summary

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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

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.

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.

sys/arm/arm/devmap.c
48 ↗(On Diff #4578)

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

sys/arm/arm/generic_timer.c
104 ↗(On Diff #4578)

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

sys/arm64/arm64/busdma_machdep.c
19 ↗(On Diff #4578)

fun times, eh?

sys/arm64/arm64/sys_machdep.c
56 ↗(On Diff #4578)

Should we return EOPNOTSUPP here?

sys/arm64/include/bus_dma.h
32 ↗(On Diff #4578)

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

sys/arm64/include/clock.h
31 ↗(On Diff #4578)

Ditto

sys/arm64/include/smp.h
31 ↗(On Diff #4578)

ditto on copyright.

sys/arm64/include/trap.h
31 ↗(On Diff #4578)

ditto

sys/conf/files.arm64
2–3 ↗(On Diff #4578)

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

sys/conf/options.arm64
1 ↗(On Diff #4578)

Why is this needed?

sys/dev/uart/uart_cpu_fdt.c
45 ↗(On Diff #4578)

Why only arm?

sys/arm64/arm64/in_cksum.c
1 ↗(On Diff #4578)

This one's on the list for de-duplication

sys/arm64/arm64/sys_machdep.c
2–3 ↗(On Diff #4578)

Probably a new copyright here

sys/arm64/include/bus_dma.h
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.

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

  1 arg@semihalf.com
  1 br@bsdpad.com
  1 cognet@FreeBSD.org
  1 imp@FreeBSD.org
  5 robin.randhawa@arm.com
 10 emaste@freebsd.org
 10 tn@semihalf.com
 13 mst@semihalf.com
 63 zbb@semihalf.com
106 andrew@fubar.geek.nz
165 andrew@FreeBSD.org

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.

sys/arm/arm/devmap.c
48 ↗(On Diff #4578)

Yes, for pmap_mapdev

sys/arm/arm/generic_timer.c
104 ↗(On Diff #4578)

Done

sys/arm64/arm64/busdma_machdep.c
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.

sys/conf/options.arm64
1 ↗(On Diff #4578)

So we can have "cpu ARM64" in GENERIC

sys/dev/uart/uart_cpu_fdt.c
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 edited edge metadata.

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

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

  • Probably commit sys/arm/arm/devmap.c separately
sys/arm64/arm64/autoconf.c
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)

sys/arm64/arm64/busdma_machdep.c
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."

sys/arm64/arm64/gic.c
1–8 ↗(On Diff #4656)

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

sys/arm64/arm64/pmap.c
2–15 ↗(On Diff #4656)

What is left from other archs?

sys/arm64/arm64/stack_machdep.c
2–3 ↗(On Diff #4656)

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

sys/arm64/arm64/sys_machdep.c
2–3 ↗(On Diff #4656)

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

sys/arm64/include/atomic.h
172 ↗(On Diff #4656)

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

sys/arm64/include/bus_dma.h
2–3 ↗(On Diff #4656)

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

sys/arm64/include/db_machdep.h
2–4 ↗(On Diff #4656)

this most likely does not apply; this is all new

sys/arm64/include/kdb.h
2–3 ↗(On Diff #4656)

this does not apply for new stub implementations

sys/arm64/include/param.h
120–121 ↗(On Diff #4656)

should this change go in now too?

sys/conf/Makefile.arm64
1–5 ↗(On Diff #4656)

previous (c) may not apply

23 ↗(On Diff #4656)

bogus?

26–27 ↗(On Diff #4656)

should @ go away?

sys/arm64/arm64/pmap.c
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.

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.

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.

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.

sys/arm/arm/devmap.c
2–3 ↗(On Diff #4656)

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

sys/arm64/arm64/pmap.c
21–22 ↗(On Diff #4721)

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

sys/arm64/arm64/bcopy.c
1–3 ↗(On Diff #4721)
sys/arm64/arm64/busdma_machdep.c
69 ↗(On Diff #4721)

No newline

sys/arm64/arm64/dump_machdep.c
2–3 ↗(On Diff #4721)

Stub implementation, should not have old (C)

sys/arm64/arm64/elf_machdep.c
2–5 ↗(On Diff #4721)

new stub impl

sys/arm64/arm64/elf_machdep.c
2–5 ↗(On Diff #4721)

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

Update based on comments, etc.

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

andrew updated this revision to Diff 4804.

Closed by commit rS281494 (authored by @andrew).