linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] memory: tegra: Add dummy implementation on Tegra194
@ 2023-06-29 16:01 Thierry Reding
  2023-07-06 19:22 ` Sumit Gupta
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Thierry Reding @ 2023-06-29 16:01 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Krzysztof Kozlowski, Jon Hunter, Sumit Gupta, linux-tegra, linux-kernel

From: Thierry Reding <treding@nvidia.com>

With the introduction of commit 9365bf006f53 ("PCI: tegra194: Add
interconnect support in Tegra234"), the PCI driver on Tegra194 and later
requires an interconnect provider. However, a provider is currently only
exposed on Tegra234 and this causes PCI on Tegra194 to defer probe
indefinitely.

Fix this by adding a dummy implementation on Tegra194. This allows nodes
to be provided to interconnect consumers, but doesn't do any bandwidth
accounting or frequency scaling.

Fixes: 9365bf006f53 ("PCI: tegra194: Add interconnect support in Tegra234")
Reported-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/memory/tegra/mc.c       | 37 +++++++++++++++++++++++++++++++++
 drivers/memory/tegra/tegra194.c |  1 +
 drivers/memory/tegra/tegra234.c | 23 +-------------------
 include/soc/tegra/mc.h          |  3 +++
 4 files changed, 42 insertions(+), 22 deletions(-)

diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c
index 4a750da1c12a..deb6e65b59af 100644
--- a/drivers/memory/tegra/mc.c
+++ b/drivers/memory/tegra/mc.c
@@ -755,6 +755,43 @@ const char *const tegra_mc_error_names[8] = {
 	[6] = "SMMU translation error",
 };
 
+struct icc_node *tegra_mc_icc_xlate(struct of_phandle_args *spec, void *data)
+{
+	struct tegra_mc *mc = icc_provider_to_tegra_mc(data);
+	struct icc_node *node;
+
+	list_for_each_entry(node, &mc->provider.nodes, node_list) {
+		if (node->id == spec->args[0])
+			return node;
+	}
+
+	/*
+	 * If a client driver calls devm_of_icc_get() before the MC driver
+	 * is probed, then return EPROBE_DEFER to the client driver.
+	 */
+	return ERR_PTR(-EPROBE_DEFER);
+}
+
+static int tegra_mc_icc_get(struct icc_node *node, u32 *average, u32 *peak)
+{
+	*average = 0;
+	*peak = 0;
+
+	return 0;
+}
+
+static int tegra_mc_icc_set(struct icc_node *src, struct icc_node *dst)
+{
+	return 0;
+}
+
+const struct tegra_mc_icc_ops tegra_mc_icc_ops = {
+	.xlate = tegra_mc_icc_xlate,
+	.aggregate = icc_std_aggregate,
+	.get_bw = tegra_mc_icc_get,
+	.set = tegra_mc_icc_set,
+};
+
 /*
  * Memory Controller (MC) has few Memory Clients that are issuing memory
  * bandwidth allocation requests to the MC interconnect provider. The MC
diff --git a/drivers/memory/tegra/tegra194.c b/drivers/memory/tegra/tegra194.c
index b2416ee3ac26..26035ac3a1eb 100644
--- a/drivers/memory/tegra/tegra194.c
+++ b/drivers/memory/tegra/tegra194.c
@@ -1355,6 +1355,7 @@ const struct tegra_mc_soc tegra194_mc_soc = {
 		   MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM,
 	.has_addr_hi_reg = true,
 	.ops = &tegra186_mc_ops,
+	.icc_ops = &tegra_mc_icc_ops,
 	.ch_intmask = 0x00000f00,
 	.global_intstatus_channel_shift = 8,
 };
diff --git a/drivers/memory/tegra/tegra234.c b/drivers/memory/tegra/tegra234.c
index 78daa61ccd46..2fe8a61928e6 100644
--- a/drivers/memory/tegra/tegra234.c
+++ b/drivers/memory/tegra/tegra234.c
@@ -909,27 +909,6 @@ static int tegra234_mc_icc_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,
 	return 0;
 }
 
-static struct icc_node*
-tegra234_mc_of_icc_xlate(struct of_phandle_args *spec, void *data)
-{
-	struct tegra_mc *mc = icc_provider_to_tegra_mc(data);
-	unsigned int cl_id = spec->args[0];
-	struct icc_node *node;
-
-	list_for_each_entry(node, &mc->provider.nodes, node_list) {
-		if (node->id != cl_id)
-			continue;
-
-		return node;
-	}
-
-	/*
-	 * If a client driver calls devm_of_icc_get() before the MC driver
-	 * is probed, then return EPROBE_DEFER to the client driver.
-	 */
-	return ERR_PTR(-EPROBE_DEFER);
-}
-
 static int tegra234_mc_icc_get_init_bw(struct icc_node *node, u32 *avg, u32 *peak)
 {
 	*avg = 0;
@@ -939,7 +918,7 @@ static int tegra234_mc_icc_get_init_bw(struct icc_node *node, u32 *avg, u32 *pea
 }
 
 static const struct tegra_mc_icc_ops tegra234_mc_icc_ops = {
-	.xlate = tegra234_mc_of_icc_xlate,
+	.xlate = tegra_mc_icc_xlate,
 	.aggregate = tegra234_mc_icc_aggregate,
 	.get_bw = tegra234_mc_icc_get_init_bw,
 	.set = tegra234_mc_icc_set,
diff --git a/include/soc/tegra/mc.h b/include/soc/tegra/mc.h
index fc3001483e62..a5ef84944a06 100644
--- a/include/soc/tegra/mc.h
+++ b/include/soc/tegra/mc.h
@@ -175,6 +175,9 @@ struct tegra_mc_icc_ops {
 	int (*get_bw)(struct icc_node *node, u32 *avg, u32 *peak);
 };
 
+struct icc_node *tegra_mc_icc_xlate(struct of_phandle_args *spec, void *data);
+extern const struct tegra_mc_icc_ops tegra_mc_icc_ops;
+
 struct tegra_mc_ops {
 	/*
 	 * @probe: Callback to set up SoC-specific bits of the memory controller. This is called
-- 
2.41.0


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

* Re: [PATCH] memory: tegra: Add dummy implementation on Tegra194
  2023-06-29 16:01 [PATCH] memory: tegra: Add dummy implementation on Tegra194 Thierry Reding
@ 2023-07-06 19:22 ` Sumit Gupta
  2023-07-10 10:09 ` Krzysztof Kozlowski
  2023-07-10 10:10 ` Krzysztof Kozlowski
  2 siblings, 0 replies; 8+ messages in thread
