Skip to content

Commit

Permalink
contrib: initial code commit
Browse files Browse the repository at this point in the history
Initial contribution of code to the Gunyah Hypervisor project!

Signed-off-by: Carl van Schaik <quic_cvanscha@quicinc.com>
  • Loading branch information
quic-cvanscha committed Apr 16, 2021
0 parents commit 7ecf251
Showing 655 changed files with 66,376 additions and 0 deletions.
140 changes: 140 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# Gunyah Coding Style - requires Clang Format >= 9
#
# For more information, see:
#
# https://clang.llvm.org/docs/ClangFormat.html
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
---
Language: Cpp
AccessModifierOffset: -8
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: true
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortLambdasOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: All
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeComma
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ FIXME:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros: ['list_foreach', 'list_foreach_container',
'list_foreach_container_maydelete', 'list_foreach_container_consume',
'vpm_vcpus_state_foreach']
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<(hyptypes|assert|limits|string|std.*)\.h>$'
Priority: -100
- Regex: '^<(hyp[a-z].*|result)\.h>$'
Priority: -90
- Regex: '^<asm/'
Priority: -50
- Regex: '^<asm-generic/'
Priority: -25
- Regex: '^<events/'
Priority: -60
- Regex: '^<'
Priority: -75
- Regex: '^"common\.h"$'
Priority: -10
- Regex: '^"'
Priority: -1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentWidth: 8
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: '^BITMAP_(ATOMIC_)?FOREACH_(SET|CLEAR)_BEGIN$'
MacroBlockEnd: '^BITMAP_(ATOMIC_)?FOREACH_(SET|CLEAR)_END$'
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 10
PenaltyBreakBeforeFirstCallParameter: 30
PenaltyBreakComment: 10
PenaltyBreakFirstLessLess: 0
PenaltyBreakString: 10
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 100
PenaltyReturnTypeOnItsOwnLine: 0
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: false
SpaceInEmptyBlock: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp03
StatementMacros: []
TabWidth: 8
UseTab: Always
...
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Ignore build products
/build.ninja
/.ninja_deps
/.ninja_log
/.sconsign.dblite
/build*/

# Ignore Python precompiled bitcode
*.pyc

# Ignore local editor configurations
/compile_commands.json
/.syntastic_*
/.dir-locals.el
/cscope*

# Ignore cppcheck dumps
*.c.dump

# Ignore Vim temporary files
.*.sw[a-p]
.*.un~
9 changes: 9 additions & 0 deletions .gitlab-ci-build-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

# Ensure this script aborts on errors
set -ex

pip install -r $CI_PROJECT_DIR/tools/requirements.txt

# Clear any stale builds
rm -rf build
12 changes: 12 additions & 0 deletions .gitlab-ci-run-sa.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

# Ensure this script aborts on errors
set -ex

scons all=1 enable_sa=1 build/$1/$2/sa-html -j4

set +x
mkdir sa-results
find build -type f -name '*.html' | xargs -n 1 -I HTML cp HTML sa-results/
# Fail if any results were generated
if [ -n "$(ls -A sa-results/)" ]; then echo "SA Failed"; exit 1; else echo "SA Passed"; fi
90 changes: 90 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
image: python3:latest

# Default environment variables
variables:
# Change pip's cache directory to be inside the project directory since we
# can only cache local items.
PIP_CACHE_DIR: "$CI_PROJECT_ID/.cache/.pip"
SCAN_DIR: "../.scan"
# Always use a fresh clone so submodule doesn't break.
GIT_STRATEGY: clone

stages:
- check
- build

cache:
paths:
- .cache/.pip
- gunyah-venv/

before_script:
- python3 -m venv gunyah-venv
- source gunyah-venv/bin/activate

code-style:
stage: check
tags:
- gunyah
only:
- merge_requests
script:
- pip install flake8
- pip install autopep8
- git ls-files -- '*.py' | xargs autopep8 -i
- git ls-files -- '*.py' | xargs flake8
- git ls-files -- '*.[ch]' | xargs $LLVM/bin/clang-format --style=file -i
- git ls-files -- '*.tc' '*.ev' '*.hvc' | xargs sed -i 's/ /\t/g'
- git ls-files -- '*.tc' '*.ev' '*.hvc' | xargs sed -i 's/\t /\t/g'
- git ls-files -- '*.[chS]' '*.tc' '*.ev' '*.hvc' | xargs sed -i 's/ \t/\t/g'
- git diff --exit-code

git-checks:
stage: check
tags:
- gunyah
only:
- merge_requests
script:
- if ! git ls-files --error-unmatch hyp/core/boot/include/version.h; then echo "version.h not present"; else echo "version.h should not be committed!"; exit 1; fi
- git diff --check origin/master HEAD

branch-up-to-date:
stage: check
tags:
- gunyah
only:
- merge_requests
allow_failure: true
script:
- COMMITS=`git cherry -v HEAD origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME`
- echo $COMMITS
- if [[ "$COMMITS" ]]; then false; else true; fi

build-gunyah-rm:
stage: build
tags:
- gunyah
only:
- merge_requests
script:
- ./.gitlab-ci-build-setup.sh
- scons featureset=gunyah-rm-qemu all=1 -j4

sa-production:
stage: build
tags:
- gunyah
# Do not set allow_failure to true, unless agreed that new failure cannot be
# immediately addressed and merge is necessary regardless.
allow_failure: false
only:
- merge_requests
script:
- ./.gitlab-ci-build-setup.sh
- ./.gitlab-ci-run-sa.sh qemu/gunyah-rm-qemu production
artifacts:
when: on_failure
expire_in: 3 days
paths:
- sa-results/*.html
9 changes: 9 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Qualcomm Innovation Center, Inc.

# The original Gunyah Hypervisor development team:
# - Ali Pouladi
# - Binglin Chen
# - Carl van Schaik
# - Jack Suann
# - Philip Derrin
# - Stephany Gamiz Perez
41 changes: 41 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Changelog

All notable changes to this project will be documented in this file.

## Open Issues

### 1. Secondary VM support

The Resource Manager being the root-VM, manages creation of the Primary VM
(HLOS) and controls the rights to create additional VMs. In the Gunyah Resource
Manager design, VM management services are provided by the Resource Manager
(although it is technically possible for these rights to be delegated to other
VMs).

The current Resource Manager does not support Secondary VM loading. Support
will be added in a subsequent contribution.

### 2. Virtio support

Virtio support is under development and should be contributed along with secondary VM support.

## Unreleased

Unreleased changes in the `develop` branch may be added here.

## Releases

Individual releases are tagged, and the latest release will be available in the `main` branch.

* No releases have been made at this time.

## Contributions

Significant contributions are listed here.

### Initial Opensource Contribution

This is the initial contribution of source code to the Gunyah Hypervisor.

* Support for QEMU AArch64 Simulator
* Support unmodified Linux Primary VM kernel
Loading

0 comments on commit 7ecf251

Please sign in to comment.