Support for Tegra 2D hardware
Subsystems (7)
cover Support for Tegra 2D hardware
This set of patches adds support for Tegra20 and Tegra30 host1x and 2D. It is based on Thierry Reding's tegra/next branch.
nvhost is the driver that controls host1x hardware. It supports host1x command channels, synchronization, run-time power management and memory management.
The patch set removes responsibility of host1x from tegradrm. At the same time, it moves all drm related infrastructure in host1x.c to other files.
The patch set also adds user space API to tegradrm for accessing features provided by nvhost to tegradrm. We have prepared also patches to libdrm, but they are not yet ready for sending out.
Please note that IOMMU support has effectively been disabled in this patch. The problem with IOMMU is that we should put all host1x devices under the same address space, but we haven't found a nice way of doing that in case of multiple drivers.
Arto Merilainen (3):
gpu: drm: tegra: Remove redundant host1x
gpu: drm: tegra: Free platform data on remove
gpu: drm: tegra: Prime support
Terje Bergstrom (3):
video: tegra: Add nvhost driver
ARM: tegra: Add auxiliary data for nvhost
drm: tegra: Add gr2d device
arch/arm/mach-tegra/board-dt-tegra20.c | 38 +- arch/arm/mach-tegra/board-dt-tegra30.c | 38 +- arch/arm/mach-tegra/tegra20_clocks_data.c | 8 +- arch/arm/mach-tegra/tegra30_clocks_data.c | 2 + drivers/gpu/drm/tegra/Kconfig | 8 +- drivers/gpu/drm/tegra/Makefile | 4 +- drivers/gpu/drm/tegra/dc.c | 25 +- drivers/gpu/drm/tegra/dmabuf.c | 150 ++++++ drivers/gpu/drm/tegra/drm.c | 444 ++++++++++++++-- drivers/gpu/drm/tegra/drm.h | 89 ++-- drivers/gpu/drm/tegra/dsi.c | 27 +- drivers/gpu/drm/tegra/fb.c | 26 +- drivers/gpu/drm/tegra/gr2d.c | 225 +++++++++ drivers/gpu/drm/tegra/hdmi.c | 27 +- drivers/gpu/drm/tegra/host1x.c | 343 ------------- drivers/gpu/drm/tegra/tvo.c | 36 +- drivers/video/Kconfig | 2 + drivers/video/Makefile | 2 + drivers/video/tegra/host/Kconfig | 20 + drivers/video/tegra/host/Makefile | 21 + drivers/video/tegra/host/bus_client.c | 101 ++++ drivers/video/tegra/host/bus_client.h | 32 ++ drivers/video/tegra/host/chip_support.c | 68 +++ drivers/video/tegra/host/chip_support.h | 179 +++++++ drivers/video/tegra/host/debug.c | 255 ++++++++++ drivers/video/tegra/host/debug.h | 50 ++ drivers/video/tegra/host/dev.c | 104 ++++ drivers/video/tegra/host/dev.h | 33 ++ drivers/video/tegra/host/dmabuf.c | 151 ++++++ drivers/video/tegra/host/dmabuf.h | 51 ++ drivers/video/tegra/host/host1x/Makefile | 6 + drivers/video/tegra/host/host1x/host1x.c | 320 ++++++++++++ drivers/video/tegra/host/host1x/host1x.h | 97 ++++ .../video/tegra/host/host1x/host1x01_hardware.h | 157 ++++++ drivers/video/tegra/host/host1x/host1x_cdma.c | 488 ++++++++++++++++++ drivers/video/tegra/host/host1x/host1x_cdma.h | 39 ++ drivers/video/tegra/host/host1x/host1x_channel.c | 157 ++++++ drivers/video/tegra/host/host1x/host1x_debug.c | 405 +++++++++++++++ drivers/video/tegra/host/host1x/host1x_intr.c | 263 ++++++++++ drivers/video/tegra/host/host1x/host1x_syncpt.c | 170 +++++++ .../video/tegra/host/host1x/hw_host1x01_channel.h | 182 +++++++ drivers/video/tegra/host/host1x/hw_host1x01_sync.h | 398 +++++++++++++++ .../video/tegra/host/host1x/hw_host1x01_uclass.h | 474 +++++++++++++++++ drivers/video/tegra/host/nvhost_acm.c | 532 ++++++++++++++++++++ drivers/video/tegra/host/nvhost_acm.h | 49 ++ drivers/video/tegra/host/nvhost_cdma.c | 473 +++++++++++++++++ drivers/video/tegra/host/nvhost_cdma.h | 116 +++++ drivers/video/tegra/host/nvhost_channel.c | 129 +++++ drivers/video/tegra/host/nvhost_channel.h | 65 +++ drivers/video/tegra/host/nvhost_intr.c | 391 ++++++++++++++ drivers/video/tegra/host/nvhost_intr.h | 110 ++++ drivers/video/tegra/host/nvhost_job.c | 398 +++++++++++++++ drivers/video/tegra/host/nvhost_memmgr.c | 252 ++++++++++ drivers/video/tegra/host/nvhost_memmgr.h | 66 +++ drivers/video/tegra/host/nvhost_syncpt.c | 453 +++++++++++++++++ drivers/video/tegra/host/nvhost_syncpt.h | 148 ++++++ drivers/video/tegra/host/t20/Makefile | 6 + drivers/video/tegra/host/t20/t20.c | 78 +++ drivers/video/tegra/host/t20/t20.h | 29 ++ drivers/video/tegra/host/t30/Makefile | 6 + drivers/video/tegra/host/t30/t30.c | 80 +++ drivers/video/tegra/host/t30/t30.h | 29 ++ include/drm/tegra_drm.h | 129 +++++ include/linux/nvhost.h | 302 +++++++++++ include/trace/events/nvhost.h | 249 +++++++++ 65 files changed, 9295 insertions(+), 510 deletions(-) create mode 100644 drivers/gpu/drm/tegra/dmabuf.c create mode 100644 drivers/gpu/drm/tegra/gr2d.c delete mode 100644 drivers/gpu/drm/tegra/host1x.c create mode 100644 drivers/video/tegra/host/Kconfig create mode 100644 drivers/video/tegra/host/Makefile create mode 100644 drivers/video/tegra/host/bus_client.c create mode 100644 drivers/video/tegra/host/bus_client.h create mode 100644 drivers/video/tegra/host/chip_support.c create mode 100644 drivers/video/tegra/host/chip_support.h create mode 100644 drivers/video/tegra/host/debug.c create mode 100644 drivers/video/tegra/host/debug.h create mode 100644 drivers/video/tegra/host/dev.c create mode 100644 drivers/video/tegra/host/dev.h create mode 100644 drivers/video/tegra/host/dmabuf.c create mode 100644 drivers/video/tegra/host/dmabuf.h create mode 100644 drivers/video/tegra/host/host1x/Makefile create mode 100644 drivers/video/tegra/host/host1x/host1x.c create mode 100644 drivers/video/tegra/host/host1x/host1x.h create mode 100644 drivers/video/tegra/host/host1x/host1x01_hardware.h create mode 100644 drivers/video/tegra/host/host1x/host1x_cdma.c create mode 100644 drivers/video/tegra/host/host1x/host1x_cdma.h create mode 100644 drivers/video/tegra/host/host1x/host1x_channel.c create mode 100644 drivers/video/tegra/host/host1x/host1x_debug.c create mode 100644 drivers/video/tegra/host/host1x/host1x_intr.c create mode 100644 drivers/video/tegra/host/host1x/host1x_syncpt.c create mode 100644 drivers/video/tegra/host/host1x/hw_host1x01_channel.h create mode 100644 drivers/video/tegra/host/host1x/hw_host1x01_sync.h create mode 100644 drivers/video/tegra/host/host1x/hw_host1x01_uclass.h create mode 100644 drivers/video/tegra/host/nvhost_acm.c create mode 100644 drivers/video/tegra/host/nvhost_acm.h create mode 100644 drivers/video/tegra/host/nvhost_cdma.c create mode 100644 drivers/video/tegra/host/nvhost_cdma.h create mode 100644 drivers/video/tegra/host/nvhost_channel.c create mode 100644 drivers/video/tegra/host/nvhost_channel.h create mode 100644 drivers/video/tegra/host/nvhost_intr.c create mode 100644 drivers/video/tegra/host/nvhost_intr.h create mode 100644 drivers/video/tegra/host/nvhost_job.c create mode 100644 drivers/video/tegra/host/nvhost_memmgr.c create mode 100644 drivers/video/tegra/host/nvhost_memmgr.h create mode 100644 drivers/video/tegra/host/nvhost_syncpt.c create mode 100644 drivers/video/tegra/host/nvhost_syncpt.h create mode 100644 drivers/video/tegra/host/t20/Makefile create mode 100644 drivers/video/tegra/host/t20/t20.c create mode 100644 drivers/video/tegra/host/t20/t20.h create mode 100644 drivers/video/tegra/host/t30/Makefile create mode 100644 drivers/video/tegra/host/t30/t30.c create mode 100644 drivers/video/tegra/host/t30/t30.h create mode 100644 include/drm/tegra_drm.h create mode 100644 include/linux/nvhost.h create mode 100644 include/trace/events/nvhost.h
Signature · 1 line
1.7.9.5
PATCH 1/6 video: tegra: Add nvhost driver
In reply to a message not in the archiveAdd nvhost, the driver for host1x and 2D, which is a client device for host1x.
--- drivers/video/Kconfig | 2 + drivers/video/Makefile | 2 + drivers/video/tegra/host/Kconfig | 20 + drivers/video/tegra/host/Makefile | 21 + drivers/video/tegra/host/bus_client.c | 101 ++++ drivers/video/tegra/host/bus_client.h | 32 ++ drivers/video/tegra/host/chip_support.c | 68 +++ drivers/video/tegra/host/chip_support.h | 179 +++++++ drivers/video/tegra/host/debug.c | 255 ++++++++++ drivers/video/tegra/host/debug.h | 50 ++ drivers/video/tegra/host/dev.c | 104 ++++ drivers/video/tegra/host/dev.h | 33 ++ drivers/video/tegra/host/dmabuf.c | 151 ++++++ drivers/video/tegra/host/dmabuf.h | 51 ++ drivers/video/tegra/host/host1x/Makefile | 6 + drivers/video/tegra/host/host1x/host1x.c | 320 ++++++++++++ drivers/video/tegra/host/host1x/host1x.h | 97 ++++ .../video/tegra/host/host1x/host1x01_hardware.h | 157 ++++++ drivers/video/tegra/host/host1x/host1x_cdma.c | 488 ++++++++++++++++++ drivers/video/tegra/host/host1x/host1x_cdma.h | 39 ++ drivers/video/tegra/host/host1x/host1x_channel.c | 157 ++++++ drivers/video/tegra/host/host1x/host1x_debug.c | 405 +++++++++++++++ drivers/video/tegra/host/host1x/host1x_intr.c | 263 ++++++++++ drivers/video/tegra/host/host1x/host1x_syncpt.c | 170 +++++++ .../video/tegra/host/host1x/hw_host1x01_channel.h | 182 +++++++ drivers/video/tegra/host/host1x/hw_host1x01_sync.h | 398 +++++++++++++++ .../video/tegra/host/host1x/hw_host1x01_uclass.h | 474 +++++++++++++++++ drivers/video/tegra/host/nvhost_acm.c | 532 ++++++++++++++++++++ drivers/video/tegra/host/nvhost_acm.h | 49 ++ drivers/video/tegra/host/nvhost_cdma.c | 473 +++++++++++++++++ drivers/video/tegra/host/nvhost_cdma.h | 116 +++++ drivers/video/tegra/host/nvhost_channel.c | 129 +++++ drivers/video/tegra/host/nvhost_channel.h | 65 +++ drivers/video/tegra/host/nvhost_intr.c | 391 ++++++++++++++ drivers/video/tegra/host/nvhost_intr.h | 110 ++++ drivers/video/tegra/host/nvhost_job.c | 398 +++++++++++++++ drivers/video/tegra/host/nvhost_memmgr.c | 252 ++++++++++ drivers/video/tegra/host/nvhost_memmgr.h | 66 +++ drivers/video/tegra/host/nvhost_syncpt.c | 453 +++++++++++++++++ drivers/video/tegra/host/nvhost_syncpt.h | 148 ++++++ drivers/video/tegra/host/t20/Makefile | 6 + drivers/video/tegra/host/t20/t20.c | 78 +++ drivers/video/tegra/host/t20/t20.h | 29 ++ drivers/video/tegra/host/t30/Makefile | 6 + drivers/video/tegra/host/t30/t30.c | 80 +++ drivers/video/tegra/host/t30/t30.h | 29 ++ include/linux/nvhost.h | 302 +++++++++++ include/trace/events/nvhost.h | 249 +++++++++ 48 files changed, 8186 insertions(+) create mode 100644 drivers/video/tegra/host/Kconfig create mode 100644 drivers/video/tegra/host/Makefile create mode 100644 drivers/video/tegra/host/bus_client.c create mode 100644 drivers/video/tegra/host/bus_client.h create mode 100644 drivers/video/tegra/host/chip_support.c create mode 100644 drivers/video/tegra/host/chip_support.h create mode 100644 drivers/video/tegra/host/debug.c create mode 100644 drivers/video/tegra/host/debug.h create mode 100644 drivers/video/tegra/host/dev.c create mode 100644 drivers/video/tegra/host/dev.h create mode 100644 drivers/video/tegra/host/dmabuf.c create mode 100644 drivers/video/tegra/host/dmabuf.h create mode 100644 drivers/video/tegra/host/host1x/Makefile create mode 100644 drivers/video/tegra/host/host1x/host1x.c create mode 100644 drivers/video/tegra/host/host1x/host1x.h create mode 100644 drivers/video/tegra/host/host1x/host1x01_hardware.h create mode 100644 drivers/video/tegra/host/host1x/host1x_cdma.c create mode 100644 drivers/video/tegra/host/host1x/host1x_cdma.h create mode 100644 drivers/video/tegra/host/host1x/host1x_channel.c create mode 100644 drivers/video/tegra/host/host1x/host1x_debug.c create mode 100644 drivers/video/tegra/host/host1x/host1x_intr.c create mode 100644 drivers/video/tegra/host/host1x/host1x_syncpt.c create mode 100644 drivers/video/tegra/host/host1x/hw_host1x01_channel.h create mode 100644 drivers/video/tegra/host/host1x/hw_host1x01_sync.h create mode 100644 drivers/video/tegra/host/host1x/hw_host1x01_uclass.h create mode 100644 drivers/video/tegra/host/nvhost_acm.c create mode 100644 drivers/video/tegra/host/nvhost_acm.h create mode 100644 drivers/video/tegra/host/nvhost_cdma.c create mode 100644 drivers/video/tegra/host/nvhost_cdma.h create mode 100644 drivers/video/tegra/host/nvhost_channel.c create mode 100644 drivers/video/tegra/host/nvhost_channel.h create mode 100644 drivers/video/tegra/host/nvhost_intr.c create mode 100644 drivers/video/tegra/host/nvhost_intr.h create mode 100644 drivers/video/tegra/host/nvhost_job.c create mode 100644 drivers/video/tegra/host/nvhost_memmgr.c create mode 100644 drivers/video/tegra/host/nvhost_memmgr.h create mode 100644 drivers/video/tegra/host/nvhost_syncpt.c create mode 100644 drivers/video/tegra/host/nvhost_syncpt.h create mode 100644 drivers/video/tegra/host/t20/Makefile create mode 100644 drivers/video/tegra/host/t20/t20.c create mode 100644 drivers/video/tegra/host/t20/t20.h create mode 100644 drivers/video/tegra/host/t30/Makefile create mode 100644 drivers/video/tegra/host/t30/t30.c create mode 100644 drivers/video/tegra/host/t30/t30.h create mode 100644 include/linux/nvhost.h create mode 100644 include/trace/events/nvhost.h
drivers/video/Kconfig +2 -0
@@ -2463,4 +2463,6 @@ config FB_SH_MOBILE_MERAM Up to 4 memory channels can be configured, allowing 4 RGB or 2 YCbCr framebuffers to be configured. +source "drivers/video/tegra/host/Kconfig" + endmenu
drivers/video/Makefile +2 -0
@@ -17,6 +17,8 @@ obj-y += backlight/ obj-$(CONFIG_EXYNOS_VIDEO) += exynos/ +obj-$(CONFIG_TEGRA_GRHOST) += tegra/host/ + obj-$(CONFIG_FB_CFB_FILLRECT) += cfbfillrect.o obj-$(CONFIG_FB_CFB_COPYAREA) += cfbcopyarea.o obj-$(CONFIG_FB_CFB_IMAGEBLIT) += cfbimgblt.o
drivers/video/tegra/host/Kconfig new file +20 -0
@@ -0,0 +1,20 @@ +config TEGRA_GRHOST + tristate "Tegra graphics host driver" + help + Driver for the Tegra graphics host hardware. + +config TEGRA_GRHOST_USE_DMABUF + depends on TEGRA_GRHOST + bool "Support dmabuf buffers" + default y + select DMA_SHARED_BUFFER + help + Support dmabuf buffers. + +config TEGRA_GRHOST_DEFAULT_TIMEOUT + depends on TEGRA_GRHOST + int "Default timeout for submits" + default 10000 + help + Default timeout for jobs in milliseconds. Set to zero for no timeout. +
drivers/video/tegra/host/Makefile new file +21 -0
@@ -0,0 +1,21 @@ +ccflags-y = -Idrivers/video/tegra/host -Iarch/arm/mach-tegra + +nvhost-objs = \ + nvhost_acm.o \ + nvhost_syncpt.o \ + nvhost_cdma.o \ + nvhost_intr.o \ + nvhost_channel.o \ + nvhost_job.o \ + dev.o \ + debug.o \ + bus_client.o \ + chip_support.o \ + nvhost_memmgr.o + +obj-$(CONFIG_TEGRA_GRHOST) += host1x/ +obj-$(CONFIG_TEGRA_GRHOST) += t20/ +obj-$(CONFIG_TEGRA_GRHOST) += t30/ +obj-$(CONFIG_TEGRA_GRHOST) += nvhost.o + +obj-$(CONFIG_TEGRA_GRHOST_USE_DMABUF) += dmabuf.o
drivers/video/tegra/host/bus_client.c new file +101 -0
101 lines not on this page · raw message
drivers/video/tegra/host/bus_client.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* drivers/video/tegra/host/bus_client.h +* +* Tegra Graphics Host client +* +* Copyright (c) 2010-2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __NVHOST_BUS_CLIENT_H +#define __NVHOST_BUS_CLIENT_H + +#include <linux/types.h> + +struct platform_device ; + +int nvhost_client_device_init (struct platform_device *dev); + +int nvhost_client_device_suspend (struct platform_device *dev); + +#endif
drivers/video/tegra/host/chip_support.c new file +68 -0
68 lines not on this page · raw message
drivers/video/tegra/host/chip_support.h new file +179 -0
179 lines not on this page · raw message
drivers/video/tegra/host/debug.c new file +255 -0
255 lines not on this page · raw message
drivers/video/tegra/host/debug.h new file +50 -0
50 lines not on this page · raw message
drivers/video/tegra/host/dev.c new file +104 -0
104 lines not on this page · raw message
drivers/video/tegra/host/dev.h new file +33 -0
@@ -0,0 +1,33 @@ +/* +* drivers/video/tegra/host/dev.h +* +* Copyright (c) 2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef NVHOST_DEV_H +#define NVHOST_DEV_H + +#include "host1x/host1x.h" + +struct platform_device ; + +void nvhost_device_list_init (void ); +int nvhost_device_list_add (struct platform_device *pdev); +void nvhost_device_list_for_all (void *data, +int (*fptr)(struct platform_device *pdev,void *fdata)); +struct platform_device *nvhost_device_list_match_by_id (u32 id); +void nvhost_device_list_remove (struct platform_device *pdev); + +#endif
drivers/video/tegra/host/dmabuf.c new file +151 -0
151 lines not on this page · raw message
drivers/video/tegra/host/dmabuf.h new file +51 -0
51 lines not on this page · raw message
drivers/video/tegra/host/host1x/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +ccflags-y = -Idrivers/video/tegra/host + +nvhost-host1x-objs = \ + host1x.o + +obj-$(CONFIG_TEGRA_GRHOST) += nvhost-host1x.o
drivers/video/tegra/host/host1x/host1x.c new file +320 -0
320 lines not on this page · raw message
drivers/video/tegra/host/host1x/host1x.h new file +97 -0
97 lines not on this page · raw message
drivers/video/tegra/host/host1x/host1x01_hardware.h new file +157 -0
157 lines not on this page · raw message
drivers/video/tegra/host/host1x/host1x_cdma.c new file +488 -0
488 lines not on this page · raw message
drivers/video/tegra/host/host1x/host1x_cdma.h new file +39 -0
@@ -0,0 +1,39 @@ +/* +* drivers/video/tegra/host/host1x/host1x_cdma.h +* +* Tegra Graphics Host Command DMA +* +* Copyright (c) 2011-2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __NVHOST_HOST1X_HOST1X_CDMA_H +#define __NVHOST_HOST1X_HOST1X_CDMA_H + +/* Size of the sync queue. If it is too small, we won't be able to queue up +* many command buffers. If it is too large, we waste memory. */ +#define NVHOST_SYNC_QUEUE_SIZE 512 + +/* Number of gathers we allow to be queued up per channel. Must be a +* power of two. Currently sized such that pushbuffer is 4KB (512*8B). */ +#define NVHOST_GATHER_QUEUE_SIZE 512 + +/* 8 bytes per slot. (This number does not include the final RESTART.) */ +#define PUSH_BUFFER_SIZE (NVHOST_GATHER_QUEUE_SIZE * 8) + +/* 4K page containing GATHERed methods to increment channel syncpts +* and replaces the original timed out contexts GATHER slots */ +#define SYNCPT_INCR_BUFFER_SIZE_WORDS (4096 / sizeof(u32)) + +#endif
drivers/video/tegra/host/host1x/host1x_channel.c new file +157 -0
157 lines not on this page · raw message
drivers/video/tegra/host/host1x/host1x_debug.c new file +405 -0
405 lines not on this page · raw message
drivers/video/tegra/host/host1x/host1x_intr.c new file +263 -0
252 lines not on this page · raw message
drivers/video/tegra/host/host1x/host1x_syncpt.c new file +170 -0
170 lines not on this page · raw message
drivers/video/tegra/host/host1x/hw_host1x01_channel.h new file +182 -0
182 lines not on this page · raw message
drivers/video/tegra/host/host1x/hw_host1x01_sync.h new file +398 -0
398 lines not on this page · raw message
drivers/video/tegra/host/host1x/hw_host1x01_uclass.h new file +474 -0
474 lines not on this page · raw message
drivers/video/tegra/host/nvhost_acm.c new file +532 -0
532 lines not on this page · raw message
drivers/video/tegra/host/nvhost_acm.h new file +49 -0
49 lines not on this page · raw message
drivers/video/tegra/host/nvhost_cdma.c new file +473 -0
473 lines not on this page · raw message
drivers/video/tegra/host/nvhost_cdma.h new file +116 -0
116 lines not on this page · raw message
drivers/video/tegra/host/nvhost_channel.c new file +129 -0
129 lines not on this page · raw message
drivers/video/tegra/host/nvhost_channel.h new file +65 -0
65 lines not on this page · raw message
drivers/video/tegra/host/nvhost_intr.c new file +391 -0
391 lines not on this page · raw message
drivers/video/tegra/host/nvhost_intr.h new file +110 -0
110 lines not on this page · raw message
drivers/video/tegra/host/nvhost_job.c new file +398 -0
398 lines not on this page · raw message
drivers/video/tegra/host/nvhost_memmgr.c new file +252 -0
252 lines not on this page · raw message
drivers/video/tegra/host/nvhost_memmgr.h new file +66 -0
66 lines not on this page · raw message
drivers/video/tegra/host/nvhost_syncpt.c new file +453 -0
453 lines not on this page · raw message
drivers/video/tegra/host/nvhost_syncpt.h new file +148 -0
148 lines not on this page · raw message
drivers/video/tegra/host/t20/Makefile new file +6 -0
Lines of this file are not shown. View the raw message.
drivers/video/tegra/host/t20/t20.c new file +78 -0
78 lines not on this page · raw message
drivers/video/tegra/host/t20/t20.h new file +29 -0
Lines of this file are not shown. View the raw message.
drivers/video/tegra/host/t30/Makefile new file +6 -0
Lines of this file are not shown. View the raw message.
drivers/video/tegra/host/t30/t30.c new file +80 -0
80 lines not on this page · raw message
drivers/video/tegra/host/t30/t30.h new file +29 -0
Lines of this file are not shown. View the raw message.
include/linux/nvhost.h new file +302 -0
302 lines not on this page · raw message
include/trace/events/nvhost.h new file +249 -0
249 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.9.5
Part of the diff is not shown here. View the raw message.
PATCH 2/6 ARM: tegra: Add auxiliary data for nvhost
In reply to a message not in the archiveAdd SoC specific auxiliary data to host1x and gr2d. nvhost uses this data.
--- arch/arm/mach-tegra/board-dt-tegra20.c | 38 ++++++++++++++++++++++++++++- arch/arm/mach-tegra/board-dt-tegra30.c | 38 ++++++++++++++++++++++++++++- arch/arm/mach-tegra/tegra20_clocks_data.c | 8 +++--- arch/arm/mach-tegra/tegra30_clocks_data.c | 2 ++ 4 files changed, 80 insertions(+), 6 deletions(-)
arch/arm/mach-tegra/board-dt-tegra20.c +37 -1
@@ -33,6 +33,7 @@#include <linux/i2c.h> #include <linux/i2c-tegra.h> #include <linux/usb/tegra_usb_phy.h> +#include <linux/nvhost.h> #include <asm/hardware/gic.h> #include <asm/mach-types.h>
@@ -45,6 +46,38 @@#include "common.h" #include "iomap.h" +static const char *host1x_syncpt_names[32 ] = { + [0 ] ="gfx_host" , + [NVSYNCPT_2D_0 ] ="2d_0" , + [NVSYNCPT_2D_1 ] ="2d_1" , + [NVSYNCPT_VBLANK0 ] ="vblank0" , + [NVSYNCPT_VBLANK1 ] ="vblank1" , +}; + +static struct host1x_device_info host1x_info = { + .nb_channels =8 , + .nb_pts =32 , + .nb_mlocks =16 , + .nb_bases =8 , + .syncpt_names = host1x_syncpt_names, + .client_managed =NVSYNCPTS_CLIENT_MANAGED , +}; + +static struct nvhost_device_data tegra_host1x_info = { + .clocks = { {"host1x" ,UINT_MAX } }, +NVHOST_MODULE_NO_POWERGATE_IDS , + .private_data = &host1x_info, +}; + +static struct nvhost_device_data tegra_gr2d_info = { + .index =2 , + .syncpts =BIT (NVSYNCPT_2D_0 ) |BIT (NVSYNCPT_2D_1 ), + .clocks = { {"gr2d" ,UINT_MAX , true}, {"epp" ,UINT_MAX , true} }, +NVHOST_MODULE_NO_POWERGATE_IDS , + .clockgate_delay =0 , + .serialize = true, +}; +struct tegra_ehci_platform_data tegra_ehci1_pdata = { .operating_mode =TEGRA_USB_OTG , .power_down_on_bus_suspend =1 ,
@@ -94,13 +127,16 @@ struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {OF_DEV_AUXDATA ("nvidia,tegra20-slink" ,0x7000D600 ,"spi_tegra.1" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-slink" ,0x7000D800 ,"spi_tegra.2" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-slink" ,0x7000DA00 ,"spi_tegra.3" ,NULL ), -OF_DEV_AUXDATA ("nvidia,tegra20-host1x" ,0x50000000 ,"host1x" ,NULL ), +OF_DEV_AUXDATA ("nvidia,tegra20-host1x" ,0x50000000 ,"host1x" , + &tegra_host1x_info),OF_DEV_AUXDATA ("nvidia,tegra20-dc" ,0x54200000 ,"tegradc.0" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-dc" ,0x54240000 ,"tegradc.1" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-hdmi" ,0x54280000 ,"hdmi" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-dsi" ,0x54300000 ,"dsi" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-tvo" ,0x542c0000 ,"tvo" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-nand" ,0x70008000 ,"tegra-nand" ,NULL ), +OF_DEV_AUXDATA ("nvidia,tegra20-gr2d" ,0x54140000 ,"tegra-gr2d" , + &tegra_gr2d_info), {} };
arch/arm/mach-tegra/board-dt-tegra30.c +37 -1
@@ -29,6 +29,7 @@#include <linux/of_fdt.h> #include <linux/of_irq.h> #include <linux/of_platform.h> +#include <linux/nvhost.h> #include <asm/mach/arch.h> #include <asm/hardware/gic.h>
@@ -38,6 +39,38 @@#include "common.h" #include "iomap.h" +static const char *host1x_syncpt_names[32 ] = { + [0 ] ="gfx_host" , + [NVSYNCPT_2D_0 ] ="2d_0" , + [NVSYNCPT_2D_1 ] ="2d_1" , + [NVSYNCPT_VBLANK0 ] ="vblank0" , + [NVSYNCPT_VBLANK1 ] ="vblank1" , +}; + +static struct host1x_device_info host1x_info = { + .nb_channels =8 , + .nb_pts =32 , + .nb_mlocks =16 , + .nb_bases =8 , + .syncpt_names = host1x_syncpt_names, + .client_managed =NVSYNCPTS_CLIENT_MANAGED , +}; + +static struct nvhost_device_data tegra_host1x_info = { + .clocks = { {"host1x" ,UINT_MAX } }, +NVHOST_MODULE_NO_POWERGATE_IDS , + .private_data = &host1x_info, +}; + +static struct nvhost_device_data tegra_gr2d_info = { + .index =2 , + .syncpts =BIT (NVSYNCPT_2D_0 ) |BIT (NVSYNCPT_2D_1 ), + .clocks = { {"gr2d" ,UINT_MAX , true}, {"epp" ,UINT_MAX , true} }, +NVHOST_MODULE_NO_POWERGATE_IDS , + .clockgate_delay =0 , + .serialize = true, +}; +struct of_dev_auxdata tegra30_auxdata_lookup[]__initdata = {OF_DEV_AUXDATA ("nvidia,tegra20-sdhci" ,0x78000000 ,"sdhci-tegra.0" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-sdhci" ,0x78000200 ,"sdhci-tegra.1" ,NULL ),
@@ -57,12 +90,15 @@ struct of_dev_auxdata tegra30_auxdata_lookup[] __initdata = {OF_DEV_AUXDATA ("nvidia,tegra30-slink" ,0x7000DA00 ,"spi_tegra.3" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra30-slink" ,0x7000DC00 ,"spi_tegra.4" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra30-slink" ,0x7000DE00 ,"spi_tegra.5" ,NULL ), -OF_DEV_AUXDATA ("nvidia,tegra30-host1x" ,0x50000000 ,"host1x" ,NULL ), +OF_DEV_AUXDATA ("nvidia,tegra30-host1x" ,0x50000000 ,"host1x" , + &tegra_host1x_info),OF_DEV_AUXDATA ("nvidia,tegra30-dc" ,0x54200000 ,"tegradc.0" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra30-dc" ,0x54240000 ,"tegradc.1" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra30-hdmi" ,0x54280000 ,"hdmi" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra30-dsi" ,0x54300000 ,"dsi" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra30-tvo" ,0x542c0000 ,"tvo" ,NULL ), +OF_DEV_AUXDATA ("nvidia,tegra30-gr2d" ,0x54140000 ,"gr2d" , + &tegra_gr2d_info), {} };
arch/arm/mach-tegra/tegra20_clocks_data.c +4 -4
@@ -1041,10 +1041,10 @@ static struct clk_duplicate tegra_clk_duplicates[] = {CLK_DUPLICATE ("usbd" ,"utmip-pad" ,NULL ),CLK_DUPLICATE ("usbd" ,"tegra-ehci.0" ,NULL ),CLK_DUPLICATE ("usbd" ,"tegra-otg" ,NULL ), -CLK_DUPLICATE ("2d" ,"tegra_grhost" ,"gr2d" ), -CLK_DUPLICATE ("3d" ,"tegra_grhost" ,"gr3d" ), -CLK_DUPLICATE ("epp" ,"tegra_grhost" ,"epp" ), -CLK_DUPLICATE ("mpe" ,"tegra_grhost" ,"mpe" ), +CLK_DUPLICATE ("2d" ,NULL ,"gr2d" ), +CLK_DUPLICATE ("3d" ,NULL ,"gr3d" ), +CLK_DUPLICATE ("epp" ,NULL ,"epp" ), +CLK_DUPLICATE ("mpe" ,NULL ,"mpe" ),CLK_DUPLICATE ("cop" ,"tegra-avp" ,"cop" ),CLK_DUPLICATE ("vde" ,"tegra-aes" ,"vde" ), CLK_DUPLICATE("cclk", NULL, "cpu"),
arch/arm/mach-tegra/tegra30_clocks_data.c +2 -0
@@ -1338,6 +1338,8 @@ struct clk_duplicate tegra_clk_duplicates[] = {CLK_DUPLICATE ("pll_p" ,"tegradc.0" ,"parent" ),CLK_DUPLICATE ("pll_p" ,"tegradc.1" ,"parent" ),CLK_DUPLICATE ("pll_d2_out0" ,"hdmi" ,"parent" ), +CLK_DUPLICATE ("2d" ,NULL ,"gr2d" ), + CLK_DUPLICATE("epp", NULL, "epp"), }; struct clk *tegra_ptr_clks[] = {
Signature · 1 line
1.7.9.5
PATCH 3/6 gpu: drm: tegra: Remove redundant host1x
In reply to a message not in the archiveFrom: Arto Merilainen <[email protected]>
This patch removes the redundant host1x driver from tegradrm and makes necessary bindings to the separate host driver.
This modification introduces a regression: Because there is no general framework for attaching separate devices into the same address space, this patch removes the ability to use IOMMU in tegradrm.
--- drivers/gpu/drm/tegra/Kconfig | 8 +- drivers/gpu/drm/tegra/Makefile | 2 +- drivers/gpu/drm/tegra/dc.c | 22 +-- drivers/gpu/drm/tegra/drm.c | 206 +++++++++++++++++++----- drivers/gpu/drm/tegra/drm.h | 55 ++----- drivers/gpu/drm/tegra/dsi.c | 24 ++- drivers/gpu/drm/tegra/fb.c | 26 ++- drivers/gpu/drm/tegra/hdmi.c | 24 ++- drivers/gpu/drm/tegra/host1x.c | 343 ---------------------------------------- drivers/gpu/drm/tegra/tvo.c | 33 ++-- 10 files changed, 245 insertions(+), 498 deletions(-) delete mode 100644 drivers/gpu/drm/tegra/host1x.c
drivers/gpu/drm/tegra/Kconfig +1 -7
@@ -1,6 +1,6 @@ config DRM_TEGRA tristate "NVIDIA Tegra DRM" - depends on DRM && OF && ARCH_TEGRA + depends on DRM && OF && ARCH_TEGRA && TEGRA_GRHOST select DRM_KMS_HELPER select DRM_GEM_CMA_HELPER select DRM_KMS_CMA_HELPER
@@ -20,10 +20,4 @@ config DRM_TEGRA_DEBUG help Say yes here to enable debugging support. -config DRM_TEGRA_IOMMU - bool "NVIDIA Tegra DRM IOMMU support" - help - Say yes here to enable the use of the IOMMU to allocate and - map memory buffers. - endif
drivers/gpu/drm/tegra/Makefile +1 -1
@@ -1,7 +1,7 @@ ccflags-y := -Iinclude/drm ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG -tegra-drm-y := drm.o fb.o dc.o host1x.o +tegra-drm-y := drm.o fb.o dc.o tegra-drm-y += output.o rgb.o hdmi.o tvo.o dsi.o tegra-drm-y += plane.o
drivers/gpu/drm/tegra/dc.c +11 -11
@@ -12,6 +12,7 @@#include <linux/module.h> #include <linux/of.h> #include <linux/platform_device.h> +#include <linux/nvhost.h> #include <mach/clk.h>
@@ -673,10 +674,10 @@ static int tegra_dc_debugfs_exit(struct tegra_dc *dc)return 0 ; } -static int tegra_dc_drm_init (struct host1x_client *client, +static int tegra_dc_drm_init (struct tegra_drm_client *client,struct drm_device *drm) { -struct tegra_dc *dc =host1x_client_to_dc (client); +struct tegra_dc *dc =tegra_drm_client_to_dc (client);int err; dc->pipe = drm->mode_config.num_crtc;
@@ -712,9 +713,9 @@ static int tegra_dc_drm_init(struct host1x_client *client,return 0 ; } -static int tegra_dc_drm_exit (struct host1x_client *client) +static int tegra_dc_drm_exit (struct tegra_drm_client *client) { -struct tegra_dc *dc =host1x_client_to_dc (client); +struct tegra_dc *dc =tegra_drm_client_to_dc (client);int err;devm_free_irq (dc->dev, dc->irq, dc);
@@ -734,14 +735,13 @@ static int tegra_dc_drm_exit(struct host1x_client *client)return 0 ; } -static const struct host1x_client_ops dc_client_ops = { +static const struct tegra_drm_client_ops dc_client_ops = { .drm_init = tegra_dc_drm_init, .drm_exit = tegra_dc_drm_exit, };static int tegra_dc_probe (struct platform_device *pdev) { -struct host1x *host1x =dev_get_drvdata (pdev->dev.parent);struct resource *regs;struct tegra_dc *dc;int err;
@@ -791,13 +791,14 @@ static int tegra_dc_probe(struct platform_device *pdev)return err; } - err =host1x_register_client (host1x, &dc->client); + err =tegra_drm_register_client (&dc->client);if (err <0 ) { -dev_err (&pdev->dev,"failed to register host1x client: %d\n" , +dev_err (&pdev->dev,"failed to register tegra drm client: %d\n" , err);return err; } +nvhost_module_busy_ext (pdev);platform_set_drvdata (pdev, dc);return 0 ;
@@ -805,13 +806,12 @@ static int tegra_dc_probe(struct platform_device *pdev)static int tegra_dc_remove (struct platform_device *pdev) { -struct host1x *host1x =dev_get_drvdata (pdev->dev.parent);struct tegra_dc *dc =platform_get_drvdata (pdev);int err; - err =host1x_unregister_client (host1x, &dc->client); + err =tegra_drm_unregister_client (&dc->client);if (err <0 ) { -dev_err (&pdev->dev,"failed to unregister host1x client: %d\n" , +dev_err (&pdev->dev,"failed to unregister tegra_drm client: %d\n" , err);return err; }
drivers/gpu/drm/tegra/drm.c +167 -39
239 lines not on this page · raw message
drivers/gpu/drm/tegra/drm.h +14 -41
88 lines not on this page · raw message
drivers/gpu/drm/tegra/dsi.c +11 -13
@@ -15,7 +15,7 @@#include "drm.h" struct tegra_dsi { -struct host1x_client client; +struct tegra_drm_client client;struct tegra_output output;void __iomem *regs;
@@ -23,7 +23,7 @@ struct tegra_dsi { };static inline struct tegra_dsi * -host1x_client_to_dsi (struct host1x_client *client) +tegra_drm_client_to_dsi (struct tegra_drm_client *client) { return container_of(client, struct tegra_dsi, client); }
@@ -59,10 +59,10 @@ static const struct tegra_output_ops dsi_ops = { .disable = tegra_output_dsi_disable, }; -static int tegra_dsi_drm_init (struct host1x_client *client, +static int tegra_dsi_drm_init (struct tegra_drm_client *client,struct drm_device *drm) { -struct tegra_dsi *dsi =host1x_client_to_dsi (client); +struct tegra_dsi *dsi =tegra_drm_client_to_dsi (client);int err; dsi->output.type =TEGRA_OUTPUT_DSI ;
@@ -78,9 +78,9 @@ static int tegra_dsi_drm_init(struct host1x_client *client,return 0 ; } -static int tegra_dsi_drm_exit (struct host1x_client *client) +static int tegra_dsi_drm_exit (struct tegra_drm_client *client) { -struct tegra_dsi *dsi =host1x_client_to_dsi (client); +struct tegra_dsi *dsi =tegra_drm_client_to_dsi (client);int err; err =tegra_output_exit (&dsi->output);
@@ -92,14 +92,13 @@ static int tegra_dsi_drm_exit(struct host1x_client *client)return 0 ; } -static const struct host1x_client_ops dsi_client_ops = { +static const struct tegra_drm_client_ops dsi_client_ops = { .drm_init = tegra_dsi_drm_init, .drm_exit = tegra_dsi_drm_exit, };static int tegra_dsi_probe (struct platform_device *pdev) { -struct host1x *host1x =dev_get_drvdata (pdev->dev.parent);struct tegra_dsi *dsi;struct resource *regs;int err;
@@ -126,9 +125,9 @@ static int tegra_dsi_probe(struct platform_device *pdev)INIT_LIST_HEAD (&dsi->client.list); dsi->client.dev = &pdev->dev; - err =host1x_register_client (host1x, &dsi->client); + err =tegra_drm_register_client (&dsi->client);if (err <0 ) { -dev_err (&pdev->dev,"failed to register host1x client: %d\n" , +dev_err (&pdev->dev,"failed to register tegra drm client: %d\n" , err);return err; }
@@ -140,13 +139,12 @@ static int tegra_dsi_probe(struct platform_device *pdev)static int tegra_dsi_remove (struct platform_device *pdev) { -struct host1x *host1x =dev_get_drvdata (pdev->dev.parent);struct tegra_dsi *dsi =platform_get_drvdata (pdev);int err; - err =host1x_unregister_client (host1x, &dsi->client); + err =tegra_drm_unregister_client (&dsi->client);if (err <0 ) { -dev_err (&pdev->dev,"failed to unregister host1x client: %d\n" , +dev_err (&pdev->dev,"failed to unregister tegra drm client: %d\n" , err);return err; }
drivers/gpu/drm/tegra/fb.c +12 -14
@@ -9,11 +9,11 @@#include "drm.h" +static struct drm_fbdev_cma *tegra_fbdev; +static void tegra_drm_fb_output_poll_changed (struct drm_device *drm) { -struct host1x *host1x = drm->dev_private; - -drm_fbdev_cma_hotplug_event (host1x->fbdev); +drm_fbdev_cma_hotplug_event (tegra_fbdev); }static const struct drm_mode_config_funcs tegra_drm_mode_funcs = {
@@ -23,9 +23,6 @@ static const struct drm_mode_config_funcs tegra_drm_mode_funcs = {int tegra_drm_fb_init (struct drm_device *drm) { -struct host1x *host1x = drm->dev_private; -struct drm_fbdev_cma *fbdev; - drm->mode_config.min_width =0 ; drm->mode_config.min_height =0 ;
@@ -34,23 +31,24 @@ int tegra_drm_fb_init(struct drm_device *drm) drm->mode_config.funcs = &tegra_drm_mode_funcs; - fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_crtc, + tegra_fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_crtc, drm->mode_config.num_connector); -if (IS_ERR (fbdev)) -return PTR_ERR (fbdev); +if (IS_ERR (tegra_fbdev)) +return PTR_ERR (tegra_fbdev);#ifndef CONFIG_FRAMEBUFFER_CONSOLE -drm_fbdev_cma_restore_mode (fbdev); +drm_fbdev_cma_restore_mode (tegra_fbdev);#endif - host1x->fbdev = fbdev; -return 0 ; }void tegra_drm_fb_exit (struct drm_device *drm) { -struct host1x *host1x = drm->dev_private; +drm_fbdev_cma_fini (tegra_fbdev); +} -drm_fbdev_cma_fini (host1x->fbdev); +void tegra_drm_fb_restore (struct drm_device *drm) +{ +drm_fbdev_cma_restore_mode (tegra_fbdev); }
drivers/gpu/drm/tegra/hdmi.c +11 -13
@@ -22,7 +22,7 @@#include "dc.h" struct tegra_hdmi { -struct host1x_client client; +struct tegra_drm_client client;struct tegra_output output;struct device *dev;
@@ -46,7 +46,7 @@ struct tegra_hdmi { };static inline struct tegra_hdmi * -host1x_client_to_hdmi (struct host1x_client *client) +tegra_drm_client_to_hdmi (struct tegra_drm_client *client) { return container_of(client, struct tegra_hdmi, client); }
@@ -1152,10 +1152,10 @@ static int tegra_hdmi_debugfs_exit(struct tegra_hdmi *hdmi)return 0 ; } -static int tegra_hdmi_drm_init (struct host1x_client *client, +static int tegra_hdmi_drm_init (struct tegra_drm_client *client,struct drm_device *drm) { -struct tegra_hdmi *hdmi =host1x_client_to_hdmi (client); +struct tegra_hdmi *hdmi =tegra_drm_client_to_hdmi (client);int err; hdmi->output.type =TEGRA_OUTPUT_HDMI ;
@@ -1177,9 +1177,9 @@ static int tegra_hdmi_drm_init(struct host1x_client *client,return 0 ; } -static int tegra_hdmi_drm_exit (struct host1x_client *client) +static int tegra_hdmi_drm_exit (struct tegra_drm_client *client) { -struct tegra_hdmi *hdmi =host1x_client_to_hdmi (client); +struct tegra_hdmi *hdmi =tegra_drm_client_to_hdmi (client);int err;if (IS_ENABLED (CONFIG_DEBUG_FS )) {
@@ -1204,14 +1204,13 @@ static int tegra_hdmi_drm_exit(struct host1x_client *client)return 0 ; } -static const struct host1x_client_ops hdmi_client_ops = { +static const struct tegra_drm_client_ops hdmi_client_ops = { .drm_init = tegra_hdmi_drm_init, .drm_exit = tegra_hdmi_drm_exit, };static int tegra_hdmi_probe (struct platform_device *pdev) { -struct host1x *host1x =dev_get_drvdata (pdev->dev.parent);struct tegra_hdmi *hdmi;struct resource *regs;int err;
@@ -1286,9 +1285,9 @@ static int tegra_hdmi_probe(struct platform_device *pdev)INIT_LIST_HEAD (&hdmi->client.list); hdmi->client.dev = &pdev->dev; - err =host1x_register_client (host1x, &hdmi->client); + err =tegra_drm_register_client (&hdmi->client);if (err <0 ) { -dev_err (&pdev->dev,"failed to register host1x client: %d\n" , +dev_err (&pdev->dev,"failed to register tegra drm client: %d\n" , err);return err; }
@@ -1300,13 +1299,12 @@ static int tegra_hdmi_probe(struct platform_device *pdev)static int tegra_hdmi_remove (struct platform_device *pdev) { -struct host1x *host1x =dev_get_drvdata (pdev->dev.parent);struct tegra_hdmi *hdmi =platform_get_drvdata (pdev);int err; - err =host1x_unregister_client (host1x, &hdmi->client); + err =tegra_drm_unregister_client (&hdmi->client);if (err <0 ) { -dev_err (&pdev->dev,"failed to unregister host1x client: %d\n" , +dev_err (&pdev->dev,"failed to unregister tegra drm client: %d\n" , err);return err; }
drivers/gpu/drm/tegra/host1x.c deleted +0 -343
343 lines not on this page · raw message
drivers/gpu/drm/tegra/tvo.c +17 -16
@@ -15,7 +15,7 @@#include "drm.h" struct tegra_tvo { -struct host1x_client client; +struct tegra_drm_client client;struct tegra_output output;void __iomem *regs;
@@ -24,7 +24,7 @@ struct tegra_tvo { };static inline struct tegra_tvo * -host1x_client_to_tvo (struct host1x_client *client) +tegra_drm_client_to_tvo (struct tegra_drm_client *client) { return container_of(client, struct tegra_tvo, client); }
@@ -60,10 +60,10 @@ static const struct tegra_output_ops tvo_ops = { .disable = tegra_output_tvo_disable, }; -static int tegra_tvo_drm_init (struct host1x_client *client, +static int tegra_tvo_drm_init (struct tegra_drm_client *client,struct drm_device *drm) { -struct tegra_tvo *tvo =host1x_client_to_tvo (client); +struct tegra_tvo *tvo =tegra_drm_client_to_tvo (client);int err; tvo->output.type =TEGRA_OUTPUT_TVO ;
@@ -79,9 +79,9 @@ static int tegra_tvo_drm_init(struct host1x_client *client,return 0 ; } -static int tegra_tvo_drm_exit (struct host1x_client *client) +static int tegra_tvo_drm_exit (struct tegra_drm_client *client) { -struct tegra_tvo *tvo =host1x_client_to_tvo (client); +struct tegra_tvo *tvo =tegra_drm_client_to_tvo (client);int err; err =tegra_output_exit (&tvo->output);
@@ -93,14 +93,13 @@ static int tegra_tvo_drm_exit(struct host1x_client *client)return err; } -static const struct host1x_client_ops tvo_client_ops = { +static const struct tegra_drm_client_ops tvo_client_ops = { .drm_init = tegra_tvo_drm_init, .drm_exit = tegra_tvo_drm_exit, };static int tegra_tvo_probe (struct platform_device *pdev) { -struct host1x *host1x =dev_get_drvdata (pdev->dev.parent);struct tegra_tvo *tvo;struct resource *regs;int err;
@@ -120,22 +119,25 @@ static int tegra_tvo_probe(struct platform_device *pdev)return -ENXIO ; err =platform_get_irq (pdev,0 ); -if (err <0 ) +if (err <0 ) { +dev_err (&pdev->dev,"failed to get tvo irq\n" );return err; - + } tvo->irq = err; tvo->regs =devm_request_and_ioremap (&pdev->dev, regs); -if (!tvo->regs) +if (!tvo->regs) { +dev_err (&pdev->dev,"failed to request tvo regs\n" );return -EADDRNOTAVAIL ; + } tvo->client.ops = &tvo_client_ops;INIT_LIST_HEAD (&tvo->client.list); tvo->client.dev = &pdev->dev; - err =host1x_register_client (host1x, &tvo->client); + err =tegra_drm_register_client (&tvo->client);if (err <0 ) { -dev_err (&pdev->dev,"failed to register host1x client: %d\n" , +dev_err (&pdev->dev,"failed to register tegra drm client: %d\n" , err);return err; }
@@ -147,13 +149,12 @@ static int tegra_tvo_probe(struct platform_device *pdev)static int tegra_tvo_remove (struct platform_device *pdev) { -struct host1x *host1x =dev_get_drvdata (pdev->dev.parent);struct tegra_tvo *tvo =platform_get_drvdata (pdev);int err; - err =host1x_unregister_client (host1x, &tvo->client); + err =tegra_drm_unregister_client (&tvo->client);if (err <0 ) { -dev_err (&pdev->dev,"failed to unregister host1x client: %d\n" , +dev_err (&pdev->dev,"failed to unregister tegra drm client: %d\n" , err);return err; }
Signature · 1 line
1.7.9.5
PATCH 4/6 gpu: drm: tegra: Free platform data on remove
In reply to a message not in the archiveFrom: Arto Merilainen <[email protected]>
Platform data was not freed in device removal. This patch adds missing devm_kfree() calls.
--- drivers/gpu/drm/tegra/dc.c | 3 +++ drivers/gpu/drm/tegra/dsi.c | 3 +++ drivers/gpu/drm/tegra/hdmi.c | 3 +++ drivers/gpu/drm/tegra/tvo.c | 3 +++ 4 files changed, 12 insertions(+)
drivers/gpu/drm/tegra/dc.c +3 -0
@@ -818,6 +818,9 @@ static int tegra_dc_remove(struct platform_device *pdev)clk_disable_unprepare (dc->clk); +platform_set_drvdata (pdev,NULL ); +devm_kfree (&pdev->dev, dc); +return 0 ; }
drivers/gpu/drm/tegra/dsi.c +3 -0
@@ -149,6 +149,9 @@ static int tegra_dsi_remove(struct platform_device *pdev)return err; } +platform_set_drvdata (pdev,NULL ); +devm_kfree (&pdev->dev, dsi); +return 0 ; }
drivers/gpu/drm/tegra/hdmi.c +3 -0
@@ -1312,6 +1312,9 @@ static int tegra_hdmi_remove(struct platform_device *pdev)clk_unprepare (hdmi->clk_parent);clk_unprepare (hdmi->clk); +platform_set_drvdata (pdev,NULL ); +devm_kfree (&pdev->dev, hdmi); +return 0 ; }
drivers/gpu/drm/tegra/tvo.c +3 -0
@@ -159,6 +159,9 @@ static int tegra_tvo_remove(struct platform_device *pdev)return err; } +platform_set_drvdata (pdev,NULL ); +devm_kfree (&pdev->dev, tvo); +return 0 ; }
Signature · 1 line
1.7.9.5
PATCH 5/6 gpu: drm: tegra: Prime support
In reply to a message not in the archiveFrom: Arto Merilainen <[email protected]>
This patch introduces support for exporting allocated memory as dmabuf objects. Exported buffers are used for delivering data to nvhost driver.
--- drivers/gpu/drm/tegra/Makefile | 2 +- drivers/gpu/drm/tegra/dmabuf.c | 150 ++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/tegra/drm.c | 9 ++- drivers/gpu/drm/tegra/drm.h | 6 ++ 4 files changed, 165 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/tegra/dmabuf.c
drivers/gpu/drm/tegra/Makefile +1 -1
@@ -3,6 +3,6 @@ ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG tegra-drm-y := drm.o fb.o dc.o tegra-drm-y += output.o rgb.o hdmi.o tvo.o dsi.o -tegra-drm-y += plane.o +tegra-drm-y += plane.o dmabuf.o obj-$(CONFIG_DRM_TEGRA) += tegra-drm.o
drivers/gpu/drm/tegra/dmabuf.c new file +150 -0
150 lines not on this page · raw message
drivers/gpu/drm/tegra/drm.c +8 -1
@@ -250,7 +250,8 @@ static const struct file_operations tegra_drm_fops = { };struct drm_driver tegra_drm_driver = { - .driver_features =DRIVER_BUS_PLATFORM |DRIVER_MODESET |DRIVER_GEM , + .driver_features =DRIVER_BUS_PLATFORM |DRIVER_MODESET |DRIVER_GEM | +DRIVER_PRIME , .load = tegra_drm_load, .unload = tegra_drm_unload, .open = tegra_drm_open,
@@ -266,6 +267,12 @@ struct drm_driver tegra_drm_driver = { .num_ioctls = ARRAY_SIZE(tegra_drm_ioctls), .fops = &tegra_drm_fops, + .prime_handle_to_fd = drm_gem_prime_handle_to_fd, + .prime_fd_to_handle = drm_gem_prime_fd_to_handle, + + .gem_prime_export = tegra_dmabuf_export, + .gem_prime_import = tegra_dmabuf_import, + .name = DRIVER_NAME, .desc = DRIVER_DESC, .date = DRIVER_DATE,
drivers/gpu/drm/tegra/drm.h +6 -0
@@ -227,4 +227,10 @@ extern struct platform_driver tegra_dsi_driver;extern struct platform_driver tegra_dc_driver;extern struct drm_driver tegra_drm_driver; +/* from dmabuf.c */ +struct dma_buf *tegra_dmabuf_export (struct drm_device *drm_dev, +struct drm_gem_object *obj,int flags); +struct drm_gem_object *tegra_dmabuf_import (struct drm_device *drm_dev, +struct dma_buf *dmabuf); +#endif /* TEGRA_DRM_H */
Signature · 1 line
1.7.9.5
PATCH 6/6 drm: tegra: Add gr2d device
In reply to a message not in the archiveAdd client driver for 2D device.
--- drivers/gpu/drm/tegra/Makefile | 2 +- drivers/gpu/drm/tegra/drm.c | 231 +++++++++++++++++++++++++++++++++++++++- drivers/gpu/drm/tegra/drm.h | 42 ++++++-- drivers/gpu/drm/tegra/gr2d.c | 225 ++++++++++++++++++++++++++++++++++++++ include/drm/tegra_drm.h | 129 ++++++++++++++++++++++ 5 files changed, 616 insertions(+), 13 deletions(-) create mode 100644 drivers/gpu/drm/tegra/gr2d.c create mode 100644 include/drm/tegra_drm.h
drivers/gpu/drm/tegra/Makefile +1 -1
@@ -1,7 +1,7 @@ ccflags-y := -Iinclude/drm ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG -tegra-drm-y := drm.o fb.o dc.o +tegra-drm-y := drm.o fb.o dc.o gr2d.o tegra-drm-y += output.o rgb.o hdmi.o tvo.o dsi.o tegra-drm-y += plane.o dmabuf.o
drivers/gpu/drm/tegra/drm.c +229 -2
273 lines not on this page · raw message
drivers/gpu/drm/tegra/drm.h +32 -10
74 lines not on this page · raw message
drivers/gpu/drm/tegra/gr2d.c new file +225 -0
225 lines not on this page · raw message
include/drm/tegra_drm.h new file +129 -0
129 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [PATCH 4/6] gpu: drm: tegra: Free platform data on remove
In reply to a message not in the archiveQuoted 8 lines · Terje Bergstrom
From: Arto Merilainen <[email protected]>
Platform data was not freed in device removal. This patch adds missing
devm_kfree()calls.Change-Id Id00fd1940e786dbc80c7ac5a1bd4d6a4c18720a1Signed-off-by Arto Merilainen <[email protected]>Signed-off-by Terje Bergstrom <[email protected]>
Quoted 6 lines
--- drivers/gpu/drm/tegra/dc.c | 3 +++ drivers/gpu/drm/tegra/dsi.c | 3 +++ drivers/gpu/drm/tegra/hdmi.c | 3 +++ drivers/gpu/drm/tegra/tvo.c | 3 +++ 4 files changed, 12 insertions(+)
All of this is unnecessary. The reason for using the managed allocations in the first place is because the memory is automatically freed when the device is removed.
Thierry
Re: [PATCH 5/6] gpu: drm: tegra: Prime support
In reply to a message not in the archiveQuoted 9 lines · Terje Bergstrom
From: Arto Merilainen <[email protected]>
This patch introduces support for exporting allocated memory as dmabuf objects. Exported buffers are used for delivering data to nvhost driver.
Change-Id Ide8244366e83747a108fc3aaf762ec1350dba616Signed-off-by Arto Merilainen <[email protected]>Signed-off-by Terje Bergstrom <[email protected]>
Quoted 7 lines
--- drivers/gpu/drm/tegra/Makefile | 2 +- drivers/gpu/drm/tegra/dmabuf.c | 150 ++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/tegra/drm.c | 9 ++- drivers/gpu/drm/tegra/drm.h | 6 ++ 4 files changed, 165 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/tegra/dmabuf.c
Nothing in this patch looks specific to Tegra. This should really be added to the generic GEM CMA helpers.
Thierry
Re: [PATCH 3/6] gpu: drm: tegra: Remove redundant host1x
In reply to a message not in the archiveQuoted 4 lines · Terje Bergstrom
From: Arto Merilainen <[email protected]>
This patch removes the redundant host1x driver from tegradrm and makes necessary bindings to the separate host driver.
I'd rather keep the host1x driver where it is for now. There aren't any users external to DRM yet, so I don't see a reason for moving it out. Instead we can use DRM as a playground, see what we really need and once external users start to appear we can think about moving the host1x code somewhere else.
Quoted 4 lines
This modification introduces a regression: Because there is no general framework for attaching separate devices into the same address space, this patch removes the ability to use IOMMU in tegradrm.
So the IOMMU support was up for discussion anyway and I wasn't going to submit it for inclusion anytime soon either. No harm done.
Aside from ripping out the existing host1x code, the remainder of this patch is mostly renaming from host1x_client to tegra_drm_client, so I won't comment on it.
Thierry
Re: [PATCH 1/6] video: tegra: Add nvhost driver
In reply to a message not in the archiveQuoted 94 lines · Terje Bergstrom
Add nvhost, the driver for host1x and 2D, which is a client device for host1x.
Change-Id Id93a28491dc2d54049e0adce4ad287c5985b2bcaSigned-off-by Terje Bergstrom <[email protected]>Signed-off-by Arto Merilainen <[email protected]>--- drivers/video/Kconfig | 2 + drivers/video/Makefile | 2 + drivers/video/tegra/host/Kconfig | 20 + drivers/video/tegra/host/Makefile | 21 + drivers/video/tegra/host/bus_client.c | 101 ++++ drivers/video/tegra/host/bus_client.h | 32 ++ drivers/video/tegra/host/chip_support.c | 68 +++ drivers/video/tegra/host/chip_support.h | 179 +++++++ drivers/video/tegra/host/debug.c | 255 ++++++++++ drivers/video/tegra/host/debug.h | 50 ++ drivers/video/tegra/host/dev.c | 104 ++++ drivers/video/tegra/host/dev.h | 33 ++ drivers/video/tegra/host/dmabuf.c | 151 ++++++ drivers/video/tegra/host/dmabuf.h | 51 ++ drivers/video/tegra/host/host1x/Makefile | 6 + drivers/video/tegra/host/host1x/host1x.c | 320 ++++++++++++ drivers/video/tegra/host/host1x/host1x.h | 97 ++++ .../video/tegra/host/host1x/host1x01_hardware.h | 157 ++++++ drivers/video/tegra/host/host1x/host1x_cdma.c | 488 ++++++++++++++++++ drivers/video/tegra/host/host1x/host1x_cdma.h | 39 ++ drivers/video/tegra/host/host1x/host1x_channel.c | 157 ++++++ drivers/video/tegra/host/host1x/host1x_debug.c | 405 +++++++++++++++ drivers/video/tegra/host/host1x/host1x_intr.c | 263 ++++++++++ drivers/video/tegra/host/host1x/host1x_syncpt.c | 170 +++++++ .../video/tegra/host/host1x/hw_host1x01_channel.h | 182 +++++++ drivers/video/tegra/host/host1x/hw_host1x01_sync.h | 398 +++++++++++++++ .../video/tegra/host/host1x/hw_host1x01_uclass.h | 474 +++++++++++++++++ drivers/video/tegra/host/nvhost_acm.c | 532 ++++++++++++++++++++ drivers/video/tegra/host/nvhost_acm.h | 49 ++ drivers/video/tegra/host/nvhost_cdma.c | 473 +++++++++++++++++ drivers/video/tegra/host/nvhost_cdma.h | 116 +++++ drivers/video/tegra/host/nvhost_channel.c | 129 +++++ drivers/video/tegra/host/nvhost_channel.h | 65 +++ drivers/video/tegra/host/nvhost_intr.c | 391 ++++++++++++++ drivers/video/tegra/host/nvhost_intr.h | 110 ++++ drivers/video/tegra/host/nvhost_job.c | 398 +++++++++++++++ drivers/video/tegra/host/nvhost_memmgr.c | 252 ++++++++++ drivers/video/tegra/host/nvhost_memmgr.h | 66 +++ drivers/video/tegra/host/nvhost_syncpt.c | 453 +++++++++++++++++ drivers/video/tegra/host/nvhost_syncpt.h | 148 ++++++ drivers/video/tegra/host/t20/Makefile | 6 + drivers/video/tegra/host/t20/t20.c | 78 +++ drivers/video/tegra/host/t20/t20.h | 29 ++ drivers/video/tegra/host/t30/Makefile | 6 + drivers/video/tegra/host/t30/t30.c | 80 +++ drivers/video/tegra/host/t30/t30.h | 29 ++ include/linux/nvhost.h | 302 +++++++++++ include/trace/events/nvhost.h | 249 +++++++++ 48 files changed, 8186 insertions(+) create mode 100644 drivers/video/tegra/host/Kconfig create mode 100644 drivers/video/tegra/host/Makefile create mode 100644 drivers/video/tegra/host/bus_client.c create mode 100644 drivers/video/tegra/host/bus_client.h create mode 100644 drivers/video/tegra/host/chip_support.c create mode 100644 drivers/video/tegra/host/chip_support.h create mode 100644 drivers/video/tegra/host/debug.c create mode 100644 drivers/video/tegra/host/debug.h create mode 100644 drivers/video/tegra/host/dev.c create mode 100644 drivers/video/tegra/host/dev.h create mode 100644 drivers/video/tegra/host/dmabuf.c create mode 100644 drivers/video/tegra/host/dmabuf.h create mode 100644 drivers/video/tegra/host/host1x/Makefile create mode 100644 drivers/video/tegra/host/host1x/host1x.c create mode 100644 drivers/video/tegra/host/host1x/host1x.h create mode 100644 drivers/video/tegra/host/host1x/host1x01_hardware.h create mode 100644 drivers/video/tegra/host/host1x/host1x_cdma.c create mode 100644 drivers/video/tegra/host/host1x/host1x_cdma.h create mode 100644 drivers/video/tegra/host/host1x/host1x_channel.c create mode 100644 drivers/video/tegra/host/host1x/host1x_debug.c create mode 100644 drivers/video/tegra/host/host1x/host1x_intr.c create mode 100644 drivers/video/tegra/host/host1x/host1x_syncpt.c create mode 100644 drivers/video/tegra/host/host1x/hw_host1x01_channel.h create mode 100644 drivers/video/tegra/host/host1x/hw_host1x01_sync.h create mode 100644 drivers/video/tegra/host/host1x/hw_host1x01_uclass.h create mode 100644 drivers/video/tegra/host/nvhost_acm.c create mode 100644 drivers/video/tegra/host/nvhost_acm.h create mode 100644 drivers/video/tegra/host/nvhost_cdma.c create mode 100644 drivers/video/tegra/host/nvhost_cdma.h create mode 100644 drivers/video/tegra/host/nvhost_channel.c create mode 100644 drivers/video/tegra/host/nvhost_channel.h create mode 100644 drivers/video/tegra/host/nvhost_intr.c create mode 100644 drivers/video/tegra/host/nvhost_intr.h create mode 100644 drivers/video/tegra/host/nvhost_job.c create mode 100644 drivers/video/tegra/host/nvhost_memmgr.c create mode 100644 drivers/video/tegra/host/nvhost_memmgr.h create mode 100644 drivers/video/tegra/host/nvhost_syncpt.c create mode 100644 drivers/video/tegra/host/nvhost_syncpt.h
Quoted 8 lines
create mode 100644 drivers/video/tegra/host/t20/Makefile create mode 100644 drivers/video/tegra/host/t20/t20.c create mode 100644 drivers/video/tegra/host/t20/t20.h create mode 100644 drivers/video/tegra/host/t30/Makefile create mode 100644 drivers/video/tegra/host/t30/t30.c create mode 100644 drivers/video/tegra/host/t30/t30.h create mode 100644 include/linux/nvhost.h create mode 100644 include/trace/events/nvhost.h
Okay, there's a huge amount of code here. From a quick look this seems like the whole nvhost implementation as found in the L4T kernel. It'll obviously take quite a bit of time to go through all of it.
I would really like this to be phased in in more manageable chunks. For instance syncpoints could be added on top of the existing host1x infrastructure (the display controllers can make use of it for VBLANK reporting, right?), followed by channel support for command submission.
While VBLANK reporting is already rudimentarily supported using the display controllers' VBLANK interrupts, adding syncpt based support should be easy to do.
Last but not least, I'd really appreciate it if we could settle on one name for this component. One place calls it graphics host, another one refers to it as host1x and now we have an nvhost driver for it. The TRM isn't very consistent either, unfortunately, but a number of chapters refer to it as host1x and the clock that drives the block is also named host1x. Those are pretty much the reasons why I chose to call the DT node and the driver host1x and I would like to suggest we stay with it to keep things less confusing.
Thierry
Re: [PATCH 2/6] ARM: tegra: Add auxiliary data for nvhost
In reply to a message not in the archiveQuoted 26 lines · Terje Bergstrom
Add SoC specific auxiliary data to host1x and gr2d. nvhost uses this data.
Change-Id Idb04b262c8b6432e56cffb6c7ed64cf7ef4545b3Signed-off-by Terje Bergstrom <[email protected]>Signed-off-by Arto Merilainen <[email protected]>--- arch/arm/mach-tegra/board-dt-tegra20.c | 38 ++++++++++++++++++++++++++++- arch/arm/mach-tegra/board-dt-tegra30.c | 38 ++++++++++++++++++++++++++++- arch/arm/mach-tegra/tegra20_clocks_data.c | 8 +++--- arch/arm/mach-tegra/tegra30_clocks_data.c | 2 ++ 4 files changed, 80 insertions(+), 6 deletions(-)arch/arm/mach-tegra/board-dt-tegra20.c +1
-0@@ -33,6 +33,7 @@#include <linux/i2c.h> #include <linux/i2c-tegra.h> #include <linux/usb/tegra_usb_phy.h> +#include <linux/nvhost.h> #include <asm/hardware/gic.h> #include <asm/mach-types.h>
arch/arm/mach-tegra/board-dt-tegra20.c line 55
Quoted 10 lines
arch/arm/mach-tegra/board-dt-tegra20.c +7
-0@@ -45,6 +46,38 @@#include "common.h" #include "iomap.h" +static const char *host1x_syncpt_names[32 ] = { + [0 ] ="gfx_host" , + [NVSYNCPT_2D_0 ] ="2d_0" , + [NVSYNCPT_2D_1 ] ="2d_1" , + [NVSYNCPT_VBLANK0 ] ="vblank0" , + [NVSYNCPT_VBLANK1 ] ="vblank1" , +};
I think I remember a discussion about this back when we designed the DT bindings. The result I seem to remember was that since syncpoints can be arbitrarily assigned they wouldn't have to be statically allocated at compile time.
Instead we could just have them allocated when a host1x client registers with host1x. Or have each client request its required syncpoints explicitly. The latter would make it trivial to associate a label with it.
Quoted 14 lines
arch/arm/mach-tegra/board-dt-tegra20.c +14
-0+ +static struct host1x_device_info host1x_info = { + .nb_channels =8 , + .nb_pts =32 , + .nb_mlocks =16 , + .nb_bases =8 , + .syncpt_names = host1x_syncpt_names, + .client_managed =NVSYNCPTS_CLIENT_MANAGED , +}; + +static struct nvhost_device_data tegra_host1x_info = { + .clocks = { {"host1x" ,UINT_MAX } }, +NVHOST_MODULE_NO_POWERGATE_IDS , + .private_data = &host1x_info,
arch/arm/mach-tegra/board-dt-tegra20.c line 79
Quoted 10 lines
arch/arm/mach-tegra/board-dt-tegra20.c +10
-0+}; + +static struct nvhost_device_data tegra_gr2d_info = { + .index =2 , + .syncpts =BIT (NVSYNCPT_2D_0 ) |BIT (NVSYNCPT_2D_1 ), + .clocks = { {"gr2d" ,UINT_MAX , true}, {"epp" ,UINT_MAX , true} }, +NVHOST_MODULE_NO_POWERGATE_IDS , + .clockgate_delay =0 , + .serialize = true, +};
Again, this doesn't seem like it should be statically configured in the board data.
The same comments apply to the Tegra30 hunk that I've left out.
Quoted 6 lines
arch/arm/mach-tegra/tegra20_clocks_data.c +0
-0@@ -1041,10 +1041,10 @@ static struct clk_duplicate tegra_clk_duplicates[] = { CLK_DUPLICATE("usbd", "utmip-pad", NULL),
arch/arm/mach-tegra/tegra20_clocks_data.c static struct clk_duplicate tegra_clk_duplicates[] = { · line 1047
Quoted 10 lines
arch/arm/mach-tegra/tegra20_clocks_data.c +4
-4CLK_DUPLICATE ("usbd" ,"tegra-ehci.0" ,NULL ),CLK_DUPLICATE ("usbd" ,"tegra-otg" ,NULL ), -CLK_DUPLICATE ("2d" ,"tegra_grhost" ,"gr2d" ), -CLK_DUPLICATE ("3d" ,"tegra_grhost" ,"gr3d" ), -CLK_DUPLICATE ("epp" ,"tegra_grhost" ,"epp" ), - CLK_DUPLICATE("mpe", "tegra_grhost", "mpe"), +CLK_DUPLICATE ("2d" ,NULL ,"gr2d" ), +CLK_DUPLICATE ("3d" ,NULL ,"gr3d" ), +CLK_DUPLICATE ("epp" ,NULL ,"epp" ), + CLK_DUPLICATE("mpe", NULL, "mpe"),
Are these actually required here?
arch/arm/mach-tegra/tegra30_clocks_data.c struct clk_duplicate tegra_clk_duplicates[] = { · line 1342
Quoted 13 lines
arch/arm/mach-tegra/tegra20_clocks_data.c +0
-0CLK_DUPLICATE ("cop" ,"tegra-avp" ,"cop" ),CLK_DUPLICATE ("vde" ,"tegra-aes" ,"vde" ), CLK_DUPLICATE("cclk", NULL, "cpu"),arch/arm/mach-tegra/tegra30_clocks_data.c +2
-0@@ -1338,6 +1338,8 @@ struct clk_duplicate tegra_clk_duplicates[] = {CLK_DUPLICATE ("pll_p" ,"tegradc.0" ,"parent" ),CLK_DUPLICATE ("pll_p" ,"tegradc.1" ,"parent" ),CLK_DUPLICATE ("pll_d2_out0" ,"hdmi" ,"parent" ), +CLK_DUPLICATE ("2d" ,NULL ,"gr2d" ), + CLK_DUPLICATE("epp", NULL, "epp"),
Same here.
Thierry
Re: [PATCH 1/6] video: tegra: Add nvhost driver
In reply to a message not in the archiveQuoted 3 lines · Thierry Reding
Okay, there's a huge amount of code here. From a quick look this seems like the whole nvhost implementation as found in the L4T kernel. It'll obviously take quite a bit of time to go through all of it.
Thanks Thierry for your comments.
It's actually about a third of of the downstream nvhost. I left out support for all client modules, ioctl APIs, hardware context, nvmap (obviously) and various other features.
But yes, the amount of code is still significant and I feel the pain, too. I'm attempting to keep downstream and upstream nvhost as similar to each other as possible so that we can port changes easily between the two trees. In downstream kernel nvhost manages all its clients (except DC only partially), so it's kept as its own driver. I'm hoping we'd end up using tegradrm in downstream, and keeping nvhost as separate entity is playing a role there.
If it helps, I could write up an essay on the structure of nvhost and why it works that way. That should help in understanding some of the design decisions in code.
Quoted 8 lines
I would really like this to be phased in in more manageable chunks. For instance syncpoints could be added on top of the existing host1x infrastructure (the display controllers can make use of it for VBLANK reporting, right?), followed by channel support for command submission.
While VBLANK reporting is already rudimentarily supported using the display controllers' VBLANK interrupts, adding syncpt based support should be easy to do.
Yep, vblank is a sync point register.
I attempted to tune the code down to only having syncpt support, but it pulled in still enough (interrupts, syncpts, power management) that the patch went down about 40% in size. I thought that as the staging didn't bring really small parts, I deleted that attempt.
I could redo that if it helps. I guess removing dynamic power management would be the first step, and channels the second. In review process, they're anyway in separate files so I'm not sure about the benefits, though.
I'm not convinced about moving the code to live inside tegradrm. There's really not that much host1x infrastructure in tegradrm's host1x.c that we could leverage except binding device and driver and enabling and disabling host1x clocks. Most of code in current host1x.c is dedicated to managing the drm sub-clients, which anyway logically belong to drm.c.
To implement sync points in tegradrm, we'd need to re-implement syncpt and interrupt support in tegradrm. That's a significant part of code, and we already have code for that, so I'd like to leverage it as far as possible.
Quoted 8 lines
Last but not least, I'd really appreciate it if we could settle on one name for this component. One place calls it graphics host, another one refers to it as host1x and now we have an nvhost driver for it. The TRM isn't very consistent either, unfortunately, but a number of chapters refer to it as host1x and the clock that drives the block is also named host1x. Those are pretty much the reasons why I chose to call the DT node and the driver host1x and I would like to suggest we stay with it to keep things less confusing.
Graphics host and host1x are names for the hardware block. Graphics host is an older name, host1x is the proper name.
nvhost is the driver for host1x and its client modules in downstream kernel. The naming gets confusing in upstream kernel because of shared responsibility of client modules. tegradrm's 2D driver is just glue between tegradrm and nvhost.
host1x as the name of the driver wouldn't cover the fact that it's also managing client modules.
I'll still try to figure out a way to clear up the naming, and suggestions are welcome. :-)
Terje
Re: [PATCH 2/6] ARM: tegra: Add auxiliary data for nvhost
In reply to a message not in the archiveQuoted 8 lines · Thierry Reding
I think I remember a discussion about this back when we designed the DT bindings. The result I seem to remember was that since syncpoints can be arbitrarily assigned they wouldn't have to be statically allocated at compile time.
Instead we could just have them allocated when a host1x client registers with host1x. Or have each client request its required syncpoints explicitly. The latter would make it trivial to associate a label with it.
True. I didn't yet have time to implement dynamic allocation and I didn't want to wait for that to get the code out. I'll try to find time for that.
Quoted 20 lines
Quoted 20 lines
arch/arm/mach-tegra/board-dt-tegra20.c +19
-0+ +static struct host1x_device_info host1x_info = { + .nb_channels =8 , + .nb_pts =32 , + .nb_mlocks =16 , + .nb_bases =8 , + .syncpt_names = host1x_syncpt_names, + .client_managed =NVSYNCPTS_CLIENT_MANAGED , +}; + +static struct nvhost_device_data tegra_host1x_info = { + .clocks = { {"host1x" ,UINT_MAX } }, +NVHOST_MODULE_NO_POWERGATE_IDS , + .private_data = &host1x_info, +}; + +static struct nvhost_device_data tegra_gr2d_info = { + .index =2 , + .syncpts =BIT (NVSYNCPT_2D_0 ) |BIT (NVSYNCPT_2D_1 ),
Quoted 8 lines
arch/arm/mach-tegra/board-dt-tegra20.c line 79
Quoted 5 lines
arch/arm/mach-tegra/board-dt-tegra20.c +5
-0+ .clocks = { {"gr2d", UINT_MAX, true}, {"epp", UINT_MAX, true} }, + NVHOST_MODULE_NO_POWERGATE_IDS, + .clockgate_delay = 0, + .serialize = true, +};Again, this doesn't seem like it should be statically configured in the board data.
The host1x specifics (number of channels, pts etc) are description of hardware, so they could go to a device tree binding.
The allocation of sync points is a software policy that could be handled by the driver.
Clocks are waiting for the general discussion about clock bindings in device trees, but that data is SoC specific, so that's why I've put that in board data.
Clock gating policy is software feature that could be in driver.
Quoted 10 lines
Quoted 10 lines
arch/arm/mach-tegra/tegra20_clocks_data.c +0
-2@@ -1041,10 +1041,10 @@ static struct clk_duplicate tegra_clk_duplicates[] = {CLK_DUPLICATE ("usbd" ,"utmip-pad" ,NULL ),CLK_DUPLICATE ("usbd" ,"tegra-ehci.0" ,NULL ), CLK_DUPLICATE("usbd", "tegra-otg", NULL), -CLK_DUPLICATE ("2d" ,"tegra_grhost" ,"gr2d" ), - CLK_DUPLICATE("3d", "tegra_grhost", "gr3d"),
Quoted 8 lines
arch/arm/mach-tegra/tegra20_clocks_data.c static struct clk_duplicate tegra_clk_duplicates[] = { · line 1047
Quoted 6 lines
arch/arm/mach-tegra/tegra20_clocks_data.c +4
-2-CLK_DUPLICATE ("epp" ,"tegra_grhost" ,"epp" ), - CLK_DUPLICATE("mpe", "tegra_grhost", "mpe"), +CLK_DUPLICATE ("2d" ,NULL ,"gr2d" ), +CLK_DUPLICATE ("3d" ,NULL ,"gr3d" ), +CLK_DUPLICATE ("epp" ,NULL ,"epp" ), + CLK_DUPLICATE("mpe", NULL, "mpe"),Are these actually required here?
I think we had problems in driver acquiring the clocks without this (mismatch of driver), but I could retry. The old bindings assumed that driver would be called "tegra_grhost", but that's not the case.
Terje
Re: [PATCH 5/6] gpu: drm: tegra: Prime support
In reply to a message not in the archiveQuoted 2 lines · Thierry Reding
Nothing in this patch looks specific to Tegra. This should really be added to the generic GEM CMA helpers.
That was actually done at first. But then we started having difficulties with duplicate mappings and IOMMU, and mapping memory to correct device. We haven't yet figured out how to solve that for the generic case. That's we moved the code back to tegradrm.
Terje
Re: [PATCH 1/6] video: tegra: Add nvhost driver
In reply to a message not in the archiveQuoted 11 lines · Terje Bergström
Quoted 3 lines · Thierry Reding
Okay, there's a huge amount of code here. From a quick look this seems like the whole nvhost implementation as found in the L4T kernel. It'll obviously take quite a bit of time to go through all of it.
Thanks Thierry for your comments.
It's actually about a third of of the downstream nvhost. I left out support for all client modules, ioctl APIs, hardware context, nvmap (obviously) and various other features.
Quoted 7 lines
But yes, the amount of code is still significant and I feel the pain, too. I'm attempting to keep downstream and upstream nvhost as similar to each other as possible so that we can port changes easily between the two trees. In downstream kernel nvhost manages all its clients (except DC only partially), so it's kept as its own driver. I'm hoping we'd end up using tegradrm in downstream, and keeping nvhost as separate entity is playing a role there.
The usual way to do this is to adapt downstream kernels to upstream changes, not the other way around.
Quoted 3 lines
If it helps, I could write up an essay on the structure of nvhost and why it works that way. That should help in understanding some of the design decisions in code.
Some more documentation about host1x would certainly be very welcome. If you write something up, maybe you can push to get it included in the TRM as well. The host1x chapter in the TRM is a bit sketchy and something more like a programming guide would be really useful.
Funny enough, the chapter about the 2D engine says that it is merely there to document the registers and explicitly not as a programming guide because it is expected that NVIDIA supplied drivers will always be used. I had a good laugh when I read that. =)
Still I guess it's better than nothing.
Quoted 11 lines
Quoted 8 lines
I would really like this to be phased in in more manageable chunks. For instance syncpoints could be added on top of the existing host1x infrastructure (the display controllers can make use of it for VBLANK reporting, right?), followed by channel support for command submission.
While VBLANK reporting is already rudimentarily supported using the display controllers' VBLANK interrupts, adding syncpt based support should be easy to do.
Yep, vblank is a sync point register.
Quoted 8 lines
I attempted to tune the code down to only having syncpt support, but it pulled in still enough (interrupts, syncpts, power management) that the patch went down about 40% in size. I thought that as the staging didn't bring really small parts, I deleted that attempt.
I could redo that if it helps. I guess removing dynamic power management would be the first step, and channels the second. In review process, they're anyway in separate files so I'm not sure about the benefits, though.
The benefit is that smaller changes that add a single particular feature are a lot easier to review and verify.
Quoted 4 lines
I'm not convinced about moving the code to live inside tegradrm. There's really not that much host1x infrastructure in tegradrm's
host1x.cthat we could leverage except binding device and driver and enabling and disabling host1x clocks.
The reason there isn't more infrastructure is that I explicitly wanted to start small. Just enough to get the display to work. I find that to be a very good method because it allows the code to evolve in small and incremental steps.
Quoted 2 lines
Most of code in current
host1x.cis dedicated to managing the drm sub- clients, which anyway logically belong todrm.c.
In fact the code in host1x.c is supposed to be managing host1x clients, which is exactly what nvhost does. It isn't doing much else for sole reason that it doesn't have to at this point.
Quoted 4 lines
To implement sync points in tegradrm, we'd need to re-implement syncpt and interrupt support in tegradrm. That's a significant part of code, and we already have code for that, so I'd like to leverage it as far as possible.
I'm all for reusing your code. My concern is that the structure of this is quite different from what can be found in the L4T downstream kernels and therefore some rethinking may be required.
Quoted 9 lines
Quoted 8 lines
Last but not least, I'd really appreciate it if we could settle on one name for this component. One place calls it graphics host, another one refers to it as host1x and now we have an nvhost driver for it. The TRM isn't very consistent either, unfortunately, but a number of chapters refer to it as host1x and the clock that drives the block is also named host1x. Those are pretty much the reasons why I chose to call the DT node and the driver host1x and I would like to suggest we stay with it to keep things less confusing.
Quoted 7 lines
Graphics host and host1x are names for the hardware block. Graphics host is an older name, host1x is the proper name.
nvhost is the driver for host1x and its client modules in downstream kernel. The naming gets confusing in upstream kernel because of shared responsibility of client modules. tegradrm's 2D driver is just glue between tegradrm and nvhost.
But that's precisely my point. If the hardware is called host1x, why not call the driver host1x as well. We do the same for all other hardware blocks. The I2C controller driver is named i2c-tegra just as the RTC driver is named rtc-tegra. Why should the driver for host1x not be named host1x?
Quoted 2 lines
host1x as the name of the driver wouldn't cover the fact that it's also managing client modules.
That's like saying an I2C controller driver shouldn't be named I2C because it addresses slaves. Furthermore, just naming it nvhost doesn't change anything about that. How does nvhost make it any clearer that it manages client modules compared to host1x?
Quoted 2 lines
I'll still try to figure out a way to clear up the naming, and suggestions are welcome. :-)
host1x hardware and host1x clients are controlled by the "host1x" driver. Can it be any clearer than that?
Thierry
Re: [PATCH 2/6] ARM: tegra: Add auxiliary data for nvhost
In reply to a message not in the archiveQuoted 10 lines · Terje Bergström
Quoted 8 lines · Thierry Reding
I think I remember a discussion about this back when we designed the DT bindings. The result I seem to remember was that since syncpoints can be arbitrarily assigned they wouldn't have to be statically allocated at compile time.
Instead we could just have them allocated when a host1x client registers with host1x. Or have each client request its required syncpoints explicitly. The latter would make it trivial to associate a label with it.
Quoted 3 lines
True. I didn't yet have time to implement dynamic allocation and I didn't want to wait for that to get the code out. I'll try to find time for that.
Okay, sounds good. I agree that it was good to post these patches soon. The earlier they can be discussed and reviewed the better.
Quoted 28 lines
Quoted 19 lines
Quoted 19 lines
arch/arm/mach-tegra/board-dt-tegra20.c +19
-0+ +static struct host1x_device_info host1x_info = { + .nb_channels =8 , + .nb_pts =32 , + .nb_mlocks =16 , + .nb_bases =8 , + .syncpt_names = host1x_syncpt_names, + .client_managed =NVSYNCPTS_CLIENT_MANAGED , +}; + +static struct nvhost_device_data tegra_host1x_info = { + .clocks = { {"host1x" ,UINT_MAX } }, +NVHOST_MODULE_NO_POWERGATE_IDS , + .private_data = &host1x_info, +}; + +static struct nvhost_device_data tegra_gr2d_info = { + .index =2 , + .syncpts =BIT (NVSYNCPT_2D_0 ) |BIT (NVSYNCPT_2D_1 ),Quoted 8 lines
arch/arm/mach-tegra/board-dt-tegra20.c line 79
Quoted 5 lines
arch/arm/mach-tegra/board-dt-tegra20.c +5
-0+ .clocks = { {"gr2d", UINT_MAX, true}, {"epp", UINT_MAX, true} }, + NVHOST_MODULE_NO_POWERGATE_IDS, + .clockgate_delay = 0, + .serialize = true, +};Again, this doesn't seem like it should be statically configured in the board data.
Quoted 2 lines
The host1x specifics (number of channels, pts etc) are description of hardware, so they could go to a device tree binding.
I'm not sure that's even required. The number of syncpoints and channels should be static for a particular version of SoC, right? In that case it can be derived from the DT compatible property, can't it?
Quoted 28 lines
The allocation of sync points is a software policy that could be handled by the driver.
Clocks are waiting for the general discussion about clock bindings in device trees, but that data is SoC specific, so that's why I've put that in board data.
Clock gating policy is software feature that could be in driver.
Quoted 10 lines
Quoted 10 lines
arch/arm/mach-tegra/tegra20_clocks_data.c +0
-2@@ -1041,10 +1041,10 @@ static struct clk_duplicate tegra_clk_duplicates[] = {CLK_DUPLICATE ("usbd" ,"utmip-pad" ,NULL ),CLK_DUPLICATE ("usbd" ,"tegra-ehci.0" ,NULL ), CLK_DUPLICATE("usbd", "tegra-otg", NULL), -CLK_DUPLICATE ("2d" ,"tegra_grhost" ,"gr2d" ), - CLK_DUPLICATE("3d", "tegra_grhost", "gr3d"),Quoted 8 lines
arch/arm/mach-tegra/tegra20_clocks_data.c static struct clk_duplicate tegra_clk_duplicates[] = { · line 1047
Quoted 6 lines
arch/arm/mach-tegra/tegra20_clocks_data.c +4
-2-CLK_DUPLICATE ("epp" ,"tegra_grhost" ,"epp" ), - CLK_DUPLICATE("mpe", "tegra_grhost", "mpe"), +CLK_DUPLICATE ("2d" ,NULL ,"gr2d" ), +CLK_DUPLICATE ("3d" ,NULL ,"gr3d" ), +CLK_DUPLICATE ("epp" ,NULL ,"epp" ), + CLK_DUPLICATE("mpe", NULL, "mpe"),Are these actually required here?
Quoted 3 lines
I think we had problems in driver acquiring the clocks without this (mismatch of driver), but I could retry. The old bindings assumed that driver would be called "
tegra_grhost", but that's not the case.
I hope that DT clock support will go into 3.9, in which case the issue will just go away.
Thierry
Re: [PATCH 5/6] gpu: drm: tegra: Prime support
In reply to a message not in the archiveQuoted 8 lines · Terje Bergström
Quoted 2 lines · Thierry Reding
Nothing in this patch looks specific to Tegra. This should really be added to the generic GEM CMA helpers.
That was actually done at first. But then we started having difficulties with duplicate mappings and IOMMU, and mapping memory to correct device. We haven't yet figured out how to solve that for the generic case. That's we moved the code back to tegradrm.
I still don't see how that's relevant here. IOMMU support has explicitly been removed as you mentioned in your introductory email and none of the functionality in this patch is in any way specific to Tegra. Right?
Thierry
Re: [PATCH 5/6] gpu: drm: tegra: Prime support
In reply to a message not in the archiveQuoted 3 lines · Thierry Reding
I still don't see how that's relevant here. IOMMU support has explicitly been removed as you mentioned in your introductory email and none of the functionality in this patch is in any way specific to Tegra. Right?
You're right - my point became moot once we disabled IOMMU. Arto, can we revive the generic code?
Terje
Re: [PATCH 1/6] video: tegra: Add nvhost driver
In reply to a message not in the archiveI'll reply to the rest later, but here some initial comments.
Quoted 2 lines · Thierry Reding
The usual way to do this is to adapt downstream kernels to upstream changes, not the other way around.
Yep, we're doing both ways - leveraging downstream and upstream code.
Quoted 4 lines
Some more documentation about host1x would certainly be very welcome. If you write something up, maybe you can push to get it included in the TRM as well. The host1x chapter in the TRM is a bit sketchy and something more like a programming guide would be really useful.
Got it. I hope user space code would help here, as it would be a definite explanation of how the thing is supposed to be used.
Quoted 4 lines
Funny enough, the chapter about the 2D engine says that it is merely there to document the registers and explicitly not as a programming guide because it is expected that NVIDIA supplied drivers will always be used. I had a good laugh when I read that. =)
Ouch. :-)
Quoted 2 lines
The benefit is that smaller changes that add a single particular feature are a lot easier to review and verify.
Yep, I'm working on this. I think I found a way.
Quoted 5 lines
But that's precisely my point. If the hardware is called host1x, why not call the driver host1x as well. We do the same for all other hardware blocks. The I2C controller driver is named i2c-tegra just as the RTC driver is named rtc-tegra. Why should the driver for host1x not be named host1x?
Ok, I got it.
Terje
RE: [PATCH 5/6] gpu: drm: tegra: Prime support
In reply to a message not in the archiveThe code can be revived if necessary. I still think this code should be kept tegra specific because the current implementation IMO does not work in generic case... and the generic case solution would not suit well for our needs.
Our implementation assumes that both source and target devices share the same address space and thus there is no need to actually do buffer mapping when the target device wishes to access a buffer. The code just creates a scattertable for already mapped pages. Currently we wish to share buffers only between host1x devices and therefore this restriction does not cause any issues. However, in generic case the target and source devices can be in different address spaces and hence the code actually _should_ map the buffer to the target device's address space.
AFAIK dma-mapping API is not smart enough to determine whether a given buffer is already mapped to some address space. It just maps and potentially creates duplicates (please correct me if I am wrong). Therefore, if the "generic case solution" is applied to our "specific case", there will always be duplicates and I do not think that is a good practice. I also considered doing a smart optimisation here, but dma-mapping API did not seem to support querying of the address space of a certain device.
- Arto
________________________________________
From: Terje Bergstrom
Sent: Saturday, November 24, 2012 9:59 PM
To: Thierry Reding
Cc: [email protected]; Arto Merilainen
Subject: Re: [PATCH 5/6] gpu: drm: tegra: Prime support
Quoted 3 lines · Thierry Reding
I still don't see how that's relevant here. IOMMU support has explicitly been removed as you mentioned in your introductory email and none of the functionality in this patch is in any way specific to Tegra. Right?
You're right - my point became moot once we disabled IOMMU. Arto, can we revive the generic code?
Terje
RE: [PATCH 4/6] gpu: drm: tegra: Free platform data on remove
In reply to a message not in the archiveThank you for your comments, I will drop this patch.
- Arto
________________________________________
From: Thierry Reding [[email protected]]
Sent: Friday, November 23, 2012 11:53 PM
To: Terje Bergstrom
Cc: [email protected]; Arto Merilainen
Subject: Re: [PATCH 4/6] gpu: drm: tegra: Free platform data on remove
* PGP Signed by an unknown key
Quoted 8 lines · Terje Bergstrom
From: Arto Merilainen <[email protected]>
Platform data was not freed in device removal. This patch adds missing
devm_kfree()calls.Change-Id Id00fd1940e786dbc80c7ac5a1bd4d6a4c18720a1Signed-off-by Arto Merilainen <[email protected]>Signed-off-by Terje Bergstrom <[email protected]>
Quoted 6 lines
--- drivers/gpu/drm/tegra/dc.c | 3 +++ drivers/gpu/drm/tegra/dsi.c | 3 +++ drivers/gpu/drm/tegra/hdmi.c | 3 +++ drivers/gpu/drm/tegra/tvo.c | 3 +++ 4 files changed, 12 insertions(+)
All of this is unnecessary. The reason for using the managed allocations in the first place is because the memory is automatically freed when the device is removed.
Thierry
* Unknown Key
* 0x7F3EB3A1
Re: [PATCH 1/6] video: tegra: Add nvhost driver
In reply to a message not in the archiveQuoted 4 lines · Thierry Reding
Quoted 4 lines
Quoted 4 lines
I would really like this to be phased in in more manageable chunks. For instance syncpoints could be added on top of the existing host1x infrastructure (the display controllers can make use of it for VBLANK reporting, right?), followed by channel support for command submission.
I staged nvhost into 4 patches that each add some functionality:
* Add driver with API to read and increment sync point values
* Add syncpt wait and interrupt infrastructure
* Add channel and client support and related infrastructure (jobs, memmgr)
* Add debug support
I hope that helps in reviews.
Quoted 3 lines
I'm all for reusing your code. My concern is that the structure of this is quite different from what can be found in the L4T downstream kernels and therefore some rethinking may be required.
As long as I can keep nvhost as a separate entity, I can port changes from upstream to downstream and vice versa and there's no architectural reason why we couldn't gradually move in downstream kernel to using tegradrm.
If we merge host1x management code to tegradrm, there's no logical way of taking tegradrm into use in downstream.
Terje
Re: [PATCH 1/6] video: tegra: Add nvhost driver
In reply to a message not in the archiveQuoted 6 lines · Terje Bergström
Quoted 4 lines · Thierry Reding
Quoted 4 lines
Quoted 4 lines
I would really like this to be phased in in more manageable chunks. For instance syncpoints could be added on top of the existing host1x infrastructure (the display controllers can make use of it for VBLANK reporting, right?), followed by channel support for command submission.
Quoted 7 lines
I staged nvhost into 4 patches that each add some functionality:
* Add driver with API to read and increment sync point values
* Add syncpt wait and interrupt infrastructure
* Add channel and client support and related infrastructure (jobs, memmgr)
* Add debug supportI hope that helps in reviews.
Sounds better.
Quoted 11 lines
Quoted 3 lines
I'm all for reusing your code. My concern is that the structure of this is quite different from what can be found in the L4T downstream kernels and therefore some rethinking may be required.
As long as I can keep nvhost as a separate entity, I can port changes from upstream to downstream and vice versa and there's no architectural reason why we couldn't gradually move in downstream kernel to using tegradrm.
If we merge host1x management code to tegradrm, there's no logical way of taking tegradrm into use in downstream.
I think I understand what you're saying. While I agree that it might be better to move host1x out of tegra-drm in the long term, in particular because other frameworks like V4L2 will start to use it eventually, I have some reservations about whether it makes sense to do it right away.
Furthermore as I understand it, most of the work required to use tegra-drm downstream would involve changes to the userspace components, wouldn't it? None of that would be dependent on where in the kernel the host1x driver resides.
Thierry
Re: [PATCH 5/6] gpu: drm: tegra: Prime support
In reply to a message not in the archiveQuoted 8 lines · Arto Merilainen
AFAIK dma-mapping API is not smart enough to determine whether a given buffer is already mapped to some address space. It just maps and potentially creates duplicates (please correct me if I am wrong). Therefore, if the "generic case solution" is applied to our "specific case", there will always be duplicates and I do not think that is a good practice. I also considered doing a smart optimisation here, but dma-mapping API did not seem to support querying of the address space of a certain device.
This coupled with the facts that CMA helper calls dma mapping API, and that CMA helper doesn't know if IOMMU is enabled or disabled for a particular device, we need to keep the prime support as tegradrm specific code for now.
Terje
Re: [PATCH 1/6] video: tegra: Add nvhost driver
In reply to a message not in the archiveQuoted 9 lines · Thierry Reding
I think I understand what you're saying. While I agree that it might be better to move host1x out of tegra-drm in the long term, in particular because other frameworks like V4L2 will start to use it eventually, I have some reservations about whether it makes sense to do it right away.
Furthermore as I understand it, most of the work required to use tegra-drm downstream would involve changes to the userspace components, wouldn't it? None of that would be dependent on where in the kernel the host1x driver resides.
If we start using tegradrm in downstream and it takes over host1x, we'd lose ability to operate 3D, camera and multimedia hw. In current form we expose enough APIs to add support for them in separate drivers.
Terje
Re: [PATCH 2/6] ARM: tegra: Add auxiliary data for nvhost
In reply to a message not in the archiveQuoted 7 lines · Thierry Reding
Quoted 2 lines · Terje Bergström
The host1x specifics (number of channels, pts etc) are description of hardware, so they could go to a device tree binding.
I'm not sure that's even required. The number of syncpoints and channels should be static for a particular version of SoC, right? In that case it can be derived from the DT compatible property, can't it?
I might be a bit confused here about the purpose of device trees.
The register aperture, irqs and enumerated list of devices could also be derived from the information about host1x compatibility properly. They don't change within SoC version. Why do we have them in device tree?
I have considered device trees to be the alternative to being able to query hardware. As we can't ask the hardware the number of sync points and channels, we should have them in device trees in the same way as we have IO apertures and list of client modules.
Terje
Re: [PATCH 1/6] video: tegra: Add nvhost driver
In reply to a message not in the archiveQuoted 9 lines · Thierry Reding
Quoted 7 lines · Terje Bergström
I staged nvhost into 4 patches that each add some functionality:
* Add driver with API to read and increment sync point values
* Add syncpt wait and interrupt infrastructure
* Add channel and client support and related infrastructure (jobs, memmgr)
* Add debug supportI hope that helps in reviews.
Sounds better.
Done now, and patches sent. Let me know if you believe the patches should still be divided.
Best regards,
Terje
Re: [PATCH 2/6] ARM: tegra: Add auxiliary data for nvhost
In reply to a message not in the archiveQuoted 10 lines · Thierry Reding
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
arch/arm/mach-tegra/tegra20_clocks_data.c +0
-2@@ -1041,10 +1041,10 @@ static struct clk_duplicate tegra_clk_duplicates[] = {CLK_DUPLICATE ("usbd" ,"utmip-pad" ,NULL ),CLK_DUPLICATE ("usbd" ,"tegra-ehci.0" ,NULL ), CLK_DUPLICATE("usbd", "tegra-otg", NULL), -CLK_DUPLICATE ("2d" ,"tegra_grhost" ,"gr2d" ), - CLK_DUPLICATE("3d", "tegra_grhost", "gr3d"),
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-tegra/tegra20_clocks_data.c static struct clk_duplicate tegra_clk_duplicates[] = { · line 1047
Quoted 6 lines
arch/arm/mach-tegra/tegra20_clocks_data.c +4
-2-CLK_DUPLICATE ("epp" ,"tegra_grhost" ,"epp" ), - CLK_DUPLICATE("mpe", "tegra_grhost", "mpe"), +CLK_DUPLICATE ("2d" ,NULL ,"gr2d" ), +CLK_DUPLICATE ("3d" ,NULL ,"gr3d" ), +CLK_DUPLICATE ("epp" ,NULL ,"epp" ), + CLK_DUPLICATE("mpe", NULL, "mpe"),Are these actually required here?
It looks like the change from tegra_grhost to NULL is required. nvhost cannot acquire the clock if this change is not done:
[ 0.848517] tegra-gr2d tegra-gr2d: Cannot get clock gr2d
But I'll need to stage the aux data and clock changes to separate patches with explanations.
Terje
Re: [PATCH 2/6] ARM: tegra: Add auxiliary data for nvhost
In reply to a message not in the archiveQuoted 9 lines · Terje Bergström
Quoted 7 lines · Thierry Reding
Quoted 2 lines · Terje Bergström
The host1x specifics (number of channels, pts etc) are description of hardware, so they could go to a device tree binding.
I'm not sure that's even required. The number of syncpoints and channels should be static for a particular version of SoC, right? In that case it can be derived from the DT compatible property, can't it?
Quoted 5 lines
I might be a bit confused here about the purpose of device trees.
The register aperture, irqs and enumerated list of devices could also be derived from the information about host1x compatibility properly. They don't change within SoC version. Why do we have them in device tree?
That's potentially true.
But, consider something like an I2C controller. We have 4 or 5 instances of that. Each has a different register base, IRQ, etc. Hence, the per-instance information is in DT. Some HW modules are singleton so putting req/IRQ in DT might not be strictly necessary, but then the argument becomes that its better to be consistent and get reg/IRQ from DT in all cases, not only where strictly necessary.
Another question is: Can we support likely future HW versions just by changing DT data? If so, putting the data in DT is probably a good things. Lets say that Tegra20 and Tegra30 host1x are exactly identical except for a different base address and different # of syncpoint registers. If we put that information in DT, we don't even need to add a new compatible value to the driver, nor a new table mapping that compatible value to the # syncpoints. That means new HW support without having to write code. There is obviously a trade-off to make in order to decide exactly what's best to go into DT and what's best to go into the driver. Something simple like #syncpoints might do well in DT. Something like the entire Tegra pin controller pin/group/... definitions don't really make sense to put in DT.