From 566858f37f29e3fc3f7f604fb434ba5e55a8223f Mon Sep 17 00:00:00 2001 From: Santosh BS Date: Tue, 21 May 2024 11:05:02 +0000 Subject: [PATCH] gpu: host1x: multi device support Update the node names to support multi device config. Bug 4505161 Jira NVGPU-11046 Signed-off-by: Santosh BS Change-Id: Id5cc345d9ee2eab96e0c999c9e6b510642a398d9 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3142192 Reviewed-by: Mikko Perttunen --- drivers/gpu/host1x/bus.c | 6 +++--- drivers/gpu/host1x/context.c | 2 +- drivers/gpu/host1x/debug.c | 13 +++++++++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c index 3777585e..2650906a 100644 --- a/drivers/gpu/host1x/bus.c +++ b/drivers/gpu/host1x/bus.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (C) 2012 Avionic Design GmbH - * Copyright (C) 2012-2013, NVIDIA Corporation + * Copyright (C) 2012-2024, NVIDIA Corporation */ #include @@ -337,7 +337,7 @@ static int host1x_del_client(struct host1x *host1x, static int host1x_device_match(struct device *dev, struct device_driver *drv) { - return strcmp(dev_name(dev), drv->name) == 0; + return strstr(dev_name(dev), drv->name) != NULL; } #if defined(NV_BUS_TYPE_STRUCT_UEVENT_HAS_CONST_DEV_ARG) /* Linux v6.3 */ @@ -476,7 +476,7 @@ static int host1x_device_add(struct host1x *host1x, device->dev.coherent_dma_mask = host1x->dev->coherent_dma_mask; device->dev.dma_mask = &device->dev.coherent_dma_mask; - dev_set_name(&device->dev, "%s", driver->driver.name); + dev_set_name(&device->dev, "%s.%s", dev_name(host1x->dev), driver->driver.name); device->dev.release = host1x_device_release; device->dev.bus = &host1x_bus_type; device->dev.parent = host1x->dev; diff --git a/drivers/gpu/host1x/context.c b/drivers/gpu/host1x/context.c index 2ddbba81..622beee2 100644 --- a/drivers/gpu/host1x/context.c +++ b/drivers/gpu/host1x/context.c @@ -50,7 +50,7 @@ int host1x_memory_context_list_init(struct host1x *host1x) ctx->dma_mask = DMA_BIT_MASK(38); ctx->dev.dma_mask = &ctx->dma_mask; ctx->dev.coherent_dma_mask = ctx->dma_mask; - dev_set_name(&ctx->dev, "host1x-ctx.%d", i); + dev_set_name(&ctx->dev, "%s.host1x-ctx.%d", dev_name(host1x->dev), i); ctx->dev.bus = &host1x_context_device_bus_type; ctx->dev.parent = host1x->dev; diff --git a/drivers/gpu/host1x/debug.c b/drivers/gpu/host1x/debug.c index ffb6979f..21e4103f 100644 --- a/drivers/gpu/host1x/debug.c +++ b/drivers/gpu/host1x/debug.c @@ -3,7 +3,7 @@ * Copyright (C) 2010 Google, Inc. * Author: Erik Gilling * - * Copyright (C) 2011-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (C) 2011-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ #include @@ -191,7 +191,16 @@ static const struct file_operations host1x_debug_fops = { static void host1x_debugfs_init(struct host1x *host1x) { - struct dentry *de = debugfs_create_dir("tegra-host1x", NULL); + struct dentry *de; + char dir_name[64]; + int numa_node = dev_to_node(host1x->dev); + + if (numa_node != NUMA_NO_NODE) + sprintf(dir_name, "tegra-host1x.%d", numa_node); + else + sprintf(dir_name, "tegra-host1x"); + + de = debugfs_create_dir(dir_name, NULL); /* Store the created entry */ host1x->debugfs = de;