Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Fix compilation error. Secure execution whatever happens to the host …
Browse files Browse the repository at this point in the history
…and card information retreival.
  • Loading branch information
xlz-jbleclere committed Aug 26, 2020
1 parent 0f8a178 commit d96f126
Showing 1 changed file with 38 additions and 42 deletions.
80 changes: 38 additions & 42 deletions source/drm_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,43 +435,48 @@ class DRM_LOCAL DrmManager::Impl {
if ( !findXrtUtility() )
return;

// Call xbutil to collect host and card data
std::string cmd = fmt::format( "{} dump", mXbutil );
std::string cmd_out = exec_cmd( cmd );

// Parse collected data and save to header
Json::Value node = parseJsonString( cmd_out );
for(Json::Value::iterator itr=node.begin(); itr!=node.end(); ++itr) {
std::string key = itr.key().asString();
try {
if ( ( key == "version" )
|| ( key == "system" )
|| ( key == "runtime" )
)
mHostConfigData[key] = *itr;
else if ( key == "board" ) {
// Add general info node
mHostConfigData[key]["info"] = itr->get("info", Json::nullValue);
// Try to get the number of kernels
Json::Value compute_unit_node = itr->get("compute_unit", Json::nullValue);
if ( compute_unit_node != Json::nullValue )
mHostConfigData[key]["compute_unit"] = compute_unit_node.size();
else
mHostConfigData[key]["compute_unit"] = -1;
// Add XCLBIN UUID
mHostConfigData[key]["xclbin"] = itr->get("xclbin", Json::nullValue);
// Add CSP specific command
CspBase* csp = CspBase::make_csp();
if ( csp != nullptr ) {
mHostConfigData[key]["csp"] = csp->get_metadata();
delete csp;
try {
// Call xbutil to collect host and card data
std::string cmd = fmt::format( "{} dump", mXbutil );
std::string cmd_out = exec_cmd( cmd );

// Parse collected data and save to header
Json::Value node = parseJsonString( cmd_out );
for(Json::Value::iterator itr=node.begin(); itr!=node.end(); ++itr) {
std::string key = itr.key().asString();
try {
if ( ( key == "version" )
|| ( key == "system" )
|| ( key == "runtime" )
)
mHostConfigData[key] = *itr;
else if ( key == "board" ) {
// Add general info node
mHostConfigData[key]["info"] = itr->get("info", Json::nullValue);
// Try to get the number of kernels
Json::Value compute_unit_node = itr->get("compute_unit", Json::nullValue);
if ( compute_unit_node != Json::nullValue )
mHostConfigData[key]["compute_unit"] = compute_unit_node.size();
else
mHostConfigData[key]["compute_unit"] = -1;
// Add XCLBIN UUID
mHostConfigData[key]["xclbin"] = itr->get("xclbin", Json::nullValue);
// Add CSP specific command
CspBase* csp = CspBase::make_csp();
if ( csp != nullptr ) {
mHostConfigData[key]["csp"] = csp->get_metadata();
delete csp;
}
}
} catch( const std::exception &e ) {
Debug( "Could not extract Host Information for key {}", key );
}
} catch( const std::exception &e ) {
Debug( "Could not extract Host Information for key {}", key );
}
Debug( "Host and card information:\n{}", mHostConfigData.toStyledString() );

} catch( const std::exception &e ) {
Warning( "Error when retreiving host and card information: {}", e.what() );
}
Debug( "Host and card information:\n{}", mHostConfigData.toStyledString() );
}

Json::Value buildSettingsNode() {
Expand Down Expand Up @@ -2508,15 +2513,6 @@ class DRM_LOCAL DrmManager::Impl {
custom_msg );
break;
}
case ParameterKey::bad_product_id: {
Warning( "Parameter '{}' (ID={}) is deprecated", key_str, key_id );
break;
}
case ParameterKey::bad_oauth2_token: {
Debug( "Set parameter '{}' (ID={}) to random value", key_str, key_id );
getDrmWSClient().setOAuth2token( "BAD_TOKEN" );
break;
}
case ParameterKey::log_message_level: {
int32_t message_level = (*it).asInt();
if ( ( message_level < spdlog::level::trace)
Expand Down

0 comments on commit d96f126

Please sign in to comment.