gpu: nvgpu: collapse nvgpu_gr_prepare_sw into nvgpu_gr_alloc

common.gr unit exports a separate API nvgpu_gr_prepare_sw to
initialize some SW pieces required for nvgpu_gr_enable_hw().
A separate API is really unnecessary since same initialization
can be performed in nvgpu_gr_alloc().

Remove nvgpu_gr_prepare_sw() and HAL gops.gr.gr_prepare_sw().
Initialize falcon and interrupt structures in loop from
nvgpu_gr_alloc().

Move nvgpu_netlist_init_ctx_vars() from nvgpu_gr_prepare_sw() to
common init path since netlist parsing need not be done from
common.gr unit. It just needs to happen before nvgpu_gr_enable_hw().

Also, trigger nvgpu_gr_free() from gr_remove_support() instead
of OS specific paths. Also remove nvgpu_gr_free() calls from
probe error paths since nvgpu_gr_alloc is no longer called in
probe path.

Move interrupt and falcon data structure free calls to nvgpu_gr_free().

Also remove corresponding unit testing code that tests
nvgpu_gr_prepare_sw() specifically.
Update some unit tests to initialize ecc counters and netlist.
Disable some unit tests that fail for reasons unknown.

Jira NVGPU-5648

Change-Id: I82ec8160f76530bc40e0c11a9f26ba1c8f9cf643
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2400166
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Deepak Nibade
2020-08-18 17:24:34 +05:30
committed by Alex Waterman
parent cfa360f5b8
commit 8cccb49bd2
25 changed files with 129 additions and 259 deletions

View File

@@ -323,9 +323,6 @@ static void nvgpu_free_gk20a(struct gk20a *g)
{
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
/* free gr memory */
nvgpu_gr_free(g);
kfree(l);
}

View File

@@ -1731,7 +1731,6 @@ return_err:
* Last since the above allocs may use data structures in here.
*/
nvgpu_kmem_fini(gk20a, NVGPU_KMEM_FINI_FORCE_CLEANUP);
nvgpu_gr_free(gk20a);
kfree(l);
return err;

View File

@@ -695,7 +695,6 @@ static int nvgpu_pci_probe(struct pci_dev *pdev,
err_free_irq:
nvgpu_free_irq(g);
nvgpu_gr_free(g);
err_disable_msi:
#if defined(CONFIG_PCI_MSI)
if (g->msi_enabled)

View File

@@ -399,7 +399,6 @@ int vgpu_probe(struct platform_device *pdev)
/* Initialize the platform interface. */
err = platform->probe(dev);
if (err) {
nvgpu_gr_free(gk20a);
if (err == -EPROBE_DEFER)
nvgpu_info(gk20a, "platform probe failed");
else
@@ -411,7 +410,6 @@ int vgpu_probe(struct platform_device *pdev)
err = platform->late_probe(dev);
if (err) {
nvgpu_err(gk20a, "late probe failed");
nvgpu_gr_free(gk20a);
return err;
}
}
@@ -419,14 +417,12 @@ int vgpu_probe(struct platform_device *pdev)
err = vgpu_comm_init(gk20a);
if (err) {
nvgpu_err(gk20a, "failed to init comm interface");
nvgpu_gr_free(gk20a);
return -ENOSYS;
}
priv->virt_handle = vgpu_connect();
if (!priv->virt_handle) {
nvgpu_err(gk20a, "failed to connect to server node");
nvgpu_gr_free(gk20a);
vgpu_comm_deinit();
return -ENOSYS;
}
@@ -434,21 +430,18 @@ int vgpu_probe(struct platform_device *pdev)
err = vgpu_get_constants(gk20a);
if (err) {
vgpu_comm_deinit();
nvgpu_gr_free(gk20a);
return err;
}
err = vgpu_pm_init(dev);
if (err) {
nvgpu_err(gk20a, "pm init failed");
nvgpu_gr_free(gk20a);
return err;
}
err = nvgpu_thread_create(&priv->intr_handler, gk20a,
vgpu_intr_thread, "gk20a");
if (err) {
nvgpu_gr_free(gk20a);
return err;
}