From: Sumit Gupta @ 2023-07-06 19:22 UTC (permalink / raw)
  To: Thierry Reding; +Cc: Krzysztof Kozlowski, Jon Hunter, linux-tegra, linux-kernel



On 29/06/23 21:31, Thierry Reding wrote:
> External email: Use caution opening links or attachments
> 
> 
> From: Thierry Reding <treding@nvidia.com>
> 
> With the introduction of commit 9365bf006f53 ("PCI: tegra194: Add
> interconnect support in Tegra234"), the PCI driver on Tegra194 and later
> requires an interconnect provider. However, a provider is currently only
> exposed on Tegra234 and this causes PCI on Tegra194 to defer probe
> indefinitely.
> 
> Fix this by adding a dummy implementation on Tegra194. This allows nodes
> to be provided to interconnect consumers, but doesn't do any bandwidth
> accounting or frequency scaling.
> 
> Fixes: 9365bf006f53 ("PCI: tegra194: Add interconnect support in Tegra234")
> Reported-by: Jon Hunter <jonathanh@nvidia.com>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---

Reviewed-by: Sumit Gupta <sumitg@nvidia.com>
Tested-by: Sumit Gupta <sumitg@nvidia.com>

Thank you,
Sumit Gupta

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

* Re: [PATCH] memory: tegra: Add dummy implementation on Tegra194
  2023-06-29 16:01 [PATCH] memory: tegra: Add dummy implementation on Tegra194 Thierry Reding
  2023-07-06 19:22 ` Sumit Gupta
@ 2023-07-10 10:09 ` Krzysztof Kozlowski
  2023-07-10 10:10 ` Krzysztof Kozlowski
  2 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2023-07-10 10:09 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Krzysztof Kozlowski, Jon Hunter, Sumit Gupta, linux-tegra, linux-kernel


On Thu, 29 Jun 2023 18:01:32 +0200, Thierry Reding wrote:
> With the introduction of commit 9365bf006f53 ("PCI: tegra194: Add
> interconnect support in Tegra234"), the PCI driver on Tegra194 and later
> requires an interconnect provider. However, a provider is currently only
> exposed on Tegra234 and this causes PCI on Tegra194 to defer probe
> indefinitely.
> 
> Fix this by adding a dummy implementation on Tegra194. This allows nodes
> to be provided to interconnect consumers, but doesn't do any bandwidth
> accounting or frequency scaling.
> 
> [...]

Applied, thanks!

[1/1] memory: tegra: Add dummy implementation on Tegra194
      https://git.kernel.org/krzk/linux-mem-ctrl/c/d1478aea649e739a0a0e4890cd8b049ae5d08c13

Best regards,
-- 
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

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

* Re: [PATCH] memory: tegra: Add dummy implementation on Tegra194
  2023-06-29 16:01 [PATCH] memory: tegra: Add dummy implementation on Tegra194 Thierry Reding
  2023-07-06 19:22 ` Sumit Gupta
  2023-07-10 10:09 ` Krzysztof Kozlowski
@ 2023-07-10 10:10 ` Krzysztof Kozlowski
  2023-07-10 13:06   ` Thierry Reding
  2 siblings, 1 reply; 8+ messages in thread
From: Krzysztof Kozlowski @ 2023-07-10 10:10 UTC (permalink / raw)
  To: Thierry Reding; +Cc: Jon Hunter, Sumit Gupta, linux-tegra, linux-kernel

On 29/06/2023 18:01, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> With the introduction of commit 9365bf006f53 ("PCI: tegra194: Add
> interconnect support in Tegra234"), the PCI driver on Tegra194 and later
> requires an interconnect provider. However, a provider is currently only
> exposed on Tegra234 and this causes PCI on Tegra194 to defer probe
> indefinitely.
> 
> Fix this by adding a dummy implementation on Tegra194. This allows nodes
> to be provided to interconnect consumers, but doesn't do any bandwidth
> accounting or frequency scaling.
> 
> Fixes: 9365bf006f53 ("PCI: tegra194: Add interconnect support in Tegra234")
> Reported-by: Jon Hunter <jonathanh@nvidia.com>

Applied with checkpatch warning. Please be sure you run checkpatch
before sending the patches.

Best regards,
Krzysztof


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

* Re: [PATCH] memory: tegra: Add dummy implementation on Tegra194
  2023-07-10 10:10 ` Krzysztof Kozlowski
@ 2023-07-10 13:06   ` Thierry Reding
  2023-07-10 13:29     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 8+ messages in thread
From: Thierry Reding @ 2023-07-10 13:06 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: Jon Hunter, Sumit Gupta, linux-tegra, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1183 bytes --]

On Mon, Jul 10, 2023 at 12:10:43PM +0200, Krzysztof Kozlowski wrote:
> On 29/06/2023 18:01, Thierry Reding wrote:
> > From: Thierry Reding <treding@nvidia.com>
> > 
> > With the introduction of commit 9365bf006f53 ("PCI: tegra194: Add
> > interconnect support in Tegra234"), the PCI driver on Tegra194 and later
> > requires an interconnect provider. However, a provider is currently only
> > exposed on Tegra234 and this causes PCI on Tegra194 to defer probe
> > indefinitely.
> > 
> > Fix this by adding a dummy implementation on Tegra194. This allows nodes
> > to be provided to interconnect consumers, but doesn't do any bandwidth
> > accounting or frequency scaling.
> > 
> > Fixes: 9365bf006f53 ("PCI: tegra194: Add interconnect support in Tegra234")
> > Reported-by: Jon Hunter <jonathanh@nvidia.com>
> 
> Applied with checkpatch warning. Please be sure you run checkpatch
> before sending the patches.

Are you referring to the Reported-by/Closes complaint? I didn't include
a URL here because this came from an internal test report and there's no
corresponding public reference.

I suppose I could've left out the Reported-by altogether.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] memory: tegra: Add dummy implementation on Tegra194
  2023-07-10 13:06   ` Thierry Reding
@ 2023-07-10 13:29     ` Krzysztof Kozlowski
  2023-07-25 10:14       ` Jon Hunter
  0 siblings, 1 reply; 8+ messages in thread
From: Krzysztof Kozlowski @ 2023-07-10 13:29 UTC (permalink / raw)
  To: Thierry Reding; +Cc: Jon Hunter, Sumit Gupta, linux-tegra, linux-kernel

On 10/07/2023 15:06, Thierry Reding wrote:
> On Mon, Jul 10, 2023 at 12:10:43PM +0200, Krzysztof Kozlowski wrote:
>> On 29/06/2023 18:01, Thierry Reding wrote:
>>> From: Thierry Reding <treding@nvidia.com>
>>>
>>> With the introduction of commit 9365bf006f53 ("PCI: tegra194: Add
>>> interconnect support in Tegra234"), the PCI driver on Tegra194 and later
>>> requires an interconnect provider. However, a provider is currently only
>>> exposed on Tegra234 and this causes PCI on Tegra194 to defer probe
>>> indefinitely.
>>>
>>> Fix this by adding a dummy implementation on Tegra194. This allows nodes
>>> to be provided to interconnect consumers, but doesn't do any bandwidth
>>> accounting or frequency scaling.
>>>
>>> Fixes: 9365bf006f53 ("PCI: tegra194: Add interconnect support in Tegra234")
>>> Reported-by: Jon Hunter <jonathanh@nvidia.com>
>>
>> Applied with checkpatch warning. Please be sure you run checkpatch
>> before sending the patches.
> 
> Are you referring to the Reported-by/Closes complaint? 

Yes.

> I didn't include
> a URL here because this came from an internal test report and there's no
> corresponding public reference.

Ah, ok, apologies for pickiness then. :)

> 
> I suppose I could've left out the Reported-by altogether.

I think it is fine. Checkpatch warning is just advisory.


Best regards,
Krzysztof


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

* Re: [PATCH] memory: tegra: Add dummy implementation on Tegra194
  2023-07-10 13:29     ` Krzysztof Kozlowski
@ 2023-07-25 10:14       ` Jon Hunter
  2023-07-25 10:20         ` Krzysztof Kozlowski
  0 siblings, 1 reply; 8+ messages in thread
From: Jon Hunter @ 2023-07-25 10:14 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Thierry Reding
  Cc: Sumit Gupta, linux-tegra, linux-kernel

Hi Krzysztof,

On 10/07/2023 14:29, Krzysztof Kozlowski wrote:
> On 10/07/2023 15:06, Thierry Reding wrote:
>> On Mon, Jul 10, 2023 at 12:10:43PM +0200, Krzysztof Kozlowski wrote:
>>> On 29/06/2023 18:01, Thierry Reding wrote:
>>>> From: Thierry Reding <treding@nvidia.com>
>>>>
>>>> With the introduction of commit 9365bf006f53 ("PCI: tegra194: Add
>>>> interconnect support in Tegra234"), the PCI driver on Tegra194 and later
>>>> requires an interconnect provider. However, a provider is currently only
>>>> exposed on Tegra234 and this causes PCI on Tegra194 to defer probe
>>>> indefinitely.
>>>>
>>>> Fix this by adding a dummy implementation on Tegra194. This allows nodes
>>>> to be provided to interconnect consumers, but doesn't do any bandwidth
>>>> accounting or frequency scaling.
>>>>
>>>> Fixes: 9365bf006f53 ("PCI: tegra194: Add interconnect support in Tegra234")
>>>> Reported-by: Jon Hunter <jonathanh@nvidia.com>
>>>
>>> Applied with checkpatch warning. Please be sure you run checkpatch
>>> before sending the patches.
>>
>> Are you referring to the Reported-by/Closes complaint?
> 
> Yes.
> 
>> I didn't include
>> a URL here because this came from an internal test report and there's no
>> corresponding public reference.
> 
> Ah, ok, apologies for pickiness then. :)
> 
>>
>> I suppose I could've left out the Reported-by altogether.
> 
> I think it is fine. Checkpatch warning is just advisory.


We need this in v6.5 as a fix, because without this change PCIe support 
is broken on Tegra194 devices. Would you be able to send as a fix for v6.5?

Thanks!
Jon

-- 
nvpublic

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

* Re: [PATCH] memory: tegra: Add dummy implementation on Tegra194
  2023-07-25 10:14       ` Jon Hunter
@ 2023-07-25 10:20         ` Krzysztof Kozlowski
  0 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2023-07-25 10:20 UTC (permalink / raw)
  To: Jon Hunter, Thierry Reding; +Cc: Sumit Gupta, linux-tegra, linux-kernel

On 25/07/2023 12:14, Jon Hunter wrote:
> Hi Krzysztof,
> 
> On 10/07/2023 14:29, Krzysztof Kozlowski wrote:
>> On 10/07/2023 15:06, Thierry Reding wrote:
>>> On Mon, Jul 10, 2023 at 12:10:43PM +0200, Krzysztof Kozlowski wrote:
>>>> On 29/06/2023 18:01, Thierry Reding wrote:
>>>>> From: Thierry Reding <treding@nvidia.com>
>>>>>
>>>>> With the introduction of commit 9365bf006f53 ("PCI: tegra194: Add
>>>>> interconnect support in Tegra234"), the PCI driver on Tegra194 and later
>>>>> requires an interconnect provider. However, a provider is currently only
>>>>> exposed on Tegra234 and this causes PCI on Tegra194 to defer probe
>>>>> indefinitely.
>>>>>
>>>>> Fix this by adding a dummy implementation on Tegra194. This allows nodes
>>>>> to be provided to interconnect consumers, but doesn't do any bandwidth
>>>>> accounting or frequency scaling.
>>>>>
>>>>> Fixes: 9365bf006f53 ("PCI: tegra194: Add interconnect support in Tegra234")
>>>>> Reported-by: Jon Hunter <jonathanh@nvidia.com>
>>>>
>>>> Applied with checkpatch warning. Please be sure you run checkpatch
>>>> before sending the patches.
>>>
>>> Are you referring to the Reported-by/Closes complaint?
>>
>> Yes.
>>
>>> I didn't include
>>> a URL here because this came from an internal test report and there's no
>>> corresponding public reference.
>>
>> Ah, ok, apologies for pickiness then. :)
>>
>>>
>>> I suppose I could've left out the Reported-by altogether.
>>
>> I think it is fine. Checkpatch warning is just advisory.
> 
> 
> We need this in v6.5 as a fix, because without this change PCIe support 
> is broken on Tegra194 devices. Would you be able to send as a fix for v6.5?

Thanks for letting me know. I'll send it soon.

Best regards,
Krzysztof


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

end of thread, other threads:[~2023-07-25 10:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-29 16:01 [PATCH] memory: tegra: Add dummy implementation on Tegra194 Thierry Reding
2023-07-06 19:22 ` Sumit Gupta
2023-07-10 10:09 ` Krzysztof Kozlowski
2023-07-10 10:10 ` Krzysztof Kozlowski
2023-07-10 13:06   ` Thierry Reding
2023-07-10 13:29     ` Krzysztof Kozlowski
2023-07-25 10:14       ` Jon Hunter
2023-07-25 10:20         ` Krzysztof Kozlowski

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