Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hfo2 update: take 1 #72

Merged
merged 37 commits into from
Feb 3, 2020
Merged

Hfo2 update: take 1 #72

merged 37 commits into from
Feb 3, 2020

Conversation

efenniht
Copy link
Collaborator

-O- 34개의 커밋을 리베이스하는 데 이틀이 넘게 걸리네요...

David Brazdil and others added 30 commits January 22, 2020 16:56
Adds 'build/docker/Dockerfile' which describes the base container image of
Hafnium compilation environment. This image is built and uploaded to GCP
where users download it from. The feature is always enabled for Kokoro
and can optionally be enabled for local builds too. Once rootless
containers are easier to set up, we might make it the default for local
builds too.

An arbitrary command can be executed inside the container with
'build/run_in_container.sh [-i] <command> ...'. This is done
automatically inside 'Makefile' and 'kokoro/ubuntu/build.sh' which
detect whether they are already running inside the container and respawn
themselves using 'run_in_container.sh' if not.

The feature is guarded with HAFNIUM_HERMETIC_BUILD environment variable,
switched on if the value is "true". All other values switch it off, e.g.
'run_in_container.sh' sets it to 'inside' to avoid recursion.

Bug: 132428451
Test: HAFNIUM_HERMETIC_BUILD=<value> make
Test: HAFNIUM_HERMETIC_BUILD=<value> kokoro/ubuntu/build.sh
Change-Id: I0737a868ab4f67c0fdbf78fa8a97cc91714d2e10
Linux tree did not use to specify any sources and would therefore never
be rebuilt after first build. Add a script which generates a depfile for
the tree and use it for a target that linux targets depend on.

Test: make ; touch third_party/linux/README; make (should recompile); \
      make (should not recompile)
Change-Id: Id0a06be73de2ed31c52f1697ac00f7d45425b43b
Bug: 115484857, 132429213
Change-Id: I7ae3fd6c24ca8b42f581d9d4417fc6c49b23b43d
Change-Id: I7ce6e1c5f540c9a619c70949fb99606c89fbabe9
smc wrapper function accepts all arguments and returns all four result
registers.

Bug: 132421503
Change-Id: If3030df8ffe77f26a89d73959d9e05c3bd269c05
AArch64 requires stack pointer alignment of two X (8 byte) registers.

Bug: 132421503
Change-Id: Ib93bd47a49286ec9646bfd1f0456c8765fa64aca
This is the first stage of creating an SMC forwarding path based on
the manifest.

Currently none of the SMCs are forwarded, which maintains existing behavior.

Bug: 132421503
Change-Id: I1c3257b83346d47ff1e71db3898b9b85be14a043
When the emulator crashes/times out, instead of generating a json output, hftest
crashes when a json parsing exception is thrown.  This patch handles the
exception and tries to print the error it encountered instead.

Change-Id: Ice353e6a53c64ecc2cfdc8045cbde0a1fed2077d
Change-Id: Ib337ebdebee9cb917029c464f292f1b4cbf11cba
Change-Id: Ibc270de8cd6d8535e20847098175d8a00c67abe9
Change-Id: I3e2e262966a0584a43a86a49570d0d3db7cff09f
The `initrd` GN template currently supports two different ways of
specifying a primary VM image - name of a target or a path to a prebuilt
image. These use different target properties (as GN has no mechanism of
classifying a string as either a target or a path).

Simplify this in anticipation of using different Linux targets for
different HW boards in platform args by creating a target for each
prebuilt image. The `linux_kernel` template accepts a `prebuilt` path
and creates a "${target_name}__prebuilt" target which copies the image
into the out folder. As a side effect, this more closely ties the image
to the source code in the GN file.

Change-Id: I2afa295e666581393e9a80c311d7d8fe56d4fbba
The SMCCC reserves VM ID 0 for the hypervisor itself, therefore, other VM IDs
should start after that (at least, but not necessarily at 1).

- Generate VM IDs with an offset defined by HF_VM_ID_OFFSET (currently 1)
- Fix hardcoded IDs and other code that assumes VM IDs start at 0.

Bug: 132421503
Change-Id: I47cff8734ac153dcb1a1a435285153d6caf2877e
Change-Id: I29063eb7a0ef66f9093740c158cff15512ed15d2
Change-Id: I73e9ce0ff5e4de92f4a86ce78bb49fd6a7f7bda5
In order to move towards builds which only use resources in the Hafnium
repo, this patch adds a script which runs the build with strace and
dumps all files touched in the process. Files in the Hafnium directory
and in /tmp are automatically filtered out.

Bug: 132428451
Test: ./build/strace_open.sh opened_files.txt
Change-Id: I03a2df4eedf40c456b65920ec8bf98ad08e747c6
Previously the build used the GN copy() target to copy the source
of a to-be-built kernel module into the output directory. However,
the target does not support preserving subfolder structure. Replace
it with a Python script.

A new 'source_dir_copy' template is added, which creates a dependency
on the files in the source directory using the 'source_dir' target.
Then it copies the files into 'target_out_dir'. When the source
directory changes, the copying Python script is invoked again, updating
the copy in the out folder.

Change-Id: I23f2807fbb77bcf6d933e9541f5dbf1f2429b410
Add a Linux module unit test that covers more cases than the basic load/unload.
This test create a secondary VM, and using the socket interface sends a message
and received the same payload as a response.

Bug: 138977432
Change-Id: Ibbc313c1a788924b2f227a28bf0ecd3bf21304a1
Bug: 138977432
Change-Id: Ib3a826b4ea64b42cc229b81cd956f5ecb775d589
Use macros instead of function calls to not rely on LTO inlining.
Make macros take the op-kind argument to generalize.

