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

drm_internal.h (8943B)


      1/*
      2 * Copyright © 2014 Intel Corporation
      3 *   Daniel Vetter <daniel.vetter@ffwll.ch>
      4 *
      5 * Permission is hereby granted, free of charge, to any person obtaining a
      6 * copy of this software and associated documentation files (the "Software"),
      7 * to deal in the Software without restriction, including without limitation
      8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      9 * and/or sell copies of the Software, and to permit persons to whom the
     10 * Software is furnished to do so, subject to the following conditions:
     11 *
     12 * The above copyright notice and this permission notice shall be included in
     13 * all copies or substantial portions of the Software.
     14 *
     15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     18 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
     19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     21 * OTHER DEALINGS IN THE SOFTWARE.
     22 */
     23
     24#include <linux/kthread.h>
     25
     26#include <drm/drm_ioctl.h>
     27#include <drm/drm_vblank.h>
     28
     29#define DRM_IF_MAJOR 1
     30#define DRM_IF_MINOR 4
     31
     32#define DRM_IF_VERSION(maj, min) (maj << 16 | min)
     33
     34struct dentry;
     35struct dma_buf;
     36struct iosys_map;
     37struct drm_connector;
     38struct drm_crtc;
     39struct drm_framebuffer;
     40struct drm_gem_object;
     41struct drm_master;
     42struct drm_minor;
     43struct drm_prime_file_private;
     44struct drm_printer;
     45struct drm_vblank_crtc;
     46
     47/* drm_file.c */
     48extern struct mutex drm_global_mutex;
     49bool drm_dev_needs_global_mutex(struct drm_device *dev);
     50struct drm_file *drm_file_alloc(struct drm_minor *minor);
     51void drm_file_free(struct drm_file *file);
     52void drm_lastclose(struct drm_device *dev);
     53
     54#ifdef CONFIG_PCI
     55
     56/* drm_pci.c */
     57int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master);
     58
     59#else
     60
     61static inline int drm_pci_set_busid(struct drm_device *dev,
     62				    struct drm_master *master)
     63{
     64	return -EINVAL;
     65}
     66
     67#endif
     68
     69/* drm_prime.c */
     70int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data,
     71				 struct drm_file *file_priv);
     72int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,
     73				 struct drm_file *file_priv);
     74
     75void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv);
     76void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv);
     77void drm_prime_remove_buf_handle_locked(struct drm_prime_file_private *prime_fpriv,
     78					struct dma_buf *dma_buf);
     79
     80/* drm_drv.c */
     81struct drm_minor *drm_minor_acquire(unsigned int minor_id);
     82void drm_minor_release(struct drm_minor *minor);
     83
     84/* drm_managed.c */
     85void drm_managed_release(struct drm_device *dev);
     86void drmm_add_final_kfree(struct drm_device *dev, void *container);
     87
     88/* drm_vblank.c */
     89static inline bool drm_vblank_passed(u64 seq, u64 ref)
     90{
     91	return (seq - ref) <= (1 << 23);
     92}
     93
     94void drm_vblank_disable_and_save(struct drm_device *dev, unsigned int pipe);
     95int drm_vblank_get(struct drm_device *dev, unsigned int pipe);
     96void drm_vblank_put(struct drm_device *dev, unsigned int pipe);
     97u64 drm_vblank_count(struct drm_device *dev, unsigned int pipe);
     98
     99/* drm_vblank_work.c */
    100static inline void drm_vblank_flush_worker(struct drm_vblank_crtc *vblank)
    101{
    102	kthread_flush_worker(vblank->worker);
    103}
    104
    105static inline void drm_vblank_destroy_worker(struct drm_vblank_crtc *vblank)
    106{
    107	kthread_destroy_worker(vblank->worker);
    108}
    109
    110int drm_vblank_worker_init(struct drm_vblank_crtc *vblank);
    111void drm_vblank_cancel_pending_works(struct drm_vblank_crtc *vblank);
    112void drm_handle_vblank_works(struct drm_vblank_crtc *vblank);
    113
    114/* IOCTLS */
    115int drm_wait_vblank_ioctl(struct drm_device *dev, void *data,
    116			  struct drm_file *filp);
    117int drm_legacy_modeset_ctl_ioctl(struct drm_device *dev, void *data,
    118				 struct drm_file *file_priv);
    119
    120/* drm_irq.c */
    121
    122/* IOCTLS */
    123#if IS_ENABLED(CONFIG_DRM_LEGACY)
    124int drm_legacy_irq_control(struct drm_device *dev, void *data,
    125			   struct drm_file *file_priv);
    126#endif
    127
    128int drm_crtc_get_sequence_ioctl(struct drm_device *dev, void *data,
    129				struct drm_file *filp);
    130
    131int drm_crtc_queue_sequence_ioctl(struct drm_device *dev, void *data,
    132				  struct drm_file *filp);
    133
    134/* drm_auth.c */
    135int drm_getmagic(struct drm_device *dev, void *data,
    136		 struct drm_file *file_priv);
    137int drm_authmagic(struct drm_device *dev, void *data,
    138		  struct drm_file *file_priv);
    139int drm_setmaster_ioctl(struct drm_device *dev, void *data,
    140			struct drm_file *file_priv);
    141int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
    142			 struct drm_file *file_priv);
    143int drm_master_open(struct drm_file *file_priv);
    144void drm_master_release(struct drm_file *file_priv);
    145bool drm_master_internal_acquire(struct drm_device *dev);
    146void drm_master_internal_release(struct drm_device *dev);
    147
    148/* drm_sysfs.c */
    149extern struct class *drm_class;
    150
    151int drm_sysfs_init(void);
    152void drm_sysfs_destroy(void);
    153struct device *drm_sysfs_minor_alloc(struct drm_minor *minor);
    154int drm_sysfs_connector_add(struct drm_connector *connector);
    155void drm_sysfs_connector_remove(struct drm_connector *connector);
    156
    157void drm_sysfs_lease_event(struct drm_device *dev);
    158
    159/* drm_gem.c */
    160int drm_gem_init(struct drm_device *dev);
    161int drm_gem_handle_create_tail(struct drm_file *file_priv,
    162			       struct drm_gem_object *obj,
    163			       u32 *handlep);
    164int drm_gem_close_ioctl(struct drm_device *dev, void *data,
    165			struct drm_file *file_priv);
    166int drm_gem_flink_ioctl(struct drm_device *dev, void *data,
    167			struct drm_file *file_priv);
    168int drm_gem_open_ioctl(struct drm_device *dev, void *data,
    169		       struct drm_file *file_priv);
    170void drm_gem_open(struct drm_device *dev, struct drm_file *file_private);
    171void drm_gem_release(struct drm_device *dev, struct drm_file *file_private);
    172void drm_gem_print_info(struct drm_printer *p, unsigned int indent,
    173			const struct drm_gem_object *obj);
    174
    175int drm_gem_pin(struct drm_gem_object *obj);
    176void drm_gem_unpin(struct drm_gem_object *obj);
    177int drm_gem_vmap(struct drm_gem_object *obj, struct iosys_map *map);
    178void drm_gem_vunmap(struct drm_gem_object *obj, struct iosys_map *map);
    179
    180int drm_gem_dumb_destroy(struct drm_file *file, struct drm_device *dev,
    181			 u32 handle);
    182
    183/* drm_debugfs.c drm_debugfs_crc.c */
    184#if defined(CONFIG_DEBUG_FS)
    185int drm_debugfs_init(struct drm_minor *minor, int minor_id,
    186		     struct dentry *root);
    187void drm_debugfs_cleanup(struct drm_minor *minor);
    188void drm_debugfs_connector_add(struct drm_connector *connector);
    189void drm_debugfs_connector_remove(struct drm_connector *connector);
    190void drm_debugfs_crtc_add(struct drm_crtc *crtc);
    191void drm_debugfs_crtc_remove(struct drm_crtc *crtc);
    192void drm_debugfs_crtc_crc_add(struct drm_crtc *crtc);
    193#else
    194static inline int drm_debugfs_init(struct drm_minor *minor, int minor_id,
    195				   struct dentry *root)
    196{
    197	return 0;
    198}
    199
    200static inline void drm_debugfs_cleanup(struct drm_minor *minor)
    201{
    202}
    203
    204static inline void drm_debugfs_connector_add(struct drm_connector *connector)
    205{
    206}
    207static inline void drm_debugfs_connector_remove(struct drm_connector *connector)
    208{
    209}
    210
    211static inline void drm_debugfs_crtc_add(struct drm_crtc *crtc)
    212{
    213}
    214static inline void drm_debugfs_crtc_remove(struct drm_crtc *crtc)
    215{
    216}
    217
    218static inline void drm_debugfs_crtc_crc_add(struct drm_crtc *crtc)
    219{
    220}
    221
    222#endif
    223
    224drm_ioctl_t drm_version;
    225drm_ioctl_t drm_getunique;
    226drm_ioctl_t drm_getclient;
    227
    228/* drm_syncobj.c */
    229void drm_syncobj_open(struct drm_file *file_private);
    230void drm_syncobj_release(struct drm_file *file_private);
    231int drm_syncobj_create_ioctl(struct drm_device *dev, void *data,
    232			     struct drm_file *file_private);
    233int drm_syncobj_destroy_ioctl(struct drm_device *dev, void *data,
    234			      struct drm_file *file_private);
    235int drm_syncobj_handle_to_fd_ioctl(struct drm_device *dev, void *data,
    236				   struct drm_file *file_private);
    237int drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, void *data,
    238				   struct drm_file *file_private);
    239int drm_syncobj_transfer_ioctl(struct drm_device *dev, void *data,
    240			       struct drm_file *file_private);
    241int drm_syncobj_wait_ioctl(struct drm_device *dev, void *data,
    242			   struct drm_file *file_private);
    243int drm_syncobj_timeline_wait_ioctl(struct drm_device *dev, void *data,
    244				    struct drm_file *file_private);
    245int drm_syncobj_reset_ioctl(struct drm_device *dev, void *data,
    246			    struct drm_file *file_private);
    247int drm_syncobj_signal_ioctl(struct drm_device *dev, void *data,
    248			     struct drm_file *file_private);
    249int drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data,
    250				      struct drm_file *file_private);
    251int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
    252			    struct drm_file *file_private);
    253
    254/* drm_framebuffer.c */
    255void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent,
    256				const struct drm_framebuffer *fb);
    257void drm_framebuffer_debugfs_init(struct drm_minor *minor);