Commit Graph

4656 Commits

Author SHA1 Message Date
Gerwin Klein 4262144dfd aarch64 haskell: implement isValidVTableRoot
The C code has an unnecessary name indirection via isValidNativeRoot
here, which I replicated to make more obvious what maps to what.
Eventually this should disappear.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein 33f060e249 aarch64 haskell: implement lookupFrame
This is a bit speculative since the C is not there yet, but I think
it's a good candidate, esp turning the VMPageSize parameters into Int,
because that will save the C from converting it back and forth.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Rafal Kolanski 06acbdb742 aarch64 haskell: validate Interrupt and TCB
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein 900612734a aarch64 haskell: decodeVSpaceRootInvocation
Uses lookupFrame which still needs to be filled in. We already have
a form of that in the formalisation, and can maybe reuse some of that.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein 4c7294452b aarch64 haskell: flush API, including perform
Still missing decodeInvocation, but should otherwise be complete,
including machine ops.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein 2215c411a1 aarch64 haskell: deleting ASIDs and ASIDPools
This adds first AArch64-specific flushing. More to come when we add
the explicit flush API.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein 3f4428edfa aarch64 haskell: VM faults
Preliminary, depending on how addressTranslateS1 ends up in C.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Rafal Kolanski e5df18102f aarch64 machine: add preliminary Platform.thy
Very early version, with C changes still in progress.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein 4b56c08d3c haskell aarch64: validated Object/Instances
All definitions fine, the commit only removes the FIXME.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein c9d224d79a aarch64 haskell: fill in updateASIDPoolEntry
This refactors getASIDPoolEntry to extract code that is shared between
lookup and update, and should make conversion to reader monad later
easier.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein b1370585fe github: provide auth token for gitlint check
Missed one in c4fe1abb3d

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Rafal Kolanski 92745f3e5b aarch64 haskell: simplify checkIRQ
We are on an Arm board, where <= maxIRQ implies != irqInvalid, so use
original ARM version.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein 103d7cfa12 aarch64 haskell: adjust PT lookup code
This adjusts ptBitsLeft and ptIndex to properly take into account
the potentially different-sized top-level table. This is all that is
needed for the rest of the lookup code to be correct.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein f47a798ba9 aarch64 haskell: adjust API Object types
This is a sketch of what I think the API will look like after C code
changes. In particular, this adds a VSpaceRoot API object type
that stands for a top-level page table. The name may change, but a
different API object type for the different page size will probably
stay.

Different top-level table size only applies in some configurations. The
spec attempts to model both cases by making ptBits and
ptTranslationBits dependent on whether it is a top-level table or not.
The rest follows from that.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein 74573d88f7 aarch64 haskell: adjust API maxBound
The VCPUObject is the last in the enum, so should be set as maxBound.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein 9d851c13bf aarch64 haskell: validate Structures
Validated constants defined in Structures/AARCH64.lhs

PT caps now include a flag whether they are for a top-level table or
not. This could later be generalised to a level, but that's likely not
necessary for AArch64.

Amazingly, only the creation of new PT caps was affected by this
change. That creation will need user-level input which size of table to
create (to be added later).

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Rafal Kolanski 05c5140150 aarch64 haskell: RegisterSet definitions
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Rafal Kolanski 11ce90f8cc aarch64 haskell: some RISCV->ARM renames
Previously renamed invocation labels, as well as decodeARMMMUInvocation
and performARMMMUInvocation.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Rafal Kolanski d85201d2f1 aarch64 haskell: add Arm memory barriers
Copied from ARM_HYP.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Rafal Kolanski e3f6caee72 aarch64 haskell: add VCPU/HYP infrastucture
Largely adapted from ARM_HYP, modified and checked against C code.
Remaining known issues marked with FIXMEs.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein 0b023a4fc1 aarch64 github: provide repo token and cache
The repo token allows the action to work on a private repo, and
the S3 cache bucket name allows it to charge a different org.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein d98d3ea703 github: enable standard checks on aarch64 branch
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein 98f0338877 aarch64 haskell: global kernel data
Model AARCH64-specific global kernel data, which means:

- adjust vspace region mapping names
- remove global page tables, including accesses (copyGlobalMappings)
- add pointer to empty user page table

This commit does not yet include VCPU and SMMU.

As on 32-bit ARM_HYP, global page tables exist on AARCH64, but are not
accessed by any code after boot, so are not visible in verified code
apart from defining the (constant) kernel window and kernel mappings
during execution. User code without a valid VSpace root is assigned a
pointer to an empty table.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein c3a2f39762 aarch64 haskell: global state component naming
Set the naming convention for global state components to armKS..
This overlaps with ARM and ARM_HYP, but so do the concepts as well
as the C convention.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein aada0b9166 aarch64 haskell: first sketch of C asid_map
This commit adds hardware ASID handling from ARM/ARM_HYP, and tweaks it
to use local ASID pool entries for hardware ASIDs instead of a global
ASID map.

Naming here is unfortunate in multiple dimensions:
 - C calls the entries asid_map (from the global function in Haskell)
 - what is actually mapped is a seL4 ASID to a HW ASID + VSpace root,
   but only via multiple functions, the type is not a map
 - the HW ASIDS are not actual ASIDs, but instead VMIDs in AArch64 EL-2

To be cleaned up when nomenclature is clearer in C.

