summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/nvgpu/vgpu/fifo_vgpu.c53
-rw-r--r--drivers/gpu/nvgpu/vgpu/gr_vgpu.c71
-rw-r--r--drivers/gpu/nvgpu/vgpu/vgpu.c4
-rw-r--r--drivers/gpu/nvgpu/vgpu/vgpu.h12
-rw-r--r--include/linux/tegra_vgpu.h24
5 files changed, 128 insertions, 36 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c
index 24b9f4be..45d956a2 100644
--- a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Virtualized GPU Fifo 2 * Virtualized GPU Fifo
3 * 3 *
4 * Copyright (c) 2014 NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2015, 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,
@@ -551,6 +551,57 @@ static int vgpu_fifo_wait_engine_idle(struct gk20a *g)
551 return 0; 551 return 0;
552} 552}
553 553
554static void vgpu_fifo_set_ctx_mmu_error(struct gk20a *g,
555 struct channel_gk20a *ch)
556{
557 if (ch->error_notifier) {
558 if (ch->error_notifier->status == 0xffff) {
559 /* If error code is already set, this mmu fault
560 * was triggered as part of recovery from other
561 * error condition.
562 * Don't overwrite error flag. */
563 } else {
564 gk20a_set_error_notifier(ch,
565 NVGPU_CHANNEL_FIFO_ERROR_MMU_ERR_FLT);
566 }
567 }
568 /* mark channel as faulted */
569 ch->has_timedout = true;
570 wmb();
571 /* unblock pending waits */
572 wake_up(&ch->semaphore_wq);
573 wake_up(&ch->notifier_wq);
574 wake_up(&ch->submit_wq);
575}
576
577int vgpu_fifo_isr(struct gk20a *g, struct tegra_vgpu_fifo_intr_info *info)
578{
579 struct fifo_gk20a *f = &g->fifo;
580 struct channel_gk20a *ch = &f->channel[info->chid];
581
582 gk20a_err(dev_from_gk20a(g), "fifo intr (%d) on ch %u",
583 info->type, info->chid);
584
585 switch (info->type) {
586 case TEGRA_VGPU_FIFO_INTR_PBDMA:
587 gk20a_set_error_notifier(ch, NVGPU_CHANNEL_PBDMA_ERROR);
588 break;
589 case TEGRA_VGPU_FIFO_INTR_CTXSW_TIMEOUT:
590 gk20a_set_error_notifier(ch,
591 NVGPU_CHANNEL_FIFO_ERROR_IDLE_TIMEOUT);
592 break;
593 case TEGRA_VGPU_FIFO_INTR_MMU_FAULT:
594 gk20a_channel_abort(ch);
595 vgpu_fifo_set_ctx_mmu_error(g, ch);
596 break;
597 default:
598 WARN_ON(1);
599 break;
600 }
601
602 return 0;
603}
604
554void vgpu_init_fifo_ops(struct gpu_ops *gops) 605void vgpu_init_fifo_ops(struct gpu_ops *gops)
555{ 606{
556 gops->fifo.bind_channel = vgpu_channel_bind; 607 gops->fifo.bind_channel = vgpu_channel_bind;
diff --git a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
index b1a8027e..aac097d9 100644
--- a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Virtualized GPU Graphics 2 * Virtualized GPU Graphics
3 * 3 *
4 * Copyright (c) 2014 NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2015, 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,
@@ -668,38 +668,51 @@ int vgpu_init_gr_support(struct gk20a *g)
668 return vgpu_gr_init_gr_setup_sw(g); 668 return vgpu_gr_init_gr_setup_sw(g);
669} 669}
670 670
671struct gr_isr_data {
672 u32 addr;
673 u32 data_lo;
674 u32 data_hi;
675 u32 curr_ctx;
676 u32 chid;
677 u32 offset;
678 u32 sub_chan;
679 u32 class_num;
680};
681
682static int vgpu_gr_handle_notify_pending(struct gk20a *g,
683 struct gr_isr_data *isr_data)
684{
685 struct fifo_gk20a *f = &g->fifo;
686 struct channel_gk20a *ch = &f->channel[isr_data->chid];
687
688 gk20a_dbg_fn("");
689 wake_up(&ch->notifier_wq);
690 return 0;
691}
692
693int vgpu_gr_isr(struct gk20a *g, struct tegra_vgpu_gr_intr_info *info) 671int vgpu_gr_isr(struct gk20a *g, struct tegra_vgpu_gr_intr_info *info)
694{ 672{
695 struct gr_isr_data isr_data; 673 struct fifo_gk20a *f = &g->fifo;
674 struct channel_gk20a *ch = &f->channel[info->chid];
696 675
697 gk20a_dbg_fn(""); 676 gk20a_dbg_fn("");
698 677 if (info->type != TEGRA_VGPU_GR_INTR_NOTIFY)
699 isr_data.chid = info->chid; 678 gk20a_err(dev_from_gk20a(g), "gr intr (%d) on ch %u",
700 679 info->type, info->chid);
701 if (info->type == TEGRA_VGPU_GR_INTR_NOTIFY) 680
702 vgpu_gr_handle_notify_pending(g, &isr_data); 681 switch (info->type) {
682 case TEGRA_VGPU_GR_INTR_NOTIFY:
683 wake_up(&ch->notifier_wq);
684 break;
685 case TEGRA_VGPU_GR_INTR_SEMAPHORE_TIMEOUT:
686 gk20a_set_error_notifier(ch,
687 NVGPU_CHANNEL_GR_SEMAPHORE_TIMEOUT);
688 break;
689 case TEGRA_VGPU_GR_INTR_ILLEGAL_NOTIFY:
690 gk20a_set_error_notifier(ch,
691 NVGPU_CHANNEL_GR_ILLEGAL_NOTIFY);
692 case TEGRA_VGPU_GR_INTR_ILLEGAL_METHOD:
693 break;
694 case TEGRA_VGPU_GR_INTR_ILLEGAL_CLASS:
695 gk20a_set_error_notifier(ch,
696 NVGPU_CHANNEL_GR_ERROR_SW_NOTIFY);
697 break;
698 case TEGRA_VGPU_GR_INTR_FECS_ERROR:
699 break;
700 case TEGRA_VGPU_GR_INTR_CLASS_ERROR:
701 gk20a_set_error_notifier(ch,
702 NVGPU_CHANNEL_GR_ERROR_SW_NOTIFY);
703 break;
704 case TEGRA_VGPU_GR_INTR_FIRMWARE_METHOD:
705 gk20a_set_error_notifier(ch,
706 NVGPU_CHANNEL_GR_ERROR_SW_NOTIFY);
707 break;
708 case TEGRA_VGPU_GR_INTR_EXCEPTION:
709 gk20a_set_error_notifier(ch,
710 NVGPU_CHANNEL_GR_ERROR_SW_NOTIFY);
711 break;
712 default:
713 WARN_ON(1);
714 break;
715 }
703 716
704 return 0; 717 return 0;
705} 718}
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c
index 36d65ee8..d3d793d1 100644
--- a/drivers/gpu/nvgpu/vgpu/vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/vgpu.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Virtualized GPU 2 * Virtualized GPU
3 * 3 *
4 * Copyright (c) 2014-2015 NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2015, 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,
@@ -114,6 +114,8 @@ static int vgpu_intr_thread(void *dev_id)
114 114
115 if (msg->unit == TEGRA_VGPU_INTR_GR) 115 if (msg->unit == TEGRA_VGPU_INTR_GR)
116 vgpu_gr_isr(g, &msg->info.gr_intr); 116 vgpu_gr_isr(g, &msg->info.gr_intr);
117 else if (msg->unit == TEGRA_VGPU_INTR_FIFO)
118 vgpu_fifo_isr(g, &msg->info.fifo_intr);
117 119
118 tegra_gr_comm_release(handle); 120 tegra_gr_comm_release(handle);
119 } 121 }
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.h b/drivers/gpu/nvgpu/vgpu/vgpu.h
index 4677b36c..1a7ef7ba 100644
--- a/drivers/gpu/nvgpu/vgpu/vgpu.h
+++ b/drivers/gpu/nvgpu/vgpu/vgpu.h
@@ -27,6 +27,7 @@ int vgpu_probe(struct platform_device *dev);
27int vgpu_remove(struct platform_device *dev); 27int vgpu_remove(struct platform_device *dev);
28u64 vgpu_bar1_map(struct gk20a *g, struct sg_table **sgt, u64 size); 28u64 vgpu_bar1_map(struct gk20a *g, struct sg_table **sgt, u64 size);
29int vgpu_gr_isr(struct gk20a *g, struct tegra_vgpu_gr_intr_info *info); 29int vgpu_gr_isr(struct gk20a *g, struct tegra_vgpu_gr_intr_info *info);
30int vgpu_fifo_isr(struct gk20a *g, struct tegra_vgpu_fifo_intr_info *info);
30void vgpu_init_fifo_ops(struct gpu_ops *gops); 31void vgpu_init_fifo_ops(struct gpu_ops *gops);
31void vgpu_init_gr_ops(struct gpu_ops *gops); 32void vgpu_init_gr_ops(struct gpu_ops *gops);
32void vgpu_init_ltc_ops(struct gpu_ops *gops); 33void vgpu_init_ltc_ops(struct gpu_ops *gops);
@@ -56,11 +57,18 @@ static inline int vgpu_remove(struct platform_device *dev)
56{ 57{
57 return -ENOSYS; 58 return -ENOSYS;
58} 59}
59static inline u64 vgpu_bar1_map(struct gk20a *g, struct sg_table **sgt, u64 size) 60static inline u64 vgpu_bar1_map(struct gk20a *g, struct sg_table **sgt,
61 u64 size)
60{ 62{
61 return 0; 63 return 0;
62} 64}
63static inline int vgpu_gr_isr(struct gk20a *g, struct tegra_vgpu_gr_intr_info *info) 65static inline int vgpu_gr_isr(struct gk20a *g,
66 struct tegra_vgpu_gr_intr_info *info)
67{
68 return 0;
69}
70static inline int vgpu_fifo_isr(struct gk20a *g,
71 struct tegra_vgpu_fifo_intr_info *info)
64{ 72{
65 return 0; 73 return 0;
66} 74}
diff --git a/include/linux/tegra_vgpu.h b/include/linux/tegra_vgpu.h
index e0a7ff66..61ffff70 100644
--- a/include/linux/tegra_vgpu.h
+++ b/include/linux/tegra_vgpu.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Tegra GPU Virtualization Interfaces to Server 2 * Tegra GPU Virtualization Interfaces to Server
3 * 3 *
4 * Copyright (c) 2014, NVIDIA Corporation. All rights reserved. 4 * Copyright (c) 2014-2015, 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,
@@ -210,7 +210,18 @@ struct tegra_vgpu_cmd_msg {
210}; 210};
211 211
212enum { 212enum {
213 TEGRA_VGPU_GR_INTR_NOTIFY = 0 213 TEGRA_VGPU_GR_INTR_NOTIFY = 0,
214 TEGRA_VGPU_GR_INTR_SEMAPHORE_TIMEOUT,
215 TEGRA_VGPU_GR_INTR_ILLEGAL_NOTIFY,
216 TEGRA_VGPU_GR_INTR_ILLEGAL_METHOD,
217 TEGRA_VGPU_GR_INTR_ILLEGAL_CLASS,
218 TEGRA_VGPU_GR_INTR_FECS_ERROR,
219 TEGRA_VGPU_GR_INTR_CLASS_ERROR,
220 TEGRA_VGPU_GR_INTR_FIRMWARE_METHOD,
221 TEGRA_VGPU_GR_INTR_EXCEPTION,
222 TEGRA_VGPU_FIFO_INTR_PBDMA,
223 TEGRA_VGPU_FIFO_INTR_CTXSW_TIMEOUT,
224 TEGRA_VGPU_FIFO_INTR_MMU_FAULT
214}; 225};
215 226
216struct tegra_vgpu_gr_intr_info { 227struct tegra_vgpu_gr_intr_info {
@@ -218,8 +229,14 @@ struct tegra_vgpu_gr_intr_info {
218 u32 chid; 229 u32 chid;
219}; 230};
220 231
232struct tegra_vgpu_fifo_intr_info {
233 u32 type;
234 u32 chid;
235};
236
221enum { 237enum {
222 TEGRA_VGPU_INTR_GR = 0 238 TEGRA_VGPU_INTR_GR = 0,
239 TEGRA_VGPU_INTR_FIFO
223}; 240};
224 241
225enum { 242enum {
@@ -232,6 +249,7 @@ struct tegra_vgpu_intr_msg {
232 u32 unit; 249 u32 unit;
233 union { 250 union {
234 struct tegra_vgpu_gr_intr_info gr_intr; 251 struct tegra_vgpu_gr_intr_info gr_intr;
252 struct tegra_vgpu_fifo_intr_info fifo_intr;
235 } info; 253 } info;
236}; 254};
237 255