mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-25 02:52:51 +03:00
gpu: nvgpu: rework secure_page allocation path
Currently, if can_railgate = false, then we have below sequence to allocate secure_page - unrailgate GPU (forever) - reset_assert() - allocate secure_page - reset_deassert() But if we allocate secure page even before unrailgating GPU for first time, then we can avoid reset_assert()/deassert() calls since GPU should already be in reset/railgated at boot time hence, rework this sequence as below - init required mutex, set platform->reset_control - allocate secure page (GPU should already be in reset at this point) - gk20a_pm_init() which unrailgates GPU in case of can_railgate = false Bug 200137963 Bug 1678611 Change-Id: I79d0543bb5cf1eaf1009e1e6ac142532d84514a5 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/797153 (cherry picked from commit 368004501943d38c003747f6bec0384fed57ee65) Reviewed-on: http://git-master/r/816005 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
committed by
Terje Bergstrom
parent
960552df3e
commit
1cf6539990
@@ -1275,8 +1275,6 @@ static int gk20a_pm_init(struct platform_device *dev)
|
||||
|
||||
gk20a_dbg_fn("");
|
||||
|
||||
mutex_init(&platform->railgate_lock);
|
||||
|
||||
/* Initialise pm runtime */
|
||||
if (platform->clockgate_delay) {
|
||||
pm_runtime_set_autosuspend_delay(&dev->dev,
|
||||
@@ -1299,10 +1297,6 @@ static int gk20a_pm_init(struct platform_device *dev)
|
||||
if (IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS))
|
||||
err = gk20a_pm_initialise_domain(dev);
|
||||
|
||||
platform->reset_control = devm_reset_control_get(&dev->dev, NULL);
|
||||
if (IS_ERR(platform->reset_control))
|
||||
platform->reset_control = NULL;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -1312,17 +1306,11 @@ static int gk20a_secure_page_alloc(struct platform_device *pdev)
|
||||
int err = 0;
|
||||
|
||||
if (platform->secure_page_alloc) {
|
||||
if (platform->num_clks > 0)
|
||||
tegra_periph_reset_assert(platform->clk[0]);
|
||||
udelay(10);
|
||||
err = platform->secure_page_alloc(pdev);
|
||||
if (platform->num_clks > 0)
|
||||
tegra_periph_reset_deassert(platform->clk[0]);
|
||||
if (!err)
|
||||
platform->secure_alloc_ready = true;
|
||||
}
|
||||
|
||||
if (!err)
|
||||
platform->secure_alloc_ready = true;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -1413,9 +1401,14 @@ static int gk20a_probe(struct platform_device *dev)
|
||||
gk20a_init_support(dev);
|
||||
|
||||
init_rwsem(&gk20a->busy_lock);
|
||||
mutex_init(&platform->railgate_lock);
|
||||
|
||||
spin_lock_init(&gk20a->mc_enable_lock);
|
||||
|
||||
platform->reset_control = devm_reset_control_get(&dev->dev, NULL);
|
||||
if (IS_ERR(platform->reset_control))
|
||||
platform->reset_control = NULL;
|
||||
|
||||
gk20a_debug_init(dev);
|
||||
|
||||
/* Initialize the platform interface. */
|
||||
@@ -1425,6 +1418,11 @@ static int gk20a_probe(struct platform_device *dev)
|
||||
return err;
|
||||
}
|
||||
|
||||
err = gk20a_secure_page_alloc(dev);
|
||||
if (err)
|
||||
dev_err(&dev->dev,
|
||||
"failed to allocate secure buffer %d\n", err);
|
||||
|
||||
err = gk20a_pm_init(dev);
|
||||
if (err) {
|
||||
dev_err(&dev->dev, "pm init failed");
|
||||
@@ -1445,11 +1443,6 @@ static int gk20a_probe(struct platform_device *dev)
|
||||
}
|
||||
}
|
||||
|
||||
err = gk20a_secure_page_alloc(dev);
|
||||
if (err)
|
||||
dev_err(&dev->dev,
|
||||
"failed to allocate secure buffer %d\n", err);
|
||||
|
||||
/* Set DMA parameters to allow larger sgt lists */
|
||||
dev->dev.dma_parms = &gk20a->dma_parms;
|
||||
dma_set_max_seg_size(&dev->dev, UINT_MAX);
|
||||
|
||||
Reference in New Issue
Block a user