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)
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEbSBwaO7dZQkcLOKj+mJfZA7rE8oFAmIChLkACgkQ+mJfZA7r
 E8rDOgf9GdgD5PIqly1zCjfpN0z15KXS6kn6lDlthcZMQ2INpAjfo7sOhpAdcb5h
 ptoKkBxD0p+VlLWTR14+N1/DXV8lvxgdfbee2XHdG2+750eBjcjdYNakDj+lGZJ6
 AVO5pNJRa6WEMd4pesm53CJMHlgSzydRCl66PobHrqqeHahO4VGh4Y9jqoJ3JzvD
 unO1iWrss/i9HvJrefcrUKPGkpb9u59dzsiM9Q3rCNSsPg3ik7Mz1LLPEyHEHyUi
 7vs8ugjN2UiZZELnMJIiCBwHs1xN0O3oS4YkjjTzZXMWc+cvY9mFpGbIWMffYpMY
 qijXJLO8Fh57SN0G6EPaCjNyQbm8Gw==
 =/7VU
 -----END PGP SIGNATURE-----

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>

From: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/YgKFLmCgpv4vQEa1@intel.com
This commit is contained in:
Dave Airlie 2022-02-11 14:13:36 +10:00
commit e7a09cea64
273 changed files with 6342 additions and 5855 deletions

View file

@ -13,7 +13,7 @@
#ifndef __DMA_BUF_H__
#define __DMA_BUF_H__
#include <linux/dma-buf-map.h>
#include <linux/iosys-map.h>
#include <linux/file.h>
#include <linux/err.h>
#include <linux/scatterlist.h>
@ -283,8 +283,8 @@ struct dma_buf_ops {
*/
int (*mmap)(struct dma_buf *, struct vm_area_struct *vma);
int (*vmap)(struct dma_buf *dmabuf, struct dma_buf_map *map);
void (*vunmap)(struct dma_buf *dmabuf, struct dma_buf_map *map);
int (*vmap)(struct dma_buf *dmabuf, struct iosys_map *map);
void (*vunmap)(struct dma_buf *dmabuf, struct iosys_map *map);
};
/**
@ -347,7 +347,7 @@ struct dma_buf {
* @vmap_ptr:
* The current vmap ptr if @vmapping_counter > 0. Protected by @lock.
*/
struct dma_buf_map vmap_ptr;
struct iosys_map vmap_ptr;
/**
* @exp_name:
@ -628,6 +628,6 @@ int dma_buf_end_cpu_access(struct dma_buf *dma_buf,
int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *,
unsigned long);
int dma_buf_vmap(struct dma_buf *dmabuf, struct dma_buf_map *map);
void dma_buf_vunmap(struct dma_buf *dmabuf, struct dma_buf_map *map);
int dma_buf_vmap(struct dma_buf *dmabuf, struct iosys_map *map);
void dma_buf_vunmap(struct dma_buf *dmabuf, struct iosys_map *map);
#endif /* __DMA_BUF_H__ */

257
include/linux/iosys-map.h Normal file
View file

