panvk: Force a cacheline alignment when allocating objects from WB shared pools

When allocating individual objects from a shared pool, we don't want
objects to share cachelines, otherwise cache maintenance operations on
individual objects might corrupt other objects.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36385>
This commit is contained in:
Boris Brezillon 2025-09-18 09:37:12 +02:00
parent 1c7793ea0b
commit f60d2aa545

View file

@ -141,6 +141,16 @@ panvk_pool_alloc_backing(struct panvk_pool *pool, size_t sz)
struct panvk_priv_mem
panvk_pool_alloc_mem(struct panvk_pool *pool, struct panvk_pool_alloc_info info)
{
struct panvk_physical_device *pdev =
to_panvk_physical_device(pool->dev->vk.physical);
/* Make sure objects allocated from shared BOs are aligned on a cacheline. */
if (!pool->props.owns_bos &&
(pool->props.create_flags & PAN_KMOD_BO_FLAG_WB_MMAP)) {
info.alignment =
MAX2(pdev->vk.properties.nonCoherentAtomSize, info.alignment);
}
assert(info.alignment == util_next_power_of_two(info.alignment));
if (pool->props.needs_locking)