Commit 55ea9bd6 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'drm-intel-fixes-2022-07-17' of git://anongit.freedesktop.org/drm/drm-intel

Pull intel drm build fix from Rodrigo Vivi:
 "Our 'dim' flow has a problem with fixes of fixes getting missed. We
  need to take a look on that later.

  Meanwhile, please allow me to quickly propagate this fix for the
  32-bit build issue here upstream"

* tag 'drm-intel-fixes-2022-07-17' of git://anongit.freedesktop.org/drm/drm-intel:
  drm/i915/ttm: fix 32b build
parents f7f4da30 ced7866d
...@@ -60,6 +60,8 @@ __i915_gem_object_create_region(struct intel_memory_region *mem, ...@@ -60,6 +60,8 @@ __i915_gem_object_create_region(struct intel_memory_region *mem,
if (page_size) if (page_size)
default_page_size = page_size; default_page_size = page_size;
/* We should be able to fit a page within an sg entry */
GEM_BUG_ON(overflows_type(default_page_size, u32));
GEM_BUG_ON(!is_power_of_2_u64(default_page_size)); GEM_BUG_ON(!is_power_of_2_u64(default_page_size));
GEM_BUG_ON(default_page_size < PAGE_SIZE); GEM_BUG_ON(default_page_size < PAGE_SIZE);
......
...@@ -620,7 +620,7 @@ i915_ttm_resource_get_st(struct drm_i915_gem_object *obj, ...@@ -620,7 +620,7 @@ i915_ttm_resource_get_st(struct drm_i915_gem_object *obj,
struct ttm_resource *res) struct ttm_resource *res)
{ {
struct ttm_buffer_object *bo = i915_gem_to_ttm(obj); struct ttm_buffer_object *bo = i915_gem_to_ttm(obj);
u64 page_alignment; u32 page_alignment;
if (!i915_ttm_gtt_binds_lmem(res)) if (!i915_ttm_gtt_binds_lmem(res))
return i915_ttm_tt_get_st(bo->ttm); return i915_ttm_tt_get_st(bo->ttm);
......
...@@ -79,10 +79,10 @@ void i915_refct_sgt_init(struct i915_refct_sgt *rsgt, size_t size) ...@@ -79,10 +79,10 @@ void i915_refct_sgt_init(struct i915_refct_sgt *rsgt, size_t size)
*/ */
struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *node, struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *node,
u64 region_start, u64 region_start,
u64 page_alignment) u32 page_alignment)
{ {
const u64 max_segment = round_down(UINT_MAX, page_alignment); const u32 max_segment = round_down(UINT_MAX, page_alignment);
u64 segment_pages = max_segment >> PAGE_SHIFT; const u32 segment_pages = max_segment >> PAGE_SHIFT;
u64 block_size, offset, prev_end; u64 block_size, offset, prev_end;
struct i915_refct_sgt *rsgt; struct i915_refct_sgt *rsgt;
struct sg_table *st; struct sg_table *st;
...@@ -96,7 +96,7 @@ struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *node, ...@@ -96,7 +96,7 @@ struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *node,
i915_refct_sgt_init(rsgt, node->size << PAGE_SHIFT); i915_refct_sgt_init(rsgt, node->size << PAGE_SHIFT);
st = &rsgt->table; st = &rsgt->table;
if (sg_alloc_table(st, DIV_ROUND_UP(node->size, segment_pages), if (sg_alloc_table(st, DIV_ROUND_UP_ULL(node->size, segment_pages),
GFP_KERNEL)) { GFP_KERNEL)) {
i915_refct_sgt_put(rsgt); i915_refct_sgt_put(rsgt);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -123,7 +123,7 @@ struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *node, ...@@ -123,7 +123,7 @@ struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *node,
st->nents++; st->nents++;
} }
len = min(block_size, max_segment - sg->length); len = min_t(u64, block_size, max_segment - sg->length);
sg->length += len; sg->length += len;
sg_dma_len(sg) += len; sg_dma_len(sg) += len;
...@@ -155,11 +155,11 @@ struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *node, ...@@ -155,11 +155,11 @@ struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *node,
*/ */
struct i915_refct_sgt *i915_rsgt_from_buddy_resource(struct ttm_resource *res, struct i915_refct_sgt *i915_rsgt_from_buddy_resource(struct ttm_resource *res,
u64 region_start, u64 region_start,
u64 page_alignment) u32 page_alignment)
{ {
struct i915_ttm_buddy_resource *bman_res = to_ttm_buddy_resource(res); struct i915_ttm_buddy_resource *bman_res = to_ttm_buddy_resource(res);
const u64 size = res->num_pages << PAGE_SHIFT; const u64 size = res->num_pages << PAGE_SHIFT;
const u64 max_segment = round_down(UINT_MAX, page_alignment); const u32 max_segment = round_down(UINT_MAX, page_alignment);
struct drm_buddy *mm = bman_res->mm; struct drm_buddy *mm = bman_res->mm;
struct list_head *blocks = &bman_res->blocks; struct list_head *blocks = &bman_res->blocks;
struct drm_buddy_block *block; struct drm_buddy_block *block;
...@@ -207,7 +207,7 @@ struct i915_refct_sgt *i915_rsgt_from_buddy_resource(struct ttm_resource *res, ...@@ -207,7 +207,7 @@ struct i915_refct_sgt *i915_rsgt_from_buddy_resource(struct ttm_resource *res,
st->nents++; st->nents++;
} }
len = min(block_size, max_segment - sg->length); len = min_t(u64, block_size, max_segment - sg->length);
sg->length += len; sg->length += len;
sg_dma_len(sg) += len; sg_dma_len(sg) += len;
......
...@@ -214,10 +214,10 @@ void i915_refct_sgt_init(struct i915_refct_sgt *rsgt, size_t size); ...@@ -214,10 +214,10 @@ void i915_refct_sgt_init(struct i915_refct_sgt *rsgt, size_t size);
struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *node, struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *node,
u64 region_start, u64 region_start,
u64 page_alignment); u32 page_alignment);
struct i915_refct_sgt *i915_rsgt_from_buddy_resource(struct ttm_resource *res, struct i915_refct_sgt *i915_rsgt_from_buddy_resource(struct ttm_resource *res,
u64 region_start, u64 region_start,
u64 page_alignment); u32 page_alignment);
#endif #endif
...@@ -163,7 +163,7 @@ int intel_region_ttm_fini(struct intel_memory_region *mem) ...@@ -163,7 +163,7 @@ int intel_region_ttm_fini(struct intel_memory_region *mem)
struct i915_refct_sgt * struct i915_refct_sgt *
intel_region_ttm_resource_to_rsgt(struct intel_memory_region *mem, intel_region_ttm_resource_to_rsgt(struct intel_memory_region *mem,
struct ttm_resource *res, struct ttm_resource *res,
u64 page_alignment) u32 page_alignment)
{ {
if (mem->is_range_manager) { if (mem->is_range_manager) {
struct ttm_range_mgr_node *range_node = struct ttm_range_mgr_node *range_node =
......
...@@ -25,7 +25,7 @@ int intel_region_ttm_fini(struct intel_memory_region *mem); ...@@ -25,7 +25,7 @@ int intel_region_ttm_fini(struct intel_memory_region *mem);
struct i915_refct_sgt * struct i915_refct_sgt *
intel_region_ttm_resource_to_rsgt(struct intel_memory_region *mem, intel_region_ttm_resource_to_rsgt(struct intel_memory_region *mem,
struct ttm_resource *res, struct ttm_resource *res,
u64 page_alignment); u32 page_alignment);
void intel_region_ttm_resource_free(struct intel_memory_region *mem, void intel_region_ttm_resource_free(struct intel_memory_region *mem,
struct ttm_resource *res); struct ttm_resource *res);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment