summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Zhao <rizhao@nvidia.com>2018-01-29 19:15:58 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2018-02-27 17:30:20 -0500
commit0e39ad429e8aa68cd11e464cd76a8b9d1912fb7d (patch)
treef0e0e5b082d59333aea7276375b1b1c15f05b0c4
parent26f22226bad5b31ec57938bad17cc1e1c1d60343 (diff)
gpu: nvgpu: vgpu: move to nvgpu_err/info from dev_err/info
It helps code be more portable. Jira EVLR-2364 Change-Id: I0cc1fa739d7884d3c863975f08b3b592acd34613 Signed-off-by: Richard Zhao <rizhao@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1649941 Reviewed-by: Aingara Paramakuru <aparamakuru@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Nirav Patel <nipatel@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.c11
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c9
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c6
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/mm_vgpu.c8
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c12
-rw-r--r--drivers/gpu/nvgpu/common/linux/vgpu/vgpu.h11
6 files changed, 23 insertions, 34 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.c
index 3e493506..f7e24382 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/fecs_trace_vgpu.c
@@ -54,7 +54,7 @@ int vgpu_fecs_trace_init(struct gk20a *g)
54 err = of_parse_phandle_with_fixed_args(np, 54 err = of_parse_phandle_with_fixed_args(np,
55 "mempool-fecs-trace", 1, 0, &args); 55 "mempool-fecs-trace", 1, 0, &args);
56 if (err) { 56 if (err) {
57 dev_info(dev_from_gk20a(g), "does not support fecs trace\n"); 57 nvgpu_info(g, "does not support fecs trace");
58 goto fail; 58 goto fail;
59 } 59 }
60 __nvgpu_set_enabled(g, NVGPU_SUPPORT_FECS_CTXSW_TRACE, true); 60 __nvgpu_set_enabled(g, NVGPU_SUPPORT_FECS_CTXSW_TRACE, true);
@@ -62,8 +62,8 @@ int vgpu_fecs_trace_init(struct gk20a *g)
62 mempool = args.args[0]; 62 mempool = args.args[0];
63 vcst->cookie = vgpu_ivm_mempool_reserve(mempool); 63 vcst->cookie = vgpu_ivm_mempool_reserve(mempool);
64 if (IS_ERR(vcst->cookie)) { 64 if (IS_ERR(vcst->cookie)) {
65 dev_info(dev_from_gk20a(g), 65 nvgpu_info(g,
66 "mempool %u reserve failed\n", mempool); 66 "mempool %u reserve failed", mempool);
67 vcst->cookie = NULL; 67 vcst->cookie = NULL;
68 err = -EINVAL; 68 err = -EINVAL;
69 goto fail; 69 goto fail;
@@ -72,15 +72,14 @@ int vgpu_fecs_trace_init(struct gk20a *g)
72 vcst->buf = ioremap_cache(vgpu_ivm_get_ipa(vcst->cookie), 72 vcst->buf = ioremap_cache(vgpu_ivm_get_ipa(vcst->cookie),
73 vgpu_ivm_get_size(vcst->cookie)); 73 vgpu_ivm_get_size(vcst->cookie));
74 if (!vcst->buf) { 74 if (!vcst->buf) {
75 dev_info(dev_from_gk20a(g), "ioremap_cache failed\n"); 75 nvgpu_info(g, "ioremap_cache failed");
76 err = -EINVAL; 76 err = -EINVAL;
77 goto fail; 77 goto fail;
78 } 78 }
79 vcst->header = vcst->buf; 79 vcst->header = vcst->buf;
80 vcst->num_entries = vcst->header->num_ents; 80 vcst->num_entries = vcst->header->num_ents;
81 if (unlikely(vcst->header->ent_size != sizeof(*vcst->entries))) { 81 if (unlikely(vcst->header->ent_size != sizeof(*vcst->entries))) {
82 dev_err(dev_from_gk20a(g), 82 nvgpu_err(g, "entry size mismatch");
83 "entry size mismatch\n");
84 goto fail; 83 goto fail;
85 } 84 }
86 vcst->entries = vcst->buf + sizeof(*vcst->header); 85 vcst->entries = vcst->buf + sizeof(*vcst->header);
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c
index e8ca9d2f..2a7cfdb3 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c
@@ -147,7 +147,6 @@ int vgpu_channel_setup_ramfc(struct channel_gk20a *ch, u64 gpfifo_base,
147 u32 gpfifo_entries, 147 u32 gpfifo_entries,
148 unsigned long acquire_timeout, u32 flags) 148 unsigned long acquire_timeout, u32 flags)
149{ 149{
150 struct device __maybe_unused *d = dev_from_gk20a(ch->g);
151 struct tegra_vgpu_cmd_msg msg; 150 struct tegra_vgpu_cmd_msg msg;
152 struct tegra_vgpu_ramfc_params *p = &msg.params.ramfc; 151 struct tegra_vgpu_ramfc_params *p = &msg.params.ramfc;
153 int err; 152 int err;
@@ -211,7 +210,6 @@ int vgpu_fifo_init_engine_info(struct fifo_gk20a *f)
211static int init_runlist(struct gk20a *g, struct fifo_gk20a *f) 210static int init_runlist(struct gk20a *g, struct fifo_gk20a *f)
212{ 211{
213 struct fifo_runlist_info_gk20a *runlist; 212 struct fifo_runlist_info_gk20a *runlist;
214 struct device *d = dev_from_gk20a(g);
215 unsigned int runlist_id = -1; 213 unsigned int runlist_id = -1;
216 u32 i; 214 u32 i;
217 u64 runlist_size; 215 u64 runlist_size;
@@ -242,7 +240,7 @@ static int init_runlist(struct gk20a *g, struct fifo_gk20a *f)
242 int err = nvgpu_dma_alloc_sys(g, runlist_size, 240 int err = nvgpu_dma_alloc_sys(g, runlist_size,
243 &runlist->mem[i]); 241 &runlist->mem[i]);
244 if (err) { 242 if (err) {
245 dev_err(d, "memory allocation failed\n"); 243 nvgpu_err(g, "memory allocation failed");
246 goto clean_up_runlist; 244 goto clean_up_runlist;
247 } 245 }
248 } 246 }
@@ -266,7 +264,6 @@ static int vgpu_init_fifo_setup_sw(struct gk20a *g)
266{ 264{
267 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); 265 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
268 struct fifo_gk20a *f = &g->fifo; 266 struct fifo_gk20a *f = &g->fifo;
269 struct device *d = dev_from_gk20a(g);
270 struct vgpu_priv_data *priv = vgpu_get_priv_data(g); 267 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
271 unsigned int chid; 268 unsigned int chid;
272 int err = 0; 269 int err = 0;
@@ -287,7 +284,7 @@ static int vgpu_init_fifo_setup_sw(struct gk20a *g)
287 err = nvgpu_dma_alloc_sys(g, f->userd_entry_size * f->num_channels, 284 err = nvgpu_dma_alloc_sys(g, f->userd_entry_size * f->num_channels,
288 &f->userd); 285 &f->userd);
289 if (err) { 286 if (err) {
290 dev_err(d, "memory allocation failed\n"); 287 nvgpu_err(g, "memory allocation failed");
291 goto clean_up; 288 goto clean_up;
292 } 289 }
293 290
@@ -296,7 +293,7 @@ static int vgpu_init_fifo_setup_sw(struct gk20a *g)
296 f->userd.gpu_va = vgpu_bar1_map(g, &f->userd.priv.sgt, 293 f->userd.gpu_va = vgpu_bar1_map(g, &f->userd.priv.sgt,
297 f->userd.size); 294 f->userd.size);
298 if (!f->userd.gpu_va) { 295 if (!f->userd.gpu_va) {
299 dev_err(d, "gmmu mapping failed\n"); 296 nvgpu_err(g, "gmmu mapping failed");
300 goto clean_up; 297 goto clean_up;
301 } 298 }
302 /* if reduced BAR1 range is specified, use offset of 0 299 /* if reduced BAR1 range is specified, use offset of 0
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c
index 4d796f67..e293517f 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c
@@ -35,12 +35,12 @@ static int gv11b_vgpu_probe(struct device *dev)
35 35
36 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "usermode"); 36 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "usermode");
37 if (!r) { 37 if (!r) {
38 dev_err(dev, "failed to get usermode regs\n"); 38 nvgpu_err(g, "failed to get usermode regs");
39 return -ENXIO; 39 return -ENXIO;
40 } 40 }
41 regs = devm_ioremap_resource(dev, r); 41 regs = devm_ioremap_resource(dev, r);
42 if (IS_ERR(regs)) { 42 if (IS_ERR(regs)) {
43 dev_err(dev, "failed to map usermode regs\n"); 43 nvgpu_err(g, "failed to map usermode regs");
44 return PTR_ERR(regs); 44 return PTR_ERR(regs);
45 } 45 }
46 l->usermode_regs = regs; 46 l->usermode_regs = regs;
@@ -56,7 +56,7 @@ static int gv11b_vgpu_probe(struct device *dev)
56 &g->syncpt_unit_base, 56 &g->syncpt_unit_base,
57 &g->syncpt_unit_size); 57 &g->syncpt_unit_size);
58 if (ret) { 58 if (ret) {
59 dev_err(dev, "Failed to get syncpt interface"); 59 nvgpu_err(g, "Failed to get syncpt interface");
60 return -ENOSYS; 60 return -ENOSYS;
61 } 61 }
62 g->syncpt_size = nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(1); 62 g->syncpt_size = nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(1);
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/mm_vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/mm_vgpu.c
index fe6c2e82..7290c9df 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/mm_vgpu.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/mm_vgpu.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Virtualized GPU Memory Management 2 * Virtualized GPU Memory Management
3 * 3 *
4 * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -98,8 +98,7 @@ void vgpu_locked_gmmu_unmap(struct vm_gk20a *vm,
98 if (va_allocated) { 98 if (va_allocated) {
99 err = __nvgpu_vm_free_va(vm, vaddr, pgsz_idx); 99 err = __nvgpu_vm_free_va(vm, vaddr, pgsz_idx);
100 if (err) { 100 if (err) {
101 dev_err(dev_from_vm(vm), 101 nvgpu_err(g, "failed to free va");
102 "failed to free va");
103 return; 102 return;
104 } 103 }
105 } 104 }
@@ -110,8 +109,7 @@ void vgpu_locked_gmmu_unmap(struct vm_gk20a *vm,
110 p->gpu_va = vaddr; 109 p->gpu_va = vaddr;
111 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); 110 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg));
112 if (err || msg.ret) 111 if (err || msg.ret)
113 dev_err(dev_from_vm(vm), 112 nvgpu_err(g, "failed to update gmmu ptes on unmap");
114 "failed to update gmmu ptes on unmap");
115 113
116 /* TLB invalidate handled on server side */ 114 /* TLB invalidate handled on server side */
117} 115}
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c
index 046401a6..7cf161e0 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.c
@@ -685,29 +685,29 @@ int vgpu_probe(struct platform_device *pdev)
685 err = platform->probe(dev); 685 err = platform->probe(dev);
686 if (err) { 686 if (err) {
687 if (err == -EPROBE_DEFER) 687 if (err == -EPROBE_DEFER)
688 dev_info(dev, "platform probe failed"); 688 nvgpu_info(gk20a, "platform probe failed");
689 else 689 else
690 dev_err(dev, "platform probe failed"); 690 nvgpu_err(gk20a, "platform probe failed");
691 return err; 691 return err;
692 } 692 }
693 693
694 if (platform->late_probe) { 694 if (platform->late_probe) {
695 err = platform->late_probe(dev); 695 err = platform->late_probe(dev);
696 if (err) { 696 if (err) {
697 dev_err(dev, "late probe failed"); 697 nvgpu_err(gk20a, "late probe failed");
698 return err; 698 return err;
699 } 699 }
700 } 700 }
701 701
702 err = vgpu_comm_init(gk20a); 702 err = vgpu_comm_init(gk20a);
703 if (err) { 703 if (err) {
704 dev_err(dev, "failed to init comm interface\n"); 704 nvgpu_err(gk20a, "failed to init comm interface");
705 return -ENOSYS; 705 return -ENOSYS;
706 } 706 }
707 707
708 priv->virt_handle = vgpu_connect(); 708 priv->virt_handle = vgpu_connect();
709 if (!priv->virt_handle) { 709 if (!priv->virt_handle) {
710 dev_err(dev, "failed to connect to server node\n"); 710 nvgpu_err(gk20a, "failed to connect to server node");
711 vgpu_comm_deinit(); 711 vgpu_comm_deinit();
712 return -ENOSYS; 712 return -ENOSYS;
713 } 713 }
@@ -720,7 +720,7 @@ int vgpu_probe(struct platform_device *pdev)
720 720
721 err = vgpu_pm_init(dev); 721 err = vgpu_pm_init(dev);
722 if (err) { 722 if (err) {
723 dev_err(dev, "pm init failed"); 723 nvgpu_err(gk20a, "pm init failed");
724 return err; 724 return err;
725 } 725 }
726 726
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.h b/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.h
index e9a73baf..be999930 100644
--- a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.h
+++ b/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.h
@@ -53,23 +53,18 @@ static inline struct vgpu_priv_data *vgpu_get_priv_data(struct gk20a *g)
53 return vgpu_get_priv_data_from_dev(dev_from_gk20a(g)); 53 return vgpu_get_priv_data_from_dev(dev_from_gk20a(g));
54} 54}
55 55
56static inline u64 vgpu_get_handle_from_dev(struct device *dev) 56static inline u64 vgpu_get_handle(struct gk20a *g)
57{ 57{
58 struct vgpu_priv_data *priv = vgpu_get_priv_data_from_dev(dev); 58 struct vgpu_priv_data *priv = vgpu_get_priv_data(g);
59 59
60 if (unlikely(!priv)) { 60 if (unlikely(!priv)) {
61 dev_err(dev, "invalid vgpu_priv_data in %s\n", __func__); 61 nvgpu_err(g, "invalid vgpu_priv_data in %s", __func__);
62 return INT_MAX; 62 return INT_MAX;
63 } 63 }
64 64
65 return priv->virt_handle; 65 return priv->virt_handle;
66} 66}
67 67
68static inline u64 vgpu_get_handle(struct gk20a *g)
69{
70 return vgpu_get_handle_from_dev(dev_from_gk20a(g));
71}
72
73int vgpu_pm_prepare_poweroff(struct device *dev); 68int vgpu_pm_prepare_poweroff(struct device *dev);
74int vgpu_pm_finalize_poweron(struct device *dev); 69int vgpu_pm_finalize_poweron(struct device *dev);
75int vgpu_probe(struct platform_device *dev); 70int vgpu_probe(struct platform_device *dev);