public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Patch] memory: tegra: Skip SID override from Guest VM
@ 2024-02-06 11:48 Sumit Gupta
  2024-02-06 12:00 ` Krzysztof Kozlowski
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Sumit Gupta @ 2024-02-06 11:48 UTC (permalink / raw)
  To: treding, krzysztof.kozlowski, jonathanh, maz, mark.rutland,
	linux-kernel, linux-tegra
  Cc: amhetre, bbasu, sumitg

MC SID register access is restricted for Guest VM.
So, skip the SID override programming from the Guest VM.

Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
---
 drivers/memory/tegra/tegra186.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/memory/tegra/tegra186.c b/drivers/memory/tegra/tegra186.c
index 1b3183951bfe..df441896b69d 100644
--- a/drivers/memory/tegra/tegra186.c
+++ b/drivers/memory/tegra/tegra186.c
@@ -10,6 +10,7 @@
 #include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
+#include <asm/virt.h>
 
 #include <soc/tegra/mc.h>
 
@@ -118,6 +119,11 @@ static int tegra186_mc_probe_device(struct tegra_mc *mc, struct device *dev)
 	unsigned int i, index = 0;
 	u32 sid;
 
+	if (!is_kernel_in_hyp_mode()) {
+		dev_dbg(mc->dev, "Register access not allowed\n");
+		return 0;
+	}
+
 	if (!tegra_dev_iommu_get_stream_id(dev, &sid))
 		return 0;
 
@@ -146,6 +152,11 @@ static int tegra186_mc_resume(struct tegra_mc *mc)
 #if IS_ENABLED(CONFIG_IOMMU_API)
 	unsigned int i;
 
+	if (!is_kernel_in_hyp_mode()) {
+		dev_dbg(mc->dev, "Register access not allowed\n");
+		return 0;
+	}
+
 	for (i = 0; i < mc->soc->num_clients; i++) {
 		const struct tegra_mc_client *client = &mc->soc->clients[i];
 
-- 
2.17.1


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

end of thread, other threads:[~2024-02-07 12:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-06 11:48 [Patch] memory: tegra: Skip SID override from Guest VM Sumit Gupta
2024-02-06 12:00 ` Krzysztof Kozlowski
2024-02-06 12:08 ` Mark Rutland
2024-02-06 12:17 ` Marc Zyngier
2024-02-06 12:28   ` Jon Hunter
2024-02-06 12:51     ` Jon Hunter
2024-02-06 12:54       ` Marc Zyngier
2024-02-06 12:53     ` Marc Zyngier
2024-02-06 14:07       ` Thierry Reding
2024-02-06 14:54         ` Marc Zyngier
2024-02-06 17:08           ` Thierry Reding
2024-02-07 12:03             ` Marc Zyngier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox