mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 22:21:42 +00:00
Driver Changes:
- Fix an out-of-bounds shift. - Fix the display code thinking xe uses shmem - Fix a warning about index out-of-bound - Fix a clang-16 compilation warning -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRskUM7w1oG5rx2IZO4FpNVCsYGvwUCZc4GBQAKCRC4FpNVCsYG vxR5AQD8961ciqivB/Psn36f9lOctbJ41Hma46x5ESuQjfN+vAEA3qLplLgWuFrY HTaq3VG4kX1M5yF2b6p18NnTSAyyLAA= =tfli -----END PGP SIGNATURE----- Merge tag 'drm-xe-fixes-2024-02-15' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-fixes Driver Changes: - Fix an out-of-bounds shift. - Fix the display code thinking xe uses shmem - Fix a warning about index out-of-bound - Fix a clang-16 compilation warning Signed-off-by: Dave Airlie <airlied@redhat.com> From: Thomas Hellstrom <thomas.hellstrom@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/Zc4GpcrbFVqdK9Ws@fedora
This commit is contained in:
commit
427e337f7a
@ -10,7 +10,7 @@
|
||||
|
||||
#include "xe_bo.h"
|
||||
|
||||
#define i915_gem_object_is_shmem(obj) ((obj)->flags & XE_BO_CREATE_SYSTEM_BIT)
|
||||
#define i915_gem_object_is_shmem(obj) (0) /* We don't use shmem */
|
||||
|
||||
static inline dma_addr_t i915_gem_object_get_dma_address(const struct xe_bo *bo, pgoff_t n)
|
||||
{
|
||||
|
@ -20,8 +20,8 @@
|
||||
|
||||
struct xe_pt_dir {
|
||||
struct xe_pt pt;
|
||||
/** @dir: Directory structure for the xe_pt_walk functionality */
|
||||
struct xe_ptw_dir dir;
|
||||
/** @children: Array of page-table child nodes */
|
||||
struct xe_ptw *children[XE_PDES];
|
||||
};
|
||||
|
||||
#if IS_ENABLED(CONFIG_DRM_XE_DEBUG_VM)
|
||||
@ -44,7 +44,7 @@ static struct xe_pt_dir *as_xe_pt_dir(struct xe_pt *pt)
|
||||
|
||||
static struct xe_pt *xe_pt_entry(struct xe_pt_dir *pt_dir, unsigned int index)
|
||||
{
|
||||
return container_of(pt_dir->dir.entries[index], struct xe_pt, base);
|
||||
return container_of(pt_dir->children[index], struct xe_pt, base);
|
||||
}
|
||||
|
||||
static u64 __xe_pt_empty_pte(struct xe_tile *tile, struct xe_vm *vm,
|
||||
@ -65,6 +65,14 @@ static u64 __xe_pt_empty_pte(struct xe_tile *tile, struct xe_vm *vm,
|
||||
XE_PTE_NULL;
|
||||
}
|
||||
|
||||
static void xe_pt_free(struct xe_pt *pt)
|
||||
{
|
||||
if (pt->level)
|
||||
kfree(as_xe_pt_dir(pt));
|
||||
else
|
||||
kfree(pt);
|
||||
}
|
||||
|
||||
/**
|
||||
* xe_pt_create() - Create a page-table.
|
||||
* @vm: The vm to create for.
|
||||
@ -85,15 +93,19 @@ struct xe_pt *xe_pt_create(struct xe_vm *vm, struct xe_tile *tile,
|
||||
{
|
||||
struct xe_pt *pt;
|
||||
struct xe_bo *bo;
|
||||
size_t size;
|
||||
int err;
|
||||
|
||||
size = !level ? sizeof(struct xe_pt) : sizeof(struct xe_pt_dir) +
|
||||
XE_PDES * sizeof(struct xe_ptw *);
|
||||
pt = kzalloc(size, GFP_KERNEL);
|
||||
if (level) {
|
||||
struct xe_pt_dir *dir = kzalloc(sizeof(*dir), GFP_KERNEL);
|
||||
|
||||
pt = (dir) ? &dir->pt : NULL;
|
||||
} else {
|
||||
pt = kzalloc(sizeof(*pt), GFP_KERNEL);
|
||||
}
|
||||
if (!pt)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
pt->level = level;
|
||||
bo = xe_bo_create_pin_map(vm->xe, tile, vm, SZ_4K,
|
||||
ttm_bo_type_kernel,
|
||||
XE_BO_CREATE_VRAM_IF_DGFX(tile) |
|
||||
@ -106,8 +118,7 @@ struct xe_pt *xe_pt_create(struct xe_vm *vm, struct xe_tile *tile,
|
||||
goto err_kfree;
|
||||
}
|
||||
pt->bo = bo;
|
||||
pt->level = level;
|
||||
pt->base.dir = level ? &as_xe_pt_dir(pt)->dir : NULL;
|
||||
pt->base.children = level ? as_xe_pt_dir(pt)->children : NULL;
|
||||
|
||||
if (vm->xef)
|
||||
xe_drm_client_add_bo(vm->xef->client, pt->bo);
|
||||
@ -116,7 +127,7 @@ struct xe_pt *xe_pt_create(struct xe_vm *vm, struct xe_tile *tile,
|
||||
return pt;
|
||||
|
||||
err_kfree:
|
||||
kfree(pt);
|
||||
xe_pt_free(pt);
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
|
||||
@ -193,7 +204,7 @@ void xe_pt_destroy(struct xe_pt *pt, u32 flags, struct llist_head *deferred)
|
||||
deferred);
|
||||
}
|
||||
}
|
||||
kfree(pt);
|
||||
xe_pt_free(pt);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -358,7 +369,7 @@ xe_pt_insert_entry(struct xe_pt_stage_bind_walk *xe_walk, struct xe_pt *parent,
|
||||
struct iosys_map *map = &parent->bo->vmap;
|
||||
|
||||
if (unlikely(xe_child))
|
||||
parent->base.dir->entries[offset] = &xe_child->base;
|
||||
parent->base.children[offset] = &xe_child->base;
|
||||
|
||||
xe_pt_write(xe_walk->vm->xe, map, offset, pte);
|
||||
parent->num_live++;
|
||||
@ -853,7 +864,7 @@ static void xe_pt_commit_bind(struct xe_vma *vma,
|
||||
xe_pt_destroy(xe_pt_entry(pt_dir, j_),
|
||||
xe_vma_vm(vma)->flags, deferred);
|
||||
|
||||
pt_dir->dir.entries[j_] = &newpte->base;
|
||||
pt_dir->children[j_] = &newpte->base;
|
||||
}
|
||||
kfree(entries[i].pt_entries);
|
||||
}
|
||||
@ -1507,7 +1518,7 @@ xe_pt_commit_unbind(struct xe_vma *vma,
|
||||
xe_pt_destroy(xe_pt_entry(pt_dir, i),
|
||||
xe_vma_vm(vma)->flags, deferred);
|
||||
|
||||
pt_dir->dir.entries[i] = NULL;
|
||||
pt_dir->children[i] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ int xe_pt_walk_range(struct xe_ptw *parent, unsigned int level,
|
||||
u64 addr, u64 end, struct xe_pt_walk *walk)
|
||||
{
|
||||
pgoff_t offset = xe_pt_offset(addr, level, walk);
|
||||
struct xe_ptw **entries = parent->dir ? parent->dir->entries : NULL;
|
||||
struct xe_ptw **entries = parent->children ? parent->children : NULL;
|
||||
const struct xe_pt_walk_ops *ops = walk->ops;
|
||||
enum page_walk_action action;
|
||||
struct xe_ptw *child;
|
||||
|
@ -8,28 +8,15 @@
|
||||
#include <linux/pagewalk.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
struct xe_ptw_dir;
|
||||
|
||||
/**
|
||||
* struct xe_ptw - base class for driver pagetable subclassing.
|
||||
* @dir: Pointer to an array of children if any.
|
||||
* @children: Pointer to an array of children if any.
|
||||
*
|
||||
* Drivers could subclass this, and if it's a page-directory, typically
|
||||
* embed the xe_ptw_dir::entries array in the same allocation.
|
||||
* embed an array of xe_ptw pointers.
|
||||
*/
|
||||
struct xe_ptw {
|
||||
struct xe_ptw_dir *dir;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct xe_ptw_dir - page directory structure
|
||||
* @entries: Array holding page directory children.
|
||||
*
|
||||
* It is the responsibility of the user to ensure @entries is
|
||||
* correctly sized.
|
||||
*/
|
||||
struct xe_ptw_dir {
|
||||
struct xe_ptw *entries[0];
|
||||
struct xe_ptw **children;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -151,6 +151,11 @@ xe_range_fence_tree_next(struct xe_range_fence *rfence, u64 start, u64 last)
|
||||
return xe_range_fence_tree_iter_next(rfence, start, last);
|
||||
}
|
||||
|
||||
static void xe_range_fence_free(struct xe_range_fence *rfence)
|
||||
{
|
||||
kfree(rfence);
|
||||
}
|
||||
|
||||
const struct xe_range_fence_ops xe_range_fence_kfree_ops = {
|
||||
.free = (void (*)(struct xe_range_fence *rfence)) kfree,
|
||||
.free = xe_range_fence_free,
|
||||
};
|
||||
|
@ -995,9 +995,16 @@ int xe_vm_prepare_vma(struct drm_exec *exec, struct xe_vma *vma,
|
||||
int err;
|
||||
|
||||
XE_WARN_ON(!vm);
|
||||
err = drm_exec_prepare_obj(exec, xe_vm_obj(vm), num_shared);
|
||||
if (!err && bo && !bo->vm)
|
||||
err = drm_exec_prepare_obj(exec, &bo->ttm.base, num_shared);
|
||||
if (num_shared)
|
||||
err = drm_exec_prepare_obj(exec, xe_vm_obj(vm), num_shared);
|
||||
else
|
||||
err = drm_exec_lock_obj(exec, xe_vm_obj(vm));
|
||||
if (!err && bo && !bo->vm) {
|
||||
if (num_shared)
|
||||
err = drm_exec_prepare_obj(exec, &bo->ttm.base, num_shared);
|
||||
else
|
||||
err = drm_exec_lock_obj(exec, &bo->ttm.base);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user