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

Add snpinfo.sh script #4196

Merged
merged 11 commits into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .azure-pipelines-templates/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@ parameters:
cmake_args: ""

steps:
- script: |
set -ex
samples/scripts/platform_info.sh
cat /proc/cpuinfo | grep flags | uniq
sudo groupadd -g 119 sgx_prv
sudo usermod -a -G sgx_prv $(whoami)
displayName: Platform Info
condition: succeededOrFailed()

- script: |
set -ex
mkdir build
Expand Down
4 changes: 4 additions & 0 deletions .azure-pipelines-templates/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
target: ${{ parameters.target }}
quictls_mode: ${{ parameters.fetch_quictls }}

- template: platform.yml
parameters:
target: "${{ parameters.target }}"

- template: cmake.yml
parameters:
cmake_args: "${{ parameters.cmake_args }}"
Expand Down
27 changes: 27 additions & 0 deletions .azure-pipelines-templates/platform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
parameters:
target: ""

steps:
# 119 is GID of special "sgx_prv" group on underlying VM that is
# required to run SGX on kernel > 5.11
- ${{ if or(eq(parameters.target, 'SGX'), eq(parameters.target, 'SGXIceLake')) }}:
- script: |
set -ex
sudo groupadd -g 119 sgx_prv
sudo usermod -a -G sgx_prv $(whoami)
displayName: SGX Group
condition: succeededOrFailed()

- script: |
set -ex
samples/scripts/sgxinfo.sh
cat /proc/cpuinfo | grep flags | uniq
displayName: SGX Info
condition: succeededOrFailed()

- ${{ if ne(parameters.target, 'SGX') }}:
- script: |
set -ex
samples/scripts/snpinfo.sh
displayName: SEV-SNP Info
condition: succeededOrFailed()
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [3.0.0-dev3]

### Changed
### Added

- `sgxinfo.sh` script has been renamed to `platform_info.sh` (#4184).
- New `snpinfo.sh` script (#4196).

## [3.0.0-dev2]

Expand Down
3 changes: 2 additions & 1 deletion cmake/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ foreach(UTILITY ${CCF_TEST_UTILITIES})
endforeach()

# Install additional utilities
install(PROGRAMS ${CCF_DIR}/samples/scripts/platform_info.sh DESTINATION bin)
install(PROGRAMS ${CCF_DIR}/samples/scripts/sgxinfo.sh DESTINATION bin)
install(PROGRAMS ${CCF_DIR}/samples/scripts/snpinfo.sh DESTINATION bin)
install(FILES ${CCF_DIR}/tests/config.jinja DESTINATION bin)

# Install getting_started scripts for VM creation and setup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@

set +e

# SEV-SNP
AMD_SEV_SNP_DEVICE="/dev/sev"
if test -c "$AMD_SEV_SNP_DEVICE"; then
echo "AMD SEV-SNP:"
echo "$AMD_SEV_SNP_DEVICE detected."
exit 0
fi

# SGX
if grep -q "^flags.*sgx.*" < /proc/cpuinfo ; then
echo "LINUX KERNEL WITH BUILT-IN SGX SUPPORT (5.11+):"
uname -r
Expand Down
13 changes: 13 additions & 0 deletions samples/scripts/snpinfo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache 2.0 License.

set +e

AMD_SEV_SNP_DEVICE="/dev/sev"
echo "AMD SEV-SNP DEVICE:"
if test -c "$AMD_SEV_SNP_DEVICE"; then
echo "$AMD_SEV_SNP_DEVICE detected."
else
echo "$AMD_SEV_SNP_DEVICE not detected."
fi