gpu: nvgpu: mig: Defer dev_nodes creation and create new power node to support MIG

- This is deferring the dev_nodes creation after power_on to
select the MIG config and to create the dev_nodes as per the
selected MIG config.

- The patch is adding a device node to issue power on. The
nodes are:
 for igpu :/dev/nvgpu/igpu0/power
 for dgpu:/dev/nvgpu/dgpu-0001:01:00.0/power

To issue power on :
echo "1" > /dev/nvgpu/igpu0/power
echo "1" > /dev/nvgpu/dgpu-0001:01:00.0/power

JIRA NVGPU-6633

Change-Id: Ic4f1f3e42724cc788dcfaf0e881d188fd3bd1ce1
Signed-off-by: dt <dt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2512647
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
dt
2021-04-09 06:54:50 +00:00
committed by mobile promotions
parent cfc1281223
commit 639ca4edfb
9 changed files with 355 additions and 21 deletions

View File

@@ -268,6 +268,7 @@ int nvgpu_probe(struct gk20a *g,
{
struct device *dev = dev_from_gk20a(g);
struct gk20a_platform *platform = dev_get_drvdata(dev);
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
int err = 0;
nvgpu_init_vars(g);
@@ -294,11 +295,22 @@ int nvgpu_probe(struct gk20a *g,
}
nvgpu_init_mm_vars(g);
/* platform probe can defer do user init only if probe succeeds */
err = gk20a_user_init(dev);
if (err)
err = gk20a_power_node_init(dev);
if (err) {
nvgpu_err(g, "power_node creation failed");
return err;
}
/*
* TODO: While removing the legacy nodes the following condition
* need to be removed.
*/
if (platform->platform_chip_id == TEGRA_210) {
err = gk20a_user_init(dev);
if (err)
return err;
l->dev_nodes_created = true;
}
/*
* Note that for runtime suspend to work the clocks have to be setup