Commit f581dbb3 authored by Dave Airlie's avatar Dave Airlie

Merge tag 'drm-misc-fixes-2024-02-22' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes

A list handling fix and 64bit division on 32bit platform fix for the
drm/buddy allocator, a cast warning and an initialization fix for
nouveau, a bridge handling fix for meson, an initialisation fix for
ivpu, a SPARC build fix for fbdev, a double-free fix for ttm, and two
fence handling fixes for syncobj.
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Maxime Ripard <mripard@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/gl2antuifidtzn3dfm426p7xwh5fxj23behagwh26owfnosh2w@gqoa7vj5prnh
parents b401b621 2aa6f5b0
...@@ -60,7 +60,7 @@ libs-y += arch/sparc/prom/ ...@@ -60,7 +60,7 @@ libs-y += arch/sparc/prom/
libs-y += arch/sparc/lib/ libs-y += arch/sparc/lib/
drivers-$(CONFIG_PM) += arch/sparc/power/ drivers-$(CONFIG_PM) += arch/sparc/power/
drivers-$(CONFIG_FB) += arch/sparc/video/ drivers-$(CONFIG_FB_CORE) += arch/sparc/video/
boot := arch/sparc/boot boot := arch/sparc/boot
......
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_FB) += fbdev.o obj-$(CONFIG_FB_CORE) += fbdev.o
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#define SKU_HW_ID_SHIFT 16u #define SKU_HW_ID_SHIFT 16u
#define SKU_HW_ID_MASK 0xffff0000u #define SKU_HW_ID_MASK 0xffff0000u
#define PLL_CONFIG_DEFAULT 0x1 #define PLL_CONFIG_DEFAULT 0x0
#define PLL_CDYN_DEFAULT 0x80 #define PLL_CDYN_DEFAULT 0x80
#define PLL_EPP_DEFAULT 0x80 #define PLL_EPP_DEFAULT 0x80
#define PLL_REF_CLK_FREQ (50 * 1000000) #define PLL_REF_CLK_FREQ (50 * 1000000)
......
...@@ -538,13 +538,13 @@ static int __alloc_range(struct drm_buddy *mm, ...@@ -538,13 +538,13 @@ static int __alloc_range(struct drm_buddy *mm,
list_add(&block->left->tmp_link, dfs); list_add(&block->left->tmp_link, dfs);
} while (1); } while (1);
list_splice_tail(&allocated, blocks);
if (total_allocated < size) { if (total_allocated < size) {
err = -ENOSPC; err = -ENOSPC;
goto err_free; goto err_free;
} }
list_splice_tail(&allocated, blocks);
return 0; return 0;
err_undo: err_undo:
......
...@@ -1040,7 +1040,8 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, ...@@ -1040,7 +1040,8 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs,
uint64_t *points; uint64_t *points;
uint32_t signaled_count, i; uint32_t signaled_count, i;
if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) if (flags & (DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT |
DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE))
lockdep_assert_none_held_once(); lockdep_assert_none_held_once();
points = kmalloc_array(count, sizeof(*points), GFP_KERNEL); points = kmalloc_array(count, sizeof(*points), GFP_KERNEL);
...@@ -1109,7 +1110,8 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, ...@@ -1109,7 +1110,8 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs,
* fallthough and try a 0 timeout wait! * fallthough and try a 0 timeout wait!
*/ */
if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) { if (flags & (DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT |
DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE)) {
for (i = 0; i < count; ++i) for (i = 0; i < count; ++i)
drm_syncobj_fence_add_wait(syncobjs[i], &entries[i]); drm_syncobj_fence_add_wait(syncobjs[i], &entries[i]);
} }
...@@ -1416,10 +1418,21 @@ syncobj_eventfd_entry_func(struct drm_syncobj *syncobj, ...@@ -1416,10 +1418,21 @@ syncobj_eventfd_entry_func(struct drm_syncobj *syncobj,
/* This happens inside the syncobj lock */ /* This happens inside the syncobj lock */
fence = dma_fence_get(rcu_dereference_protected(syncobj->fence, 1)); fence = dma_fence_get(rcu_dereference_protected(syncobj->fence, 1));
if (!fence)
return;
ret = dma_fence_chain_find_seqno(&fence, entry->point); ret = dma_fence_chain_find_seqno(&fence, entry->point);
if (ret != 0 || !fence) { if (ret != 0) {
/* The given seqno has not been submitted yet. */
dma_fence_put(fence); dma_fence_put(fence);
return; return;
} else if (!fence) {
/* If dma_fence_chain_find_seqno returns 0 but sets the fence
* to NULL, it implies that the given seqno is signaled and a
* later seqno has already been submitted. Assign a stub fence
* so that the eventfd still gets signaled below.
*/
fence = dma_fence_get_stub();
} }
list_del_init(&entry->node); list_del_init(&entry->node);
......
...@@ -294,6 +294,5 @@ void meson_encoder_cvbs_remove(struct meson_drm *priv) ...@@ -294,6 +294,5 @@ void meson_encoder_cvbs_remove(struct meson_drm *priv)
if (priv->encoders[MESON_ENC_CVBS]) { if (priv->encoders[MESON_ENC_CVBS]) {
meson_encoder_cvbs = priv->encoders[MESON_ENC_CVBS]; meson_encoder_cvbs = priv->encoders[MESON_ENC_CVBS];
drm_bridge_remove(&meson_encoder_cvbs->bridge); drm_bridge_remove(&meson_encoder_cvbs->bridge);
drm_bridge_remove(meson_encoder_cvbs->next_bridge);
} }
} }
...@@ -168,6 +168,5 @@ void meson_encoder_dsi_remove(struct meson_drm *priv) ...@@ -168,6 +168,5 @@ void meson_encoder_dsi_remove(struct meson_drm *priv)
if (priv->encoders[MESON_ENC_DSI]) { if (priv->encoders[MESON_ENC_DSI]) {
meson_encoder_dsi = priv->encoders[MESON_ENC_DSI]; meson_encoder_dsi = priv->encoders[MESON_ENC_DSI];
drm_bridge_remove(&meson_encoder_dsi->bridge); drm_bridge_remove(&meson_encoder_dsi->bridge);
drm_bridge_remove(meson_encoder_dsi->next_bridge);
} }
} }
...@@ -474,6 +474,5 @@ void meson_encoder_hdmi_remove(struct meson_drm *priv) ...@@ -474,6 +474,5 @@ void meson_encoder_hdmi_remove(struct meson_drm *priv)
if (priv->encoders[MESON_ENC_HDMI]) { if (priv->encoders[MESON_ENC_HDMI]) {
meson_encoder_hdmi = priv->encoders[MESON_ENC_HDMI]; meson_encoder_hdmi = priv->encoders[MESON_ENC_HDMI];
drm_bridge_remove(&meson_encoder_hdmi->bridge); drm_bridge_remove(&meson_encoder_hdmi->bridge);
drm_bridge_remove(meson_encoder_hdmi->next_bridge);
} }
} }
...@@ -168,12 +168,11 @@ r535_bar_new_(const struct nvkm_bar_func *hw, struct nvkm_device *device, ...@@ -168,12 +168,11 @@ r535_bar_new_(const struct nvkm_bar_func *hw, struct nvkm_device *device,
rm->flush = r535_bar_flush; rm->flush = r535_bar_flush;
ret = gf100_bar_new_(rm, device, type, inst, &bar); ret = gf100_bar_new_(rm, device, type, inst, &bar);
*pbar = bar;
if (ret) { if (ret) {
if (!bar)
kfree(rm); kfree(rm);
return ret; return ret;
} }
*pbar = bar;
bar->flushBAR2PhysMode = ioremap(device->func->resource_addr(device, 3), PAGE_SIZE); bar->flushBAR2PhysMode = ioremap(device->func->resource_addr(device, 3), PAGE_SIZE);
if (!bar->flushBAR2PhysMode) if (!bar->flushBAR2PhysMode)
......
...@@ -154,11 +154,17 @@ shadow_fw_init(struct nvkm_bios *bios, const char *name) ...@@ -154,11 +154,17 @@ shadow_fw_init(struct nvkm_bios *bios, const char *name)
return (void *)fw; return (void *)fw;
} }
static void
shadow_fw_release(void *fw)
{
release_firmware(fw);
}
static const struct nvbios_source static const struct nvbios_source
shadow_fw = { shadow_fw = {
.name = "firmware", .name = "firmware",
.init = shadow_fw_init, .init = shadow_fw_init,
.fini = (void(*)(void *))release_firmware, .fini = shadow_fw_release,
.read = shadow_fw_read, .read = shadow_fw_read,
.rw = false, .rw = false,
}; };
......
...@@ -21,7 +21,7 @@ static inline u64 get_size(int order, u64 chunk_size) ...@@ -21,7 +21,7 @@ static inline u64 get_size(int order, u64 chunk_size)
static void drm_test_buddy_alloc_contiguous(struct kunit *test) static void drm_test_buddy_alloc_contiguous(struct kunit *test)
{ {
u64 mm_size, ps = SZ_4K, i, n_pages, total; u32 mm_size, ps = SZ_4K, i, n_pages, total;
struct drm_buddy_block *block; struct drm_buddy_block *block;
struct drm_buddy mm; struct drm_buddy mm;
LIST_HEAD(left); LIST_HEAD(left);
...@@ -56,30 +56,30 @@ static void drm_test_buddy_alloc_contiguous(struct kunit *test) ...@@ -56,30 +56,30 @@ static void drm_test_buddy_alloc_contiguous(struct kunit *test)
KUNIT_ASSERT_FALSE_MSG(test, KUNIT_ASSERT_FALSE_MSG(test,
drm_buddy_alloc_blocks(&mm, 0, mm_size, drm_buddy_alloc_blocks(&mm, 0, mm_size,
ps, ps, list, 0), ps, ps, list, 0),
"buddy_alloc hit an error size=%d\n", "buddy_alloc hit an error size=%u\n",
ps); ps);
} while (++i < n_pages); } while (++i < n_pages);
KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size, KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size,
3 * ps, ps, &allocated, 3 * ps, ps, &allocated,
DRM_BUDDY_CONTIGUOUS_ALLOCATION), DRM_BUDDY_CONTIGUOUS_ALLOCATION),
"buddy_alloc didn't error size=%d\n", 3 * ps); "buddy_alloc didn't error size=%u\n", 3 * ps);
drm_buddy_free_list(&mm, &middle); drm_buddy_free_list(&mm, &middle);
KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size, KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size,
3 * ps, ps, &allocated, 3 * ps, ps, &allocated,
DRM_BUDDY_CONTIGUOUS_ALLOCATION), DRM_BUDDY_CONTIGUOUS_ALLOCATION),
"buddy_alloc didn't error size=%llu\n", 3 * ps); "buddy_alloc didn't error size=%u\n", 3 * ps);
KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size, KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size,
2 * ps, ps, &allocated, 2 * ps, ps, &allocated,
DRM_BUDDY_CONTIGUOUS_ALLOCATION), DRM_BUDDY_CONTIGUOUS_ALLOCATION),
"buddy_alloc didn't error size=%llu\n", 2 * ps); "buddy_alloc didn't error size=%u\n", 2 * ps);
drm_buddy_free_list(&mm, &right); drm_buddy_free_list(&mm, &right);
KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size, KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size,
3 * ps, ps, &allocated, 3 * ps, ps, &allocated,
DRM_BUDDY_CONTIGUOUS_ALLOCATION), DRM_BUDDY_CONTIGUOUS_ALLOCATION),
"buddy_alloc didn't error size=%llu\n", 3 * ps); "buddy_alloc didn't error size=%u\n", 3 * ps);
/* /*
* At this point we should have enough contiguous space for 2 blocks, * At this point we should have enough contiguous space for 2 blocks,
* however they are never buddies (since we freed middle and right) so * however they are never buddies (since we freed middle and right) so
...@@ -88,13 +88,13 @@ static void drm_test_buddy_alloc_contiguous(struct kunit *test) ...@@ -88,13 +88,13 @@ static void drm_test_buddy_alloc_contiguous(struct kunit *test)
KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size, KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size,
2 * ps, ps, &allocated, 2 * ps, ps, &allocated,
DRM_BUDDY_CONTIGUOUS_ALLOCATION), DRM_BUDDY_CONTIGUOUS_ALLOCATION),
"buddy_alloc hit an error size=%d\n", 2 * ps); "buddy_alloc hit an error size=%u\n", 2 * ps);
drm_buddy_free_list(&mm, &left); drm_buddy_free_list(&mm, &left);
KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size, KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size,
3 * ps, ps, &allocated, 3 * ps, ps, &allocated,
DRM_BUDDY_CONTIGUOUS_ALLOCATION), DRM_BUDDY_CONTIGUOUS_ALLOCATION),
"buddy_alloc hit an error size=%d\n", 3 * ps); "buddy_alloc hit an error size=%u\n", 3 * ps);
total = 0; total = 0;
list_for_each_entry(block, &allocated, link) list_for_each_entry(block, &allocated, link)
......
...@@ -387,7 +387,7 @@ static void ttm_pool_free_range(struct ttm_pool *pool, struct ttm_tt *tt, ...@@ -387,7 +387,7 @@ static void ttm_pool_free_range(struct ttm_pool *pool, struct ttm_tt *tt,
enum ttm_caching caching, enum ttm_caching caching,
pgoff_t start_page, pgoff_t end_page) pgoff_t start_page, pgoff_t end_page)
{ {
struct page **pages = tt->pages; struct page **pages = &tt->pages[start_page];
unsigned int order; unsigned int order;
pgoff_t i, nr; pgoff_t i, nr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment