From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF1FF410D15 for ; Wed, 29 Apr 2026 18:33:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777487593; cv=pass; b=JTkrKsEUN6FTFv0f16/mA6S7vpUc1+O8baZD923JkpVQLq8HHYMf1M8zj0FzKAp9FI2EpfNlfBaN9tcRmLAG8S1HykbppLs2xc5SiV0EoaEpw5Yql9Zegm0we6A+rI/ODIb29lNmGE70CTcJiDlBcnZpuNpxbRY4CgVqFtYdjMo= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777487593; c=relaxed/simple; bh=re/KYKLnIg+YkexERPDF5Ajq0Kb86F5UikaX7yhWWqY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=qDFQ+X+mzJ6BBY4bxjiSoeqhG39O54Q/3Lo8j1kj9z1Lz9hf1/o4wlshga7/NhGGLCkWhagxEWivjBlsecPgJIk9E2CCCFGr8hWo/IegTl7TNinntq5FUbX4Ao1pFhk3c6FZ9IVDKUXvNWhbgZahCDazTaXgxZ3r5BK+9wOPnMw= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b=R7w8KRfN; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b="R7w8KRfN" ARC-Seal: i=1; a=rsa-sha256; t=1777487583; cv=none; d=zohomail.com; s=zohoarc; b=VxzSigshzm8N+XLgnwvlraQ7KiJSYTlIgWgIth2i7aqDOo3X7E2jlb2GeDhvuGjNfGHbbd2zHuxEo5cCeZ7Vipk4DfP6jfRhomituOoEzC2/ZksWB49KWrVZAUMVZlenaFkmpQJSyaPqzecyHmoYkr/+RCwIsDKynhCUIQYIzbI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777487583; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=T1XAvqKQ8kNl1pfBdBhLcZ+NAaNaR/wGfnRQ6tTjurE=; b=h1lJc6QNWQABTMres1XJfMngmy4GY4DgfEyCKqaZGIJXOUeDE9cRQmpjNQvmL/j0yYv2nFl160pf1ENVBbbXCPTZW+ksh8lYeRf/XuooWG0JkSSl6tFQbTgUB95jXzL4wMbdC6emsrHsBAWeT57/rf5lX+YzlrbtUua2GzcskXI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=adrian.larumbe@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1777487583; s=zohomail; d=collabora.com; i=adrian.larumbe@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=T1XAvqKQ8kNl1pfBdBhLcZ+NAaNaR/wGfnRQ6tTjurE=; b=R7w8KRfNo+kIPhxiclWJk8HT9dj1iVHa9/ZhXjLd7nJ0nDVtkpMdHua5jSjhOYzJ +4YaosJhC6cMegCykIXFsGYt5/8wbYv15AzScHuARPR59ofAbGzKFch2WBfjanlceSK 2IdHm+xAY62r5Ru3YInDBUSnZhvDnlmd/mB6LndI= Received: by mx.zohomail.com with SMTPS id 177748758255049.62677130764098; Wed, 29 Apr 2026 11:33:02 -0700 (PDT) From: =?UTF-8?q?Adri=C3=A1n=20Larumbe?= To: linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, Steven Price , Boris Brezillon , kernel@collabora.com, =?UTF-8?q?Adri=C3=A1n=20Larumbe?= Subject: [PATCH v10 0/6] Support sparse mappings in Panthor Date: Wed, 29 Apr 2026 19:32:12 +0100 Message-ID: <20260429183253.66422-1-adrian.larumbe@collabora.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch series implements sparse mappings in Panthor. Owing to the lack of HW MMU features for sparse page table entries, this had to be implemented using a dummy object over which sparse mappings requested over VM_BIND are mapped cyclically. To that end, a new VM_BIND flag was added in the driver's uAPI. The end goal of this patch series is to improve support of Vulkan sparse resources. At the moment, to implement this feature on Mali hardware, Vulkan sparse map is implemented by mapping the specified region to a "dummy bo" so that the accesses do not fault. A newly created sparse resource starts off unmapped, and therefore also has to be mapped to the "dummy bo". This "dummy bo" is small (a page size) in comparison to the sizes of va ranges that we might want to map to it, and a large number of vm_bind ops can be necessary. For example, if the user were to create a 100e6-byte sparse resident resource, we'd have to poke VM_BIND with ceil(100e6/0x1000)=24415 map operations. The new VM_BIND sparse mapping feature addresses this particular inefficiency by letting us implement a single Vulkan sparse map operation and sparse resident resource initialization with just one map operation. Link to the conversation for the previous patch series revision at: https://lore.kernel.org/dri-devel/20260422122538.3117380-1-adrian.larumbe@collabora.com Changes in v10: - Fixed uAPI enum ordering issue - Reworked sparse mapping by hardcoding size of dummy object. - Added missing cleanup in case dummy object fails to allocate - Other minor fixes. Changes in v9: - Addressed some nits. - Rearranged argument checks for vm_bind to profit from compiler optimisations. - Added some further comments. Changes in v8: - Allocate a single 2MiB BO as a dummy buffer for sparse mappings. Let its pages be retrieved just like for any other BO during a map operation. - Removed locking around allocation of the dummy BO by doing it right at the time of a VMA pool creation. - Some minor style fixes. - Refactor low level page mapping code in sm_remap and sm_map. - Made NO_EXEC a mandatory flag for sparse mappings. - Actually bumped the driver's minor revision number. Changes in v7: - Switched back to Panthor BO-backed dummy object instead of raw pages so as to profit from the existing shrinker reclaim paths. - Created Dummy BO's per file context to avoid information leaking between them. - Reorganised some of the low-level page mapping code. - Added commits deleting spurious white space and unused op contex field. Changes in v6: - Moved all the GPUVM core code into the driver backend. - Discarded commits that touch on the gpuvm core too. - Redesigned the uAPI so that no repeat range or user BO is supplied for sparse mappings. - Replaced user-supplied BO with a kernel-allocated array of raw pages. Changes in v5: - Minor fixes to drm_gpuvm.c. - Add panthor MMU page sizes device queriable param. - Add helper to make sure unmaps of repeated regions are correct. - Some fixes to Panthor's repeat mappings implementation. - Lump arguments to panthor_vm_prepare_map_op_ctx into a single struct. Changes in v4: - Fixed the warnings reported by the kernel test robot. https://lore.kernel.org/oe-kbuild-all/202507041635.WyDu3TQ1-lkp@intel.com/ - Fixed the warnings reported by the CI. https://patchwork.freedesktop.org/series/151264/ No changes in v3. Changes in v2: - Make panthor use this stuff. - Make it possible to express a repeated mappina of any suitably sized and aligned range of a BO, rather than strictly the page size -sized prefix, generalizing the API. Rename DRM_GPUVA_SINGLE_PAGE to DRM_GPUVA_REPEAT. - Clean up parts of drm/gpuvm affected by these changes. Adrián Larumbe (6): drm/panthor: Expose GPU page sizes to UM drm/panthor: Pass vm_bind_op to vm_prepare_map_op_ctx drm/panthor: Delete spurious whitespace from uAPI header drm/panthor: Remove unused operation context field drm/panthor: Support sparse mappings drm/panthor: Bump the driver version to 1.9 drivers/gpu/drm/panthor/panthor_device.h | 3 + drivers/gpu/drm/panthor/panthor_drv.c | 12 +- drivers/gpu/drm/panthor/panthor_gem.c | 18 ++ drivers/gpu/drm/panthor/panthor_gem.h | 2 + drivers/gpu/drm/panthor/panthor_mmu.c | 201 ++++++++++++++++++----- include/uapi/drm/panthor_drm.h | 26 ++- 6 files changed, 218 insertions(+), 44 deletions(-) base-commit: 9a096b8879801a597c06c1a69d41c827458cea60 prerequisite-patch-id: 0000000000000000000000000000000000000000 -- 2.53.0