Validation against C is minimal at the moment; only the types are
validated to correspond with C, and which functions are present, but
not their full behaviour/structure yet.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein 6418bda962 aarch64/riscv/x64: remove findVSpaceForASIDAssert
findVSpaceForASIDAssert is needed for modeling the hardware ASID lookup
on ARM. None of AARCH64, RISCV64, X64 use that mechanism and the
function is unused. There are some proof about it, but those are unused
as well. This commit removes all of these.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Rafal Kolanski b7cfc4c323 aarch64 haskell: add simplified FPU
Adds FPU state to UserContext, uses 64 general-purpose registers as seen
on TX2.
Abstracts FPU operations to fpuThreadDelete required for thread
deletion, thereby not including intricacies of lazy FPU switching.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein fcdbbf5bad aarch64 run_tests: add test setup for AARCH64
This adds the AARCH64 L4V_ARCH and adds a long initial test exclusion
list that will be reduced as verification proceeds.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein c3900ced40 github: add AARCH64 to build matrix
This commit will only come into full effect when it is merged into
master, which is also the time AARCH64 tests should run regularly
in the main repository.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein 8aefcddb37 github: separate workflow file for AARCH64
This is a separate workflow instead of being added to `proof.yml` so
that it can be switched on/off separately.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Rafal Kolanski f0e4fbf112 aarch64 haskell: initialise from RISCV64 files
Use RISCV64 version of Haskell spec as a basis for upcoming work on
spec for AARCH64 architecture.

Only minimal RISCV64 to AARCH64 substitution done to yield a compiling
target, with a big FIXME stuck on top to remind people this got no human
oversight.

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Rafal Kolanski f48b2041f9 aarch64 haskell: add TX2 hardware config
Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Rafal Kolanski 745a94910b haskell: add build configuration for AARCH64 on TX2 platform
Setup.hs + SEL4.cabal + Makefile

Signed-off-by: Rafal Kolanski <rafal.kolanski@proofcraft.systems>
2022-04-20 09:16:19 +10:00
Gerwin Klein 954b42cdd9 refine: speed up CSpace1_R+CSpace_R proofs
Three main thrusts:
  - speed up the `updateMDB_the_lot` chain by using more targeted
    proof methods
  - drastically reduce goal size by removing unused assumptions when
    that becomes possible (this is the largest overall speed win)
  - use `subgoal` to unblock interactive proof progress

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-19 15:27:44 +10:00
Corey Lewis 0aaeb868ce ainvs: remove unused preconditions
Signed-off-by: Corey Lewis <corey.lewis@unsw.edu.au>
2022-04-13 13:44:45 +10:00
Gerwin Klein 2a1fc75e6f regression: tool for comparing session times
This adds a small script that parses two run_tests logs for session
times and compares them.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-13 13:35:24 +10:00
Corey Lewis 93f04fa675 docs: proof style for unfolding definitions
Signed-off-by: Corey Lewis <corey.lewis@unsw.edu.au>
2022-04-12 14:36:09 +10:00
Corey Lewis 86445726a3 docs: consistent indentation
Signed-off-by: Corey Lewis <corey.lewis@unsw.edu.au>
2022-04-12 14:36:09 +10:00
Gerwin Klein 3a0667c1f8 proof: add missing Makefile dependencies
Both AInvs and the refinement chain need the generated files necessary
for ASpec and ExecSpec. We could depend on ASpec directly, but that
would mess with Isabelle being able to schedule sessions as it wants
them.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-08 10:59:21 +10:00
Gerwin Klein 82434f0d62 trivial: fix typo
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-04-08 10:59:05 +10:00
Matthew Brecknell d62eb31f9d ci binary: wait for artifacts
The previous version of the `binary` workflow assumed that its input
artifacts would be available for download before a `binary` workflow run
is started. However, the `binary` workflow typically wants to download
those artifacts from the same workflow run that triggered the `binary`
run via `repository_dispatch`.

It appears that GitHub Actions does not make artifacts available for
download from a workflow until *after* the relevant job has finished.
Hence, there's a race between the `binary` workflow and the workflow
that triggered it. We resolve this by making the `binary` workflow retry
its artifact download for up to 10 minutes.

Signed-off-by: Matthew Brecknell <matt@kry10.com>
2022-04-01 19:17:37 +11:00
Matthew Brecknell 2a173ba189 ci binary: download artifacts from correct repo
The previous version was erroneously downloading artifacts from the repo
in which the `binary` workflow was triggered, when it should have been
downloading from the repo identified by the payload of the trigger.

Signed-off-by: Matthew Brecknell <matt@kry10.com>
2022-04-01 19:17:37 +11:00
Gerwin Klein bf432bb631 github: changed AutoCorresSEL4 default
ci-actions/aws-proofs no longer excludes the AutoCorresSEL4 session by
default, so we no longer need to provide a fake argument to the session
parameter to not exclude it.

This is significant, because we now want the default to be non-verbose
since we're running multiple sessions in parallel.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-30 10:27:25 +11:00
Gerwin Klein 7535796778 crefine: remove useless comments
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 4bb5899359 word_lib: move in lemma from l4v
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 2d930d69db word_lib: fix non-terminal `auto` violations
Not acceptable in either AFP or l4v.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 896434499e word_lib: fix license headers
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein c953ab0396 word_lib/proofs: bundle word simp set changes
Add a bundle for global word simp set changes -- unfortunately we
can't actually do this globally, because they are mostly simp rule
removals which will be overwritten by theory merges. So this new
l4v_word_lib bundle will have to be activated/unbundled multiple times.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein 65fbeb5b01 isabelle2021-1 word_lib: add lemmas from l4v
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00
Gerwin Klein b29a3433ef isabelle2021-1: remove no_take_bit
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2022-03-29 08:38:25 +11:00