History

Merge tag 'drm-intel-next-2022-02-08' of git://anongit.freedesktop.org/drm/drm-intel into drm-next

Cross-subsystem Changes: ------------------------ dma-buf: - dma-buf-map: Rename to iosys-map (Lucas) Core Changes: ------------- drm: - Always include the debugfs_entry in drm_crtc (Ville) - Add orientation quirk for GPD Win Max (Anisse) Driver Changes: --------------- gvt: - Constify some pointers. (Rikard Falkeborn) - Use list_entry to access list members. (Guenter Roeck) - Fix cmd parser error for Passmark9. (Zhenyu Wang) i915: - Various clean-ups including headers and removing unused and unnecessary stuff\ (Jani, Hans, Andy, Ville) - Cleaning up on our registers definitions i915_reg.h (Matt) - More multi-FBC refactoring (Ville) - Baytrail backlight fix (Hans) - DG1 OPROM read through SPI controller (Clint) - ADL-N platform enabling (Tejas) - Fix slab-out-of-bounds access (Jani) - Add opregion mailbox #5 support for possible EDID override (Anisse) - Fix possible NULL dereferences (Harish) - Updates and fixes around display voltage swing values (Clint, Jose) - Fix RPM wekeref on PXP code (Juston) - Many register definitions clean-up, including planes registers (Ville) - More conversion towards display version over the old gen (Madhumitha, Ville) - DP MST ESI handling improvements (Jani) - drm device based logging conversions (Jani) - Prevent divide by zero (Dan) - Introduce ilk_pch_pre_enable for complete modeset abstraction (Ville) - Async flip optimization for DG2 (Stanislav) - Multiple DSC and bigjoiner fixes and improvements (Ville) - Fix ADL-P TypeC Phy ready status readout (Imre) - Fix up DP DFP 4:2:0 handling more display related fixes (Ville) - Display M/N cleanup (Ville) - Switch to use VGA definitions from video/vga.h (Jani) - Fixes and improvements to abstract CPU architecture (Lucas) - Disable unsused power wells left enabled by BIOS (Imre) - Allow !join_mbus cases for adlp+ dbuf configuration (Ville) - Populate pipe dbuf slices more accurately during readout (Ville) - Workaround broken BIOS DBUF configuration on TGL/RKL (Ville) - Fix trailing semicolon (Lucas) Signed-off-by: Dave Airlie <airlied@redhat.com>

Dave Airlie committed 4 years ago

Commit e7a09ce2 parents 53dbee4 7938f42273 files · +6341 −5854Browse files

Showing the changes to include (17 of 273 files). Show all

Unified · Split

17 files
  1. include/drm/drm_cache.h +3 −3
  2. include/drm/drm_client.h +4 −3
  3. include/drm/drm_crtc.h +0 −2
  4. include/drm/drm_gem.h +3 −3
  5. include/drm/drm_gem_atomic_helper.h +3 −3
  6. include/drm/drm_gem_cma_helper.h +4 −2
  7. include/drm/drm_gem_framebuffer_helper.h +4 −4
  8. include/drm/drm_gem_shmem_helper.h +8 −4
  9. include/drm/drm_gem_ttm_helper.h +3 −3
  10. include/drm/drm_gem_vram_helper.h +5 −4
  11. include/drm/drm_prime.h +3 −3
  12. include/drm/i915_pciids.h +6 −0
  13. include/drm/ttm/ttm_bo_api.h +5 −5
  14. include/drm/ttm/ttm_kmap_iter.h +5 −5
  15. include/drm/ttm/ttm_resource.h +3 −3
  16. include/linux/dma-buf.h +6 −6
  17. include/linux/iosys-map.h +257 −0
