mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: add platform control for gc off
The GC-OFF feature shall be available only for selective dGPUs like Volta, etc. To enable this, add a platform flag to control GC-OFF feature for a given dGPU. If GC-OFF is not enabled for a dGPU, EPERM error will be returned by kernel interfaces. JIRA NVGPU-1100 Change-Id: Ic9e4492b2bb8916d520e78ecb6a500ccd349b70c Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1923249 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
4fcdc2771f
commit
7cec4ba326
@@ -189,6 +189,7 @@ static struct gk20a_platform nvgpu_pci_device[] = {
|
|||||||
/* power management configuration */
|
/* power management configuration */
|
||||||
.railgate_delay_init = 500,
|
.railgate_delay_init = 500,
|
||||||
.can_railgate_init = false,
|
.can_railgate_init = false,
|
||||||
|
.can_pci_gc_off = true,
|
||||||
.can_elpg_init = false,
|
.can_elpg_init = false,
|
||||||
.enable_elpg = false,
|
.enable_elpg = false,
|
||||||
.enable_elcg = false,
|
.enable_elcg = false,
|
||||||
@@ -263,6 +264,7 @@ static struct gk20a_platform nvgpu_pci_device[] = {
|
|||||||
/* power management configuration */
|
/* power management configuration */
|
||||||
.railgate_delay_init = 500,
|
.railgate_delay_init = 500,
|
||||||
.can_railgate_init = false,
|
.can_railgate_init = false,
|
||||||
|
.can_pci_gc_off = true,
|
||||||
.can_elpg_init = false,
|
.can_elpg_init = false,
|
||||||
.enable_elpg = false,
|
.enable_elpg = false,
|
||||||
.enable_elcg = false,
|
.enable_elcg = false,
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ struct nvgpu_pci_power {
|
|||||||
char pci_dev_name[PCI_DEV_NAME_MAX];
|
char pci_dev_name[PCI_DEV_NAME_MAX];
|
||||||
void *pci_cookie;
|
void *pci_cookie;
|
||||||
struct pci_power_stats stats;
|
struct pci_power_stats stats;
|
||||||
|
bool can_pci_gc_off;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct list_head nvgpu_pci_power_devs =
|
static struct list_head nvgpu_pci_power_devs =
|
||||||
@@ -70,6 +71,7 @@ static struct nvgpu_pci_power *nvgpu_pci_get_pci_power(const char *dev_name)
|
|||||||
|
|
||||||
int nvgpu_pci_add_pci_power(struct pci_dev *pdev)
|
int nvgpu_pci_add_pci_power(struct pci_dev *pdev)
|
||||||
{
|
{
|
||||||
|
struct gk20a_platform *platform;
|
||||||
struct nvgpu_pci_power *pp;
|
struct nvgpu_pci_power *pp;
|
||||||
|
|
||||||
if (!pdev)
|
if (!pdev)
|
||||||
@@ -90,6 +92,9 @@ int nvgpu_pci_add_pci_power(struct pci_dev *pdev)
|
|||||||
strlcpy(pp->pci_dev_name,
|
strlcpy(pp->pci_dev_name,
|
||||||
dev_name(&pdev->dev), PCI_DEV_NAME_MAX);
|
dev_name(&pdev->dev), PCI_DEV_NAME_MAX);
|
||||||
|
|
||||||
|
platform = pci_get_drvdata(pdev);
|
||||||
|
pp->can_pci_gc_off = platform->can_pci_gc_off;
|
||||||
|
|
||||||
list_add(&pp->list, &nvgpu_pci_power_devs);
|
list_add(&pp->list, &nvgpu_pci_power_devs);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -440,6 +445,11 @@ static int nvgpu_pci_gpu_power_on(char *dev_name)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pp->can_pci_gc_off == false) {
|
||||||
|
pr_err("nvgpu: gc-off not enabled for pdev: %s\n", dev_name);
|
||||||
|
return -EPERM;
|
||||||
|
}
|
||||||
|
|
||||||
time_start = ktime_get();
|
time_start = ktime_get();
|
||||||
|
|
||||||
nvgpu_mutex_acquire(&pp->mutex);
|
nvgpu_mutex_acquire(&pp->mutex);
|
||||||
@@ -504,6 +514,11 @@ static int nvgpu_pci_gpu_power_off(char *dev_name)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pp->can_pci_gc_off == false) {
|
||||||
|
pr_err("nvgpu: gc-off not enabled for pdev: %s\n", dev_name);
|
||||||
|
return -EPERM;
|
||||||
|
}
|
||||||
|
|
||||||
time_start = ktime_get();
|
time_start = ktime_get();
|
||||||
|
|
||||||
nvgpu_mutex_acquire(&pp->mutex);
|
nvgpu_mutex_acquire(&pp->mutex);
|
||||||
|
|||||||
@@ -59,6 +59,9 @@ struct gk20a_platform {
|
|||||||
/* Should be populated at probe. */
|
/* Should be populated at probe. */
|
||||||
bool can_railgate_init;
|
bool can_railgate_init;
|
||||||
|
|
||||||
|
/* controls gc off feature for pci gpu */
|
||||||
|
bool can_pci_gc_off;
|
||||||
|
|
||||||
/* Should be populated at probe. */
|
/* Should be populated at probe. */
|
||||||
bool can_tpc_powergate;
|
bool can_tpc_powergate;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user