Test: ./kokoro/ubuntu/build.sh
Change-Id: I8a5553d47cf3a0965fbf35d93c3c925f5f02ac4e
Also add comments explaining why individual barriers are needed.

Change-Id: I2510ca56682129ffd754e09074e25c478b490c56
Revisions of the ISA prior to ARMv8.4 do not support invalidation of
a range of addresses, only looping per page or invalidating all. Hafnium
currently only supports the former, this patch adds the latter for
performance reasons.

Change-Id: I2d07c66eaea0dabfdec1b63673103c1f43866784
VM API tests are failing on real hardware because VMs are not seeing
data written by the hypervisor. The reason for this is that Hafnium has
data caching enabled while the test VMs do not. Solve this discrepancy
by enabling data caching in the VMs too, which requires enabling stage-1
MMU translation.

The entire address space is identity-mapped with read-write-execute
permisssions. Only GIC tests currently require custom device mappings.

Implementation shares ptable management code from src/mm.c and
src/arch/mm.c.

Bug: 138985026
Test: ./kokoro/ubuntu/build.sh
Change-Id: Ib9f599c448d70296a6ca869ddbb51abfcc55148d
Change-Id: I6e61d3a7e1cdf64f18119e946758923cec9764fb
The configuration is static so it doesn't matter where it is originally
calculated. There were previously multiple paths for enablement, one
being implicit in initialization, so this splits them apart.

Bug: 139269163
Change-Id: Ic82c351b6e84b7d46e79f5886b39d07e53e6fde6
Change-Id: I891911bcd9087f584aed086f37b1aadf40673ce5
Monitor Debug Configuration Register (EL2) configures performance monitor
extensions, which include debug as well as performance registers.  Trapping
on certain accesses to these registers will likely vary between VMs.

Make the code for saving/restoring register state when handling exceptions more
flexible.  ldp/stp indices must be in the range [-512, 504].  Use post-index
addressing to keep the base index register up to date.

Bug: 132422368

Change-Id: I5d095b19d8753f2a23b3b089f62a69041314ca08
The CPU should get the corresponding entry from the callstacks for
easier understanding. In particular, the boot CPU must get the 0th
callstack since it has already been using that stack since boot.

Change-Id: I435f5f9580baecae4be233507b72faa4da00d78f
The file now contains aarch64 assembly and should not be in the
architecture-agnostic folder.

Change-Id: I4c5c7d98ffe75d95ee35fc360c025a8c68c10cb3
Change-Id: Ic71d89c3b7a8acec71ac593228219e4044e58664
AndrewScull and others added 4 commits January 28, 2020 23:48
Change-Id: I042384bbd33bcda3a8bde86f6af2beff23ce2d1a
These are first steps towards a new manifest format. A new "device_tree"
build target is introduced to compile DTS files to DTB, and
`generate_initrd.py` now does not produce a "vms.txt" file. Instead
"initrd" targets are expected to provide a path to a DTS manifest in the
format:

    /dts-v1/;

    / {
      hypervisor {
        vm1 {
	  debug_name = "primary";
	};

	vm2 {
	  debug_name = "secondary1";
	  kernel_filename = "filename";
	  vcpu_count = <N>;
          mem_size = <M>;
	};

	...
      };
    };

The information provided in the manifest matches "vms.txt".

Bug: 117551352
Test: manifest_test.cc
Test: used by hftest
Change-Id: I6b70bd44d2b110c4f7a6b971018c834084b6d8c4
Bug: 132960440
Change-Id: I3e81ee7bc138f1c2fb411ec6b429b41b9ff630e5
Small refactor replacing the pattern of verifying inputs in
safe equivalents of stdlib functions with a CHECK-like macro
which adheres to the C11 semantics of filling the destination
buffer when a constraint is not satisfied at runtime.

Semantic changes:

memcpy_s: More permissive memory ranges. Used to check that source does
not overlap with the entire destination buffer, when only the first
`count` bytes matter.

memcpy_s: Used to allow `dest==src`. Safe under our implementation in
aarch64 but not allowed under C11.

strlen_s: Should return 'strsz' if NULL character not found.

Change-Id: If483a97e6ee1c64c7f2afed9a0af1d3087da7002
@efenniht efenniht self-assigned this Jan 29, 2020
Copy link
Member

@jeehoonkang jeehoonkang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

질문 드립니다!

build/docker/Dockerfile Show resolved Hide resolved
build/image/dtc.py Show resolved Hide resolved
hfo2/src/cpio.rs Show resolved Hide resolved
hfo2/src/cpu.rs Show resolved Hide resolved
hfo2/src/fdt_handler.rs Outdated Show resolved Hide resolved
hfo2/src/manifest.rs Outdated Show resolved Hide resolved
hfo2/src/manifest.rs Outdated Show resolved Hide resolved
hfo2/src/manifest.rs Outdated Show resolved Hide resolved
hfo2/src/panic.rs Outdated Show resolved Hide resolved
hfo2/src/std.rs Show resolved Hide resolved
efenniht added a commit to efenniht/hafnium-verification that referenced this pull request Jan 30, 2020
Copy link
Member

@jeehoonkang jeehoonkang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

거의 다 한 것 같습니다. 마지막 남은 몇몇 코멘트만 address하고 머지합시다.

@efenniht efenniht mentioned this pull request Feb 3, 2020
@efenniht efenniht merged commit 83cec14 into kaist-cp:hfo2 Feb 3, 2020
efenniht added a commit that referenced this pull request Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants