Skip to content
Open
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
2 changes: 2 additions & 0 deletions cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ def create_args():
help="Query the ECC state of the GPU")
argp.add_argument("--query-cc-mode", action='store_true', default=False,
help="Query the current Confidential Computing (CC) mode of the GPU.")
argp.add_argument("--output-json-file",
help="Path to write JSON output to for relevant query commands (e.g., --query-cc-mode).")
argp.add_argument("--query-cc-settings", action='store_true', default=False,
help="Query the Confidential Computing (CC) settings of the GPU."
"This prints the lower level setting knobs that will take effect upon GPU reset.")
Expand Down
16 changes: 15 additions & 1 deletion cli/per_gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# DEALINGS IN THE SOFTWARE.
#

import json
import os
import sys
import time
Expand Down Expand Up @@ -220,7 +221,20 @@ def main_per_gpu(gpu, opts):
return False

cc_mode = gpu.query_cc_mode()
info(f"{gpu} CC mode is {cc_mode}")
output_data = {
"gpu_bdf": str(gpu.bdf),
"cc_mode": cc_mode
}
print(json.dumps(output_data))

if opts.output_json_file:
try:
with open(opts.output_json_file, 'w') as f:
json.dump(output_data, f, indent=4)
info(f"CC mode query result written to {opts.output_json_file}")
except IOError as e:
error(f"Failed to write CC mode query result to {opts.output_json_file}: {e}")
return False

if opts.query_bar0_firewall_mode:
if not gpu.is_bar0_firewall_supported:
Expand Down