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>
Showing the changes to include (17 of 273 files). Show all
Unified · Split
| @@ -35,7 +35,7 @@ · 34 unmodified lines | ||
| 35 | 35 | |
| 36 | 36 | #include <linux/scatterlist.h> |
| 37 | 37 | |
| 38 | −struct dma_buf_map; | |
| 38 | +struct iosys_map; | |
| 39 | 39 | |
| 40 | 40 | void drm_clflush_pages(struct page *pages[], unsigned long num_pages); |
| 41 | 41 | void 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 | |
| 75 | 75 | void drm_memcpy_init_early(void); |
| 76 | 76 | |
| 77 | −void drm_memcpy_from_wc(struct dma_buf_map *dst, | |
| 78 | − const struct dma_buf_map *src, | |
| 77 | +void drm_memcpy_from_wc(struct iosys_map *dst, | |
| 78 | + const struct iosys_map *src, | |
| 79 | 79 | unsigned long len); |
| 80 | 80 | #endif |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | #ifndef _DRM_CLIENT_H_ |
| 4 | 4 | #define _DRM_CLIENT_H_ |
| 5 | 5 | |
| 6 | −#include <linux/dma-buf-map.h> | |
| 6 | +#include <linux/iosys-map.h> | |
| 7 | 7 | #include <linux/lockdep.h> |
| 8 | 8 | #include <linux/mutex.h> |
| 9 | 9 | #include <linux/types.h> |
| @@ -144,7 +144,7 @@ struct drm_client_buffer { · 134 unmodified lines | ||
| 144 | 144 | /** |
| 145 | 145 | * @map: Virtual address for the buffer |
| 146 | 146 | */ |
| 147 | − struct dma_buf_map map; | |
| 147 | + struct iosys_map map; | |
| 148 | 148 | |
| 149 | 149 | /** |
| 150 | 150 | * @fb: DRM framebuffer |
| @@ -156,7 +156,8 @@ struct drm_client_buffer * · 5 unmodified lines | ||
| 156 | 156 | drm_client_framebuffer_create(struct drm_client_dev *client, u32 width, u32 height, u32 format); |
| 157 | 157 | void drm_client_framebuffer_delete(struct drm_client_buffer *buffer); |
| 158 | 158 | int drm_client_framebuffer_flush(struct drm_client_buffer *buffer, struct drm_rect *rect); |
| 159 | −int drm_client_buffer_vmap(struct drm_client_buffer *buffer, struct dma_buf_map *map); | |
| 159 | +int drm_client_buffer_vmap(struct drm_client_buffer *buffer, | |
| 160 | + struct iosys_map *map); | |
| 160 | 161 | void drm_client_buffer_vunmap(struct drm_client_buffer *buffer); |
| 161 | 162 | |
| 162 | 163 | int drm_client_modeset_create(struct drm_client_dev *client); |
| @@ -1145,14 +1145,12 @@ struct drm_crtc { · 1144 unmodified lines | ||
| 1145 | 1145 | */ |
| 1146 | 1146 | spinlock_t commit_lock; |
| 1147 | 1147 | |
| 1148 | −#ifdef CONFIG_DEBUG_FS | |
| 1149 | 1148 | /** |
| 1150 | 1149 | * @debugfs_entry: |
| 1151 | 1150 | * |
| 1152 | 1151 | * Debugfs directory for this CRTC. |
| 1153 | 1152 | */ |
| 1154 | 1153 | struct dentry *debugfs_entry; |
| 1155 | −#endif | |
| 1156 | 1154 | |
| 1157 | 1155 | /** |
| 1158 | 1156 | * @crc: |
| @@ -39,7 +39,7 @@ · 38 unmodified lines | ||
| 39 | 39 | |
| 40 | 40 | #include <drm/drm_vma_manager.h> |
| 41 | 41 | |
| 42 | −struct dma_buf_map; | |
| 42 | +struct iosys_map; | |
| 43 | 43 | struct drm_gem_object; |
| 44 | 44 | |
| 45 | 45 | /** |
| @@ -139,7 +139,7 @@ struct drm_gem_object_funcs { · 93 unmodified lines | ||
| 139 | 139 | * |
| 140 | 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 | 145 | * @vunmap: |
| @@ -149,7 +149,7 @@ struct drm_gem_object_funcs { · 3 unmodified lines | ||
| 149 | 149 | * |
| 150 | 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 | 155 | * @mmap: |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | #ifndef __DRM_GEM_ATOMIC_HELPER_H__ |
| 4 | 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 | 8 | #include <drm/drm_fourcc.h> |
| 9 | 9 | #include <drm/drm_plane.h> |
| @@ -59,7 +59,7 @@ struct drm_shadow_plane_state { · 49 unmodified lines | ||
| 59 | 59 | * The memory mappings stored in map should be established in the plane's |
| 60 | 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 | 65 | * @data: Address of each framebuffer BO's data |
| @@ -67,7 +67,7 @@ struct drm_shadow_plane_state { · 1 unmodified line | ||
| 67 | 67 | * The address of the data stored in each mapping. This is different |
| 68 | 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 | /** |
| @@ -38,7 +38,8 @@ void drm_gem_cma_free(struct drm_gem_cma_object *cma_obj); · 37 unmodified lines | ||
| 38 | 38 | void drm_gem_cma_print_info(const struct drm_gem_cma_object *cma_obj, |
| 39 | 39 | struct drm_printer *p, unsigned int indent); |
| 40 | 40 | struct sg_table *drm_gem_cma_get_sg_table(struct drm_gem_cma_object *cma_obj); |
| 41 | −int drm_gem_cma_vmap(struct drm_gem_cma_object *cma_obj, struct dma_buf_map *map); | |
| 41 | +int drm_gem_cma_vmap(struct drm_gem_cma_object *cma_obj, | |
| 42 | + struct iosys_map *map); | |
| 42 | 43 | int drm_gem_cma_mmap(struct drm_gem_cma_object *cma_obj, struct vm_area_struct *vma); |
| 43 | 44 | |
| 44 | 45 | extern 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 | 107 | * Returns: |
| 107 | 108 | * 0 on success or a negative error code on failure. |
| 108 | 109 | */ |
| 109 | −static inline int drm_gem_cma_object_vmap(struct drm_gem_object *obj, struct dma_buf_map *map) | |
| 110 | +static inline int drm_gem_cma_object_vmap(struct drm_gem_object *obj, | |
| 111 | + struct iosys_map *map) | |
| 110 | 112 | { |
| 111 | 113 | struct drm_gem_cma_object *cma_obj = to_drm_gem_cma_obj(obj); |
| 112 | 114 | |
| @@ -2,7 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | #define __DRM_GEM_FB_HELPER_H__ |
| 3 | 3 | |
| 4 | 4 | #include <linux/dma-buf.h> |
| 5 | −#include <linux/dma-buf-map.h> | |
| 5 | +#include <linux/iosys-map.h> | |
| 6 | 6 | |
| 7 | 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 | 40 | const struct drm_mode_fb_cmd2 *mode_cmd); |
| 41 | 41 | |
| 42 | 42 | int drm_gem_fb_vmap(struct drm_framebuffer *fb, |
| 43 | − struct dma_buf_map map[static DRM_FORMAT_MAX_PLANES], | |
| 44 | − struct dma_buf_map data[DRM_FORMAT_MAX_PLANES]); | |
| 43 | + struct iosys_map map[static DRM_FORMAT_MAX_PLANES], | |
| 44 | + struct iosys_map data[DRM_FORMAT_MAX_PLANES]); | |
| 45 | 45 | void 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]); | |
| 47 | 47 | int drm_gem_fb_begin_cpu_access(struct drm_framebuffer *fb, enum dma_data_direction dir); |
| 48 | 48 | void drm_gem_fb_end_cpu_access(struct drm_framebuffer *fb, enum dma_data_direction dir); |
| 49 | 49 | |
| @@ -113,8 +113,10 @@ int drm_gem_shmem_get_pages(struct drm_gem_shmem_object *shmem); · 112 unmodified lines | ||
| 113 | 113 | void drm_gem_shmem_put_pages(struct drm_gem_shmem_object *shmem); |
| 114 | 114 | int drm_gem_shmem_pin(struct drm_gem_shmem_object *shmem); |
| 115 | 115 | void drm_gem_shmem_unpin(struct drm_gem_shmem_object *shmem); |
| 116 | −int drm_gem_shmem_vmap(struct drm_gem_shmem_object *shmem, struct dma_buf_map *map); | |
| 117 | −void drm_gem_shmem_vunmap(struct drm_gem_shmem_object *shmem, struct dma_buf_map *map); | |
| 116 | +int drm_gem_shmem_vmap(struct drm_gem_shmem_object *shmem, | |
| 117 | + struct iosys_map *map); | |
| 118 | +void drm_gem_shmem_vunmap(struct drm_gem_shmem_object *shmem, | |
| 119 | + struct iosys_map *map); | |
| 118 | 120 | int drm_gem_shmem_mmap(struct drm_gem_shmem_object *shmem, struct vm_area_struct *vma); |
| 119 | 121 | |
| 120 | 122 | int 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 | 228 | * Returns: |
| 227 | 229 | * 0 on success or a negative error code on failure. |
| 228 | 230 | */ |
| 229 | −static inline int drm_gem_shmem_object_vmap(struct drm_gem_object *obj, struct dma_buf_map *map) | |
| 231 | +static inline int drm_gem_shmem_object_vmap(struct drm_gem_object *obj, | |
| 232 | + struct iosys_map *map) | |
| 230 | 233 | { |
| 231 | 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 | 244 | * This function wraps drm_gem_shmem_vunmap(). Drivers that employ the shmem helpers should |
| 242 | 245 | * use it as their &drm_gem_object_funcs.vunmap handler. |
| 243 | 246 | */ |
| 244 | −static inline void drm_gem_shmem_object_vunmap(struct drm_gem_object *obj, struct dma_buf_map *map) | |
| 247 | +static inline void drm_gem_shmem_object_vunmap(struct drm_gem_object *obj, | |
| 248 | + struct iosys_map *map) | |
| 245 | 249 | { |
| 246 | 250 | struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(obj); |
| 247 | 251 | |
| @@ -10,7 +10,7 @@ · 9 unmodified lines | ||
| 10 | 10 | #include <drm/ttm/ttm_bo_api.h> |
| 11 | 11 | #include <drm/ttm/ttm_bo_driver.h> |
| 12 | 12 | |
| 13 | −struct dma_buf_map; | |
| 13 | +struct iosys_map; | |
| 14 | 14 | |
| 15 | 15 | #define drm_gem_ttm_of_gem(gem_obj) \ |
| 16 | 16 | container_of(gem_obj, struct ttm_buffer_object, base) |
| @@ -18,9 +18,9 @@ struct dma_buf_map; · 1 unmodified line | ||
| 18 | 18 | void drm_gem_ttm_print_info(struct drm_printer *p, unsigned int indent, |
| 19 | 19 | const struct drm_gem_object *gem); |
| 20 | 20 | int drm_gem_ttm_vmap(struct drm_gem_object *gem, |
| 21 | − struct dma_buf_map *map); | |
| 21 | + struct iosys_map *map); | |
| 22 | 22 | void drm_gem_ttm_vunmap(struct drm_gem_object *gem, |
| 23 | − struct dma_buf_map *map); | |
| 23 | + struct iosys_map *map); | |
| 24 | 24 | int drm_gem_ttm_mmap(struct drm_gem_object *gem, |
| 25 | 25 | struct vm_area_struct *vma); |
| 26 | 26 | |
| @@ -12,7 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <drm/ttm/ttm_bo_driver.h> |
| 13 | 13 | |
| 14 | 14 | #include <linux/container_of.h> |
| 15 | −#include <linux/dma-buf-map.h> | |
| 15 | +#include <linux/iosys-map.h> | |
| 16 | 16 | |
| 17 | 17 | struct drm_mode_create_dumb; |
| 18 | 18 | struct drm_plane; |
| @@ -51,7 +51,7 @@ struct vm_area_struct; · 32 unmodified lines | ||
| 51 | 51 | */ |
| 52 | 52 | struct drm_gem_vram_object { |
| 53 | 53 | struct ttm_buffer_object bo; |
| 54 | − struct dma_buf_map map; | |
| 54 | + struct iosys_map map; | |
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * @vmap_use_count: |
| @@ -97,8 +97,9 @@ void drm_gem_vram_put(struct drm_gem_vram_object *gbo); · 39 unmodified lines | ||
| 97 | 97 | s64 drm_gem_vram_offset(struct drm_gem_vram_object *gbo); |
| 98 | 98 | int drm_gem_vram_pin(struct drm_gem_vram_object *gbo, unsigned long pl_flag); |
| 99 | 99 | int drm_gem_vram_unpin(struct drm_gem_vram_object *gbo); |
| 100 | −int drm_gem_vram_vmap(struct drm_gem_vram_object *gbo, struct dma_buf_map *map); | |
| 101 | −void drm_gem_vram_vunmap(struct drm_gem_vram_object *gbo, struct dma_buf_map *map); | |
| 100 | +int drm_gem_vram_vmap(struct drm_gem_vram_object *gbo, struct iosys_map *map); | |
| 101 | +void drm_gem_vram_vunmap(struct drm_gem_vram_object *gbo, | |
| 102 | + struct iosys_map *map); | |
| 102 | 103 | |
| 103 | 104 | int drm_gem_vram_fill_create_dumb(struct drm_file *file, |
| 104 | 105 | struct drm_device *dev, |
| @@ -54,7 +54,7 @@ struct device; · 53 unmodified lines | ||
| 54 | 54 | struct dma_buf_export_info; |
| 55 | 55 | struct dma_buf; |
| 56 | 56 | struct dma_buf_attachment; |
| 57 | −struct dma_buf_map; | |
| 57 | +struct iosys_map; | |
| 58 | 58 | |
| 59 | 59 | enum 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 | ||
| 83 | 83 | void drm_gem_unmap_dma_buf(struct dma_buf_attachment *attach, |
| 84 | 84 | struct sg_table *sgt, |
| 85 | 85 | enum dma_data_direction dir); |
| 86 | −int drm_gem_dmabuf_vmap(struct dma_buf *dma_buf, struct dma_buf_map *map); | |
| 87 | −void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, struct dma_buf_map *map); | |
| 86 | +int drm_gem_dmabuf_vmap(struct dma_buf *dma_buf, struct iosys_map *map); | |
| 87 | +void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, struct iosys_map *map); | |
| 88 | 88 | |
| 89 | 89 | int drm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma); |
| 90 | 90 | int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma); |
| @@ -666,6 +666,12 @@ · 665 unmodified lines | ||
| 666 | 666 | INTEL_VGA_DEVICE(0x46C2, info), \ |
| 667 | 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 | 675 | /* RPL-S */ |
| 670 | 676 | #define INTEL_RPLS_IDS(info) \ |
| 671 | 677 | INTEL_VGA_DEVICE(0xA780, info), \ |
| @@ -47,7 +47,7 @@ struct ttm_global; · 46 unmodified lines | ||
| 47 | 47 | |
| 48 | 48 | struct ttm_device; |
| 49 | 49 | |
| 50 | −struct dma_buf_map; | |
| 50 | +struct iosys_map; | |
| 51 | 51 | |
| 52 | 52 | struct drm_mm_node; |
| 53 | 53 | |
| @@ -481,17 +481,17 @@ void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map); · 427 unmodified lines | ||
| 481 | 481 | * ttm_bo_vmap |
| 482 | 482 | * |
| 483 | 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 | 486 | * Sets up a kernel virtual mapping, using ioremap or vmap to the |
| 487 | 487 | * 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 | 490 | * Returns |
| 491 | 491 | * -ENOMEM: Out of memory. |
| 492 | 492 | * -EINVAL: Invalid range. |
| 493 | 493 | */ |
| 494 | −int ttm_bo_vmap(struct ttm_buffer_object *bo, struct dma_buf_map *map); | |
| 494 | +int ttm_bo_vmap(struct ttm_buffer_object *bo, struct iosys_map *map); | |
| 495 | 495 | |
| 496 | 496 | /** |
| 497 | 497 | * 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 | 502 | * Unmaps a kernel map set up by ttm_bo_vmap(). |
| 503 | 503 | */ |
| 504 | −void ttm_bo_vunmap(struct ttm_buffer_object *bo, struct dma_buf_map *map); | |
| 504 | +void ttm_bo_vunmap(struct ttm_buffer_object *bo, struct iosys_map *map); | |
| 505 | 505 | |
| 506 | 506 | /** |
| 507 | 507 | * ttm_bo_mmap_obj - mmap memory backed by a ttm buffer object. |
| @@ -8,7 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | #include <linux/types.h> |
| 9 | 9 | |
| 10 | 10 | struct ttm_kmap_iter; |
| 11 | −struct dma_buf_map; | |
| 11 | +struct iosys_map; | |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * struct ttm_kmap_iter_ops - Ops structure for a struct |
| @@ -24,22 +24,22 @@ struct ttm_kmap_iter_ops { · 9 unmodified lines | ||
| 24 | 24 | * kmap_local semantics. |
| 25 | 25 | * @res_iter: Pointer to the struct ttm_kmap_iter representing |
| 26 | 26 | * the resource. |
| 27 | − * @dmap: The struct dma_buf_map holding the virtual address after | |
| 27 | + * @dmap: The struct iosys_map holding the virtual address after | |
| 28 | 28 | * the operation. |
| 29 | 29 | * @i: The location within the resource to map. PAGE_SIZE granularity. |
| 30 | 30 | */ |
| 31 | 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 | 34 | * unmap_local() - Unmap a PAGE_SIZE part of the resource previously |
| 35 | 35 | * mapped using kmap_local. |
| 36 | 36 | * @res_iter: Pointer to the struct ttm_kmap_iter representing |
| 37 | 37 | * the resource. |
| 38 | − * @dmap: The struct dma_buf_map holding the virtual address after | |
| 38 | + * @dmap: The struct iosys_map holding the virtual address after | |
| 39 | 39 | * the operation. |
| 40 | 40 | */ |
| 41 | 41 | void (*unmap_local)(struct ttm_kmap_iter *res_iter, |
| 42 | − struct dma_buf_map *dmap); | |
| 42 | + struct iosys_map *dmap); | |
| 43 | 43 | bool maps_tt; |
| 44 | 44 | }; |
| 45 | 45 | |
| @@ -27,7 +27,7 @@ · 26 unmodified lines | ||
| 27 | 27 | |
| 28 | 28 | #include <linux/types.h> |
| 29 | 29 | #include <linux/mutex.h> |
| 30 | −#include <linux/dma-buf-map.h> | |
| 30 | +#include <linux/iosys-map.h> | |
| 31 | 31 | #include <linux/dma-fence.h> |
| 32 | 32 | #include <drm/drm_print.h> |
| 33 | 33 | #include <drm/ttm/ttm_caching.h> |
| @@ -41,7 +41,7 @@ struct ttm_resource; · 7 unmodified lines | ||
| 41 | 41 | struct ttm_place; |
| 42 | 42 | struct ttm_buffer_object; |
| 43 | 43 | struct ttm_placement; |
| 44 | −struct dma_buf_map; | |
| 44 | +struct iosys_map; | |
| 45 | 45 | struct io_mapping; |
| 46 | 46 | struct sg_table; |
| 47 | 47 | struct scatterlist; |
| @@ -210,7 +210,7 @@ struct ttm_kmap_iter_iomap { · 162 unmodified lines | ||
| 210 | 210 | */ |
| 211 | 211 | struct ttm_kmap_iter_linear_io { |
| 212 | 212 | struct ttm_kmap_iter base; |
| 213 | − struct dma_buf_map dmap; | |
| 213 | + struct iosys_map dmap; | |
| 214 | 214 | bool needs_unmap; |
| 215 | 215 | }; |
| 216 | 216 | |
| @@ -13,7 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | #ifndef __DMA_BUF_H__ |
| 14 | 14 | #define __DMA_BUF_H__ |
| 15 | 15 | |
| 16 | −#include <linux/dma-buf-map.h> | |
| 16 | +#include <linux/iosys-map.h> | |
| 17 | 17 | #include <linux/file.h> |
| 18 | 18 | #include <linux/err.h> |
| 19 | 19 | #include <linux/scatterlist.h> |
| @@ -283,8 +283,8 @@ struct dma_buf_ops { · 263 unmodified lines | ||
| 283 | 283 | */ |
| 284 | 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); | |
| 287 | − void (*vunmap)(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 iosys_map *map); | |
| 288 | 288 | }; |
| 289 | 289 | |
| 290 | 290 | /** |
| @@ -347,7 +347,7 @@ struct dma_buf { · 56 unmodified lines | ||
| 347 | 347 | * @vmap_ptr: |
| 348 | 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 | 353 | * @exp_name: |
| @@ -628,6 +628,6 @@ int dma_buf_end_cpu_access(struct dma_buf *dma_buf, · 274 unmodified lines | ||
| 628 | 628 | |
| 629 | 629 | int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *, |
| 630 | 630 | unsigned long); |
| 631 | −int dma_buf_vmap(struct dma_buf *dmabuf, struct dma_buf_map *map); | |
| 632 | −void dma_buf_vunmap(struct dma_buf *dmabuf, struct dma_buf_map *map); | |
| 631 | +int dma_buf_vmap(struct dma_buf *dmabuf, struct iosys_map *map); | |
| 632 | +void dma_buf_vunmap(struct dma_buf *dmabuf, struct iosys_map *map); | |
| 633 | 633 | #endif /* __DMA_BUF_H__ */ |
| @@ -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 | + */ | |
| 105 | +struct 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 | + */ | |
| 130 | +static 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 | + */ | |
| 143 | +static 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 | + */ | |
| 161 | +static 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 | + */ | |
| 182 | +static 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 | + */ | |
| 199 | +static 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 | + */ | |
| 212 | +static 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 | + */ | |
| 232 | +static 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 | + */ | |
| 249 | +static 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__ */ | |