mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-25 02:52:51 +03:00
gpu: nvgpu: Move secure_alloc to struct gk20a
Move the function pointer for VPR page allocation to struct gk20a and use it from there. At the same time remove secure_page_alloc pointer and add a direct call to it in probe. Move platform_tegra.h as tegra/linux/platform_gk20a_tegra.h, as it's only declaring functions defined in platform_gk20a_tegra.c to other files in the same directory. JIRA NVGPU-16 Change-Id: I19ac9ee0b2f6734203ae32a1f51d67fd51aced9f Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1473706 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
c3fa78b1d9
commit
bd68f98ba7
@@ -110,6 +110,8 @@ static void gk20a_tegra_secure_page_destroy(struct device *dev,
|
||||
dma_free_attrs(&tegra_vpr_dev, secure_buffer->size,
|
||||
(void *)(uintptr_t)secure_buffer->iova,
|
||||
secure_buffer->iova, __DMA_ATTR(attrs));
|
||||
|
||||
secure_buffer->destroy = NULL;
|
||||
}
|
||||
|
||||
int gk20a_tegra_secure_page_alloc(struct device *dev)
|
||||
@@ -153,7 +155,7 @@ static void gk20a_tegra_secure_destroy(struct gk20a *g,
|
||||
}
|
||||
}
|
||||
|
||||
int gk20a_tegra_secure_alloc(struct device *dev,
|
||||
static int gk20a_tegra_secure_alloc(struct device *dev,
|
||||
struct gr_ctx_buffer_desc *desc,
|
||||
size_t size)
|
||||
{
|
||||
@@ -164,9 +166,6 @@ int gk20a_tegra_secure_alloc(struct device *dev,
|
||||
struct page *page;
|
||||
int err = 0;
|
||||
|
||||
if (!platform->secure_alloc_ready)
|
||||
return -EINVAL;
|
||||
|
||||
dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, __DMA_ATTR(attrs));
|
||||
(void)dma_alloc_attrs(&tegra_vpr_dev, size, &iova,
|
||||
GFP_KERNEL, __DMA_ATTR(attrs));
|
||||
@@ -194,6 +193,9 @@ int gk20a_tegra_secure_alloc(struct device *dev,
|
||||
desc->mem.size = size;
|
||||
desc->mem.aperture = APERTURE_SYSMEM;
|
||||
|
||||
if (platform->secure_buffer.destroy)
|
||||
platform->secure_buffer.destroy(dev, &platform->secure_buffer);
|
||||
|
||||
return err;
|
||||
|
||||
fail_sgt:
|
||||
@@ -896,6 +898,11 @@ void gk20a_tegra_idle(struct device *dev)
|
||||
#endif
|
||||
}
|
||||
|
||||
void gk20a_tegra_init_secure_alloc(struct gk20a *g)
|
||||
{
|
||||
g->ops.mm.secure_alloc = gk20a_tegra_secure_alloc;
|
||||
}
|
||||
|
||||
static int gk20a_tegra_probe(struct device *dev)
|
||||
{
|
||||
struct gk20a_platform *platform = dev_get_drvdata(dev);
|
||||
@@ -974,6 +981,7 @@ static int gk20a_tegra_probe(struct device *dev)
|
||||
|
||||
gk20a_tegra_get_clocks(dev);
|
||||
nvgpu_linux_init_clk_support(platform->g);
|
||||
gk20a_tegra_init_secure_alloc(platform->g);
|
||||
|
||||
if (platform->clk_register) {
|
||||
ret = platform->clk_register(platform->g);
|
||||
@@ -988,8 +996,11 @@ static int gk20a_tegra_probe(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gk20a_tegra_late_probe(struct device *dev)
|
||||
int gk20a_tegra_late_probe(struct device *dev)
|
||||
{
|
||||
/* Cause early VPR resize */
|
||||
gk20a_tegra_secure_page_alloc(dev);
|
||||
|
||||
/* Initialise tegra specific scaling quirks */
|
||||
gk20a_tegra_scale_init(dev);
|
||||
|
||||
@@ -1085,8 +1096,6 @@ struct gk20a_platform gk20a_tegra_platform = {
|
||||
.devfreq_governor = "nvhost_podgov",
|
||||
.qos_notify = gk20a_scale_qos_notify,
|
||||
|
||||
.secure_alloc = gk20a_tegra_secure_alloc,
|
||||
.secure_page_alloc = gk20a_tegra_secure_page_alloc,
|
||||
.dump_platform_dependencies = gk20a_tegra_debug_dump,
|
||||
|
||||
.soc_name = "tegra12x",
|
||||
@@ -1157,8 +1166,6 @@ struct gk20a_platform gm20b_tegra_platform = {
|
||||
.devfreq_governor = "nvhost_podgov",
|
||||
.qos_notify = gk20a_scale_qos_notify,
|
||||
|
||||
.secure_alloc = gk20a_tegra_secure_alloc,
|
||||
.secure_page_alloc = gk20a_tegra_secure_page_alloc,
|
||||
.dump_platform_dependencies = gk20a_tegra_debug_dump,
|
||||
|
||||
.has_cde = true,
|
||||
|
||||
25
drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.h
Normal file
25
drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* GK20A Platform (SoC) Interface
|
||||
*
|
||||
* Copyright (c) 2014-2017, 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.
|
||||
*/
|
||||
|
||||
#ifndef _NVGPU_PLATFORM_GK20A_TEGRA_H_
|
||||
#define _NVGPU_PLATFORM_GK20A_TEGRA_H_
|
||||
|
||||
struct device;
|
||||
struct gk20a;
|
||||
|
||||
void gk20a_tegra_init_secure_alloc(struct gk20a *g);
|
||||
int gk20a_tegra_secure_page_alloc(struct device *dev);
|
||||
|
||||
#endif
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "gk20a/gk20a.h"
|
||||
#include "gk20a/gk20a_scale.h"
|
||||
|
||||
#include "platform_tegra.h"
|
||||
#include "platform_gk20a_tegra.h"
|
||||
#include "gp10b/gp10b_sysfs.h"
|
||||
#include "gp10b/platform_gp10b.h"
|
||||
|
||||
@@ -163,12 +163,16 @@ static int gp10b_tegra_probe(struct device *dev)
|
||||
|
||||
gp10b_tegra_get_clocks(dev);
|
||||
nvgpu_linux_init_clk_support(platform->g);
|
||||
gk20a_tegra_init_secure_alloc(platform->g);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gp10b_tegra_late_probe(struct device *dev)
|
||||
{
|
||||
/* Cause early VPR resize */
|
||||
gk20a_tegra_secure_page_alloc(dev);
|
||||
|
||||
/*Create GP10B specific sysfs*/
|
||||
gp10b_create_sysfs(dev);
|
||||
|
||||
@@ -423,9 +427,6 @@ struct gk20a_platform gp10b_tegra_platform = {
|
||||
|
||||
.qos_notify = gk20a_scale_qos_notify,
|
||||
|
||||
.secure_alloc = gk20a_tegra_secure_alloc,
|
||||
.secure_page_alloc = gk20a_tegra_secure_page_alloc,
|
||||
|
||||
.reset_assert = gp10b_tegra_reset_assert,
|
||||
.reset_deassert = gp10b_tegra_reset_deassert,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user