include/drm/drm_cache.h+3−3
@@ -35,7 +35,7 @@ · 34 unmodified lines
35 35
36#include <linux/scatterlist.h>36#include <linux/scatterlist.h>
37 37
38struct dma_buf_map;38struct iosys_map;
39 39
40void drm_clflush_pages(struct page *pages[], unsigned long num_pages);40void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
41void drm_clflush_sg(struct sg_table *st);41void drm_clflush_sg(struct sg_table *st);
@@ -74,7 +74,7 @@ static inline bool drm_arch_can_wc_memory(void) · 32 unmodified lines
74 74
75void drm_memcpy_init_early(void);75void drm_memcpy_init_early(void);
76 76
77void drm_memcpy_from_wc(struct dma_buf_map *dst,77void drm_memcpy_from_wc(struct iosys_map *dst,
78 const struct dma_buf_map *src,78 const struct iosys_map *src,
79 unsigned long len);79 unsigned long len);
80#endif80#endif
include/drm/drm_client.h+4−3
@@ -3,7 +3,7 @@ · 2 unmodified lines
3#ifndef _DRM_CLIENT_H_3#ifndef _DRM_CLIENT_H_
4#define _DRM_CLIENT_H_4#define _DRM_CLIENT_H_
5 5
6#include <linux/dma-buf-map.h>6#include <linux/iosys-map.h>
7#include <linux/lockdep.h>7#include <linux/lockdep.h>
8#include <linux/mutex.h>8#include <linux/mutex.h>
9#include <linux/types.h>9#include <linux/types.h>
@@ -144,7 +144,7 @@ struct drm_client_buffer { · 134 unmodified lines
144 /**144 /**
145 * @map: Virtual address for the buffer145 * @map: Virtual address for the buffer
146 */146 */
147 struct dma_buf_map map;147 struct iosys_map map;
148 148
149 /**149 /**
150 * @fb: DRM framebuffer150 * @fb: DRM framebuffer
@@ -156,7 +156,8 @@ struct drm_client_buffer * · 5 unmodified lines
156drm_client_framebuffer_create(struct drm_client_dev *client, u32 width, u32 height, u32 format);156drm_client_framebuffer_create(struct drm_client_dev *client, u32 width, u32 height, u32 format);
157void drm_client_framebuffer_delete(struct drm_client_buffer *buffer);157void drm_client_framebuffer_delete(struct drm_client_buffer *buffer);
158int drm_client_framebuffer_flush(struct drm_client_buffer *buffer, struct drm_rect *rect);158int drm_client_framebuffer_flush(struct drm_client_buffer *buffer, struct drm_rect *rect);
159int drm_client_buffer_vmap(struct drm_client_buffer *buffer, struct dma_buf_map *map);159int drm_client_buffer_vmap(struct drm_client_buffer *buffer,
160 struct iosys_map *map);
160void drm_client_buffer_vunmap(struct drm_client_buffer *buffer);161void drm_client_buffer_vunmap(struct drm_client_buffer *buffer);
161 162
162int drm_client_modeset_create(struct drm_client_dev *client);163int drm_client_modeset_create(struct drm_client_dev *client);
include/drm/drm_crtc.h+0−2
@@ -1145,14 +1145,12 @@ struct drm_crtc { · 1144 unmodified lines
1145 */1145 */
1146 spinlock_t commit_lock;1146 spinlock_t commit_lock;
1147 1147
1148#ifdef CONFIG_DEBUG_FS
1149 /**1148 /**
1150 * @debugfs_entry:1149 * @debugfs_entry:
1151 *1150 *
1152 * Debugfs directory for this CRTC.1151 * Debugfs directory for this CRTC.
1153 */1152 */
1154 struct dentry *debugfs_entry;1153 struct dentry *debugfs_entry;
1155#endif
1156 1154
1157 /**1155 /**
1158 * @crc:1156 * @crc:
include/drm/drm_gem.h+3−3
@@ -39,7 +39,7 @@ · 38 unmodified lines
39 39
40#include <drm/drm_vma_manager.h>40#include <drm/drm_vma_manager.h>
41 41
42struct dma_buf_map;42struct iosys_map;
43struct drm_gem_object;43struct drm_gem_object;
44 44
45/**45/**
@@ -139,7 +139,7 @@ struct drm_gem_object_funcs { · 93 unmodified lines
139 *139 *
140 * This callback is optional.140 * This callback is optional.
141 */141 */
142 int (*vmap)(struct drm_gem_object *obj, struct dma_buf_map *map);142 int (*vmap)(struct drm_gem_object *obj, struct iosys_map *map);
143 143
144 /**144 /**
145 * @vunmap:145 * @vunmap:
@@ -149,7 +149,7 @@ struct drm_gem_object_funcs { · 3 unmodified lines
149 *149 *
150 * This callback is optional.150 * This callback is optional.
151 */151 */
152 void (*vunmap)(struct drm_gem_object *obj, struct dma_buf_map *map);152 void (*vunmap)(struct drm_gem_object *obj, struct iosys_map *map);
153 153
154 /**154 /**
155 * @mmap:155 * @mmap:
include/drm/drm_gem_atomic_helper.h+3−3
@@ -3,7 +3,7 @@ · 2 unmodified lines
3#ifndef __DRM_GEM_ATOMIC_HELPER_H__3#ifndef __DRM_GEM_ATOMIC_HELPER_H__
4#define __DRM_GEM_ATOMIC_HELPER_H__4#define __DRM_GEM_ATOMIC_HELPER_H__
5 5
6#include <linux/dma-buf-map.h>6#include <linux/iosys-map.h>
7 7
8#include <drm/drm_fourcc.h>8#include <drm/drm_fourcc.h>
9#include <drm/drm_plane.h>9#include <drm/drm_plane.h>
@@ -59,7 +59,7 @@ struct drm_shadow_plane_state { · 49 unmodified lines
59 * The memory mappings stored in map should be established in the plane's59 * The memory mappings stored in map should be established in the plane's
60 * prepare_fb callback and removed in the cleanup_fb callback.60 * prepare_fb callback and removed in the cleanup_fb callback.
61 */61 */
62 struct dma_buf_map map[DRM_FORMAT_MAX_PLANES];62 struct iosys_map map[DRM_FORMAT_MAX_PLANES];
63 63
64 /**64 /**
65 * @data: Address of each framebuffer BO's data65 * @data: Address of each framebuffer BO's data
@@ -67,7 +67,7 @@ struct drm_shadow_plane_state { · 1 unmodified line
67 * The address of the data stored in each mapping. This is different67 * The address of the data stored in each mapping. This is different
68 * for framebuffers with non-zero offset fields.68 * for framebuffers with non-zero offset fields.
69 */69 */
70 struct dma_buf_map data[DRM_FORMAT_MAX_PLANES];70 struct iosys_map data[DRM_FORMAT_MAX_PLANES];
71};71};
72 72
73/**73/**
include/drm/drm_gem_cma_helper.h+4−2
@@ -38,7 +38,8 @@ void drm_gem_cma_free(struct drm_gem_cma_object *cma_obj); · 37 unmodified lines
38void drm_gem_cma_print_info(const struct drm_gem_cma_object *cma_obj,38void drm_gem_cma_print_info(const struct drm_gem_cma_object *cma_obj,
39 struct drm_printer *p, unsigned int indent);39 struct drm_printer *p, unsigned int indent);
40struct sg_table *drm_gem_cma_get_sg_table(struct drm_gem_cma_object *cma_obj);40struct sg_table *drm_gem_cma_get_sg_table(struct drm_gem_cma_object *cma_obj);
41int drm_gem_cma_vmap(struct drm_gem_cma_object *cma_obj, struct dma_buf_map *map);41int drm_gem_cma_vmap(struct drm_gem_cma_object *cma_obj,
42 struct iosys_map *map);
42int drm_gem_cma_mmap(struct drm_gem_cma_object *cma_obj, struct vm_area_struct *vma);43int drm_gem_cma_mmap(struct drm_gem_cma_object *cma_obj, struct vm_area_struct *vma);
43 44
44extern const struct vm_operations_struct drm_gem_cma_vm_ops;45extern const struct vm_operations_struct drm_gem_cma_vm_ops;
@@ -106,7 +107,8 @@ static inline struct sg_table *drm_gem_cma_object_get_sg_table(struct drm_gem_ob · 61 unmodified lines
106 * Returns:107 * Returns:
107 * 0 on success or a negative error code on failure.108 * 0 on success or a negative error code on failure.
108 */109 */
109static inline int drm_gem_cma_object_vmap(struct drm_gem_object *obj, struct dma_buf_map *map)110static inline int drm_gem_cma_object_vmap(struct drm_gem_object *obj,
111 struct iosys_map *map)
110{112{
111 struct drm_gem_cma_object *cma_obj = to_drm_gem_cma_obj(obj);113 struct drm_gem_cma_object *cma_obj = to_drm_gem_cma_obj(obj);
112 114
include/drm/drm_gem_framebuffer_helper.h+4−4
@@ -2,7 +2,7 @@ · 1 unmodified line
2#define __DRM_GEM_FB_HELPER_H__2#define __DRM_GEM_FB_HELPER_H__
3 3
4#include <linux/dma-buf.h>4#include <linux/dma-buf.h>
5#include <linux/dma-buf-map.h>5#include <linux/iosys-map.h>
6 6
7#include <drm/drm_fourcc.h>7#include <drm/drm_fourcc.h>
8 8
@@ -40,10 +40,10 @@ drm_gem_fb_create_with_dirty(struct drm_device *dev, struct drm_file *file, · 31 unmodified lines
40 const struct drm_mode_fb_cmd2 *mode_cmd);40 const struct drm_mode_fb_cmd2 *mode_cmd);
41 41
42int drm_gem_fb_vmap(struct drm_framebuffer *fb,42int drm_gem_fb_vmap(struct drm_framebuffer *fb,
43 struct dma_buf_map map[static DRM_FORMAT_MAX_PLANES],43 struct iosys_map map[static DRM_FORMAT_MAX_PLANES],
44 struct dma_buf_map data[DRM_FORMAT_MAX_PLANES]);44 struct iosys_map data[DRM_FORMAT_MAX_PLANES]);
45void drm_gem_fb_vunmap(struct drm_framebuffer *fb,45void drm_gem_fb_vunmap(struct drm_framebuffer *fb,
46 struct dma_buf_map map[static DRM_FORMAT_MAX_PLANES]);46 struct iosys_map map[static DRM_FORMAT_MAX_PLANES]);
47int drm_gem_fb_begin_cpu_access(struct drm_framebuffer *fb, enum dma_data_direction dir);47int drm_gem_fb_begin_cpu_access(struct drm_framebuffer *fb, enum dma_data_direction dir);
48void drm_gem_fb_end_cpu_access(struct drm_framebuffer *fb, enum dma_data_direction dir);48void drm_gem_fb_end_cpu_access(struct drm_framebuffer *fb, enum dma_data_direction dir);
49 49
include/drm/drm_gem_shmem_helper.h+8−4
@@ -113,8 +113,10 @@ int drm_gem_shmem_get_pages(struct drm_gem_shmem_object *shmem); · 112 unmodified lines
113void drm_gem_shmem_put_pages(struct drm_gem_shmem_object *shmem);113void drm_gem_shmem_put_pages(struct drm_gem_shmem_object *shmem);
114int drm_gem_shmem_pin(struct drm_gem_shmem_object *shmem);114int drm_gem_shmem_pin(struct drm_gem_shmem_object *shmem);
115void drm_gem_shmem_unpin(struct drm_gem_shmem_object *shmem);115void drm_gem_shmem_unpin(struct drm_gem_shmem_object *shmem);
116int drm_gem_shmem_vmap(struct drm_gem_shmem_object *shmem, struct dma_buf_map *map);116int drm_gem_shmem_vmap(struct drm_gem_shmem_object *shmem,
117void drm_gem_shmem_vunmap(struct drm_gem_shmem_object *shmem, struct dma_buf_map *map);117 struct iosys_map *map);
118void drm_gem_shmem_vunmap(struct drm_gem_shmem_object *shmem,
119 struct iosys_map *map);
118int drm_gem_shmem_mmap(struct drm_gem_shmem_object *shmem, struct vm_area_struct *vma);120int drm_gem_shmem_mmap(struct drm_gem_shmem_object *shmem, struct vm_area_struct *vma);
119 121
120int drm_gem_shmem_madvise(struct drm_gem_shmem_object *shmem, int madv);122int drm_gem_shmem_madvise(struct drm_gem_shmem_object *shmem, int madv);
@@ -226,7 +228,8 @@ static inline struct sg_table *drm_gem_shmem_object_get_sg_table(struct drm_gem_ · 105 unmodified lines
226 * Returns:228 * Returns:
227 * 0 on success or a negative error code on failure.229 * 0 on success or a negative error code on failure.
228 */230 */
229static inline int drm_gem_shmem_object_vmap(struct drm_gem_object *obj, struct dma_buf_map *map)231static inline int drm_gem_shmem_object_vmap(struct drm_gem_object *obj,
232 struct iosys_map *map)
230{233{
231 struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(obj);234 struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(obj);
232 235
@@ -241,7 +244,8 @@ static inline int drm_gem_shmem_object_vmap(struct drm_gem_object *obj, struct d · 8 unmodified lines
241 * This function wraps drm_gem_shmem_vunmap(). Drivers that employ the shmem helpers should244 * This function wraps drm_gem_shmem_vunmap(). Drivers that employ the shmem helpers should
242 * use it as their &drm_gem_object_funcs.vunmap handler.245 * use it as their &drm_gem_object_funcs.vunmap handler.
243 */246 */
244static inline void drm_gem_shmem_object_vunmap(struct drm_gem_object *obj, struct dma_buf_map *map)247static inline void drm_gem_shmem_object_vunmap(struct drm_gem_object *obj,
248 struct iosys_map *map)
245{249{
246 struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(obj);250 struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(obj);
247 251
include/drm/drm_gem_ttm_helper.h+3−3
@@ -10,7 +10,7 @@ · 9 unmodified lines
10#include <drm/ttm/ttm_bo_api.h>10#include <drm/ttm/ttm_bo_api.h>
11#include <drm/ttm/ttm_bo_driver.h>11#include <drm/ttm/ttm_bo_driver.h>
12 12
13struct dma_buf_map;13struct iosys_map;
14 14
15#define drm_gem_ttm_of_gem(gem_obj) \15#define drm_gem_ttm_of_gem(gem_obj) \
16 container_of(gem_obj, struct ttm_buffer_object, base)16 container_of(gem_obj, struct ttm_buffer_object, base)
@@ -18,9 +18,9 @@ struct dma_buf_map; · 1 unmodified line
18void drm_gem_ttm_print_info(struct drm_printer *p, unsigned int indent,18void drm_gem_ttm_print_info(struct drm_printer *p, unsigned int indent,
19 const struct drm_gem_object *gem);19 const struct drm_gem_object *gem);
20int drm_gem_ttm_vmap(struct drm_gem_object *gem,20int drm_gem_ttm_vmap(struct drm_gem_object *gem,
21 struct dma_buf_map *map);21 struct iosys_map *map);
22void drm_gem_ttm_vunmap(struct drm_gem_object *gem,22void drm_gem_ttm_vunmap(struct drm_gem_object *gem,
23 struct dma_buf_map *map);23 struct iosys_map *map);
24int drm_gem_ttm_mmap(struct drm_gem_object *gem,24int drm_gem_ttm_mmap(struct drm_gem_object *gem,
25 struct vm_area_struct *vma);25 struct vm_area_struct *vma);
26 26
include/drm/drm_gem_vram_helper.h+5−4
@@ -12,7 +12,7 @@ · 11 unmodified lines
12#include <drm/ttm/ttm_bo_driver.h>12#include <drm/ttm/ttm_bo_driver.h>
13 13
14#include <linux/container_of.h>14#include <linux/container_of.h>
15#include <linux/dma-buf-map.h>15#include <linux/iosys-map.h>
16 16
17struct drm_mode_create_dumb;17struct drm_mode_create_dumb;
18struct drm_plane;18struct drm_plane;
@@ -51,7 +51,7 @@ struct vm_area_struct; · 32 unmodified lines
51 */51 */
52struct drm_gem_vram_object {52struct drm_gem_vram_object {
53 struct ttm_buffer_object bo;53 struct ttm_buffer_object bo;
54 struct dma_buf_map map;54 struct iosys_map map;
55 55
56 /**56 /**
57 * @vmap_use_count:57 * @vmap_use_count:
@@ -97,8 +97,9 @@ void drm_gem_vram_put(struct drm_gem_vram_object *gbo); · 39 unmodified lines
97s64 drm_gem_vram_offset(struct drm_gem_vram_object *gbo);97s64 drm_gem_vram_offset(struct drm_gem_vram_object *gbo);
98int drm_gem_vram_pin(struct drm_gem_vram_object *gbo, unsigned long pl_flag);98int drm_gem_vram_pin(struct drm_gem_vram_object *gbo, unsigned long pl_flag);
99int drm_gem_vram_unpin(struct drm_gem_vram_object *gbo);99int drm_gem_vram_unpin(struct drm_gem_vram_object *gbo);
100int drm_gem_vram_vmap(struct drm_gem_vram_object *gbo, struct dma_buf_map *map);100int drm_gem_vram_vmap(struct drm_gem_vram_object *gbo, struct iosys_map *map);
101void drm_gem_vram_vunmap(struct drm_gem_vram_object *gbo, struct dma_buf_map *map);101void drm_gem_vram_vunmap(struct drm_gem_vram_object *gbo,
102 struct iosys_map *map);
102 103
103int drm_gem_vram_fill_create_dumb(struct drm_file *file,104int drm_gem_vram_fill_create_dumb(struct drm_file *file,
104 struct drm_device *dev,105 struct drm_device *dev,
include/drm/drm_prime.h+3−3
@@ -54,7 +54,7 @@ struct device; · 53 unmodified lines
54struct dma_buf_export_info;54struct dma_buf_export_info;
55struct dma_buf;55struct dma_buf;
56struct dma_buf_attachment;56struct dma_buf_attachment;
57struct dma_buf_map;57struct iosys_map;
58 58
59enum dma_data_direction;59enum dma_data_direction;
60 60
@@ -83,8 +83,8 @@ struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach, · 22 unmodified lines
83void drm_gem_unmap_dma_buf(struct dma_buf_attachment *attach,83void drm_gem_unmap_dma_buf(struct dma_buf_attachment *attach,
84 struct sg_table *sgt,84 struct sg_table *sgt,
85 enum dma_data_direction dir);85 enum dma_data_direction dir);
86int drm_gem_dmabuf_vmap(struct dma_buf *dma_buf, struct dma_buf_map *map);86int drm_gem_dmabuf_vmap(struct dma_buf *dma_buf, struct iosys_map *map);
87void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, struct dma_buf_map *map);87void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, struct iosys_map *map);
88 88
89int drm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma);89int drm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma);
90int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma);90int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma);
include/drm/i915_pciids.h+6−0
@@ -666,6 +666,12 @@ · 665 unmodified lines
666 INTEL_VGA_DEVICE(0x46C2, info), \666 INTEL_VGA_DEVICE(0x46C2, info), \
667 INTEL_VGA_DEVICE(0x46C3, info)667 INTEL_VGA_DEVICE(0x46C3, info)
668 668
669/* ADL-N */
670#define INTEL_ADLN_IDS(info) \
671 INTEL_VGA_DEVICE(0x46D0, info), \
672 INTEL_VGA_DEVICE(0x46D1, info), \
673 INTEL_VGA_DEVICE(0x46D2, info)
674
669/* RPL-S */675/* RPL-S */
670#define INTEL_RPLS_IDS(info) \676#define INTEL_RPLS_IDS(info) \
671 INTEL_VGA_DEVICE(0xA780, info), \677 INTEL_VGA_DEVICE(0xA780, info), \
include/drm/ttm/ttm_bo_api.h+5−5
@@ -47,7 +47,7 @@ struct ttm_global; · 46 unmodified lines
47 47
48struct ttm_device;48struct ttm_device;
49 49
50struct dma_buf_map;50struct iosys_map;
51 51
52struct drm_mm_node;52struct drm_mm_node;
53 53
@@ -481,17 +481,17 @@ void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map); · 427 unmodified lines
481 * ttm_bo_vmap481 * ttm_bo_vmap
482 *482 *
483 * @bo: The buffer object.483 * @bo: The buffer object.
484 * @map: pointer to a struct dma_buf_map representing the map.484 * @map: pointer to a struct iosys_map representing the map.
485 *485 *
486 * Sets up a kernel virtual mapping, using ioremap or vmap to the486 * Sets up a kernel virtual mapping, using ioremap or vmap to the
487 * data in the buffer object. The parameter @map returns the virtual487 * data in the buffer object. The parameter @map returns the virtual
488 * address as struct dma_buf_map. Unmap the buffer with ttm_bo_vunmap().488 * address as struct iosys_map. Unmap the buffer with ttm_bo_vunmap().
489 *489 *
490 * Returns490 * Returns
491 * -ENOMEM: Out of memory.491 * -ENOMEM: Out of memory.
492 * -EINVAL: Invalid range.492 * -EINVAL: Invalid range.
493 */493 */
494int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map);494int ttm_bo_vmap(struct ttm_buffer_object *bo, struct iosys_map *map);
495 495
496/**496/**
497 * ttm_bo_vunmap497 * ttm_bo_vunmap
@@ -501,7 +501,7 @@ int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map); · 3 unmodified lines
501 *501 *
502 * Unmaps a kernel map set up by ttm_bo_vmap().502 * Unmaps a kernel map set up by ttm_bo_vmap().
503 */503 */
504void ttm_bo_vunmap(struct ttm_buffer_object *bo, struct dma_buf_map *map);504void ttm_bo_vunmap(struct ttm_buffer_object *bo, struct iosys_map *map);
505 505
506/**506/**
507 * ttm_bo_mmap_obj - mmap memory backed by a ttm buffer object.507 * ttm_bo_mmap_obj - mmap memory backed by a ttm buffer object.
include/drm/ttm/ttm_kmap_iter.h+5−5
@@ -8,7 +8,7 @@ · 7 unmodified lines
8#include <linux/types.h>8#include <linux/types.h>
9 9
10struct ttm_kmap_iter;10struct ttm_kmap_iter;
11struct dma_buf_map;11struct iosys_map;
12 12
13/**13/**
14 * struct ttm_kmap_iter_ops - Ops structure for a struct14 * struct ttm_kmap_iter_ops - Ops structure for a struct
@@ -24,22 +24,22 @@ struct ttm_kmap_iter_ops { · 9 unmodified lines
24 * kmap_local semantics.24 * kmap_local semantics.
25 * @res_iter: Pointer to the struct ttm_kmap_iter representing25 * @res_iter: Pointer to the struct ttm_kmap_iter representing
26 * the resource.26 * the resource.
27 * @dmap: The struct dma_buf_map holding the virtual address after27 * @dmap: The struct iosys_map holding the virtual address after
28 * the operation.28 * the operation.
29 * @i: The location within the resource to map. PAGE_SIZE granularity.29 * @i: The location within the resource to map. PAGE_SIZE granularity.
30 */30 */
31 void (*map_local)(struct ttm_kmap_iter *res_iter,31 void (*map_local)(struct ttm_kmap_iter *res_iter,
32 struct dma_buf_map *dmap, pgoff_t i);32 struct iosys_map *dmap, pgoff_t i);
33 /**33 /**
34 * unmap_local() - Unmap a PAGE_SIZE part of the resource previously34 * unmap_local() - Unmap a PAGE_SIZE part of the resource previously
35 * mapped using kmap_local.35 * mapped using kmap_local.
36 * @res_iter: Pointer to the struct ttm_kmap_iter representing36 * @res_iter: Pointer to the struct ttm_kmap_iter representing
37 * the resource.37 * the resource.
38 * @dmap: The struct dma_buf_map holding the virtual address after38 * @dmap: The struct iosys_map holding the virtual address after
39 * the operation.39 * the operation.
40 */40 */
41 void (*unmap_local)(struct ttm_kmap_iter *res_iter,41 void (*unmap_local)(struct ttm_kmap_iter *res_iter,
42 struct dma_buf_map *dmap);42 struct iosys_map *dmap);
43 bool maps_tt;43 bool maps_tt;
44};44};
45 45
include/drm/ttm/ttm_resource.h+3−3
@@ -27,7 +27,7 @@ · 26 unmodified lines
27 27
28#include <linux/types.h>28#include <linux/types.h>
29#include <linux/mutex.h>29#include <linux/mutex.h>
30#include <linux/dma-buf-map.h>30#include <linux/iosys-map.h>
31#include <linux/dma-fence.h>31#include <linux/dma-fence.h>
32#include <drm/drm_print.h>32#include <drm/drm_print.h>
33#include <drm/ttm/ttm_caching.h>33#include <drm/ttm/ttm_caching.h>
@@ -41,7 +41,7 @@ struct ttm_resource; · 7 unmodified lines
41struct ttm_place;41struct ttm_place;
42struct ttm_buffer_object;42struct ttm_buffer_object;
43struct ttm_placement;43struct ttm_placement;
44struct dma_buf_map;44struct iosys_map;
45struct io_mapping;45struct io_mapping;
46struct sg_table;46struct sg_table;
47struct scatterlist;47struct scatterlist;
@@ -210,7 +210,7 @@ struct ttm_kmap_iter_iomap { · 162 unmodified lines
210 */210 */
211struct ttm_kmap_iter_linear_io {211struct ttm_kmap_iter_linear_io {
212 struct ttm_kmap_iter base;212 struct ttm_kmap_iter base;
213 struct dma_buf_map dmap;213 struct iosys_map dmap;
214 bool needs_unmap;214 bool needs_unmap;
215};215};
216 216
include/linux/dma-buf.h+6−6
@@ -13,7 +13,7 @@ · 12 unmodified lines
13#ifndef __DMA_BUF_H__13#ifndef __DMA_BUF_H__
14#define __DMA_BUF_H__14#define __DMA_BUF_H__
15 15
16#include <linux/dma-buf-map.h>16#include <linux/iosys-map.h>
17#include <linux/file.h>17#include <linux/file.h>
18#include <linux/err.h>18#include <linux/err.h>
19#include <linux/scatterlist.h>19#include <linux/scatterlist.h>
@@ -283,8 +283,8 @@ struct dma_buf_ops { · 263 unmodified lines
283 */283 */
284 int (*mmap)(struct dma_buf *, struct vm_area_struct *vma);284 int (*mmap)(struct dma_buf *, struct vm_area_struct *vma);
285 285
286 int (*vmap)(struct dma_buf *dmabuf, struct dma_buf_map *map);286 int (*vmap)(struct dma_buf *dmabuf, struct iosys_map *map);
287 void (*vunmap)(struct dma_buf *dmabuf, struct dma_buf_map *map);287 void (*vunmap)(struct dma_buf *dmabuf, struct iosys_map *map);
288};288};
289 289
290/**290/**
@@ -347,7 +347,7 @@ struct dma_buf { · 56 unmodified lines
347 * @vmap_ptr:347 * @vmap_ptr:
348 * The current vmap ptr if @vmapping_counter > 0. Protected by @lock.348 * The current vmap ptr if @vmapping_counter > 0. Protected by @lock.
349 */349 */
350 struct dma_buf_map vmap_ptr;350 struct iosys_map vmap_ptr;
351 351
352 /**352 /**
353 * @exp_name:353 * @exp_name:
@@ -628,6 +628,6 @@ int dma_buf_end_cpu_access(struct dma_buf *dma_buf, · 274 unmodified lines
628 628
629int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *,629int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *,
630 unsigned long);630 unsigned long);
631int dma_buf_vmap(struct dma_buf *dmabuf, struct dma_buf_map *map);631int dma_buf_vmap(struct dma_buf *dmabuf, struct iosys_map *map);
632void dma_buf_vunmap(struct dma_buf *dmabuf, struct dma_buf_map *map);632void dma_buf_vunmap(struct dma_buf *dmabuf, struct iosys_map *map);
633#endif /* __DMA_BUF_H__ */633#endif /* __DMA_BUF_H__ */
include/linux/iosys-map.h+257−0
@@ -0,0 +1,257 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Pointer abstraction for IO/system memory
4 */
5
6#ifndef __IOSYS_MAP_H__
7#define __IOSYS_MAP_H__
8
9#include <linux/io.h>
10#include <linux/string.h>
11
12/**
13 * DOC: overview
14 *
15 * When accessing a memory region, depending on its location, users may have to
16 * access it with I/O operations or memory load/store operations. For example,
17 * copying to system memory could be done with memcpy(), copying to I/O memory
18 * would be done with memcpy_toio().
19 *
20 * .. code-block:: c
21 *
22 * void *vaddr = ...; // pointer to system memory
23 * memcpy(vaddr, src, len);
24 *
25 * void *vaddr_iomem = ...; // pointer to I/O memory
26 * memcpy_toio(vaddr, _iomem, src, len);
27 *
28 * The user of such pointer may not have information about the mapping of that
29 * region or may want to have a single code path to handle operations on that
30 * buffer, regardless if it's located in system or IO memory. The type
31 * :c:type:`struct iosys_map <iosys_map>` and its helpers abstract that so the
32 * buffer can be passed around to other drivers or have separate duties inside
33 * the same driver for allocation, read and write operations.
34 *
35 * Open-coding access to :c:type:`struct iosys_map <iosys_map>` is considered
36 * bad style. Rather then accessing its fields directly, use one of the provided
37 * helper functions, or implement your own. For example, instances of
38 * :c:type:`struct iosys_map <iosys_map>` can be initialized statically with
39 * IOSYS_MAP_INIT_VADDR(), or at runtime with iosys_map_set_vaddr(). These
40 * helpers will set an address in system memory.
41 *
42 * .. code-block:: c
43 *
44 * struct iosys_map map = IOSYS_MAP_INIT_VADDR(0xdeadbeaf);
45 *
46 * iosys_map_set_vaddr(&map, 0xdeadbeaf);
47 *
48 * To set an address in I/O memory, use iosys_map_set_vaddr_iomem().
49 *
50 * .. code-block:: c
51 *
52 * iosys_map_set_vaddr_iomem(&map, 0xdeadbeaf);
53 *
54 * Instances of struct iosys_map do not have to be cleaned up, but
55 * can be cleared to NULL with iosys_map_clear(). Cleared mappings
56 * always refer to system memory.
57 *
58 * .. code-block:: c
59 *
60 * iosys_map_clear(&map);
61 *
62 * Test if a mapping is valid with either iosys_map_is_set() or
63 * iosys_map_is_null().
64 *
65 * .. code-block:: c
66 *
67 * if (iosys_map_is_set(&map) != iosys_map_is_null(&map))
68 * // always true
69 *
70 * Instances of :c:type:`struct iosys_map <iosys_map>` can be compared for
71 * equality with iosys_map_is_equal(). Mappings that point to different memory
72 * spaces, system or I/O, are never equal. That's even true if both spaces are
73 * located in the same address space, both mappings contain the same address
74 * value, or both mappings refer to NULL.
75 *
76 * .. code-block:: c
77 *
78 * struct iosys_map sys_map; // refers to system memory
79 * struct iosys_map io_map; // refers to I/O memory
80 *
81 * if (iosys_map_is_equal(&sys_map, &io_map))
82 * // always false
83 *
84 * A set up instance of struct iosys_map can be used to access or manipulate the
85 * buffer memory. Depending on the location of the memory, the provided helpers
86 * will pick the correct operations. Data can be copied into the memory with
87 * iosys_map_memcpy_to(). The address can be manipulated with iosys_map_incr().
88 *
89 * .. code-block:: c
90 *
91 * const void *src = ...; // source buffer
92 * size_t len = ...; // length of src
93 *
94 * iosys_map_memcpy_to(&map, src, len);
95 * iosys_map_incr(&map, len); // go to first byte after the memcpy
96 */
97
98/**
99 * struct iosys_map - Pointer to IO/system memory
100 * @vaddr_iomem: The buffer's address if in I/O memory
101 * @vaddr: The buffer's address if in system memory
102 * @is_iomem: True if the buffer is located in I/O memory, or false
103 * otherwise.
104 */
105struct iosys_map {
106 union {
107 void __iomem *vaddr_iomem;
108 void *vaddr;
109 };
110 bool is_iomem;
111};
112
113/**
114 * IOSYS_MAP_INIT_VADDR - Initializes struct iosys_map to an address in system memory
115 * @vaddr_: A system-memory address
116 */
117#define IOSYS_MAP_INIT_VADDR(vaddr_) \
118 { \
119 .vaddr = (vaddr_), \
120 .is_iomem = false, \
121 }
122
123/**
124 * iosys_map_set_vaddr - Sets a iosys mapping structure to an address in system memory
125 * @map: The iosys_map structure
126 * @vaddr: A system-memory address
127 *
128 * Sets the address and clears the I/O-memory flag.
129 */
130static inline void iosys_map_set_vaddr(struct iosys_map *map, void *vaddr)
131{
132 map->vaddr = vaddr;
133 map->is_iomem = false;
134}
135
136/**
137 * iosys_map_set_vaddr_iomem - Sets a iosys mapping structure to an address in I/O memory
138 * @map: The iosys_map structure
139 * @vaddr_iomem: An I/O-memory address
140 *
141 * Sets the address and the I/O-memory flag.
142 */
143static inline void iosys_map_set_vaddr_iomem(struct iosys_map *map,
144 void __iomem *vaddr_iomem)
145{
146 map->vaddr_iomem = vaddr_iomem;
147 map->is_iomem = true;
148}
149
150/**
151 * iosys_map_is_equal - Compares two iosys mapping structures for equality
152 * @lhs: The iosys_map structure
153 * @rhs: A iosys_map structure to compare with
154 *
155 * Two iosys mapping structures are equal if they both refer to the same type of memory
156 * and to the same address within that memory.
157 *
158 * Returns:
159 * True is both structures are equal, or false otherwise.
160 */
161static inline bool iosys_map_is_equal(const struct iosys_map *lhs,
162 const struct iosys_map *rhs)
163{
164 if (lhs->is_iomem != rhs->is_iomem)
165 return false;
166 else if (lhs->is_iomem)
167 return lhs->vaddr_iomem == rhs->vaddr_iomem;
168 else
169 return lhs->vaddr == rhs->vaddr;
170}
171
172/**
173 * iosys_map_is_null - Tests for a iosys mapping to be NULL
174 * @map: The iosys_map structure
175 *
176 * Depending on the state of struct iosys_map.is_iomem, tests if the
177 * mapping is NULL.
178 *
179 * Returns:
180 * True if the mapping is NULL, or false otherwise.
181 */
182static inline bool iosys_map_is_null(const struct iosys_map *map)
183{
184 if (map->is_iomem)
185 return !map->vaddr_iomem;
186 return !map->vaddr;
187}
188
189/**
190 * iosys_map_is_set - Tests if the iosys mapping has been set
191 * @map: The iosys_map structure
192 *
193 * Depending on the state of struct iosys_map.is_iomem, tests if the
194 * mapping has been set.
195 *
196 * Returns:
197 * True if the mapping is been set, or false otherwise.
198 */
199static inline bool iosys_map_is_set(const struct iosys_map *map)
200{
201 return !iosys_map_is_null(map);
202}
203
204/**
205 * iosys_map_clear - Clears a iosys mapping structure
206 * @map: The iosys_map structure
207 *
208 * Clears all fields to zero, including struct iosys_map.is_iomem, so
209 * mapping structures that were set to point to I/O memory are reset for
210 * system memory. Pointers are cleared to NULL. This is the default.
211 */
212static inline void iosys_map_clear(struct iosys_map *map)
213{
214 if (map->is_iomem) {
215 map->vaddr_iomem = NULL;
216 map->is_iomem = false;
217 } else {
218 map->vaddr = NULL;
219 }
220}
221
222/**
223 * iosys_map_memcpy_to - Memcpy into iosys mapping
224 * @dst: The iosys_map structure
225 * @src: The source buffer
226 * @len: The number of byte in src
227 *
228 * Copies data into a iosys mapping. The source buffer is in system
229 * memory. Depending on the buffer's location, the helper picks the correct
230 * method of accessing the memory.
231 */
232static inline void iosys_map_memcpy_to(struct iosys_map *dst, const void *src,
233 size_t len)
234{
235 if (dst->is_iomem)
236 memcpy_toio(dst->vaddr_iomem, src, len);
237 else
238 memcpy(dst->vaddr, src, len);
239}
240
241/**
242 * iosys_map_incr - Increments the address stored in a iosys mapping
243 * @map: The iosys_map structure
244 * @incr: The number of bytes to increment
245 *
246 * Increments the address stored in a iosys mapping. Depending on the
247 * buffer's location, the correct value will be updated.
248 */
249static inline void iosys_map_incr(struct iosys_map *map, size_t incr)
250{
251 if (map->is_iomem)
252 map->vaddr_iomem += incr;
253 else
254 map->vaddr += incr;
255}
256
257#endif /* __IOSYS_MAP_H__ */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t