ethosu_gem.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* SPDX-License-Identifier: GPL-2.0 or MIT */
  2. /* Copyright 2025 Arm, Ltd. */
  3. #ifndef __ETHOSU_GEM_H__
  4. #define __ETHOSU_GEM_H__
  5. #include "ethosu_device.h"
  6. #include <drm/drm_gem_dma_helper.h>
  7. struct ethosu_validated_cmdstream_info {
  8. u32 cmd_size;
  9. u64 region_size[NPU_BASEP_REGION_MAX];
  10. bool output_region[NPU_BASEP_REGION_MAX];
  11. };
  12. /**
  13. * struct ethosu_gem_object - Driver specific GEM object.
  14. */
  15. struct ethosu_gem_object {
  16. /** @base: Inherit from drm_gem_shmem_object. */
  17. struct drm_gem_dma_object base;
  18. struct ethosu_validated_cmdstream_info *info;
  19. /** @flags: Combination of drm_ethosu_bo_flags flags. */
  20. u32 flags;
  21. };
  22. static inline
  23. struct ethosu_gem_object *to_ethosu_bo(struct drm_gem_object *obj)
  24. {
  25. return container_of(to_drm_gem_dma_obj(obj), struct ethosu_gem_object, base);
  26. }
  27. struct drm_gem_object *ethosu_gem_create_object(struct drm_device *ddev,
  28. size_t size);
  29. int ethosu_gem_create_with_handle(struct drm_file *file,
  30. struct drm_device *ddev,
  31. u64 *size, u32 flags, uint32_t *handle);
  32. int ethosu_gem_cmdstream_create(struct drm_file *file,
  33. struct drm_device *ddev,
  34. u32 size, u64 data, u32 flags, u32 *handle);
  35. #endif /* __ETHOSU_GEM_H__ */