@ -0,0 +1,257 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Pointer abstraction for IO/system memory
*/
#ifndef __IOSYS_MAP_H__
#define __IOSYS_MAP_H__
#include <linux/io.h>
#include <linux/string.h>
/**
* DOC: overview
*
* When accessing a memory region, depending on its location, users may have to
* access it with I/O operations or memory load/store operations. For example,
* copying to system memory could be done with memcpy(), copying to I/O memory
* would be done with memcpy_toio().
*
* .. code-block:: c
*
* void *vaddr = ...; // pointer to system memory
* memcpy(vaddr, src, len);
*
* void *vaddr_iomem = ...; // pointer to I/O memory
* memcpy_toio(vaddr, _iomem, src, len);
*
* The user of such pointer may not have information about the mapping of that
* region or may want to have a single code path to handle operations on that
* buffer, regardless if it's located in system or IO memory. The type
* :c:type:`struct iosys_map <iosys_map>` and its helpers abstract that so the
* buffer can be passed around to other drivers or have separate duties inside
* the same driver for allocation, read and write operations.
*
* Open-coding access to :c:type:`struct iosys_map <iosys_map>` is considered
* bad style. Rather then accessing its fields directly, use one of the provided
* helper functions, or implement your own. For example, instances of
* :c:type:`struct iosys_map <iosys_map>` can be initialized statically with
* IOSYS_MAP_INIT_VADDR(), or at runtime with iosys_map_set_vaddr(). These
* helpers will set an address in system memory.
*
* .. code-block:: c
*
* struct iosys_map map = IOSYS_MAP_INIT_VADDR(0xdeadbeaf);
*
* iosys_map_set_vaddr(&map, 0xdeadbeaf);
*
* To set an address in I/O memory, use iosys_map_set_vaddr_iomem().
*
* .. code-block:: c
*
* iosys_map_set_vaddr_iomem(&map, 0xdeadbeaf);
*
* Instances of struct iosys_map do not have to be cleaned up, but
* can be cleared to NULL with iosys_map_clear(). Cleared mappings
* always refer to system memory.
*
* .. code-block:: c
*
* iosys_map_clear(&map);
*
* Test if a mapping is valid with either iosys_map_is_set() or
* iosys_map_is_null().
*
* .. code-block:: c
*
* if (iosys_map_is_set(&map) != iosys_map_is_null(&map))
* // always true
*
* Instances of :c:type:`struct iosys_map <iosys_map>` can be compared for
* equality with iosys_map_is_equal(). Mappings that point to different memory
* spaces, system or I/O, are never equal. That's even true if both spaces are
* located in the same address space, both mappings contain the same address
* value, or both mappings refer to NULL.
*
* .. code-block:: c
*
* struct iosys_map sys_map; // refers to system memory
* struct iosys_map io_map; // refers to I/O memory
*
* if (iosys_map_is_equal(&sys_map, &io_map))
* // always false
*
* A set up instance of struct iosys_map can be used to access or manipulate the
* buffer memory. Depending on the location of the memory, the provided helpers
* will pick the correct operations. Data can be copied into the memory with
* iosys_map_memcpy_to(). The address can be manipulated with iosys_map_incr().
*
* .. code-block:: c
*
* const void *src = ...; // source buffer
* size_t len = ...; // length of src
*
* iosys_map_memcpy_to(&map, src, len);
* iosys_map_incr(&map, len); // go to first byte after the memcpy
*/
/**
* struct iosys_map - Pointer to IO/system memory
* @vaddr_iomem: The buffer's address if in I/O memory
* @vaddr: The buffer's address if in system memory
* @is_iomem: True if the buffer is located in I/O memory, or false
* otherwise.
*/
struct iosys_map {
union {
void __iomem *vaddr_iomem;
void *vaddr;
};
bool is_iomem;
};
/**
* IOSYS_MAP_INIT_VADDR - Initializes struct iosys_map to an address in system memory
* @vaddr_: A system-memory address
*/
#define IOSYS_MAP_INIT_VADDR(vaddr_) \
{ \
.vaddr = (vaddr_), \
.is_iomem = false, \
}
/**
* iosys_map_set_vaddr - Sets a iosys mapping structure to an address in system memory
* @map: The iosys_map structure
* @vaddr: A system-memory address
*
* Sets the address and clears the I/O-memory flag.
*/
static inline void iosys_map_set_vaddr(struct iosys_map *map, void *vaddr)
{
map->vaddr = vaddr;
map->is_iomem = false;
}
/**
* iosys_map_set_vaddr_iomem - Sets a iosys mapping structure to an address in I/O memory
* @map: The iosys_map structure
* @vaddr_iomem: An I/O-memory address
*
* Sets the address and the I/O-memory flag.
*/
static inline void iosys_map_set_vaddr_iomem(struct iosys_map *map,
void __iomem *vaddr_iomem)
{
map->vaddr_iomem = vaddr_iomem;
map->is_iomem = true;
}
/**
* iosys_map_is_equal - Compares two iosys mapping structures for equality
* @lhs: The iosys_map structure
* @rhs: A iosys_map structure to compare with
*
* Two iosys mapping structures are equal if they both refer to the same type of memory
* and to the same address within that memory.
*
* Returns:
* True is both structures are equal, or false otherwise.
*/
static inline bool iosys_map_is_equal(const struct iosys_map *lhs,
const struct iosys_map *rhs)
{
if (lhs->is_iomem != rhs->is_iomem)
return false;
else if (lhs->is_iomem)
return lhs->vaddr_iomem == rhs->vaddr_iomem;
else
return lhs->vaddr == rhs->vaddr;
}
/**
* iosys_map_is_null - Tests for a iosys mapping to be NULL
* @map: The iosys_map structure
*
* Depending on the state of struct iosys_map.is_iomem, tests if the
* mapping is NULL.
*
* Returns:
* True if the mapping is NULL, or false otherwise.
*/
static inline bool iosys_map_is_null(const struct iosys_map *map)
{
if (map->is_iomem)
return !map->vaddr_iomem;
return !map->vaddr;
}
/**
* iosys_map_is_set - Tests if the iosys mapping has been set
* @map: The iosys_map structure
*
* Depending on the state of struct iosys_map.is_iomem, tests if the
* mapping has been set.
*
* Returns:
* True if the mapping is been set, or false otherwise.
*/
static inline bool iosys_map_is_set(const struct iosys_map *map)
{
return !iosys_map_is_null(map);
}
/**
* iosys_map_clear - Clears a iosys mapping structure
* @map: The iosys_map structure
*
* Clears all fields to zero, including struct iosys_map.is_iomem, so
* mapping structures that were set to point to I/O memory are reset for
* system memory. Pointers are cleared to NULL. This is the default.
*/
static inline void iosys_map_clear(struct iosys_map *map)
{
if (map->is_iomem) {
map->vaddr_iomem = NULL;
map->is_iomem = false;
} else {
map->vaddr = NULL;
}
}
/**
* iosys_map_memcpy_to - Memcpy into iosys mapping
* @dst: The iosys_map structure
* @src: The source buffer
* @len: The number of byte in src
*
* Copies data into a iosys mapping. The source buffer is in system
* memory. Depending on the buffer's location, the helper picks the correct
* method of accessing the memory.
*/
static inline void iosys_map_memcpy_to(struct iosys_map *dst, const void *src,
size_t len)
{
if (dst->is_iomem)
memcpy_toio(dst->vaddr_iomem, src, len);
else
memcpy(dst->vaddr, src, len);
}
/**
* iosys_map_incr - Increments the address stored in a iosys mapping
* @map: The iosys_map structure
* @incr: The number of bytes to increment
*
* Increments the address stored in a iosys mapping. Depending on the
* buffer's location, the correct value will be updated.
*/
static inline void iosys_map_incr(struct iosys_map *map, size_t incr)
{
if (map->is_iomem)
map->vaddr_iomem += incr;
else
map->vaddr += incr;
}
#endif /* __IOSYS_MAP_H__ */