mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 12:35:52 +02:00
This uses the SHMEM DRM helpers and we map right away to the CPU and NPU sides, as all buffers are expected to be accessed from both. v2: - Sync the IOMMUs for the other cores when mapping and unmapping. v3: - Make use of GPL-2.0-only for the copyright notice (Jeff Hugo) v6: - Use mutexes guard (Markus Elfring) v7: - Assign its own IOMMU domain to each client, for isolation (Daniel Stone and Robin Murphy) v8: - Correctly acquire a reference to the IOMMU (Robin Murphy) - Allocate DMA address ourselves with drm_mm (Robin Murphy) - Use refcount_read (Heiko Stuebner) - Remove superfluous dma_sync_sgtable_for_device (Robin Murphy) Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Tomeu Vizoso <tomeu@tomeuvizoso.net> Signed-off-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com> Link: https://lore.kernel.org/r/20250721-6-10-rocket-v9-3-77ebd484941e@tomeuvizoso.net
31 lines
743 B
C
31 lines
743 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/* Copyright 2024-2025 Tomeu Vizoso <tomeu@tomeuvizoso.net> */
|
|
|
|
#ifndef __ROCKET_GEM_H__
|
|
#define __ROCKET_GEM_H__
|
|
|
|
#include <drm/drm_gem_shmem_helper.h>
|
|
|
|
struct rocket_gem_object {
|
|
struct drm_gem_shmem_object base;
|
|
|
|
struct rocket_file_priv *driver_priv;
|
|
|
|
struct rocket_iommu_domain *domain;
|
|
struct drm_mm_node mm;
|
|
size_t size;
|
|
u32 offset;
|
|
};
|
|
|
|
struct drm_gem_object *rocket_gem_create_object(struct drm_device *dev, size_t size);
|
|
|
|
int rocket_ioctl_create_bo(struct drm_device *dev, void *data, struct drm_file *file);
|
|
|
|
static inline
|
|
struct rocket_gem_object *to_rocket_bo(struct drm_gem_object *obj)
|
|
{
|
|
return container_of(to_drm_gem_shmem_obj(obj), struct rocket_gem_object, base);
|
|
}
|
|
|
|
#endif
|