Host1x and VIC support for Tegra186
Subsystems (5)
Mikko Perttunen
maintainercover Host1x and VIC support for Tegra186
Hi everyone,
this series adds basic support for the Host1x channel engine and the VIC 2d compositor unit on Tegra186. The first three patches do the required device tree changes, the fourth patch updates the device tree binding documentation, and the two remaining patches add the actual implementation, almost all of which is in Host1x itself.
The Tegra186 Host1x is a relatively large update over previous generations, which can be seen in the diffstat. The biggest change is that Host1x is now contains separate hypervisor and vm register apertures to support virtualization at the hardware level. This driver, however, currently assumes that this instance of Linux is the sole operating system having access to the hardware.
This combined with increased numbers of supported channels and syncpoints have caused a number of register space changes that are responsible for most of the updated code.
The series has been tested on the Jetson TX1 (T210) and TX2 (T186) using the host1x_test test suite available at
http://github.com/cyndis/host1x_test
The series itself is available at
http://github.com/cyndis/linux, branch host1x-t186-1
Cheers,
Mikko
Mikko Perttunen (6):
arm64: tegra: Add #power-domain-cells for BPMP
arm64: tegra: Add host1x on Tegra186
arm64: tegra: Add VIC on Tegra186
dt-bindings: host1x: Fix and add Tegra186 information
gpu: host1x: Add Tegra186 support
drm/tegra: Add Tegra186 support for VIC
.../display/tegra/nvidia,tegra20-host1x.txt | 9 +-
arch/arm64/boot/dts/nvidia/tegra186.dtsi | 31 ++++
drivers/gpu/drm/tegra/drm.c | 1 +
drivers/gpu/drm/tegra/vic.c | 10 ++
drivers/gpu/host1x/Makefile | 3 +-
drivers/gpu/host1x/dev.c | 60 ++++++-
drivers/gpu/host1x/dev.h | 4 +
drivers/gpu/host1x/hw/cdma_hw.c | 49 +++---
drivers/gpu/host1x/hw/debug_hw.c | 137 +---------------
.../gpu/host1x/hw/{debug_hw.c => debug_hw_1x01.c} | 160 ------------------
drivers/gpu/host1x/hw/debug_hw_1x06.c | 133 +++++++++++++++
drivers/gpu/host1x/hw/host1x01.c | 2 +
drivers/gpu/host1x/hw/host1x02.c | 2 +
drivers/gpu/host1x/hw/host1x04.c | 2 +
drivers/gpu/host1x/hw/host1x05.c | 2 +
drivers/gpu/host1x/hw/{host1x02.c => host1x06.c} | 12 +-
drivers/gpu/host1x/hw/{host1x02.c => host1x06.h} | 30 +---
drivers/gpu/host1x/hw/host1x06_hardware.h | 142 ++++++++++++++++
drivers/gpu/host1x/hw/hw_host1x06_hypervisor.h | 32 ++++
drivers/gpu/host1x/hw/hw_host1x06_uclass.h | 181 +++++++++++++++++++++
drivers/gpu/host1x/hw/hw_host1x06_vm.h | 47 ++++++
drivers/gpu/host1x/hw/intr_hw.c | 29 ++--
22 files changed, 719 insertions(+), 359 deletions(-)
copy drivers/gpu/host1x/hw/{debug_hw.c => debug_hw_1x01.c} (53%)
create mode 100644 drivers/gpu/host1x/hw/debug_hw_1x06.c
copy drivers/gpu/host1x/hw/{host1x02.c => host1x06.c} (84%)
copy drivers/gpu/host1x/hw/{host1x02.c => host1x06.h} (50%)
create mode 100644 drivers/gpu/host1x/hw/host1x06_hardware.h
create mode 100644 drivers/gpu/host1x/hw/hw_host1x06_hypervisor.h
create mode 100644 drivers/gpu/host1x/hw/hw_host1x06_uclass.h
create mode 100644 drivers/gpu/host1x/hw/hw_host1x06_vm.hSignature · 1 line
2.14.1
Mikko Perttunen
maintainerPATCH 1/6 arm64: tegra: Add #power-domain-cells for BPMP
Add #power-domain-cells for the BPMP node on Tegra186 so that the power domain provider may be used.
--- arch/arm64/boot/dts/nvidia/tegra186.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/nvidia/tegra186.dtsi +1 -0
@@ -443,6 +443,7 @@ shmem = <&cpu_bpmp_tx &cpu_bpmp_rx>; #clock-cells = <1>; #reset-cells = <1>; + #power-domain-cells = <1>; bpmp_i2c: i2c { compatible = "nvidia,tegra186-bpmp-i2c";
Signature · 1 line
2.14.1
Mikko Perttunen
maintainerPATCH 2/6 arm64: tegra: Add host1x on Tegra186
In reply to Mikko PerttunenAdd the node for Host1x on the Tegra186, without any subdevices for now.
--- arch/arm64/boot/dts/nvidia/tegra186.dtsi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
arch/arm64/boot/dts/nvidia/tegra186.dtsi +18 -0
@@ -355,6 +355,24 @@ nvidia,bpmp = <&bpmp>; }; + host1x@13e00000 { + compatible = "nvidia,tegra186-host1x", "simple-bus"; + reg = <0x0 0x13e00000 0x0 0x10000>, + <0x0 0x13e10000 0x0 0x10000>; + reg-names = "hypervisor", "vm"; + interrupts = <GIC_SPI 265 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 263 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&bpmp TEGRA186_CLK_HOST1X>; + clock-names = "host1x"; + resets = <&bpmp TEGRA186_RESET_HOST1X>; + reset-names = "host1x"; + + #address-cells = <2>; + #size-cells = <2>; + + ranges = <0x0 0x15000000 0x0 0x15000000 0x0 0x01000000>; + }; + gpu@17000000 { compatible = "nvidia,gp10b"; reg = <0x0 0x17000000 0x0 0x1000000>,
Signature · 1 line
2.14.1
Mikko Perttunen
maintainerPATCH 3/6 arm64: tegra: Add VIC on Tegra186
In reply to Mikko PerttunenAdd a node for the Video Image Compositor on the Tegra186.
--- arch/arm64/boot/dts/nvidia/tegra186.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/nvidia/tegra186.dtsi +12 -0
@@ -371,6 +371,18 @@ #size-cells = <2>; ranges = <0x0 0x15000000 0x0 0x15000000 0x0 0x01000000>; + + vic at 15340000 { + compatible = "nvidia,tegra186-vic"; + reg = <0x0 0x15340000 0x0 0x40000>; + interrupts = <GIC_SPI 206 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&bpmp TEGRA186_CLK_VIC>; + clock-names = "vic"; + resets = <&bpmp TEGRA186_RESET_VIC>; + reset-names = "vic"; + + power-domains = <&bpmp TEGRA186_POWER_DOMAIN_VIC>; + }; }; gpu at 17000000 {
Signature · 1 line
2.14.1
Mikko Perttunen
maintainerPATCH 4/6 dt-bindings: host1x: Fix and add Tegra186 information
In reply to Mikko PerttunenAdd note that address/size-cells should be 2 on 64-bit systems, and add Tegra186-specific register range properties.
--- .../devicetree/bindings/display/tegra/nvidia,tegra20-host1x.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-host1x.txt +7 -2
@@ -3,11 +3,16 @@ NVIDIA Tegra host1x Required properties: - compatible: "nvidia,tegra<chip>-host1x" - reg: Physical base address and length of the controller's registers. + For pre-Tegra186, one entry describing the whole register area. + For Tegra186, one entry for each entry in reg-names: + "vm" - VM region assigned to Linux + "hypervisor" - Hypervisor region (only if Linux acts as hypervisor) - interrupts: The interrupt outputs from the controller. - #address-cells: The number of cells used to represent physical base addresses - in the host1x address space. Should be 1. + in the host1x address space. Should be 1 for 32-bit and 2 for 64-bit systems. - #size-cells: The number of cells used to represent the size of an address - range in the host1x address space. Should be 1. + range in the host1x address space. Should be 1 for 32-bit and 2 for 64-bit + systems. - ranges: The mapping of the host1x address space to the CPU address space. - clocks: Must contain one entry, for the module clock. See ../clocks/clock-bindings.txt for details.
Signature · 1 line
2.14.1
Rob Herring
maintainerRe: [PATCH 4/6] dt-bindings: host1x: Fix and add Tegra186 information
Quoted 2 lines · Mikko Perttunen
Add note that address/size-cells should be 2 on 64-bit systems, and add Tegra186-specific register range properties.
Generally the cell sizes have nothing to do with the addressing size of the cpu. They should be as small as what fits for the given sub-tree. If all the register space fits into 4GB, then there's no reason for the #size-cells to be 2. The same is true if the sub-tree has a parent bus.
Rob
Mikko Perttunen
maintainerPATCH 5/6 gpu: host1x: Add Tegra186 support
In reply to Mikko PerttunenAdd support for the implementation of Host1x present on the Tegra186. The register space has been shuffled around a little bit, requiring addition of some chip-specific code sections. Tegra186 also adds several new features, most importantly the hypervisor, but those are not yet supported with this commit.
---
drivers/gpu/host1x/Makefile | 3 +-
drivers/gpu/host1x/dev.c | 60 ++++++-
drivers/gpu/host1x/dev.h | 4 +
drivers/gpu/host1x/hw/cdma_hw.c | 49 +++---
drivers/gpu/host1x/hw/debug_hw.c | 137 +---------------
.../gpu/host1x/hw/{debug_hw.c => debug_hw_1x01.c} | 160 ------------------
drivers/gpu/host1x/hw/debug_hw_1x06.c | 133 +++++++++++++++
drivers/gpu/host1x/hw/host1x01.c | 2 +
drivers/gpu/host1x/hw/host1x02.c | 2 +
drivers/gpu/host1x/hw/host1x04.c | 2 +
drivers/gpu/host1x/hw/host1x05.c | 2 +
drivers/gpu/host1x/hw/{host1x02.c => host1x06.c} | 12 +-
drivers/gpu/host1x/hw/{host1x02.c => host1x06.h} | 30 +---
drivers/gpu/host1x/hw/host1x06_hardware.h | 142 ++++++++++++++++
drivers/gpu/host1x/hw/hw_host1x06_hypervisor.h | 32 ++++
drivers/gpu/host1x/hw/hw_host1x06_uclass.h | 181 +++++++++++++++++++++
drivers/gpu/host1x/hw/hw_host1x06_vm.h | 47 ++++++
drivers/gpu/host1x/hw/intr_hw.c | 29 ++--
18 files changed, 670 insertions(+), 357 deletions(-)
copy drivers/gpu/host1x/hw/{debug_hw.c => debug_hw_1x01.c} (53%)
create mode 100644 drivers/gpu/host1x/hw/debug_hw_1x06.c
copy drivers/gpu/host1x/hw/{host1x02.c => host1x06.c} (84%)
copy drivers/gpu/host1x/hw/{host1x02.c => host1x06.h} (50%)
create mode 100644 drivers/gpu/host1x/hw/host1x06_hardware.h
create mode 100644 drivers/gpu/host1x/hw/hw_host1x06_hypervisor.h
create mode 100644 drivers/gpu/host1x/hw/hw_host1x06_uclass.h
create mode 100644 drivers/gpu/host1x/hw/hw_host1x06_vm.hdrivers/gpu/host1x/Makefile +2 -1
@@ -11,6 +11,7 @@ host1x-y = \ hw/host1x01.o \ hw/host1x02.o \ hw/host1x04.o \ - hw/host1x05.o + hw/host1x05.o \ + hw/host1x06.o obj-$(CONFIG_TEGRA_HOST1X) += host1x.o
drivers/gpu/host1x/dev.c +54 -6
98 lines not on this page · raw message
drivers/gpu/host1x/dev.h +4 -0
@@ -100,12 +100,14 @@ struct host1x_info {int (*init)(struct host1x *host1x);/* initialize per SoC ops */ unsigned int sync_offset;/* offset of syncpoint registers */ u64 dma_mask;/* mask of addressable memory */ +bool has_hypervisor;/* has hypervisor registers */ };struct host1x {const struct host1x_info *info;void __iomem *regs; +void __iomem *hv_regs;/* hypervisor region */ struct host1x_syncpt *syncpt;struct host1x_syncpt_base *bases;struct device *dev;
@@ -140,6 +142,8 @@ struct host1x {struct list_head list; }; +void host1x_hypervisor_writel (struct host1x *host1x,u32 r,u32 v); +u32 host1x_hypervisor_readl (struct host1x *host1x,u32 r);void host1x_sync_writel (struct host1x *host1x,u32 r,u32 v);u32 host1x_sync_readl (struct host1x *host1x,u32 r);void host1x_ch_writel (struct host1x_channel *ch,u32 r,u32 v);
drivers/gpu/host1x/hw/cdma_hw.c +30 -19
102 lines not on this page · raw message
drivers/gpu/host1x/hw/debug_hw.c +5 -132
143 lines not on this page · raw message
drivers/gpu/host1x/hw/debug_hw_1x01.c renamed from drivers/gpu/host1x/hw/debug_hw.c +0 -160
169 lines not on this page · raw message
drivers/gpu/host1x/hw/debug_hw_1x06.c new file +133 -0
133 lines not on this page · raw message
drivers/gpu/host1x/hw/host1x01.c +2 -0
@@ -21,6 +21,8 @@#include "host1x01_hardware.h" /* include code */ +#define HOST1X_HW 1 +#include "cdma_hw.c" #include "channel_hw.c" #include "debug_hw.c"
drivers/gpu/host1x/hw/host1x02.c +2 -0
@@ -21,6 +21,8 @@#include "host1x02_hardware.h" /* include code */ +#define HOST1X_HW 2 +#include "cdma_hw.c" #include "channel_hw.c" #include "debug_hw.c"
drivers/gpu/host1x/hw/host1x04.c +2 -0
@@ -21,6 +21,8 @@#include "host1x04_hardware.h" /* include code */ +#define HOST1X_HW 4 +#include "cdma_hw.c" #include "channel_hw.c" #include "debug_hw.c"
drivers/gpu/host1x/hw/host1x05.c +2 -0
@@ -21,6 +21,8 @@#include "host1x05_hardware.h" /* include code */ +#define HOST1X_HW 5 +#include "cdma_hw.c" #include "channel_hw.c" #include "debug_hw.c"
drivers/gpu/host1x/hw/host1x06.c renamed from drivers/gpu/host1x/hw/host1x02.c +7 -5
@@ -1,7 +1,7 @@/* -* Host1x init for Tegra114 SoCs +* Host1x init for Tegra186 SoCs * -* Copyright (c) 2013 NVIDIA Corporation. +* Copyright (c) 2017 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,
@@ -17,10 +17,12 @@*/ /* include hw specification */ -#include "host1x02.h" -#include "host1x02_hardware.h" +#include "host1x06.h" +#include "host1x06_hardware.h" /* include code */ +#define HOST1X_HW 6 +#include "cdma_hw.c" #include "channel_hw.c" #include "debug_hw.c"
@@ -29,7 +31,7 @@#include "../dev.h" -int host1x02_init (struct host1x *host) +int host1x06_init (struct host1x *host) { host->channel_op = &host1x_channel_ops; host->cdma_op = &host1x_cdma_ops;
drivers/gpu/host1x/hw/host1x06.h renamed from drivers/gpu/host1x/hw/host1x02.c +7 -23
@@ -1,7 +1,7 @@/* -* Host1x init for Tegra114 SoCs +* Host1x init for Tegra186 SoCs * -* Copyright (c) 2013 NVIDIA Corporation. +* Copyright (c) 2017 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,
@@ -16,27 +16,11 @@* along with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* include hw specification */ -#include "host1x02.h" -#include "host1x02_hardware.h" +#ifndef HOST1X_HOST1X06_H +#define HOST1X_HOST1X06_H -/* include code */ -#include "cdma_hw.c" -#include "channel_hw.c" -#include "debug_hw.c" -#include "intr_hw.c" -#include "syncpt_hw.c" +struct host1x ; -#include "../dev.h" +int host1x06_init (struct host1x *host); -int host1x02_init (struct host1x *host) -{ - host->channel_op = &host1x_channel_ops; - host->cdma_op = &host1x_cdma_ops; - host->cdma_pb_op = &host1x_pushbuffer_ops; - host->syncpt_op = &host1x_syncpt_ops; - host->intr_op = &host1x_intr_ops; - host->debug_op = &host1x_debug_ops; - -return 0 ; -} +#endif
drivers/gpu/host1x/hw/host1x06_hardware.h new file +142 -0
142 lines not on this page · raw message
drivers/gpu/host1x/hw/hw_host1x06_hypervisor.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* Copyright (c) 2017 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/>. +* +*/ + +#define HOST1X_HV_SYNCPT_PROT_EN 0x1ac4 +#define HOST1X_HV_SYNCPT_PROT_EN_CH_EN BIT(1) +#define HOST1X_HV_CH_KERNEL_FILTER_GBUFFER (x) (0x2020 + (x * 4)) +#define HOST1X_HV_CMDFIFO_PEEK_CTRL 0x233c +#define HOST1X_HV_CMDFIFO_PEEK_CTRL_ADDR (x) (x) +#define HOST1X_HV_CMDFIFO_PEEK_CTRL_CHANNEL (x) ((x) << 16) +#define HOST1X_HV_CMDFIFO_PEEK_CTRL_ENABLE BIT(31) +#define HOST1X_HV_CMDFIFO_PEEK_READ 0x2340 +#define HOST1X_HV_CMDFIFO_PEEK_PTRS 0x2344 +#define HOST1X_HV_CMDFIFO_PEEK_PTRS_WR_PTR_V (x) (((x) >> 16) & 0xfff) +#define HOST1X_HV_CMDFIFO_PEEK_PTRS_RD_PTR_V (x) ((x) & 0xfff) +#define HOST1X_HV_CMDFIFO_SETUP (x) (0x2588 + (x * 4)) +#define HOST1X_HV_CMDFIFO_SETUP_LIMIT_V (x) (((x) >> 16) & 0xfff) +#define HOST1X_HV_CMDFIFO_SETUP_BASE_V (x) ((x) & 0xfff) +#define HOST1X_HV_ICG_EN_OVERRIDE 0x2aa8
drivers/gpu/host1x/hw/hw_host1x06_uclass.h new file +181 -0
181 lines not on this page · raw message
drivers/gpu/host1x/hw/hw_host1x06_vm.h new file +47 -0
47 lines not on this page · raw message
drivers/gpu/host1x/hw/intr_hw.c +18 -11
@@ -72,6 +72,23 @@ static void _host1x_intr_disable_all_syncpt_intrs(struct host1x *host) } } +static void intr_hw_init (struct host1x *host,u32 cpm) +{ +#if HOST1X_HW <6 +/* disable the ip_busy_timeout. this prevents write drops */ +host1x_sync_writel (host,0 ,HOST1X_SYNC_IP_BUSY_TIMEOUT ); + +/* +* increase the auto-ack timout to the maximum value. 2d will hang +* otherwise on Tegra2. +*/ +host1x_sync_writel (host,0xff ,HOST1X_SYNC_CTXSW_TIMEOUT_CFG ); + +/* update host clocks per usec */ +host1x_sync_writel (host, cpm,HOST1X_SYNC_USEC_CLK ); +#endif +} +static int _host1x_intr_init_host_sync (struct host1x *host,u32 cpm,void (*syncpt_thresh_work)(struct work_struct *))
@@ -92,17 +109,7 @@ _host1x_intr_init_host_sync(struct host1x *host, u32 cpm,return err; } -/* disable the ip_busy_timeout. this prevents write drops */ -host1x_sync_writel (host,0 ,HOST1X_SYNC_IP_BUSY_TIMEOUT ); - -/* -* increase the auto-ack timout to the maximum value. 2d will hang -* otherwise on Tegra2. -*/ -host1x_sync_writel (host,0xff ,HOST1X_SYNC_CTXSW_TIMEOUT_CFG ); - -/* update host clocks per usec */ -host1x_sync_writel (host, cpm,HOST1X_SYNC_USEC_CLK ); +intr_hw_init (host, cpm);return 0 ; }
Signature · 1 line
2.14.1
Re: [PATCH 5/6] gpu: host1x: Add Tegra186 support
Quoted 8 lines · Mikko Perttunen
Add support for the implementation of Host1x present on the Tegra186. The register space has been shuffled around a little bit, requiring addition of some chip-specific code sections. Tegra186 also adds several new features, most importantly the hypervisor, but those are not yet supported with this commit.
Signed-off-by Mikko Perttunen <[email protected]>---
I haven't reviewed Tegra186-specific code since I'm not familiar with that platform. Code movement related to pre-Tegra186 looks fine, no regressions spotted on Tegra20.
Signature · 1 line
Dmitry
Mikko Perttunen
maintainerPATCH 6/6 drm/tegra: Add Tegra186 support for VIC
In reply to Mikko PerttunenAdd Tegra186 support for VIC - no changes are required except for new firmware and compatibility string.
--- drivers/gpu/drm/tegra/drm.c | 1 + drivers/gpu/drm/tegra/vic.c | 10 ++++++++++ 2 files changed, 11 insertions(+)
drivers/gpu/drm/tegra/drm.c +1 -0
@@ -1281,6 +1281,7 @@ static const struct of_device_id host1x_drm_subdevs[] = { { .compatible = "nvidia,tegra210-sor", }, { .compatible = "nvidia,tegra210-sor1", }, { .compatible = "nvidia,tegra210-vic", }, + { .compatible = "nvidia,tegra186-vic", }, { /* sentinel */ } };
drivers/gpu/drm/tegra/vic.c +10 -0
@@ -270,9 +270,16 @@ static const struct vic_config vic_t210_config = { .firmware = NVIDIA_TEGRA_210_VIC_FIRMWARE, }; +#define NVIDIA_TEGRA_186_VIC_FIRMWARE "nvidia/tegra186/vic04_ucode.bin" + +static const struct vic_config vic_t186_config = { + .firmware =NVIDIA_TEGRA_186_VIC_FIRMWARE , +}; +static const struct of_device_id vic_match[] = { { .compatible ="nvidia,tegra124-vic" , .data = &vic_t124_config }, { .compatible ="nvidia,tegra210-vic" , .data = &vic_t210_config }, + { .compatible ="nvidia,tegra186-vic" , .data = &vic_t186_config }, { }, };
@@ -405,3 +412,6 @@ MODULE_FIRMWARE(NVIDIA_TEGRA_124_VIC_FIRMWARE);#if IS_ENABLED (CONFIG_ARCH_TEGRA_210_SOC )MODULE_FIRMWARE (NVIDIA_TEGRA_210_VIC_FIRMWARE );#endif +#if IS_ENABLED (CONFIG_ARCH_TEGRA_186_SOC ) +MODULE_FIRMWARE (NVIDIA_TEGRA_186_VIC_FIRMWARE ); +#endif
Signature · 1 line
2.14.1