devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Mikko Perttunen <mperttunen@nvidia.com>
Cc: thierry.reding@gmail.com, jonathanh@nvidia.com, joro@8bytes.org,
	will@kernel.org, robh+dt@kernel.org, robin.murphy@arm.com,
	linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org,
	iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 2/9] gpu: host1x: Add context bus
Date: Tue, 22 Feb 2022 08:21:28 -0800	[thread overview]
Message-ID: <YhUNiHiYdQfxJybk@infradead.org> (raw)
In-Reply-To: <20220218113952.3077606-3-mperttunen@nvidia.com>

On Fri, Feb 18, 2022 at 01:39:45PM +0200, Mikko Perttunen wrote:
> 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>
> ---
>  drivers/gpu/Makefile               |  3 +--
>  drivers/gpu/host1x/Kconfig         |  5 +++++
>  drivers/gpu/host1x/Makefile        |  1 +
>  drivers/gpu/host1x/context_bus.c   | 31 ++++++++++++++++++++++++++++++
>  include/linux/host1x_context_bus.h | 15 +++++++++++++++
>  5 files changed, 53 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/gpu/host1x/context_bus.c
>  create mode 100644 include/linux/host1x_context_bus.h
> 
> diff --git a/drivers/gpu/Makefile b/drivers/gpu/Makefile
> index 835c88318cec..8997f0096545 100644
> --- a/drivers/gpu/Makefile
> +++ b/drivers/gpu/Makefile
> @@ -2,7 +2,6 @@
>  # drm/tegra depends on host1x, so if both drivers are built-in care must be
>  # taken to initialize them in the correct order. Link order is the only way
>  # to ensure this currently.
> -obj-$(CONFIG_TEGRA_HOST1X)	+= host1x/
> -obj-y			+= drm/ vga/
> +obj-y			+= host1x/ drm/ vga/
>  obj-$(CONFIG_IMX_IPUV3_CORE)	+= ipu-v3/
>  obj-$(CONFIG_TRACE_GPU_MEM)		+= trace/
> diff --git a/drivers/gpu/host1x/Kconfig b/drivers/gpu/host1x/Kconfig
> index 6815b4db17c1..1861a8180d3f 100644
> --- a/drivers/gpu/host1x/Kconfig
> +++ b/drivers/gpu/host1x/Kconfig
> @@ -1,8 +1,13 @@
>  # SPDX-License-Identifier: GPL-2.0-only
> +
> +config TEGRA_HOST1X_CONTEXT_BUS
> +	bool
> +
>  config TEGRA_HOST1X
>  	tristate "NVIDIA Tegra host1x driver"
>  	depends on ARCH_TEGRA || (ARM && COMPILE_TEST)
>  	select DMA_SHARED_BUFFER
> +	select TEGRA_HOST1X_CONTEXT_BUS
>  	select IOMMU_IOVA
>  	help
>  	  Driver for the NVIDIA Tegra host1x hardware.
> diff --git a/drivers/gpu/host1x/Makefile b/drivers/gpu/host1x/Makefile
> index d2b6f7de0498..c891a3e33844 100644
> --- a/drivers/gpu/host1x/Makefile
> +++ b/drivers/gpu/host1x/Makefile
> @@ -18,3 +18,4 @@ host1x-y = \
>  	hw/host1x07.o
>  
>  obj-$(CONFIG_TEGRA_HOST1X) += host1x.o
> +obj-$(CONFIG_TEGRA_HOST1X_CONTEXT_BUS) += context_bus.o
> diff --git a/drivers/gpu/host1x/context_bus.c b/drivers/gpu/host1x/context_bus.c
> new file mode 100644
> index 000000000000..2625914f3c7d
> --- /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(host1x_context_device_bus_type);

EXPORT_SYMBOL_GPL, please.

But the pattern that this copies in arm_smmu_bus_init is really
ugly.  I think we need to figure out a way todo that without having
to export all the low-level bus types.

  parent reply	other threads:[~2022-02-22 16:21 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-18 11:39 [PATCH v3 0/9] Host1x context isolation support Mikko Perttunen
2022-02-18 11:39 ` [PATCH v3 1/9] dt-bindings: host1x: Add memory-contexts property Mikko Perttunen
2022-02-21 15:23   ` Robin Murphy
2022-02-21 15:28     ` Mikko Perttunen
2022-02-21 16:58       ` Robin Murphy
2022-02-21 17:12         ` Mikko Perttunen
2022-02-18 11:39 ` [PATCH v3 2/9] gpu: host1x: Add context bus Mikko Perttunen
2022-02-19 17:54   ` Dmitry Osipenko
2022-02-19 18:15     ` Dmitry Osipenko
2022-02-22 16:21   ` Christoph Hellwig [this message]
2022-02-22 21:30     ` Robin Murphy
2022-02-23  6:36       ` Christoph Hellwig
2022-02-18 11:39 ` [PATCH v3 3/9] gpu: host1x: Add context device management code Mikko Perttunen
2022-02-19 17:48   ` Dmitry Osipenko
2022-02-21 11:35     ` Mikko Perttunen
2022-02-19 17:52   ` Dmitry Osipenko
2022-02-21 11:37     ` Mikko Perttunen
2022-02-22 16:24   ` Christoph Hellwig
2022-02-23  9:44     ` Mikko Perttunen
2022-02-18 11:39 ` [PATCH v3 4/9] gpu: host1x: Program context stream ID on submission Mikko Perttunen
2022-02-18 11:39 ` [PATCH v3 5/9] iommu/arm-smmu: Attach to host1x context device bus Mikko Perttunen
2022-02-18 11:39 ` [PATCH v3 6/9] arm64: tegra: Add Host1x context stream IDs on Tegra186+ Mikko Perttunen
2022-02-18 11:39 ` [PATCH v3 7/9] drm/tegra: falcon: Set DMACTX field on DMA transactions Mikko Perttunen
2022-02-18 11:39 ` [PATCH v3 8/9] drm/tegra: vic: Implement get_streamid_offset Mikko Perttunen
2022-02-19 18:49   ` Dmitry Osipenko
2022-02-19 18:54     ` Dmitry Osipenko
2022-02-21 11:44       ` Mikko Perttunen
2022-02-21 20:10         ` Dmitry Osipenko
2022-02-22  8:27           ` Mikko Perttunen
2022-02-22 10:46             ` Dmitry Osipenko
2022-02-22 10:54               ` Mikko Perttunen
2022-02-22 11:02                 ` Dmitry Osipenko
2022-02-21 17:27   ` Robin Murphy
2022-02-21 17:36     ` Mikko Perttunen
2022-02-18 11:39 ` [PATCH v3 9/9] drm/tegra: Support context isolation Mikko Perttunen
2022-02-19 18:35   ` Dmitry Osipenko
2022-02-21 12:06     ` Mikko Perttunen
2022-02-21 20:02       ` Dmitry Osipenko
2022-02-22  8:37         ` Mikko Perttunen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YhUNiHiYdQfxJybk@infradead.org \
    --to=hch@infradead.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jonathanh@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mperttunen@nvidia.com \
    --cc=robh+dt@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=thierry.reding@gmail.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).