Commit 8a9dab17 authored by Andreas Beckmann's avatar Andreas Beckmann

New upstream version 390.48

parents fc98d0f4 6d8bbaeb
NVIDIA_VERSION = 390.25
NVIDIA_VERSION = 390.48
NVIDIA_VERSION = 390.25
NVIDIA_VERSION = 390.48
......@@ -117,6 +117,12 @@ static gboolean checkConfigfile(gboolean *writable);
static gboolean disallow_whitespace(GtkWidget *widget, GdkEvent *event, gpointer user_data);
static gboolean allow_digits(GtkWidget *widget, GdkEvent *event, gpointer user_data);
static gboolean enable_disable_ui_controls(GtkWidget *widget, GdkEvent *event, gpointer user_data);
static void update_gui_from_griddconfig(gpointer user_data);
static gboolean licenseStateQueryFailed = FALSE;
static void get_licensed_feature_code(gpointer user_data);
static gboolean is_restart_required(gpointer user_data);
static gboolean queryLicensedFeatureCode = TRUE;
int64_t licensedFeatureCode = NV_GRID_LICENSE_FEATURE_TYPE_VAPP;
GType ctk_manage_grid_license_get_type(void)
{
......@@ -748,19 +754,60 @@ static gboolean update_manage_grid_license_state_info(gpointer user_data)
int licenseState = NV_GRID_UNLICENSED;
int griddFeatureType = ctk_manage_grid_license->feature_type;
/* Send license state request */
if (!(send_message_to_gridd(ctk_manage_grid_license, LICENSE_STATE_REQUEST,
&licenseState))) {
ret = FALSE;
/* Send license state and feature type request */
if ((!(send_message_to_gridd(ctk_manage_grid_license, LICENSE_STATE_REQUEST,
&licenseState))) ||
(!(send_message_to_gridd(ctk_manage_grid_license, LICENSE_FEATURE_TYPE_REQUEST,
&griddFeatureType)))) {
licenseStatusMessage = "Unable to query license state information "
"from the NVIDIA GRID "
"licensing daemon.\n"
"Please make sure nvidia-gridd and "
"dbus-daemon are running.\n";
gtk_label_set_text(GTK_LABEL(ctk_manage_grid_license->label_license_state),
licenseStatusMessage);
/* Disable text controls on UI. */
gtk_widget_set_sensitive(ctk_manage_grid_license->txt_server_address, FALSE);
gtk_widget_set_sensitive(ctk_manage_grid_license->txt_server_port, FALSE);
gtk_widget_set_sensitive(ctk_manage_grid_license->txt_secondary_server_address, FALSE);
gtk_widget_set_sensitive(ctk_manage_grid_license->txt_secondary_server_port, FALSE);
/* Disable Apply/Cancel button. */
gtk_widget_set_sensitive(ctk_manage_grid_license->btn_apply, FALSE);
gtk_widget_set_sensitive(ctk_manage_grid_license->btn_cancel, FALSE);
/* Disable toggle buttons */
if (ctk_manage_grid_license->radio_btn_qdws && ctk_manage_grid_license->radio_btn_vapp) {
gtk_widget_set_sensitive(ctk_manage_grid_license->radio_btn_qdws, FALSE);
gtk_widget_set_sensitive(ctk_manage_grid_license->radio_btn_vapp, FALSE);
}
licenseStateQueryFailed = TRUE;
return ret;
}
if (licenseStateQueryFailed == TRUE) {
/*Failure to communicate with nvidia-gridd in previous attempt.
Refresh UI with parameters from the griddConfig.*/
update_gui_from_griddconfig(ctk_manage_grid_license);
licenseStateQueryFailed = FALSE;
}
/* Set the license feature type fetched from nvidia-gridd.*/
ctk_manage_grid_license->gridd_feature_type = griddFeatureType;
if (licenseState == NV_GRID_UNLICENSED) {
queryLicensedFeatureCode = TRUE;
switch (ctk_manage_grid_license->feature_type) {
case NV_GRID_LICENSE_FEATURE_TYPE_VAPP:
licenseStatus = NV_GRID_UNLICENSED_VAPP;
if (is_restart_required(ctk_manage_grid_license)) {
licenseStatus = NV_GRID_LICENSE_RESTART_REQUIRED_VAPP;
}
break;
case NV_GRID_LICENSE_FEATURE_TYPE_QDWS:
licenseStatus = NV_GRID_UNLICENSED_QDWS_SELECTED;
if (licensedFeatureCode == NV_GRID_LICENSE_FEATURE_TYPE_QDWS) {
licenseStatus = NV_GRID_UNLICENSED_REQUEST_DETAILS;
}
break;
case NV_GRID_LICENSE_FEATURE_TYPE_VGPU:
licenseStatus = NV_GRID_UNLICENSED_VGPU;
......@@ -770,14 +817,6 @@ static gboolean update_manage_grid_license_state_info(gpointer user_data)
}
}
else {
/* Send license feature type request */
if (!(send_message_to_gridd(ctk_manage_grid_license, LICENSE_FEATURE_TYPE_REQUEST,
&griddFeatureType))) {
ret = FALSE;
}
/* Set the license feature type fetched from nvidia-gridd.*/
ctk_manage_grid_license->gridd_feature_type = griddFeatureType;
if ((licenseState == NV_GRID_LICENSED) ||
(licenseState == NV_GRID_LICENSE_RENEWING) ||
(licenseState == NV_GRID_LICENSE_RENEW_FAILED)) {
......@@ -804,6 +843,10 @@ static gboolean update_manage_grid_license_state_info(gpointer user_data)
default:
break;
}
if (queryLicensedFeatureCode == TRUE) {
get_licensed_feature_code(ctk_manage_grid_license);
queryLicensedFeatureCode = FALSE;
}
}
else if (licenseState == NV_GRID_LICENSE_REQUESTING) {
switch (ctk_manage_grid_license->feature_type) {
......@@ -932,8 +975,12 @@ static gboolean update_manage_grid_license_state_info(gpointer user_data)
"Your system is currently licensed for Quadro Virtual Datacenter "
"Workstation.";
break;
case NV_GRID_LICENSE_RESTART_REQUIRED_VAPP:
licenseStatusMessage = "Restart your system for GRID Virtual Apps.";
break;
case NV_GRID_UNLICENSED_REQUEST_DETAILS:
default:
licenseStatusMessage = "Your system does not have a valid GPU license.\n"
licenseStatusMessage = "Your system does not have a valid GRID license.\n"
"Enter license server details and apply.";
break;
}
......@@ -943,7 +990,22 @@ static gboolean update_manage_grid_license_state_info(gpointer user_data)
return ret;
}
/*
* is_restart_required() - Check if restart is required for new feature to be enabled.
*/
static gboolean is_restart_required(gpointer user_data)
{
CtkManageGridLicense *ctk_manage_grid_license = CTK_MANAGE_GRID_LICENSE(user_data);
gboolean ret = FALSE;
/* Once licensed, system reboot required if there is mismatch between feature type
updated from UI/gridd.conf and feature code of the feature that is licensed on this system. */
if ((licensedFeatureCode) &&
(licensedFeatureCode != ctk_manage_grid_license->feature_type)) {
ret = TRUE;
}
return ret;
}
/*
* apply_clicked() - Called when the user clicks on the "Apply" button.
......@@ -1030,11 +1092,47 @@ static void apply_clicked(GtkWidget *widget, gpointer user_data)
gtk_widget_set_sensitive(ctk_manage_grid_license->btn_cancel, FALSE);
}
/*
* get_licensed_feature_code() - Get the feature code of the feature that is licensed on this system.
*/
static void get_licensed_feature_code(gpointer user_data)
{
CtkManageGridLicense *ctk_manage_grid_license = CTK_MANAGE_GRID_LICENSE(user_data);
nvmlGridLicensableFeatures_t *gridLicensableFeatures;
gint ret, i;
ret = NvCtrlNvmlGetGridLicenseAttributes(ctk_manage_grid_license->target,
NV_CTRL_ATTR_NVML_GPU_GRID_LICENSABLE_FEATURES,
&gridLicensableFeatures);
if (ret != NvCtrlSuccess) {
return;
}
for (i = 0; i < gridLicensableFeatures->licensableFeaturesCount; i++)
{
if (gridLicensableFeatures->gridLicensableFeatures[i].featureState != 0)
{
licensedFeatureCode = gridLicensableFeatures->gridLicensableFeatures[i].featureCode;
break;
}
}
nvfree(gridLicensableFeatures);
}
/*
* cancel_clicked() - Called when the user clicks on the "Cancel" button.
*/
static void cancel_clicked(GtkWidget *widget, gpointer user_data)
{
CtkManageGridLicense *ctk_manage_grid_license = CTK_MANAGE_GRID_LICENSE(user_data);
/* Discard user input and revert back to configuration from the nvidia-gridd config file */
update_gui_from_griddconfig(ctk_manage_grid_license);
}
static void update_gui_from_griddconfig(gpointer user_data)
{
CtkManageGridLicense *ctk_manage_grid_license = CTK_MANAGE_GRID_LICENSE(user_data);
NvGriddConfigParams *griddConfig = NULL;
......@@ -1058,21 +1156,55 @@ static void cancel_clicked(GtkWidget *widget, gpointer user_data)
griddConfig->str[NV_GRIDD_BACKUP_SERVER_ADDRESS]);
gtk_entry_set_text(GTK_ENTRY(ctk_manage_grid_license->txt_secondary_server_port),
griddConfig->str[NV_GRIDD_BACKUP_SERVER_PORT]);
}
/* set default value for feature type based on the user configured parameter or virtualization mode */
/* Check Feature type "2" for Quadro Virtual Datacenter Workstation. */
if (strcmp(griddConfig->str[NV_GRIDD_FEATURE_TYPE], "2") == 0) {
ctk_manage_grid_license->feature_type = NV_GRID_LICENSE_FEATURE_TYPE_QDWS;
}
else {
ctk_manage_grid_license->feature_type = NV_GRID_LICENSE_FEATURE_TYPE_VAPP;
}
textBoxServerStr = gtk_entry_get_text(GTK_ENTRY(ctk_manage_grid_license->txt_server_address));
/* Enable/Disable Secondary server address/port textboxes if Primary server address textbox string is empty. */
if (strcmp(textBoxServerStr, "") == 0) {
gtk_widget_set_sensitive(ctk_manage_grid_license->txt_secondary_server_address, FALSE);
gtk_widget_set_sensitive(ctk_manage_grid_license->txt_secondary_server_port, FALSE);
} else {
gtk_widget_set_sensitive(ctk_manage_grid_license->txt_secondary_server_address, TRUE);
gtk_widget_set_sensitive(ctk_manage_grid_license->txt_secondary_server_port, TRUE);
}
/* Override feature type when on vGPU */
if (ctk_manage_grid_license->license_edition_state == NV_CTRL_ATTR_NVML_GPU_VIRTUALIZATION_MODE_VGPU)
{
ctk_manage_grid_license->feature_type = NV_GRID_LICENSE_FEATURE_TYPE_VGPU;
}
/* Disable Apply/Cancel button. */
gtk_widget_set_sensitive(ctk_manage_grid_license->btn_apply, FALSE);
gtk_widget_set_sensitive(ctk_manage_grid_license->btn_cancel, FALSE);
/* Set license edition toggle button active */
if (ctk_manage_grid_license->radio_btn_qdws && ctk_manage_grid_license->radio_btn_vapp) {
if (ctk_manage_grid_license->feature_type == NV_GRID_LICENSE_FEATURE_TYPE_QDWS) {
/* Set 'Quadro Virtual Datacenter Workstation' toggle button active */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ctk_manage_grid_license->radio_btn_qdws), TRUE);
}
else {
/* Set 'GRID Virtual Apps' toggle button active */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ctk_manage_grid_license->radio_btn_vapp), TRUE);
}
}
/* Enable Primary server address/port textboxes. */
gtk_widget_set_sensitive(ctk_manage_grid_license->txt_server_address, TRUE);
gtk_widget_set_sensitive(ctk_manage_grid_license->txt_server_port, TRUE);
/* Enable toggle buttons. */
if (ctk_manage_grid_license->radio_btn_qdws && ctk_manage_grid_license->radio_btn_vapp) {
gtk_widget_set_sensitive(ctk_manage_grid_license->radio_btn_qdws, TRUE);
gtk_widget_set_sensitive(ctk_manage_grid_license->radio_btn_vapp, TRUE);
}
textBoxServerStr = gtk_entry_get_text(GTK_ENTRY(ctk_manage_grid_license->txt_server_address));
/* Enable/Disable Secondary server address/port textboxes if Primary server address textbox string is empty. */
if (strcmp(textBoxServerStr, "") == 0) {
gtk_widget_set_sensitive(ctk_manage_grid_license->txt_secondary_server_address, FALSE);
gtk_widget_set_sensitive(ctk_manage_grid_license->txt_secondary_server_port, FALSE);
} else {
gtk_widget_set_sensitive(ctk_manage_grid_license->txt_secondary_server_address, TRUE);
gtk_widget_set_sensitive(ctk_manage_grid_license->txt_secondary_server_port, TRUE);
}
/* Disable Apply/Cancel button. */
gtk_widget_set_sensitive(ctk_manage_grid_license->btn_apply, FALSE);
gtk_widget_set_sensitive(ctk_manage_grid_license->btn_cancel, FALSE);
}
if(griddConfig)
FreeNvGriddConfigParams(griddConfig);
......@@ -1198,8 +1330,8 @@ static gboolean enable_disable_ui_controls(GtkWidget *widget, GdkEvent *event, g
textBoxSecondaryServerPortStr = gtk_entry_get_text(GTK_ENTRY(ctk_manage_grid_license->txt_secondary_server_port));
/* Enable apply/cancel button if either:
Primary server address/port textbox string doesn't match with the Primary server string from the gridd config file or
Secondary server address/port textbox string doesn't match with the Secondary server string from the gridd config file. */
Primary server address/port textbox string doesn't match with the Primary server string from the nvidia-gridd config file or
Secondary server address/port textbox string doesn't match with the Secondary server string from the nvidia-gridd config file. */
if ((strcmp(griddConfig->str[NV_GRIDD_SERVER_ADDRESS], textBoxServerStr) != 0) ||
((strcmp(griddConfig->str[NV_GRIDD_BACKUP_SERVER_ADDRESS], textBoxSecondaryServerStr) != 0) ||
(strcmp(griddConfig->str[NV_GRIDD_BACKUP_SERVER_PORT], textBoxSecondaryServerPortStr) != 0) ||
......@@ -1336,7 +1468,6 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target,
GtkWidget *banner, *label, *frame;
gchar *str = NULL;
int64_t mode;
GtkWidget *button1 = NULL, *button2 = NULL;
GSList *slist = NULL;
gint ret;
DBusError err;
......@@ -1430,25 +1561,7 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target,
ctk_manage_grid_license->license_edition_state = mode;
ctk_manage_grid_license->dbusData = dbusData;
ctk_manage_grid_license->feature_type = 0;
/* set default value for feature type based on the user configured parameter or virtualization mode */
if (griddConfig) {
/* Check Feature type "2" for Quadro Virtual Datacenter Workstation. */
if (strcmp(griddConfig->str[NV_GRIDD_FEATURE_TYPE], "2") == 0) {
ctk_manage_grid_license->feature_type = NV_GRID_LICENSE_FEATURE_TYPE_QDWS;
}
else {
ctk_manage_grid_license->feature_type = NV_GRID_LICENSE_FEATURE_TYPE_VAPP;
}
}
/* Overwrite feature type in vGPU case */
if (ctk_manage_grid_license->license_edition_state == NV_CTRL_ATTR_NVML_GPU_VIRTUALIZATION_MODE_VGPU)
{
ctk_manage_grid_license->feature_type = NV_GRID_LICENSE_FEATURE_TYPE_VGPU;
}
ctk_manage_grid_license->gridd_feature_type = ctk_manage_grid_license->feature_type;
ctk_manage_grid_license->target = target;
/* set container properties for the CtkManageGridLicense widget */
......@@ -1481,22 +1594,22 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target,
gtk_container_add(GTK_CONTAINER(vbox1), vbox3);
gtk_container_set_border_width(GTK_CONTAINER(vbox3), 5);
button1 = gtk_radio_button_new_with_label(NULL,
ctk_manage_grid_license->radio_btn_qdws = gtk_radio_button_new_with_label(NULL,
"Quadro Virtual Datacenter Workstation");
slist = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button1));
gtk_box_pack_start(GTK_BOX(vbox3), button1, FALSE, FALSE, 0);
g_object_set_data(G_OBJECT(button1), "button_id",
slist = gtk_radio_button_get_group(GTK_RADIO_BUTTON(ctk_manage_grid_license->radio_btn_qdws));
gtk_box_pack_start(GTK_BOX(vbox3), ctk_manage_grid_license->radio_btn_qdws, FALSE, FALSE, 0);
g_object_set_data(G_OBJECT(ctk_manage_grid_license->radio_btn_qdws), "button_id",
GINT_TO_POINTER(NV_GRID_LICENSE_FEATURE_TYPE_QDWS));
g_signal_connect(G_OBJECT(button1), "toggled",
g_signal_connect(G_OBJECT(ctk_manage_grid_license->radio_btn_qdws), "toggled",
G_CALLBACK(license_edition_toggled),
(gpointer) ctk_manage_grid_license);
button2 = gtk_radio_button_new_with_label(slist, "GRID Virtual Apps");
gtk_box_pack_start(GTK_BOX(vbox3), button2, FALSE, FALSE, 0);
g_object_set_data(G_OBJECT(button2), "button_id",
ctk_manage_grid_license->radio_btn_vapp = gtk_radio_button_new_with_label(slist, "GRID Virtual Apps");
gtk_box_pack_start(GTK_BOX(vbox3), ctk_manage_grid_license->radio_btn_vapp, FALSE, FALSE, 0);
g_object_set_data(G_OBJECT(ctk_manage_grid_license->radio_btn_vapp), "button_id",
GINT_TO_POINTER(NV_GRID_LICENSE_FEATURE_TYPE_VAPP));
g_signal_connect(G_OBJECT(button2), "toggled",
g_signal_connect(G_OBJECT(ctk_manage_grid_license->radio_btn_vapp), "toggled",
G_CALLBACK(license_edition_toggled),
(gpointer) ctk_manage_grid_license);
......@@ -1540,8 +1653,6 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target,
label = gtk_label_new("Primary Server:");
ctk_manage_grid_license->txt_server_address = gtk_entry_new();
gtk_entry_set_text(GTK_ENTRY(ctk_manage_grid_license->txt_server_address),
griddConfig->str[NV_GRIDD_SERVER_ADDRESS]);
hbox = gtk_hbox_new(FALSE, 0);
eventbox = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(eventbox), label);
......@@ -1577,8 +1688,6 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target,
/* value */
ctk_manage_grid_license->txt_server_port = gtk_entry_new();
gtk_entry_set_text(GTK_ENTRY(ctk_manage_grid_license->txt_server_port),
griddConfig->str[NV_GRIDD_SERVER_PORT]);
hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox),
ctk_manage_grid_license->txt_server_port,
......@@ -1596,13 +1705,6 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target,
label = gtk_label_new("Secondary Server:");
ctk_manage_grid_license->txt_secondary_server_address = gtk_entry_new();
/* Disable Secondary server address textbox if Primary server address is empty. */
if (strcmp(griddConfig->str[NV_GRIDD_SERVER_ADDRESS], "") == 0) {
gtk_widget_set_sensitive(ctk_manage_grid_license->txt_secondary_server_address, FALSE);
}
gtk_entry_set_text(GTK_ENTRY(ctk_manage_grid_license->txt_secondary_server_address),
griddConfig->str[NV_GRIDD_BACKUP_SERVER_ADDRESS]);
hbox = gtk_hbox_new(FALSE, 0);
eventbox = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(eventbox), label);
......@@ -1640,13 +1742,6 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target,
/* value */
ctk_manage_grid_license->txt_secondary_server_port = gtk_entry_new();
/* Disable Secondary server port textbox if Primary server address is empty. */
if (strcmp(griddConfig->str[NV_GRIDD_SERVER_ADDRESS], "") == 0) {
gtk_widget_set_sensitive(ctk_manage_grid_license->txt_secondary_server_port, FALSE);
}
gtk_entry_set_text(GTK_ENTRY(ctk_manage_grid_license->txt_secondary_server_port),
griddConfig->str[NV_GRIDD_BACKUP_SERVER_PORT]);
hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox),
ctk_manage_grid_license->txt_secondary_server_port,
......@@ -1687,18 +1782,13 @@ GtkWidget* ctk_manage_grid_license_new(CtrlTarget *target,
G_CALLBACK(cancel_clicked),
(gpointer) ctk_manage_grid_license);
/* Set license edition toggle button active */
if (button2 && button1) {
if (ctk_manage_grid_license->feature_type == NV_GRID_LICENSE_FEATURE_TYPE_QDWS) {
/* Set 'Quadro Virtual Datacenter Workstation' toggle button active */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button1), TRUE);
}
else {
/* Set 'GRID Virtual Apps' toggle button active */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button2), TRUE);
}
}
/* Update GUI with information from the nvidia-gridd config file */
update_gui_from_griddconfig(ctk_manage_grid_license);
get_licensed_feature_code(ctk_manage_grid_license);
/* Set the license feature type fetched from nvidia-gridd */
ctk_manage_grid_license->gridd_feature_type = ctk_manage_grid_license->feature_type;
/* Register a timer callback to update license status info */
str = g_strdup_printf("Manage GRID License");
......
......@@ -56,10 +56,13 @@ struct _CtkManageGridLicense
GtkWidget* txt_server_address;
GtkWidget* label_license_state;
GtkWidget* btn_apply;
GtkWidget* radio_btn_vapp;
GtkWidget* radio_btn_qdws;
GtkWidget* btn_cancel;
GtkWidget* box_server_info;
DbusData *dbusData;
CtrlTarget *target;
gint license_edition_state;
gint feature_type; // Feature type from UI/gridd.conf.
int gridd_feature_type; // Feature type fetched from nvidia-gridd.
......@@ -82,6 +85,8 @@ typedef enum
NV_GRID_LICENSE_EXPIRED_VGPU,
NV_GRID_LICENSE_EXPIRED_QDWS,
NV_GRID_LICENSE_RESTART_REQUIRED,
NV_GRID_LICENSE_RESTART_REQUIRED_VAPP,
NV_GRID_UNLICENSED_REQUEST_DETAILS, // Default case
} licenseStatus;
struct _CtkManageGridLicenseClass
......
NVIDIA_VERSION = 390.25
NVIDIA_VERSION = 390.48
......@@ -272,7 +272,9 @@ typedef enum {
#define NV_CTRL_ATTR_NVML_GPU_GRID_LICENSE_SUPPORTED_FALSE 0
#define NV_CTRL_ATTR_NVML_GPU_GRID_LICENSE_SUPPORTED_TRUE 1
#define NV_CTRL_ATTR_NVML_LAST_ATTRIBUTE (NV_CTRL_ATTR_NVML_GPU_GRID_LICENSE_SUPPORTED)
#define NV_CTRL_ATTR_NVML_GPU_GRID_LICENSABLE_FEATURES (NV_CTRL_ATTR_NVML_BASE + 2)
#define NV_CTRL_ATTR_NVML_LAST_ATTRIBUTE (NV_CTRL_ATTR_NVML_GPU_GRID_LICENSABLE_FEATURES)
#define NV_CTRL_ATTR_LAST_ATTRIBUTE \
(NV_CTRL_ATTR_NVML_LAST_ATTRIBUTE)
......
......@@ -895,6 +895,54 @@ static ReturnStatus NvCtrlNvmlGetGPUAttribute(const CtrlTarget *ctrl_target,
return NvCtrlNotSupported;
}
static ReturnStatus NvCtrlNvmlGetGridLicensableFeatures(const CtrlTarget *ctrl_target,
int attr, nvmlGridLicensableFeatures_t **val)
{
const NvCtrlAttributePrivateHandle *h = getPrivateHandleConst(ctrl_target);
const NvCtrlNvmlAttributes *nvml;
nvmlDevice_t device;
nvmlReturn_t ret;
if ((h == NULL) || (h->nvml == NULL)) {
return NvCtrlBadHandle;
}
nvml = h->nvml;
ret = nvml->lib.deviceGetHandleByIndex(nvml->deviceIdx, &device);
if (ret == NVML_SUCCESS) {
switch (attr) {
case NV_CTRL_ATTR_NVML_GPU_GRID_LICENSABLE_FEATURES:
if (nvml->lib.deviceGetGridLicensableFeatures) {
nvmlGridLicensableFeatures_t *gridLicensableFeatures;
gridLicensableFeatures = (nvmlGridLicensableFeatures_t *)nvalloc(sizeof(nvmlGridLicensableFeatures_t));
ret = nvml->lib.deviceGetGridLicensableFeatures(device,
gridLicensableFeatures);
if (ret == NVML_SUCCESS) {
*val = gridLicensableFeatures;
return NvCtrlSuccess;
}
} else {
/* return NvCtrlNotSupported against older driver */
ret = NVML_ERROR_FUNCTION_NOT_FOUND;
}
break;
default:
/* Did we forget to handle a GPU integer attribute? */
nv_warning_msg("Unhandled integer attribute %s (%d) of GPU "
"(%d)", INT_ATTRIBUTE_NAME(attr), attr,
NvCtrlGetTargetId(ctrl_target));
return NvCtrlNotSupported;
}
}
/* An NVML error occurred */
printNvmlError(ret);
return NvCtrlNotSupported;
}
#ifdef NVML_EXPERIMENTAL
static int getThermalCoolerId(const NvCtrlAttributePrivateHandle *h,
......@@ -1072,6 +1120,28 @@ ReturnStatus NvCtrlNvmlGetAttribute(const CtrlTarget *ctrl_target,
}
ReturnStatus NvCtrlNvmlGetGridLicenseAttributes(const CtrlTarget *ctrl_target,
int attr, nvmlGridLicensableFeatures_t **val)
{
if (NvmlMissing(ctrl_target)) {
return NvCtrlMissingExtension;
}
/*
* This should't be reached for target types that are not handled through
* NVML (Keep TARGET_TYPE_IS_NVML_COMPATIBLE in NvCtrlAttributesPrivate.h up
* to date).
*/
assert(TARGET_TYPE_IS_NVML_COMPATIBLE(NvCtrlGetTargetType(ctrl_target)));
if (NvCtrlGetTargetType(ctrl_target) == GPU_TARGET) {
return NvCtrlNvmlGetGridLicensableFeatures(ctrl_target, attr, val);
}
else {
return NvCtrlBadHandle;
}
}
/*
* Set NVML Attribute Values
......
......@@ -427,6 +427,8 @@ ReturnStatus NvCtrlNvmlSetStringAttribute(CtrlTarget *ctrl_target,
int attr, const char *ptr);
ReturnStatus NvCtrlNvmlGetAttribute(const CtrlTarget *ctrl_target,
int attr, int64_t *val);
ReturnStatus NvCtrlNvmlGetGridLicenseAttributes(const CtrlTarget *ctrl_target,
int attr, nvmlGridLicensableFeatures_t **val);
ReturnStatus NvCtrlNvmlSetAttribute(CtrlTarget *ctrl_target, int attr,
int index, int val);
ReturnStatus
......
......@@ -1144,12 +1144,6 @@ typedef struct nvmlEventData_st
*/
#define nvmlClocksThrottleReasonSyncBoost 0x0000000000000010LL
/** GPU clocks are limited by current setting of Display clocks
*
* @see bug 1997531
*/
#define nvmlClocksThrottleReasonDisplayClockSetting 0x0000000000000020LL
/** Bit mask representing no clocks throttling
*
* Clocks are as high as possible.
......@@ -1165,7 +1159,6 @@ typedef struct nvmlEventData_st
| nvmlClocksThrottleReasonSwPowerCap \
| nvmlClocksThrottleReasonHwSlowdown \
| nvmlClocksThrottleReasonSyncBoost \
| nvmlClocksThrottleReasonDisplayClockSetting \
)
/** @} */
......
#define NVIDIA_VERSION "390.25"
#define NVIDIA_VERSION "390.48"
NVIDIA_VERSION = 390.25
NVIDIA_VERSION = 390.48
NVIDIA_VERSION = 390.25
NVIDIA_VERSION = 390.48
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment