linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] arm64: tegra: Mark host1x as dma-coherent on Tegra194/234
@ 2023-01-19 13:38 Mikko Perttunen
  2023-01-19 13:38 ` [PATCH 2/4] gpu: host1x: Fix mask for syncpoint increment register Mikko Perttunen
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Mikko Perttunen @ 2023-01-19 13:38 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter
  Cc: Mikko Perttunen, linux-tegra, linux-kernel, dri-devel

From: Mikko Perttunen <mperttunen@nvidia.com>

Ensure appropriate configuration is done to make the host1x device
and context devices DMA coherent by adding the dma-coherent flag.

Fixes: b35f5b53a87b ("arm64: tegra: Add context isolation domains on Tegra234")
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
 arch/arm64/boot/dts/nvidia/tegra194.dtsi | 1 +
 arch/arm64/boot/dts/nvidia/tegra234.dtsi | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi
index 4afcbd60e144..d8169920b33b 100644
--- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi
@@ -1918,6 +1918,7 @@ host1x@13e00000 {
 			interconnects = <&mc TEGRA194_MEMORY_CLIENT_HOST1XDMAR &emc>;
 			interconnect-names = "dma-mem";
 			iommus = <&smmu TEGRA194_SID_HOST1X>;
+			dma-coherent;
 
 			/* Context isolation domains */
 			iommu-map = <0 &smmu TEGRA194_SID_HOST1X_CTX0 1>,
diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
index eaf05ee9acd1..77ceed615b7f 100644
--- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi
@@ -571,6 +571,7 @@ host1x@13e00000 {
 			interconnects = <&mc TEGRA234_MEMORY_CLIENT_HOST1XDMAR &emc>;
 			interconnect-names = "dma-mem";
 			iommus = <&smmu_niso1 TEGRA234_SID_HOST1X>;
+			dma-coherent;
 
 			/* Context isolation domains */
 			iommu-map = <0 &smmu_niso0 TEGRA234_SID_HOST1X_CTX0 1>,
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] gpu: host1x: Fix mask for syncpoint increment register
  2023-01-19 13:38 [PATCH 1/4] arm64: tegra: Mark host1x as dma-coherent on Tegra194/234 Mikko Perttunen
@ 2023-01-19 13:38 ` Mikko Perttunen
  2023-01-19 13:39 ` [PATCH 3/4] gpu: host1x: Don't skip assigning syncpoints to channels Mikko Perttunen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Mikko Perttunen @ 2023-01-19 13:38 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter
  Cc: Mikko Perttunen, linux-tegra, linux-kernel, dri-devel

From: Mikko Perttunen <mperttunen@nvidia.com>

On Tegra186+, the syncpoint ID has 10 bits of space. To allow
using more than 256 syncpoints, fix the mask.

Fixes: 9abdd497cd0a ("gpu: host1x: Tegra234 device data and headers")
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
 drivers/gpu/host1x/hw/hw_host1x06_uclass.h | 2 +-
 drivers/gpu/host1x/hw/hw_host1x07_uclass.h | 2 +-
 drivers/gpu/host1x/hw/hw_host1x08_uclass.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/host1x/hw/hw_host1x06_uclass.h b/drivers/gpu/host1x/hw/hw_host1x06_uclass.h
index 5f831438d19b..50c32de452fb 100644
--- a/drivers/gpu/host1x/hw/hw_host1x06_uclass.h
+++ b/drivers/gpu/host1x/hw/hw_host1x06_uclass.h
@@ -53,7 +53,7 @@ static inline u32 host1x_uclass_incr_syncpt_cond_f(u32 v)
 	host1x_uclass_incr_syncpt_cond_f(v)
 static inline u32 host1x_uclass_incr_syncpt_indx_f(u32 v)
 {
-	return (v & 0xff) << 0;
+	return (v & 0x3ff) << 0;
 }
 #define HOST1X_UCLASS_INCR_SYNCPT_INDX_F(v) \
 	host1x_uclass_incr_syncpt_indx_f(v)
diff --git a/drivers/gpu/host1x/hw/hw_host1x07_uclass.h b/drivers/gpu/host1x/hw/hw_host1x07_uclass.h
index 8cd2ef087d5d..887b878f92f7 100644
--- a/drivers/gpu/host1x/hw/hw_host1x07_uclass.h
+++ b/drivers/gpu/host1x/hw/hw_host1x07_uclass.h
@@ -53,7 +53,7 @@ static inline u32 host1x_uclass_incr_syncpt_cond_f(u32 v)
 	host1x_uclass_incr_syncpt_cond_f(v)
 static inline u32 host1x_uclass_incr_syncpt_indx_f(u32 v)
 {
-	return (v & 0xff) << 0;
+	return (v & 0x3ff) << 0;
 }
 #define HOST1X_UCLASS_INCR_SYNCPT_INDX_F(v) \
 	host1x_uclass_incr_syncpt_indx_f(v)
diff --git a/drivers/gpu/host1x/hw/hw_host1x08_uclass.h b/drivers/gpu/host1x/hw/hw_host1x08_uclass.h
index 724cccd71aa1..4fb1d090edae 100644
--- a/drivers/gpu/host1x/hw/hw_host1x08_uclass.h
+++ b/drivers/gpu/host1x/hw/hw_host1x08_uclass.h
@@ -53,7 +53,7 @@ static inline u32 host1x_uclass_incr_syncpt_cond_f(u32 v)
 	host1x_uclass_incr_syncpt_cond_f(v)
 static inline u32 host1x_uclass_incr_syncpt_indx_f(u32 v)
 {
-	return (v & 0xff) << 0;
+	return (v & 0x3ff) << 0;
 }
 #define HOST1X_UCLASS_INCR_SYNCPT_INDX_F(v) \
 	host1x_uclass_incr_syncpt_indx_f(v)
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/4] gpu: host1x: Don't skip assigning syncpoints to channels
  2023-01-19 13:38 [PATCH 1/4] arm64: tegra: Mark host1x as dma-coherent on Tegra194/234 Mikko Perttunen
  2023-01-19 13:38 ` [PATCH 2/4] gpu: host1x: Fix mask for syncpoint increment register Mikko Perttunen
@ 2023-01-19 13:39 ` Mikko Perttunen
  2023-01-19 13:39 ` [PATCH 4/4] drm/tegra: firewall: Check for is_addr_reg existence in IMM check Mikko Perttunen
  2023-01-26 14:37 ` [PATCH 1/4] arm64: tegra: Mark host1x as dma-coherent on Tegra194/234 Thierry Reding
  3 siblings, 0 replies; 5+ messages in thread
From: Mikko Perttunen @ 2023-01-19 13:39 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter
  Cc: Mikko Perttunen, linux-tegra, linux-kernel, dri-devel

From: Mikko Perttunen <mperttunen@nvidia.com>

The code to write the syncpoint channel assignment register
incorrectly skips the write if hypervisor registers are not available.

The register, however, is within the guest aperture so remove the
check and assign syncpoints properly even on virtualized systems.

Fixes: c3f52220f276 ("gpu: host1x: Enable Tegra186 syncpoint protection")
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
 drivers/gpu/host1x/hw/syncpt_hw.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/host1x/hw/syncpt_hw.c b/drivers/gpu/host1x/hw/syncpt_hw.c
index dd39d67ccec3..8cf35b2eff3d 100644
--- a/drivers/gpu/host1x/hw/syncpt_hw.c
+++ b/drivers/gpu/host1x/hw/syncpt_hw.c
@@ -106,9 +106,6 @@ static void syncpt_assign_to_channel(struct host1x_syncpt *sp,
 #if HOST1X_HW >= 6
 	struct host1x *host = sp->host;
 
-	if (!host->hv_regs)
-		return;
-
 	host1x_sync_writel(host,
 			   HOST1X_SYNC_SYNCPT_CH_APP_CH(ch ? ch->id : 0xff),
 			   HOST1X_SYNC_SYNCPT_CH_APP(sp->id));
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] drm/tegra: firewall: Check for is_addr_reg existence in IMM check
  2023-01-19 13:38 [PATCH 1/4] arm64: tegra: Mark host1x as dma-coherent on Tegra194/234 Mikko Perttunen
  2023-01-19 13:38 ` [PATCH 2/4] gpu: host1x: Fix mask for syncpoint increment register Mikko Perttunen
  2023-01-19 13:39 ` [PATCH 3/4] gpu: host1x: Don't skip assigning syncpoints to channels Mikko Perttunen
@ 2023-01-19 13:39 ` Mikko Perttunen
  2023-01-26 14:37 ` [PATCH 1/4] arm64: tegra: Mark host1x as dma-coherent on Tegra194/234 Thierry Reding
  3 siblings, 0 replies; 5+ messages in thread
From: Mikko Perttunen @ 2023-01-19 13:39 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter
  Cc: Mikko Perttunen, linux-tegra, linux-kernel, dri-devel

From: Mikko Perttunen <mperttunen@nvidia.com>

In the IMM opcode check, don't call is_addr_reg if it's not set.

Fixes: 8cc95f3fd35e ("drm/tegra: Add job firewall")
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
 drivers/gpu/drm/tegra/firewall.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/tegra/firewall.c b/drivers/gpu/drm/tegra/firewall.c
index 1824d2db0e2c..d53f890fa689 100644
--- a/drivers/gpu/drm/tegra/firewall.c
+++ b/drivers/gpu/drm/tegra/firewall.c
@@ -97,6 +97,9 @@ static int fw_check_regs_imm(struct tegra_drm_firewall *fw, u32 offset)
 {
 	bool is_addr;
 
+	if (!fw->client->ops->is_addr_reg)
+		return 0;
+
 	is_addr = fw->client->ops->is_addr_reg(fw->client->base.dev, fw->class,
 					       offset);
 	if (is_addr)
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/4] arm64: tegra: Mark host1x as dma-coherent on Tegra194/234
  2023-01-19 13:38 [PATCH 1/4] arm64: tegra: Mark host1x as dma-coherent on Tegra194/234 Mikko Perttunen
                   ` (2 preceding siblings ...)
  2023-01-19 13:39 ` [PATCH 4/4] drm/tegra: firewall: Check for is_addr_reg existence in IMM check Mikko Perttunen
@ 2023-01-26 14:37 ` Thierry Reding
  3 siblings, 0 replies; 5+ messages in thread
