gpu: host1x: multi device support

Update the node names to support multi device config.

Bug 4505161
Jira NVGPU-11046

Signed-off-by: Santosh BS <santoshb@nvidia.com>
Change-Id: Id5cc345d9ee2eab96e0c999c9e6b510642a398d9
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3142192
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
This commit is contained in:
Santosh BS
2024-05-21 11:05:02 +00:00
committed by mobile promotions
parent 00cdac08b6
commit 566858f37f
3 changed files with 15 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* /*
* Copyright (C) 2012 Avionic Design GmbH * Copyright (C) 2012 Avionic Design GmbH
* Copyright (C) 2012-2013, NVIDIA Corporation * Copyright (C) 2012-2024, NVIDIA Corporation
*/ */
#include <nvidia/conftest.h> #include <nvidia/conftest.h>
@@ -337,7 +337,7 @@ static int host1x_del_client(struct host1x *host1x,
static int host1x_device_match(struct device *dev, struct device_driver *drv) 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 */ #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.coherent_dma_mask = host1x->dev->coherent_dma_mask;
device->dev.dma_mask = &device->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.release = host1x_device_release;
device->dev.bus = &host1x_bus_type; device->dev.bus = &host1x_bus_type;
device->dev.parent = host1x->dev; device->dev.parent = host1x->dev;

View File

@@ -50,7 +50,7 @@ int host1x_memory_context_list_init(struct host1x *host1x)
ctx->dma_mask = DMA_BIT_MASK(38); ctx->dma_mask = DMA_BIT_MASK(38);
ctx->dev.dma_mask = &ctx->dma_mask; ctx->dev.dma_mask = &ctx->dma_mask;
ctx->dev.coherent_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.bus = &host1x_context_device_bus_type;
ctx->dev.parent = host1x->dev; ctx->dev.parent = host1x->dev;

View File

@@ -3,7 +3,7 @@
* Copyright (C) 2010 Google, Inc. * Copyright (C) 2010 Google, Inc.
* Author: Erik Gilling <konkers@android.com> * Author: Erik Gilling <konkers@android.com>
* *
* Copyright (C) 2011-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * Copyright (C) 2011-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*/ */
#include <linux/debugfs.h> #include <linux/debugfs.h>
@@ -191,7 +191,16 @@ static const struct file_operations host1x_debug_fops = {
static void host1x_debugfs_init(struct host1x *host1x) 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 */ /* Store the created entry */
host1x->debugfs = de; host1x->debugfs = de;