diff options
author | 2022-05-16 11:52:51 +0300 | |
---|---|---|
committer | 2022-06-01 11:50:42 +0200 | |
commit | 597b89d30b42dcc8e6b262e6876b42dde66f97f0 (patch) | |
tree | 869a22d9070a1e34988262d9aabc7c0446555128 /drivers/gpu/host1x/context_bus.c | |
parent | drm/tegra: gem: Do not try to dereference ERR_PTR() (diff) | |
download | linux-dev-597b89d30b42dcc8e6b262e6876b42dde66f97f0.tar.xz linux-dev-597b89d30b42dcc8e6b262e6876b42dde66f97f0.zip |
gpu: host1x: Add context bus
The context bus is a "dummy" bus that contains struct devices that
correspond to IOMMU contexts assigned through Host1x to processes.
Even when host1x itself is built as a module, the bus is registered
in built-in code so that the built-in ARM SMMU driver is able to
reference it.
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/host1x/context_bus.c')
-rw-r--r-- | drivers/gpu/host1x/context_bus.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/gpu/host1x/context_bus.c b/drivers/gpu/host1x/context_bus.c new file mode 100644 index 000000000000..b0d35b2bbe89 --- /dev/null +++ b/drivers/gpu/host1x/context_bus.c @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2021, NVIDIA Corporation. + */ + +#include <linux/device.h> +#include <linux/of.h> + +struct bus_type host1x_context_device_bus_type = { + .name = "host1x-context", +}; +EXPORT_SYMBOL_GPL(host1x_context_device_bus_type); + +static int __init host1x_context_device_bus_init(void) +{ + int err; + + if (!of_machine_is_compatible("nvidia,tegra186") && + !of_machine_is_compatible("nvidia,tegra194") && + !of_machine_is_compatible("nvidia,tegra234")) + return 0; + + err = bus_register(&host1x_context_device_bus_type); + if (err < 0) { + pr_err("bus type registration failed: %d\n", err); + return err; + } + + return 0; +} +postcore_initcall(host1x_context_device_bus_init); |