From 1fd722f592c2e0523c5e399a2406a4e387057188 Mon Sep 17 00:00:00 2001 From: Aingara Paramakuru Date: Mon, 5 May 2014 21:14:22 -0400 Subject: gpu: nvgpu: support gk20a virtualization The nvgpu driver now supports using the Tegra graphics virtualization interfaces to support gk20a in a virtualized environment. Bug 1509608 Change-Id: I6ede15ee7bf0b0ad8a13e8eb5f557c3516ead676 Signed-off-by: Aingara Paramakuru Reviewed-on: http://git-master/r/440122 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c | 64 +++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c (limited to 'drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c') diff --git a/drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c b/drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c new file mode 100644 index 00000000..ea4fde79 --- /dev/null +++ b/drivers/gpu/nvgpu/gk20a/platform_vgpu_tegra.c @@ -0,0 +1,64 @@ +/* + * Tegra Virtualized GPU Platform Interface + * + * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#include + +#include "gk20a.h" +#include "hal_gk20a.h" +#include "platform_gk20a.h" + +static int gk20a_tegra_probe(struct platform_device *dev) +{ + struct gk20a_platform *platform = gk20a_get_platform(dev); + struct device_node *np = dev->dev.of_node; + const __be32 *host1x_ptr; + struct platform_device *host1x_pdev = NULL; + + host1x_ptr = of_get_property(np, "nvidia,host1x", NULL); + if (host1x_ptr) { + struct device_node *host1x_node = + of_find_node_by_phandle(be32_to_cpup(host1x_ptr)); + + host1x_pdev = of_find_device_by_node(host1x_node); + if (!host1x_pdev) { + dev_warn(&dev->dev, "host1x device not available"); + return -EPROBE_DEFER; + } + + } else { + host1x_pdev = to_platform_device(dev->dev.parent); + dev_warn(&dev->dev, "host1x reference not found. assuming host1x to be parent"); + } + + platform->g->host1x_dev = host1x_pdev; + + return 0; +} + +struct gk20a_platform vgpu_tegra_platform = { + .has_syncpoints = true, + + /* power management configuration */ + .can_railgate = false, + .enable_slcg = false, + .enable_blcg = false, + .enable_elcg = false, + .enable_elpg = false, + .enable_aelpg = false, + + .probe = gk20a_tegra_probe, + + .virtual_dev = true, +}; -- cgit v1.2.2