UAPI Changes: - GuC hwconfig support and query (John Harrison, Rodrigo Vivi, Tvrtko Ursulin) - Sysfs support for multi-tile devices (Andi Shyti, Sujaritha Sundaresan) - Per client GPU utilisation via fdinfo (Tvrtko Ursulin, Ashutosh Dixit) - Add DRM_I915_QUERY_GEOMETRY_SUBSLICES (Matt Atwood) Cross-subsystem Changes: - Add GSC as a MEI auxiliary device (Tomas Winkler, Alexander Usyskin) Core Changes: - Document fdinfo format specification (Tvrtko Ursulin) Driver Changes: - Fix prime_mmap to work when using LMEM (Gwan-gyeong Mun) - Fix vm open count and remove vma refcount (Thomas Hellström) - Fixup setting screen_size (Matthew Auld) - Opportunistically apply ALLOC_CONTIGIOUS (Matthew Auld) - Limit where we apply TTM_PL_FLAG_CONTIGUOUS (Matthew Auld) - Drop aux table invalidation on FlatCCS platforms (Matt Roper) - Add missing boundary check in vm_access (Mastan Katragadda) - Update topology dumps for Xe_HP (Matt Roper) - Add support for steered register writes (Matt Roper) - Add steering info to GuC register save/restore list (Daniele Ceraolo Spurio) - Small PCI BAR enabling (Matthew Auld, Akeem G Abodunrin, CQ Tang) - Add preemption changes for Wa_14015141709 (Akeem G Abodunrin) - Add logical mapping for video decode engines (Matthew Brost) - Don't evict unmappable VMAs when pinning with PIN_MAPPABLE (v2) (Vivek Kasireddy) - GuC error capture support (Alan Previn, Daniele Ceraolo Spurio) - avoid concurrent writes to aux_inv (Fei Yang) - Add Wa_22014226127 (José Roberto de Souza) - Sunset igpu legacy mmap support based on GRAPHICS_VER_FULL (Matt Roper) - Evict and restore of compressed objects (Ramalingam C) - Update to GuC version 70.1.1 (John Harrison) - Add Wa_22011802037 force cs halt (Tilak Tangudu) - Enable Wa_22011802037 for gen12 GuC based platforms (Umesh Nerlige Ramappa) - GuC based workarounds for DG2 (Vinay Belgaumkar, John Harrison, Matthew Brost, José Roberto de Souza) - consider min_page_size when migrating (Matthew Auld) - Prep work for next GuC firmware release (John Harrison) - Support platforms with CCS engines but no RCS (Matt Roper, Stuart Summers) - Don't overallocate subslice storage (Matt Roper) - Reduce stack usage in debugfs due to SSEU (John Harrison) - Report steering details in debugfs (Matt Roper) - Refactor some x86-ism out to prepare for non-x86 builds (Michael Cheng) - add lmem_size modparam (CQ Tang) - Refactor for non-x86 driver builds (Casey Bowman) - Centralize computation of freq caps (Ashutosh Dixit) - Update dma_buf_ops.unmap_dma_buf callback to use drm_gem_unmap_dma_buf() (Gwan-gyeong Mun) - Limit the async bind to bind_async_flags (Matthew Auld) - Stop checking for NULL vma->obj (Matthew Auld) - Reduce overzealous alignment constraints for GGTT (Matthew Auld) - Remove GEN12_SFC_DONE_MAX from register defs header (Matt Roper) - Fix renamed struct field (Lucas De Marchi) - Do not return '0' if there is nothing to return (Andi Shyti) - fix i915_reg_t initialization (Jani Nikula) - move the migration sanity check (Matthew Auld) - handle more rounding in selftests (Matthew Auld) - Perf and i915 query kerneldoc updates (Matt Roper) - Use i915_probe_error instead of drm_err (Vinay Belgaumkar) - sanity check object size in the buddy allocator (Matthew Auld) - fixup selftests min_alignment usage (Matthew Auld) - tweak selftests misaligned_case (Matthew Auld) Signed-off-by: Dave Airlie <airlied@redhat.com> # Conflicts: # drivers/gpu/drm/i915/i915_vma.c From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/Ymkfy8FjsG2JrodK@tursulin-mobl2
143 lines
4.3 KiB
C
143 lines
4.3 KiB
C
// SPDX-License-Identifier: MIT
|
|
/*
|
|
* Copyright © 2019 Intel Corporation
|
|
*/
|
|
|
|
#include <uapi/drm/i915_drm.h>
|
|
|
|
#include "intel_memory_region.h"
|
|
#include "gem/i915_gem_region.h"
|
|
#include "gem/i915_gem_lmem.h"
|
|
#include "i915_drv.h"
|
|
|
|
void __iomem *
|
|
i915_gem_object_lmem_io_map(struct drm_i915_gem_object *obj,
|
|
unsigned long n,
|
|
unsigned long size)
|
|
{
|
|
resource_size_t offset;
|
|
|
|
GEM_BUG_ON(!i915_gem_object_is_contiguous(obj));
|
|
|
|
offset = i915_gem_object_get_dma_address(obj, n);
|
|
offset -= obj->mm.region->region.start;
|
|
|
|
return io_mapping_map_wc(&obj->mm.region->iomap, offset, size);
|
|
}
|
|
|
|
/**
|
|
* i915_gem_object_is_lmem - Whether the object is resident in
|
|
* lmem
|
|
* @obj: The object to check.
|
|
*
|
|
* Even if an object is allowed to migrate and change memory region,
|
|
* this function checks whether it will always be present in lmem when
|
|
* valid *or* if that's not the case, whether it's currently resident in lmem.
|
|
* For migratable and evictable objects, the latter only makes sense when
|
|
* the object is locked.
|
|
*
|
|
* Return: Whether the object migratable but resident in lmem, or not
|
|
* migratable and will be present in lmem when valid.
|
|
*/
|
|
bool i915_gem_object_is_lmem(struct drm_i915_gem_object *obj)
|
|
{
|
|
struct intel_memory_region *mr = READ_ONCE(obj->mm.region);
|
|
|
|
#ifdef CONFIG_LOCKDEP
|
|
if (i915_gem_object_migratable(obj) &&
|
|
i915_gem_object_evictable(obj))
|
|
assert_object_held(obj);
|
|
#endif
|
|
return mr && (mr->type == INTEL_MEMORY_LOCAL ||
|
|
mr->type == INTEL_MEMORY_STOLEN_LOCAL);
|
|
}
|
|
|
|
/**
|
|
* __i915_gem_object_is_lmem - Whether the object is resident in
|
|
* lmem while in the fence signaling critical path.
|
|
* @obj: The object to check.
|
|
*
|
|
* This function is intended to be called from within the fence signaling
|
|
* path where the fence, or a pin, keeps the object from being migrated. For
|
|
* example during gpu reset or similar.
|
|
*
|
|
* Return: Whether the object is resident in lmem.
|
|
*/
|
|
bool __i915_gem_object_is_lmem(struct drm_i915_gem_object *obj)
|
|
{
|
|
struct intel_memory_region *mr = READ_ONCE(obj->mm.region);
|
|
|
|
#ifdef CONFIG_LOCKDEP
|
|
GEM_WARN_ON(dma_resv_test_signaled(obj->base.resv, DMA_RESV_USAGE_BOOKKEEP) &&
|
|
i915_gem_object_evictable(obj));
|
|
#endif
|
|
return mr && (mr->type == INTEL_MEMORY_LOCAL ||
|
|
mr->type == INTEL_MEMORY_STOLEN_LOCAL);
|
|
}
|
|
|
|
/**
|
|
* __i915_gem_object_create_lmem_with_ps - Create lmem object and force the
|
|
* minimum page size for the backing pages.
|
|
* @i915: The i915 instance.
|
|
* @size: The size in bytes for the object. Note that we need to round the size
|
|
* up depending on the @page_size. The final object size can be fished out from
|
|
* the drm GEM object.
|
|
* @page_size: The requested minimum page size in bytes for this object. This is
|
|
* useful if we need something bigger than the regions min_page_size due to some
|
|
* hw restriction, or in some very specialised cases where it needs to be
|
|
* smaller, where the internal fragmentation cost is too great when rounding up
|
|
* the object size.
|
|
* @flags: The optional BO allocation flags.
|
|
*
|
|
* Note that this interface assumes you know what you are doing when forcing the
|
|
* @page_size. If this is smaller than the regions min_page_size then it can
|
|
* never be inserted into any GTT, otherwise it might lead to undefined
|
|
* behaviour.
|
|
*
|
|
* Return: The object pointer, which might be an ERR_PTR in the case of failure.
|
|
*/
|
|
struct drm_i915_gem_object *
|
|
__i915_gem_object_create_lmem_with_ps(struct drm_i915_private *i915,
|
|
resource_size_t size,
|
|
resource_size_t page_size,
|
|
unsigned int flags)
|
|
{
|
|
return i915_gem_object_create_region(i915->mm.regions[INTEL_REGION_LMEM_0],
|
|
size, page_size, flags);
|
|
}
|
|
|
|
struct drm_i915_gem_object *
|
|
i915_gem_object_create_lmem_from_data(struct drm_i915_private *i915,
|
|
const void *data, size_t size)
|
|
{
|
|
struct drm_i915_gem_object *obj;
|
|
void *map;
|
|
|
|
obj = i915_gem_object_create_lmem(i915,
|
|
round_up(size, PAGE_SIZE),
|
|
I915_BO_ALLOC_CONTIGUOUS);
|
|
if (IS_ERR(obj))
|
|
return obj;
|
|
|
|
map = i915_gem_object_pin_map_unlocked(obj, I915_MAP_WC);
|
|
if (IS_ERR(map)) {
|
|
i915_gem_object_put(obj);
|
|
return map;
|
|
}
|
|
|
|
memcpy(map, data, size);
|
|
|
|
i915_gem_object_unpin_map(obj);
|
|
|
|
return obj;
|
|
}
|
|
|
|
struct drm_i915_gem_object *
|
|
i915_gem_object_create_lmem(struct drm_i915_private *i915,
|
|
resource_size_t size,
|
|
unsigned int flags)
|
|
{
|
|
return i915_gem_object_create_region(i915->mm.regions[INTEL_REGION_LMEM_0],
|
|
size, 0, flags);
|
|
}
|