From ecc3722aa1d7cd439035b0895781930871008a82 Mon Sep 17 00:00:00 2001 From: Richard Zhao Date: Wed, 28 Dec 2016 14:44:59 -0800 Subject: gpu: nvgpu: vgpu: restructure event handling Take interrupts as one kind of event message, and make it easier to add new kind of events. JIRA VFND-3291 Bug 200257899 Change-Id: I83482293230c0aa10b05caf61e249a042bf6653c Signed-off-by: Richard Zhao Reviewed-on: http://git-master/r/1278396 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Aingara Paramakuru Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/vgpu/vgpu.c | 53 +++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 25 deletions(-) (limited to 'drivers/gpu/nvgpu/vgpu/vgpu.c') diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c index 213f6bbb..da79de9d 100644 --- a/drivers/gpu/nvgpu/vgpu/vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/vgpu.c @@ -1,7 +1,7 @@ /* * Virtualized GPU * - * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. + * 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, @@ -102,12 +102,12 @@ int vgpu_get_attribute(u64 handle, u32 attrib, u32 *value) return 0; } -static void vgpu_handle_general_event(struct gk20a *g, - struct tegra_vgpu_general_event_info *info) +static void vgpu_handle_channel_event(struct gk20a *g, + struct tegra_vgpu_channel_event_info *info) { if (info->id >= g->fifo.num_channels || info->event_id >= NVGPU_IOCTL_CHANNEL_EVENT_ID_MAX) { - gk20a_err(g->dev, "invalid general event"); + gk20a_err(g->dev, "invalid channel event"); return; } @@ -152,30 +152,33 @@ static int vgpu_intr_thread(void *dev_id) break; } - if (msg->event == TEGRA_VGPU_EVENT_FECS_TRACE) { + switch (msg->event) { + case TEGRA_VGPU_EVENT_INTR: + if (msg->unit == TEGRA_VGPU_INTR_GR) + vgpu_gr_isr(g, &msg->info.gr_intr); + else if (msg->unit == TEGRA_VGPU_NONSTALL_INTR_GR) + vgpu_gr_nonstall_isr(g, + &msg->info.gr_nonstall_intr); + else if (msg->unit == TEGRA_VGPU_INTR_FIFO) + vgpu_fifo_isr(g, &msg->info.fifo_intr); + else if (msg->unit == TEGRA_VGPU_NONSTALL_INTR_FIFO) + vgpu_fifo_nonstall_isr(g, + &msg->info.fifo_nonstall_intr); + else if (msg->unit == TEGRA_VGPU_NONSTALL_INTR_CE2) + vgpu_ce2_nonstall_isr(g, + &msg->info.ce2_nonstall_intr); + break; + case TEGRA_VGPU_EVENT_FECS_TRACE: vgpu_fecs_trace_data_update(g); - tegra_gr_comm_release(handle); - continue; - } - - if (msg->event == TEGRA_VGPU_EVENT_CHANNEL) { - vgpu_handle_general_event(g, &msg->info.general_event); - tegra_gr_comm_release(handle); - continue; + break; + case TEGRA_VGPU_EVENT_CHANNEL: + vgpu_handle_channel_event(g, &msg->info.channel_event); + break; + default: + gk20a_err(g->dev, "unknown event %u", msg->event); + break; } - if (msg->unit == TEGRA_VGPU_INTR_GR) - vgpu_gr_isr(g, &msg->info.gr_intr); - else if (msg->unit == TEGRA_VGPU_NONSTALL_INTR_GR) - vgpu_gr_nonstall_isr(g, &msg->info.gr_nonstall_intr); - else if (msg->unit == TEGRA_VGPU_INTR_FIFO) - vgpu_fifo_isr(g, &msg->info.fifo_intr); - else if (msg->unit == TEGRA_VGPU_NONSTALL_INTR_FIFO) - vgpu_fifo_nonstall_isr(g, - &msg->info.fifo_nonstall_intr); - else if (msg->unit == TEGRA_VGPU_NONSTALL_INTR_CE2) - vgpu_ce2_nonstall_isr(g, &msg->info.ce2_nonstall_intr); - tegra_gr_comm_release(handle); } -- cgit v1.2.2