From: Thierry Reding @ 2023-01-26 14:37 UTC (permalink / raw)
  To: Mikko Perttunen, Jonathan Hunter, Thierry Reding
  Cc: Mikko Perttunen, linux-tegra, dri-devel, linux-kernel

From: Thierry Reding <treding@nvidia.com>

On Thu, 19 Jan 2023 15:38:58 +0200, Mikko Perttunen wrote:
> From: Mikko Perttunen <mperttunen@nvidia.com>
> 
> Ensure appropriate configuration is done to make the host1x device
> and context devices DMA coherent by adding the dma-coherent flag.
> 
> 

Applied, thanks!

[1/4] arm64: tegra: Mark host1x as dma-coherent on Tegra194/234
      (no commit info)
[2/4] gpu: host1x: Fix mask for syncpoint increment register
      commit: c42babb37bc2ba84d692d8d13ce900636b19d2b7
[3/4] gpu: host1x: Don't skip assigning syncpoints to channels
      commit: 529babe886a29b3e4ffcdc61b755c3d7245c6cf2
[4/4] drm/tegra: firewall: Check for is_addr_reg existence in IMM check
      commit: 40aef7daa1bdf73bd66aa97e6e2069e340415a38

Best regards,
-- 
Thierry Reding <treding@nvidia.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-01-26 14:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-19 13:38 [PATCH 1/4] arm64: tegra: Mark host1x as dma-coherent on Tegra194/234 Mikko Perttunen
2023-01-19 13:38 ` [PATCH 2/4] gpu: host1x: Fix mask for syncpoint increment register Mikko Perttunen
2023-01-19 13:39 ` [PATCH 3/4] gpu: host1x: Don't skip assigning syncpoints to channels Mikko Perttunen
2023-01-19 13:39 ` [PATCH 4/4] drm/tegra: firewall: Check for is_addr_reg existence in IMM check Mikko Perttunen
2023-01-26 14:37 ` [PATCH 1/4] arm64: tegra: Mark host1x as dma-coherent on Tegra194/234 Thierry Reding

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).