[PATCH 3/4] gpu: host1x: Support running without hv/common registers

From: Mikko Perttunen

Date: Mon Jun 22 2026 - 04:23:37 EST


Host1x can be used without access to the hypervisor or common regions
when they are configured by other components in the system. Add support
for running without access to them.

Signed-off-by: Mikko Perttunen <mperttunen@xxxxxxxxxx>
---
drivers/gpu/host1x/dev.c | 15 ++++++++++-----
drivers/gpu/host1x/hw/cdma_hw.c | 3 +++
drivers/gpu/host1x/hw/debug_hw_1x06.c | 3 +++
3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index 3f475f0e6545..545fa2e3f180 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -305,7 +305,7 @@ static void host1x_setup_virtualization_tables(struct host1x *host)
const struct host1x_info *info = host->info;
unsigned int i;

- if (!info->has_hypervisor)
+ if (!host->hv_regs)
return;

for (i = 0; i < info->num_sid_entries; i++) {
@@ -532,15 +532,20 @@ static int host1x_probe(struct platform_device *pdev)
host->info = of_device_get_match_data(&pdev->dev);

if (host->info->has_hypervisor) {
+ struct resource *res;
+
host->regs = devm_platform_ioremap_resource_byname(pdev, "vm");
if (IS_ERR(host->regs))
return PTR_ERR(host->regs);

- host->hv_regs = devm_platform_ioremap_resource_byname(pdev, "hypervisor");
- if (IS_ERR(host->hv_regs))
- return PTR_ERR(host->hv_regs);
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hypervisor");
+ if (res) {
+ host->hv_regs = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(host->hv_regs))
+ return PTR_ERR(host->hv_regs);
+ }

- if (host->info->has_common) {
+ if (res && host->info->has_common) {
host->common_regs = devm_platform_ioremap_resource_byname(pdev, "common");
if (IS_ERR(host->common_regs))
return PTR_ERR(host->common_regs);
diff --git a/drivers/gpu/host1x/hw/cdma_hw.c b/drivers/gpu/host1x/hw/cdma_hw.c
index 3f3f0018eee0..85f7e5633555 100644
--- a/drivers/gpu/host1x/hw/cdma_hw.c
+++ b/drivers/gpu/host1x/hw/cdma_hw.c
@@ -253,6 +253,9 @@ static void timeout_release_mlock(struct host1x_cdma *cdma)
struct host1x *host1x = cdma_to_host1x(cdma);
u32 offset;

+ if (!host1x->common_regs)
+ return;
+
switch (ch->client->class) {
case HOST1X_CLASS_NVJPG1:
offset = HOST1X_COMMON_NVJPG1_MLOCK;
diff --git a/drivers/gpu/host1x/hw/debug_hw_1x06.c b/drivers/gpu/host1x/hw/debug_hw_1x06.c
index 9d0667879a19..324e76436f7b 100644
--- a/drivers/gpu/host1x/hw/debug_hw_1x06.c
+++ b/drivers/gpu/host1x/hw/debug_hw_1x06.c
@@ -87,6 +87,9 @@ static void host1x_debug_show_channel_fifo(struct host1x *host,
host1x_debug_output(o, "CMDFIFO_RDATA %08x\n", val);

#if HOST1X_HW <= 6
+ if (!host->hv_regs)
+ return;
+
/* Peek pointer values are invalid during SLCG, so disable it */
host1x_hypervisor_writel(host, 0x1, HOST1X_HV_ICG_EN_OVERRIDE);


--
2.53.0