From 24475ad46b7d5116febcaf7cd9a635622aa493f3 Mon Sep 17 00:00:00 2001 From: Ramalingam C Date: Wed, 12 Apr 2023 08:58:08 +0000 Subject: [PATCH] gpu: nvgpu: pci power management for iGPU-PCIe devices Use the PCI power management functions for iGPU-PCIe devices. JIRA NVGPU-9896 Change-Id: I1ac4ae67fa727e0a8e37ed2037d1417c5c19bb17 Signed-off-by: Ramalingam C Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2886799 Reviewed-by: Rajesh Devaraj Reviewed-by: Seema Khowala Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-cert GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/os/linux/pci.c | 34 +++++++++++--------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/nvgpu/os/linux/pci.c b/drivers/gpu/nvgpu/os/linux/pci.c index 034f1cb54..ab611632f 100644 --- a/drivers/gpu/nvgpu/os/linux/pci.c +++ b/drivers/gpu/nvgpu/os/linux/pci.c @@ -700,11 +700,6 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, if (IS_ERR(platform->reset_control)) platform->reset_control = NULL; #endif - err = gk20a_pm_init(&pdev->dev); - if (err) { - dev_err(&pdev->dev, "pm init failed"); - goto err_free_irq; - } } if (strchr(dev_name(&pdev->dev), '%')) { @@ -717,12 +712,10 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, if (err) goto err_free_irq; - if (!g->is_pci_igpu) { - err = nvgpu_pci_pm_init(&pdev->dev); - if (err) { - nvgpu_err(g, "pm init failed"); - goto err_free_irq; - } + err = nvgpu_pci_pm_init(&pdev->dev); + if (err) { + nvgpu_err(g, "pm init failed"); + goto err_free_irq; } if (!platform->disable_nvlink) { @@ -754,12 +747,6 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, #endif if (g->is_pci_igpu) { - err = gk20a_pm_late_init(&pdev->dev); - if (err) { - dev_err(&pdev->dev, "pm late_init failed"); - goto err_free_irq; - } - l->nvgpu_reboot_nb.notifier_call = nvgpu_kernel_shutdown_notification; err = register_reboot_notifier(&l->nvgpu_reboot_nb); @@ -769,13 +756,14 @@ static int nvgpu_pci_probe(struct pci_dev *pdev, err = nvgpu_get_dt_clock_limit(g, &g->dgpu_max_clk); if (err != 0) nvgpu_info(g, "Missing nvgpu node"); - - err = nvgpu_pci_add_pci_power(pdev); - if (err) { - nvgpu_err(g, "add pci power failed (%d).", err); - goto err_free_irq; - } } + + err = nvgpu_pci_add_pci_power(pdev); + if (err) { + nvgpu_err(g, "add pci power failed (%d).", err); + goto err_free_irq; + } + nvgpu_mutex_init(&l->dmabuf_priv_list_lock); nvgpu_init_list_node(&l->dmabuf_priv_list);