cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

armada_gem.h (1430B)


      1/* SPDX-License-Identifier: GPL-2.0-only */
      2/*
      3 * Copyright (C) 2012 Russell King
      4 */
      5#ifndef ARMADA_GEM_H
      6#define ARMADA_GEM_H
      7
      8#include <drm/drm_gem.h>
      9
     10/* GEM */
     11struct armada_gem_object {
     12	struct drm_gem_object	obj;
     13	void			*addr;
     14	phys_addr_t		phys_addr;
     15	resource_size_t		dev_addr;
     16	bool			mapped;
     17	struct drm_mm_node	*linear;	/* for linear backed */
     18	struct page		*page;		/* for page backed */
     19	struct sg_table		*sgt;		/* for imported */
     20	void			(*update)(void *);
     21	void			*update_data;
     22};
     23
     24#define drm_to_armada_gem(o) container_of(o, struct armada_gem_object, obj)
     25
     26void armada_gem_free_object(struct drm_gem_object *);
     27int armada_gem_linear_back(struct drm_device *, struct armada_gem_object *);
     28void *armada_gem_map_object(struct drm_device *, struct armada_gem_object *);
     29struct armada_gem_object *armada_gem_alloc_private_object(struct drm_device *,
     30	size_t);
     31int armada_gem_dumb_create(struct drm_file *, struct drm_device *,
     32	struct drm_mode_create_dumb *);
     33struct dma_buf *armada_gem_prime_export(struct drm_gem_object *obj, int flags);
     34struct drm_gem_object *armada_gem_prime_import(struct drm_device *,
     35	struct dma_buf *);
     36int armada_gem_map_import(struct armada_gem_object *);
     37
     38static inline struct armada_gem_object *armada_gem_object_lookup(
     39	struct drm_file *dfile, unsigned handle)
     40{
     41	struct drm_gem_object *obj = drm_gem_object_lookup(dfile, handle);
     42
     43	return obj ? drm_to_armada_gem(obj) : NULL;
     44}
     45#endif