From: Mikko Perttunen <mperttunen@nvidia.com> Date: 2021-09-16 14:34:10
Hi all,
***
New in v2:
Added support for Tegra194
Use standard iommu-map property instead of custom mechanism
***
this series adds support for Host1x 'context isolation'. Since
when programming engines through Host1x, userspace can program in
any addresses it wants, we need some way to isolate the engines'
memory spaces. Traditionally this has either been done imperfectly
with a single shared IOMMU domain, or by copying and verifying the
programming command stream at submit time (Host1x firewall).
Since Tegra186 there is a privileged (only usable by kernel)
Host1x opcode that allows setting the stream ID sent by the engine
to the SMMU. So, by allocating a number of context banks and stream
IDs for this purpose, and using this opcode at the beginning of
each job, we can implement isolation. Due to the limited number of
context banks only each process gets its own context, and not
each channel.
This feature also allows sharing engines among multiple VMs when
used with Host1x's hardware virtualization support - up to 8 VMs
can be configured with a subset of allowed stream IDs, enforced
at hardware level.
To implement this, this series adds a new host1x context bus, which
will contain the 'struct device's corresponding to each context
bank / stream ID, changes to device tree and SMMU code to allow
registering the devices and using the bus, as well as the Host1x
stream ID programming code and support in TegraDRM.
Device tree bindings are not updated yet pending consensus that the
proposed changes make sense.
Thanks,
Mikko
Mikko Perttunen (8):
gpu: host1x: Add context bus
gpu: host1x: Add context device management code
gpu: host1x: Program context stream ID on submission
iommu/arm-smmu: Attach to host1x context device bus
arm64: tegra: Add Host1x context stream IDs on Tegra186+
drm/tegra: falcon: Set DMACTX field on DMA transactions
drm/tegra: vic: Implement get_streamid_offset
drm/tegra: Support context isolation
arch/arm64/boot/dts/nvidia/tegra186.dtsi | 12 ++
arch/arm64/boot/dts/nvidia/tegra194.dtsi | 12 ++
drivers/gpu/Makefile | 3 +-
drivers/gpu/drm/tegra/drm.h | 2 +
drivers/gpu/drm/tegra/falcon.c | 8 +
drivers/gpu/drm/tegra/falcon.h | 1 +
drivers/gpu/drm/tegra/submit.c | 13 ++
drivers/gpu/drm/tegra/uapi.c | 34 ++++-
drivers/gpu/drm/tegra/vic.c | 38 +++++
drivers/gpu/host1x/Kconfig | 5 +
drivers/gpu/host1x/Makefile | 2 +
drivers/gpu/host1x/context.c | 174 ++++++++++++++++++++++
drivers/gpu/host1x/context.h | 27 ++++
drivers/gpu/host1x/context_bus.c | 31 ++++
drivers/gpu/host1x/dev.c | 12 +-
drivers/gpu/host1x/dev.h | 2 +
drivers/gpu/host1x/hw/channel_hw.c | 52 ++++++-
drivers/gpu/host1x/hw/host1x06_hardware.h | 10 ++
drivers/gpu/host1x/hw/host1x07_hardware.h | 10 ++
drivers/iommu/arm/arm-smmu/arm-smmu.c | 13 ++
include/linux/host1x.h | 21 +++
include/linux/host1x_context_bus.h | 15 ++
22 files changed, 488 insertions(+), 9 deletions(-)
create mode 100644 drivers/gpu/host1x/context.c
create mode 100644 drivers/gpu/host1x/context.h
create mode 100644 drivers/gpu/host1x/context_bus.c
create mode 100644 include/linux/host1x_context_bus.h
--
2.32.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Mikko Perttunen <mperttunen@nvidia.com> Date: 2021-09-16 14:33:36
Add code to do stream ID switching at the beginning of a job. The
stream ID is switched to the stream ID specified by the context
passed in the job structure.
Before switching the stream ID, an OP_DONE wait is done on the
channel's engine to ensure that there is no residual ongoing
work that might do DMA using the new stream ID.
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
drivers/gpu/host1x/hw/channel_hw.c | 52 +++++++++++++++++++++--
drivers/gpu/host1x/hw/host1x06_hardware.h | 10 +++++
drivers/gpu/host1x/hw/host1x07_hardware.h | 10 +++++
include/linux/host1x.h | 4 ++
4 files changed, 72 insertions(+), 4 deletions(-)
@@ -159,6 +159,45 @@ static void host1x_channel_set_streamid(struct host1x_channel *channel)#endif}+staticvoidhost1x_channel_program_engine_streamid(structhost1x_job*job)+{+#if HOST1X_HW >= 6+u32fence;++if(!job->context)+return;++fence=host1x_syncpt_incr_max(job->syncpt,1);++/* First, increment a syncpoint on OP_DONE condition.. */++host1x_cdma_push(&job->channel->cdma,+host1x_opcode_nonincr(HOST1X_UCLASS_INCR_SYNCPT,1),+HOST1X_UCLASS_INCR_SYNCPT_INDX_F(job->syncpt->id)|+HOST1X_UCLASS_INCR_SYNCPT_COND_F(1));++/* Wait for syncpoint to increment */++host1x_cdma_push(&job->channel->cdma,+host1x_opcode_setclass(HOST1X_CLASS_HOST1X,+host1x_uclass_wait_syncpt_r(),1),+host1x_class_host_wait_syncpt(job->syncpt->id,fence));++/*+*Nowthatweknowtheengineisidle,returntoclassand+*changestreamID.+*/++host1x_cdma_push(&job->channel->cdma,+host1x_opcode_setclass(job->class,0,0),+HOST1X_OPCODE_NOP);++host1x_cdma_push(&job->channel->cdma,+host1x_opcode_setpayload(job->context->stream_id),+host1x_opcode_setstreamid(job->engine_streamid_offset/4));+#endif+}+staticintchannel_submit(structhost1x_job*job){structhost1x_channel*ch=job->channel;
@@ -214,18 +253,23 @@ static int channel_submit(struct host1x_job *job)if(sp->base)synchronize_syncpt_base(job);-syncval=host1x_syncpt_incr_max(sp,user_syncpt_incrs);-host1x_hw_syncpt_assign_to_channel(host,sp,ch);-job->syncpt_end=syncval;-/* add a setclass for modules that require it */if(job->class)host1x_cdma_push(&ch->cdma,host1x_opcode_setclass(job->class,0,0),HOST1X_OPCODE_NOP);+/*+*EnsureengineDMAisidleandsetnewstreamID.Mayincrement+*syncptmax.+*/+host1x_channel_program_engine_streamid(job);++syncval=host1x_syncpt_incr_max(sp,user_syncpt_incrs);+job->syncpt_end=syncval;+submit_gathers(job,syncval-user_syncpt_incrs);/* end CDMA submit & stash pinned hMems into sync queue */
@@ -277,6 +277,10 @@ struct host1x_job {/* Whether host1x-side firewall should be ran for this job or not */boolenable_firewall;++/* Options for configuring engine data stream ID */+structhost1x_context*context;+u32engine_streamid_offset;};structhost1x_job*host1x_job_alloc(structhost1x_channel*ch,
--
2.32.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Mikko Perttunen <mperttunen@nvidia.com> Date: 2021-09-16 14:33:36
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
@@ -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/
From: Mikko Perttunen <mperttunen@nvidia.com> Date: 2021-09-16 14:33:43
Set itself as the IOMMU for the host1x context device bus, containing
"dummy" devices used for Host1x context isolation.
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
drivers/iommu/arm/arm-smmu/arm-smmu.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
From: Mikko Perttunen <mperttunen@nvidia.com> Date: 2021-09-16 14:33:53
Implement the get_streamid_offset required for supporting context
isolation. Since old firmware cannot support context isolation
without hacks that we don't want to implement, check the firmware
binary to see if context isolation should be enabled.
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
drivers/gpu/drm/tegra/vic.c | 38 +++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
@@ -216,6 +218,7 @@ static int vic_load_firmware(struct vic *vic){structhost1x_client*client=&vic->client.base;structtegra_drm*tegra=vic->client.drm;+u32fce_bin_data_offset;dma_addr_tiova;size_tsize;void*virt;
@@ -264,6 +267,25 @@ static int vic_load_firmware(struct vic *vic)vic->falcon.firmware.phys=phys;}+/*+*Checkiffirmwareisnewenoughtonotrequiremappingfirmware+*todatabufferdomains.+*/+fce_bin_data_offset=*(u32*)(virt+VIC_UCODE_FCE_DATA_OFFSET);++if(!vic->config->supports_sid){+vic->can_use_context=false;+}elseif(fce_bin_data_offset!=0x0&&fce_bin_data_offset!=0xa5a5a5a5){+/*+*FirmwarewillaccessFCEthroughSTREAMID0,socontext+*isolationcannotbeused.+*/+vic->can_use_context=false;+dev_warn_once(vic->dev,"context isolation disabled due to old firmware\n");+}else{+vic->can_use_context=true;+}+return0;cleanup:
From: Mikko Perttunen <mperttunen@nvidia.com> Date: 2021-09-16 14:34:00
For engines that support context isolation, allocate a context when
opening a channel, and set up stream ID offset and context fields
when submitting a job.
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
drivers/gpu/drm/tegra/drm.h | 2 ++
drivers/gpu/drm/tegra/submit.c | 13 +++++++++++++
drivers/gpu/drm/tegra/uapi.c | 34 ++++++++++++++++++++++++++++++++--
3 files changed, 47 insertions(+), 2 deletions(-)
@@ -80,6 +80,7 @@ struct tegra_drm_context {/* Only used by new UAPI. */structxarraymappings;+structhost1x_context*memory_context;};structtegra_drm_client_ops{
From: Mikko Perttunen <mperttunen@nvidia.com> Date: 2021-09-16 14:34:04
The DMACTX field determines which context, as specified in the
TRANSCFG register, is used. While during boot it doesn't matter
which is used, later on it matters and this value is reused by
the firmware.
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
drivers/gpu/drm/tegra/falcon.c | 8 ++++++++
drivers/gpu/drm/tegra/falcon.h | 1 +
2 files changed, 9 insertions(+)
From: Mikko Perttunen <mperttunen@nvidia.com> Date: 2021-09-16 14:34:14
Add Host1x context stream IDs on systems that support Host1x context
isolation. Host1x and attached engines can use these stream IDs to
allow isolation between memory used by different processes.
The specified stream IDs must match those configured by the hypervisor,
if one is present.
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
v2:
* Added context devices on T194.
* Use iommu-map instead of custom property.
---
arch/arm64/boot/dts/nvidia/tegra186.dtsi | 12 ++++++++++++
arch/arm64/boot/dts/nvidia/tegra194.dtsi | 12 ++++++++++++
2 files changed, 24 insertions(+)
From: Mikko Perttunen <hidden> Date: 2021-11-08 10:37:04
On 9/16/21 5:32 PM, Mikko Perttunen wrote:
Hi all,
***
New in v2:
Added support for Tegra194
Use standard iommu-map property instead of custom mechanism
***
this series adds support for Host1x 'context isolation'. Since
when programming engines through Host1x, userspace can program in
any addresses it wants, we need some way to isolate the engines'
memory spaces. Traditionally this has either been done imperfectly
with a single shared IOMMU domain, or by copying and verifying the
programming command stream at submit time (Host1x firewall).
Since Tegra186 there is a privileged (only usable by kernel)
Host1x opcode that allows setting the stream ID sent by the engine
to the SMMU. So, by allocating a number of context banks and stream
IDs for this purpose, and using this opcode at the beginning of
each job, we can implement isolation. Due to the limited number of
context banks only each process gets its own context, and not
each channel.
This feature also allows sharing engines among multiple VMs when
used with Host1x's hardware virtualization support - up to 8 VMs
can be configured with a subset of allowed stream IDs, enforced
at hardware level.
To implement this, this series adds a new host1x context bus, which
will contain the 'struct device's corresponding to each context
bank / stream ID, changes to device tree and SMMU code to allow
registering the devices and using the bus, as well as the Host1x
stream ID programming code and support in TegraDRM.
Device tree bindings are not updated yet pending consensus that the
proposed changes make sense.
Thanks,
Mikko
Mikko Perttunen (8):
gpu: host1x: Add context bus
gpu: host1x: Add context device management code
gpu: host1x: Program context stream ID on submission
iommu/arm-smmu: Attach to host1x context device bus
arm64: tegra: Add Host1x context stream IDs on Tegra186+
drm/tegra: falcon: Set DMACTX field on DMA transactions
drm/tegra: vic: Implement get_streamid_offset
drm/tegra: Support context isolation
arch/arm64/boot/dts/nvidia/tegra186.dtsi | 12 ++
arch/arm64/boot/dts/nvidia/tegra194.dtsi | 12 ++
drivers/gpu/Makefile | 3 +-
drivers/gpu/drm/tegra/drm.h | 2 +
drivers/gpu/drm/tegra/falcon.c | 8 +
drivers/gpu/drm/tegra/falcon.h | 1 +
drivers/gpu/drm/tegra/submit.c | 13 ++
drivers/gpu/drm/tegra/uapi.c | 34 ++++-
drivers/gpu/drm/tegra/vic.c | 38 +++++
drivers/gpu/host1x/Kconfig | 5 +
drivers/gpu/host1x/Makefile | 2 +
drivers/gpu/host1x/context.c | 174 ++++++++++++++++++++++
drivers/gpu/host1x/context.h | 27 ++++
drivers/gpu/host1x/context_bus.c | 31 ++++
drivers/gpu/host1x/dev.c | 12 +-
drivers/gpu/host1x/dev.h | 2 +
drivers/gpu/host1x/hw/channel_hw.c | 52 ++++++-
drivers/gpu/host1x/hw/host1x06_hardware.h | 10 ++
drivers/gpu/host1x/hw/host1x07_hardware.h | 10 ++
drivers/iommu/arm/arm-smmu/arm-smmu.c | 13 ++
include/linux/host1x.h | 21 +++
include/linux/host1x_context_bus.h | 15 ++
22 files changed, 488 insertions(+), 9 deletions(-)
create mode 100644 drivers/gpu/host1x/context.c
create mode 100644 drivers/gpu/host1x/context.h
create mode 100644 drivers/gpu/host1x/context_bus.c
create mode 100644 include/linux/host1x_context_bus.h
IOMMU/DT folks, any thoughts about this approach? The patches that are of interest outside of Host1x/TegraDRM specifics are patches 1, 2, 4, and 5.
Thanks,
Mikko
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Jon Hunter <jonathanh@nvidia.com> Date: 2021-12-06 09:55:27
Will, Joerg, Rob,
On 08/11/2021 10:36, Mikko Perttunen wrote:
On 9/16/21 5:32 PM, Mikko Perttunen wrote:
quoted
Hi all,
***
New in v2:
Added support for Tegra194
Use standard iommu-map property instead of custom mechanism
***
this series adds support for Host1x 'context isolation'. Since
when programming engines through Host1x, userspace can program in
any addresses it wants, we need some way to isolate the engines'
memory spaces. Traditionally this has either been done imperfectly
with a single shared IOMMU domain, or by copying and verifying the
programming command stream at submit time (Host1x firewall).
Since Tegra186 there is a privileged (only usable by kernel)
Host1x opcode that allows setting the stream ID sent by the engine
to the SMMU. So, by allocating a number of context banks and stream
IDs for this purpose, and using this opcode at the beginning of
each job, we can implement isolation. Due to the limited number of
context banks only each process gets its own context, and not
each channel.
This feature also allows sharing engines among multiple VMs when
used with Host1x's hardware virtualization support - up to 8 VMs
can be configured with a subset of allowed stream IDs, enforced
at hardware level.
To implement this, this series adds a new host1x context bus, which
will contain the 'struct device's corresponding to each context
bank / stream ID, changes to device tree and SMMU code to allow
registering the devices and using the bus, as well as the Host1x
stream ID programming code and support in TegraDRM.
Device tree bindings are not updated yet pending consensus that the
proposed changes make sense.
Thanks,
Mikko
Mikko Perttunen (8):
gpu: host1x: Add context bus
gpu: host1x: Add context device management code
gpu: host1x: Program context stream ID on submission
iommu/arm-smmu: Attach to host1x context device bus
arm64: tegra: Add Host1x context stream IDs on Tegra186+
drm/tegra: falcon: Set DMACTX field on DMA transactions
drm/tegra: vic: Implement get_streamid_offset
drm/tegra: Support context isolation
arch/arm64/boot/dts/nvidia/tegra186.dtsi | 12 ++
arch/arm64/boot/dts/nvidia/tegra194.dtsi | 12 ++
drivers/gpu/Makefile | 3 +-
drivers/gpu/drm/tegra/drm.h | 2 +
drivers/gpu/drm/tegra/falcon.c | 8 +
drivers/gpu/drm/tegra/falcon.h | 1 +
drivers/gpu/drm/tegra/submit.c | 13 ++
drivers/gpu/drm/tegra/uapi.c | 34 ++++-
drivers/gpu/drm/tegra/vic.c | 38 +++++
drivers/gpu/host1x/Kconfig | 5 +
drivers/gpu/host1x/Makefile | 2 +
drivers/gpu/host1x/context.c | 174 ++++++++++++++++++++++
drivers/gpu/host1x/context.h | 27 ++++
drivers/gpu/host1x/context_bus.c | 31 ++++
drivers/gpu/host1x/dev.c | 12 +-
drivers/gpu/host1x/dev.h | 2 +
drivers/gpu/host1x/hw/channel_hw.c | 52 ++++++-
drivers/gpu/host1x/hw/host1x06_hardware.h | 10 ++
drivers/gpu/host1x/hw/host1x07_hardware.h | 10 ++
drivers/iommu/arm/arm-smmu/arm-smmu.c | 13 ++
include/linux/host1x.h | 21 +++
include/linux/host1x_context_bus.h | 15 ++
22 files changed, 488 insertions(+), 9 deletions(-)
create mode 100644 drivers/gpu/host1x/context.c
create mode 100644 drivers/gpu/host1x/context.h
create mode 100644 drivers/gpu/host1x/context_bus.c
create mode 100644 include/linux/host1x_context_bus.h
IOMMU/DT folks, any thoughts about this approach? The patches that are of interest outside of Host1x/TegraDRM specifics are patches 1, 2, 4, and 5.
From: Jon Hunter <jonathanh@nvidia.com> Date: 2021-12-14 08:06:03
Hi all,
Still no response on this :-(
On 06/12/2021 09:55, Jon Hunter wrote:
Will, Joerg, Rob,
On 08/11/2021 10:36, Mikko Perttunen wrote:
quoted
On 9/16/21 5:32 PM, Mikko Perttunen wrote:
quoted
Hi all,
***
New in v2:
Added support for Tegra194
Use standard iommu-map property instead of custom mechanism
***
this series adds support for Host1x 'context isolation'. Since
when programming engines through Host1x, userspace can program in
any addresses it wants, we need some way to isolate the engines'
memory spaces. Traditionally this has either been done imperfectly
with a single shared IOMMU domain, or by copying and verifying the
programming command stream at submit time (Host1x firewall).
Since Tegra186 there is a privileged (only usable by kernel)
Host1x opcode that allows setting the stream ID sent by the engine
to the SMMU. So, by allocating a number of context banks and stream
IDs for this purpose, and using this opcode at the beginning of
each job, we can implement isolation. Due to the limited number of
context banks only each process gets its own context, and not
each channel.
This feature also allows sharing engines among multiple VMs when
used with Host1x's hardware virtualization support - up to 8 VMs
can be configured with a subset of allowed stream IDs, enforced
at hardware level.
To implement this, this series adds a new host1x context bus, which
will contain the 'struct device's corresponding to each context
bank / stream ID, changes to device tree and SMMU code to allow
registering the devices and using the bus, as well as the Host1x
stream ID programming code and support in TegraDRM.
Device tree bindings are not updated yet pending consensus that the
proposed changes make sense.
Thanks,
Mikko
Mikko Perttunen (8):
gpu: host1x: Add context bus
gpu: host1x: Add context device management code
gpu: host1x: Program context stream ID on submission
iommu/arm-smmu: Attach to host1x context device bus
arm64: tegra: Add Host1x context stream IDs on Tegra186+
drm/tegra: falcon: Set DMACTX field on DMA transactions
drm/tegra: vic: Implement get_streamid_offset
drm/tegra: Support context isolation
arch/arm64/boot/dts/nvidia/tegra186.dtsi | 12 ++
arch/arm64/boot/dts/nvidia/tegra194.dtsi | 12 ++
drivers/gpu/Makefile | 3 +-
drivers/gpu/drm/tegra/drm.h | 2 +
drivers/gpu/drm/tegra/falcon.c | 8 +
drivers/gpu/drm/tegra/falcon.h | 1 +
drivers/gpu/drm/tegra/submit.c | 13 ++
drivers/gpu/drm/tegra/uapi.c | 34 ++++-
drivers/gpu/drm/tegra/vic.c | 38 +++++
drivers/gpu/host1x/Kconfig | 5 +
drivers/gpu/host1x/Makefile | 2 +
drivers/gpu/host1x/context.c | 174 ++++++++++++++++++++++
drivers/gpu/host1x/context.h | 27 ++++
drivers/gpu/host1x/context_bus.c | 31 ++++
drivers/gpu/host1x/dev.c | 12 +-
drivers/gpu/host1x/dev.h | 2 +
drivers/gpu/host1x/hw/channel_hw.c | 52 ++++++-
drivers/gpu/host1x/hw/host1x06_hardware.h | 10 ++
drivers/gpu/host1x/hw/host1x07_hardware.h | 10 ++
drivers/iommu/arm/arm-smmu/arm-smmu.c | 13 ++
include/linux/host1x.h | 21 +++
include/linux/host1x_context_bus.h | 15 ++
22 files changed, 488 insertions(+), 9 deletions(-)
create mode 100644 drivers/gpu/host1x/context.c
create mode 100644 drivers/gpu/host1x/context.h
create mode 100644 drivers/gpu/host1x/context_bus.c
create mode 100644 include/linux/host1x_context_bus.h
IOMMU/DT folks, any thoughts about this approach? The patches that are of interest outside of Host1x/TegraDRM specifics are patches 1, 2, 4, and 5.
I see only two patches on Tegra ML and others on DRI ML. Might be good
to start with re-sending this whole series and CCing MLs properly.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Mikko Perttunen <hidden> Date: 2021-12-14 14:53:31
On 12/14/21 16:35, Dmitry Osipenko wrote:
14.12.2021 11:05, Jon Hunter пишет:
quoted
Hi all,
Still no response on this :-(
I see only two patches on Tegra ML and others on DRI ML. Might be good
to start with re-sending this whole series and CCing MLs properly.
All patches should have been sent to the same set of addresses. At least LWN's archive seems to agree..
Mikko
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
I see only two patches on Tegra ML and others on DRI ML. Might be good
to start with re-sending this whole series and CCing MLs properly.
All patches should have been sent to the same set of addresses. At least
LWN's archive seems to agree..
Indeed, I see that Tegra ML was CCed and I see all patches on Tegra
patchwork, but I don't see them all on lore and gmane.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Robin Murphy <robin.murphy@arm.com> Date: 2021-12-14 15:39:03
On 2021-11-08 10:36, Mikko Perttunen wrote:
On 9/16/21 5:32 PM, Mikko Perttunen wrote:
quoted
Hi all,
***
New in v2:
Added support for Tegra194
Use standard iommu-map property instead of custom mechanism
***
this series adds support for Host1x 'context isolation'. Since
when programming engines through Host1x, userspace can program in
any addresses it wants, we need some way to isolate the engines'
memory spaces. Traditionally this has either been done imperfectly
with a single shared IOMMU domain, or by copying and verifying the
programming command stream at submit time (Host1x firewall).
Since Tegra186 there is a privileged (only usable by kernel)
Host1x opcode that allows setting the stream ID sent by the engine
to the SMMU. So, by allocating a number of context banks and stream
IDs for this purpose, and using this opcode at the beginning of
each job, we can implement isolation. Due to the limited number of
context banks only each process gets its own context, and not
each channel.
This feature also allows sharing engines among multiple VMs when
used with Host1x's hardware virtualization support - up to 8 VMs
can be configured with a subset of allowed stream IDs, enforced
at hardware level.
To implement this, this series adds a new host1x context bus, which
will contain the 'struct device's corresponding to each context
bank / stream ID, changes to device tree and SMMU code to allow
registering the devices and using the bus, as well as the Host1x
stream ID programming code and support in TegraDRM.
Device tree bindings are not updated yet pending consensus that the
proposed changes make sense.
Thanks,
Mikko
Mikko Perttunen (8):
gpu: host1x: Add context bus
gpu: host1x: Add context device management code
gpu: host1x: Program context stream ID on submission
iommu/arm-smmu: Attach to host1x context device bus
arm64: tegra: Add Host1x context stream IDs on Tegra186+
drm/tegra: falcon: Set DMACTX field on DMA transactions
drm/tegra: vic: Implement get_streamid_offset
drm/tegra: Support context isolation
arch/arm64/boot/dts/nvidia/tegra186.dtsi | 12 ++
arch/arm64/boot/dts/nvidia/tegra194.dtsi | 12 ++
drivers/gpu/Makefile | 3 +-
drivers/gpu/drm/tegra/drm.h | 2 +
drivers/gpu/drm/tegra/falcon.c | 8 +
drivers/gpu/drm/tegra/falcon.h | 1 +
drivers/gpu/drm/tegra/submit.c | 13 ++
drivers/gpu/drm/tegra/uapi.c | 34 ++++-
drivers/gpu/drm/tegra/vic.c | 38 +++++
drivers/gpu/host1x/Kconfig | 5 +
drivers/gpu/host1x/Makefile | 2 +
drivers/gpu/host1x/context.c | 174 ++++++++++++++++++++++
drivers/gpu/host1x/context.h | 27 ++++
drivers/gpu/host1x/context_bus.c | 31 ++++
drivers/gpu/host1x/dev.c | 12 +-
drivers/gpu/host1x/dev.h | 2 +
drivers/gpu/host1x/hw/channel_hw.c | 52 ++++++-
drivers/gpu/host1x/hw/host1x06_hardware.h | 10 ++
drivers/gpu/host1x/hw/host1x07_hardware.h | 10 ++
drivers/iommu/arm/arm-smmu/arm-smmu.c | 13 ++
include/linux/host1x.h | 21 +++
include/linux/host1x_context_bus.h | 15 ++
22 files changed, 488 insertions(+), 9 deletions(-)
create mode 100644 drivers/gpu/host1x/context.c
create mode 100644 drivers/gpu/host1x/context.h
create mode 100644 drivers/gpu/host1x/context_bus.c
create mode 100644 include/linux/host1x_context_bus.h
IOMMU/DT folks, any thoughts about this approach? The patches that are of interest outside of Host1x/TegraDRM specifics are patches 1, 2, 4, and 5.
FWIW it looks fairly innocuous to me. I don't understand host1x - neither hardware nor driver abstractions - well enough to meaningfully review it all (e.g. maybe it's deliberate that the bus .dma_configure method isn't used?), but the SMMU patch seems fine given the Kconfig solution to avoid module linkage problems.
Cheers,
Robin.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Jon Hunter <jonathanh@nvidia.com> Date: 2021-12-17 11:16:22
On 14/12/2021 15:38, Robin Murphy wrote:
...
quoted
IOMMU/DT folks, any thoughts about this approach? The patches that are of interest outside of Host1x/TegraDRM specifics are patches 1, 2, 4, and 5.
FWIW it looks fairly innocuous to me. I don't understand host1x - neither hardware nor driver abstractions - well enough to meaningfully review it all (e.g. maybe it's deliberate that the bus .dma_configure method isn't used?), but the SMMU patch seems fine given the Kconfig solution to avoid module linkage problems.
Thanks Robin! Will, Joerg, is OK with you?
Mikko, I believe we are missing a dt-binding change to document the 'memory-contexts' node which I assume you will add if everyone is OK with this?
Cheers
Jon
--
nvpublic
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel