Message ID | 20220708102124.493372-1-Arunpravin.PaneerSelvam@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Revert "drm/amdgpu: add drm buddy support to amdgpu" | expand |
Hi Am 08.07.22 um 12:21 schrieb Arunpravin Paneer Selvam: > This reverts the following commits: > commit 708d19d9f362 ("drm/amdgpu: move internal vram_mgr function into the C file") > commit 5e3f1e7729ec ("drm/amdgpu: fix start calculation in amdgpu_vram_mgr_new") > commit c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu") Does the revert need to be cherry-picked into drm-misc-next-fixes? Best regards Thomas > > [WHY] > Few users reported garbaged graphics as soon as x starts, > reverting until this can be resolved. > > Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> > --- > drivers/gpu/drm/Kconfig | 1 - > .../gpu/drm/amd/amdgpu/amdgpu_res_cursor.h | 97 +---- > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 10 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 394 +++++++----------- > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h | 62 --- > 5 files changed, 176 insertions(+), 388 deletions(-) > delete mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h > > diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig > index 6c2256e8474b..d438d5ff8b40 100644 > --- a/drivers/gpu/drm/Kconfig > +++ b/drivers/gpu/drm/Kconfig > @@ -272,7 +272,6 @@ config DRM_AMDGPU > select HWMON > select BACKLIGHT_CLASS_DEVICE > select INTERVAL_TREE > - select DRM_BUDDY > help > Choose this option if you have a recent AMD Radeon graphics card. > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_res_cursor.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_res_cursor.h > index 6546552e596c..acfa207cf970 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_res_cursor.h > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_res_cursor.h > @@ -30,15 +30,12 @@ > #include <drm/ttm/ttm_resource.h> > #include <drm/ttm/ttm_range_manager.h> > > -#include "amdgpu_vram_mgr.h" > - > /* state back for walking over vram_mgr and gtt_mgr allocations */ > struct amdgpu_res_cursor { > uint64_t start; > uint64_t size; > uint64_t remaining; > - void *node; > - uint32_t mem_type; > + struct drm_mm_node *node; > }; > > /** > @@ -55,63 +52,27 @@ static inline void amdgpu_res_first(struct ttm_resource *res, > uint64_t start, uint64_t size, > struct amdgpu_res_cursor *cur) > { > - struct drm_buddy_block *block; > - struct list_head *head, *next; > struct drm_mm_node *node; > > - if (!res) > - goto fallback; > - > - BUG_ON(start + size > res->num_pages << PAGE_SHIFT); > - > - cur->mem_type = res->mem_type; > - > - switch (cur->mem_type) { > - case TTM_PL_VRAM: > - head = &to_amdgpu_vram_mgr_resource(res)->blocks; > - > - block = list_first_entry_or_null(head, > - struct drm_buddy_block, > - link); > - if (!block) > - goto fallback; > - > - while (start >= amdgpu_vram_mgr_block_size(block)) { > - start -= amdgpu_vram_mgr_block_size(block); > - > - next = block->link.next; > - if (next != head) > - block = list_entry(next, struct drm_buddy_block, link); > - } > - > - cur->start = amdgpu_vram_mgr_block_start(block) + start; > - cur->size = min(amdgpu_vram_mgr_block_size(block) - start, size); > - cur->remaining = size; > - cur->node = block; > - break; > - case TTM_PL_TT: > - node = to_ttm_range_mgr_node(res)->mm_nodes; > - while (start >= node->size << PAGE_SHIFT) > - start -= node++->size << PAGE_SHIFT; > - > - cur->start = (node->start << PAGE_SHIFT) + start; > - cur->size = min((node->size << PAGE_SHIFT) - start, size); > + if (!res || res->mem_type == TTM_PL_SYSTEM) { > + cur->start = start; > + cur->size = size; > cur->remaining = size; > - cur->node = node; > - break; > - default: > - goto fallback; > + cur->node = NULL; > + WARN_ON(res && start + size > res->num_pages << PAGE_SHIFT); > + return; > } > > - return; > + BUG_ON(start + size > res->num_pages << PAGE_SHIFT); > > -fallback: > - cur->start = start; > - cur->size = size; > + node = to_ttm_range_mgr_node(res)->mm_nodes; > + while (start >= node->size << PAGE_SHIFT) > + start -= node++->size << PAGE_SHIFT; > + > + cur->start = (node->start << PAGE_SHIFT) + start; > + cur->size = min((node->size << PAGE_SHIFT) - start, size); > cur->remaining = size; > - cur->node = NULL; > - WARN_ON(res && start + size > res->num_pages << PAGE_SHIFT); > - return; > + cur->node = node; > } > > /** > @@ -124,9 +85,7 @@ static inline void amdgpu_res_first(struct ttm_resource *res, > */ > static inline void amdgpu_res_next(struct amdgpu_res_cursor *cur, uint64_t size) > { > - struct drm_buddy_block *block; > - struct drm_mm_node *node; > - struct list_head *next; > + struct drm_mm_node *node = cur->node; > > BUG_ON(size > cur->remaining); > > @@ -140,27 +99,9 @@ static inline void amdgpu_res_next(struct amdgpu_res_cursor *cur, uint64_t size) > return; > } > > - switch (cur->mem_type) { > - case TTM_PL_VRAM: > - block = cur->node; > - > - next = block->link.next; > - block = list_entry(next, struct drm_buddy_block, link); > - > - cur->node = block; > - cur->start = amdgpu_vram_mgr_block_start(block); > - cur->size = min(amdgpu_vram_mgr_block_size(block), cur->remaining); > - break; > - case TTM_PL_TT: > - node = cur->node; > - > - cur->node = ++node; > - cur->start = node->start << PAGE_SHIFT; > - cur->size = min(node->size << PAGE_SHIFT, cur->remaining); > - break; > - default: > - return; > - } > + cur->node = ++node; > + cur->start = node->start << PAGE_SHIFT; > + cur->size = min(node->size << PAGE_SHIFT, cur->remaining); > } > > #endif > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h > index 6a70818039dd..9120ae80ef52 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h > @@ -26,7 +26,6 @@ > > #include <linux/dma-direction.h> > #include <drm/gpu_scheduler.h> > -#include "amdgpu_vram_mgr.h" > #include "amdgpu.h" > > #define AMDGPU_PL_GDS (TTM_PL_PRIV + 0) > @@ -39,6 +38,15 @@ > > #define AMDGPU_POISON 0xd0bed0be > > +struct amdgpu_vram_mgr { > + struct ttm_resource_manager manager; > + struct drm_mm mm; > + spinlock_t lock; > + struct list_head reservations_pending; > + struct list_head reserved_pages; > + atomic64_t vis_usage; > +}; > + > struct amdgpu_gtt_mgr { > struct ttm_resource_manager manager; > struct drm_mm mm; > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c > index 7a5e8a7b4a1b..0a7611648573 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c > @@ -32,10 +32,8 @@ > #include "atom.h" > > struct amdgpu_vram_reservation { > - u64 start; > - u64 size; > - struct list_head allocated; > - struct list_head blocks; > + struct list_head node; > + struct drm_mm_node mm_node; > }; > > static inline struct amdgpu_vram_mgr * > @@ -50,35 +48,6 @@ to_amdgpu_device(struct amdgpu_vram_mgr *mgr) > return container_of(mgr, struct amdgpu_device, mman.vram_mgr); > } > > -static inline struct drm_buddy_block * > -amdgpu_vram_mgr_first_block(struct list_head *list) > -{ > - return list_first_entry_or_null(list, struct drm_buddy_block, link); > -} > - > -static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct list_head *head) > -{ > - struct drm_buddy_block *block; > - u64 start, size; > - > - block = amdgpu_vram_mgr_first_block(head); > - if (!block) > - return false; > - > - while (head != block->link.next) { > - start = amdgpu_vram_mgr_block_start(block); > - size = amdgpu_vram_mgr_block_size(block); > - > - block = list_entry(block->link.next, struct drm_buddy_block, link); > - if (start + size != amdgpu_vram_mgr_block_start(block)) > - return false; > - } > - > - return true; > -} > - > - > - > /** > * DOC: mem_info_vram_total > * > @@ -217,18 +186,18 @@ const struct attribute_group amdgpu_vram_mgr_attr_group = { > }; > > /** > - * amdgpu_vram_mgr_vis_size - Calculate visible block size > + * amdgpu_vram_mgr_vis_size - Calculate visible node size > * > * @adev: amdgpu_device pointer > - * @block: DRM BUDDY block structure > + * @node: MM node structure > * > - * Calculate how many bytes of the DRM BUDDY block are inside visible VRAM > + * Calculate how many bytes of the MM node are inside visible VRAM > */ > static u64 amdgpu_vram_mgr_vis_size(struct amdgpu_device *adev, > - struct drm_buddy_block *block) > + struct drm_mm_node *node) > { > - u64 start = amdgpu_vram_mgr_block_start(block); > - u64 end = start + amdgpu_vram_mgr_block_size(block); > + uint64_t start = node->start << PAGE_SHIFT; > + uint64_t end = (node->size + node->start) << PAGE_SHIFT; > > if (start >= adev->gmc.visible_vram_size) > return 0; > @@ -249,9 +218,9 @@ u64 amdgpu_vram_mgr_bo_visible_size(struct amdgpu_bo *bo) > { > struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); > struct ttm_resource *res = bo->tbo.resource; > - struct amdgpu_vram_mgr_resource *vres = to_amdgpu_vram_mgr_resource(res); > - struct drm_buddy_block *block; > - u64 usage = 0; > + unsigned pages = res->num_pages; > + struct drm_mm_node *mm; > + u64 usage; > > if (amdgpu_gmc_vram_full_visible(&adev->gmc)) > return amdgpu_bo_size(bo); > @@ -259,8 +228,9 @@ u64 amdgpu_vram_mgr_bo_visible_size(struct amdgpu_bo *bo) > if (res->start >= adev->gmc.visible_vram_size >> PAGE_SHIFT) > return 0; > > - list_for_each_entry(block, &vres->blocks, link) > - usage += amdgpu_vram_mgr_vis_size(adev, block); > + mm = &container_of(res, struct ttm_range_mgr_node, base)->mm_nodes[0]; > + for (usage = 0; pages; pages -= mm->size, mm++) > + usage += amdgpu_vram_mgr_vis_size(adev, mm); > > return usage; > } > @@ -270,30 +240,23 @@ static void amdgpu_vram_mgr_do_reserve(struct ttm_resource_manager *man) > { > struct amdgpu_vram_mgr *mgr = to_vram_mgr(man); > struct amdgpu_device *adev = to_amdgpu_device(mgr); > - struct drm_buddy *mm = &mgr->mm; > + struct drm_mm *mm = &mgr->mm; > struct amdgpu_vram_reservation *rsv, *temp; > - struct drm_buddy_block *block; > uint64_t vis_usage; > > - list_for_each_entry_safe(rsv, temp, &mgr->reservations_pending, blocks) { > - if (drm_buddy_alloc_blocks(mm, rsv->start, rsv->start + rsv->size, > - rsv->size, mm->chunk_size, &rsv->allocated, > - DRM_BUDDY_RANGE_ALLOCATION)) > - continue; > - > - block = amdgpu_vram_mgr_first_block(&rsv->allocated); > - if (!block) > + list_for_each_entry_safe(rsv, temp, &mgr->reservations_pending, node) { > + if (drm_mm_reserve_node(mm, &rsv->mm_node)) > continue; > > dev_dbg(adev->dev, "Reservation 0x%llx - %lld, Succeeded\n", > - rsv->start, rsv->size); > + rsv->mm_node.start, rsv->mm_node.size); > > - vis_usage = amdgpu_vram_mgr_vis_size(adev, block); > + vis_usage = amdgpu_vram_mgr_vis_size(adev, &rsv->mm_node); > atomic64_add(vis_usage, &mgr->vis_usage); > spin_lock(&man->bdev->lru_lock); > - man->usage += rsv->size; > + man->usage += rsv->mm_node.size << PAGE_SHIFT; > spin_unlock(&man->bdev->lru_lock); > - list_move(&rsv->blocks, &mgr->reserved_pages); > + list_move(&rsv->node, &mgr->reserved_pages); > } > } > > @@ -315,16 +278,14 @@ int amdgpu_vram_mgr_reserve_range(struct amdgpu_vram_mgr *mgr, > if (!rsv) > return -ENOMEM; > > - INIT_LIST_HEAD(&rsv->allocated); > - INIT_LIST_HEAD(&rsv->blocks); > - > - rsv->start = start; > - rsv->size = size; > + INIT_LIST_HEAD(&rsv->node); > + rsv->mm_node.start = start >> PAGE_SHIFT; > + rsv->mm_node.size = size >> PAGE_SHIFT; > > - mutex_lock(&mgr->lock); > - list_add_tail(&rsv->blocks, &mgr->reservations_pending); > + spin_lock(&mgr->lock); > + list_add_tail(&rsv->node, &mgr->reservations_pending); > amdgpu_vram_mgr_do_reserve(&mgr->manager); > - mutex_unlock(&mgr->lock); > + spin_unlock(&mgr->lock); > > return 0; > } > @@ -346,19 +307,19 @@ int amdgpu_vram_mgr_query_page_status(struct amdgpu_vram_mgr *mgr, > struct amdgpu_vram_reservation *rsv; > int ret; > > - mutex_lock(&mgr->lock); > + spin_lock(&mgr->lock); > > - list_for_each_entry(rsv, &mgr->reservations_pending, blocks) { > - if (rsv->start <= start && > - (start < (rsv->start + rsv->size))) { > + list_for_each_entry(rsv, &mgr->reservations_pending, node) { > + if ((rsv->mm_node.start <= start) && > + (start < (rsv->mm_node.start + rsv->mm_node.size))) { > ret = -EBUSY; > goto out; > } > } > > - list_for_each_entry(rsv, &mgr->reserved_pages, blocks) { > - if (rsv->start <= start && > - (start < (rsv->start + rsv->size))) { > + list_for_each_entry(rsv, &mgr->reserved_pages, node) { > + if ((rsv->mm_node.start <= start) && > + (start < (rsv->mm_node.start + rsv->mm_node.size))) { > ret = 0; > goto out; > } > @@ -366,10 +327,32 @@ int amdgpu_vram_mgr_query_page_status(struct amdgpu_vram_mgr *mgr, > > ret = -ENOENT; > out: > - mutex_unlock(&mgr->lock); > + spin_unlock(&mgr->lock); > return ret; > } > > +/** > + * amdgpu_vram_mgr_virt_start - update virtual start address > + * > + * @mem: ttm_resource to update > + * @node: just allocated node > + * > + * Calculate a virtual BO start address to easily check if everything is CPU > + * accessible. > + */ > +static void amdgpu_vram_mgr_virt_start(struct ttm_resource *mem, > + struct drm_mm_node *node) > +{ > + unsigned long start; > + > + start = node->start + node->size; > + if (start > mem->num_pages) > + start -= mem->num_pages; > + else > + start = 0; > + mem->start = max(mem->start, start); > +} > + > /** > * amdgpu_vram_mgr_new - allocate new ranges > * > @@ -385,44 +368,46 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man, > const struct ttm_place *place, > struct ttm_resource **res) > { > - u64 vis_usage = 0, max_bytes, cur_size, min_block_size; > + unsigned long lpfn, num_nodes, pages_per_node, pages_left, pages; > struct amdgpu_vram_mgr *mgr = to_vram_mgr(man); > struct amdgpu_device *adev = to_amdgpu_device(mgr); > - struct amdgpu_vram_mgr_resource *vres; > - u64 size, remaining_size, lpfn, fpfn; > - struct drm_buddy *mm = &mgr->mm; > - struct drm_buddy_block *block; > - unsigned long pages_per_block; > + uint64_t vis_usage = 0, mem_bytes, max_bytes; > + struct ttm_range_mgr_node *node; > + struct drm_mm *mm = &mgr->mm; > + enum drm_mm_insert_mode mode; > + unsigned i; > int r; > > - lpfn = place->lpfn << PAGE_SHIFT; > + lpfn = place->lpfn; > if (!lpfn) > - lpfn = man->size; > - > - fpfn = place->fpfn << PAGE_SHIFT; > + lpfn = man->size >> PAGE_SHIFT; > > max_bytes = adev->gmc.mc_vram_size; > if (tbo->type != ttm_bo_type_kernel) > max_bytes -= AMDGPU_VM_RESERVED_VRAM; > > + mem_bytes = tbo->base.size; > if (place->flags & TTM_PL_FLAG_CONTIGUOUS) { > - pages_per_block = ~0ul; > + pages_per_node = ~0ul; > + num_nodes = 1; > } else { > #ifdef CONFIG_TRANSPARENT_HUGEPAGE > - pages_per_block = HPAGE_PMD_NR; > + pages_per_node = HPAGE_PMD_NR; > #else > /* default to 2MB */ > - pages_per_block = 2UL << (20UL - PAGE_SHIFT); > + pages_per_node = 2UL << (20UL - PAGE_SHIFT); > #endif > - pages_per_block = max_t(uint32_t, pages_per_block, > - tbo->page_alignment); > + pages_per_node = max_t(uint32_t, pages_per_node, > + tbo->page_alignment); > + num_nodes = DIV_ROUND_UP_ULL(PFN_UP(mem_bytes), pages_per_node); > } > > - vres = kzalloc(sizeof(*vres), GFP_KERNEL); > - if (!vres) > + node = kvmalloc(struct_size(node, mm_nodes, num_nodes), > + GFP_KERNEL | __GFP_ZERO); > + if (!node) > return -ENOMEM; > > - ttm_resource_init(tbo, place, &vres->base); > + ttm_resource_init(tbo, place, &node->base); > > /* bail out quickly if there's likely not enough VRAM for this BO */ > if (ttm_resource_manager_usage(man) > max_bytes) { > @@ -430,136 +415,66 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man, > goto error_fini; > } > > - INIT_LIST_HEAD(&vres->blocks); > - > + mode = DRM_MM_INSERT_BEST; > if (place->flags & TTM_PL_FLAG_TOPDOWN) > - vres->flags |= DRM_BUDDY_TOPDOWN_ALLOCATION; > - > - if (fpfn || lpfn != man->size) > - /* Allocate blocks in desired range */ > - vres->flags |= DRM_BUDDY_RANGE_ALLOCATION; > - > - remaining_size = vres->base.num_pages << PAGE_SHIFT; > - > - mutex_lock(&mgr->lock); > - while (remaining_size) { > - if (tbo->page_alignment) > - min_block_size = tbo->page_alignment << PAGE_SHIFT; > - else > - min_block_size = mgr->default_page_size; > - > - BUG_ON(min_block_size < mm->chunk_size); > - > - /* Limit maximum size to 2GiB due to SG table limitations */ > - size = min(remaining_size, 2ULL << 30); > - > - if (size >= pages_per_block << PAGE_SHIFT) > - min_block_size = pages_per_block << PAGE_SHIFT; > - > - cur_size = size; > - > - if (fpfn + size != place->lpfn << PAGE_SHIFT) { > - /* > - * Except for actual range allocation, modify the size and > - * min_block_size conforming to continuous flag enablement > - */ > - if (place->flags & TTM_PL_FLAG_CONTIGUOUS) { > - size = roundup_pow_of_two(size); > - min_block_size = size; > - /* > - * Modify the size value if size is not > - * aligned with min_block_size > - */ > - } else if (!IS_ALIGNED(size, min_block_size)) { > - size = round_up(size, min_block_size); > + mode = DRM_MM_INSERT_HIGH; > + > + pages_left = node->base.num_pages; > + > + /* Limit maximum size to 2GB due to SG table limitations */ > + pages = min(pages_left, 2UL << (30 - PAGE_SHIFT)); > + > + i = 0; > + spin_lock(&mgr->lock); > + while (pages_left) { > + uint32_t alignment = tbo->page_alignment; > + > + if (pages >= pages_per_node) > + alignment = pages_per_node; > + > + r = drm_mm_insert_node_in_range(mm, &node->mm_nodes[i], pages, > + alignment, 0, place->fpfn, > + lpfn, mode); > + if (unlikely(r)) { > + if (pages > pages_per_node) { > + if (is_power_of_2(pages)) > + pages = pages / 2; > + else > + pages = rounddown_pow_of_two(pages); > + continue; > } > + goto error_free; > } > > - r = drm_buddy_alloc_blocks(mm, fpfn, > - lpfn, > - size, > - min_block_size, > - &vres->blocks, > - vres->flags); > - if (unlikely(r)) > - goto error_free_blocks; > - > - if (size > remaining_size) > - remaining_size = 0; > - else > - remaining_size -= size; > - } > - mutex_unlock(&mgr->lock); > - > - if (cur_size != size) { > - struct drm_buddy_block *block; > - struct list_head *trim_list; > - u64 original_size; > - LIST_HEAD(temp); > - > - trim_list = &vres->blocks; > - original_size = vres->base.num_pages << PAGE_SHIFT; > - > - /* > - * If size value is rounded up to min_block_size, trim the last > - * block to the required size > - */ > - if (!list_is_singular(&vres->blocks)) { > - block = list_last_entry(&vres->blocks, typeof(*block), link); > - list_move_tail(&block->link, &temp); > - trim_list = &temp; > - /* > - * Compute the original_size value by subtracting the > - * last block size with (aligned size - original size) > - */ > - original_size = amdgpu_vram_mgr_block_size(block) - (size - cur_size); > - } > - > - mutex_lock(&mgr->lock); > - drm_buddy_block_trim(mm, > - original_size, > - trim_list); > - mutex_unlock(&mgr->lock); > - > - if (!list_empty(&temp)) > - list_splice_tail(trim_list, &vres->blocks); > - } > - > - vres->base.start = 0; > - list_for_each_entry(block, &vres->blocks, link) { > - unsigned long start; > - > - start = amdgpu_vram_mgr_block_start(block) + > - amdgpu_vram_mgr_block_size(block); > - start >>= PAGE_SHIFT; > + vis_usage += amdgpu_vram_mgr_vis_size(adev, &node->mm_nodes[i]); > + amdgpu_vram_mgr_virt_start(&node->base, &node->mm_nodes[i]); > + pages_left -= pages; > + ++i; > > - if (start > vres->base.num_pages) > - start -= vres->base.num_pages; > - else > - start = 0; > - vres->base.start = max(vres->base.start, start); > - > - vis_usage += amdgpu_vram_mgr_vis_size(adev, block); > + if (pages > pages_left) > + pages = pages_left; > } > + spin_unlock(&mgr->lock); > > - if (amdgpu_is_vram_mgr_blocks_contiguous(&vres->blocks)) > - vres->base.placement |= TTM_PL_FLAG_CONTIGUOUS; > + if (i == 1) > + node->base.placement |= TTM_PL_FLAG_CONTIGUOUS; > > if (adev->gmc.xgmi.connected_to_cpu) > - vres->base.bus.caching = ttm_cached; > + node->base.bus.caching = ttm_cached; > else > - vres->base.bus.caching = ttm_write_combined; > + node->base.bus.caching = ttm_write_combined; > > atomic64_add(vis_usage, &mgr->vis_usage); > - *res = &vres->base; > + *res = &node->base; > return 0; > > -error_free_blocks: > - drm_buddy_free_list(mm, &vres->blocks); > - mutex_unlock(&mgr->lock); > +error_free: > + while (i--) > + drm_mm_remove_node(&node->mm_nodes[i]); > + spin_unlock(&mgr->lock); > error_fini: > - ttm_resource_fini(man, &vres->base); > - kfree(vres); > + ttm_resource_fini(man, &node->base); > + kvfree(node); > > return r; > } > @@ -575,26 +490,27 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man, > static void amdgpu_vram_mgr_del(struct ttm_resource_manager *man, > struct ttm_resource *res) > { > - struct amdgpu_vram_mgr_resource *vres = to_amdgpu_vram_mgr_resource(res); > + struct ttm_range_mgr_node *node = to_ttm_range_mgr_node(res); > struct amdgpu_vram_mgr *mgr = to_vram_mgr(man); > struct amdgpu_device *adev = to_amdgpu_device(mgr); > - struct drm_buddy *mm = &mgr->mm; > - struct drm_buddy_block *block; > uint64_t vis_usage = 0; > + unsigned i, pages; > > - mutex_lock(&mgr->lock); > - list_for_each_entry(block, &vres->blocks, link) > - vis_usage += amdgpu_vram_mgr_vis_size(adev, block); > + spin_lock(&mgr->lock); > + for (i = 0, pages = res->num_pages; pages; > + pages -= node->mm_nodes[i].size, ++i) { > + struct drm_mm_node *mm = &node->mm_nodes[i]; > > + drm_mm_remove_node(mm); > + vis_usage += amdgpu_vram_mgr_vis_size(adev, mm); > + } > amdgpu_vram_mgr_do_reserve(man); > - > - drm_buddy_free_list(mm, &vres->blocks); > - mutex_unlock(&mgr->lock); > + spin_unlock(&mgr->lock); > > atomic64_sub(vis_usage, &mgr->vis_usage); > > ttm_resource_fini(man, res); > - kfree(vres); > + kvfree(node); > } > > /** > @@ -626,7 +542,7 @@ int amdgpu_vram_mgr_alloc_sgt(struct amdgpu_device *adev, > if (!*sgt) > return -ENOMEM; > > - /* Determine the number of DRM_BUDDY blocks to export */ > + /* Determine the number of DRM_MM nodes to export */ > amdgpu_res_first(res, offset, length, &cursor); > while (cursor.remaining) { > num_entries++; > @@ -642,10 +558,10 @@ int amdgpu_vram_mgr_alloc_sgt(struct amdgpu_device *adev, > sg->length = 0; > > /* > - * Walk down DRM_BUDDY blocks to populate scatterlist nodes > - * @note: Use iterator api to get first the DRM_BUDDY block > + * Walk down DRM_MM nodes to populate scatterlist nodes > + * @note: Use iterator api to get first the DRM_MM node > * and the number of bytes from it. Access the following > - * DRM_BUDDY block(s) if more buffer needs to exported > + * DRM_MM node(s) if more buffer needs to exported > */ > amdgpu_res_first(res, offset, length, &cursor); > for_each_sgtable_sg((*sgt), sg, i) { > @@ -732,22 +648,13 @@ static void amdgpu_vram_mgr_debug(struct ttm_resource_manager *man, > struct drm_printer *printer) > { > struct amdgpu_vram_mgr *mgr = to_vram_mgr(man); > - struct drm_buddy *mm = &mgr->mm; > - struct drm_buddy_block *block; > > drm_printf(printer, " vis usage:%llu\n", > amdgpu_vram_mgr_vis_usage(mgr)); > > - mutex_lock(&mgr->lock); > - drm_printf(printer, "default_page_size: %lluKiB\n", > - mgr->default_page_size >> 10); > - > - drm_buddy_print(mm, printer); > - > - drm_printf(printer, "reserved:\n"); > - list_for_each_entry(block, &mgr->reserved_pages, link) > - drm_buddy_block_print(mm, block, printer); > - mutex_unlock(&mgr->lock); > + spin_lock(&mgr->lock); > + drm_mm_print(&mgr->mm, printer); > + spin_unlock(&mgr->lock); > } > > static const struct ttm_resource_manager_func amdgpu_vram_mgr_func = { > @@ -767,21 +674,16 @@ int amdgpu_vram_mgr_init(struct amdgpu_device *adev) > { > struct amdgpu_vram_mgr *mgr = &adev->mman.vram_mgr; > struct ttm_resource_manager *man = &mgr->manager; > - int err; > > ttm_resource_manager_init(man, &adev->mman.bdev, > adev->gmc.real_vram_size); > > man->func = &amdgpu_vram_mgr_func; > > - err = drm_buddy_init(&mgr->mm, man->size, PAGE_SIZE); > - if (err) > - return err; > - > - mutex_init(&mgr->lock); > + drm_mm_init(&mgr->mm, 0, man->size >> PAGE_SHIFT); > + spin_lock_init(&mgr->lock); > INIT_LIST_HEAD(&mgr->reservations_pending); > INIT_LIST_HEAD(&mgr->reserved_pages); > - mgr->default_page_size = PAGE_SIZE; > > ttm_set_driver_manager(&adev->mman.bdev, TTM_PL_VRAM, &mgr->manager); > ttm_resource_manager_set_used(man, true); > @@ -809,16 +711,16 @@ void amdgpu_vram_mgr_fini(struct amdgpu_device *adev) > if (ret) > return; > > - mutex_lock(&mgr->lock); > - list_for_each_entry_safe(rsv, temp, &mgr->reservations_pending, blocks) > + spin_lock(&mgr->lock); > + list_for_each_entry_safe(rsv, temp, &mgr->reservations_pending, node) > kfree(rsv); > > - list_for_each_entry_safe(rsv, temp, &mgr->reserved_pages, blocks) { > - drm_buddy_free_list(&mgr->mm, &rsv->blocks); > + list_for_each_entry_safe(rsv, temp, &mgr->reserved_pages, node) { > + drm_mm_remove_node(&rsv->mm_node); > kfree(rsv); > } > - drm_buddy_fini(&mgr->mm); > - mutex_unlock(&mgr->lock); > + drm_mm_takedown(&mgr->mm); > + spin_unlock(&mgr->lock); > > ttm_resource_manager_cleanup(man); > ttm_set_driver_manager(&adev->mman.bdev, TTM_PL_VRAM, NULL); > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h > deleted file mode 100644 > index 4b267bf1c5db..000000000000 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h > +++ /dev/null > @@ -1,62 +0,0 @@ > -/* SPDX-License-Identifier: MIT > - * Copyright 2021 Advanced Micro Devices, Inc. > - * > - * Permission is hereby granted, free of charge, to any person obtaining a > - * copy of this software and associated documentation files (the "Software"), > - * to deal in the Software without restriction, including without limitation > - * the rights to use, copy, modify, merge, publish, distribute, sublicense, > - * and/or sell copies of the Software, and to permit persons to whom the > - * Software is furnished to do so, subject to the following conditions: > - * > - * The above copyright notice and this permission notice shall be included in > - * all copies or substantial portions of the Software. > - * > - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL > - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR > - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, > - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR > - * OTHER DEALINGS IN THE SOFTWARE. > - * > - */ > - > -#ifndef __AMDGPU_VRAM_MGR_H__ > -#define __AMDGPU_VRAM_MGR_H__ > - > -#include <drm/drm_buddy.h> > - > -struct amdgpu_vram_mgr { > - struct ttm_resource_manager manager; > - struct drm_buddy mm; > - /* protects access to buffer objects */ > - struct mutex lock; > - struct list_head reservations_pending; > - struct list_head reserved_pages; > - atomic64_t vis_usage; > - u64 default_page_size; > -}; > - > -struct amdgpu_vram_mgr_resource { > - struct ttm_resource base; > - struct list_head blocks; > - unsigned long flags; > -}; > - > -static inline u64 amdgpu_vram_mgr_block_start(struct drm_buddy_block *block) > -{ > - return drm_buddy_block_offset(block); > -} > - > -static inline u64 amdgpu_vram_mgr_block_size(struct drm_buddy_block *block) > -{ > - return PAGE_SIZE << drm_buddy_block_order(block); > -} > - > -static inline struct amdgpu_vram_mgr_resource * > -to_amdgpu_vram_mgr_resource(struct ttm_resource *res) > -{ > - return container_of(res, struct amdgpu_vram_mgr_resource, base); > -} > - > -#endif
On Fri, 8 Jul 2022 03:21:24 -0700 Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> wrote: > This reverts the following commits: > commit 708d19d9f362 ("drm/amdgpu: move internal vram_mgr function into the C file") > commit 5e3f1e7729ec ("drm/amdgpu: fix start calculation in amdgpu_vram_mgr_new") > commit c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu") > > [WHY] > Few users reported garbaged graphics as soon as x starts, > reverting until this can be resolved. > > Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> This revert is currently breaking drm-tip. Please revert it ASAP, as it is preventing CI bots to properly test new patches on the top of current drm-tip: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_new’: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:459:13: error: ‘cur_size’ undeclared (first use in this function) 459 | if (cur_size != size) { | ^~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:459:13: note: each undeclared identifier is reported only once for each function it appears in drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:459:25: error: ‘size’ undeclared (first use in this function); did you mean ‘ksize’? 459 | if (cur_size != size) { | ^~~~ | ksize drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:465:30: error: ‘vres’ undeclared (first use in this function); did you mean ‘res’? 465 | trim_list = &vres->blocks; | ^~~~ | res In file included from ./include/linux/bits.h:22, from ./include/linux/ratelimit_types.h:5, from ./include/linux/ratelimit.h:5, from ./include/linux/dev_printk.h:16, from ./include/linux/device.h:15, from ./include/linux/dma-mapping.h:7, from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25: ./include/linux/container_of.h:19:54: error: invalid use of undefined type ‘struct drm_buddy_block’ 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~ ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) | ^~~~ ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~~~ ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~ ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ 520 | container_of(ptr, type, member) | ^~~~~~~~~~~~ ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’ 542 | list_entry((ptr)->prev, type, member) | ^~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:473:33: note: in expansion of macro ‘list_last_entry’ 473 | block = list_last_entry(&vres->blocks, typeof(*block), link); | ^~~~~~~~~~~~~~~ ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) | ^~~~ ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~~~ ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~ ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ 520 | container_of(ptr, type, member) | ^~~~~~~~~~~~ ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’ 542 | list_entry((ptr)->prev, type, member) | ^~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:473:33: note: in expansion of macro ‘list_last_entry’ 473 | block = list_last_entry(&vres->blocks, typeof(*block), link); | ^~~~~~~~~~~~~~~ In file included from ./include/uapi/linux/posix_types.h:5, from ./include/uapi/linux/types.h:14, from ./include/linux/types.h:6, from ./include/linux/kasan-checks.h:5, from ./include/asm-generic/rwonce.h:26, from ./arch/x86/include/generated/asm/rwonce.h:1, from ./include/linux/compiler.h:248, from ./include/linux/string.h:5, from ./include/linux/dma-mapping.h:6: ./include/linux/stddef.h:16:33: error: invalid use of undefined type ‘struct drm_buddy_block’ 16 | #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER) | ^~~~~~~~~~~~~~~~~~ ./include/linux/container_of.h:22:28: note: in expansion of macro ‘offsetof’ 22 | ((type *)(__mptr - offsetof(type, member))); }) | ^~~~~~~~ ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ 520 | container_of(ptr, type, member) | ^~~~~~~~~~~~ ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’ 542 | list_entry((ptr)->prev, type, member) | ^~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:473:33: note: in expansion of macro ‘list_last_entry’ 473 | block = list_last_entry(&vres->blocks, typeof(*block), link); | ^~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:474:46: error: invalid use of undefined type ‘struct drm_buddy_block’ 474 | list_move_tail(&block->link, &temp); | ^~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:480:41: error: implicit declaration of function ‘amdgpu_vram_mgr_block_size’; did you mean ‘amdgpu_vram_mgr_vis_size’? [-Werror=implicit-function-declaration] 480 | original_size = amdgpu_vram_mgr_block_size(block) - (size - cur_size); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | amdgpu_vram_mgr_vis_size drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:483:28: error: passing argument 1 of ‘mutex_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] 483 | mutex_lock(&mgr->lock); | ^~~~~~~~~~ | | | spinlock_t * {aka struct spinlock *} In file included from ./include/linux/rhashtable-types.h:14, from ./include/linux/ipc.h:7, from ./include/uapi/linux/sem.h:5, from ./include/linux/sem.h:5, from ./include/linux/sched.h:15, from ./include/linux/ratelimit.h:6: ./include/linux/mutex.h:199:38: note: expected ‘struct mutex *’ but argument is of type ‘spinlock_t *’ {aka ‘struct spinlock *’} 199 | extern void mutex_lock(struct mutex *lock); | ~~~~~~~~~~~~~~^~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:484:17: error: implicit declaration of function ‘drm_buddy_block_trim’ [-Werror=implicit-function-declaration] 484 | drm_buddy_block_trim(mm, | ^~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:487:30: error: passing argument 1 of ‘mutex_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] 487 | mutex_unlock(&mgr->lock); | ^~~~~~~~~~ | | | spinlock_t * {aka struct spinlock *} ./include/linux/mutex.h:218:40: note: expected ‘struct mutex *’ but argument is of type ‘spinlock_t *’ {aka ‘struct spinlock *’} 218 | extern void mutex_unlock(struct mutex *lock); | ~~~~~~~~~~~~~~^~~~ In file included from ./include/linux/rculist.h:10, from ./include/linux/pid.h:5, from ./include/linux/sched.h:14: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:493:29: error: ‘block’ undeclared (first use in this function); did you mean ‘flock’? 493 | list_for_each_entry(block, &vres->blocks, link) | ^~~~~ ./include/linux/list.h:674:14: note: in definition of macro ‘list_for_each_entry’ 674 | for (pos = list_first_entry(head, typeof(*pos), member); \ | ^~~ ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) | ^~~~ ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~~~ ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~ ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ 520 | container_of(ptr, type, member) | ^~~~~~~~~~~~ ./include/linux/list.h:531:9: note: in expansion of macro ‘list_entry’ 531 | list_entry((ptr)->next, type, member) | ^~~~~~~~~~ ./include/linux/list.h:674:20: note: in expansion of macro ‘list_first_entry’ 674 | for (pos = list_first_entry(head, typeof(*pos), member); \ | ^~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:493:9: note: in expansion of macro ‘list_for_each_entry’ 493 | list_for_each_entry(block, &vres->blocks, link) | ^~~~~~~~~~~~~~~~~~~ ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) | ^~~~ ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~~~ ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~ ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ 520 | container_of(ptr, type, member) | ^~~~~~~~~~~~ ./include/linux/list.h:564:9: note: in expansion of macro ‘list_entry’ 564 | list_entry((pos)->member.next, typeof(*(pos)), member) | ^~~~~~~~~~ ./include/linux/list.h:676:20: note: in expansion of macro ‘list_next_entry’ 676 | pos = list_next_entry(pos, member)) | ^~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:493:9: note: in expansion of macro ‘list_for_each_entry’ 493 | list_for_each_entry(block, &vres->blocks, link) | ^~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:496:17: error: implicit declaration of function ‘amdgpu_vram_mgr_first_block’; did you mean ‘amdgpu_vram_mgr_virt_start’? [-Werror=implicit-function-declaration] 496 | block = amdgpu_vram_mgr_first_block(&vres->blocks); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ | amdgpu_vram_mgr_virt_start drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:502:28: error: implicit declaration of function ‘amdgpu_vram_mgr_block_start’; did you mean ‘amdgpu_vram_mgr_virt_start’? [-Werror=implicit-function-declaration] 502 | vres->base.start = amdgpu_vram_mgr_block_start(block) >> PAGE_SHIFT; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ | amdgpu_vram_mgr_virt_start drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:504:13: error: implicit declaration of function ‘amdgpu_is_vram_mgr_blocks_contiguous’ [-Werror=implicit-function-declaration] 504 | if (amdgpu_is_vram_mgr_blocks_contiguous(&vres->blocks)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[4]: *** [scripts/Makefile.build:249: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.o] Error 1 make[4]: *** Waiting for unfinished jobs.... make[3]: *** [scripts/Makefile.build:466: drivers/gpu/drm/amd/amdgpu] Error 2 make[2]: *** [scripts/Makefile.build:466: drivers/gpu/drm] Error 2 make[1]: *** [scripts/Makefile.build:466: drivers/gpu] Error 2 make: *** [Makefile:1843: drivers] Error 2 mchehab@sal /new_devel/v4l/tmp $ nano drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c mchehab@sal /new_devel/v4l/tmp $ make drivers/gpu/drm/amd/amdgpu/ DESCEND objtool CALL scripts/atomic/check-atomics.sh CALL scripts/checksyscalls.sh CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.o CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_csa.o CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_ras.o CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.o CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.o CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.o CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.o CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.o CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_umc.o In file included from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:30: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h:29:8: error: redefinition of ‘struct amdgpu_vram_mgr’ 29 | struct amdgpu_vram_mgr { | ^~~~~~~~~~~~~~~ In file included from drivers/gpu/drm/amd/amdgpu/amdgpu.h:73, from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:28: drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:41:8: note: originally defined here 41 | struct amdgpu_vram_mgr { | ^~~~~~~~~~~~~~~ In file included from ./include/linux/bits.h:22, from ./include/linux/ratelimit_types.h:5, from ./include/linux/ratelimit.h:5, from ./include/linux/dev_printk.h:16, from ./include/linux/device.h:15, from ./include/linux/dma-mapping.h:7, from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘to_amdgpu_device’: ./include/linux/build_bug.h:78:41: error: static assertion failed: "pointer type mismatch in container_of()" 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) | ^~~~~~~~~~~~~~ ./include/linux/build_bug.h:77:34: note: in expansion of macro ‘__static_assert’ 77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr) | ^~~~~~~~~~~~~~~ ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:49:16: note: in expansion of macro ‘container_of’ 49 | return container_of(mgr, struct amdgpu_device, mman.vram_mgr); | ^~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_do_reserve’: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:244:29: error: initialization of ‘struct drm_mm *’ from incompatible pointer type ‘struct drm_buddy *’ [-Werror=incompatible-pointer-types] 244 | struct drm_mm *mm = &mgr->mm; | ^ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: At top level: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:273:5: error: conflicting types for ‘amdgpu_vram_mgr_reserve_range’; have ‘int(struct amdgpu_vram_mgr *, uint64_t, uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int, long long unsigned int)’} 273 | int amdgpu_vram_mgr_reserve_range(struct amdgpu_vram_mgr *mgr, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:129:5: note: previous declaration of ‘amdgpu_vram_mgr_reserve_range’ with type ‘int(struct amdgpu_vram_mgr *, uint64_t, uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int, long long unsigned int)’} 129 | int amdgpu_vram_mgr_reserve_range(struct amdgpu_vram_mgr *mgr, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_reserve_range’: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:286:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] 286 | spin_lock(&mgr->lock); | ^~~~~~~~~~ | | | struct mutex * In file included from ./include/linux/wait.h:9, from ./include/linux/pid.h:6, from ./include/linux/sched.h:14, from ./include/linux/ratelimit.h:6: ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ 347 | static __always_inline void spin_lock(spinlock_t *lock) | ~~~~~~~~~~~~^~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:289:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] 289 | spin_unlock(&mgr->lock); | ^~~~~~~~~~ | | | struct mutex * ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ 387 | static __always_inline void spin_unlock(spinlock_t *lock) | ~~~~~~~~~~~~^~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: At top level: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:305:5: error: conflicting types for ‘amdgpu_vram_mgr_query_page_status’; have ‘int(struct amdgpu_vram_mgr *, uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int)’} 305 | int amdgpu_vram_mgr_query_page_status(struct amdgpu_vram_mgr *mgr, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:131:5: note: previous declaration of ‘amdgpu_vram_mgr_query_page_status’ with type ‘int(struct amdgpu_vram_mgr *, uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int)’} 131 | int amdgpu_vram_mgr_query_page_status(struct amdgpu_vram_mgr *mgr, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_query_page_status’: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:311:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] 311 | spin_lock(&mgr->lock); | ^~~~~~~~~~ | | | struct mutex * ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ 347 | static __always_inline void spin_lock(spinlock_t *lock) | ~~~~~~~~~~~~^~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:331:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] 331 | spin_unlock(&mgr->lock); | ^~~~~~~~~~ | | | struct mutex * ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ 387 | static __always_inline void spin_unlock(spinlock_t *lock) | ~~~~~~~~~~~~^~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_new’: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:377:29: error: initialization of ‘struct drm_mm *’ from incompatible pointer type ‘struct drm_buddy *’ [-Werror=incompatible-pointer-types] 377 | struct drm_mm *mm = &mgr->mm; | ^ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:429:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] 429 | spin_lock(&mgr->lock); | ^~~~~~~~~~ | | | struct mutex * ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ 347 | static __always_inline void spin_lock(spinlock_t *lock) | ~~~~~~~~~~~~^~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:458:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] 458 | spin_unlock(&mgr->lock); | ^~~~~~~~~~ | | | struct mutex * ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ 387 | static __always_inline void spin_unlock(spinlock_t *lock) | ~~~~~~~~~~~~^~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:460:13: error: ‘cur_size’ undeclared (first use in this function) 460 | if (cur_size != size) { | ^~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:460:13: note: each undeclared identifier is reported only once for each function it appears in drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:460:25: error: ‘size’ undeclared (first use in this function); did you mean ‘ksize’? 460 | if (cur_size != size) { | ^~~~ | ksize drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:466:30: error: ‘vres’ undeclared (first use in this function); did you mean ‘res’? 466 | trim_list = &vres->blocks; | ^~~~ | res ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) | ^~~~ ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~~~ ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~ ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ 520 | container_of(ptr, type, member) | ^~~~~~~~~~~~ ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’ 542 | list_entry((ptr)->prev, type, member) | ^~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:474:33: note: in expansion of macro ‘list_last_entry’ 474 | block = list_last_entry(&vres->blocks, typeof(*block), link); | ^~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:485:38: error: passing argument 1 of ‘drm_buddy_block_trim’ from incompatible pointer type [-Werror=incompatible-pointer-types] 485 | drm_buddy_block_trim(mm, | ^~ | | | struct drm_mm * In file included from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h:27: ./include/drm/drm_buddy.h:146:44: note: expected ‘struct drm_buddy *’ but argument is of type ‘struct drm_mm *’ 146 | int drm_buddy_block_trim(struct drm_buddy *mm, | ~~~~~~~~~~~~~~~~~~^~ In file included from ./include/linux/rculist.h:10, from ./include/linux/pid.h:5: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:494:29: error: ‘block’ undeclared (first use in this function); did you mean ‘flock’? 494 | list_for_each_entry(block, &vres->blocks, link) | ^~~~~ ./include/linux/list.h:674:14: note: in definition of macro ‘list_for_each_entry’ 674 | for (pos = list_first_entry(head, typeof(*pos), member); \ | ^~~ ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) | ^~~~ ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~~~ ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~ ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ 520 | container_of(ptr, type, member) | ^~~~~~~~~~~~ ./include/linux/list.h:531:9: note: in expansion of macro ‘list_entry’ 531 | list_entry((ptr)->next, type, member) | ^~~~~~~~~~ ./include/linux/list.h:674:20: note: in expansion of macro ‘list_first_entry’ 674 | for (pos = list_first_entry(head, typeof(*pos), member); \ | ^~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:494:9: note: in expansion of macro ‘list_for_each_entry’ 494 | list_for_each_entry(block, &vres->blocks, link) | ^~~~~~~~~~~~~~~~~~~ ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) | ^~~~ ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~~~ ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ | ^~~~~~~~~~~ ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ 520 | container_of(ptr, type, member) | ^~~~~~~~~~~~ ./include/linux/list.h:564:9: note: in expansion of macro ‘list_entry’ 564 | list_entry((pos)->member.next, typeof(*(pos)), member) | ^~~~~~~~~~ ./include/linux/list.h:676:20: note: in expansion of macro ‘list_next_entry’ 676 | pos = list_next_entry(pos, member)) | ^~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:494:9: note: in expansion of macro ‘list_for_each_entry’ 494 | list_for_each_entry(block, &vres->blocks, link) | ^~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:520:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] 520 | spin_unlock(&mgr->lock); | ^~~~~~~~~~ | | | struct mutex * ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ 387 | static __always_inline void spin_unlock(spinlock_t *lock) | ~~~~~~~~~~~~^~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_del’: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:545:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] 545 | spin_lock(&mgr->lock); | ^~~~~~~~~~ | | | struct mutex * ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ 347 | static __always_inline void spin_lock(spinlock_t *lock) | ~~~~~~~~~~~~^~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:554:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] 554 | spin_unlock(&mgr->lock); | ^~~~~~~~~~ | | | struct mutex * ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ 387 | static __always_inline void spin_unlock(spinlock_t *lock) | ~~~~~~~~~~~~^~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: At top level: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:680:10: error: conflicting types for ‘amdgpu_vram_mgr_vis_usage’; have ‘uint64_t(struct amdgpu_vram_mgr *)’ {aka ‘long long unsigned int(struct amdgpu_vram_mgr *)’} 680 | uint64_t amdgpu_vram_mgr_vis_usage(struct amdgpu_vram_mgr *mgr) | ^~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:128:10: note: previous declaration of ‘amdgpu_vram_mgr_vis_usage’ with type ‘uint64_t(struct amdgpu_vram_mgr *)’ {aka ‘long long unsigned int(struct amdgpu_vram_mgr *)’} 128 | uint64_t amdgpu_vram_mgr_vis_usage(struct amdgpu_vram_mgr *mgr); | ^~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_debug’: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:701:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] 701 | spin_lock(&mgr->lock); | ^~~~~~~~~~ | | | struct mutex * ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ 347 | static __always_inline void spin_lock(spinlock_t *lock) | ~~~~~~~~~~~~^~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:702:22: error: passing argument 1 of ‘drm_mm_print’ from incompatible pointer type [-Werror=incompatible-pointer-types] 702 | drm_mm_print(&mgr->mm, printer); | ^~~~~~~~ | | | struct drm_buddy * In file included from ./include/drm/ttm/ttm_range_manager.h:8, from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:26: ./include/drm/drm_mm.h:551:40: note: expected ‘const struct drm_mm *’ but argument is of type ‘struct drm_buddy *’ 551 | void drm_mm_print(const struct drm_mm *mm, struct drm_printer *p); | ~~~~~~~~~~~~~~~~~~~~~^~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:703:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] 703 | spin_unlock(&mgr->lock); | ^~~~~~~~~~ | | | struct mutex * ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ 387 | static __always_inline void spin_unlock(spinlock_t *lock) | ~~~~~~~~~~~~^~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_init’: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:721:39: error: initialization of ‘struct amdgpu_vram_mgr *’ from incompatible pointer type ‘struct amdgpu_vram_mgr *’ [-Werror=incompatible-pointer-types] 721 | struct amdgpu_vram_mgr *mgr = &adev->mman.vram_mgr; | ^ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:729:21: error: passing argument 1 of ‘drm_mm_init’ from incompatible pointer type [-Werror=incompatible-pointer-types] 729 | drm_mm_init(&mgr->mm, 0, man->size >> PAGE_SHIFT); | ^~~~~~~~ | | | struct drm_buddy * ./include/drm/drm_mm.h:467:33: note: expected ‘struct drm_mm *’ but argument is of type ‘struct drm_buddy *’ 467 | void drm_mm_init(struct drm_mm *mm, u64 start, u64 size); | ~~~~~~~~~~~~~~~^~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:730:24: error: passing argument 1 of ‘spinlock_check’ from incompatible pointer type [-Werror=incompatible-pointer-types] 730 | spin_lock_init(&mgr->lock); | ^~~~~~~~~~ | | | struct mutex * ./include/linux/spinlock.h:341:24: note: in definition of macro ‘spin_lock_init’ 341 | spinlock_check(_lock); \ | ^~~~~ ./include/linux/spinlock.h:322:67: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ 322 | static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock) | ~~~~~~~~~~~~^~~~ In file included from ./include/linux/spinlock.h:87: ./include/linux/spinlock_types.h:41:9: error: incompatible types when assigning to type ‘struct mutex’ from type ‘spinlock_t’ {aka ‘struct spinlock’} 41 | (spinlock_t) __SPIN_LOCK_INITIALIZER(lockname) | ^ ./include/linux/spinlock.h:342:20: note: in expansion of macro ‘__SPIN_LOCK_UNLOCKED’ 342 | *(_lock) = __SPIN_LOCK_UNLOCKED(_lock); \ | ^~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:730:9: note: in expansion of macro ‘spin_lock_init’ 730 | spin_lock_init(&mgr->lock); | ^~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_fini’: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:749:39: error: initialization of ‘struct amdgpu_vram_mgr *’ from incompatible pointer type ‘struct amdgpu_vram_mgr *’ [-Werror=incompatible-pointer-types] 749 | struct amdgpu_vram_mgr *mgr = &adev->mman.vram_mgr; | ^ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:760:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] 760 | spin_lock(&mgr->lock); | ^~~~~~~~~~ | | | struct mutex * ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ 347 | static __always_inline void spin_lock(spinlock_t *lock) | ~~~~~~~~~~~~^~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:768:25: error: passing argument 1 of ‘drm_mm_takedown’ from incompatible pointer type [-Werror=incompatible-pointer-types] 768 | drm_mm_takedown(&mgr->mm); | ^~~~~~~~ | | | struct drm_buddy * ./include/drm/drm_mm.h:468:37: note: expected ‘struct drm_mm *’ but argument is of type ‘struct drm_buddy *’ 468 | void drm_mm_takedown(struct drm_mm *mm); | ~~~~~~~~~~~~~~~^~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:769:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] 769 | spin_unlock(&mgr->lock); | ^~~~~~~~~~ | | | struct mutex * ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ 387 | static __always_inline void spin_unlock(spinlock_t *lock) | ~~~~~~~~~~~~^~~~ cc1: all warnings being treated as errors make[4]: *** [scripts/Makefile.build:249: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.o] Error 1 make[4]: *** Waiting for unfinished jobs.... CC [M] drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.o make[3]: *** [scripts/Makefile.build:466: drivers/gpu/drm/amd/amdgpu] Error 2 make[2]: *** [scripts/Makefile.build:466: drivers/gpu/drm] Error 2 make[1]: *** [scripts/Makefile.build:466: drivers/gpu] Error 2 make: *** [Makefile:1843: drivers] Error 2 Regards, Mauro
Hi Mauro, well the last time I checked drm-tip was clean. The revert is necessary because we had some problems with the commit which we couldn't fix in the 5.19 cycle. I will double check drm-tip once more. Regards, Christian. Am 14.07.22 um 14:54 schrieb Mauro Carvalho Chehab: > On Fri, 8 Jul 2022 03:21:24 -0700 > Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> wrote: > >> This reverts the following commits: >> commit 708d19d9f362 ("drm/amdgpu: move internal vram_mgr function into the C file") >> commit 5e3f1e7729ec ("drm/amdgpu: fix start calculation in amdgpu_vram_mgr_new") >> commit c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu") >> >> [WHY] >> Few users reported garbaged graphics as soon as x starts, >> reverting until this can be resolved. >> >> Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> > This revert is currently breaking drm-tip. Please revert it ASAP, as it > is preventing CI bots to properly test new patches on the top of current > drm-tip: > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_new’: > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:459:13: error: ‘cur_size’ undeclared (first use in this function) > 459 | if (cur_size != size) { > | ^~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:459:13: note: each undeclared identifier is reported only once for each function it appears in > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:459:25: error: ‘size’ undeclared (first use in this function); did you mean ‘ksize’? > 459 | if (cur_size != size) { > | ^~~~ > | ksize > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:465:30: error: ‘vres’ undeclared (first use in this function); did you mean ‘res’? > 465 | trim_list = &vres->blocks; > | ^~~~ > | res > In file included from ./include/linux/bits.h:22, > from ./include/linux/ratelimit_types.h:5, > from ./include/linux/ratelimit.h:5, > from ./include/linux/dev_printk.h:16, > from ./include/linux/device.h:15, > from ./include/linux/dma-mapping.h:7, > from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25: > ./include/linux/container_of.h:19:54: error: invalid use of undefined type ‘struct drm_buddy_block’ > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > | ^~ > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > | ^~~~ > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > | ^~~~~~~~~~~~~ > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > | ^~~~~~~~~~~ > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > 520 | container_of(ptr, type, member) > | ^~~~~~~~~~~~ > ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’ > 542 | list_entry((ptr)->prev, type, member) > | ^~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:473:33: note: in expansion of macro ‘list_last_entry’ > 473 | block = list_last_entry(&vres->blocks, typeof(*block), link); > | ^~~~~~~~~~~~~~~ > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer > 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > | ^~~~ > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > | ^~~~~~~~~~~~~ > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > | ^~~~~~~~~~~ > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > 520 | container_of(ptr, type, member) > | ^~~~~~~~~~~~ > ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’ > 542 | list_entry((ptr)->prev, type, member) > | ^~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:473:33: note: in expansion of macro ‘list_last_entry’ > 473 | block = list_last_entry(&vres->blocks, typeof(*block), link); > | ^~~~~~~~~~~~~~~ > In file included from ./include/uapi/linux/posix_types.h:5, > from ./include/uapi/linux/types.h:14, > from ./include/linux/types.h:6, > from ./include/linux/kasan-checks.h:5, > from ./include/asm-generic/rwonce.h:26, > from ./arch/x86/include/generated/asm/rwonce.h:1, > from ./include/linux/compiler.h:248, > from ./include/linux/string.h:5, > from ./include/linux/dma-mapping.h:6: > ./include/linux/stddef.h:16:33: error: invalid use of undefined type ‘struct drm_buddy_block’ > 16 | #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER) > | ^~~~~~~~~~~~~~~~~~ > ./include/linux/container_of.h:22:28: note: in expansion of macro ‘offsetof’ > 22 | ((type *)(__mptr - offsetof(type, member))); }) > | ^~~~~~~~ > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > 520 | container_of(ptr, type, member) > | ^~~~~~~~~~~~ > ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’ > 542 | list_entry((ptr)->prev, type, member) > | ^~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:473:33: note: in expansion of macro ‘list_last_entry’ > 473 | block = list_last_entry(&vres->blocks, typeof(*block), link); > | ^~~~~~~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:474:46: error: invalid use of undefined type ‘struct drm_buddy_block’ > 474 | list_move_tail(&block->link, &temp); > | ^~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:480:41: error: implicit declaration of function ‘amdgpu_vram_mgr_block_size’; did you mean ‘amdgpu_vram_mgr_vis_size’? [-Werror=implicit-function-declaration] > 480 | original_size = amdgpu_vram_mgr_block_size(block) - (size - cur_size); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~ > | amdgpu_vram_mgr_vis_size > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:483:28: error: passing argument 1 of ‘mutex_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > 483 | mutex_lock(&mgr->lock); > | ^~~~~~~~~~ > | | > | spinlock_t * {aka struct spinlock *} > In file included from ./include/linux/rhashtable-types.h:14, > from ./include/linux/ipc.h:7, > from ./include/uapi/linux/sem.h:5, > from ./include/linux/sem.h:5, > from ./include/linux/sched.h:15, > from ./include/linux/ratelimit.h:6: > ./include/linux/mutex.h:199:38: note: expected ‘struct mutex *’ but argument is of type ‘spinlock_t *’ {aka ‘struct spinlock *’} > 199 | extern void mutex_lock(struct mutex *lock); > | ~~~~~~~~~~~~~~^~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:484:17: error: implicit declaration of function ‘drm_buddy_block_trim’ [-Werror=implicit-function-declaration] > 484 | drm_buddy_block_trim(mm, > | ^~~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:487:30: error: passing argument 1 of ‘mutex_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > 487 | mutex_unlock(&mgr->lock); > | ^~~~~~~~~~ > | | > | spinlock_t * {aka struct spinlock *} > ./include/linux/mutex.h:218:40: note: expected ‘struct mutex *’ but argument is of type ‘spinlock_t *’ {aka ‘struct spinlock *’} > 218 | extern void mutex_unlock(struct mutex *lock); > | ~~~~~~~~~~~~~~^~~~ > In file included from ./include/linux/rculist.h:10, > from ./include/linux/pid.h:5, > from ./include/linux/sched.h:14: > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:493:29: error: ‘block’ undeclared (first use in this function); did you mean ‘flock’? > 493 | list_for_each_entry(block, &vres->blocks, link) > | ^~~~~ > ./include/linux/list.h:674:14: note: in definition of macro ‘list_for_each_entry’ > 674 | for (pos = list_first_entry(head, typeof(*pos), member); \ > | ^~~ > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer > 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > | ^~~~ > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > | ^~~~~~~~~~~~~ > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > | ^~~~~~~~~~~ > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > 520 | container_of(ptr, type, member) > | ^~~~~~~~~~~~ > ./include/linux/list.h:531:9: note: in expansion of macro ‘list_entry’ > 531 | list_entry((ptr)->next, type, member) > | ^~~~~~~~~~ > ./include/linux/list.h:674:20: note: in expansion of macro ‘list_first_entry’ > 674 | for (pos = list_first_entry(head, typeof(*pos), member); \ > | ^~~~~~~~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:493:9: note: in expansion of macro ‘list_for_each_entry’ > 493 | list_for_each_entry(block, &vres->blocks, link) > | ^~~~~~~~~~~~~~~~~~~ > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer > 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > | ^~~~ > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > | ^~~~~~~~~~~~~ > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > | ^~~~~~~~~~~ > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > 520 | container_of(ptr, type, member) > | ^~~~~~~~~~~~ > ./include/linux/list.h:564:9: note: in expansion of macro ‘list_entry’ > 564 | list_entry((pos)->member.next, typeof(*(pos)), member) > | ^~~~~~~~~~ > ./include/linux/list.h:676:20: note: in expansion of macro ‘list_next_entry’ > 676 | pos = list_next_entry(pos, member)) > | ^~~~~~~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:493:9: note: in expansion of macro ‘list_for_each_entry’ > 493 | list_for_each_entry(block, &vres->blocks, link) > | ^~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:496:17: error: implicit declaration of function ‘amdgpu_vram_mgr_first_block’; did you mean ‘amdgpu_vram_mgr_virt_start’? [-Werror=implicit-function-declaration] > 496 | block = amdgpu_vram_mgr_first_block(&vres->blocks); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > | amdgpu_vram_mgr_virt_start > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:502:28: error: implicit declaration of function ‘amdgpu_vram_mgr_block_start’; did you mean ‘amdgpu_vram_mgr_virt_start’? [-Werror=implicit-function-declaration] > 502 | vres->base.start = amdgpu_vram_mgr_block_start(block) >> PAGE_SHIFT; > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > | amdgpu_vram_mgr_virt_start > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:504:13: error: implicit declaration of function ‘amdgpu_is_vram_mgr_blocks_contiguous’ [-Werror=implicit-function-declaration] > 504 | if (amdgpu_is_vram_mgr_blocks_contiguous(&vres->blocks)) > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > cc1: all warnings being treated as errors > make[4]: *** [scripts/Makefile.build:249: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.o] Error 1 > make[4]: *** Waiting for unfinished jobs.... > make[3]: *** [scripts/Makefile.build:466: drivers/gpu/drm/amd/amdgpu] Error 2 > make[2]: *** [scripts/Makefile.build:466: drivers/gpu/drm] Error 2 > make[1]: *** [scripts/Makefile.build:466: drivers/gpu] Error 2 > make: *** [Makefile:1843: drivers] Error 2 > mchehab@sal /new_devel/v4l/tmp $ nano drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c > mchehab@sal /new_devel/v4l/tmp $ make drivers/gpu/drm/amd/amdgpu/ > DESCEND objtool > CALL scripts/atomic/check-atomics.sh > CALL scripts/checksyscalls.sh > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.o > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_csa.o > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_ras.o > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.o > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.o > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.o > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.o > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.o > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_umc.o > In file included from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:30: > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h:29:8: error: redefinition of ‘struct amdgpu_vram_mgr’ > 29 | struct amdgpu_vram_mgr { > | ^~~~~~~~~~~~~~~ > In file included from drivers/gpu/drm/amd/amdgpu/amdgpu.h:73, > from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:28: > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:41:8: note: originally defined here > 41 | struct amdgpu_vram_mgr { > | ^~~~~~~~~~~~~~~ > In file included from ./include/linux/bits.h:22, > from ./include/linux/ratelimit_types.h:5, > from ./include/linux/ratelimit.h:5, > from ./include/linux/dev_printk.h:16, > from ./include/linux/device.h:15, > from ./include/linux/dma-mapping.h:7, > from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25: > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘to_amdgpu_device’: > ./include/linux/build_bug.h:78:41: error: static assertion failed: "pointer type mismatch in container_of()" > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > | ^~~~~~~~~~~~~~ > ./include/linux/build_bug.h:77:34: note: in expansion of macro ‘__static_assert’ > 77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr) > | ^~~~~~~~~~~~~~~ > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > | ^~~~~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:49:16: note: in expansion of macro ‘container_of’ > 49 | return container_of(mgr, struct amdgpu_device, mman.vram_mgr); > | ^~~~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_do_reserve’: > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:244:29: error: initialization of ‘struct drm_mm *’ from incompatible pointer type ‘struct drm_buddy *’ [-Werror=incompatible-pointer-types] > 244 | struct drm_mm *mm = &mgr->mm; > | ^ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: At top level: > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:273:5: error: conflicting types for ‘amdgpu_vram_mgr_reserve_range’; have ‘int(struct amdgpu_vram_mgr *, uint64_t, uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int, long long unsigned int)’} > 273 | int amdgpu_vram_mgr_reserve_range(struct amdgpu_vram_mgr *mgr, > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:129:5: note: previous declaration of ‘amdgpu_vram_mgr_reserve_range’ with type ‘int(struct amdgpu_vram_mgr *, uint64_t, uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int, long long unsigned int)’} > 129 | int amdgpu_vram_mgr_reserve_range(struct amdgpu_vram_mgr *mgr, > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_reserve_range’: > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:286:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > 286 | spin_lock(&mgr->lock); > | ^~~~~~~~~~ > | | > | struct mutex * > In file included from ./include/linux/wait.h:9, > from ./include/linux/pid.h:6, > from ./include/linux/sched.h:14, > from ./include/linux/ratelimit.h:6: > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > 347 | static __always_inline void spin_lock(spinlock_t *lock) > | ~~~~~~~~~~~~^~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:289:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > 289 | spin_unlock(&mgr->lock); > | ^~~~~~~~~~ > | | > | struct mutex * > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > 387 | static __always_inline void spin_unlock(spinlock_t *lock) > | ~~~~~~~~~~~~^~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: At top level: > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:305:5: error: conflicting types for ‘amdgpu_vram_mgr_query_page_status’; have ‘int(struct amdgpu_vram_mgr *, uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int)’} > 305 | int amdgpu_vram_mgr_query_page_status(struct amdgpu_vram_mgr *mgr, > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:131:5: note: previous declaration of ‘amdgpu_vram_mgr_query_page_status’ with type ‘int(struct amdgpu_vram_mgr *, uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int)’} > 131 | int amdgpu_vram_mgr_query_page_status(struct amdgpu_vram_mgr *mgr, > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_query_page_status’: > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:311:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > 311 | spin_lock(&mgr->lock); > | ^~~~~~~~~~ > | | > | struct mutex * > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > 347 | static __always_inline void spin_lock(spinlock_t *lock) > | ~~~~~~~~~~~~^~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:331:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > 331 | spin_unlock(&mgr->lock); > | ^~~~~~~~~~ > | | > | struct mutex * > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > 387 | static __always_inline void spin_unlock(spinlock_t *lock) > | ~~~~~~~~~~~~^~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_new’: > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:377:29: error: initialization of ‘struct drm_mm *’ from incompatible pointer type ‘struct drm_buddy *’ [-Werror=incompatible-pointer-types] > 377 | struct drm_mm *mm = &mgr->mm; > | ^ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:429:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > 429 | spin_lock(&mgr->lock); > | ^~~~~~~~~~ > | | > | struct mutex * > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > 347 | static __always_inline void spin_lock(spinlock_t *lock) > | ~~~~~~~~~~~~^~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:458:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > 458 | spin_unlock(&mgr->lock); > | ^~~~~~~~~~ > | | > | struct mutex * > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > 387 | static __always_inline void spin_unlock(spinlock_t *lock) > | ~~~~~~~~~~~~^~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:460:13: error: ‘cur_size’ undeclared (first use in this function) > 460 | if (cur_size != size) { > | ^~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:460:13: note: each undeclared identifier is reported only once for each function it appears in > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:460:25: error: ‘size’ undeclared (first use in this function); did you mean ‘ksize’? > 460 | if (cur_size != size) { > | ^~~~ > | ksize > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:466:30: error: ‘vres’ undeclared (first use in this function); did you mean ‘res’? > 466 | trim_list = &vres->blocks; > | ^~~~ > | res > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer > 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > | ^~~~ > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > | ^~~~~~~~~~~~~ > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > | ^~~~~~~~~~~ > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > 520 | container_of(ptr, type, member) > | ^~~~~~~~~~~~ > ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’ > 542 | list_entry((ptr)->prev, type, member) > | ^~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:474:33: note: in expansion of macro ‘list_last_entry’ > 474 | block = list_last_entry(&vres->blocks, typeof(*block), link); > | ^~~~~~~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:485:38: error: passing argument 1 of ‘drm_buddy_block_trim’ from incompatible pointer type [-Werror=incompatible-pointer-types] > 485 | drm_buddy_block_trim(mm, > | ^~ > | | > | struct drm_mm * > In file included from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h:27: > ./include/drm/drm_buddy.h:146:44: note: expected ‘struct drm_buddy *’ but argument is of type ‘struct drm_mm *’ > 146 | int drm_buddy_block_trim(struct drm_buddy *mm, > | ~~~~~~~~~~~~~~~~~~^~ > In file included from ./include/linux/rculist.h:10, > from ./include/linux/pid.h:5: > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:494:29: error: ‘block’ undeclared (first use in this function); did you mean ‘flock’? > 494 | list_for_each_entry(block, &vres->blocks, link) > | ^~~~~ > ./include/linux/list.h:674:14: note: in definition of macro ‘list_for_each_entry’ > 674 | for (pos = list_first_entry(head, typeof(*pos), member); \ > | ^~~ > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer > 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > | ^~~~ > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > | ^~~~~~~~~~~~~ > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > | ^~~~~~~~~~~ > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > 520 | container_of(ptr, type, member) > | ^~~~~~~~~~~~ > ./include/linux/list.h:531:9: note: in expansion of macro ‘list_entry’ > 531 | list_entry((ptr)->next, type, member) > | ^~~~~~~~~~ > ./include/linux/list.h:674:20: note: in expansion of macro ‘list_first_entry’ > 674 | for (pos = list_first_entry(head, typeof(*pos), member); \ > | ^~~~~~~~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:494:9: note: in expansion of macro ‘list_for_each_entry’ > 494 | list_for_each_entry(block, &vres->blocks, link) > | ^~~~~~~~~~~~~~~~~~~ > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer > 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > | ^~~~ > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > | ^~~~~~~~~~~~~ > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > | ^~~~~~~~~~~ > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > 520 | container_of(ptr, type, member) > | ^~~~~~~~~~~~ > ./include/linux/list.h:564:9: note: in expansion of macro ‘list_entry’ > 564 | list_entry((pos)->member.next, typeof(*(pos)), member) > | ^~~~~~~~~~ > ./include/linux/list.h:676:20: note: in expansion of macro ‘list_next_entry’ > 676 | pos = list_next_entry(pos, member)) > | ^~~~~~~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:494:9: note: in expansion of macro ‘list_for_each_entry’ > 494 | list_for_each_entry(block, &vres->blocks, link) > | ^~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:520:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > 520 | spin_unlock(&mgr->lock); > | ^~~~~~~~~~ > | | > | struct mutex * > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > 387 | static __always_inline void spin_unlock(spinlock_t *lock) > | ~~~~~~~~~~~~^~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_del’: > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:545:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > 545 | spin_lock(&mgr->lock); > | ^~~~~~~~~~ > | | > | struct mutex * > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > 347 | static __always_inline void spin_lock(spinlock_t *lock) > | ~~~~~~~~~~~~^~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:554:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > 554 | spin_unlock(&mgr->lock); > | ^~~~~~~~~~ > | | > | struct mutex * > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > 387 | static __always_inline void spin_unlock(spinlock_t *lock) > | ~~~~~~~~~~~~^~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: At top level: > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:680:10: error: conflicting types for ‘amdgpu_vram_mgr_vis_usage’; have ‘uint64_t(struct amdgpu_vram_mgr *)’ {aka ‘long long unsigned int(struct amdgpu_vram_mgr *)’} > 680 | uint64_t amdgpu_vram_mgr_vis_usage(struct amdgpu_vram_mgr *mgr) > | ^~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:128:10: note: previous declaration of ‘amdgpu_vram_mgr_vis_usage’ with type ‘uint64_t(struct amdgpu_vram_mgr *)’ {aka ‘long long unsigned int(struct amdgpu_vram_mgr *)’} > 128 | uint64_t amdgpu_vram_mgr_vis_usage(struct amdgpu_vram_mgr *mgr); > | ^~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_debug’: > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:701:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > 701 | spin_lock(&mgr->lock); > | ^~~~~~~~~~ > | | > | struct mutex * > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > 347 | static __always_inline void spin_lock(spinlock_t *lock) > | ~~~~~~~~~~~~^~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:702:22: error: passing argument 1 of ‘drm_mm_print’ from incompatible pointer type [-Werror=incompatible-pointer-types] > 702 | drm_mm_print(&mgr->mm, printer); > | ^~~~~~~~ > | | > | struct drm_buddy * > In file included from ./include/drm/ttm/ttm_range_manager.h:8, > from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:26: > ./include/drm/drm_mm.h:551:40: note: expected ‘const struct drm_mm *’ but argument is of type ‘struct drm_buddy *’ > 551 | void drm_mm_print(const struct drm_mm *mm, struct drm_printer *p); > | ~~~~~~~~~~~~~~~~~~~~~^~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:703:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > 703 | spin_unlock(&mgr->lock); > | ^~~~~~~~~~ > | | > | struct mutex * > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > 387 | static __always_inline void spin_unlock(spinlock_t *lock) > | ~~~~~~~~~~~~^~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_init’: > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:721:39: error: initialization of ‘struct amdgpu_vram_mgr *’ from incompatible pointer type ‘struct amdgpu_vram_mgr *’ [-Werror=incompatible-pointer-types] > 721 | struct amdgpu_vram_mgr *mgr = &adev->mman.vram_mgr; > | ^ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:729:21: error: passing argument 1 of ‘drm_mm_init’ from incompatible pointer type [-Werror=incompatible-pointer-types] > 729 | drm_mm_init(&mgr->mm, 0, man->size >> PAGE_SHIFT); > | ^~~~~~~~ > | | > | struct drm_buddy * > ./include/drm/drm_mm.h:467:33: note: expected ‘struct drm_mm *’ but argument is of type ‘struct drm_buddy *’ > 467 | void drm_mm_init(struct drm_mm *mm, u64 start, u64 size); > | ~~~~~~~~~~~~~~~^~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:730:24: error: passing argument 1 of ‘spinlock_check’ from incompatible pointer type [-Werror=incompatible-pointer-types] > 730 | spin_lock_init(&mgr->lock); > | ^~~~~~~~~~ > | | > | struct mutex * > ./include/linux/spinlock.h:341:24: note: in definition of macro ‘spin_lock_init’ > 341 | spinlock_check(_lock); \ > | ^~~~~ > ./include/linux/spinlock.h:322:67: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > 322 | static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock) > | ~~~~~~~~~~~~^~~~ > In file included from ./include/linux/spinlock.h:87: > ./include/linux/spinlock_types.h:41:9: error: incompatible types when assigning to type ‘struct mutex’ from type ‘spinlock_t’ {aka ‘struct spinlock’} > 41 | (spinlock_t) __SPIN_LOCK_INITIALIZER(lockname) > | ^ > ./include/linux/spinlock.h:342:20: note: in expansion of macro ‘__SPIN_LOCK_UNLOCKED’ > 342 | *(_lock) = __SPIN_LOCK_UNLOCKED(_lock); \ > | ^~~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:730:9: note: in expansion of macro ‘spin_lock_init’ > 730 | spin_lock_init(&mgr->lock); > | ^~~~~~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_fini’: > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:749:39: error: initialization of ‘struct amdgpu_vram_mgr *’ from incompatible pointer type ‘struct amdgpu_vram_mgr *’ [-Werror=incompatible-pointer-types] > 749 | struct amdgpu_vram_mgr *mgr = &adev->mman.vram_mgr; > | ^ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:760:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > 760 | spin_lock(&mgr->lock); > | ^~~~~~~~~~ > | | > | struct mutex * > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > 347 | static __always_inline void spin_lock(spinlock_t *lock) > | ~~~~~~~~~~~~^~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:768:25: error: passing argument 1 of ‘drm_mm_takedown’ from incompatible pointer type [-Werror=incompatible-pointer-types] > 768 | drm_mm_takedown(&mgr->mm); > | ^~~~~~~~ > | | > | struct drm_buddy * > ./include/drm/drm_mm.h:468:37: note: expected ‘struct drm_mm *’ but argument is of type ‘struct drm_buddy *’ > 468 | void drm_mm_takedown(struct drm_mm *mm); > | ~~~~~~~~~~~~~~~^~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:769:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > 769 | spin_unlock(&mgr->lock); > | ^~~~~~~~~~ > | | > | struct mutex * > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > 387 | static __always_inline void spin_unlock(spinlock_t *lock) > | ~~~~~~~~~~~~^~~~ > cc1: all warnings being treated as errors > make[4]: *** [scripts/Makefile.build:249: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.o] Error 1 > make[4]: *** Waiting for unfinished jobs.... > CC [M] drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.o > make[3]: *** [scripts/Makefile.build:466: drivers/gpu/drm/amd/amdgpu] Error 2 > make[2]: *** [scripts/Makefile.build:466: drivers/gpu/drm] Error 2 > make[1]: *** [scripts/Makefile.build:466: drivers/gpu] Error 2 > make: *** [Makefile:1843: drivers] Error 2 > > Regards, > Mauro
On Thu, 14 Jul 2022 15:08:48 +0200 Christian König <christian.koenig@amd.com> wrote: > Hi Mauro, > > well the last time I checked drm-tip was clean. > > The revert is necessary because we had some problems with the commit > which we couldn't fix in the 5.19 cycle. I see. I don't have any issues with the patch itself, provided that drm-tip build doesn't break ;-) > I will double check drm-tip once more. Did a new rebase on the top of: bc04f10d22f7 (drm-tip/drm-tip) drm-tip: 2022y-07m-14d-12h-41m-36s UTC integration manifest And it is still broken on amdgpu_vram_mgr.c, but now with different issues: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_new’: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:465:13: error: ‘i’ undeclared (first use in this function) 465 | if (i == 1) | ^ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:465:13: note: each undeclared identifier is reported only once for each function it appears in drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:466:17: error: ‘node’ undeclared (first use in this function) 466 | node->base.placement |= TTM_PL_FLAG_CONTIGUOUS; | ^~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:365:33: error: unused variable ‘block’ [-Werror=unused-variable] 365 | struct drm_buddy_block *block; | ^~~~~ cc1: all warnings being treated as errors Regards, Mauro
Am 14.07.22 um 15:19 schrieb Mauro Carvalho Chehab: > On Thu, 14 Jul 2022 15:08:48 +0200 > Christian König <christian.koenig@amd.com> wrote: > >> Hi Mauro, >> >> well the last time I checked drm-tip was clean. >> >> The revert is necessary because we had some problems with the commit >> which we couldn't fix in the 5.19 cycle. > I see. I don't have any issues with the patch itself, provided that drm-tip > build doesn't break ;-) > >> I will double check drm-tip once more. > Did a new rebase on the top of: > bc04f10d22f7 (drm-tip/drm-tip) drm-tip: 2022y-07m-14d-12h-41m-36s UTC integration manifest I have absolutely no idea what's going wrong here. After just running "dim rebuild-tip" once more my drm-tip is at: commit bc04f10d22f7d8a6d76abe431cfb6ef6ba67ad0c (drm-tip/drm-tip, drm-tip) Author: Christian König <christian.koenig@amd.com> Date: Thu Jul 14 14:42:33 2022 +0200 drm-tip: 2022y-07m-14d-12h-41m-36s UTC integration manifest And that's compiling perfectly fine. Regards, Christian. > > And it is still broken on amdgpu_vram_mgr.c, but now with different issues: > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_new’: > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:465:13: error: ‘i’ undeclared (first use in this function) > 465 | if (i == 1) > | ^ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:465:13: note: each undeclared identifier is reported only once for each function it appears in > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:466:17: error: ‘node’ undeclared (first use in this function) > 466 | node->base.placement |= TTM_PL_FLAG_CONTIGUOUS; > | ^~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:365:33: error: unused variable ‘block’ [-Werror=unused-variable] > 365 | struct drm_buddy_block *block; > | ^~~~~ > cc1: all warnings being treated as errors > > Regards, > Mauro
On Thu, Jul 14, 2022 at 9:09 AM Christian König <christian.koenig@amd.com> wrote: > > Hi Mauro, > > well the last time I checked drm-tip was clean. > > The revert is necessary because we had some problems with the commit > which we couldn't fix in the 5.19 cycle. Would it be worth reverting the revert and applying the actual fix[1]? It's a huge revert unfortunately while the actual fix is like 10 lines of code. I'm concerned there will be subtle fallout from the revert due to how extensive it is. [1] - https://gitlab.freedesktop.org/drm/amd/uploads/564b2cc2b5ea87357f39e45c3a1a44e2/0001-drm-amdgpu-Fix-for-drm-buddy-memory-corruption.patch Alex > > I will double check drm-tip once more. > > Regards, > Christian. > > Am 14.07.22 um 14:54 schrieb Mauro Carvalho Chehab: > > On Fri, 8 Jul 2022 03:21:24 -0700 > > Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> wrote: > > > >> This reverts the following commits: > >> commit 708d19d9f362 ("drm/amdgpu: move internal vram_mgr function into the C file") > >> commit 5e3f1e7729ec ("drm/amdgpu: fix start calculation in amdgpu_vram_mgr_new") > >> commit c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu") > >> > >> [WHY] > >> Few users reported garbaged graphics as soon as x starts, > >> reverting until this can be resolved. > >> > >> Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> > > This revert is currently breaking drm-tip. Please revert it ASAP, as it > > is preventing CI bots to properly test new patches on the top of current > > drm-tip: > > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_new’: > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:459:13: error: ‘cur_size’ undeclared (first use in this function) > > 459 | if (cur_size != size) { > > | ^~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:459:13: note: each undeclared identifier is reported only once for each function it appears in > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:459:25: error: ‘size’ undeclared (first use in this function); did you mean ‘ksize’? > > 459 | if (cur_size != size) { > > | ^~~~ > > | ksize > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:465:30: error: ‘vres’ undeclared (first use in this function); did you mean ‘res’? > > 465 | trim_list = &vres->blocks; > > | ^~~~ > > | res > > In file included from ./include/linux/bits.h:22, > > from ./include/linux/ratelimit_types.h:5, > > from ./include/linux/ratelimit.h:5, > > from ./include/linux/dev_printk.h:16, > > from ./include/linux/device.h:15, > > from ./include/linux/dma-mapping.h:7, > > from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25: > > ./include/linux/container_of.h:19:54: error: invalid use of undefined type ‘struct drm_buddy_block’ > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > | ^~ > > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ > > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > > | ^~~~ > > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > | ^~~~~~~~~~~~~ > > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > | ^~~~~~~~~~~ > > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > > 520 | container_of(ptr, type, member) > > | ^~~~~~~~~~~~ > > ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’ > > 542 | list_entry((ptr)->prev, type, member) > > | ^~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:473:33: note: in expansion of macro ‘list_last_entry’ > > 473 | block = list_last_entry(&vres->blocks, typeof(*block), link); > > | ^~~~~~~~~~~~~~~ > > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer > > 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ > > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > > | ^~~~ > > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > | ^~~~~~~~~~~~~ > > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > | ^~~~~~~~~~~ > > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > > 520 | container_of(ptr, type, member) > > | ^~~~~~~~~~~~ > > ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’ > > 542 | list_entry((ptr)->prev, type, member) > > | ^~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:473:33: note: in expansion of macro ‘list_last_entry’ > > 473 | block = list_last_entry(&vres->blocks, typeof(*block), link); > > | ^~~~~~~~~~~~~~~ > > In file included from ./include/uapi/linux/posix_types.h:5, > > from ./include/uapi/linux/types.h:14, > > from ./include/linux/types.h:6, > > from ./include/linux/kasan-checks.h:5, > > from ./include/asm-generic/rwonce.h:26, > > from ./arch/x86/include/generated/asm/rwonce.h:1, > > from ./include/linux/compiler.h:248, > > from ./include/linux/string.h:5, > > from ./include/linux/dma-mapping.h:6: > > ./include/linux/stddef.h:16:33: error: invalid use of undefined type ‘struct drm_buddy_block’ > > 16 | #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER) > > | ^~~~~~~~~~~~~~~~~~ > > ./include/linux/container_of.h:22:28: note: in expansion of macro ‘offsetof’ > > 22 | ((type *)(__mptr - offsetof(type, member))); }) > > | ^~~~~~~~ > > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > > 520 | container_of(ptr, type, member) > > | ^~~~~~~~~~~~ > > ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’ > > 542 | list_entry((ptr)->prev, type, member) > > | ^~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:473:33: note: in expansion of macro ‘list_last_entry’ > > 473 | block = list_last_entry(&vres->blocks, typeof(*block), link); > > | ^~~~~~~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:474:46: error: invalid use of undefined type ‘struct drm_buddy_block’ > > 474 | list_move_tail(&block->link, &temp); > > | ^~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:480:41: error: implicit declaration of function ‘amdgpu_vram_mgr_block_size’; did you mean ‘amdgpu_vram_mgr_vis_size’? [-Werror=implicit-function-declaration] > > 480 | original_size = amdgpu_vram_mgr_block_size(block) - (size - cur_size); > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~ > > | amdgpu_vram_mgr_vis_size > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:483:28: error: passing argument 1 of ‘mutex_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > 483 | mutex_lock(&mgr->lock); > > | ^~~~~~~~~~ > > | | > > | spinlock_t * {aka struct spinlock *} > > In file included from ./include/linux/rhashtable-types.h:14, > > from ./include/linux/ipc.h:7, > > from ./include/uapi/linux/sem.h:5, > > from ./include/linux/sem.h:5, > > from ./include/linux/sched.h:15, > > from ./include/linux/ratelimit.h:6: > > ./include/linux/mutex.h:199:38: note: expected ‘struct mutex *’ but argument is of type ‘spinlock_t *’ {aka ‘struct spinlock *’} > > 199 | extern void mutex_lock(struct mutex *lock); > > | ~~~~~~~~~~~~~~^~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:484:17: error: implicit declaration of function ‘drm_buddy_block_trim’ [-Werror=implicit-function-declaration] > > 484 | drm_buddy_block_trim(mm, > > | ^~~~~~~~~~~~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:487:30: error: passing argument 1 of ‘mutex_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > 487 | mutex_unlock(&mgr->lock); > > | ^~~~~~~~~~ > > | | > > | spinlock_t * {aka struct spinlock *} > > ./include/linux/mutex.h:218:40: note: expected ‘struct mutex *’ but argument is of type ‘spinlock_t *’ {aka ‘struct spinlock *’} > > 218 | extern void mutex_unlock(struct mutex *lock); > > | ~~~~~~~~~~~~~~^~~~ > > In file included from ./include/linux/rculist.h:10, > > from ./include/linux/pid.h:5, > > from ./include/linux/sched.h:14: > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:493:29: error: ‘block’ undeclared (first use in this function); did you mean ‘flock’? > > 493 | list_for_each_entry(block, &vres->blocks, link) > > | ^~~~~ > > ./include/linux/list.h:674:14: note: in definition of macro ‘list_for_each_entry’ > > 674 | for (pos = list_first_entry(head, typeof(*pos), member); \ > > | ^~~ > > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer > > 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ > > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > > | ^~~~ > > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > | ^~~~~~~~~~~~~ > > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > | ^~~~~~~~~~~ > > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > > 520 | container_of(ptr, type, member) > > | ^~~~~~~~~~~~ > > ./include/linux/list.h:531:9: note: in expansion of macro ‘list_entry’ > > 531 | list_entry((ptr)->next, type, member) > > | ^~~~~~~~~~ > > ./include/linux/list.h:674:20: note: in expansion of macro ‘list_first_entry’ > > 674 | for (pos = list_first_entry(head, typeof(*pos), member); \ > > | ^~~~~~~~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:493:9: note: in expansion of macro ‘list_for_each_entry’ > > 493 | list_for_each_entry(block, &vres->blocks, link) > > | ^~~~~~~~~~~~~~~~~~~ > > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer > > 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ > > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > > | ^~~~ > > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > | ^~~~~~~~~~~~~ > > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > | ^~~~~~~~~~~ > > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > > 520 | container_of(ptr, type, member) > > | ^~~~~~~~~~~~ > > ./include/linux/list.h:564:9: note: in expansion of macro ‘list_entry’ > > 564 | list_entry((pos)->member.next, typeof(*(pos)), member) > > | ^~~~~~~~~~ > > ./include/linux/list.h:676:20: note: in expansion of macro ‘list_next_entry’ > > 676 | pos = list_next_entry(pos, member)) > > | ^~~~~~~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:493:9: note: in expansion of macro ‘list_for_each_entry’ > > 493 | list_for_each_entry(block, &vres->blocks, link) > > | ^~~~~~~~~~~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:496:17: error: implicit declaration of function ‘amdgpu_vram_mgr_first_block’; did you mean ‘amdgpu_vram_mgr_virt_start’? [-Werror=implicit-function-declaration] > > 496 | block = amdgpu_vram_mgr_first_block(&vres->blocks); > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > > | amdgpu_vram_mgr_virt_start > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:502:28: error: implicit declaration of function ‘amdgpu_vram_mgr_block_start’; did you mean ‘amdgpu_vram_mgr_virt_start’? [-Werror=implicit-function-declaration] > > 502 | vres->base.start = amdgpu_vram_mgr_block_start(block) >> PAGE_SHIFT; > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > > | amdgpu_vram_mgr_virt_start > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:504:13: error: implicit declaration of function ‘amdgpu_is_vram_mgr_blocks_contiguous’ [-Werror=implicit-function-declaration] > > 504 | if (amdgpu_is_vram_mgr_blocks_contiguous(&vres->blocks)) > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > cc1: all warnings being treated as errors > > make[4]: *** [scripts/Makefile.build:249: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.o] Error 1 > > make[4]: *** Waiting for unfinished jobs.... > > make[3]: *** [scripts/Makefile.build:466: drivers/gpu/drm/amd/amdgpu] Error 2 > > make[2]: *** [scripts/Makefile.build:466: drivers/gpu/drm] Error 2 > > make[1]: *** [scripts/Makefile.build:466: drivers/gpu] Error 2 > > make: *** [Makefile:1843: drivers] Error 2 > > mchehab@sal /new_devel/v4l/tmp $ nano drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c > > mchehab@sal /new_devel/v4l/tmp $ make drivers/gpu/drm/amd/amdgpu/ > > DESCEND objtool > > CALL scripts/atomic/check-atomics.sh > > CALL scripts/checksyscalls.sh > > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.o > > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_csa.o > > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_ras.o > > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.o > > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.o > > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.o > > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.o > > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.o > > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_umc.o > > In file included from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:30: > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h:29:8: error: redefinition of ‘struct amdgpu_vram_mgr’ > > 29 | struct amdgpu_vram_mgr { > > | ^~~~~~~~~~~~~~~ > > In file included from drivers/gpu/drm/amd/amdgpu/amdgpu.h:73, > > from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:28: > > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:41:8: note: originally defined here > > 41 | struct amdgpu_vram_mgr { > > | ^~~~~~~~~~~~~~~ > > In file included from ./include/linux/bits.h:22, > > from ./include/linux/ratelimit_types.h:5, > > from ./include/linux/ratelimit.h:5, > > from ./include/linux/dev_printk.h:16, > > from ./include/linux/device.h:15, > > from ./include/linux/dma-mapping.h:7, > > from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25: > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘to_amdgpu_device’: > > ./include/linux/build_bug.h:78:41: error: static assertion failed: "pointer type mismatch in container_of()" > > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > > | ^~~~~~~~~~~~~~ > > ./include/linux/build_bug.h:77:34: note: in expansion of macro ‘__static_assert’ > > 77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr) > > | ^~~~~~~~~~~~~~~ > > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > | ^~~~~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:49:16: note: in expansion of macro ‘container_of’ > > 49 | return container_of(mgr, struct amdgpu_device, mman.vram_mgr); > > | ^~~~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_do_reserve’: > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:244:29: error: initialization of ‘struct drm_mm *’ from incompatible pointer type ‘struct drm_buddy *’ [-Werror=incompatible-pointer-types] > > 244 | struct drm_mm *mm = &mgr->mm; > > | ^ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: At top level: > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:273:5: error: conflicting types for ‘amdgpu_vram_mgr_reserve_range’; have ‘int(struct amdgpu_vram_mgr *, uint64_t, uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int, long long unsigned int)’} > > 273 | int amdgpu_vram_mgr_reserve_range(struct amdgpu_vram_mgr *mgr, > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:129:5: note: previous declaration of ‘amdgpu_vram_mgr_reserve_range’ with type ‘int(struct amdgpu_vram_mgr *, uint64_t, uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int, long long unsigned int)’} > > 129 | int amdgpu_vram_mgr_reserve_range(struct amdgpu_vram_mgr *mgr, > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_reserve_range’: > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:286:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > 286 | spin_lock(&mgr->lock); > > | ^~~~~~~~~~ > > | | > > | struct mutex * > > In file included from ./include/linux/wait.h:9, > > from ./include/linux/pid.h:6, > > from ./include/linux/sched.h:14, > > from ./include/linux/ratelimit.h:6: > > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > 347 | static __always_inline void spin_lock(spinlock_t *lock) > > | ~~~~~~~~~~~~^~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:289:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > 289 | spin_unlock(&mgr->lock); > > | ^~~~~~~~~~ > > | | > > | struct mutex * > > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > 387 | static __always_inline void spin_unlock(spinlock_t *lock) > > | ~~~~~~~~~~~~^~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: At top level: > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:305:5: error: conflicting types for ‘amdgpu_vram_mgr_query_page_status’; have ‘int(struct amdgpu_vram_mgr *, uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int)’} > > 305 | int amdgpu_vram_mgr_query_page_status(struct amdgpu_vram_mgr *mgr, > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:131:5: note: previous declaration of ‘amdgpu_vram_mgr_query_page_status’ with type ‘int(struct amdgpu_vram_mgr *, uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int)’} > > 131 | int amdgpu_vram_mgr_query_page_status(struct amdgpu_vram_mgr *mgr, > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_query_page_status’: > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:311:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > 311 | spin_lock(&mgr->lock); > > | ^~~~~~~~~~ > > | | > > | struct mutex * > > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > 347 | static __always_inline void spin_lock(spinlock_t *lock) > > | ~~~~~~~~~~~~^~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:331:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > 331 | spin_unlock(&mgr->lock); > > | ^~~~~~~~~~ > > | | > > | struct mutex * > > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > 387 | static __always_inline void spin_unlock(spinlock_t *lock) > > | ~~~~~~~~~~~~^~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_new’: > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:377:29: error: initialization of ‘struct drm_mm *’ from incompatible pointer type ‘struct drm_buddy *’ [-Werror=incompatible-pointer-types] > > 377 | struct drm_mm *mm = &mgr->mm; > > | ^ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:429:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > 429 | spin_lock(&mgr->lock); > > | ^~~~~~~~~~ > > | | > > | struct mutex * > > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > 347 | static __always_inline void spin_lock(spinlock_t *lock) > > | ~~~~~~~~~~~~^~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:458:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > 458 | spin_unlock(&mgr->lock); > > | ^~~~~~~~~~ > > | | > > | struct mutex * > > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > 387 | static __always_inline void spin_unlock(spinlock_t *lock) > > | ~~~~~~~~~~~~^~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:460:13: error: ‘cur_size’ undeclared (first use in this function) > > 460 | if (cur_size != size) { > > | ^~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:460:13: note: each undeclared identifier is reported only once for each function it appears in > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:460:25: error: ‘size’ undeclared (first use in this function); did you mean ‘ksize’? > > 460 | if (cur_size != size) { > > | ^~~~ > > | ksize > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:466:30: error: ‘vres’ undeclared (first use in this function); did you mean ‘res’? > > 466 | trim_list = &vres->blocks; > > | ^~~~ > > | res > > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer > > 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ > > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > > | ^~~~ > > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > | ^~~~~~~~~~~~~ > > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > | ^~~~~~~~~~~ > > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > > 520 | container_of(ptr, type, member) > > | ^~~~~~~~~~~~ > > ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’ > > 542 | list_entry((ptr)->prev, type, member) > > | ^~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:474:33: note: in expansion of macro ‘list_last_entry’ > > 474 | block = list_last_entry(&vres->blocks, typeof(*block), link); > > | ^~~~~~~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:485:38: error: passing argument 1 of ‘drm_buddy_block_trim’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > 485 | drm_buddy_block_trim(mm, > > | ^~ > > | | > > | struct drm_mm * > > In file included from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h:27: > > ./include/drm/drm_buddy.h:146:44: note: expected ‘struct drm_buddy *’ but argument is of type ‘struct drm_mm *’ > > 146 | int drm_buddy_block_trim(struct drm_buddy *mm, > > | ~~~~~~~~~~~~~~~~~~^~ > > In file included from ./include/linux/rculist.h:10, > > from ./include/linux/pid.h:5: > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:494:29: error: ‘block’ undeclared (first use in this function); did you mean ‘flock’? > > 494 | list_for_each_entry(block, &vres->blocks, link) > > | ^~~~~ > > ./include/linux/list.h:674:14: note: in definition of macro ‘list_for_each_entry’ > > 674 | for (pos = list_first_entry(head, typeof(*pos), member); \ > > | ^~~ > > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer > > 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ > > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > > | ^~~~ > > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > | ^~~~~~~~~~~~~ > > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > | ^~~~~~~~~~~ > > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > > 520 | container_of(ptr, type, member) > > | ^~~~~~~~~~~~ > > ./include/linux/list.h:531:9: note: in expansion of macro ‘list_entry’ > > 531 | list_entry((ptr)->next, type, member) > > | ^~~~~~~~~~ > > ./include/linux/list.h:674:20: note: in expansion of macro ‘list_first_entry’ > > 674 | for (pos = list_first_entry(head, typeof(*pos), member); \ > > | ^~~~~~~~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:494:9: note: in expansion of macro ‘list_for_each_entry’ > > 494 | list_for_each_entry(block, &vres->blocks, link) > > | ^~~~~~~~~~~~~~~~~~~ > > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer > > 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ > > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > > | ^~~~ > > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > | ^~~~~~~~~~~~~ > > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > | ^~~~~~~~~~~ > > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > > 520 | container_of(ptr, type, member) > > | ^~~~~~~~~~~~ > > ./include/linux/list.h:564:9: note: in expansion of macro ‘list_entry’ > > 564 | list_entry((pos)->member.next, typeof(*(pos)), member) > > | ^~~~~~~~~~ > > ./include/linux/list.h:676:20: note: in expansion of macro ‘list_next_entry’ > > 676 | pos = list_next_entry(pos, member)) > > | ^~~~~~~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:494:9: note: in expansion of macro ‘list_for_each_entry’ > > 494 | list_for_each_entry(block, &vres->blocks, link) > > | ^~~~~~~~~~~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:520:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > 520 | spin_unlock(&mgr->lock); > > | ^~~~~~~~~~ > > | | > > | struct mutex * > > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > 387 | static __always_inline void spin_unlock(spinlock_t *lock) > > | ~~~~~~~~~~~~^~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_del’: > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:545:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > 545 | spin_lock(&mgr->lock); > > | ^~~~~~~~~~ > > | | > > | struct mutex * > > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > 347 | static __always_inline void spin_lock(spinlock_t *lock) > > | ~~~~~~~~~~~~^~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:554:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > 554 | spin_unlock(&mgr->lock); > > | ^~~~~~~~~~ > > | | > > | struct mutex * > > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > 387 | static __always_inline void spin_unlock(spinlock_t *lock) > > | ~~~~~~~~~~~~^~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: At top level: > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:680:10: error: conflicting types for ‘amdgpu_vram_mgr_vis_usage’; have ‘uint64_t(struct amdgpu_vram_mgr *)’ {aka ‘long long unsigned int(struct amdgpu_vram_mgr *)’} > > 680 | uint64_t amdgpu_vram_mgr_vis_usage(struct amdgpu_vram_mgr *mgr) > > | ^~~~~~~~~~~~~~~~~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:128:10: note: previous declaration of ‘amdgpu_vram_mgr_vis_usage’ with type ‘uint64_t(struct amdgpu_vram_mgr *)’ {aka ‘long long unsigned int(struct amdgpu_vram_mgr *)’} > > 128 | uint64_t amdgpu_vram_mgr_vis_usage(struct amdgpu_vram_mgr *mgr); > > | ^~~~~~~~~~~~~~~~~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_debug’: > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:701:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > 701 | spin_lock(&mgr->lock); > > | ^~~~~~~~~~ > > | | > > | struct mutex * > > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > 347 | static __always_inline void spin_lock(spinlock_t *lock) > > | ~~~~~~~~~~~~^~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:702:22: error: passing argument 1 of ‘drm_mm_print’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > 702 | drm_mm_print(&mgr->mm, printer); > > | ^~~~~~~~ > > | | > > | struct drm_buddy * > > In file included from ./include/drm/ttm/ttm_range_manager.h:8, > > from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:26: > > ./include/drm/drm_mm.h:551:40: note: expected ‘const struct drm_mm *’ but argument is of type ‘struct drm_buddy *’ > > 551 | void drm_mm_print(const struct drm_mm *mm, struct drm_printer *p); > > | ~~~~~~~~~~~~~~~~~~~~~^~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:703:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > 703 | spin_unlock(&mgr->lock); > > | ^~~~~~~~~~ > > | | > > | struct mutex * > > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > 387 | static __always_inline void spin_unlock(spinlock_t *lock) > > | ~~~~~~~~~~~~^~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_init’: > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:721:39: error: initialization of ‘struct amdgpu_vram_mgr *’ from incompatible pointer type ‘struct amdgpu_vram_mgr *’ [-Werror=incompatible-pointer-types] > > 721 | struct amdgpu_vram_mgr *mgr = &adev->mman.vram_mgr; > > | ^ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:729:21: error: passing argument 1 of ‘drm_mm_init’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > 729 | drm_mm_init(&mgr->mm, 0, man->size >> PAGE_SHIFT); > > | ^~~~~~~~ > > | | > > | struct drm_buddy * > > ./include/drm/drm_mm.h:467:33: note: expected ‘struct drm_mm *’ but argument is of type ‘struct drm_buddy *’ > > 467 | void drm_mm_init(struct drm_mm *mm, u64 start, u64 size); > > | ~~~~~~~~~~~~~~~^~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:730:24: error: passing argument 1 of ‘spinlock_check’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > 730 | spin_lock_init(&mgr->lock); > > | ^~~~~~~~~~ > > | | > > | struct mutex * > > ./include/linux/spinlock.h:341:24: note: in definition of macro ‘spin_lock_init’ > > 341 | spinlock_check(_lock); \ > > | ^~~~~ > > ./include/linux/spinlock.h:322:67: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > 322 | static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock) > > | ~~~~~~~~~~~~^~~~ > > In file included from ./include/linux/spinlock.h:87: > > ./include/linux/spinlock_types.h:41:9: error: incompatible types when assigning to type ‘struct mutex’ from type ‘spinlock_t’ {aka ‘struct spinlock’} > > 41 | (spinlock_t) __SPIN_LOCK_INITIALIZER(lockname) > > | ^ > > ./include/linux/spinlock.h:342:20: note: in expansion of macro ‘__SPIN_LOCK_UNLOCKED’ > > 342 | *(_lock) = __SPIN_LOCK_UNLOCKED(_lock); \ > > | ^~~~~~~~~~~~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:730:9: note: in expansion of macro ‘spin_lock_init’ > > 730 | spin_lock_init(&mgr->lock); > > | ^~~~~~~~~~~~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_fini’: > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:749:39: error: initialization of ‘struct amdgpu_vram_mgr *’ from incompatible pointer type ‘struct amdgpu_vram_mgr *’ [-Werror=incompatible-pointer-types] > > 749 | struct amdgpu_vram_mgr *mgr = &adev->mman.vram_mgr; > > | ^ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:760:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > 760 | spin_lock(&mgr->lock); > > | ^~~~~~~~~~ > > | | > > | struct mutex * > > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > 347 | static __always_inline void spin_lock(spinlock_t *lock) > > | ~~~~~~~~~~~~^~~~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:768:25: error: passing argument 1 of ‘drm_mm_takedown’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > 768 | drm_mm_takedown(&mgr->mm); > > | ^~~~~~~~ > > | | > > | struct drm_buddy * > > ./include/drm/drm_mm.h:468:37: note: expected ‘struct drm_mm *’ but argument is of type ‘struct drm_buddy *’ > > 468 | void drm_mm_takedown(struct drm_mm *mm); > > | ~~~~~~~~~~~~~~~^~ > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:769:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > 769 | spin_unlock(&mgr->lock); > > | ^~~~~~~~~~ > > | | > > | struct mutex * > > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > 387 | static __always_inline void spin_unlock(spinlock_t *lock) > > | ~~~~~~~~~~~~^~~~ > > cc1: all warnings being treated as errors > > make[4]: *** [scripts/Makefile.build:249: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.o] Error 1 > > make[4]: *** Waiting for unfinished jobs.... > > CC [M] drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.o > > make[3]: *** [scripts/Makefile.build:466: drivers/gpu/drm/amd/amdgpu] Error 2 > > make[2]: *** [scripts/Makefile.build:466: drivers/gpu/drm] Error 2 > > make[1]: *** [scripts/Makefile.build:466: drivers/gpu] Error 2 > > make: *** [Makefile:1843: drivers] Error 2 > > > > Regards, > > Mauro >
On Thu, 14 Jul 2022 09:33:23 -0400 Alex Deucher <alexdeucher@gmail.com> wrote: > On Thu, Jul 14, 2022 at 9:09 AM Christian König > <christian.koenig@amd.com> wrote: > > > > Hi Mauro, > > > > well the last time I checked drm-tip was clean. > > > > The revert is necessary because we had some problems with the commit > > which we couldn't fix in the 5.19 cycle. > > Would it be worth reverting the revert and applying the actual fix[1]? > It's a huge revert unfortunately while the actual fix is like 10 > lines of code. I'm concerned there will be subtle fallout from the > revert due to how extensive it is. > > [1] - https://gitlab.freedesktop.org/drm/amd/uploads/564b2cc2b5ea87357f39e45c3a1a44e2/0001-drm-amdgpu-Fix-for-drm-buddy-memory-corruption.patch The tree now seems to be clean. I re-submitted a CI trybot job to double-check if everything is ok. Probably the issue was due to some badly solved merge conflict. Thank you! Mauro > > Alex > > > > > > I will double check drm-tip once more. > > > > Regards, > > Christian. > > > > Am 14.07.22 um 14:54 schrieb Mauro Carvalho Chehab: > > > On Fri, 8 Jul 2022 03:21:24 -0700 > > > Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> wrote: > > > > > >> This reverts the following commits: > > >> commit 708d19d9f362 ("drm/amdgpu: move internal vram_mgr function into the C file") > > >> commit 5e3f1e7729ec ("drm/amdgpu: fix start calculation in amdgpu_vram_mgr_new") > > >> commit c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu") > > >> > > >> [WHY] > > >> Few users reported garbaged graphics as soon as x starts, > > >> reverting until this can be resolved. > > >> > > >> Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> > > > This revert is currently breaking drm-tip. Please revert it ASAP, as it > > > is preventing CI bots to properly test new patches on the top of current > > > drm-tip: > > > > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_new’: > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:459:13: error: ‘cur_size’ undeclared (first use in this function) > > > 459 | if (cur_size != size) { > > > | ^~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:459:13: note: each undeclared identifier is reported only once for each function it appears in > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:459:25: error: ‘size’ undeclared (first use in this function); did you mean ‘ksize’? > > > 459 | if (cur_size != size) { > > > | ^~~~ > > > | ksize > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:465:30: error: ‘vres’ undeclared (first use in this function); did you mean ‘res’? > > > 465 | trim_list = &vres->blocks; > > > | ^~~~ > > > | res > > > In file included from ./include/linux/bits.h:22, > > > from ./include/linux/ratelimit_types.h:5, > > > from ./include/linux/ratelimit.h:5, > > > from ./include/linux/dev_printk.h:16, > > > from ./include/linux/device.h:15, > > > from ./include/linux/dma-mapping.h:7, > > > from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25: > > > ./include/linux/container_of.h:19:54: error: invalid use of undefined type ‘struct drm_buddy_block’ > > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > > | ^~ > > > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ > > > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > > > | ^~~~ > > > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > > | ^~~~~~~~~~~~~ > > > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ > > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > > | ^~~~~~~~~~~ > > > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > > > 520 | container_of(ptr, type, member) > > > | ^~~~~~~~~~~~ > > > ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’ > > > 542 | list_entry((ptr)->prev, type, member) > > > | ^~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:473:33: note: in expansion of macro ‘list_last_entry’ > > > 473 | block = list_last_entry(&vres->blocks, typeof(*block), link); > > > | ^~~~~~~~~~~~~~~ > > > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer > > > 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ > > > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > > > | ^~~~ > > > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > > | ^~~~~~~~~~~~~ > > > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ > > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > > | ^~~~~~~~~~~ > > > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > > > 520 | container_of(ptr, type, member) > > > | ^~~~~~~~~~~~ > > > ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’ > > > 542 | list_entry((ptr)->prev, type, member) > > > | ^~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:473:33: note: in expansion of macro ‘list_last_entry’ > > > 473 | block = list_last_entry(&vres->blocks, typeof(*block), link); > > > | ^~~~~~~~~~~~~~~ > > > In file included from ./include/uapi/linux/posix_types.h:5, > > > from ./include/uapi/linux/types.h:14, > > > from ./include/linux/types.h:6, > > > from ./include/linux/kasan-checks.h:5, > > > from ./include/asm-generic/rwonce.h:26, > > > from ./arch/x86/include/generated/asm/rwonce.h:1, > > > from ./include/linux/compiler.h:248, > > > from ./include/linux/string.h:5, > > > from ./include/linux/dma-mapping.h:6: > > > ./include/linux/stddef.h:16:33: error: invalid use of undefined type ‘struct drm_buddy_block’ > > > 16 | #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER) > > > | ^~~~~~~~~~~~~~~~~~ > > > ./include/linux/container_of.h:22:28: note: in expansion of macro ‘offsetof’ > > > 22 | ((type *)(__mptr - offsetof(type, member))); }) > > > | ^~~~~~~~ > > > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > > > 520 | container_of(ptr, type, member) > > > | ^~~~~~~~~~~~ > > > ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’ > > > 542 | list_entry((ptr)->prev, type, member) > > > | ^~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:473:33: note: in expansion of macro ‘list_last_entry’ > > > 473 | block = list_last_entry(&vres->blocks, typeof(*block), link); > > > | ^~~~~~~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:474:46: error: invalid use of undefined type ‘struct drm_buddy_block’ > > > 474 | list_move_tail(&block->link, &temp); > > > | ^~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:480:41: error: implicit declaration of function ‘amdgpu_vram_mgr_block_size’; did you mean ‘amdgpu_vram_mgr_vis_size’? [-Werror=implicit-function-declaration] > > > 480 | original_size = amdgpu_vram_mgr_block_size(block) - (size - cur_size); > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~ > > > | amdgpu_vram_mgr_vis_size > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:483:28: error: passing argument 1 of ‘mutex_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > > 483 | mutex_lock(&mgr->lock); > > > | ^~~~~~~~~~ > > > | | > > > | spinlock_t * {aka struct spinlock *} > > > In file included from ./include/linux/rhashtable-types.h:14, > > > from ./include/linux/ipc.h:7, > > > from ./include/uapi/linux/sem.h:5, > > > from ./include/linux/sem.h:5, > > > from ./include/linux/sched.h:15, > > > from ./include/linux/ratelimit.h:6: > > > ./include/linux/mutex.h:199:38: note: expected ‘struct mutex *’ but argument is of type ‘spinlock_t *’ {aka ‘struct spinlock *’} > > > 199 | extern void mutex_lock(struct mutex *lock); > > > | ~~~~~~~~~~~~~~^~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:484:17: error: implicit declaration of function ‘drm_buddy_block_trim’ [-Werror=implicit-function-declaration] > > > 484 | drm_buddy_block_trim(mm, > > > | ^~~~~~~~~~~~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:487:30: error: passing argument 1 of ‘mutex_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > > 487 | mutex_unlock(&mgr->lock); > > > | ^~~~~~~~~~ > > > | | > > > | spinlock_t * {aka struct spinlock *} > > > ./include/linux/mutex.h:218:40: note: expected ‘struct mutex *’ but argument is of type ‘spinlock_t *’ {aka ‘struct spinlock *’} > > > 218 | extern void mutex_unlock(struct mutex *lock); > > > | ~~~~~~~~~~~~~~^~~~ > > > In file included from ./include/linux/rculist.h:10, > > > from ./include/linux/pid.h:5, > > > from ./include/linux/sched.h:14: > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:493:29: error: ‘block’ undeclared (first use in this function); did you mean ‘flock’? > > > 493 | list_for_each_entry(block, &vres->blocks, link) > > > | ^~~~~ > > > ./include/linux/list.h:674:14: note: in definition of macro ‘list_for_each_entry’ > > > 674 | for (pos = list_first_entry(head, typeof(*pos), member); \ > > > | ^~~ > > > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer > > > 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ > > > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > > > | ^~~~ > > > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > > | ^~~~~~~~~~~~~ > > > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ > > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > > | ^~~~~~~~~~~ > > > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > > > 520 | container_of(ptr, type, member) > > > | ^~~~~~~~~~~~ > > > ./include/linux/list.h:531:9: note: in expansion of macro ‘list_entry’ > > > 531 | list_entry((ptr)->next, type, member) > > > | ^~~~~~~~~~ > > > ./include/linux/list.h:674:20: note: in expansion of macro ‘list_first_entry’ > > > 674 | for (pos = list_first_entry(head, typeof(*pos), member); \ > > > | ^~~~~~~~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:493:9: note: in expansion of macro ‘list_for_each_entry’ > > > 493 | list_for_each_entry(block, &vres->blocks, link) > > > | ^~~~~~~~~~~~~~~~~~~ > > > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer > > > 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ > > > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > > > | ^~~~ > > > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > > | ^~~~~~~~~~~~~ > > > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ > > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > > | ^~~~~~~~~~~ > > > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > > > 520 | container_of(ptr, type, member) > > > | ^~~~~~~~~~~~ > > > ./include/linux/list.h:564:9: note: in expansion of macro ‘list_entry’ > > > 564 | list_entry((pos)->member.next, typeof(*(pos)), member) > > > | ^~~~~~~~~~ > > > ./include/linux/list.h:676:20: note: in expansion of macro ‘list_next_entry’ > > > 676 | pos = list_next_entry(pos, member)) > > > | ^~~~~~~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:493:9: note: in expansion of macro ‘list_for_each_entry’ > > > 493 | list_for_each_entry(block, &vres->blocks, link) > > > | ^~~~~~~~~~~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:496:17: error: implicit declaration of function ‘amdgpu_vram_mgr_first_block’; did you mean ‘amdgpu_vram_mgr_virt_start’? [-Werror=implicit-function-declaration] > > > 496 | block = amdgpu_vram_mgr_first_block(&vres->blocks); > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > | amdgpu_vram_mgr_virt_start > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:502:28: error: implicit declaration of function ‘amdgpu_vram_mgr_block_start’; did you mean ‘amdgpu_vram_mgr_virt_start’? [-Werror=implicit-function-declaration] > > > 502 | vres->base.start = amdgpu_vram_mgr_block_start(block) >> PAGE_SHIFT; > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > | amdgpu_vram_mgr_virt_start > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:504:13: error: implicit declaration of function ‘amdgpu_is_vram_mgr_blocks_contiguous’ [-Werror=implicit-function-declaration] > > > 504 | if (amdgpu_is_vram_mgr_blocks_contiguous(&vres->blocks)) > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > cc1: all warnings being treated as errors > > > make[4]: *** [scripts/Makefile.build:249: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.o] Error 1 > > > make[4]: *** Waiting for unfinished jobs.... > > > make[3]: *** [scripts/Makefile.build:466: drivers/gpu/drm/amd/amdgpu] Error 2 > > > make[2]: *** [scripts/Makefile.build:466: drivers/gpu/drm] Error 2 > > > make[1]: *** [scripts/Makefile.build:466: drivers/gpu] Error 2 > > > make: *** [Makefile:1843: drivers] Error 2 > > > mchehab@sal /new_devel/v4l/tmp $ nano drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c > > > mchehab@sal /new_devel/v4l/tmp $ make drivers/gpu/drm/amd/amdgpu/ > > > DESCEND objtool > > > CALL scripts/atomic/check-atomics.sh > > > CALL scripts/checksyscalls.sh > > > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.o > > > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_csa.o > > > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_ras.o > > > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.o > > > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.o > > > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.o > > > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.o > > > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.o > > > CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_umc.o > > > In file included from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:30: > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h:29:8: error: redefinition of ‘struct amdgpu_vram_mgr’ > > > 29 | struct amdgpu_vram_mgr { > > > | ^~~~~~~~~~~~~~~ > > > In file included from drivers/gpu/drm/amd/amdgpu/amdgpu.h:73, > > > from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:28: > > > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:41:8: note: originally defined here > > > 41 | struct amdgpu_vram_mgr { > > > | ^~~~~~~~~~~~~~~ > > > In file included from ./include/linux/bits.h:22, > > > from ./include/linux/ratelimit_types.h:5, > > > from ./include/linux/ratelimit.h:5, > > > from ./include/linux/dev_printk.h:16, > > > from ./include/linux/device.h:15, > > > from ./include/linux/dma-mapping.h:7, > > > from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25: > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘to_amdgpu_device’: > > > ./include/linux/build_bug.h:78:41: error: static assertion failed: "pointer type mismatch in container_of()" > > > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > > > | ^~~~~~~~~~~~~~ > > > ./include/linux/build_bug.h:77:34: note: in expansion of macro ‘__static_assert’ > > > 77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr) > > > | ^~~~~~~~~~~~~~~ > > > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > > | ^~~~~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:49:16: note: in expansion of macro ‘container_of’ > > > 49 | return container_of(mgr, struct amdgpu_device, mman.vram_mgr); > > > | ^~~~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_do_reserve’: > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:244:29: error: initialization of ‘struct drm_mm *’ from incompatible pointer type ‘struct drm_buddy *’ [-Werror=incompatible-pointer-types] > > > 244 | struct drm_mm *mm = &mgr->mm; > > > | ^ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: At top level: > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:273:5: error: conflicting types for ‘amdgpu_vram_mgr_reserve_range’; have ‘int(struct amdgpu_vram_mgr *, uint64_t, uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int, long long unsigned int)’} > > > 273 | int amdgpu_vram_mgr_reserve_range(struct amdgpu_vram_mgr *mgr, > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:129:5: note: previous declaration of ‘amdgpu_vram_mgr_reserve_range’ with type ‘int(struct amdgpu_vram_mgr *, uint64_t, uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int, long long unsigned int)’} > > > 129 | int amdgpu_vram_mgr_reserve_range(struct amdgpu_vram_mgr *mgr, > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_reserve_range’: > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:286:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > > 286 | spin_lock(&mgr->lock); > > > | ^~~~~~~~~~ > > > | | > > > | struct mutex * > > > In file included from ./include/linux/wait.h:9, > > > from ./include/linux/pid.h:6, > > > from ./include/linux/sched.h:14, > > > from ./include/linux/ratelimit.h:6: > > > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > > 347 | static __always_inline void spin_lock(spinlock_t *lock) > > > | ~~~~~~~~~~~~^~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:289:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > > 289 | spin_unlock(&mgr->lock); > > > | ^~~~~~~~~~ > > > | | > > > | struct mutex * > > > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > > 387 | static __always_inline void spin_unlock(spinlock_t *lock) > > > | ~~~~~~~~~~~~^~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: At top level: > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:305:5: error: conflicting types for ‘amdgpu_vram_mgr_query_page_status’; have ‘int(struct amdgpu_vram_mgr *, uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int)’} > > > 305 | int amdgpu_vram_mgr_query_page_status(struct amdgpu_vram_mgr *mgr, > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:131:5: note: previous declaration of ‘amdgpu_vram_mgr_query_page_status’ with type ‘int(struct amdgpu_vram_mgr *, uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int)’} > > > 131 | int amdgpu_vram_mgr_query_page_status(struct amdgpu_vram_mgr *mgr, > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_query_page_status’: > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:311:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > > 311 | spin_lock(&mgr->lock); > > > | ^~~~~~~~~~ > > > | | > > > | struct mutex * > > > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > > 347 | static __always_inline void spin_lock(spinlock_t *lock) > > > | ~~~~~~~~~~~~^~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:331:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > > 331 | spin_unlock(&mgr->lock); > > > | ^~~~~~~~~~ > > > | | > > > | struct mutex * > > > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > > 387 | static __always_inline void spin_unlock(spinlock_t *lock) > > > | ~~~~~~~~~~~~^~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_new’: > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:377:29: error: initialization of ‘struct drm_mm *’ from incompatible pointer type ‘struct drm_buddy *’ [-Werror=incompatible-pointer-types] > > > 377 | struct drm_mm *mm = &mgr->mm; > > > | ^ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:429:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > > 429 | spin_lock(&mgr->lock); > > > | ^~~~~~~~~~ > > > | | > > > | struct mutex * > > > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > > 347 | static __always_inline void spin_lock(spinlock_t *lock) > > > | ~~~~~~~~~~~~^~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:458:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > > 458 | spin_unlock(&mgr->lock); > > > | ^~~~~~~~~~ > > > | | > > > | struct mutex * > > > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > > 387 | static __always_inline void spin_unlock(spinlock_t *lock) > > > | ~~~~~~~~~~~~^~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:460:13: error: ‘cur_size’ undeclared (first use in this function) > > > 460 | if (cur_size != size) { > > > | ^~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:460:13: note: each undeclared identifier is reported only once for each function it appears in > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:460:25: error: ‘size’ undeclared (first use in this function); did you mean ‘ksize’? > > > 460 | if (cur_size != size) { > > > | ^~~~ > > > | ksize > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:466:30: error: ‘vres’ undeclared (first use in this function); did you mean ‘res’? > > > 466 | trim_list = &vres->blocks; > > > | ^~~~ > > > | res > > > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer > > > 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ > > > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > > > | ^~~~ > > > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > > | ^~~~~~~~~~~~~ > > > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ > > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > > | ^~~~~~~~~~~ > > > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > > > 520 | container_of(ptr, type, member) > > > | ^~~~~~~~~~~~ > > > ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’ > > > 542 | list_entry((ptr)->prev, type, member) > > > | ^~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:474:33: note: in expansion of macro ‘list_last_entry’ > > > 474 | block = list_last_entry(&vres->blocks, typeof(*block), link); > > > | ^~~~~~~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:485:38: error: passing argument 1 of ‘drm_buddy_block_trim’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > > 485 | drm_buddy_block_trim(mm, > > > | ^~ > > > | | > > > | struct drm_mm * > > > In file included from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h:27: > > > ./include/drm/drm_buddy.h:146:44: note: expected ‘struct drm_buddy *’ but argument is of type ‘struct drm_mm *’ > > > 146 | int drm_buddy_block_trim(struct drm_buddy *mm, > > > | ~~~~~~~~~~~~~~~~~~^~ > > > In file included from ./include/linux/rculist.h:10, > > > from ./include/linux/pid.h:5: > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:494:29: error: ‘block’ undeclared (first use in this function); did you mean ‘flock’? > > > 494 | list_for_each_entry(block, &vres->blocks, link) > > > | ^~~~~ > > > ./include/linux/list.h:674:14: note: in definition of macro ‘list_for_each_entry’ > > > 674 | for (pos = list_first_entry(head, typeof(*pos), member); \ > > > | ^~~ > > > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer > > > 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ > > > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > > > | ^~~~ > > > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > > | ^~~~~~~~~~~~~ > > > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ > > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > > | ^~~~~~~~~~~ > > > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > > > 520 | container_of(ptr, type, member) > > > | ^~~~~~~~~~~~ > > > ./include/linux/list.h:531:9: note: in expansion of macro ‘list_entry’ > > > 531 | list_entry((ptr)->next, type, member) > > > | ^~~~~~~~~~ > > > ./include/linux/list.h:674:20: note: in expansion of macro ‘list_first_entry’ > > > 674 | for (pos = list_first_entry(head, typeof(*pos), member); \ > > > | ^~~~~~~~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:494:9: note: in expansion of macro ‘list_for_each_entry’ > > > 494 | list_for_each_entry(block, &vres->blocks, link) > > > | ^~~~~~~~~~~~~~~~~~~ > > > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer > > > 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ > > > 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) > > > | ^~~~ > > > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ > > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > > | ^~~~~~~~~~~~~ > > > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ > > > 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ > > > | ^~~~~~~~~~~ > > > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ > > > 520 | container_of(ptr, type, member) > > > | ^~~~~~~~~~~~ > > > ./include/linux/list.h:564:9: note: in expansion of macro ‘list_entry’ > > > 564 | list_entry((pos)->member.next, typeof(*(pos)), member) > > > | ^~~~~~~~~~ > > > ./include/linux/list.h:676:20: note: in expansion of macro ‘list_next_entry’ > > > 676 | pos = list_next_entry(pos, member)) > > > | ^~~~~~~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:494:9: note: in expansion of macro ‘list_for_each_entry’ > > > 494 | list_for_each_entry(block, &vres->blocks, link) > > > | ^~~~~~~~~~~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:520:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > > 520 | spin_unlock(&mgr->lock); > > > | ^~~~~~~~~~ > > > | | > > > | struct mutex * > > > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > > 387 | static __always_inline void spin_unlock(spinlock_t *lock) > > > | ~~~~~~~~~~~~^~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_del’: > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:545:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > > 545 | spin_lock(&mgr->lock); > > > | ^~~~~~~~~~ > > > | | > > > | struct mutex * > > > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > > 347 | static __always_inline void spin_lock(spinlock_t *lock) > > > | ~~~~~~~~~~~~^~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:554:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > > 554 | spin_unlock(&mgr->lock); > > > | ^~~~~~~~~~ > > > | | > > > | struct mutex * > > > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > > 387 | static __always_inline void spin_unlock(spinlock_t *lock) > > > | ~~~~~~~~~~~~^~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: At top level: > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:680:10: error: conflicting types for ‘amdgpu_vram_mgr_vis_usage’; have ‘uint64_t(struct amdgpu_vram_mgr *)’ {aka ‘long long unsigned int(struct amdgpu_vram_mgr *)’} > > > 680 | uint64_t amdgpu_vram_mgr_vis_usage(struct amdgpu_vram_mgr *mgr) > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:128:10: note: previous declaration of ‘amdgpu_vram_mgr_vis_usage’ with type ‘uint64_t(struct amdgpu_vram_mgr *)’ {aka ‘long long unsigned int(struct amdgpu_vram_mgr *)’} > > > 128 | uint64_t amdgpu_vram_mgr_vis_usage(struct amdgpu_vram_mgr *mgr); > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_debug’: > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:701:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > > 701 | spin_lock(&mgr->lock); > > > | ^~~~~~~~~~ > > > | | > > > | struct mutex * > > > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > > 347 | static __always_inline void spin_lock(spinlock_t *lock) > > > | ~~~~~~~~~~~~^~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:702:22: error: passing argument 1 of ‘drm_mm_print’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > > 702 | drm_mm_print(&mgr->mm, printer); > > > | ^~~~~~~~ > > > | | > > > | struct drm_buddy * > > > In file included from ./include/drm/ttm/ttm_range_manager.h:8, > > > from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:26: > > > ./include/drm/drm_mm.h:551:40: note: expected ‘const struct drm_mm *’ but argument is of type ‘struct drm_buddy *’ > > > 551 | void drm_mm_print(const struct drm_mm *mm, struct drm_printer *p); > > > | ~~~~~~~~~~~~~~~~~~~~~^~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:703:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > > 703 | spin_unlock(&mgr->lock); > > > | ^~~~~~~~~~ > > > | | > > > | struct mutex * > > > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > > 387 | static __always_inline void spin_unlock(spinlock_t *lock) > > > | ~~~~~~~~~~~~^~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_init’: > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:721:39: error: initialization of ‘struct amdgpu_vram_mgr *’ from incompatible pointer type ‘struct amdgpu_vram_mgr *’ [-Werror=incompatible-pointer-types] > > > 721 | struct amdgpu_vram_mgr *mgr = &adev->mman.vram_mgr; > > > | ^ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:729:21: error: passing argument 1 of ‘drm_mm_init’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > > 729 | drm_mm_init(&mgr->mm, 0, man->size >> PAGE_SHIFT); > > > | ^~~~~~~~ > > > | | > > > | struct drm_buddy * > > > ./include/drm/drm_mm.h:467:33: note: expected ‘struct drm_mm *’ but argument is of type ‘struct drm_buddy *’ > > > 467 | void drm_mm_init(struct drm_mm *mm, u64 start, u64 size); > > > | ~~~~~~~~~~~~~~~^~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:730:24: error: passing argument 1 of ‘spinlock_check’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > > 730 | spin_lock_init(&mgr->lock); > > > | ^~~~~~~~~~ > > > | | > > > | struct mutex * > > > ./include/linux/spinlock.h:341:24: note: in definition of macro ‘spin_lock_init’ > > > 341 | spinlock_check(_lock); \ > > > | ^~~~~ > > > ./include/linux/spinlock.h:322:67: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > > 322 | static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock) > > > | ~~~~~~~~~~~~^~~~ > > > In file included from ./include/linux/spinlock.h:87: > > > ./include/linux/spinlock_types.h:41:9: error: incompatible types when assigning to type ‘struct mutex’ from type ‘spinlock_t’ {aka ‘struct spinlock’} > > > 41 | (spinlock_t) __SPIN_LOCK_INITIALIZER(lockname) > > > | ^ > > > ./include/linux/spinlock.h:342:20: note: in expansion of macro ‘__SPIN_LOCK_UNLOCKED’ > > > 342 | *(_lock) = __SPIN_LOCK_UNLOCKED(_lock); \ > > > | ^~~~~~~~~~~~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:730:9: note: in expansion of macro ‘spin_lock_init’ > > > 730 | spin_lock_init(&mgr->lock); > > > | ^~~~~~~~~~~~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_fini’: > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:749:39: error: initialization of ‘struct amdgpu_vram_mgr *’ from incompatible pointer type ‘struct amdgpu_vram_mgr *’ [-Werror=incompatible-pointer-types] > > > 749 | struct amdgpu_vram_mgr *mgr = &adev->mman.vram_mgr; > > > | ^ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:760:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > > 760 | spin_lock(&mgr->lock); > > > | ^~~~~~~~~~ > > > | | > > > | struct mutex * > > > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > > 347 | static __always_inline void spin_lock(spinlock_t *lock) > > > | ~~~~~~~~~~~~^~~~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:768:25: error: passing argument 1 of ‘drm_mm_takedown’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > > 768 | drm_mm_takedown(&mgr->mm); > > > | ^~~~~~~~ > > > | | > > > | struct drm_buddy * > > > ./include/drm/drm_mm.h:468:37: note: expected ‘struct drm_mm *’ but argument is of type ‘struct drm_buddy *’ > > > 468 | void drm_mm_takedown(struct drm_mm *mm); > > > | ~~~~~~~~~~~~~~~^~ > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:769:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] > > > 769 | spin_unlock(&mgr->lock); > > > | ^~~~~~~~~~ > > > | | > > > | struct mutex * > > > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ > > > 387 | static __always_inline void spin_unlock(spinlock_t *lock) > > > | ~~~~~~~~~~~~^~~~ > > > cc1: all warnings being treated as errors > > > make[4]: *** [scripts/Makefile.build:249: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.o] Error 1 > > > make[4]: *** Waiting for unfinished jobs.... > > > CC [M] drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.o > > > make[3]: *** [scripts/Makefile.build:466: drivers/gpu/drm/amd/amdgpu] Error 2 > > > make[2]: *** [scripts/Makefile.build:466: drivers/gpu/drm] Error 2 > > > make[1]: *** [scripts/Makefile.build:466: drivers/gpu] Error 2 > > > make: *** [Makefile:1843: drivers] Error 2 > > > > > > Regards, > > > Mauro > >
Am 14.07.22 um 15:33 schrieb Alex Deucher: > On Thu, Jul 14, 2022 at 9:09 AM Christian König > <christian.koenig@amd.com> wrote: >> Hi Mauro, >> >> well the last time I checked drm-tip was clean. >> >> The revert is necessary because we had some problems with the commit >> which we couldn't fix in the 5.19 cycle. > Would it be worth reverting the revert and applying the actual fix[1]? > It's a huge revert unfortunately while the actual fix is like 10 > lines of code. I'm concerned there will be subtle fallout from the > revert due to how extensive it is. We have other bug fixes and cleanups around that patch which didn't made it into 5.19 either. I don't want to create an ever greater mess. Real question is why building drm-tip work for me but not for others? Christian. > > [1] - https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fdrm%2Famd%2Fuploads%2F564b2cc2b5ea87357f39e45c3a1a44e2%2F0001-drm-amdgpu-Fix-for-drm-buddy-memory-corruption.patch&data=05%7C01%7Cchristian.koenig%40amd.com%7Cee3322f9e7c54aaabb9f08da659d74a2%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637934024189075602%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=cGS2JZt84FMlA4V57pAA2ilXDC5pvr8ryZcUoHpXKXA%3D&reserved=0 > > Alex > > >> I will double check drm-tip once more. >> >> Regards, >> Christian. >> >> Am 14.07.22 um 14:54 schrieb Mauro Carvalho Chehab: >>> On Fri, 8 Jul 2022 03:21:24 -0700 >>> Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> wrote: >>> >>>> This reverts the following commits: >>>> commit 708d19d9f362 ("drm/amdgpu: move internal vram_mgr function into the C file") >>>> commit 5e3f1e7729ec ("drm/amdgpu: fix start calculation in amdgpu_vram_mgr_new") >>>> commit c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu") >>>> >>>> [WHY] >>>> Few users reported garbaged graphics as soon as x starts, >>>> reverting until this can be resolved. >>>> >>>> Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> >>> This revert is currently breaking drm-tip. Please revert it ASAP, as it >>> is preventing CI bots to properly test new patches on the top of current >>> drm-tip: >>> >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_new’: >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:459:13: error: ‘cur_size’ undeclared (first use in this function) >>> 459 | if (cur_size != size) { >>> | ^~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:459:13: note: each undeclared identifier is reported only once for each function it appears in >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:459:25: error: ‘size’ undeclared (first use in this function); did you mean ‘ksize’? >>> 459 | if (cur_size != size) { >>> | ^~~~ >>> | ksize >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:465:30: error: ‘vres’ undeclared (first use in this function); did you mean ‘res’? >>> 465 | trim_list = &vres->blocks; >>> | ^~~~ >>> | res >>> In file included from ./include/linux/bits.h:22, >>> from ./include/linux/ratelimit_types.h:5, >>> from ./include/linux/ratelimit.h:5, >>> from ./include/linux/dev_printk.h:16, >>> from ./include/linux/device.h:15, >>> from ./include/linux/dma-mapping.h:7, >>> from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25: >>> ./include/linux/container_of.h:19:54: error: invalid use of undefined type ‘struct drm_buddy_block’ >>> 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ >>> | ^~ >>> ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ >>> 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) >>> | ^~~~ >>> ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ >>> 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ >>> | ^~~~~~~~~~~~~ >>> ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ >>> 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ >>> | ^~~~~~~~~~~ >>> ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ >>> 520 | container_of(ptr, type, member) >>> | ^~~~~~~~~~~~ >>> ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’ >>> 542 | list_entry((ptr)->prev, type, member) >>> | ^~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:473:33: note: in expansion of macro ‘list_last_entry’ >>> 473 | block = list_last_entry(&vres->blocks, typeof(*block), link); >>> | ^~~~~~~~~~~~~~~ >>> ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer >>> 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) >>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ >>> 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) >>> | ^~~~ >>> ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ >>> 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ >>> | ^~~~~~~~~~~~~ >>> ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ >>> 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ >>> | ^~~~~~~~~~~ >>> ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ >>> 520 | container_of(ptr, type, member) >>> | ^~~~~~~~~~~~ >>> ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’ >>> 542 | list_entry((ptr)->prev, type, member) >>> | ^~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:473:33: note: in expansion of macro ‘list_last_entry’ >>> 473 | block = list_last_entry(&vres->blocks, typeof(*block), link); >>> | ^~~~~~~~~~~~~~~ >>> In file included from ./include/uapi/linux/posix_types.h:5, >>> from ./include/uapi/linux/types.h:14, >>> from ./include/linux/types.h:6, >>> from ./include/linux/kasan-checks.h:5, >>> from ./include/asm-generic/rwonce.h:26, >>> from ./arch/x86/include/generated/asm/rwonce.h:1, >>> from ./include/linux/compiler.h:248, >>> from ./include/linux/string.h:5, >>> from ./include/linux/dma-mapping.h:6: >>> ./include/linux/stddef.h:16:33: error: invalid use of undefined type ‘struct drm_buddy_block’ >>> 16 | #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER) >>> | ^~~~~~~~~~~~~~~~~~ >>> ./include/linux/container_of.h:22:28: note: in expansion of macro ‘offsetof’ >>> 22 | ((type *)(__mptr - offsetof(type, member))); }) >>> | ^~~~~~~~ >>> ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ >>> 520 | container_of(ptr, type, member) >>> | ^~~~~~~~~~~~ >>> ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’ >>> 542 | list_entry((ptr)->prev, type, member) >>> | ^~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:473:33: note: in expansion of macro ‘list_last_entry’ >>> 473 | block = list_last_entry(&vres->blocks, typeof(*block), link); >>> | ^~~~~~~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:474:46: error: invalid use of undefined type ‘struct drm_buddy_block’ >>> 474 | list_move_tail(&block->link, &temp); >>> | ^~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:480:41: error: implicit declaration of function ‘amdgpu_vram_mgr_block_size’; did you mean ‘amdgpu_vram_mgr_vis_size’? [-Werror=implicit-function-declaration] >>> 480 | original_size = amdgpu_vram_mgr_block_size(block) - (size - cur_size); >>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~ >>> | amdgpu_vram_mgr_vis_size >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:483:28: error: passing argument 1 of ‘mutex_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] >>> 483 | mutex_lock(&mgr->lock); >>> | ^~~~~~~~~~ >>> | | >>> | spinlock_t * {aka struct spinlock *} >>> In file included from ./include/linux/rhashtable-types.h:14, >>> from ./include/linux/ipc.h:7, >>> from ./include/uapi/linux/sem.h:5, >>> from ./include/linux/sem.h:5, >>> from ./include/linux/sched.h:15, >>> from ./include/linux/ratelimit.h:6: >>> ./include/linux/mutex.h:199:38: note: expected ‘struct mutex *’ but argument is of type ‘spinlock_t *’ {aka ‘struct spinlock *’} >>> 199 | extern void mutex_lock(struct mutex *lock); >>> | ~~~~~~~~~~~~~~^~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:484:17: error: implicit declaration of function ‘drm_buddy_block_trim’ [-Werror=implicit-function-declaration] >>> 484 | drm_buddy_block_trim(mm, >>> | ^~~~~~~~~~~~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:487:30: error: passing argument 1 of ‘mutex_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] >>> 487 | mutex_unlock(&mgr->lock); >>> | ^~~~~~~~~~ >>> | | >>> | spinlock_t * {aka struct spinlock *} >>> ./include/linux/mutex.h:218:40: note: expected ‘struct mutex *’ but argument is of type ‘spinlock_t *’ {aka ‘struct spinlock *’} >>> 218 | extern void mutex_unlock(struct mutex *lock); >>> | ~~~~~~~~~~~~~~^~~~ >>> In file included from ./include/linux/rculist.h:10, >>> from ./include/linux/pid.h:5, >>> from ./include/linux/sched.h:14: >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:493:29: error: ‘block’ undeclared (first use in this function); did you mean ‘flock’? >>> 493 | list_for_each_entry(block, &vres->blocks, link) >>> | ^~~~~ >>> ./include/linux/list.h:674:14: note: in definition of macro ‘list_for_each_entry’ >>> 674 | for (pos = list_first_entry(head, typeof(*pos), member); \ >>> | ^~~ >>> ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer >>> 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) >>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ >>> 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) >>> | ^~~~ >>> ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ >>> 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ >>> | ^~~~~~~~~~~~~ >>> ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ >>> 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ >>> | ^~~~~~~~~~~ >>> ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ >>> 520 | container_of(ptr, type, member) >>> | ^~~~~~~~~~~~ >>> ./include/linux/list.h:531:9: note: in expansion of macro ‘list_entry’ >>> 531 | list_entry((ptr)->next, type, member) >>> | ^~~~~~~~~~ >>> ./include/linux/list.h:674:20: note: in expansion of macro ‘list_first_entry’ >>> 674 | for (pos = list_first_entry(head, typeof(*pos), member); \ >>> | ^~~~~~~~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:493:9: note: in expansion of macro ‘list_for_each_entry’ >>> 493 | list_for_each_entry(block, &vres->blocks, link) >>> | ^~~~~~~~~~~~~~~~~~~ >>> ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer >>> 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) >>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ >>> 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) >>> | ^~~~ >>> ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ >>> 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ >>> | ^~~~~~~~~~~~~ >>> ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ >>> 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ >>> | ^~~~~~~~~~~ >>> ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ >>> 520 | container_of(ptr, type, member) >>> | ^~~~~~~~~~~~ >>> ./include/linux/list.h:564:9: note: in expansion of macro ‘list_entry’ >>> 564 | list_entry((pos)->member.next, typeof(*(pos)), member) >>> | ^~~~~~~~~~ >>> ./include/linux/list.h:676:20: note: in expansion of macro ‘list_next_entry’ >>> 676 | pos = list_next_entry(pos, member)) >>> | ^~~~~~~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:493:9: note: in expansion of macro ‘list_for_each_entry’ >>> 493 | list_for_each_entry(block, &vres->blocks, link) >>> | ^~~~~~~~~~~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:496:17: error: implicit declaration of function ‘amdgpu_vram_mgr_first_block’; did you mean ‘amdgpu_vram_mgr_virt_start’? [-Werror=implicit-function-declaration] >>> 496 | block = amdgpu_vram_mgr_first_block(&vres->blocks); >>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> | amdgpu_vram_mgr_virt_start >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:502:28: error: implicit declaration of function ‘amdgpu_vram_mgr_block_start’; did you mean ‘amdgpu_vram_mgr_virt_start’? [-Werror=implicit-function-declaration] >>> 502 | vres->base.start = amdgpu_vram_mgr_block_start(block) >> PAGE_SHIFT; >>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> | amdgpu_vram_mgr_virt_start >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:504:13: error: implicit declaration of function ‘amdgpu_is_vram_mgr_blocks_contiguous’ [-Werror=implicit-function-declaration] >>> 504 | if (amdgpu_is_vram_mgr_blocks_contiguous(&vres->blocks)) >>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> cc1: all warnings being treated as errors >>> make[4]: *** [scripts/Makefile.build:249: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.o] Error 1 >>> make[4]: *** Waiting for unfinished jobs.... >>> make[3]: *** [scripts/Makefile.build:466: drivers/gpu/drm/amd/amdgpu] Error 2 >>> make[2]: *** [scripts/Makefile.build:466: drivers/gpu/drm] Error 2 >>> make[1]: *** [scripts/Makefile.build:466: drivers/gpu] Error 2 >>> make: *** [Makefile:1843: drivers] Error 2 >>> mchehab@sal /new_devel/v4l/tmp $ nano drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c >>> mchehab@sal /new_devel/v4l/tmp $ make drivers/gpu/drm/amd/amdgpu/ >>> DESCEND objtool >>> CALL scripts/atomic/check-atomics.sh >>> CALL scripts/checksyscalls.sh >>> CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.o >>> CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_csa.o >>> CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_ras.o >>> CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.o >>> CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.o >>> CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.o >>> CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.o >>> CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.o >>> CC [M] drivers/gpu/drm/amd/amdgpu/amdgpu_umc.o >>> In file included from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:30: >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h:29:8: error: redefinition of ‘struct amdgpu_vram_mgr’ >>> 29 | struct amdgpu_vram_mgr { >>> | ^~~~~~~~~~~~~~~ >>> In file included from drivers/gpu/drm/amd/amdgpu/amdgpu.h:73, >>> from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:28: >>> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:41:8: note: originally defined here >>> 41 | struct amdgpu_vram_mgr { >>> | ^~~~~~~~~~~~~~~ >>> In file included from ./include/linux/bits.h:22, >>> from ./include/linux/ratelimit_types.h:5, >>> from ./include/linux/ratelimit.h:5, >>> from ./include/linux/dev_printk.h:16, >>> from ./include/linux/device.h:15, >>> from ./include/linux/dma-mapping.h:7, >>> from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25: >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘to_amdgpu_device’: >>> ./include/linux/build_bug.h:78:41: error: static assertion failed: "pointer type mismatch in container_of()" >>> 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) >>> | ^~~~~~~~~~~~~~ >>> ./include/linux/build_bug.h:77:34: note: in expansion of macro ‘__static_assert’ >>> 77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr) >>> | ^~~~~~~~~~~~~~~ >>> ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ >>> 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ >>> | ^~~~~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:49:16: note: in expansion of macro ‘container_of’ >>> 49 | return container_of(mgr, struct amdgpu_device, mman.vram_mgr); >>> | ^~~~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_do_reserve’: >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:244:29: error: initialization of ‘struct drm_mm *’ from incompatible pointer type ‘struct drm_buddy *’ [-Werror=incompatible-pointer-types] >>> 244 | struct drm_mm *mm = &mgr->mm; >>> | ^ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: At top level: >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:273:5: error: conflicting types for ‘amdgpu_vram_mgr_reserve_range’; have ‘int(struct amdgpu_vram_mgr *, uint64_t, uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int, long long unsigned int)’} >>> 273 | int amdgpu_vram_mgr_reserve_range(struct amdgpu_vram_mgr *mgr, >>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:129:5: note: previous declaration of ‘amdgpu_vram_mgr_reserve_range’ with type ‘int(struct amdgpu_vram_mgr *, uint64_t, uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int, long long unsigned int)’} >>> 129 | int amdgpu_vram_mgr_reserve_range(struct amdgpu_vram_mgr *mgr, >>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_reserve_range’: >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:286:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] >>> 286 | spin_lock(&mgr->lock); >>> | ^~~~~~~~~~ >>> | | >>> | struct mutex * >>> In file included from ./include/linux/wait.h:9, >>> from ./include/linux/pid.h:6, >>> from ./include/linux/sched.h:14, >>> from ./include/linux/ratelimit.h:6: >>> ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ >>> 347 | static __always_inline void spin_lock(spinlock_t *lock) >>> | ~~~~~~~~~~~~^~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:289:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] >>> 289 | spin_unlock(&mgr->lock); >>> | ^~~~~~~~~~ >>> | | >>> | struct mutex * >>> ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ >>> 387 | static __always_inline void spin_unlock(spinlock_t *lock) >>> | ~~~~~~~~~~~~^~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: At top level: >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:305:5: error: conflicting types for ‘amdgpu_vram_mgr_query_page_status’; have ‘int(struct amdgpu_vram_mgr *, uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int)’} >>> 305 | int amdgpu_vram_mgr_query_page_status(struct amdgpu_vram_mgr *mgr, >>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:131:5: note: previous declaration of ‘amdgpu_vram_mgr_query_page_status’ with type ‘int(struct amdgpu_vram_mgr *, uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int)’} >>> 131 | int amdgpu_vram_mgr_query_page_status(struct amdgpu_vram_mgr *mgr, >>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_query_page_status’: >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:311:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] >>> 311 | spin_lock(&mgr->lock); >>> | ^~~~~~~~~~ >>> | | >>> | struct mutex * >>> ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ >>> 347 | static __always_inline void spin_lock(spinlock_t *lock) >>> | ~~~~~~~~~~~~^~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:331:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] >>> 331 | spin_unlock(&mgr->lock); >>> | ^~~~~~~~~~ >>> | | >>> | struct mutex * >>> ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ >>> 387 | static __always_inline void spin_unlock(spinlock_t *lock) >>> | ~~~~~~~~~~~~^~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_new’: >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:377:29: error: initialization of ‘struct drm_mm *’ from incompatible pointer type ‘struct drm_buddy *’ [-Werror=incompatible-pointer-types] >>> 377 | struct drm_mm *mm = &mgr->mm; >>> | ^ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:429:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] >>> 429 | spin_lock(&mgr->lock); >>> | ^~~~~~~~~~ >>> | | >>> | struct mutex * >>> ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ >>> 347 | static __always_inline void spin_lock(spinlock_t *lock) >>> | ~~~~~~~~~~~~^~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:458:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] >>> 458 | spin_unlock(&mgr->lock); >>> | ^~~~~~~~~~ >>> | | >>> | struct mutex * >>> ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ >>> 387 | static __always_inline void spin_unlock(spinlock_t *lock) >>> | ~~~~~~~~~~~~^~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:460:13: error: ‘cur_size’ undeclared (first use in this function) >>> 460 | if (cur_size != size) { >>> | ^~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:460:13: note: each undeclared identifier is reported only once for each function it appears in >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:460:25: error: ‘size’ undeclared (first use in this function); did you mean ‘ksize’? >>> 460 | if (cur_size != size) { >>> | ^~~~ >>> | ksize >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:466:30: error: ‘vres’ undeclared (first use in this function); did you mean ‘res’? >>> 466 | trim_list = &vres->blocks; >>> | ^~~~ >>> | res >>> ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer >>> 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) >>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ >>> 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) >>> | ^~~~ >>> ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ >>> 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ >>> | ^~~~~~~~~~~~~ >>> ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ >>> 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ >>> | ^~~~~~~~~~~ >>> ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ >>> 520 | container_of(ptr, type, member) >>> | ^~~~~~~~~~~~ >>> ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’ >>> 542 | list_entry((ptr)->prev, type, member) >>> | ^~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:474:33: note: in expansion of macro ‘list_last_entry’ >>> 474 | block = list_last_entry(&vres->blocks, typeof(*block), link); >>> | ^~~~~~~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:485:38: error: passing argument 1 of ‘drm_buddy_block_trim’ from incompatible pointer type [-Werror=incompatible-pointer-types] >>> 485 | drm_buddy_block_trim(mm, >>> | ^~ >>> | | >>> | struct drm_mm * >>> In file included from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h:27: >>> ./include/drm/drm_buddy.h:146:44: note: expected ‘struct drm_buddy *’ but argument is of type ‘struct drm_mm *’ >>> 146 | int drm_buddy_block_trim(struct drm_buddy *mm, >>> | ~~~~~~~~~~~~~~~~~~^~ >>> In file included from ./include/linux/rculist.h:10, >>> from ./include/linux/pid.h:5: >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:494:29: error: ‘block’ undeclared (first use in this function); did you mean ‘flock’? >>> 494 | list_for_each_entry(block, &vres->blocks, link) >>> | ^~~~~ >>> ./include/linux/list.h:674:14: note: in definition of macro ‘list_for_each_entry’ >>> 674 | for (pos = list_first_entry(head, typeof(*pos), member); \ >>> | ^~~ >>> ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer >>> 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) >>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ >>> 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) >>> | ^~~~ >>> ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ >>> 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ >>> | ^~~~~~~~~~~~~ >>> ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ >>> 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ >>> | ^~~~~~~~~~~ >>> ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ >>> 520 | container_of(ptr, type, member) >>> | ^~~~~~~~~~~~ >>> ./include/linux/list.h:531:9: note: in expansion of macro ‘list_entry’ >>> 531 | list_entry((ptr)->next, type, member) >>> | ^~~~~~~~~~ >>> ./include/linux/list.h:674:20: note: in expansion of macro ‘list_first_entry’ >>> 674 | for (pos = list_first_entry(head, typeof(*pos), member); \ >>> | ^~~~~~~~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:494:9: note: in expansion of macro ‘list_for_each_entry’ >>> 494 | list_for_each_entry(block, &vres->blocks, link) >>> | ^~~~~~~~~~~~~~~~~~~ >>> ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer >>> 295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) >>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’ >>> 78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg) >>> | ^~~~ >>> ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’ >>> 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ >>> | ^~~~~~~~~~~~~ >>> ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’ >>> 19 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \ >>> | ^~~~~~~~~~~ >>> ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’ >>> 520 | container_of(ptr, type, member) >>> | ^~~~~~~~~~~~ >>> ./include/linux/list.h:564:9: note: in expansion of macro ‘list_entry’ >>> 564 | list_entry((pos)->member.next, typeof(*(pos)), member) >>> | ^~~~~~~~~~ >>> ./include/linux/list.h:676:20: note: in expansion of macro ‘list_next_entry’ >>> 676 | pos = list_next_entry(pos, member)) >>> | ^~~~~~~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:494:9: note: in expansion of macro ‘list_for_each_entry’ >>> 494 | list_for_each_entry(block, &vres->blocks, link) >>> | ^~~~~~~~~~~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:520:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] >>> 520 | spin_unlock(&mgr->lock); >>> | ^~~~~~~~~~ >>> | | >>> | struct mutex * >>> ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ >>> 387 | static __always_inline void spin_unlock(spinlock_t *lock) >>> | ~~~~~~~~~~~~^~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_del’: >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:545:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] >>> 545 | spin_lock(&mgr->lock); >>> | ^~~~~~~~~~ >>> | | >>> | struct mutex * >>> ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ >>> 347 | static __always_inline void spin_lock(spinlock_t *lock) >>> | ~~~~~~~~~~~~^~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:554:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] >>> 554 | spin_unlock(&mgr->lock); >>> | ^~~~~~~~~~ >>> | | >>> | struct mutex * >>> ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ >>> 387 | static __always_inline void spin_unlock(spinlock_t *lock) >>> | ~~~~~~~~~~~~^~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: At top level: >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:680:10: error: conflicting types for ‘amdgpu_vram_mgr_vis_usage’; have ‘uint64_t(struct amdgpu_vram_mgr *)’ {aka ‘long long unsigned int(struct amdgpu_vram_mgr *)’} >>> 680 | uint64_t amdgpu_vram_mgr_vis_usage(struct amdgpu_vram_mgr *mgr) >>> | ^~~~~~~~~~~~~~~~~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:128:10: note: previous declaration of ‘amdgpu_vram_mgr_vis_usage’ with type ‘uint64_t(struct amdgpu_vram_mgr *)’ {aka ‘long long unsigned int(struct amdgpu_vram_mgr *)’} >>> 128 | uint64_t amdgpu_vram_mgr_vis_usage(struct amdgpu_vram_mgr *mgr); >>> | ^~~~~~~~~~~~~~~~~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_debug’: >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:701:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] >>> 701 | spin_lock(&mgr->lock); >>> | ^~~~~~~~~~ >>> | | >>> | struct mutex * >>> ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ >>> 347 | static __always_inline void spin_lock(spinlock_t *lock) >>> | ~~~~~~~~~~~~^~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:702:22: error: passing argument 1 of ‘drm_mm_print’ from incompatible pointer type [-Werror=incompatible-pointer-types] >>> 702 | drm_mm_print(&mgr->mm, printer); >>> | ^~~~~~~~ >>> | | >>> | struct drm_buddy * >>> In file included from ./include/drm/ttm/ttm_range_manager.h:8, >>> from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:26: >>> ./include/drm/drm_mm.h:551:40: note: expected ‘const struct drm_mm *’ but argument is of type ‘struct drm_buddy *’ >>> 551 | void drm_mm_print(const struct drm_mm *mm, struct drm_printer *p); >>> | ~~~~~~~~~~~~~~~~~~~~~^~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:703:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] >>> 703 | spin_unlock(&mgr->lock); >>> | ^~~~~~~~~~ >>> | | >>> | struct mutex * >>> ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ >>> 387 | static __always_inline void spin_unlock(spinlock_t *lock) >>> | ~~~~~~~~~~~~^~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_init’: >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:721:39: error: initialization of ‘struct amdgpu_vram_mgr *’ from incompatible pointer type ‘struct amdgpu_vram_mgr *’ [-Werror=incompatible-pointer-types] >>> 721 | struct amdgpu_vram_mgr *mgr = &adev->mman.vram_mgr; >>> | ^ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:729:21: error: passing argument 1 of ‘drm_mm_init’ from incompatible pointer type [-Werror=incompatible-pointer-types] >>> 729 | drm_mm_init(&mgr->mm, 0, man->size >> PAGE_SHIFT); >>> | ^~~~~~~~ >>> | | >>> | struct drm_buddy * >>> ./include/drm/drm_mm.h:467:33: note: expected ‘struct drm_mm *’ but argument is of type ‘struct drm_buddy *’ >>> 467 | void drm_mm_init(struct drm_mm *mm, u64 start, u64 size); >>> | ~~~~~~~~~~~~~~~^~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:730:24: error: passing argument 1 of ‘spinlock_check’ from incompatible pointer type [-Werror=incompatible-pointer-types] >>> 730 | spin_lock_init(&mgr->lock); >>> | ^~~~~~~~~~ >>> | | >>> | struct mutex * >>> ./include/linux/spinlock.h:341:24: note: in definition of macro ‘spin_lock_init’ >>> 341 | spinlock_check(_lock); \ >>> | ^~~~~ >>> ./include/linux/spinlock.h:322:67: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ >>> 322 | static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock) >>> | ~~~~~~~~~~~~^~~~ >>> In file included from ./include/linux/spinlock.h:87: >>> ./include/linux/spinlock_types.h:41:9: error: incompatible types when assigning to type ‘struct mutex’ from type ‘spinlock_t’ {aka ‘struct spinlock’} >>> 41 | (spinlock_t) __SPIN_LOCK_INITIALIZER(lockname) >>> | ^ >>> ./include/linux/spinlock.h:342:20: note: in expansion of macro ‘__SPIN_LOCK_UNLOCKED’ >>> 342 | *(_lock) = __SPIN_LOCK_UNLOCKED(_lock); \ >>> | ^~~~~~~~~~~~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:730:9: note: in expansion of macro ‘spin_lock_init’ >>> 730 | spin_lock_init(&mgr->lock); >>> | ^~~~~~~~~~~~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_fini’: >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:749:39: error: initialization of ‘struct amdgpu_vram_mgr *’ from incompatible pointer type ‘struct amdgpu_vram_mgr *’ [-Werror=incompatible-pointer-types] >>> 749 | struct amdgpu_vram_mgr *mgr = &adev->mman.vram_mgr; >>> | ^ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:760:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types] >>> 760 | spin_lock(&mgr->lock); >>> | ^~~~~~~~~~ >>> | | >>> | struct mutex * >>> ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ >>> 347 | static __always_inline void spin_lock(spinlock_t *lock) >>> | ~~~~~~~~~~~~^~~~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:768:25: error: passing argument 1 of ‘drm_mm_takedown’ from incompatible pointer type [-Werror=incompatible-pointer-types] >>> 768 | drm_mm_takedown(&mgr->mm); >>> | ^~~~~~~~ >>> | | >>> | struct drm_buddy * >>> ./include/drm/drm_mm.h:468:37: note: expected ‘struct drm_mm *’ but argument is of type ‘struct drm_buddy *’ >>> 468 | void drm_mm_takedown(struct drm_mm *mm); >>> | ~~~~~~~~~~~~~~~^~ >>> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:769:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types] >>> 769 | spin_unlock(&mgr->lock); >>> | ^~~~~~~~~~ >>> | | >>> | struct mutex * >>> ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’ >>> 387 | static __always_inline void spin_unlock(spinlock_t *lock) >>> | ~~~~~~~~~~~~^~~~ >>> cc1: all warnings being treated as errors >>> make[4]: *** [scripts/Makefile.build:249: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.o] Error 1 >>> make[4]: *** Waiting for unfinished jobs.... >>> CC [M] drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.o >>> make[3]: *** [scripts/Makefile.build:466: drivers/gpu/drm/amd/amdgpu] Error 2 >>> make[2]: *** [scripts/Makefile.build:466: drivers/gpu/drm] Error 2 >>> make[1]: *** [scripts/Makefile.build:466: drivers/gpu] Error 2 >>> make: *** [Makefile:1843: drivers] Error 2 >>> >>> Regards, >>> Mauro
On Thu, 14 Jul 2022 08:00:32 -0700, Christian König wrote: > > Am 14.07.22 um 15:33 schrieb Alex Deucher: > > On Thu, Jul 14, 2022 at 9:09 AM Christian König > > <christian.koenig@amd.com> wrote: > >> Hi Mauro, > >> > >> well the last time I checked drm-tip was clean. > >> > >> The revert is necessary because we had some problems with the commit > >> which we couldn't fix in the 5.19 cycle. > > Would it be worth reverting the revert and applying the actual fix[1]? > > It's a huge revert unfortunately while the actual fix is like 10 > > lines of code. I'm concerned there will be subtle fallout from the > > revert due to how extensive it is. > > We have other bug fixes and cleanups around that patch which didn't made it > into 5.19 either. I don't want to create an ever greater mess. > > Real question is why building drm-tip work for me but not for others? Seeing this on latest drm-tip: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:54:1: error: redefinition of ‘amdgpu_vram_mgr_first_block’ 54 | amdgpu_vram_mgr_first_block(struct list_head *list) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:29, from drivers/gpu/drm/amd/amdgpu/amdgpu.h:73, from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:28: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h:57:1: note: previous definition of ‘amdgpu_vram_mgr_first_block’ with type ‘struct drm_buddy_block *(struct list_head *)’ 57 | amdgpu_vram_mgr_first_block(struct list_head *list) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:59:20: error: redefinition of ‘amdgpu_is_vram_mgr_blocks_contiguous’ 59 | static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct list_head *head) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h:62:20: note: previous definition of ‘amdgpu_is_vram_mgr_blocks_contiguous’ with type ‘bool(struct list_head *)’ {aka ‘_Bool(struct list_head *)’} 62 | static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct list_head *head) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ make[4]: *** [scripts/Makefile.build:249: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.o] Error 1 make[4]: *** Waiting for unfinished jobs.... make[3]: *** [scripts/Makefile.build:466: drivers/gpu/drm/amd/amdgpu] Error 2 make[2]: *** [scripts/Makefile.build:466: drivers/gpu/drm] Error 2 make[1]: *** [scripts/Makefile.build:466: drivers/gpu] Error 2
Hi When is this relanding? Cheers Mike On Mon, 18 Jul 2022 at 21:40, Dixit, Ashutosh <ashutosh.dixit@intel.com> wrote: > > On Thu, 14 Jul 2022 08:00:32 -0700, Christian König wrote: > > > > Am 14.07.22 um 15:33 schrieb Alex Deucher: > > > On Thu, Jul 14, 2022 at 9:09 AM Christian König > > > <christian.koenig@amd.com> wrote: > > >> Hi Mauro, > > >> > > >> well the last time I checked drm-tip was clean. > > >> > > >> The revert is necessary because we had some problems with the commit > > >> which we couldn't fix in the 5.19 cycle. > > > Would it be worth reverting the revert and applying the actual fix[1]? > > > It's a huge revert unfortunately while the actual fix is like 10 > > > lines of code. I'm concerned there will be subtle fallout from the > > > revert due to how extensive it is. > > > > We have other bug fixes and cleanups around that patch which didn't made it > > into 5.19 either. I don't want to create an ever greater mess. > > > > Real question is why building drm-tip work for me but not for others? > > Seeing this on latest drm-tip: > > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:54:1: error: redefinition of ‘amdgpu_vram_mgr_first_block’ > 54 | amdgpu_vram_mgr_first_block(struct list_head *list) > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > In file included from drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:29, > from drivers/gpu/drm/amd/amdgpu/amdgpu.h:73, > from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:28: > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h:57:1: note: previous definition of ‘amdgpu_vram_mgr_first_block’ with type ‘struct drm_buddy_block *(struct list_head *)’ > 57 | amdgpu_vram_mgr_first_block(struct list_head *list) > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:59:20: error: redefinition of ‘amdgpu_is_vram_mgr_blocks_contiguous’ > 59 | static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct list_head *head) > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h:62:20: note: previous definition of ‘amdgpu_is_vram_mgr_blocks_contiguous’ with type ‘bool(struct list_head *)’ {aka ‘_Bool(struct list_head *)’} > 62 | static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct list_head *head) > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > make[4]: *** [scripts/Makefile.build:249: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.o] Error 1 > make[4]: *** Waiting for unfinished jobs.... > make[3]: *** [scripts/Makefile.build:466: drivers/gpu/drm/amd/amdgpu] Error 2 > make[2]: *** [scripts/Makefile.build:466: drivers/gpu/drm] Error 2 > make[1]: *** [scripts/Makefile.build:466: drivers/gpu] Error 2
On Fri, 5 Aug 2022 at 01:53, Mike Lothian <mike@fireburn.co.uk> wrote: > > Hi > > When is this relanding? It should be in Linus tree now enabled. Dave.
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 6c2256e8474b..d438d5ff8b40 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -272,7 +272,6 @@ config DRM_AMDGPU select HWMON select BACKLIGHT_CLASS_DEVICE select INTERVAL_TREE - select DRM_BUDDY help Choose this option if you have a recent AMD Radeon graphics card. diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_res_cursor.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_res_cursor.h index 6546552e596c..acfa207cf970 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_res_cursor.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_res_cursor.h @@ -30,15 +30,12 @@ #include <drm/ttm/ttm_resource.h> #include <drm/ttm/ttm_range_manager.h> -#include "amdgpu_vram_mgr.h" - /* state back for walking over vram_mgr and gtt_mgr allocations */ struct amdgpu_res_cursor { uint64_t start; uint64_t size; uint64_t remaining; - void *node; - uint32_t mem_type; + struct drm_mm_node *node; }; /** @@ -55,63 +52,27 @@ static inline void amdgpu_res_first(struct ttm_resource *res, uint64_t start, uint64_t size, struct amdgpu_res_cursor *cur) { - struct drm_buddy_block *block; - struct list_head *head, *next; struct drm_mm_node *node; - if (!res) - goto fallback; - - BUG_ON(start + size > res->num_pages << PAGE_SHIFT); - - cur->mem_type = res->mem_type; - - switch (cur->mem_type) { - case TTM_PL_VRAM: - head = &to_amdgpu_vram_mgr_resource(res)->blocks; - - block = list_first_entry_or_null(head, - struct drm_buddy_block, - link); - if (!block) - goto fallback; - - while (start >= amdgpu_vram_mgr_block_size(block)) { - start -= amdgpu_vram_mgr_block_size(block); - - next = block->link.next; - if (next != head) - block = list_entry(next, struct drm_buddy_block, link); - } - - cur->start = amdgpu_vram_mgr_block_start(block) + start; - cur->size = min(amdgpu_vram_mgr_block_size(block) - start, size); - cur->remaining = size; - cur->node = block; - break; - case TTM_PL_TT: - node = to_ttm_range_mgr_node(res)->mm_nodes; - while (start >= node->size << PAGE_SHIFT) - start -= node++->size << PAGE_SHIFT; - - cur->start = (node->start << PAGE_SHIFT) + start; - cur->size = min((node->size << PAGE_SHIFT) - start, size); + if (!res || res->mem_type == TTM_PL_SYSTEM) { + cur->start = start; + cur->size = size; cur->remaining = size; - cur->node = node; - break; - default: - goto fallback; + cur->node = NULL; + WARN_ON(res && start + size > res->num_pages << PAGE_SHIFT); + return; } - return; + BUG_ON(start + size > res->num_pages << PAGE_SHIFT); -fallback: - cur->start = start; - cur->size = size; + node = to_ttm_range_mgr_node(res)->mm_nodes; + while (start >= node->size << PAGE_SHIFT) + start -= node++->size << PAGE_SHIFT; + + cur->start = (node->start << PAGE_SHIFT) + start; + cur->size = min((node->size << PAGE_SHIFT) - start, size); cur->remaining = size; - cur->node = NULL; - WARN_ON(res && start + size > res->num_pages << PAGE_SHIFT); - return; + cur->node = node; } /** @@ -124,9 +85,7 @@ static inline void amdgpu_res_first(struct ttm_resource *res, */ static inline void amdgpu_res_next(struct amdgpu_res_cursor *cur, uint64_t size) { - struct drm_buddy_block *block; - struct drm_mm_node *node; - struct list_head *next; + struct drm_mm_node *node = cur->node; BUG_ON(size > cur->remaining); @@ -140,27 +99,9 @@ static inline void amdgpu_res_next(struct amdgpu_res_cursor *cur, uint64_t size) return; } - switch (cur->mem_type) { - case TTM_PL_VRAM: - block = cur->node; - - next = block->link.next; - block = list_entry(next, struct drm_buddy_block, link); - - cur->node = block; - cur->start = amdgpu_vram_mgr_block_start(block); - cur->size = min(amdgpu_vram_mgr_block_size(block), cur->remaining); - break; - case TTM_PL_TT: - node = cur->node; - - cur->node = ++node; - cur->start = node->start << PAGE_SHIFT; - cur->size = min(node->size << PAGE_SHIFT, cur->remaining); - break; - default: - return; - } + cur->node = ++node; + cur->start = node->start << PAGE_SHIFT; + cur->size = min(node->size << PAGE_SHIFT, cur->remaining); } #endif diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h index 6a70818039dd..9120ae80ef52 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h @@ -26,7 +26,6 @@ #include <linux/dma-direction.h> #include <drm/gpu_scheduler.h> -#include "amdgpu_vram_mgr.h" #include "amdgpu.h" #define AMDGPU_PL_GDS (TTM_PL_PRIV + 0) @@ -39,6 +38,15 @@ #define AMDGPU_POISON 0xd0bed0be +struct amdgpu_vram_mgr { + struct ttm_resource_manager manager; + struct drm_mm mm; + spinlock_t lock; + struct list_head reservations_pending; + struct list_head reserved_pages; + atomic64_t vis_usage; +}; + struct amdgpu_gtt_mgr { struct ttm_resource_manager manager; struct drm_mm mm; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c index 7a5e8a7b4a1b..0a7611648573 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c @@ -32,10 +32,8 @@ #include "atom.h" struct amdgpu_vram_reservation { - u64 start; - u64 size; - struct list_head allocated; - struct list_head blocks; + struct list_head node; + struct drm_mm_node mm_node; }; static inline struct amdgpu_vram_mgr * @@ -50,35 +48,6 @@ to_amdgpu_device(struct amdgpu_vram_mgr *mgr) return container_of(mgr, struct amdgpu_device, mman.vram_mgr); } -static inline struct drm_buddy_block * -amdgpu_vram_mgr_first_block(struct list_head *list) -{ - return list_first_entry_or_null(list, struct drm_buddy_block, link); -} - -static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct list_head *head) -{ - struct drm_buddy_block *block; - u64 start, size; - - block = amdgpu_vram_mgr_first_block(head); - if (!block) - return false; - - while (head != block->link.next) { - start = amdgpu_vram_mgr_block_start(block); - size = amdgpu_vram_mgr_block_size(block); - - block = list_entry(block->link.next, struct drm_buddy_block, link); - if (start + size != amdgpu_vram_mgr_block_start(block)) - return false; - } - - return true; -} - - - /** * DOC: mem_info_vram_total * @@ -217,18 +186,18 @@ const struct attribute_group amdgpu_vram_mgr_attr_group = { }; /** - * amdgpu_vram_mgr_vis_size - Calculate visible block size + * amdgpu_vram_mgr_vis_size - Calculate visible node size * * @adev: amdgpu_device pointer - * @block: DRM BUDDY block structure + * @node: MM node structure * - * Calculate how many bytes of the DRM BUDDY block are inside visible VRAM + * Calculate how many bytes of the MM node are inside visible VRAM */ static u64 amdgpu_vram_mgr_vis_size(struct amdgpu_device *adev, - struct drm_buddy_block *block) + struct drm_mm_node *node) { - u64 start = amdgpu_vram_mgr_block_start(block); - u64 end = start + amdgpu_vram_mgr_block_size(block); + uint64_t start = node->start << PAGE_SHIFT; + uint64_t end = (node->size + node->start) << PAGE_SHIFT; if (start >= adev->gmc.visible_vram_size) return 0; @@ -249,9 +218,9 @@ u64 amdgpu_vram_mgr_bo_visible_size(struct amdgpu_bo *bo) { struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); struct ttm_resource *res = bo->tbo.resource; - struct amdgpu_vram_mgr_resource *vres = to_amdgpu_vram_mgr_resource(res); - struct drm_buddy_block *block; - u64 usage = 0; + unsigned pages = res->num_pages; + struct drm_mm_node *mm; + u64 usage; if (amdgpu_gmc_vram_full_visible(&adev->gmc)) return amdgpu_bo_size(bo); @@ -259,8 +228,9 @@ u64 amdgpu_vram_mgr_bo_visible_size(struct amdgpu_bo *bo) if (res->start >= adev->gmc.visible_vram_size >> PAGE_SHIFT) return 0; - list_for_each_entry(block, &vres->blocks, link) - usage += amdgpu_vram_mgr_vis_size(adev, block); + mm = &container_of(res, struct ttm_range_mgr_node, base)->mm_nodes[0]; + for (usage = 0; pages; pages -= mm->size, mm++) + usage += amdgpu_vram_mgr_vis_size(adev, mm); return usage; } @@ -270,30 +240,23 @@ static void amdgpu_vram_mgr_do_reserve(struct ttm_resource_manager *man) { struct amdgpu_vram_mgr *mgr = to_vram_mgr(man); struct amdgpu_device *adev = to_amdgpu_device(mgr); - struct drm_buddy *mm = &mgr->mm; + struct drm_mm *mm = &mgr->mm; struct amdgpu_vram_reservation *rsv, *temp; - struct drm_buddy_block *block; uint64_t vis_usage; - list_for_each_entry_safe(rsv, temp, &mgr->reservations_pending, blocks) { - if (drm_buddy_alloc_blocks(mm, rsv->start, rsv->start + rsv->size, - rsv->size, mm->chunk_size, &rsv->allocated, - DRM_BUDDY_RANGE_ALLOCATION)) - continue; - - block = amdgpu_vram_mgr_first_block(&rsv->allocated); - if (!block) + list_for_each_entry_safe(rsv, temp, &mgr->reservations_pending, node) { + if (drm_mm_reserve_node(mm, &rsv->mm_node)) continue; dev_dbg(adev->dev, "Reservation 0x%llx - %lld, Succeeded\n", - rsv->start, rsv->size); + rsv->mm_node.start, rsv->mm_node.size); - vis_usage = amdgpu_vram_mgr_vis_size(adev, block); + vis_usage = amdgpu_vram_mgr_vis_size(adev, &rsv->mm_node); atomic64_add(vis_usage, &mgr->vis_usage); spin_lock(&man->bdev->lru_lock); - man->usage += rsv->size; + man->usage += rsv->mm_node.size << PAGE_SHIFT; spin_unlock(&man->bdev->lru_lock); - list_move(&rsv->blocks, &mgr->reserved_pages); + list_move(&rsv->node, &mgr->reserved_pages); } } @@ -315,16 +278,14 @@ int amdgpu_vram_mgr_reserve_range(struct amdgpu_vram_mgr *mgr, if (!rsv) return -ENOMEM; - INIT_LIST_HEAD(&rsv->allocated); - INIT_LIST_HEAD(&rsv->blocks); - - rsv->start = start; - rsv->size = size; + INIT_LIST_HEAD(&rsv->node); + rsv->mm_node.start = start >> PAGE_SHIFT; + rsv->mm_node.size = size >> PAGE_SHIFT; - mutex_lock(&mgr->lock); - list_add_tail(&rsv->blocks, &mgr->reservations_pending); + spin_lock(&mgr->lock); + list_add_tail(&rsv->node, &mgr->reservations_pending); amdgpu_vram_mgr_do_reserve(&mgr->manager); - mutex_unlock(&mgr->lock); + spin_unlock(&mgr->lock); return 0; } @@ -346,19 +307,19 @@ int amdgpu_vram_mgr_query_page_status(struct amdgpu_vram_mgr *mgr, struct amdgpu_vram_reservation *rsv; int ret; - mutex_lock(&mgr->lock); + spin_lock(&mgr->lock); - list_for_each_entry(rsv, &mgr->reservations_pending, blocks) { - if (rsv->start <= start && - (start < (rsv->start + rsv->size))) { + list_for_each_entry(rsv, &mgr->reservations_pending, node) { + if ((rsv->mm_node.start <= start) && + (start < (rsv->mm_node.start + rsv->mm_node.size))) { ret = -EBUSY; goto out; } } - list_for_each_entry(rsv, &mgr->reserved_pages, blocks) { - if (rsv->start <= start && - (start < (rsv->start + rsv->size))) { + list_for_each_entry(rsv, &mgr->reserved_pages, node) { + if ((rsv->mm_node.start <= start) && + (start < (rsv->mm_node.start + rsv->mm_node.size))) { ret = 0; goto out; } @@ -366,10 +327,32 @@ int amdgpu_vram_mgr_query_page_status(struct amdgpu_vram_mgr *mgr, ret = -ENOENT; out: - mutex_unlock(&mgr->lock); + spin_unlock(&mgr->lock); return ret; } +/** + * amdgpu_vram_mgr_virt_start - update virtual start address + * + * @mem: ttm_resource to update + * @node: just allocated node + * + * Calculate a virtual BO start address to easily check if everything is CPU + * accessible. + */ +static void amdgpu_vram_mgr_virt_start(struct ttm_resource *mem, + struct drm_mm_node *node) +{ + unsigned long start; + + start = node->start + node->size; + if (start > mem->num_pages) + start -= mem->num_pages; + else + start = 0; + mem->start = max(mem->start, start); +} + /** * amdgpu_vram_mgr_new - allocate new ranges * @@ -385,44 +368,46 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man, const struct ttm_place *place, struct ttm_resource **res) { - u64 vis_usage = 0, max_bytes, cur_size, min_block_size; + unsigned long lpfn, num_nodes, pages_per_node, pages_left, pages; struct amdgpu_vram_mgr *mgr = to_vram_mgr(man); struct amdgpu_device *adev = to_amdgpu_device(mgr); - struct amdgpu_vram_mgr_resource *vres; - u64 size, remaining_size, lpfn, fpfn; - struct drm_buddy *mm = &mgr->mm; - struct drm_buddy_block *block; - unsigned long pages_per_block; + uint64_t vis_usage = 0, mem_bytes, max_bytes; + struct ttm_range_mgr_node *node; + struct drm_mm *mm = &mgr->mm; + enum drm_mm_insert_mode mode; + unsigned i; int r; - lpfn = place->lpfn << PAGE_SHIFT; + lpfn = place->lpfn; if (!lpfn) - lpfn = man->size; - - fpfn = place->fpfn << PAGE_SHIFT; + lpfn = man->size >> PAGE_SHIFT; max_bytes = adev->gmc.mc_vram_size; if (tbo->type != ttm_bo_type_kernel) max_bytes -= AMDGPU_VM_RESERVED_VRAM; + mem_bytes = tbo->base.size; if (place->flags & TTM_PL_FLAG_CONTIGUOUS) { - pages_per_block = ~0ul; + pages_per_node = ~0ul; + num_nodes = 1; } else { #ifdef CONFIG_TRANSPARENT_HUGEPAGE - pages_per_block = HPAGE_PMD_NR; + pages_per_node = HPAGE_PMD_NR; #else /* default to 2MB */ - pages_per_block = 2UL << (20UL - PAGE_SHIFT); + pages_per_node = 2UL << (20UL - PAGE_SHIFT); #endif - pages_per_block = max_t(uint32_t, pages_per_block, - tbo->page_alignment); + pages_per_node = max_t(uint32_t, pages_per_node, + tbo->page_alignment); + num_nodes = DIV_ROUND_UP_ULL(PFN_UP(mem_bytes), pages_per_node); } - vres = kzalloc(sizeof(*vres), GFP_KERNEL); - if (!vres) + node = kvmalloc(struct_size(node, mm_nodes, num_nodes), + GFP_KERNEL | __GFP_ZERO); + if (!node) return -ENOMEM; - ttm_resource_init(tbo, place, &vres->base); + ttm_resource_init(tbo, place, &node->base); /* bail out quickly if there's likely not enough VRAM for this BO */ if (ttm_resource_manager_usage(man) > max_bytes) { @@ -430,136 +415,66 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man, goto error_fini; } - INIT_LIST_HEAD(&vres->blocks); - + mode = DRM_MM_INSERT_BEST; if (place->flags & TTM_PL_FLAG_TOPDOWN) - vres->flags |= DRM_BUDDY_TOPDOWN_ALLOCATION; - - if (fpfn || lpfn != man->size) - /* Allocate blocks in desired range */ - vres->flags |= DRM_BUDDY_RANGE_ALLOCATION; - - remaining_size = vres->base.num_pages << PAGE_SHIFT; - - mutex_lock(&mgr->lock); - while (remaining_size) { - if (tbo->page_alignment) - min_block_size = tbo->page_alignment << PAGE_SHIFT; - else - min_block_size = mgr->default_page_size; - - BUG_ON(min_block_size < mm->chunk_size); - - /* Limit maximum size to 2GiB due to SG table limitations */ - size = min(remaining_size, 2ULL << 30); - - if (size >= pages_per_block << PAGE_SHIFT) - min_block_size = pages_per_block << PAGE_SHIFT; - - cur_size = size; - - if (fpfn + size != place->lpfn << PAGE_SHIFT) { - /* - * Except for actual range allocation, modify the size and - * min_block_size conforming to continuous flag enablement - */ - if (place->flags & TTM_PL_FLAG_CONTIGUOUS) { - size = roundup_pow_of_two(size); - min_block_size = size; - /* - * Modify the size value if size is not - * aligned with min_block_size - */ - } else if (!IS_ALIGNED(size, min_block_size)) { - size = round_up(size, min_block_size); + mode = DRM_MM_INSERT_HIGH; + + pages_left = node->base.num_pages; + + /* Limit maximum size to 2GB due to SG table limitations */ + pages = min(pages_left, 2UL << (30 - PAGE_SHIFT)); + + i = 0; + spin_lock(&mgr->lock); + while (pages_left) { + uint32_t alignment = tbo->page_alignment; + + if (pages >= pages_per_node) + alignment = pages_per_node; + + r = drm_mm_insert_node_in_range(mm, &node->mm_nodes[i], pages, + alignment, 0, place->fpfn, + lpfn, mode); + if (unlikely(r)) { + if (pages > pages_per_node) { + if (is_power_of_2(pages)) + pages = pages / 2; + else + pages = rounddown_pow_of_two(pages); + continue; } + goto error_free; } - r = drm_buddy_alloc_blocks(mm, fpfn, - lpfn, - size, - min_block_size, - &vres->blocks, - vres->flags); - if (unlikely(r)) - goto error_free_blocks; - - if (size > remaining_size) - remaining_size = 0; - else - remaining_size -= size; - } - mutex_unlock(&mgr->lock); - - if (cur_size != size) { - struct drm_buddy_block *block; - struct list_head *trim_list; - u64 original_size; - LIST_HEAD(temp); - - trim_list = &vres->blocks; - original_size = vres->base.num_pages << PAGE_SHIFT; - - /* - * If size value is rounded up to min_block_size, trim the last - * block to the required size - */ - if (!list_is_singular(&vres->blocks)) { - block = list_last_entry(&vres->blocks, typeof(*block), link); - list_move_tail(&block->link, &temp); - trim_list = &temp; - /* - * Compute the original_size value by subtracting the - * last block size with (aligned size - original size) - */ - original_size = amdgpu_vram_mgr_block_size(block) - (size - cur_size); - } - - mutex_lock(&mgr->lock); - drm_buddy_block_trim(mm, - original_size, - trim_list); - mutex_unlock(&mgr->lock); - - if (!list_empty(&temp)) - list_splice_tail(trim_list, &vres->blocks); - } - - vres->base.start = 0; - list_for_each_entry(block, &vres->blocks, link) { - unsigned long start; - - start = amdgpu_vram_mgr_block_start(block) + - amdgpu_vram_mgr_block_size(block); - start >>= PAGE_SHIFT; + vis_usage += amdgpu_vram_mgr_vis_size(adev, &node->mm_nodes[i]); + amdgpu_vram_mgr_virt_start(&node->base, &node->mm_nodes[i]); + pages_left -= pages; + ++i; - if (start > vres->base.num_pages) - start -= vres->base.num_pages; - else - start = 0; - vres->base.start = max(vres->base.start, start); - - vis_usage += amdgpu_vram_mgr_vis_size(adev, block); + if (pages > pages_left) + pages = pages_left; } + spin_unlock(&mgr->lock); - if (amdgpu_is_vram_mgr_blocks_contiguous(&vres->blocks)) - vres->base.placement |= TTM_PL_FLAG_CONTIGUOUS; + if (i == 1) + node->base.placement |= TTM_PL_FLAG_CONTIGUOUS; if (adev->gmc.xgmi.connected_to_cpu) - vres->base.bus.caching = ttm_cached; + node->base.bus.caching = ttm_cached; else - vres->base.bus.caching = ttm_write_combined; + node->base.bus.caching = ttm_write_combined; atomic64_add(vis_usage, &mgr->vis_usage); - *res = &vres->base; + *res = &node->base; return 0; -error_free_blocks: - drm_buddy_free_list(mm, &vres->blocks); - mutex_unlock(&mgr->lock); +error_free: + while (i--) + drm_mm_remove_node(&node->mm_nodes[i]); + spin_unlock(&mgr->lock); error_fini: - ttm_resource_fini(man, &vres->base); - kfree(vres); + ttm_resource_fini(man, &node->base); + kvfree(node); return r; } @@ -575,26 +490,27 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man, static void amdgpu_vram_mgr_del(struct ttm_resource_manager *man, struct ttm_resource *res) { - struct amdgpu_vram_mgr_resource *vres = to_amdgpu_vram_mgr_resource(res); + struct ttm_range_mgr_node *node = to_ttm_range_mgr_node(res); struct amdgpu_vram_mgr *mgr = to_vram_mgr(man); struct amdgpu_device *adev = to_amdgpu_device(mgr); - struct drm_buddy *mm = &mgr->mm; - struct drm_buddy_block *block; uint64_t vis_usage = 0; + unsigned i, pages; - mutex_lock(&mgr->lock); - list_for_each_entry(block, &vres->blocks, link) - vis_usage += amdgpu_vram_mgr_vis_size(adev, block); + spin_lock(&mgr->lock); + for (i = 0, pages = res->num_pages; pages; + pages -= node->mm_nodes[i].size, ++i) { + struct drm_mm_node *mm = &node->mm_nodes[i]; + drm_mm_remove_node(mm); + vis_usage += amdgpu_vram_mgr_vis_size(adev, mm); + } amdgpu_vram_mgr_do_reserve(man); - - drm_buddy_free_list(mm, &vres->blocks); - mutex_unlock(&mgr->lock); + spin_unlock(&mgr->lock); atomic64_sub(vis_usage, &mgr->vis_usage); ttm_resource_fini(man, res); - kfree(vres); + kvfree(node); } /** @@ -626,7 +542,7 @@ int amdgpu_vram_mgr_alloc_sgt(struct amdgpu_device *adev, if (!*sgt) return -ENOMEM; - /* Determine the number of DRM_BUDDY blocks to export */ + /* Determine the number of DRM_MM nodes to export */ amdgpu_res_first(res, offset, length, &cursor); while (cursor.remaining) { num_entries++; @@ -642,10 +558,10 @@ int amdgpu_vram_mgr_alloc_sgt(struct amdgpu_device *adev, sg->length = 0; /* - * Walk down DRM_BUDDY blocks to populate scatterlist nodes - * @note: Use iterator api to get first the DRM_BUDDY block + * Walk down DRM_MM nodes to populate scatterlist nodes + * @note: Use iterator api to get first the DRM_MM node * and the number of bytes from it. Access the following - * DRM_BUDDY block(s) if more buffer needs to exported + * DRM_MM node(s) if more buffer needs to exported */ amdgpu_res_first(res, offset, length, &cursor); for_each_sgtable_sg((*sgt), sg, i) { @@ -732,22 +648,13 @@ static void amdgpu_vram_mgr_debug(struct ttm_resource_manager *man, struct drm_printer *printer) { struct amdgpu_vram_mgr *mgr = to_vram_mgr(man); - struct drm_buddy *mm = &mgr->mm; - struct drm_buddy_block *block; drm_printf(printer, " vis usage:%llu\n", amdgpu_vram_mgr_vis_usage(mgr)); - mutex_lock(&mgr->lock); - drm_printf(printer, "default_page_size: %lluKiB\n", - mgr->default_page_size >> 10); - - drm_buddy_print(mm, printer); - - drm_printf(printer, "reserved:\n"); - list_for_each_entry(block, &mgr->reserved_pages, link) - drm_buddy_block_print(mm, block, printer); - mutex_unlock(&mgr->lock); + spin_lock(&mgr->lock); + drm_mm_print(&mgr->mm, printer); + spin_unlock(&mgr->lock); } static const struct ttm_resource_manager_func amdgpu_vram_mgr_func = { @@ -767,21 +674,16 @@ int amdgpu_vram_mgr_init(struct amdgpu_device *adev) { struct amdgpu_vram_mgr *mgr = &adev->mman.vram_mgr; struct ttm_resource_manager *man = &mgr->manager; - int err; ttm_resource_manager_init(man, &adev->mman.bdev, adev->gmc.real_vram_size); man->func = &amdgpu_vram_mgr_func; - err = drm_buddy_init(&mgr->mm, man->size, PAGE_SIZE); - if (err) - return err; - - mutex_init(&mgr->lock); + drm_mm_init(&mgr->mm, 0, man->size >> PAGE_SHIFT); + spin_lock_init(&mgr->lock); INIT_LIST_HEAD(&mgr->reservations_pending); INIT_LIST_HEAD(&mgr->reserved_pages); - mgr->default_page_size = PAGE_SIZE; ttm_set_driver_manager(&adev->mman.bdev, TTM_PL_VRAM, &mgr->manager); ttm_resource_manager_set_used(man, true); @@ -809,16 +711,16 @@ void amdgpu_vram_mgr_fini(struct amdgpu_device *adev) if (ret) return; - mutex_lock(&mgr->lock); - list_for_each_entry_safe(rsv, temp, &mgr->reservations_pending, blocks) + spin_lock(&mgr->lock); + list_for_each_entry_safe(rsv, temp, &mgr->reservations_pending, node) kfree(rsv); - list_for_each_entry_safe(rsv, temp, &mgr->reserved_pages, blocks) { - drm_buddy_free_list(&mgr->mm, &rsv->blocks); + list_for_each_entry_safe(rsv, temp, &mgr->reserved_pages, node) { + drm_mm_remove_node(&rsv->mm_node); kfree(rsv); } - drm_buddy_fini(&mgr->mm); - mutex_unlock(&mgr->lock); + drm_mm_takedown(&mgr->mm); + spin_unlock(&mgr->lock); ttm_resource_manager_cleanup(man); ttm_set_driver_manager(&adev->mman.bdev, TTM_PL_VRAM, NULL); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h deleted file mode 100644 index 4b267bf1c5db..000000000000 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h +++ /dev/null @@ -1,62 +0,0 @@ -/* SPDX-License-Identifier: MIT - * Copyright 2021 Advanced Micro Devices, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - */ - -#ifndef __AMDGPU_VRAM_MGR_H__ -#define __AMDGPU_VRAM_MGR_H__ - -#include <drm/drm_buddy.h> - -struct amdgpu_vram_mgr { - struct ttm_resource_manager manager; - struct drm_buddy mm; - /* protects access to buffer objects */ - struct mutex lock; - struct list_head reservations_pending; - struct list_head reserved_pages; - atomic64_t vis_usage; - u64 default_page_size; -}; - -struct amdgpu_vram_mgr_resource { - struct ttm_resource base; - struct list_head blocks; - unsigned long flags; -}; - -static inline u64 amdgpu_vram_mgr_block_start(struct drm_buddy_block *block) -{ - return drm_buddy_block_offset(block); -} - -static inline u64 amdgpu_vram_mgr_block_size(struct drm_buddy_block *block) -{ - return PAGE_SIZE << drm_buddy_block_order(block); -} - -static inline struct amdgpu_vram_mgr_resource * -to_amdgpu_vram_mgr_resource(struct ttm_resource *res) -{ - return container_of(res, struct amdgpu_vram_mgr_resource, base); -} - -#endif
This reverts the following commits: commit 708d19d9f362 ("drm/amdgpu: move internal vram_mgr function into the C file") commit 5e3f1e7729ec ("drm/amdgpu: fix start calculation in amdgpu_vram_mgr_new") commit c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu") [WHY] Few users reported garbaged graphics as soon as x starts, reverting until this can be resolved. Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> --- drivers/gpu/drm/Kconfig | 1 - .../gpu/drm/amd/amdgpu/amdgpu_res_cursor.h | 97 +---- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 10 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 394 +++++++----------- drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h | 62 --- 5 files changed, 176 insertions(+), 388 deletions(-) delete mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h