mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-28 15:47:16 -04:00
Add a driver for Arm Ethos-U65/U85 NPUs. The Ethos-U NPU has a relatively simple interface with single command stream to describe buffers, operation settings, and network operations. It supports up to 8 memory regions (though no h/w bounds on a region). The Ethos NPUs are designed to use an SRAM for scratch memory. Region 2 is reserved for SRAM (like the downstream driver stack and compiler). Userspace doesn't need access to the SRAM. The h/w has no MMU nor external IOMMU and is a DMA engine which can read and write anywhere in memory without h/w bounds checks. The user submitted command streams must be validated against the bounds of the GEM BOs. This is similar to the VC4 design which validates shaders. The job submit is based on the rocket driver for the Rockchip NPU utilizing the GPU scheduler. It is simpler as there's only 1 core rather than 3. Tested on i.MX93 platform (U65) and FVP (U85) with Mesa Teflon support. Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Tomeu Vizoso <tomeu@tomeuvizoso.net> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20251020-ethos-v6-2-ecebc383c4b7@kernel.org Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
47 lines
1.2 KiB
C
47 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0 or MIT */
|
|
/* Copyright 2025 Arm, Ltd. */
|
|
|
|
#ifndef __ETHOSU_GEM_H__
|
|
#define __ETHOSU_GEM_H__
|
|
|
|
#include "ethosu_device.h"
|
|
#include <drm/drm_gem_dma_helper.h>
|
|
|
|
struct ethosu_validated_cmdstream_info {
|
|
u32 cmd_size;
|
|
u64 region_size[NPU_BASEP_REGION_MAX];
|
|
bool output_region[NPU_BASEP_REGION_MAX];
|
|
};
|
|
|
|
/**
|
|
* struct ethosu_gem_object - Driver specific GEM object.
|
|
*/
|
|
struct ethosu_gem_object {
|
|
/** @base: Inherit from drm_gem_shmem_object. */
|
|
struct drm_gem_dma_object base;
|
|
|
|
struct ethosu_validated_cmdstream_info *info;
|
|
|
|
/** @flags: Combination of drm_ethosu_bo_flags flags. */
|
|
u32 flags;
|
|
};
|
|
|
|
static inline
|
|
struct ethosu_gem_object *to_ethosu_bo(struct drm_gem_object *obj)
|
|
{
|
|
return container_of(to_drm_gem_dma_obj(obj), struct ethosu_gem_object, base);
|
|
}
|
|
|
|
struct drm_gem_object *ethosu_gem_create_object(struct drm_device *ddev,
|
|
size_t size);
|
|
|
|
int ethosu_gem_create_with_handle(struct drm_file *file,
|
|
struct drm_device *ddev,
|
|
u64 *size, u32 flags, uint32_t *handle);
|
|
|
|
int ethosu_gem_cmdstream_create(struct drm_file *file,
|
|
struct drm_device *ddev,
|
|
u32 size, u64 data, u32 flags, u32 *handle);
|
|
|
|
#endif /* __ETHOSU_GEM_H__ */
|